正在显示
1 个修改的文件
包含
27 行增加
和
1 行删除
| @@ -1071,10 +1071,36 @@ func (c *OrderInfoController) ImportOrderFromExcel() { | @@ -1071,10 +1071,36 @@ func (c *OrderInfoController) ImportOrderFromExcel() { | ||
| 1071 | } | 1071 | } |
| 1072 | } | 1072 | } |
| 1073 | 1073 | ||
| 1074 | + // 产品数量校验 | ||
| 1075 | + productNumberError := make([]interface{}, 0) | ||
| 1076 | + | ||
| 1074 | // 批量创建订单命令集 | 1077 | // 批量创建订单命令集 |
| 1075 | var createOrderCommands []*orderCmd.CreateOrderCommand | 1078 | var createOrderCommands []*orderCmd.CreateOrderCommand |
| 1076 | for _, orderCommand := range orderCommands { | 1079 | for _, orderCommand := range orderCommands { |
| 1077 | - createOrderCommands = append(createOrderCommands, orderCommand) | 1080 | + if len(orderCommand.Goods) > 50 { // 产品数量校验 |
| 1081 | + for _, line := range orderCommand.LineNumbers { | ||
| 1082 | + var tmpRow []string | ||
| 1083 | + tmpRow = append(tmpRow, "单笔订单产品超过50种") // 错误信息 | ||
| 1084 | + s := strconv.Itoa(line + 1) | ||
| 1085 | + tmpRow = append(tmpRow, s) // 行号 | ||
| 1086 | + tmpRow = append(tmpRow, rows[line]...) // 错误行数据 | ||
| 1087 | + productNumberError = append(productNumberError, tmpRow) | ||
| 1088 | + } | ||
| 1089 | + } else { | ||
| 1090 | + createOrderCommands = append(createOrderCommands, orderCommand) | ||
| 1091 | + } | ||
| 1092 | + } | ||
| 1093 | + | ||
| 1094 | + if len(productNumberError) > 0 { | ||
| 1095 | + ret = map[string]interface{}{ | ||
| 1096 | + "successCount": 0, | ||
| 1097 | + "fail": map[string]interface{}{ | ||
| 1098 | + "tableHeader": tableHeader, | ||
| 1099 | + "tableData": productNumberError, | ||
| 1100 | + }, | ||
| 1101 | + } | ||
| 1102 | + c.ResponseData(ret) | ||
| 1103 | + return | ||
| 1078 | } | 1104 | } |
| 1079 | 1105 | ||
| 1080 | // 新增失败记录 | 1106 | // 新增失败记录 |
-
请 注册 或 登录 后发表评论