Browse Source

入库的导入模板(采购入库、其他入库)增加生产日期字段

huang 23 giờ trước cách đây
mục cha
commit
45ceb5ae86

+ 33 - 2
src/main/java/com/jsh/erp/controller/DepotItemController.java

@@ -1028,7 +1028,7 @@ public class DepotItemController {
             } else {
                 List<Map<String, String>> detailList = new ArrayList<>();
                 for (int i = 2; i < src.getRows(); i++) {
-                    String depotName = "", barCode = "", num = "", unitPrice = "", taxRate = "", remark = "";
+                    String depotName = "", barCode = "",productionDate = "", num = "", unitPrice = "", taxRate = "", remark = "";
                     if("QGD".equals(prefixNo)) {
                         barCode = ExcelUtils.getContent(src, i, 0);
                         num = ExcelUtils.getContent(src, i, 2);
@@ -1045,12 +1045,42 @@ public class DepotItemController {
                         //采购入库
                         depotName = ExcelUtils.getContent(src, i, 0);
                         barCode = ExcelUtils.getContent(src, i, 1);
+                        productionDate = ExcelUtils.getContent(src, i, 3);
+                        String format = "yyyy-MM-dd";
+                        //校验日期格式
+                        if (!DateUtils.isDateValid(productionDate,format)){
+                            throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_PRODUCTION_DATE_TIME_CODE,
+                                    String.format(ExceptionConstants.DEPOT_ITEM_PRODUCTION_DATE_TIME_MSG, barCode));
+                        }
+                        num = ExcelUtils.getContent(src, i, 4);
+                        unitPrice = ExcelUtils.getContent(src, i, 5);
+                        taxRate = ExcelUtils.getContent(src, i, 6);
+                        remark = ExcelUtils.getContent(src, i, 7);
+                    }
+                    if("QTRK".equals(prefixNo)) {
+                        //其他入库
+                        depotName = ExcelUtils.getContent(src, i, 0);
+                        barCode = ExcelUtils.getContent(src, i, 1);
+                        productionDate = ExcelUtils.getContent(src, i, 3);
+                        String format = "yyyy-MM-dd";
+                        //校验日期格式
+                        if (!DateUtils.isDateValid(productionDate,format)){
+                            throw new BusinessRunTimeException(ExceptionConstants.DEPOT_ITEM_PRODUCTION_DATE_TIME_CODE,
+                                    String.format(ExceptionConstants.DEPOT_ITEM_PRODUCTION_DATE_TIME_MSG, barCode));
+                        }
+                        num = ExcelUtils.getContent(src, i, 4);
+                        unitPrice = ExcelUtils.getContent(src, i, 5);
+                        remark = ExcelUtils.getContent(src, i, 6);
+                    }
+                    if("XSCK".equals(prefixNo)) {
+                        depotName = ExcelUtils.getContent(src, i, 0);
+                        barCode = ExcelUtils.getContent(src, i, 1);
                         num = ExcelUtils.getContent(src, i, 3);
                         unitPrice = ExcelUtils.getContent(src, i, 4);
                         taxRate = ExcelUtils.getContent(src, i, 5);
                         remark = ExcelUtils.getContent(src, i, 6);
                     }
-                    if("QTRK".equals(prefixNo) || "QTCK".equals(prefixNo)) {
+                    if("QTCK".equals(prefixNo)) {
                         depotName = ExcelUtils.getContent(src, i, 0);
                         barCode = ExcelUtils.getContent(src, i, 1);
                         num = ExcelUtils.getContent(src, i, 3);
@@ -1064,6 +1094,7 @@ public class DepotItemController {
                     materialMap.put("unitPrice", unitPrice);
                     materialMap.put("taxRate", taxRate);
                     materialMap.put("remark", remark);
+                    materialMap.put("productionDate", productionDate);
                     detailList.add(materialMap);
                     barCodes += "'" + barCode + "',";
                 }