diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/ndxy_special/NdxySpecialDeviceDriver.java b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/ndxy_special/NdxySpecialDeviceDriver.java index 134f4fa..b479623 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/ndxy_special/NdxySpecialDeviceDriver.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/ndxy_special/NdxySpecialDeviceDriver.java @@ -17,6 +17,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; import org.nl.acs.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver; import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.log.service.LogServer; import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppServiceImpl; @@ -49,6 +50,9 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements RouteLineService routeLineServer = SpringContextHolder.getBean("routeLineServiceImpl"); @Autowired TaskService taskServer = SpringContextHolder.getBean("taskServiceImpl"); + @Autowired + LogServer logServer = SpringContextHolder.getBean("logServerImpl"); + String container; String container_type_desc; String last_container_type_desc; @@ -154,7 +158,7 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements } } //是否为出库口 - else if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("outbound"))) { + else if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("outbound"))) { if (StrUtil.equals(this.getDevice().getExtraValue().get("outbound").toString(), "true")) { if (move != 0) { this.setRequireSucess(false); @@ -169,75 +173,75 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements this.execute_log.setResource(this.device_code, this.device.getDevice_name()); this.execute_log.log("设备:" + device_code + ",last_error -> error:" + last_error + "->" + error); } - //判断当前设备是否为入库位 - if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("put_storage"))) { - if (StrUtil.equals(this.getDevice().getExtraValue().get("put_storage").toString(), "true")) { - int moveNumber = 0; - if (this.move != 0) { - moveNumber += 1; - } - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) { - Object[] arr = (Object[]) this.getDevice().getExtraValue().get("link_device_code"); - String[] str_arr = new String[arr.length]; - for (int j = 0; j < arr.length; j++) { - str_arr[j] = (String) arr[j]; - } - for (int j = 0; j < str_arr.length; j++) { - String device_code = str_arr[j]; - Device relevance_device = appService.findDeviceByCode(device_code); - StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; - if (relevance_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) relevance_device.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMove() != 0) { - moveNumber += 1; - } - } - } - } - if (moveNumber == 4 && ObjectUtil.isNotEmpty(taskServer.findByNextCode(this.device_code))){ - this.checked = false; - this.choose = false; - } - if (moveNumber >= 5) { - this.checked = false; - this.choose = false; - } - } - } +// //判断当前设备是否为入库位 +// if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("put_storage"))) { +// if (StrUtil.equals(this.getDevice().getExtraValue().get("put_storage").toString(), "true")) { +// int moveNumber = 0; +// if (this.move != 0) { +// moveNumber += 1; +// } +// DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); +// if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) { +// Object[] arr = (Object[]) this.getDevice().getExtraValue().get("link_device_code"); +// String[] str_arr = new String[arr.length]; +// for (int j = 0; j < arr.length; j++) { +// str_arr[j] = (String) arr[j]; +// } +// for (int j = 0; j < str_arr.length; j++) { +// String device_code = str_arr[j]; +// Device relevance_device = appService.findDeviceByCode(device_code); +// StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; +// if (relevance_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { +// standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) relevance_device.getDeviceDriver(); +// if (standardInspectSiteDeviceDriver.getMove() != 0) { +// moveNumber += 1; +// } +// } +// } +// } +// if (moveNumber == 3 && ObjectUtil.isNotEmpty(taskServer.findByNextCode(this.device_code))){ +// this.checked = false; +// this.choose = false; +// } +// if (moveNumber >= 4) { +// this.checked = false; +// this.choose = false; +// } +// } +// } //判断当前设备是否为出库位 - if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("outbound"))) { - this.choose = false; - if (StrUtil.equals(this.getDevice().getExtraValue().get("outbound").toString(), "true")) { - int moveNumber = 0; - if (this.move == 0) { - moveNumber += 1; - } - DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); - if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) { - Object[] arr = (Object[]) this.getDevice().getExtraValue().get("link_device_code"); - String[] str_arr = new String[arr.length]; - for (int j = 0; j < arr.length; j++) { - str_arr[j] = (String) arr[j]; - } - for (int j = 0; j < str_arr.length; j++) { - String device_code = str_arr[j]; - Device relevance_device = appService.findDeviceByCode(device_code); - StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; - if (relevance_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { - standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) relevance_device.getDeviceDriver(); - if (standardInspectSiteDeviceDriver.getMove() == 0) { - moveNumber += 1; - } - } - } - } - if (moveNumber == 6) { - this.choose = false; - this.checked = false; - } - } - } +// if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("outbound"))) { +// this.choose = false; +// if (StrUtil.equals(this.getDevice().getExtraValue().get("outbound").toString(), "true")) { +// int moveNumber = 0; +// if (this.move == 0) { +// moveNumber += 1; +// } +// DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); +// if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) { +// Object[] arr = (Object[]) this.getDevice().getExtraValue().get("link_device_code"); +// String[] str_arr = new String[arr.length]; +// for (int j = 0; j < arr.length; j++) { +// str_arr[j] = (String) arr[j]; +// } +// for (int j = 0; j < str_arr.length; j++) { +// String device_code = str_arr[j]; +// Device relevance_device = appService.findDeviceByCode(device_code); +// StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; +// if (relevance_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { +// standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) relevance_device.getDeviceDriver(); +// if (standardInspectSiteDeviceDriver.getMove() == 0) { +// moveNumber += 1; +// } +// } +// } +// } +// if (moveNumber == 2) { +// this.choose = false; +// this.checked = false; +// } +// } +// } // if (this.choose) { // this.checked = false; @@ -280,17 +284,17 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements break; case 2: //入库 - if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("apply_task"))) { - if (!requireSucess && this.move == 0 && StrUtil.equals(this.getDevice().getExtraValue().get("apply_task").toString(), "true")) { - standby(); - } - } +// if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("apply_task"))) { +// if (!requireSucess && this.move != 0 && StrUtil.equals(this.getDevice().getExtraValue().get("apply_task").toString(), "true")) { +// standby(); +// } +// } //出库 - else if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("outbound"))) { - if (!requireSucess && this.checked && this.move != 0 && StrUtil.equals(this.getDevice().getExtraValue().get("outbound").toString(), "true")) { - outbound(); - } - } +// else if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("outbound"))) { +// if (!requireSucess && this.checked && this.move != 0 && StrUtil.equals(this.getDevice().getExtraValue().get("outbound").toString(), "true")) { +// outbound(); +// } +// } break; case 3: @@ -330,6 +334,8 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements List list = routeLineServer.getShortPathLinesByCode(this.device_code, "normal"); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); + int nextDeviceMove = 0; + for (int i = 0; i < list.size(); i++) { RouteLineDto routeLineDto = list.get(i); @@ -342,6 +348,7 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements && ndxySpecialDeviceDriver.getMode() != 0 && ndxySpecialDeviceDriver.getMove() == 0 && StrUtil.equals(ndxySpecialDeviceDriver.getDevice().getExtraValue().get("put_storage").toString(), "true")) { + nextDeviceMove = ndxySpecialDeviceDriver.getMove(); break; } else { next_device_code = ""; @@ -367,6 +374,8 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements String task_code = CodeUtil.getNewCode("TASK_NO"); dto.setTask_code("-" + task_code); + logServer.log(task_code,"灭菌前任务","","任务起点:" + device_code + "," + "光电信号:" + move + ";" + "任务终点:" + next_device_code + "光电信号:" + nextDeviceMove,"","","",""); + WQLObject wo = WQLObject.getWQLObject("acs_task"); JSONObject json = JSONObject.fromObject(dto); wo.insert(json); @@ -401,6 +410,8 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements List list = routeLineServer.getShortPathLinesByCode(this.device_code, "normal"); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); + int nextDeviceMove = 0; + for (int i = 0; i < list.size(); i++) { RouteLineDto routeLineDto = list.get(i); @@ -408,8 +419,8 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements Device device = appService.findDeviceByCode(next_device_code); if (device.getDeviceDriver() instanceof NdxySpecialDeviceDriver) { ndxySpecialDeviceDriver = (NdxySpecialDeviceDriver) device.getDeviceDriver(); - if (ndxySpecialDeviceDriver.getMove() == 0 - && ndxySpecialDeviceDriver.getMode() != 0) { + if (ndxySpecialDeviceDriver.getMode() != 0) { + nextDeviceMove = ndxySpecialDeviceDriver.getMove(); break; } else { next_device_code = ""; @@ -432,6 +443,8 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements String task_code = CodeUtil.getNewCode("TASK_NO"); dto.setTask_code("-" + task_code); + logServer.log(task_code,"灭菌后任务","","任务起点:" + device_code + "," + "光电信号:" + move + ";" + "任务终点:" + next_device_code + "光电信号:" + nextDeviceMove,"","","",""); + WQLObject wo = WQLObject.getWQLObject("acs_task"); JSONObject json = JSONObject.fromObject(dto); wo.insert(json); diff --git a/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/ToAgvDevice.java b/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/ToAgvDevice.java index 94d200f..1f38010 100644 --- a/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/ToAgvDevice.java +++ b/hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/ToAgvDevice.java @@ -40,7 +40,7 @@ public class ToAgvDevice { row.put("device_code", agvDto.getName()); row.put("energyLevel", agvDto.getEnergyLevel()); row.put("device_status",agvDto.getState()); - row.put("transportOrder", agvDto.getTransportOrder()); + row.put("transportOrder", ""); row.put("positionX", agvDto.getPositionX()); row.put("positionY", agvDto.getPositionY()); row.put("positionAngle", agvDto.getPositionAngle());