add :堆垛机对接位bug修复
This commit is contained in:
@@ -510,7 +510,12 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
//查找有没有对应的指令
|
||||
Instruction inst = instructionService.findByStartCodeAndReady(this.device_code);
|
||||
Instruction inst;
|
||||
if ("RK1032".equals(this.device_code)||"RK1034".equals(this.device_code)||"RK1035".equals(this.device_code)){
|
||||
inst = instructionService.findByStartCodeAndReady2(this.device_code);
|
||||
}else {
|
||||
inst = instructionService.findByStartCodeAndReady(this.device_code);
|
||||
}
|
||||
if (ObjectUtil.isNotNull(inst)) {
|
||||
List<RouteLineDto> routeLineDtos = routeLineService.selectDeviceCodeList(this.device_code);
|
||||
if (routeLineDtos.size() < 1) {
|
||||
@@ -796,7 +801,15 @@ public class BeltConveyorDeviceDriver extends AbstractOpcDeviceDriver implements
|
||||
List list = new ArrayList();
|
||||
writeData(next_addr, list, instdto, containerType);
|
||||
// led_message = getLedMessage(instdto);
|
||||
requireSucess = true;
|
||||
//写完信号to_task写成功后更新指令为执行中
|
||||
inst = checkInst();
|
||||
to_task = this.itemProtocol.getTo_task();
|
||||
if (Integer.parseInt(to_task)>0 && to_task.equals(inst.getInstruction_code())) {
|
||||
inst.setInstruction_status(CommonFinalParam.ONE);
|
||||
inst.setExecute_device_code(this.device_code);
|
||||
instructionService.update(inst);
|
||||
requireSucess = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -348,6 +348,14 @@ public interface InstructionService extends CommonService<InstructionMybatis> {
|
||||
*/
|
||||
Instruction findByStartCodeAndReady(String device_code);
|
||||
|
||||
|
||||
/**
|
||||
* 找最新的指令
|
||||
* @param device_code
|
||||
* @return
|
||||
*/
|
||||
Instruction findByStartCodeAndReady2(String device_code);
|
||||
|
||||
/**
|
||||
* 根据起点设备编号查询当前是否有运行的指令
|
||||
*
|
||||
|
||||
@@ -1935,6 +1935,15 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
return optionalInstruction.orElse(null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Instruction findByStartCodeAndReady2(String device_code) {
|
||||
Optional<Instruction> optionalInstruction = instructions.stream()
|
||||
.filter(instruction -> StrUtil.equals(instruction.getStart_device_code(), device_code)
|
||||
&& StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex()) && !instruction.getInstruction_type().equals(TaskTypeEnum.Mxddhj_Task.getIndex())).max(Comparator.comparing(Instruction::getCreate_time));
|
||||
return optionalInstruction.orElse(null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Instruction> findByDeviceCodes(Instruction instruction1, Boolean flay) {
|
||||
List<Instruction> instructionList = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user