From 944994450e3ba369e218e24c3f5ef3996f5c183c Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期三, 20 九月 2023 16:32:35 +0800 Subject: [PATCH] # --- src/main/java/com/zy/asrs/controller/LiftController.java | 44 ++++++++++++++++++++++++++++---------------- 1 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/zy/asrs/controller/LiftController.java b/src/main/java/com/zy/asrs/controller/LiftController.java index a2199df..244cb3c 100644 --- a/src/main/java/com/zy/asrs/controller/LiftController.java +++ b/src/main/java/com/zy/asrs/controller/LiftController.java @@ -234,24 +234,14 @@ //绉诲姩鎵樼洏 int workNo = commonService.getWorkNo(3);//鑾峰彇浠诲姟鍙� - Integer startSta = null; - Integer targetSta = null; - for (LiftStaProtocol liftStaProtocol : liftThread.getLiftStaProtocols()) { - if (liftStaProtocol.getStaNo() == param.getSourceStaNo()) { - startSta = liftStaProtocol.getStaNo(); - } - - if (liftStaProtocol.getLev() == param.getStaNo()) { - targetSta = liftStaProtocol.getStaNo(); - } - } - - if (startSta == null || targetSta == 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, startSta, targetSta, 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); @@ -268,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