From 37ac298f910094ab7764f7e83172502f8618a794 Mon Sep 17 00:00:00 2001 From: yanps Date: Mon, 22 Jan 2024 19:27:06 +0800 Subject: [PATCH] =?UTF-8?q?opt:=20=E5=86=85=E5=8C=85=E9=97=B4=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CasingStationConveyorDeviceDriver.java | 6 +- .../IndoorManipulatorDeviceDriver.java | 116 ++++++++++++++---- ...PluggingUnpluggingMachineDeviceDriver.java | 48 ++++---- .../basedriver/rgv/RgvDeviceDriver.java | 16 ++- .../SiemensConveyorDeviceDriver.java | 1 - .../driver/AbstractOpcDeviceDriver.java | 5 +- .../org/nl/acs/task/service/dto/TaskDto.java | 8 ++ .../task/service/impl/TaskServiceImpl.java | 27 ++++ .../main/resources/config/application-dev.yml | 4 +- acs/nladmin-ui/.env.production | 4 +- acs/nladmin-ui/public/config.js | 4 +- acs/nladmin-ui/src/views/acs/task/index.vue | 6 +- 12 files changed, 181 insertions(+), 64 deletions(-) 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 81e68a0c0..f2b24e088 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 @@ -291,7 +291,11 @@ public class CasingStationConveyorDeviceDriver extends AbstractOpcDeviceDriver i if (ObjectUtil.isNotEmpty(inst1)) { String task_code = inst1.getTask_code(); if (Long.parseLong(task_code) < 1) { - message = "任务ACS创建,不反馈LMS取货完成"; + Map map = new LinkedHashMap<>(); + map.put("to_command", 6); + this.writing(map); + requireSucess = true; + message = "任务ACS创建,不反馈LMS套管工位取货完成"; return; } applyManipulatorActionRequest.setAction("1"); 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 b338c56ca..f6ae2ec2b 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 @@ -243,6 +243,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple // this.setNow_steps_type(0); // logServer.deviceExecuteLog(this.device_code, "", "", "当前执行步骤复位后:" + this.getNow_steps_type()); // } + requireSucess = false; feedMessage = ""; notCreateInstMessage = ""; notCreateTaskMessage = ""; @@ -393,6 +394,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple itemMap.put(getToParam() + key, value); } }); + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap); if (ObjectUtil.isNotEmpty(itemMap)) { try { this.checkcontrol(itemMap); @@ -442,7 +444,11 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple if (mode == 3 && action == 2) { String task_code = inst1.getTask_code(); if(Long.parseLong(task_code) < 1){ + Map map = new LinkedHashMap<>(); + map.put("to_command", 2); + this.writing(map); message = "任务ACS创建,不反馈LMS尺寸"; + feedbackSucess = true; return; } applyManipulatorActionRequest.setType("2"); @@ -454,7 +460,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple message = "反馈尺寸LMS成功..."; logServer.deviceExecuteLog(this.device_code, "", "", "反馈尺寸成请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); Map map = new LinkedHashMap<>(); - map.put("to_command", 2); + map.put("to_command", "2"); this.writing(map); } else { feedbackSucess = false; @@ -480,7 +486,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple Map map = new LinkedHashMap<>(); map.put("inflatableShaftVersion", applyManipulatorActionResponse.getVersion()); map.put("to_size", applyManipulatorActionResponse.getSize()); - map.put("to_command", 3); + map.put("to_command", "3"); map.put("to_putpoint", Integer.parseInt(to_putpoint)); this.writing(map); feedbackSucess = true; @@ -506,7 +512,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple 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_command", "4"); map.put("inflatableShaftVersion", applyManipulatorActionResponse.getVersion()); map.put("to_new_getpoint", Integer.parseInt(to_new_getpoint)); this.writing(map); @@ -535,8 +541,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple String to_two_putpoint = device.getExtraValue().get("address").toString(); Map map = new LinkedHashMap<>(); map.put("inflatableShaftVersion", applyManipulatorActionResponse.getVersion()); -// map.put("to_size", applyManipulatorActionResponse.getSize()); - map.put("to_command", 5); + map.put("to_command", "5"); map.put("to_two_putpoint", Integer.parseInt(to_two_putpoint)); this.writing(map); feedbackSucess = true; @@ -552,6 +557,10 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple if (mode == 3 && action == 6) { String task_code = inst1.getTask_code(); if(Long.parseLong(task_code) < 1){ + Map map = new LinkedHashMap<>(); + map.put("to_command", "6"); + this.writing(map); + feedbackSucess = true; message = "任务ACS创建,不反馈LMS缓存库取货成功"; return; } @@ -561,7 +570,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple if (applyManipulatorActionResponse1.getstatus() == 200) { logServer.deviceExecuteLog(this.device_code, "", "", "缓存库取货请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse1)); Map map = new LinkedHashMap<>(); - map.put("to_command", 6); + map.put("to_command", "6"); this.writing(map); message = "缓存库取货完成"; feedbackSucess = true; @@ -575,6 +584,10 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple if (mode == 3 && action == 7) { String task_code = inst1.getTask_code(); if(Long.parseLong(task_code) < 1){ + Map map = new LinkedHashMap<>(); + map.put("to_command", "7"); + this.writing(map); + feedbackSucess = true; message = "任务ACS创建,不反馈LMS缓存库放货完成"; return; } @@ -584,7 +597,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple if (applyManipulatorActionResponse1.getstatus() == 200) { logServer.deviceExecuteLog(this.device_code, "", "", "缓存库放货完成,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse1)); Map map = new LinkedHashMap<>(); - map.put("to_command", 7); + map.put("to_command", "7"); this.writing(map); feedbackSucess = true; message = "缓存库放货成功"; @@ -604,7 +617,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple taskserver.cancel(byTaskCode.getTask_id()); logServer.deviceExecuteLog(this.device_code, "", "", "取消任务完成"); Map map = new LinkedHashMap<>(); - map.put("to_command", 9); + map.put("to_command", "9"); this.writing(map); feedbackSucess = true; message = "异常气胀轴任务取消成功"; @@ -622,7 +635,7 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple feedbackSucess = true; finish_instruction(inst1); Map map = new LinkedHashMap<>(); - map.put("to_command", 8); + map.put("to_command", "8"); this.writing(map); message = "放货完成"; } catch (Exception e) { @@ -868,18 +881,26 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple String is_bushing = taskDto.getIs_bushing(); String version = taskDto.getVersion(); String bushing_num = taskDto.getBushing_num(); - - Map map = new LinkedHashMap<>(); - map.put("to_command", 1); + /*Map map = new LinkedHashMap<>(); + map.put("to_command", "1"); map.put("inflatableShaftVersion", version); - map.put("tube_num", bushing_num); - map.put("is_wrapped", is_bushing); + map.put("tube_num", StrUtil.isEmpty(bushing_num) ? "0" : bushing_num); + map.put("is_wrapped",StrUtil.isEmpty(is_bushing) ? "0" : is_bushing ); 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_target", next_addr);*/ + List list = new ArrayList(); + writing(list,"to_command","1"); + writing(list,"inflatableShaftVersion",version); + writing(list,"tube_num",StrUtil.isEmpty(bushing_num) ? "0" : bushing_num); + writing(list,"is_wrapped",StrUtil.isEmpty(is_bushing) ? "0" : is_bushing); + writing(list,"to_task_type",taskDto.getTruss_type()); + writing(list,"to_onset",start_addr); + writing(list,"to_task",instruction.getInstruction_code()); + writing(list,"to_target",next_addr); try { - this.writing(map); + this.writing(list); } catch (Exception e) { logServer.deviceExecuteLog(device_code, "", "", "下发指令:" + instruction.getInstruction_code() + ",指令起点:" + instruction.getStart_device_code() + ",指令终点:" + instruction.getNext_device_code() + ",指令执行失败:" + e.getMessage()); @@ -987,21 +1008,30 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple String next_addr = nextDevice.getExtraValue().get("address").toString(); logServer.deviceExecuteLog(device_code, "", "", "当前设备:" + device_code + ",下发指令:" + instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code() - + ",指令终点:" + instdto.getNext_device_code()); - Map map = new LinkedHashMap<>(); - 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)); + + ",指令终点:" + instdto.getNext_device_code()+ "指令号:" + instdto.getInstruction_code()+ + "行架任务类型: "+ task.getTruss_type() + "起点:"+ start_addr + "终点"+ next_addr); + /*Map map = new LinkedHashMap<>(); + map.put("to_command", "1"); + 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); if (!StrUtil.isEmpty(task.getVersion())) { map.put("inflatableShaftVersion", task.getVersion()); - } - this.writing(map); + }*/ + + List list = new ArrayList(); + writing(list,"to_command","1"); + writing(list,"to_task_type",task.getTruss_type()); + writing(list,"to_onset",start_addr); + writing(list,"to_task",instdto.getInstruction_code()); + writing(list,"to_target",next_addr); + writing(list,"inflatableShaftVersion",StrUtil.isEmpty(task.getVersion()) ? "0" : task.getVersion()); try { - this.writing(map); + this.writing(list); } catch (Exception e) { - logServer.deviceExecuteLog(device_code, "", "", "下发指令:" + instdto.getInstruction_code() + ",指令起点:" + instdto.getStart_device_code() + logServer.deviceExecuteLog(device_code, "", "", "下发指令:" + instdto.getInstruction_code() + + ",指令起点:" + instdto.getStart_device_code() + ",指令终点:" + instdto.getNext_device_code() + ",指令执行失败:" + e.getMessage()); } this.setRequireSucess(true); @@ -1015,6 +1045,38 @@ public class IndoorManipulatorDeviceDriver extends AbstractOpcDeviceDriver imple } } + public void writing(List list,String writingName,String writeValue) { + Map map = new HashMap(); + map.put("code", writingName); + map.put("value", writeValue); + list.add(map); + } + + public void writing(List list) { + Map itemMap = new HashMap(); + for (int i = 0; i < list.size(); i++) { + Object ob = list.get(i); + JSONObject json = (JSONObject) JSONObject.toJSON(ob); + if (!StrUtil.isEmpty(json.getString("value"))) { + String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + json.getString("code"); + itemMap.put(to_param, json.getString("value")); + } + } + logServer.deviceExecuteLog(device_code, "", "", "下发电气信号:" + itemMap); + try { + this.checkcontrol(itemMap); + } catch (Exception e) { + e.printStackTrace(); + try { + this.checkcontrol(itemMap); + } catch (Exception e1) { + e1.printStackTrace(); + } + } + + } + private Boolean checkAgv(TaskDto taskDto) { StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; RgvDeviceDriver rgv1; 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 e89644ebd..7db9dd378 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 @@ -107,7 +107,7 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv if (mode != last_mode) { this.requireSucess = false; - logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记"); + logServer.deviceExecuteLog(this.device_code, "", "", "信号mode:" + last_mode + "->" + mode + "复位请求标记" + requireSucess); } if (move != last_move) { logServer.deviceExecuteLog(this.device_code, "", "", "信号move:" + last_move + "->" + move); @@ -185,24 +185,32 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv private void deliveryCompleted() { ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest(); applyManipulatorActionRequest.setAction("1"); - applyManipulatorActionRequest.setTask_code1(String.valueOf(task1)); - ApplyManipulatorActionResponse applyManipulatorActionResponse = acsToWmsService.actionFinishRequest(applyManipulatorActionRequest); - if (applyManipulatorActionResponse.getstatus() == 200) { - logServer.deviceExecuteLog(this.device_code, "", "", "插拔机取货完成,请求成功响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); - Map map = new LinkedHashMap<>(); + Instruction inst1 = instructionService.findByCode(String.valueOf(task1)); + String task_code1 = inst1.getTask_code(); + Map map = new LinkedHashMap<>(); + if (Long.parseLong(task_code1) < 1) { map.put("to_command", 7); this.writing(map); requireSucess = true; - message = "缓存库放货成功"; + message = "任务ACS创建,不向LMS反馈插拔机取货完成"; + return; + } + applyManipulatorActionRequest.setTask_code1(task_code1); + ApplyManipulatorActionResponse applyManipulatorActionResponse = acsToWmsService.actionFinishRequest(applyManipulatorActionRequest); + if (applyManipulatorActionResponse.getstatus() == 200) { + logServer.deviceExecuteLog(this.device_code, "", "", "插拔机取货完成,请求成功响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); + map.put("to_command", 7); + this.writing(map); + requireSucess = true; + message = "插拔机取货完成反馈成功"; } else { requireSucess = false; logServer.deviceExecuteLog(this.device_code, "", "", "插拔机取货完成,请求失败响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); - message = "缓存库放货失败"; + message = "插拔机取货完成反馈失败"; } } private synchronized void pullingSucess() { - List list = new ArrayList(); ApplyManipulatorActionRequest applyManipulatorActionRequest = new ApplyManipulatorActionRequest(); ApplyManipulatorActionResponse applyManipulatorActionResponse; Instruction inst1 = instructionService.findByCode(String.valueOf(task1)); @@ -264,45 +272,41 @@ public class PluggingUnpluggingMachineDeviceDriver extends AbstractOpcDeviceDriv } private synchronized void applyBushing() { - List list = new ArrayList(); 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(); if (Long.parseLong(task_code1) < 1) { message = "任务ACS创建,不向LMS申请套轴"; return; } -// 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 (ObjectUtils.isNotEmpty(applyManipulatorActionResponse) && "1".equals(applyManipulatorActionResponse.getIs_bushing())) { + if (ObjectUtils.isNotEmpty(applyManipulatorActionResponse) && ("1".equals(applyManipulatorActionResponse.getIs_bushing()))) { + logServer.deviceExecuteLog(this.device_code, "", "", "申请套轴成功,返回参数:" + applyManipulatorActionResponse); Map map = new LinkedHashMap<>(); - map.put("to_command", 4); + map.put("to_command", "4"); this.writing(map); requireSucess = true; - logServer.deviceExecuteLog(this.device_code, "", "", "申请套轴成功,返回参数:" + applyManipulatorActionResponse); message = "套轴申请成功"; - } else if (ObjectUtils.isNotEmpty(applyManipulatorActionResponse) && "2".equals(applyManipulatorActionResponse.getIs_bushing())) { + } else if (ObjectUtils.isNotEmpty(applyManipulatorActionResponse) && ("2".equals(applyManipulatorActionResponse.getIs_bushing()))) { message = applyManipulatorActionResponse.getMessage(); + logServer.deviceExecuteLog(this.device_code, "", "", "等待套轴,返回参数:" + applyManipulatorActionResponse); Map map = new LinkedHashMap<>(); - map.put("to_command", 98); + map.put("to_command", "98"); this.writing(map); requireSucess = true; message = "等待套轴"; - logServer.deviceExecuteLog(this.device_code, "", "", "等待套轴,返回参数:" + applyManipulatorActionResponse); - } else { + } else if (ObjectUtils.isNotEmpty(applyManipulatorActionResponse) && ("0".equals(applyManipulatorActionResponse.getIs_bushing()))){ message = applyManipulatorActionResponse.getMessage(); + logServer.deviceExecuteLog(this.device_code, "", "", "套轴申请失败,返回参数:" + applyManipulatorActionResponse); Map map = new LinkedHashMap<>(); - map.put("to_command", 99); + map.put("to_command", "99"); this.writing(map); requireSucess = true; message = "套轴申请失败"; - logServer.deviceExecuteLog(this.device_code, "", "", "套轴申请失败,返回参数:" + applyManipulatorActionResponse); } } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDeviceDriver.java index 993fa5c68..30ee81d0a 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/rgv/RgvDeviceDriver.java @@ -63,6 +63,8 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr int last_error = 0; int move1 = 0; int last_move1 = 0; + int to_command = 0; + int last_to_command = 0; Integer move2 = 0; Integer last_move2 = 0; Float qty1 = 0f; @@ -105,7 +107,7 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr qty1 = this.itemProtocol.getQty1(); qty2 = this.itemProtocol.getQty2(); task = this.itemProtocol.getTask(); - + to_command = this.itemProtocol.getToCommand(); if (mode != last_mode) { this.requireSucess = false; @@ -126,6 +128,9 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr if(task != last_task){ logServer.deviceExecuteLog(this.device_code, "", "", "信号task:" + last_task + "->" + task); } + if(to_command != last_to_command){ + logServer.deviceExecuteLog(this.device_code, "", "", "信号to_command:" + last_to_command + "->" + to_command); + } } catch (Exception var17) { @@ -179,6 +184,7 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr last_task = task; last_qty1 = qty1; last_qty2 = qty2; + last_to_command = to_command; } private void manualFeedbackQty() { @@ -201,14 +207,14 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr message = "手动反馈LMS成功..."; logServer.deviceExecuteLog(this.device_code, "", "", "手动反馈重量请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); Map map = new LinkedHashMap<>(); - map.put("to_command", 5); + map.put("to_command", "5"); this.writing(map); } else { requireSucess = false; message = "手动完成反馈LMS失败," + applyManipulatorActionResponse.getMessage(); logServer.deviceExecuteLog(this.device_code, "", "", "手动反馈重量请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); Map map = new LinkedHashMap<>(); - map.put("to_command", 99); + map.put("to_command", "99"); this.writing(map); } } @@ -232,14 +238,14 @@ public class RgvDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDr message = "自动反馈LMS成功..."; logServer.deviceExecuteLog(this.device_code, "", "", "自动反馈重量请求成功,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); Map map = new LinkedHashMap<>(); - map.put("to_command", 4); + map.put("to_command", "4"); this.writing(map); } else { requireSucess = false; message = "自动完成反馈LMS失败," + String.valueOf(applyManipulatorActionResponse); logServer.deviceExecuteLog(this.device_code, "", "", "自动反馈重量请求失败,响应参数:" + JSON.toJSONString(applyManipulatorActionResponse)); Map map = new LinkedHashMap<>(); - map.put("to_command", 99); + map.put("to_command", "99"); this.writing(map); } } 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 03990b473..e0f32087f 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 @@ -659,7 +659,6 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme } public void writing(List list) { - Map itemMap = new HashMap(); for (int i = 0; i < list.size(); i++) { Object ob = list.get(i); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java index ab5de46c6..dc02d7d5a 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java @@ -64,8 +64,10 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc try{ if(i == 0){ control( itemValues); + log.info("i等于0:{}",itemValues); } else { controlByNewConn( itemValues); + log.info("i不等于0:{}",itemValues); } } catch (Exception e){ @@ -108,10 +110,11 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc String itemString = (String)var24.next(); if (!ObjectUtl.isEquals(String.valueOf(itemValues.get(itemString)), String.valueOf(read.get(itemString)))) { check = false; + log.info("写入失败,写入值为{},读取值为==={}" , itemValues.get(itemString), read.get(itemString)); } } } catch (Exception e){ - e.printStackTrace(); + log.info("写入信号出现异常:{}",e.getMessage()); check = false; } diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/dto/TaskDto.java b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/dto/TaskDto.java index a1ea21fb0..2f5f4f03b 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/dto/TaskDto.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/dto/TaskDto.java @@ -342,6 +342,14 @@ public class TaskDto implements Serializable { private String paper_array; private JSONArray paperArray; + /** + * 仓位 + */ + private String device_code; + /** + * 数量 + */ + private String qty; diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java index 62229877c..1504c8294 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/task/service/impl/TaskServiceImpl.java @@ -1,11 +1,15 @@ package org.nl.acs.task.service.impl; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpResponse; +import cn.hutool.json.InternalJSONUtil; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -20,6 +24,7 @@ import org.nl.acs.device.service.DeviceService; import org.nl.acs.device.service.StorageCellService; import org.nl.acs.device.service.dto.DeviceAssignedDto; import org.nl.acs.device.service.impl.DeviceServiceImpl; +import org.nl.acs.device_driver.basedriver.paper_tube_device2.Paper; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; @@ -210,6 +215,28 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { Integer currentPageNumber = page.getPageNumber() + 1; Integer pageMaxSize = page.getPageSize(); + for (TaskDto taskDto : taskList) { + if("10".equals(taskDto.getTask_type())){ + cn.hutool.json.JSONArray jsonArray = JSONUtil.parseArray(taskDto.getPaper_array()); + List papers = JSONUtil.toList(jsonArray, Paper.class); + StringBuilder task_paper = new StringBuilder(); + StringBuilder task_qty = new StringBuilder(); + for (Paper paper : papers) { + task_qty.append(paper.getQty()).append(","); + task_paper.append(paper.getDevice_code()).append(","); + } + String qty = task_qty.toString(); + if (qty.endsWith(",")) { + qty = qty.substring(0, qty.length() - 1); + } + String device_code = task_paper.toString(); + if (device_code.endsWith(",")) { + device_code = device_code.substring(0, device_code.length() - 1); + } + taskDto.setDevice_code(device_code); + taskDto.setQty(qty); + } + } List taskDtoList = taskList.stream() .skip((currentPageNumber - 1) * pageMaxSize) diff --git a/acs/nladmin-system/src/main/resources/config/application-dev.yml b/acs/nladmin-system/src/main/resources/config/application-dev.yml index e0243e89f..e4b08d5dc 100644 --- a/acs/nladmin-system/src/main/resources/config/application-dev.yml +++ b/acs/nladmin-system/src/main/resources/config/application-dev.yml @@ -13,11 +13,11 @@ spring: driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy # url: jdbc:log4jdbc:mysql://${DB_HOST:10.1.3.91}:${DB_PORT:3306}/${DB_NAME:acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true # url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:lzhl_one_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true - url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_a1_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true + url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:lzhl_a1_acs1}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true username: ${DB_USER:root} # password: ${DB_PWD:P@ssw0rd} # password: ${DB_PWD:Root.123456} - password: ${DB_PWD:root} + password: ${DB_PWD:123456} # 初始连接数 initial-size: 5 diff --git a/acs/nladmin-ui/.env.production b/acs/nladmin-ui/.env.production index 762ac12e7..2c75e4bb6 100644 --- a/acs/nladmin-ui/.env.production +++ b/acs/nladmin-ui/.env.production @@ -2,6 +2,6 @@ ENV = 'production' # 如果使用 Nginx 代理后端接口,那么此处需要改为 '/',文件查看 Docker 部署篇,Nginx 配置 # 接口地址,注意协议,如果你没有配置 ssl,需要将 https 改为 http -VUE_APP_BASE_API = 'http://127.0.0.1:8010' +VUE_APP_BASE_API = 'http://10.1.3.94:8011' # 如果接口是 http 形式, wss 需要改为 ws -VUE_APP_WS_API = 'ws://127.0.0.1:8010' +VUE_APP_WS_API = 'ws://10.1.3.94:8011' diff --git a/acs/nladmin-ui/public/config.js b/acs/nladmin-ui/public/config.js index c4d32ea74..4c79c8a78 100644 --- a/acs/nladmin-ui/public/config.js +++ b/acs/nladmin-ui/public/config.js @@ -1,9 +1,9 @@ window.g = { dev: { - VUE_APP_BASE_API: 'http://127.0.0.1:8010' + VUE_APP_BASE_API: 'http://10.1.3.94:8011' }, prod: { - VUE_APP_BASE_API: 'http://127.0.0.1:8010' + VUE_APP_BASE_API: 'http://10.1.3.94:8011' } diff --git a/acs/nladmin-ui/src/views/acs/task/index.vue b/acs/nladmin-ui/src/views/acs/task/index.vue index 20a170eb3..f01311cbe 100644 --- a/acs/nladmin-ui/src/views/acs/task/index.vue +++ b/acs/nladmin-ui/src/views/acs/task/index.vue @@ -441,6 +441,8 @@ + + @@ -599,7 +601,9 @@ export default { device_code: '', material_code: '', qty: '' - }] + }], + device_code: null, + qty: null }, rules: { start_height: [