This commit is contained in:
2022-12-05 15:45:09 +08:00
parent b7188d4a9a
commit 66335dc4a3
3 changed files with 92 additions and 66 deletions

View File

@@ -153,12 +153,17 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
inst1.setInstruction_status("1"); inst1.setInstruction_status("1");
instructionService.update(inst1); instructionService.update(inst1);
TaskDto taskDto = taskserver.findByCode(inst1.getTask_code()); TaskDto taskDto = taskserver.findByCode(inst1.getTask_code());
JSONArray array = new JSONArray(); if (ObjectUtil.isNotEmpty(taskDto)){
JSONObject map = new JSONObject(); if (StrUtil.isNotEmpty(taskDto.getExt_task_id())){
map.put("task_id", taskDto.getExt_task_id()); JSONArray array = new JSONArray();
map.put("task_status", "1"); JSONObject map = new JSONObject();
array.add(map); map.put("task_id", taskDto.getExt_task_id());
acsToWmsService.feedbackTaskStatusToWms(array); map.put("task_status", "1");
array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array);
}
}
} }
} }
} }
@@ -181,7 +186,7 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
//行架机械手取货时校验条码 校验失败,取消任务 //行架机械手取货时校验条码 校验失败,取消任务
if (mode == 4 && action == 1 && move == 0 && task > 0) { if (mode == 4 && action == 1 && move == 0 && task > 0) {
Instruction instructionDto = instructionService.findByCode(String.valueOf(task)); Instruction instructionDto = instructionService.findByCodeFromCache(String.valueOf(task));
instructionService.cancel(instructionDto.getInstruction_id()); instructionService.cancel(instructionDto.getInstruction_id());
this.writing("to_command", "4"); this.writing("to_command", "4");
this.writing("to_onset", "0"); this.writing("to_onset", "0");
@@ -191,7 +196,7 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
//申请放货 //申请放货
if (mode == 3 && action == 3 && move == 1 && task > 0) { if (mode == 3 && action == 3 && move == 1 && task > 0) {
Instruction instructionDto = instructionService.findByCode(String.valueOf(task)); Instruction instructionDto = instructionService.findByCodeFromCache(String.valueOf(task));
String next_device_code = instructionDto.getNext_device_code(); String next_device_code = instructionDto.getNext_device_code();
Device nextDevice = appService.findDeviceByCode(next_device_code); Device nextDevice = appService.findDeviceByCode(next_device_code);
HfStationDeviceDriver hfStationDeviceDriver; HfStationDeviceDriver hfStationDeviceDriver;
@@ -209,28 +214,29 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task)); Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task));
if (inst2 != null) { if (inst2 != null) {
if (StrUtil.equals(inst2.getInstruction_status(), "1")) { if (StrUtil.equals(inst2.getInstruction_status(), "1")) {
try { this.finish_instruction(inst2);
finish_instruction(inst2);
} catch (Exception e) {
e.printStackTrace();
}
//获取当前工单数量 //获取当前工单数量
TaskDto taskDto = taskserver.findByCode(inst2.getTask_code()); TaskDto taskDto = taskserver.findByCode(inst2.getTask_code());
String next_device_code = inst2.getNext_device_code(); if (ObjectUtil.isNotEmpty(taskDto)){
Device device = appService.findDeviceByCode(next_device_code); if (StrUtil.isNotEmpty(taskDto.getExt_task_id())){
HfStationDeviceDriver hfStationDeviceDriver; String next_device_code = inst2.getNext_device_code();
String current_num = ""; Device device = appService.findDeviceByCode(next_device_code);
if (device.getDeviceDriver() instanceof HfStationDeviceDriver) { HfStationDeviceDriver hfStationDeviceDriver;
hfStationDeviceDriver = (HfStationDeviceDriver) device.getDeviceDriver(); String current_num = "";
current_num = String.valueOf(hfStationDeviceDriver.getCurrent_order_num()); if (device.getDeviceDriver() instanceof HfStationDeviceDriver) {
hfStationDeviceDriver = (HfStationDeviceDriver) device.getDeviceDriver();
current_num = String.valueOf(hfStationDeviceDriver.getCurrent_order_num());
}
JSONArray array = new JSONArray();
JSONObject map = new JSONObject();
map.put("task_id", taskDto.getExt_task_id());
map.put("task_status", "2");
map.put("material_num", current_num);
array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array);
}
} }
JSONArray array = new JSONArray();
JSONObject map = new JSONObject();
map.put("task_id", taskDto.getExt_task_id());
map.put("task_status", "2");
map.put("material_num", current_num);
array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array);
this.writing("to_command", "0"); this.writing("to_command", "0");
this.writing("to_onset", "0"); this.writing("to_onset", "0");
this.writing("to_target", "0"); this.writing("to_target", "0");
@@ -309,8 +315,8 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
instructionService.update(instruction); instructionService.update(instruction);
int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code()); int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code());
int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code()); int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code());
writing("to_onset", String.valueOf(start_addrIndex)); writing("to_onset", String.valueOf(start_addrIndex + 1));
writing("to_target", String.valueOf(next_addrIndex)); writing("to_target", String.valueOf(next_addrIndex + 1));
writing("to_task", instruction.getInstruction_code()); writing("to_task", instruction.getInstruction_code());
writing("to_command", "1"); writing("to_command", "1");
this.setRequireSucess(true); this.setRequireSucess(true);
@@ -366,8 +372,8 @@ public class HfGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver imp
//根据获取托盘信息返回的结果 得到对应抓取工位/放货工位设备编码所在的索引位置 //根据获取托盘信息返回的结果 得到对应抓取工位/放货工位设备编码所在的索引位置
int start_addrIndex = getDeviceCodeList.indexOf(start_device_code); int start_addrIndex = getDeviceCodeList.indexOf(start_device_code);
int next_addrIndex = putDeviceCodeList.indexOf(next_device_code); int next_addrIndex = putDeviceCodeList.indexOf(next_device_code);
writing("to_onset", String.valueOf(start_addrIndex)); writing("to_onset", String.valueOf(start_addrIndex + 1));
writing("to_target", String.valueOf(next_addrIndex)); writing("to_target", String.valueOf(next_addrIndex + 1));
writing("to_task", instdto.getInstruction_code()); writing("to_task", instdto.getInstruction_code());
writing("to_command", "1"); writing("to_command", "1");
this.setRequireSucess(true); this.setRequireSucess(true);

