fix 线程

This commit is contained in:
USER-20220102CG\noblelift
2023-04-20 21:51:31 +08:00
parent 0a7b9e9953
commit 2a527249ee
5 changed files with 28 additions and 22 deletions

View File

@@ -456,6 +456,8 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic
// String demosub = linkobj.substring(1,linkobj.length()-1);
// String demoArray[] = demosub.split(",");
// List<String> demoList = Arrays.asList(demoArray);
json.put("device_code",this.device_code);
json.put("material_code",material);
json.put("qty",encoder_qty);

View File

@@ -363,13 +363,14 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
UnifiedDataAccessor accessor_value = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key);
accessor_value.setValue(itemId, value);
if (value != null) {
if (log.isTraceEnabled()) {
log.trace("Item {} new value: {}, Timestamp: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime()});
}
} else if (log.isInfoEnabled()) {
log.info("Item {} new value: {}, Timestamp: {}, Quality: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime(), itemState.getQuality()});
}
// if (value != null) {
// if (log.isTraceEnabled()) {
// log.trace("Item {} new value: {}, Timestamp: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime()});
// }
// } else if (log.isInfoEnabled()) {
// log.info("Item {} new value: {}, Timestamp: {}, Quality: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime(), itemState.getQuality()});
// }
log.trace("Item {} new value: {}, Timestamp: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime()});
OpcItemDto itemDto = this.getItem(itemId);
// if (Boolean.TRUE.equals(itemDto.getNeed_log())) {
@@ -401,7 +402,6 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(),itemId, his, value});
// this.businessLogger.setResource(itemDto.getDevice_code(), itemDto.getDevice_name()).log("信号{}变更从{}->{}", new Object[]{itemId, his, value});
}
}
}

View File

@@ -10,5 +10,5 @@ public class OpcConfig {
public static String opc_server_default_group = "group";
public static String resource_code = "opc_sync";
public static String resource_name = "opc同步";
public static boolean opc_item_read_using_callback = true;
public static boolean opc_item_read_using_callback = false;
}

View File

@@ -19,7 +19,7 @@ import java.util.concurrent.Executors;
public class DeviceOpcSynchronizeAutoRun extends AbstractAutoRunnable {
public static boolean isRun = false;
ExecutorService executorService = Executors.newCachedThreadPool();
ExecutorService executorService;
@Autowired
private DeviceAppService deviceAppService;
@Autowired
@@ -39,7 +39,7 @@ public class DeviceOpcSynchronizeAutoRun extends AbstractAutoRunnable {
public void autoRun() throws Exception {
{
isRun = true;
this.executorService = Executors.newCachedThreadPool();
Map<String, OpcServerManageDto> servers = this.opcServerManageService.queryAllServerMap();
Map<String, List<List<OpcItemDto>>> pros;
do{
@@ -67,8 +67,12 @@ public class DeviceOpcSynchronizeAutoRun extends AbstractAutoRunnable {
//Map<String, List<List<OpcItemDto>>> pros1 = this.deviceAppService.findAllFormatProtocolFromDriver();
//List<DeviceDriver> opcDrivers = this.deviceAppService.findDeviceDriver(DeviceDriver.class);
while (true) {
Thread.sleep(3000L);
while(true) {
try {
Thread.sleep(3600000L);
} catch (InterruptedException var11) {
return;
}
}
}
}

View File

@@ -5,15 +5,15 @@
<div v-if="crud.props.searchToggle">
<!-- 搜索 -->
<el-select
v-model="form.unified_key"
placeholder="unified_key"
class="filter-item"
@change="crud.toQuery"
clearable
filterable
size="small">
<el-option v-for="(item,index) in unified_key" :key="index" :label="item.label" :value="item.value">
</el-option>
v-model="form.unified_key"
placeholder="unified_key"
class="filter-item"
clearable
filterable
size="small"
@change="crud.toQuery"
>
<el-option v-for="(item,index) in unified_key" :key="index" :label="item.label" :value="item.value" />
</el-select>
<el-input
v-model="query.code"