Browse Source

rev:优化

master
涂强 4 months ago
parent
commit
2dd8125eed
  1. 48
      hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java
  2. 13
      hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryXZAgvTaskStatus.java

48
hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCreateInst.java

@ -412,54 +412,6 @@ public class AutoCreateInst {
continue; continue;
} }
HttpResponse response = agvService.queryXZAgvInstStatus();
JSONObject jo = JSONArray.parseObject(response.body());
JSONArray ja = JSONArray.parseArray(jo.getString("list"));
for (int j = 0; j < ja.size(); j++) {
JSONObject one = (JSONObject) ja.get(j);
String inst_code = one.getString("id");
Instruction inst = instructionService.findByCodeFromCache(inst_code);
if (ObjectUtil.isEmpty(inst))
continue;
String state = one.getString("state");
if (!StrUtil.isEmpty(one.getString("vehicle"))) {
String carno = one.getString("vehicle");
inst.setCarno(carno);
}
// 已创建=CREATED,
// 待分配=TOBEDISPATCHED,
// 正在执行=RUNNING,
// 完成=FINISHED,
// 失败=FAILED(主动失败),
// 终止=STOPPED(被人为终止),
// 无法执行=Error(参数错误),
// 等待=WAITING
//执行中
if ("RUNNING".equals(state) || "CREATED".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) {
if (inst != null) {
inst.setInstruction_status("1");
instructionService.update(inst);
}
} else if ("FINISHED".equals(state)) {
if (inst != null) {
inst.setInstruction_status("2");
instructionService.finish(inst);
}
} else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) {
if (inst != null) {
inst.setInstruction_status("1");
instructionService.update(inst);
}
}
}
//创建指令后修改任务状态 //创建指令后修改任务状态
acsTask.setTask_status("1"); acsTask.setTask_status("1");
taskserver.update(acsTask); taskserver.update(acsTask);

13
hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/QueryXZAgvTaskStatus.java

@ -55,7 +55,12 @@ public class QueryXZAgvTaskStatus {
String state = one.getString("state"); String state = one.getString("state");
if (!StrUtil.isEmpty(one.getString("vehicle"))) { if (!StrUtil.isEmpty(one.getString("vehicle"))) {
String carno = one.getString("vehicle"); String carno = one.getString("vehicle");
inst.setCarno(carno); if (ObjectUtil.isEmpty(inst.getCarno())) {
inst.setCarno(carno);
instructionService.update(inst);
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
taskService.update(taskDto);
}
} }
// 已创建=CREATED, // 已创建=CREATED,
@ -72,22 +77,16 @@ public class QueryXZAgvTaskStatus {
if (inst != null) { if (inst != null) {
inst.setInstruction_status("1"); inst.setInstruction_status("1");
instructionService.update(inst); instructionService.update(inst);
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
taskService.update(taskDto);
} }
} else if ("FINISHED".equals(state)) { } else if ("FINISHED".equals(state)) {
if (inst != null) { if (inst != null) {
inst.setInstruction_status("2"); inst.setInstruction_status("2");
instructionService.finish(inst); instructionService.finish(inst);
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
taskService.update(taskDto);
} }
} else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) { } else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) {
if (inst != null) { if (inst != null) {
inst.setInstruction_status("1"); inst.setInstruction_status("1");
instructionService.update(inst); instructionService.update(inst);
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
taskService.update(taskDto);
} }
} }
} }

Loading…
Cancel
Save