From d9aab59e3d4c8688eaf00c0d98f6926a218ff57f Mon Sep 17 00:00:00 2001
From: pang.jiabao <pang_jiabao@163.com>
Date: 星期一, 28 四月 2025 15:28:11 +0800
Subject: [PATCH] 拣货单出库完成,但是库存没减,日志埋点

---
 src/main/java/com/zy/asrs/utils/PlaExcelListener.java |   64 +++++++++++++++++++++++++++-----
 1 files changed, 54 insertions(+), 10 deletions(-)

diff --git a/src/main/java/com/zy/asrs/utils/PlaExcelListener.java b/src/main/java/com/zy/asrs/utils/PlaExcelListener.java
index 18fb046..b36cf1a 100644
--- a/src/main/java/com/zy/asrs/utils/PlaExcelListener.java
+++ b/src/main/java/com/zy/asrs/utils/PlaExcelListener.java
@@ -18,10 +18,7 @@
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 
 /**
  * Created by vincent on 2019-11-25
@@ -35,6 +32,7 @@
 
     private int total = 0;
     private int index = 1;
+    private String recordLog = "";
     private Long userId;
 
     public PlaExcelListener() {
@@ -69,11 +67,13 @@
         MatService matService = SpringUtils.getBean(MatService.class);
         Date now = new Date();
 
+
+
         // 鍟嗗搧
         if(Cools.isEmpty(excel.getBatch()) || Cools.isEmpty(excel.getPackageNo())){
-            return;
+            throw new CoolException("绗�" +  index++ + "鏁版嵁閿欒锛屽寘鍙锋垨鑰呮壒鍙蜂负绌�");
         }
-        Pla pla = plaService.selectByBatchAndPackageNo(excel.getBatch(),excel.getPackageNo());
+        Pla pla = plaService.selectByBatchAndPackageNo(excel.getBatch(),excel.getPackageNo(),excel.getBrand());
         if (pla == null) {
             pla = plaCreate(pla,excel,matService,nodeService);
             pla.setCreateTime(new Date());
@@ -87,20 +87,58 @@
 //                throw new CoolException("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屽晢鍝佺紪鐮侊細" + excel.getMatnr());
 //            }
             total++;
-        }else if(Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_0) || Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_1) || Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_00)){
+        }else if(Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_0) || Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_00) || Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_1) ){
             excel.setId(pla.getId());
             excel.setCreateTime(pla.getCreateTime());
             excel.setStatus(pla.getStatus());
             excel.setPakinTime(pla.getPakinTime());
             excel.setStash(pla.getStash());
-            excel.setLocNo(pla.getLocNo());
+            excel.setStockFreeze(pla.getStockFreeze());
+            if(Cools.isEmpty(excel.getLocNo())){
+                excel.setLocNo(pla.getLocNo());
+            }
             BeanUtils.copyProperties(excel,pla);
             pla = plaCreate(pla,excel,matService,nodeService);
             try {
                 plaService.updateById(pla);
+                recordLog = recordLog + index + "," + pla.getBatch() + "," + pla.getPackageNo() + ";" ;
             }catch (Exception e){
                 log.error("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屾壒鍙凤細" + excel.getBatch() + ", 鍖呭彿锛�" + excel.getPackageNo() + "鍘熷洜涓猴細" + e.getMessage());
                 throw new CoolException("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屾壒鍙凤細" + excel.getBatch() + ", 鍖呭彿锛�" + excel.getPackageNo() + "鍘熷洜涓猴細" + e.getMessage());
+            }
+            total++;
+        } else if (Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_2) || Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_3) || Cools.eq(pla.getStatus(),GlobleParameter.PLA_STATUS_4)) {
+            // 琛ヤ紶璐ㄩ噺鎸囨爣
+            pla.setProDate(excel.getProDate());
+            pla.setWeight(excel.getWeight());
+            pla.setPackageType(excel.getPackageType());
+            pla.setZpalletType(excel.getZpalletType());
+            pla.setFingerMelting(excel.getFingerMelting());
+            pla.setWater(excel.getWater());
+            pla.setFusingPoint(excel.getFusingPoint());
+            pla.setVadf1(excel.getVadf1());
+            pla.setVadf2(excel.getVadf2());
+            pla.setYellowness(excel.getYellowness());
+            pla.setOpacity(excel.getOpacity());
+            pla.setL(excel.getL());
+            pla.setA(excel.getA());
+            pla.setB(excel.getB());
+            pla.setFillIn(excel.getFillIn());
+            pla.setStr1(excel.getStr1());
+            pla.setStr2(excel.getStr2());
+            pla.setStr3(excel.getStr3());
+            pla.setStr4(excel.getStr4());
+            pla.setStr5(excel.getStr5());
+            pla.setStr6(excel.getStr6());
+            pla.setMassState(excel.getMassState());
+            pla.setProblem(excel.getProblem());
+            pla.setModifyTime(now);
+            try {
+                plaService.updateById(pla);
+                recordLog = recordLog + index + "," + pla.getBatch() + "," + pla.getPackageNo() + ";" ;
+            } catch (Exception e){
+                log.error("琛ヤ紶璐ㄩ噺鎸囨爣寮傚父锛屾壒鍙凤細" + excel.getBatch() + ", 鍖呭彿锛�" + excel.getPackageNo() + "鍘熷洜涓猴細" + e.getMessage());
+                throw new CoolException("琛ヤ紶璐ㄩ噺鎸囨爣寮傚父锛屾壒鍙凤細" + excel.getBatch() + ", 鍖呭彿锛�" + excel.getPackageNo() + "鍘熷洜涓猴細" + e.getMessage());
             }
             total++;
         }
@@ -145,7 +183,10 @@
                     pla.setWorkshop("涓夎溅闂�");
                 }
             }else if ("鏀规�ф爲鑴�".equals(pla.getType())){
-                if ("01".equals(line) || "02".equals(line) || "03".equals(line) || "04".equals(line)){
+                if (pla.getBrand() != null && (pla.getBrand().equals("161") || pla.getBrand().equals("171") || pla.getBrand().equals("181"))) {
+                    pla.setOwner(OWNER_HZ);
+                    pla.setWorkshop("涓�杞﹂棿");
+                } else if ("01".equals(line) || "02".equals(line) || "03".equals(line) || "04".equals(line)){
                     pla.setOwner(OWNER_HNE);
                     pla.setWorkshop("浜岃溅闂�");
                 }
@@ -171,12 +212,15 @@
         pla.setStep(2);
         pla.setModifyTime(new Date());
         pla.setStatus(GlobleParameter.PLA_STATUS_00);
-        pla.setStockFreeze(1);
+        pla.setStockFreeze(Cools.isEmpty(excel.getStockFreeze()) ? 1 : excel.getStockFreeze());
         pla.setWeightAnfme(pla.getWeight());
         Mat mat = matService.selectByMaktx(pla.getBrand());
         if(Cools.isEmpty(mat)){
             throw new CoolException("鏃犳硶鎵惧埌瀵瑰簲鐨勭墝鍙蜂俊鎭紝鐗屽彿=" + pla.getBrand());
         }
+        if (!Cools.isEmpty(excel.getProblem()) && excel.getProblem().contains("瀹為獙鏂�")) {
+            excel.setMassState("瀹為獙鏂�");
+        }
         pla.setMatnr(mat.getMatnr());
         try {
             if(Cools.isEmpty(pla.getType())){

--
Gitblit v1.9.1