From e1783e196a4ada918268b9f81bfb3a19641e0626 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期六, 10 六月 2023 19:24:09 +0800
Subject: [PATCH] 提升机状态读取、提升机高度设定、提升机操作方案

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  253 +++++++++++--------------------------------------
 1 files changed, 59 insertions(+), 194 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 ca20843..e462e8a 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -640,13 +640,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;
@@ -708,18 +708,15 @@
                             if (wrkMast.getWrkSts() == 8 || Boolean.parseBoolean(searchIdleShuttle.get("sameLay").toString())) {
                                 //鍚屼竴灞傜洿鎺ュ彇璐ф棤闇�缁忚繃鎻愬崌鏈�
                                 //鐩存帴璁$畻杞﹀埌鎻愬崌鏈哄彇璐у啀鍒板簱浣嶈矾寰勬寚浠�
-                                List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, locNo, assignCommand);
+                                List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, locNo, assignCommand,shuttleThread);
                                 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);
+                                    short startCode = Short.parseShort(basDevp.getQrCodeValue());//鎻愬崌鏈哄唴閮ㄤ簩缁寸爜
+                                    Short distCode = commands.get(0).getStartCodeNum();//鎻愬崌鏈哄彛浜岀淮鐮�
+                                    Short runDirection = commands.get(0).getRunDirection();//杩愯鏂瑰悜
+                                    //鑾峰彇鍛戒护
+                                    ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1300, runDirection);
                                     commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
                                 }
                                 assignCommand.setCommands(commands);
@@ -732,7 +729,7 @@
                                 //涓嶅悓灞傦紝灏嗙洰鏍囧簱浣嶅垎閰嶆垚鎻愬崌鏈哄簱浣嶅彿
 
                                 //灏忚溅绉诲姩鍒版彁鍗囨満鍙o紝璁$畻璺緞
-                                List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand);
+                                List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread);
                                 //鍒嗛厤鐩爣搴撲綅
                                 shuttleProtocol.setLocNo(liftLocNo);
                                 //鐩爣搴撲綅
@@ -756,7 +753,7 @@
     }
 
     //鑾峰彇璧风偣-缁堢偣鎸囦护銆俶apType锛�1=銆嬫棤璐у湴鍥撅紝2=銆嬫湁璐у湴鍥�
-    public synchronized List<ShuttleCommand> shuttleAssignCommand(String startLocNo, String locNo, Integer mapType, ShuttleAssignCommand assignCommand) {
+    public synchronized List<ShuttleCommand> shuttleAssignCommand(String startLocNo, String locNo, Integer mapType, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) {
         //璁$畻灏忚溅璧风偣鍒颁腑鐐规墍闇�鍛戒护
         List<NavigateNode> calc = NavigateUtils.calc(startLocNo, locNo, mapType);
         List<ShuttleCommand> commands = new ArrayList<>();
@@ -776,29 +773,12 @@
             //鐩爣璺緞
             NavigateNode endPath = nodes.get(nodes.size() - 1);
             Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
-
-            ShuttleCommand command = new ShuttleCommand();
-            command.setCommandWord((short) 1);
-
             //閫氳繃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(0);
-            command.setRunDirection(ShuttleRunDirection.get(startPath.getDirection()).id);
-            command.setPalletLift((short) 1);
-            command.setForceMoveDistance(0);
-            command.setChargeSwitch((short) 2);
-            command.setIOControl((short) 0);
-            command.setRadarTmp((short) 0);
-            command.setCommandEnd((short) 1);
+            //鑾峰彇绉诲姩鍛戒护
+            ShuttleCommand command = shuttleThread.getMoveCommand(startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id);
             commands.add(command);
         }
 
@@ -811,7 +791,7 @@
     }
 
     //鑾峰彇璧风偣-涓偣-缁堢偣鎸囦护
