From 082b64710500d15dea0af764e21fea0f03fd856b Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Mon, 13 Mar 2023 16:06:01 +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 --- .../agv/ndcone/AgvNdcOneDeviceDriver.java | 131 +++++++++--------- .../wms/service/impl/AcsToWmsServiceImpl.java | 30 ++-- .../src/main/resources/config/application.yml | 2 +- .../acs/device/driver/standard_storage.vue | 17 ++- 4 files changed, 99 insertions(+), 81 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java index 00f751e..f743c95 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java @@ -169,25 +169,24 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic return; } - if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - Object reqWms = device.getExtraValue().get("reqWms"); - if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) { - JSONArray req = new JSONArray(); - JSONObject map = new JSONObject(); - map.put("Vehiclecode", inst.getVehicle_code()); - map.put("Status", "1"); - map.put("Devicecode", inst.getStart_device_code()); - map.put("Taskcode", inst.getTask_code()); - req.add(map); - HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); - if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); - log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code()); - } else { - log.warn("指令号:{},acs请求wms取货申请失败,连接被拒绝,未反馈agv允许取货", inst.getInstruction_code()); - } + Object reqWms = device.getExtraValue().get("reqWms"); + if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) { + JSONArray req = new JSONArray(); + JSONObject map = new JSONObject(); + map.put("Vehiclecode", inst.getVehicle_code()); + map.put("Status", "1"); + map.put("Devicecode", inst.getStart_point_code()); + map.put("Taskcode", inst.getTask_code()); + req.add(map); + HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); + if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + log.info("指令号:{},acs请求wms取货申请成功,wms允许agv申请取货,已反馈agv允许取货", inst.getInstruction_code()); + } else { + log.warn("指令号:{},acs请求wms取货申请失败,连接被拒绝,未反馈agv允许取货", inst.getInstruction_code()); } } + //取货完毕 //(需要WCS反馈) } else if (phase == 0x05) { @@ -225,25 +224,24 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic return; } - if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - Object reqWms = device.getExtraValue().get("reqWms"); - if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) { - JSONArray req = new JSONArray(); - JSONObject map = new JSONObject(); - map.put("Vehiclecode", inst.getVehicle_code()); - map.put("Status", "2"); - map.put("Devicecode", inst.getStart_device_code()); - map.put("Taskcode", inst.getTask_code()); - req.add(map); - HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); - if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); - log.info("指令号:{},acs反馈wms取货完成成功,wms允许agv取货完成,已反馈agv取货完成", inst.getInstruction_code()); - } else { - log.warn("指令号:{},acs反馈wms取货完成失败,连接被拒绝,未反馈agv取货完成", inst.getInstruction_code()); - } + Object reqWms = device.getExtraValue().get("reqWms"); + if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) { + JSONArray req = new JSONArray(); + JSONObject map = new JSONObject(); + map.put("Vehiclecode", inst.getVehicle_code()); + map.put("Status", "2"); + map.put("Devicecode", inst.getStart_point_code()); + map.put("Taskcode", inst.getTask_code()); + req.add(map); + HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); + if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + log.info("指令号:{},acs反馈wms取货完成成功,wms允许agv取货完成,已反馈agv取货完成", inst.getInstruction_code()); + } else { + log.warn("指令号:{},acs反馈wms取货完成失败,连接被拒绝,未反馈agv取货完成", inst.getInstruction_code()); } } + //到达放货点 //(需要WCS反馈) } else if (phase == 0x07) { @@ -277,23 +275,21 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic log.info("未找到关联编号{}对应的指令", ikey); return; } - if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - Object reqWms = device.getExtraValue().get("reqWms"); - if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) { - JSONArray req = new JSONArray(); - JSONObject map = new JSONObject(); - map.put("Vehiclecode", inst.getVehicle_code()); - map.put("Status", "3"); - map.put("Devicecode", inst.getNext_device_code()); - map.put("Taskcode", inst.getTask_code()); - req.add(map); - HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); - if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); - log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code()); - } else { - log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code()); - } + Object reqWms = device.getExtraValue().get("reqWms"); + if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) { + JSONArray req = new JSONArray(); + JSONObject map = new JSONObject(); + map.put("Vehiclecode", inst.getVehicle_code()); + map.put("Status", "3"); + map.put("Devicecode", inst.getNext_point_code()); + map.put("Taskcode", inst.getTask_code()); + req.add(map); + HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); + if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + log.info("指令号:{},acs请求wms放货申请成功,wms允许agv申请放货,已反馈agv允许放货", inst.getInstruction_code()); + } else { + log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code()); } } //放货完毕 @@ -330,25 +326,24 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic log.info("未找到编号{}对应的指令", ikey); return; } - if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { - Object reqWms = device.getExtraValue().get("reqWms"); - if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) { - JSONArray req = new JSONArray(); - JSONObject map = new JSONObject(); - map.put("Vehiclecode", inst.getVehicle_code()); - map.put("Status", "4"); - map.put("Devicecode", inst.getNext_device_code()); - map.put("Taskcode", inst.getTask_code()); - req.add(map); - HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); - if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); - log.info("指令号:{},acs请求wms放货完成成功", inst.getInstruction_code()); - } else { - log.warn("指令号:{},acs请求wms放货完成失败", inst.getInstruction_code()); - } + Object reqWms = device.getExtraValue().get("reqWms"); + if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) { + JSONArray req = new JSONArray(); + JSONObject map = new JSONObject(); + map.put("Vehiclecode", inst.getVehicle_code()); + map.put("Status", "4"); + map.put("Devicecode", inst.getNext_point_code()); + map.put("Taskcode", inst.getTask_code()); + req.add(map); + HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); + if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + log.info("指令号:{},acs请求wms放货完成成功", inst.getInstruction_code()); + } else { + log.warn("指令号:{},acs请求wms放货完成失败", inst.getInstruction_code()); } } + } //到达位置点 //(需要WCS反馈) 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 981ae7b..f1a0348 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 @@ -119,19 +119,27 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { AddressDto addressDto = addressService.findByCode("feedbackTaskStatusToWms"); String methods_url = addressDto.getMethods_url(); String url = wmsurl + methods_url; - try { - result = HttpRequest - .post(url + "?token=" + token) - .header("Content-Type", "application/json") - .body(String.valueOf(data)) - .execute(); + + for (int i = 0; i < data.size(); i++) { + JSONObject jsonObject = data.getJSONObject(i); + String taskcode = jsonObject.getString("Taskcode"); + String taskstatus = jsonObject.getString("Taskstatus"); + JSONObject reqData = new JSONObject(); + reqData.put("Staus",taskstatus); + try { + result = HttpRequest + .put(url + taskcode + "?token=" + token) + .header("Content-Type", "application/json") + .body(String.valueOf(reqData)) + .execute(); // //System.out.println(result2); - } catch (Exception e) { - String msg = e.getMessage(); - //网络不通 + } catch (Exception e) { + String msg = e.getMessage(); + //网络不通 // //System.out.println(msg); - log.info("feedbackTaskStatusToWms-----输出参数{}", msg); + log.info("feedbackTaskStatusToWms-----输出参数{}", msg); + } } String type = ""; if (result.getStatus() == 200) { @@ -140,7 +148,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { type = "error"; } JSONObject jo = JSONObject.parseObject(result.body()); - log.info("feedbackTaskStatusToWms-----输出参数{}", jo.toString()); + log.info("feedbackTaskStatusToWms-----输出参数{}", String.valueOf(jo)); return result; } finally { MDC.remove(log_file_type); diff --git a/acs/nladmin-system/src/main/resources/config/application.yml b/acs/nladmin-system/src/main/resources/config/application.yml index cfc52fe..f943602 100644 --- a/acs/nladmin-system/src/main/resources/config/application.yml +++ b/acs/nladmin-system/src/main/resources/config/application.yml @@ -2,7 +2,7 @@ spring: freemarker: check-template-location: false profiles: - active: prod + active: dev jackson: time-zone: GMT+8 data: diff --git a/acs/nladmin-ui/src/views/acs/device/driver/standard_storage.vue b/acs/nladmin-ui/src/views/acs/device/driver/standard_storage.vue index 6f89389..3b3cd05 100644 --- a/acs/nladmin-ui/src/views/acs/device/driver/standard_storage.vue +++ b/acs/nladmin-ui/src/views/acs/device/driver/standard_storage.vue @@ -1,6 +1,20 @@