From 9c788a00d8b6b0f8a24f4e7bfacc74ea64afd4ff Mon Sep 17 00:00:00 2001 From: psh Date: Wed, 16 Aug 2023 17:22:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=BE=E8=B4=A7=E6=97=B6=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E8=AF=B7=E6=B1=82=E9=AB=98=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agv/server/impl/NDCAgvServiceImpl.java | 4 +- .../agv/ndcone/AgvNdcOneDeviceDriver.java | 58 ++++++++++++------- 2 files changed, 38 insertions(+), 24 deletions(-) diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index e317808..64f7279 100644 --- a/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -173,8 +173,8 @@ public class NDCAgvServiceImpl implements NDCAgvService { (byte) indexhigh, (byte) indexlow, (byte) 0X01, (byte) 0X14, (byte) phasehigh, (byte) phaselow, - (byte) phasehigh, (byte) phaselow, - (byte) phasehigh, (byte) phaselow + (byte) pickuphigh, (byte) pickuplow, + (byte) releasehigh, (byte) releaselow }; 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 9a494d0..86d509f 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 @@ -297,30 +297,41 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic log.info("未找到关联编号{}对应的指令", ikey); return; } + TaskDto task =taskService.findById(inst.getTask_id()); + int start_height= ObjectUtil.isNotEmpty(task.getStart_height())?Integer.parseInt(task.getStart_height()):0; + int next_height= ObjectUtil.isNotEmpty(task.getNext_height())?Integer.parseInt(task.getNext_height()):0; // Object reqWms = device.getExtraValue().get("reqWms"); // if (ObjectUtil.isNotEmpty(reqWms) && reqWms.toString().equals("true")) { -// JSONArray req = new JSONArray(); -// JSONObject map = new JSONObject(); -// map.put("vehicle_code", inst.getVehicle_code()); -// map.put("status", "3"); -// map.put("device_code", inst.getNext_point_code()); -// map.put("task_code", inst.getTask_code()); -// req.add(map); -// HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); -// if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { -// JSONObject resp = JSONObject.parseObject(httpResponse.body()); - // if (resp.getInteger("status") == 200) { -// data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,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 { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0); -// } + if(!StrUtil.startWith(task.getTask_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("vehicle_code", inst.getVehicle_code()); + map.put("status", "3"); + map.put("device_code", inst.getNext_point_code()); + map.put("task_code", inst.getTask_code()); + req.add(map); + HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); + if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { + JSONObject resp = JSONObject.parseObject(httpResponse.body()).getJSONObject("data"); + if (resp.getInteger("status") == 200) { + start_height=resp.getInteger("start_height"); + next_height=resp.getInteger("next_height"); + task.setStart_height(String.valueOf(start_height)); + task.setNext_height(String.valueOf(next_height)); + taskService.update(task); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,start_height,next_height); + 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 { + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,start_height,next_height); + } //放货完毕 //(需要WCS反馈) } else if (phase == 0x09) { @@ -422,6 +433,9 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } else if (phase == 0x74) { //三色灯状态 status = ikey; + if(status==4) { + order = ""; + } } if (!ObjectUtil.isEmpty(data)) { logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data);