-    public synchronized List<ShuttleCommand> shuttleAssignCommand(String startLocNo, String middleLocNo, String locNo, ShuttleAssignCommand assignCommand) {
+    public synchronized List<ShuttleCommand> shuttleAssignCommand(String startLocNo, String middleLocNo, String locNo, ShuttleAssignCommand assignCommand, ShuttleThread shuttleThread) {
         //璁$畻灏忚溅璧风偣鍒颁腑鐐规墍闇�鍛戒护
         List<NavigateNode> calc = NavigateUtils.calc(startLocNo, middleLocNo, 1);//灏忚溅鏃犺揣锛岃蛋鍏ュ簱鍦板浘
         List<ShuttleCommand> commands = new ArrayList<>();
@@ -832,37 +812,17 @@
             NavigateNode endPath = nodes.get(nodes.size() - 1);
             Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
 
-            ShuttleCommand command = new ShuttleCommand();
-            command.setCommandWord((short) 1);
-
             //閫氳繃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(0);
-            command.setRunDirection(ShuttleRunDirection.get(startPath.getDirection()).id);
-            command.setPalletLift((short) 1);
-            command.setForceMoveDistance(0);
-            command.setChargeSwitch((short) 2);
-            command.setIOControl((short) 0);
-            command.setRadarTmp((short) 0);
-            command.setCommandEnd((short) 1);
+            //鑾峰彇绉诲姩鍛戒护
+            ShuttleCommand command = shuttleThread.getMoveCommand(startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id);
             commands.add(command);
         }
 
         //灏忚溅鎸囦护鍒拌揪鐩爣浣嶇疆鍚庯紝鍐嶅彂鍑轰竴鏉¢《鍗囨寚浠�
-        ShuttleCommand command = new ShuttleCommand();
-        command.setCommandWord((short) 2);
-        command.setPalletLift((short) 1);
-        command.setCommandEnd((short) 1);
-        commands.add(command);
+        commands.add(shuttleThread.getPalletCommand((short) 1));
 
         //璁$畻灏忚溅涓偣鍒扮粓鐐规墍闇�鍛戒护
         List<NavigateNode> calc2 = NavigateUtils.calc(middleLocNo, locNo, 2);//灏忚溅鏈夎揣锛岃蛋鍑哄簱鍦板浘(鍑哄簱鍦板浘鏈変笓鐢ㄨ揣閬�)
@@ -881,37 +841,16 @@
             NavigateNode endPath = nodes.get(nodes.size() - 1);
             Integer allDistance = NavigateUtils.getCurrentPathAllDistance(nodes);//璁$畻褰撳墠璺緞琛岃蛋鎬昏窛绂�
 
-            command = new ShuttleCommand();
-            command.setCommandWord((short) 1);
-
             //閫氳繃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(0);
-            command.setRunDirection(ShuttleRunDirection.get(startPath.getDirection()).id);
-            command.setPalletLift((short) 1);
-            command.setForceMoveDistance(0);
-            command.setChargeSwitch((short) 2);
-            command.setIOControl((short) 0);
-            command.setRadarTmp((short) 0);
-            command.setCommandEnd((short) 1);
-            commands.add(command);
+            ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCodeNum, distCodeNum, allDistance, ShuttleRunDirection.get(startPath.getDirection()).id);
+            commands.add(moveCommand);
         }
 
         //灏忚溅鎸囦护鍒拌揪鐩爣浣嶇疆鍚庯紝鍐嶅彂鍑轰竴鏉℃墭鐩樹笅闄嶆寚浠�
-        command = new ShuttleCommand();
-        command.setCommandWord((short) 2);
-        command.setPalletLift((short) 2);
-        command.setCommandEnd((short) 1);
-        commands.add(command);
+        commands.add(shuttleThread.getPalletCommand((short) 2));
 
         assignCommand.setNodes(allNode);//褰撳墠浠诲姟鎵�鍗犵敤鐨勮妭鐐筶ist
         //鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢�
@@ -1001,7 +940,7 @@
                         if (Boolean.parseBoolean(searchIdleShuttle.get("sameLay").toString())) {
                             //鍚屼竴灞�(灏嗗皬杞︾Щ鍔ㄥ埌璐х墿浣嶇疆)
 
-                            List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftLocNo, assignCommand);
+                            List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftLocNo, assignCommand, shuttleThread);
                             //鍒嗛厤鐩爣搴撲綅
                             shuttleProtocol.setLocNo(wrkMast.getSourceLocNo());
                             //鐩爣搴撲綅
