|
@@ -1069,6 +1069,12 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
String.format(ExceptionConstants.MATERIAL_EXCEL_IMPORT_MANY_BARCODE_EXIST_MSG, manyBarCode));
|
|
String.format(ExceptionConstants.MATERIAL_EXCEL_IMPORT_MANY_BARCODE_EXIST_MSG, manyBarCode));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //EXCEL中有条码在系统中已存在
|
|
|
|
+ int count = materialExtendService.getCountByManyBarCodeWithoutUs(barCode, barCode);
|
|
|
|
+ if (count>0) {
|
|
|
|
+ throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_EXCEL_IMPORT_BARCODE_SYSTEM_EXIST_CODE,
|
|
|
|
+ String.format(ExceptionConstants.MATERIAL_EXCEL_IMPORT_BARCODE_SYSTEM_EXIST_MSG, barCode));
|
|
|
|
+ }
|
|
for(MaterialWithInitStock material: mList){
|
|
for(MaterialWithInitStock material: mList){
|
|
JSONObject materialExObj = material.getMaterialExObj();
|
|
JSONObject materialExObj = material.getMaterialExObj();
|
|
String basicBarCode = "";
|
|
String basicBarCode = "";
|
|
@@ -1807,6 +1813,18 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_ENABLED_ERROR_CODE,
|
|
throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_ENABLED_ERROR_CODE,
|
|
String.format(ExceptionConstants.MATERIAL_ENABLED_ERROR_MSG, i+1));
|
|
String.format(ExceptionConstants.MATERIAL_ENABLED_ERROR_MSG, i+1));
|
|
}
|
|
}
|
|
|
|
+ //商品条码为空
|
|
|
|
+ if(StringUtil.isEmpty(barCode)) {
|
|
|
|
+ throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_EMPTY_CODE,
|
|
|
|
+ String.format(ExceptionConstants.MATERIAL_BARCODE_EMPTY_MSG, i+1));
|
|
|
|
+ }
|
|
|
|
+ //校验基本条码长度为4到40位
|
|
|
|
+ if(!StringUtil.checkBarCodeLength(barCode)) {
|
|
|
|
+ throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_LENGTH_ERROR_CODE,
|
|
|
|
+ String.format(ExceptionConstants.MATERIAL_BARCODE_LENGTH_ERROR_MSG, barCode));
|
|
|
|
+ }
|
|
|
|
+ //批量校验excel中有无重复条码(1-文档自身校验,2-和数据库里面的商品校验)
|
|
|
|
+ batchCheckExistBarCodeByParam(mList, barCode, null);
|
|
Long depotId = null;
|
|
Long depotId = null;
|
|
if(StringUtil.isNotEmpty(depotName)) {
|
|
if(StringUtil.isNotEmpty(depotName)) {
|
|
//根据仓库名查询仓库id
|
|
//根据仓库名查询仓库id
|
|
@@ -1850,7 +1868,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
//设置商品拓展属性
|
|
//设置商品拓展属性
|
|
JSONObject materialExObj = new JSONObject();
|
|
JSONObject materialExObj = new JSONObject();
|
|
JSONObject basicObj = new JSONObject();
|
|
JSONObject basicObj = new JSONObject();
|
|
- basicObj.put("commodityUnit", unit); //商品单位
|
|
|
|
|
|
+ basicObj.put("commodityUnit", manyUnit.isEmpty() ? unit : manyUnit); //商品单位
|
|
//basicObj.put("sku", sku); //商品属性
|
|
//basicObj.put("sku", sku); //商品属性
|
|
// basicObj.put("purchaseDecimal", purchaseDecimal); //采购价格
|
|
// basicObj.put("purchaseDecimal", purchaseDecimal); //采购价格
|
|
// basicObj.put("commodityDecimal", commodityDecimal); //零售价格
|
|
// basicObj.put("commodityDecimal", commodityDecimal); //零售价格
|
|
@@ -1924,6 +1942,8 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public List<PDADepotItemVO> inventoryInquiry(PDAInventoryDTO pdaInventoryDTO) throws Exception {
|
|
public List<PDADepotItemVO> inventoryInquiry(PDAInventoryDTO pdaInventoryDTO) throws Exception {
|
|
|
|
+
|
|
|
|
+ pdaInventoryDTO.setMaterialIds(materialInitialStockMapper.selectMaterialIdByPosition(pdaInventoryDTO.getPosition()));
|
|
//查询类型id的子类型
|
|
//查询类型id的子类型
|
|
pdaInventoryDTO.setCategoryIds(selectCategoryIds(pdaInventoryDTO.getCategoryId()));
|
|
pdaInventoryDTO.setCategoryIds(selectCategoryIds(pdaInventoryDTO.getCategoryId()));
|
|
return materialMapperEx.inventoryInquiry(pdaInventoryDTO);
|
|
return materialMapperEx.inventoryInquiry(pdaInventoryDTO);
|
|
@@ -1934,7 +1954,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public List<PDATypeTree> selectPosition() {
|
|
public List<PDATypeTree> selectPosition() {
|
|
- List<String> positions = materialExtendMapper.selectPosition();
|
|
|
|
|
|
+ List<String> positions = materialInitialStockMapper.selectPosition();
|
|
Map<String,List<String>> map = new HashMap<>();
|
|
Map<String,List<String>> map = new HashMap<>();
|
|
for (String s : positions) {
|
|
for (String s : positions) {
|
|
String [] str = s.split("-");
|
|
String [] str = s.split("-");
|
|
@@ -2009,8 +2029,7 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
+ "-" + m.getStandard()
|
|
+ "-" + m.getStandard()
|
|
+ "-" + m.getBrand()
|
|
+ "-" + m.getBrand()
|
|
+ "-" + m.getColor()
|
|
+ "-" + m.getColor()
|
|
- + "-" + m.getUnit()
|
|
|
|
- + "-" + materialSku;
|
|
|
|
|
|
+ + "-" + m.getUnit();
|
|
if (materialMap.get(str) == null) {
|
|
if (materialMap.get(str) == null) {
|
|
//商品主表不存在,创建商品主表
|
|
//商品主表不存在,创建商品主表
|
|
Material material = new Material();
|
|
Material material = new Material();
|
|
@@ -2055,34 +2074,12 @@ public class MaterialServiceImpl extends ServiceImpl<MaterialMapper, Material> i
|
|
//添加子表信息
|
|
//添加子表信息
|
|
MaterialExtend materialExtend = new MaterialExtend();
|
|
MaterialExtend materialExtend = new MaterialExtend();
|
|
//商品单位
|
|
//商品单位
|
|
- materialExtend.setCommodityUnit(m.getUnit());
|
|
|
|
|
|
+ materialExtend.setCommodityUnit(basicObj.getString("commodityUnit"));
|
|
//商品属性
|
|
//商品属性
|
|
materialExtend.setSku(materialSku);
|
|
materialExtend.setSku(materialSku);
|
|
- //采购价格
|
|
|
|
- materialExtend.setPurchaseDecimal(basicObj.getBigDecimal("purchaseDecimal"));
|
|
|
|
- //零售价格
|
|
|
|
- materialExtend.setCommodityDecimal(basicObj.getBigDecimal("commodityDecimal"));
|
|
|
|
- //销售价格
|
|
|
|
- materialExtend.setWholesaleDecimal(basicObj.getBigDecimal("wholesaleDecimal"));
|
|
|
|
- //最低售价
|
|
|
|
- materialExtend.setLowDecimal(basicObj.getBigDecimal("lowDecimal"));
|
|
|
|
- //生产日期
|
|
|
|
- materialExtend.setProductionDate(basicObj.getDate("productionDate"));
|
|
|
|
- //保质期天数
|
|
|
|
- materialExtend.setExpiryNum(basicObj.getInteger("expiryNum"));
|
|
|
|
- //供应商id
|
|
|
|
- materialExtend.setSupplierId(basicObj.getLong("supplierId"));
|
|
|
|
//商品条码
|
|
//商品条码
|
|
materialExtend.setBarCode(basicObj.getString("barCode"));
|
|
materialExtend.setBarCode(basicObj.getString("barCode"));
|
|
- //设置批次号
|
|
|
|
- String batchNumber = DateUtils.dateTimeNow("yyyyMMdd") + RandomHelper.getRandomStr(6);
|
|
|
|
- materialExtend.setBatchNumber(batchNumber);
|
|
|
|
- //仓库id
|
|
|
|
- materialExtend.setDepotId(basicObj.getLong("depotId"));
|
|
|
|
- //仓位货架
|
|
|
|
- materialExtend.setPosition(basicObj.getString("position"));
|
|
|
|
- //库存
|
|
|
|
- materialExtend.setInventory(basicObj.getBigDecimal("inventory"));
|
|
|
|
|
|
+
|
|
materialMap.get(str).getList().add(materialExtend);
|
|
materialMap.get(str).getList().add(materialExtend);
|
|
}
|
|
}
|
|
materialMap.values().forEach(v -> materials.add(v));
|
|
materialMap.values().forEach(v -> materials.add(v));
|