From eb3ad0d690a7aec77b964918e97247549b04a0e2 Mon Sep 17 00:00:00 2001
From: 野心家 <1051256694@qq.com>
Date: 星期一, 09 十月 2023 08:34:00 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   65 ++++++++++++++++----------------
 1 files changed, 32 insertions(+), 33 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 15852c4..293d0d1 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -698,38 +698,6 @@
                 continue;
             }
         }
-
-
-
-
-        // 鏍规嵁杈撻�佺嚎plc閬嶅巻
-        for (DevpSlave devp : slaveProperties.getDevp()) {
-            // 閬嶅巻鍏ュ簱绔�
-            for (DevpSlave.StaRack staRack : devp.getRackInStn()) {
-                // 鑾峰彇鍏ュ簱绔欎俊鎭�
-                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
-                StaProtocol staProtocol = devpThread.getStation().get(staRack.getStaNo());
-                if (staProtocol == null) {
-                    continue;
-                } else {
-                    staProtocol = staProtocol.clone();
-                }
-                Short workNo = staProtocol.getWorkNo();
-                BasDevp basDevp = basDevpService.selectById(staProtocol.getSiteId());
-                if (basDevp == null) {
-                    continue;//绔欑偣淇℃伅涓嶅瓨鍦�
-                }
-
-                // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢锛岃嚜鍔ㄣ�佹湁鐗┿�佸洓鍚戠┛姊溅鍙彇淇″彿
-                if (!(staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isShuttleTakeEnable())) {
-                    continue;
-                }
-
-
-
-            }
-        }
-
     }
 
 //    /**
@@ -1176,6 +1144,12 @@
 
             //鑾峰彇鎻愬崌鏈哄懡浠�
             NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, startSta, targetSta, wrkMast.getWrkNo());
+            if (wrkMast.getIoType() == 53) {
+                //鎷f枡鍐嶅洖搴擄紝閲嶆柊鍒嗛厤璁惧宸ヤ綔鍙�
+                Random random = new Random();
+                int deviceWrk = Math.abs((liftCommand.getTaskNo().intValue() + random.nextInt(9999)));//鑾峰彇璁惧宸ヤ綔鍙�
+                liftCommand.setTaskNo((short) deviceWrk);
+            }
             ArrayList<NyLiftCommand> commands = new ArrayList<>();
             commands.add(liftCommand);
 
@@ -2626,7 +2600,8 @@
                 NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_CAR.id, sourceLiftSta.getStaNo(), sourceLiftSta.getStaNo(), wrkMast.getWrkNo());
 
                 Random random = new Random();
-                liftCommand.setTaskNo((short) Math.abs((liftCommand.getTaskNo().intValue() + random.nextInt(9999))));//鏇存崲闅忔満浠诲姟鍙�
+                int deviceWrk = Math.abs((liftCommand.getTaskNo().intValue() + random.nextInt(9999)));//鑾峰彇璁惧宸ヤ綔鍙�
+                liftCommand.setTaskNo((short) deviceWrk);//鏇存崲闅忔満浠诲姟鍙�
 
                 ArrayList<NyLiftCommand> commands = new ArrayList<>();
                 commands.add(liftCommand);
@@ -2948,6 +2923,30 @@
 //            NavigateNode liftNode = new NavigateNode(basLift.getPoint$().getX(), basLift.getPoint$().getY());
 //            liftNode.setZ(basLift.getPoint$().getZ());
 
+            //灏忚溅宸茬粡鍦ㄧ洰鏍囧簱浣嶏紝鐩存帴璁ゅ畾灏忚溅绉诲姩浠诲姟瀹屾垚
+            if (shuttleProtocol.getCurrentLocNo().equals(wrkMast.getLocNo())) {
+                if (shuttleProtocol.getToken().equals(wrkMast.getWrkNo())) {
+                    //閲婃斁灏忚溅浠ょ墝
+                    shuttleProtocol.setToken(0);
+                }
+                wrkMast.setWrkSts(111L);//111.灏忚溅绉诲姩瀹屾垚
+                wrkMast.setLiftNo(null);//閲婃斁鎻愬崌鏈�
+                wrkMast.setModiTime(now);
+                wrkMastMapper.updateById(wrkMast);
+
+                if (wrkMast.getWrkSts() == 111) {
+                    // 淇濆瓨宸ヤ綔涓绘。鍘嗗彶妗�
+                    if (wrkMastLocMapper.save(wrkMast.getWrkNo()) <= 0) {
+                        log.info("淇濆瓨宸ヤ綔鍘嗗彶妗workNo={0}]澶辫触", wrkMast.getWrkNo());
+                    }
+                    // 鍒犻櫎宸ヤ綔涓绘。
+                    if (!wrkMastService.deleteById(wrkMast)) {
+                        log.info("鍒犻櫎宸ヤ綔涓绘。[workNo={0}]澶辫触", wrkMast.getWrkNo());
+                    }
+                }
+                return false;
+            }
+
             //鑾峰彇灏忚溅鍒扮洰鏍囧簱浣嶅懡浠�
             NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo(), NavigationMapType.NORMAL.id);
             if (result == null) {

--
Gitblit v1.9.1