From cd87c057ec64e917105bd85e4f562b54f7b165d7 Mon Sep 17 00:00:00 2001
From: zwl <1051256694@qq.com>
Date: 星期三, 10 九月 2025 17:31:26 +0800
Subject: [PATCH] 堆垛机任务下发优化

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   23 ++++++++++++++++++-----
 1 files changed, 18 insertions(+), 5 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 593a28b..2dea637 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -38,6 +38,7 @@
 import com.zy.core.properties.SlaveProperties;
 import com.zy.core.thread.BarcodeThread;
 import com.zy.core.thread.LedThread;
+import com.zy.core.thread.ScaleThread;
 import com.zy.core.thread.SiemensDevpThread;
 import com.zy.system.entity.Config;
 import com.zy.system.service.ConfigService;
@@ -340,6 +341,7 @@
                         errMsg = "鎵爜澶辫触";
                         back = true;
                     }
+
                     // 鍒ゆ柇鏄惁婊¤冻鍏ュ簱鏉′欢
                     if (staProtocol.isAutoing() && staProtocol.isLoading()
                             && staProtocol.isInEnable()
@@ -374,12 +376,23 @@
                             }
                         }
 
+                        ScaleThread scaleThread = (ScaleThread) SlaveConnection.get(SlaveType.Scale, inSta.getBarcode());
+                        if(scaleThread != null) {
+                            storageEscalationParam.setWeight(scaleThread.getScale());
+                        }
 
                         storageEscalationParam.setBoxNo(BoxNo);
                         //鏄惁婊℃澘 1婊℃澘  0绌烘澘
                         storageEscalationParam.setStaType(staProtocol.isEmptyMk() ? 0 : 1);
-                        //搴撲綅绫诲瀷 1楂樺簱浣� 0浣庡簱浣�
-                        storageEscalationParam.setLocType(staProtocol.isHigh() ? 1 : 0);
+                        //搴撲綅绫诲瀷 2涓簱浣� 1楂樺簱浣� 0浣庡簱浣�
+                        if(staProtocol.isHigh()){
+                            storageEscalationParam.setLocType(1);
+                        }else if(staProtocol.isLow()){
+                            storageEscalationParam.setLocType(0);
+                        }else if (staProtocol.isCentre()){
+                            storageEscalationParam.setLocType(2);
+                        }
+
                         storageEscalationParam.setTerminalNo(staProtocol.getSiteId());
                         log.info("缁勬墭鍏ュ簱={}", storageEscalationParam);
                         String response = "";
@@ -1118,7 +1131,7 @@
                 crnCommand.setDestinationPosX(Utils.getRowShort(taskWrk.getTargetPoint()));     // 鐩爣搴撲綅鍒�
                 crnCommand.setDestinationPosY(Utils.getBayShort(taskWrk.getTargetPoint()));     // 鐩爣搴撲綅灞�
                 crnCommand.setDestinationPosZ(Utils.getLevShort(taskWrk.getTargetPoint()));     // 鐩爣搴撲綅鎺�
-                crnCommand.setCommand((short) 1);
+                crnCommand.setCommand((short) 0);
                 log.info("鍫嗗灈鏈哄叆搴撲换鍔′笅鍙�={}", crnCommand);
                 if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(2, crnCommand), false)) {
                     log.error("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", taskWrk.getCrnNo(), JSON.toJSON(crnCommand));
@@ -1229,7 +1242,7 @@
                         command.setDestinationPosX(crnStn.getRow().shortValue());     // 鐩爣搴撲綅鎺�
                         command.setDestinationPosY(crnStn.getBay().shortValue());     // 鐩爣搴撲綅鍒�
                         command.setDestinationPosZ(crnStn.getLev().shortValue());     // 鐩爣搴撲綅灞�
-                        command.setCommand((short) 1);
+                        command.setCommand((short) 0);
 
                         if (!CommandUtils.offer(SlaveType.Crn, taskWrk.getCrnNo(), new Task(2, command), false)) {
                             log.error("鍫嗗灈鏈哄懡浠ょ敓鎴愬け璐ワ紝鍫嗗灈鏈哄彿={}锛屼换鍔℃暟鎹�={}", taskWrk.getCrnNo(), JSON.toJSON(command));
@@ -1832,7 +1845,7 @@
         taskWrk.setStatus(TaskStatusType.RECEIVE.id);//浠诲姟鐘舵�侊細鎺ユ敹
         taskWrk.setCreateTime(now);
         taskWrk.setIoType(1);//浠诲姟绫诲瀷 鍏ュ簱
-        taskWrk.setIoPri(13);//浼樺厛绾�
+        taskWrk.setIoPri(10);//浼樺厛绾�
         taskWrk.setBarcode(barcode);//鏉$爜
         taskWrk.setTargetPoint(locNo);
         taskWrk.setStartPoint(staNo+"");

--
Gitblit v1.9.1