From 2134dcfd33cfb6ce46cee33c873e9f19a6ce892a Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Thu, 27 Jun 2024 20:35:45 +0800 Subject: [PATCH] =?UTF-8?q?rev=20=20=E5=AF=B9=E6=8E=A5=E5=B7=A5=E4=BD=8D?= =?UTF-8?q?=E4=BF=A1=E5=8F=B7=E5=86=99=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ManipulatorAgvStationDeviceDriver.java | 55 ++++++++++++------- .../ToCommandControl.java | 31 +++++++++++ 2 files changed, 66 insertions(+), 20 deletions(-) create mode 100644 acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ToCommandControl.java diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ManipulatorAgvStationDeviceDriver.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ManipulatorAgvStationDeviceDriver.java index 8cb62f565..9c3770c3d 100644 --- a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ManipulatorAgvStationDeviceDriver.java +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ManipulatorAgvStationDeviceDriver.java @@ -42,6 +42,9 @@ import java.util.Map; @RequiredArgsConstructor public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor, FeedLmsRealFailed { protected ItemProtocol itemProtocol = new ItemProtocol(this); + + protected ToCommandControl toCommandControl = new ToCommandControl(this); + @Autowired DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); @Autowired @@ -99,6 +102,10 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i return this.device; } + public ToCommandControl getToCommandControl() { + return this.toCommandControl; + } + /** * 请求成功标记 */ @@ -210,30 +217,38 @@ public class ManipulatorAgvStationDeviceDriver extends AbstractOpcDeviceDriver i this.setRequireSucess(false); } - public void writing(int command) { - String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() - + "." + org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.ItemProtocol.item_to_command; - Map itemMap = new HashMap(); - itemMap.put(to_command, command); - LuceneLogDto logDto = LuceneLogDto.builder() - .device_code(device_code) - .content("下发电气信号:" + itemMap) - .build(); - logDto.setLog_level(3); - luceneExecuteLogService.deviceExecuteLog(logDto); - try { - this.checkcontrol(itemMap); - } catch (Exception e) { + public void writing(int command){ +// String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() +// + "." + org.nl.acs.device_driver.two_conveyor.hongxiang_conveyor.ItemProtocol.item_to_command; +// Map itemMap = new HashMap(); +// itemMap.put(to_command, command); +// LuceneLogDto logDto = LuceneLogDto.builder() +// .device_code(device_code) +// .content("下发电气信号:" + itemMap) +// .build(); +// logDto.setLog_level(3); +// luceneExecuteLogService.deviceExecuteLog(logDto); +// try { +// this.checkcontrol(itemMap); +// } catch (Exception e) { +// e.printStackTrace(); +// try { +// this.checkcontrol(itemMap); +// } catch (Exception e1) { +// e1.printStackTrace(); +// } +// } + + try{ + this.toCommandControl.control(command); + } catch (Exception e){ e.printStackTrace(); - try { - this.checkcontrol(itemMap); - } catch (Exception e1) { - e1.printStackTrace(); - } } } - @Override + + + @Override public JSONObject getDeviceStatusName() { JSONObject jo = new JSONObject(); String mode = ""; diff --git a/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ToCommandControl.java b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ToCommandControl.java new file mode 100644 index 000000000..92567876c --- /dev/null +++ b/acs2/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/two_conveyor/manipulator_agv_station/ToCommandControl.java @@ -0,0 +1,31 @@ +package org.nl.acs.device_driver.two_conveyor.manipulator_agv_station; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.alibaba.fastjson.JSONObject; +import org.nl.acs.device_driver.driver.ItemValue; +import org.nl.acs.device_driver.stacker.standard_stacker.ItemProtocol; +import org.nl.acs.device_driver.stacker.standard_stacker.StandardStackerDeviceDriver; + +import java.util.HashMap; +import java.util.Map; + +public class ToCommandControl { + + private ManipulatorAgvStationDeviceDriver driver; + + public ToCommandControl(ManipulatorAgvStationDeviceDriver driver) { + this.driver = driver; + } + + public void control(int command) 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.getOpcServer() + "." + this.driver.getOpcPlc() + "." + this.driver.getDevice().getDevice_code() + + ".to_command"; + Object obj = command; + itemMap.put(to_param, obj); + this.driver.checkcontrol(itemMap); + } + +}