From e68666a80db37d8f720ec69e4f59b9ebb7e6c487 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Tue, 23 Nov 2021 22:57:13 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=99=E5=95=86=E5=93=81=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BF=9D=E8=B4=A8=E6=9C=9F=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=EF=BC=8C=E7=BB=99=E5=95=86=E5=93=81=E5=AF=BC=E5=85=A5=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=9D=A1=E7=A0=81=E9=87=8D=E5=A4=8D=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../erp/service/material/MaterialService.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java index 2c01ccc1..9c532349 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java @@ -471,7 +471,7 @@ public class MaterialService { String model = ExcelUtils.getContent(src, i, 2); //型号 String color = ExcelUtils.getContent(src, i, 3); //颜色 String categoryName = ExcelUtils.getContent(src, i, 4); //类别 - String safetyStock = ExcelUtils.getContent(src, i, 5); //安全存量 + String expiryNum = ExcelUtils.getContent(src, i, 5); //保质期 String unit = ExcelUtils.getContent(src, i, 6); //基础单位 //校验名称、单位是否为空 if(StringUtil.isNotEmpty(name) && StringUtil.isNotEmpty(unit)) { @@ -484,6 +484,9 @@ public class MaterialService { if(null!=categoryId){ m.setCategoryId(categoryId); } + if(StringUtil.isNotEmpty(expiryNum)) { + m.setExpiryNum(Integer.parseInt(expiryNum)); + } String manyUnit = ExcelUtils.getContent(src, i, 7); //副单位 String barCode = ExcelUtils.getContent(src, i, 8); //基础条码 String manyBarCode = ExcelUtils.getContent(src, i, 9); //副条码 @@ -492,6 +495,18 @@ public class MaterialService { String commodityDecimal = ExcelUtils.getContent(src, i, 12); //零售价 String wholesaleDecimal = ExcelUtils.getContent(src, i, 13); //销售价 String lowDecimal = ExcelUtils.getContent(src, i, 14); //最低售价 + String enabled = ExcelUtils.getContent(src, i, 15); //状态 + //校验条码是否存在 + List basicMaterialList = getMaterialByBarCode(barCode); + if(basicMaterialList!=null && basicMaterialList.size()>0) { + throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_EXISTS_CODE, + String.format(ExceptionConstants.MATERIAL_BARCODE_EXISTS_MSG, barCode)); + } + List otherMaterialList = getMaterialByBarCode(manyBarCode); + if(otherMaterialList!=null && otherMaterialList.size()>0) { + throw new BusinessRunTimeException(ExceptionConstants.MATERIAL_BARCODE_EXISTS_CODE, + String.format(ExceptionConstants.MATERIAL_BARCODE_EXISTS_MSG, manyBarCode)); + } JSONObject materialExObj = new JSONObject(); JSONObject basicObj = new JSONObject(); basicObj.put("barCode", barCode); @@ -522,7 +537,6 @@ public class MaterialService { m.setUnit(unit); } m.setMaterialExObj(materialExObj); - String enabled = ExcelUtils.getContent(src, i, 15); //状态 m.setEnabled(enabled.equals("1")? true: false); //缓存各个仓库的库存信息 Map stockMap = new HashMap();