From b5dad5bca39b68fdaaaf844e38fcc55e94bb34f1 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 14 四月 2023 15:23:50 +0800
Subject: [PATCH] 地图处于其他楼层时无法显示提升机口站点问题

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  205 +++++++++++++++++---------------------------------
 1 files changed, 71 insertions(+), 134 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 92fe3d4..f2b386c 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -606,115 +606,6 @@
         }
     }
 
-//    /**
-//     * 鍏ュ簱  ===>>  鍥涘悜绌挎杞﹀叆搴撲綔涓氫笅鍙�
-//     */
-//    public synchronized void shuttleIoInExecute() {
-//        // 鏍规嵁杈撻�佺嚎plc閬嶅巻
-//        for (DevpSlave devp : slaveProperties.getDevp()) {
-//            // 閬嶅巻鍏ュ簱绔�
-//            for (DevpSlave.StaRack rackInStn : devp.getRackInStn()) {
-//                // 鑾峰彇鍏ュ簱绔欎俊鎭�
-//                DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
-//
-//                StaProtocol staProtocol = devpThread.getStation().get(rackInStn.getStaNo());
-//                StaProtocol staProtocol105 = devpThread.getStation().get(105);
-//                staProtocol105.setWorkNo((short) 752);
-//                staProtocol105.setStaNo((short) 100);
-//
-//                StaProtocol staProtocol106 = devpThread.getStation().get(106);
-//                staProtocol106.setWorkNo((short) 753);
-//                staProtocol106.setStaNo((short) 100);
-//
-//                if (staProtocol == null) {
-//                    continue;
-//                } else {
-//                    staProtocol = staProtocol.clone();
-//                }
-//                Short workNo = staProtocol.getWorkNo();
-//
-//                // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
-//                if (true || staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable()) {
-//                    WrkMast wrkMast = wrkMastMapper.selectRackInStep48(workNo, staProtocol.getSiteId());
-//                    if (wrkMast != null) {
-//                        if (wrkMast.getWrkSts() == 4 || wrkMast.getWrkSts() == 8) {
-//                            ShuttleThread shuttleThread = null;
-//                            HashMap<String, Object> searchIdleShuttle = null;
-//                            if (wrkMast.getWrkSts() == 4) {
-//                                //瀵绘壘鏈�杩戜笖绌洪棽鐨勫洓鍚戠┛姊溅
-//                                searchIdleShuttle = this.searchIdleShuttle(wrkMast);
-//                                shuttleThread = (ShuttleThread) searchIdleShuttle.get("result");
-//                            }else {
-//                                //鐘舵��8锛屽洓鍚戠┛姊溅宸插湪鎻愬崌鏈哄彛锛岀瓑寰呭懡浠よ繘琛屽叆搴撴惉杩愬姩浣�
-//                                Integer shuttleNo = wrkMast.getShuttleNo();//鍥涘悜绌挎杞﹀彿
-//                                shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo);
-//                            }
-//
-//                            if (shuttleThread == null) {
-//                                continue;
-//                            }
-//
-//                            ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
-//                            if (!shuttleProtocol.isIdle()) {
-//                                continue;
-//                            }
-//
-//                            wrkMast.setShuttleNo(shuttleProtocol.getShuttleNo().intValue());//缁欏伐浣滄。鍒嗛厤鍥涘悜绌挎杞﹀彿
-//
-//                            //鍒嗛厤浠诲姟鍙�
-//                            shuttleProtocol.setTaskNo(wrkMast.getWrkNo().shortValue());
-//                            //鍒嗛厤婧愬簱浣�
-//                            shuttleProtocol.setSourceLocNo(wrkMast.getSourceLocNo());
-//
-//                            ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
-//                            //鍥涘悜绌挎杞﹀彿
-//                            assignCommand.setShuttleNo(shuttleProtocol.getShuttleNo());
-//                            //浠诲姟鍙�
-//                            assignCommand.setTaskNo(wrkMast.getWrkNo().shortValue());
-//                            //鍏ュ嚭搴撴ā寮�
-//                            assignCommand.setTaskMode(ShuttleTaskModeType.PAK_IN.id.shortValue());
-//                            //婧愬簱浣�(灏忚溅褰撳墠浣嶇疆)
-//                            String currentLocNo = shuttleProtocol.getCurrentLocNo();
-//                            assignCommand.setSourceLocNo(currentLocNo);
-//
-//                            if (wrkMast.getWrkSts() == 8 || Boolean.parseBoolean(searchIdleShuttle.get("sameLay").toString())) {
-//                                //鍚屼竴灞�
-//                                //鍒嗛厤鐩爣搴撲綅
-//                                shuttleProtocol.setLocNo(wrkMast.getLocNo());
-//                                //鐩爣搴撲綅
-//                                assignCommand.setLocNo(wrkMast.getLocNo());
-//                                wrkMast.setWrkSts(9L);//灏忚溅鍏ュ簱涓�
-//
-//                                //鑾峰彇浠庡皬杞�
-//                            }else {
-//                                //涓嶅悓灞傦紝灏嗙洰鏍囧簱浣嶅垎閰嶆垚鎻愬崌鏈哄簱浣嶅彿
-//
-//                                //灏忚溅褰撳墠灞傞珮
-//                                Integer currentLev = Integer.parseInt(currentLocNo.substring(currentLocNo.length() - 2, currentLocNo.length()));
-//
-//                                //鑾峰彇鎻愬崌鏈�
-//                                LiftSlave liftSlave = slaveProperties.getLift().get(0);
-//                                //鎻愬崌鏈哄簱浣嶅彿
-//                                String liftLocNo = liftSlave.getLiftLocNo(currentLev);
-//                                shuttleProtocol.setLocNo(liftLocNo);
-//                                //鐩爣搴撲綅
-//                                assignCommand.setLocNo(liftLocNo);
-//                                wrkMast.setWrkSts(5L);//灏忚溅杩佺Щ鐘舵��
-//                            }
-//
-//                            if (wrkMastMapper.updateById(wrkMast) > 0) {
-//                                //涓嬪彂浠诲姟
-//                                MessageQueue.offer(SlaveType.Shuttle, assignCommand.getShuttleNo().intValue(), new Task(3, assignCommand));
-//                            }
-//                        }
-//
-//                    }
-//                }
-//
-//            }
-//        }
-//
-//    }
 
     /**
      * 鍏ュ簱  ===>>  鍥涘悜绌挎杞﹀叆搴撲綔涓氫笅鍙�
@@ -728,13 +619,13 @@
                 DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId());
 
                 StaProtocol staProtocol = devpThread.getStation().get(rackInStn.getStaNo());
-//                StaProtocol staProtocol105 = devpThread.getStation().get(105);
-//                staProtocol105.setWorkNo((short) 752);
-//                staProtocol105.setStaNo((short) 100);
-//
-//                StaProtocol staProtocol106 = devpThread.getStation().get(106);
-//                staProtocol106.setWorkNo((short) 753);
-//                staProtocol106.setStaNo((short) 100);
+                StaProtocol staProtocol105 = devpThread.getStation().get(105);
+                staProtocol105.setWorkNo((short) 752);
+                staProtocol105.setStaNo((short) 100);
+
+                StaProtocol staProtocol106 = devpThread.getStation().get(106);
+                staProtocol106.setWorkNo((short) 753);
+                staProtocol106.setStaNo((short) 100);
 
                 if (staProtocol == null) {
                     continue;
@@ -797,6 +688,19 @@
                                 //鍚屼竴灞傜洿鎺ュ彇璐ф棤闇�缁忚繃鎻愬崌鏈�
                                 //鐩存帴璁$畻杞﹀埌鎻愬崌鏈哄彇璐у啀鍒板簱浣嶈矾寰勬寚浠�
                                 List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, locNo);
+                                if (wrkMast.getWrkSts() == 8) {
+                                    //姝ゆ椂杞﹀湪鎻愬崌鏈哄唴閮紝闇�瑕佸涓嬭揪涓�姝ユ寚浠よ杞︾Щ鍔ㄥ埌鎻愬崌鏈哄彛
+                                    BasDevp basDevp = basDevpService.selectById(109);//鑾峰彇鎻愬崌鏈轰俊鎭�
+                                    ShuttleCommand moveCommand = new ShuttleCommand();
+                                    moveCommand.setCommandWord((short) 1);
+                                    moveCommand.setStartCodeNum(Short.parseShort(basDevp.getQrCodeValue()));//鎻愬崌鏈哄唴閮ㄤ簩缁寸爜
+                                    moveCommand.setDistCodeNum(commands.get(0).getStartCodeNum());//鎻愬崌鏈哄彛浜岀淮鐮�
+                                    moveCommand.setStartToDistDistance(1300);
+                                    moveCommand.setMiddleToDistDistance(0);
+                                    moveCommand.setRunDirection(commands.get(0).getRunDirection());
+                                    moveCommand.setCommandEnd((short) 1);
+                                    commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
+                                }
                                 assignCommand.setCommands(commands);
                                 //鍒嗛厤鐩爣搴撲綅
                                 shuttleProtocol.setLocNo(wrkMast.getLocNo());
@@ -851,17 +755,24 @@
 
             ShuttleCommand command = new ShuttleCommand();
             command.setCommandWord((short) 1);
-            command.setStartCodeNum(NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY()));
-            command.setMiddleCodeNum((short) 0);
-            command.setDistCodeNum(NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY()));
+
+            //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
+            Short startCodeNum = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());
+            command.setStartCodeNum(startCodeNum);
+
+            command.setMiddleCodeNum((short) 1);
+
+            //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
+            Short distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());
+            command.setDistCodeNum(distCodeNum);
+
             command.setStartToDistDistance(allDistance);
-            command.setMiddleToDistDistance(1000);
+            command.setMiddleToDistDistance(0);
             command.setRunDirection(ShuttleRunDirection.get(startPath.getDirection()).id);
             command.setPalletLift((short) 1);
-            command.setForceMoveDistance(1000);
+            command.setForceMoveDistance(0);
             command.setChargeSwitch((short) 2);
             command.setIOControl((short) 0);
-            command.setRunSpeed((short) 1000);
             command.setRadarTmp((short) 0);
             command.setCommandEnd((short) 1);
             commands.add(command);
@@ -890,17 +801,24 @@
 
             ShuttleCommand command = new ShuttleCommand();
             command.setCommandWord((short) 1);
-            command.setStartCodeNum(NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY()));
-            command.setMiddleCodeNum((short) 0);
-            command.setDistCodeNum(NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY()));
+
+            //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
+            Short startCodeNum = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());
+            command.setStartCodeNum(startCodeNum);
+
+            command.setMiddleCodeNum((short) 1);
+
+            //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
+            Short distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());
+            command.setDistCodeNum(distCodeNum);
+
             command.setStartToDistDistance(allDistance);
-            command.setMiddleToDistDistance(1000);
+            command.setMiddleToDistDistance(0);
             command.setRunDirection(ShuttleRunDirection.get(startPath.getDirection()).id);
             command.setPalletLift((short) 1);
-            command.setForceMoveDistance(1000);
+            command.setForceMoveDistance(0);
             command.setChargeSwitch((short) 2);
             command.setIOControl((short) 0);
-            command.setRunSpeed((short) 1000);
             command.setRadarTmp((short) 0);
             command.setCommandEnd((short) 1);
             commands.add(command);
@@ -930,17 +848,24 @@
 
             command = new ShuttleCommand();
             command.setCommandWord((short) 1);
-            command.setStartCodeNum(NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY()));
-            command.setMiddleCodeNum((short) 0);
-            command.setDistCodeNum(NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY()));
+
+            //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
+            Short startCodeNum = NavigatePositionConvert.xyToPosition(startPath.getX(), startPath.getY(), startPath.getZ());
+            command.setStartCodeNum(startCodeNum);
+
+            command.setMiddleCodeNum((short) 1);
+
+            //閫氳繃xy鍧愭爣灏忚溅浜岀淮鐮�
+            Short distCodeNum = NavigatePositionConvert.xyToPosition(endPath.getX(), endPath.getY(), endPath.getZ());
+            command.setDistCodeNum(distCodeNum);
+
             command.setStartToDistDistance(allDistance);
-            command.setMiddleToDistDistance(1000);
+            command.setMiddleToDistDistance(0);
             command.setRunDirection(ShuttleRunDirection.get(startPath.getDirection()).id);
             command.setPalletLift((short) 1);
-            command.setForceMoveDistance(1000);
+            command.setForceMoveDistance(0);
             command.setChargeSwitch((short) 2);
             command.setIOControl((short) 0);
-            command.setRunSpeed((short) 1000);
             command.setRadarTmp((short) 0);
             command.setCommandEnd((short) 1);
             commands.add(command);
@@ -1056,6 +981,18 @@
                         }
                     } else if (wrkMast.getWrkSts() == 25) {
                         List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftLocNo);
+                        //姝ゆ椂杞﹀湪鎻愬崌鏈哄唴閮紝闇�瑕佸涓嬭揪涓�姝ユ寚浠よ杞︾Щ鍔ㄥ埌鎻愬崌鏈哄彛
+                        BasDevp basDevp = basDevpService.selectById(109);//鑾峰彇鎻愬崌鏈轰俊鎭�
+                        ShuttleCommand moveCommand = new ShuttleCommand();
+                        moveCommand.setCommandWord((short) 1);//灏忚溅绉诲姩鎸囦护瀛�
+                        moveCommand.setStartCodeNum(Short.parseShort(basDevp.getQrCodeValue()));//鎻愬崌鏈轰簩缁寸爜
+                        moveCommand.setDistCodeNum(commands.get(0).getStartCodeNum());
+                        moveCommand.setStartToDistDistance(1300);
+                        moveCommand.setMiddleToDistDistance(0);
+                        moveCommand.setRunDirection(commands.get(0).getRunDirection());
+                        moveCommand.setCommandEnd((short) 1);
+                        commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
+
                         //鍒嗛厤鐩爣搴撲綅
                         shuttleProtocol.setLocNo(wrkMast.getSourceLocNo());
                         //鐩爣搴撲綅

--
Gitblit v1.9.1