From 21caf282f3d903a729d72b3398e0dbedab7f244d Mon Sep 17 00:00:00 2001
From: zhangc <zc@123>
Date: 星期日, 20 四月 2025 15:06:07 +0800
Subject: [PATCH] 999

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   57 +++++++++++++++++++++++++--------------------------------
 1 files changed, 25 insertions(+), 32 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index 4e1dc68..0283968 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -40,6 +40,7 @@
 import com.zy.system.service.ConfigService;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.util.*;
@@ -98,6 +99,8 @@
     private LiftAction liftAction;
     @Autowired
     private BasWrkStatusService wrkStatusService;
+    @Value("${asrs.wmsUrl}")
+    private String wmsUrl;
 
 
     public boolean isInEnable(DevpThread devpThread, Integer staNo) {
@@ -184,8 +187,8 @@
                     if (staProtocol.isAutoing() && staProtocol.isLoading() && isInEnable(devpThread, inSta.getStaNo()) && !staProtocol.isEmptyMk() && (workNo == 0 || (workNo >= 9990 && workNo <= 9999)) && staProtocol.isPakMk()) {
                         String barcode = staProtocol.getBarcode();
                         // 鍒ゆ柇閲嶅宸ヤ綔妗�
-                        WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("source_sta_no", inSta.getStaNo()).eq("wrk_sts", WrkStsType.NEW_INBOUND.sts).eq("barcode", barcode));
-                        if (wrkMast != null) {
+                        WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("source_sta_no", inSta.getStaNo()).eq("barcode", barcode));
+                        if (wrkMast != null && wrkMast.getWrkSts() == WrkStsType.NEW_INBOUND.sts) {
                             News.error("宸ヤ綔妗e凡瀛樺湪,宸ヤ綔鍙�={}", wrkMast.getWrkNo());
                             //鍒ゆ柇鏃舵彁鍗囨満渚э紝杩樻槸鏃犳彁鍗囨満娴�
                             staProtocol.setWorkNo(Short.parseShort(String.valueOf(wrkMast.getWrkNo())));
@@ -195,14 +198,15 @@
                             wrkMast.setWrkSts(WrkStsType.INBOUND_DEVICE_RUN.sts);
                             wrkMast.setModiTime(new Date());
                             wrkMastService.updateById(wrkMast);
+                        } else if (wrkMast != null && wrkMast.getWrkSts() != WrkStsType.NEW_INBOUND.sts) {
+                            continue;
                         }
                         try {
-                            String wmsUrl = "192.168.10.201:8080/fyxcwms";
                             SearchLocParam param = new SearchLocParam();
                             param.setBarcode(barcode);
                             param.setIoType(1);
                             param.setSourceStaNo(inSta.getStaNo());
-                            param.setLocType1(staProtocol.getLocType1().shortValue());
+                            param.setLocType1((short) 1);
                             String response = new HttpHandler.Builder()
                                     .setUri(wmsUrl)
                                     .setPath("/rpc/pakin/loc/v1")
@@ -273,10 +277,9 @@
                     if (staProtocol.isAutoing() && staProtocol.isLoading() && isInEnable(devpThread, inSta.getStaNo()) && !staProtocol.isEmptyMk() && (workNo == 0 || (workNo >= 9990 && workNo <= 9999)) && staProtocol.isPakMk()) {
                         String barcode = staProtocol.getBarcode();
                         // 鍒ゆ柇閲嶅宸ヤ綔妗�
-                        WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("source_sta_no", inSta.getStaNo()).eq("wrk_sts", WrkStsType.NEW_INBOUND.sts).eq("barcode", barcode));
+                        WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("source_sta_no", inSta.getStaNo()).eq("barcode", barcode));
                         if (wrkMast == null) {
                             try {
-                                String wmsUrl = "192.168.10.201:8080/fyxcwms";
                                 SearchLocParam param = new SearchLocParam();
                                 param.setBarcode(barcode);
                                 param.setIoType(1);
@@ -349,7 +352,7 @@
                 if (wrkMast.getStaNo() == 1026) {
                     locNo = "1200305";
                 }
-                boolean dispatchShuttle = shuttleDispatchUtils.searchDispatchShuttleS(wrkMast.getWrkNo(), locNo, wrkMast.getLocNo(), "TRANSPORT_DEVP");
+                boolean dispatchShuttle = shuttleDispatchUtils.searchDispatchShuttleNoLift(wrkMast.getWrkNo(), locNo, wrkMast.getLocNo(), "TRANSPORT_DEVP");
                 if (!dispatchShuttle) {
                     News.info("{}浠诲姟锛岃皟搴﹀皬杞﹀け璐�", wrkMast.getWrkNo());
                     continue;
@@ -396,18 +399,10 @@
             if (wrkMast.getStaNo() == 1024) {
                 locNo = "1200305";
             }
-            boolean dispatchShuttle = shuttleDispatchUtils.searchDispatchShuttleS(wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), locNo, "TRANSPORT_DEVP");
+            boolean dispatchShuttle = shuttleDispatchUtils.searchDispatchShuttleNoLift(wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), locNo, "TRANSPORT_DEVP");
             if (!dispatchShuttle) {
                 News.info("{}浠诲姟锛岃皟搴﹀皬杞﹀け璐�", wrkMast.getWrkNo());
                 continue;
-            } else {
-                WrkMast wrkMast1 = wrkMastService.selectByMainWrkNo(wrkMast.getWrkNo());
-                if (wrkMast1 == null) {
-                    News.info("{}浠诲姟锛岃皟搴﹀皬杞﹀け璐�,缁堜簬鍙戠幇浜�", wrkMast.getWrkNo());
-                    continue;
-                } else {
-                    News.info("{}浠诲姟锛屾棤鎻愬崌鏈哄璋冨害灏忚溅鎴愬姛", wrkMast.getWrkNo());
-                }
             }
 
             wrkMast.setWrkSts(WrkStsType.OUTBOUND_SHUTTLE_RUN.sts);
@@ -880,7 +875,7 @@
             short staNo = 1012;
             if (wrkMast.getSourceStaNo() == 1022) {
                 staNo = 1023;
-            } else if (wrkMast.getSourceStaNo() == 1031 || wrkMast.getSourceStaNo() == 1032) {
+            } else if ( wrkMast.getSourceStaNo() == 1032) {
                 staNo = 1032;
             }
 
@@ -969,17 +964,14 @@
                     News.info("{}浠诲姟锛寋}绔欑偣锛屼换鍔″彿涓嶄竴鑷�", wrkMast.getWrkNo(), staProtocol.getSiteId());
                     return false;
                 }
-                if (!station.get(1022).getBarcode().equals(wrkMast.getBarcode())) {
-                    News.info("{}浠诲姟锛寋}绔欑偣锛屾墭鐩樼爜涓嶅尮閰嶏紝绔欑偣鎵樼洏鐮侊細{}锛屼换鍔℃墭鐩樼爜锛歿}", wrkMast.getWrkNo(), staProtocol.getSiteId(), staProtocol.getBarcode(), wrkMast.getBarcode());
-                    return false;
-                }
-            } else {
+            } else if (sourceStaNo == 1012) {
                 if (staProtocol.getWorkNo().intValue() != wrkMast.getWrkNo()) {
                     News.info("{}浠诲姟锛寋}绔欑偣锛屼换鍔″彿涓嶄竴鑷�", wrkMast.getWrkNo(), staProtocol.getSiteId());
                     return false;
                 }
-                if (!staProtocol.getBarcode().equals(wrkMast.getBarcode())) {
-                    News.info("{}浠诲姟锛寋}绔欑偣锛屾墭鐩樼爜涓嶅尮閰嶏紝绔欑偣鎵樼洏鐮侊細{}锛屼换鍔℃墭鐩樼爜锛歿}", wrkMast.getWrkNo(), staProtocol.getSiteId(), staProtocol.getBarcode(), wrkMast.getBarcode());
+            } else if (sourceStaNo == 1032 ) {
+                if (staProtocol.getWorkNo().intValue() != wrkMast.getWrkNo()) {
+                    News.info("{}浠诲姟锛寋}绔欑偣锛屼换鍔″彿涓嶄竴鑷�", wrkMast.getWrkNo(), staProtocol.getSiteId());
                     return false;
                 }
             }
@@ -987,7 +979,7 @@
             String locNo = "0200305";
             if (wrkMast.getSourceStaNo() == 1012) {
                 locNo = "0200301";
-            } else if (wrkMast.getSourceStaNo() == 1032 || wrkMast.getSourceStaNo() == 1031) {
+            } else if (wrkMast.getSourceStaNo() == 1032 ) {
                 locNo = "0200308";
             }
             boolean dispatchShuttle = shuttleDispatchUtils.searchDispatchShuttleS(wrkMast.getWrkNo(), locNo, wrkMast.getLocNo(), "TRANSPORT_LIFT");
@@ -1001,7 +993,7 @@
                 //TODO
                 // lev = 105;
                 lev = 1021;
-            } else if (wrkMast.getSourceStaNo() == 1032 || wrkMast.getSourceStaNo() == 1031) {
+            } else if ( wrkMast.getSourceStaNo() == 1031) {
                 lev = 1031;
             }
             //鑾峰彇鎻愬崌鏈哄懡浠�
