rev:优化自动门写方法
This commit is contained in:
@@ -30,6 +30,7 @@ import java.util.Map;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, DeviceStageMonitor {
|
public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, DeviceStageMonitor {
|
||||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||||
|
protected ToDoorCommandControl toDoorCommandControl = new ToDoorCommandControl(this);
|
||||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||||
@Autowired
|
@Autowired
|
||||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||||
@@ -85,22 +86,16 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
|
|||||||
|
|
||||||
|
|
||||||
public void writing(String param, String value) {
|
public void writing(String param, String value) {
|
||||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
// String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||||
+ "." + param;
|
// + "." + param;
|
||||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
// Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
itemMap.put(to_param, Integer.parseInt(value));
|
// itemMap.put(to_param, Integer.parseInt(value));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.checkcontrol(itemMap);
|
this.toDoorCommandControl.control(param,value);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
|
||||||
.device_code(device_code)
|
|
||||||
.content("下发门信号:" + itemMap)
|
|
||||||
.build();
|
|
||||||
logDto.setLog_level(4);
|
|
||||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void writing(String param, int command) {
|
public void writing(String param, int command) {
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package org.nl.acs.device_driver.autodoor.standard_autodoor;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ToDoorCommandControl {
|
||||||
|
|
||||||
|
private StandardAutodoorDeviceDriver driver;
|
||||||
|
|
||||||
|
public ToDoorCommandControl(StandardAutodoorDeviceDriver driver){
|
||||||
|
this.driver = driver;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void control(String param, String value) throws Exception {
|
||||||
|
// ItemValue[] itemValues = new ItemValue[]{new ItemValue(this.driver.getItem(ItemProtocol.item_to_command), command)};
|
||||||
|
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||||
|
String to_param = this.driver.getDevice().getOpc_server_code() + "." + this.driver.getDevice().getOpc_plc_code() + "." + this.driver.getDevice().getDevice_code()
|
||||||
|
+ "."+ param;
|
||||||
|
itemMap.put(to_param, Integer.parseInt(value));
|
||||||
|
try {
|
||||||
|
this.driver.checkcontrol(itemMap);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user