@@ -1012,7 +951,7 @@
                             //涓嶅悓灞傦紝灏嗙洰鏍囧簱浣嶅垎閰嶆垚鎻愬崌鏈哄簱浣嶅彿(灏嗗皬杞︾Щ鍔ㄥ埌鎻愬崌鏈轰綅缃�)
 
                             //灏忚溅鍒版彁鍗囨満鍙f寚浠�
-                            List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand);
+                            List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread);
                             shuttleProtocol.setLocNo(liftLocNo);
                             //鐩爣搴撲綅
                             assignCommand.setLocNo(liftLocNo);
@@ -1020,17 +959,13 @@
                             wrkMast.setWrkSts(22L);//灏忚溅杩佺Щ鐘舵��
                         }
                     } else if (wrkMast.getWrkSts() == 25) {
-                        List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftLocNo, assignCommand);
+                        List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, wrkMast.getSourceLocNo(), liftLocNo, assignCommand, shuttleThread);
                         //姝ゆ椂杞﹀湪鎻愬崌鏈哄唴閮紝闇�瑕佸涓嬭揪涓�姝ユ寚浠よ杞︾Щ鍔ㄥ埌鎻愬崌鏈哄彛
                         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);
+                        short startCode = Short.parseShort(basDevp.getQrCodeValue());//鎻愬崌鏈轰簩缁寸爜
+                        Short distCode = commands.get(0).getStartCodeNum();//鐩爣浜岀淮鐮�
+                        //鑾峰彇绉诲姩鍛戒护
+                        ShuttleCommand moveCommand = shuttleThread.getMoveCommand(startCode, distCode, 1300, commands.get(0).getRunDirection());
                         commands.add(0, moveCommand);//灏嗚鎸囦护娣诲姞鍒伴槦澶�
 
                         //鍒嗛厤鐩爣搴撲綅
@@ -1272,44 +1207,22 @@
                 //鎻愬崌鏈哄綋鍓嶆ゼ灞�
                 int liftLev = liftProtocol.getLev().intValue();
                 if (liftLev != 1) {
-                    //鎻愬崌鏈轰笉鍦�1灞�
-                    LiftCommand command1 = new LiftCommand();
-                    command1.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
-                    command1.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
-                    command1.setRun((short) 1);//鍗囬檷
-                    command1.setDistPosition((short) 1);//鐩爣妤煎眰1灞�
-                    command1.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+                    //鎻愬崌鏈轰笉鍦�1灞傦紝鑾峰彇鍒�1灞傜殑鎻愬崌鏈哄懡浠�
+                    LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), (short) 1);
                     commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
                 }
 
-                //杈撻�佺嚎灏嗚揣鐗╄繍杩涙潵
-                LiftCommand command2 = new LiftCommand();
-                command2.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
-                command2.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
-                command2.setRun((short) 6);//杈撻�佺嚎杩愪綔
-                command2.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+                //杈撻�佺嚎灏嗚揣鐗╄繍杩涙潵(姝h浆)
+                LiftCommand command2 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 1);
                 commands.add(command2);//灏嗗懡浠ゆ坊鍔犺繘list
 
-                //鎻愬崌鏈哄墠寰�鐩爣妤煎眰
-                LiftCommand command3 = new LiftCommand();
-                command3.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
-                command3.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
-                command3.setRun((short) 1);//鍗囬檷
-                command3.setDistPosition((short) wrkMastLocNoLey);//宸ヤ綔妗g洰鏍囨ゼ灞�
-                command3.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+                //鎻愬崌鏈哄墠寰�鐩爣妤煎眰(宸ヤ綔妗g洰鏍囨ゼ灞�)
+                LiftCommand command3 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), (short) wrkMastLocNoLey);
                 commands.add(command3);//灏嗗懡浠ゆ坊鍔犺繘list
 
-                //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓
+                //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓(鍙嶈浆)
                 //杈撻�佺嚎灏嗚揣鐗╃Щ鍑哄幓