@@ -1091,7 +1083,7 @@
 
     public synchronized void liftOutExecute() {
         try {
-            List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().in("wrk_sts", WrkStsType.NEW_OUTBOUND.sts, WrkStsType.OUTBOUND_SHUTTLE_RUN_COMPLETE.sts).in("sta_no", 1011, 1021));
+            List<WrkMast> wrkMasts = wrkMastService.selectList(new EntityWrapper<WrkMast>().in("wrk_sts", WrkStsType.NEW_OUTBOUND.sts, WrkStsType.OUTBOUND_SHUTTLE_RUN_COMPLETE.sts).in("sta_no", 1011, 1021, 1031));
             for (WrkMast wrkMast : wrkMasts) {
                 boolean step1 = this.liftOutExecuteStep1(wrkMast);//瑙﹀彂鎼繍浠诲姟
                 if (!step1) {
@@ -1135,7 +1127,7 @@
             String locNo = "0200305";
             if (wrkMast.getStaNo() == 1011) {
                 locNo = "0200301";
-            } else if (wrkMast.getStaNo() == 1032) {
+            } else if (wrkMast.getStaNo() == 1031) {
                 locNo = "0200308";
             }
             boolean dispatchShuttle = shuttleDispatchUtils.searchDispatchShuttleS(wrkMast.getWrkNo(), wrkMast.getSourceLocNo(), locNo, "TRANSPORT_LIFT");
@@ -2154,12 +2146,13 @@
     }
 
     private void shuttleMoveExecuteTransportNoLift(WrkMast wrkMast) {
-        if (12 == Utils.getRow(wrkMast.getSourceLocNo()) && 3 == Utils.getBay(wrkMast.getSourceLocNo())) {
+        WrkMast mainWrk = wrkMastService.selectByWorkNo(wrkMast.getMainWrkNo());
+        if (mainWrk != null && mainWrk.getIoType() == 1) {
             //鍏ュ簱
-            noLiftInService.shuttleMoveExecute(wrkMast);
-        } else {
+            noLiftInService.shuttleMoveExecute(wrkMast, mainWrk.getStaNo(), Utils.getLev(mainWrk.getLocNo()));
+        } else if (mainWrk != null && mainWrk.getIoType() == 101) {
             //鍑哄簱
-            noLiftOutService.shuttleMoveExecute(wrkMast);
+            noLiftOutService.shuttleMoveExecute(wrkMast, mainWrk.getStaNo(), Utils.getLev(mainWrk.getSourceLocNo()));
         }
     }
 

--
Gitblit v1.9.1