diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java index e29dfcf..d1c9d24 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/NDCAgvService.java @@ -29,7 +29,7 @@ public interface NDCAgvService { */ public void sendAgvInstToNDC(String agv_system_type,Instruction inst) throws Exception; - public byte[] sendAgvOneModeInst(int phase, int index,int result); + public byte[] sendAgvOneModeInst(int phase, int index,int result,int startPoint,int nextPoint,int startHigh,int nextHigh); public byte[] sendAgvTwoModeInst(int phase, int index,int result); diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java index c4ce0e5..c307495 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/agv/server/impl/NDCAgvServiceImpl.java @@ -125,23 +125,35 @@ public class NDCAgvServiceImpl implements NDCAgvService { } @Override - public byte[] sendAgvOneModeInst(int phase, int index, int result) { + public byte[] sendAgvOneModeInst(int phase, int index, int result,int startPoint,int nextPoint,int startHigh,int nextHigh) { if (phase < 0 || index < 0) return null; byte indexhigh = (byte) IntToHexHigh(index); byte indexlow = (byte) IntToHexLow(index); byte phasehigh = (byte) IntToHexHigh(phase); byte phaselow = (byte) IntToHexLow(phase); + byte startPointHigh =(byte) IntToHexHigh(startPoint); + byte startPointLow =(byte) IntToHexLow(startPoint); + byte nextPointHigh =(byte) IntToHexHigh(nextPoint); + byte nextPointLow =(byte) IntToHexLow(nextPoint); + byte startHighHigh =(byte) IntToHexHigh(startHigh); + byte startHighLow =(byte) IntToHexLow(startHigh); + byte nextHighHigh =(byte) IntToHexHigh(nextHigh); + byte nextHighLow =(byte) IntToHexLow(nextHigh); byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD, (byte) 0X00, (byte) 0X08, - (byte) 0X00, (byte) 0X0A, + (byte) 0X00, (byte) 0X12, (byte) 0X00, (byte) 0X01, (byte) 0X00, (byte) 0X6D, - (byte) 0X00, (byte) 0X06, + (byte) 0X00, (byte) 0X0E, (byte) indexhigh, (byte) indexlow, - (byte) 0X01, (byte) 0X12, - (byte) phasehigh, (byte) phaselow + (byte) 0X01, (byte) 0X14, + (byte) phasehigh, (byte) phaselow, + (byte) startPointHigh, (byte) startPointLow, + (byte) nextPointHigh, (byte) nextPointLow, + (byte) startHighHigh, (byte) startHighLow, + (byte) nextHighHigh, (byte) nextHighLow }; diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java index 3149f00..fc9b314 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java @@ -158,7 +158,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { inst.setSend_status("1"); instructionService.update(inst); } - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); } //任务完毕 //(无车id及状态) @@ -168,13 +168,13 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { } else { log.warn("指令号:{},未反馈wms任务完成,因为agv上报指令号查询指令为空!"); } - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); log.info("指令号:{},已反馈agv任务完成!"); } //请求删除任务 //(需要WCS反馈) else if (phase == 0x30) { - data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0); + data = NDCAgvService.sendAgvOneModeInst(0x8F, index, 0,0,0,0,0); } //任务删除确认 //(需要WCS反馈) @@ -185,7 +185,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable { instructionService.cancelNOSendAgv(inst.getInstruction_id()); } } - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); } else { //上报异常信息 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 937e61c..a24cda7 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 @@ -111,7 +111,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (arr[18] * 256 + arr[19] == 0) { } - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); } //普通站点 @@ -179,7 +179,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { JSONObject resp = JSONObject.parseObject(httpResponse.body()); if (resp.getInteger("status") == 200) { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + 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()); @@ -188,8 +188,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic log.warn("指令号:{},acs请求wms取货申请失败,连接被拒绝,未反馈agv允许取货", inst.getInstruction_code()); } } else { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); } + //到达取货等待点 + //(需要WCS反馈) + } else if (phase == 0x04) { //取货完毕 //(需要WCS反馈) } else if (phase == 0x05) { @@ -240,7 +243,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { JSONObject resp = JSONObject.parseObject(httpResponse.body()); if (resp.getInteger("status") == 200) { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + 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()); @@ -249,8 +252,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic log.warn("指令号:{},acs反馈wms取货完成失败,连接被拒绝,未反馈agv取货完成", inst.getInstruction_code()); } } else { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); } + //到达放货等待点 + //(需要WCS反馈) + } else if (phase == 0x06) { //到达放货点 //(需要WCS反馈) } else if (phase == 0x07) { @@ -297,7 +303,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { JSONObject resp = JSONObject.parseObject(httpResponse.body()); if (resp.getInteger("status") == 200) { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + 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()); @@ -306,7 +312,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic log.warn("指令号:{},acs请求wms放货申请失败,连接被拒绝,未反馈agv允许放货", inst.getInstruction_code()); } } else { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); } //放货完毕 //(需要WCS反馈) @@ -353,13 +359,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic req.add(map); HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(req); if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) { - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + 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); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); } } //到达位置点 @@ -368,13 +374,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic //1、根据货位id找到对应三工位设备,赋给agv属性地址对应的满料位设备 agvaddr = arr[18] * 256 + arr[19]; agvaddr_copy = agvaddr; - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); } else if (phase == 0x50) {//进入交通灯区域 - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); } else if (phase == 0x51) {//离开交通灯区域 - data = NDCAgvService.sendAgvOneModeInst(phase, index, 0); + data = NDCAgvService.sendAgvOneModeInst(phase, index, 0,0,0,0,0); logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + data); } if (!ObjectUtil.isEmpty(data)) { diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java index 11884d3..deb62ea 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/standard_inspect_site/StandardInspectSiteDeviceDriver.java @@ -442,6 +442,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp this.time = date; FeedBackTaskStatusRequest request = new FeedBackTaskStatusRequest(); request.setDevice_code(devicecode); + request.setMaterial_type(String.valueOf(material_type)); request.setVehicle_code(String.valueOf(barcode)); if (devicecode.startsWith("TBX")&&type==5) { //满架下料 diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStatusRequest.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStatusRequest.java index eb3267b..bd0dfd0 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStatusRequest.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/ext/wms/data/feedBackTaskStatus/FeedBackTaskStatusRequest.java @@ -41,5 +41,10 @@ public class FeedBackTaskStatusRequest extends BaseRequest { */ private String action; + /** + * 1-正极板;2-负极板;3-边负极板 + */ + private String material_type; + } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/controller/AcsToWmsController.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/controller/AcsToWmsController.java index d23863c..3e04561 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/controller/AcsToWmsController.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/controller/AcsToWmsController.java @@ -56,6 +56,15 @@ public class AcsToWmsController { return new ResponseEntity<>(acsToWmsService.status(param), HttpStatus.OK); } + @PostMapping("/feedbackState") + @Log("ACS系统反馈AGV取放货状态") + @ApiOperation("ACS系统反馈AGV取放货状态") + //@SaCheckPermission("@el.check('schBaseTask:add')") + @SaIgnore + public ResponseEntity feedbackState(@RequestBody JSONObject param) { + return new ResponseEntity<>(acsToWmsService.feedbackState(param), HttpStatus.OK); + } + @PostMapping("/notify") @Log("acs通知wms") @ApiOperation("acs通知wms") @@ -64,4 +73,13 @@ public class AcsToWmsController { public ResponseEntity notify(@RequestBody JSONObject param) { return new ResponseEntity<>(acsToWmsService.notify(param), HttpStatus.OK); } + +// @PostMapping("/notify") +// @Log("acs通知wms") +// @ApiOperation("acs通知wms") +// //@SaCheckPermission("@el.check('schBaseTask:add')") +// @SaIgnore +// public ResponseEntity notify(@RequestBody JSONObject param) { +// return new ResponseEntity<>(acsToWmsService.notify(param), HttpStatus.OK); +// } } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/AcsToWmsService.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/AcsToWmsService.java index 6b49d06..cc74c00 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/AcsToWmsService.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/AcsToWmsService.java @@ -15,7 +15,10 @@ public interface AcsToWmsService { /** 任务反馈 */ BaseResponse status(JSONObject param); - /** 任务反馈 */ + /** 任务阶段反馈最新点位 */ + BaseResponse feedbackState(JSONObject param); + + /** acs通知wms */ BaseResponse notify(JSONObject param); } diff --git a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java index e909a03..00fa2f6 100644 --- a/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java +++ b/lms/nladmin-system/nlsso-server/src/main/java/org/nl/wms/ext/service/impl/AcsToWmsServiceImpl.java @@ -179,4 +179,39 @@ public class AcsToWmsServiceImpl implements AcsToWmsService { return BaseResponse.responseOk(requestNo, "反馈成功!"); } + /** + * 任务阶段反馈最新点位 + * todo + * */ + + @Override + public BaseResponse feedbackState(JSONObject param) { + String requestNo = param.getString("requestNo"); + String requestMethodCode = param.getString("request_medthod_code"); // 获取请求方法名 + String requestMethodName = param.getString("request_medthod_name"); + BaseResponse result = BaseResponse.build(requestNo); + String device_code = param.getString("device_code"); + param.put("config_code",requestMethodCode); + try { + if(ObjectUtil.isEmpty(requestMethodCode)){ + throw new BadRequestException("任务类型不正确!requestMethodCode:"+requestMethodName+",device_code:"+device_code); + } + AbstractTask task = taskFactory.getTask(requestMethodCode); + // 执行创建任务 + task.apply(param); + } catch (Exception e) { + String message = ObjectUtil.isEmpty(e.getMessage()) + ? ((InvocationTargetException) e).getTargetException().getMessage() + : e.getMessage(); + log.error("ACS请求LMS出现错误: {}", message); + result.setCode(HttpStatus.HTTP_BAD_REQUEST); + result.setMessage(message); + result.setRequestNo(requestNo); + // 消息通知 + noticeService.createNotice("异常信息:" + message, "acsApply: " + param.getString("request_medthod_code"), + NoticeTypeEnum.EXCEPTION.getCode()); + } + return result; + } + }