From 886ec394c38d842e1a2ef099782fbc93409e9d16 Mon Sep 17 00:00:00 2001
From: zyx <zyx123456>
Date: 星期一, 29 一月 2024 09:56:19 +0800
Subject: [PATCH] 修复卡顿Bug

---
 src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java |   39 ++++++++++++++++++++++++++++++++-------
 1 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
index 3efb55f..982fcbf 100644
--- a/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/AgvMobileServiceImpl.java
@@ -18,6 +18,7 @@
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * 绉诲姩绔湇鍔℃牳蹇冪被
@@ -37,6 +38,10 @@
     private OrderDetlService orderDetlService;
     @Autowired
     private AgvBasDevpService agvBasDevpService;
+    @Autowired
+    private AgvLocDetlService agvLocDetlService;
+    @Autowired
+    private AgvWrkMastService agvWrkMastService;
 
 
     /*
@@ -50,9 +55,18 @@
         }
 
         //妫�鏌ユ槸鍚﹀凡瀛樺湪鐩稿悓鐨勬墭鐩樻潯鐮侊紝瀛樺湪鍒欐姏鍑哄紓甯�
-        if (agvWaitPakinService.selectCount(new EntityWrapper<AgvWaitPakin>().
-                eq("supp_code", param.getBarcode()).eq("io_status", "N")) > 0) {
-            throw new CoolException(param.getBarcode() + "鏁版嵁姝e湪杩涜鍏ュ簱");
+        if (agvWaitPakinService.selectCount(new EntityWrapper<AgvWaitPakin>().eq("supp_code", param.getBarcode())) > 0) {
+            throw new CoolException(param.getBarcode() + "鏂欐兂鐮佸凡瀛樺湪AGV鍏ュ簱閫氱煡妗d腑");
+        }
+
+        //妫�鏌ュ簱瀛樻槸鍚︽湁鐩稿悓鏂欑锛屽瓨鍦ㄥ垯鎶涘嚭寮傚父
+        if(!Cools.isEmpty(agvLocDetlService.selectOne(new EntityWrapper<AgvLocDetl>().eq("supp_code",param.getBarcode())))){
+            throw new CoolException(param.getBarcode() + "鏂欑鐮佸凡瀛樺湪AGV搴撳瓨鏄庣粏涓�");
+        }
+
+        //鏌ョ湅宸ヤ綔妗f槸鍚︽湁鐩稿悓鏂欑锛屽瓨鍦ㄥ垯鎶涘嚭寮傚父
+        if(!Cools.isEmpty(agvWrkMastService.selectByContainerCode(param.getBarcode()))){
+            throw new CoolException(param.getBarcode() + "鏂欑鐮佸凡瀛樺湪AGV宸ヤ綔妗d腑");
         }
 
         if (Cools.isEmpty(param.getOrderNo())) {
@@ -122,7 +136,7 @@
                 checkOrderQty(order,combMat);
             }
 
-            DetlDto detlDto = new DetlDto(combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme(), combMat.getCsocode(), combMat.getIsoseq());
+            DetlDto detlDto = new DetlDto(combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme(), combMat.getCsocode(), combMat.getIsoseq(),combMat.getContainerCode());
             //鍚屼竴鎵樼洏涓嬬浉鍚岀墿鏂欎俊鎭拰鎵瑰彿杞负涓�涓叆搴撻�氱煡妗�
             if (DetlDto.has(detlDtos, detlDto)) {
                 DetlDto one = DetlDto.find(detlDtos, detlDto.getMatnr(), detlDto.getBatch(), detlDto.getCsocode(), detlDto.getIsoseq(),null);
@@ -141,7 +155,7 @@
      */
     private void checkOrderQty(Order order, CombParam.CombMat combMat){
         // 璁㈠崟鏄庣粏鏁伴噺鏍¢獙锛屽鏋滀綔涓氭暟閲忓ぇ浜庡崟鎹暟閲忓垯鎶涘嚭寮傚父
-        OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), combMat.getMatnr(), combMat.getBatch());
+        OrderDetl orderDetl = orderDetlService.selectItem(order.getId(), combMat.getMatnr(), combMat.getBatch(), combMat.getCsocode(),combMat.getIsoseq());
         if(Cools.isEmpty(orderDetl)){
             throw new CoolException("鏈尮閰嶅埌璇ュ崟鎹笅鐨勭墿鏂�");
         }
@@ -149,7 +163,7 @@
             throw new CoolException(orderDetl.getMatnr() + "鍏ュ簱鏁伴噺涓嶅悎娉�");
         }
         // 淇敼璁㈠崟鏄庣粏鏁伴噺
-        if (!orderDetlService.increase(order.getId(), combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme())) {
+        if (!orderDetlService.increase(order.getId(), combMat.getMatnr(), combMat.getBatch(), combMat.getAnfme(), combMat.getCsocode(),combMat.getIsoseq())) {
             throw new CoolException("淇敼鍗曟嵁鏄庣粏鏁伴噺澶辫触");
         }
     }
@@ -203,6 +217,10 @@
     @Override
     public void combBinding(String barcode, String stationCode) {
 
+        if(Cools.isEmpty(agvWaitPakinService.selectByContainerCode(barcode))){
+            throw new CoolException("璇ユ枡绠辨湭缁勬墭锛屾棤娉曠粦瀹氱珯鐐�");
+        }
+
         AgvBasDevp agvBasDevp = agvBasDevpService.selectOne(new EntityWrapper<AgvBasDevp>().eq("barcode", barcode));
 
         if(!Cools.isEmpty(agvBasDevp)){
@@ -216,6 +234,10 @@
         if(!"O".equals(agvBasDevp.getLocSts())){
             throw new CoolException(stationCode + "璇ョ珯鐐硅揣浣嶇姸鎬侀潪绌�");
         }
+        AgvWrkMast agvWrkMast = agvWrkMastService.selectOne(new EntityWrapper<AgvWrkMast>().eq("loc_no", agvBasDevp.getDevNo()));
+        if(!Cools.isEmpty(agvWrkMast)){
+            throw new CoolException(stationCode + "璇ョ珯鐐瑰凡琚伐浣滃彿涓�" + agvWrkMast.getWrkNo() + "鍗犵敤锛屾棤娉曠粦瀹�");
+        }
 
         agvBasDevp.setBarcode(barcode);
         agvBasDevp.setLocSts("F");
@@ -225,7 +247,10 @@
     public List<AgvBasDevp> getAgvBasDevpByFloor(int floor) {
         EntityWrapper<AgvBasDevp> wrapper = new EntityWrapper<>();
         wrapper.eq("floor",floor).eq("cache_shelves","Y").eq("loc_sts","F");
-        return agvBasDevpService.selectList(wrapper);
+        List<AgvBasDevp> agvBasDevpList = agvBasDevpService.selectList(wrapper);
+        return agvBasDevpList.stream().filter(agvBasDevp -> {
+            return !Cools.isEmpty(agvWaitPakinService.selectByContainerCode(agvBasDevp.getBarcode()));
+        }).collect(Collectors.toList());
     }
 
 }

--
Gitblit v1.9.1