rev:申请开盖空指针处理
This commit is contained in:
@@ -76,7 +76,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
|
||||
DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
|
||||
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean("luceneExecuteLogServiceImpl");
|
||||
|
||||
//当前指令
|
||||
Instruction inst = null;
|
||||
@@ -160,6 +160,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
String last_vehicle_code;
|
||||
|
||||
String vehicle_code2;
|
||||
|
||||
@Override
|
||||
public Device getDevice() {
|
||||
return this.device;
|
||||
@@ -203,11 +204,11 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
}
|
||||
|
||||
//空箱出库开盖位,申请开盖
|
||||
if (mode == 15 && move == 1 && task > 0 ) {
|
||||
if (mode == 15 && move == 1 && task > 0) {
|
||||
Instruction instruction = instructionService.findByCode(String.valueOf(task));
|
||||
//不允许开盖,完成出库任务,自动去扫码位
|
||||
if (StrUtil.isEmpty(instruction.getVehicle_code())){
|
||||
message = "任务托盘码为空";
|
||||
if (instruction == null || StrUtil.isEmpty(instruction.getVehicle_code())) {
|
||||
message = "指令信息不存在或者任务托盘码为空,无法开盖";
|
||||
}
|
||||
applyUnbox(instruction.getVehicle_code());
|
||||
|
||||
@@ -226,23 +227,20 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
last_mode =mode;
|
||||
last_move =move;
|
||||
last_carrier_direction =carrier_direction;
|
||||
last_error =error;
|
||||
last_task =task;
|
||||
last_heartbeat =heartbeat;
|
||||
last_to_task =to_task;
|
||||
last_to_command =to_command;
|
||||
last_to_target =to_target;
|
||||
last_to_strap_times =to_strap_times;
|
||||
last_to_length =to_length;
|
||||
last_to_weight =to_weight;
|
||||
last_to_height =to_height;
|
||||
}
|
||||
last_mode = mode;
|
||||
last_move = move;
|
||||
last_carrier_direction = carrier_direction;
|
||||
last_error = error;
|
||||
last_task = task;
|
||||
last_heartbeat = heartbeat;
|
||||
last_to_task = to_task;
|
||||
last_to_command = to_command;
|
||||
last_to_target = to_target;
|
||||
last_to_strap_times = to_strap_times;
|
||||
last_to_length = to_length;
|
||||
last_to_weight = to_weight;
|
||||
last_to_height = to_height;
|
||||
}
|
||||
|
||||
private Boolean applyUnbox(String vehicleCode) {
|
||||
Date date = new Date();
|
||||
@@ -275,14 +273,14 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
requireSucess = true;
|
||||
packagePLCData(jo);
|
||||
String isUncap = jo.getString("isUncap");
|
||||
if ("1".equals(isUncap)){
|
||||
if ("1".equals(isUncap)) {
|
||||
List list1 = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_command");
|
||||
map.put("value", 15);
|
||||
list1.add(map);
|
||||
this.writing(list1);
|
||||
}else {
|
||||
} else {
|
||||
List list1 = new ArrayList();
|
||||
Map map = new HashMap();
|
||||
map.put("code", "to_command");
|
||||
@@ -293,7 +291,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
finish_instruction(inst);
|
||||
}
|
||||
|
||||
}else {
|
||||
} else {
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content("木箱开盖报错,接口返回:" + response)
|
||||
@@ -631,7 +629,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
||||
, instdto.getInstruction_code())) {
|
||||
this.writing(list);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
|
||||
.build();
|
||||
@@ -675,7 +673,7 @@ public class UnBoxLableConveyorDeviceDriver extends AbstractOpcDeviceDriver impl
|
||||
while (!StrUtil.equals(this.getOpcValueAccessor().getValue(this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDevice_code() + ".task").toString()
|
||||
, inst.getInstruction_code())) {
|
||||
this.writing(list);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
.content(device_code + inst.getInstruction_code() + "再次下发电气信号")
|
||||
.build();
|
||||
|
||||
@@ -2109,8 +2109,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
@Override
|
||||
public Instruction findByStarCodeAndExcute(String start_code) {
|
||||
Optional<Instruction> optionalInstruction = instructions.stream()
|
||||
.filter(instruction -> StrUtil.equals(instruction.getStart_device_code(), start_code)
|
||||
&& StrUtil.equals(instruction.getInstruction_status(), InstructionStatusEnum.READY.getIndex()))
|
||||
.filter(instruction -> StrUtil.equals(instruction.getStart_device_code(), start_code))
|
||||
.findFirst();
|
||||
return optionalInstruction.orElse(null);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user