From 6a804f89cad0662b5d22517a4dbdc9a3239a9722 Mon Sep 17 00:00:00 2001
From: zyx <zyx123456>
Date: 星期二, 30 一月 2024 14:43:15 +0800
Subject: [PATCH] 货主档案搜索bug修复

---
 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 b44a089..fae28c7 100644
--- a/src/main/java/com/zy/asrs/utils/PlaExcelListener.java
+++ b/src/main/java/com/zy/asrs/utils/PlaExcelListener.java
@@ -5,8 +5,10 @@
 import com.core.common.Cools;
 import com.core.common.SpringUtils;
 import com.core.exception.CoolException;
+import com.zy.asrs.entity.Node;
 import com.zy.asrs.entity.Pla;
 import com.zy.asrs.entity.param.GlobleParameter;
+import com.zy.asrs.service.NodeService;
 import com.zy.asrs.service.PlaService;
 import com.zy.common.entity.MatExcel;
 import com.zy.common.entity.PlaExcel;
@@ -54,6 +56,7 @@
     @Override
     public void invoke(PlaExcel excel, AnalysisContext ctx) {
         PlaService plaService = SpringUtils.getBean(PlaService.class);
+        NodeService nodeService = SpringUtils.getBean(NodeService.class);
         Date now = new Date();
 
         // 鍟嗗搧
@@ -65,17 +68,29 @@
             pla = excel;
             pla.setStep(2);
             pla.setCreateTime(new Date());
-            pla.setStatus(GlobleParameter.PLA_STATUS_0);
+            pla.setModifyTime(new Date());
+            pla.setStatus(GlobleParameter.PLA_STATUS_00);
+            pla.setStockFreeze(1);
+            if(!Cools.isEmpty(pla.getLocNo())){
+                Node node = nodeService.selectByUuid(pla.getLocNo());
+                if(Cools.isEmpty(node)){
+                    throw new CoolException("鏈兘鎵惧埌鐩稿簲鐨勫簱浣嶄俊鎭�");
+                }
+                pla.setStash(node.getParentName());
+                pla.setLocNo(node.getUuid());
+                pla.setStatus(GlobleParameter.PLA_STATUS_1);
+                pla.setPakinTime(new Date());
+            }
             if (!plaService.insert(pla)) {
                 throw new CoolException("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屽晢鍝佺紪鐮侊細" + excel.getMatnr());
             }
             total++;
-        }else if (pla.getStatus().equals(GlobleParameter.PLA_STATUS_0)){
+        }else if (pla.getStatus().equals(GlobleParameter.PLA_STATUS_00)){
             excel.setId(pla.getId());
             excel.setCreateTime(pla.getCreateTime());
-            excel.setModifyTime(pla.getModifyTime());
+            excel.setModifyTime(new Date());
             excel.setStep(2);
-            excel.setStatus(GlobleParameter.PLA_STATUS_0);
+            excel.setStatus(GlobleParameter.PLA_STATUS_00);
             BeanUtils.copyProperties(excel,pla);
             plaService.updateById(pla);
             total++;

--
Gitblit v1.9.1