From 28b6555ea8ada9bfa450f7e4eb4fb2a4b6f25b09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=91=A8=E4=BF=8A=E6=9D=B0?= <9463626+zhou-junjiezjj@user.noreply.gitee.com> Date: Thu, 7 Sep 2023 09:18:04 +0800 Subject: [PATCH] =?UTF-8?q?rev=20lunce=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agv/ndcone/AgvNdcOneDeviceDriver.java | 89 ++++++++++--------- 1 file changed, 46 insertions(+), 43 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 0e67aee..73f1dc8 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 @@ -39,6 +39,7 @@ import org.nl.acs.opc.DeviceAppService; import org.nl.acs.task.service.TaskService; import org.nl.acs.task.service.dto.TaskDto; import org.nl.acs.task.service.impl.TaskServiceImpl; +import org.nl.modules.lucene.service.LuceneExecuteLogService; import org.nl.modules.system.service.ParamService; import org.nl.modules.system.service.impl.ParamServiceImpl; import org.nl.modules.wql.util.SpringContextHolder; @@ -63,13 +64,15 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic TaskService taskService=SpringContextHolder.getBean(TaskServiceImpl.class); AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class); NDCAgvService NDCAgvService = SpringContextHolder.getBean(NDCAgvService.class); - DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class); + DeviceExecuteLogService lucene = SpringContextHolder.getBean(DeviceExecuteLogService.class); DeviceAppService deviceAppService = SpringContextHolder.getBean(DeviceAppService.class); DeviceService deviceService = SpringContextHolder.getBean(DeviceService.class); NDCAgvService AgvService = SpringContextHolder.getBean(NDCAgvService.class); OneAgvPhase oneAgvPhase = new OneAgvPhase(); ParamService acsConfigService = SpringContextHolder.getBean(ParamServiceImpl.class); WmsToAcsService wmsToAcsService=SpringContextHolder.getBean(WmsToAcsService.class); + + int agvaddr = 0; int agvaddr_copy = 0; int weight = 0; @@ -111,7 +114,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic agvaddr = arr[18] * 256 + arr[19]; //车号 int carno = arr[20]; - logServer.deviceExecuteLog(this.device_code, "", "", "接收agv上报信息:" + "phase--" + phase + " index--" + index + " 指令号--" + ikey + " 站点号--" + agvaddr + " 车号--" + carno); + lucene.deviceExecuteLog(this.device_code, "", "", "接收agv上报信息:" + "phase--" + phase + " index--" + index + " 指令号--" + ikey + " 站点号--" + agvaddr + " 车号--" + carno); Instruction link_inst = null; List insts = null; Instruction inst = null; @@ -167,7 +170,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (phase == 0x02) { inst.setCarno(String.valueOf(carno)); instructionService.update(inst); - logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈车号:" + carno + ",指令号:" + ikey); + lucene.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈车号:" + carno + ",指令号:" + ikey); //到达取货点 //(需要WCS反馈) @@ -176,14 +179,14 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (ObjectUtil.isEmpty(inst)) { log.info("未找到指令:" + ikey); - logServer.deviceExecuteLog(device_code, "", "", "未找到指令 [" + ikey + "]"); + lucene.deviceExecuteLog(device_code, "", "", "未找到指令 [" + ikey + "]"); return; } if (agvaddr == 0) { agvaddr = agvaddr_copy; } if (agvaddr < 1) { - logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); + lucene.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); return; } device_code = deviceService.queryDeviceCodeByAddress(agvaddr); @@ -204,14 +207,14 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic device = deviceAppService.findDeviceByCode(device_code); if (ObjectUtil.isEmpty(device_code)) { log.info(agvaddr + "对应设备号为空!"); - logServer.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空"); + lucene.deviceExecuteLog(this.device_code, "", "", agvaddr + "对应设备号为空"); return; } //校验agv上报站点编号与指令起始点相同 if (ObjectUtil.isEmpty(inst)) { log.info("未找到编号{}对应的指令", ikey); agv_message = "未找到编号"+ikey +"对应的指令"; - logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); + lucene.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); return; } //标准版-机械手对接位 @@ -245,7 +248,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV取货。"; lnshPalletizingManipulatorSiteDeviceDriver.setMessage(message); agv_message = lnshPalletizingManipulatorSiteDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //标准版-工位(交互模板) @@ -279,7 +282,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV取货。"; lnshStationDeviceDriver.setMessage(message); agv_message = lnshStationDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //标准版-压制对接位 @@ -311,7 +314,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV取货。"; conveyorPressStationDeviceDriver.setMessage(message); agv_message = conveyorPressStationDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //普通站点 @@ -328,7 +331,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { - logServer.deviceExecuteLog(device_code, "", "", "AGV请求取货设备{}无货,无法反馈"); + lucene.deviceExecuteLog(device_code, "", "", "AGV请求取货设备{}无货,无法反馈"); } } } @@ -356,7 +359,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV取货。"; conveyorBarcodeDeviceDriver.setMessage(message); agv_message = conveyorBarcodeDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //标准版-叠盘机 LnshFoldDiscSiteDeviceDriverl @@ -390,7 +393,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV取货。"; agv_message = lnshFoldDiscSiteDeviceDriver.getDevice_code() + message; lnshFoldDiscSiteDeviceDriver.setMessage(message); - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } @@ -406,7 +409,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } if (flag) { log.info("==================允许AGV取货=================="); - logServer.deviceExecuteLog(device_code, "", "", "允许AGV取货。"); + lucene.deviceExecuteLog(device_code, "", "", "允许AGV取货。"); } //取货完毕 //(需要WCS反馈) @@ -414,14 +417,14 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic log.info("================AGV取货完成请求离开================"); if (ObjectUtil.isEmpty(inst)) { log.info("未找到指令:" + ikey); - logServer.deviceExecuteLog(device_code, "", "", "未找到指令 [" + ikey + "]"); + lucene.deviceExecuteLog(device_code, "", "", "未找到指令 [" + ikey + "]"); return; } if (agvaddr == 0) { agvaddr = agvaddr_copy; } if (agvaddr < 1) { - logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); + lucene.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); return; } if (agvaddr != 0) { @@ -441,13 +444,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic if (ObjectUtil.isEmpty(device_code)) { log.info(agvaddr + "对应设备号为空!"); - logServer.deviceExecuteLog(this.device_code, "", "", "对应设备号为空" + device_code); + lucene.deviceExecuteLog(this.device_code, "", "", "对应设备号为空" + device_code); return; } //校验agv上报站点编号与指令起始点相同 if (ObjectUtil.isEmpty(inst)) { log.info("未找到关联编号{}对应的指令", ikey); - logServer.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); + lucene.deviceExecuteLog(this.device_code, "", "", "未找到关联编号对应的指令" + ikey); return; } //标准版-机械手对接位 @@ -478,7 +481,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV取货后离开。"; lnshPalletizingManipulatorSiteDeviceDriver.setMessage(message); agv_message = lnshPalletizingManipulatorSiteDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //标准版-工位(交互模板) LnshStationDeviceDriver @@ -509,7 +512,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV取货后离开。"; lnshStationDeviceDriver.setMessage(message); agv_message = lnshStationDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //标准版-压制对接位 @@ -540,7 +543,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV取货后离开。"; conveyorPressStationDeviceDriver.setMessage(message); agv_message = conveyorPressStationDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //普通站点 @@ -584,7 +587,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV取货后离开。"; conveyorBarcodeDeviceDriver.setMessage(message); agv_message = conveyorBarcodeDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //标准版-叠盘机 @@ -615,7 +618,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV取货后离开。"; lnshFoldDiscSiteDeviceDriver.setMessage(message); agv_message = lnshFoldDiscSiteDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } if (StrUtil.equals(inst.getStart_device_code(), device_code)) { @@ -634,7 +637,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } if (ObjectUtil.isNotEmpty(data)) { - logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data)); + lucene.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data)); } // if (flag) { // String hasWms = acsConfigService.findByCode(AcsConfig.HASWMS).getValue(); @@ -647,14 +650,14 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic // ar.add(param); // acsToWmsService.feedbackTaskStatusToWms(ar); // } catch (Exception e) { -// logServer.deviceExecuteLog(device_code, "", "", "AGV取货完成离开后,反馈上位系统失败!"); +// lucene.deviceExecuteLog(device_code, "", "", "AGV取货完成离开后,反馈上位系统失败!"); // e.printStackTrace(); // } // } // } if (flag) { log.info("================允许AGV取货后离开================="); - logServer.deviceExecuteLog(device_code, "", "", "允许AGV取货后离开。"); + lucene.deviceExecuteLog(device_code, "", "", "允许AGV取货后离开。"); } //到达放货点 //(需要WCS反馈) @@ -662,14 +665,14 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic log.info("==================AGV请求放货=================="); if (ObjectUtil.isEmpty(inst)) { log.info("未找到指令:" + ikey); - logServer.deviceExecuteLog(device_code, "", "", "未找到指令 [" + ikey + "]"); + lucene.deviceExecuteLog(device_code, "", "", "未找到指令 [" + ikey + "]"); return; } if (agvaddr == 0) { agvaddr = agvaddr_copy; } if (agvaddr < 1) { - logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); + lucene.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); return; } if (agvaddr != 0) { @@ -726,7 +729,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV放货。"; agv_message = lnshPalletizingManipulatorSiteDeviceDriver.getDevice_code() + message; lnshPalletizingManipulatorSiteDeviceDriver.setMessage(message); - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //标准版-工位(交互模板) @@ -760,7 +763,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV放货。"; lnshStationDeviceDriver.setMessage(message); agv_message = lnshStationDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //标准版-压制对接位 @@ -794,7 +797,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV放货。"; conveyorPressStationDeviceDriver.setMessage(message); agv_message = conveyorPressStationDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //普通站点 @@ -836,7 +839,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV放货。"; conveyorBarcodeDeviceDriver.setMessage(message); agv_message = conveyorBarcodeDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //标准版-叠盘机 @@ -871,7 +874,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV放货。"; lnshFoldDiscSiteDeviceDriver.setMessage(message); agv_message = lnshFoldDiscSiteDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } if (StrUtil.equals(inst.getNext_device_code(), device_code)) { @@ -889,7 +892,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } if (flag) { log.info("==================允许AGV放货=================="); - logServer.deviceExecuteLog(device_code, "", "", "允许AGV放货。"); + lucene.deviceExecuteLog(device_code, "", "", "允许AGV放货。"); } //放货完毕 @@ -898,14 +901,14 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic log.info("================AGV放货完成请求离开================"); if (ObjectUtil.isEmpty(inst)) { log.info("未找到指令:" + ikey); - logServer.deviceExecuteLog("未找到指令号对应的指令:", "", "", String.valueOf(ikey)); + lucene.deviceExecuteLog("未找到指令号对应的指令:", "", "", String.valueOf(ikey)); return; } if (agvaddr == 0) { agvaddr = agvaddr_copy; } if (agvaddr < 1) { - logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); + lucene.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); return; } if (agvaddr != 0) { @@ -959,7 +962,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV放货后离开。"; lnshPalletizingManipulatorSiteDeviceDriver.setMessage(message); agv_message = lnshPalletizingManipulatorSiteDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //标准版-工位(交互模板) @@ -989,7 +992,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV放货后离开。"; lnshStationDeviceDriver.setMessage(message); agv_message = lnshStationDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //标准版-压制对接位(需要给电气目标站) @@ -1034,7 +1037,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV放货后离开。"; conveyorPressStationDeviceDriver.setMessage(message); agv_message = conveyorPressStationDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //普通站点 @@ -1079,7 +1082,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV放货后离开。"; agv_message = conveyorBarcodeDeviceDriver.getDevice_code() + message; conveyorBarcodeDeviceDriver.setMessage(message); - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } //标准版-叠盘机 @@ -1110,12 +1113,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic message += "不允许AGV放货后离开。"; lnshFoldDiscSiteDeviceDriver.setMessage(message); agv_message = lnshFoldDiscSiteDeviceDriver.getDevice_code() + message; - logServer.deviceExecuteLog(device_code, "", "", message); + lucene.deviceExecuteLog(device_code, "", "", message); } } if (flag) { log.info("================允许AGV放货后离开================="); - logServer.deviceExecuteLog(device_code, "", "", "允许AGV放货后离开。"); + lucene.deviceExecuteLog(device_code, "", "", "允许AGV放货后离开。"); } } //到达位置点 @@ -1159,7 +1162,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic } if (!ObjectUtil.isEmpty(data)) { phase = 0; - logServer.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data)); + lucene.deviceExecuteLog(this.device_code, "", "", "agvphase:" + phase + "反馈:" + Bytes2HexString(data)); NDCSocketConnectionAutoRun.write(data); }