rev:优化自动门写方法
This commit is contained in:
@@ -30,6 +30,7 @@ import java.util.Map;
|
||||
@RequiredArgsConstructor
|
||||
public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, DeviceStageMonitor {
|
||||
protected ItemProtocol itemProtocol = new ItemProtocol(this);
|
||||
protected ToDoorCommandControl toDoorCommandControl = new ToDoorCommandControl(this);
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl");
|
||||
@Autowired
|
||||
LuceneExecuteLogService luceneExecuteLogService = SpringContextHolder.getBean(LuceneExecuteLogService.class);
|
||||
@@ -85,22 +86,16 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
|
||||
|
||||
public void writing(String param, String value) {
|
||||
String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
+ "." + param;
|
||||
Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
itemMap.put(to_param, Integer.parseInt(value));
|
||||
// String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code()
|
||||
// + "." + param;
|
||||
// Map<String, Object> itemMap = new HashMap<String, Object>();
|
||||
// itemMap.put(to_param, Integer.parseInt(value));
|
||||
|
||||
try {
|
||||
this.checkcontrol(itemMap);
|
||||
this.toDoorCommandControl.control(param,value);
|
||||
} catch (Exception e) {
|
||||
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) {
|
||||
|
||||
@@ -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