fix: 扫描码位生成指令优化、内包间优化、写信号优化、lucence注解
This commit is contained in:
@@ -50,7 +50,7 @@ public class AgvWaitUtil {
|
||||
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
|
||||
BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver;
|
||||
//agv诺宝对接位安全信号交互
|
||||
if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
|
||||
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
|
||||
if (manipulatorAgvStationDeviceDriver.getTo_command() != 2) {
|
||||
manipulatorAgvStationDeviceDriver.writing(2);
|
||||
|
||||
@@ -11,6 +11,10 @@ import org.openscada.opc.lib.da.ItemState;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.CompletionException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements OpcDeviceDriver {
|
||||
UnifiedDataAccessor opcUdw;
|
||||
@@ -35,201 +39,223 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
|
||||
|
||||
|
||||
public void checkcontrol(Map<String, Object> itemValues) throws Exception {
|
||||
Group group = opcServerService.getServer(this.getOpcServer());
|
||||
Map<String, Object> write = new HashMap();
|
||||
Map<String, Item> readitems = new LinkedHashMap();
|
||||
List<String> itemsString = new ArrayList();
|
||||
itemsString = new ArrayList<>(itemValues.keySet());
|
||||
Iterator is = itemsString.iterator();
|
||||
|
||||
while (is.hasNext()) {
|
||||
String string = (String) is.next();
|
||||
CompletableFuture<String> future = CompletableFuture.supplyAsync(() -> {
|
||||
try {
|
||||
readitems.put(string, group.addItem(string));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
int i = 0;
|
||||
while (true) {
|
||||
//下发信号
|
||||
try {
|
||||
if (i == 0) {
|
||||
control(itemValues);
|
||||
} else {
|
||||
controlByNewConn(itemValues);
|
||||
}
|
||||
Group group = opcServerService.getServer(this.getOpcServer());
|
||||
Map<String, Object> write = new HashMap();
|
||||
Map<String, Item> readitems = new LinkedHashMap();
|
||||
List<String> itemsString = new ArrayList();
|
||||
itemsString = new ArrayList<>(itemValues.keySet());
|
||||
Iterator is = itemsString.iterator();
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Map<String, Object> read = new HashMap();
|
||||
Map<Item, ItemState> itemStatus = null;
|
||||
boolean check = true;
|
||||
try {
|
||||
if (i > 0) {
|
||||
group = opcServerService.getServer(this.getOpcServer());
|
||||
itemsString = new ArrayList<>(itemValues.keySet());
|
||||
Iterator nis = itemsString.iterator();
|
||||
|
||||
while (nis.hasNext()) {
|
||||
String string = (String) nis.next();
|
||||
try {
|
||||
readitems.put(string, group.addItem(string));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
while (is.hasNext()) {
|
||||
String string = (String) is.next();
|
||||
try {
|
||||
readitems.put(string, group.addItem(string));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
itemStatus = group.read(true, (Item[]) readitems.values().toArray(new Item[0]));
|
||||
|
||||
} else {
|
||||
itemStatus = group.read(true, (Item[]) readitems.values().toArray(new Item[0]));
|
||||
}
|
||||
Set<Item> items = itemStatus.keySet();
|
||||
Iterator var15 = items.iterator();
|
||||
while (var15.hasNext()) {
|
||||
Item item = (Item) var15.next();
|
||||
ItemState itemState = (ItemState) itemStatus.get(item);
|
||||
Object value = OpcUtl.getValue(item, itemState);
|
||||
read.put(item.getId(), value);
|
||||
}
|
||||
int i = 0;
|
||||
while (true) {
|
||||
//下发信号
|
||||
|
||||
Iterator var24 = itemsString.iterator();
|
||||
try {
|
||||
if (i == 0) {
|
||||
control(itemValues);
|
||||
} else {
|
||||
controlByNewConn(itemValues);
|
||||
}
|
||||
|
||||
while (var24.hasNext()) {
|
||||
String itemString = (String) var24.next();
|
||||
if (!ObjectUtl.isEquals(String.valueOf(itemValues.get(itemString)), String.valueOf(read.get(itemString)))) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Map<String, Object> read = new HashMap();
|
||||
Map<Item, ItemState> itemStatus = null;
|
||||
boolean check = true;
|
||||
try {
|
||||
if (i > 0) {
|
||||
group = opcServerService.getServer(this.getOpcServer());
|
||||
itemsString = new ArrayList<>(itemValues.keySet());
|
||||
Iterator nis = itemsString.iterator();
|
||||
|
||||
while (nis.hasNext()) {
|
||||
String string = (String) nis.next();
|
||||
try {
|
||||
readitems.put(string, group.addItem(string));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
itemStatus = group.read(true, (Item[]) readitems.values().toArray(new Item[0]));
|
||||
|
||||
} else {
|
||||
itemStatus = group.read(true, (Item[]) readitems.values().toArray(new Item[0]));
|
||||
}
|
||||
Set<Item> items = itemStatus.keySet();
|
||||
Iterator var15 = items.iterator();
|
||||
while (var15.hasNext()) {
|
||||
Item item = (Item) var15.next();
|
||||
ItemState itemState = (ItemState) itemStatus.get(item);
|
||||
Object value = OpcUtl.getValue(item, itemState);
|
||||
read.put(item.getId(), value);
|
||||
}
|
||||
|
||||
Iterator var24 = itemsString.iterator();
|
||||
|
||||
while (var24.hasNext()) {
|
||||
String itemString = (String) var24.next();
|
||||
if (!ObjectUtl.isEquals(String.valueOf(itemValues.get(itemString)), String.valueOf(read.get(itemString)))) {
|
||||
check = false;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
check = false;
|
||||
}
|
||||
|
||||
if (check) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (i > 0) {
|
||||
ThreadUtl.sleep(100L);
|
||||
}
|
||||
|
||||
if (i >= 3) {
|
||||
// log.info("写入次数超过3次而失败");
|
||||
throw new RuntimeException("写入次数超过3次而失败");
|
||||
}
|
||||
++i;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
check = false;
|
||||
Thread.currentThread().interrupt();
|
||||
throw new IllegalStateException("Interrupted", e);
|
||||
}
|
||||
|
||||
if (check) {
|
||||
return;
|
||||
});
|
||||
try {
|
||||
String result = future.get(2, TimeUnit.SECONDS); // 设置超时时间为2秒
|
||||
System.out.println(result);
|
||||
} catch (CompletionException e) {
|
||||
Throwable cause = e.getCause();
|
||||
if (cause instanceof TimeoutException) {
|
||||
System.out.println("Operation timed out");
|
||||
} else {
|
||||
throw e; // rethrow other exceptions
|
||||
}
|
||||
|
||||
if (i > 0) {
|
||||
ThreadUtl.sleep(100L);
|
||||
}
|
||||
|
||||
if (i >= 3) {
|
||||
// log.info("写入次数超过3次而失败");
|
||||
throw new RuntimeException("写入次数超过3次而失败");
|
||||
}
|
||||
++i;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean controlByNewConn(Map<String, Object> itemValues) {
|
||||
public boolean controlByNewConn (Map < String, Object > itemValues){
|
||||
|
||||
Iterator<Map.Entry<String, Object>> it = itemValues.entrySet().iterator();
|
||||
Iterator<Map.Entry<String, Object>> it = itemValues.entrySet().iterator();
|
||||
|
||||
ItemValue[] p2;
|
||||
p2 = new ItemValue[itemValues.size()];
|
||||
int i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<String, Object> entry = it.next();
|
||||
System.out.println("即将写入值:" + entry.getKey() + ":" + entry.getValue());
|
||||
p2[i] = new ItemValue();
|
||||
p2[i].setItem_code(entry.getKey());
|
||||
p2[i].setItem_value(entry.getValue());
|
||||
i++;
|
||||
}
|
||||
|
||||
return this.controlByNewConn(p2);
|
||||
}
|
||||
|
||||
public boolean control(Map<String, Object> itemValues) {
|
||||
|
||||
Iterator<Map.Entry<String, Object>> it = itemValues.entrySet().iterator();
|
||||
|
||||
ItemValue[] p2;
|
||||
p2 = new ItemValue[itemValues.size()];
|
||||
int i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<String, Object> entry = it.next();
|
||||
System.out.println("即将写入值:" + entry.getKey() + ":" + entry.getValue());
|
||||
p2[i] = new ItemValue();
|
||||
p2[i].setItem_code(entry.getKey());
|
||||
p2[i].setItem_value(entry.getValue());
|
||||
i++;
|
||||
}
|
||||
|
||||
return this.control(p2);
|
||||
}
|
||||
|
||||
|
||||
public boolean control(ItemValue[] itemValues) {
|
||||
if (itemValues != null && itemValues.length != 0) {
|
||||
String this_items = JsonUtl.parseWithoutException(itemValues);
|
||||
boolean need_write = false;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
ItemValue[] var5 = itemValues;
|
||||
int var6 = itemValues.length;
|
||||
|
||||
for (int var7 = 0; var7 < var6; ++var7) {
|
||||
ItemValue itemValue = var5[var7];
|
||||
String code = itemValue.getItem_code();
|
||||
Object udw_value = this.getUdwValue(code);
|
||||
Object write_value = itemValue.getItem_value();
|
||||
sb.append(code);
|
||||
sb.append(":");
|
||||
sb.append(JsonUtl.parseWithoutException(udw_value));
|
||||
sb.append(";");
|
||||
if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) {
|
||||
need_write = true;
|
||||
} else {
|
||||
//log.warn("下发信号点位{} 当前写入值:{} 与系统内存值:{} 相同,不再写入 ", code, write_value, udw_value );
|
||||
ItemValue[] p2;
|
||||
p2 = new ItemValue[itemValues.size()];
|
||||
int i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<String, Object> entry = it.next();
|
||||
System.out.println("即将写入值:" + entry.getKey() + ":" + entry.getValue());
|
||||
p2[i] = new ItemValue();
|
||||
p2[i].setItem_code(entry.getKey());
|
||||
p2[i].setItem_value(entry.getValue());
|
||||
i++;
|
||||
}
|
||||
}
|
||||
// need_write = true;
|
||||
|
||||
if (need_write) {
|
||||
Date date = new Date();
|
||||
return this.controlByNewConn(p2);
|
||||
}
|
||||
|
||||
public boolean control (Map < String, Object > itemValues){
|
||||
|
||||
Iterator<Map.Entry<String, Object>> it = itemValues.entrySet().iterator();
|
||||
|
||||
ItemValue[] p2;
|
||||
p2 = new ItemValue[itemValues.size()];
|
||||
int i = 0;
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<String, Object> entry = it.next();
|
||||
System.out.println("即将写入值:" + entry.getKey() + ":" + entry.getValue());
|
||||
p2[i] = new ItemValue();
|
||||
p2[i].setItem_code(entry.getKey());
|
||||
p2[i].setItem_value(entry.getValue());
|
||||
i++;
|
||||
}
|
||||
|
||||
return this.control(p2);
|
||||
}
|
||||
|
||||
|
||||
public boolean control (ItemValue[]itemValues){
|
||||
if (itemValues != null && itemValues.length != 0) {
|
||||
String this_items = JsonUtl.parseWithoutException(itemValues);
|
||||
boolean need_write = false;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
ItemValue[] var5 = itemValues;
|
||||
int var6 = itemValues.length;
|
||||
|
||||
for (int var7 = 0; var7 < var6; ++var7) {
|
||||
ItemValue itemValue = var5[var7];
|
||||
String code = itemValue.getItem_code();
|
||||
Object udw_value = this.getUdwValue(code);
|
||||
Object write_value = itemValue.getItem_value();
|
||||
sb.append(code);
|
||||
sb.append(":");
|
||||
sb.append(JsonUtl.parseWithoutException(udw_value));
|
||||
sb.append(";");
|
||||
if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) {
|
||||
need_write = true;
|
||||
} else {
|
||||
//log.warn("下发信号点位{} 当前写入值:{} 与系统内存值:{} 相同,不再写入 ", code, write_value, udw_value );
|
||||
}
|
||||
}
|
||||
// need_write = true;
|
||||
|
||||
if (need_write) {
|
||||
Date date = new Date();
|
||||
/*if (StringUtl.isEqual(this_items, this.last_items) && date.getTime() - this.sendTime.getTime() < (long) WcsConfig.opc_write_repeat_check) {
|
||||
log.trace("发送时间因为小于{}毫秒,而被无视", WcsConfig.opc_write_repeat_check);
|
||||
return false;
|
||||
}*/
|
||||
|
||||
this.last_items = this_items;
|
||||
this.sendTime = date;
|
||||
this.last_items = this_items;
|
||||
this.sendTime = date;
|
||||
/* this.execute_log.setResource(this.getDevice().getCode(), this.getDevice().getName());
|
||||
this.execute_log.log("原始记录{}->变更为{}", new Object[]{sb, this_items});
|
||||
OpcServerService opcServerService = OpcServerFactory.getOpcServerService();*/
|
||||
|
||||
OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class);
|
||||
OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class);
|
||||
|
||||
opcServerService.writeInteger(this.getOpcServer(), itemValues);
|
||||
UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor();
|
||||
ItemValue[] var17 = itemValues;
|
||||
int var18 = itemValues.length;
|
||||
opcServerService.writeInteger(this.getOpcServer(), itemValues);
|
||||
UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor();
|
||||
ItemValue[] var17 = itemValues;
|
||||
int var18 = itemValues.length;
|
||||
|
||||
for (int var19 = 0; var19 < var18; ++var19) {
|
||||
ItemValue itemValue = var17[var19];
|
||||
String code = itemValue.getItem_code();
|
||||
Object value = itemValue.getItem_value();
|
||||
opcValueAccessor.setValue(code, value);
|
||||
for (int var19 = 0; var19 < var18; ++var19) {
|
||||
ItemValue itemValue = var17[var19];
|
||||
String code = itemValue.getItem_code();
|
||||
Object value = itemValue.getItem_value();
|
||||
opcValueAccessor.setValue(code, value);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
throw new RuntimeException("下发 无内容");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
throw new RuntimeException("下发 无内容");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public boolean controlByNewConn(ItemValue[] itemValues) {
|
||||
if (itemValues != null && itemValues.length != 0) {
|
||||
String this_items = JsonUtl.parseWithoutException(itemValues);
|
||||
boolean need_write = false;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
ItemValue[] var5 = itemValues;
|
||||
int var6 = itemValues.length;
|
||||
public boolean controlByNewConn (ItemValue[]itemValues){
|
||||
if (itemValues != null && itemValues.length != 0) {
|
||||
String this_items = JsonUtl.parseWithoutException(itemValues);
|
||||
boolean need_write = false;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
ItemValue[] var5 = itemValues;
|
||||
int var6 = itemValues.length;
|
||||
// for (int var7 = 0; var7 < var6; ++var7) {
|
||||
// ItemValue itemValue = var5[var7];
|
||||
// String code = itemValue.getItem_code();
|
||||
@@ -245,36 +271,36 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
|
||||
// log.warn("下发信号点位{} 当前写入值:{} 与系统内存值:{} 相同,不再写入 ", code, write_value, udw_value );
|
||||
// }
|
||||
// }
|
||||
need_write = true;
|
||||
if (need_write) {
|
||||
Date date = new Date();
|
||||
need_write = true;
|
||||
if (need_write) {
|
||||
Date date = new Date();
|
||||
/*if (StringUtl.isEqual(this_items, this.last_items) && date.getTime() - this.sendTime.getTime() < (long) WcsConfig.opc_write_repeat_check) {
|
||||
log.trace("发送时间因为小于{}毫秒,而被无视", WcsConfig.opc_write_repeat_check);
|
||||
return false;
|
||||
}*/
|
||||
|
||||
this.last_items = this_items;
|
||||
this.sendTime = date;
|
||||
OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class);
|
||||
this.last_items = this_items;
|
||||
this.sendTime = date;
|
||||
OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class);
|
||||
|
||||
opcServerService.writeIntegerByNewConn(this.getOpcServer(), itemValues);
|
||||
opcServerService.writeIntegerByNewConn(this.getOpcServer(), itemValues);
|
||||
|
||||
|
||||
UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor();
|
||||
ItemValue[] var17 = itemValues;
|
||||
int var18 = itemValues.length;
|
||||
UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor();
|
||||
ItemValue[] var17 = itemValues;
|
||||
int var18 = itemValues.length;
|
||||
|
||||
for (int var19 = 0; var19 < var18; ++var19) {
|
||||
ItemValue itemValue = var17[var19];
|
||||
String code = itemValue.getItem_code();
|
||||
Object value = itemValue.getItem_value();
|
||||
opcValueAccessor.setValue(code, value);
|
||||
for (int var19 = 0; var19 < var18; ++var19) {
|
||||
ItemValue itemValue = var17[var19];
|
||||
String code = itemValue.getItem_code();
|
||||
Object value = itemValue.getItem_value();
|
||||
opcValueAccessor.setValue(code, value);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
throw new RuntimeException("下发 无内容");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} else {
|
||||
throw new RuntimeException("下发 无内容");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,30 +229,6 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
|
||||
log.debug("设备运转模式:等待工作");
|
||||
break;
|
||||
case 2:
|
||||
//申请任务
|
||||
if (move > 0 && task == 0 && !requireSucess) {
|
||||
instruction_require();
|
||||
}else {
|
||||
String remark = "";
|
||||
;
|
||||
if (mode != 2) {
|
||||
remark = "universal_remark2";
|
||||
}
|
||||
if (move != 0) {
|
||||
remark = "universal_remark3";
|
||||
}
|
||||
if (task != 0) {
|
||||
remark = "universal_remark4";
|
||||
if (ObjectUtil.isNotEmpty(this.inst)) {
|
||||
this.inst = null;
|
||||
}
|
||||
}
|
||||
if (requireSucess) {
|
||||
remark = "universal_remark5";
|
||||
}
|
||||
this.setNotCreateInstMessage(remark);
|
||||
//}
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
if ( StrUtil.isEmpty(material_barcode)) {
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.device_driver.led.led_screen.LedScreenDeviceDriver;
|
||||
import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.InteractionJsonDTO;
|
||||
import org.nl.acs.device_driver.stacker.standard_stacker.StandardStackerDeviceDriver;
|
||||
import org.nl.acs.device_driver.two_conveyor.manipulator_agv_station.ManipulatorAgvStationDeviceDriver;
|
||||
import org.nl.acs.enums.StorageTypeEnum;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.history.ErrorUtil;
|
||||
@@ -298,9 +299,9 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
List toInstructions;
|
||||
//木箱入库申请入库任务
|
||||
if (mode == 6 && !requireSucess) {
|
||||
if (StrUtil.isEmpty(barcode)||StrUtil.isEmpty(material_barcode)) {
|
||||
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
|
||||
message = "托盘条码为空、或者子卷码为空";
|
||||
}else {
|
||||
} else {
|
||||
applyIn(StorageTypeEnum.BOX_IN.getType(), mode);
|
||||
}
|
||||
|
||||
@@ -310,7 +311,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
if (mode == 7 && move == 1 && !requireSucess) {
|
||||
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
|
||||
message = "托盘条码为空、或者子卷码为空";
|
||||
}else {
|
||||
} else {
|
||||
applyIn(StorageTypeEnum.STORAGE.getType(), mode);
|
||||
}
|
||||
|
||||
@@ -321,7 +322,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
if (mode == 9 && move == 1 && !requireSucess) {
|
||||
if (container_type == 0 || StrUtil.isEmpty(barcode)) {
|
||||
message = "托盘类型为空";
|
||||
}else {
|
||||
} else {
|
||||
applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode);
|
||||
}
|
||||
}
|
||||
@@ -330,7 +331,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
if (mode == 18 && move == 1 && !requireSucess) {
|
||||
if (StrUtil.isEmpty(barcode)) {
|
||||
message = "托盘条码为空";
|
||||
}else {
|
||||
} else {
|
||||
applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode);
|
||||
}
|
||||
|
||||
@@ -339,7 +340,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
if (mode == 23 && !requireSucess) {
|
||||
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
|
||||
message = "条码为空";
|
||||
}else {
|
||||
} else {
|
||||
applyErrorHeight();
|
||||
}
|
||||
|
||||
@@ -406,7 +407,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
if (StrUtil.isNotEmpty(hand_barcode)) {
|
||||
param.put("vehicle_code", hand_barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(barcode)&&(barcode.startsWith("A")||barcode.startsWith("B"))) {
|
||||
if (StrUtil.isNotEmpty(barcode) && (barcode.startsWith("A") || barcode.startsWith("B"))) {
|
||||
param.put("vehicle_code", barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(material_barcode)) {
|
||||
@@ -473,7 +474,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
if (StrUtil.isNotEmpty(hand_barcode)) {
|
||||
param.put("vehicle_code", hand_barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(barcode)&&(barcode.startsWith("A")||barcode.startsWith("B"))) {
|
||||
if (StrUtil.isNotEmpty(barcode) && (barcode.startsWith("A") || barcode.startsWith("B"))) {
|
||||
param.put("vehicle_code", barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(material_barcode)) {
|
||||
@@ -589,7 +590,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
if (StrUtil.isNotEmpty(hand_barcode)) {
|
||||
param.put("vehicle_code", hand_barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(barcode)&&(barcode.startsWith("A")||barcode.startsWith("B"))) {
|
||||
if (StrUtil.isNotEmpty(barcode) && (barcode.startsWith("A") || barcode.startsWith("B"))) {
|
||||
param.put("vehicle_code", barcode);
|
||||
}
|
||||
param.put("type", type);
|
||||
@@ -645,7 +646,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
if (StrUtil.isNotEmpty(hand_barcode)) {
|
||||
param.put("vehicle_code", hand_barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(barcode)&&(barcode.startsWith("A")||barcode.startsWith("B"))) {
|
||||
if (StrUtil.isNotEmpty(barcode) && (barcode.startsWith("A") || barcode.startsWith("B"))) {
|
||||
param.put("vehicle_code", barcode);
|
||||
}
|
||||
if (StrUtil.isNotEmpty(material_barcode)) {
|
||||
@@ -654,7 +655,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
if (StrUtil.isNotEmpty(hand_material_barcode)) {
|
||||
param.put("material_barcode", hand_material_barcode);
|
||||
}
|
||||
if (mode == 7 && weight != 0){
|
||||
if (mode == 7 && weight != 0) {
|
||||
param.put("weight", weight);
|
||||
}
|
||||
param.put("type", type);
|
||||
@@ -796,21 +797,32 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
|
||||
//判断有无出入库任务是相同路线
|
||||
//判断有没有DDJ对接位出入库的指令
|
||||
List<Instruction> byCodeAndExcute = instructionService.findByCodeAndExcute(next_device_code);
|
||||
if (CollUtil.isNotEmpty(byCodeAndExcute)){
|
||||
Iterator<Instruction> iterator = byCodeAndExcute.iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Instruction instruction = iterator.next();
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(instruction.getNext_device_code());
|
||||
if (StrUtil.equals(nextDevice.getDevice_type(), DeviceType.storage.name())){
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(byCodeAndExcute)){
|
||||
this.message="有DDJ对接位出入库的指令";
|
||||
if (CollUtil.isNotEmpty(byCodeAndExcute)) {
|
||||
this.message = "有DDJ对接位出入库的指令";
|
||||
requireSucess = false;
|
||||
return true;
|
||||
}
|
||||
Device nextDevice = deviceAppService.findDeviceByCode(next_device_code);
|
||||
BeltConveyorDeviceDriver beltConveyorDeviceDriver;
|
||||
if (nextDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||
beltConveyorDeviceDriver = (BeltConveyorDeviceDriver) nextDevice.getDeviceDriver();
|
||||
//判断对接位和关联站点光电信号
|
||||
getDeviceCodeList = beltConveyorDeviceDriver.getExtraDeviceCodes("link_device_code");
|
||||
if (CollUtil.isNotEmpty(getDeviceCodeList)) {
|
||||
String linkDeviceCode = getDeviceCodeList.get(0);
|
||||
Device linkDevice = deviceAppService.findDeviceByCode(linkDeviceCode);
|
||||
BeltConveyorDeviceDriver linkDeviceDriver;
|
||||
if (linkDevice.getDeviceDriver() instanceof BeltConveyorDeviceDriver) {
|
||||
linkDeviceDriver = (BeltConveyorDeviceDriver) linkDevice.getDeviceDriver();
|
||||
if ((beltConveyorDeviceDriver.getMode() == 0 || beltConveyorDeviceDriver.getMove() == 1) && (linkDeviceDriver.getMode() == 0 || linkDeviceDriver.getMove() == 1)) {
|
||||
this.message = "DDJ对接位或关联输送线存在正在移动的货物或者未联机";
|
||||
requireSucess = false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
TaskDto dto = taskserver.findByCodeAndExcute(taskdto.getNext_device_code(), taskdto.getStart_device_code());
|
||||
if (ObjectUtil.isNotEmpty(dto)) {
|
||||
requireSucess = false;
|
||||
|
||||
@@ -133,6 +133,8 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
||||
//行架机械手申请任务成功标识
|
||||
boolean requireSucess = false;
|
||||
|
||||
//行架请求动作标识
|
||||
boolean actionRequireSucess = false;
|
||||
private int instruction_finished_time_out;
|
||||
|
||||
int branchProtocol = 0;
|
||||
@@ -185,9 +187,12 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
||||
to_type = this.itemProtocol.getTo_type();
|
||||
|
||||
if (mode != last_mode) {
|
||||
|
||||
requireSucess = false;
|
||||
}
|
||||
|
||||
if (action != last_action) {
|
||||
actionRequireSucess = false;
|
||||
}
|
||||
// 更新指令状态
|
||||
if (mode == 3 && task > 0) {
|
||||
if (null!=inst) {
|
||||
@@ -196,13 +201,13 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
||||
updateInstructionStatus();
|
||||
}
|
||||
//四个点行架任务,满轴放货完成后调lms生成rgv任务
|
||||
if (action == 6 && task > 0 ){
|
||||
if (action == 6 && task > 0 && !actionRequireSucess ){
|
||||
Integer actionType = ActionTypeEnum.RELEASE_FINISHING.getCode();
|
||||
creatAGV(actionType,action);
|
||||
}
|
||||
|
||||
//空载具取货完成
|
||||
if (action == 7 && task > 0 ){
|
||||
if (action == 7 && task > 0 && !actionRequireSucess ){
|
||||
Integer actionType = ActionTypeEnum.IN_FINISHING.getCode();
|
||||
creatAGV(actionType, action);
|
||||
}
|
||||
@@ -304,7 +309,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
|
||||
map1.put("value", toCommand);
|
||||
list.add(map1);
|
||||
this.writing(list);
|
||||
|
||||
this.actionRequireSucess = true;
|
||||
} else {
|
||||
LuceneLogDto logDto2 = LuceneLogDto.builder()
|
||||
.device_code(device_code)
|
||||
|
||||
@@ -833,9 +833,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
|
||||
map4.put("value", "0");
|
||||
list.add(map4);
|
||||
Map map5 = new HashMap<>();
|
||||
map4.put("code", "to_task");
|
||||
map4.put("value", "0");
|
||||
list.add(map4);
|
||||
map5.put("code", "to_task");
|
||||
map5.put("value", "0");
|
||||
list.add(map5);
|
||||
|
||||
this.writing(list);
|
||||
message = null;
|
||||
|
||||
@@ -1949,7 +1949,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
|
||||
@Override
|
||||
public List<Instruction> findByCodeAndExcute(String next_code) {
|
||||
List<Instruction> instructionList = instructions.stream().filter(item -> item.getNext_device_code().equals(next_code) || item.getStart_device_code().equals(next_code)).collect(Collectors.toList());
|
||||
List<Instruction> instructionList = instructions.stream().filter(item -> item.getNext_device_code().equals(next_code) ).collect(Collectors.toList());
|
||||
|
||||
return instructionList;
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
|
||||
if (!UnifiedDataAppService.isEquals(value, his)) {
|
||||
OpcItemDto itemDto = this.getItem(itemId);
|
||||
if (true) {
|
||||
this.logItemChanged(itemId, accessor_value, value, itemDto);
|
||||
// this.logItemChanged(itemId, accessor_value, value, itemDto);
|
||||
}
|
||||
if(!ObjectUtil.isEmpty(value) || "".equals(value)){
|
||||
accessor_value.setValue(itemId, value);
|
||||
@@ -416,7 +416,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
|
||||
sb.append("key:" + relate + "value:" + obj + ";");
|
||||
}
|
||||
if (!itemDto.getItem_code().endsWith("heartbeat") && !itemDto.getItem_code().endsWith("time") && !itemDto.getItem_code().endsWith("consumption")
|
||||
&& !itemDto.getItem_code().endsWith("x") && !itemDto.getItem_code().endsWith("y")) {
|
||||
&& !itemDto.getItem_code().endsWith("x") && !itemDto.getItem_code().endsWith("y")) {
|
||||
// 存在上次点位值为null情况 则不记录日志
|
||||
if(!(his instanceof Float) && !(value instanceof Float)){
|
||||
LuceneLogDto luceneLogDto = new LuceneLogDto(itemDto.getOpc_server_code(), itemDto.getOpc_plc_code(),4, itemDto.getDevice_code(), itemDto.getItem_code().substring(itemDto.getItem_code().lastIndexOf(".") + 1),
|
||||
|
||||
Reference in New Issue
Block a user