From 32bf433492f540b1392c19757124ebb91d0e74bd Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 29 三月 2023 15:55:01 +0800
Subject: [PATCH] 四向车入库分配任务逻辑

---
 src/main/java/com/zy/asrs/controller/ShuttleController.java |   71 +++++++++++++++++++----------------
 1 files changed, 38 insertions(+), 33 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/ShuttleController.java b/src/main/java/com/zy/asrs/controller/ShuttleController.java
index fb88e02..839572d 100644
--- a/src/main/java/com/zy/asrs/controller/ShuttleController.java
+++ b/src/main/java/com/zy/asrs/controller/ShuttleController.java
@@ -63,21 +63,32 @@
                 continue;
             }
             ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol();
-            if (shuttleProtocol == null) {
+            if (shuttleProtocol == null || shuttleProtocol.getShuttleNo()==null) {
                 continue;
             }
             vo.setTaskNo(shuttleProtocol.getTaskNo().intValue());  //  浠诲姟鍙�
-            if (!Cools.isEmpty(shuttleProtocol.getBusyStatus())) {
-                vo.setStatus(shuttleProtocol.getBusyStatusType().desc); //  鐘舵��
-            }
-            vo.setBatteryPower(shuttleProtocol.getBatteryPower() + "%");
-            vo.setSpeed(shuttleProtocol.getCurrentMoveServoSpeed());
+            vo.setBusyStatus(shuttleProtocol.getBusyStatusType().desc); //鍥涘悜绌挎杞︾姸鎬�
+            vo.setStatus(shuttleProtocol.getProtocolStatusType().desc);//褰撳墠浠诲姟鐘舵��
+            vo.setCurrentCode(shuttleProtocol.getCurrentCode());//褰撳墠浜岀淮鐮�
+            vo.setBatteryPower(shuttleProtocol.getBatteryPower$() == null ? "" : shuttleProtocol.getBatteryPower$() + "%");//鐢垫睜鐢甸噺
+            vo.setBatteryTemp(shuttleProtocol.getBatteryTemp$() == null ? "" : shuttleProtocol.getBatteryTemp$() + "掳");//鐢垫睜娓╁害
             if (!Cools.isEmpty(shuttleProtocol.getErrorCode())) {
-                vo.setAlarm1(String.valueOf(shuttleProtocol.getErrorCode()));
+                vo.setErrorCode(shuttleProtocol.getErrorCodeType().desc);//閿欒缂栧彿
             }
+            vo.setPlcOutputStatusIO(shuttleProtocol.getPlcOutputStatusIO());//Plc杈撳嚭鐘舵�両O
             if (!Cools.isEmpty(shuttleProtocol.getStatusErrorCode())) {
-                vo.setAlarm2(String.valueOf(shuttleProtocol.getStatusErrorCode()));
+                vo.setStatusErrorCode(shuttleProtocol.getStatusErrorCode());//閿欒淇℃伅鐮�
             }
+            vo.setPlcInputStatus(shuttleProtocol.getPlcInputStatus());//PLC杈撳叆鐘舵��
+            vo.setCurrentOrBeforeCode(shuttleProtocol.getCurrentOrBeforeCode());//褰撳墠鎴栬�呬箣鍓嶈鍒扮殑浜岀淮鐮佸��
+            vo.setCodeOffsetX(shuttleProtocol.getCodeOffsetX());//璇诲埌鐨勪簩缁寸爜X鏂瑰悜鍋忕Щ閲�
+            vo.setCodeOffsetY(shuttleProtocol.getCodeOffsetY());//璇诲埌鐨勪簩缁寸爜Y鏂瑰悜鍋忕Щ閲�
+            vo.setCurrentVoltage(shuttleProtocol.getCurrentVoltage());//褰撳墠鐨勭數鍘嬪��
+            vo.setCurrentAnalogValue(shuttleProtocol.getCurrentAnalogValue());//褰撳墠鐨勬ā鎷熼噺鍊�
+            vo.setCurrentLiftServoSpeed(shuttleProtocol.getCurrentLiftServoSpeed());//褰撳墠鐨勫崌闄嶄己鏈嶉�熷害
+            vo.setCurrentMoveServoSpeed(shuttleProtocol.getCurrentMoveServoSpeed());//褰撳墠鐨勮璧颁己鏈嶉�熷害
+            vo.setCurrentLiftServoLoad(shuttleProtocol.getCurrentLiftServoLoad());//褰撳墠鐨勫崌闄嶄己鏈嶈礋杞界巼
+            vo.setCurrentMoveServoLoad(shuttleProtocol.getCurrentMoveServoLoad());//褰撳墠鐨勮璧颁己鏈嶈礋杞界巼
         }
         return R.ok().add(list);
     }
@@ -102,19 +113,26 @@
                 continue;
             }
 
