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

View File

@@ -416,7 +416,7 @@ public class HfStationDeviceDriver extends AbstractOpcDeviceDriver implements De
} else {
this.instruction_call_material_time = date;
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("is_auto_issue", "0");
json.put("type", "1");

View File

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