diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java index 10ccaae96..8d4fd056c 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java @@ -55,6 +55,10 @@ public enum DriverTypeEnum { PAPER_TUBE_DEVICE(22, "paper_tube_conveyor", "纸管库设备", "conveyor"), + PAPER_TUBE_DEVICE2(26, "paper_tube_conveyor2", "纸管库2", "conveyor"), + + CASING_STATION(27, "casing_station", "套管工位", "conveyor"), + DEVICE_STATUS(23,"device_status","立库设备状态","conveyor"), INDOOR_MANIPULATOR(24,"indoor_manipulator","内包间-行架机械手","station"), diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device/wql/task_inst.xls b/acs/nladmin-system/src/main/java/org/nl/acs/device/wql/task_inst.xls index d3ad5b206..3d99fe326 100644 Binary files a/acs/nladmin-system/src/main/java/org/nl/acs/device/wql/task_inst.xls and b/acs/nladmin-system/src/main/java/org/nl/acs/device/wql/task_inst.xls differ diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationConveyorDeviceDriver.java index 0c7406519..c5a43c70e 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/casing_station/CasingStationConveyorDeviceDriver.java @@ -177,6 +177,7 @@ public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver i param.put("device_type", "1"); param.put("product_area", paramService.findByCode("productArea").getValue()); acsToWmsService.sendDeviceStatus(param); + requireSucess = false; logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记:" + requireSucess); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode); } @@ -287,6 +288,11 @@ public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver i applyPaperActionRequest.setMaterial1(material1); applyPaperActionRequest.setMaterial2(material2); ApplyPaperActionResponse applyPaperActionResponse = acsToWmsService.applyPaperActionRequest(applyPaperActionRequest); + if (ObjectUtil.isNull(applyPaperActionResponse)) { + message = "请求失败"; + requireSucess = false; + return; + } Map map = new HashMap(); if (applyPaperActionResponse.getstatus() == 200) { map.put("code", "to_command"); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/IndoorManipulatorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/IndoorManipulatorDeviceDriver.java index 69e69deee..6b9c6bae0 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/IndoorManipulatorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/indoor_manipulator/IndoorManipulatorDeviceDriver.java @@ -5,27 +5,18 @@ import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; -import org.nl.acs.AcsConfig; import org.nl.acs.device.service.DeviceService; import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.RouteableDeviceDriver; -import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver; -import org.nl.acs.device_driver.basedriver.lamp_three_color.LampThreecolorDeviceDriver; -import org.nl.acs.device_driver.basedriver.photoelectric_inspection_site.PhotoelectricInspectionSiteDeviceDriver; import org.nl.acs.device_driver.basedriver.plugging_unplugging_machine.PluggingUnpluggingMachineDeviceDriver; import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver; -import org.nl.acs.device_driver.basedriver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; -import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingRequest; -import org.nl.acs.ext.wms.data.ApplyLabelingAndBindingResponse; import org.nl.acs.ext.wms.data.ApplyManipulatorActionRequest; import org.nl.acs.ext.wms.data.ApplyManipulatorActionResponse; import org.nl.acs.ext.wms.service.AcsToWmsService; @@ -36,7 +27,6 @@ import org.nl.acs.history.service.impl.DeviceErrorLogServiceImpl; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; import org.nl.acs.log.service.DeviceExecuteLogService; -import org.nl.acs.monitor.DeviceStageMonitor; import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppServiceImpl; @@ -311,14 +301,9 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple logServer.deviceExecuteLog(this.device_code, "", "", "信号inflatable_shaft_size:" + last_inflatable_shaft_size + "->" + inflatable_shaft_size); } - if (task > 0 && getTo_task_type() == 1) { + + if (task > 0 && !feedbackSucess) { update_instruction_status(); - } else if (task > 0 && getTo_task_type() == 2) {// - update_instruction_status2(); - } else if (task > 0 && getTo_task_type() == 6) { - update_instruction_status3(); - } else if (task > 0 && getTo_task_type() == 7) { - update_instruction_status4(); } @@ -425,348 +410,180 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple } private synchronized void update_instruction_status() { + ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest(); + ApplyManipulatorActionResponse applyManipulatorActionResponse; Date date = new Date(); - if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out); + Instruction inst1 = checkInst(); + if (inst1 != null) { + if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out); - } else { - this.instruction_update_time = date; - //更改任务状态 - if (task > 0) { - //inst_message - Instruction inst1 = checkInst(); - if (inst1 != null) { - if (StrUtil.equals(inst1.getInstruction_status(), "0")) { - inst1.setInstruction_status("1"); - inst1.setExecute_device_code(this.device_code); - instructionService.update(inst1); - } - } - } - - //任务完成 - if (action == 8) { - Instruction inst2 = checkInst(); - if (inst2 != null) { - try { - finish_instruction(inst2); - this.writing("to_command", "8"); - } catch (Exception e) { - e.printStackTrace(); - } - feedMessage = ""; - } } else { - feedMessage = "行架机械手:"; - if (mode != 3) { - feedMessage = feedMessage + "工作模式(mode)不为运行中状态,"; - } - if (action != 6) { - feedMessage = feedMessage + "动作信号(action)不为放货完成状态,"; - } - if (move != 0) { - feedMessage = feedMessage + "光电信号(move)不为无货状态,"; - } - if (task == 0) { - feedMessage = feedMessage + "当前上报任务号(task)不应该为0。"; - } - } - - - } - } - - private synchronized void update_instruction_status2() { - Date date = new Date(); - if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out); - - } else { - this.instruction_update_time = date; - //更改任务状态 - if (task > 0) { - //inst_message - Instruction inst1 = checkInst(); - if (inst1 != null) { - if (StrUtil.equals(inst1.getInstruction_status(), "0")) { - inst1.setInstruction_status("1"); - inst1.setExecute_device_code(this.device_code); - instructionService.update(inst1); + this.instruction_update_time = date; + //更改任务状态 + if (task > 0) { + //inst_message + if (inst1 != null) { + if (StrUtil.equals(inst1.getInstruction_status(), "0")) { + inst1.setInstruction_status("1"); + inst1.setExecute_device_code(this.device_code); + instructionService.update(inst1); + } } } - } - - ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest(); - ApplyManipulatorActionResponse applyManipulatorActionResponse; - //反馈气胀轴尺寸 - if (mode == 3) { - Instruction inst2 = checkInst(); - String task_code = inst2.getTask_code(); - TaskDto taskDto = taskserver.findByCode(task_code); - String truss_type = taskDto.getTruss_type(); - applyManipulatorActionRequest.setType(truss_type); - applyManipulatorActionRequest.setTask_code(task_code); - applyManipulatorActionRequest.setSize(String.valueOf(inflatable_shaft_size)); - applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); - if (applyManipulatorActionResponse.getstatus() == 200) { - requireSucess = true; - message = "反馈LMS成功..."; - logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); - Map map = new LinkedHashMap<>(); - map.put("to_command", "2"); - map.put("to_task_type", "2"); - this.writing(map); - this.setFeedbackSucess(true); - } else { - requireSucess = true; - message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse); - logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); - } - } - - //申请放货点 - if (action == 3) { - Instruction inst2 = checkInst(); - String task_code = inst2.getTask_code(); - TaskDto taskDto = taskserver.findByCode(task_code); - String truss_type = taskDto.getTruss_type(); - applyManipulatorActionRequest.setType(truss_type); - applyManipulatorActionRequest.setTask_code(String.valueOf(task)); - applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); - String put_device_code = applyManipulatorActionResponse.getPut_device_code(); - String detail_type = applyManipulatorActionResponse.getDetail_type(); - Map map = new LinkedHashMap<>(); - map.put("to_command", "3"); - map.put("to_putpoint", put_device_code); - this.writing(map); - this.setFeedbackSucess(true); - } - - //任务完成 - if (action == 8) { - Instruction inst2 = checkInst(); - if (inst2 != null) { - try { - finish_instruction(inst2); - this.writing("to_command", "8"); - } catch (Exception e) { - e.printStackTrace(); - } - feedMessage = ""; - } - } else { - feedMessage = "行架机械手:"; - if (mode != 3) { - feedMessage = feedMessage + "工作模式(mode)不为运行中状态,"; - } - if (action != 6) { - feedMessage = feedMessage + "动作信号(action)不为放货完成状态,"; - } - if (move != 0) { - feedMessage = feedMessage + "光电信号(move)不为无货状态,"; - } - if (task == 0) { - feedMessage = feedMessage + "当前上报任务号(task)不应该为0。"; - } - } - } - } - - private synchronized void update_instruction_status3() { - Date date = new Date(); - if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out); - - } else { - this.instruction_update_time = date; - //更改任务状态 - if (task > 0) { - //inst_message - Instruction inst1 = checkInst(); - if (inst1 != null) { - if (StrUtil.equals(inst1.getInstruction_status(), "0")) { - inst1.setInstruction_status("1"); - inst1.setExecute_device_code(this.device_code); - instructionService.update(inst1); + //反馈尺寸 + if (mode == 3 && action == 2) { + String task_code = inst1.getTask_code(); + TaskDto task = taskserver.findByCode(task_code); + applyManipulatorActionRequest.setType("2"); + applyManipulatorActionRequest.setTask_code1(task_code); + applyManipulatorActionRequest.setSize(String.valueOf(inflatable_shaft_size)); + applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); + if (applyManipulatorActionResponse.getstatus() == 200) { + feedbackSucess = true; + message = "反馈LMS成功..."; + logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); + String is_bushing = task.getIs_bushing(); + String version = task.getVersion(); + String bushing_num = task.getBushing_num(); + Map map = new LinkedHashMap<>(); + map.put("inflatableShaftVersion", Integer.parseInt(version)); + map.put("tube_num", Integer.parseInt(bushing_num)); + map.put("is_wrapped", Integer.parseInt(is_bushing)); + map.put("to_command", 2); + this.writing(map); + } else { + feedbackSucess = false; + message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse); + logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); } } - } - - - - //任务完成 - if (action == 8) { - Instruction inst2 = checkInst(); - if (inst2 != null) { - try { - String task_code = inst2.getTask_code(); - TaskDto taskDto = taskserver.findByCode(task_code); - String truss_type = taskDto.getTruss_type(); - finish_instruction(inst2); - this.writing("to_command", "8"); - } catch (Exception e) { - e.printStackTrace(); - } - feedMessage = ""; - } - } else { - feedMessage = "行架机械手:"; - if (mode != 3) { - feedMessage = feedMessage + "工作模式(mode)不为运行中状态,"; - } - if (action != 8) { - feedMessage = feedMessage + "动作信号(action)不为放货完成状态,"; - } - if (move != 0) { - feedMessage = feedMessage + "光电信号(move)不为无货状态,"; - } - if (task == 0) { - feedMessage = feedMessage + "当前上报任务号(task)不应该为0。"; - } - } - - - } - } - - private synchronized void update_instruction_status4() { - Date date = new Date(); - if (date.getTime() - this.instruction_update_time.getTime() < (long) this.instruction_update_time_out) { - log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_update_time_out); - - } else { - this.instruction_update_time = date; - //更改任务状态 - if (task > 0) { - //inst_message - Instruction inst1 = checkInst(); - if (inst1 != null) { - if (StrUtil.equals(inst1.getInstruction_status(), "0")) { - inst1.setInstruction_status("1"); - inst1.setExecute_device_code(this.device_code); - instructionService.update(inst1); - } - } - } - - ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest(); - ApplyManipulatorActionResponse applyManipulatorActionResponse; - //反馈尺寸 - if (action == 2) { - Instruction inst2 = checkInst(); - String task_code = inst2.getTask_code(); - TaskDto taskDto = taskserver.findByCode(task_code); - String truss_type = taskDto.getTruss_type(); - applyManipulatorActionRequest.setType(truss_type); - applyManipulatorActionRequest.setTask_code(task_code); - applyManipulatorActionRequest.setSize(String.valueOf(inflatable_shaft_size)); - applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); - if (applyManipulatorActionResponse.getstatus() == 200) { - requireSucess = true; - message = "反馈LMS成功..."; - logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); - String version = applyManipulatorActionResponse.getVersion(); - String bushing_num = applyManipulatorActionResponse.getBushing_num(); - String is_bushing = applyManipulatorActionResponse.getIs_bushing(); - String detail_type = applyManipulatorActionResponse.getDetail_type(); + //申请放货点 + if (mode == 3 && action == 3) { + String task_code = inst1.getTask_code(); + applyManipulatorActionRequest.setType("3"); + applyManipulatorActionRequest.setTask_code1(task_code); + applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); String put_device_code = applyManipulatorActionResponse.getPut_device_code(); + Device device = deviceAppService.findDeviceByCode(put_device_code); + String to_putpoint = device.getExtraValue().get("address").toString(); Map map = new LinkedHashMap<>(); - map.put("to_command", "2"); - map.put("inflatableShaftVersion", version); - map.put("tube_num", bushing_num); - map.put("is_wrapped", is_bushing); - map.put("to_putpoint", put_device_code); + map.put("to_command", 3); + map.put("to_putpoint", Integer.parseInt(to_putpoint)); this.writing(map); - this.setFeedbackSucess(true); - } else { - requireSucess = true; - message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse); - logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); + feedbackSucess = true; } - } - if (action == 3) { - Instruction inst2 = checkInst(); - String task_code = inst2.getTask_code(); - TaskDto taskDto = taskserver.findByCode(task_code); - String truss_type = taskDto.getTruss_type(); - applyManipulatorActionRequest.setType(truss_type); - applyManipulatorActionRequest.setTask_code(String.valueOf(task)); - applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); - String put_device_code = applyManipulatorActionResponse.getPut_device_code(); - String detail_type = applyManipulatorActionResponse.getDetail_type(); - Map map = new LinkedHashMap<>(); - map.put("to_command", "3"); - map.put("to_task_type", detail_type); - map.put("to_putpoint", put_device_code); - this.writing(map); - this.setFeedbackSucess(true); - } - if (mode == 3 && action == 4 && task > 0) { - applyManipulatorActionRequest.setType("4"); - applyManipulatorActionRequest.setTask_code(String.valueOf(task)); - applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); - String get_device_code = applyManipulatorActionResponse.getGet_device_code(); - String put_device_code = applyManipulatorActionResponse.getPut_device_code(); - Map map = new LinkedHashMap<>(); - map.put("to_command", "4"); - map.put("to_new_getpoint", get_device_code); - map.put("to_putpoint", put_device_code); - this.writing(map); - this.setFeedbackSucess(true); - } - if (action == 5) { - applyManipulatorActionRequest.setType("5"); - applyManipulatorActionRequest.setTask_code(String.valueOf(task)); - applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); - String put_device_code2 = applyManipulatorActionResponse.getPut_device_code2(); - String detail_type = applyManipulatorActionResponse.getDetail_type(); - String get_device_code = applyManipulatorActionResponse.getGet_device_code(); - Map map = new LinkedHashMap<>(); - map.put("to_command", "5"); - map.put("to_task_type", detail_type); - map.put("to_two_putpoint", put_device_code2); - map.put("to_new_getpoint", get_device_code); - this.writing(map); - this.setFeedbackSucess(true); - } - - - //放货完成 - if (action == 8) { - Instruction inst2 = checkInst(); - if (inst2 != null) { - try { - String task_code = inst2.getTask_code(); - TaskDto taskDto = taskserver.findByCode(task_code); - String truss_type = taskDto.getTruss_type(); - finish_instruction(inst2); - this.writing("to_command", "8"); - } catch (Exception e) { - e.printStackTrace(); + //申请新取货点 + if (mode == 3 && action == 4) { + String task_code = inst1.getTask_code(); + applyManipulatorActionRequest.setType("4"); + applyManipulatorActionRequest.setTask_code1(task_code); + applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); + if (applyManipulatorActionResponse.getstatus() == 200) { + String get_device_code = applyManipulatorActionResponse.getGet_device_code(); + Device device = deviceAppService.findDeviceByCode(get_device_code); + String to_new_getpoint = device.getExtraValue().get("address").toString(); + Map map = new LinkedHashMap<>(); + map.put("to_command", 4); + map.put("to_new_getpoint", Integer.parseInt(to_new_getpoint)); + this.writing(map); + feedbackSucess = true; + logServer.deviceExecuteLog(this.device_code, "", "", "申请新取货点,返回参数:" + applyManipulatorActionResponse); + message = "申请新取货点成功"; + } else { + feedbackSucess = false; + message = "申请失败"; + logServer.deviceExecuteLog(this.device_code, "", "", "申请失败,返回参数:" + applyManipulatorActionResponse); } - feedMessage = ""; } - } else { - feedMessage = "行架机械手:"; - if (mode != 3) { - feedMessage = feedMessage + "工作模式(mode)不为运行中状态,"; + + //申请二次放货点 + if (mode == 3 && action == 5) { + String task_code = inst1.getTask_code(); + applyManipulatorActionRequest.setType("5"); + applyManipulatorActionRequest.setTask_code1(task_code); + applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); + if (applyManipulatorActionResponse.getstatus() == 200) { + String put_device_code2 = applyManipulatorActionResponse.getPut_device_code2(); + Device device = deviceAppService.findDeviceByCode(put_device_code2); + String to_two_putpoint = device.getExtraValue().get("address").toString(); + Map map = new LinkedHashMap<>(); + map.put("to_command", 5); + map.put("to_two_putpoint", Integer.parseInt(to_two_putpoint)); + this.writing(map); + feedbackSucess = true; + logServer.deviceExecuteLog(this.device_code, "", "", "申请二次放货点,返回参数:" + applyManipulatorActionResponse); + message = "申请二次放货点成功"; + } else { + feedbackSucess = false; + message = "申请失败"; + logServer.deviceExecuteLog(this.device_code, "", "", "申请失败,返回参数:" + applyManipulatorActionResponse); + } } - if (action != 8) { - feedMessage = feedMessage + "动作信号(action)不为放货完成状态,"; + + //缓存库取货完成 + if (mode == 3 && action == 6) { + String task_code = inst1.getTask_code(); + applyManipulatorActionRequest.setAction("1"); + applyManipulatorActionRequest.setTask_code1(task_code); + acsToWmsService.actionFinishRequest(applyManipulatorActionRequest); + Map map = new LinkedHashMap<>(); + map.put("to_command", 6); + this.writing(map); + feedbackSucess = true; } - if (move != 0) { - feedMessage = feedMessage + "光电信号(move)不为无货状态,"; + + //缓存库放货完成 + if (mode == 3 && action == 7) { + String task_code = inst1.getTask_code(); + applyManipulatorActionRequest.setAction("2"); + applyManipulatorActionRequest.setTask_code1(task_code); + acsToWmsService.actionFinishRequest(applyManipulatorActionRequest); + Map map = new LinkedHashMap<>(); + map.put("to_command", 7); + this.writing(map); + feedbackSucess = true; } - if (task == 0) { - feedMessage = feedMessage + "当前上报任务号(task)不应该为0。"; + + + //放货完成 + if (mode == 3 && action == 8 && move == 0) { + if (inst1 != null) { + try { + feedbackSucess = true; + finish_instruction(inst1); + Map map = new LinkedHashMap<>(); + map.put("to_command", 8); + this.writing(map); + } catch (Exception e) { + e.printStackTrace(); + } + feedMessage = ""; + } + } else { + feedMessage = "行架机械手:"; + if (mode != 3) { + feedMessage = feedMessage + "工作模式(mode)不为运行中状态,"; + } + if (action != 8) { + feedMessage = feedMessage + "动作信号(action)不为放货完成状态,"; + } + if (move != 0) { + feedMessage = feedMessage + "光电信号(move)不为无货状态,"; + } + if (task == 0) { + feedMessage = feedMessage + "当前上报任务号(task)不应该为0。"; + } } + + } - - + } else { + feedMessage = ""; } } @@ -907,18 +724,14 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple String bushing_num = taskDto.getBushing_num(); Map map = new LinkedHashMap<>(); - map.put("to_command", "1"); - if (action == 2) { - map.put("inflatableShaftVersion", version); - map.put("tube_num", bushing_num); - map.put("is_wrapped", is_bushing); - } - if (taskDto.getTruss_type() == "1" || taskDto.getTruss_type() == "5") { - map.put("to_task_type", taskDto.getTruss_type()); - } - map.put("to_onset", start_addr); - map.put("to_task", instruction.getInstruction_code()); - map.put("to_target", next_addr); + map.put("to_command", 1); + map.put("inflatableShaftVersion", Integer.parseInt(version)); + map.put("tube_num", Integer.parseInt(bushing_num)); + map.put("is_wrapped", Integer.parseInt(is_bushing)); + map.put("to_task_type", Integer.parseInt(taskDto.getTruss_type())); + map.put("to_onset", Integer.parseInt(start_addr)); + map.put("to_task", Integer.parseInt(instruction.getInstruction_code())); + map.put("to_target", Integer.parseInt(next_addr)); this.writing(map); this.setRequireSucess(true); return true; @@ -930,7 +743,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple taskDtoList = this.sortTask(taskDtoList); task = taskDtoList.get(j); // 9 行架任务 - if (!StrUtil.equals(task.getTruss_type(), "9")) { + if (!StrUtil.equals(task.getTask_type(), "9")) { task = null; continue; } @@ -942,7 +755,6 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple if (!ObjectUtil.isEmpty(task)) { Device nextdevice = deviceAppService.findDeviceByCode(task.getNext_device_code()); Device startdevice = deviceAppService.findDeviceByCode(task.getStart_device_code()); - StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; SiemensConveyorDeviceDriver siemensConveyorDeviceDriver; if (startdevice.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { siemensConveyorDeviceDriver = (SiemensConveyorDeviceDriver) startdevice.getDeviceDriver(); @@ -1010,22 +822,12 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:" + instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code() + ",指令终点:" + instdto.getNext_device_code()); - String is_bushing = task.getIs_bushing(); - String version = task.getVersion(); - String bushing_num = task.getBushing_num(); Map map = new LinkedHashMap<>(); - map.put("to_command", "1"); - if (action == 2) { - map.put("inflatableShaftVersion", version); - map.put("tube_num", bushing_num); - map.put("is_wrapped", is_bushing); - } - if (task.getTruss_type() == "1" || task.getTruss_type() == "5") { - map.put("to_task_type", task.getTruss_type()); - } - map.put("to_onset", start_addr); - map.put("to_task", instdto.getInstruction_code()); - map.put("to_target", next_addr); + map.put("to_command", 1); + map.put("to_task_type", Integer.parseInt(task.getTruss_type())); + map.put("to_onset", Integer.parseInt(start_addr)); + map.put("to_task", Integer.parseInt(instdto.getInstruction_code())); + map.put("to_target", Integer.parseInt(next_addr)); this.writing(map); this.setRequireSucess(true); notCreateInstMessage = ""; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/PaperTubeConveyor2DeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/PaperTubeConveyor2DeviceDriver.java index b522eb139..034fafd91 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/PaperTubeConveyor2DeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/paper_tube_device2/PaperTubeConveyor2DeviceDriver.java @@ -293,6 +293,7 @@ public class PaperTubeConveyor2DeviceDriver extends AbstractOpcDeviceDriver impl param.put("device_type", "1"); param.put("product_area", paramService.findByCode("productArea").getValue()); acsToWmsService.sendDeviceStatus(param); + requireSucess = false; logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记:" + requireSucess); logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode); } @@ -572,7 +573,7 @@ public class PaperTubeConveyor2DeviceDriver extends AbstractOpcDeviceDriver impl return false; } //判断当前任务号是否存在指令 - Instruction inst1 = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()); + //Instruction inst1 = instructionService.findByTaskcodeAndStatus(taskdto.getTask_code()); /*if(ObjectUtil.isNotNull(inst1)){ Device nextdevice = deviceAppservice.findDeviceByCode(inst1.getNext_device_code()); String next_addr = nextdevice.getExtraValue().get("address").toString(); @@ -625,7 +626,9 @@ public class PaperTubeConveyor2DeviceDriver extends AbstractOpcDeviceDriver impl writeStatus(paperArray, map, 2); writeStatus(paperArray, map, 3); } - writeData(taskdto.getNext_device_code(), instdto, map); + Device nextdevice = deviceAppservice.findDeviceByCode(taskdto.getNext_device_code()); + String next_addr = nextdevice.getExtraValue().get("address").toString(); + writeData(next_addr, instdto, map); this.writing(map); requireSucess = true; return true; @@ -656,9 +659,9 @@ public class PaperTubeConveyor2DeviceDriver extends AbstractOpcDeviceDriver impl map.put("to_material" + status, paper.getMaterial_code()); map.put("to_out_qty" + status, paper.getQty()); map.put("to_seq" + status, status); - Device nextdevice = deviceAppservice.findDeviceByCode(paper.getDevice_code()); - String next_addr = nextdevice.getExtraValue().get("address").toString(); - map.put("to_position" + status, next_addr); +// Device nextdevice = deviceAppservice.findDeviceByCode(paper.getDevice_code()); +// String next_addr = nextdevice.getExtraValue().get("address").toString(); + map.put("to_position" + status, paper.getDevice_code()); } @@ -807,7 +810,7 @@ public class PaperTubeConveyor2DeviceDriver extends AbstractOpcDeviceDriver impl if (item_qty12 != (last_item_qty12)) { logServer.deviceExecuteLog(this.device_code, "", "", "信号qty12:" + last_item_qty12 + "->" + item_qty12); } - if (item_material1.equals(last_item_material1)) { + if (!item_material1.equals(last_item_material1)) { logServer.deviceExecuteLog(this.device_code, "", "", "信号material1:" + last_item_material1 + "->" + item_material1); } if (!item_material2.equals(last_item_material2)) { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/ItemProtocol.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/ItemProtocol.java index df30a3944..40483ef90 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/ItemProtocol.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/ItemProtocol.java @@ -15,7 +15,8 @@ public class ItemProtocol { public static String item_mode = "mode"; public static String item_move = "move"; public static String item_error = "error"; - public static String item_task = "task"; + public static String item_task1 = "task1"; + public static String item_task2 = "task2"; public static String item_to_command = "to_command"; private PluggingUnpluggingMachineDeviceDriver driver; @@ -40,8 +41,11 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_error); } - public int getTask() { - return this.getOpcIntegerValue(item_task); + public int getTask1() { + return this.getOpcIntegerValue(item_task1); + } + public int getTask2() { + return this.getOpcIntegerValue(item_task2); } public int getToCommand() { @@ -75,7 +79,9 @@ public class ItemProtocol { list.add(new ItemDto(item_mode, "工作状态", "DB600.B2")); list.add(new ItemDto(item_move, "光电开关信号", "DB600.B3")); list.add(new ItemDto(item_error, "报警信号", "DB600.B5")); - list.add(new ItemDto(item_task, "任务号", "DB600.D6")); + list.add(new ItemDto(item_task1, "任务号1(行架任务号)", "DB600.D6")); + list.add(new ItemDto(item_task2, "任务号2(纸管任务号)", "DB600.D10")); + return list; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDefination.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDefination.java index e38405519..563fc8e8f 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDefination.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDefination.java @@ -2,7 +2,6 @@ package org.nl.acs.device_driver.basedriver.plugging_unplugging_machine; import org.nl.acs.device.device_driver.standard_inspect.ItemDto; import org.nl.acs.device_driver.DeviceDriver; -import org.nl.acs.device_driver.basedriver.standard_inspect_site.ItemProtocol; import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceType; @@ -51,7 +50,7 @@ public class PluggingUnpluggingMachineDefination implements OpcDeviceDriverDefin @Override public List getReadableItemDtos() { - return org.nl.acs.device_driver.basedriver.standard_inspect_site.ItemProtocol.getReadableItemDtos(); + return ItemProtocol.getReadableItemDtos(); } @Override diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDeviceDriver.java index 2b2e081aa..8ea99edbf 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/plugging_unplugging_machine/PluggingUnpluggingMachineDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.plugging_unplugging_machine; +import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; @@ -60,17 +61,22 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv int mode = 0; int error = 0; int move = 0; - int task = 0; + int task1 = 0; + int task2 = 0; int last_mode = 0; int last_error = 0; int last_move = 0; - int last_task = 0; + int last_task1 = 0; + int last_task2 = 0; Boolean isonline = true; Boolean iserror = false; //行架机械手申请任务成功标识 boolean requireSucess = false; + //当前指令 + Instruction inst = null; + //1-执行任务;2-取货完成;3-放货完成; int flag; @@ -91,9 +97,11 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv mode = this.itemProtocol.getMode(); error = this.itemProtocol.getError(); move = this.itemProtocol.getMove(); - task = this.itemProtocol.getTask(); + task1 = this.itemProtocol.getTask1(); + task2 = this.itemProtocol.getTask2(); if (mode != last_mode) { + this.requireSucess=false; logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记"); } if (move != last_move) { @@ -129,55 +137,82 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv case 3: break; case 4: - if (!requireSucess) { - feedback(); + if ((task1 > 0 || task2 > 0) && !requireSucess) { + applyBushing(); } break; case 5: - if (!requireSucess) { - feedback1(); + if ((task1 > 0 || task2 > 0) && !requireSucess) { + bushingSucess(); } break; + default: + break; + } } last_mode = mode; last_error = error; last_move = move; - last_task = task; + last_task1 = task1; + last_task2 = task2; } - private synchronized void feedback1() { + + private synchronized void bushingSucess() { ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest(); ApplyManipulatorActionResponse applyManipulatorActionResponse; + Instruction inst1 = instructionService.findByCode(String.valueOf(task1)); + Instruction inst2 = instructionService.findByCode(String.valueOf(task2)); + String task_code1 = inst1.getTask_code(); + String task_code2 = inst2.getTask_code(); + applyManipulatorActionRequest.setDevice_code(device_code); + applyManipulatorActionRequest.setTask_code1(task_code1); + applyManipulatorActionRequest.setTask_code2(task_code2); applyManipulatorActionRequest.setType("7"); applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); - if (applyManipulatorActionResponse.getstatus() == 200) { - + if (applyManipulatorActionResponse.getstatus()==200) { Map map = new LinkedHashMap<>(); - map.put("to_command", "5"); + map.put("to_command", 5); requireSucess = true; - } else { + logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse); + message = "套轴完成成功"; + }else{ + message = applyManipulatorActionResponse.getMessage(); + Map map = new LinkedHashMap<>(); + map.put("to_command", 99); requireSucess = true; - message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse); - logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); + message = "套轴失败"; + logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse); } } - private synchronized void feedback() { + private synchronized void applyBushing() { ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest(); ApplyManipulatorActionResponse applyManipulatorActionResponse; + Instruction inst1 = instructionService.findByCode(String.valueOf(task1)); + Instruction inst2 = instructionService.findByCode(String.valueOf(task2)); + String task_code1 = inst1.getTask_code(); + String task_code2 = inst2.getTask_code(); + applyManipulatorActionRequest.setDevice_code(device_code); + applyManipulatorActionRequest.setTask_code1(task_code1); + applyManipulatorActionRequest.setTask_code2(task_code2); applyManipulatorActionRequest.setType("6"); applyManipulatorActionResponse = acsToWmsService.applyManipulatorActionRequest(applyManipulatorActionRequest); - if (applyManipulatorActionResponse.getstatus() == 200) { - + if (applyManipulatorActionResponse.getstatus()==200) { Map map = new LinkedHashMap<>(); - map.put("to_command", "4"); + map.put("to_command", 4); requireSucess = true; - } else { + logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse); + message = "套轴申请成功"; + }else { + message = applyManipulatorActionResponse.getMessage(); + Map map = new LinkedHashMap<>(); + map.put("to_command", 99); requireSucess = true; - message = "完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse); - logServer.deviceExecuteLog(this.device_code, "", "", "反馈完成请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); + message = "申请失败"; + logServer.deviceExecuteLog(this.device_code, "", "", "申请出纸管,返回参数:" + applyManipulatorActionResponse); } } @@ -225,7 +260,6 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv } - @Override public JSONObject getDeviceStatusName() { JSONObject jo = new JSONObject(); @@ -276,5 +310,4 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv } - } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java index a1e99d098..3d8aae307 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/siemens_conveyor/SiemensConveyorDeviceDriver.java @@ -303,8 +303,10 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme if (task != last_task) { logServer.deviceItemValue(this.device_code, "task", String.valueOf(task)); logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task); + if ("true".equals(this.device.getExtraValue().get("task_update"))) { + taskDeviceUpdate(); + } } - if (move != 0 && task > 0) { // logServer.deviceExecuteLog(device_code, "", "", "输送线任务开始反馈任务状态,指令号:" + task); //inst_message @@ -431,6 +433,22 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme } + private void taskDeviceUpdate() { + Instruction inst = checkInst(); + JSONObject param = new JSONObject() {{ + put("device_code", device_code); + put("task_code", inst.getTask_code()); + + }}; + logServer.deviceExecuteLog(this.device_code, "", "", "task变化请求LMS,参数:" + param); + HttpResponse response = acsToWmsService.taskDeviceUpdate(param); + if (response == null || response.getStatus() == 200) { + logServer.deviceExecuteLog(this.device_code, "", "", "task变化请求LMS,接口返回:" + response.body()); + } + } + + + public boolean exe_error() { if (this.error == 0) { return true; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionRequest.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionRequest.java index 4fec7dd92..ddcd86a25 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionRequest.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/ApplyManipulatorActionRequest.java @@ -17,14 +17,23 @@ public class ApplyManipulatorActionRequest extends BaseRequest { private String type; /** - * 任务号 + * 行架任务号 */ - private String task_code; + private String task_code1; + /** + * 纸管任务号 + */ + private String task_code2; /** * 气胀轴尺寸 3/6寸 */ private String size; + /** + * 动作完成 + * 取货完成1 放货完成2 + */ + private String action; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java index 226fb0a07..9d559cfb8 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/CreateTaskRequest.java @@ -1,5 +1,6 @@ package org.nl.acs.ext.wms.data; +import com.alibaba.fastjson.JSONArray; import lombok.Data; import org.nl.acs.device_driver.basedriver.paper_tube_device2.Paper; @@ -122,6 +123,27 @@ public class CreateTaskRequest extends BaseRequest { */ Map params; - private List paper_array; + /** + * 行架任务类型 + */ + private String truss_type; + + + /** + * 气胀轴代数 + */ + private String version; + + /** + * 是否套管 + */ + private String is_bushing; + + /** + * 套管数量 + */ + private String bushing_num; + + private String paper_array; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java index 41b51958b..fa57630d6 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/rest/AcsToWmsController.java @@ -107,6 +107,13 @@ public class AcsToWmsController { return new ResponseEntity<>(acstowmsService.applyManipulatorActionRequest(param), HttpStatus.OK); } + @PostMapping("/actionFinishRequest") + @Log(value = "动作完成请求",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS) + @ApiOperation("动作完成请求") + public ResponseEntity actionFinishRequest(@RequestBody ApplyManipulatorActionRequest param) { + return new ResponseEntity<>(acstowmsService.actionFinishRequest(param), HttpStatus.OK); + } + @PostMapping("/liKuApplyTaskRequest") @Log(value = "立库申请任务",isInterfaceLog = true,interfaceLogType= InterfaceLogType.ACS_TO_LMS) @ApiOperation("立库申请任务") diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index e7765a03e..a6ea893db 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -112,7 +112,10 @@ public interface AcsToWmsService { // 输送线有货变成无货时向lms请求 HttpResponse shipDeviceUpdate(JSONObject param); + HttpResponse taskDeviceUpdate(JSONObject param); + void sendDeviceStatus(JSONObject param); ApplyManipulatorActionResponse applyManipulatorActionRequest(ApplyManipulatorActionRequest param); + ApplyManipulatorActionResponse actionFinishRequest(ApplyManipulatorActionRequest param); } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index 1715b5d6a..a8b5c7019 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -444,8 +444,38 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } finally { MDC.remove(log_file_type); } + } - + @Override + public ApplyManipulatorActionResponse actionFinishRequest(ApplyManipulatorActionRequest param) { + try { + MDC.put(log_file_type, log_type); + ApplyManipulatorActionResponse actionFinishRequestResponse = new ApplyManipulatorActionResponse(); + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + AddressDto addressDto = addressService.findByCode("actionFinishRequest"); + String methods_url = addressDto.getMethods_url(); + String url = wmsUrl + methods_url; + log.info("ApplyManipulatorActionRequest----请求参数{}", param); + try { +// String result = ""; + String result = HttpRequest.post(url) + .body(JSON.toJSONString(param)) + .execute().body(); + JSONObject jsonObject = JSONObject.parseObject(result); + log.info("ApplyManipulatorActionResponse----返回参数{}", result); + actionFinishRequestResponse = JSONObject.toJavaObject(jsonObject, ApplyManipulatorActionResponse.class); + } catch (Exception e) { + JSONObject map = new JSONObject(); + map.put("status", 400); + map.put("message", e.getMessage()); + return JSONObject.toJavaObject(map, ApplyManipulatorActionResponse.class); + } + } + return actionFinishRequestResponse; + } finally { + MDC.remove(log_file_type); + } } @Override @@ -608,6 +638,29 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return null; } + @Override + public HttpResponse taskDeviceUpdate(JSONObject param) { + try { + MDC.put(log_file_type, log_type); +// log.info("shipDeviceUpdate-----输入参数{}", param); + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { + String wmsUrl = paramService.findByCode(AcsConfig.WMSURL).getValue(); + AddressDto addressDto = addressService.findByCode("taskDeviceUpdate"); + String methods_url = addressDto.getMethods_url(); + String url = wmsUrl + methods_url; + return HttpRequest + .post(url) + .body(param.toString()) + .execute(); + } + } catch (Throwable ignored) { + + } finally { + MDC.remove(log_file_type); + } + return null; + } + @Override public void sendDeviceStatus(JSONObject param) { try { diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java index 3ae28e74c..7c6469602 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/WmsToAcsServiceImpl.java @@ -21,15 +21,19 @@ import org.nl.acs.device_driver.FeedLmsRealFailed; import org.nl.acs.device_driver.basedriver.agv.ndcone.AgvNdcOneDeviceDriver; import org.nl.acs.device_driver.basedriver.agv.ndctwo.AgvNdcTwoDeviceDriver; import org.nl.acs.device_driver.basedriver.cargo_lift_conveyor.CargoLiftConveyorDeviceDriver; +import org.nl.acs.device_driver.basedriver.casing_station.CasingStationConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.device_status.DeviceStatusDeviceDriver; import org.nl.acs.device_driver.basedriver.empty_vehicle_stacking_position.EmptyVehicleStackingPositionDeviceDriver; import org.nl.acs.device_driver.basedriver.hongxiang_conveyor.HongXiangStationDeviceDriver; import org.nl.acs.device_driver.basedriver.hongxiang_device.HongXiangConveyorDeviceDriver; +import org.nl.acs.device_driver.basedriver.indoor_manipulator.IndoorManipulatorDeviceDriver; import org.nl.acs.device_driver.basedriver.lamp_three_color.LampThreecolorDeviceDriver; import org.nl.acs.device_driver.basedriver.oven_manipulator.OvenGantryManipulatorDeviceDriver; import org.nl.acs.device_driver.basedriver.paper_tube_device.PaperTubeConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.paper_tube_device2.Paper; +import org.nl.acs.device_driver.basedriver.paper_tube_device2.PaperTubeConveyor2DeviceDriver; import org.nl.acs.device_driver.basedriver.plug_pull_device_site.PlugPullDeviceSiteDeviceDriver; +import org.nl.acs.device_driver.basedriver.plugging_unplugging_machine.PluggingUnpluggingMachineDeviceDriver; import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDeviceDriver; import org.nl.acs.device_driver.basedriver.siemens_conveyor_ckk.SiemensConveyorCkkDeviceDriver; import org.nl.acs.device_driver.basedriver.siemens_conveyor_labeling.SiemensConveyorLabelingDeviceDriver; @@ -238,8 +242,17 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { StandardCoveyorControlWithScannerDeviceDriver standardCoveyorControlWithScannerDeviceDriver; //纸管库 PaperTubeConveyorDeviceDriver paperTubeConveyorDeviceDriver; + //纸管库2 + PaperTubeConveyor2DeviceDriver paperTubeConveyor2DeviceDriver; //立库设备 DeviceStatusDeviceDriver deviceStatusDeviceDriver; + //插拔轴机 + PlugPullDeviceSiteDeviceDriver plugPullDeviceSiteDeviceDriver; + //内包间行架机械手 + IndoorManipulatorDeviceDriver indoorManipulatorDeviceDriver; + //套管工位 + CasingStationConveyorDeviceDriver casingStationConveyorDeviceDriver; + if (datas.size() == 0) { throw new BadRequestException("缺少输入参数!"); } @@ -291,6 +304,19 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("action", standardCoveyorControlWithScannerDeviceDriver.getAction()); jo.put("error", standardCoveyorControlWithScannerDeviceDriver.getError()); + } else if (device.getDeviceDriver() instanceof CasingStationConveyorDeviceDriver) { + casingStationConveyorDeviceDriver = (CasingStationConveyorDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", parent_device_code); + jo.put("mode", casingStationConveyorDeviceDriver.getMode()); + jo.put("move", casingStationConveyorDeviceDriver.getMove()); + jo.put("heartbeat", casingStationConveyorDeviceDriver.getHeartbeat()); + jo.put("carrier_direction", casingStationConveyorDeviceDriver.getCarrier_direction()); + jo.put("error", casingStationConveyorDeviceDriver.getError()); + jo.put("task", casingStationConveyorDeviceDriver.getTask()); + jo.put("material1", casingStationConveyorDeviceDriver.getMaterial1()); + jo.put("material2", casingStationConveyorDeviceDriver.getMaterial2()); + + } else if (device.getDeviceDriver() instanceof PaperTubeConveyorDeviceDriver) { paperTubeConveyorDeviceDriver = (PaperTubeConveyorDeviceDriver) device.getDeviceDriver(); jo.put("device_code", parent_device_code); @@ -356,6 +382,42 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("y", driver.getY_position()); jo.put("error", driver.getError()); jo.put("error_msg", driver.getError() == 0 ? "" : ErrorUtil.getDictDetail("fqhj_error_type", String.valueOf(driver.getError()))); + }else if (device.getDeviceDriver() instanceof PaperTubeConveyor2DeviceDriver) { + paperTubeConveyor2DeviceDriver = (PaperTubeConveyor2DeviceDriver) device.getDeviceDriver(); + jo.put("device_code", parent_device_code); + jo.put("heartbeat",paperTubeConveyor2DeviceDriver.getHeartbeat()); + jo.put("mode",paperTubeConveyor2DeviceDriver.getMode()); + jo.put("move",paperTubeConveyor2DeviceDriver.getMove()); + jo.put("carrier_direction",paperTubeConveyor2DeviceDriver.getCarrier_direction()); + jo.put("error",paperTubeConveyor2DeviceDriver.getError()); + jo.put("task",paperTubeConveyor2DeviceDriver.getTask()); + jo.put("out_seq_arr",paperTubeConveyor2DeviceDriver.getItem_out_seq_arr()); + jo.put("out_qty_arr",paperTubeConveyor2DeviceDriver.getItem_out_qty_arr()); + jo.put("material1",paperTubeConveyor2DeviceDriver.getItem_material1()); + jo.put("qty1",paperTubeConveyor2DeviceDriver.getItem_qty1()); + jo.put("material2",paperTubeConveyor2DeviceDriver.getItem_material2()); + jo.put("qty2",paperTubeConveyor2DeviceDriver.getItem_qty2()); + jo.put("material3",paperTubeConveyor2DeviceDriver.getItem_material3()); + jo.put("qty3",paperTubeConveyor2DeviceDriver.getItem_qty3()); + jo.put("material4",paperTubeConveyor2DeviceDriver.getItem_material4()); + jo.put("qty4",paperTubeConveyor2DeviceDriver.getItem_qty4()); + jo.put("material5",paperTubeConveyor2DeviceDriver.getItem_material5()); + jo.put("qty5",paperTubeConveyor2DeviceDriver.getItem_qty5()); + jo.put("material6",paperTubeConveyor2DeviceDriver.getItem_material6()); + jo.put("qty6",paperTubeConveyor2DeviceDriver.getItem_qty6()); + jo.put("material7",paperTubeConveyor2DeviceDriver.getItem_material7()); + jo.put("qty7",paperTubeConveyor2DeviceDriver.getItem_qty7()); + jo.put("material8",paperTubeConveyor2DeviceDriver.getItem_material8()); + jo.put("qty8",paperTubeConveyor2DeviceDriver.getItem_qty8()); + jo.put("material9",paperTubeConveyor2DeviceDriver.getItem_material9()); + jo.put("qty9",paperTubeConveyor2DeviceDriver.getItem_qty9()); + jo.put("material10",paperTubeConveyor2DeviceDriver.getItem_material10()); + jo.put("qty10",paperTubeConveyor2DeviceDriver.getItem_qty10()); + jo.put("material11",paperTubeConveyor2DeviceDriver.getItem_material11()); + jo.put("qty11",paperTubeConveyor2DeviceDriver.getItem_qty11()); + jo.put("material12",paperTubeConveyor2DeviceDriver.getItem_material12()); + jo.put("qty12",paperTubeConveyor2DeviceDriver.getItem_qty12()); + } else if (device.getDeviceDriver() instanceof SiemensConveyorDeviceDriver) { SiemensConveyorDeviceDriver driver = (SiemensConveyorDeviceDriver) device.getDeviceDriver(); jo.put("device_code", driver.getDevice().getDevice_code()); @@ -384,6 +446,31 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("status", Math.min(3, driver.getMode())); jo.put("error", driver.getError()); jo.put("error_msg", driver.getError() == 0 ? "" : ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(driver.getError()))); + } else if (device.getDeviceDriver() instanceof IndoorManipulatorDeviceDriver) { + IndoorManipulatorDeviceDriver driver = (IndoorManipulatorDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", driver.getDevice().getDevice_code()); + jo.put("device_name", driver.getDevice().getDevice_name()); + jo.put("status", Math.min(3, driver.getMode())); + jo.put("mode", driver.getMode()); + jo.put("move", driver.getMove()); + jo.put("action", driver.getAction()); + jo.put("walk_y", driver.getWalk_y()); + jo.put("task", driver.getTask()); + jo.put("x_position", driver.getX_position()); + jo.put("y_position", driver.getY_position()); + jo.put("inflatable_shaft_size", driver.getInflatable_shaft_size()); + jo.put("error_msg", driver.getError() == 0 ? "" : ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(driver.getError()))); + }else if (device.getDeviceDriver() instanceof PluggingUnpluggingMachineDeviceDriver) { + PluggingUnpluggingMachineDeviceDriver driver = (PluggingUnpluggingMachineDeviceDriver) device.getDeviceDriver(); + jo.put("device_code", driver.getDevice().getDevice_code()); + jo.put("device_name", driver.getDevice().getDevice_name()); + jo.put("status", Math.min(3, driver.getMode())); + jo.put("mode", driver.getMode()); + jo.put("move", driver.getMove()); + jo.put("task1", driver.getTask1()); + jo.put("task2", driver.getTask2()); + jo.put("error", driver.getError()); + jo.put("error_msg", driver.getError() == 0 ? "" : ErrorUtil.getDictDetail("ssx_error_type", String.valueOf(driver.getError()))); } else { jo.put("device_code", parent_device_code); } @@ -616,7 +703,7 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { for (int i = 0; i < datas.size(); i++) { String data = datas.get(i).toString(); CreateTaskRequest request = JsonUtl.format(data, CreateTaskRequest.class); - List paper_array = request.getPaper_array(); + String paper_array = request.getPaper_array(); String ext_task_id = request.getExt_task_id(); String task_code = request.getTask_code(); String start_device_code = request.getStart_device_code(); @@ -629,6 +716,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { String vehicle_type = request.getVehicle_type(); String route_plan_code = request.getRoute_plan_code(); String task_type = request.getTask_type(); + String truss_type = request.getTruss_type(); + String is_bushing = request.getIs_bushing(); + String version = request.getVersion(); + String bushing_num = request.getBushing_num(); String storage_task_type = request.getDtl_type(); String agv_system_type = request.getAgv_system_type(); String remark = request.getRemark(); @@ -827,6 +918,10 @@ public class WmsToAcsServiceImpl implements WmsToAcsService { jo.put("params", params); jo.put("task_type", StrUtil.isEmpty(task_type) ? 1 : Integer.parseInt(task_type)); jo.put("paper_array", JSONUtil.toJsonStr(paper_array)); + jo.put("truss_type", JSONUtil.toJsonStr(truss_type)); + jo.put("is_bushing", JSONUtil.toJsonStr(is_bushing)); + jo.put("version", JSONUtil.toJsonStr(version)); + jo.put("bushing_num", JSONUtil.toJsonStr(bushing_num)); if (!StrUtil.isEmpty(ext_task_id)) { diff --git a/acs/nladmin-ui/src/views/acs/device/config.vue b/acs/nladmin-ui/src/views/acs/device/config.vue index 69bb4b800..f8ed9781a 100644 --- a/acs/nladmin-ui/src/views/acs/device/config.vue +++ b/acs/nladmin-ui/src/views/acs/device/config.vue @@ -100,6 +100,8 @@ import photoelectric_inspection_site from '@/views/acs/device/driver/photoelectr import standard_autodoor from '@/views/acs/device/driver/standard_autodoor' import lamp_three_color from '@/views/acs/device/driver/lamp_three_color' import paper_tube_conveyor from '@/views/acs/device/driver/paper_tube_conveyor' +import paper_tube_conveyor2 from '@/views/acs/device/driver/paper_tube_conveyor2' +import casing_station from '@/views/acs/device/driver/casing_station' import device_status from '@/views/acs/device/driver/device_status' import indoor_manipulator from '@/views/acs/device/driver/indoor_manipulator' import plugging_unplugging_machine from '@/views/acs/device/driver/plugging_unplugging_machine' @@ -134,6 +136,8 @@ export default { standard_autodoor, lamp_three_color, paper_tube_conveyor, + paper_tube_conveyor2, + casing_station, device_status, indoor_manipulator, plugging_unplugging_machine diff --git a/acs/nladmin-ui/src/views/acs/device/driver/siemens_conveyor.vue b/acs/nladmin-ui/src/views/acs/device/driver/siemens_conveyor.vue index 50e0323fa..1d3381c43 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/siemens_conveyor.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/siemens_conveyor.vue @@ -153,6 +153,13 @@ + + + + + + + @@ -326,7 +333,8 @@ export default { link_device_code: [], ship_device_update: true, special_flag: true, - sendDeviceStatus: true + sendDeviceStatus: true, + task_update: true }, rules: {} }