From a18ed78675d0f7745ed1ebe519bfe0aa64c97dfe Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期三, 20 九月 2023 15:02:32 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/controller/LiftController.java |   34 ++++++++++++++++++++++++++++------
 1 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/LiftController.java b/src/main/java/com/zy/asrs/controller/LiftController.java
index 0104c32..244cb3c 100644
--- a/src/main/java/com/zy/asrs/controller/LiftController.java
+++ b/src/main/java/com/zy/asrs/controller/LiftController.java
@@ -234,14 +234,14 @@
                     //绉诲姩鎵樼洏
                     int workNo = commonService.getWorkNo(3);//鑾峰彇浠诲姟鍙�
 
-                    LiftStaProtocol sourceLiftSta = NyLiftUtils.getLiftStaByStaNo(param.getSourceStaNo());
-                    LiftStaProtocol liftSta = NyLiftUtils.getLiftStaByStaNo(param.getStaNo());
-                    if (sourceLiftSta == null || liftSta == null) {
-                        throw new CoolException("婧愮珯鎴栫洰鏍囩珯涓嶅瓨鍦�");
-                    }
+//                    LiftStaProtocol sourceLiftSta = NyLiftUtils.getLiftStaByStaNo(param.getSourceStaNo());
+//                    LiftStaProtocol liftSta = NyLiftUtils.getLiftStaByStaNo(param.getStaNo());
+//                    if (sourceLiftSta == null || liftSta == null) {
+//                        throw new CoolException("婧愮珯鎴栫洰鏍囩珯涓嶅瓨鍦�");
+//                    }
 
                     //鑾峰彇鎻愬崌鏈哄懡浠�
-                    NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, sourceLiftSta.getStaNo(), liftSta.getStaNo(), workNo);
+                    NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, param.getSourceStaNo(), param.getStaNo(), workNo);
                     ArrayList<NyLiftCommand> commands = new ArrayList<>();
                     commands.add(liftCommand);
 
@@ -258,6 +258,28 @@
                     } else {
                         throw new CoolException("鍛戒护涓嬪彂澶辫触");
                     }
+                } else if (param.getLiftTaskMode() == 0) {
+                    //鎻愬崌鏈哄浣�
+                    int workNo = commonService.getWorkNo(3);//鑾峰彇浠诲姟鍙�
+
+                    //鑾峰彇鎻愬崌鏈哄懡浠�
+                    NyLiftCommand liftCommand = NyLiftUtils.getLiftResetCommand(liftProtocol.getLiftNo().intValue());
+                    ArrayList<NyLiftCommand> commands = new ArrayList<>();
+                    commands.add(liftCommand);
+
+                    //鎻愪氦鍒扮嚎绋嬪幓宸ヤ綔
+                    LiftAssignCommand assignCommand = new LiftAssignCommand();
+                    assignCommand.setCommands(commands);
+                    assignCommand.setLiftNo(liftProtocol.getLiftNo());
+                    assignCommand.setTaskNo((short) workNo);
+                    assignCommand.setAuto(false);//鎵嬪姩妯″紡
+                    assignCommand.setTaskMode(NyLiftTaskModelType.RESET.id.shortValue());
+
+                    if (MessageQueue.offer(SlaveType.Lift, liftSlave.getId(), new Task(3, assignCommand))) {
+                        return R.ok();
+                    } else {
+                        throw new CoolException("鍛戒护涓嬪彂澶辫触");
+                    }
                 } else {
                     throw new CoolException("鏈煡鍛戒护");
                 }

--
Gitblit v1.9.1