|
|
@ -38,6 +38,11 @@ import java.util.*; |
|
|
|
import java.util.concurrent.locks.Lock; |
|
|
|
import java.util.concurrent.locks.ReentrantLock; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Description 1、适用于单/双堆垛机;2、默认优先执行移库任务;3、其次按照堆垛机设置的策略(入库优先(含拣选出库)策略、出库优先策略、时间顺序策略)执行;4、除移库任务是从任务列表中查找,其余任务都是从指令列表中查找就绪状态下的信息 |
|
|
|
* @Author Gengby |
|
|
|
* @Date 2024/6/26 |
|
|
|
*/ |
|
|
|
@Slf4j |
|
|
|
@Getter |
|
|
|
@Setter |
|
|
@ -277,10 +282,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
* 禁止入库 |
|
|
|
*/ |
|
|
|
private boolean prohibitInWarehouse = false; |
|
|
|
|
|
|
|
/** |
|
|
|
* 禁止出库 |
|
|
|
*/ |
|
|
|
private boolean prohibitOutWarehouse = false; |
|
|
|
|
|
|
|
/** |
|
|
|
* 停止接收任务 |
|
|
|
*/ |
|
|
@ -292,10 +299,20 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
private int stackerNum = 1; |
|
|
|
|
|
|
|
/** |
|
|
|
* 空出、满入、阻挡请求标记 |
|
|
|
* 空出、满入、阻挡异常请求标记 |
|
|
|
*/ |
|
|
|
private boolean againRequireSuccess = false; |
|
|
|
|
|
|
|
/** |
|
|
|
* 未执行任务原因 |
|
|
|
*/ |
|
|
|
private String unExecutedMessage; |
|
|
|
|
|
|
|
/** |
|
|
|
* 空出、满入、阻挡异常报警码 |
|
|
|
*/ |
|
|
|
private static final List<Integer> AGAIN_ERROR = Arrays.asList(ErrorEnum.MR.getCode(), ErrorEnum.KC.getCode(), ErrorEnum.ZD.getCode()); |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Device getDevice() { |
|
|
@ -401,7 +418,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
return Integer.parseInt(devicePoint.split("-")[2]); |
|
|
|
} |
|
|
|
|
|
|
|
private static final List<Integer> AGAIN_ERROR = Arrays.asList(ErrorEnum.MR.getCode(), ErrorEnum.KC.getCode(), ErrorEnum.ZD.getCode()); |
|
|
|
|
|
|
|
@SneakyThrows |
|
|
|
@Override |
|
|
@ -418,31 +434,25 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//前叉满入
|
|
|
|
if (this.front_Zerror == ErrorEnum.MR.getCode()) { |
|
|
|
if (!this.againRequireSuccess) { |
|
|
|
this.mR(this.front_task, ForkTypeEnum.FRONT.getCode()); |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
//后叉满入
|
|
|
|
else if (this.back_Zerror == ErrorEnum.MR.getCode()) { |
|
|
|
} else if (this.back_Zerror == ErrorEnum.MR.getCode()) { |
|
|
|
if (!this.againRequireSuccess) { |
|
|
|
this.mR(this.back_task, ForkTypeEnum.BACK.getCode()); |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
//前叉和后叉都空出
|
|
|
|
if (this.front_Zerror == ErrorEnum.KC.getCode() && this.back_Zerror == ErrorEnum.KC.getCode()) { |
|
|
|
if (!this.againRequireSuccess) { |
|
|
|
this.kC(this.front_task); |
|
|
|
this.kC(this.back_task); |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
//前叉空出
|
|
|
|
else if (this.front_Zerror == ErrorEnum.KC.getCode()) { |
|
|
|
} else if (this.front_Zerror == ErrorEnum.KC.getCode()) { |
|
|
|
if (!this.againRequireSuccess) { |
|
|
|
this.kC(this.front_task); |
|
|
|
Instruction back_inst = instructionService.findByCodeFromCache(String.valueOf(this.back_task)); |
|
|
@ -451,9 +461,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
//后叉空出
|
|
|
|
else if (this.back_Zerror == ErrorEnum.KC.getCode()) { |
|
|
|
} else if (this.back_Zerror == ErrorEnum.KC.getCode()) { |
|
|
|
if (!this.againRequireSuccess) { |
|
|
|
this.kC(this.back_task); |
|
|
|
Instruction front_inst = instructionService.findByCodeFromCache(String.valueOf(this.front_task)); |
|
|
@ -464,31 +472,33 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
//前叉浅货位有货
|
|
|
|
if (this.front_Zerror == ErrorEnum.ZD.getCode()) { |
|
|
|
if (this.front_Zerror == ErrorEnum.ZD.getCode() && this.back_Zerror == ErrorEnum.ZD.getCode() |
|
|
|
&& this.front_command == CommandEnum.PICKUP.getStatus() && this.back_command == CommandEnum.PICKUP.getStatus() |
|
|
|
) { |
|
|
|
if (!this.againRequireSuccess) { |
|
|
|
this.getzD(this.front_task); |
|
|
|
this.getzD(this.back_task); |
|
|
|
} |
|
|
|
} else if (this.front_Zerror == ErrorEnum.ZD.getCode()) { |
|
|
|
if (!this.againRequireSuccess) { |
|
|
|
if (this.front_command == CommandEnum.PICKUP.getStatus()) { |
|
|
|
this.getzD(this.front_task); |
|
|
|
Instruction back_inst = instructionService.findByCodeFromCache(String.valueOf(this.back_task)); |
|
|
|
if (ObjectUtil.isNotEmpty(back_inst)) { |
|
|
|
this.backWrite(back_inst); |
|
|
|
Thread.sleep(1000); |
|
|
|
} |
|
|
|
} else if (this.front_command == CommandEnum.RELEASE.getStatus()) { |
|
|
|
this.putzD(this.front_task, ForkTypeEnum.FRONT.getCode()); |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
//后叉浅货位有货
|
|
|
|
else if (this.back_Zerror == ErrorEnum.ZD.getCode()) { |
|
|
|
} else if (this.back_Zerror == ErrorEnum.ZD.getCode()) { |
|
|
|
if (!this.againRequireSuccess) { |
|
|
|
if (this.back_command == CommandEnum.PICKUP.getStatus()) { |
|
|
|
this.getzD(this.back_task); |
|
|
|
Instruction front_inst = instructionService.findByCodeFromCache(String.valueOf(this.front_task)); |
|
|
|
if (ObjectUtil.isNotEmpty(front_inst)) { |
|
|
|
this.frontWrite(front_inst); |
|
|
|
Thread.sleep(1000); |
|
|
|
} |
|
|
|
} else if (this.back_command == CommandEnum.RELEASE.getStatus()) { |
|
|
|
this.putzD(this.back_task, ForkTypeEnum.BACK.getCode()); |
|
|
@ -503,9 +513,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
this.message = "设备离线"; |
|
|
|
} else if (this.mode != ModeEnum.MODE_3.getNum()) { |
|
|
|
this.message = "设备未联机"; |
|
|
|
} else if (this.stacker_error != 0) { |
|
|
|
this.message = "设备主体报警"; |
|
|
|
this.isError = true; |
|
|
|
} else if (this.front_Zerror != 0) { |
|
|
|
this.message = "设备前叉报警"; |
|
|
|
this.isError = true; |
|
|
@ -525,7 +532,10 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), 0); |
|
|
|
Thread.sleep(1000); |
|
|
|
} |
|
|
|
if (this.stopReceiveTask) return; |
|
|
|
if (this.stopReceiveTask) { |
|
|
|
this.unExecutedMessage = "堆垛机设置为停止接收任务"; |
|
|
|
return; |
|
|
|
} |
|
|
|
this.applyTask(); |
|
|
|
} else { |
|
|
|
this.sendPutInfoToPlc(frontInst, backInst); |
|
|
@ -694,6 +704,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 放货阻挡、满入更改任务指令终点信息 |
|
|
|
* |
|
|
|
* @param devicePoint |
|
|
|
* @param inst |
|
|
|
*/ |
|
|
|
private void updateNextPointCode(String devicePoint, Instruction inst) { |
|
|
|
Integer x = getX(devicePoint); |
|
|
|
Integer y = getY(devicePoint); |
|
|
@ -716,6 +732,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 查找任务 |
|
|
|
*/ |
|
|
|
private void applyTask() { |
|
|
|
long currentTimeMillis = System.currentTimeMillis(); |
|
|
|
if (!isTimeValid(currentTimeMillis)) { |
|
|
@ -733,7 +752,7 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 移库任务 |
|
|
|
* 移库 |
|
|
|
*/ |
|
|
|
private void applyMoveTask() { |
|
|
|
List<String> xDeviceCodeList = this.getExtraDeviceCodes("xDeviceCodeList"); |
|
|
@ -743,7 +762,6 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
TaskDto frontTaskDto = null; |
|
|
|
TaskDto backTaskDto = null; |
|
|
|
if (CollectionUtil.isNotEmpty(frontTaskDtos)) { |
|
|
|
//如果当前堆垛机是双叉
|
|
|
|
if (this.stackerNum == 2) { |
|
|
|
for (TaskDto frontTask : frontTaskDtos) { |
|
|
|
//查找一起取放的移库任务
|
|
|
@ -760,11 +778,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
} |
|
|
|
if (ObjectUtil.isEmpty(frontTaskDto) && ObjectUtil.isEmpty(backTaskDto)) { |
|
|
|
//查询前叉移库任务
|
|
|
|
frontTaskDto = frontTaskDtos.get(0); |
|
|
|
} |
|
|
|
} else { |
|
|
|
//查找后叉移库任务
|
|
|
|
if (this.stackerNum == 2) { |
|
|
|
List<TaskDto> backTaskDtos = taskService.findReadyTaskByXDeviceCode(xDeviceCodeList, backNoY); |
|
|
|
if (CollectionUtil.isNotEmpty(backTaskDtos)) { |
|
|
@ -785,14 +801,14 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
taskService.update(frontTaskDto); |
|
|
|
taskService.update(backTaskDto); |
|
|
|
} catch (Exception e) { |
|
|
|
this.unExecutedMessage = "创建移库指令时出现异常,原因:" + e.getMessage(); |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage())); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.FBWrite(frontInst, backInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
//下发双叉任务
|
|
|
|
} else if (ObjectUtil.isNotEmpty(frontTaskDto)) { |
|
|
|
//下发前叉任务
|
|
|
|
Instruction frontInst = new Instruction(); |
|
|
|
setInstruction(frontInst, frontTaskDto); |
|
|
|
try { |
|
|
@ -800,13 +816,14 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
frontTaskDto.setTask_status(TaskStatusEnum.BUSY.getIndex()); |
|
|
|
taskService.update(frontTaskDto); |
|
|
|
} catch (Exception e) { |
|
|
|
this.unExecutedMessage = "创建移库指令时出现异常,原因:" + e.getMessage(); |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage())); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.frontWrite(frontInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (ObjectUtil.isNotEmpty(backTaskDto)) { |
|
|
|
//下发后叉任务
|
|
|
|
Instruction backInst = new Instruction(); |
|
|
|
setInstruction(backInst, backTaskDto); |
|
|
|
try { |
|
|
@ -814,10 +831,12 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
backTaskDto.setTask_status(TaskStatusEnum.BUSY.getIndex()); |
|
|
|
taskService.update(backTaskDto); |
|
|
|
} catch (Exception e) { |
|
|
|
this.unExecutedMessage = "创建移库指令时出现异常,原因:" + e.getMessage(); |
|
|
|
logService.deviceExecuteLog(new LuceneLogDto(this.currentDeviceCode, "创建指令失败, 原因:" + e.getMessage())); |
|
|
|
return; |
|
|
|
} |
|
|
|
this.backWrite(backInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else { |
|
|
|
String strategyValue = Optional.ofNullable(this.getExtraValue().get("strategyValue")).map(Object::toString).orElse(""); |
|
|
@ -836,6 +855,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 拣选出库 |
|
|
|
* |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
private boolean applySpecialTask() { |
|
|
|
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList"); |
|
|
|
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList"); |
|
|
@ -892,46 +916,28 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
private void applyInTask() { |
|
|
|
boolean flag = this.applySpecialTask(); |
|
|
|
if (flag) { |
|
|
|
this.unExecutedMessage = null; |
|
|
|
return; |
|
|
|
} |
|
|
|
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList"); |
|
|
|
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY"); |
|
|
|
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList"); |
|
|
|
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY"); |
|
|
|
List<Instruction> frontInsts = instructionService.findReadyInstByStartDeviceCode(getFrontDeviceCodeList, frontNoY); |
|
|
|
Instruction frontInst = null; |
|
|
|
Instruction backInst = null; |
|
|
|
Device front_start_device = null; |
|
|
|
Device back_start_device = null; |
|
|
|
if (CollectionUtil.isNotEmpty(frontInsts)) { |
|
|
|
frontInst = frontInsts.get(0); |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst)) { |
|
|
|
String front_start_device_code = frontInst.getStart_device_code(); |
|
|
|
front_start_device = deviceAppService.findDeviceByCode(front_start_device_code); |
|
|
|
if (front_start_device != null) { |
|
|
|
String getLinkDeviceCode = this.handExtraStringValue(front_start_device, "getLinkDeviceCode"); |
|
|
|
backInst = instructionService.findReadyInstByLinkDeviceCodeAndStartDeviceCode(getLinkDeviceCode, backNoY); |
|
|
|
if (ObjectUtil.isEmpty(backInst)) { |
|
|
|
Instruction inst = instructionService.findBusyInstByNextDeviceCode(getLinkDeviceCode); |
|
|
|
if (ObjectUtil.isNotEmpty(inst)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (this.stackerNum == 2) { |
|
|
|
List<Instruction> backInsts = instructionService.findReadyInstByStartDeviceCode(getBackDeviceCodeList, backNoY); |
|
|
|
if (CollectionUtil.isNotEmpty(backInsts)) { |
|
|
|
backInst = backInsts.get(0); |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
String back_start_device_code = backInst.getStart_device_code(); |
|
|
|
back_start_device = deviceAppService.findDeviceByCode(back_start_device_code); |
|
|
|
if (back_start_device != null) { |
|
|
|
String getLinkDeviceCode = this.handExtraStringValue(back_start_device, "getLinkDeviceCode"); |
|
|
|
frontInst = instructionService.findReadyInstByLinkDeviceCodeAndStartDeviceCode(getLinkDeviceCode, frontNoY); |
|
|
|
if (ObjectUtil.isEmpty(frontInst)) { |
|
|
|
if (!prohibitInWarehouse) { |
|
|
|
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList"); |
|
|
|
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY"); |
|
|
|
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList"); |
|
|
|
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY"); |
|
|
|
List<Instruction> frontInsts = instructionService.findReadyInstByStartDeviceCode(getFrontDeviceCodeList, frontNoY); |
|
|
|
Instruction frontInst = null; |
|
|
|
Instruction backInst = null; |
|
|
|
Device front_start_device = null; |
|
|
|
Device back_start_device = null; |
|
|
|
if (CollectionUtil.isNotEmpty(frontInsts)) { |
|
|
|
frontInst = frontInsts.get(0); |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst)) { |
|
|
|
String front_start_device_code = frontInst.getStart_device_code(); |
|
|
|
front_start_device = deviceAppService.findDeviceByCode(front_start_device_code); |
|
|
|
if (front_start_device != null) { |
|
|
|
String getLinkDeviceCode = this.handExtraStringValue(front_start_device, "getLinkDeviceCode"); |
|
|
|
backInst = instructionService.findReadyInstByLinkDeviceCodeAndStartDeviceCode(getLinkDeviceCode, backNoY); |
|
|
|
if (ObjectUtil.isEmpty(backInst)) { |
|
|
|
Instruction inst = instructionService.findBusyInstByNextDeviceCode(getLinkDeviceCode); |
|
|
|
if (ObjectUtil.isNotEmpty(inst)) { |
|
|
|
return; |
|
|
@ -939,68 +945,113 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (this.stackerNum == 2) { |
|
|
|
List<Instruction> backInsts = instructionService.findReadyInstByStartDeviceCode(getBackDeviceCodeList, backNoY); |
|
|
|
if (CollectionUtil.isNotEmpty(backInsts)) { |
|
|
|
backInst = backInsts.get(0); |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
String back_start_device_code = backInst.getStart_device_code(); |
|
|
|
back_start_device = deviceAppService.findDeviceByCode(back_start_device_code); |
|
|
|
if (back_start_device != null) { |
|
|
|
String getLinkDeviceCode = this.handExtraStringValue(back_start_device, "getLinkDeviceCode"); |
|
|
|
frontInst = instructionService.findReadyInstByLinkDeviceCodeAndStartDeviceCode(getLinkDeviceCode, frontNoY); |
|
|
|
if (ObjectUtil.isEmpty(frontInst)) { |
|
|
|
Instruction inst = instructionService.findBusyInstByNextDeviceCode(getLinkDeviceCode); |
|
|
|
if (ObjectUtil.isNotEmpty(inst)) { |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.FBWrite(front_start_device, frontInst, backInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (ObjectUtil.isNotEmpty(frontInst)) { |
|
|
|
this.frontWrite(front_start_device, frontInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.backWrite(back_start_device, backInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else { |
|
|
|
String strategyValue = Optional.ofNullable(this.getExtraValue().get("strategyValue")).map(Object::toString).orElse(""); |
|
|
|
if (ObjectUtil.equals(strategyValue, StrategyEnum.IN.getValue())) { |
|
|
|
this.applyOutTask(); |
|
|
|
} else if (ObjectUtil.equals(strategyValue, StrategyEnum.OUT.getValue()) && !ObjectUtil.equals(strategyValue, StrategyEnum.TIME.getValue())) { |
|
|
|
this.unExecutedMessage = "堆垛机未查询到就绪状态下可执行的任务或指令信息"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.FBWrite(front_start_device, frontInst, backInst); |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (ObjectUtil.isNotEmpty(frontInst)) { |
|
|
|
this.frontWrite(front_start_device, frontInst); |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.backWrite(back_start_device, backInst); |
|
|
|
this.requireSuccess = true; |
|
|
|
} else { |
|
|
|
String strategyValue = Optional.ofNullable(this.getExtraValue().get("strategyValue")).map(Object::toString).orElse(""); |
|
|
|
if (ObjectUtil.equals(strategyValue, StrategyEnum.IN.getValue())) { |
|
|
|
this.applyOutTask(); |
|
|
|
if (this.prohibitOutWarehouse) { |
|
|
|
this.unExecutedMessage = "堆垛机设置为禁止出库、禁止入库"; |
|
|
|
return; |
|
|
|
} |
|
|
|
this.applyOutTask(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 出库 |
|
|
|
* 出库(含拣选) |
|
|
|
*/ |
|
|
|
private void applyOutTask() { |
|
|
|
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList"); |
|
|
|
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList"); |
|
|
|
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY"); |
|
|
|
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY"); |
|
|
|
List<Instruction> frontInsts = instructionService.findReadyInstByNextDeviceCode(getFrontDeviceCodeList, frontNoY); |
|
|
|
Instruction frontInst = null; |
|
|
|
Instruction backInst = null; |
|
|
|
if (CollectionUtil.isNotEmpty(frontInsts)) { |
|
|
|
frontInst = frontInsts.get(0); |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst) && this.stackerNum == 2) { |
|
|
|
String front_next_device_code = frontInst.getNext_device_code(); |
|
|
|
Device front_next_device = deviceAppService.findDeviceByCode(front_next_device_code); |
|
|
|
if (front_next_device != null) { |
|
|
|
String getLinkDeviceCode = this.handExtraStringValue(front_next_device, "getLinkDeviceCode"); |
|
|
|
backInst = instructionService.findReadyInstByNextDeviceCode(frontInst, getLinkDeviceCode, backNoY); |
|
|
|
if (!this.prohibitOutWarehouse) { |
|
|
|
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList"); |
|
|
|
List<String> getBackDeviceCodeList = this.getExtraDeviceCodes("backDeviceCodeList"); |
|
|
|
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY"); |
|
|
|
String backNoY = this.handExtraStringValue(this.getDevice(), "backNoY"); |
|
|
|
List<Instruction> frontInsts = instructionService.findReadyInstByNextDeviceCode(getFrontDeviceCodeList, frontNoY); |
|
|
|
Instruction frontInst = null; |
|
|
|
Instruction backInst = null; |
|
|
|
if (CollectionUtil.isNotEmpty(frontInsts)) { |
|
|
|
frontInst = frontInsts.get(0); |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst) && this.stackerNum == 2) { |
|
|
|
String front_next_device_code = frontInst.getNext_device_code(); |
|
|
|
Device front_next_device = deviceAppService.findDeviceByCode(front_next_device_code); |
|
|
|
if (front_next_device != null) { |
|
|
|
String getLinkDeviceCode = this.handExtraStringValue(front_next_device, "getLinkDeviceCode"); |
|
|
|
backInst = instructionService.findReadyInstByNextDeviceCode(frontInst, getLinkDeviceCode, backNoY); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (this.stackerNum == 2) { |
|
|
|
List<Instruction> backInsts = instructionService.findReadyInstByNextDeviceCode(getBackDeviceCodeList, backNoY); |
|
|
|
if (CollectionUtil.isNotEmpty(backInsts)) { |
|
|
|
backInst = backInsts.get(0); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
if (this.stackerNum == 2) { |
|
|
|
List<Instruction> backInsts = instructionService.findReadyInstByNextDeviceCode(getBackDeviceCodeList, backNoY); |
|
|
|
if (CollectionUtil.isNotEmpty(backInsts)) { |
|
|
|
backInst = backInsts.get(0); |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.FBWrite(frontInst, backInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (ObjectUtil.isNotEmpty(frontInst)) { |
|
|
|
this.frontWrite(frontInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.backWrite(backInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else { |
|
|
|
String strategyValue = Optional.ofNullable(this.getExtraValue().get("strategyValue")).map(Object::toString).orElse(""); |
|
|
|
if (ObjectUtil.equals(strategyValue, StrategyEnum.OUT.getValue())) { |
|
|
|
this.applyInTask(); |
|
|
|
} else if (ObjectUtil.equals(strategyValue, StrategyEnum.IN.getValue()) && !ObjectUtil.equals(strategyValue, StrategyEnum.TIME.getValue())) { |
|
|
|
this.unExecutedMessage = "堆垛机未查询到就绪状态下可执行的任务或指令信息"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (ObjectUtil.isNotEmpty(frontInst) && ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.FBWrite(frontInst, backInst); |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (ObjectUtil.isNotEmpty(frontInst)) { |
|
|
|
this.frontWrite(frontInst); |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.backWrite(backInst); |
|
|
|
this.requireSuccess = true; |
|
|
|
} else { |
|
|
|
Integer strategyValue = this.handExtraIntValue(this.getDevice(), "strategyValue"); |
|
|
|
if (ObjectUtil.equals(strategyValue, StrategyEnum.OUT.getValue())) { |
|
|
|
this.applyInTask(); |
|
|
|
if (this.prohibitInWarehouse) { |
|
|
|
this.unExecutedMessage = "堆垛机设置为禁止出库、禁止入库"; |
|
|
|
return; |
|
|
|
} |
|
|
|
this.applyInTask(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1008,6 +1059,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
* 时间顺序策略 |
|
|
|
*/ |
|
|
|
private void applyTaskByTime() { |
|
|
|
boolean flag = this.applySpecialTask(); |
|
|
|
if (flag) { |
|
|
|
this.unExecutedMessage = null; |
|
|
|
return; |
|
|
|
} |
|
|
|
List<String> getFrontDeviceCodeList = this.getExtraDeviceCodes("frontDeviceCodeList"); |
|
|
|
String frontNoY = this.handExtraStringValue(this.getDevice(), "frontNoY"); |
|
|
|
List<Instruction> frontInsts = instructionService.findReadyInstByDeviceCode(getFrontDeviceCodeList, frontNoY); |
|
|
@ -1024,9 +1080,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
Instruction backInst = instructionService.findReadyInstByStartDeviceCode(frontInst, getLinkDeviceCode, backNoY); |
|
|
|
if (ObjectUtil.isNotEmpty(getLinkDeviceCode) && deviceAppService.findDeviceByCode(getLinkDeviceCode) != null && ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.FBWrite(front_start_device, frontInst, backInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else { |
|
|
|
this.frontWrite(front_start_device, frontInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} |
|
|
|
} else if (front_start_device != null && front_start_device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
@ -1037,9 +1095,11 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
Instruction backInst = instructionService.findReadyInstByNextDeviceCode(frontInst, getLinkDeviceCode, backNoY); |
|
|
|
if (ObjectUtil.isNotEmpty(getLinkDeviceCode) && deviceAppService.findDeviceByCode(getLinkDeviceCode) != null && ObjectUtil.isNotEmpty(backInst)) { |
|
|
|
this.FBWrite(frontInst, backInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else { |
|
|
|
this.frontWrite(frontInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} |
|
|
|
} |
|
|
@ -1057,20 +1117,35 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
Device back_start_device = deviceAppService.findDeviceByCode(back_start_device_code); |
|
|
|
if (back_start_device != null && back_start_device.getDeviceDriver() instanceof AppearanceInspectionScannerConveyorDeviceDriver) { |
|
|
|
this.backWrite(back_start_device, backInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} else if (back_start_device != null && back_start_device.getDeviceDriver() instanceof StandardStorageDeviceDriver) { |
|
|
|
this.backWrite(backInst); |
|
|
|
this.unExecutedMessage = null; |
|
|
|
this.requireSuccess = true; |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.unExecutedMessage = "堆垛机未查询到就绪状态下可执行的任务或指令信息"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 下发前叉取货信息(取货位是输送线) |
|
|
|
* |
|
|
|
* @param frontInst |
|
|
|
*/ |
|
|
|
private void frontWrite(Instruction frontInst) { |
|
|
|
List<Object> values = Arrays.asList(Integer.parseInt(StringUtil.handleString(frontInst.getFrom_x())), Integer.parseInt(frontInst.getFrom_y()), Integer.parseInt(frontInst.getFrom_z()), frontInst.getInstruction_code(), SendSignalEnum.CHOOSE_FORK_ONE.getSignalNum(), SendSignalEnum.COMMAND_ONE.getSignalNum()); |
|
|
|
this.writing(this.getFrontKeys(), values); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 下发前叉取货信息(取货位是输送线) |
|
|
|
* |
|
|
|
* @param frontDevice |
|
|
|
* @param frontInst |
|
|
|
*/ |
|
|
|
private void frontWrite(Device frontDevice, Instruction frontInst) { |
|
|
|
Integer frontX = this.handExtraIntValue(frontDevice, "currentX"); |
|
|
|
Integer frontY = this.handExtraIntValue(frontDevice, "currentY"); |
|
|
@ -1079,11 +1154,22 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
this.writing(this.getFrontKeys(), values); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 下发后叉取货信息(取货位是货架) |
|
|
|
* |
|
|
|
* @param backInst |
|
|
|
*/ |
|
|
|
private void backWrite(Instruction backInst) { |
|
|
|
List<Object> values = Arrays.asList(Integer.parseInt(StringUtil.handleString(backInst.getFrom_x())), Integer.parseInt(backInst.getFrom_y()), Integer.parseInt(backInst.getFrom_z()), backInst.getInstruction_code(), SendSignalEnum.CHOOSE_FORK_TWO.getSignalNum(), SendSignalEnum.COMMAND_ONE.getSignalNum()); |
|
|
|
this.writing(this.getBackKeys(), values); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 下发后叉取货信息(取货位是输送线) |
|
|
|
* |
|
|
|
* @param backDevice |
|
|
|
* @param backInst |
|
|
|
*/ |
|
|
|
private void backWrite(Device backDevice, Instruction backInst) { |
|
|
|
Integer backX = this.handExtraIntValue(backDevice, "currentX"); |
|
|
|
Integer backY = this.handExtraIntValue(backDevice, "currentY"); |
|
|
@ -1092,11 +1178,25 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
this.writing(this.getBackKeys(), values); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 下发双叉取货信息(取货位是货架) |
|
|
|
* |
|
|
|
* @param frontInst |
|
|
|
* @param backInst |
|
|
|
*/ |
|
|
|
private void FBWrite(Instruction frontInst, Instruction backInst) { |
|
|
|
List<Object> values = Arrays.asList(Integer.parseInt(StringUtil.handleString(frontInst.getFrom_x())), Integer.parseInt(frontInst.getFrom_y()), Integer.parseInt(frontInst.getFrom_z()), frontInst.getInstruction_code(), backInst.getInstruction_code(), SendSignalEnum.CHOOSE_FORK_THREE.getSignalNum(), SendSignalEnum.COMMAND_ONE.getSignalNum()); |
|
|
|
this.writing(this.getFBKeys(), values); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 下发双叉取货信息(取货位是输送线) |
|
|
|
* |
|
|
|
* @param frontDevice |
|
|
|
* @param frontInst |
|
|
|
* @param backInst |
|
|
|
*/ |
|
|
|
private void FBWrite(Device frontDevice, Instruction frontInst, Instruction backInst) { |
|
|
|
Integer frontX = this.handExtraIntValue(frontDevice, "currentX"); |
|
|
|
Integer frontY = this.handExtraIntValue(frontDevice, "currentY"); |
|
|
@ -1146,18 +1246,35 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
|
|
|
|
@Override |
|
|
|
public JSONObject getDeviceStatusName() throws Exception { |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
jo.put("device_code", this.currentDeviceCode); |
|
|
|
jo.put("device_name", this.getDevice().getDevice_name()); |
|
|
|
jo.put("driver_type", "standard_stacker_device"); |
|
|
|
jo.put("is_click", true); |
|
|
|
jo.put("message", this.message); |
|
|
|
jo.put("isOnline", this.online); |
|
|
|
jo.put("isError", this.isError); |
|
|
|
jo.put("prohibitInWarehouse", this.prohibitInWarehouse); |
|
|
|
jo.put("prohibitOutWarehouse", this.prohibitOutWarehouse); |
|
|
|
jo.put("stopReceiveTask", this.stopReceiveTask); |
|
|
|
jo.put("requireSuccess", this.requireSuccess ? "1" : "0"); |
|
|
|
Map<String, Object> map = new LinkedHashMap(); |
|
|
|
map.put("device_code", this.currentDeviceCode); |
|
|
|
map.put("device_name", this.getDevice().getDevice_name()); |
|
|
|
map.put("driver_type", "standard_stacker_device"); |
|
|
|
map.put("is_click", true); |
|
|
|
map.put("isOnline", this.online); |
|
|
|
map.put("isError", this.isError); |
|
|
|
map.put("message", this.message); |
|
|
|
map.put("unExecutedMessage", this.unExecutedMessage); |
|
|
|
map.put("prohibitInWarehouse", this.prohibitInWarehouse); |
|
|
|
map.put("prohibitOutWarehouse", this.prohibitOutWarehouse); |
|
|
|
map.put("stopReceiveTask", this.stopReceiveTask); |
|
|
|
map.put("requireSuccess", this.requireSuccess); |
|
|
|
map.put("againRequireSuccess", this.againRequireSuccess); |
|
|
|
map.put("mode", ModeEnum.getDescByNum(this.mode)); |
|
|
|
map.put("front_command", CommandEnum.getDesc(this.front_command)); |
|
|
|
map.put("front_task", this.front_task + " (" + (instructionService.findByCodeFromCache(String.valueOf(this.front_task)) == null ? "已结束" : "执行中") + ")"); |
|
|
|
map.put("front_Zerror", ErrorEnum.getDesc(this.front_Zerror)); |
|
|
|
map.put("front_z", this.front_z); |
|
|
|
map.put("front_x", this.front_x); |
|
|
|
map.put("front_y", this.front_y); |
|
|
|
map.put("back_command", CommandEnum.getDesc(this.back_command)); |
|
|
|
map.put("back_task", this.back_task + " (" + (instructionService.findByCodeFromCache(String.valueOf(this.back_task)) == null ? "已结束" : "执行中") + ")"); |
|
|
|
map.put("back_Zerror", ErrorEnum.getDesc(this.back_Zerror)); |
|
|
|
map.put("back_z", this.back_z); |
|
|
|
map.put("back_x", this.back_x); |
|
|
|
map.put("back_y", this.back_y); |
|
|
|
map.put("strategy", StrategyEnum.getLabel(Optional.ofNullable(this.getExtraValue().get("strategyValue")).map(Object::toString).orElse(""))); |
|
|
|
JSONObject jo = new JSONObject(map); |
|
|
|
return jo; |
|
|
|
} |
|
|
|
|
|
|
@ -1171,16 +1288,24 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
} |
|
|
|
//ACS监控大屏设置禁止入库、禁止出库、停止接收任务
|
|
|
|
Boolean prohibitInWarehouse = data.getBoolean("prohibitInWarehouse"); |
|
|
|
this.prohibitInWarehouse = prohibitInWarehouse; |
|
|
|
if (prohibitInWarehouse != null) { |
|
|
|
this.prohibitInWarehouse = prohibitInWarehouse; |
|
|
|
} |
|
|
|
Boolean prohibitOutWarehouse = data.getBoolean("prohibitOutWarehouse"); |
|
|
|
this.prohibitOutWarehouse = prohibitOutWarehouse; |
|
|
|
if (prohibitOutWarehouse != null) { |
|
|
|
this.prohibitOutWarehouse = prohibitOutWarehouse; |
|
|
|
} |
|
|
|
Boolean stopReceiveTask = data.getBoolean("stopReceiveTask"); |
|
|
|
this.stopReceiveTask = stopReceiveTask; |
|
|
|
String requireSuccess = data.getString("requireSuccess"); |
|
|
|
if (StrUtil.equals("0", requireSuccess)) { |
|
|
|
this.requireSuccess = false; |
|
|
|
} else if (StrUtil.equals("1", requireSuccess)) { |
|
|
|
this.requireSuccess = true; |
|
|
|
if (stopReceiveTask != null) { |
|
|
|
this.stopReceiveTask = stopReceiveTask; |
|
|
|
} |
|
|
|
Boolean requireSuccess = data.getBoolean("requireSuccess"); |
|
|
|
if (requireSuccess != null) { |
|
|
|
this.requireSuccess = requireSuccess; |
|
|
|
} |
|
|
|
Boolean againRequireSuccess = data.getBoolean("againRequireSuccess"); |
|
|
|
if (againRequireSuccess != null) { |
|
|
|
this.againRequireSuccess = againRequireSuccess; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1219,6 +1344,8 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
Integer z = this.handExtraIntValue(next_device, "currentZ"); |
|
|
|
this.writing(this.getBackKeys(), Arrays.asList(x, y, z, backInst.getInstruction_code(), SendSignalEnum.CHOOSE_FORK_TWO.getSignalNum(), SendSignalEnum.COMMAND_TWO.getSignalNum())); |
|
|
|
} |
|
|
|
} else { |
|
|
|
this.unExecutedMessage = "未执行放货原因, 堆垛机上报任务号不存在"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1285,28 +1412,22 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
.type("rm") |
|
|
|
.data(param) |
|
|
|
.build(); |
|
|
|
// UnifiedResponse<JSONObject> response = acsToWmsService.apply(request, JSONObject.class);
|
|
|
|
// if (response.isSuccess()) {
|
|
|
|
// JSONObject data = response.getData();
|
|
|
|
JSONObject data = new JSONObject(); |
|
|
|
if (this.stackerNum == 1) { |
|
|
|
data.put("devicePoint", "T02-89-03"); |
|
|
|
} else { |
|
|
|
data.put("devicePoint", "L02-22-03"); |
|
|
|
} |
|
|
|
String devicePoint = data.getString("devicePoint"); |
|
|
|
if (devicePoint != null && devicePoint.contains("-") && devicePoint.split("-").length == 3) { |
|
|
|
this.updateNextPointCode(devicePoint, inst); |
|
|
|
//清警
|
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), 5); |
|
|
|
if ("1".equals(type)) { |
|
|
|
this.sendPutInfoToPlc(inst, null); |
|
|
|
} else { |
|
|
|
this.sendPutInfoToPlc(null, inst); |
|
|
|
UnifiedResponse<JSONObject> response = acsToWmsService.apply(request, JSONObject.class); |
|
|
|
if (response.isSuccess()) { |
|
|
|
JSONObject data = response.getData(); |
|
|
|
String devicePoint = data.getString("devicePoint"); |
|
|
|
if (devicePoint != null && devicePoint.contains("-") && devicePoint.split("-").length == 3) { |
|
|
|
this.updateNextPointCode(devicePoint, inst); |
|
|
|
//清警
|
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), 5); |
|
|
|
if (ForkTypeEnum.FRONT.getCode().equals(type)) { |
|
|
|
this.sendPutInfoToPlc(inst, null); |
|
|
|
} else { |
|
|
|
this.sendPutInfoToPlc(null, inst); |
|
|
|
} |
|
|
|
this.againRequireSuccess = true; |
|
|
|
} |
|
|
|
this.againRequireSuccess = true; |
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1325,11 +1446,13 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
.type("ck") |
|
|
|
.data(param) |
|
|
|
.build(); |
|
|
|
// acsToWmsService.apply(request);
|
|
|
|
instructionService.cancelInstAndTask(inst.getInstruction_id()); |
|
|
|
UnifiedResponse<JSONObject> response = acsToWmsService.apply(request, JSONObject.class); |
|
|
|
if (response.isSuccess()) { |
|
|
|
instructionService.cancelInstAndTask(inst.getInstruction_id()); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), SendSignalEnum.COMMAND_FIVE.getSignalNum()); |
|
|
|
this.againRequireSuccess = true; |
|
|
|
} |
|
|
|
} |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), SendSignalEnum.COMMAND_FIVE.getSignalNum()); |
|
|
|
this.againRequireSuccess = true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -1347,13 +1470,13 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
.type("czd") |
|
|
|
.data(param) |
|
|
|
.build(); |
|
|
|
//UnifiedResponse<JSONObject> response = acsToWmsService.apply(request, JSONObject.class);
|
|
|
|
// if (response.isSuccess()) {
|
|
|
|
//取消ACS指令和任务
|
|
|
|
instructionService.cancelInstAndTaskNoSendWms(inst.getInstruction_id()); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), SendSignalEnum.COMMAND_FIVE.getSignalNum()); |
|
|
|
this.againRequireSuccess = true; |
|
|
|
// }
|
|
|
|
UnifiedResponse<JSONObject> response = acsToWmsService.apply(request, JSONObject.class); |
|
|
|
if (response.isSuccess()) { |
|
|
|
//取消ACS指令和任务
|
|
|
|
instructionService.cancelInstAndTaskNoSendWms(inst.getInstruction_id()); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), SendSignalEnum.COMMAND_FIVE.getSignalNum()); |
|
|
|
this.againRequireSuccess = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1371,23 +1494,21 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme |
|
|
|
.type("rzd") |
|
|
|
.data(param) |
|
|
|
.build(); |
|
|
|
// UnifiedResponse<JSONObject> response = acsToWmsService.apply(request, JSONObject.class);
|
|
|
|
// if (response.isSuccess()) {
|
|
|
|
// JSONObject data = response.getData();
|
|
|
|
JSONObject data = new JSONObject(); |
|
|
|
data.put("devicePoint", "L03-89-03"); |
|
|
|
String devicePoint = data.getString("devicePoint"); |
|
|
|
if (devicePoint != null && devicePoint.contains("-") && devicePoint.split("-").length == 3) { |
|
|
|
this.updateNextPointCode(devicePoint, inst); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), SendSignalEnum.COMMAND_FIVE.getSignalNum()); |
|
|
|
if ("1".equals(type)) { |
|
|
|
this.sendPutInfoToPlc(inst, null); |
|
|
|
} else { |
|
|
|
this.sendPutInfoToPlc(null, inst); |
|
|
|
UnifiedResponse<JSONObject> response = acsToWmsService.apply(request, JSONObject.class); |
|
|
|
if (response.isSuccess()) { |
|
|
|
JSONObject data = response.getData(); |
|
|
|
String devicePoint = data.getString("devicePoint"); |
|
|
|
if (devicePoint != null && devicePoint.contains("-") && devicePoint.split("-").length == 3) { |
|
|
|
this.updateNextPointCode(devicePoint, inst); |
|
|
|
this.writing(ItemProtocol.TO_COMMAND.getKey(), SendSignalEnum.COMMAND_FIVE.getSignalNum()); |
|
|
|
if (ForkTypeEnum.FRONT.getCode().equals(type)) { |
|
|
|
this.sendPutInfoToPlc(inst, null); |
|
|
|
} else { |
|
|
|
this.sendPutInfoToPlc(null, inst); |
|
|
|
} |
|
|
|
this.againRequireSuccess = true; |
|
|
|
} |
|
|
|
this.againRequireSuccess = true; |
|
|
|
} |
|
|
|
// }
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|