View File

@@ -416,7 +416,7 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De
} else { } else {
this.instruction_call_material_time = date; this.instruction_call_material_time = date;
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("point_code", this.device_code); json.put("device_code", this.device_code);
json.put("create_mode", "2"); json.put("create_mode", "2");
json.put("is_auto_issue", "0"); json.put("is_auto_issue", "0");
json.put("type", "1"); json.put("type", "1");

View File

@@ -193,17 +193,22 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
inst1.setInstruction_status("1"); inst1.setInstruction_status("1");
instructionService.update(inst1); instructionService.update(inst1);
TaskDto taskDto = taskserver.findByCode(inst1.getTask_code()); TaskDto taskDto = taskserver.findByCode(inst1.getTask_code());
JSONArray array = new JSONArray(); if (ObjectUtil.isNotEmpty(taskDto)){
JSONObject map = new JSONObject(); if (StrUtil.isNotEmpty(taskDto.getExt_task_id())){
map.put("task_id",taskDto.getExt_task_id()); JSONArray array = new JSONArray();
map.put("task_status","1"); JSONObject map = new JSONObject();
array.add(map); map.put("task_id",taskDto.getExt_task_id());
acsToWmsService.feedbackTaskStatusToWms(array); map.put("task_status","1");
array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array);
}
}
} }
} }
} }
//前工位放货完成 任务完成 //前工位放货完成 任务完成
if (action1 == 4 && move1 == 0 && task1 > 0) { if (mode == 3 && action1 == 4 && move1 == 0 && task1 > 0) {
//inst_message //inst_message
Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1));
if (inst1 != null) { if (inst1 != null) {
@@ -211,12 +216,17 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
finish_instruction(inst1); finish_instruction(inst1);
JSONArray array = new JSONArray(); JSONArray array = new JSONArray();
TaskDto taskDto = taskserver.findByCode(inst1.getTask_code()); TaskDto taskDto = taskserver.findByCode(inst1.getTask_code());
JSONObject map = new JSONObject(); if (ObjectUtil.isNotEmpty(taskDto)){
map.put("task_id",taskDto.getExt_task_id()); if (StrUtil.isNotEmpty(taskDto.getExt_task_id())){
map.put("task_status","2"); JSONObject map = new JSONObject();
map.put("finished_type","1"); map.put("task_id",taskDto.getExt_task_id());
array.add(map); map.put("task_status","2");
acsToWmsService.feedbackTaskStatusToWms(array); map.put("finished_type","1");
array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array);
}
}
writing("to_command1", "0"); writing("to_command1", "0");
writing("to_onset1", "0"); writing("to_onset1", "0");
writing("to_target1", "0"); writing("to_target1", "0");
@@ -234,17 +244,22 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
inst2.setInstruction_status("1"); inst2.setInstruction_status("1");
instructionService.update(inst2); instructionService.update(inst2);
TaskDto taskDto = taskserver.findByCode(inst2.getTask_code()); TaskDto taskDto = taskserver.findByCode(inst2.getTask_code());
JSONArray array = new JSONArray(); if (ObjectUtil.isNotEmpty(taskDto)){
JSONObject map = new JSONObject(); if (StrUtil.isNotEmpty(taskDto.getExt_task_id())){
map.put("task_id",taskDto.getExt_task_id()); JSONArray array = new JSONArray();
map.put("task_status","1"); JSONObject map = new JSONObject();
array.add(map); map.put("task_id",taskDto.getExt_task_id());
acsToWmsService.feedbackTaskStatusToWms(array); map.put("task_status","1");
array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array);
}
}
} }
} }
} }
//后工位放货完成 任务完成 //后工位放货完成 任务完成
if (action2 == 4 && move2 == 0 && task2 > 0) { if (mode == 3 && action2 == 4 && move2 == 0 && task2 > 0) {
//inst_message //inst_message
Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2)); Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2));
if (inst2 != null) { if (inst2 != null) {
@@ -252,12 +267,17 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
finish_instruction(inst2); finish_instruction(inst2);
JSONArray array = new JSONArray(); JSONArray array = new JSONArray();
TaskDto taskDto = taskserver.findByCode(inst1.getTask_code()); TaskDto taskDto = taskserver.findByCode(inst1.getTask_code());
JSONObject map = new JSONObject(); if (ObjectUtil.isNotEmpty(taskDto)){
map.put("task_id",taskDto.getExt_task_id()); if (StrUtil.isNotEmpty(taskDto.getExt_task_id())){
map.put("task_status","2"); JSONObject map = new JSONObject();
map.put("finished_type","1"); map.put("task_id",taskDto.getExt_task_id());
array.add(map); map.put("task_status","2");
acsToWmsService.feedbackTaskStatusToWms(array); map.put("finished_type","1");
array.add(map);
acsToWmsService.feedbackTaskStatusToWms(array);
}
}
writing("to_command2", "0"); writing("to_command2", "0");
writing("to_onset2", "0"); writing("to_onset2", "0");
writing("to_target2", "0"); writing("to_target2", "0");
@@ -418,8 +438,8 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
instructionService.update(instruction); instructionService.update(instruction);
int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code()); int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code());
int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code()); int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code());
this.writing("to_onset1", String.valueOf(start_addrIndex)); this.writing("to_onset1", String.valueOf(start_addrIndex + 1));
this.writing("to_target1", String.valueOf(next_addrIndex)); this.writing("to_target1", String.valueOf(next_addrIndex + 1));
this.writing("to_task1", instruction.getInstruction_code()); this.writing("to_task1", instruction.getInstruction_code());
this.writing("to_command1", "1"); this.writing("to_command1", "1");
requireHeadSucess = true; requireHeadSucess = true;
@@ -478,8 +498,8 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
//根据查询的任务起始点位 得出取放工位的索引值 写入后工位电气中 //根据查询的任务起始点位 得出取放工位的索引值 写入后工位电气中
int start_addrIndex = getDeviceCodeList.indexOf(start_device_code); int start_addrIndex = getDeviceCodeList.indexOf(start_device_code);
int next_addrIndex = putDeviceCodeList.indexOf(next_device_code); int next_addrIndex = putDeviceCodeList.indexOf(next_device_code);
this.writing("to_onset1", String.valueOf(start_addrIndex)); this.writing("to_onset1", String.valueOf(start_addrIndex + 1));
this.writing("to_target1", String.valueOf(next_addrIndex)); this.writing("to_target1", String.valueOf(next_addrIndex + 1));
this.writing("to_task1", instdto.getInstruction_code()); this.writing("to_task1", instdto.getInstruction_code());
this.writing("to_command1", "1"); this.writing("to_command1", "1");
requireHeadSucess = true; requireHeadSucess = true;
@@ -514,8 +534,8 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
instructionService.update(instruction); instructionService.update(instruction);
int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code()); int start_addrIndex = getDeviceCodeList.indexOf(instruction.getStart_device_code());
int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code()); int next_addrIndex = putDeviceCodeList.indexOf(instruction.getNext_device_code());
this.writing("to_onset1", String.valueOf(start_addrIndex)); this.writing("to_onset1", String.valueOf(start_addrIndex + 1));
this.writing("to_target1", String.valueOf(next_addrIndex)); this.writing("to_target1", String.valueOf(next_addrIndex + 1));
this.writing("to_task1", instruction.getInstruction_code()); this.writing("to_task1", instruction.getInstruction_code());
this.writing("to_command1", "1"); this.writing("to_command1", "1");
requireBackSucess = true; requireBackSucess = true;
@@ -573,8 +593,8 @@ public class HfTwoRGVDeviceDriver extends AbstractOpcDeviceDriver implements Dev
//根据查询的任务起始点位 得出取放工位的索引值 写入后工位电气中 //根据查询的任务起始点位 得出取放工位的索引值 写入后工位电气中
int start_addrIndex = getDeviceCodeList.indexOf(start_device_code); int start_addrIndex = getDeviceCodeList.indexOf(start_device_code);
int next_addrIndex = putDeviceCodeList.indexOf(next_device_code); int next_addrIndex = putDeviceCodeList.indexOf(next_device_code);
this.writing("to_onset2", String.valueOf(start_addrIndex)); this.writing("to_onset2", String.valueOf(start_addrIndex + 1));
this.writing("to_target2", String.valueOf(next_addrIndex)); this.writing("to_target2", String.valueOf(next_addrIndex + 1));
this.writing("to_task2", instdto.getInstruction_code()); this.writing("to_task2", instdto.getInstruction_code());
this.writing("to_command2", "1"); this.writing("to_command2", "1");
requireBackSucess = true; requireBackSucess = true;