diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java index d7152a8fd..8314b69aa 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/StandardAutodoorDeviceDriver.java @@ -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 itemMap = new HashMap(); - 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 itemMap = new HashMap(); +// 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) { diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ToDoorCommandControl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ToDoorCommandControl.java new file mode 100644 index 000000000..48839fca8 --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/autodoor/standard_autodoor/ToDoorCommandControl.java @@ -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 itemMap = new HashMap(); + 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(); + } + } +}