|
@@ -2,6 +2,7 @@ package com.gree.mall.manager.logic.material.base;
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.gree.mall.manager.bean.admin.AdminUserCom;
|
|
@@ -408,16 +409,16 @@ public class WebsitGoodsLogic {
|
|
|
for (int i = 0; i < objects.size(); i++) {
|
|
|
List<Object> row = (List<Object>) objects.get(i);
|
|
|
CommonUtils.initList2(row, 12);
|
|
|
- if (row.size() < 7) {
|
|
|
+ if (row.size() < 8) {
|
|
|
row.add(null);
|
|
|
row.add(null);
|
|
|
row.add(null);
|
|
|
}
|
|
|
- if (row.size() < 8) {
|
|
|
+ if (row.size() < 9) {
|
|
|
row.add(null);
|
|
|
row.add(null);
|
|
|
}
|
|
|
- if (row.size() < 9) {
|
|
|
+ if (row.size() < 10) {
|
|
|
row.add(null);
|
|
|
}
|
|
|
if (Objects.isNull(row.get(0))) {
|
|
@@ -430,12 +431,18 @@ public class WebsitGoodsLogic {
|
|
|
throw new RemoteServiceException("第" + (i+1) + "行, 辅材名称不能为空");
|
|
|
}
|
|
|
if (Objects.isNull(row.get(3))) {
|
|
|
- throw new RemoteServiceException("第" + (i+1) + "行, 单位不能为空");
|
|
|
+ throw new RemoteServiceException("第" + (i+1) + "行, 库存单位不能为空");
|
|
|
}
|
|
|
if (Objects.isNull(row.get(4))) {
|
|
|
- throw new RemoteServiceException("第" + (i+1) + "行, 采购价格不能为空");
|
|
|
+ throw new RemoteServiceException("第" + (i+1) + "行, 销售单位不能为空");
|
|
|
}
|
|
|
if (Objects.isNull(row.get(5))) {
|
|
|
+ throw new RemoteServiceException("第" + (i+1) + "行, 销售单位不能为空");
|
|
|
+ }
|
|
|
+ if (Objects.isNull(row.get(6))) {
|
|
|
+ throw new RemoteServiceException("第" + (i+1) + "行, 采购价格不能为空");
|
|
|
+ }
|
|
|
+ if (Objects.isNull(row.get(7))) {
|
|
|
throw new RemoteServiceException("第" + (i+1) + "行, 销售价格不能为空");
|
|
|
}
|
|
|
|
|
@@ -443,13 +450,14 @@ public class WebsitGoodsLogic {
|
|
|
String categoryStr = (String) row.get(1);
|
|
|
String goodsNameStr = (String) row.get(2);
|
|
|
String unitStr = (String) row.get(3);
|
|
|
- String costStr = (String) row.get(4);
|
|
|
- String salesStr = (String) row.get(5);
|
|
|
- String goodsCodeStr = (String) row.get(6);
|
|
|
- String specificationStr = (String) row.get(7);
|
|
|
- String remark = (String) row.get(8);
|
|
|
- String manageWorkerStock = (String) row.get(9);
|
|
|
- String salesConvertQty = (String) row.get(9);
|
|
|
+ String saleUnitStr = (String) row.get(4);
|
|
|
+ String costStr = (String) row.get(5);
|
|
|
+ String salesStr = (String) row.get(6);
|
|
|
+ String goodsCodeStr = (String) row.get(7);
|
|
|
+ String specificationStr = (String) row.get(8);
|
|
|
+ String remark = (String) row.get(9);
|
|
|
+ String manageWorkerStock = (String) row.get(10);
|
|
|
+ String salesConvertQty = (String) row.get(11);
|
|
|
|
|
|
if (!treeMap.containsKey(parentCategoryStr)) {
|
|
|
throw new RemoteServiceException("第" + (i+1) + "行, 大类信息不存在");
|
|
@@ -477,7 +485,11 @@ public class WebsitGoodsLogic {
|
|
|
}
|
|
|
|
|
|
if (!unitList.contains(unitStr)) {
|
|
|
- throw new RemoteServiceException("第" + (i+1) + "行, 单位信息不存在");
|
|
|
+ throw new RemoteServiceException("第" + (i+1) + "行, 库存单位信息不存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!unitList.contains(saleUnitStr)) {
|
|
|
+ throw new RemoteServiceException("第" + (i+1) + "行, 销售单位信息不存在");
|
|
|
}
|
|
|
|
|
|
WebsitGoods goods = new WebsitGoods();
|
|
@@ -494,9 +506,8 @@ public class WebsitGoodsLogic {
|
|
|
goods.setCost(new BigDecimal(costStr));
|
|
|
goods.setMarketPrice(new BigDecimal(salesStr));
|
|
|
|
|
|
- // 库存单位与销售单位一致
|
|
|
- goods.setGoodsStockUnit(unitStr);
|
|
|
- goods.setGoodsSalesUnit(unitStr);
|
|
|
+ goods.setGoodsStockUnit(StrUtil.trim(unitStr));
|
|
|
+ goods.setGoodsSalesUnit(StrUtil.trim(saleUnitStr));
|
|
|
if (StringUtils.isBlank(manageWorkerStock) || manageWorkerStock.equals(JudgeEnum.YES.getRemark())) {
|
|
|
goods.setManageWorkerStock(JudgeEnum.YES.getKey());
|
|
|
} else {
|
|
@@ -679,8 +690,8 @@ public class WebsitGoodsLogic {
|
|
|
|
|
|
|
|
|
// 库存单位与销售单位一致
|
|
|
- goods.setGoodsStockUnit(unitStr);
|
|
|
- goods.setGoodsSalesUnit(unitStr);
|
|
|
+ goods.setGoodsStockUnit(StrUtil.trim(unitStr));
|
|
|
+ goods.setGoodsSalesUnit(StrUtil.trim(unitStr));
|
|
|
goods.setManageWorkerStock(JudgeEnum.YES.getKey());
|
|
|
goods.setNormType(NormTypeEnum.M.getKey());
|
|
|
goods.setPartType(partType);
|
|
@@ -777,8 +788,8 @@ public class WebsitGoodsLogic {
|
|
|
|
|
|
|
|
|
// 库存单位与销售单位一致
|
|
|
- goods.setGoodsStockUnit(unitStr);
|
|
|
- goods.setGoodsSalesUnit(unitStr);
|
|
|
+ goods.setGoodsStockUnit(StrUtil.trim(unitStr));
|
|
|
+ goods.setGoodsSalesUnit(StrUtil.trim(unitStr));
|
|
|
goods.setManageWorkerStock(JudgeEnum.YES.getKey());
|
|
|
goods.setNormType(NormTypeEnum.S.getKey());
|
|
|
|