fix: 扫描码位生成指令优化、内包间优化、写信号优化、lucence注解
This commit is contained in:
@@ -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,6 +39,9 @@ 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 {
|
||||||
|
|
||||||
|
CompletableFuture<String> future = CompletableFuture.supplyAsync(() -> {
|
||||||
|
try {
|
||||||
Group group = opcServerService.getServer(this.getOpcServer());
|
Group group = opcServerService.getServer(this.getOpcServer());
|
||||||
Map<String, Object> write = new HashMap();
|
Map<String, Object> write = new HashMap();
|
||||||
Map<String, Item> readitems = new LinkedHashMap();
|
Map<String, Item> readitems = new LinkedHashMap();
|
||||||
@@ -53,6 +60,7 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
//下发信号
|
//下发信号
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (i == 0) {
|
if (i == 0) {
|
||||||
control(itemValues);
|
control(itemValues);
|
||||||
@@ -108,7 +116,7 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (check) {
|
if (check) {
|
||||||
return;
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
@@ -121,6 +129,24 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc
|
|||||||
}
|
}
|
||||||
++i;
|
++i;
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
throw new IllegalStateException("Interrupted", e);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
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
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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)) {
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -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)){
|
|
||||||
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)) {
|
if (CollUtil.isNotEmpty(byCodeAndExcute)) {
|
||||||
this.message = "有DDJ对接位出入库的指令";
|
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;
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
@@ -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" />
|
||||||
|
|||||||
Reference in New Issue
Block a user