From 1e15725d1fbd46d4cbc3cd0b400eceb1cead3712 Mon Sep 17 00:00:00 2001 From: baoge <751575283@qq.com> Date: Wed, 27 Dec 2023 17:58:25 +0800 Subject: [PATCH] =?UTF-8?q?rev:=E4=BF=AE=E6=94=B9=E5=9B=BA=E5=8C=96?= =?UTF-8?q?=E5=AE=A4=EF=BC=8C=E8=BE=93=E9=80=81=E7=BA=BF=EF=BC=8C=E6=B6=82?= =?UTF-8?q?=E6=9D=BF=E7=BA=BF=E9=A9=B1=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../guhuashi/GuhuashiSiteDeviceDriver.java | 61 ++++++++++--- .../tianneng/guhuashi/ItemProtocol.java | 90 +++++++++++++++++-- .../tianneng/site/ItemProtocol.java | 8 +- .../tianneng/site/SiteDeviceDriver.java | 14 ++- .../org/nl/acs/opc/DeviceExecuteAutoRun.java | 5 +- .../src/views/acs/device/opc/index.vue | 2 +- 6 files changed, 144 insertions(+), 36 deletions(-) diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/guhuashi/GuhuashiSiteDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/guhuashi/GuhuashiSiteDeviceDriver.java index ef96a94..1b9b73c 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/guhuashi/GuhuashiSiteDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/guhuashi/GuhuashiSiteDeviceDriver.java @@ -151,6 +151,30 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements int last_error_time = 0; int end_time = 0; int last_end_time = 0; + int temperature = 0; + int temperature_setting = 0; + int humidity = 0; + int humidity_setting = 0; + int current_stage = 0; + int total_running_time = 0; + int executing_stage_num = 0; + int front_door = 0; + int front_door_off = 0; + int back_door = 0; + int back_door_off = 0; + int device_code = 0; + int device_name = 0; + int last_temperature; + int last_temperature_setting; + int last_humidity; + int last_humidity_setting; + int last_current_stage; + int last_total_running_time; + int last_executing_stage_num; + int last_front_door; + int last_front_door_off; + int last_back_door; + int last_back_door_off; @Override @@ -167,14 +191,17 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements mode = this.itemProtocol.getMode(); error = this.itemProtocol.getError(); status = this.itemProtocol.getStatus(); - start_time = this.itemProtocol.getItem_start_time(); - stop_time = this.itemProtocol.getItem_stop_time(); - open_time = this.itemProtocol.getItem_open_time(); - standby_time = this.itemProtocol.getItem_standby_time(); - production_time = this.itemProtocol.getItem_production_time(); - error_time = this.itemProtocol.getItem_error_time(); - end_time = this.itemProtocol.getItem_end_time(); - + temperature = this.itemProtocol.getTemperature(); + temperature_setting = this.itemProtocol.getTemperatureSetting(); + humidity = this.itemProtocol.getHumidity(); + humidity_setting = this.itemProtocol.getHumiditySetting(); + current_stage = this.itemProtocol.getCurrentStage(); + total_running_time = this.itemProtocol.getTotalRunningTime(); + executing_stage_num = this.itemProtocol.getExecutingStageNum(); + front_door = this.itemProtocol.getFrontDoor(); + front_door_off = this.itemProtocol.getFrontDoorOff(); + back_door = this.itemProtocol.getBackDoor(); + back_door_off = this.itemProtocol.getBackDoorOff(); if (mode != last_mode) { this.setRequireSucess(false); if (mode == 2) { @@ -229,7 +256,6 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements //todo 称重模式,带上重量、数量和向lms请求 break; } - switch (flag) { //取货完成 case 1: @@ -241,8 +267,8 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements return; } - } + last_mode = mode; last_error = error; last_status = status; @@ -253,7 +279,17 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements last_production_time = production_time; last_error_time = error_time; last_end_time = end_time; - + last_temperature = temperature; + last_temperature_setting = temperature_setting; + last_humidity = humidity; + last_humidity_setting = humidity_setting; + last_current_stage = current_stage; + last_total_running_time = total_running_time; + last_executing_stage_num = executing_stage_num; + last_front_door = front_door; + last_front_door_off = front_door_off; + last_back_door = back_door; + last_back_door_off = back_door_off; } @@ -280,7 +316,8 @@ public class GuhuashiSiteDeviceDriver extends AbstractOpcDeviceDriver implements itemMap.put(to_command, command); this.control(itemMap); } - public void writing(String param,int command) { + + public void writing(String param, int command) { String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; Map itemMap = new HashMap<>(); diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/guhuashi/ItemProtocol.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/guhuashi/ItemProtocol.java index 8de8e52..6075d1d 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/guhuashi/ItemProtocol.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/guhuashi/ItemProtocol.java @@ -23,6 +23,20 @@ public class ItemProtocol { public static String item_error_time = "error_time"; public static String item_end_time = "end_time"; public static String item_to_command = "to_command"; + public static String item_temperature = "temperature"; + public static String item_temperature_setting = "temperature_setting"; + public static String item_humidity = "humidity"; + public static String item_humidity_setting = "humidity_setting"; + public static String item_current_stage = "current_stage"; + public static String item_total_running_time = "total_running_time"; + public static String item_executing_stage_num = "executing_stage_num"; + public static String item_front_door = "front_door"; + public static String item_front_door_off = "front_door_off"; + public static String item_back_door = "back_door"; + public static String item_back_door_off = "back_door_off"; + public static String item_device_code = "device_code"; + public static String item_device_name = "device_name"; + private GuhuashiSiteDeviceDriver driver; @@ -38,14 +52,69 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_mode); } + + public int getStatus() { return this.getOpcIntegerValue(item_status); } + public int getTemperature() { + return this.getOpcIntegerValue(item_temperature); + } + + public int getTemperatureSetting() { + return this.getOpcIntegerValue(item_temperature_setting); + } + + + public int getHumidity() { + return this.getOpcIntegerValue(item_humidity); + } + + + public int getHumiditySetting() { + return this.getOpcIntegerValue(item_humidity_setting); + } + + + public int getCurrentStage() { + return this.getOpcIntegerValue(item_current_stage); + } + + + public int getTotalRunningTime() { + return this.getOpcIntegerValue(item_total_running_time); + } + + public int getExecutingStageNum() { + return this.getOpcIntegerValue(item_executing_stage_num); + } + public int getError() { return this.getOpcIntegerValue(item_error); } + + public int getFrontDoor() { + return this.getOpcIntegerValue(item_front_door); + } + + + public int getFrontDoorOff() { + return this.getOpcIntegerValue(item_front_door_off); + } + + + public int getBackDoor() { + return this.getOpcIntegerValue(item_back_door); + } + + public int getBackDoorOff() { + return this.getOpcIntegerValue(item_back_door_off); + } + + + public int getItem_start_time() { return this.getOpcIntegerValue(item_start_time); } @@ -98,17 +167,22 @@ public class ItemProtocol { public static List getReadableItemDtos() { ArrayList list = new ArrayList(); - list.add(new ItemDto(item_heartbeat, "心跳", "DB600.B0")); list.add(new ItemDto(item_mode, "工作状态", "DB600.B2", Boolean.valueOf(true))); list.add(new ItemDto(item_status, "设备状态", "DB600.B3")); list.add(new ItemDto(item_error, "error", "DB600.B4")); - list.add(new ItemDto(item_start_time, "开始固化时间", "DB600.D6")); - list.add(new ItemDto(item_stop_time, "固化结束时间", "DB600.D6")); - list.add(new ItemDto(item_open_time, "当前开机时间", "DB600.D6")); - list.add(new ItemDto(item_standby_time, "当前待机时间", "DB600.B7")); - list.add(new ItemDto(item_production_time, "当前生产时间", "DB600.D8")); - list.add(new ItemDto(item_error_time, "当前故障时间", "DB600.D8")); - list.add(new ItemDto(item_end_time, "当前故障时间", "DB600.B3")); + list.add(new ItemDto(item_temperature, "温度显示", "DB600.B4")); + list.add(new ItemDto(item_temperature_setting, "温度设定", "DB600.B4")); + list.add(new ItemDto(item_humidity, "湿度显示", "DB600.B4")); + list.add(new ItemDto(item_humidity_setting, "湿度设定", "DB600.B4")); + list.add(new ItemDto(item_current_stage, "当前阶段", "DB600.B4")); + list.add(new ItemDto(item_total_running_time, "阶段累加时", "DB600.B4")); + list.add(new ItemDto(item_executing_stage_num, "正在执行的阶段数", "DB600.B4")); + list.add(new ItemDto(item_front_door, "固化室前门已开信号", "DB600.B4")); + list.add(new ItemDto(item_front_door_off, "固化室前门已关信号", "DB600.B4")); + list.add(new ItemDto(item_back_door, "固化室后门已开信号", "DB600.B4")); + list.add(new ItemDto(item_back_door_off, "固化室后门已关信号", "DB600.B4")); + list.add(new ItemDto(item_device_code, "设备编号", "DB600.B4")); + list.add(new ItemDto(item_device_name, "设备名称", "DB600.B4")); return list; } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/site/ItemProtocol.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/site/ItemProtocol.java index e96f262..a84e7c9 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/site/ItemProtocol.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/site/ItemProtocol.java @@ -16,7 +16,7 @@ public class ItemProtocol { public static String item_move = "move"; public static String item_action = "action"; public static String item_error = "error"; - public static String item_material_type = "material_type"; + public static String item_pallet_type = "pallet_type"; public static String item_to_command = "to_command"; private SiteDeviceDriver driver; @@ -45,8 +45,8 @@ public class ItemProtocol { return this.getOpcIntegerValue(item_error); } - public int getMaterialType() { - return this.getOpcIntegerValue(item_material_type); + public int getPalletType() { + return this.getOpcIntegerValue(item_pallet_type); } public int getToCommand() { @@ -80,7 +80,7 @@ public class ItemProtocol { list.add(new ItemDto(item_move, "光电信号", "DB600.B3")); list.add(new ItemDto(item_action, "取放信号", "DB600.B3")); list.add(new ItemDto(item_error, "error", "DB600.B4")); - list.add(new ItemDto(item_material_type, "物料类型", "DB600.D6")); + list.add(new ItemDto(item_pallet_type, "托盘类型", "DB600.D6")); return list; } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/site/SiteDeviceDriver.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/site/SiteDeviceDriver.java index 260baa5..5443105 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/site/SiteDeviceDriver.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/device_driver/tianneng/site/SiteDeviceDriver.java @@ -3,7 +3,6 @@ package org.nl.acs.device_driver.tianneng.site; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import lombok.Data; import lombok.RequiredArgsConstructor; @@ -31,9 +30,6 @@ import org.nl.acs.task.service.mapper.TaskMapper; import org.nl.acs.utils.ConvertUtil; import org.nl.common.utils.CodeUtil; import org.nl.config.SpringContextHolder; -import org.nl.system.service.lucene.dto.LuceneLogDto; -import org.openscada.opc.lib.da.Server; - import java.util.Date; import java.util.HashMap; import java.util.List; @@ -87,8 +83,10 @@ public class SiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceD int io_action = 0; int last_io_action = 0; - int material_type = 0; - int last_material_type = 0; + int pallet_type = 0; + int last_pallet_type = 0; + + int barcode = 0; int last_barcode = 0; @@ -152,7 +150,7 @@ public class SiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceD move = this.itemProtocol.getMove(); hasGoods = this.itemProtocol.getMove(); action = this.itemProtocol.getAction(); - material_type = this.itemProtocol.getMaterialType(); + pallet_type = this.itemProtocol.getPalletType(); if (mode != last_mode) { this.setRequireSucess(false); if (mode == 2) { @@ -244,7 +242,7 @@ public class SiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceD last_error = error; last_move = move; last_task = task; - last_material_type = material_type; + last_pallet_type = pallet_type; last_barcode = barcode; } diff --git a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceExecuteAutoRun.java b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceExecuteAutoRun.java index bfb4009..7af69b3 100644 --- a/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceExecuteAutoRun.java +++ b/acs/nladmin-system/nlsso-server/src/main/java/org/nl/acs/opc/DeviceExecuteAutoRun.java @@ -75,10 +75,10 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable { @Override public void autoRun() throws Exception { for (int i = 0; !OpcStartTag.is_run; ++i) { - log.info("设备执行线程等待opc同步线程..."); + //log.info("设备执行线程等待opc同步线程..."); Thread.sleep(1000L); if (i > 60) { - log.info("设备执行线程放弃等待opc同步线程..."); + //log.info("设备执行线程放弃等待opc同步线程..."); break; } } @@ -109,7 +109,6 @@ public class DeviceExecuteAutoRun extends AbstractAutoRunnable { if (!this.runs.keySet().contains(deviceDriver.getDeviceCode())) { this.runs.put(deviceDriver.getDeviceCode(), runnable); } - runnable.setIndex(this.runs); this.executorService.submit(runnable); } diff --git a/acs/nladmin-ui/src/views/acs/device/opc/index.vue b/acs/nladmin-ui/src/views/acs/device/opc/index.vue index 1a50838..4c0e346 100644 --- a/acs/nladmin-ui/src/views/acs/device/opc/index.vue +++ b/acs/nladmin-ui/src/views/acs/device/opc/index.vue @@ -98,7 +98,7 @@ @selection-change="crud.selectionChangeHandler" > - +