From 79603e53c78e535dba4bfbc69b8c3b5c184012c5 Mon Sep 17 00:00:00 2001 From: Junjie <xjj@123> Date: 星期一, 08 四月 2024 09:16:05 +0800 Subject: [PATCH] # --- zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java | 417 ++++++++++++++++++++--------------------------------------- 1 files changed, 143 insertions(+), 274 deletions(-) diff --git a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java index beb76a3..e276f9a 100644 --- a/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java +++ b/zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/ShuttleCommandService.java @@ -3,6 +3,8 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.zy.asrs.framework.common.Cools; import com.zy.asrs.framework.exception.CoolException; +import com.zy.asrs.wcs.core.action.LiftAction; +import com.zy.asrs.wcs.core.action.ShuttleAction; import com.zy.asrs.wcs.core.entity.Loc; import com.zy.asrs.wcs.core.model.NavigateNode; import com.zy.asrs.wcs.core.model.command.ShuttleAssignCommand; @@ -17,8 +19,10 @@ import com.zy.asrs.wcs.core.entity.Motion; import com.zy.asrs.wcs.rcs.model.enums.ShuttleProtocolStatusType; import com.zy.asrs.wcs.rcs.model.enums.SlaveType; +import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol; import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol; import com.zy.asrs.wcs.core.service.MotionService; +import com.zy.asrs.wcs.rcs.thread.LiftThread; import com.zy.asrs.wcs.rcs.thread.ShuttleThread; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -50,6 +54,10 @@ private LocService locService; @Autowired private NavigateMapUtils navigateMapUtils; + @Autowired + private ShuttleAction shuttleAction; + @Autowired + private LiftAction liftAction; // 璁$畻 public Boolean accept(Motion motion) { @@ -73,16 +81,16 @@ } ShuttleAssignCommand assignCommand = new ShuttleAssignCommand(); - assignCommand.setShuttleNo(deviceNo.shortValue()); - assignCommand.setTaskNo(motion.getWrkNo().shortValue()); + assignCommand.setShuttleNo(deviceNo); + assignCommand.setTaskNo(motion.getWrkNo()); assignCommand.setSourceLocNo(motion.getOrigin()); assignCommand.setLocNo(motion.getTarget()); List<ShuttleCommand> shuttleCommands = new ArrayList<>(); ShuttleTaskModeType shuttleTaskModeType = null; -// SiemensLiftThread liftThread = null; -// LiftProtocol liftProtocol = null; + LiftThread liftThread = null; + LiftProtocol liftProtocol = null; //鍒ゆ柇灏忚溅鐘舵�� if (shuttleProtocol.getIdle() @@ -103,38 +111,80 @@ shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread); shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO; break; -// case SHUTTLE_MOVE_LIFT_PALLET://绌挎杞﹂《鍗囧苟绉诲姩 -// shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread); -// shuttleTaskModeType = ShuttleTaskModeType.PAK_IN; -// shuttleCommands.add(0, shuttleThread.getPalletCommand((short) 1)); -// break; -// case SHUTTLE_MOVE_DOWN_PALLET://绌挎杞︾Щ鍔ㄥ苟鎵樼洏涓嬮檷 -// shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread); -// shuttleTaskModeType = ShuttleTaskModeType.PAK_IN; -// shuttleCommands.add(shuttleCommands.size(), shuttleThread.getPalletCommand((short) 2)); -// break; -// case SHUTTLE_MOVE_FROM_LIFT://鍑烘彁鍗囨満 -// // 鍒ゆ柇鎻愬崌鏈虹姸鎬� -// liftThread = (SiemensLiftThread) SlaveConnection.get(SlaveType.Lift, Integer.parseInt(motion.getTemp())); -// if (liftThread == null) { -// return false; -// } -// liftProtocol = liftThread.getLiftProtocol(); -// // 鍒ゆ柇鎻愬崌鏈烘槸鍚﹁嚜鍔ㄣ�佺┖闂层�佸噯澶囧氨缁�侀摼鏉℃病鏈夎浆鍔ㄣ�佹病鏈夋湭灏辩华鎶ラ敊 -// if (!liftProtocol.getMode() -// || liftProtocol.getRunning() -// || !liftProtocol.getReady() -// || liftProtocol.getForwardRotationFeedback() -// || liftProtocol.getReverseFeedback() -// || liftProtocol.getNotReady().intValue() != 0 -// ) { -// return false; -// } + case SHUTTLE_MOVE_LIFT_PALLET://绌挎杞﹂《鍗囧苟绉诲姩 + shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread); + shuttleTaskModeType = ShuttleTaskModeType.PAK_IN; + shuttleCommands.add(0, shuttleThread.getLiftCommand(motion.getWrkNo(), true)); + break; + case SHUTTLE_MOVE_DOWN_PALLET://绌挎杞︾Щ鍔ㄥ苟鎵樼洏涓嬮檷 + shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread); + shuttleTaskModeType = ShuttleTaskModeType.PAK_IN; + shuttleCommands.add(shuttleCommands.size(), shuttleThread.getLiftCommand(motion.getWrkNo(), false)); + break; + case SHUTTLE_MOVE_FROM_LIFT://鍑烘彁鍗囨満 + // 鍒ゆ柇鎻愬崌鏈虹姸鎬� + liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, Integer.parseInt(motion.getTemp())); + if (liftThread == null) { + return false; + } + + liftProtocol = liftThread.getStatus(); + if (liftProtocol == null) { + return false; + } + + // 鍒ゆ柇鎻愬崌鏈烘槸鍚︾┖闂� + if (!liftThread.isIdle()) { + return false; + } + + if (liftProtocol.getLev() != Utils.getLev(motion.getTarget())) {//鍒ゆ柇鎻愬崌鏈烘槸鍚﹁揪鍒扮洰鏍囧眰 + return false; + } + +// //鍒ゆ柇鎻愬崌鏈烘槸鍚﹁閿佸畾 +// if (!liftProtocol.getLock()) { +// //閿佸畾鎻愬崌鏈� +// LiftCommand lockCommand = liftThread.getLockCommand(motion.getWrkNo(), true);//鑾峰彇鎻愬崌鏈洪攣瀹氬懡浠� // -// if (liftProtocol.getLev().intValue() != Utils.getLev(motion.getTarget())) {//鍒ゆ柇鎻愬崌鏈烘槸鍚﹁揪鍒扮洰鏍囧眰 -// return false; -// } +// LiftAssignCommand liftAssignCommand = new LiftAssignCommand(); +// liftAssignCommand.setLiftNo(liftThread.getStatus().getLiftNo()); +// liftAssignCommand.setTaskNo(motion.getWrkNo()); +// ArrayList<LiftCommand> list = new ArrayList<>(); +// list.add(lockCommand); +// liftAssignCommand.setCommands(list); // +// liftAction.assignWork(liftThread.getDevice(), liftAssignCommand); +// return false;//绛夊緟涓嬩竴娆¤疆璇� +// } + + //鍒ゆ柇鎻愬崌鏈哄伐浣滃彿鏄惁鍜屽綋鍓嶄换鍔$浉鍚� + if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) { + return false; + } + + shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread); + shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO; + break; + case SHUTTLE_MOVE_TO_LIFT://杩涙彁鍗囨満 + // 鍒ゆ柇鎻愬崌鏈虹姸鎬� + liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, Integer.parseInt(motion.getTemp())); + if (liftThread == null) { + return false; + } + liftProtocol = liftThread.getStatus(); + if (liftProtocol == null) { + return false; + } + // 鍒ゆ柇鎻愬崌鏈烘槸鍚︾┖闂� + if (!liftThread.isIdle()) { + return false; + } + + if (liftProtocol.getLev() != Utils.getLev(motion.getTarget())) {//鍒ゆ柇鎻愬崌鏈烘槸鍚﹁揪鍒扮洰鏍囧眰 + return false; + } + // //鍒ゆ柇鎻愬崌鏈烘槸鍚﹁閿佸畾 // if (!liftProtocol.getLiftLock()) { // //閿佸畾鎻愬崌鏈� @@ -144,213 +194,33 @@ // liftThread.assignWork(lockCommand); // return false;//绛夊緟涓嬩竴娆¤疆璇� // } -// -// //鍒ゆ柇鎻愬崌鏈哄伐浣滃彿鏄惁鍜屽綋鍓嶄换鍔$浉鍚� -// if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) { -// return false; -// } -// -// shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread); -// shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO; -// break; -// case SHUTTLE_MOVE_TO_LIFT://杩涙彁鍗囨満 -// // 鍒ゆ柇鎻愬崌鏈虹姸鎬� -// liftThread = (SiemensLiftThread) SlaveConnection.get(SlaveType.Lift, Integer.parseInt(motion.getTemp())); -// if (liftThread == null) { -// return false; -// } -// liftProtocol = liftThread.getLiftProtocol(); -// // 鍒ゆ柇鎻愬崌鏈烘槸鍚﹁嚜鍔ㄣ�佺┖闂层�佸噯澶囧氨缁�侀摼鏉℃病鏈夎浆鍔ㄣ�佹病鏈夋湭灏辩华鎶ラ敊 -// if (!liftProtocol.getMode() -// || liftProtocol.getRunning() -// || !liftProtocol.getReady() -// || liftProtocol.getForwardRotationFeedback() -// || liftProtocol.getReverseFeedback() -// || liftProtocol.getNotReady().intValue() != 0 -// ) { -// return false; -// } -// -// if (liftProtocol.getLev().intValue() != Utils.getLev(motion.getTarget())) {//鍒ゆ柇鎻愬崌鏈烘槸鍚﹁揪鍒扮洰鏍囧眰 -// return false; -// } -// -// //鍒ゆ柇鎻愬崌鏈烘槸鍚﹁閿佸畾 -// if (!liftProtocol.getLiftLock()) { -// //閿佸畾鎻愬崌鏈� -// LiftCommand lockCommand = liftThread.getLockCommand(true);//鑾峰彇鎻愬崌鏈洪攣瀹氬懡浠� -// lockCommand.setLiftNo(liftProtocol.getLiftNo()); -// lockCommand.setTaskNo(motion.getWrkNo().shortValue());//鑾峰彇浠诲姟鍙� -// liftThread.assignWork(lockCommand); -// return false;//绛夊緟涓嬩竴娆¤疆璇� -// } -// -// //鍒ゆ柇鎻愬崌鏈哄伐浣滃彿鏄惁鍜屽綋鍓嶄换鍔$浉鍚� -// if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) { -// return false; -// } -// -// shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread); -// shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO; -// break; -// case SHUTTLE_MOVE_FROM_CONVEYOR: -// shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread); -// shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO; -// break; -// case SHUTTLE_MOVE_TO_CONVEYOR: -// shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread); -// shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO; -// break; -// case SHUTTLE_MOVE_FROM_LIFT_TO_CONVEYOR://绌挎杞﹀嚭鎻愬崌鏈哄幓杈撻�佺嚎 -// // 鍒ゆ柇鎻愬崌鏈虹姸鎬� -// liftThread = (SiemensLiftThread) SlaveConnection.get(SlaveType.Lift, Integer.parseInt(motion.getTemp())); -// if (liftThread == null) { -// return false; -// } -// liftProtocol = liftThread.getLiftProtocol(); -// // 鍒ゆ柇鎻愬崌鏈烘槸鍚﹁嚜鍔ㄣ�佺┖闂层�佸噯澶囧氨缁�侀摼鏉℃病鏈夎浆鍔ㄣ�佹病鏈夋湭灏辩华鎶ラ敊 -// if (!liftProtocol.getMode() -// || liftProtocol.getRunning() -// || !liftProtocol.getReady() -// || liftProtocol.getForwardRotationFeedback() -// || liftProtocol.getReverseFeedback() -// || liftProtocol.getNotReady().intValue() != 0 -// ) { -// return false; -// } -// -// if (liftProtocol.getLev().intValue() != Utils.getLev(motion.getTarget())) {//鍒ゆ柇鎻愬崌鏈烘槸鍚﹁揪鍒扮洰鏍囧眰 -// return false; -// } -// -// //鍒ゆ柇鎻愬崌鏈烘槸鍚﹁閿佸畾 -// if (!liftProtocol.getLiftLock()) { -// //閿佸畾鎻愬崌鏈� -// LiftCommand lockCommand = liftThread.getLockCommand(true);//鑾峰彇鎻愬崌鏈洪攣瀹氬懡浠� -// lockCommand.setLiftNo(liftProtocol.getLiftNo()); -// lockCommand.setTaskNo(motion.getWrkNo().shortValue());//鑾峰彇浠诲姟鍙� -// liftThread.assignWork(lockCommand); -// return false;//绛夊緟涓嬩竴娆¤疆璇� -// } -// -// //鍒ゆ柇鎻愬崌鏈哄伐浣滃彿鏄惁鍜屽綋鍓嶄换鍔$浉鍚� -// if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) { -// return false; -// } -// -// shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread); -// shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO; -// break; -// case SHUTTLE_TRANSPORT: -// shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread); -// shuttleTaskModeType = ShuttleTaskModeType.PAK_IN; -// -// shuttleCommands.add(0, shuttleThread.getPalletCommand((short) 1)); -// shuttleCommands.add(shuttleCommands.size(), shuttleThread.getPalletCommand((short) 2)); -// break; -// case SHUTTLE_TRANSPORT_FROM_LIFT://绌挎杞﹁浇璐у嚭鎻愬崌鏈� -// // 鍒ゆ柇鎻愬崌鏈虹姸鎬� -// liftThread = (SiemensLiftThread) SlaveConnection.get(SlaveType.Lift, Integer.parseInt(motion.getTemp())); -// if (liftThread == null) { -// return false; -// } -// liftProtocol = liftThread.getLiftProtocol(); -// // 鍒ゆ柇鎻愬崌鏈烘槸鍚﹁嚜鍔ㄣ�佺┖闂层�佸噯澶囧氨缁�侀摼鏉℃病鏈夎浆鍔ㄣ�佹病鏈夋湭灏辩华鎶ラ敊 -// if (!liftProtocol.getMode() -// || liftProtocol.getRunning() -// || !liftProtocol.getReady() -// || liftProtocol.getForwardRotationFeedback() -// || liftProtocol.getReverseFeedback() -// || liftProtocol.getNotReady().intValue() != 0 -// ) { -// return false; -// } -// -// if (liftProtocol.getLev().intValue() != Utils.getLev(motion.getTarget())) {//鍒ゆ柇鎻愬崌鏈烘槸鍚﹁揪鍒扮洰鏍囧眰 -// return false; -// } -// -// //鍒ゆ柇鎻愬崌鏈烘槸鍚﹁閿佸畾 -// if (!liftProtocol.getLiftLock()) { -// //閿佸畾鎻愬崌鏈� -// LiftCommand lockCommand = liftThread.getLockCommand(true);//鑾峰彇鎻愬崌鏈洪攣瀹氬懡浠� -// lockCommand.setLiftNo(liftProtocol.getLiftNo()); -// lockCommand.setTaskNo(motion.getWrkNo().shortValue());//鑾峰彇浠诲姟鍙� -// liftThread.assignWork(lockCommand); -// return false;//绛夊緟涓嬩竴娆¤疆璇� -// } -// -// //鍒ゆ柇鎻愬崌鏈哄伐浣滃彿鏄惁鍜屽綋鍓嶄换鍔$浉鍚� -// if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) { -// return false; -// } -// -// shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread); -// shuttleTaskModeType = ShuttleTaskModeType.PAK_IN; -// shuttleCommands.add(0, shuttleThread.getPalletCommand((short) 1)); -//// shuttleCommands.add(shuttleCommands.size(), shuttleThread.getPalletCommand((short) 2)); -// break; -// case SHUTTLE_TRANSPORT_TO_LIFT://绌挎杞﹁浇璐ц繘鎻愬崌鏈� -// // 鍒ゆ柇鎻愬崌鏈虹姸鎬� -// liftThread = (SiemensLiftThread) SlaveConnection.get(SlaveType.Lift, Integer.parseInt(motion.getTemp())); -// if (liftThread == null) { -// return false; -// } -// liftProtocol = liftThread.getLiftProtocol(); -// // 鍒ゆ柇鎻愬崌鏈烘槸鍚﹁嚜鍔ㄣ�佺┖闂层�佸噯澶囧氨缁�侀摼鏉℃病鏈夎浆鍔ㄣ�佹病鏈夋湭灏辩华鎶ラ敊 -// if (!liftProtocol.getMode() -// || liftProtocol.getRunning() -// || !liftProtocol.getReady() -// || liftProtocol.getForwardRotationFeedback() -// || liftProtocol.getReverseFeedback() -// || liftProtocol.getNotReady().intValue() != 0 -// ) { -// return false; -// } -// -// if (liftProtocol.getLev().intValue() != Utils.getLev(motion.getTarget())) {//鍒ゆ柇鎻愬崌鏈烘槸鍚﹁揪鍒扮洰鏍囧眰 -// return false; -// } -// -// //鍒ゆ柇鎻愬崌鏈烘槸鍚﹁閿佸畾 -// if (!liftProtocol.getLiftLock()) { -// //閿佸畾鎻愬崌鏈� -// LiftCommand lockCommand = liftThread.getLockCommand(true);//鑾峰彇鎻愬崌鏈洪攣瀹氬懡浠� -// lockCommand.setLiftNo(liftProtocol.getLiftNo()); -// lockCommand.setTaskNo(motion.getWrkNo().shortValue());//鑾峰彇浠诲姟鍙� -// liftThread.assignWork(lockCommand); -// return false;//绛夊緟涓嬩竴娆¤疆璇� -// } -// -// //鍒ゆ柇鎻愬崌鏈哄伐浣滃彿鏄惁鍜屽綋鍓嶄换鍔$浉鍚� -// if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) { -// return false; -// } -// -// shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread); -// shuttleTaskModeType = ShuttleTaskModeType.PAK_IN; -//// shuttleCommands.add(0, shuttleThread.getPalletCommand((short) 1)); -// shuttleCommands.add(shuttleCommands.size(), shuttleThread.getPalletCommand((short) 2)); -// break; -// case SHUTTLE_TRANSPORT_FROM_CONVEYOR: -// shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread); -// shuttleTaskModeType = ShuttleTaskModeType.PAK_IN; -// -// shuttleCommands.add(0, shuttleThread.getPalletCommand((short) 1)); -// shuttleCommands.add(shuttleCommands.size(), shuttleThread.getPalletCommand((short) 2)); -// break; -// case SHUTTLE_TRANSPORT_TO_CONVEYOR: -// shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.DFX.id, assignCommand, shuttleThread); -// shuttleTaskModeType = ShuttleTaskModeType.PAK_IN; -// -// shuttleCommands.add(0, shuttleThread.getPalletCommand((short) 1)); -// shuttleCommands.add(shuttleCommands.size(), shuttleThread.getPalletCommand((short) 2)); -// break; -// case SHUTTLE_CHARGE_ON: -// shuttleTaskModeType = ShuttleTaskModeType.CHARGE; -// shuttleCommands.add(shuttleThread.getChargeSwitchCommand((short) 1)); -// assignCommand.setCharge(Boolean.TRUE); -// break; + + //鍒ゆ柇鎻愬崌鏈哄伐浣滃彿鏄惁鍜屽綋鍓嶄换鍔$浉鍚� + if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) { + return false; + } + + shuttleCommands = this.shuttleAssignCommand(motion.getOrigin(), motion.getTarget(), NavigationMapType.NORMAL.id, assignCommand, shuttleThread); + shuttleTaskModeType = ShuttleTaskModeType.SHUTTLE_MOVE_LOC_NO; + break; + case SHUTTLE_CHARGE_ON://鍏呯數寮� + shuttleTaskModeType = ShuttleTaskModeType.CHARGE; + shuttleCommands.add(shuttleThread.getChargeCommand(motion.getWrkNo(), true)); + assignCommand.setCharge(Boolean.TRUE); + break; + case SHUTTLE_CHARGE_OFF://鍏呯數鍏� + shuttleTaskModeType = ShuttleTaskModeType.CHARGE; + shuttleCommands.add(shuttleThread.getChargeCommand(motion.getWrkNo(), false)); + assignCommand.setCharge(Boolean.TRUE); + break; + case SHUTTLE_PALLET_LIFT://鎵樼洏椤跺崌 + shuttleTaskModeType = ShuttleTaskModeType.PALLET_LIFT; + shuttleCommands.add(shuttleThread.getLiftCommand(motion.getWrkNo(), true)); + break; + case SHUTTLE_PALLET_DOWN://鎵樼洏涓嬮檷 + shuttleTaskModeType = ShuttleTaskModeType.PALLET_DOWN; + shuttleCommands.add(shuttleThread.getLiftCommand(motion.getWrkNo(), false)); + break; default: throw new CoolException(motion.getMotionCtgEl() + "娌℃湁鎸囧畾浠诲姟浣滀笟娴佺▼锛侊紒锛�"); } @@ -360,21 +230,19 @@ } assert null != shuttleTaskModeType; - assignCommand.setTaskMode(shuttleTaskModeType.id.shortValue());//鍏ュ嚭搴撴ā寮� + assignCommand.setTaskMode(shuttleTaskModeType.id);//鍏ュ嚭搴撴ā寮� assignCommand.setCommands(shuttleCommands); if (motion.getOrigin() != null && motion.getTarget() != null) { //鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢� - boolean lockResult = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(motion.getTarget()), Integer.parseInt(shuttleProtocol.getShuttleNo()), assignCommand.getNodes(), true);//鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢� + boolean lockResult = navigateMapUtils.writeNavigateNodeToRedisMap(Utils.getLev(motion.getTarget()), shuttleProtocol.getShuttleNo(), assignCommand.getNodes(), true);//鎵�浣跨敤鐨勮矾寰勮繘琛岄攣瀹氱鐢� if (!lockResult) { return false;//閿佸畾澶辫触 } -// shuttleThread.assignWork(assignCommand); - }else { -// shuttleThread.assignWork(assignCommand); } - return Boolean.TRUE; + boolean result = shuttleAction.assignWork(shuttleThread.getDevice(), assignCommand); + return result; } public Boolean finish(Motion motion) { @@ -404,12 +272,13 @@ return false; } - if (!shuttleProtocol.getIdle()) { + //鍒ゆ柇璁惧鏄惁绌洪棽 + if (!shuttleThread.isIdle()) { return false; } -// SiemensLiftThread liftThread = null; -// LiftProtocol liftProtocol = null; + LiftThread liftThread = null; + LiftProtocol liftProtocol = null; switch (Objects.requireNonNull(MotionCtgType.get(motion.getMotionCtgEl()))){ case SHUTTLE_MOVE: @@ -421,21 +290,21 @@ return false; } break; -// case SHUTTLE_MOVE_TO_LIFT: -// case SHUTTLE_MOVE_FROM_LIFT: -// case SHUTTLE_TRANSPORT_FROM_LIFT: -// case SHUTTLE_TRANSPORT_TO_LIFT: -// case SHUTTLE_MOVE_FROM_LIFT_TO_CONVEYOR: -// liftThread = (SiemensLiftThread) SlaveConnection.get(SlaveType.Lift, Integer.parseInt(motion.getTemp())); -// if (liftThread == null) { -// return false; -// } -// liftProtocol = liftThread.getLiftProtocol(); -// -// if (!shuttleProtocol.getCurrentLocNo().equals(motion.getTarget())) { -// return false; -// } -// + case SHUTTLE_MOVE_TO_LIFT: + case SHUTTLE_MOVE_FROM_LIFT: + case SHUTTLE_TRANSPORT_FROM_LIFT: + case SHUTTLE_TRANSPORT_TO_LIFT: + case SHUTTLE_MOVE_FROM_LIFT_TO_CONVEYOR: + liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, Integer.parseInt(motion.getTemp())); + if (liftThread == null) { + return false; + } + liftProtocol = liftThread.getStatus(); + + if (!shuttleProtocol.getCurrentLocNo().equals(motion.getTarget())) { + return false; + } + // //鍒ゆ柇鎻愬崌鏈烘槸鍚﹁閿佸畾 // if (liftProtocol.getLiftLock()) { // //瑙i攣鎻愬崌鏈� @@ -445,18 +314,18 @@ // liftThread.assignWork(lockCommand); // return false; // } -// -// //鍒ゆ柇鎻愬崌鏈哄伐浣滃彿鏄惁鍜屽綋鍓嶄换鍔$浉鍚� -// if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) { -// return false; -// } -// -// if (liftProtocol.getTaskNo().intValue() != 0) { + + //鍒ゆ柇鎻愬崌鏈哄伐浣滃彿鏄惁鍜屽綋鍓嶄换鍔$浉鍚� + if (liftProtocol.getTaskNo().intValue() != motion.getWrkNo()) { + return false; + } + +// if (liftProtocol.getTaskNo() != 0) { // //娓呯┖鎻愬崌鏈哄彿 // liftThread.setTaskNo(0); // } -// -// break; + + break; default: break; } -- Gitblit v1.9.1