From c173e19565049a483dcee587161ca7cf7de69cd1 Mon Sep 17 00:00:00 2001 From: psh Date: Tue, 24 Oct 2023 14:13:08 +0800 Subject: [PATCH] =?UTF-8?q?NDC=E6=8E=A5=E5=8F=A3=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agv/ndcone/AgvNdcOneDeviceDriver.java | 107 +++--------------- .../StandardOrdinarySiteDeviceDriver.java | 8 +- .../org/nl/acs/ext/wms/data/BaseRequest.java | 9 ++ .../acs/ext/wms/service/AcsToWmsService.java | 5 + .../wms/service/impl/AcsToWmsServiceImpl.java | 14 +++ .../service/impl/InstructionServiceImpl.java | 12 +- .../ext/service/impl/AcsToWmsServiceImpl.java | 15 ++- .../sch/point/service/dao/SchBasePoint.java | 6 + .../nl/wms/sch/task_manage/AbstractTask.java | 14 +++ .../sch/task_manage/task/tasks/BPSLTask.java | 17 +++ .../task_manage/task/tasks/KGHJRKTask.java | 17 +++ .../sch/task_manage/task/tasks/MJXLTask.java | 18 +++ .../task_manage/task/tasks/TBXBKJTask.java | 17 +++ .../sch/task_manage/task/tasks/XSCKTask.java | 17 +++ .../task_manage/task/tasks/ZJBZKDDTask.java | 17 +++ .../task_manage/task/tasks/ghs/GHSFMTask.java | 17 +++ .../task_manage/task/tasks/ghs/GHSQHTask.java | 17 +++ 17 files changed, 216 insertions(+), 111 deletions(-) diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java index a24cda7..772e776 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java @@ -1,5 +1,6 @@ package org.nl.acs.device_driver.basedriver.agv.ndcone; +import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import cn.hutool.http.HttpResponse; @@ -17,6 +18,7 @@ import org.nl.acs.device_driver.basedriver.siemens_conveyor.SiemensConveyorDevic import org.nl.acs.device_driver.basedriver.standard_ordinary_site.StandardOrdinarySiteDeviceDriver; import org.nl.acs.device_driver.basedriver.standard_storage.StandardStorageDeviceDriver; import org.nl.acs.device_driver.driver.AbstractDeviceDriver; +import org.nl.acs.ext.wms.data.BaseRequest; import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl; import org.nl.acs.instruction.domain.Instruction; @@ -26,6 +28,7 @@ import org.nl.acs.log.LokiLog; import org.nl.acs.log.LokiLogType; import org.nl.acs.log.service.DeviceExecuteLogService; import org.nl.acs.opc.DeviceAppService; +import org.nl.acs.task.domain.Task; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.impl.TaskServiceImpl; import org.nl.system.service.param.ISysParamService; @@ -165,31 +168,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); return; } - - 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", "1"); - map.put("device_code", inst.getStart_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,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,0,0); - } + Task task =taskService.getById(inst.getTask_id()); + BaseRequest request=new BaseRequest(); + request.setRequestNo(IdUtil.simpleUUID()); + request.setTaskId(task.getExt_task_id()); + request.setPhase(String.valueOf(phase)); + acsToWmsService.feedbackState(request); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); //到达取货等待点 //(需要WCS反馈) } else if (phase == 0x04) { @@ -229,31 +214,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); return; } - - 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", "2"); - map.put("device_code", inst.getStart_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,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,0,0); - } + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); //到达放货等待点 //(需要WCS反馈) } else if (phase == 0x06) { @@ -290,30 +251,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic log.info("未找到关联编号{}对应的指令", ikey); return; } - 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,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,0,0); - } + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); + //放货完毕 //(需要WCS反馈) } else if (phase == 0x09) { @@ -348,25 +287,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic log.info("未找到编号{}对应的指令", ikey); return; } - 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", "4"); - 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) { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); - log.info("指令号:{},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,0,0); - } + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); } //到达位置点 //(需要WCS反馈) diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java index 5935872..9b93ce4 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java @@ -126,7 +126,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple if (ObjectUtil.isNotEmpty(inst)) { inst.setExecute_status("1"); instructionService.update(inst); - byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0); + byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0,0,0,0,0); agvphase = 0; index = 0; inst = null; @@ -141,7 +141,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple if (ObjectUtil.isNotEmpty(inst)) { inst.setExecute_status("2"); instructionService.update(inst); - byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0); + byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0,0,0,0,0); // OneNDCSocketConnectionAutoRun.write(data); agvphase = 0; index = 0; @@ -157,7 +157,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple if (ObjectUtil.isNotEmpty(inst)) { inst.setExecute_status("5"); instructionService.update(inst); - byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0); + byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0,0,0,0,0); // OneNDCSocketConnectionAutoRun.write(data); agvphase = 0; index = 0; @@ -172,7 +172,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple if (ObjectUtil.isNotEmpty(inst)) { inst.setExecute_status("6"); instructionService.update(inst); - byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0); + byte[] data = agvService.sendAgvOneModeInst(agvphase, index, 0,0,0,0,0); // OneNDCSocketConnectionAutoRun.write(data); agvphase = 0; index = 0; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java index a35e7dc..093078e 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/BaseRequest.java @@ -63,6 +63,15 @@ public class BaseRequest { */ private String state; + /** + * 任务号 + */ + private String taskId; + + /** + * 阶段号 + */ + private String phase; } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java index 4b00ea8..e3af8f8 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/AcsToWmsService.java @@ -127,4 +127,9 @@ public interface AcsToWmsService { * ACS向WMS反馈任务状态 */ String notify(BaseRequest request); + + /** + * 任务阶段反馈最新点位 + */ + String feedbackState(BaseRequest request); } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java index d18663b..e473525 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/service/impl/AcsToWmsServiceImpl.java @@ -592,4 +592,18 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { MDC.remove(log_file_type); } } + + @Override + public String feedbackState(BaseRequest requestParam) { + try { + MDC.put(log_file_type, log_type); + String api = addressService.findByCode("feedbackState").getMethods_url(); + log.info("feedbackState-----输入参数{}", JSON.toJSONString(requestParam, SerializerFeature.DisableCircularReferenceDetect)); + String result = LmsUtil.notifyAcs(api, requestParam); + log.info("feedbackState-----输出参数{}", result); + return result; + } finally { + MDC.remove(log_file_type); + } + } } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java index 450fb52..2d39114 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java @@ -384,13 +384,13 @@ public class InstructionServiceImpl extends CommonServiceImpl