|
|
@ -290,6 +290,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
*/ |
|
|
|
private int stackerNum = 1; |
|
|
|
|
|
|
|
private boolean againRequireSuccess = false; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Device getDevice() { |
|
|
|
return this.device; |
|
|
@ -382,13 +385,132 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
return device == null ? false : device.getDeviceDriver() instanceof StandardStorageDeviceDriver; |
|
|
|
} |
|
|
|
|
|
|
|
private static final List<Integer> AGAIN_ERROR = Arrays.asList(5, 6, 16); |
|
|
|
|
|
|
|
@SneakyThrows |
|
|
|
@Override |
|
|
|
public void executeLogic() { |
|
|
|
stackerNum = Optional.ofNullable(this.getExtraValue().get("stackerNum")).map(Object::toString).map(Integer::parseInt).orElse(1); |
|
|
|
|
|
|
|
if (this.back_command != this.lastBack_command || this.front_command != this.lastFront_command) { |
|
|
|
this.requireSuccess = false; |
|
|
|
} |
|
|
|
|
|
|
|
if (front_Zerror != lastFront_Zerror || back_Zerror != lastBack_Zerror) { |
|
|
|
if (AGAIN_ERROR.contains(front_Zerror) || AGAIN_ERROR.contains(back_Zerror)) { |
|
|
|
this.againRequireSuccess = false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//前叉满入
|
|
|
|
if (front_Zerror == 5) { |
|
|
|
//先解警
|
|
|
|
//重新下发放货点位信息
|
|
|
|
//
|
|
|
|
if (!againRequireSuccess) { |
|
|
|
List<String> keys = Arrays.asList(ItemProtocol.TO_Z.getKey(), ItemProtocol.TO_X.getKey(), ItemProtocol.TO_Y.getKey(), ItemProtocol.TO_FRONT_TASK.getKey(), ItemProtocol.TO_CHOOSE_FORK.getKey(), ItemProtocol.TO_COMMAND.getKey()); |
|
|
|
List<Object> values = Arrays.asList(2, 25, 5, this.front_task, SendSignalEnum.CHOOSE_FORK_ONE.getSignalNum(), SendSignalEnum.COMMAND_TWO.getSignalNum()); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), 5); |
|
|
|
this.writing(keys, values); |
|
|
|
this.againRequireSuccess = true; |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
//后叉满入
|
|
|
|
else if (back_Zerror == 5) { |
|
|
|
//先解警
|
|
|
|
//重新下发放货点位信息
|
|
|
|
if (!againRequireSuccess) { |
|
|
|
List<String> keys = Arrays.asList(ItemProtocol.TO_Z.getKey(), ItemProtocol.TO_X.getKey(), ItemProtocol.TO_Y.getKey(), ItemProtocol.TO_BACK_TASK.getKey(), ItemProtocol.TO_CHOOSE_FORK.getKey(), ItemProtocol.TO_COMMAND.getKey()); |
|
|
|
List<Object> values = Arrays.asList(2, 30, 6, this.back_task, SendSignalEnum.CHOOSE_FORK_TWO.getSignalNum(), SendSignalEnum.COMMAND_TWO.getSignalNum()); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), 5); |
|
|
|
this.writing(keys, values); |
|
|
|
this.againRequireSuccess = true; |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//前叉空出
|
|
|
|
if (front_Zerror == 6) { |
|
|
|
//先解警
|
|
|
|
//重新下发取货点位信息
|
|
|
|
if (!againRequireSuccess) { |
|
|
|
List<String> keys = Arrays.asList(ItemProtocol.TO_Z.getKey(), ItemProtocol.TO_X.getKey(), ItemProtocol.TO_Y.getKey(), ItemProtocol.TO_FRONT_TASK.getKey(), ItemProtocol.TO_CHOOSE_FORK.getKey(), ItemProtocol.TO_COMMAND.getKey()); |
|
|
|
List<Object> values = Arrays.asList(2, 25, 5, this.front_task, SendSignalEnum.CHOOSE_FORK_ONE.getSignalNum(), SendSignalEnum.COMMAND_ONE.getSignalNum()); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), 5); |
|
|
|
this.writing(keys, values); |
|
|
|
this.againRequireSuccess = true; |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
//后叉空出
|
|
|
|
else if (back_Zerror == 6) { |
|
|
|
//先解警
|
|
|
|
//重新下发取货点位信息
|
|
|
|
if (!againRequireSuccess) { |
|
|
|
List<String> keys = Arrays.asList(ItemProtocol.TO_Z.getKey(), ItemProtocol.TO_X.getKey(), ItemProtocol.TO_Y.getKey(), ItemProtocol.TO_BACK_TASK.getKey(), ItemProtocol.TO_CHOOSE_FORK.getKey(), ItemProtocol.TO_COMMAND.getKey()); |
|
|
|
List<Object> values = Arrays.asList(2, 30, 5, this.front_task, SendSignalEnum.CHOOSE_FORK_TWO.getSignalNum(), SendSignalEnum.COMMAND_ONE.getSignalNum()); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), 5); |
|
|
|
this.writing(keys, values); |
|
|
|
this.againRequireSuccess = true; |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
//前叉浅货位有货
|
|
|
|
if (front_Zerror == 16) { |
|
|
|
//先解警
|
|
|
|
//重新下发取放货点位信息
|
|
|
|
if (!againRequireSuccess) { |
|
|
|
//判断是取货阻挡还是放货阻挡
|
|
|
|
//取货阻挡
|
|
|
|
if (this.front_command == 1) { |
|
|
|
List<String> keys = Arrays.asList(ItemProtocol.TO_Z.getKey(), ItemProtocol.TO_X.getKey(), ItemProtocol.TO_Y.getKey(), ItemProtocol.TO_FRONT_TASK.getKey(), ItemProtocol.TO_CHOOSE_FORK.getKey(), ItemProtocol.TO_COMMAND.getKey()); |
|
|
|
List<Object> values = Arrays.asList(3, 18, 6, this.front_task, SendSignalEnum.CHOOSE_FORK_ONE.getSignalNum(), SendSignalEnum.COMMAND_ONE.getSignalNum()); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), 5); |
|
|
|
this.writing(keys, values); |
|
|
|
this.againRequireSuccess = true; |
|
|
|
} |
|
|
|
//放货阻挡
|
|
|
|
else if (this.front_command == 3) { |
|
|
|
List<String> keys = Arrays.asList(ItemProtocol.TO_Z.getKey(), ItemProtocol.TO_X.getKey(), ItemProtocol.TO_Y.getKey(), ItemProtocol.TO_FRONT_TASK.getKey(), ItemProtocol.TO_CHOOSE_FORK.getKey(), ItemProtocol.TO_COMMAND.getKey()); |
|
|
|
List<Object> values = Arrays.asList(3, 22, 6, this.front_task, SendSignalEnum.CHOOSE_FORK_ONE.getSignalNum(), SendSignalEnum.COMMAND_TWO.getSignalNum()); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), 5); |
|
|
|
this.writing(keys, values); |
|
|
|
this.againRequireSuccess = true; |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
//后叉前货位有货
|
|
|
|
else if (back_Zerror == 16) { |
|
|
|
//先解警
|
|
|
|
//重新下发取放货点位信息
|
|
|
|
if (!againRequireSuccess) { |
|
|
|
//判断是取货阻挡还是放货阻挡
|
|
|
|
//取货阻挡
|
|
|
|
if (this.back_command == 1) { |
|
|
|
List<String> keys = Arrays.asList(ItemProtocol.TO_Z.getKey(), ItemProtocol.TO_X.getKey(), ItemProtocol.TO_Y.getKey(), ItemProtocol.TO_BACK_TASK.getKey(), ItemProtocol.TO_CHOOSE_FORK.getKey(), ItemProtocol.TO_COMMAND.getKey()); |
|
|
|
List<Object> values = Arrays.asList(3, 50, 2, this.front_task, SendSignalEnum.CHOOSE_FORK_TWO.getSignalNum(), SendSignalEnum.COMMAND_ONE.getSignalNum()); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), 5); |
|
|
|
this.writing(keys, values); |
|
|
|
this.againRequireSuccess = true; |
|
|
|
} |
|
|
|
//放货阻挡
|
|
|
|
else if (this.back_command == 3) { |
|
|
|
List<String> keys = Arrays.asList(ItemProtocol.TO_Z.getKey(), ItemProtocol.TO_X.getKey(), ItemProtocol.TO_Y.getKey(), ItemProtocol.TO_BACK_TASK.getKey(), ItemProtocol.TO_CHOOSE_FORK.getKey(), ItemProtocol.TO_COMMAND.getKey()); |
|
|
|
List<Object> values = Arrays.asList(3, 60, 2, this.back_task, SendSignalEnum.CHOOSE_FORK_TWO.getSignalNum(), SendSignalEnum.COMMAND_TWO.getSignalNum()); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), 5); |
|
|
|
this.writing(keys, values); |
|
|
|
this.againRequireSuccess = true; |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
this.updateInstStatus(); |
|
|
|
|
|
|
|
if (!this.online) { |
|
|
|
this.message = "设备离线"; |
|
|
|
} else if (this.mode != ModeEnum.MODE_3.getNum()) { |
|
|
@ -407,10 +529,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
if (ObjectUtil.isEmpty(frontInst) && ObjectUtil.isEmpty(backInst)) { |
|
|
|
if (this.to_command != 0) { |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), 0); |
|
|
|
Thread.sleep(1000); |
|
|
|
} |
|
|
|
this.applyTask(); |
|
|
|
} else { |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
|
this.requireSuccess = true; |
|
|
|
} |
|
|
|
} |
|
|
|
//取货中
|
|
|
|