-                LiftCommand command4 = new LiftCommand();
-                command4.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
-                command4.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
-                command4.setRun((short) 3);//杈撻�佺嚎杩愪綔
-                command4.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+                LiftCommand command4 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 2);
                 commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
             }else {
                 liftProtocol.setShuttleNo(wrkMast.getShuttleNo().shortValue());//璁剧疆鍥涘悜绌挎杞﹀彿
@@ -1338,45 +1251,24 @@
                 int liftLev = liftProtocol.getLev().intValue();
                 if (liftLev != currentLocNoLey) {
                     //涓嶅悓妤煎眰
-                    LiftCommand command1 = new LiftCommand();
-                    command1.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
-                    command1.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
-                    command1.setRun((short) 1);//鍗囬檷
-                    command1.setDistPosition((short) currentLocNoLey);//鐩爣妤煎眰(绌挎杞︽墍鍦ㄦゼ灞�)
-                    command1.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+                    //鑾峰彇鐩爣妤煎眰(绌挎杞︽墍鍦ㄦゼ灞�)鍛戒护
+                    LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), (short) currentLocNoLey);
                     commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
                 }
 
-                //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩杩涙潵
-                LiftCommand command2 = new LiftCommand();
-                command2.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
-                command2.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
-                command2.setRun((short) 6);//杈撻�佺嚎杩愪綔
-                command2.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+                //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩杩涙潵(姝h浆)
+                LiftCommand command2 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 1);
                 commands.add(command2);//灏嗗懡浠ゆ坊鍔犺繘list
 
                 if (liftLev != currentLocNoLey) {
-                    //鎻愬崌鏈哄墠寰�鐩爣妤煎眰
-                    LiftCommand command3 = new LiftCommand();
-                    command3.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
-                    command3.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
-                    command3.setRun((short) 1);//鍗囬檷
-                    command3.setDistPosition((short) wrkMastLocNoLey);//宸ヤ綔妗g洰鏍囨ゼ灞�
-                    command3.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+                    //鎻愬崌鏈哄墠寰�鐩爣妤煎眰(宸ヤ綔妗g洰鏍囨ゼ灞�)
+                    LiftCommand command3 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), (short) wrkMastLocNoLey);
                     commands.add(command3);//灏嗗懡浠ゆ坊鍔犺繘list
                 }
 
                 //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲嚭鍘�
-                //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩鍑哄幓
-                LiftCommand command4 = new LiftCommand();
-                command4.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
-                command4.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
-                command4.setRun((short) 3);//杈撻�佺嚎杩愪綔
-                command4.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+                //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩鍑哄幓(鍙嶈浆)
+                LiftCommand command4 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 2);
                 commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
             }
 
@@ -2261,7 +2153,7 @@
                 ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
 
                 //鑾峰彇灏忚溅鍒板厖鐢靛簱浣嶈矾寰勬寚浠�
-                List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, chargeLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand);
+                List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, chargeLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread);
                 //杩涜鍏呯數涓�
                 shuttleProtocol.setProtocolStatus(ShuttleProtocolStatusType.CHARGING);
 
@@ -2271,11 +2163,7 @@
                 assignCommand.setCharge(true);//鍏呯數浠诲姟
 
                 //鍒涘缓鍏呯數鎸囦护
-                ShuttleCommand command = new ShuttleCommand();
-                command.setCommandWord((short) 5);//鍏呯數
-                command.setShuttleNo(shuttleProtocol.getShuttleNo());
-                command.setChargeSwitch((short) 1);//寮�濮嬪厖鐢�
-                command.setCommandEnd((short) 1);
+                ShuttleCommand command = shuttleThread.getChargeSwitchCommand((short) 1);//寮�濮嬪厖鐢�
                 commands.add(command);
 
                 //鎸囦护闆嗗垎閰�
@@ -2292,7 +2180,7 @@
                 ShuttleAssignCommand assignCommand = new ShuttleAssignCommand();
 
                 //灏忚溅绉诲姩鍒版彁鍗囨満鍙o紝璁$畻璺緞
