fix:驱动代码修改

This commit is contained in:
2023-12-12 16:54:49 +08:00
parent 188e46b0fb
commit 6572957a09
5 changed files with 45 additions and 28 deletions

View File

@@ -89,10 +89,14 @@ public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver i
//报警
int error = 0;
int last_error = 0;
//任务号
//任务号1
int task = 0;
int last_task = 0;
//任务号2
int task1 = 0;
int last_task1 = 0;
String material1 = null;
String last_material1 = null;
@@ -136,6 +140,7 @@ public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver i
carrier_direction = this.itemProtocol.getCarrier_direction();
error = this.itemProtocol.getError();
task = this.itemProtocol.getTask();
task1 = this.itemProtocol.getTask1();
material1 = this.itemProtocol.getMaterial1();
material2 = this.itemProtocol.getMaterial2();
qty = this.itemProtocol.getQty();
@@ -161,6 +166,10 @@ public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver i
logServer.deviceItemValue(this.device_code, "task", String.valueOf(task));
logServer.deviceExecuteLog(this.device_code, "", "", "信号task" + last_task + "->" + task);
}
if (task1 != last_task1) {
logServer.deviceItemValue(this.device_code, "task1", String.valueOf(task1));
logServer.deviceExecuteLog(this.device_code, "", "", "信号task1" + last_task1 + "->" + task1);
}
if (error != last_error) {
if (error != 0) {
DeviceErrorLogDto dto = new DeviceErrorLogDto();
@@ -195,7 +204,7 @@ public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver i
logServer.deviceExecuteLog(this.device_code, "", "", "信号qty" + last_qty + "->" + qty);
}
if (move != 0 && task > 1) {
if (move != 0 && task > 1 && task1 > 0) {
update_instruction_status();
}

View File

@@ -22,8 +22,10 @@ public class ItemProtocol {
public static String item_carrier_direction = "carrier_direction";
//报警
public static String item_error = "error";
//任务号
//任务号1
public static String item_task = "task";
//任务号2
public static String item_task1 = "task1";
//物料1
public static String item_material1 = "material1";
//物料2
@@ -66,6 +68,10 @@ public class ItemProtocol {
return this.getOpcIntegerValue(item_task);
}
public int getTask1() {
return this.getOpcIntegerValue(item_task1);
}
public String getMaterial1() {
return this.getOpcStringValue(item_material1);
}
@@ -108,19 +114,20 @@ public class ItemProtocol {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_heartbeat, "心跳", "DB101.W0"));
list.add(new ItemDto(item_mode, "工作模式", "DB101.W2"));
list.add(new ItemDto(item_move, "光电信号", "DB101.W3"));
list.add(new ItemDto(item_carrier_direction, "托盘方向", "DB101.W4"));
list.add(new ItemDto(item_error, "报警", "DB101.W58"));
list.add(new ItemDto(item_task, "任务号", "DB101.W6"));
list.add(new ItemDto(item_material1, "物料1", "DB101.W7"));
list.add(new ItemDto(item_material2, "物料2", "DB101.W8"));
list.add(new ItemDto(item_move, "光电信号", "DB101.W4"));
list.add(new ItemDto(item_carrier_direction, "托盘方向", "DB101.W6"));
list.add(new ItemDto(item_error, "报警", "DB101.W8"));
list.add(new ItemDto(item_task, "任务号1", "DB101.D116"));
list.add(new ItemDto(item_task1, "任务号2", "DB101.D118"));
list.add(new ItemDto(item_material1, "物料1", "DB102.STRING10.50"));
list.add(new ItemDto(item_material2, "物料2", "DB102.STRING62.50"));
list.add(new ItemDto(item_qty, "数量", "DB101.W114"));
return list;
}
public static List<ItemDto> getWriteableItemDtos() {
ArrayList list = new ArrayList();
list.add(new ItemDto(item_to_command, "下发命令", "DB201.W4"));
list.add(new ItemDto(item_to_command, "下发命令", "DB201.W0"));
return list;
}

View File

@@ -16,7 +16,7 @@ public class ItemProtocol {
public static String item_move = "move";
public static String item_error = "error";
public static String item_task1 = "task1";
public static String item_task2 = "task2";
// public static String item_task2 = "task2";
public static String item_to_command = "to_command";
private PluggingUnpluggingMachineDeviceDriver driver;
@@ -44,9 +44,9 @@ public class ItemProtocol {
public int getTask1() {
return this.getOpcIntegerValue(item_task1);
}
public int getTask2() {
return this.getOpcIntegerValue(item_task2);
}
// public int getTask2() {
// return this.getOpcIntegerValue(item_task2);
// }
public int getToCommand() {
return this.getOpcIntegerValue(item_to_command);
@@ -80,7 +80,7 @@ public class ItemProtocol {
list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3"));
list.add(new ItemDto(item_error, "报警信号", "DB600.B5"));
list.add(new ItemDto(item_task1, "任务号1(行架任务号)", "DB600.D6"));
list.add(new ItemDto(item_task2, "任务号2(纸管任务号)", "DB600.D10"));
// list.add(new ItemDto(item_task2, "任务号2(纸管任务号)", "DB600.D10"));
return list;
}

View File

@@ -62,12 +62,12 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
int error = 0;
int move = 0;
int task1 = 0;
int task2 = 0;
// int task2 = 0;
int last_mode = 0;
int last_error = 0;
int last_move = 0;
int last_task1 = 0;
int last_task2 = 0;
// int last_task2 = 0;
Boolean isonline = true;
Boolean iserror = false;
@@ -98,7 +98,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
error = this.itemProtocol.getError();
move = this.itemProtocol.getMove();
task1 = this.itemProtocol.getTask1();
task2 = this.itemProtocol.getTask2();
// task2 = this.itemProtocol.getTask2();
if (mode != last_mode) {
this.requireSucess=false;
@@ -137,12 +137,12 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
case 3:
break;
case 4:
if ((task1 > 0 || task2 > 0) && !requireSucess) {
if ((task1 > 0) && !requireSucess) {
applyBushing();
}
break;
case 5:
if ((task1 > 0 || task2 > 0) && !requireSucess) {
if ((task1 > 0) && !requireSucess) {
bushingSucess();
}
break;
@@ -161,7 +161,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
last_error = error;
last_move = move;
last_task1 = task1;
last_task2 = task2;
// last_task2 = task2;
}
private synchronized void pullingSucess() {
@@ -194,12 +194,12 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
ApplyManipulatorActionResponse applyManipulatorActionResponse;
Instruction inst1 = instructionService.findByCode(String.valueOf(task1));
Instruction inst2 = instructionService.findByCode(String.valueOf(task2));
// Instruction inst2 = instructionService.findByCode(String.valueOf(task2));
String task_code1 = inst1.getTask_code();
String task_code2 = inst2.getTask_code();
// String task_code2 = inst2.getTask_code();
applyManipulatorActionRequest.setDevice_code(device_code);
applyManipulatorActionRequest.setTask_code1(task_code1);
applyManipulatorActionRequest.setTask_code2(task_code2);
// applyManipulatorActionRequest.setTask_code2(task_code2);
applyManipulatorActionRequest.setType("7");
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
if (applyManipulatorActionResponse.getstatus()==200) {
@@ -224,12 +224,12 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv
ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest();
ApplyManipulatorActionResponse applyManipulatorActionResponse;
Instruction inst1 = instructionService.findByCode(String.valueOf(task1));
Instruction inst2 = instructionService.findByCode(String.valueOf(task2));
// Instruction inst2 = instructionService.findByCode(String.valueOf(task2));
String task_code1 = inst1.getTask_code();
String task_code2 = inst2.getTask_code();
// String task_code2 = inst2.getTask_code();
applyManipulatorActionRequest.setDevice_code(device_code);
applyManipulatorActionRequest.setTask_code1(task_code1);
applyManipulatorActionRequest.setTask_code2(task_code2);
// applyManipulatorActionRequest.setTask_code2(task_code2);
applyManipulatorActionRequest.setType("6");
applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest);
if (applyManipulatorActionResponse.getstatus()==200) {

View File

@@ -316,6 +316,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("carrier_direction", casingStationConveyorDeviceDriver.getCarrier_direction());
jo.put("error", casingStationConveyorDeviceDriver.getError());
jo.put("task", casingStationConveyorDeviceDriver.getTask());
jo.put("task1", casingStationConveyorDeviceDriver.getTask1());
jo.put("material1", casingStationConveyorDeviceDriver.getMaterial1());
jo.put("material2", casingStationConveyorDeviceDriver.getMaterial2());
jo.put("qty", casingStationConveyorDeviceDriver.getQty());
@@ -484,7 +485,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService {
jo.put("mode", driver.getMode());
jo.put("move", driver.getMove());
jo.put("task1", driver.getTask1());
jo.put("task2", driver.getTask2());
// jo.put("task2", driver.getTask2());
jo.put("error", driver.getError());
jo.put("error_msg", driver.getError() == 0 ? "" : ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(driver.getError())));
} else {