From 31a531624397475f067ccbe588e9a90255d99649 Mon Sep 17 00:00:00 2001 From: gengby <858962040@qq.com> Date: Wed, 26 Oct 2022 10:30:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B9=B3=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/device_driver/DriverTypeEnum.java | 4 +- .../nl/acs/device/service/DeviceService.java | 1 + .../service/impl/DeviceServiceImpl.java | 74 ++ .../hailiang_flat/HailiangFlatDefination.java | 62 ++ .../HailiangFlatDeviceDriver.java | 250 +++++++ .../hailiang/hailiang_flat/ItemProtocol.java | 633 ++++++++++++++++++ .../java/org/nl/hand/rest/HandController.java | 7 + .../java/org/nl/hand/service/HandService.java | 2 + .../nl/hand/service/impl/HandServiceImpl.java | 230 +++++-- qd/src/views/acs/device/config.vue | 3 +- .../driver/hailing_zgbz/hailiang_flat.vue | 458 +++++++++++++ 11 files changed, 1680 insertions(+), 44 deletions(-) create mode 100644 nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/HailiangFlatDefination.java create mode 100644 nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/HailiangFlatDeviceDriver.java create mode 100644 nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/ItemProtocol.java create mode 100644 qd/src/views/acs/device/driver/hailing_zgbz/hailiang_flat.vue diff --git a/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java b/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java index e6dabe5..569c9a8 100644 --- a/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java +++ b/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java @@ -22,7 +22,9 @@ public enum DriverTypeEnum { HAILIANG_COATING(6, "hailiang_coating", "海亮包装项目-裹膜线体", "conveyor"), - HAILIANG_LABELING(7, "hailiang_labeling", "海亮包装项目-贴标线体", "conveyor"); + HAILIANG_LABELING(7, "hailiang_labeling", "海亮包装项目-贴标线体", "conveyor"), + + HAILIANG_FLAT(8, "hailiang_flat", "海亮包装项目-平板", "conveyor"); //驱动索引 diff --git a/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java b/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java index baddaa5..f1a5f96 100644 --- a/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java +++ b/nladmin-system/src/main/java/org/nl/acs/device/service/DeviceService.java @@ -225,6 +225,7 @@ public interface DeviceService { void testWrite(Map map); void downDeviceDBloadCSV(JSONArray queryDeviceProtocol, HttpServletResponse response); + void downDeviceDBPBloadCSV(JSONArray queryDeviceProtocol, HttpServletResponse response); void downDeviceDBloadOumulongCSV(JSONArray queryDeviceProtocol, HttpServletResponse response); diff --git a/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java b/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java index 8c70395..7e6e5aa 100644 --- a/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java +++ b/nladmin-system/src/main/java/org/nl/acs/device/service/impl/DeviceServiceImpl.java @@ -1135,6 +1135,80 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial datatype = "String"; } else if (headtype.startsWith("REAL")) { datatype = "REAL"; + }else if (headtype.startsWith("X")) { + datatype = "Boolean"; + } + } else { + //西门子200 + if (datatype.indexOf(".") == -1) { + datatype = "Byte"; + } else { + datatype = "Boolean"; + } + } + + item.add(datatype); + item.add("1"); + item.add("R/W"); + item.add("100"); + + cellList.add(item.toArray()); + } + + String[] tableHeaderArr = {"Tag Name", "Address", "Data Type", "Respect Data Type", + "Client Access", "Scan Rate"}; + String fileName = "导出文件.csv"; + byte[] bytes = ExportCSVUtil.writeCsvAfterToBytes(tableHeaderArr, cellList); + ExportCSVUtil.responseSetProperties(fileName, bytes, response); + } + + @Override + public void downDeviceDBPBloadCSV(JSONArray jsonarr, HttpServletResponse response) { + List cellList = new ArrayList<>(); + for (int i = 0; i < jsonarr.size(); i++) { + List item = new ArrayList(); + JSONObject jo = jsonarr.getJSONObject(i); + String extra_code = jo.getString("extra_code"); + //校验数据 格式为: RD1.RD1.A1.mode + int num = countStr(extra_code, "."); + if (num != 3) { + throw new BadRequestException(extra_code + "数据格式不正确"); + } + + extra_code = extra_code.substring(extra_code.indexOf(".") + 1, extra_code.length()); + extra_code = extra_code.substring(extra_code.indexOf(".") + 1, extra_code.length()); + item.add(extra_code); + item.add(jo.get("extra_name")); + String datatype = jo.getString("extra_name"); + //西门子1200、1500 为DB + if (datatype.startsWith("DB")) { + //校验数据 格式为:DB600.B1 +// if(datatype.indexOf(".") == -1 ){ +// throw new BadRequestException(jo.getString("extra_code") + "点位数据格式不正确"); +// } +// int count = countStr(datatype,"."); +// if(count != 1){ +// throw new BadRequestException(jo.getString("extra_code") + "点位数据格式不正确"); +// } + + String str1 = datatype.substring(0, datatype.indexOf(".")); + String headtype = datatype.substring(str1.length() + 1, datatype.length()); + if (headtype.startsWith("B")) { + if (headtype.contains(".")) { + datatype = "Boolean"; + } else { + datatype = "Byte"; + } + } else if (headtype.startsWith("W")) { + datatype = "Word"; + } else if (headtype.startsWith("D")) { + datatype = "DWord"; + } else if (headtype.startsWith("S")) { + datatype = "String"; + } else if (headtype.startsWith("REAL")) { + datatype = "REAL"; + }else if (headtype.startsWith("X")) { + datatype = "Boolean"; } } else { //西门子200 diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/HailiangFlatDefination.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/HailiangFlatDefination.java new file mode 100644 index 0000000..07a5431 --- /dev/null +++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/HailiangFlatDefination.java @@ -0,0 +1,62 @@ +package org.nl.acs.device_driver.hailiang.hailiang_flat; + +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.defination.OpcDeviceDriverDefination; +import org.nl.acs.opc.Device; +import org.nl.acs.opc.DeviceType; +import org.springframework.stereotype.Service; + +import java.util.LinkedList; +import java.util.List; + +/** + * 直管包装平板 + * + */ +@Service +public class HailiangFlatDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "hailiang_flat"; + } + + @Override + public String getDriverName() { + return "海亮平板特殊驱动"; + } + + @Override + public String getDriverDescription() { + return "海亮平板特殊驱动"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new HailiangFlatDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return HailiangFlatDeviceDriver.class; + } + + @Override + public List getFitDeviceTypes() { + List types = new LinkedList(); + types.add(DeviceType.station); + return types; + } + + @Override + public List getReadableItemDtos() { + return ItemProtocol.getReadableItemDtos(); + } + + @Override + public List getWriteableItemDtos() { + return ItemProtocol.getWriteableItemDtos(); + } + +} diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/HailiangFlatDeviceDriver.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/HailiangFlatDeviceDriver.java new file mode 100644 index 0000000..abed6db --- /dev/null +++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/HailiangFlatDeviceDriver.java @@ -0,0 +1,250 @@ +package org.nl.acs.device_driver.hailiang.hailiang_flat; + +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.standard_inspect.ReadUtil; +import org.nl.acs.device_driver.DeviceDriver; +import org.nl.acs.device_driver.RouteableDeviceDriver; +import org.nl.acs.device_driver.driver.AbstractOpcDeviceDriver; +import org.nl.acs.device_driver.driver.ExecutableDeviceDriver; +import org.nl.acs.opc.Device; +import org.openscada.opc.lib.da.Server; + +import java.util.*; + +/** + * 宏丰双工位RGV + */ +@Slf4j +@Data +@RequiredArgsConstructor +public class HailiangFlatDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + + int is_auto = 0; + int is_running = 0; + int mode = 0; + int a_pressure = 0; + int b_pressure = 0; + int outer_diameter = 0; + int length = 0; + int wall_thickness = 0; + int color = 0; + int jackup_num = 0; + int strap_number = 0; + int start = 0; + int stop = 0; + int main_convey1 = 0; + int main_convey1_seat1 = 0; + int main_convey1_seat2 = 0; + int ink_jet = 0; + int ink_jet_seat1 = 0; + int ink_jet_seat2 = 0; + int ink_jet_seat3 = 0; + int main_convey2 = 0; + int main_convey2_seat1 = 0; + int main_convey3_has_pass = 0; + int main_convey3_has_noPass = 0; + int main_convey3_seat1 = 0; + int main_convey3_seat2 = 0; + int cowl_a_cache = 0; + int cowl_a_cache_seat1 = 0; + int cowl_a_cache_seat2 = 0; + int cowl_a_cowl = 0; + int cowl_a_cowl_seat1 = 0; + int cowl_a_cowl_seat2 = 0; + int cowl_a_cowl_pass = 0; + int reverse_convey = 0; + int reverse_convey_seat1 = 0; + int reverse_convey_seat2 = 0; + int reverse_convey_seat3 = 0; + int reverse_convey_pass = 0; + int cowl_b_cache = 0; + int cowl_b_cache_seat1 = 0; + int cowl_b_cache_seat2 = 0; + int cowl_b_cache_pass = 0; + int cowl_b_cowl = 0; + int cowl_b_cowl_seat1 = 0; + int cowl_b_cowl_seat2 = 0; + int cowl_b_cowl_aPass = 0; + int cowl_b_cowl_bPass = 0; + int no_pass_convey_cache_num = 0; + int wrap_ago = 0; + int wrap_ago_seat1 = 0; + int wrap_ago_seat2 = 0; + int wrap_after = 0; + int wrap_after_seat1 = 0; + int wrap_after_seat2 = 0; + int strapping_current_step = 0; + int strapping_seat1 = 0; + int strapping_seat2 = 0; + int strapping_seat3 = 0; + int strapping_seat4 = 0; + int strapping_seat5 = 0; + int strapping_seat6 = 0; + int strapping_seat7 = 0; + int strapping_seat8 = 0; + int strapping_seat9 = 0; + int strapping_seat10 = 0; + int strapping_seat11 = 0; + int strapping_seat12 = 0; + int a_error1_clear = 0; + int b_error1_clear = 0; + int a_error2_clear = 0; + int b_error2_clear = 0; + int wrap_control = 0; + int strapping_finish = 0; + int error_clear = 0; + + String device_code; + + + @Override + public Device getDevice() { + return this.device; + } + + + @Override + public void execute() throws Exception { + String message = null; + try { + device_code = this.getDeviceCode(); + //mode = this.itemProtocol.getMode(); + is_auto = this.itemProtocol.getis_auto(); + is_running = this.itemProtocol.getis_running(); + mode = this.itemProtocol.getmode(); + a_pressure = this.itemProtocol.geta_pressure(); + b_pressure = this.itemProtocol.getb_pressure(); + outer_diameter = this.itemProtocol.getouter_diameter(); + length = this.itemProtocol.getlength(); + wall_thickness = this.itemProtocol.getwall_thickness(); + color = this.itemProtocol.getcolor(); + jackup_num = this.itemProtocol.getjackup_num(); + strap_number = this.itemProtocol.getstrap_number(); + start = this.itemProtocol.getstart(); + stop = this.itemProtocol.getstop(); + main_convey1 = this.itemProtocol.getmain_convey1(); + main_convey1_seat1 = this.itemProtocol.getmain_convey1_seat1(); + main_convey1_seat2 = this.itemProtocol.getmain_convey1_seat2(); + ink_jet = this.itemProtocol.getink_jet(); + ink_jet_seat1 = this.itemProtocol.getink_jet_seat1(); + ink_jet_seat2 = this.itemProtocol.getink_jet_seat2(); + ink_jet_seat3 = this.itemProtocol.getink_jet_seat3(); + main_convey2 = this.itemProtocol.getmain_convey2(); + main_convey2_seat1 = this.itemProtocol.getmain_convey2_seat1(); + main_convey3_has_pass = this.itemProtocol.getmain_convey3_has_pass(); + main_convey3_has_noPass = this.itemProtocol.getmain_convey3_has_noPass(); + main_convey3_seat1 = this.itemProtocol.getmain_convey3_seat1(); + main_convey3_seat2 = this.itemProtocol.getmain_convey3_seat2(); + cowl_a_cache = this.itemProtocol.getcowl_a_cache(); + cowl_a_cache_seat1 = this.itemProtocol.getcowl_a_cache_seat1(); + cowl_a_cache_seat2 = this.itemProtocol.getcowl_a_cache_seat2(); + cowl_a_cowl = this.itemProtocol.getcowl_a_cowl(); + cowl_a_cowl_seat1 = this.itemProtocol.getcowl_a_cowl_seat1(); + cowl_a_cowl_seat2 = this.itemProtocol.getcowl_a_cowl_seat2(); + cowl_a_cowl_pass = this.itemProtocol.getcowl_a_cowl_pass(); + reverse_convey = this.itemProtocol.getreverse_convey(); + reverse_convey_seat1 = this.itemProtocol.getreverse_convey_seat1(); + reverse_convey_seat2 = this.itemProtocol.getreverse_convey_seat2(); + reverse_convey_seat3 = this.itemProtocol.getreverse_convey_seat3(); + reverse_convey_pass = this.itemProtocol.getreverse_convey_pass(); + cowl_b_cache = this.itemProtocol.getcowl_b_cache(); + cowl_b_cache_seat1 = this.itemProtocol.getcowl_b_cache_seat1(); + cowl_b_cache_seat2 = this.itemProtocol.getcowl_b_cache_seat2(); + cowl_b_cache_pass = this.itemProtocol.getcowl_b_cache_pass(); + cowl_b_cowl = this.itemProtocol.getcowl_b_cowl(); + cowl_b_cowl_seat1 = this.itemProtocol.getcowl_b_cowl_seat1(); + cowl_b_cowl_seat2 = this.itemProtocol.getcowl_b_cowl_seat2(); + cowl_b_cowl_aPass = this.itemProtocol.getcowl_b_cowl_aPass(); + cowl_b_cowl_bPass = this.itemProtocol.getcowl_b_cowl_bPass(); + no_pass_convey_cache_num = this.itemProtocol.getno_pass_convey_cache_num(); + wrap_ago = this.itemProtocol.getwrap_ago(); + wrap_ago_seat1 = this.itemProtocol.getwrap_ago_seat1(); + wrap_ago_seat2 = this.itemProtocol.getwrap_ago_seat2(); + wrap_after = this.itemProtocol.getwrap_after(); + wrap_after_seat1 = this.itemProtocol.getwrap_after_seat1(); + wrap_after_seat2 = this.itemProtocol.getwrap_after_seat2(); + strapping_current_step = this.itemProtocol.getstrapping_current_step(); + strapping_seat1 = this.itemProtocol.getstrapping_seat1(); + strapping_seat2 = this.itemProtocol.getstrapping_seat2(); + strapping_seat3 = this.itemProtocol.getstrapping_seat3(); + strapping_seat4 = this.itemProtocol.getstrapping_seat4(); + strapping_seat5 = this.itemProtocol.getstrapping_seat5(); + strapping_seat6 = this.itemProtocol.getstrapping_seat6(); + strapping_seat7 = this.itemProtocol.getstrapping_seat7(); + strapping_seat8 = this.itemProtocol.getstrapping_seat8(); + strapping_seat9 = this.itemProtocol.getstrapping_seat9(); + strapping_seat10 = this.itemProtocol.getstrapping_seat10(); + strapping_seat11 = this.itemProtocol.getstrapping_seat11(); + strapping_seat12 = this.itemProtocol.getstrapping_seat12(); + a_error1_clear = this.itemProtocol.geta_error1_clear(); + b_error1_clear = this.itemProtocol.getb_error1_clear(); + a_error2_clear = this.itemProtocol.geta_error2_clear(); + b_error2_clear = this.itemProtocol.getb_error2_clear(); + wrap_control = this.itemProtocol.getwrap_control(); + strapping_finish = this.itemProtocol.getstrapping_finish(); + error_clear = this.itemProtocol.geterror_clear(); + } catch (Exception var17) { + return; + } + + + } + + + + 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; + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + itemMap.put(to_param, value); + + ReadUtil.write(itemMap, server); + } + + public boolean exe_business() { + return true; + } + + + public void executing(Server server, Map itemMap) { + ReadUtil.write(itemMap, server); + } + + public void writing1(int command) { +// String to_command1 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() +// + "." + ItemProtocol.item_to_command1; +// +// String opcservcerid = this.getDevice().getOpc_server_id(); +// Server server = ReadUtil.getServer(opcservcerid); +// Map itemMap = new HashMap(); +// itemMap.put(to_command1, command); +// ReadUtil.write(itemMap, server); + + } + + public void writing2(int command) { +// String to_command2 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() +// + "." + ItemProtocol.item_to_command2; +// +// String opcservcerid = this.getDevice().getOpc_server_id(); +// Server server = ReadUtil.getServer(opcservcerid); +// Map itemMap = new HashMap(); +// itemMap.put(to_command2, command); +// ReadUtil.write(itemMap, server); + + } + + public void writing(int type, int command) { + String opcservcerid = this.getDevice().getOpc_server_id(); + Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); + ReadUtil.write(itemMap, server); + } + +} diff --git a/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/ItemProtocol.java b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/ItemProtocol.java new file mode 100644 index 0000000..4c4f8f9 --- /dev/null +++ b/nladmin-system/src/main/java/org/nl/acs/device_driver/hailiang/hailiang_flat/ItemProtocol.java @@ -0,0 +1,633 @@ +package org.nl.acs.device_driver.hailiang.hailiang_flat; + +import cn.hutool.core.util.StrUtil; +import lombok.Data; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.device_driver.standard_inspect.ItemDto; + +import java.util.ArrayList; +import java.util.List; + +@Slf4j +@Data +public class ItemProtocol { + + //手自动 + public static String item_is_auto = "is_auto"; + //系统运行 + public static String item_is_running = "is_running"; + //联机模式 + public static String item_mode = "mode"; + //a测档压力 + public static String item_a_pressure = "a_pressure"; + //b测档压力 + public static String item_b_pressure = "b_pressure"; + //管径(mm) + public static String item_outer_diameter = "outer_diameter"; + //管长 + public static String item_length = "length"; + //壁厚 + public static String item_wall_thickness = "wall_thickness"; + //颜色 + public static String item_color = "color"; + //合格提升每次提升根数 + public static String item_jackup_num = "jackup_num"; + //每捆根数 + public static String item_strap_number = "strap_number"; + //启动 + public static String item_start = "start"; + //停止 + public static String item_stop = "stop"; + //主输送一段—-有料 + public static String item_main_convey1 = "main_convey1"; + //主输送一段—-有料 占位1 2 + public static String item_main_convey1_seat1 = "main_convey1_seat1"; + public static String item_main_convey1_seat2 = "main_convey1_seat2"; + //喷墨 + public static String item_ink_jet = "ink_jet"; + //喷墨-占位 1 2 3 + public static String item_ink_jet_seat1 = "ink_jet_seat1"; + public static String item_ink_jet_seat2 = "ink_jet_seat2"; + public static String item_ink_jet_seat3 = "ink_jet_seat3"; + //主输送二段 + public static String item_main_convey2 = "main_convey2"; + //主输送二段 占位 1 + public static String item_main_convey2_seat1 = "main_convey2_seat1"; + //主输送三段—-有料合格 + public static String item_main_convey3_has_pass = "main_convey3_has_pass"; + //主输送三段—-有料不合格 + public static String item_main_convey3_has_noPass = "main_convey3_has_noPass"; + //主输送三段—-占位1 2 + public static String item_main_convey3_seat1 = "main_convey3_seat1"; + public static String item_main_convey3_seat2 = "main_convey3_seat2"; + //套帽A缓存—-有料 + public static String item_cowl_a_cache = "cowl_a_cache"; + //套帽A缓存—-占位 1 2 + public static String item_cowl_a_cache_seat1 = "cowl_a_cache_seat1"; + public static String item_cowl_a_cache_seat2 = "cowl_a_cache_seat2"; + //套帽A套帽—-有料 + public static String item_cowl_a_cowl = "cowl_a_cowl"; + //套帽A套帽—-占位 1 2 + public static String item_cowl_a_cowl_seat1 = "cowl_a_cowl_seat1"; + public static String item_cowl_a_cowl_seat2 = "cowl_a_cowl_seat2"; + //套帽A套帽—-合格 + public static String item_cowl_a_cowl_pass = "cowl_a_cowl_pass"; + //反向输送—-有料 + public static String item_reverse_convey = "reverse_convey"; + //反向输送—-占位 1 2 3 + public static String item_reverse_convey_seat1 = "reverse_convey_seat1"; + public static String item_reverse_convey_seat2 = "reverse_convey_seat2"; + public static String item_reverse_convey_seat3 = "reverse_convey_seat3"; + //反向输送—-合格 + public static String item_reverse_convey_pass = "reverse_convey_pass"; + //套帽B缓存—-有料 + public static String item_cowl_b_cache = "cowl_b_cache"; + //套帽B缓存—-占位 1 2 + public static String item_cowl_b_cache_seat1 = "cowl_b_cache_seat1"; + public static String item_cowl_b_cache_seat2 = "cowl_b_cache_seat2"; + //套帽B缓存 合格 + public static String item_cowl_b_cache_pass = "cowl_b_cache_pass"; + //套帽B套帽—-有料 + public static String item_cowl_b_cowl = "cowl_b_cowl"; + //套帽B套帽—-占位 1 2 + public static String item_cowl_b_cowl_seat1 = "cowl_b_cowl_seat1"; + public static String item_cowl_b_cowl_seat2 = "cowl_b_cowl_seat2"; + //套帽B套帽—-套帽A合格 + public static String item_cowl_b_cowl_aPass = "cowl_b_cowl_aPass"; + //套帽B套帽—-套帽B合格 + public static String item_cowl_b_cowl_bPass = "cowl_b_cowl_bPass"; + //不合格输送辊缓存计数 + public static String item_no_pass_convey_cache_num = "no_pass_convey_cache_num"; + //裹膜前段—-有料 + public static String item_wrap_ago = "wrap_ago"; + //裹膜前段—-有料 占位1 2 + public static String item_wrap_ago_seat1 = "wrap_ago_seat1"; + public static String item_wrap_ago_seat2 = "wrap_ago_seat2"; + //裹膜后段—-有料 + public static String item_wrap_after = "wrap_after"; + //裹膜后段—-有料 占位1 2 + public static String item_wrap_after_seat1 = "wrap_after_seat1"; + public static String item_wrap_after_seat2 = "wrap_after_seat2"; + //捆扎当前步骤 + public static String item_strapping_current_step = "strapping_current_step"; + //捆扎段占位1---12 + public static String item_strapping_seat1 = "strapping_seat1"; + public static String item_strapping_seat2 = "strapping_seat2"; + public static String item_strapping_seat3 = "strapping_seat3"; + public static String item_strapping_seat4 = "strapping_seat4"; + public static String item_strapping_seat5 = "strapping_seat5"; + public static String item_strapping_seat6 = "strapping_seat6"; + public static String item_strapping_seat7 = "strapping_seat7"; + public static String item_strapping_seat8 = "strapping_seat8"; + public static String item_strapping_seat9 = "strapping_seat9"; + public static String item_strapping_seat10 = "strapping_seat10"; + public static String item_strapping_seat11 = "strapping_seat11"; + public static String item_strapping_seat12 = "strapping_seat12"; + //A侧摇杆出料异常复位 + public static String item_a_error1_clear = "a_error1_clear"; + //B侧摇杆出料异常复位 + public static String item_b_error1_clear = "b_error1_clear"; + //A侧皮带异常复位 + public static String item_a_error2_clear = "a_error2_clear"; + //B侧皮带异常复位 + public static String item_b_error2_clear = "b_error2_clear"; + //裹膜机控制权 + public static String item_wrap_control = "wrap_control"; + //捆扎完成 + public static String item_strapping_finish = "strapping_finish"; + //故障复位 + public static String item_error_clear = "error_clear"; + + private HailiangFlatDeviceDriver driver; + + public ItemProtocol(HailiangFlatDeviceDriver driver) { + this.driver = driver; + } + + public int getis_auto() { + return this.getOpcIntegerValue(item_is_auto); + } + + public int getis_running() { + return this.getOpcIntegerValue(item_is_running); + } + + public int getmode() { + return this.getOpcIntegerValue(item_mode); + } + + public int geta_pressure() { + return this.getOpcIntegerValue(item_a_pressure); + } + + public int getb_pressure() { + return this.getOpcIntegerValue(item_b_pressure); + } + + public int getouter_diameter() { + return this.getOpcIntegerValue(item_outer_diameter); + } + + public int getlength() { + return this.getOpcIntegerValue(item_length); + } + + public int getwall_thickness() { + return this.getOpcIntegerValue(item_wall_thickness); + } + + public int getcolor() { + return this.getOpcIntegerValue(item_color); + } + + public int getjackup_num() { + return this.getOpcIntegerValue(item_jackup_num); + } + + public int getstrap_number() { + return this.getOpcIntegerValue(item_strap_number); + } + + public int getstart() { + return this.getOpcIntegerValue(item_start); + } + + public int getstop() { + return this.getOpcIntegerValue(item_stop); + } + + public int getmain_convey1() { + return this.getOpcIntegerValue(item_main_convey1); + } + + public int getmain_convey1_seat1() { + return this.getOpcIntegerValue(item_main_convey1_seat1); + } + + public int getmain_convey1_seat2() { + return this.getOpcIntegerValue(item_main_convey1_seat2); + } + + public int getink_jet() { + return this.getOpcIntegerValue(item_ink_jet); + } + + public int getink_jet_seat1() { + return this.getOpcIntegerValue(item_ink_jet_seat1); + } + + public int getink_jet_seat2() { + return this.getOpcIntegerValue(item_ink_jet_seat2); + } + + public int getink_jet_seat3() { + return this.getOpcIntegerValue(item_ink_jet_seat3); + } + + public int getmain_convey2() { + return this.getOpcIntegerValue(item_main_convey2); + } + + public int getmain_convey2_seat1() { + return this.getOpcIntegerValue(item_main_convey2_seat1); + } + + public int getmain_convey3_has_pass() { + return this.getOpcIntegerValue(item_main_convey3_has_pass); + } + + public int getmain_convey3_has_noPass() { + return this.getOpcIntegerValue(item_main_convey3_has_noPass); + } + + public int getmain_convey3_seat1() { + return this.getOpcIntegerValue(item_main_convey3_seat1); + } + + public int getmain_convey3_seat2() { + return this.getOpcIntegerValue(item_main_convey3_seat2); + } + + public int getcowl_a_cache() { + return this.getOpcIntegerValue(item_cowl_a_cache); + } + + public int getcowl_a_cache_seat1() { + return this.getOpcIntegerValue(item_cowl_a_cache_seat1); + } + + public int getcowl_a_cache_seat2() { + return this.getOpcIntegerValue(item_cowl_a_cache_seat2); + } + + public int getcowl_a_cowl() { + return this.getOpcIntegerValue(item_cowl_a_cowl); + } + + public int getcowl_a_cowl_seat1() { + return this.getOpcIntegerValue(item_cowl_a_cowl_seat1); + } + + public int getcowl_a_cowl_seat2() { + return this.getOpcIntegerValue(item_cowl_a_cowl_seat2); + } + + public int getcowl_a_cowl_pass() { + return this.getOpcIntegerValue(item_cowl_a_cowl_pass); + } + + public int getreverse_convey() { + return this.getOpcIntegerValue(item_reverse_convey); + } + + public int getreverse_convey_seat1() { + return this.getOpcIntegerValue(item_reverse_convey_seat1); + } + + public int getreverse_convey_seat2() { + return this.getOpcIntegerValue(item_reverse_convey_seat2); + } + + public int getreverse_convey_seat3() { + return this.getOpcIntegerValue(item_reverse_convey_seat3); + } + + public int getreverse_convey_pass() { + return this.getOpcIntegerValue(item_reverse_convey_pass); + } + + public int getcowl_b_cache() { + return this.getOpcIntegerValue(item_cowl_b_cache); + } + + public int getcowl_b_cache_seat1() { + return this.getOpcIntegerValue(item_cowl_b_cache_seat1); + } + + public int getcowl_b_cache_seat2() { + return this.getOpcIntegerValue(item_cowl_b_cache_seat2); + } + + public int getcowl_b_cache_pass() { + return this.getOpcIntegerValue(item_cowl_b_cache_pass); + } + + public int getcowl_b_cowl() { + return this.getOpcIntegerValue(item_cowl_b_cowl); + } + + public int getcowl_b_cowl_seat1() { + return this.getOpcIntegerValue(item_cowl_b_cowl_seat1); + } + + public int getcowl_b_cowl_seat2() { + return this.getOpcIntegerValue(item_cowl_b_cowl_seat2); + } + + public int getcowl_b_cowl_aPass() { + return this.getOpcIntegerValue(item_cowl_b_cowl_aPass); + } + + public int getcowl_b_cowl_bPass() { + return this.getOpcIntegerValue(item_cowl_b_cowl_bPass); + } + + public int getno_pass_convey_cache_num() { + return this.getOpcIntegerValue(item_no_pass_convey_cache_num); + } + + public int getwrap_ago() { + return this.getOpcIntegerValue(item_wrap_ago); + } + + public int getwrap_ago_seat1() { + return this.getOpcIntegerValue(item_wrap_ago_seat1); + } + + public int getwrap_ago_seat2() { + return this.getOpcIntegerValue(item_wrap_ago_seat2); + } + + public int getwrap_after() { + return this.getOpcIntegerValue(item_wrap_after); + } + + public int getwrap_after_seat1() { + return this.getOpcIntegerValue(item_wrap_after_seat1); + } + + public int getwrap_after_seat2() { + return this.getOpcIntegerValue(item_wrap_after_seat2); + } + + public int getstrapping_current_step() { + return this.getOpcIntegerValue(item_strapping_current_step); + } + + public int getstrapping_seat1() { + return this.getOpcIntegerValue(item_strapping_seat1); + } + + public int getstrapping_seat2() { + return this.getOpcIntegerValue(item_strapping_seat2); + } + + public int getstrapping_seat3() { + return this.getOpcIntegerValue(item_strapping_seat3); + } + + public int getstrapping_seat4() { + return this.getOpcIntegerValue(item_strapping_seat4); + } + + public int getstrapping_seat5() { + return this.getOpcIntegerValue(item_strapping_seat5); + } + + public int getstrapping_seat6() { + return this.getOpcIntegerValue(item_strapping_seat6); + } + + public int getstrapping_seat7() { + return this.getOpcIntegerValue(item_strapping_seat7); + } + + public int getstrapping_seat8() { + return this.getOpcIntegerValue(item_strapping_seat8); + } + + public int getstrapping_seat9() { + return this.getOpcIntegerValue(item_strapping_seat9); + } + + public int getstrapping_seat10() { + return this.getOpcIntegerValue(item_strapping_seat10); + } + + public int getstrapping_seat11() { + return this.getOpcIntegerValue(item_strapping_seat11); + } + + public int getstrapping_seat12() { + return this.getOpcIntegerValue(item_strapping_seat12); + } + + public int geta_error1_clear() { + return this.getOpcIntegerValue(item_a_error1_clear); + } + + public int getb_error1_clear() { + return this.getOpcIntegerValue(item_b_error1_clear); + } + + public int geta_error2_clear() { + return this.getOpcIntegerValue(item_a_error2_clear); + } + + public int getb_error2_clear() { + return this.getOpcIntegerValue(item_b_error2_clear); + } + + public int getwrap_control() { + return this.getOpcIntegerValue(item_wrap_control); + } + + public int getstrapping_finish() { + return this.getOpcIntegerValue(item_strapping_finish); + } + + public int geterror_clear() { + return this.getOpcIntegerValue(item_error_clear); + } + + + //是否有货 + public int hasGoods(int move) { + return move; + } + + Boolean isonline; + + public int getOpcIntegerValue(String protocol) { + Integer value = this.driver.getIntegeregerValue(protocol); + if (value == null) { + log.error(this.getDriver().getDeviceCode() + ":protocol " + protocol + " 信号同步异常!"); + setIsonline(false); + } else { + setIsonline(true); + return value; + } + return 0; + + } + + public String getOpcStringValue(String protocol) { + String value = this.driver.getStringValue(protocol); + if (StrUtil.isEmpty(value)) { + + } else { + return value; + } + return "0"; + } + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_is_auto, "手自动", "I18.1")); + list.add(new ItemDto(item_is_running, "系统运行", "M4.2")); + list.add(new ItemDto(item_mode, "联机模式", "DB1.X0.3")); + list.add(new ItemDto(item_a_pressure, "A侧挡压压力", "DB219.D20")); + list.add(new ItemDto(item_b_pressure, "B侧挡压压力", "DB239.D20")); + list.add(new ItemDto(item_outer_diameter, "管径(mm)", "DB1.D6")); + list.add(new ItemDto(item_length, "管长(mm)", "DB1.D2")); + list.add(new ItemDto(item_wall_thickness, "壁厚(mm)", "DB1.D10")); + list.add(new ItemDto(item_color, "颜色", "DB1.W14")); + list.add(new ItemDto(item_jackup_num, "合格每次提升根数", "DB2.W2")); + list.add(new ItemDto(item_strap_number, "每捆根数", "DB2.W4")); + list.add(new ItemDto(item_start, "启动", "M4.0")); + list.add(new ItemDto(item_stop, "停止", "M4.1")); + list.add(new ItemDto(item_main_convey1, "主输送一段-有料", "DB14.X4.0")); + list.add(new ItemDto(item_main_convey1_seat1, "主输送一段-占位1", "I22.4")); + list.add(new ItemDto(item_main_convey1_seat2, "主输送一段-占位2", "I22.5")); + list.add(new ItemDto(item_ink_jet, "喷墨-一段出料完成", "DB14.X3.6")); + list.add(new ItemDto(item_ink_jet_seat1, "喷墨-占位1", "I23.5")); + list.add(new ItemDto(item_ink_jet_seat2, "喷墨-占位2", "I23.4")); + list.add(new ItemDto(item_ink_jet_seat3, "喷墨-占位3", "I39.6")); + list.add(new ItemDto(item_main_convey2, "主输送二段—有料", "DB14.X4.1")); + list.add(new ItemDto(item_main_convey2_seat1, "主输送二段—占位1", "I22.6")); + list.add(new ItemDto(item_main_convey3_has_pass, "主输送三段-有料合格", "DB14.X4.2")); + list.add(new ItemDto(item_main_convey3_has_noPass, "主输送三段-有料不合格", "DB14.X4.3")); + list.add(new ItemDto(item_main_convey3_seat1, "主输送三段-占位1", "I23.0")); + list.add(new ItemDto(item_main_convey3_seat2, "主输送三段-占位2", "I22.7")); + list.add(new ItemDto(item_cowl_a_cache, "套帽A缓存-有料", "DB15.X2.0")); + list.add(new ItemDto(item_cowl_a_cache_seat1, "套帽A缓存-占位1", "I26.0")); + list.add(new ItemDto(item_cowl_a_cache_seat2, "套帽A缓存-占位2", "I26.1")); + list.add(new ItemDto(item_cowl_a_cowl, "套帽A套帽-有料", "DB15.X2.4")); + list.add(new ItemDto(item_cowl_a_cowl_seat1, "套帽A套帽-占位1", "I26.2")); + list.add(new ItemDto(item_cowl_a_cowl_seat2, "套帽A套帽-占位2", "I26.3")); + list.add(new ItemDto(item_cowl_a_cowl_pass, "套帽A套帽-合格", "DB254.X1.6")); + list.add(new ItemDto(item_reverse_convey, "反向输送-有料", "DB14.X4.4")); + list.add(new ItemDto(item_reverse_convey_seat1, "反向输送-占位1", "I23.3")); + list.add(new ItemDto(item_reverse_convey_seat2, "反向输送-占位2", "I23.2")); + list.add(new ItemDto(item_reverse_convey_seat3, "反向输送-占位3", "I23.1")); + list.add(new ItemDto(item_reverse_convey_pass, "反向输送-合格", "DB256.X1.6")); + list.add(new ItemDto(item_cowl_b_cache, "套帽B缓存-有料", "DB15.X2.1")); + list.add(new ItemDto(item_cowl_b_cache_seat1, "套帽B缓存-占位1", "I28.4")); + list.add(new ItemDto(item_cowl_b_cache_seat2, "套帽B缓存-占位2", "I28.5")); + list.add(new ItemDto(item_cowl_b_cache_pass, "套帽B缓存-合格", "DB256.X12.4")); + list.add(new ItemDto(item_cowl_b_cowl, "套帽B套帽-有料", "DB15.X2.5")); + list.add(new ItemDto(item_cowl_b_cowl_seat1, "套帽B套帽-占位1", "I28.6")); + list.add(new ItemDto(item_cowl_b_cowl_seat2, "套帽B套帽-占位2", "I28.7")); + list.add(new ItemDto(item_cowl_b_cowl_aPass, "套帽B套帽-套帽A合格", "DB15.X3.4")); + list.add(new ItemDto(item_cowl_b_cowl_bPass, "套帽B套帽-套帽B合格", "DB15.X3.5")); + list.add(new ItemDto(item_no_pass_convey_cache_num, "不合格输送辊缓存计数", "DB2.W12")); + list.add(new ItemDto(item_wrap_ago, "裹膜前段-有料", "DB3.X48.0")); + list.add(new ItemDto(item_wrap_ago_seat1, "裹膜前段-占位1", "I29.3")); + list.add(new ItemDto(item_wrap_ago_seat2, "裹膜前段-占位2", "I29.4")); + list.add(new ItemDto(item_wrap_after, "裹膜后段-有料", "DB3.X48.1")); + list.add(new ItemDto(item_wrap_after_seat1, "裹膜后段-占位1", "I29.5")); + list.add(new ItemDto(item_wrap_after_seat2, "裹膜后段-占位1", "I29.6")); + list.add(new ItemDto(item_strapping_current_step, "捆扎当前步骤", "DB3.W54")); + list.add(new ItemDto(item_strapping_seat1, "捆扎段占位1", "I32.7")); + list.add(new ItemDto(item_strapping_seat2, "捆扎段占位2", "I29.0")); + list.add(new ItemDto(item_strapping_seat3, "捆扎段占位3", "I33.1")); + list.add(new ItemDto(item_strapping_seat4, "捆扎段占位4", "I29.1")); + list.add(new ItemDto(item_strapping_seat5, "捆扎段占位5", "I34.7")); + list.add(new ItemDto(item_strapping_seat6, "捆扎段占位6", "I29.2")); + list.add(new ItemDto(item_strapping_seat7, "捆扎段占位7", "I29.3")); + list.add(new ItemDto(item_strapping_seat8, "捆扎段占位8", "I29.4")); + list.add(new ItemDto(item_strapping_seat9, "捆扎段占位9", "I29.5")); + list.add(new ItemDto(item_strapping_seat10, "捆扎段占位10", "I29.6")); + list.add(new ItemDto(item_strapping_seat10, "捆扎段占位11", "I35.5")); + list.add(new ItemDto(item_strapping_seat12, "捆扎段占位12", "I36.7")); + list.add(new ItemDto(item_a_error1_clear, "A侧摇杆出料异常复位", "DB214.X10.7")); + list.add(new ItemDto(item_b_error1_clear, "B侧摇杆出料异常复位", "DB234.X10.7")); + list.add(new ItemDto(item_a_error2_clear, "A侧皮带异常复位", "DB201.X14.7")); + list.add(new ItemDto(item_b_error2_clear, "B侧皮带异常复位", "DB221.X14.7")); + list.add(new ItemDto(item_wrap_control, "裹膜机控制权", "DB360.X2.3")); + list.add(new ItemDto(item_strapping_finish, "捆扎完成", "M4.5")); + list.add(new ItemDto(item_error_clear, "故障复位", "M5.2")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + ///list.add(new ItemDto(item_is_auto, "手自动", "I18.1")); + //list.add(new ItemDto(item_is_running, "系统运行", "M4.2")); + // list.add(new ItemDto(item_mode, "联机模式", "DB1.DBX0.3")); + // list.add(new ItemDto(item_a_pressure, "A侧挡压压力", "DB219.DBD20")); + // list.add(new ItemDto(item_b_pressure, "B侧挡压压力", "DB239.DBD20")); + list.add(new ItemDto(item_outer_diameter, "管径(mm)", "DB1.D6")); + list.add(new ItemDto(item_length, "管长(mm)", "DB1.D2")); + list.add(new ItemDto(item_wall_thickness, "壁厚(mm)", "DB1.D10")); + list.add(new ItemDto(item_color, "颜色", "DB1.W14")); + list.add(new ItemDto(item_jackup_num, "合格每次提升根数", "DB2.W2")); + list.add(new ItemDto(item_strap_number, "每捆根数", "DB2.W4")); + list.add(new ItemDto(item_start, "启动", "M4.0")); + list.add(new ItemDto(item_stop, "停止", "M4.1")); + list.add(new ItemDto(item_main_convey1, "主输送一段-有料", "DB14.X4.0")); + //list.add(new ItemDto(item_main_convey1_seat1, "主输送一段-占位1", "I22.4")); + //list.add(new ItemDto(item_main_convey1_seat2, "主输送一段-占位2", "I22.5")); + list.add(new ItemDto(item_ink_jet, "喷墨-一段出料完成", "DB14.X3.6")); + //list.add(new ItemDto(item_ink_jet_seat1, "喷墨-占位1", "I23.5")); + //list.add(new ItemDto(item_ink_jet_seat2, "喷墨-占位2", "I23.4")); + // list.add(new ItemDto(item_ink_jet_seat3, "喷墨-占位3", "I39.6")); + list.add(new ItemDto(item_main_convey2, "主输送二段—有料", "DB14.X4.1")); + //list.add(new ItemDto(item_main_convey2_seat1, "主输送二段—占位1", "I22.6")); + list.add(new ItemDto(item_main_convey3_has_pass, "主输送三段-有料合格", "DB14.X4.2")); + list.add(new ItemDto(item_main_convey3_has_noPass, "主输送三段-有料不合格", "DB14.X4.3")); + //list.add(new ItemDto(item_main_convey3_seat1, "主输送三段-占位1", "I23.0")); + //list.add(new ItemDto(item_main_convey3_seat2, "主输送三段-占位2", "I22.7")); + list.add(new ItemDto(item_cowl_a_cache, "套帽A缓存-有料", "DB15.X2.0")); + //list.add(new ItemDto(item_cowl_a_cache_seat1, "套帽A缓存-占位1", "I26.0")); + //list.add(new ItemDto(item_cowl_a_cache_seat2, "套帽A缓存-占位2", "I26.1")); + list.add(new ItemDto(item_cowl_a_cowl, "套帽A套帽-有料", "DB15.X2.4")); + //list.add(new ItemDto(item_cowl_a_cowl_seat1, "套帽A套帽-占位1", "I26.2")); + //list.add(new ItemDto(item_cowl_a_cowl_seat2, "套帽A套帽-占位2", "I26.3")); + list.add(new ItemDto(item_cowl_a_cowl_pass, "套帽A套帽-合格", "DB254.X1.6")); + list.add(new ItemDto(item_reverse_convey, "反向输送-有料", "DB14.X4.4")); + //list.add(new ItemDto(item_reverse_convey_seat1, "反向输送-占位1", "I23.3")); + //list.add(new ItemDto(item_reverse_convey_seat2, "反向输送-占位2", "I23.2")); + //list.add(new ItemDto(item_reverse_convey_seat3, "反向输送-占位3", "I23.1")); + list.add(new ItemDto(item_reverse_convey_pass, "反向输送-合格", "DB256.X1.6")); + list.add(new ItemDto(item_cowl_b_cache, "套帽B缓存-有料", "DB15.X2.1")); + //list.add(new ItemDto(item_cowl_b_cache_seat1, "套帽B缓存-占位1", "I28.4")); + //list.add(new ItemDto(item_cowl_b_cache_seat2, "套帽B缓存-占位2", "I28.5")); + list.add(new ItemDto(item_cowl_b_cache_pass, "套帽B缓存-合格", "DB256.X12.4")); + list.add(new ItemDto(item_cowl_b_cowl, "套帽B套帽-有料", "DB15.X2.5")); + //list.add(new ItemDto(item_cowl_b_cowl_seat1, "套帽B套帽-占位1", "I28.6")); + // list.add(new ItemDto(item_cowl_b_cowl_seat2, "套帽B套帽-占位2", "I28.7")); + list.add(new ItemDto(item_cowl_b_cowl_aPass, "套帽B套帽-套帽A合格", "DB15.X3.4")); + list.add(new ItemDto(item_cowl_b_cowl_bPass, "套帽B套帽-套帽B合格", "DB15.X3.5")); + list.add(new ItemDto(item_no_pass_convey_cache_num, "不合格输送辊缓存计数", "DB2.W12")); + list.add(new ItemDto(item_wrap_ago, "裹膜前段-有料", "DB3.X48.0")); + //list.add(new ItemDto(item_wrap_ago_seat1, "裹膜前段-占位1", "I29.3")); + //list.add(new ItemDto(item_wrap_ago_seat2, "裹膜前段-占位2", "I29.4")); + list.add(new ItemDto(item_wrap_after, "裹膜后段-有料", "DB3.X48.1")); + //list.add(new ItemDto(item_wrap_after_seat1, "裹膜后段-占位1", "I29.5")); + //list.add(new ItemDto(item_wrap_after_seat2, "裹膜后段-占位1", "I29.6")); + list.add(new ItemDto(item_strapping_current_step, "捆扎当前步骤", "DB3.W54")); + //list.add(new ItemDto(item_strapping_seat1, "捆扎段占位1", "I32.7")); + //list.add(new ItemDto(item_strapping_seat2, "捆扎段占位2", "I29.0")); + //list.add(new ItemDto(item_strapping_seat3, "捆扎段占位3", "I33.1")); + //list.add(new ItemDto(item_strapping_seat4, "捆扎段占位4", "I29.1")); + //list.add(new ItemDto(item_strapping_seat5, "捆扎段占位5", "I34.7")); + //list.add(new ItemDto(item_strapping_seat6, "捆扎段占位6", "I29.2")); + // list.add(new ItemDto(item_strapping_seat7, "捆扎段占位7", "I29.3")); + //list.add(new ItemDto(item_strapping_seat8, "捆扎段占位8", "I29.4")); + //list.add(new ItemDto(item_strapping_seat9, "捆扎段占位9", "I29.5")); + //list.add(new ItemDto(item_strapping_seat10, "捆扎段占位10", "I29.6")); + //list.add(new ItemDto(item_strapping_seat10, "捆扎段占位11", "I35.5")); + //list.add(new ItemDto(item_strapping_seat12, "捆扎段占位12", "I36.7")); + list.add(new ItemDto(item_a_error1_clear, "A侧摇杆出料异常复位", "DB214.X10.7")); + list.add(new ItemDto(item_b_error1_clear, "B侧摇杆出料异常复位", "DB234.X10.7")); + list.add(new ItemDto(item_a_error2_clear, "A侧皮带异常复位", "DB201.X14.7")); + list.add(new ItemDto(item_b_error2_clear, "B侧皮带异常复位", "DB221.X14.7")); + list.add(new ItemDto(item_wrap_control, "裹膜机控制权", "DB360.X2.3")); + list.add(new ItemDto(item_strapping_finish, "捆扎完成", "M4.5")); + list.add(new ItemDto(item_error_clear, "故障复位", "M5.2")); + return list; + } + +} + diff --git a/nladmin-system/src/main/java/org/nl/hand/rest/HandController.java b/nladmin-system/src/main/java/org/nl/hand/rest/HandController.java index 41c020e..062c2b0 100644 --- a/nladmin-system/src/main/java/org/nl/hand/rest/HandController.java +++ b/nladmin-system/src/main/java/org/nl/hand/rest/HandController.java @@ -122,4 +122,11 @@ public class HandController { public ResponseEntity putPoint(@RequestBody Map param) { return new ResponseEntity<>(handService.putPoint(param), HttpStatus.OK); } + + @PostMapping("/queryDeviceInfo") + @Log("信号查询(定时)") + @ApiOperation("信号查询(定时)") + public ResponseEntity queryDeviceInfo() { + return new ResponseEntity<>(handService.queryDeviceInfo(), HttpStatus.OK); + } } diff --git a/nladmin-system/src/main/java/org/nl/hand/service/HandService.java b/nladmin-system/src/main/java/org/nl/hand/service/HandService.java index cab2a31..a2352a1 100644 --- a/nladmin-system/src/main/java/org/nl/hand/service/HandService.java +++ b/nladmin-system/src/main/java/org/nl/hand/service/HandService.java @@ -70,4 +70,6 @@ public interface HandService { * @return 提示 */ JSONObject putPoint(Map param); + + JSONObject queryDeviceInfo(); } diff --git a/nladmin-system/src/main/java/org/nl/hand/service/impl/HandServiceImpl.java b/nladmin-system/src/main/java/org/nl/hand/service/impl/HandServiceImpl.java index 34794e5..4fd7dae 100644 --- a/nladmin-system/src/main/java/org/nl/hand/service/impl/HandServiceImpl.java +++ b/nladmin-system/src/main/java/org/nl/hand/service/impl/HandServiceImpl.java @@ -8,6 +8,8 @@ import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.nl.acs.device_driver.hailiang.hailiang_feeding_trunk.HaiLiangFeedingTrunkDeviceDriver; +import org.nl.acs.device_driver.hailiang.hailiang_flat.HailiangFlatDeviceDriver; +import org.nl.acs.opc.Device; import org.nl.acs.opc.DeviceAppService; import org.nl.acs.order.service.ProduceshiftorderService; import org.nl.acs.order.service.ProduceshiftorderdetailService; @@ -406,52 +408,196 @@ public class HandServiceImpl implements HandService { public JSONObject putPoint(Map param) { // 返回值 JSONObject resultJSON = new JSONObject(); - - // 参数校验 - String outerDiameter = param.get("outer_diameter"); - if (StrUtil.isEmpty(outerDiameter)) { - resultJSON.put("code", "0"); - resultJSON.put("desc", "管径不能为空"); - return resultJSON; - } - String length = param.get("length"); - if (StrUtil.isEmpty(length)) { - resultJSON.put("code", "0"); - resultJSON.put("desc", "管长不能为空"); - return resultJSON; - } - String color = param.get("color"); - if (StrUtil.isEmpty(color)) { - resultJSON.put("code", "0"); - resultJSON.put("desc", "颜色不能为空"); - return resultJSON; - } - String jackupNum = param.get("jackup_num"); - if (StrUtil.isEmpty(jackupNum)) { - resultJSON.put("code", "0"); - resultJSON.put("desc", "合格提升每次提升根数不能为空"); - return resultJSON; - } - String strapNumber = param.get("strap_number"); - if (StrUtil.isEmpty(strapNumber)) { - resultJSON.put("code", "0"); - resultJSON.put("desc", "每捆根数不能为空"); - return resultJSON; + String name = param.get("name"); + String type = param.get("type"); + String value = param.get("value"); + Device device = deviceAppService.findDeviceByCode("PB01"); + HailiangFlatDeviceDriver hailiangFlatDeviceDriver; + if (device.getDeviceDriver() instanceof HailiangFlatDeviceDriver){ + hailiangFlatDeviceDriver = (HailiangFlatDeviceDriver) device.getDeviceDriver(); + if (type.equals("1")){ + hailiangFlatDeviceDriver.writing(name,value); + }else if (type.equals("2")){ + int realValue = hailiangFlatDeviceDriver.getItemProtocol().getOpcIntegerValue(name); + if (realValue == 0){ + realValue = 1; + } else if (realValue == 1){ + realValue = 0; + } + hailiangFlatDeviceDriver.writing(name,String.valueOf(realValue)); + } else { + hailiangFlatDeviceDriver.writing(name,value); + } } - - // 获取设备驱动 - HaiLiangFeedingTrunkDeviceDriver driver = deviceAppService.findDeviceDriver(HaiLiangFeedingTrunkDeviceDriver.class).get(0); - - // 写信号 - driver.writing("to_outer_diameter", outerDiameter); - driver.writing("to_length", length); - driver.writing("to_color", color); - driver.writing("to_jackup_num", jackupNum); - driver.writing("to_one_strapping_qty", strapNumber); - // 返回 resultJSON.put("code", "1"); resultJSON.put("desc", "下发成功"); return resultJSON; } + + @Override + public JSONObject queryDeviceInfo() { + Device device = deviceAppService.findDeviceByCode("PB01"); + JSONObject resp = new JSONObject(); + HailiangFlatDeviceDriver hailiangFlatDeviceDriver; + if (device.getDeviceDriver() instanceof HailiangFlatDeviceDriver){ + hailiangFlatDeviceDriver = (HailiangFlatDeviceDriver) device.getDeviceDriver(); + int is_auto = hailiangFlatDeviceDriver.getIs_auto(); + int is_running = hailiangFlatDeviceDriver.getIs_running(); + int mode = hailiangFlatDeviceDriver.getMode(); + int a_pressure = hailiangFlatDeviceDriver.getA_pressure(); + int b_pressure = hailiangFlatDeviceDriver.getB_pressure(); + int outer_diameter = hailiangFlatDeviceDriver.getOuter_diameter(); + int length = hailiangFlatDeviceDriver.getLength(); + int wall_thickness = hailiangFlatDeviceDriver.getWall_thickness(); + int color = hailiangFlatDeviceDriver.getColor(); + int jackup_num = hailiangFlatDeviceDriver.getJackup_num(); + int strap_number = hailiangFlatDeviceDriver.getStrap_number(); + int start = hailiangFlatDeviceDriver.getStart(); + int stop = hailiangFlatDeviceDriver.getStop(); + int main_convey1 = hailiangFlatDeviceDriver.getMain_convey1(); + int main_convey1_seat1 = hailiangFlatDeviceDriver.getMain_convey1_seat1(); + int main_convey1_seat2 = hailiangFlatDeviceDriver.getMain_convey1_seat2(); + int ink_jet = hailiangFlatDeviceDriver.getInk_jet(); + int ink_jet_seat1 = hailiangFlatDeviceDriver.getInk_jet_seat1(); + int ink_jet_seat2 = hailiangFlatDeviceDriver.getInk_jet_seat2(); + int ink_jet_seat3 = hailiangFlatDeviceDriver.getInk_jet_seat3(); + int main_convey2 = hailiangFlatDeviceDriver.getMain_convey2(); + int main_convey2_seat1 = hailiangFlatDeviceDriver.getMain_convey2_seat1(); + int main_convey3_has_pass = hailiangFlatDeviceDriver.getMain_convey3_has_pass(); + int main_convey3_has_noPass = hailiangFlatDeviceDriver.getMain_convey3_has_noPass(); + int main_convey3_seat1 = hailiangFlatDeviceDriver.getMain_convey3_seat1(); + int main_convey3_seat2 = hailiangFlatDeviceDriver.getMain_convey3_seat2(); + int cowl_a_cache = hailiangFlatDeviceDriver.getCowl_a_cache(); + int cowl_a_cache_seat1 = hailiangFlatDeviceDriver.getCowl_a_cache_seat1(); + int cowl_a_cache_seat2 = hailiangFlatDeviceDriver.getCowl_a_cache_seat2(); + int cowl_a_cowl = hailiangFlatDeviceDriver.getCowl_a_cowl(); + int cowl_a_cowl_seat1 = hailiangFlatDeviceDriver.getCowl_a_cowl_seat1(); + int cowl_a_cowl_seat2 = hailiangFlatDeviceDriver.getCowl_a_cowl_seat2(); + int cowl_a_cowl_pass = hailiangFlatDeviceDriver.getCowl_a_cowl_pass(); + int reverse_convey = hailiangFlatDeviceDriver.getReverse_convey(); + int reverse_convey_seat1 = hailiangFlatDeviceDriver.getReverse_convey_seat1(); + int reverse_convey_seat2 = hailiangFlatDeviceDriver.getReverse_convey_seat2(); + int reverse_convey_seat3 = hailiangFlatDeviceDriver.getReverse_convey_seat3(); + int reverse_convey_pass = hailiangFlatDeviceDriver.getReverse_convey_pass(); + int cowl_b_cache = hailiangFlatDeviceDriver.getCowl_b_cache(); + int cowl_b_cache_seat1 = hailiangFlatDeviceDriver.getCowl_b_cache_seat1(); + int cowl_b_cache_seat2 = hailiangFlatDeviceDriver.getCowl_b_cache_seat2(); + int cowl_b_cache_pass = hailiangFlatDeviceDriver.getCowl_b_cache_pass(); + int cowl_b_cowl = hailiangFlatDeviceDriver.getCowl_b_cowl(); + int cowl_b_cowl_seat1 = hailiangFlatDeviceDriver.getCowl_b_cowl_seat1(); + int cowl_b_cowl_seat2 = hailiangFlatDeviceDriver.getCowl_b_cowl_seat2(); + int cowl_b_cowl_aPass = hailiangFlatDeviceDriver.getCowl_b_cowl_aPass(); + int cowl_b_cowl_bPass = hailiangFlatDeviceDriver.getCowl_b_cowl_bPass(); + int no_pass_convey_cache_num = hailiangFlatDeviceDriver.getNo_pass_convey_cache_num(); + int wrap_ago = hailiangFlatDeviceDriver.getWrap_ago(); + int wrap_ago_seat1 = hailiangFlatDeviceDriver.getWrap_ago_seat1(); + int wrap_ago_seat2 = hailiangFlatDeviceDriver.getWrap_ago_seat2(); + int wrap_after = hailiangFlatDeviceDriver.getWrap_after(); + int wrap_after_seat1 = hailiangFlatDeviceDriver.getWrap_after_seat1(); + int wrap_after_seat2 = hailiangFlatDeviceDriver.getWrap_after_seat2(); + int strapping_current_step = hailiangFlatDeviceDriver.getStrapping_current_step(); + int strapping_seat1 = hailiangFlatDeviceDriver.getStrapping_seat1(); + int strapping_seat2 = hailiangFlatDeviceDriver.getStrapping_seat2(); + int strapping_seat3 = hailiangFlatDeviceDriver.getStrapping_seat3(); + int strapping_seat4 = hailiangFlatDeviceDriver.getStrapping_seat4(); + int strapping_seat5 = hailiangFlatDeviceDriver.getStrapping_seat5(); + int strapping_seat6 = hailiangFlatDeviceDriver.getStrapping_seat6(); + int strapping_seat7 = hailiangFlatDeviceDriver.getStrapping_seat7(); + int strapping_seat8 = hailiangFlatDeviceDriver.getStrapping_seat8(); + int strapping_seat9 = hailiangFlatDeviceDriver.getStrapping_seat9(); + int strapping_seat10 = hailiangFlatDeviceDriver.getStrapping_seat10(); + int strapping_seat11 = hailiangFlatDeviceDriver.getStrapping_seat11(); + int strapping_seat12 = hailiangFlatDeviceDriver.getStrapping_seat12(); + int a_error1_clear = hailiangFlatDeviceDriver.getA_error1_clear(); + int b_error1_clear = hailiangFlatDeviceDriver.getB_error1_clear(); + int a_error2_clear = hailiangFlatDeviceDriver.getA_error2_clear(); + int b_error2_clear = hailiangFlatDeviceDriver.getB_error2_clear(); + int wrap_control = hailiangFlatDeviceDriver.getWrap_control(); + int strapping_finish = hailiangFlatDeviceDriver.getStrapping_finish(); + int error_clear = hailiangFlatDeviceDriver.getError_clear(); + resp.put("code","1"); + resp.put("desc","查询成功"); + JSONObject result = new JSONObject(); + result.put("is_auto",is_auto); + result.put("is_running",is_running); + result.put("mode",mode); + result.put("a_pressure",a_pressure); + result.put("b_pressure",b_pressure); + result.put("outer_diameter",outer_diameter); + result.put("length",length); + result.put("wall_thickness",wall_thickness); + result.put("color",color); + result.put("jackup_num",jackup_num); + result.put("strap_number",strap_number); + result.put("start",start); + result.put("stop",stop); + result.put("main_convey1",main_convey1); + result.put("main_convey1_seat1",main_convey1_seat1); + result.put("main_convey1_seat2",main_convey1_seat2); + result.put("ink_jet",ink_jet); + result.put("ink_jet_seat1",ink_jet_seat1); + result.put("ink_jet_seat2",ink_jet_seat2); + result.put("ink_jet_seat3",ink_jet_seat3); + result.put("main_convey2",main_convey2); + result.put("main_convey2_seat1",main_convey2_seat1); + result.put("main_convey3_has_pass",main_convey3_has_pass); + result.put("main_convey3_has_noPass",main_convey3_has_noPass); + result.put("main_convey3_seat1",main_convey3_seat1); + result.put("main_convey3_seat2",main_convey3_seat2); + result.put("cowl_a_cache",cowl_a_cache); + result.put("cowl_a_cache_seat1",cowl_a_cache_seat1); + result.put("cowl_a_cache_seat2",cowl_a_cache_seat2); + result.put("cowl_a_cowl",cowl_a_cowl); + result.put("cowl_a_cowl_seat1",cowl_a_cowl_seat1); + result.put("cowl_a_cowl_seat2",cowl_a_cowl_seat2); + result.put("cowl_a_cowl_pass",cowl_a_cowl_pass); + result.put("reverse_convey",reverse_convey); + result.put("reverse_convey_seat1",reverse_convey_seat1); + result.put("reverse_convey_seat2",reverse_convey_seat2); + result.put("reverse_convey_seat3",reverse_convey_seat3); + result.put("reverse_convey_pass",reverse_convey_pass); + result.put("cowl_b_cache",cowl_b_cache); + result.put("cowl_b_cache_seat1",cowl_b_cache_seat1); + result.put("cowl_b_cache_seat2",cowl_b_cache_seat2); + result.put("cowl_b_cache_pass",cowl_b_cache_pass); + result.put("cowl_b_cowl",cowl_b_cowl); + result.put("cowl_b_cowl_seat1",cowl_b_cowl_seat1); + result.put("cowl_b_cowl_seat2",cowl_b_cowl_seat2); + result.put("cowl_b_cowl_aPass",cowl_b_cowl_aPass); + result.put("cowl_b_cowl_bPass",cowl_b_cowl_bPass); + result.put("no_pass_convey_cache_num",no_pass_convey_cache_num); + result.put("wrap_ago",wrap_ago); + result.put("wrap_ago_seat1",wrap_ago_seat1); + result.put("wrap_ago_seat2",wrap_ago_seat2); + result.put("wrap_after",wrap_after); + result.put("wrap_after_seat1",wrap_after_seat1); + result.put("wrap_after_seat2",wrap_after_seat2); + result.put("strapping_current_step",strapping_current_step); + result.put("strapping_seat1",strapping_seat1); + result.put("strapping_seat2",strapping_seat2); + result.put("strapping_seat3",strapping_seat3); + result.put("strapping_seat4",strapping_seat4); + result.put("strapping_seat5",strapping_seat5); + result.put("strapping_seat6",strapping_seat6); + result.put("strapping_seat7",strapping_seat7); + result.put("strapping_seat8",strapping_seat8); + result.put("strapping_seat9",strapping_seat9); + result.put("strapping_seat10",strapping_seat10); + result.put("strapping_seat11",strapping_seat11); + result.put("strapping_seat12",strapping_seat12); + result.put("a_error1_clear",a_error1_clear); + result.put("b_error1_clear",b_error1_clear); + result.put("a_error2_clear",a_error2_clear); + result.put("b_error2_clear",b_error2_clear); + result.put("wrap_control",wrap_control); + result.put("strapping_finish",strapping_finish); + result.put("error_clear",error_clear); + resp.put("result",result); + return resp; + } + resp.put("code","0"); + resp.put("desc","查询失败"); + return resp; + } } diff --git a/qd/src/views/acs/device/config.vue b/qd/src/views/acs/device/config.vue index 8ecac28..59cdeba 100644 --- a/qd/src/views/acs/device/config.vue +++ b/qd/src/views/acs/device/config.vue @@ -102,6 +102,7 @@ import hailiang_lettering from '@/views/acs/device/driver/hailing_zgbz/hailiang_ import hailiang_risking from '@/views/acs/device/driver/hailing_zgbz/hailiang_risking' import hailiang_strapping from '@/views/acs/device/driver/hailing_zgbz/hailiang_strapping' import hailiang_coating from '@/views/acs/device/driver/hailing_zgbz/hailiang_coating' +import hailiang_flat from '@/views/acs/device/driver/hailing_zgbz/hailiang_flat' import hailiang_special_pick_station from '@/views/acs/device/driver/hailiang_one/hailiang_special_pick_station' import hailiang_special_empty_station from '@/views/acs/device/driver/hailiang_one/hailiang_special_empty_station' @@ -116,7 +117,7 @@ export default { lamp_three_color, standard_storage, special_ordinary_site, standard_scanner, standard_conveyor_control_with_scanner, standard_conveyor_control_with_plcscanner, standard_conveyor_control, standard_conveyor_monitor, weighing_site, machines_site, non_line_manipulator_inspect_site, non_line_inspect_site, manipulator_inspect_site_NDC, standard_manipulator_stacking_site, - standard_photoelectric_inspect_site, ndxy_special, + standard_photoelectric_inspect_site, ndxy_special, hailiang_flat, hailiang_labeling, hailiang_feeding_trunk, hailiang_feeding, hailiang_lettering, hailiang_risking, hailiang_strapping, hailiang_coating, hailiang_special_pick_station, hailiang_special_empty_station, hailiang_special_full_station, hailiang_special_pour_station, hailiang_special_device }, dicts: ['device_type'], diff --git a/qd/src/views/acs/device/driver/hailing_zgbz/hailiang_flat.vue b/qd/src/views/acs/device/driver/hailing_zgbz/hailiang_flat.vue new file mode 100644 index 0000000..7f83048 --- /dev/null +++ b/qd/src/views/acs/device/driver/hailing_zgbz/hailiang_flat.vue @@ -0,0 +1,458 @@ + + + + +