-                List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand);
+                List<ShuttleCommand> commands = this.shuttleAssignCommand(currentLocNo, liftLocNo, ShuttleTaskModeType.PAK_IN.id, assignCommand, shuttleThread);
                 //鍒嗛厤鐩爣搴撲綅
                 shuttleProtocol.setLocNo(liftLocNo);
 
@@ -2342,42 +2230,23 @@
             int liftLev = liftProtocol.getLev().intValue();
             if (liftLev != currentLev) {
                 //绌挎杞﹀拰鎻愬崌鏈哄浜庝笉鍚屾ゼ灞�
-                LiftCommand command1 = new LiftCommand();
-                command1.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
-                command1.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
-                command1.setRun((short) 1);//鍗囬檷
-                command1.setDistPosition(currentLev.shortValue());//鐩爣妤煎眰(绌挎杞︽墍鍦ㄦゼ灞�)
-                command1.setLiftLock(true);//閿佸畾鎻愬崌鏈�
+                //鑾峰彇鐩爣妤煎眰(绌挎杞︽墍鍦ㄦゼ灞�)鍛戒护
+                LiftCommand command1 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), currentLev.shortValue());
                 commands.add(command1);//灏嗗懡浠ゆ坊鍔犺繘list
             }
 
-            //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩杩涙潵
-            LiftCommand command2 = new LiftCommand();
-            command2.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
-            command2.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
-            command2.setRun((short) 6);//杈撻�佺嚎杩愪綔
-            command2.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+            //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩杩涙潵(姝h浆)
+            LiftCommand command2 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 1);
             commands.add(command2);//灏嗗懡浠ゆ坊鍔犺繘list
 
             //鎻愬崌鏈哄墠寰�鐩爣妤煎眰
-            LiftCommand command3 = new LiftCommand();
-            command3.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
-            command3.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
-            command3.setRun((short) 1);//鍗囬檷
-            command3.setDistPosition(chargeLocNoLev.shortValue());//鍏呯數搴撲綅鐩爣妤煎眰
-            command3.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+            //鑾峰彇鍏呯數搴撲綅鐩爣妤煎眰鍛戒护
+            LiftCommand command3 = liftThread.getLiftUpDownCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), chargeLocNoLev.shortValue());
             commands.add(command3);//灏嗗懡浠ゆ坊鍔犺繘list
 
             //鎻愬崌鏈哄埌杈炬寚瀹氭ゼ灞傦紝杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲嚭鍘�
-            //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩鍑哄幓
-            LiftCommand command4 = new LiftCommand();
-            command4.setLiftNo(liftProtocol.getLiftNo());//鎻愬崌鏈哄彿
-            command4.setTaskNo(liftProtocol.getTaskNo());//浠诲姟鍙�
-            command4.setRun((short) 3);//杈撻�佺嚎杩愪綔
-            command4.setLiftLock(true);//閿佸畾鎻愬崌鏈�
-
+            //杈撻�佺嚎灏嗗洓鍚戠┛姊溅绉诲姩鍑哄幓(鍙嶈浆)
+            LiftCommand command4 = liftThread.getLiftTurnCommand(liftProtocol.getLiftNo(), liftProtocol.getTaskNo(), 2);
             commands.add(command4);//灏嗗懡浠ゆ坊鍔犺繘list
 
             wrkCharge.setWrkSts(54L);//鎻愬崌鏈烘惉杩愪腑
@@ -2404,11 +2273,7 @@
                 assignCommand.setCharge(true);
 
                 //鍒涘缓鍏呯數鎸囦护
-                ShuttleCommand command = new ShuttleCommand();
-                command.setCommandWord((short) 5);//鍏呯數
-                command.setShuttleNo(shuttleProtocol.getShuttleNo());
-                command.setChargeSwitch((short) 2);//鏂紑鍏呯數
-                command.setCommandEnd((short) 1);
+                ShuttleCommand command = shuttleThread.getChargeSwitchCommand((short) 2);//鏂紑鍏呯數
                 commands.add(command);
 
                 //鎸囦护闆嗗垎閰�

--
Gitblit v1.9.1