opt: 气胀轴缓存架优化
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package org.nl.acs.device_driver.two_conveyor.inflatable_shaft_library;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -30,6 +31,7 @@ import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -132,7 +134,11 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
|
||||
itemMap.put(to_param, Integer.parseInt(value));
|
||||
this.control(itemMap);
|
||||
try {
|
||||
this.checkcontrol(itemMap);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
logServer.deviceExecuteLog(deviceCode, "", "", "下发电气信号设备号:" + deviceCode + ",下发电气:" + to_param + ",下发电气值:" + value);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(deviceCode)
|
||||
@@ -141,6 +147,30 @@ public class InflatableShaftLibraryDeviceDriver extends AbstractOpcDeviceDriver
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
|
||||
public String getToParam() {
|
||||
return this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + ".";
|
||||
}
|
||||
|
||||
public void writing(Map<String, Object> map) throws Exception {
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
Map<String, Object> itemMap = new LinkedHashMap<>();
|
||||
map.forEach((key, value) -> {
|
||||
if (ObjectUtil.isNotEmpty(value)) {
|
||||
itemMap.put(getToParam() + key, value);
|
||||
}
|
||||
});
|
||||
if (ObjectUtil.isNotEmpty(itemMap)) {
|
||||
this.checkcontrol(itemMap);
|
||||
logServer.deviceExecuteLog(this.getDevice().getDevice_code(), "", "", "下发多个电气信号:" + itemMap);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code(this.deviceCode)
|
||||
.content("下发多个电气信号" + itemMap)
|
||||
.build();
|
||||
logDto.setLog_level(3);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public JSONObject feedLmsRealFailedInfo() {
|
||||
|
||||
Reference in New Issue
Block a user