fix: 烘箱下发信号指令错误解决

This commit is contained in:
yanps
2024-03-29 18:55:20 +08:00
parent de2bdefb24
commit b4e31c71a2
4 changed files with 18 additions and 11 deletions

View File

@@ -440,9 +440,6 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
notCreateInstMessage = "手动创建指令未下发电气信号原因->取货位:" + start_device_code + ",放货位:" + next_device_code + ",存在关联的同一列烘箱设备未关门!指令号:" + instruction.getInstruction_code();
return false;
}
instruction.setInstruction_status("1");
instruction.setUpdate_time(DateUtil.now());
instructionService.update(instruction);
Device startDevice = deviceAppService.findDeviceByCode(start_device_code);
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
if (ObjectUtil.isEmpty(startDevice.getExtraValue().get("address"))) {
@@ -454,7 +451,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code()
+ instruction.getInstruction_code() + "任务号="+ taskDto.getTask_code() + ",指令起点:" + instruction.getStart_device_code()
+ ",指令终点:" + instruction.getNext_device_code());
this.writing("to_onset", start_addr);
this.writing("to_target", next_addr);
@@ -622,10 +619,15 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
throw new BadRequestException("设备:" + nextDevice.getDevice_code() + "未设置电气调度号!");
}
Instruction byInsructionCode = instructionService.findByInsructionCode(instdto.getInstruction_code());
if(ObjectUtil.isEmpty(byInsructionCode)){
logServer.deviceExecuteLog(this.getDevice_code(), "", "", "未找到指令号: "+instdto.getInstruction_code());
return false;
}
String start_addr = startDevice.getExtraValue().get("address").toString();
String next_addr = nextDevice.getExtraValue().get("address").toString();
logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:"
+ instdto.getInstruction_code() +";指令号: "+ CodeUtil.getNewCode("INSTRUCT_NO") + ",指令起点:" + instdto.getStart_device_code()
+ instdto.getInstruction_code()+ "任务号: "+ task.getTask_code() + ",指令起点:" + instdto.getStart_device_code()
+ ",指令终点:" + instdto.getNext_device_code());
this.writing("to_onset", start_addr);
this.writing("to_target", next_addr);

View File

@@ -117,7 +117,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
}
int[] arr = new int[count];
StringBuffer bs = new StringBuffer();
StringBuffer bs = new StringBuffer();
for (int i = 0; i < count; i++) {
int temp = b[i];

View File

@@ -230,7 +230,8 @@ public class AgvNdcTwoDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) {
e.printStackTrace();
}
if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1 && standardInspectSiteDeviceDriver.getError() == 0)) {
if ((standardInspectSiteDeviceDriver.getMove() == 1 && standardInspectSiteDeviceDriver.getAction() == 1
&& standardInspectSiteDeviceDriver.getError() == 0)) {
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} else {
message = "设备号:" + device_code + "光电信号:" + standardInspectSiteDeviceDriver.getMove() + ",动作信号:" + standardInspectSiteDeviceDriver.getAction() + "报警信号:" + standardInspectSiteDeviceDriver.getError() + ",指令号:" + ikey + "不满足取货条件";

View File

@@ -707,7 +707,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (linkDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) linkDevice.getDeviceDriver();
//判断关联设备是否开门
if (hongXiangConveyorDeviceDriver.getDoor() == 1) {
if (hongXiangConveyorDeviceDriver.getDoor() == 1 || hongXiangConveyorDeviceDriver.getError1() != 0
|| hongXiangConveyorDeviceDriver.getError() != 0) {
isClose = true;
notCreateInstMessage = start_device_code + "关联设备->" + deviceCode + "烘箱门未关闭!";
break;
@@ -732,7 +733,8 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
if (linkDevice.getDeviceDriver() instanceof HongXiangConveyorDeviceDriver) {
hongXiangConveyorDeviceDriver = (HongXiangConveyorDeviceDriver) linkDevice.getDeviceDriver();
//判断关联设备是否开门
if (hongXiangConveyorDeviceDriver.getDoor() == 1) {
if (hongXiangConveyorDeviceDriver.getDoor() == 1 || hongXiangConveyorDeviceDriver.getError1() != 0
|| hongXiangConveyorDeviceDriver.getError() != 0) {
isClose = true;
notCreateInstMessage = next_device_code + "关联设备->" + deviceCode + "烘箱门未关闭!";
break;
@@ -812,8 +814,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
int door = hongXiangConveyorDeviceDriver.getDoor();
int action = hongXiangConveyorDeviceDriver.getAction();
int error1 = hongXiangConveyorDeviceDriver.getError1();
int error = hongXiangConveyorDeviceDriver.getError();
int move = hongXiangConveyorDeviceDriver.getMove();
if (mode == 1 && door == 1 && action == 1 && error1 == 0 && move == 1) {
if (mode == 1 && door == 1 && action == 1 && error == 0 && error1 == 0 && move == 1) {
if (this.getNow_steps_type() == 2) {
map.put("code", "to_command");
map.put("value", "2");
@@ -920,8 +923,9 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
int door = hongXiangConveyorDeviceDriver.getDoor();
int action = hongXiangConveyorDeviceDriver.getAction();
int error1 = hongXiangConveyorDeviceDriver.getError1();
int error = hongXiangConveyorDeviceDriver.getError();
int move = hongXiangConveyorDeviceDriver.getMove();
if (mode == 1 && door == 1 && action == 1 && error1 == 0 && move == 0) {
if (mode == 1 && door == 1 && action == 1 && error == 0 && error1 == 0 && move == 0) {
if (this.getNow_steps_type() == 4) {
map.put("code", "to_command");
map.put("value", "4");