Sfoglia il codice sorgente

订单导入增加内容校验,去除保障平台产线

yejian 3 anni fa
parent
commit
de1b36c1f8

+ 3 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/OrderServiceImpl.java

@@ -1128,7 +1128,9 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
            List<ZZone> zZones = zZoneMapper.selectList(zZoneWrapper);
            List<String> zZoneList = new ArrayList<>();
            for(ZZone zZone: zZones){
-               zZoneList.add(zZone.getId() + "-"+ zZone.getName());
+               if(!zZone.getName().contains("保障")){
+                   zZoneList.add(zZone.getId() + "-"+ zZone.getName());
+               }
            }
            String[] zZoneInfos = new String[zZoneList.size()];
            zZoneList.toArray(zZoneInfos);

+ 46 - 3
imcs-admin-boot/imcs-business-controller/src/main/java/com/github/zuihou/business/controller/operationManagementCenter/OrderController.java

@@ -49,6 +49,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.map.HashedMap;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
@@ -246,6 +247,16 @@ public class OrderController extends SuperController<OrderService, Long, Order,
             return this.validFail("导入订单数据不完整");
         }
 
+        if(!StringUtils.isBlank(orderInfo.get(3).toString())){
+            try{
+                DateUtil.stringToDate3(orderInfo.get(3).toString());
+            }catch (Exception e){
+                return this.validFail("导入订单数据第2行下单日期格式不正确");
+            }
+        }else{
+            return this.validFail("导入订单数据第2行下单日期格式不正确");
+        }
+
         String zZoneInfo = String.valueOf(orderInfo.get(5));
         String[] zZoneInfos = zZoneInfo.split("-");
         if(zZoneInfos.length != 2){
@@ -260,31 +271,63 @@ public class OrderController extends SuperController<OrderService, Long, Order,
         order.setOrderTime(DateUtil.stringToDate3(String.valueOf(orderInfo.get(3))));
 
         List<Map> detailList = new ArrayList<>();
+        String maxdeliveryTime=null;
         for(int i = 0; i < excelOrders.size(); i++){
             // 遍历订单产品
+            int lineCount = i+1;
             if(i > 1){
                 Map orderProduct = new HashedMap();
                 List<Object> line = excelOrders.get(i);
                 // 零件
                 String[] bbomInfos = String.valueOf(line.get(0)).split("-");
                 if(bbomInfos.length != 2){
-                    return this.validFail("导入订单数据第" + "行零件名称不正确");
+                    return this.validFail("导入订单数据第" + lineCount + "行零件名称不正确");
                 }
                 orderProduct.put("bomId",bbomInfos[0]);
 
                 // 原材料原炉号
                 String[] furnaceBatchNoInfos = String.valueOf(line.get(1)).split("-");
                 if(furnaceBatchNoInfos.length != 4){
-                    return this.validFail("导入订单数据第" + "行零件原材料原炉批号不正确");
+                    return this.validFail("导入订单数据第" + lineCount + "行零件原材料原炉批号不正确");
+                }
+                String excelDeliveryTime = line.get(3).toString();
+                if(StringUtils.isBlank(maxdeliveryTime)){
+                    if(StringUtils.isNotBlank(excelDeliveryTime)){
+                        try{
+                            DateUtil.stringToDate3(maxdeliveryTime.toString());
+                        }catch (Exception e){
+                            return this.validFail("导入订单数据第" + lineCount + "行交付日期格式不正确");
+                        }
+
+                        maxdeliveryTime = excelDeliveryTime.toString();
+                    }else{
+                        return this.validFail("导入订单数据第" + lineCount + "行交付日期格式不正确");
+                    }
+                }else{
+                    if(StringUtils.isNotBlank(excelDeliveryTime)){
+                        try{
+                            DateUtil.stringToDate3(maxdeliveryTime.toString());
+                        }catch (Exception e){
+                            return this.validFail("导入订单数据第" + lineCount + "行交互日期格式不正确");
+                        }
+                        if(maxdeliveryTime.compareTo(excelDeliveryTime.toString()) < 0){
+                            maxdeliveryTime =  excelDeliveryTime.toString();
+                        }
+                    }else{
+                        return this.validFail("导入订单数据第" + lineCount + "行交付日期格式不正确");
+                    }
                 }
                 orderProduct.put("furnaceBatchNo",furnaceBatchNoInfos[2]);
                 orderProduct.put("bomNum",line.get(2));
-                orderProduct.put("deliveryTime",line.get(3));
+                orderProduct.put("deliveryTime",excelDeliveryTime);
                 orderProduct.put("remark",line.get(4));
 
                 detailList.add(orderProduct);
             }
         }
+        if(null != maxdeliveryTime){
+            order.setDeliveryTime(DateUtil.stringToDate3(maxdeliveryTime.toString()));
+        }
         return baseService.saveExcelOrder(order,detailList);
 
     }