Browse Source

fix :取消任务

master
李帅 2 months ago
parent
commit
47e020281f
  1. 35
      acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site2/StandardInspectSite2DeviceDriver.java

35
acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site2/StandardInspectSite2DeviceDriver.java

@ -279,6 +279,8 @@ public class StandardInspectSite2DeviceDriver extends AbstractOpcDeviceDriver im
WQLObject wo = WQLObject.getWQLObject("acs_task"); WQLObject wo = WQLObject.getWQLObject("acs_task");
JSONObject json = JSONObject.fromObject(dto); JSONObject json = JSONObject.fromObject(dto);
wo.insert(json); wo.insert(json);
writingTask(taskcode);
requireSucess = true; requireSucess = true;
} }
} }
@ -355,6 +357,18 @@ public class StandardInspectSite2DeviceDriver extends AbstractOpcDeviceDriver im
server.dispose(); server.dispose();
} }
public void writingTask(String task) {
String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_task;
String opcservcerid = this.getDevice().getOpc_server_id();
Server server = ReadUtil.getServer(opcservcerid);
Map<String, Object> itemMap = new HashMap<String, Object>();
itemMap.put(to_task, task);
ReadUtil.write(itemMap, server);
server.dispose();
}
public void writing(int type, int command) { public void writing(int type, int command) {
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
+ "." + ItemProtocol.item_to_command; + "." + ItemProtocol.item_to_command;
@ -404,10 +418,8 @@ public class StandardInspectSite2DeviceDriver extends AbstractOpcDeviceDriver im
} else { } else {
this.instruction_require_time = date; this.instruction_require_time = date;
Instruction inst = checkInst();
try { try {
taskserver.cancelByCode(inst.getTask_code()); taskserver.cancelByCode("-"+task);
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -416,22 +428,7 @@ public class StandardInspectSite2DeviceDriver extends AbstractOpcDeviceDriver im
} }
} }
public Instruction checkInst() {
if (ObjectUtil.isNotEmpty(this.inst)) {
if (this.task > 0) {
if (this.inst.getInstruction_code().equals(String.valueOf(this.task))) {
return this.inst;
} else {
inst = instructionService.findByCodeFromCache(String.valueOf(task));
return inst;
}
}
} else {
inst = instructionService.findByCodeFromCache(String.valueOf(task));
return inst;
}
return null;
}
/** /**
* 终点请求取消指令 * 终点请求取消指令

Loading…
Cancel
Save