diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java index a14c6e74a..71ff21035 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/slit_two_manipulator/SlitTwoManipulatorDeviceDriver.java @@ -107,13 +107,13 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl int flag; //前工位任务执行当前步骤 - //0未执行 1更改指令状态 2下发电气任务信息 3前工位允许取货 4前工位允许放货 5放货完成 + //0未执行 1更改指令状态 2下发电气任务信息 3前工位允许取货 4前工位取货完成 5前工位允许放货 6放货完成 int now_steps_type1 = 0; //后工位当前执行步骤 - //0未执行 1更改指令状态 2下发电气任务信息 3后工位允许取货 4后工位允许放货 5放货完成 + //0未执行 1更改指令状态 2下发电气任务信息 3后工位允许取货4后工位取货完成 5后工位允许放货 6放货完成 int now_steps_type2 = 0; //双工位任务当前执行步骤 - //0未执行 1更改指令状态 2下发电气任务信息 3后工位允许取货 4前工位允许取货 5后工位允许放货 6后工位放货完成 7前工位允许放货 8前工位放货完成 + //0未执行 1更改指令状态 2下发电气任务信息 3后工位允许取货 4后工位取货完成 5前工位允许取货 6前工位取货完成 7后工位允许放货 8后工位放货完成 9前工位允许放货 10前工位放货完成 int now_steps_type3 = 0; String device_code; @@ -277,128 +277,11 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl } } ; - // this.setNow_steps_type3(1); } } } - //单任务前工位放货完成 任务完成 - if (mode == 3 && action1 == 4 && move1 == 0 && task1 > 0 && type == 1) { - //inst_message - Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); - if (inst1 != null) { - if (StrUtil.equals(inst1.getInstruction_status(), "1")) { - this.finish_instruction(inst1); - TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code()); - if (!ObjectUtil.isEmpty(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", "2"); - array.add(map); - acsToWmsService.feedbackTaskStatusToWms(array); - } - } - ; - this.writing("to_command1", "4"); - this.setNow_steps_type1(5); - this.setNow_steps_type1(0); -// this.writing("to_onset1", "0"); -// this.writing("to_target1", "0"); -// this.writing("to_task1", "0"); -// this.writing("to_type", "0"); - } - } - } else { - if (this.getNow_steps_type1() == 4) { - feedMessage = "请检查:mode == 3 && action1 == 4 && move1 == 0 && task1 > 0 && type == 1"; - } - } - - //单任务 后工位放货完成 任务完成 - if (mode == 3 && action2 == 4 && move2 == 0 && task2 > 0 && type == 2) { - //inst_message - Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2)); - if (inst2 != null) { - if (StrUtil.equals(inst2.getInstruction_status(), "1")) { - finish_instruction(inst2); - TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code()); - if (!ObjectUtil.isEmpty(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", "2"); - array.add(map); - acsToWmsService.feedbackTaskStatusToWms(array); - } - } - ; - this.writing("to_command2", "4"); - this.setNow_steps_type2(5); - this.setNow_steps_type2(0); -// this.writing("to_onset2", "0"); -// this.writing("to_target2", "0"); -// this.writing("to_task2", "0"); -// this.writing("to_type", "0"); - } - } - } else { - if (this.getNow_steps_type2() == 4) { - feedMessage = "请检查:mode == 3 && action2 == 4 && move2 == 0 && task2 > 0 && type == 2"; - } - } - - //双任务后工位反馈4 - if (mode == 3 && action2 == 4 && move2 == 0 && task1 > 0 && task2 > 0 && type == 3) { - this.writing("to_command2", "4"); - this.setNow_steps_type3(6); - } else { - if (this.getNow_steps_type3() == 5) { - feedMessage = "请检查:mode == 3 && action2 == 4 && move2 == 0 && task1 > 0 && task2 > 0 && type == 3"; - } - } - - //双工位 任务完成 前工位反馈4 - if (mode == 3 && action1 == 4 && move1 == 0 && task1 > 0 && task2 > 0 && type == 3) { - //inst_message - Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); - if (inst1 != null) { - if (StrUtil.equals(inst1.getInstruction_status(), "1")) { - this.finish_instruction(inst1); - TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code()); - if (!ObjectUtil.isEmpty(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", "2"); - array.add(map); - acsToWmsService.feedbackTaskStatusToWms(array); - } - } - ; - this.writing("to_command1", "4"); - this.setNow_steps_type3(8); - this.setNow_steps_type3(0); -// this.writing("to_onset1", "0"); -// this.writing("to_target1", "0"); -// this.writing("to_task1", "0"); -// this.writing("to_onset2", "0"); -// this.writing("to_target2", "0"); -// this.writing("to_task2", "0"); -// this.writing("to_type", "0"); - } - } - } else { - if (this.getNow_steps_type3() == 7) { - feedMessage = "请检查:mode == 3 && action1 == 4 && move1 == 0 && task1 > 0 && task2 > 0 && type == 3"; - } - } - - - //后工位取货时判断取货位光电信号 + //双任务/单任务 后工位取空时判断动作信号,并反馈 if (mode == 3 && action2 == 1 && move2 == 0 && task2 > 0) { Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task2)); String start_device_code = ""; @@ -434,35 +317,106 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl } } - //后工位允许放货 - if (mode == 3 && action2 == 3 && move2 == 1 && task2 > 0) { - this.writing("to_command2", "3"); - if (type == 2) { + //单任务/或双任务 后工位收到取货完成信号并反馈 + if (mode == 3 && action2 == 2 && move2 == 1 && task2 > 0){ + this.writing("to_command2","3"); + if (type == 2){ this.setNow_steps_type2(4); - } else if (type == 3) { - this.setNow_steps_type3(5); } - } else { - if (this.getNow_steps_type2() == 3 || this.getNow_steps_type3() == 4) { - feedMessage = "请检查:mode == 3 && action2 == 3 && move2 == 1 && task2 > 0"; + if (type == 3){ + this.setNow_steps_type3(4); + } + }else { + if (this.getNow_steps_type2() == 3 || this.getNow_steps_type3() == 3) { + feedMessage = "请检查:mode == 3 && action2 == 2 && move2 == 1 && task2 > 0"; } } - //前工位允许取货 + //单任务/双任务 前工位取货时判断动作信号并反馈 if (mode == 3 && action1 == 1 && move1 == 0 && task1 > 0) { this.writing("to_command1", "2"); if (type == 1) { this.setNow_steps_type1(3); } else if (type == 3) { - this.setNow_steps_type3(4); + this.setNow_steps_type3(5); } } else { - if (this.getNow_steps_type1() == 2 || this.getNow_steps_type3() == 3) { + if (this.getNow_steps_type1() == 2 || this.getNow_steps_type3() == 4) { feedMessage = "请检查mode == 3 && action1 == 1 && move1 == 0 && task1 > 0"; } } - //前工位放货时判断放货位光电信号 + //单任务/双任务 前工位取货完成并反馈 + if (mode == 3 && action1 == 2 && move1 == 1 && task1 > 0){ + this.writing("to_command1","3"); + if (type == 1){ + this.setNow_steps_type1(4); + } + if (type == 3){ + this.setNow_steps_type3(6); + } + }else { + if (this.getNow_steps_type1() == 3 || this.getNow_steps_type3() == 5) { + feedMessage = "请检查:mode == 3 && action1 == 2 && move1 == 1 && task1 > 0"; + } + } + + + //单任务/双任务 后工位放货时判断信号并反馈 + if (mode == 3 && action2 == 3 && move2 == 1 && task2 > 0) { + this.writing("to_command2", "4"); + if (type == 2) { + this.setNow_steps_type2(5); + } else if (type == 3) { + this.setNow_steps_type3(7); + } + } else { + if (this.getNow_steps_type2() == 4 || this.getNow_steps_type3() == 6) { + feedMessage = "请检查:mode == 3 && action2 == 3 && move2 == 1 && task2 > 0"; + } + } + + //单任务 后工位放货完成 任务完成 + if (mode == 3 && action2 == 4 && move2 == 0 && task2 > 0 && type == 2) { + //inst_message + Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2)); + if (inst2 != null) { + if (StrUtil.equals(inst2.getInstruction_status(), "1")) { + finish_instruction(inst2); + TaskDto taskDto = taskserver.findByCodeFromCache(inst2.getTask_code()); + if (!ObjectUtil.isEmpty(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", "2"); + array.add(map); + acsToWmsService.feedbackTaskStatusToWms(array); + } + } + ; + this.writing("to_command2", "5"); + this.setNow_steps_type2(6); + this.setNow_steps_type2(0); + } + } + } else { + if (this.getNow_steps_type2() == 5) { + feedMessage = "请检查:mode == 3 && action2 == 4 && move2 == 0 && task2 > 0 && type == 2"; + } + } + + //双任务 后工位反馈任务完成 并反馈 + if (mode == 3 && action2 == 4 && move2 == 0 && task1 > 0 && task2 > 0 && type == 3) { + this.writing("to_command2", "5"); + this.setNow_steps_type3(8); + } else { + if (this.getNow_steps_type3() == 7) { + feedMessage = "请检查:mode == 3 && action2 == 4 && move2 == 0 && task1 > 0 && task2 > 0 && type == 3"; + } + } + + //单任务/双任务 前工位放货时判断放货位光电信号 if (mode == 3 && action1 == 3 && move1 == 1 && task1 > 0) { Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); String next_device_code = inst1.getNext_device_code(); @@ -473,25 +427,90 @@ public class SlitTwoManipulatorDeviceDriver extends AbstractOpcDeviceDriver impl int move = siemensConveyorDeviceDriver.getMove(); int mode = siemensConveyorDeviceDriver.getMode(); if (move == 0 && mode == 2) { - this.writing("to_command1", "3"); + this.writing("to_command1", "4"); if (type == 1) { - this.setNow_steps_type1(4); + this.setNow_steps_type1(5); } else if (type == 3) { - this.setNow_steps_type3(7); + this.setNow_steps_type3(9); } } else { log.warn("后工位放货位有货,放货位:{},mode:{},move:{}", next_device_code, mode, move); - if (this.getNow_steps_type1() == 3 || this.getNow_steps_type3() == 6) { + if (this.getNow_steps_type1() == 4 || this.getNow_steps_type3() == 8) { feedMessage = "请检查输送线:move == 0 && mode == 2"; } } } } else { - if (this.getNow_steps_type1() == 3 || this.getNow_steps_type3() == 6) { + if (this.getNow_steps_type1() == 4 || this.getNow_steps_type3() == 8) { feedMessage = "请检查:mode == 3 && action1 == 3 && move1 == 1 && task1 > 0"; } } + + //单任务前工位放货完成 任务完成 + if (mode == 3 && action1 == 4 && move1 == 0 && task1 > 0 && type == 1) { + //inst_message + Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); + if (inst1 != null) { + if (StrUtil.equals(inst1.getInstruction_status(), "1")) { + this.finish_instruction(inst1); + TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code()); + if (!ObjectUtil.isEmpty(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", "2"); + array.add(map); + acsToWmsService.feedbackTaskStatusToWms(array); + } + } + ; + this.writing("to_command1", "5"); + this.setNow_steps_type1(6); + this.setNow_steps_type1(0); + } + } + } else { + if (this.getNow_steps_type1() == 5) { + feedMessage = "请检查:mode == 3 && action1 == 4 && move1 == 0 && task1 > 0 && type == 1"; + } + } + + + + //双工位 任务完成 前工位反馈4 + if (mode == 3 && action1 == 4 && move1 == 0 && task1 > 0 && task2 > 0 && type == 3) { + //inst_message + Instruction inst1 = instructionService.findByCodeFromCache(String.valueOf(task1)); + if (inst1 != null) { + if (StrUtil.equals(inst1.getInstruction_status(), "1")) { + this.finish_instruction(inst1); + TaskDto taskDto = taskserver.findByCodeFromCache(inst1.getTask_code()); + if (!ObjectUtil.isEmpty(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", "2"); + array.add(map); + acsToWmsService.feedbackTaskStatusToWms(array); + } + } + ; + this.writing("to_command1", "5"); + this.setNow_steps_type3(10); + this.setNow_steps_type3(0); + } + } + } else { + if (this.getNow_steps_type3() == 9) { + feedMessage = "请检查:mode == 3 && action1 == 4 && move1 == 0 && task1 > 0 && task2 > 0 && type == 3"; + } + } + + + } catch (Exception var17) { return; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/AcsUtil.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/AcsUtil.java index 8db03aa1f..8f78cb017 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/AcsUtil.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/AcsUtil.java @@ -3,7 +3,7 @@ package org.nl.acs.ext.wms; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpRequest; -import cn.hutool.http.HttpResponse; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import org.nl.modules.common.exception.BadRequestException; import org.nl.modules.system.service.ParamService; @@ -25,7 +25,7 @@ public class AcsUtil { try { return HttpRequest .post(liKu_wcs_url + api) - .body(String.valueOf(requestParam)) + .body(JSON.toJSONString(requestParam)) .execute() .body(); } catch (Exception e) {