From b1e133cb313010cb53ea044739ba086bb7eecabd Mon Sep 17 00:00:00 2001 From: psh Date: Mon, 4 Sep 2023 08:32:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../run/OneNDCSocketConnectionAutoRun.java | 45 ++++++++++--------- .../agv/ndcone/AgvNdcOneDeviceDriver.java | 36 ++++++++++----- .../acs/ext/wms/rest/AcsToWmsController.java | 2 +- .../acs/ext/wms/service/AcsToWmsService.java | 2 +- .../wms/service/impl/AcsToWmsServiceImpl.java | 2 +- .../wms/service/impl/JDToAcsServiceImpl.java | 2 +- 6 files changed, 53 insertions(+), 36 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java index c012d99..10871ed 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java @@ -159,28 +159,31 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { inst.setAgv_jobno(String.valueOf(index)); inst.setSend_status("1"); instructionService.update(inst); - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "0")) { +// if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "0") +// ||StrUtil.startWith(inst.getTask_code(), "-")) { data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); - } else { - JSONArray req = new JSONArray(); - JSONObject map = new JSONObject(); - map.put("uuid", IdUtil.simpleUUID()); - map.put("taskNo", inst.getTask_id()); - map.put("businessType", "PENDING"); - req.add(map); - HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); - if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { - JSONObject resp = JSONObject.parseObject(httpResponse.body()); - if (resp.getInteger("code") == 200) { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); - log.info("指令号:{},acs请求wms任务执行申请成功,wms允许agv任务执行,已反馈agv任务执行", inst.getInstruction_code()); - } else { - log.warn("指令号:{},acs请求wms任务执行任务执行失败,wms不允许agv任务执行离开,未反馈agv任务执行", inst.getInstruction_code()); - } - } else { - log.warn("指令号:{},acs请求wms任务执行任务执行失败,连接被拒绝,未反馈agv任务执行", inst.getInstruction_code()); - } - } +// } else { +// JSONArray req = new JSONArray(); +// JSONObject map = new JSONObject(); +// map.put("uuid", IdUtil.simpleUUID()); +// map.put("taskNo", inst.getTask_code()); +// map.put("businessType", "PENDING"); +// map.put("containerNo",inst.getVehicle_code()); +// map.put("deviceNo",inst.getCarno()); +// req.add(map); +// HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); +// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { +// JSONObject resp = JSONObject.parseObject(httpResponse.body()); +// if (resp.getInteger("code") == 200) { +// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); +// log.info("指令号:{},acs请求wms任务执行申请成功,wms允许agv任务执行,已反馈agv任务执行", inst.getInstruction_code()); +// } else { +// log.warn("指令号:{},acs请求wms任务执行任务执行失败,wms不允许agv任务执行离开,未反馈agv任务执行", inst.getInstruction_code()); +// } +// } else { +// log.warn("指令号:{},acs请求wms任务执行任务执行失败,连接被拒绝,未反馈agv任务执行", inst.getInstruction_code()); +// } +// } } } //任务完毕 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 73416a2..eed8e57 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 @@ -132,7 +132,15 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic inst.setCarno(String.valueOf(carno)); instructionService.update(inst); logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + "反馈:" + data); - +// JSONArray req = new JSONArray(); + JSONObject map = new JSONObject(); + map.put("uuid", IdUtil.simpleUUID()); + map.put("taskNo", inst.getTask_code()); + map.put("businessType", "PENDING"); + map.put("containerNo",inst.getVehicle_code()); + map.put("deviceNo",inst.getCarno()); +// req.add(map); + HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(map); //到达取货点 //(需要WCS反馈) } else if (phase == 0x03) { @@ -208,16 +216,19 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic return; } - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "0")) { + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "0") + ||StrUtil.startWith(inst.getTask_code(), "-")) { data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); } else { - JSONArray req = new JSONArray(); +// JSONArray req = new JSONArray(); JSONObject map = new JSONObject(); map.put("uuid", IdUtil.simpleUUID()); - map.put("taskNo", inst.getTask_id()); + map.put("taskNo", inst.getTask_code()); map.put("businessType", "LEAVE_FROM_POINT"); - req.add(map); - HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); + map.put("containerNo",inst.getVehicle_code()); + map.put("deviceNo",inst.getCarno()); +// req.add(map); + HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(map); if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { JSONObject resp = JSONObject.parseObject(httpResponse.body()); if (resp.getInteger("code") == 200) { @@ -301,16 +312,19 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic log.info("未找到编号{}对应的指令", ikey); return; } - if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "0")) { + if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "0") + ||StrUtil.startWith(inst.getTask_code(), "-")) { data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); } else { - JSONArray req = new JSONArray(); +// JSONArray req = new JSONArray(); JSONObject map = new JSONObject(); map.put("uuid", IdUtil.simpleUUID()); - map.put("taskNo", inst.getTask_id()); + map.put("taskNo", inst.getTask_code()); map.put("businessType", "ARRIVE_TO_POINT"); - req.add(map); - HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); + map.put("containerNo",inst.getVehicle_code()); + map.put("deviceNo",inst.getCarno()); +// req.add(map); + HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(map); if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { JSONObject resp = JSONObject.parseObject(httpResponse.body()); if (resp.getInteger("code") == 200) { 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 213c1f3..189bf9f 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,7 +107,7 @@ public class AcsToWmsController { @PostMapping("/feedAgvTaskStatus") @Log(value = "反馈AGV取放货状态", isInterfaceLog = true, interfaceLogType = InterfaceLogType.ACS_TO_LMS) @ApiOperation("反馈AGV取放货状态") - public ResponseEntity feedAgvTaskStatus(@RequestBody JSONArray from) { + public ResponseEntity feedAgvTaskStatus(@RequestBody JSONObject from) { return new ResponseEntity<>(acstowmsService.feedAgvTaskStatus(from), HttpStatus.OK); } 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 53de2bd..0d68fe5 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 @@ -113,7 +113,7 @@ public interface AcsToWmsService { * @param from * @return */ - HttpResponse feedAgvTaskStatus(JSONArray from); + HttpResponse feedAgvTaskStatus(JSONObject from); JSONObject test(JSONObject form); } 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 2da3a54..e9e8c7c 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 @@ -556,7 +556,7 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { } @Override - public HttpResponse feedAgvTaskStatus(JSONArray from) { + public HttpResponse feedAgvTaskStatus(JSONObject from) { if (StrUtil.equals(paramService.findByCode(AcsConfig.HASWMS).getValue(), "1")) { log.info("开始反馈WMS AGV取放货状态,请求参数:{}", from); this.getTokenFromWms(); diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/JDToAcsServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/JDToAcsServiceImpl.java index 2d98f85..29938ee 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/JDToAcsServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/impl/JDToAcsServiceImpl.java @@ -467,7 +467,7 @@ public class JDToAcsServiceImpl implements JDToAcsService { String start_device_code = reqs.getCarryTask().getFromPoint(); String next_device_code = reqs.getCarryTask().getToPoint(); String priority = reqs.getPriority(); - String vehicle_code = reqs.getDeviceNo(); + String vehicle_code = reqs.getCarryTask().getContainerNo(); // String vehicle_type = req.getVehicle_type(); String task_type = "1"; // String remark = req.getRemark();