fix: 扫描码位生成指令优化、内包间优化、写信号优化、lucence注解

This commit is contained in:
2024-07-14 17:15:45 +08:00
parent bd0177895e
commit 484cfacee6
9 changed files with 276 additions and 239 deletions

View File

@@ -50,7 +50,7 @@ public class AgvWaitUtil {
ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver; ManipulatorAgvStationDeviceDriver manipulatorAgvStationDeviceDriver;
BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver; BoxSubvolumesConveyorDeviceDriver boxSubvolumesConveyorDeviceDriver;
//agv诺宝对接位安全信号交互 //agv诺宝对接位安全信号交互
if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) { if (startDevice.getDeviceDriver() instanceof ManipulatorAgvStationDeviceDriver) {
manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver(); manipulatorAgvStationDeviceDriver = (ManipulatorAgvStationDeviceDriver) startDevice.getDeviceDriver();
if (manipulatorAgvStationDeviceDriver.getTo_command() != 2) { if (manipulatorAgvStationDeviceDriver.getTo_command() != 2) {
manipulatorAgvStationDeviceDriver.writing(2); manipulatorAgvStationDeviceDriver.writing(2);

View File

@@ -11,6 +11,10 @@ import org.openscada.opc.lib.da.ItemState;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import java.util.*; 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 { public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements OpcDeviceDriver {
UnifiedDataAccessor opcUdw; UnifiedDataAccessor opcUdw;
@@ -35,201 +39,223 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
public void checkcontrol(Map<String, Object> itemValues) throws Exception { 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()) { CompletableFuture<String> future = CompletableFuture.supplyAsync(() -> {
String string = (String) is.next();
try { try {
readitems.put(string, group.addItem(string)); Group group = opcServerService.getServer(this.getOpcServer());
} catch (Exception e) { Map<String, Object> write = new HashMap();
e.printStackTrace(); Map<String, Item> readitems = new LinkedHashMap();
} List<String> itemsString = new ArrayList();
} itemsString = new ArrayList<>(itemValues.keySet());
int i = 0; Iterator is = itemsString.iterator();
while (true) {
//下发信号
try {
if (i == 0) {
control(itemValues);
} else {
controlByNewConn(itemValues);
}
} catch (Exception e) { while (is.hasNext()) {
e.printStackTrace(); String string = (String) is.next();
} try {
Map<String, Object> read = new HashMap(); readitems.put(string, group.addItem(string));
Map<Item, ItemState> itemStatus = null; } catch (Exception e) {
boolean check = true; e.printStackTrace();
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);
} }
int i = 0;
while (true) {
//下发信号
Iterator var24 = itemsString.iterator(); try {
if (i == 0) {
control(itemValues);
} else {
controlByNewConn(itemValues);
}
while (var24.hasNext()) { } catch (Exception e) {
String itemString = (String) var24.next(); e.printStackTrace();
if (!ObjectUtl.isEquals(String.valueOf(itemValues.get(itemString)), String.valueOf(read.get(itemString)))) { }
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; 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) { } catch (Exception e) {
e.printStackTrace(); Thread.currentThread().interrupt();
check = false; throw new IllegalStateException("Interrupted", e);
} }
});
if (check) { try {
return; 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
} }
} catch (Exception e) {
if (i > 0) { throw new RuntimeException(e);
ThreadUtl.sleep(100L);
}
if (i >= 3) {
// log.info("写入次数超过3次而失败");
throw new RuntimeException("写入次数超过3次而失败");
}
++i;
} }
} }
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; ItemValue[] p2;
p2 = new ItemValue[itemValues.size()]; p2 = new ItemValue[itemValues.size()];
int i = 0; int i = 0;
while (it.hasNext()) { while (it.hasNext()) {
Map.Entry<String, Object> entry = it.next(); Map.Entry<String, Object> entry = it.next();
System.out.println("即将写入值:" + entry.getKey() + ":" + entry.getValue()); System.out.println("即将写入值:" + entry.getKey() + ":" + entry.getValue());
p2[i] = new ItemValue(); p2[i] = new ItemValue();
p2[i].setItem_code(entry.getKey()); p2[i].setItem_code(entry.getKey());
p2[i].setItem_value(entry.getValue()); p2[i].setItem_value(entry.getValue());
i++; 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 );
} }
}
// need_write = true;
if (need_write) { return this.controlByNewConn(p2);
Date date = new Date(); }
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) { /*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); log.trace("发送时间因为小于{}毫秒,而被无视", WcsConfig.opc_write_repeat_check);
return false; return false;
}*/ }*/
this.last_items = this_items; this.last_items = this_items;
this.sendTime = date; this.sendTime = date;
/* this.execute_log.setResource(this.getDevice().getCode(), this.getDevice().getName()); /* this.execute_log.setResource(this.getDevice().getCode(), this.getDevice().getName());
this.execute_log.log("原始记录{}->变更为{}", new Object[]{sb, this_items}); this.execute_log.log("原始记录{}->变更为{}", new Object[]{sb, this_items});
OpcServerService opcServerService = OpcServerFactory.getOpcServerService();*/ OpcServerService opcServerService = OpcServerFactory.getOpcServerService();*/
OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class); OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class);
opcServerService.writeInteger(this.getOpcServer(), itemValues); opcServerService.writeInteger(this.getOpcServer(), itemValues);
UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor(); UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor();
ItemValue[] var17 = itemValues; ItemValue[] var17 = itemValues;
int var18 = itemValues.length; int var18 = itemValues.length;
for (int var19 = 0; var19 < var18; ++var19) { for (int var19 = 0; var19 < var18; ++var19) {
ItemValue itemValue = var17[var19]; ItemValue itemValue = var17[var19];
String code = itemValue.getItem_code(); String code = itemValue.getItem_code();
Object value = itemValue.getItem_value(); Object value = itemValue.getItem_value();
opcValueAccessor.setValue(code, value); opcValueAccessor.setValue(code, value);
}
}
return true;
} else {
throw new RuntimeException("下发 无内容");
} }
} }
return true;
} else {
throw new RuntimeException("下发 无内容");
}
}
public boolean controlByNewConn (ItemValue[]itemValues){
public boolean controlByNewConn(ItemValue[] itemValues) { if (itemValues != null && itemValues.length != 0) {
if (itemValues != null && itemValues.length != 0) { String this_items = JsonUtl.parseWithoutException(itemValues);
String this_items = JsonUtl.parseWithoutException(itemValues); boolean need_write = false;
boolean need_write = false; StringBuilder sb = new StringBuilder();
StringBuilder sb = new StringBuilder(); ItemValue[] var5 = itemValues;
ItemValue[] var5 = itemValues; int var6 = itemValues.length;
int var6 = itemValues.length;
// for (int var7 = 0; var7 < var6; ++var7) { // for (int var7 = 0; var7 < var6; ++var7) {
// ItemValue itemValue = var5[var7]; // ItemValue itemValue = var5[var7];
// String code = itemValue.getItem_code(); // String code = itemValue.getItem_code();
@@ -245,36 +271,36 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
// log.warn("下发信号点位{} 当前写入值:{} 与系统内存值:{} 相同,不再写入 ", code, write_value, udw_value ); // log.warn("下发信号点位{} 当前写入值:{} 与系统内存值:{} 相同,不再写入 ", code, write_value, udw_value );
// } // }
// } // }
need_write = true; need_write = true;
if (need_write) { if (need_write) {
Date date = new Date(); Date date = new Date();
/*if (StringUtl.isEqual(this_items, this.last_items) && date.getTime() - this.sendTime.getTime() < (long) WcsConfig.opc_write_repeat_check) { /*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); log.trace("发送时间因为小于{}毫秒,而被无视", WcsConfig.opc_write_repeat_check);
return false; return false;
}*/ }*/
this.last_items = this_items; this.last_items = this_items;
this.sendTime = date; this.sendTime = date;
OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class); OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class);
opcServerService.writeIntegerByNewConn(this.getOpcServer(), itemValues); opcServerService.writeIntegerByNewConn(this.getOpcServer(), itemValues);
UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor(); UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor();
ItemValue[] var17 = itemValues; ItemValue[] var17 = itemValues;
int var18 = itemValues.length; int var18 = itemValues.length;
for (int var19 = 0; var19 < var18; ++var19) { for (int var19 = 0; var19 < var18; ++var19) {
ItemValue itemValue = var17[var19]; ItemValue itemValue = var17[var19];
String code = itemValue.getItem_code(); String code = itemValue.getItem_code();
Object value = itemValue.getItem_value(); Object value = itemValue.getItem_value();
opcValueAccessor.setValue(code, value); opcValueAccessor.setValue(code, value);
}
}
return true;
} else {
throw new RuntimeException("下发 无内容");
} }
} }
return true;
} else {
throw new RuntimeException("下发 无内容");
} }
}
}