-            vo.setWorkNo(shuttleProtocol.getTaskNo().intValue());  //  浠诲姟鍙�
+            vo.setWorkNo(shuttleProtocol.getTaskNo().intValue());//浠诲姟鍙�
             if (shuttleProtocol.getTaskNo() > 0) {
                 WrkMast wrkMast = wrkMastService.selectById(shuttleProtocol.getTaskNo());
                 if (wrkMast != null) {
-                    //vo.setStatus(CrnStatusType.process(wrkMast.getIoType()).getDesc());   //  妯″紡鐘舵��
-                    vo.setSourceStaNo(wrkMast.getSourceStaNo$());    //  婧愮珯
-                    vo.setStaNo(wrkMast.getStaNo$());   //  鐩爣绔�
-                    vo.setSourceLocNo(wrkMast.getSourceLocNo());    //  婧愬簱浣�
-                    vo.setLocNo(wrkMast.getLocNo());    //  鐩爣搴撲綅
+                    vo.setSourceLocNo(wrkMast.getSourceLocNo());//婧愬簱浣�
+                    vo.setDistLocNo(wrkMast.getLocNo());//鐩爣搴撲綅
                 }
             }
-            vo.setSpeed(shuttleProtocol.getCurrentMoveServoSpeed());  // 閫熷害
-            vo.setPakMk(shuttleProtocol.getPakMk().toString());    // 浣滀笟鏍囪
+            if (shuttleProtocol.getProtocolStatusType() != null) {
+                vo.setStatus(shuttleProtocol.getProtocolStatusType().desc);//鐘舵��
+            }
+            vo.setCodeOffsetX(shuttleProtocol.getCodeOffsetX());//璇诲埌鐨勪簩缁寸爜X鏂瑰悜鍋忕Щ閲�
+            vo.setCodeOffsetY(shuttleProtocol.getCodeOffsetY());//璇诲埌鐨勪簩缁寸爜Y鏂瑰悜鍋忕Щ閲�
+            vo.setCurrentVoltage(shuttleProtocol.getCurrentVoltage());//褰撳墠鐨勭數鍘嬪��
+            vo.setCurrentAnalogValue(shuttleProtocol.getCurrentAnalogValue());//褰撳墠鐨勬ā鎷熼噺鍊�
+            vo.setCurrentMoveServoSpeed(shuttleProtocol.getCurrentMoveServoSpeed());//褰撳墠鐨勮璧颁己鏈嶉�熷害
+            vo.setCurrentMoveServoLoad(shuttleProtocol.getCurrentMoveServoLoad() == null ? "" : shuttleProtocol.getCurrentMoveServoLoad() + "%");//褰撳墠鐨勮璧颁己鏈嶈礋杞界巼
+            vo.setCurrentLiftServoLoad(shuttleProtocol.getCurrentLiftServoLoad() == null ? "" : shuttleProtocol.getCurrentLiftServoLoad() + "%");//褰撳墠鐨勫崌闄嶄己鏈嶈礋杞界巼
+            vo.setCurrentLiftServoSpeed(shuttleProtocol.getCurrentLiftServoSpeed());//褰撳墠鐨勫崌闄嶄己鏈嶉�熷害
+            vo.setPakMk(shuttleProtocol.getPakMk()?"Y" : "N");    // 浣滀笟鏍囪
         }
         return R.ok().add(list);
     }
@@ -178,23 +196,6 @@
 
                 // 绌挎杞︽彁绀轰俊鎭� ----------------------
 
-                // 浠诲姟淇℃伅 ----------------
-                vo.setPakInTask(shuttleProtocol.isPakInTask());
-                vo.setPakOutTask(shuttleProtocol.isPakOutTask());
-                vo.setPakMoveTask(shuttleProtocol.isPakMoveTask());
-                vo.setGoHpTask(shuttleProtocol.isGoHpTask());
-                vo.setGoOHpTask(shuttleProtocol.isGoOHpTask());
-                vo.setGoHpAvoid(shuttleProtocol.isGoHpAvoid());
-                vo.setGoOHpAvoid(shuttleProtocol.isGoOHpAvoid());
-                vo.setPakInEmpty(shuttleProtocol.isPakInEmpty());
-                vo.setPakInFinish(shuttleProtocol.isPakInFinish());
-                vo.setPakOutEmpty(shuttleProtocol.isPakOutEmpty());
-                vo.setPakOutFinish(shuttleProtocol.isPakOutFinish());
-                vo.setGoHpAvoidFinish(shuttleProtocol.isGoHpAvoidFinish());
-                vo.setGoOHpAvoidFinish(shuttleProtocol.isGoOHpAvoidFinish());
-                vo.setGoHpAvoidErr(shuttleProtocol.isGoHpAvoidErr());
-                vo.setGoOHpAvoidErr(shuttleProtocol.isGoOHpAvoidErr());
-
                 // 鐘舵�佷俊鎭� -------------
 
                 break;
@@ -251,6 +252,10 @@
             return R.parse(BaseRes.PARAM);
         }
 
+        if (Cools.isEmpty(param.getSourceLocNo(), param.getDistLocNo())) {
+            return R.parse(BaseRes.PARAM);
+        }
+
         for (ShuttleSlave shuttleSlave : slaveProperties.getShuttle()) {
             if (param.getShuttleNo().equals(shuttleSlave.getId())) {
                 ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleSlave.getId());

--
Gitblit v1.9.1