opt: 三色灯回退,OPC连接优化

This commit is contained in:
yanps
2024-02-23 15:38:33 +08:00
parent 2498dea59f
commit d4c89bc50f
6 changed files with 49 additions and 11 deletions

View File

@@ -1143,7 +1143,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
}
/*if (nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
if (nextDevice.getDeviceDriver() instanceof StandardInspectSiteDeviceDriver) {
standardInspectSiteDeviceDriver = (StandardInspectSiteDeviceDriver) nextDevice.getDeviceDriver();
// hongXiangConveyorDeviceDriver.writing("to_close_door", "1");
@@ -1162,7 +1162,7 @@ public class OvenGantryManipulatorDeviceDriver extends AbstractOpcDeviceDriver i
}
}
}*/
}
this.writing("to_command", "5");
this.setNow_steps_type(6);
this.setNow_steps_type(0);

View File

@@ -130,7 +130,6 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
@Override
public void execute() {
String message = null;
try {
device_code = this.getDeviceCode();
mode = this.itemProtocol.getMode();
@@ -162,13 +161,12 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
message = "未联机";
//有报警
} else {
} else if (error != 0) {
this.setIserror(true);
message = "有报警";
}else {
this.setIsonline(true);
this.setIserror(false);
if (error != 0) {
this.setIserror(true);
message = "有报警";
}
message = "";
Instruction instruction = null;
List toInstructions;
@@ -179,7 +177,6 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp
case 2:
break;
}
}
last_mode = mode;
last_error = error;

View File

@@ -2,7 +2,10 @@ package org.nl.acs.opc;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.auto.run.AbstractAutoRunnable;
import org.nl.acs.auto.run.AutoRunService;
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
import org.nl.acs.udw.UnifiedDataAccessor;
import org.nl.acs.udw.UnifiedDataAccessorFactory;
import org.nl.config.thread.TheadFactoryName;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -15,6 +18,8 @@ import java.util.concurrent.*;
public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
@Autowired
DeviceAppService deviceAppService;
@Autowired
private AutoRunService autoRunService;
int cache_thread = 3;
int corePoolSize = 50;
@@ -78,6 +83,10 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
log.info("设备执行线程等待opc同步线程...");
Thread.sleep(1000L);
if (i > 60) {
UnifiedDataAccessor accessor_value = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key);
if(accessor_value.getAllKey().size() < 1){
autoRunService.startThread("DeviceOpcSynchronizeAutoRun");
}
log.info("设备执行线程放弃等待opc同步线程...");
break;
}
@@ -109,7 +118,6 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable {
if (!this.runs.keySet().contains(deviceDriver.getDeviceCode())) {
this.runs.put(deviceDriver.getDeviceCode(), runnable);
}
runnable.setIndex(this.runs);
this.executorService.submit(runnable);
}