|
@@ -981,10 +981,10 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
|
|
|
|
/**
|
|
|
* 缓存各个仓库的库存信息
|
|
|
- * @param src
|
|
|
+ * @param src 行数据
|
|
|
* @param depotCount
|
|
|
* @param depotMap
|
|
|
- * @param i
|
|
|
+ * @param i 行数
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
@@ -1058,8 +1058,8 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
|
}
|
|
|
}
|
|
|
//EXCEL中有条码在系统中已存在
|
|
|
- int count = materialExtendService.getCountByManyBarCodeWithoutUs(barCode, barCode);
|
|
|
- if (count>0) {
|
|
|
+ MaterialExtend materialExtend = materialExtendService.getInfoByBarCode(barCode);
|
|
|
+ if (materialExtend != null && !materialExtend.getBarCode().isEmpty()) {
|
|
|
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_EXCEL_IMPORT_BARCODE_SYSTEM_EXIST_CODE,
|
|
|
String.format(ExceptionConstants.MATERIAL_EXCEL_IMPORT_BARCODE_SYSTEM_EXIST_MSG, barCode));
|
|
|
}
|
|
@@ -1746,8 +1746,6 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
|
String otherField2 = ExcelUtils.getContent(src, i, 14); //自定义2
|
|
|
String otherField3 = ExcelUtils.getContent(src, i, 15); //自定义3
|
|
|
String remark = ExcelUtils.getContent(src, i, 16); //备注
|
|
|
- String depotName = ExcelUtils.getContent(src, i, 17); //仓库名称
|
|
|
- String position = ExcelUtils.getContent(src, i, 18); //仓位货架
|
|
|
//校验字段
|
|
|
//名称为空
|
|
|
if(StringUtil.isEmpty(name)) {
|
|
@@ -1810,16 +1808,16 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
|
}
|
|
|
//批量校验excel中有无重复条码(1-文档自身校验,2-和数据库里面的商品校验)
|
|
|
batchCheckExistBarCodeByParam(mList, barCode, null);
|
|
|
- Long depotId = null;
|
|
|
- if(StringUtil.isNotEmpty(depotName)) {
|
|
|
- //根据仓库名查询仓库id
|
|
|
- depotId = depotMapperEx.selectByConditionDepot(depotName,null,null).get(0).getId();
|
|
|
- if (depotId == null){
|
|
|
- //仓库不存在
|
|
|
- throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_DEPOT_NOT_DECIMAL_CODE,
|
|
|
- String.format(ExceptionConstants.MATERIAL_DEPOT_NOT_DECIMAL_MSG, i+1));
|
|
|
- }
|
|
|
- }
|
|
|
+// Long depotId = null;
|
|
|
+// if(StringUtil.isNotEmpty(depotName)) {
|
|
|
+// //根据仓库名查询仓库id
|
|
|
+// depotId = depotMapperEx.selectByConditionDepot(depotName,null,null).get(0).getId();
|
|
|
+// if (depotId == null){
|
|
|
+// //仓库不存在
|
|
|
+// throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_DEPOT_NOT_DECIMAL_CODE,
|
|
|
+// String.format(ExceptionConstants.MATERIAL_DEPOT_NOT_DECIMAL_MSG, i+1));
|
|
|
+// }
|
|
|
+// }
|
|
|
MaterialWithInitStock m = new MaterialWithInitStock();
|
|
|
//设置商品名字、规格、型号、颜色、品牌、类型id
|
|
|
m.setName(name);
|
|
@@ -1854,18 +1852,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
|
JSONObject materialExObj = new JSONObject();
|
|
|
JSONObject basicObj = new JSONObject();
|
|
|
basicObj.put("commodityUnit", manyUnit.isEmpty() ? unit : manyUnit); //商品单位
|
|
|
- //basicObj.put("sku", sku); //商品属性
|
|
|
-// basicObj.put("purchaseDecimal", purchaseDecimal); //采购价格
|
|
|
-// basicObj.put("commodityDecimal", commodityDecimal); //零售价格
|
|
|
-// basicObj.put("wholesaleDecimal", wholesaleDecimal); //销售价格
|
|
|
-// basicObj.put("lowDecimal", lowDecimal); //最低售价
|
|
|
-// basicObj.put("productionDate",productionDate); //生产日期
|
|
|
-// basicObj.put("expiryNum",expiryNum); //保质期天数
|
|
|
-// basicObj.put("supplierId",supplierId); //供应商id
|
|
|
basicObj.put("barCode", barCode); //商品条码
|
|
|
-// basicObj.put("inventory",inventory); //库存
|
|
|
- basicObj.put("depotId",depotId); //仓库id
|
|
|
- basicObj.put("position",position); //仓位货架
|
|
|
materialExObj.put("basic", basicObj);
|
|
|
if(StringUtil.isNotEmpty(manyUnit) && StringUtil.isNotEmpty(ratio)){ //多单位
|
|
|
//校验比例是否是数字(含小数)
|
|
@@ -1878,19 +1865,12 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
|
m.setUnitId(unitId);
|
|
|
m.setUnit("");
|
|
|
}
|
|
|
-// JSONObject otherObj = new JSONObject();
|
|
|
-// otherObj.put("commodityUnit", manyUnit);
|
|
|
-// otherObj.put("purchaseDecimal", parsePrice(purchaseDecimal,ratio));
|
|
|
-// otherObj.put("commodityDecimal", parsePrice(commodityDecimal,ratio));
|
|
|
-// otherObj.put("wholesaleDecimal", parsePrice(wholesaleDecimal,ratio));
|
|
|
-// otherObj.put("lowDecimal", parsePrice(lowDecimal,ratio));
|
|
|
-// materialExObj.put("other", otherObj);
|
|
|
} else {
|
|
|
m.setUnit(unit);
|
|
|
m.setUnitId(null);
|
|
|
}
|
|
|
m.setMaterialExObj(materialExObj);
|
|
|
- //设置库存
|
|
|
+ //设置仓库库位
|
|
|
m.setStockMap(getStockMapCache(src, depotCount, depotMap, i));
|
|
|
mList.add(m);
|
|
|
}
|