This commit is contained in:
USER-20220102CG\noblelift
2023-03-30 17:44:04 +08:00
parent bc47ff43e9
commit bd74d6a3d4

View File

@@ -23,6 +23,9 @@ import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest;
import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse; import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse;
import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.ErrorUtil;
import org.nl.acs.history.service.DeviceErrorLogService;
import org.nl.acs.history.service.dto.DeviceErrorLogDto;
import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl;
import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.instruction.service.dto.Instruction;
import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.log.service.DeviceExecuteLogService;
@@ -69,6 +72,8 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
@Autowired @Autowired
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class); NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
@Autowired
DeviceErrorLogService deviceErrorLogService = SpringContextHolder.getBean(DeviceErrorLogServiceImpl.class);
//当前指令 //当前指令
Instruction inst = null; Instruction inst = null;
@@ -162,7 +167,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
} }
if (move != last_move) { if (move != last_move) {
message = null; message = null;
if (move == 0 ) { if (move == 0) {
inst_message = null; inst_message = null;
requireSucess = false; requireSucess = false;
this.clearWrite(); this.clearWrite();
@@ -175,6 +180,13 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
logServer.deviceExecuteLog(this.device_code, "", "", "信号carrier_direction" + last_carrier_direction + "->" + carrier_direction); logServer.deviceExecuteLog(this.device_code, "", "", "信号carrier_direction" + last_carrier_direction + "->" + carrier_direction);
} }
if (error != last_error) { if (error != last_error) {
if (error != 0) {
DeviceErrorLogDto dto = new DeviceErrorLogDto();
dto.setDevice_code(device_code);
dto.setError_code(String.valueOf(error));
dto.setError_info(ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(error)));
deviceErrorLogService.create(dto);
}
logServer.deviceItemValue(this.device_code, "error", String.valueOf(error)); logServer.deviceItemValue(this.device_code, "error", String.valueOf(error));
logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error); logServer.deviceExecuteLog(this.device_code, "", "", "信号error" + last_error + "->" + error);
} }
@@ -244,11 +256,11 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
case 2: case 2:
//申请任务 //申请任务
if (move > 0 && !requireSucess) { if (move > 0 && !requireSucess) {
try { try {
instruction_require(); instruction_require();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
break; break;
case 4: case 4:
@@ -483,10 +495,10 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
if (ObjectUtil.isEmpty(instruction)) { if (ObjectUtil.isEmpty(instruction)) {
//instruction = instructionService.findByCode(String.valueOf(task)); //instruction = instructionService.findByCode(String.valueOf(task));
message ="任务号:"+task +"未找到对应立库指令,请检查"; message = "任务号:" + task + "未找到对应立库指令,请检查";
return false; return false;
} }
if(StrUtil.equals(instruction.getInstruction_status(),"1")){ if (StrUtil.equals(instruction.getInstruction_status(), "1")) {
if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) { if (StrUtil.equals(this.getDeviceCode(), inst.getNext_device_code())) {
vehicle_code = inst.getVehicle_code(); vehicle_code = inst.getVehicle_code();
inst.setExecute_device_code(this.device_code); inst.setExecute_device_code(this.device_code);
@@ -622,8 +634,8 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
instructionService.create(instdto); instructionService.create(instdto);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error("指令创建失败!",e.getMessage()); log.error("指令创建失败!", e.getMessage());
return false; return false;
} }
//创建指令后修改任务状态 //创建指令后修改任务状态
taskdto.setTask_status("1"); taskdto.setTask_status("1");
@@ -747,7 +759,7 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
String vehicle_code = ""; String vehicle_code = "";
if (task > 0) { if (task > 0) {
Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task));
if(ObjectUtil.isEmpty(instruction)){ if (ObjectUtil.isEmpty(instruction)) {
message = "申请捆扎电气设备任务号:" + task + "未找到对应指令"; message = "申请捆扎电气设备任务号:" + task + "未找到对应指令";
throw new RuntimeException("该电气任务号未找到对应指令!"); throw new RuntimeException("该电气任务号未找到对应指令!");
} }
@@ -859,8 +871,8 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
this.instruction_require_time = date; this.instruction_require_time = date;
if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) {
Instruction instruction = instructionService.findByCode(String.valueOf(task)); Instruction instruction = instructionService.findByCode(String.valueOf(task));
if(ObjectUtil.isEmpty(instruction)){ if (ObjectUtil.isEmpty(instruction)) {
message = "指令号"+task+"未找到对应指令"; message = "指令号" + task + "未找到对应指令";
return; return;
} }
message = "申请AGV搬运任务中..."; message = "申请AGV搬运任务中...";
@@ -903,13 +915,13 @@ public class SiemensConveyorCkkDeviceDriver extends AbstractOpcDeviceDriver impl
JSONObject jo = JSON.parseObject(str); JSONObject jo = JSON.parseObject(str);
if (ObjectUtil.isEmpty(jo)) { if (ObjectUtil.isEmpty(jo)) {
message = "申请空盘出库接口不通"; message = "申请空盘出库接口不通";
requireSucess = true; // requireSucess = true;
} else { } else {
if (jo.getInteger("status") == 200) { if (jo.getInteger("status") == 200) {
message = "申请空盘出库成功"; message = "申请空盘出库成功";
requireSucess = true; requireSucess = true;
} else { } else {
requireSucess = true; // requireSucess = true;
message = "申请空盘出库失败," + jo.get("message").toString(); message = "申请空盘出库失败," + jo.get("message").toString();
} }
} }