|
...
|
...
|
@@ -1071,10 +1071,36 @@ func (c *OrderInfoController) ImportOrderFromExcel() { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 产品数量校验
|
|
|
|
productNumberError := make([]interface{}, 0)
|
|
|
|
|
|
|
|
// 批量创建订单命令集
|
|
|
|
var createOrderCommands []*orderCmd.CreateOrderCommand
|
|
|
|
for _, orderCommand := range orderCommands {
|
|
|
|
createOrderCommands = append(createOrderCommands, orderCommand)
|
|
|
|
if len(orderCommand.Goods) > 50 { // 产品数量校验
|
|
|
|
for _, line := range orderCommand.LineNumbers {
|
|
|
|
var tmpRow []string
|
|
|
|
tmpRow = append(tmpRow, "单笔订单产品超过50种") // 错误信息
|
|
|
|
s := strconv.Itoa(line + 1)
|
|
|
|
tmpRow = append(tmpRow, s) // 行号
|
|
|
|
tmpRow = append(tmpRow, rows[line]...) // 错误行数据
|
|
|
|
productNumberError = append(productNumberError, tmpRow)
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
createOrderCommands = append(createOrderCommands, orderCommand)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(productNumberError) > 0 {
|
|
|
|
ret = map[string]interface{}{
|
|
|
|
"successCount": 0,
|
|
|
|
"fail": map[string]interface{}{
|
|
|
|
"tableHeader": tableHeader,
|
|
|
|
"tableData": productNumberError,
|
|
|
|
},
|
|
|
|
}
|
|
|
|
c.ResponseData(ret)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
// 新增失败记录
|
...
|
...
|
|