rev:优化
This commit is contained in:
@@ -412,54 +412,6 @@ public class AutoCreateInst {
|
||||
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");
|
||||
taskserver.update(acsTask);
|
||||
|
||||
@@ -55,7 +55,12 @@ public class QueryXZAgvTaskStatus {
|
||||
String state = one.getString("state");
|
||||
if (!StrUtil.isEmpty(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,
|
||||
@@ -72,22 +77,16 @@ public class QueryXZAgvTaskStatus {
|
||||
if (inst != null) {
|
||||
inst.setInstruction_status("1");
|
||||
instructionService.update(inst);
|
||||
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
|
||||
taskService.update(taskDto);
|
||||
}
|
||||
} else if ("FINISHED".equals(state)) {
|
||||
if (inst != null) {
|
||||
inst.setInstruction_status("2");
|
||||
instructionService.finish(inst);
|
||||
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
|
||||
taskService.update(taskDto);
|
||||
}
|
||||
} else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) {
|
||||
if (inst != null) {
|
||||
inst.setInstruction_status("1");
|
||||
instructionService.update(inst);
|
||||
TaskDto taskDto = taskService.findByCode(inst.getTask_code());
|
||||
taskService.update(taskDto);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user