fix :取消任务
This commit is contained in:
@@ -279,6 +279,8 @@ public class StandardInspectSite2DeviceDriver extends AbstractOpcDeviceDriver im
|
||||
WQLObject wo = WQLObject.getWQLObject("acs_task");
|
||||
JSONObject json = JSONObject.fromObject(dto);
|
||||
wo.insert(json);
|
||||
|
||||
writingTask(taskcode);
|
||||
requireSucess = true;
|
||||
}
|
||||
}
|
||||
@@ -355,6 +357,18 @@ public class StandardInspectSite2DeviceDriver extends AbstractOpcDeviceDriver im
|
||||
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) {
|
||||
String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + ItemProtocol.item_to_command;
|
||||
@@ -404,10 +418,8 @@ public class StandardInspectSite2DeviceDriver extends AbstractOpcDeviceDriver im
|
||||
} else {
|
||||
this.instruction_require_time = date;
|
||||
|
||||
Instruction inst = checkInst();
|
||||
|
||||
try {
|
||||
taskserver.cancelByCode(inst.getTask_code());
|
||||
taskserver.cancelByCode("-"+task);
|
||||
} catch (Exception e) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 终点请求取消指令
|
||||
|
||||
Reference in New Issue
Block a user