Browse Source

fix

v1.1_20240705
张江玮 1 year ago
parent
commit
59063cdda3
  1. 122
      acs/nladmin-system/src/main/java/org/nl/acs/device_driver/nl4/station/NL4StationDeviceDriver.java

122
acs/nladmin-system/src/main/java/org/nl/acs/device_driver/nl4/station/NL4StationDeviceDriver.java

@ -212,7 +212,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
} }
@NotNull @NotNull
public TaskDto creatTask(Device device1, Device device2, Device device3, Device device4, RequestMethodEnum method) { private TaskDto creatTask(Device device1, Device device2, Device device3, Device device4, RequestMethodEnum method) {
JSONObject rpUpdate = new JSONObject(); JSONObject rpUpdate = new JSONObject();
rpUpdate.put("islock", "1"); rpUpdate.put("islock", "1");
rpUpdate.put("update_by", "auto"); rpUpdate.put("update_by", "auto");
@ -241,6 +241,26 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
return task.toJavaObject(TaskDto.class); return task.toJavaObject(TaskDto.class);
} }
private Device findHasGoodsDevice(JSONArray deviceCodes) {
for (int i = 0; i < deviceCodes.size(); i++) {
Device device = this.deviceAppService.findDeviceByCode(deviceCodes.getString(i));
if ("0".equals(device.getIslock()) && 1 == device.getHas_goods()) {
return device;
}
}
return null;
}
private Device findNotHasGoodsDevice(JSONArray deviceCodes) {
for (int i = 0; i < deviceCodes.size(); i++) {
Device device = this.deviceAppService.findDeviceByCode(deviceCodes.getString(i));
if ("0".equals(device.getIslock()) && 0 == device.getHas_goods()) {
return device;
}
}
return null;
}
/** /**
* 门架上料完成 * 门架上料完成
*/ */
@ -268,15 +288,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
JSONArray materialDeviceCodes = JSONArray.parseArray(gantryDeviceCode2.toString()); JSONArray materialDeviceCodes = JSONArray.parseArray(gantryDeviceCode2.toString());
// 查找合适的放空设备 // 查找合适的放空设备
Device emptyDevice = null; Device emptyDevice = this.findNotHasGoodsDevice(emptyDeviceCodes);
for (int i = 0; i < emptyDeviceCodes.size(); i++) {
String deviceCode = emptyDeviceCodes.getString(i);
Device device = deviceAppService.findDeviceByCode(deviceCode);
if ("0".equals(device.getIslock()) && 0 == device.getHas_goods()) {
emptyDevice = device;
break;
}
}
if (ObjectUtil.isEmpty(emptyDevice)) { if (ObjectUtil.isEmpty(emptyDevice)) {
String message = "未找到合适的门架上料完成放空设备。"; String message = "未找到合适的门架上料完成放空设备。";
this.message = message; this.message = message;
@ -286,15 +298,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
assert emptyDevice != null; assert emptyDevice != null;
// 查找合适的取满设备 // 查找合适的取满设备
Device materialDevice = null; Device materialDevice = this.findHasGoodsDevice(materialDeviceCodes);
for (int i = 0; i < materialDeviceCodes.size(); i++) {
String deviceCode = materialDeviceCodes.getString(i);
Device device = deviceAppService.findDeviceByCode(deviceCode);
if ("0".equals(device.getIslock()) && 1 == device.getHas_goods()) {
materialDevice = device;
break;
}
}
if (ObjectUtil.isEmpty(materialDevice)) { if (ObjectUtil.isEmpty(materialDevice)) {
String message = "未找到合适的门架上料完成取满设备。"; String message = "未找到合适的门架上料完成取满设备。";
this.message = message; this.message = message;
@ -343,15 +347,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
JSONArray deviceCodes4 = JSONArray.parseArray(channelSteelDeviceCode4.toString()); JSONArray deviceCodes4 = JSONArray.parseArray(channelSteelDeviceCode4.toString());
// 查找合适的取满设备 // 查找合适的取满设备
Device device1 = null; Device device1 = this.findHasGoodsDevice(deviceCodes1);
for (int i = 0; i < deviceCodes1.size(); i++) {
String deviceCode = deviceCodes1.getString(i);
Device device = deviceAppService.findDeviceByCode(deviceCode);
if ("0".equals(device.getIslock()) && 1 == device.getHas_goods()) {
device1 = device;
break;
}
}
if (ObjectUtil.isEmpty(device1)) { if (ObjectUtil.isEmpty(device1)) {
String message = "未找到合适的槽钢上料完成取满设备。"; String message = "未找到合适的槽钢上料完成取满设备。";
this.message = message; this.message = message;
@ -361,15 +357,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
assert device1 != null; assert device1 != null;
// 查找合适的放满设备 // 查找合适的放满设备
Device device2 = null; Device device2 = this.findNotHasGoodsDevice(deviceCodes2);
for (int i = 0; i < deviceCodes2.size(); i++) {
String deviceCode = deviceCodes2.getString(i);
Device device = deviceAppService.findDeviceByCode(deviceCode);
if ("0".equals(device.getIslock()) && 0 == device.getHas_goods()) {
device2 = device;
break;
}
}
if (ObjectUtil.isEmpty(device2)) { if (ObjectUtil.isEmpty(device2)) {
String message = "未找到合适的槽钢上料完成放满设备。"; String message = "未找到合适的槽钢上料完成放满设备。";
this.message = message; this.message = message;
@ -379,15 +367,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
assert device2 != null; assert device2 != null;
// 查找合适的放空设备 // 查找合适的放空设备
Device device4 = null; Device device4 = this.findNotHasGoodsDevice(deviceCodes4);
for (int i = 0; i < deviceCodes4.size(); i++) {
String deviceCode = deviceCodes4.getString(i);
Device device = deviceAppService.findDeviceByCode(deviceCode);
if ("0".equals(device.getIslock()) && 0 == device.getHas_goods()) {
device4 = device;
break;
}
}
if (ObjectUtil.isEmpty(device4)) { if (ObjectUtil.isEmpty(device4)) {
String message = "未找到合适的槽钢上料完成放空设备。"; String message = "未找到合适的槽钢上料完成放空设备。";
this.message = message; this.message = message;
@ -436,15 +416,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
JSONArray deviceCodes4 = JSONArray.parseArray(channelSteelCallMaterialDeviceCode4.toString()); JSONArray deviceCodes4 = JSONArray.parseArray(channelSteelCallMaterialDeviceCode4.toString());
// 查找合适的取满设备 // 查找合适的取满设备
Device device1 = null; Device device1 = this.findHasGoodsDevice(deviceCodes1);
for (int i = 0; i < deviceCodes1.size(); i++) {
String deviceCode = deviceCodes1.getString(i);
Device device = deviceAppService.findDeviceByCode(deviceCode);
if ("0".equals(device.getIslock()) && 1 == device.getHas_goods()) {
device1 = device;
break;
}
}
if (ObjectUtil.isEmpty(device1)) { if (ObjectUtil.isEmpty(device1)) {
String message = "未找到合适的槽钢呼叫满料取满设备。"; String message = "未找到合适的槽钢呼叫满料取满设备。";
this.message = message; this.message = message;
@ -454,15 +426,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
assert device1 != null; assert device1 != null;
// 查找合适的取空设备 // 查找合适的取空设备
Device device3 = null; Device device3 = this.findHasGoodsDevice(deviceCodes3);
for (int i = 0; i < deviceCodes3.size(); i++) {
String deviceCode = deviceCodes3.getString(i);
Device device = deviceAppService.findDeviceByCode(deviceCode);
if ("0".equals(device.getIslock()) && 1 == device.getHas_goods()) {
device3 = device;
break;
}
}
if (ObjectUtil.isEmpty(device3)) { if (ObjectUtil.isEmpty(device3)) {
String message = "未找到合适的槽钢呼叫满料取空设备。"; String message = "未找到合适的槽钢呼叫满料取空设备。";
this.message = message; this.message = message;
@ -472,15 +436,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
assert device3 != null; assert device3 != null;
// 查找合适的放空设备 // 查找合适的放空设备
Device device4 = null; Device device4 = this.findNotHasGoodsDevice(deviceCodes4);
for (int i = 0; i < deviceCodes4.size(); i++) {
String deviceCode = deviceCodes4.getString(i);
Device device = deviceAppService.findDeviceByCode(deviceCode);
if ("0".equals(device.getIslock()) && 0 == device.getHas_goods()) {
device4 = device;
break;
}
}
if (ObjectUtil.isEmpty(device4)) { if (ObjectUtil.isEmpty(device4)) {
String message = "未找到合适的槽钢呼叫满料放空设备。"; String message = "未找到合适的槽钢呼叫满料放空设备。";
this.message = message; this.message = message;
@ -520,15 +476,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
JSONArray deviceCodes3 = JSONArray.parseArray(productionCompletedDeviceCode3.toString()); JSONArray deviceCodes3 = JSONArray.parseArray(productionCompletedDeviceCode3.toString());
// 查找合适的放满设备 // 查找合适的放满设备
Device device2 = null; Device device2 = this.findNotHasGoodsDevice(deviceCodes2);
for (int i = 0; i < deviceCodes2.size(); i++) {
String deviceCode = deviceCodes2.getString(i);
Device device = deviceAppService.findDeviceByCode(deviceCode);
if ("0".equals(device.getIslock()) && 0 == device.getHas_goods()) {
device2 = device;
break;
}
}
if (ObjectUtil.isEmpty(device2)) { if (ObjectUtil.isEmpty(device2)) {
String message = "未找到合适的下料完成放满设备。"; String message = "未找到合适的下料完成放满设备。";
this.message = message; this.message = message;
@ -538,15 +486,7 @@ public class NL4StationDeviceDriver extends AbstractOpcDeviceDriver implements D
assert device2 != null; assert device2 != null;
// 查找合适的取空设备 // 查找合适的取空设备
Device device3 = null; Device device3 = this.findHasGoodsDevice(deviceCodes3);
for (int i = 0; i < deviceCodes3.size(); i++) {
String deviceCode = deviceCodes3.getString(i);
Device device = deviceAppService.findDeviceByCode(deviceCode);
if ("0".equals(device.getIslock()) && 1 == device.getHas_goods()) {
device3 = device;
break;
}
}
if (ObjectUtil.isEmpty(device3)) { if (ObjectUtil.isEmpty(device3)) {
String message = "未找到合适的下料完成取空设备。"; String message = "未找到合适的下料完成取空设备。";
this.message = message; this.message = message;

Loading…
Cancel
Save