From cdd4592594b66ea6cb60bb9815bd0196a2fd5e15 Mon Sep 17 00:00:00 2001 From: "USER-20220102CG\\noblelift" <546428999@qq.com> Date: Thu, 4 May 2023 16:13:34 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E5=8C=85=E8=A3=85=E7=A0=81=E5=9E=9B?= =?UTF-8?q?=E6=9C=BA=E6=A2=B0=E6=89=8B=E5=B7=A5=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/device_driver/DriverTypeEnum.java | 5 +- .../driver/AbstractOpcDeviceDriver.java | 21 +- .../device_driver/driver/OpcDeviceDriver.java | 2 +- .../LnshLaminatingMachineDeviceDriver.java | 3 +- ...hPackagePalletManipulatorDeviceDriver.java | 4 +- .../ItemProtocol.java | 984 +++++++++++ ...ePalletizingManipulatorSiteDefination.java | 63 + ...alletizingManipulatorSiteDeviceDriver.java | 1507 +++++++++++++++++ ...nshPalletizingManipulatorDeviceDriver.java | 3 +- ...alletizingManipulatorSiteDeviceDriver.java | 3 +- .../lnsh_station/LnshStationDeviceDriver.java | 2 + ...agePalletSplitManipulatorDeviceDriver.java | 4 +- .../nl/acs/opc/DeviceOpcProtocolRunable.java | 102 +- .../java/org/nl/acs/opc/OpcServerService.java | 2 +- .../org/nl/acs/opc/OpcServerServiceImpl.java | 142 +- .../auto/run/NDCSocketConnectionAutoRun.java | 262 ++- acs/qd/src/views/acs/device/config.vue | 3 +- ...h_package_palletizing_manipulator_site.vue | 528 ++++++ 18 files changed, 3437 insertions(+), 203 deletions(-) create mode 100644 acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_palletizing_manipulator_site/ItemProtocol.java create mode 100644 acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_palletizing_manipulator_site/LnshPackagePalletizingManipulatorSiteDefination.java create mode 100644 acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_palletizing_manipulator_site/LnshPackagePalletizingManipulatorSiteDeviceDriver.java create mode 100644 acs/qd/src/views/acs/device/driver/lnsh/lnsh_package_palletizing_manipulator_site.vue diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java index f2c241f..293ac76 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device/device_driver/DriverTypeEnum.java @@ -57,7 +57,10 @@ public enum DriverTypeEnum { LNSH_PALLETIZING_MANIPULATOR_SITE(54, "lnsh_palletizing_manipulator_site", "嘉耐-码垛机械手工位", "station"), - LNSH_ONE_RGV(55, "lnsh_one_rgv", "嘉耐单工位RGV", "rgv"); + LNSH_ONE_RGV(55, "lnsh_one_rgv", "嘉耐单工位RGV", "rgv"), + + LNSH_PACKAGE_PALLETIZING_MANIPULATOR_SITE(56, "lnsh_package_palletizing_manipulator_site", "嘉耐-包装码垛机械手工位", "station"); + //驱动索引 private int index; diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java index 28e76a5..e91821f 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/AbstractOpcDeviceDriver.java @@ -1,11 +1,13 @@ package org.nl.acs.device_driver.driver; +import lombok.extern.slf4j.Slf4j; import org.jinterop.dcom.common.JIException; import org.nl.acs.ext.wms.data.JsonUtl; import org.nl.acs.opc.*; import org.nl.exception.WDKException; import org.nl.modules.udw.UnifiedDataAccessor; import org.nl.modules.udw.UnifiedDataAccessorFactory; +import org.nl.modules.udw.UnifiedDataAppService; import org.nl.utils.SpringContextHolder; import org.openscada.opc.lib.da.AddFailedException; import org.openscada.opc.lib.da.Group; @@ -15,6 +17,7 @@ import org.springframework.beans.factory.annotation.Autowired; import java.util.*; +@Slf4j public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements OpcDeviceDriver { UnifiedDataAccessor opcUdw; @@ -38,7 +41,7 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc - public void checkcontrol(Map itemValues) throws JIException, AddFailedException { + public void checkcontrol(Map itemValues) throws Exception { Group group = opcServerService.getServer(this.getOpcServer()); Map write = new HashMap(); Map readitems = new LinkedHashMap(); @@ -134,11 +137,13 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc sb.append(":"); sb.append(JsonUtl.parseWithoutException(udw_value)); sb.append(";"); -// if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) { -// need_write = true; -// } + if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) { + need_write = true; + } else { + log.warn("下发信号点位{} 当前写入值:{} 与系统内存值:{} 相同,不再写入 ", code, write_value, udw_value ); + } } - need_write = true; + // need_write = true; if (need_write) { Date date = new Date(); @@ -149,9 +154,9 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc this.last_items = this_items; this.sendTime = date; - /* this.execute_log.setResource(this.getDevice().getCode(), this.getDevice().getName()); - this.execute_log.log("原始记录{}->变更为{}", new Object[]{sb, this_items}); - OpcServerService opcServerService = OpcServerFactory.getOpcServerService();*/ + /* this.execute_log.setResource(this.getDevice().getCode(), this.getDevice().getName()); + this.execute_log.log("原始记录{}->变更为{}", new Object[]{sb, this_items}); + OpcServerService opcServerService = OpcServerFactory.getOpcServerService();*/ OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java index da8c357..96496fe 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/driver/OpcDeviceDriver.java @@ -27,7 +27,7 @@ public interface OpcDeviceDriver extends DeviceDriver { //设备扩展表【acs_device_extra】 WQLObject extraTab = WQLObject.getWQLObject("acs_device_extra"); - JSONArray arr = extraTab.query("filed_type='02' and device_id = '" + this.getDevice().getDevice_id() + "'").getResultJSONArray(0); + JSONArray arr = extraTab.query(" (filed_type='02' or filed_type='03' )and device_id = '" + this.getDevice().getDevice_id() + "'").getResultJSONArray(0); for (int i = 0; i < arr.size(); i++) { JSONObject json = arr.getJSONObject(i); OpcItemDto dto = new OpcItemDto(); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java index 7cf20f5..fdb5a23 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_Laminating_machine/LnshLaminatingMachineDeviceDriver.java @@ -74,7 +74,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i int last_container_type = 0; int barcode = 0; int last_barcode = 0; - + int to_command =0; Boolean isonline = true; int hasGoods = 0; String message = null; @@ -127,6 +127,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i barcode = this.itemProtocol.getBarcode(); hasGoods = this.itemProtocol.getMove(); container_type = this.itemProtocol.getContainer_type(); + to_command = this.itemProtocol.getToCommand(); if (mode != last_mode) { this.setRequireSucess(false); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java index f966293..e82ec82 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/LnshPackagePalletManipulatorDeviceDriver.java @@ -344,6 +344,9 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD if (mode != last_mode) { this.setRequireSucess(false); this.setResultSucess(false); + if(mode ==2 ){ + this.writing(0); + } logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); } @@ -685,7 +688,6 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD log.debug("设备运转模式:等待工作"); return; case 2: - this.writing(0); break; case 4: //排产单确认 diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_palletizing_manipulator_site/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_palletizing_manipulator_site/ItemProtocol.java new file mode 100644 index 0000000..d60077b --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_palletizing_manipulator_site/ItemProtocol.java @@ -0,0 +1,984 @@ +package org.nl.acs.device_driver.lnsh.lnsh_package_palletizing_manipulator_site; + +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_heartbeat = "heartbeat"; + public static String item_mode = "mode"; + public static String item_move = "move"; + public static String item_action = "action"; + public static String item_ioaction = "ioaction"; + public static String item_error = "error"; + public static String item_task = "task"; + public static String item_weight = "weight"; + public static String item_barcode = "barcode"; + public static String item_material = "material"; + public static String item_qty = "qty"; + public static String item_batch = "batch"; + public static String item_specifications = "specifications"; + public static String item_open_time = "open_time"; + public static String item_standby_time = "standby_time"; + public static String item_production_time = "production_time"; + public static String item_error_time = "error_time"; + public static String item_order_No = "order_No"; + public static String item_order_qty = "order_qty"; + public static String item_total_split = "total_split"; + public static String item_xContainer_length = "xContainer_length"; + public static String item_yContainer_length = "yContainer_length"; + public static String item_container_getQty = "container_getQty"; + public static String item_getX_offset = "getX_offset"; + public static String item_getY_offset = "getY_offset"; + + public static String item_product_code = "product_code"; + public static String item_AlongSide = "AlongSide"; + public static String item_BshortSide = "BshortSide"; + public static String item_Htrapezoidal = "Htrapezoidal"; + public static String item_Wthickness = "Wthickness"; + public static String item_tray_qty = "tray_qty"; + public static String item_tray_high = "tray_high"; + public static String item_crib_category = "crib_category"; + public static String item_palletX1_line = "palletX1_line"; + public static String item_palletY1_row = "palletY1_row"; + public static String item_palletA1_angle = "palletA1_angle"; + public static String item_palletX2_line = "palletX2_line"; + public static String item_palletY2_row = "palletY2_row"; + public static String item_palletA2_angle = "palletA2_angle"; + public static String item_palletX3_line = "palletX3_line"; + public static String item_palletY3_row = "palletY3_row"; + public static String item_palletA3_angle = "palletA3_angle"; + public static String item_pressCribX1_line = "pressCribX1_line"; + public static String item_pressCribY1_row = "pressCribY1_row"; + public static String item_pressCribA1_angle = "pressCribA1_angle"; + public static String item_pressCribX2_line = "pressCribX2_line"; + public static String item_pressCribY2_row = "pressCribY2_row"; + public static String item_pressCribA2_angle = "pressCribA2_angle"; + public static String item_pressCribX3_line = "pressCribX3_line"; + public static String item_pressCribY3_row = "pressCribY3_row"; + public static String item_pressCribA3_angle = "pressCribA3_angle"; + public static String item_Zoffset = "Zoffset"; + public static String item_pallet_layerQty = "pallet_layerQty"; + public static String item_pressCrib_layerQty = "pressCrib_layerQty"; + public static String item_codeLayerX1_interval = "codeLayerX1_interval"; + public static String item_codeLayerY1_interval = "codeLayerY1_interval"; + public static String item_codeLayerX2_interval = "codeLayerX2_interval"; + public static String item_codeLayerY2_interval = "codeLayerY2_interval"; + public static String item_codeLayerX3_interval = "codeLayerX3_interval"; + public static String item_codeLayerY3_interval = "codeLayerY3_interval"; + public static String item_codeLayerX1_offset = "codeLayerX1_offset"; + public static String item_codeLayerY1_offset = "codeLayerY1_offset"; + public static String item_codeLayerX2_offset = "codeLayerX2_offset"; + public static String item_codeLayerY2_offset = "codeLayerY2_offset"; + public static String item_codeLayerX3_offset = "codeLayerX3_offset"; + public static String item_codeLayerY3_offset = "codeLayerY3_offset"; + public static String item_pressLayerX1_interval = "pressLayerX1_interval"; + public static String item_pressLayerY1_interval = "pressLayerY1_interval"; + public static String item_pressLayerX2_interval = "pressLayerX2_interval"; + public static String item_pressLayerY2_interval = "pressLayerY2_interval"; + public static String item_pressLayerX3_interval = "pressLayerX3_interval"; + public static String item_pressLayerY3_interval = "pressLayerY3_interval"; + public static String item_pressLayerX1_offset = "pressLayerX1_offset"; + public static String item_pressLayerY1_offset = "pressLayerY1_offset"; + public static String item_pressLayerX2_offset = "pressLayerX2_offset"; + public static String item_pressLayerY2_offset = "pressLayerY2_offset"; + public static String item_pressLayerX3_offset = "pressLayerX3_offset"; + public static String item_pressLayerY3_offset = "pressLayerY3_offset"; + public static String item_one_cribTotal = "one_cribTotal"; + public static String item_two_cribTotal = "two_cribTotal"; + public static String item_one_qty = "one_qty"; + public static String item_two_qty = "two_qty"; + public static String item_tool_coordinate = "tool_coordinate"; + + public static String item_to_command = "to_command"; + public static String item_to_target = "to_target"; + public static String item_to_task = "to_task"; + public static String item_to_barcode = "to_barcode"; + public static String item_to_feedback = "to_feedback"; + public static String item_to_error = "to_error"; + public static String item_to_material_qty = "to_material_qty"; + public static String item_to_allow_pallet_qty = "to_allow_pallet_qty"; + public static String item_to_material_type = "to_material_type"; + public static String item_to_material_code = "to_material_code"; + public static String item_to_order_No = "to_order_No"; + public static String item_to_order_qty = "to_order_qty"; + + public static String item_to_product_code = "to_product_code"; + public static String item_to_AlongSide = "to_AlongSide"; + public static String item_to_BshortSide = "to_BshortSide"; + public static String item_to_Htrapezoidal = "to_Htrapezoidal"; + public static String item_to_Wthickness = "to_Wthickness"; + public static String item_to_tray_qty = "to_tray_qty"; + public static String item_to_tray_high = "to_tray_high"; + public static String item_to_crib_category = "to_crib_category"; + public static String item_to_palletX1_line = "to_palletX1_line"; + public static String item_to_palletY1_row = "to_palletY1_row"; + public static String item_to_palletA1_angle = "to_palletA1_angle"; + public static String item_to_palletX2_line = "to_palletX2_line"; + public static String item_to_palletY2_row = "to_palletY2_row"; + public static String item_to_palletA2_angle = "to_palletA2_angle"; + public static String item_to_palletX3_line = "to_palletX3_line"; + public static String item_to_palletY3_row = "to_palletY3_row"; + public static String item_to_palletA3_angle = "to_palletA3_angle"; + public static String item_to_pressCribX1_line = "to_pressCribX1_line"; + public static String item_to_pressCribY1_row = "to_pressCribY1_row"; + public static String item_to_pressCribA1_angle = "to_pressCribA1_angle"; + public static String item_to_pressCribX2_line = "to_pressCribX2_line"; + public static String item_to_pressCribY2_row = "to_pressCribY2_row"; + public static String item_to_pressCribA2_angle = "to_pressCribA2_angle"; + public static String item_to_pressCribX3_line = "to_pressCribX3_line"; + public static String item_to_pressCribY3_row = "to_pressCribY3_row"; + public static String item_to_pressCribA3_angle = "to_pressCribA3_angle"; + public static String item_to_Zoffset = "to_Zoffset"; + public static String item_to_pallet_layerQty = "to_pallet_layerQty"; + public static String item_to_pressCrib_layerQty = "to_pressCrib_layerQty"; + public static String item_to_codeLayerX1_interval = "to_codeLayerX1_interval"; + public static String item_to_codeLayerY1_interval = "to_codeLayerY1_interval"; + public static String item_to_codeLayerX2_interval = "to_codeLayerX2_interval"; + public static String item_to_codeLayerY2_interval = "to_codeLayerY2_interval"; + public static String item_to_codeLayerX3_interval = "to_codeLayerX3_interval"; + public static String item_to_codeLayerY3_interval = "to_codeLayerY3_interval"; + public static String item_to_codeLayerX1_offset = "to_codeLayerX1_offset"; + public static String item_to_codeLayerY1_offset = "to_codeLayerY1_offset"; + public static String item_to_codeLayerX2_offset = "to_codeLayerX2_offset"; + public static String item_to_codeLayerY2_offset = "to_codeLayerY2_offset"; + public static String item_to_codeLayerX3_offset = "to_codeLayerX3_offset"; + public static String item_to_codeLayerY3_offset = "to_codeLayerY3_offset"; + public static String item_to_pressLayerX1_interval = "to_pressLayerX1_interval"; + public static String item_to_pressLayerY1_interval = "to_pressLayerY1_interval"; + public static String item_to_pressLayerX2_interval = "to_pressLayerX2_interval"; + public static String item_to_pressLayerY2_interval = "to_pressLayerY2_interval"; + public static String item_to_pressLayerX3_interval = "to_pressLayerX3_interval"; + public static String item_to_pressLayerY3_interval = "to_pressLayerY3_interval"; + public static String item_to_pressLayerX1_offset = "to_pressLayerX1_offset"; + public static String item_to_pressLayerY1_offset = "to_pressLayerY1_offset"; + public static String item_to_pressLayerX2_offset = "to_pressLayerX2_offset"; + public static String item_to_pressLayerY2_offset = "to_pressLayerY2_offset"; + public static String item_to_pressLayerX3_offset = "to_pressLayerX3_offset"; + public static String item_to_pressLayerY3_offset = "to_pressLayerY3_offset"; + public static String item_to_one_cribTotal = "to_one_cribTotal"; + public static String item_to_two_cribTotal = "to_two_cribTotal"; + public static String item_to_one_qty = "to_one_qty"; + public static String item_to_two_qty = "to_two_qty"; + public static String item_to_tool_coordinate = "to_tool_coordinate"; + public static String item_to_xContainer_length = "to_xContainer_length"; + public static String item_to_yContainer_length = "to_yContainer_length"; + public static String item_to_container_getQty = "to_container_getQty"; + public static String item_to_getX_offset = "to_getX_offset"; + public static String item_to_getY_offset = "to_getY_offset"; + + + + Boolean isonline; + + private LnshPackagePalletizingManipulatorSiteDeviceDriver driver; + + public ItemProtocol(LnshPackagePalletizingManipulatorSiteDeviceDriver driver) { + this.driver = driver; + } + + public int getHeartbeat() { + return this.getOpcIntegerValue(item_heartbeat); + } + + public int getMode() { + return this.getOpcIntegerValue(item_mode); + } + + public int getMove() { + return this.getOpcIntegerValue(item_move); + } + + public int getAction() { + return this.getOpcIntegerValue(item_action); + } + + public int getIoAction() { + return this.getOpcIntegerValue(item_ioaction); + } + + public int getError() { + return this.getOpcIntegerValue(item_error); + } + + public int getTask() { + return this.getOpcIntegerValue(item_task); + } + + public int getBarcode() { + return this.getOpcIntegerValue(item_barcode); + } + + public String getMaterial() { + return this.getOpcStringValue(item_material); + } + + public int getQty() { + return this.getOpcIntegerValue(item_qty); + } + + public String getSpecifications() { + return this.getOpcStringValue(item_specifications); + } + + public int getBatch() { + return this.getOpcIntegerValue(item_batch); + } + + public int getOpen_time() { + return this.getOpcIntegerValue(item_open_time); + } + + public int getStandby_time() { + return this.getOpcIntegerValue(item_standby_time); + } + + public int getProduction_time() { + return this.getOpcIntegerValue(item_production_time); + } + + public int getError_time() { + return this.getOpcIntegerValue(item_error_time); + } + + public String getOrder_No() { + return this.getOpcStringValue(item_order_No); + } + + public int getTotal_split() { + return this.getOpcIntegerValue(item_total_split); + } + + public int getOrder_qty() { + return this.getOpcIntegerValue(item_order_qty); + } + + public int getXContainer_length() { + return this.getOpcIntegerValue(item_xContainer_length); + } + + public int getYContainer_length() { + return this.getOpcIntegerValue(item_yContainer_length); + } + + public int getContainer_getQty() { + return this.getOpcIntegerValue(item_container_getQty); + } + + public int getGetX_offset() { + return this.getOpcIntegerValue(item_getX_offset); + } + + public int getGetY_offset() { + return this.getOpcIntegerValue(item_getY_offset); + } + + public int getProduct_code() { + return this.getOpcIntegerValue(item_product_code); + } + + public int getAlongSide() { + return this.getOpcIntegerValue(item_AlongSide); + } + + public int getBshortSide() { + return this.getOpcIntegerValue(item_BshortSide); + } + + public int getHtrapezoidal() { + return this.getOpcIntegerValue(item_Htrapezoidal); + } + + public int getWthickness() { + return this.getOpcIntegerValue(item_Wthickness); + } + + public int getTray_qty() { + return this.getOpcIntegerValue(item_tray_qty); + } + + public int getTray_high() { + return this.getOpcIntegerValue(item_tray_high); + } + + public int getCrib_category() { + return this.getOpcIntegerValue(item_crib_category); + } + + public int getPalletX1_line() { + return this.getOpcIntegerValue(item_palletX1_line); + } + + public int getPalletY1_row() { + return this.getOpcIntegerValue(item_palletY1_row); + } + + public int getPalletA1_angle() { + return this.getOpcIntegerValue(item_palletA1_angle); + } + + public int getPalletX2_line() { + return this.getOpcIntegerValue(item_palletX2_line); + } + + public int getPalletY2_row() { + return this.getOpcIntegerValue(item_palletY2_row); + } + + public int getPalletA2_angle() { + return this.getOpcIntegerValue(item_palletA2_angle); + } + + public int getPalletX3_line() { + return this.getOpcIntegerValue(item_palletX3_line); + } + + public int getPalletY3_row() { + return this.getOpcIntegerValue(item_palletY3_row); + } + + public int getPalletA3_angle() { + return this.getOpcIntegerValue(item_palletA3_angle); + } + + public int getPressCribX1_line() { + return this.getOpcIntegerValue(item_pressCribX1_line); + } + + public int getPressCribY1_row() { + return this.getOpcIntegerValue(item_pressCribY1_row); + } + + public int getPressCribA1_angle() { + return this.getOpcIntegerValue(item_pressCribA1_angle); + } + + public int getPressCribX2_line() { + return this.getOpcIntegerValue(item_pressCribX2_line); + } + + public int getPressCribY2_row() { + return this.getOpcIntegerValue(item_pressCribY2_row); + } + + public int getPressCribA2_angle() { + return this.getOpcIntegerValue(item_pressCribA2_angle); + } + + public int getPressCribX3_line() { + return this.getOpcIntegerValue(item_pressCribX3_line); + } + + public int getPressCribY3_row() { + return this.getOpcIntegerValue(item_pressCribY3_row); + } + + public int getPressCribA3_angle() { + return this.getOpcIntegerValue(item_pressCribA3_angle); + } + + public int getZoffset() { + return this.getOpcIntegerValue(item_Zoffset); + } + + public int getPallet_layerQty() { + return this.getOpcIntegerValue(item_pallet_layerQty); + } + + public int getPressCrib_layerQty() { + return this.getOpcIntegerValue(item_pressCrib_layerQty); + } + + public int getCodeLayerX1_interval() { + return this.getOpcIntegerValue(item_codeLayerX1_interval); + } + + public int getCodeLayerY1_interval() { + return this.getOpcIntegerValue(item_codeLayerY1_interval); + } + + public int getCodeLayerX2_interval() { + return this.getOpcIntegerValue(item_codeLayerX2_interval); + } + + public int getCodeLayerY2_interval() { + return this.getOpcIntegerValue(item_codeLayerY2_interval); + } + + public int getCodeLayerX3_interval() { + return this.getOpcIntegerValue(item_codeLayerX3_interval); + } + + public int getcodeLayerY3_interval() { + return this.getOpcIntegerValue(item_codeLayerY3_interval); + } + + public int getCodeLayerX1_offset() { + return this.getOpcIntegerValue(item_codeLayerX1_offset); + } + + public int getCodeLayerY1_offset() { + return this.getOpcIntegerValue(item_codeLayerY1_offset); + } + + public int getCodeLayerX2_offset() { + return this.getOpcIntegerValue(item_codeLayerX2_offset); + } + + public int getCodeLayerY2_offset() { + return this.getOpcIntegerValue(item_codeLayerY2_offset); + } + + public int getCodeLayerX3_offset() { + return this.getOpcIntegerValue(item_codeLayerX3_offset); + } + + public int getCodeLayerY3_offset() { + return this.getOpcIntegerValue(item_codeLayerY3_offset); + } + + public int getPressLayerX1_interval() { + return this.getOpcIntegerValue(item_pressLayerX1_interval); + } + + public int getPressLayerY1_interval() { + return this.getOpcIntegerValue(item_pressLayerY1_interval); + } + + public int getPressLayerX2_interval() { + return this.getOpcIntegerValue(item_pressLayerX2_interval); + } + + public int getPressLayerY2_interval() { + return this.getOpcIntegerValue(item_pressLayerY2_interval); + } + + public int getPressLayerX3_interval() { + return this.getOpcIntegerValue(item_pressLayerX3_interval); + } + + public int getPressLayerY3_interval() { + return this.getOpcIntegerValue(item_pressLayerY3_interval); + } + + public int getPressLayerX1_offset() { + return this.getOpcIntegerValue(item_pressLayerX1_offset); + } + + public int getPressLayerY1_offset() { + return this.getOpcIntegerValue(item_pressLayerY1_offset); + } + + public int getPressLayerX2_offset() { + return this.getOpcIntegerValue(item_pressLayerX2_offset); + } + + public int getPressLayerY2_offset() { + return this.getOpcIntegerValue(item_pressLayerY2_offset); + } + + public int getPressLayerX3_offset() { + return this.getOpcIntegerValue(item_pressLayerX3_offset); + } + + public int getPressLayerY3_offset() { + return this.getOpcIntegerValue(item_pressLayerY3_offset); + } + + public int getOne_cribTotal() { + return this.getOpcIntegerValue(item_one_cribTotal); + } + + public int getTwo_cribTotal() { + return this.getOpcIntegerValue(item_two_cribTotal); + } + + public int getOne_qty() { + return this.getOpcIntegerValue(item_one_qty); + } + + public int getTwo_qty() { + return this.getOpcIntegerValue(item_two_qty); + } + + public int getTool_coordinate() { + return this.getOpcIntegerValue(item_tool_coordinate); + } + + public int getTo_feedback() { + return this.getOpcIntegerValue(item_to_feedback); + } + + public int getTo_error() { + return this.getOpcIntegerValue(item_to_error); + } + + public int getTo_material_qty() { + return this.getOpcIntegerValue(item_to_material_qty); + } + + public int getTo_allow_pallet_qty() { + return this.getOpcIntegerValue(item_to_allow_pallet_qty); + } + + public int getTo_material_type() { + return this.getOpcIntegerValue(item_to_material_type); + } + + public String getTo_material_code() { + return this.getOpcStringValue(item_to_material_code); + } + + public String getTo_order_No() { + return this.getOpcStringValue(item_to_order_No); + } + + public int getToProduct_code() { + return this.getOpcIntegerValue(item_to_product_code); + } + + public int getToAlongSide() { + return this.getOpcIntegerValue(item_to_AlongSide); + } + + public int getToBshortSide() { + return this.getOpcIntegerValue(item_to_BshortSide); + } + + public int getToHtrapezoidal() { + return this.getOpcIntegerValue(item_to_Htrapezoidal); + } + + public int getToWthickness() { + return this.getOpcIntegerValue(item_to_Wthickness); + } + + public int getToTray_qty() { + return this.getOpcIntegerValue(item_to_tray_qty); + } + + public int getToTray_high() { + return this.getOpcIntegerValue(item_to_tray_high); + } + + public int getToCrib_category() { + return this.getOpcIntegerValue(item_to_crib_category); + } + + public int getToPalletX1_line() { + return this.getOpcIntegerValue(item_to_palletX1_line); + } + + public int getToPalletY1_row() { + return this.getOpcIntegerValue(item_to_palletY1_row); + } + + public int getToPalletA1_angle() { + return this.getOpcIntegerValue(item_to_palletA1_angle); + } + + public int getToPalletX2_line() { + return this.getOpcIntegerValue(item_to_palletX2_line); + } + + public int getToPalletY2_row() { + return this.getOpcIntegerValue(item_to_palletY2_row); + } + + public int getToPalletA2_angle() { + return this.getOpcIntegerValue(item_to_palletA2_angle); + } + + public int getToPalletX3_line() { + return this.getOpcIntegerValue(item_to_palletX3_line); + } + + public int getToPalletY3_row() { + return this.getOpcIntegerValue(item_to_palletY3_row); + } + + public int getToPalletA3_angle() { + return this.getOpcIntegerValue(item_to_palletA3_angle); + } + + public int getToPressCribX1_line() { + return this.getOpcIntegerValue(item_to_pressCribX1_line); + } + + public int getToPressCribY1_row() { + return this.getOpcIntegerValue(item_to_pressCribY1_row); + } + + public int getToPressCribA1_angle() { + return this.getOpcIntegerValue(item_to_pressCribA1_angle); + } + + public int getToPressCribX2_line() { + return this.getOpcIntegerValue(item_to_pressCribX2_line); + } + + public int getToPressCribY2_row() { + return this.getOpcIntegerValue(item_to_pressCribY2_row); + } + + public int getToPressCribA2_angle() { + return this.getOpcIntegerValue(item_to_pressCribA2_angle); + } + + public int getToPressCribX3_line() { + return this.getOpcIntegerValue(item_to_pressCribX3_line); + } + + public int getToPressCribY3_row() { + return this.getOpcIntegerValue(item_to_pressCribY3_row); + } + + public int getToPressCribA3_angle() { + return this.getOpcIntegerValue(item_to_pressCribA3_angle); + } + + public int getToZoffset() { + return this.getOpcIntegerValue(item_to_Zoffset); + } + + public int getToPallet_layerQty() { + return this.getOpcIntegerValue(item_to_pallet_layerQty); + } + + public int getToPressCrib_layerQty() { + return this.getOpcIntegerValue(item_to_pressCrib_layerQty); + } + + public int getToCodeLayerX1_interval() { + return this.getOpcIntegerValue(item_to_codeLayerX1_interval); + } + + public int getToCodeLayerY1_interval() { + return this.getOpcIntegerValue(item_to_codeLayerY1_interval); + } + + public int getToCodeLayerX2_interval() { + return this.getOpcIntegerValue(item_to_codeLayerX2_interval); + } + + public int getToCodeLayerY2_interval() { + return this.getOpcIntegerValue(item_to_codeLayerY2_interval); + } + + public int getToCodeLayerX3_interval() { + return this.getOpcIntegerValue(item_to_codeLayerX3_interval); + } + + public int getTocodeLayerY3_interval() { + return this.getOpcIntegerValue(item_to_codeLayerY3_interval); + } + + public int getToCodeLayerX1_offset() { + return this.getOpcIntegerValue(item_to_codeLayerX1_offset); + } + + public int getToCodeLayerY1_offset() { + return this.getOpcIntegerValue(item_to_codeLayerY1_offset); + } + + public int getToCodeLayerX2_offset() { + return this.getOpcIntegerValue(item_to_codeLayerX2_offset); + } + + public int getToCodeLayerY2_offset() { + return this.getOpcIntegerValue(item_to_codeLayerY2_offset); + } + + public int getToCodeLayerX3_offset() { + return this.getOpcIntegerValue(item_to_codeLayerX3_offset); + } + + public int getToCodeLayerY3_offset() { + return this.getOpcIntegerValue(item_to_codeLayerY3_offset); + } + + public int getToPressLayerX1_interval() { + return this.getOpcIntegerValue(item_to_pressLayerX1_interval); + } + + public int getToPressLayerY1_interval() { + return this.getOpcIntegerValue(item_to_pressLayerY1_interval); + } + + public int getToPressLayerX2_interval() { + return this.getOpcIntegerValue(item_to_pressLayerX2_interval); + } + + public int getToPressLayerY2_interval() { + return this.getOpcIntegerValue(item_to_pressLayerY2_interval); + } + + public int getToPressLayerX3_interval() { + return this.getOpcIntegerValue(item_to_pressLayerX3_interval); + } + + public int getToPressLayerY3_interval() { + return this.getOpcIntegerValue(item_to_pressLayerY3_interval); + } + + public int getToPressLayerX1_offset() { + return this.getOpcIntegerValue(item_to_pressLayerX1_offset); + } + + public int getToPressLayerY1_offset() { + return this.getOpcIntegerValue(item_to_pressLayerY1_offset); + } + + public int getToPressLayerX2_offset() { + return this.getOpcIntegerValue(item_to_pressLayerX2_offset); + } + + public int getToPressLayerY2_offset() { + return this.getOpcIntegerValue(item_to_pressLayerY2_offset); + } + + public int getToPressLayerX3_offset() { + return this.getOpcIntegerValue(item_to_pressLayerX3_offset); + } + + public int getToPressLayerY3_offset() { + return this.getOpcIntegerValue(item_to_pressLayerY3_offset); + } + + public int getToOne_cribTotal() { + return this.getOpcIntegerValue(item_to_one_cribTotal); + } + + public int getToTwo_cribTotal() { + return this.getOpcIntegerValue(item_to_two_cribTotal); + } + + public int getToOne_qty() { + return this.getOpcIntegerValue(item_to_one_qty); + } + + public int getToTwo_qty() { + return this.getOpcIntegerValue(item_to_two_qty); + } + + public int getToTool_coordinate() { + return this.getOpcIntegerValue(item_to_tool_coordinate); + } + + public int getTo_order_qty() { + return this.getOpcIntegerValue(item_to_order_qty); + } + + public int getToXContainer_length() { + return this.getOpcIntegerValue(item_to_xContainer_length); + } + + public int getToYContainer_length() { + return this.getOpcIntegerValue(item_to_yContainer_length); + } + + public int getToContainer_getQty() { + return this.getOpcIntegerValue(item_to_container_getQty); + } + + public int getToGetX_offset() { + return this.getOpcIntegerValue(item_to_getX_offset); + } + + public int getToGetY_offset() { + return this.getOpcIntegerValue(item_to_getY_offset); + } + + public int getToCommand() { + return this.getOpcIntegerValue(item_to_command); + } + + //是否有货 + public int hasGoods(int move) { + return move; + } + + + 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.isBlank(value)) { + + } else { + return value; + } + return ""; + } + + public static List getReadableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_heartbeat, "心跳", "DB58.B0")); + list.add(new ItemDto(item_mode, "工作状态", "DB58.B1", Boolean.valueOf(true))); + list.add(new ItemDto(item_move, "光电信号", "DB58.B2")); + list.add(new ItemDto(item_action, "动作信号", "DB58.B3")); + list.add(new ItemDto(item_ioaction, "进出信号", "DB58.B4")); + list.add(new ItemDto(item_error, "故障代码", "DB58.B5")); + list.add(new ItemDto(item_task, "任务号", "DB58.D6")); + list.add(new ItemDto(item_weight, "重量", "DB112.D10")); + list.add(new ItemDto(item_batch, "批次", "DB112.D14")); + list.add(new ItemDto(item_specifications, "规格", "DB112.STRING18.256")); + list.add(new ItemDto(item_material, "物料", "DB112.STRING274.256")); + list.add(new ItemDto(item_barcode, "条码", "DB112.W530")); + list.add(new ItemDto(item_product_code, "产品编号", "DB58.W788")); + list.add(new ItemDto(item_AlongSide, "A长边", "DB58.W790")); + list.add(new ItemDto(item_BshortSide, "B短边", "DB58.W792")); + list.add(new ItemDto(item_Htrapezoidal, "H梯形高", "DB58.W794")); + list.add(new ItemDto(item_Wthickness, "W厚度", "DB58.W796")); + list.add(new ItemDto(item_tray_qty, "当前垛盘数", "DB58.W798")); + list.add(new ItemDto(item_tray_high, "垛盘高度", "DB58.W800")); + list.add(new ItemDto(item_crib_category, "垛型类别", "DB58.W802")); + list.add(new ItemDto(item_palletX1_line, "码垛X1行", "DB58.W804")); + list.add(new ItemDto(item_palletY1_row, "码垛Y1列", "DB58.W806")); + list.add(new ItemDto(item_palletA1_angle, "码垛A1角度", "DB58.W808")); + list.add(new ItemDto(item_palletX2_line, "码垛X2行", "DB58.W810")); + list.add(new ItemDto(item_palletY2_row, "码垛Y2列", "DB58.W812")); + list.add(new ItemDto(item_palletA2_angle, "码垛A2角度", "DB58.W814")); + list.add(new ItemDto(item_palletX3_line, "码垛X3行", "DB58.W816")); + list.add(new ItemDto(item_palletY3_row, "码垛Y3列", "DB58.W818")); + list.add(new ItemDto(item_palletA3_angle, "码垛A3角度", "DB58.W820")); + list.add(new ItemDto(item_pressCribX1_line, "压垛X1行", "DB58.W822")); + list.add(new ItemDto(item_pressCribY1_row, "压垛Y1列", "DB58.W824")); + list.add(new ItemDto(item_pressCribA1_angle, "压垛A1角度", "DB58.W826")); + list.add(new ItemDto(item_pressCribX2_line, "压垛X2行", "DB58.W828")); + list.add(new ItemDto(item_pressCribY2_row, "压垛Y2列", "DB58.W830")); + list.add(new ItemDto(item_pressCribA2_angle, "压垛A2角度", "DB58.W832")); + list.add(new ItemDto(item_pressCribX3_line, "压垛X3行", "DB58.W834")); + list.add(new ItemDto(item_pressCribY3_row, "压垛Y3列", "DB58.W836")); + list.add(new ItemDto(item_pressCribA3_angle, "压垛A3角度", "DB58.W838")); + list.add(new ItemDto(item_Zoffset, "Z轴偏移", "DB58.W840")); + list.add(new ItemDto(item_pallet_layerQty, "码垛层数", "DB58.W842")); + list.add(new ItemDto(item_pressCrib_layerQty, "压垛层数", "DB58.W844")); + list.add(new ItemDto(item_codeLayerX1_interval, "码层X1间隔", "DB58.W846")); + list.add(new ItemDto(item_codeLayerY1_interval, "码层Y1间隔", "DB58.W848")); + list.add(new ItemDto(item_codeLayerX2_interval, "码层X2间隔", "DB58.W850")); + list.add(new ItemDto(item_codeLayerY2_interval, "码层Y2间隔", "DB58.W852")); + list.add(new ItemDto(item_codeLayerX3_interval, "码层X3间隔", "DB58.W854")); + list.add(new ItemDto(item_codeLayerY3_interval, "码层Y3间隔", "DB58.W856")); + list.add(new ItemDto(item_codeLayerX1_offset, "码层X1偏移", "DB58.W858")); + list.add(new ItemDto(item_codeLayerY1_offset, "码层Y1偏移", "DB58.W860")); + list.add(new ItemDto(item_codeLayerX2_offset, "码层X2偏移", "DB58.W862")); + list.add(new ItemDto(item_codeLayerY2_offset, "码层Y2偏移", "DB58.W864")); + list.add(new ItemDto(item_codeLayerX3_offset, "码层X3偏移", "DB58.W866")); + list.add(new ItemDto(item_codeLayerY3_offset, "码层Y3偏移", "DB58.W868")); + list.add(new ItemDto(item_pressLayerX1_interval, "压层X1间隔", "DB58.W870")); + list.add(new ItemDto(item_pressLayerY1_interval, "压层Y1间隔", "DB58.W872")); + list.add(new ItemDto(item_pressLayerX2_interval, "压层X2间隔", "DB58.W874")); + list.add(new ItemDto(item_pressLayerY2_interval, "压层Y2间隔", "DB58.W876")); + list.add(new ItemDto(item_pressLayerX3_interval, "压层X3间隔", "DB58.W878")); + list.add(new ItemDto(item_pressLayerY3_interval, "压层Y3间隔", "DB58.W880")); + list.add(new ItemDto(item_pressLayerX1_offset, "压层X1偏移", "DB58.W882")); + list.add(new ItemDto(item_pressLayerY1_offset, "压层Y1偏移", "DB58.W884")); + list.add(new ItemDto(item_pressLayerX2_offset, "压层X2偏移", "DB58.W886")); + list.add(new ItemDto(item_pressLayerY2_offset, "压层Y2偏移", "DB58.W888")); + list.add(new ItemDto(item_pressLayerX3_offset, "压层X3偏移", "DB58.W890")); + list.add(new ItemDto(item_pressLayerY3_offset, "压层Y3偏移", "DB58.W892")); + list.add(new ItemDto(item_one_cribTotal, "1#垛总数", "DB58.W894")); + list.add(new ItemDto(item_two_cribTotal, "2#垛总数", "DB58.W896")); + list.add(new ItemDto(item_one_qty, "1#垛当前数", "DB58.W898")); + list.add(new ItemDto(item_two_qty, "2#垛当前数", "DB58.W900")); + list.add(new ItemDto(item_xContainer_length, "1#X托盘长度", "DB58.W902")); + list.add(new ItemDto(item_yContainer_length, "1#Y托盘长度", "DB58.W904")); + list.add(new ItemDto(item_container_getQty, "1#托盘抓取数", "DB58.W906")); + list.add(new ItemDto(item_getX_offset, "1#抓取X偏移", "DB58.W908")); + list.add(new ItemDto(item_getY_offset, "1#抓取Y偏移", "DB58.W910")); + return list; + } + + public static List getWriteableItemDtos() { + ArrayList list = new ArrayList(); + list.add(new ItemDto(item_to_command, "作业命令", "DB59.W0", Boolean.valueOf(true))); + list.add(new ItemDto(item_to_target, "目标站", "DB59.W2")); + list.add(new ItemDto(item_to_task, "任务号", "DB59.D4")); + list.add(new ItemDto(item_to_barcode, "条码", "DB59.W8")); + list.add(new ItemDto(item_to_material_type, "托盘类型", "DB59.D264")); + list.add(new ItemDto(item_to_product_code, "产品编号", "DB59.W266")); + list.add(new ItemDto(item_to_AlongSide, "A长边", "DB59.W268")); + list.add(new ItemDto(item_to_BshortSide, "B短边", "DB59.W270")); + list.add(new ItemDto(item_to_Htrapezoidal, "H梯形高", "DB59.W272")); + list.add(new ItemDto(item_to_Wthickness, "W厚度", "DB59.W274")); + list.add(new ItemDto(item_to_tray_qty, "当前垛盘数", "DB59.W276")); + list.add(new ItemDto(item_to_tray_high, "垛盘高度", "DB59.W278")); + list.add(new ItemDto(item_to_crib_category, "垛型类别", "DB59.W280")); + list.add(new ItemDto(item_to_palletX1_line, "码垛X1行", "DB59.W282")); + list.add(new ItemDto(item_to_palletY1_row, "码垛Y1列", "DB59.W284")); + list.add(new ItemDto(item_to_palletA1_angle, "码垛A1角度", "DB59.W286")); + list.add(new ItemDto(item_to_palletX2_line, "码垛X2行", "DB59.W288")); + list.add(new ItemDto(item_to_palletY2_row, "码垛Y2列", "DB59.W290")); + list.add(new ItemDto(item_to_palletA2_angle, "码垛A2角度", "DB59.W292")); + list.add(new ItemDto(item_to_palletX3_line, "码垛X3行", "DB59.W294")); + list.add(new ItemDto(item_to_palletY3_row, "码垛Y3列", "DB59.W296")); + list.add(new ItemDto(item_to_palletA3_angle, "码垛A3角度", "DB59.W298")); + list.add(new ItemDto(item_to_pressCribX1_line, "压垛X1行", "DB59.W300")); + list.add(new ItemDto(item_to_pressCribY1_row, "压垛Y1列", "DB59.W302")); + list.add(new ItemDto(item_to_pressCribA1_angle, "压垛A1角度", "DB59.W304")); + list.add(new ItemDto(item_to_pressCribX2_line, "压垛X2行", "DB59.W306")); + list.add(new ItemDto(item_to_pressCribY2_row, "压垛Y2列", "DB59.W308")); + list.add(new ItemDto(item_to_pressCribA2_angle, "压垛A2角度", "DB59.W310")); + list.add(new ItemDto(item_to_pressCribX3_line, "压垛X3行", "DB59.W312")); + list.add(new ItemDto(item_to_pressCribY3_row, "压垛Y3列", "DB59.W314")); + list.add(new ItemDto(item_to_pressCribA3_angle, "压垛A3角度", "DB59.W316")); + list.add(new ItemDto(item_to_Zoffset, "Z轴偏移", "DB59.W318")); + list.add(new ItemDto(item_to_pallet_layerQty, "码垛层数", "DB59.W320")); + list.add(new ItemDto(item_to_pressCrib_layerQty, "压垛层数", "DB59.W322")); + list.add(new ItemDto(item_to_codeLayerX1_interval, "码层X1间隔", "DB59.W324")); + list.add(new ItemDto(item_to_codeLayerY1_interval, "码层Y1间隔", "DB59.W326")); + list.add(new ItemDto(item_to_codeLayerX2_interval, "码层X2间隔", "DB59.W328")); + list.add(new ItemDto(item_to_codeLayerY2_interval, "码层Y2间隔", "DB59.W330")); + list.add(new ItemDto(item_to_codeLayerX3_interval, "码层X3间隔", "DB59.W332")); + list.add(new ItemDto(item_to_codeLayerY3_interval, "码层Y3间隔", "DB59.W334")); + list.add(new ItemDto(item_to_codeLayerX1_offset, "码层X1偏移", "DB59.W336")); + list.add(new ItemDto(item_to_codeLayerY1_offset, "码层Y1偏移", "DB59.W338")); + list.add(new ItemDto(item_to_codeLayerX2_offset, "码层X2偏移", "DB59.W340")); + list.add(new ItemDto(item_to_codeLayerY2_offset, "码层Y2偏移", "DB59.W342")); + list.add(new ItemDto(item_to_codeLayerX3_offset, "码层X3偏移", "DB59.W344")); + list.add(new ItemDto(item_to_codeLayerY3_offset, "码层Y3偏移", "DB59.W346")); + list.add(new ItemDto(item_to_pressLayerX1_interval, "压层X1间隔", "DB59.W348")); + list.add(new ItemDto(item_to_pressLayerY1_interval, "压层Y1间隔", "DB59.W350")); + list.add(new ItemDto(item_to_pressLayerX2_interval, "压层X2间隔", "DB59.W352")); + list.add(new ItemDto(item_to_pressLayerY2_interval, "压层Y2间隔", "DB59.W354")); + list.add(new ItemDto(item_to_pressLayerX3_interval, "压层X3间隔", "DB59.W356")); + list.add(new ItemDto(item_to_pressLayerY3_interval, "压层Y3间隔", "DB59.W358")); + list.add(new ItemDto(item_to_pressLayerX1_offset, "压层X1偏移", "DB59.W360")); + list.add(new ItemDto(item_to_pressLayerY1_offset, "压层Y1偏移", "DB59.W362")); + list.add(new ItemDto(item_to_pressLayerX2_offset, "压层X2偏移", "DB59.W364")); + list.add(new ItemDto(item_to_pressLayerY2_offset, "压层Y2偏移", "DB59.W366")); + list.add(new ItemDto(item_to_pressLayerX3_offset, "压层X3偏移", "DB59.W368")); + list.add(new ItemDto(item_to_pressLayerY3_offset, "压层Y3偏移", "DB59.W370")); + list.add(new ItemDto(item_to_one_cribTotal, "1#垛总数", "DB59.W372")); + list.add(new ItemDto(item_to_two_cribTotal, "2#垛总数", "DB59.W374")); + list.add(new ItemDto(item_to_one_qty, "1#垛当前数", "DB59.W376")); + list.add(new ItemDto(item_to_two_qty, "2#垛当前数", "DB59.W378")); + list.add(new ItemDto(item_to_tool_coordinate, "工具坐标", "DB59.W380")); + list.add(new ItemDto(item_to_order_qty, "工单数量", "DB59.W382")); + list.add(new ItemDto(item_to_xContainer_length, "1#X托盘长度", "DB59.W384")); + list.add(new ItemDto(item_to_yContainer_length, "1#Y托盘长度", "DB59.W386")); + list.add(new ItemDto(item_to_container_getQty, "1#托盘抓取数", "DB59.W388")); + list.add(new ItemDto(item_to_getX_offset, "1#抓取X偏移", "DB59.W390")); + list.add(new ItemDto(item_to_getY_offset, "1#抓取Y偏移", "DB59.W392")); + return list; + } + +} + diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_palletizing_manipulator_site/LnshPackagePalletizingManipulatorSiteDefination.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_palletizing_manipulator_site/LnshPackagePalletizingManipulatorSiteDefination.java new file mode 100644 index 0000000..4205765 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_palletizing_manipulator_site/LnshPackagePalletizingManipulatorSiteDefination.java @@ -0,0 +1,63 @@ +package org.nl.acs.device_driver.lnsh.lnsh_package_palletizing_manipulator_site; + +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.ArrayList; +import java.util.LinkedList; +import java.util.List; + +/** + * 嘉耐-包装码垛机械手工位 + * + */ +@Service +public class LnshPackagePalletizingManipulatorSiteDefination implements OpcDeviceDriverDefination { + @Override + public String getDriverCode() { + return "lnsh_package_palletizing_manipulator_site"; + } + + @Override + public String getDriverName() { + return "嘉耐-包装码垛机械手工位"; + } + + @Override + public String getDriverDescription() { + return "嘉耐-包装码垛机械手工位"; + } + + @Override + public DeviceDriver getDriverInstance(Device device) { + return (new LnshPackagePalletizingManipulatorSiteDeviceDriver()).setDevice(device).setDriverDefination(this); + + } + + @Override + public Class getDeviceDriverType() { + return LnshPackagePalletizingManipulatorSiteDeviceDriver.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/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_palletizing_manipulator_site/LnshPackagePalletizingManipulatorSiteDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_palletizing_manipulator_site/LnshPackagePalletizingManipulatorSiteDeviceDriver.java new file mode 100644 index 0000000..fae5bbf --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_palletizing_manipulator_site/LnshPackagePalletizingManipulatorSiteDeviceDriver.java @@ -0,0 +1,1507 @@ +package org.nl.acs.device_driver.lnsh.lnsh_package_palletizing_manipulator_site; + +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpResponse; +import com.alibaba.fastjson.JSONObject; +import lombok.Data; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.nl.acs.device.service.DeviceService; +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.ext.wms.service.AcsToWmsService; +import org.nl.acs.instruction.service.InstructionService; +import org.nl.acs.instruction.service.dto.Instruction; +import org.nl.acs.log.service.DeviceExecuteLogService; +import org.nl.acs.monitor.DeviceStageMonitor; +import org.nl.acs.opc.Device; +import org.nl.acs.order.service.ProduceshiftorderService; +import org.nl.acs.order.service.dto.ProduceshiftorderDto; +import org.nl.acs.route.service.RouteLineService; +import org.nl.acs.task.service.TaskService; +import org.nl.utils.SpringContextHolder; +import org.openscada.opc.lib.da.Server; +import org.springframework.beans.factory.annotation.Autowired; + +import java.util.*; + +/** + * 嘉耐-包装码垛机械手工位 + */ +@Slf4j +@Data +@RequiredArgsConstructor +public class LnshPackagePalletizingManipulatorSiteDeviceDriver extends AbstractOpcDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor { + protected ItemProtocol itemProtocol = new ItemProtocol(this); + @Autowired + InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl"); + @Autowired + DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl"); + @Autowired + RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl"); + @Autowired + TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl"); + @Autowired + DeviceExecuteLogService logServer = SpringContextHolder.getBean("deviceExecuteLogServiceImpl"); + @Autowired + AcsToWmsService acsToWmsService = SpringContextHolder.getBean("acsToWmsServiceImpl"); + @Autowired + ProduceshiftorderService produceshiftorderService = SpringContextHolder.getBean("produceshiftorderServiceImpl"); + Boolean isonline = true; + Boolean iserror = false; + int hasGoods = 0; + + String device_code; + int mode = 0; + int action =0; + int io_action =0; + int move=0; + int error=0; + int task=0; + int status = 0; + int last_status = 0; + //开机时间 + int open_time = 0; + int last_open_time = 0; + //待机时间 + int standby_time = 0; + int last_standby_time = 0; + //生产时间 + int production_time = 0; + int last_production_time = 0; + //故障时间 + int error_time = 0; + int last_error_time = 0; + int put_station = 0; + int last_put_station = 0; + int barcode = 0; + int last_barcode = 0; + String material; + String last_material; + String order_No = "0"; + String last_order_No = "0"; + int qty = 0; + int last_qty = 0; + //开关机状态 + int onoff_status = 0; + int last_onoff_status = 0; + //当前抓取工位 + int getStation = 0; + int last_getStation = 0; + //批次 + int batch = 0; + int last_batch = 0; + //规格 + String specifications = ""; + String last_specifications = ""; + //累计拆垛数量 + int total_split = 0; + int last_total_split = 0; + + int order_qty = 0; + int last_order_qty = 0; + + int xContainer_length = 0; + int last_xContainer_length = 0; + int yContainer_length = 0; + int last_yContainer_length = 0; + int container_getQty = 0; + int last_container_getQty = 0; + int getX_offset = 0; + int last_getX_offset = 0; + int getY_offset = 0; + int last_getY_offset = 0; + int to_command =0; + + //垛型参数 + int product_code = 0; + int AlongSide = 0; + int BshortSide = 0; + int Htrapezoidal = 0; + int Wthickness = 0; + int tray_qty = 0; + int tray_high = 0; + int crib_category = 0; + int palletX1_line = 0; + int palletY1_row = 0; + int palletA1_angle = 0; + int palletX2_line = 0; + int palletY2_row = 0; + int palletA2_angle = 0; + int palletX3_line = 0; + int palletY3_row = 0; + int palletA3_angle = 0; + int pressCribX1_line = 0; + int pressCribY1_row = 0; + int pressCribA1_angle = 0; + int pressCribX2_line = 0; + int pressCribY2_row = 0; + int pressCribA2_angle = 0; + int pressCribX3_line = 0; + int pressCribY3_row = 0; + int pressCribA3_angle = 0; + int Zoffset = 0; + int pallet_layerQty = 0; + int pressCrib_layerQty = 0; + int codeLayerX1_interval = 0; + int codeLayerY1_interval = 0; + int codeLayerX2_interval = 0; + int codeLayerY2_interval = 0; + int codeLayerX3_interval = 0; + int codeLayerY3_interval = 0; + int codeLayerX1_offset = 0; + int codeLayerY1_offset = 0; + int codeLayerX2_offset = 0; + int codeLayerY2_offset = 0; + int codeLayerX3_offset = 0; + int codeLayerY3_offset = 0; + int pressLayerX1_interval = 0; + int pressLayerY1_interval = 0; + int pressLayerX2_interval = 0; + int pressLayerY2_interval = 0; + int pressLayerX3_interval = 0; + int pressLayerY3_interval = 0; + int pressLayerX1_offset = 0; + int pressLayerY1_offset = 0; + int pressLayerX2_offset = 0; + int pressLayerY2_offset = 0; + int pressLayerX3_offset = 0; + int pressLayerY3_offset = 0; + int one_cribTotal = 0; + int two_cribTotal = 0; + int one_qty = 0; + int two_qty = 0; + int tool_coordinate = 0; + + int last_mode = 0; + int last_action =0; + int last_ioaction =0; + int last_move=0; + int last_error=0; + int last_task=0; + int last_product_code = 0; + int last_AlongSide = 0; + int last_BshortSide = 0; + int last_Htrapezoidal = 0; + int last_Wthickness = 0; + int last_tray_qty = 0; + int last_tray_high = 0; + int last_crib_category = 0; + int last_palletX1_line = 0; + int last_palletY1_row = 0; + int last_palletA1_angle = 0; + int last_palletX2_line = 0; + int last_palletY2_row = 0; + int last_palletA2_angle = 0; + int last_palletX3_line = 0; + int last_palletY3_row = 0; + int last_palletA3_angle = 0; + int last_pressCribX1_line = 0; + int last_pressCribY1_row = 0; + int last_pressCribA1_angle = 0; + int last_pressCribX2_line = 0; + int last_pressCribY2_row = 0; + int last_pressCribA2_angle = 0; + int last_pressCribX3_line = 0; + int last_pressCribY3_row = 0; + int last_pressCribA3_angle = 0; + int last_Zoffset = 0; + int last_pallet_layerQty = 0; + int last_pressCrib_layerQty = 0; + int last_codeLayerX1_interval = 0; + int last_codeLayerY1_interval = 0; + int last_codeLayerX2_interval = 0; + int last_codeLayerY2_interval = 0; + int last_codeLayerX3_interval = 0; + int last_codeLayerY3_interval = 0; + int last_codeLayerX1_offset = 0; + int last_codeLayerY1_offset = 0; + int last_codeLayerX2_offset = 0; + int last_codeLayerY2_offset = 0; + int last_codeLayerX3_offset = 0; + int last_codeLayerY3_offset = 0; + int last_pressLayerX1_interval = 0; + int last_pressLayerY1_interval = 0; + int last_pressLayerX2_interval = 0; + int last_pressLayerY2_interval = 0; + int last_pressLayerX3_interval = 0; + int last_pressLayerY3_interval = 0; + int last_pressLayerX1_offset = 0; + int last_pressLayerY1_offset = 0; + int last_pressLayerX2_offset = 0; + int last_pressLayerY2_offset = 0; + int last_pressLayerX3_offset = 0; + int last_pressLayerY3_offset = 0; + int last_one_cribTotal = 0; + int last_two_cribTotal = 0; + int last_one_qty = 0; + int last_two_qty = 0; + int last_tool_coordinate = 0; + + protected int instruction_num = 0; + protected int instruction_num_truth = 0; + Integer heartbeat_tag; + private Date instruction_require_time = new Date(); + private Date instruction_finished_time = new Date(); + + private int instruction_require_time_out = 1000; + boolean requireSucess = false; + boolean resultSucess = false; + + private int instruction_finished_time_out; + + int heartbeat; + int last_heartbeat; + private Date checkHeartbeattime = new Date(); + private Date last_checkHeartbeattime = new Date(); + + + int branchProtocol = 0; + //当前指令 + Instruction inst = null; + //上次指令 + Instruction last_inst = null; + + //触摸屏手动触发任务 + private Boolean is_has_task = false; + + //暂定 0就绪 1请求取货 2取货完成 3请求放货 4放货完成 5取货完成离开 6放货完成离开 7请求进入区域 8请求离开区域 + int flag; + + String message; + int weight = 0; + int last_weight = 0; + + + int unqualified_qty = 0; + int last_unqualified_qty = 0; + int encoder_qty = 0; + int last_encoder_qty = 0; + + + @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(); + error = this.itemProtocol.getError(); + move = this.itemProtocol.getMove(); + task = this.itemProtocol.getTask(); + io_action = this.itemProtocol.getIoAction(); + action = this.itemProtocol.getAction(); + material = this.itemProtocol.getMaterial(); + barcode = this.itemProtocol.getBarcode(); + batch = this.itemProtocol.getBatch(); + specifications = this.itemProtocol.getSpecifications(); + AlongSide = this.itemProtocol.getAlongSide(); + BshortSide = this.itemProtocol.getBshortSide(); + Htrapezoidal = this.itemProtocol.getHtrapezoidal(); + Wthickness = this.itemProtocol.getWthickness(); + order_qty = this.itemProtocol.getOrder_qty(); + order_No = this.itemProtocol.getOrder_No(); + qty = this.itemProtocol.getQty(); + specifications = this.itemProtocol.getSpecifications(); + batch = this.itemProtocol.getBatch(); + total_split = this.itemProtocol.getTotal_split(); + order_qty = this.itemProtocol.getOrder_qty(); + xContainer_length = this.itemProtocol.getXContainer_length(); + yContainer_length = this.itemProtocol.getYContainer_length(); + container_getQty = this.itemProtocol.getContainer_getQty(); + getX_offset = this.itemProtocol.getGetX_offset(); + getY_offset = this.itemProtocol.getGetY_offset(); + + product_code = this.itemProtocol.getProduct_code(); + AlongSide = this.itemProtocol.getAlongSide(); + BshortSide = this.itemProtocol.getBshortSide(); + Htrapezoidal = this.itemProtocol.getHtrapezoidal(); + Wthickness = this.itemProtocol.getWthickness(); + tray_qty = this.itemProtocol.getTray_qty(); + tray_high = this.itemProtocol.getTray_high(); + crib_category = this.itemProtocol.getCrib_category(); + palletX1_line = this.itemProtocol.getPalletX1_line(); + palletY1_row = this.itemProtocol.getPalletY1_row(); + palletA1_angle = this.itemProtocol.getPalletA1_angle(); + palletX2_line = this.itemProtocol.getPalletX2_line(); + palletY2_row = this.itemProtocol.getPalletY2_row(); + palletA2_angle = this.itemProtocol.getPalletA2_angle(); + palletX3_line = this.itemProtocol.getPalletX3_line(); + palletY3_row = this.itemProtocol.getPalletY3_row(); + palletA3_angle = this.itemProtocol.getPalletA3_angle(); + pressCribX1_line = this.itemProtocol.getPressCribX1_line(); + pressCribY1_row = this.itemProtocol.getPressCribY1_row(); + pressCribA1_angle = this.itemProtocol.getPressCribA1_angle(); + pressCribX2_line = this.itemProtocol.getPressCribX2_line(); + pressCribY2_row = this.itemProtocol.getPressCribY2_row(); + pressCribA2_angle = this.itemProtocol.getPressCribA2_angle(); + pressCribX3_line = this.itemProtocol.getPressCribX3_line(); + pressCribY3_row = this.itemProtocol.getPressCribY3_row(); + pressCribA3_angle = this.itemProtocol.getPressCribA3_angle(); + Zoffset = this.itemProtocol.getZoffset(); + pallet_layerQty = this.itemProtocol.getPallet_layerQty(); + pressCrib_layerQty = this.itemProtocol.getPressCrib_layerQty(); + codeLayerX1_interval = this.itemProtocol.getCodeLayerX1_interval(); + codeLayerY1_interval = this.itemProtocol.getCodeLayerY1_interval(); + codeLayerX2_interval = this.itemProtocol.getCodeLayerX2_interval(); + codeLayerY2_interval = this.itemProtocol.getCodeLayerY2_interval(); + codeLayerX3_interval = this.itemProtocol.getCodeLayerX3_interval(); + codeLayerY3_interval = this.itemProtocol.getcodeLayerY3_interval(); + codeLayerX1_offset = this.itemProtocol.getCodeLayerX1_offset(); + codeLayerY1_offset = this.itemProtocol.getCodeLayerY1_offset(); + codeLayerX2_offset = this.itemProtocol.getCodeLayerX2_offset(); + codeLayerY2_offset = this.itemProtocol.getCodeLayerY2_offset(); + codeLayerX3_offset = this.itemProtocol.getCodeLayerX3_offset(); + codeLayerY3_offset = this.itemProtocol.getCodeLayerY3_offset(); + pressLayerX1_interval = this.itemProtocol.getPressLayerX1_interval(); + pressLayerY1_interval = this.itemProtocol.getPressLayerY1_interval(); + pressLayerX2_interval = this.itemProtocol.getPressLayerX2_interval(); + pressLayerY2_interval = this.itemProtocol.getPressLayerY2_interval(); + pressLayerX3_interval = this.itemProtocol.getPressLayerX3_interval(); + pressLayerY3_interval = this.itemProtocol.getPressLayerY3_interval(); + pressLayerX1_offset = this.itemProtocol.getPressLayerX1_offset(); + pressLayerY1_offset = this.itemProtocol.getPressLayerY1_offset(); + pressLayerX2_offset = this.itemProtocol.getPressLayerX2_offset(); + pressLayerY2_offset = this.itemProtocol.getPressLayerY2_offset(); + pressLayerX3_offset = this.itemProtocol.getPressLayerX3_offset(); + pressLayerY3_offset = this.itemProtocol.getPressLayerY3_offset(); + one_cribTotal = this.itemProtocol.getOne_cribTotal(); + two_cribTotal = this.itemProtocol.getTwo_cribTotal(); + one_qty = this.itemProtocol.getOne_qty(); + two_qty = this.itemProtocol.getTwo_qty(); + tool_coordinate = this.itemProtocol.getTool_coordinate(); + + to_command = this.itemProtocol.getToCommand(); + + if (mode != last_mode) { + this.setRequireSucess(false); + logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); + logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); + } + if (move != last_move) { + logServer.deviceItemValue(this.device_code,"move" ,String.valueOf(move)); + logServer.deviceExecuteLog(this.device_code,"","","信号move:" + last_move + "->" + move); + } + if (error != last_error) { + logServer.deviceItemValue(this.device_code,"error" ,String.valueOf(error)); + logServer.deviceExecuteLog(this.device_code,"","","信号error:" + last_error + "->" + error); + } + if (task != last_task) { + logServer.deviceItemValue(this.device_code,"task",String.valueOf(task)); + logServer.deviceExecuteLog(this.device_code,"","","信号task:" + last_task + "->" + task); + } + if (action != last_action) { + logServer.deviceItemValue(this.device_code,"action",String.valueOf(action)); + logServer.deviceExecuteLog(this.device_code,"","","信号action:" + last_action + "->" + action); + } + if (io_action != last_ioaction) { + logServer.deviceItemValue(this.device_code,"io_action",String.valueOf(io_action)); + logServer.deviceExecuteLog(this.device_code,"","","信号io_action: " + last_ioaction + "->" + io_action); + } + if (weight != last_weight) { + logServer.deviceItemValue(this.device_code,"weight",String.valueOf(weight)); + logServer.deviceExecuteLog(this.device_code,"","","信号weight: " + last_weight + "->" + weight); + } + if (batch != last_batch) { + logServer.deviceItemValue(this.device_code,"batch",String.valueOf(batch)); + logServer.deviceExecuteLog(this.device_code,"","","信号batch: " + last_batch + "->" + batch); + } + if (!StrUtil.equals(material,last_material)) { + logServer.deviceItemValue(this.device_code,"material", material); + logServer.deviceExecuteLog(this.device_code,"","","信号material:" + last_material + "->" + material); + } + if (barcode != last_barcode) { + logServer.deviceItemValue(this.device_code,"barcode", String.valueOf(barcode)); + logServer.deviceExecuteLog(this.device_code,"","","信号barcode:" + last_barcode + "->" + barcode); + } + if (!StrUtil.equals(specifications,last_specifications)) { + logServer.deviceItemValue(this.device_code,"specifications", specifications); + logServer.deviceExecuteLog(this.device_code,"","","信号specifications:" + last_specifications + "->" + specifications); + } + if (AlongSide != last_AlongSide) { + logServer.deviceItemValue(this.device_code,"AlongSide",String.valueOf(AlongSide)); + logServer.deviceExecuteLog(this.device_code,"","","信号AlongSide: " + last_AlongSide + "->" + AlongSide); + } + if (BshortSide != last_BshortSide) { + logServer.deviceItemValue(this.device_code,"BshortSide",String.valueOf(BshortSide)); + logServer.deviceExecuteLog(this.device_code,"","","信号BshortSide: " + last_BshortSide + "->" + BshortSide); + } + if (Htrapezoidal != last_Htrapezoidal) { + logServer.deviceItemValue(this.device_code,"Htrapezoidal",String.valueOf(Htrapezoidal)); + logServer.deviceExecuteLog(this.device_code,"","","信号Htrapezoidal: " + last_Htrapezoidal + "->" + Htrapezoidal); + } + if (Wthickness != last_Wthickness) { + logServer.deviceItemValue(this.device_code,"Wthickness",String.valueOf(Wthickness)); + logServer.deviceExecuteLog(this.device_code,"","","信号Wthickness: " + last_Wthickness + "->" + Wthickness); + } + if (status != last_status) { + logServer.deviceItemValue(this.device_code,"status" ,String.valueOf(status)); + logServer.deviceExecuteLog(this.device_code,"","","信号status:" + last_status + "->" + status); + } + if (encoder_qty != last_encoder_qty) { + logServer.deviceItemValue(this.device_code,"encoder_qty" ,String.valueOf(encoder_qty)); + logServer.deviceExecuteLog(this.device_code,"","","信号encoder_qty:" + last_encoder_qty + "->" + encoder_qty); + } + if (!StrUtil.equals(order_No,last_order_No)) { + logServer.deviceItemValue(this.device_code,"order_No", order_No); + logServer.deviceExecuteLog(this.device_code,"","","信号order_No:" + last_order_No + "->" + order_No); + } + if (order_qty != last_order_qty) { + logServer.deviceItemValue(this.device_code,"order_qty" ,String.valueOf(order_qty)); + logServer.deviceExecuteLog(this.device_code,"","","信号order_qty:" + last_order_qty + "->" + order_qty); + } + if (unqualified_qty != last_unqualified_qty) { + logServer.deviceItemValue(this.device_code,"unqualified_qty" ,String.valueOf(unqualified_qty)); + logServer.deviceExecuteLog(this.device_code,"","","信号unqualified_qty:" + last_unqualified_qty + "->" + unqualified_qty); + } + if (total_split != last_total_split) { + logServer.deviceItemValue(this.device_code,"total_split" ,String.valueOf(total_split)); + logServer.deviceExecuteLog(this.device_code,"","","信号total_split:" + last_total_split + "->" + total_split); + } + if (product_code != last_product_code) { + logServer.deviceItemValue(this.device_code,"product_code" ,String.valueOf(product_code)); + logServer.deviceExecuteLog(this.device_code,"","","信号product_code:" + last_product_code + "->" + product_code); + } + if (AlongSide != last_AlongSide) { + logServer.deviceItemValue(this.device_code,"AlongSide" ,String.valueOf(AlongSide)); + logServer.deviceExecuteLog(this.device_code,"","","信号AlongSide:" + last_AlongSide + "->" + AlongSide); + } + if (BshortSide != last_BshortSide) { + logServer.deviceItemValue(this.device_code,"BshortSide" ,String.valueOf(BshortSide)); + logServer.deviceExecuteLog(this.device_code,"","","信号BshortSide:" + last_BshortSide + "->" + BshortSide); + } + if (Htrapezoidal != last_Htrapezoidal) { + logServer.deviceItemValue(this.device_code,"Htrapezoidal" ,String.valueOf(Htrapezoidal)); + logServer.deviceExecuteLog(this.device_code,"","","信号Htrapezoidal:" + last_Htrapezoidal + "->" + Htrapezoidal); + } + if (Wthickness != last_Wthickness) { + logServer.deviceItemValue(this.device_code,"Wthickness" ,String.valueOf(Wthickness)); + logServer.deviceExecuteLog(this.device_code,"","","信号Wthickness:" + last_Wthickness + "->" + Wthickness); + } + if (tray_qty != last_tray_qty) { + logServer.deviceItemValue(this.device_code,"tray_qty" ,String.valueOf(tray_qty)); + logServer.deviceExecuteLog(this.device_code,"","","信号tray_qty:" + last_tray_qty + "->" + tray_qty); + } + if (tray_high != last_tray_high) { + logServer.deviceItemValue(this.device_code,"tray_high" ,String.valueOf(tray_high)); + logServer.deviceExecuteLog(this.device_code,"","","信号tray_high:" + last_tray_high + "->" + tray_high); + } + if (crib_category != last_crib_category) { + logServer.deviceItemValue(this.device_code,"crib_category" ,String.valueOf(crib_category)); + logServer.deviceExecuteLog(this.device_code,"","","信号crib_category:" + last_crib_category + "->" + crib_category); + } + if (palletX1_line != last_palletX1_line) { + logServer.deviceItemValue(this.device_code,"palletX1_line" ,String.valueOf(palletX1_line)); + logServer.deviceExecuteLog(this.device_code,"","","信号palletX1_line:" + last_palletX1_line + "->" + palletX1_line); + } + if (palletY1_row != last_palletY1_row) { + logServer.deviceItemValue(this.device_code,"palletY1_row" ,String.valueOf(palletY1_row)); + logServer.deviceExecuteLog(this.device_code,"","","信号palletY1_row:" + last_palletY1_row + "->" + palletY1_row); + } + if (palletA1_angle != last_palletA1_angle) { + logServer.deviceItemValue(this.device_code,"palletA1_angle" ,String.valueOf(palletA1_angle)); + logServer.deviceExecuteLog(this.device_code,"","","信号palletA1_angle:" + last_palletA1_angle + "->" + palletA1_angle); + } + if (palletX2_line != last_palletX2_line) { + logServer.deviceItemValue(this.device_code,"palletX2_line" ,String.valueOf(palletX2_line)); + logServer.deviceExecuteLog(this.device_code,"","","信号palletX2_line:" + last_palletX2_line + "->" + palletX2_line); + } + if (palletY2_row != last_palletY2_row) { + logServer.deviceItemValue(this.device_code,"palletY2_row" ,String.valueOf(palletY2_row)); + logServer.deviceExecuteLog(this.device_code,"","","信号palletY2_row:" + last_palletY2_row + "->" + palletY2_row); + } + if (palletA2_angle != last_palletA2_angle) { + logServer.deviceItemValue(this.device_code,"palletA2_angle" ,String.valueOf(palletA2_angle)); + logServer.deviceExecuteLog(this.device_code,"","","信号palletA2_angle:" + last_palletA2_angle + "->" + palletA2_angle); + } + if (palletX3_line != last_palletX3_line) { + logServer.deviceItemValue(this.device_code,"palletX3_line" ,String.valueOf(palletX3_line)); + logServer.deviceExecuteLog(this.device_code,"","","信号palletX3_line:" + last_palletX3_line + "->" + palletX3_line); + } + if (palletY3_row != last_palletY3_row) { + logServer.deviceItemValue(this.device_code,"palletY3_row" ,String.valueOf(palletY3_row)); + logServer.deviceExecuteLog(this.device_code,"","","信号palletY3_row:" + last_palletY3_row + "->" + palletY3_row); + } + if (palletA3_angle != last_palletA3_angle) { + logServer.deviceItemValue(this.device_code,"palletA3_angle" ,String.valueOf(palletA3_angle)); + logServer.deviceExecuteLog(this.device_code,"","","信号palletA3_angle:" + last_palletA3_angle + "->" + palletA3_angle); + } + if (pressCribX1_line != last_pressCribX1_line) { + logServer.deviceItemValue(this.device_code,"pressCribX1_line" ,String.valueOf(pressCribX1_line)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressCribX1_line:" + last_pressCribX1_line + "->" + pressCribX1_line); + } + if (pressCribY1_row != last_pressCribY1_row) { + logServer.deviceItemValue(this.device_code,"pressCribY1_row" ,String.valueOf(pressCribY1_row)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressCribY1_row:" + last_pressCribY1_row + "->" + pressCribY1_row); + } + if (pressCribA1_angle != last_pressCribA1_angle) { + logServer.deviceItemValue(this.device_code,"pressCribA1_angle" ,String.valueOf(pressCribA1_angle)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressCribA1_angle:" + last_pressCribA1_angle + "->" + pressCribA1_angle); + } + if (pressCribX2_line != last_pressCribX2_line) { + logServer.deviceItemValue(this.device_code,"pressCribX2_line" ,String.valueOf(pressCribX2_line)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressCribX2_line:" + last_pressCribX2_line + "->" + pressCribX2_line); + } + if (pressCribY2_row != last_pressCribY2_row) { + logServer.deviceItemValue(this.device_code,"pressCribY2_row" ,String.valueOf(pressCribY2_row)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressCribY2_row:" + last_pressCribY2_row + "->" + pressCribY2_row); + } + if (pressCribA2_angle != last_pressCribA2_angle) { + logServer.deviceItemValue(this.device_code,"pressCribA2_angle" ,String.valueOf(pressCribA2_angle)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressCribA2_angle:" + last_pressCribA2_angle + "->" + pressCribA2_angle); + } + if (pressCribX3_line != last_pressCribX3_line) { + logServer.deviceItemValue(this.device_code,"pressCribX3_line" ,String.valueOf(pressCribX3_line)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressCribX3_line:" + last_pressCribX3_line + "->" + pressCribX3_line); + } + if (pressCribY3_row != last_pressCribY3_row) { + logServer.deviceItemValue(this.device_code,"pressCribY3_row" ,String.valueOf(pressCribY3_row)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressCribY3_row:" + last_pressCribY3_row + "->" + pressCribY3_row); + } + if (pressCribA3_angle != last_pressCribA3_angle) { + logServer.deviceItemValue(this.device_code,"pressCribA3_angle" ,String.valueOf(pressCribA3_angle)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressCribA3_angle:" + last_pressCribA3_angle + "->" + pressCribA3_angle); + } + if (Zoffset != last_Zoffset) { + logServer.deviceItemValue(this.device_code,"Zoffset" ,String.valueOf(Zoffset)); + logServer.deviceExecuteLog(this.device_code,"","","信号Zoffset:" + last_Zoffset + "->" + Zoffset); + } + if (pallet_layerQty != last_pallet_layerQty) { + logServer.deviceItemValue(this.device_code,"pallet_layerQty" ,String.valueOf(pallet_layerQty)); + logServer.deviceExecuteLog(this.device_code,"","","信号pallet_layerQty:" + last_pallet_layerQty + "->" + pallet_layerQty); + } + if (pressCrib_layerQty != last_pressCrib_layerQty) { + logServer.deviceItemValue(this.device_code,"pressCrib_layerQty" ,String.valueOf(pressCrib_layerQty)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressCrib_layerQty:" + last_pressCrib_layerQty + "->" + pressCrib_layerQty); + } + if (codeLayerX1_interval != last_codeLayerX1_interval) { + logServer.deviceItemValue(this.device_code,"codeLayerX1_interval" ,String.valueOf(codeLayerX1_interval)); + logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX1_interval:" + last_codeLayerX1_interval + "->" + codeLayerX1_interval); + } + if (codeLayerY1_interval != last_codeLayerY1_interval) { + logServer.deviceItemValue(this.device_code,"codeLayerY1_interval" ,String.valueOf(codeLayerY1_interval)); + logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY1_interval:" + last_codeLayerY1_interval + "->" + codeLayerY1_interval); + } + if (codeLayerX2_interval != last_codeLayerX2_interval) { + logServer.deviceItemValue(this.device_code,"codeLayerX2_interval" ,String.valueOf(codeLayerX2_interval)); + logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX2_interval:" + last_codeLayerX2_interval + "->" + codeLayerX2_interval); + } + if (codeLayerY2_interval != last_codeLayerY2_interval) { + logServer.deviceItemValue(this.device_code,"codeLayerY2_interval" ,String.valueOf(codeLayerY2_interval)); + logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY2_interval:" + last_codeLayerY2_interval + "->" + codeLayerY2_interval); + } + if (codeLayerX3_interval != last_codeLayerX3_interval) { + logServer.deviceItemValue(this.device_code,"codeLayerX3_interval" ,String.valueOf(codeLayerX3_interval)); + logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX3_interval:" + last_codeLayerX3_interval + "->" + codeLayerX3_interval); + } + if (codeLayerY3_interval != last_codeLayerY3_interval) { + logServer.deviceItemValue(this.device_code,"codeLayerY3_interval" ,String.valueOf(codeLayerY3_interval)); + logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY3_interval:" + last_codeLayerY3_interval + "->" + codeLayerY3_interval); + } + if (codeLayerX1_offset != last_codeLayerX1_offset) { + logServer.deviceItemValue(this.device_code,"codeLayerX1_offset" ,String.valueOf(codeLayerX1_offset)); + logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX1_offset:" + last_codeLayerX1_offset + "->" + codeLayerX1_offset); + } + if (codeLayerY1_offset != last_codeLayerY1_offset) { + logServer.deviceItemValue(this.device_code,"codeLayerY1_offset" ,String.valueOf(codeLayerY1_offset)); + logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY1_offset:" + last_codeLayerY1_offset + "->" + codeLayerY1_offset); + } + if (codeLayerX2_offset != last_codeLayerX2_offset) { + logServer.deviceItemValue(this.device_code,"codeLayerX2_offset" ,String.valueOf(codeLayerX2_offset)); + logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX2_offset:" + last_codeLayerX2_offset + "->" + codeLayerX2_offset); + } + if (codeLayerY2_offset != last_codeLayerY2_offset) { + logServer.deviceItemValue(this.device_code,"codeLayerY2_offset" ,String.valueOf(codeLayerY2_offset)); + logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY2_offset:" + last_codeLayerY2_offset + "->" + codeLayerY2_offset); + } + if (codeLayerX3_offset != last_codeLayerX3_offset) { + logServer.deviceItemValue(this.device_code,"codeLayerX3_offset" ,String.valueOf(codeLayerX3_offset)); + logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerX3_offset:" + last_codeLayerX3_offset + "->" + codeLayerX3_offset); + } + if (codeLayerY3_offset != last_codeLayerY3_offset) { + logServer.deviceItemValue(this.device_code,"codeLayerY3_offset" ,String.valueOf(codeLayerY3_offset)); + logServer.deviceExecuteLog(this.device_code,"","","信号codeLayerY3_offset:" + last_codeLayerY3_offset + "->" + codeLayerY3_offset); + } + if (pressLayerX1_interval != last_pressLayerX1_interval) { + logServer.deviceItemValue(this.device_code,"pressLayerX1_interval" ,String.valueOf(pressLayerX1_interval)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX1_interval:" + last_pressLayerX1_interval + "->" + pressLayerX1_interval); + } + if (pressLayerY1_interval != last_pressLayerY1_interval) { + logServer.deviceItemValue(this.device_code,"pressLayerY1_interval" ,String.valueOf(pressLayerY1_interval)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY1_interval:" + last_pressLayerY1_interval + "->" + pressLayerY1_interval); + } + if (pressLayerX2_interval != last_pressLayerX2_interval) { + logServer.deviceItemValue(this.device_code,"pressLayerX2_interval" ,String.valueOf(pressLayerX2_interval)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX2_interval:" + last_pressLayerX2_interval + "->" + pressLayerX2_interval); + } + if (pressLayerY2_interval != last_pressLayerY2_interval) { + logServer.deviceItemValue(this.device_code,"pressLayerY2_interval" ,String.valueOf(pressLayerY2_interval)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY2_interval:" + last_pressLayerY2_interval + "->" + pressLayerY2_interval); + } + if (pressLayerX3_interval != last_pressLayerX3_interval) { + logServer.deviceItemValue(this.device_code,"pressLayerX3_interval" ,String.valueOf(pressLayerX3_interval)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX3_interval:" + last_pressLayerX3_interval + "->" + pressLayerX3_interval); + } + if (pressLayerY3_interval != last_pressLayerY3_interval) { + logServer.deviceItemValue(this.device_code,"pressLayerY3_interval" ,String.valueOf(pressLayerY3_interval)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY3_interval:" + last_pressLayerY3_interval + "->" + pressLayerY3_interval); + } + if (pressLayerX1_offset != last_pressLayerX1_offset) { + logServer.deviceItemValue(this.device_code,"pressLayerX1_offset" ,String.valueOf(pressLayerX1_offset)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX1_offset:" + last_pressLayerX1_offset + "->" + pressLayerX1_offset); + } + if (pressLayerY1_offset != last_pressLayerY1_offset) { + logServer.deviceItemValue(this.device_code,"pressLayerY1_offset" ,String.valueOf(pressLayerY1_offset)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY1_offset:" + last_pressLayerY1_offset + "->" + pressLayerY1_offset); + } + if (pressLayerX2_offset != last_pressLayerX2_offset) { + logServer.deviceItemValue(this.device_code,"pressLayerX2_offset" ,String.valueOf(pressLayerX2_offset)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX2_offset:" + last_pressLayerX2_offset + "->" + pressLayerX2_offset); + } + if (pressLayerY2_offset != last_pressLayerY2_offset) { + logServer.deviceItemValue(this.device_code,"pressLayerY2_offset" ,String.valueOf(pressLayerY2_offset)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY2_offset:" + last_pressLayerY2_offset + "->" + pressLayerY2_offset); + } + if (pressLayerX3_offset != last_pressLayerX3_offset) { + logServer.deviceItemValue(this.device_code,"pressLayerX3_offset" ,String.valueOf(pressLayerX3_offset)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerX3_offset:" + last_pressLayerX3_offset + "->" + pressLayerX3_offset); + } + if (pressLayerY3_offset != last_pressLayerY3_offset) { + logServer.deviceItemValue(this.device_code,"pressLayerY3_offset" ,String.valueOf(pressLayerY3_offset)); + logServer.deviceExecuteLog(this.device_code,"","","信号pressLayerY3_offset:" + last_pressLayerY3_offset + "->" + pressLayerY3_offset); + } + if (one_cribTotal != last_one_cribTotal) { + logServer.deviceItemValue(this.device_code,"one_cribTotal" ,String.valueOf(one_cribTotal)); + logServer.deviceExecuteLog(this.device_code,"","","信号one_cribTotal:" + last_one_cribTotal + "->" + one_cribTotal); + } + if (two_cribTotal != last_two_cribTotal) { + logServer.deviceItemValue(this.device_code,"two_cribTotal" ,String.valueOf(two_cribTotal)); + logServer.deviceExecuteLog(this.device_code,"","","信号two_cribTotal:" + last_two_cribTotal + "->" + two_cribTotal); + } + if (one_qty != last_one_qty) { + logServer.deviceItemValue(this.device_code,"one_qty" ,String.valueOf(one_qty)); + logServer.deviceExecuteLog(this.device_code,"","","信号one_qty:" + last_one_qty + "->" + one_qty); + } + if (two_qty != last_two_qty) { + logServer.deviceItemValue(this.device_code,"two_qty" ,String.valueOf(two_qty)); + logServer.deviceExecuteLog(this.device_code,"","","信号two_qty:" + last_two_qty + "->" + two_qty); + } + if (tool_coordinate != last_tool_coordinate) { + logServer.deviceItemValue(this.device_code,"tool_coordinate" ,String.valueOf(tool_coordinate)); + logServer.deviceExecuteLog(this.device_code,"","","信号tool_coordinate:" + last_tool_coordinate + "->" + tool_coordinate); + } + if (xContainer_length != last_xContainer_length) { + logServer.deviceItemValue(this.device_code,"xContainer_length" ,String.valueOf(xContainer_length)); + logServer.deviceExecuteLog(this.device_code,"","","信号xContainer_length:" + last_xContainer_length + "->" + xContainer_length); + } + if (yContainer_length != last_yContainer_length) { + logServer.deviceItemValue(this.device_code,"yContainer_length" ,String.valueOf(yContainer_length)); + logServer.deviceExecuteLog(this.device_code,"","","信号yContainer_length:" + last_yContainer_length + "->" + yContainer_length); + } + if (container_getQty != last_container_getQty) { + logServer.deviceItemValue(this.device_code,"container_getQty" ,String.valueOf(container_getQty)); + logServer.deviceExecuteLog(this.device_code,"","","信号container_getQty:" + last_container_getQty + "->" + container_getQty); + } + if (getX_offset != last_getX_offset) { + logServer.deviceItemValue(this.device_code,"getX_offset" ,String.valueOf(getX_offset)); + logServer.deviceExecuteLog(this.device_code,"","","信号getX_offset:" + last_getX_offset + "->" + getX_offset); + } + if (getY_offset != last_getY_offset) { + logServer.deviceItemValue(this.device_code,"getY_offset" ,String.valueOf(getY_offset)); + logServer.deviceExecuteLog(this.device_code,"","","信号getY_offset:" + last_getY_offset + "->" + getY_offset); + } + + + + } catch (Exception var17) { + return; + } + + //急停 + if (this.isStop()) { + + //未在线无心跳 + } else if (!this.itemProtocol.getIsonline()) { + this.setIsonline(false); + this.setIserror(true); + message = "信号量同步异常"; + //未联机 + } else if (mode == 0) { + this.setIsonline(false); + this.setIserror(true); + message = "未联机"; + //有报警 + } else if (error != 0) { + this.setIsonline(false); + this.setIserror(true); + message = "有报警"; + //无报警 + } else { + this.setIsonline(true); + this.setIserror(false); + message = ""; + Instruction instruction = null; + List toInstructions; + switch (mode) { + case 1: + log.debug("设备运转模式:等待工作"); + break; + case 2: + break; + case 4: + break; + case 5: + //获取托盘信息 + if (!requireSucess) { + queryCribbingInfo(); + } + break; + case 6: + //码垛完成 + if (!requireSucess) { + applyEmpty(); + } + if (resultSucess) { + palletizing(); + } + break; + case 7: + //码垛强制完成 半托缓存 + if (!requireSucess) { + mandatoryPalletizing("0"); + } + break; + case 8: + //申请空盘 + if (!resultSucess) { + applyEmpty(); + } + break; + case 9: + //工单完成 + if (!requireSucess && !order_No.equals("0")) { + JSONObject json = new JSONObject(); + json.put("producetask_code",order_No); + json.put("device_code",this.device_code); + json.put("material_code",material); + json.put("qty",qty); + json.put("type","2"); + enterProduction(json); + } + break; + case 10: + //叫料 + if (!requireSucess && getStation>0 && StrUtil.isNotEmpty(material)) { +// callMaterial(); + } + break; + case 11: + //强制去包装 + if (!requireSucess) { + mandatoryPalletizing("1"); + } + break; + case 12: + //申请空盘入库 + if (!requireSucess) { + applyEmptyIn(); + } + break; + } + + switch (flag) { + //请求取货 +// case 1: +// writing(12); +// return; +// //取货完成 +// case 2: +// writing(10); +// return; +// //请求放货 +// case 3: +// writing(13); +// return; +// //放货完成 +// case 4: +// writing(11); +// return; + } + } + + last_mode = mode; + last_error = error; + last_move = move; + last_task = task; + last_action = action; + last_ioaction = io_action; + last_weight = weight; + last_material = material; + last_barcode = barcode; + last_specifications = specifications; + last_batch = batch; + last_AlongSide = AlongSide; + last_BshortSide = BshortSide; + last_Htrapezoidal = Htrapezoidal; + last_Wthickness = Wthickness; + last_order_No = order_No; + last_order_qty = order_qty; + last_encoder_qty = encoder_qty; + last_status = status; + last_unqualified_qty = unqualified_qty; + } + + + /** + * 申请空盘 + * + * @param + */ + public synchronized boolean applyEmpty() { + JSONObject json = new JSONObject(); + json.put("device_code",this.device_code); + json.put("type","4"); + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (result.getStatus() == 200) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if ("200".equals(jsonObject.getString("status"))) { + this.writing(8); + this.setResultSucess(true); + this.setRequireSucess(true); + return true; + } + } + result.close(); + return false; + } + + /** + * 排产单确认 + * + * @param + */ + public synchronized boolean enterProduction(JSONObject json) { + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return false; + } else { + this.instruction_require_time = date; + logServer.deviceExecuteLog(device_code, "", "", "排产单确认请求参数:" + json); + HttpResponse result = acsToWmsService.enterOrder(json); + logServer.deviceExecuteLog(device_code, "", "", "排产单确认返回参数:" + result); + if (ObjectUtil.isNotEmpty(result)) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { + ProduceshiftorderDto dto = produceshiftorderService.findByCode(order_No); + if (this.mode == 4) { + dto.setOrder_status("1"); + } else if (this.mode == 9) { + dto.setOrder_status("2"); + } + produceshiftorderService.update(dto); + this.writing(this.mode); + this.setRequireSucess(true); + } + } + return true; + } + } + + /** + * 码垛完成 + * + * @param + */ + public synchronized boolean palletizing() { + JSONObject json = new JSONObject(); + + json.put("device_code",this.device_code); + json.put("qty",one_qty); + json.put("vehicle_code",barcode); + json.put("is_full","1"); + json.put("product_code",product_code); + json.put("AlongSide",AlongSide); + json.put("BshortSide",BshortSide); + json.put("Htrapezoidal",Htrapezoidal); + json.put("Wthickness",Wthickness); + json.put("tray_qty",tray_qty); + json.put("tray_high",tray_high); + json.put("crib_category",crib_category); + json.put("palletX1_line",palletX1_line); + json.put("palletY1_row",palletY1_row); + json.put("palletA1_angle",palletA1_angle); + json.put("palletX2_line",palletX2_line); + json.put("palletY2_row",palletY2_row); + json.put("palletA2_angle",palletA2_angle); + json.put("palletX3_line",palletX3_line); + json.put("palletY3_row",palletY3_row); + json.put("palletA3_angle",palletA3_angle); + json.put("pressCribX1_line",pressCribX1_line); + json.put("pressCribY1_row",pressCribY1_row); + json.put("pressCribA1_angle",pressCribA1_angle); + json.put("pressCribX2_line",pressCribX2_line); + json.put("pressCribY2_row",pressCribY2_row); + json.put("pressCribA2_angle",pressCribA2_angle); + json.put("pressCribX3_line",pressCribX3_line); + json.put("pressCribY3_row",pressCribY3_row); + json.put("pressCribA3_angle",pressCribA3_angle); + json.put("Zoffset",Zoffset); + json.put("pallet_layerQty",pallet_layerQty); + json.put("pressCrib_layerQty",pressCrib_layerQty); + json.put("codeLayerX1_interval",codeLayerX1_interval); + json.put("codeLayerY1_interval",codeLayerY1_interval); + json.put("codeLayerX2_interval",codeLayerX2_interval); + json.put("codeLayerY2_interval",codeLayerY2_interval); + json.put("codeLayerX3_interval",codeLayerX3_interval); + json.put("codeLayerY3_interval",codeLayerY3_interval); + json.put("codeLayerX1_offset",codeLayerX1_offset); + json.put("codeLayerY1_offset",codeLayerY1_offset); + json.put("codeLayerX2_offset",codeLayerX2_offset); + json.put("codeLayerY2_offset",codeLayerY2_offset); + json.put("codeLayerX3_offset",codeLayerX3_offset); + json.put("codeLayerY3_offset",codeLayerY3_offset); + json.put("pressLayerX1_interval",pressLayerX1_interval); + json.put("pressLayerY1_interval",pressLayerY1_interval); + json.put("pressLayerX2_interval",pressLayerX2_interval); + json.put("pressLayerY2_interval",pressLayerY2_interval); + json.put("pressLayerX3_interval",pressLayerX3_interval); + json.put("pressLayerY3_interval",pressLayerY3_interval); + json.put("pressLayerX1_offset",pressLayerX1_offset); + json.put("pressLayerY1_offset",pressLayerY1_offset); + json.put("pressLayerX2_offset",pressLayerX2_offset); + json.put("pressLayerY2_offset",pressLayerY2_offset); + json.put("pressLayerX3_offset",pressLayerX3_offset); + json.put("pressLayerY3_offset",pressLayerY3_offset); + json.put("one_cribTotal",one_cribTotal); + json.put("two_cribTotal",two_cribTotal); + json.put("one_qty",one_qty); + json.put("two_qty",two_qty); + json.put("tool_coordinate",tool_coordinate); + json.put("material_code",material); + + HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); + if (result.getStatus() == 200) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if ("200".equals(jsonObject.getString("status"))) { + this.writing(this.mode); + this.setResultSucess(false); + } + } + result.close(); + return true; + } + + /** + * 申请空盘入库 + * + * @param + */ + public synchronized boolean applyEmptyIn() { + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return false; + } else { + this.instruction_require_time = date; + JSONObject json = new JSONObject(); + + json.put("device_code",this.device_code); + json.put("type","3"); + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { + this.writing(this.mode); + this.setRequireSucess(true); + } + } + return true; + } + } + + /** + * 码垛强制完成 + * + * @param + */ + public synchronized boolean mandatoryPalletizing(String type) { + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return false; + } else { + this.instruction_require_time = date; + JSONObject json = new JSONObject(); + json.put("device_code",this.device_code); + //如果是1号对接位请求,那么数量就传1号垛数量 + json.put("qty",one_qty); + json.put("vehicle_code",barcode); + json.put("material_code",material); + json.put("is_full",type); + json.put("product_code",product_code); + json.put("AlongSide",AlongSide); + json.put("BshortSide",BshortSide); + json.put("Htrapezoidal",Htrapezoidal); + json.put("Wthickness",Wthickness); + json.put("tray_qty",tray_qty); + json.put("tray_high",tray_high); + json.put("crib_category",crib_category); + json.put("palletX1_line",palletX1_line); + json.put("palletY1_row",palletY1_row); + json.put("palletA1_angle",palletA1_angle); + json.put("palletX2_line",palletX2_line); + json.put("palletY2_row",palletY2_row); + json.put("palletA2_angle",palletA2_angle); + json.put("palletX3_line",palletX3_line); + json.put("palletY3_row",palletY3_row); + json.put("palletA3_angle",palletA3_angle); + json.put("pressCribX1_line",pressCribX1_line); + json.put("pressCribY1_row",pressCribY1_row); + json.put("pressCribA1_angle",pressCribA1_angle); + json.put("pressCribX2_line",pressCribX2_line); + json.put("pressCribY2_row",pressCribY2_row); + json.put("pressCribA2_angle",pressCribA2_angle); + json.put("pressCribX3_line",pressCribX3_line); + json.put("pressCribY3_row",pressCribY3_row); + json.put("pressCribA3_angle",pressCribA3_angle); + json.put("Zoffset",Zoffset); + json.put("pallet_layerQty",pallet_layerQty); + json.put("pressCrib_layerQty",pressCrib_layerQty); + json.put("codeLayerX1_interval",codeLayerX1_interval); + json.put("codeLayerY1_interval",codeLayerY1_interval); + json.put("codeLayerX2_interval",codeLayerX2_interval); + json.put("codeLayerY2_interval",codeLayerY2_interval); + json.put("codeLayerX3_interval",codeLayerX3_interval); + json.put("codeLayerY3_interval",codeLayerY3_interval); + json.put("codeLayerX1_offset",codeLayerX1_offset); + json.put("codeLayerY1_offset",codeLayerY1_offset); + json.put("codeLayerX2_offset",codeLayerX2_offset); + json.put("codeLayerY2_offset",codeLayerY2_offset); + json.put("codeLayerX3_offset",codeLayerX3_offset); + json.put("codeLayerY3_offset",codeLayerY3_offset); + json.put("pressLayerX1_interval",pressLayerX1_interval); + json.put("pressLayerY1_interval",pressLayerY1_interval); + json.put("pressLayerX2_interval",pressLayerX2_interval); + json.put("pressLayerY2_interval",pressLayerY2_interval); + json.put("pressLayerX3_interval",pressLayerX3_interval); + json.put("pressLayerY3_interval",pressLayerY3_interval); + json.put("pressLayerX1_offset",pressLayerX1_offset); + json.put("pressLayerY1_offset",pressLayerY1_offset); + json.put("pressLayerX2_offset",pressLayerX2_offset); + json.put("pressLayerY2_offset",pressLayerY2_offset); + json.put("pressLayerX3_offset",pressLayerX3_offset); + json.put("pressLayerY3_offset",pressLayerY3_offset); + json.put("one_cribTotal",one_cribTotal); + json.put("two_cribTotal",two_cribTotal); + json.put("one_qty",one_qty); + json.put("two_qty",two_qty); + json.put("tool_coordinate",tool_coordinate); + + HttpResponse result = acsToWmsService.applyTaskManipulatorToWms(json); + if (ObjectUtil.isNotEmpty(result)) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { + this.writing(this.mode); + this.setRequireSucess(true); + } + } + return true; + } + } + + public synchronized boolean queryCribbingInfo() throws InterruptedException { + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return false; + } else { + this.instruction_require_time = date; + JSONObject json = new JSONObject(); + json.put("device_code",this.device_code); + json.put("vehicle_code",barcode); + HttpResponse result = acsToWmsService.queryCribbingInfo(json); + + if (result.getStatus() == 200) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + JSONObject content = jsonObject.getJSONObject("content"); + if (ObjectUtil.isEmpty(content)) { + this.writing(20); + this.setRequireSucess(true); + return true; + } else { + String qty = content.getString("qty"); + String material_code = content.getString("material_code"); + String material_name = content.getString("material_name"); + String product_code = content.getString("product_code"); + String AlongSide = content.getString("alongside"); + String BshortSide = content.getString("bshortside"); + String Htrapezoidal = content.getString("htrapezoidal"); + String Wthickness = content.getString("wthickness"); + String tray_qty = content.getString("tray_qty"); + String tray_high = content.getString("tray_high"); + String crib_category = content.getString("crib_category"); + String palletX1_line = content.getString("palletx1_line"); + String palletY1_row = content.getString("pallety1_row"); + String palletA1_angle = content.getString("palleta1_angle"); + String palletX2_line = content.getString("palletx2_line"); + String palletY2_row = content.getString("pallety2_row"); + String palletA2_angle = content.getString("palleta2_angle"); + String palletX3_line = content.getString("palletx3_line"); + String palletY3_row = content.getString("pallety3_row"); + String palletA3_angle = content.getString("palleta3_angle"); + String pressCribX1_line = content.getString("presscribx1_line"); + String pressCribY1_row = content.getString("presscriby1_row"); + String pressCribA1_angle = content.getString("presscriba1_angle"); + String pressCribX2_line = content.getString("presscribx2_line"); + String pressCribY2_row = content.getString("presscriby2_row"); + String pressCribA2_angle = content.getString("presscriba2_angle"); + String pressCribX3_line = content.getString("presscribx3_line"); + String pressCribY3_row = content.getString("presscriby3_row"); + String pressCribA3_angle = content.getString("presscriba3_angle"); + String Zoffset = content.getString("zoffset"); + String pallet_layerQty = content.getString("pallet_layerqty"); + String pressCrib_layerQty = content.getString("presscrib_layerqty"); + String codeLayerX1_interval = content.getString("codelayerx1_interval"); + String codeLayerY1_interval = content.getString("codelayery1_interval"); + String codeLayerX2_interval = content.getString("codelayerx2_interval"); + String codeLayerY2_interval = content.getString("codelayery2_interval"); + String codeLayerX3_interval = content.getString("codelayerx3_interval"); + String codeLayerY3_interval = content.getString("codelayery3_interval"); + String codeLayerX1_offset = content.getString("codelayerx1_offset"); + String codeLayerY1_offset = content.getString("codelayery1_offset"); + String codeLayerX2_offset = content.getString("codelayerx2_offset"); + String codeLayerY2_offset = content.getString("codelayery2_offset"); + String codeLayerX3_offset = content.getString("codelayerx3_offset"); + String codeLayerY3_offset = content.getString("codelayery3_offset"); + String pressLayerX1_interval = content.getString("presslayerx1_interval"); + String pressLayerY1_interval = content.getString("presslayery1_interval"); + String pressLayerX2_interval = content.getString("presslayerx2_interval"); + String pressLayerY2_interval = content.getString("presslayery2_interval"); + String pressLayerX3_interval = content.getString("presslayerx3_interval"); + String pressLayerY3_interval = content.getString("presslayery3_interval"); + String pressLayerX1_offset = content.getString("presslayerx1_offset"); + String pressLayerY1_offset = content.getString("presslayery1_offset"); + String pressLayerX2_offset = content.getString("presslayerx2_offset"); + String pressLayerY2_offset = content.getString("presslayery2_offset"); + String pressLayerX3_offset = content.getString("presslayerx3_offset"); + String pressLayerY3_offset = content.getString("presslayery3_offset"); + String one_cribTotal = content.getString("one_cribtotal"); + String two_cribTotal = content.getString("two_cribtotal"); + String one_qty = content.getString("one_qty"); + String two_qty = content.getString("two_qty"); + String tool_coordinate = content.getString("tool_coordinate"); + + this.writing("to_material_qty", StrUtil.isBlank(qty) ? "0" : qty); + this.writing("to_material_code", StrUtil.isBlank(material_code) ? "0" : material_code ); + this.writing("to_product_code", StrUtil.isBlank(product_code) ? "0" : product_code ); + this.writing("to_AlongSide", StrUtil.isBlank(AlongSide) ? "0" : AlongSide ); + this.writing("to_BshortSide", StrUtil.isBlank(BshortSide) ? "0" : BshortSide ); + this.writing("to_Htrapezoidal", StrUtil.isBlank(Htrapezoidal) ? "0" : Htrapezoidal ); + this.writing("to_Wthickness", StrUtil.isBlank(Wthickness) ? "0" : Wthickness ); + this.writing("to_tray_qty", StrUtil.isBlank(qty) ? "0" : qty ); + this.writing("to_tray_high", StrUtil.isBlank(tray_high) ? "0" : tray_high ); + this.writing("to_crib_category", StrUtil.isBlank(crib_category) ? "0" : crib_category ); + this.writing("to_palletX1_line", StrUtil.isBlank(palletX1_line) ? "0" : palletX1_line ); + this.writing("to_palletY1_row", StrUtil.isBlank(palletY1_row) ? "0" : palletY1_row ); + this.writing("to_palletA1_angle", StrUtil.isBlank(palletA1_angle) ? "0" : palletA1_angle ); + this.writing("to_palletX2_line", StrUtil.isBlank(palletX2_line) ? "0" : palletX2_line ); + this.writing("to_palletY2_row", StrUtil.isBlank(palletY2_row) ? "0" : palletY2_row ); + this.writing("to_palletA2_angle", StrUtil.isBlank(palletA2_angle) ? "0" : palletA2_angle ); + this.writing("to_palletX3_line", StrUtil.isBlank(palletX3_line) ? "0" : palletX3_line ); + this.writing("to_palletY3_row", StrUtil.isBlank(palletY3_row) ? "0" : palletY3_row ); + this.writing("to_palletA3_angle", StrUtil.isBlank(palletA3_angle) ? "0" : palletA3_angle ); + this.writing("to_pressCribX1_line", StrUtil.isBlank(pressCribX1_line) ? "0" : pressCribX1_line ); + this.writing("to_pressCribY1_row", StrUtil.isBlank(pressCribY1_row) ? "0" : pressCribY1_row ); + this.writing("to_pressCribA1_angle", StrUtil.isBlank(pressCribA1_angle) ? "0" : pressCribA1_angle ); + this.writing("to_pressCribX2_line", StrUtil.isBlank(pressCribX2_line) ? "0" : pressCribX2_line ); + this.writing("to_pressCribY2_row", StrUtil.isBlank(pressCribY2_row) ? "0" : pressCribY2_row ); + this.writing("to_pressCribA2_angle", StrUtil.isBlank(pressCribA2_angle) ? "0" : pressCribA2_angle ); + this.writing("to_pressCribX3_line", StrUtil.isBlank(pressCribX3_line) ? "0" : pressCribX3_line ); + this.writing("to_pressCribY3_row", StrUtil.isBlank(pressCribY3_row) ? "0" : pressCribY3_row ); + this.writing("to_pressCribA3_angle", StrUtil.isBlank(pressCribA3_angle) ? "0" : pressCribA3_angle ); + this.writing("to_Zoffset", StrUtil.isBlank(Zoffset) ? "0" : Zoffset ); + this.writing("to_pallet_layerQty", StrUtil.isBlank(pallet_layerQty) ? "0" : pallet_layerQty ); + this.writing("to_pressCrib_layerQty", StrUtil.isBlank(pressCrib_layerQty) ? "0" : pressCrib_layerQty ); + this.writing("to_codeLayerX1_interval", StrUtil.isBlank(codeLayerX1_interval) ? "0" : codeLayerX1_interval ); + this.writing("to_codeLayerY1_interval", StrUtil.isBlank(codeLayerY1_interval) ? "0" : codeLayerY1_interval ); + this.writing("to_codeLayerX2_interval", StrUtil.isBlank(codeLayerX2_interval) ? "0" : codeLayerX2_interval ); + this.writing("to_codeLayerY2_interval", StrUtil.isBlank(codeLayerY2_interval) ? "0" : codeLayerY2_interval ); + this.writing("to_codeLayerX3_interval", StrUtil.isBlank(codeLayerX3_interval) ? "0" : codeLayerX3_interval ); + this.writing("to_codeLayerY3_interval", StrUtil.isBlank(codeLayerY3_interval) ? "0" : codeLayerY3_interval ); + this.writing("to_codeLayerX1_offset", StrUtil.isBlank(codeLayerX1_offset) ? "0" : codeLayerX1_offset ); + this.writing("to_codeLayerY1_offset", StrUtil.isBlank(codeLayerY1_offset) ? "0" : codeLayerY1_offset ); + this.writing("to_codeLayerX2_offset", StrUtil.isBlank(codeLayerX2_offset) ? "0" : codeLayerX2_offset ); + this.writing("to_codeLayerY2_offset", StrUtil.isBlank(codeLayerY2_offset) ? "0" : codeLayerY2_offset ); + this.writing("to_codeLayerX3_offset", StrUtil.isBlank(codeLayerX3_offset) ? "0" : codeLayerX3_offset ); + this.writing("to_codeLayerY3_offset", StrUtil.isBlank(codeLayerY3_offset) ? "0" : codeLayerY3_offset ); + this.writing("to_pressLayerX1_interval", StrUtil.isBlank(pressLayerX1_interval) ? "0" : pressLayerX1_interval ); + this.writing("to_pressLayerY1_interval", StrUtil.isBlank(pressLayerY1_interval) ? "0" : pressLayerY1_interval ); + this.writing("to_pressLayerX2_interval", StrUtil.isBlank(pressLayerX2_interval) ? "0" : pressLayerX2_interval ); + this.writing("to_pressLayerY2_interval", StrUtil.isBlank(pressLayerY2_interval) ? "0" : pressLayerY2_interval ); + this.writing("to_pressLayerX3_interval", StrUtil.isBlank(pressLayerX3_interval) ? "0" : pressLayerX3_interval ); + this.writing("to_pressLayerY3_interval", StrUtil.isBlank(pressLayerY3_interval) ? "0" : pressLayerY3_interval ); + this.writing("to_pressLayerX1_offset", StrUtil.isBlank(pressLayerX1_offset) ? "0" : pressLayerX1_offset ); + this.writing("to_pressLayerY1_offset", StrUtil.isBlank(pressLayerY1_offset) ? "0" : pressLayerY1_offset ); + this.writing("to_pressLayerX2_offset", StrUtil.isBlank(pressLayerX2_offset) ? "0" : pressLayerX2_offset ); + this.writing("to_pressLayerY2_offset", StrUtil.isBlank(pressLayerY2_offset) ? "0" : pressLayerY2_offset ); + this.writing("to_pressLayerX3_offset", StrUtil.isBlank(pressLayerX3_offset) ? "0" : pressLayerX3_offset ); + this.writing("to_pressLayerY3_offset", StrUtil.isBlank(pressLayerY3_offset) ? "0" : pressLayerY3_offset ); + this.writing("to_one_cribTotal", StrUtil.isBlank(one_cribTotal) ? "0" : one_cribTotal ); + this.writing("to_two_cribTotal", StrUtil.isBlank(two_cribTotal) ? "0" : two_cribTotal ); + this.writing("to_one_qty", StrUtil.isBlank(one_qty) ? "0" : one_qty ); + this.writing("to_two_qty", StrUtil.isBlank(two_qty) ? "0" : two_qty ); + this.writing("to_tool_coordinate", StrUtil.isBlank(tool_coordinate) ? "0" : tool_coordinate ); + + Thread.sleep(1000); + this.writing(this.mode); + this.setRequireSucess(true); + } + } + result.close(); + return true; + } + } + + /** + * 申请入库 + * + * @param + */ + public synchronized boolean putStorage() { + Date date = new Date(); + if (date.getTime() - this.instruction_require_time.getTime() < (long) this.instruction_require_time_out) { + log.trace("触发时间因为小于{}毫秒,而被无视", this.instruction_require_time_out); + return false; + } else { + this.instruction_require_time = date; + JSONObject json = new JSONObject(); + json.put("device_code",this.device_code); + json.put("type","1"); + json.put("material_code",material); +// json.put("vehicle_code",barcode); + json.put("qty",encoder_qty); + json.put("unqualified_qty",unqualified_qty); + json.put("is_full","1"); + logServer.deviceExecuteLog(device_code, "", "", "申请入库请求参数:" + json); + HttpResponse result = acsToWmsService.lnshApplyTaskToWms(json); + logServer.deviceExecuteLog(device_code, "", "", "申请入库返回参数:" + result); + if (ObjectUtil.isNotEmpty(result)) { + JSONObject jsonObject = JSONObject.parseObject(result.body()); + if (result.getStatus() == 200 && StrUtil.equals(jsonObject.getString("status"),"200")) { + this.writing(this.mode); + this.setRequireSucess(true); + } + } + return true; + } + } + + + + + public boolean exe_error() { + if (this.error == 0) { + return true; + } else { + log.debug("设备报警"); + return false; + } + } + + public boolean exe_business() { + return true; + } + + protected void executing(Instruction instruction) { + this.executing(1, instruction, ""); + } + + public void executing(int command, Instruction instruction, String appendMessage) { + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + ItemProtocol.item_to_command; + String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + ItemProtocol.item_to_target; + String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + ItemProtocol.item_to_task; + if (appendMessage == null) { + appendMessage = ""; + } + if (instruction != null) { + instruction_num = Integer.parseInt(instruction.getInstruction_code()); + } + + Map itemMap = new HashMap(); + itemMap.put(to_command, 1); + itemMap.put(to_task, instruction_num); + this.control(itemMap); + + } + + public void executing(Server server, Map itemMap) { + this.control(itemMap); + } + + public void writing(int type, int command) { + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + ItemProtocol.item_to_command; + String to_target = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + ItemProtocol.item_to_target; + String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + ItemProtocol.item_to_task; + + Map itemMap = new HashMap(); + if (type == 1) { + itemMap.put(to_command, command); + logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command); + } else if (type == 2) { + itemMap.put(to_target, command); + logServer.deviceExecuteLog(this.device_code, "", "", to_target + " 写入 " + command); + } else if (type == 3) { + itemMap.put(to_task, command); + logServer.deviceExecuteLog(this.device_code, "", "", to_task + " 写入 " + command); + } + this.control(itemMap); + + } + + 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, value); + this.control(itemMap); + logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value); + } + + public void writing(int command) { + String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + + "." + ItemProtocol.item_to_command; + + Map itemMap = new HashMap(); + itemMap.put(to_command, command); + this.control(itemMap); + logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command); + } + + public synchronized void OpenOrClose(String type) { + + //进入区域 + if ("1".equals(type)) { + writing(5); + } else { + //离开区域 + writing(6); + } + } + + public String toString() { + return ""; + } + + @Override + public JSONObject getDeviceStatusName() { + JSONObject jo = new JSONObject(); + String mode = ""; + String action = ""; + String io_action = ""; + String move = ""; + String status = ""; + if (this.getMode() == 0) { + mode = "未联机"; + } else if (this.getMode() == 1) { + mode = "单机"; + } else if (this.getMode() == 2) { + mode = "联机"; + } else if (this.getMode() == 4) { + mode = "叫料"; + } else if (this.getMode() == 5) { + mode = "获取托盘信息"; + } else if (this.getMode() == 6) { + mode = "码垛完成"; + } else if (this.getMode() == 7) { + mode = "强制半托缓存"; + } else if (this.getMode() == 8) { + mode = "补空托"; + } else if (this.getMode() ==11) { + mode = "强制去包装"; + } + + if (this.getAction() == 0) { + action = "禁止取放"; + } else if (this.getAction() == 1) { + action = "允许取货"; + } else if (this.getAction() == 2) { + action = "允许放货"; + } else if (this.getAction() == 3) { + action = "允许取放"; + } + if (this.getIo_action() == 0) { + io_action = "禁止进出"; + } else if (this.getIo_action() == 1) { + io_action = "允许进入"; + } else if (this.getIo_action() == 2) { + io_action = "允许离开"; + } else if (this.getIo_action() == 3) { + io_action = "允许进出"; + } + + if (this.getStatus() == 1) { + status = "待机"; + } else if (this.getStatus() == 2) { + status = "生产中"; + } else if (this.getStatus() == 3) { + status = "故障"; + } + + if (this.getMove() == 0) { + move = "无货"; + } else if (this.getMove() == 1) { + move = "有货"; + } else if (this.getMove() == 2) { + move = "有托盘有货"; + } + jo.put("device_name", this.getDevice().getDevice_name()); + jo.put("mode", mode); + jo.put("move", move); + jo.put("action", action); + jo.put("status", status); + jo.put("io_action", io_action); + jo.put("hasGoods", this.getHasGoods()); + jo.put("isOnline", this.getIsonline()); + if (this.getIserror()) { + jo.put("error", "设备有故障"); + } + jo.put("hasGoods", this.getHasGoods()); + jo.put("isError", this.getIserror()); + jo.put("message", this.getMessage()); + jo.put("task", this.getTask()); + jo.put("weight", this.getWeight()); + jo.put("material", this.getMaterial()); + jo.put("barcode", this.getBarcode()); + jo.put("specifications", this.getSpecifications()); + jo.put("AlongSide", this.getAlongSide()); + jo.put("BshortSide", this.getBshortSide()); + jo.put("Htrapezoidal", this.getHtrapezoidal()); + jo.put("Wthickness", this.getWthickness()); + jo.put("batch", this.getBatch()); + jo.put("order_No", this.getOrder_No()); + jo.put("order_qty", this.getOrder_qty()); + return jo; + } + + @Override + public void setDeviceStatus(JSONObject data) { + + } +} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java index ebffb03..031759a 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/LnshPalletizingManipulatorDeviceDriver.java @@ -62,6 +62,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri int action; int io_action; int task = 0; + int to_command = 0; int last_mode = 0; int last_error = 0; int last_move = 0; @@ -167,7 +168,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri encoder_qty = this.itemProtocol.getEncoder_qty(); status = this.itemProtocol.getStatus(); unqualified_qty = this.itemProtocol.getUnqualified_qty(); - + to_command = this.itemProtocol.getToCommand(); if (mode != last_mode) { this.setRequireSucess(false); logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java index 75fd74f..4068638 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/LnshPalletizingManipulatorSiteDeviceDriver.java @@ -117,7 +117,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic int last_Wthickness = 0; int batch = 0; int last_batch = 0; - + int to_command =0; int status = 0; int last_status = 0; @@ -164,6 +164,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic encoder_qty = this.itemProtocol.getEncoder_qty(); status = this.itemProtocol.getStatus(); unqualified_qty = this.itemProtocol.getUnqualified_qty(); + to_command = this.itemProtocol.getToCommand(); if (mode != last_mode) { this.setRequireSucess(false); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java index 25741ad..83d7d59 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/LnshStationDeviceDriver.java @@ -113,6 +113,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements int container_type =0; int batch = 0; int last_batch = 0; + int to_command =0; @Override public Device getDevice() { @@ -139,6 +140,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements batch = this.itemProtocol.getBatch(); specifications = this.itemProtocol.getSpecifications(); container_type = itemProtocol.getContainer_type(); + to_command = this.itemProtocol.getToCommand(); if (mode != last_mode) { this.setRequireSucess(false); if (last_mode == 11) { diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java index 4098074..c356804 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/RljnPackagePalletSplitManipulatorDeviceDriver.java @@ -353,6 +353,9 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe if (mode != last_mode) { this.setRequireSucess(false); this.setResultSucess(false); + if(mode ==2 ){ + this.writing(0); + } logServer.deviceItemValue(this.device_code,"mode" ,String.valueOf(mode)); logServer.deviceExecuteLog(this.device_code,"","","信号mode:" + last_mode + "->" + mode); } @@ -707,7 +710,6 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe log.debug("设备运转模式:等待工作"); return; case 2: - this.writing(0); break; case 4: //排产单确认 diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java index fbe9e13..1a8e6dc 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java @@ -22,6 +22,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC String message; int maxResartNum; private Server server; + private Group group; boolean flag = false; private int all_null; private Map itemSearchCache; @@ -52,12 +53,12 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC private OpcItemDto getItem(String item) { - OpcItemDto x = (OpcItemDto)this.itemSearchCache.get(item); + OpcItemDto x = (OpcItemDto) this.itemSearchCache.get(item); if (x == null) { Iterator var3 = this.protocols.iterator(); - while(var3.hasNext()) { - OpcItemDto dto = (OpcItemDto)var3.next(); + while (var3.hasNext()) { + OpcItemDto dto = (OpcItemDto) var3.next(); if (StrUtil.equals(item, dto.getItem_code())) { x = dto; this.itemSearchCache.put(item, dto); @@ -80,18 +81,28 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC } - private void runOld() { - while(true) { + while (true) { + start: try { + if (this.group != null) { + group.clear(); + group.remove(); + log.trace("{} 清理group{}"); + } + if (this.server != null) { + server.disconnect(); + log.trace("{} server{}"); + } + this.server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain()); this.server.addStateListener(this); - Group group = this.server.addGroup(); + group = this.server.addGroup(); List itemsString = new ArrayList(); Iterator var3 = this.protocols.iterator(); - while(var3.hasNext()) { - OpcItemDto protocol = (OpcItemDto)var3.next(); + while (var3.hasNext()) { + OpcItemDto protocol = (OpcItemDto) var3.next(); String item = protocol.getItem_code(); itemsString.add(item); } @@ -101,8 +112,8 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC StringBuilder err_message = new StringBuilder(); Iterator var6 = itemsString.iterator(); - while(var6.hasNext()) { - String string = (String)var6.next(); + while (var6.hasNext()) { + String string = (String) var6.next(); try { Item item = group.addItem(string); @@ -137,13 +148,13 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC UnifiedDataAccessor accessor_value = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key); boolean time_out = false; - while(DeviceOpcSynchronizeAutoRun.isRun) { + while (DeviceOpcSynchronizeAutoRun.isRun) { long begin = System.currentTimeMillis(); if (log.isTraceEnabled()) { log.trace("{} 开始记时{}", tag, DateUtil.now()); } - Map itemStatus = group.read(true, (Item[])itemsMap.values().toArray(new Item[0])); + Map itemStatus = group.read(true, (Item[]) itemsMap.values().toArray(new Item[0])); long end = System.currentTimeMillis(); long duration = end - begin; if (log.isTraceEnabled()) { @@ -164,9 +175,9 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC Set items = itemStatus.keySet(); Iterator var18 = items.iterator(); - while(var18.hasNext()) { - Item item = (Item)var18.next(); - ItemState itemState = (ItemState)itemStatus.get(item); + while (var18.hasNext()) { + Item item = (Item) var18.next(); + ItemState itemState = (ItemState) itemStatus.get(item); Object value = OpcUtl.getValue(item, itemState); if (value != null) { valueAllNotNull = true; @@ -194,7 +205,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC log.trace("{} 计算完成耗时{}", tag, end - begin); } - ThreadUtl.sleep((long)OpcConfig.synchronized_millisecond); + ThreadUtl.sleep((long) OpcConfig.synchronized_millisecond); if (this.error_num != 0) { this.error_num = 0; this.message = null; @@ -204,35 +215,27 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC int random = (new Random()).nextInt(10) + 1; random *= 1000; if (this.all_null < 3) { - if (log.isWarnEnabled()) { - log.warn("{} 所有内容都为空,暂定{}s", tag, 5000 + random); - } - - ThreadUtl.sleep((long)(5000 + random)); + log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null,5000 + random); + ThreadUtl.sleep((long) (5000 + random)); } else if (this.all_null < 6) { - if (log.isWarnEnabled()) { - log.warn("{} 所有内容都为空,暂定{}s", tag, 30000 + random); - } - - ThreadUtl.sleep((long)(30000 + random)); + log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null,30000 + random); + ThreadUtl.sleep((long) (1000 + random)); + log.warn("重新创建server"); + break start; } else if (this.all_null < 12) { - if (log.isWarnEnabled()) { - log.warn("{} 所有内容都为空,暂定{}ms", tag, '\uea60' + random); - } - - ThreadUtl.sleep((long)('\uea60' + random)); + log.warn("{} 所有内容都为空, all_null:{} ,暂定{}ms", tag, all_null, '\uea60' + random); + ThreadUtl.sleep((long) ('\uea60' + random)); } else { - if (log.isWarnEnabled()) { - log.warn("{} 所有内容都为空,暂定{}ms", tag, 120000 + random); - } - - ThreadUtl.sleep((long)(120000 + random)); + log.warn("{} 所有内容都为空, all_null:{} ,暂定{}ms", tag, all_null, 120000 + random); + ThreadUtl.sleep((long) (120000 + random)); } ++this.all_null; } else { this.all_null = 0; } +// break start; + } log.warn("opc线程停止。。。"); @@ -256,17 +259,16 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC log.warn(error_message, var27); } - ThreadUtl.sleep((long)(OpcConfig.synchronized_exception_wait_second * 1000)); + ThreadUtl.sleep((long) (OpcConfig.synchronized_exception_wait_second * 1000)); ++this.error_num; if (this.error_num > 3 && !StrUtil.equals(this.message, error_message)) { - this.message = error_message; + this.message = error_message; } } } } - private void runNew() { Async20Access accessor = null; @@ -363,19 +365,10 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC UnifiedDataAccessor accessor_value = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key); accessor_value.setValue(itemId, value); -// if (value != null) { -// if (log.isTraceEnabled()) { -// log.trace("Item {} new value: {}, Timestamp: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime()}); -// } -// } else if (log.isInfoEnabled()) { -// log.info("Item {} new value: {}, Timestamp: {}, Quality: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime(), itemState.getQuality()}); -// } log.trace("Item {} new value: {}, Timestamp: {}", new Object[]{itemId, itemState.getValue(), itemState.getTimestamp().getTime()}); OpcItemDto itemDto = this.getItem(itemId); -// if (Boolean.TRUE.equals(itemDto.getNeed_log())) { -// this.logItemChanged(itemId, accessor_value, value, itemDto); -// } + this.logItemChanged(itemId, accessor_value, value, itemDto); } catch (Exception var7) { @@ -396,11 +389,14 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC Object obj = accessor_value.getValue(relate); sb.append("key:" + relate + "value:" + obj + ";"); } - log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(),itemId, his, value, sb}); -// this.businessLogger.setResource(itemDto.getDevice_code(), itemDto.getDevice_name()).log("信号{}变更从{}->{};信号快照:{}", new Object[]{itemId, his, value, sb}); + if(!itemId.endsWith("heartbeat") || !itemId.endsWith("time") ) { + log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value, sb}); + } + } else { - log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(),itemId, his, value}); -// this.businessLogger.setResource(itemDto.getDevice_code(), itemDto.getDevice_name()).log("信号{}变更从{}->{}", new Object[]{itemId, his, value}); + if(!itemId.endsWith("heartbeat") || !itemId.endsWith("time") ) { + log.warn("设备:{}信号{}变更从{}->{};信号快照:{}", new Object[]{itemDto.getDevice_code(), itemId, his, value}); + } } } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/OpcServerService.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/OpcServerService.java index 3e1f7a3..8d6a340 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/OpcServerService.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/OpcServerService.java @@ -13,7 +13,7 @@ public interface OpcServerService { void reload(); - Group getServer(String var1); + Group getServer(String var1) throws Exception; void writeInteger(String var1, ItemValue... var2); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/OpcServerServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/OpcServerServiceImpl.java index 8c24406..4f234ba 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/OpcServerServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/OpcServerServiceImpl.java @@ -1,5 +1,6 @@ package org.nl.acs.opc; +import cn.hutool.core.util.StrUtil; import org.jinterop.dcom.common.JIException; import org.nl.acs.device_driver.driver.ItemValue; import org.nl.exception.WDKException; @@ -65,79 +66,86 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn this.opcServerManageDtos = Collections.synchronizedMap(this.opcServerManageDtos); } - public synchronized Group getServer(String code) { - Group group = null; - group = (Group) this.groups.get(code); - if (group != null) { - try { - if (group.isActive()) { - return group; + public synchronized Group getServer(String code) throws Exception { + synchronized(this.buildLock(code)) { + Group group = null; + group = (Group)this.groups.get(code); + if (group != null) { + label68: { + Group var10000; + try { + if (!group.isActive()) { + break label68; + } + + var10000 = group; + } catch (JIException var14) { + log.error(code, var14); + break label68; + } + + return var10000; } - } catch (JIException var9) { - var9.printStackTrace(); } - } - Server server = (Server) this.servers.get(code); - boolean needcreate = false; - if (server == null) { - needcreate = true; - } else { - try { - group = server.findGroup(OpcConfig.opc_server_default_group); - } catch (UnknownHostException - | JIException - | UnknownGroupException - | NotConnectedException - | IllegalArgumentException var8) { - var8.printStackTrace(); + Server server = (Server)this.servers.get(code); + boolean needcreate = false; + String groupName = code; + if (server == null) { needcreate = true; + } else { + try { + group = server.findGroup(groupName); + } catch (UnknownHostException | JIException | UnknownGroupException | NotConnectedException | IllegalArgumentException var13) { + log.error(code, var13); + needcreate = true; + } } + + if (needcreate) { + OpcServerManageDto dto = (OpcServerManageDto)this.opcServerManageDtos.get(code); + if (dto == null) { + throw new Exception(code + "{} 不存在"); + } + + if (server == null) { + server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); + } + + try { + group = server.addGroup(groupName); + } catch (Exception var12) { + this.clearServer(code); + ThreadUtl.sleep(5000L); + log.warn("获取opc出错重新获取", code, var12); + server = OpcServerUtl.getServerWithOutException(dto.getOpc_host(), StrUtil.trim(dto.getCls_id()), dto.getUser(), dto.getPassword(), StrUtil.trim(dto.getDomain())); + + try { + group = server.addGroup(groupName); + } catch (Exception var11) { + throw new Exception(var12); + } + } + + this.servers.put(code, server); + this.groups.put(code, group); + } + + return group; } - - if (needcreate) { - OpcServerManageDto dto = (OpcServerManageDto) this.opcServerManageDtos.get(code); - if (dto == null) { - throw new WDKException("code 不存在"); - } - - server = OpcServerUtl.getServerWithOutException( - dto.getOpc_host(), - dto.getCls_id(), - dto.getUser(), - dto.getPassword(), - dto.getDomain()); - -// server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain()); - - - try { - group = server.addGroup(OpcConfig.opc_server_default_group); - } catch (Exception var7) { - throw new WDKException(var7); - } - - this.servers.put(code, server); - this.groups.put(code, group); - } - - return group; } - public synchronized void clearServer(String code) { - try { - Server server = (Server) this.servers.get(code); - if (server!=null){ + public void clearServer(String code) { + synchronized(this.buildLock(code)) { + try { + Server server = (Server)this.servers.get(code); server.disconnect(); + } catch (Exception var5) { } - } catch (Exception e) { - e.printStackTrace(); - log.error("清理server异常,",e.getMessage()); + this.servers.remove(code); + this.groups.remove(code); } - - this.servers.remove(code); - this.groups.remove(code); } public void writeInteger(String code, ItemValue... values) { @@ -148,7 +156,17 @@ public class OpcServerServiceImpl implements OpcServerService, ApplicationAutoIn this.clearServer(code); log.warn("写入出错opc server {} 重新加载", code, var4); ThreadUtl.sleep(5000L); - throw var4; } } + + private String buildLock(String key) { + if (StrUtil.isEmpty(key)) { + key = ""; + } + StringBuilder builder = new StringBuilder(); + builder.append("OpcServerService."); + builder.append(key); + String lock = builder.toString().intern(); + return lock; + } } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java b/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java index a645ec7..7a0b6df 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/start/auto/run/NDCSocketConnectionAutoRun.java @@ -163,15 +163,12 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { } logServer.deviceExecuteLog("ndc", "","","接收agv上报设备:" + device_code); StandardInspectSiteDeviceDriver standardInspectSiteDeviceDriver; - StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; - StandardCoveyorControlDeviceDriver standardCoveyorControlDeviceDriver; - StandardStorageDeviceDriver standardStorageDeviceDriver; StandardAutodoorDeviceDriver standardAutodoorDeviceDriver; - StandardEmptyPalletSiteDeviceDriver standardEmptyPalletSiteDeviceDriver; LnshStationDeviceDriver lnshStationDeviceDriver; LnshLaminatingMachineDeviceDriver lnshLaminatingMachineDeviceDriver; LnshPalletizingManipulatorSiteDeviceDriver lnshPalletizingManipulatorSiteDeviceDriver; LnshPalletizingManipulatorDeviceDriver lnshPalletizingManipulatorDeviceDriver; + StandardOrdinarySiteDeviceDriver standardOrdinarySiteDeviceDriver; int type = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.BUSINESSTYPE)); try { @@ -241,9 +238,18 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { && (lnshStationDeviceDriver.getIo_action() == 3 || lnshStationDeviceDriver.getIo_action() == 1)) { inst.setExecute_status("1"); instructionService.update(inst); - lnshStationDeviceDriver.writing(5); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; + try { + lnshStationDeviceDriver.writing(5); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); + e.printStackTrace(); + } + if(lnshStationDeviceDriver.getTo_command() == 5 ){ + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","","AGV请求取货下发命令不等于5,无法反馈"); + } } else { logServer.deviceExecuteLog("ndc","","","AGV请求取货设备{}无货,无法反馈"); } @@ -255,9 +261,19 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { && (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 1)) { inst.setExecute_status("1"); instructionService.update(inst); - lnshPalletizingManipulatorSiteDeviceDriver.writing(12); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; + try { + lnshPalletizingManipulatorSiteDeviceDriver.writing(12); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); + e.printStackTrace(); + } + if(lnshPalletizingManipulatorSiteDeviceDriver.getTo_command() == 12 ){ + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","","AGV请求取货下发命令不等于12,无法反馈"); + } + } else { logServer.deviceExecuteLog("ndc","","","AGV请求取货设备{}无货,无法反馈"); } @@ -269,9 +285,18 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { && (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorDeviceDriver.getIo_action() == 1)) { inst.setExecute_status("1"); instructionService.update(inst); - lnshPalletizingManipulatorDeviceDriver.writing(12); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; + try { + lnshPalletizingManipulatorDeviceDriver.writing(12); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); + e.printStackTrace(); + } + if(lnshPalletizingManipulatorDeviceDriver.getTo_command() == 12 ){ + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","","AGV请求取货下发命令不等于12,无法反馈"); + } } else { logServer.deviceExecuteLog("ndc","","","AGV请求取货设备{}无货,无法反馈"); } @@ -338,11 +363,16 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (device.getDeviceDriver() instanceof LnshStationDeviceDriver) { lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver(); if (lnshStationDeviceDriver.getMove() == 0 && (lnshStationDeviceDriver.getIo_action() == 3 || lnshStationDeviceDriver.getIo_action() == 2)) { - inst.setExecute_status("5"); - instructionService.update(inst); lnshStationDeviceDriver.writing(2); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; + if(lnshStationDeviceDriver.getTo_command() == 2 ){ + inst.setExecute_status("5"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备下发命令不等于2,无法反馈"); + } + } else { logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备{}有货,无法反馈"); } @@ -351,11 +381,23 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (device.getDeviceDriver() instanceof LnshPalletizingManipulatorSiteDeviceDriver) { lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) device.getDeviceDriver(); if (lnshPalletizingManipulatorSiteDeviceDriver.getMove() == 0 && (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 2)) { - inst.setExecute_status("5"); - instructionService.update(inst); - lnshPalletizingManipulatorSiteDeviceDriver.writing(10); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; + + try { + lnshPalletizingManipulatorSiteDeviceDriver.writing(10); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); + e.printStackTrace(); + } + + if(lnshPalletizingManipulatorSiteDeviceDriver.getTo_command() == 10 ){ + inst.setExecute_status("5"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备下发命令不等于10,无法反馈"); + } + } else { logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备{}有货,无法反馈"); } @@ -367,28 +409,27 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (lnshPalletizingManipulatorDeviceDriver.getMove() == 0 && (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorDeviceDriver.getIo_action() == 2)) { inst.setExecute_status("5"); instructionService.update(inst); - lnshPalletizingManipulatorDeviceDriver.writing(10); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; + try { + lnshPalletizingManipulatorDeviceDriver.writing(10); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); + e.printStackTrace(); + } + + if(lnshPalletizingManipulatorDeviceDriver.getTo_command() == 10 ){ + inst.setExecute_status("5"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备下发命令不等于10,无法反馈"); + } + } else { logServer.deviceExecuteLog("ndc","","","AGV取货完成请求离开设备{}有货,无法反馈"); } } -// if(!inst.getTask_code().startsWith("-")) { -// //反馈wms系统动作完成 -// inst.setFinish_type("1"); -// instructionService.update(inst); -// JSONObject feedjo = new JSONObject(); -// feedjo.put("status","1"); -// feedjo.put("device_code",device_code); -// feedjo.put("vehicle_code",inst.getVehicle_code()); -// feedjo.put("task_code",inst.getTask_code()); -// JSONArray feedja = JSONArray.parseArray(String.valueOf(feedjo)); -// acsToWmsService.feedbackActionStatusToWms(feedja); -// } - - } // 到达扫码点 else if (phase == 0x06) { @@ -404,12 +445,31 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { if (lnshLaminatingMachineDeviceDriver.getMode() != 0 && lnshLaminatingMachineDeviceDriver.getMode() != 6) { inst.setExecute_status("9"); instructionService.update(inst); - lnshLaminatingMachineDeviceDriver.writing("to_task", inst.getInstruction_code()); - lnshLaminatingMachineDeviceDriver.writing(1); + try { + lnshLaminatingMachineDeviceDriver.writing("to_task", inst.getInstruction_code()); + lnshLaminatingMachineDeviceDriver.writing(1); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); + e.printStackTrace(); + } + } //如果组盘绑定条码成功,就允许agv离开 if (lnshLaminatingMachineDeviceDriver.getMode() == 6 && lnshLaminatingMachineDeviceDriver.getResult()) { - lnshLaminatingMachineDeviceDriver.writing(6); + try { + lnshLaminatingMachineDeviceDriver.writing(6); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); + e.printStackTrace(); + } +// if(lnshLaminatingMachineDeviceDriver.getTo_command() == 6 ){ +// inst.setExecute_status("5"); +// instructionService.update(inst); +// data = AgvService.sendAgvOneModeInst(phase, index, 0); +// flag = true; +// } else { +// logServer.deviceExecuteLog("ndc","","","组盘绑定条码成功发命令不等于6,无法反馈"); +// } data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } @@ -458,10 +518,23 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver(); if (lnshStationDeviceDriver.getMode() != 0 && lnshStationDeviceDriver.getMove() == 0 && (lnshStationDeviceDriver.getIo_action() == 3 || lnshStationDeviceDriver.getIo_action() == 1)) { - inst.setExecute_status("3"); - instructionService.update(inst); - lnshStationDeviceDriver.writing(6); - lnshStationDeviceDriver.writing("to_task",inst.getInstruction_code()); + + try { + lnshStationDeviceDriver.writing(6); + lnshStationDeviceDriver.writing("to_task",inst.getInstruction_code()); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); + e.printStackTrace(); + } + if(lnshStationDeviceDriver.getTo_command() == 6 ){ + inst.setExecute_status("3"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","","AGV请求放货设备下发命令不等于6,无法反馈"); + } + data = AgvService.sendAgvOneModeInst(phase, index, 0); flag = true; } else { @@ -473,11 +546,20 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) device.getDeviceDriver(); if (lnshPalletizingManipulatorSiteDeviceDriver.getMode() != 0 && lnshPalletizingManipulatorSiteDeviceDriver.getMove() == 0 && (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 1)) { - inst.setExecute_status("3"); - instructionService.update(inst); - lnshPalletizingManipulatorSiteDeviceDriver.writing(13); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; + try { + lnshPalletizingManipulatorSiteDeviceDriver.writing(13); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); + e.printStackTrace(); + } + if(lnshPalletizingManipulatorSiteDeviceDriver.getTo_command() == 13 ){ + inst.setExecute_status("3"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","","AGV请求放货设备下发命令不等于13,无法反馈"); + } } else { logServer.deviceExecuteLog("ndc","","","AGV请求放货设备{}有货,无法反馈"); } @@ -487,11 +569,20 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver(); if (lnshPalletizingManipulatorDeviceDriver.getMode() != 0 && lnshPalletizingManipulatorDeviceDriver.getMove() == 0 && (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorDeviceDriver.getIo_action() == 1)) { - inst.setExecute_status("3"); - instructionService.update(inst); - lnshPalletizingManipulatorDeviceDriver.writing(13); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; + try { + lnshPalletizingManipulatorDeviceDriver.writing(13); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); + e.printStackTrace(); + } + if(lnshPalletizingManipulatorDeviceDriver.getTo_command() == 13 ){ + inst.setExecute_status("3"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","","AGV请求放货设备下发命令不等于13,无法反馈"); + } } else { logServer.deviceExecuteLog("ndc","","","AGV请求放货设备{}有货,无法反馈"); } @@ -540,11 +631,21 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { lnshStationDeviceDriver = (LnshStationDeviceDriver) device.getDeviceDriver(); if (lnshStationDeviceDriver.getMove() == 1 && (lnshStationDeviceDriver.getIo_action() == 3 || lnshStationDeviceDriver.getIo_action() == 2)) { - inst.setExecute_status("6"); - instructionService.update(inst); - lnshStationDeviceDriver.writing(3); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; + + try { + lnshStationDeviceDriver.writing(3); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); + e.printStackTrace(); + } + if(lnshStationDeviceDriver.getTo_command() == 3 ){ + inst.setExecute_status("6"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开下发命令不等于3,无法反馈"); + } } else { logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开设备{}无货,无法反馈"); } @@ -555,11 +656,21 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { lnshPalletizingManipulatorSiteDeviceDriver = (LnshPalletizingManipulatorSiteDeviceDriver) device.getDeviceDriver(); if (lnshPalletizingManipulatorSiteDeviceDriver.getMove() == 1 && (lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorSiteDeviceDriver.getIo_action() == 2)) { - inst.setExecute_status("6"); - instructionService.update(inst); - lnshPalletizingManipulatorSiteDeviceDriver.writing(11); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; + try { + lnshPalletizingManipulatorSiteDeviceDriver.writing(11); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); + e.printStackTrace(); + } + if(lnshPalletizingManipulatorSiteDeviceDriver.getTo_command() == 11 ){ + inst.setExecute_status("6"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开下发命令不等于11,无法反馈"); + } + } else { logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开设备{}无货,无法反馈"); } @@ -570,11 +681,20 @@ public class NDCSocketConnectionAutoRun extends AbstractAutoRunnable { lnshPalletizingManipulatorDeviceDriver = (LnshPalletizingManipulatorDeviceDriver) device.getDeviceDriver(); if (lnshPalletizingManipulatorDeviceDriver.getMove() == 1 && (lnshPalletizingManipulatorDeviceDriver.getIo_action() == 3 || lnshPalletizingManipulatorDeviceDriver.getIo_action() == 2)) { - inst.setExecute_status("6"); - instructionService.update(inst); - lnshPalletizingManipulatorDeviceDriver.writing(11); - data = AgvService.sendAgvOneModeInst(phase, index, 0); - flag = true; + try { + lnshPalletizingManipulatorDeviceDriver.writing(11); + } catch (Exception e) { + log.info("下发电气信号失败:" + e.getMessage()); + e.printStackTrace(); + } + if(lnshPalletizingManipulatorDeviceDriver.getTo_command() == 11 ){ + inst.setExecute_status("6"); + instructionService.update(inst); + data = AgvService.sendAgvOneModeInst(phase, index, 0); + flag = true; + } else { + logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开下发命令不等于11,无法反馈"); + } } else { logServer.deviceExecuteLog("ndc","","","AGV放货完成请求离开设备{}无货,无法反馈"); } diff --git a/acs/qd/src/views/acs/device/config.vue b/acs/qd/src/views/acs/device/config.vue index 868eebf..532d3cd 100644 --- a/acs/qd/src/views/acs/device/config.vue +++ b/acs/qd/src/views/acs/device/config.vue @@ -115,6 +115,7 @@ import rljn_package_palletSplit_manipulator from '@/views/acs/device/driver/lnsh import standard_rgv from '@/views/acs/device/driver/standard_rgv' import lnsh_palletizing_manipulator_site from '@/views/acs/device/driver/lnsh/lnsh_palletizing_manipulator_site' import lnsh_one_rgv from '@/views/acs/device/driver/lnsh/lnsh_one_rgv' +import lnsh_package_palletizing_manipulator_site from '@/views/acs/device/driver/lnsh/lnsh_package_palletizing_manipulator_site' export default { name: 'DeviceConfig', @@ -126,7 +127,7 @@ export default { standard_photoelectric_inspect_site, ndxy_special, hailiang_labeling, ndxy_special_two, whxr_storage_conveyor, whxr_ball_mill, whxr_spary_tower, whxr_weight, electric_fence, lnsh_palletizing_manipulator, lnsh_kiln_lane, lnsh_package_pallet_manipulator, lnsh_labeling_machine, lnsh_split_manipulator, lnsh_rgv, lnsh_station, lnsh_Laminating_machine, rljn_package_palletSplit_manipulator, standard_rgv, lnsh_palletizing_manipulator_site, - lnsh_one_rgv }, + lnsh_one_rgv, lnsh_package_palletizing_manipulator_site }, dicts: ['device_type'], mixins: [crud], data() { diff --git a/acs/qd/src/views/acs/device/driver/lnsh/lnsh_package_palletizing_manipulator_site.vue b/acs/qd/src/views/acs/device/driver/lnsh/lnsh_package_palletizing_manipulator_site.vue new file mode 100644 index 0000000..0d09d0d --- /dev/null +++ b/acs/qd/src/views/acs/device/driver/lnsh/lnsh_package_palletizing_manipulator_site.vue @@ -0,0 +1,528 @@ + + + + +