From 7628b30236fb5ee70e633130b5fad9bd9ee207ec Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Sat, 4 Feb 2023 22:22:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SiemensConveyorDeviceDriver.java | 117 +++++++----------- 1 file changed, 43 insertions(+), 74 deletions(-) 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 74fdc38f0..1e8bae273 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 @@ -777,80 +777,41 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme } else { this.require_apply_strangulation_time = date; String vehicle_code = ""; -// if (task > 0) { -// Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); -// if(ObjectUtil.isEmpty(instruction)){ -// message = "申请捆扎电气设备任务号:" + task + "未找到对应指令"; -// throw new RuntimeException("该电气任务号未找到对应指令!"); -// } -// vehicle_code = instruction.getVehicle_code(); -// } else { -// logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:" + task + "异常"); -// message = "申请捆扎电气设备任务号:" + task + "异常"; -// throw new RuntimeException("任务号为空!"); -// } -// if (StrUtil.isEmpty(vehicle_code)) { -// logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:" + task + "未找到载具号"); -// message = "申请捆扎电气设备任务号:" + task + "未找到载具号"; -// throw new RuntimeException("载具号为空!"); -// } -// ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest = -// new ApplyLabelingAndBindingRequest(); -// JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + this.device_code + "'").uniqueResult(0); -// String start_point_code = null; -// if (!ObjectUtil.isEmpty(device_json)) { -// start_point_code = (String) device_json.get("parent_storage_code") == null ? this.device_code : (String) device_json.get("parent_storage_code"); -// } -// applyLabelingAndBindingRequest.setDevice_code(start_point_code); -// applyLabelingAndBindingRequest.setType("2"); -// applyLabelingAndBindingRequest.setVehicle_code(vehicle_code); -// ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest); -// if (applyLabelingAndBindingResponse.getstatus() == 200) { -// if (ObjectUtil.isNotEmpty(applyLabelingAndBindingResponse.getData())) { -// Map datas = applyLabelingAndBindingResponse.getData(); -// String length = datas.get("box_length").toString(); -// String width = datas.get("box_width").toString(); -// String box_high = datas.get("box_high").toString(); -// String bundle_times = datas.get("bundle_times").toString(); -// -// List list = new ArrayList(); -// Map map = new HashMap(); -// map.put("code", "to_length"); -// map.put("value", length); -// list.add(map); -// Map map2 = new HashMap(); -// map2.put("code", "to_weight"); -// map2.put("value", width); -// list.add(map2); -// Map map3 = new HashMap(); -// map3.put("code", "to_height"); -// map3.put("value", box_high); -// list.add(map3); -// Map map4 = new HashMap(); -// map4.put("code", "to_strap_times"); -// map4.put("value", bundle_times); -// list.add(map4); -// Map map5 = new HashMap(); -// map5.put("code", "to_command"); -// map5.put("value", "4"); -// list.add(map5); -// this.writing(list); -//// this.writing(list); -// -// message = "申请捆扎成功"; -// requireSucess = true; -// } else { -// message = "未返回尺寸信息"; -// } -// -// } else { -// message = applyLabelingAndBindingResponse.getMessage(); -// } - Thread.sleep(10000); - String length = "1280"; - String width = "800"; - String box_high = "400"; - String bundle_times = "2"; + if (task > 0) { + Instruction instruction = instructionService.findByCodeFromCache(String.valueOf(task)); + if(ObjectUtil.isEmpty(instruction)){ + message = "申请捆扎电气设备任务号:" + task + "未找到对应指令"; + throw new RuntimeException("该电气任务号未找到对应指令!"); + } + vehicle_code = instruction.getVehicle_code(); + } else { + logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:" + task + "异常"); + message = "申请捆扎电气设备任务号:" + task + "异常"; + throw new RuntimeException("任务号为空!"); + } + if (StrUtil.isEmpty(vehicle_code)) { + logServer.deviceExecuteLog(device_code, "", "", "申请捆扎电气设备任务号:" + task + "未找到载具号"); + message = "申请捆扎电气设备任务号:" + task + "未找到载具号"; + throw new RuntimeException("载具号为空!"); + } + ApplyLabelingAndBindingRequest applyLabelingAndBindingRequest = + new ApplyLabelingAndBindingRequest(); + JSONObject device_json = WQLObject.getWQLObject("acs_storage_cell").query("storage_code ='" + this.device_code + "'").uniqueResult(0); + String start_point_code = null; + if (!ObjectUtil.isEmpty(device_json)) { + start_point_code = (String) device_json.get("parent_storage_code") == null ? this.device_code : (String) device_json.get("parent_storage_code"); + } + applyLabelingAndBindingRequest.setDevice_code(start_point_code); + applyLabelingAndBindingRequest.setType("2"); + applyLabelingAndBindingRequest.setVehicle_code(vehicle_code); + ApplyLabelingAndBindingResponse applyLabelingAndBindingResponse = acsToWmsService.applyLabelingAndBindingRequest(applyLabelingAndBindingRequest); + if (applyLabelingAndBindingResponse.getstatus() == 200) { + if (ObjectUtil.isNotEmpty(applyLabelingAndBindingResponse.getData())) { + Map datas = applyLabelingAndBindingResponse.getData(); + String length = datas.get("box_length").toString(); + String width = datas.get("box_width").toString(); + String box_high = datas.get("box_high").toString(); + String bundle_times = datas.get("bundle_times").toString(); List list = new ArrayList(); Map map = new HashMap(); @@ -877,6 +838,14 @@ public class SiemensConveyorDeviceDriver extends AbstractOpcDeviceDriver impleme // this.writing(list); message = "申请捆扎成功"; + requireSucess = true; + } else { + message = "未返回尺寸信息"; + } + + } else { + message = applyLabelingAndBindingResponse.getMessage(); + } } }