View File

@@ -229,30 +229,6 @@ public class BoxStorageOutConveyorDeviceDriver extends AbstractOpcDeviceDriver i
log.debug("设备运转模式:等待工作"); log.debug("设备运转模式:等待工作");
break; break;
case 2: 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; break;
case 25: case 25:
if ( StrUtil.isEmpty(material_barcode)) { if ( StrUtil.isEmpty(material_barcode)) {

View File

@@ -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.led.led_screen.LedScreenDeviceDriver;
import org.nl.acs.device_driver.one_manipulator.box_package_manipulator.InteractionJsonDTO; 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.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.enums.StorageTypeEnum;
import org.nl.acs.ext.wms.service.AcsToWmsService; import org.nl.acs.ext.wms.service.AcsToWmsService;
import org.nl.acs.history.ErrorUtil; import org.nl.acs.history.ErrorUtil;
@@ -298,9 +299,9 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
List toInstructions; List toInstructions;
//木箱入库申请入库任务 //木箱入库申请入库任务
if (mode == 6 && !requireSucess) { if (mode == 6 && !requireSucess) {
if (StrUtil.isEmpty(barcode)||StrUtil.isEmpty(material_barcode)) { if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
message = "托盘条码为空、或者子卷码为空"; message = "托盘条码为空、或者子卷码为空";
}else { } else {
applyIn(StorageTypeEnum.BOX_IN.getType(), mode); applyIn(StorageTypeEnum.BOX_IN.getType(), mode);
} }
@@ -310,7 +311,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (mode == 7 && move == 1 && !requireSucess) { if (mode == 7 && move == 1 && !requireSucess) {
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) { if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
message = "托盘条码为空、或者子卷码为空"; message = "托盘条码为空、或者子卷码为空";
}else { } else {
applyIn(StorageTypeEnum.STORAGE.getType(), mode); applyIn(StorageTypeEnum.STORAGE.getType(), mode);
} }
@@ -321,7 +322,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (mode == 9 && move == 1 && !requireSucess) { if (mode == 9 && move == 1 && !requireSucess) {
if (container_type == 0 || StrUtil.isEmpty(barcode)) { if (container_type == 0 || StrUtil.isEmpty(barcode)) {
message = "托盘类型为空"; message = "托盘类型为空";
}else { } else {
applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode); applyEmptyTask(StorageTypeEnum.DISKS_IN.getType(), mode);
} }
} }
@@ -330,7 +331,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (mode == 18 && move == 1 && !requireSucess) { if (mode == 18 && move == 1 && !requireSucess) {
if (StrUtil.isEmpty(barcode)) { if (StrUtil.isEmpty(barcode)) {
message = "托盘条码为空"; message = "托盘条码为空";
}else { } else {
applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode); applyBoxReturnTask(StorageTypeEnum.BOX_RETURN.getType(), mode);
} }
@@ -339,7 +340,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (mode == 23 && !requireSucess) { if (mode == 23 && !requireSucess) {
if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) { if (StrUtil.isEmpty(barcode) || StrUtil.isEmpty(material_barcode)) {
message = "条码为空"; message = "条码为空";
}else { } else {
applyErrorHeight(); applyErrorHeight();
} }
@@ -406,7 +407,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (StrUtil.isNotEmpty(hand_barcode)) { if (StrUtil.isNotEmpty(hand_barcode)) {
param.put("vehicle_code", 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("vehicle_code", barcode);
} }
if (StrUtil.isNotEmpty(material_barcode)) { if (StrUtil.isNotEmpty(material_barcode)) {
@@ -473,7 +474,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (StrUtil.isNotEmpty(hand_barcode)) { if (StrUtil.isNotEmpty(hand_barcode)) {
param.put("vehicle_code", 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("vehicle_code", barcode);
} }
if (StrUtil.isNotEmpty(material_barcode)) { if (StrUtil.isNotEmpty(material_barcode)) {
@@ -589,7 +590,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (StrUtil.isNotEmpty(hand_barcode)) { if (StrUtil.isNotEmpty(hand_barcode)) {
param.put("vehicle_code", 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("vehicle_code", barcode);
} }
param.put("type", type); param.put("type", type);
@@ -645,7 +646,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (StrUtil.isNotEmpty(hand_barcode)) { if (StrUtil.isNotEmpty(hand_barcode)) {
param.put("vehicle_code", 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("vehicle_code", barcode);
} }
if (StrUtil.isNotEmpty(material_barcode)) { if (StrUtil.isNotEmpty(material_barcode)) {
@@ -654,7 +655,7 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
if (StrUtil.isNotEmpty(hand_material_barcode)) { if (StrUtil.isNotEmpty(hand_material_barcode)) {
param.put("material_barcode", 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("weight", weight);
} }
param.put("type", type); param.put("type", type);
@@ -796,21 +797,32 @@ public class ConveyorWithScannerWeightDeviceDriver extends AbstractOpcDeviceDriv
//判断有无出入库任务是相同路线 //判断有无出入库任务是相同路线
//判断有没有DDJ对接位出入库的指令 //判断有没有DDJ对接位出入库的指令
List<Instruction> byCodeAndExcute = instructionService.findByCodeAndExcute(next_device_code); List<Instruction> byCodeAndExcute = instructionService.findByCodeAndExcute(next_device_code);
if (CollUtil.isNotEmpty(byCodeAndExcute)){ if (CollUtil.isNotEmpty(byCodeAndExcute)) {
Iterator<Instruction> iterator = byCodeAndExcute.iterator(); this.message = "有DDJ对接位出入库的指令";
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对接位出入库的指令";
requireSucess = false; requireSucess = false;
return true; 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()); TaskDto dto = taskserver.findByCodeAndExcute(taskdto.getNext_device_code(), taskdto.getStart_device_code());
if (ObjectUtil.isNotEmpty(dto)) { if (ObjectUtil.isNotEmpty(dto)) {
requireSucess = false; requireSucess = false;

View File

@@ -133,6 +133,8 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
//行架机械手申请任务成功标识 //行架机械手申请任务成功标识
boolean requireSucess = false; boolean requireSucess = false;
//行架请求动作标识
boolean actionRequireSucess = false;
private int instruction_finished_time_out; private int instruction_finished_time_out;
int branchProtocol = 0; int branchProtocol = 0;
@@ -185,9 +187,12 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
to_type = this.itemProtocol.getTo_type(); to_type = this.itemProtocol.getTo_type();
if (mode != last_mode) { if (mode != last_mode) {
requireSucess = false; requireSucess = false;
} }
if (action != last_action) {
actionRequireSucess = false;
}
// 更新指令状态 // 更新指令状态
if (mode == 3 && task > 0) { if (mode == 3 && task > 0) {
if (null!=inst) { if (null!=inst) {
@@ -196,13 +201,13 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
updateInstructionStatus(); updateInstructionStatus();
} }
//四个点行架任务满轴放货完成后调lms生成rgv任务 //四个点行架任务满轴放货完成后调lms生成rgv任务
if (action == 6 && task > 0 ){ if (action == 6 && task > 0 && !actionRequireSucess ){
Integer actionType = ActionTypeEnum.RELEASE_FINISHING.getCode(); Integer actionType = ActionTypeEnum.RELEASE_FINISHING.getCode();
creatAGV(actionType,action); creatAGV(actionType,action);
} }
//空载具取货完成 //空载具取货完成
if (action == 7 && task > 0 ){ if (action == 7 && task > 0 && !actionRequireSucess ){
Integer actionType = ActionTypeEnum.IN_FINISHING.getCode(); Integer actionType = ActionTypeEnum.IN_FINISHING.getCode();
creatAGV(actionType, action); creatAGV(actionType, action);
} }
@@ -304,7 +309,7 @@ public class VolumeTwoManipulatorManipulatorDeviceDriver extends AbstractOpcDevi
map1.put("value", toCommand); map1.put("value", toCommand);
list.add(map1); list.add(map1);
this.writing(list); this.writing(list);
this.actionRequireSucess = true;
} else { } else {
LuceneLogDto logDto2 = LuceneLogDto.builder() LuceneLogDto logDto2 = LuceneLogDto.builder()
.device_code(device_code) .device_code(device_code)

View File

@@ -833,9 +833,9 @@ public class StandardStackerDeviceDriver extends AbstractOpcDeviceDriver impleme
map4.put("value", "0"); map4.put("value", "0");
list.add(map4); list.add(map4);
Map map5 = new HashMap<>(); Map map5 = new HashMap<>();
map4.put("code", "to_task"); map5.put("code", "to_task");
map4.put("value", "0"); map5.put("value", "0");
list.add(map4); list.add(map5);
this.writing(list); this.writing(list);
message = null; message = null;

View File

@@ -1949,7 +1949,7 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
@Override @Override
public List<Instruction> findByCodeAndExcute(String next_code) { 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; return instructionList;
} }

View File

@@ -203,7 +203,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
if (!UnifiedDataAppService.isEquals(value, his)) { if (!UnifiedDataAppService.isEquals(value, his)) {
OpcItemDto itemDto = this.getItem(itemId); OpcItemDto itemDto = this.getItem(itemId);
if (true) { if (true) {
this.logItemChanged(itemId, accessor_value, value, itemDto); // this.logItemChanged(itemId, accessor_value, value, itemDto);
} }
if(!ObjectUtil.isEmpty(value) || "".equals(value)){ if(!ObjectUtil.isEmpty(value) || "".equals(value)){
accessor_value.setValue(itemId, value); accessor_value.setValue(itemId, value);
@@ -416,7 +416,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
sb.append("key:" + relate + "value:" + obj + ";"); sb.append("key:" + relate + "value:" + obj + ";");
} }
if (!itemDto.getItem_code().endsWith("heartbeat") && !itemDto.getItem_code().endsWith("time") && !itemDto.getItem_code().endsWith("consumption") 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情况 则不记录日志 // 存在上次点位值为null情况 则不记录日志
if(!(his instanceof Float) && !(value instanceof Float)){ 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), 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),

View File

@@ -49,6 +49,24 @@
</div> </div>
<el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px"> <el-form ref="form" :inline="true" :model="form" :rules="rules" size="small" label-width="78px">
<el-row> <el-row>
<el-col :span="8">
<el-form-item label="关联设备" prop="device_code">
<el-select
v-model="form.link_device_code"
filterable
multiple
clearable
placeholder="请选择"
>
<el-option
v-for="item in deviceList"
:key="item.device_code"
:label="item.device_name"
:value="item.device_code"
/>
</el-select>
</el-form-item>
</el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label="忽略工作模式校验" label-width="150px"> <el-form-item label="忽略工作模式校验" label-width="150px">
<el-switch v-model="form.ignore_pickup_check" /> <el-switch v-model="form.ignore_pickup_check" />