From d16c9ca6307adde5d4b9734c540e276477940686 Mon Sep 17 00:00:00 2001
From: zyx <zyx123456>
Date: 星期五, 23 二月 2024 17:03:56 +0800
Subject: [PATCH] 分析页 牌号统计 功能完善

---
 src/main/java/com/zy/asrs/utils/PlaExcelListener.java |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/src/main/java/com/zy/asrs/utils/PlaExcelListener.java b/src/main/java/com/zy/asrs/utils/PlaExcelListener.java
index c968f3a..83bc4ef 100644
--- a/src/main/java/com/zy/asrs/utils/PlaExcelListener.java
+++ b/src/main/java/com/zy/asrs/utils/PlaExcelListener.java
@@ -14,6 +14,7 @@
 import com.zy.asrs.service.PlaService;
 import com.zy.common.entity.MatExcel;
 import com.zy.common.entity.PlaExcel;
+import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 
@@ -26,12 +27,14 @@
  * Created by vincent on 2019-11-25
  */
 @Slf4j
+@Data
 public class PlaExcelListener extends AnalysisEventListener<PlaExcel> {
 
     private static final String OWNER_HZ = "娴锋鐢熺墿";
     private static final String OWNER_HNE = "娴疯灏�";
 
     private int total = 0;
+    private int index = 1;
     private Long userId;
 
     public PlaExcelListener() {
@@ -60,6 +63,7 @@
      */
     @Override
     public void invoke(PlaExcel excel, AnalysisContext ctx) {
+        index ++;
         PlaService plaService = SpringUtils.getBean(PlaService.class);
         NodeService nodeService = SpringUtils.getBean(NodeService.class);
         MatService matService = SpringUtils.getBean(MatService.class);
@@ -89,7 +93,7 @@
                 setPla(pla);
             }catch (Exception e){
                 log.info(e.getMessage() + "Pla: " + pla.getBatch());
-                throw new CoolException(e.getMessage());
+                throw new CoolException(e.getMessage() + "锛屾壒鍙凤細" + excel.getBatch() + ", 鍖呭彿锛�" + excel.getPackageNo());
             }
 
             if(!Cools.isEmpty(pla.getLocNo())){
@@ -103,9 +107,15 @@
                 pla.setStatus(GlobleParameter.PLA_STATUS_1);
                 pla.setPakinTime(new Date());
             }
-            if (!plaService.insert(pla)) {
-                throw new CoolException("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屽晢鍝佺紪鐮侊細" + excel.getMatnr());
+            try {
+                plaService.insert(pla);
+            }catch (Exception e){
+                log.error("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屾壒鍙凤細" + excel.getBatch() + ", 鍖呭彿锛�" + excel.getPackageNo() + "鍘熷洜涓猴細" + e.getMessage());
+                throw new CoolException("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屾壒鍙凤細" + excel.getBatch() + ", 鍖呭彿锛�" + excel.getPackageNo() + "鍘熷洜涓猴細" + e.getMessage());
             }
+//            if (!plaService.insert(pla)) {
+//                throw new CoolException("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屽晢鍝佺紪鐮侊細" + excel.getMatnr());
+//            }
             total++;
         }else if (pla.getStatus().equals(GlobleParameter.PLA_STATUS_00)){
             excel.setId(pla.getId());
@@ -114,7 +124,12 @@
             excel.setStep(2);
             excel.setStatus(GlobleParameter.PLA_STATUS_00);
             BeanUtils.copyProperties(excel,pla);
-            plaService.updateById(pla);
+            try {
+                plaService.updateById(pla);
+            }catch (Exception e){
+                log.error("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屾壒鍙凤細" + excel.getBatch() + ", 鍖呭彿锛�" + excel.getPackageNo() + "鍘熷洜涓猴細" + e.getMessage());
+                throw new CoolException("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屾壒鍙凤細" + excel.getBatch() + ", 鍖呭彿锛�" + excel.getPackageNo() + "鍘熷洜涓猴細" + e.getMessage());
+            }
             total++;
         }
     }

--
Gitblit v1.9.1