From f57741a11f0cce1f7ac0f2c8ab0627c046cb855b Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期五, 14 四月 2023 11:11:53 +0800
Subject: [PATCH] 穿梭车到达提升机口前,优先调度提升机优化

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   95 ++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 73 insertions(+), 22 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..3b92522 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -728,13 +728,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 +797,20 @@
                                 //鍚屼竴灞傜洿鎺ュ彇璐ф棤闇�缁忚繃鎻愬崌鏈�
                                 //鐩存帴璁$畻杞﹀埌鎻愬崌鏈哄彇璐у啀鍒板簱浣嶈矾寰勬寚浠�
                                 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.setRunSpeed((short) 1000);
+                                    moveCommand.setCommandEnd((short) 1);
+                                    commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
+                                }
                                 assignCommand.setCommands(commands);
                                 //鍒嗛厤鐩爣搴撲綅
                                 shuttleProtocol.setLocNo(wrkMast.getLocNo());
@@ -851,14 +865,22 @@
 
             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);
@@ -890,14 +912,22 @@
 
             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);
@@ -930,14 +960,22 @@
 
             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);
@@ -1056,6 +1094,19 @@
                         }
                     } 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.setRunSpeed((short) 1000);
+                        moveCommand.setCommandEnd((short) 1);
+                        commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
+
                         //鍒嗛厤鐩爣搴撲綅
                         shuttleProtocol.setLocNo(wrkMast.getSourceLocNo());
                         //鐩爣搴撲綅

--
Gitblit v1.9.1