Browse Source

更新

master
汪菘 2 years ago
parent
commit
38432376db
  1. 175
      hd/nladmin-system/src/main/java/org/nl/acs/device_driver/ndxy_special/NdxySpecialDeviceDriver.java
  2. 2
      hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/ToAgvDevice.java

175
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.device_driver.standard_inspect_site.StandardInspectSiteDeviceDriver;
import org.nl.acs.instruction.service.InstructionService; import org.nl.acs.instruction.service.InstructionService;
import org.nl.acs.instruction.service.dto.Instruction; 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.Device;
import org.nl.acs.opc.DeviceAppService; import org.nl.acs.opc.DeviceAppService;
import org.nl.acs.opc.DeviceAppServiceImpl; import org.nl.acs.opc.DeviceAppServiceImpl;
@ -49,6 +50,9 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements
RouteLineService routeLineServer = SpringContextHolder.getBean("routeLineServiceImpl"); RouteLineService routeLineServer = SpringContextHolder.getBean("routeLineServiceImpl");
@Autowired @Autowired
TaskService taskServer = SpringContextHolder.getBean("taskServiceImpl"); TaskService taskServer = SpringContextHolder.getBean("taskServiceImpl");
@Autowired
LogServer logServer = SpringContextHolder.getBean("logServerImpl");
String container; String container;
String container_type_desc; String container_type_desc;
String last_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 (StrUtil.equals(this.getDevice().getExtraValue().get("outbound").toString(), "true")) {
if (move != 0) { if (move != 0) {
this.setRequireSucess(false); 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.setResource(this.device_code, this.device.getDevice_name());
this.execute_log.log("设备:" + device_code + ",last_error -> error:" + last_error + "->" + error); this.execute_log.log("设备:" + device_code + ",last_error -> error:" + last_error + "->" + error);
} }
//判断当前设备是否为入库位 // //判断当前设备是否为入库位
if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("put_storage"))) { // if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("put_storage"))) {
if (StrUtil.equals(this.getDevice().getExtraValue().get("put_storage").toString(), "true")) { // if (StrUtil.equals(this.getDevice().getExtraValue().get("put_storage").toString(), "true")) {
int moveNumber = 0; // int moveNumber = 0;
if (this.move != 0) { // if (this.move != 0) {
moveNumber += 1; // moveNumber += 1;
} // }
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); // DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) { // if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) {
Object[] arr = (Object[]) this.getDevice().getExtraValue().get("link_device_code"); // Object[] arr = (Object[]) this.getDevice().getExtraValue().get("link_device_code");
String[] str_arr = new String[arr.length]; // String[] str_arr = new String[arr.length];
for (int j = 0; j < arr.length; j++) { // for (int j = 0; j < arr.length; j++) {
str_arr[j] = (String) arr[j]; // str_arr[j] = (String) arr[j];
} // }
for (int j = 0; j < str_arr.length; j++) { // for (int j = 0; j < str_arr.length; j++) {
String device_code = str_arr[j]; // String device_code = str_arr[j];
Device relevance_device = appService.findDeviceByCode(device_code); // Device relevance_device = appService.findDeviceByCode(device_code);
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; // StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (relevance_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { // if (relevance_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) relevance_device.getDeviceDriver(); // standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) relevance_device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() != 0) { // if (standardInspectSiteDeviceDriver.getMove() != 0) {
moveNumber += 1; // moveNumber += 1;
} // }
} // }
} // }
} // }
if (moveNumber == 4 && ObjectUtil.isNotEmpty(taskServer.findByNextCode(this.device_code))){ // if (moveNumber == 3 && ObjectUtil.isNotEmpty(taskServer.findByNextCode(this.device_code))){
this.checked = false; // this.checked = false;
this.choose = false; // this.choose = false;
} // }
if (moveNumber >= 5) { // if (moveNumber >= 4) {
this.checked = false; // this.checked = false;
this.choose = false; // this.choose = false;
} // }
} // }
} // }
//判断当前设备是否为出库位 //判断当前设备是否为出库位
if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("outbound"))) { // if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("outbound"))) {
this.choose = false; // this.choose = false;
if (StrUtil.equals(this.getDevice().getExtraValue().get("outbound").toString(), "true")) { // if (StrUtil.equals(this.getDevice().getExtraValue().get("outbound").toString(), "true")) {
int moveNumber = 0; // int moveNumber = 0;
if (this.move == 0) { // if (this.move == 0) {
moveNumber += 1; // moveNumber += 1;
} // }
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); // DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) { // if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("link_device_code"))) {
Object[] arr = (Object[]) this.getDevice().getExtraValue().get("link_device_code"); // Object[] arr = (Object[]) this.getDevice().getExtraValue().get("link_device_code");
String[] str_arr = new String[arr.length]; // String[] str_arr = new String[arr.length];
for (int j = 0; j < arr.length; j++) { // for (int j = 0; j < arr.length; j++) {
str_arr[j] = (String) arr[j]; // str_arr[j] = (String) arr[j];
} // }
for (int j = 0; j < str_arr.length; j++) { // for (int j = 0; j < str_arr.length; j++) {
String device_code = str_arr[j]; // String device_code = str_arr[j];
Device relevance_device = appService.findDeviceByCode(device_code); // Device relevance_device = appService.findDeviceByCode(device_code);
StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; // StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver;
if (relevance_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) { // if (relevance_device.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) relevance_device.getDeviceDriver(); // standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) relevance_device.getDeviceDriver();
if (standardInspectSiteDeviceDriver.getMove() == 0) { // if (standardInspectSiteDeviceDriver.getMove() == 0) {
moveNumber += 1; // moveNumber += 1;
} // }
} // }
} // }
} // }
if (moveNumber == 6) { // if (moveNumber == 2) {
this.choose = false; // this.choose = false;
this.checked = false; // this.checked = false;
} // }
} // }
} // }
// if (this.choose) { // if (this.choose) {
// this.checked = false; // this.checked = false;
@ -280,17 +284,17 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements
break; break;
case 2: case 2:
//入库 //入库
if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("apply_task"))) { // if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("apply_task"))) {
if (!requireSucess && this.move == 0 && StrUtil.equals(this.getDevice().getExtraValue().get("apply_task").toString(), "true")) { // if (!requireSucess && this.move != 0 && StrUtil.equals(this.getDevice().getExtraValue().get("apply_task").toString(), "true")) {
standby(); // standby();
} // }
} // }
//出库 //出库
else if (ObjectUtil.isNotEmpty(this.getDevice().getExtraValue().get("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")) { // if (!requireSucess && this.checked && this.move != 0 && StrUtil.equals(this.getDevice().getExtraValue().get("outbound").toString(), "true")) {
outbound(); // outbound();
} // }
} // }
break; break;
case 3: case 3:
@ -330,6 +334,8 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements
List<RouteLineDto> list = routeLineServer.getShortPathLinesByCode(this.device_code, "normal"); List<RouteLineDto> list = routeLineServer.getShortPathLinesByCode(this.device_code, "normal");
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
int nextDeviceMove = 0;
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
RouteLineDto routeLineDto = list.get(i); RouteLineDto routeLineDto = list.get(i);
@ -342,6 +348,7 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements
&& ndxySpecialDeviceDriver.getMode() != 0 && ndxySpecialDeviceDriver.getMode() != 0
&& ndxySpecialDeviceDriver.getMove() == 0 && ndxySpecialDeviceDriver.getMove() == 0
&& StrUtil.equals(ndxySpecialDeviceDriver.getDevice().getExtraValue().get("put_storage").toString(), "true")) { && StrUtil.equals(ndxySpecialDeviceDriver.getDevice().getExtraValue().get("put_storage").toString(), "true")) {
nextDeviceMove = ndxySpecialDeviceDriver.getMove();
break; break;
} else { } else {
next_device_code = ""; next_device_code = "";
@ -367,6 +374,8 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements
String task_code = CodeUtil.getNewCode("TASK_NO"); String task_code = CodeUtil.getNewCode("TASK_NO");
dto.setTask_code("-" + task_code); dto.setTask_code("-" + task_code);
logServer.log(task_code,"灭菌前任务","","任务起点:" + device_code + "," + "光电信号:" + move + ";" + "任务终点:" + next_device_code + "光电信号:" + nextDeviceMove,"","","","");
WQLObject wo = WQLObject.getWQLObject("acs_task"); WQLObject wo = WQLObject.getWQLObject("acs_task");
JSONObject json = JSONObject.fromObject(dto); JSONObject json = JSONObject.fromObject(dto);
wo.insert(json); wo.insert(json);
@ -401,6 +410,8 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements
List<RouteLineDto> list = routeLineServer.getShortPathLinesByCode(this.device_code, "normal"); List<RouteLineDto> list = routeLineServer.getShortPathLinesByCode(this.device_code, "normal");
DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class); DeviceAppService appService = SpringContextHolder.getBean(DeviceAppServiceImpl.class);
int nextDeviceMove = 0;
for (int i = 0; i < list.size(); i++) { for (int i = 0; i < list.size(); i++) {
RouteLineDto routeLineDto = list.get(i); RouteLineDto routeLineDto = list.get(i);
@ -408,8 +419,8 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements
Device device = appService.findDeviceByCode(next_device_code); Device device = appService.findDeviceByCode(next_device_code);
if (device.getDeviceDriver() instanceof NdxySpecialDeviceDriver) { if (device.getDeviceDriver() instanceof NdxySpecialDeviceDriver) {
ndxySpecialDeviceDriver = (NdxySpecialDeviceDriver) device.getDeviceDriver(); ndxySpecialDeviceDriver = (NdxySpecialDeviceDriver) device.getDeviceDriver();
if (ndxySpecialDeviceDriver.getMove() == 0 if (ndxySpecialDeviceDriver.getMode() != 0) {
&& ndxySpecialDeviceDriver.getMode() != 0) { nextDeviceMove = ndxySpecialDeviceDriver.getMove();
break; break;
} else { } else {
next_device_code = ""; next_device_code = "";
@ -432,6 +443,8 @@ public class NdxySpecialDeviceDriver extends AbstractOpcDeviceDriver implements
String task_code = CodeUtil.getNewCode("TASK_NO"); String task_code = CodeUtil.getNewCode("TASK_NO");
dto.setTask_code("-" + task_code); dto.setTask_code("-" + task_code);
logServer.log(task_code,"灭菌后任务","","任务起点:" + device_code + "," + "光电信号:" + move + ";" + "任务终点:" + next_device_code + "光电信号:" + nextDeviceMove,"","","","");
WQLObject wo = WQLObject.getWQLObject("acs_task"); WQLObject wo = WQLObject.getWQLObject("acs_task");
JSONObject json = JSONObject.fromObject(dto); JSONObject json = JSONObject.fromObject(dto);
wo.insert(json); wo.insert(json);

2
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("device_code", agvDto.getName());
row.put("energyLevel", agvDto.getEnergyLevel()); row.put("energyLevel", agvDto.getEnergyLevel());
row.put("device_status",agvDto.getState()); row.put("device_status",agvDto.getState());
row.put("transportOrder", agvDto.getTransportOrder()); row.put("transportOrder", "");
row.put("positionX", agvDto.getPositionX()); row.put("positionX", agvDto.getPositionX());
row.put("positionY", agvDto.getPositionY()); row.put("positionY", agvDto.getPositionY());
row.put("positionAngle", agvDto.getPositionAngle()); row.put("positionAngle", agvDto.getPositionAngle());

Loading…
Cancel
Save