From e556fd53af64858c9ff5f6d1f90e665e5c28a08f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E7=8E=AE?= Date: Fri, 31 Mar 2023 17:52:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../driver/AbstractOpcDeviceDriver.java | 93 ++++++++++++ .../device_driver/driver/OpcDeviceDriver.java | 4 + .../LampThreecolorDeviceDriver.java | 5 +- .../LnshLaminatingMachineDeviceDriver.java | 24 ++- .../lnsh/lnsh_kiln_lane/ItemProtocol.java | 2 +- .../LnshKilnLaneDeviceDriver.java | 12 +- .../LnshLabelingMachineDeviceDriver.java | 12 +- .../lnsh/lnsh_one_rgv/ItemProtocol.java | 2 +- .../lnsh_one_rgv/LnshOneRGVDeviceDriver.java | 22 ++- .../ItemProtocol.java | 2 +- ...hPackagePalletManipulatorDeviceDriver.java | 138 +++++++++--------- .../ItemProtocol.java | 2 +- ...nshPalletizingManipulatorDeviceDriver.java | 22 ++- .../ItemProtocol.java | 2 +- ...alletizingManipulatorSiteDeviceDriver.java | 22 ++- .../lnsh/lnsh_rgv/ItemProtocol.java | 2 +- .../lnsh/lnsh_rgv/LnshRGVDeviceDriver.java | 58 +++----- .../lnsh_split_manipulator/ItemProtocol.java | 2 +- .../LnshSplitManipulatorDeviceDriver.java | 24 ++- .../lnsh/lnsh_station/ItemProtocol.java | 2 +- .../lnsh_station/LnshStationDeviceDriver.java | 17 +-- .../ItemProtocol.java | 2 +- ...agePalletSplitManipulatorDeviceDriver.java | 138 +++++++++--------- .../SpecialOrdinarySiteDeviceDriver.java | 8 +- .../StandardAutodoorDeviceDriver.java | 5 +- .../StandardCoveyorControlDeviceDriver.java | 26 ++-- ...eyorControlWithPlcScannerDeviceDriver.java | 31 ++-- ...CoveyorControlWithScannerDeviceDriver.java | 39 +++-- .../StandardCoveyorMonitorDeviceDriver.java | 19 +-- .../StandardEmptyPalletSiteDeviceDriver.java | 11 +- .../StandardInspectSiteDeviceDriver.java | 23 ++- .../StandardOrdinarySiteDeviceDriver.java | 8 +- .../standard_rgv/StandardRGVDeviceDriver.java | 17 +-- .../StandardScannerDeviceDriver.java | 8 +- .../java/org/nl/acs/ext/wms/data/JsonUtl.java | 125 ++++++++++++++++ .../service/impl/StageServiceImpl.java | 4 +- .../resources/config/application-prod.yml | 3 - .../org/nl/wms/common/wql/QSTRUCT_RULE.wql | 6 +- .../wms/pda/sendMaterial/wql/QPADSERVICE.wql | 4 +- .../service/wql/ST_WorkprocedureiosOut_01.wql | 2 +- 40 files changed, 550 insertions(+), 398 deletions(-) create mode 100644 acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/JsonUtl.java 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 60b9c34..e9017f9 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,12 +1,27 @@ package org.nl.acs.device_driver.driver; +import org.nl.acs.ext.wms.data.JsonUtl; import org.nl.acs.opc.OpcConfig; +import org.nl.acs.opc.OpcServerService; +import org.nl.acs.opc.OpcServerServiceImpl; +import org.nl.exception.WDKException; import org.nl.modules.udw.UnifiedDataAccessor; import org.nl.modules.udw.UnifiedDataAccessorFactory; +import org.nl.utils.SpringContextHolder; + +import java.util.Date; +import java.util.Iterator; +import java.util.Map; public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements OpcDeviceDriver { UnifiedDataAccessor opcUdw; + private Date sendTime; + private String last_items; + private int noLog_sendTimeOut; + private Date noLog_sendTime; + private String noLog_last_items; + public AbstractOpcDeviceDriver() { this.opcUdw = UnifiedDataAccessorFactory.getAccessor(OpcConfig.udw_opc_value_key); } @@ -15,4 +30,82 @@ public class AbstractOpcDeviceDriver extends AbstractDeviceDriver implements Opc public UnifiedDataAccessor getOpcValueAccessor() { return this.opcUdw; } + + public boolean control(Map itemValues) { + + Iterator> it = itemValues.entrySet().iterator(); + + ItemValue p2[]; + p2 = new ItemValue[itemValues.size()]; + int i=0; + while (it.hasNext()) { + Map.Entry entry = it.next(); + System.out.println("即将写入值:"+entry.getKey() + ":" + entry.getValue()); + p2[i] = new ItemValue(); + p2[i].setItem_code(entry.getKey()); + p2[i].setItem_value(entry.getValue()); + i++; + } + + return this.control(p2); + } + + + + public boolean control(ItemValue[] itemValues) { + if (itemValues != null && itemValues.length != 0) { + String this_items = JsonUtl.parseWithoutException(itemValues); + boolean need_write = false; + StringBuilder sb = new StringBuilder(); + ItemValue[] var5 = itemValues; + int var6 = itemValues.length; + + for (int var7 = 0; var7 < var6; ++var7) { + ItemValue itemValue = var5[var7]; + String code = itemValue.getItem_code(); + Object udw_value = this.getUdwValue(code); + Object write_value = itemValue.getItem_value(); + sb.append(code); + sb.append(":"); + sb.append(JsonUtl.parseWithoutException(udw_value)); + sb.append(";"); +// if (!need_write && !UnifiedDataAppService.isEquals(udw_value, write_value)) { +// need_write = true; +// } + } + need_write = true; + + if (need_write) { + Date date = new Date(); + /*if (StringUtl.isEqual(this_items, this.last_items) && date.getTime() - this.sendTime.getTime() < (long) WcsConfig.opc_write_repeat_check) { + log.trace("发送时间因为小于{}毫秒,而被无视", WcsConfig.opc_write_repeat_check); + return false; + }*/ + + 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();*/ + + OpcServerService opcServerService = SpringContextHolder.getBean(OpcServerServiceImpl.class); + + opcServerService.writeInteger(this.getOpcServer(), itemValues); + UnifiedDataAccessor opcValueAccessor = this.getOpcValueAccessor(); + ItemValue[] var17 = itemValues; + int var18 = itemValues.length; + + for (int var19 = 0; var19 < var18; ++var19) { + ItemValue itemValue = var17[var19]; + String code = itemValue.getItem_code(); + Object value = itemValue.getItem_value(); + opcValueAccessor.setValue(code, value); + } + } + + return true; + } else { + throw new WDKException("下发 无内容"); + } + } } 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 e86d8cb..da8c357 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 @@ -91,4 +91,8 @@ public interface OpcDeviceDriver extends DeviceDriver { return this.getOpcServer() + "." + this.getOpcPlc() + "." + this.getDeviceCode() + "." + item; } + default Object getUdwValue(String protocol) { + return this.getOpcValueAccessor().getValue(protocol); + } + } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDeviceDriver.java index 8b2e6a7..71e432e 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDeviceDriver.java @@ -137,11 +137,10 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + org.nl.acs.device_driver.standard_inspect_site.ItemProtocol.item_to_command; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); log.info("下发PLC信号:{},{}", to_command, command); System.out.println("设备:" + devicecode + ",下发PLC信号:" + to_command + ",value:" + command); } 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 12f4388..ec4360e 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 @@ -388,12 +388,11 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i if (instruction != null) { instruction_num = Integer.parseInt(instruction.getInstruction_code()); } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, 1); itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -424,18 +423,17 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command); } @@ -446,8 +444,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i + "." + 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); if (type == 1) { itemMap.put(to_command, command); @@ -459,7 +456,7 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i itemMap.put(to_task, command); logServer.deviceExecuteLog(this.device_code, "", "", to_task + " 写入 " + command); } - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -467,17 +464,16 @@ public class LnshLaminatingMachineDeviceDriver extends AbstractOpcDeviceDriver i String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_param,value); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value); } public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException { - if (obj == null || StrUtil.isEmpty(fieldName)) { + if (obj == null || StrUtil.isBlank(fieldName)) { return null; } //获取这个类的所有属性 diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/ItemProtocol.java index 596a810..957c554 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/ItemProtocol.java @@ -164,7 +164,7 @@ public class ItemProtocol { public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { + if (StrUtil.isBlank(value)) { } else { return value; diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDeviceDriver.java index 3ae5d52..1cfaac4 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_kiln_lane/LnshKilnLaneDeviceDriver.java @@ -328,31 +328,29 @@ public class LnshKilnLaneDeviceDriver extends AbstractOpcDeviceDriver implements String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); if (value instanceof String) { itemMap.put(to_param, value); } else { itemMap.put(to_param, Integer.parseInt(value)); } - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value); } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command); } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDeviceDriver.java index 2c5568a..e365336 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_labeling_machine/LnshLabelingMachineDeviceDriver.java @@ -201,15 +201,14 @@ public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver imp } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void writing(int command) { - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -217,12 +216,11 @@ public class LnshLabelingMachineDeviceDriver extends AbstractOpcDeviceDriver imp String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_param, value); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value); } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/ItemProtocol.java index 7bbedf7..fb5bfa6 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/ItemProtocol.java @@ -126,7 +126,7 @@ public class ItemProtocol { public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { + if (StrUtil.isBlank(value)) { } else { return value; diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/LnshOneRGVDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/LnshOneRGVDeviceDriver.java index b26aaad..1e94c1c 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/LnshOneRGVDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_one_rgv/LnshOneRGVDeviceDriver.java @@ -278,10 +278,9 @@ public class LnshOneRGVDeviceDriver extends AbstractOpcDeviceDriver implements D public void executing(int command, Instruction instruction, String appendMessage) { - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -290,27 +289,25 @@ public class LnshOneRGVDeviceDriver extends AbstractOpcDeviceDriver implements D String to_command1 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_command1; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command1, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void writing(String type, String value) { String to_command1 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_command1; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(type, value); - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -318,11 +315,10 @@ public class LnshOneRGVDeviceDriver extends AbstractOpcDeviceDriver implements D String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_command1; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/ItemProtocol.java index 2404010..d4c3ce2 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_package_pallet_manipulator/ItemProtocol.java @@ -811,7 +811,7 @@ public class ItemProtocol { public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { + if (StrUtil.isBlank(value)) { } else { return value; 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 46341c4..f966293 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 @@ -977,66 +977,66 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD String two_qty = content.getString("two_qty"); String tool_coordinate = content.getString("tool_coordinate"); - this.writing("to_material_qty", StrUtil.isEmpty(qty) ? "0" : qty); - this.writing("to_material_code", StrUtil.isEmpty(material_code) ? "0" : material_code); - this.writing("to_product_code", StrUtil.isEmpty(product_code) ? "0" : product_code); - this.writing("to_AlongSide", StrUtil.isEmpty(AlongSide) ? "0" : AlongSide); - this.writing("to_BshortSide", StrUtil.isEmpty(BshortSide) ? "0" : BshortSide); - this.writing("to_Htrapezoidal", StrUtil.isEmpty(Htrapezoidal) ? "0" : Htrapezoidal); - this.writing("to_Wthickness", StrUtil.isEmpty(Wthickness) ? "0" : Wthickness); - this.writing("to_tray_qty", StrUtil.isEmpty(qty) ? "0" : qty); - this.writing("to_tray_high", StrUtil.isEmpty(tray_high) ? "0" : tray_high); - this.writing("to_crib_category", StrUtil.isEmpty(crib_category) ? "0" : crib_category); - this.writing("to_palletX1_line", StrUtil.isEmpty(palletX1_line) ? "0" : palletX1_line); - this.writing("to_palletY1_row", StrUtil.isEmpty(palletY1_row) ? "0" : palletY1_row); - this.writing("to_palletA1_angle", StrUtil.isEmpty(palletA1_angle) ? "0" : palletA1_angle); - this.writing("to_palletX2_line", StrUtil.isEmpty(palletX2_line) ? "0" : palletX2_line); - this.writing("to_palletY2_row", StrUtil.isEmpty(palletY2_row) ? "0" : palletY2_row); - this.writing("to_palletA2_angle", StrUtil.isEmpty(palletA2_angle) ? "0" : palletA2_angle); - this.writing("to_palletX3_line", StrUtil.isEmpty(palletX3_line) ? "0" : palletX3_line); - this.writing("to_palletY3_row", StrUtil.isEmpty(palletY3_row) ? "0" : palletY3_row); - this.writing("to_palletA3_angle", StrUtil.isEmpty(palletA3_angle) ? "0" : palletA3_angle); - this.writing("to_pressCribX1_line", StrUtil.isEmpty(pressCribX1_line) ? "0" : pressCribX1_line); - this.writing("to_pressCribY1_row", StrUtil.isEmpty(pressCribY1_row) ? "0" : pressCribY1_row); - this.writing("to_pressCribA1_angle", StrUtil.isEmpty(pressCribA1_angle) ? "0" : pressCribA1_angle); - this.writing("to_pressCribX2_line", StrUtil.isEmpty(pressCribX2_line) ? "0" : pressCribX2_line); - this.writing("to_pressCribY2_row", StrUtil.isEmpty(pressCribY2_row) ? "0" : pressCribY2_row); - this.writing("to_pressCribA2_angle", StrUtil.isEmpty(pressCribA2_angle) ? "0" : pressCribA2_angle); - this.writing("to_pressCribX3_line", StrUtil.isEmpty(pressCribX3_line) ? "0" : pressCribX3_line); - this.writing("to_pressCribY3_row", StrUtil.isEmpty(pressCribY3_row) ? "0" : pressCribY3_row); - this.writing("to_pressCribA3_angle", StrUtil.isEmpty(pressCribA3_angle) ? "0" : pressCribA3_angle); - this.writing("to_Zoffset", StrUtil.isEmpty(Zoffset) ? "0" : Zoffset); - this.writing("to_pallet_layerQty", StrUtil.isEmpty(pallet_layerQty) ? "0" : pallet_layerQty); - this.writing("to_pressCrib_layerQty", StrUtil.isEmpty(pressCrib_layerQty) ? "0" : pressCrib_layerQty); - this.writing("to_codeLayerX1_interval", StrUtil.isEmpty(codeLayerX1_interval) ? "0" : codeLayerX1_interval); - this.writing("to_codeLayerY1_interval", StrUtil.isEmpty(codeLayerY1_interval) ? "0" : codeLayerY1_interval); - this.writing("to_codeLayerX2_interval", StrUtil.isEmpty(codeLayerX2_interval) ? "0" : codeLayerX2_interval); - this.writing("to_codeLayerY2_interval", StrUtil.isEmpty(codeLayerY2_interval) ? "0" : codeLayerY2_interval); - this.writing("to_codeLayerX3_interval", StrUtil.isEmpty(codeLayerX3_interval) ? "0" : codeLayerX3_interval); - this.writing("to_codeLayerY3_interval", StrUtil.isEmpty(codeLayerY3_interval) ? "0" : codeLayerY3_interval); - this.writing("to_codeLayerX1_offset", StrUtil.isEmpty(codeLayerX1_offset) ? "0" : codeLayerX1_offset); - this.writing("to_codeLayerY1_offset", StrUtil.isEmpty(codeLayerY1_offset) ? "0" : codeLayerY1_offset); - this.writing("to_codeLayerX2_offset", StrUtil.isEmpty(codeLayerX2_offset) ? "0" : codeLayerX2_offset); - this.writing("to_codeLayerY2_offset", StrUtil.isEmpty(codeLayerY2_offset) ? "0" : codeLayerY2_offset); - this.writing("to_codeLayerX3_offset", StrUtil.isEmpty(codeLayerX3_offset) ? "0" : codeLayerX3_offset); - this.writing("to_codeLayerY3_offset", StrUtil.isEmpty(codeLayerY3_offset) ? "0" : codeLayerY3_offset); - this.writing("to_pressLayerX1_interval", StrUtil.isEmpty(pressLayerX1_interval) ? "0" : pressLayerX1_interval); - this.writing("to_pressLayerY1_interval", StrUtil.isEmpty(pressLayerY1_interval) ? "0" : pressLayerY1_interval); - this.writing("to_pressLayerX2_interval", StrUtil.isEmpty(pressLayerX2_interval) ? "0" : pressLayerX2_interval); - this.writing("to_pressLayerY2_interval", StrUtil.isEmpty(pressLayerY2_interval) ? "0" : pressLayerY2_interval); - this.writing("to_pressLayerX3_interval", StrUtil.isEmpty(pressLayerX3_interval) ? "0" : pressLayerX3_interval); - this.writing("to_pressLayerY3_interval", StrUtil.isEmpty(pressLayerY3_interval) ? "0" : pressLayerY3_interval); - this.writing("to_pressLayerX1_offset", StrUtil.isEmpty(pressLayerX1_offset) ? "0" : pressLayerX1_offset); - this.writing("to_pressLayerY1_offset", StrUtil.isEmpty(pressLayerY1_offset) ? "0" : pressLayerY1_offset); - this.writing("to_pressLayerX2_offset", StrUtil.isEmpty(pressLayerX2_offset) ? "0" : pressLayerX2_offset); - this.writing("to_pressLayerY2_offset", StrUtil.isEmpty(pressLayerY2_offset) ? "0" : pressLayerY2_offset); - this.writing("to_pressLayerX3_offset", StrUtil.isEmpty(pressLayerX3_offset) ? "0" : pressLayerX3_offset); - this.writing("to_pressLayerY3_offset", StrUtil.isEmpty(pressLayerY3_offset) ? "0" : pressLayerY3_offset); - this.writing("to_one_cribTotal", StrUtil.isEmpty(one_cribTotal) ? "0" : one_cribTotal); - this.writing("to_two_cribTotal", StrUtil.isEmpty(two_cribTotal) ? "0" : two_cribTotal); - this.writing("to_one_qty", StrUtil.isEmpty(one_qty) ? "0" : one_qty); - this.writing("to_two_qty", StrUtil.isEmpty(two_qty) ? "0" : two_qty); - this.writing("to_tool_coordinate", StrUtil.isEmpty(tool_coordinate) ? "0" : 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); @@ -1284,11 +1284,11 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException { - if (obj == null || StrUtil.isEmpty(fieldName)) { + if (obj == null || StrUtil.isBlank(fieldName)) { return null; } //获取这个类的所有属性 @@ -1308,11 +1308,10 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_feedback; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command); } @@ -1324,12 +1323,11 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_param, value); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value); } @@ -1371,9 +1369,9 @@ public class LnshPackagePalletManipulatorDeviceDriver extends AbstractOpcDeviceD } String onoff_status = ""; - if (this.getOnoff_status() == 1) { + if (this.getOnoff_status() == 0) { onoff_status = "关机"; - } else if (this.getOnoff_status() == 2) { + } else if (this.getOnoff_status() == 1) { onoff_status = "开机"; } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/ItemProtocol.java index 1439d30..88e1047 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator/ItemProtocol.java @@ -203,7 +203,7 @@ public class ItemProtocol { } public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { + if (StrUtil.isBlank(value)) { } else { return value; 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 aa4fc4e..38e10f1 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 @@ -570,17 +570,16 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri if (instruction != null) { instruction_num = Integer.parseInt(instruction.getInstruction_code()); } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, 1); itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void writing(int type, int command) { @@ -590,8 +589,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri + "." + org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.ItemProtocol.item_to_target; String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + org.nl.acs.device_driver.lnsh.lnsh_palletizing_manipulator_site.ItemProtocol.item_to_task; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); if (type == 1) { itemMap.put(to_command, command); @@ -601,7 +599,7 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri } else if (type == 3) { itemMap.put(to_task, command); } - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -609,23 +607,21 @@ public class LnshPalletizingManipulatorDeviceDriver extends AbstractOpcDeviceDri String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_param, value); - ReadUtil.write(itemMap, server); + 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command); } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java index efb04d1..ab320fd 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_palletizing_manipulator_site/ItemProtocol.java @@ -202,7 +202,7 @@ public class ItemProtocol { } public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { + if (StrUtil.isBlank(value)) { } else { return value; 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 9809ec1..5273cd4 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 @@ -582,17 +582,16 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic if (instruction != null) { instruction_num = Integer.parseInt(instruction.getInstruction_code()); } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, 1); itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void writing(int type, int command) { @@ -602,8 +601,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic + "." + 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); if (type == 1) { itemMap.put(to_command, command); @@ -615,7 +613,7 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic itemMap.put(to_task, command); logServer.deviceExecuteLog(this.device_code, "", "", to_task + " 写入 " + command); } - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -623,22 +621,20 @@ public class LnshPalletizingManipulatorSiteDeviceDriver extends AbstractOpcDevic String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_param, value); - ReadUtil.write(itemMap, server); + 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command); } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/ItemProtocol.java index 64e9478..f41d19e 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/ItemProtocol.java @@ -186,7 +186,7 @@ public class ItemProtocol { public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { + if (StrUtil.isBlank(value)) { } else { return value; diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDeviceDriver.java index 254b416..979fc59 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_rgv/LnshRGVDeviceDriver.java @@ -178,18 +178,10 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi logServer.deviceExecuteLog(this.device_code, "", "", "信号status:" + last_status + "->" + status); } if (move_1 != last_move_1) { - if (move_1 == 0) { - this.setRequireSucess1(false); - logServer.deviceExecuteLog(this.device_code, "", "", "前工位有货变无货,复位前工位请求标记requireSucess1:"+requireSucess1); - } logServer.deviceItemValue(this.device_code, "move_1", String.valueOf(move_1)); logServer.deviceExecuteLog(this.device_code, "", "", "信号move_1:" + last_move_1 + "->" + move_1); } if (move_2 != last_move_2) { - if (move_2 == 0) { - this.setRequireSucess2(false); - logServer.deviceExecuteLog(this.device_code, "", "", "前工位有货变无货,复位前工位请求标记requireSucess1:"+requireSucess1); - } logServer.deviceItemValue(this.device_code, "move_2", String.valueOf(move_2)); logServer.deviceExecuteLog(this.device_code, "", "", "信号move_2:" + last_move_2 + "->" + move_2); } @@ -249,6 +241,14 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi logServer.deviceItemValue(this.device_code, "specifications", specifications); logServer.deviceExecuteLog(this.device_code, "", "", "信号specifications:" + last_specifications + "->" + specifications); } + if (move_1 == 0 && task1 == 0) { + this.setRequireSucess1(false); + logServer.deviceExecuteLog(this.device_code, "", "", "前工位无货且无任务,复位前工位请求标记requireSucess1:"+requireSucess1); + } + if (move_2 == 0 && task2 == 0) { + this.setRequireSucess2(false); + logServer.deviceExecuteLog(this.device_code, "", "", "后工位无货且无任务,复位后工位请求标记requireSucess2:"+requireSucess1); + } if (task1 > 0) { @@ -432,10 +432,10 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi List device_code_list = Arrays.asList(demoArray); TaskDto task = null; if (mode == 3) { - Instruction inst2 = instructionService.findByCode(String.valueOf(task2)); - device_code_list = new ArrayList() {{ - add(inst2.getNext_device_code()); - }}; + Instruction inst2 = instructionService.findByCodeFromCache(String.valueOf(task2)); + device_code_list = new ArrayList<>(); + device_code_list.add(inst2.getNext_device_code()); + logServer.deviceExecuteLog(device_code, "", "", "前工位申请起点为" + inst2.getNext_device_code() + "的任务"); } for (int i = 0; i < device_code_list.size(); i++) { if (ObjectUtil.isNotEmpty(taskserver.queryTaskByDeviceCode(device_code_list.get(i).replace("\"", "")))) { @@ -581,11 +581,6 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi logServer.deviceExecuteLog(this.device_code, "", "", "申请后工位空盘任务成功,requireSucess2"+requireSucess2+",指令号:"+instdto.getInstruction_code()); - } else { - if (mode == 2 && move_2 == 0 && action_2 == 0 && move_1 == 0 && task2 == 0 && !requireSucess1) { - logServer.deviceExecuteLog(this.device_code, "", "", "申请后工位空盘任务未找到,开始申请前工位任务,requireSucess1"+requireSucess1); - instruction_require(); - } } } return true; @@ -604,12 +599,11 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_param, value); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value); } @@ -623,10 +617,9 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi public void executing(int command, Instruction instruction, String appendMessage) { - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -638,18 +631,17 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void writing1(int command) { String to_command1 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_command1; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command1, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_command1 + " 写入 " + command); } @@ -657,23 +649,21 @@ public class LnshRGVDeviceDriver extends AbstractOpcDeviceDriver implements Devi String to_command2 = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_command2; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command2, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_command2 + " 写入 " + command); } public void writing(int type, int command) { - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException { - if (obj == null || StrUtil.isEmpty(fieldName)) { + if (obj == null || StrUtil.isBlank(fieldName)) { return null; } //获取这个类的所有属性 diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/ItemProtocol.java index 1418aef..d08d182 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/ItemProtocol.java @@ -745,7 +745,7 @@ public class ItemProtocol { public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { + if (StrUtil.isBlank(value)) { } else { return value; diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDeviceDriver.java index bb759e6..abe90d6 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_split_manipulator/LnshSplitManipulatorDeviceDriver.java @@ -1127,25 +1127,23 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im } public void executing(int command, Instruction instruction, String appendMessage) { - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void writing(int feedback) { String to_feedback = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_feedback; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_feedback, feedback); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_feedback + " 写入 " + feedback); } @@ -1153,10 +1151,9 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_feedback; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -1164,17 +1161,16 @@ public class LnshSplitManipulatorDeviceDriver extends AbstractOpcDeviceDriver im String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_param, value); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value); } public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException { - if (obj == null || StrUtil.isEmpty(fieldName)) { + if (obj == null || StrUtil.isBlank(fieldName)) { return null; } //获取这个类的所有属性 diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/ItemProtocol.java index fecadb4..07fa9aa 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/lnsh_station/ItemProtocol.java @@ -127,7 +127,7 @@ public class ItemProtocol { } public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { + if (StrUtil.isBlank(value)) { } else { return value; 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 7b8d4e7..59eecdb 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 @@ -566,17 +566,16 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements if (instruction != null) { instruction_num = Integer.parseInt(instruction.getInstruction_code()); } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, 1); itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void writing(int type, int command) { @@ -586,8 +585,7 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements + "." + 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); if (type == 1) { itemMap.put(to_command, command); @@ -599,18 +597,17 @@ public class LnshStationDeviceDriver extends AbstractOpcDeviceDriver implements itemMap.put(to_task, command); logServer.deviceExecuteLog(this.device_code, "", "", to_task + " 写入 " + command); } - ReadUtil.write(itemMap, server); + this.control(itemMap); } 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command); } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/ItemProtocol.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/ItemProtocol.java index cd8c47c..13d1aaf 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/ItemProtocol.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lnsh/rljn_package_palletSplit_manipulator/ItemProtocol.java @@ -812,7 +812,7 @@ public class ItemProtocol { public String getOpcStringValue(String protocol) { String value = this.driver.getStringValue(protocol); - if (StrUtil.isEmpty(value)) { + if (StrUtil.isBlank(value)) { } else { return value; 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 149d888..5fdbb74 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 @@ -1211,66 +1211,66 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe String two_qty = content.getString("two_qty"); String tool_coordinate = content.getString("tool_coordinate"); - this.writing("to_material_qty", StrUtil.isEmpty(qty) ? "0" : qty); - this.writing("to_material_code", StrUtil.isEmpty(material_code) ? "0" : material_code ); - this.writing("to_product_code", StrUtil.isEmpty(product_code) ? "0" : product_code ); - this.writing("to_AlongSide", StrUtil.isEmpty(AlongSide) ? "0" : AlongSide ); - this.writing("to_BshortSide", StrUtil.isEmpty(BshortSide) ? "0" : BshortSide ); - this.writing("to_Htrapezoidal", StrUtil.isEmpty(Htrapezoidal) ? "0" : Htrapezoidal ); - this.writing("to_Wthickness", StrUtil.isEmpty(Wthickness) ? "0" : Wthickness ); - this.writing("to_tray_qty", StrUtil.isEmpty(qty) ? "0" : qty ); - this.writing("to_tray_high", StrUtil.isEmpty(tray_high) ? "0" : tray_high ); - this.writing("to_crib_category", StrUtil.isEmpty(crib_category) ? "0" : crib_category ); - this.writing("to_palletX1_line", StrUtil.isEmpty(palletX1_line) ? "0" : palletX1_line ); - this.writing("to_palletY1_row", StrUtil.isEmpty(palletY1_row) ? "0" : palletY1_row ); - this.writing("to_palletA1_angle", StrUtil.isEmpty(palletA1_angle) ? "0" : palletA1_angle ); - this.writing("to_palletX2_line", StrUtil.isEmpty(palletX2_line) ? "0" : palletX2_line ); - this.writing("to_palletY2_row", StrUtil.isEmpty(palletY2_row) ? "0" : palletY2_row ); - this.writing("to_palletA2_angle", StrUtil.isEmpty(palletA2_angle) ? "0" : palletA2_angle ); - this.writing("to_palletX3_line", StrUtil.isEmpty(palletX3_line) ? "0" : palletX3_line ); - this.writing("to_palletY3_row", StrUtil.isEmpty(palletY3_row) ? "0" : palletY3_row ); - this.writing("to_palletA3_angle", StrUtil.isEmpty(palletA3_angle) ? "0" : palletA3_angle ); - this.writing("to_pressCribX1_line", StrUtil.isEmpty(pressCribX1_line) ? "0" : pressCribX1_line ); - this.writing("to_pressCribY1_row", StrUtil.isEmpty(pressCribY1_row) ? "0" : pressCribY1_row ); - this.writing("to_pressCribA1_angle", StrUtil.isEmpty(pressCribA1_angle) ? "0" : pressCribA1_angle ); - this.writing("to_pressCribX2_line", StrUtil.isEmpty(pressCribX2_line) ? "0" : pressCribX2_line ); - this.writing("to_pressCribY2_row", StrUtil.isEmpty(pressCribY2_row) ? "0" : pressCribY2_row ); - this.writing("to_pressCribA2_angle", StrUtil.isEmpty(pressCribA2_angle) ? "0" : pressCribA2_angle ); - this.writing("to_pressCribX3_line", StrUtil.isEmpty(pressCribX3_line) ? "0" : pressCribX3_line ); - this.writing("to_pressCribY3_row", StrUtil.isEmpty(pressCribY3_row) ? "0" : pressCribY3_row ); - this.writing("to_pressCribA3_angle", StrUtil.isEmpty(pressCribA3_angle) ? "0" : pressCribA3_angle ); - this.writing("to_Zoffset", StrUtil.isEmpty(Zoffset) ? "0" : Zoffset ); - this.writing("to_pallet_layerQty", StrUtil.isEmpty(pallet_layerQty) ? "0" : pallet_layerQty ); - this.writing("to_pressCrib_layerQty", StrUtil.isEmpty(pressCrib_layerQty) ? "0" : pressCrib_layerQty ); - this.writing("to_codeLayerX1_interval", StrUtil.isEmpty(codeLayerX1_interval) ? "0" : codeLayerX1_interval ); - this.writing("to_codeLayerY1_interval", StrUtil.isEmpty(codeLayerY1_interval) ? "0" : codeLayerY1_interval ); - this.writing("to_codeLayerX2_interval", StrUtil.isEmpty(codeLayerX2_interval) ? "0" : codeLayerX2_interval ); - this.writing("to_codeLayerY2_interval", StrUtil.isEmpty(codeLayerY2_interval) ? "0" : codeLayerY2_interval ); - this.writing("to_codeLayerX3_interval", StrUtil.isEmpty(codeLayerX3_interval) ? "0" : codeLayerX3_interval ); - this.writing("to_codeLayerY3_interval", StrUtil.isEmpty(codeLayerY3_interval) ? "0" : codeLayerY3_interval ); - this.writing("to_codeLayerX1_offset", StrUtil.isEmpty(codeLayerX1_offset) ? "0" : codeLayerX1_offset ); - this.writing("to_codeLayerY1_offset", StrUtil.isEmpty(codeLayerY1_offset) ? "0" : codeLayerY1_offset ); - this.writing("to_codeLayerX2_offset", StrUtil.isEmpty(codeLayerX2_offset) ? "0" : codeLayerX2_offset ); - this.writing("to_codeLayerY2_offset", StrUtil.isEmpty(codeLayerY2_offset) ? "0" : codeLayerY2_offset ); - this.writing("to_codeLayerX3_offset", StrUtil.isEmpty(codeLayerX3_offset) ? "0" : codeLayerX3_offset ); - this.writing("to_codeLayerY3_offset", StrUtil.isEmpty(codeLayerY3_offset) ? "0" : codeLayerY3_offset ); - this.writing("to_pressLayerX1_interval", StrUtil.isEmpty(pressLayerX1_interval) ? "0" : pressLayerX1_interval ); - this.writing("to_pressLayerY1_interval", StrUtil.isEmpty(pressLayerY1_interval) ? "0" : pressLayerY1_interval ); - this.writing("to_pressLayerX2_interval", StrUtil.isEmpty(pressLayerX2_interval) ? "0" : pressLayerX2_interval ); - this.writing("to_pressLayerY2_interval", StrUtil.isEmpty(pressLayerY2_interval) ? "0" : pressLayerY2_interval ); - this.writing("to_pressLayerX3_interval", StrUtil.isEmpty(pressLayerX3_interval) ? "0" : pressLayerX3_interval ); - this.writing("to_pressLayerY3_interval", StrUtil.isEmpty(pressLayerY3_interval) ? "0" : pressLayerY3_interval ); - this.writing("to_pressLayerX1_offset", StrUtil.isEmpty(pressLayerX1_offset) ? "0" : pressLayerX1_offset ); - this.writing("to_pressLayerY1_offset", StrUtil.isEmpty(pressLayerY1_offset) ? "0" : pressLayerY1_offset ); - this.writing("to_pressLayerX2_offset", StrUtil.isEmpty(pressLayerX2_offset) ? "0" : pressLayerX2_offset ); - this.writing("to_pressLayerY2_offset", StrUtil.isEmpty(pressLayerY2_offset) ? "0" : pressLayerY2_offset ); - this.writing("to_pressLayerX3_offset", StrUtil.isEmpty(pressLayerX3_offset) ? "0" : pressLayerX3_offset ); - this.writing("to_pressLayerY3_offset", StrUtil.isEmpty(pressLayerY3_offset) ? "0" : pressLayerY3_offset ); - this.writing("to_one_cribTotal", StrUtil.isEmpty(one_cribTotal) ? "0" : one_cribTotal ); - this.writing("to_two_cribTotal", StrUtil.isEmpty(two_cribTotal) ? "0" : two_cribTotal ); - this.writing("to_one_qty", StrUtil.isEmpty(one_qty) ? "0" : one_qty ); - this.writing("to_two_qty", StrUtil.isEmpty(two_qty) ? "0" : two_qty ); - this.writing("to_tool_coordinate", StrUtil.isEmpty(tool_coordinate) ? "0" : 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); @@ -1550,11 +1550,11 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } public static Boolean isExistFieldName(String fieldName, Object obj) throws NoSuchFieldException { - if (obj == null || StrUtil.isEmpty(fieldName)) { + if (obj == null || StrUtil.isBlank(fieldName)) { return null; } //获取这个类的所有属性 @@ -1574,11 +1574,10 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_feedback; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_command + " 写入 " + command); } @@ -1586,12 +1585,11 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe String to_param = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + param; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_param, value); - ReadUtil.write(itemMap, server); + this.control(itemMap); logServer.deviceExecuteLog(this.device_code, "", "", to_param + " 写入 " + value); } @@ -1637,9 +1635,9 @@ public class RljnPackagePalletSplitManipulatorDeviceDriver extends AbstractOpcDe } String onoff_status = ""; - if (this.getOnoff_status() == 1) { + if (this.getOnoff_status() == 0) { onoff_status = "关机"; - } else if (this.getOnoff_status() == 2) { + } else if (this.getOnoff_status() == 1) { onoff_status = "开机"; } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/special_ordinary_site/SpecialOrdinarySiteDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/special_ordinary_site/SpecialOrdinarySiteDeviceDriver.java index edc0b9b..8361a99 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/special_ordinary_site/SpecialOrdinarySiteDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/special_ordinary_site/SpecialOrdinarySiteDeviceDriver.java @@ -195,7 +195,7 @@ public class SpecialOrdinarySiteDeviceDriver extends AbstractDeviceDriver implem } if (specialOrdinarySiteDeviceDriver.hasGoods != 0 && !StrUtil.equals(specialOrdinarySiteDeviceDriver.getMaterial(), "0") && !StrUtil.equals(specialOrdinarySiteDeviceDriver.getMaterial(), "1") - && (StrUtil.equals(startdevice.getIslock(), "false") || StrUtil.isEmpty(startdevice.getIslock()))) { + && (StrUtil.equals(startdevice.getIslock(), "false") || StrUtil.isBlank(startdevice.getIslock()))) { flag = true; dto.setMaterial(specialOrdinarySiteDeviceDriver.getMaterial()); break; @@ -207,7 +207,7 @@ public class SpecialOrdinarySiteDeviceDriver extends AbstractDeviceDriver implem if (!flag) { return false; } - if (StrUtil.isEmpty(start_device_code)) { + if (StrUtil.isBlank(start_device_code)) { requireSucess = true; branchProtocol = 0; //throw new RuntimeException("该设备未找到对应路由"); @@ -360,7 +360,7 @@ public class SpecialOrdinarySiteDeviceDriver extends AbstractDeviceDriver implem dto.setPriority("101"); RouteLineDto jo = routeLineServer.findByCode(this.getDevice().getDevice_code()); String next_device_codecode = jo.getNext_device_code(); - if (StrUtil.isEmpty(next_device_codecode)) { + if (StrUtil.isBlank(next_device_codecode)) { throw new RuntimeException("该设备未找到对应路由"); } dto.setNext_point_code(next_device_codecode); @@ -408,7 +408,7 @@ public class SpecialOrdinarySiteDeviceDriver extends AbstractDeviceDriver implem dto.setQuantity(new BigDecimal(this.getQty())); RouteLineDto jo = routeLineServer.findByCode(this.getDevice().getDevice_code()); String next_device_codecode = jo.getNext_device_code(); - if (StrUtil.isEmpty(next_device_codecode)) { + if (StrUtil.isBlank(next_device_codecode)) { throw new RuntimeException("该设备未找到对应路由"); } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/StandardAutodoorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/StandardAutodoorDeviceDriver.java index 4f1c09f..aea7d8c 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/StandardAutodoorDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_autodoor/StandardAutodoorDeviceDriver.java @@ -139,11 +139,10 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem String to_command = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_command; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); log.info("下发PLC信号:{},{}", to_command, command); System.out.println("设备:" + devicecode + ",下发PLC信号:" + to_command + ",value:" + command); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java index 138f0c9..132c251 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control/StandardCoveyorControlDeviceDriver.java @@ -203,7 +203,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver break; case 2: //申请任务 - if (!StrUtil.isEmpty(material) && !StrUtil.isEmpty(qty) && material.length() > 0 && qty.length() > 0 && !requireSucess) { + if (!StrUtil.isBlank(material) && !StrUtil.isBlank(qty) && material.length() > 0 && qty.length() > 0 && !requireSucess) { this.instruction_require(container); } break; @@ -302,28 +302,26 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver if (instruction != null) { instruction_num = Integer.parseInt(instruction.getInstruction_code()); } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, 1); itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -335,13 +333,12 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_target; String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + org.nl.acs.device_driver.standard_conveyor_control_with_scanner.ItemProtocol.item_to_task; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); itemMap.put(to_target, target); itemMap.put(to_task, task); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void writing(int type, int command) { @@ -351,8 +348,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver + "." + 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); if (type == 1) { itemMap.put(to_command, command); @@ -362,7 +358,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver } else if (type == 3) { itemMap.put(to_task, command); } - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -402,7 +398,7 @@ public class StandardCoveyorControlDeviceDriver extends AbstractOpcDeviceDriver dto.setPriority("101"); RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code()); String next_device_codecode = jo.getNext_device_code(); - if (StrUtil.isEmpty(next_device_codecode)) { + if (StrUtil.isBlank(next_device_codecode)) { throw new RuntimeException("该设备未找到对应路由"); } dto.setNext_point_code(next_device_codecode); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java index e698d37..e54da1b 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control_with_plcscanner/StandardCoveyorControlWithPlcScannerDeviceDriver.java @@ -531,17 +531,16 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp if (instruction != null) { instruction_num = Integer.parseInt(instruction.getInstruction_code()); } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, 1); itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void writing() { @@ -552,13 +551,12 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp + "." + 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, 1); itemMap.put(to_target, deviceAppservice.findDeviceByCode(inst.getNext_device_code()).getAddress()); itemMap.put(to_task, inst.getInstruction_code()); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void writing(int command, int target, int task) { @@ -569,24 +567,22 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp + "." + 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); itemMap.put(to_target, target); itemMap.put(to_task, task); - ReadUtil.write(itemMap, server); + this.control(itemMap); } 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void writing(int type, int command) { @@ -596,8 +592,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp + "." + 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); if (type == 1) { itemMap.put(to_command, command); @@ -608,7 +603,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp itemMap.put(to_task, command); } - ReadUtil.write(itemMap, server); + this.control(itemMap); } public boolean instruction_require(String container_code) throws Exception { @@ -639,7 +634,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp * 开始平均分配 */ String this_device_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code()); - if (StrUtil.isEmpty(this_device_code)) { + if (StrUtil.isBlank(this_device_code)) { List shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code); RouteLineDto routeLineDto = shortPathsList.get(0); @@ -745,7 +740,7 @@ public class StandardCoveyorControlWithPlcScannerDeviceDriver extends AbstractOp * 开始平均分配 */ String this_device_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code()); - if (StrUtil.isEmpty(this_device_code)) { + if (StrUtil.isBlank(this_device_code)) { List shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code); RouteLineDto routeLineDto = shortPathsList.get(0); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java index ee9b37f..5241286 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_control_with_scanner/StandardCoveyorControlWithScannerDeviceDriver.java @@ -152,7 +152,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe public String formatBarcode() throws Exception { String barcode = this.barcode(); - if (!StrUtil.isEmpty(barcode)) { + if (!StrUtil.isBlank(barcode)) { barcode = barcode.trim(); } @@ -172,7 +172,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe private ScannerDeviceDriver getScanner() throws Exception { String scanner_code = (String) this.getDevice().getExtraValue().get(StandardConveyorWithScannerConfig.relation_scanner); - if (StrUtil.isEmpty(scanner_code)) { + if (StrUtil.isBlank(scanner_code)) { throw new Exception("未配置读码器"); } else { Device device = deviceAppservice.findDeviceByCode(scanner_code); @@ -270,10 +270,10 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe break; case 2: //申请任务 - if (hasGoods > 0 && !StrUtil.isEmpty(barcode()) && height > 0 && !requireSucess) { + if (hasGoods > 0 && !StrUtil.isBlank(barcode()) && height > 0 && !requireSucess) { instruction_require(barcode()); } - if (hasGoods > 0 && !StrUtil.isEmpty(barcode()) && height > 0 && !applySucess) { + if (hasGoods > 0 && !StrUtil.isBlank(barcode()) && height > 0 && !applySucess) { instruction_apply(barcode()); } } @@ -352,17 +352,16 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe if (instruction != null) { instruction_num = Integer.parseInt(instruction.getInstruction_code()); } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, 1); itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void writing() { @@ -373,13 +372,12 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe + "." + 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, 1); itemMap.put(to_target, deviceAppservice.findDeviceByCode(inst.getNext_device_code()).getAddress()); itemMap.put(to_task, inst.getInstruction_code()); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void writing(int command, int target, int task) { @@ -390,24 +388,22 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe + "." + 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); itemMap.put(to_target, target); itemMap.put(to_task, task); - ReadUtil.write(itemMap, server); + this.control(itemMap); } 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void writing(int type, int command) { @@ -417,8 +413,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe + "." + 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); if (type == 1) { itemMap.put(to_command, command); @@ -429,7 +424,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe itemMap.put(to_task, command); } - ReadUtil.write(itemMap, server); + this.control(itemMap); } public boolean instruction_require(String container_code) throws Exception { @@ -459,7 +454,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe * 开始平均分配 */ String this_device_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code()); - if (StrUtil.isEmpty(this_device_code)) { + if (StrUtil.isBlank(this_device_code)) { List shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code); RouteLineDto routeLineDto = shortPathsList.get(0); @@ -563,7 +558,7 @@ public class StandardCoveyorControlWithScannerDeviceDriver extends AbstractOpcDe * 开始平均分配 */ String this_device_code = taskserver.queryAssignedByDevice(device_code, task.getNext_device_code()); - if (StrUtil.isEmpty(this_device_code)) { + if (StrUtil.isBlank(this_device_code)) { List shortPathsList = routeLineService.getShortPathLines(start_device_code, task.getNext_device_code(), route_plan_code); RouteLineDto routeLineDto = shortPathsList.get(0); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_monitor/StandardCoveyorMonitorDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_monitor/StandardCoveyorMonitorDeviceDriver.java index 660a015..5b8f04e 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_monitor/StandardCoveyorMonitorDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_conveyor_monitor/StandardCoveyorMonitorDeviceDriver.java @@ -255,28 +255,26 @@ public class StandardCoveyorMonitorDeviceDriver extends AbstractOpcDeviceDriver if (instruction != null) { instruction_num = Integer.parseInt(instruction.getInstruction_code()); } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, 1); itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -287,8 +285,7 @@ public class StandardCoveyorMonitorDeviceDriver extends AbstractOpcDeviceDriver + "." + 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); if (type == 1) { itemMap.put(to_command, command); @@ -298,7 +295,7 @@ public class StandardCoveyorMonitorDeviceDriver extends AbstractOpcDeviceDriver } else if (type == 3) { itemMap.put(to_task, command); } - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -336,7 +333,7 @@ public class StandardCoveyorMonitorDeviceDriver extends AbstractOpcDeviceDriver dto.setPriority("101"); RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code()); String next_device_codecode = jo.getNext_device_code(); - if (StrUtil.isEmpty(next_device_codecode)) { + if (StrUtil.isBlank(next_device_codecode)) { throw new RuntimeException("该设备未找到对应路由"); } dto.setNext_device_code(next_device_codecode); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/StandardEmptyPalletSiteDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/StandardEmptyPalletSiteDeviceDriver.java index d3aebe8..b36ed89 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/StandardEmptyPalletSiteDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_emptypallet_site/StandardEmptyPalletSiteDeviceDriver.java @@ -222,7 +222,7 @@ public class StandardEmptyPalletSiteDeviceDriver extends AbstractOpcDeviceDriver } else if (mode == 2) { try { -// if (StrUtil.isEmpty(container)) { +// if (StrUtil.isBlank(container)) { // //判断条码是否为空,否则申请任务 // return; // } @@ -374,7 +374,7 @@ public class StandardEmptyPalletSiteDeviceDriver extends AbstractOpcDeviceDriver List container_instructions = new ArrayList(); String barcode = this.getLast_container(); - if (!StrUtil.isEmpty(barcode)) { + if (!StrUtil.isBlank(barcode)) { Map map = new HashMap(); map.put("vehicle_code", barcode); container_instructions = instructionService.queryAll(map); @@ -438,17 +438,16 @@ public class StandardEmptyPalletSiteDeviceDriver extends AbstractOpcDeviceDriver if (instruction != null) { instruction_num = Integer.parseInt(instruction.getInstruction_code()); } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, 1); itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java index 2b3405e..35aee61 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_inspect_site/StandardInspectSiteDeviceDriver.java @@ -188,7 +188,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp dto.setPriority("101"); // RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code()); // String next_device_codecode = jo.getNext_device_code(); -// if(StrUtil.isEmpty(next_device_codecode)){ +// if(StrUtil.isBlank(next_device_codecode)){ // throw new RuntimeException("该设备未找到对应路由"); // } dto.setNext_point_code(this.getDeviceCode()); @@ -262,7 +262,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp // dto.setPriority("101"); // RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code()); // String next_device_codecode = jo.getNext_device_code(); -// if(StrUtil.isEmpty(next_device_codecode)){ +// if(StrUtil.isBlank(next_device_codecode)){ // throw new RuntimeException("该设备未找到对应路由"); // } // dto.setNext_point_code(next_device_codecode); @@ -351,28 +351,26 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp if (instruction != null) { instruction_num = Integer.parseInt(instruction.getInstruction_code()); } - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, 1); itemMap.put(to_task, instruction_num); - ReadUtil.write(itemMap, server); + this.control(itemMap); } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -383,8 +381,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp + "." + 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); if (type == 1) { itemMap.put(to_command, command); @@ -394,7 +391,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp } else if (type == 3) { itemMap.put(to_task, command); } - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -430,7 +427,7 @@ public class StandardInspectSiteDeviceDriver extends AbstractOpcDeviceDriver imp dto.setPriority("101"); RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code()); String next_device_codecode = jo.getNext_device_code(); - if (StrUtil.isEmpty(next_device_codecode)) { + if (StrUtil.isBlank(next_device_codecode)) { throw new RuntimeException("该设备未找到对应路由"); } dto.setNext_point_code(next_device_codecode); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java index 8688d29..f1258c2 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_ordinary_site/StandardOrdinarySiteDeviceDriver.java @@ -189,7 +189,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple } } } - if (StrUtil.isEmpty(next_device_code)) { + if (StrUtil.isBlank(next_device_code)) { throw new RuntimeException("该设备未找到对应路由"); } @@ -257,7 +257,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple } } } - if (StrUtil.isEmpty(next_device_code)) { + if (StrUtil.isBlank(next_device_code)) { throw new RuntimeException("该设备未找到对应路由"); } @@ -305,7 +305,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple dto.setPriority("101"); RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code()); String next_device_codecode = jo.getNext_device_code(); - if (StrUtil.isEmpty(next_device_codecode)) { + if (StrUtil.isBlank(next_device_codecode)) { throw new RuntimeException("该设备未找到对应路由"); } dto.setNext_point_code(next_device_codecode); @@ -354,7 +354,7 @@ public class StandardOrdinarySiteDeviceDriver extends AbstractDeviceDriver imple dto.setQuantity(new BigDecimal(this.getQty())); RouteLineDto jo = routelineserver.findByCode(this.getDevice().getDevice_code()); String next_device_codecode = jo.getNext_device_code(); - if (StrUtil.isEmpty(next_device_codecode)) { + if (StrUtil.isBlank(next_device_codecode)) { throw new RuntimeException("该设备未找到对应路由"); } diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_rgv/StandardRGVDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_rgv/StandardRGVDeviceDriver.java index 870c065..60ffc6b 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_rgv/StandardRGVDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_rgv/StandardRGVDeviceDriver.java @@ -234,18 +234,17 @@ public class StandardRGVDeviceDriver extends AbstractOpcDeviceDriver implements } public void executing(Server server, Map itemMap) { - ReadUtil.write(itemMap, server); + this.control(itemMap); } 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; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, command); - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -258,8 +257,7 @@ public class StandardRGVDeviceDriver extends AbstractOpcDeviceDriver implements + "." + ItemProtocol.item_to_onset; String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_task; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); if (type == 1) { itemMap.put(to_command, command); @@ -269,7 +267,7 @@ public class StandardRGVDeviceDriver extends AbstractOpcDeviceDriver implements } else if (type == 3) { itemMap.put(to_task, command); } - ReadUtil.write(itemMap, server); + this.control(itemMap); } @@ -282,14 +280,13 @@ public class StandardRGVDeviceDriver extends AbstractOpcDeviceDriver implements + "." + ItemProtocol.item_to_onset; String to_task = this.getDevice().getOpc_server_code() + "." + this.getDevice().getOpc_plc_code() + "." + this.getDevice().getDevice_code() + "." + ItemProtocol.item_to_task; - String opcservcerid = this.getDevice().getOpc_server_id(); - Server server = ReadUtil.getServer(opcservcerid); + Map itemMap = new HashMap(); itemMap.put(to_command, 1); itemMap.put(to_onset,appService.findDeviceByCode(inst.getStart_device_code()).getAddress()); itemMap.put(to_target,appService.findDeviceByCode(inst.getNext_device_code()).getAddress()); itemMap.put(to_task, inst.getInstruction_code()); - ReadUtil.write(itemMap, server); + this.control(itemMap); } /** diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_scanner/StandardScannerDeviceDriver.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_scanner/StandardScannerDeviceDriver.java index 93dced7..317d800 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_scanner/StandardScannerDeviceDriver.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/standard_scanner/StandardScannerDeviceDriver.java @@ -26,12 +26,12 @@ public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements public String getIp() { String ip = (String) this.getDevice().getExtraValue().get("scannerIP"); - return StrUtil.isEmpty(ip) ? null : ip; + return StrUtil.isBlank(ip) ? null : ip; } public String readBarcode() throws Exception { String ip = this.getIp(); - if (StrUtil.isEmpty(ip)) { + if (StrUtil.isBlank(ip)) { throw new Exception("ip未配置"); } else { String result = (String) this.accessor_value.getValue(this.getIp()); @@ -41,7 +41,7 @@ public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements public void writeBarcode(String barcode) throws Exception { String ip = this.getIp(); - if (StrUtil.isEmpty(ip)) { + if (StrUtil.isBlank(ip)) { throw new Exception("ip未配置"); } else { this.accessor_value.setValueWithPersistence(this.getIp(), barcode); @@ -50,7 +50,7 @@ public class StandardScannerDeviceDriver extends AbstractDeviceDriver implements public void cleanBarcode() throws Exception { String ip = this.getIp(); - if (StrUtil.isEmpty(ip)) { + if (StrUtil.isBlank(ip)) { throw new Exception("ip未配置"); } else { this.accessor_value.setValueWithPersistence(this.getIp(), (Object) null); diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/JsonUtl.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/JsonUtl.java new file mode 100644 index 0000000..d60d403 --- /dev/null +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/ext/wms/data/JsonUtl.java @@ -0,0 +1,125 @@ +package org.nl.acs.ext.wms.data; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.module.SimpleModule; +import com.fasterxml.jackson.databind.type.TypeFactory; + +import java.io.IOException; +import java.util.List; +import java.util.Map; + +public class JsonUtl { + private static ObjectMapper objectMapper = null; + private static ObjectMapper objectMapperLog = null; + + private JsonUtl() { + } + + private static ObjectMapper init() { + ObjectMapper objectMapper = new ObjectMapper(); + SimpleModule simpleModule = new SimpleModule(); +// simpleModule.addSerializer(Enum.class, new EnumSerializer()); +// simpleModule.addSerializer(Date.class, new DateSerializer()); +// simpleModule.addDeserializer(Enum.class, new EnumDeserializer()); +// simpleModule.addDeserializer(Date.class, new DateDeserializers.DateDeserializer()); + objectMapper.registerModule(simpleModule); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + return objectMapper; + } + + public static ObjectMapper getInstance() { + if (objectMapper == null) { + Class var0 = JsonUtl.class; + synchronized(JsonUtl.class) { + if (objectMapper == null) { + objectMapper = init(); + } + } + } + + return objectMapper; + } + + public static ObjectMapper getInstanceLog() { + if (objectMapperLog == null) { + Class var0 = JsonUtl.class; + synchronized(JsonUtl.class) { + if (objectMapperLog == null) { + objectMapperLog = init(); + objectMapperLog.setSerializationInclusion(Include.NON_NULL); + } + } + } + + return objectMapperLog; + } + + public static ObjectMapper getObjectMapper() { + return getInstance(); + } + + public static String parse(Object object) throws RuntimeException { + try { + return getObjectMapper().writeValueAsString(object); + } catch (JsonProcessingException var2) { + throw new RuntimeException(var2); + } + } + + public static String parseWithoutException(Object object) { + try { + return parse(object); + } catch (Exception var2) { + return null; + } + } + + public static String parseLog(Object object) { + try { + return getInstanceLog().writeValueAsString(object); + } catch (Exception var2) { + return null; + } + } + + public static T format(String json, Class clazz) throws RuntimeException { + try { + return getObjectMapper().readValue(json, clazz); + } catch (IOException var3) { + throw new RuntimeException(var3); + } + } + + public static List formatList(String json, Class clazz) throws RuntimeException { + try { + JavaType type = getObjectMapper().getTypeFactory().constructParametricType(List.class, new Class[]{clazz}); + return (List)getObjectMapper().readValue(json, type); + } catch (IOException var3) { + throw new RuntimeException(var3); + } + } + + public static Map formatMap(String json, Class clazzKey, Class clazzValue) throws RuntimeException { + try { + JavaType type = getObjectMapper().getTypeFactory().constructParametricType(Map.class, new Class[]{clazzKey, clazzValue}); + return (Map)getObjectMapper().readValue(json, type); + } catch (IOException var4) { + throw new RuntimeException(var4); + } + } + + public static List> formatListTwo(String json, Class clazz) throws RuntimeException { + try { + TypeFactory typeFactory = getObjectMapper().getTypeFactory(); + JavaType type = typeFactory.constructParametrizedType(List.class, List.class, new Class[]{clazz}); + type = typeFactory.constructParametrizedType(List.class, List.class, new JavaType[]{type}); + return (List)getObjectMapper().readValue(json, type); + } catch (IOException var4) { + throw new RuntimeException(var4); + } + } +} diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/logicflow/service/impl/StageServiceImpl.java b/acs/hd/nladmin-system/src/main/java/org/nl/logicflow/service/impl/StageServiceImpl.java index 50e148a..a519602 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/logicflow/service/impl/StageServiceImpl.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/logicflow/service/impl/StageServiceImpl.java @@ -843,9 +843,9 @@ public class StageServiceImpl implements StageService { } String onoff_status = ""; - if (lnshPackagePalletManipulatorDeviceDriver.getOnoff_status() == 1) { + if (lnshPackagePalletManipulatorDeviceDriver.getOnoff_status() == 0) { onoff_status = "关机"; - } else if (lnshPackagePalletManipulatorDeviceDriver.getOnoff_status() == 2) { + } else if (lnshPackagePalletManipulatorDeviceDriver.getOnoff_status() == 1) { onoff_status = "开机"; } diff --git a/acs/hd/nladmin-system/src/main/resources/config/application-prod.yml b/acs/hd/nladmin-system/src/main/resources/config/application-prod.yml index 3c45978..8be2d61 100644 --- a/acs/hd/nladmin-system/src/main/resources/config/application-prod.yml +++ b/acs/hd/nladmin-system/src/main/resources/config/application-prod.yml @@ -14,10 +14,7 @@ spring: db-type: com.alibaba.druid.pool.DruidDataSource driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:jn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true - # url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:rljn_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true username: ${DB_USER:root} - # password: ${DB_PWD:P@ssw0rd} - # password: ${DB_PWD:Root.123456} password: ${DB_PWD:123456} # 初始连接数 initial-size: 5 diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/common/wql/QSTRUCT_RULE.wql b/wms/hd/nladmin-system/src/main/java/org/nl/wms/common/wql/QSTRUCT_RULE.wql index 818357e..9e6590e 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/common/wql/QSTRUCT_RULE.wql +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/common/wql/QSTRUCT_RULE.wql @@ -292,7 +292,7 @@ IF 输入.flag = "9" LEFT JOIN st_rule_IOdisStruct ruledis ON ruledis.struct_uuid = ivt.struct_id LEFT JOIN md_me_material material ON material.material_id = ivt.material_id WHERE - ivt.canuse_qty > 0 + ivt.canuse_qty >= 0 AND point.point_status = '02' AND point.lock_type = '00' AND point.is_used = '1' @@ -326,7 +326,7 @@ IF 输入.flag = "10" LEFT JOIN sch_base_point point ON point.point_id = ivt.struct_id left join st_rule_IOdisStruct ruledis on ruledis.struct_uuid = ivt.struct_id WHERE - ivt.canuse_qty > 0 + ivt.canuse_qty >= 0 AND point.point_status = '02' AND point.lock_type = '00' AND point.is_used ='1' @@ -425,7 +425,7 @@ IF 输入.flag = "14" LEFT JOIN st_rule_IOdisStruct ruledis ON ruledis.struct_uuid = ivt.struct_id LEFT JOIN md_me_material material ON material.material_id = ivt.material_id WHERE - ivt.canuse_qty > 0 + ivt.canuse_qty >= 0 AND point.point_status = '02' AND point.lock_type = '00' AND point.is_used = '1' diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/pda/sendMaterial/wql/QPADSERVICE.wql b/wms/hd/nladmin-system/src/main/java/org/nl/wms/pda/sendMaterial/wql/QPADSERVICE.wql index 3b63738..c1f18f1 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/pda/sendMaterial/wql/QPADSERVICE.wql +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/pda/sendMaterial/wql/QPADSERVICE.wql @@ -172,7 +172,7 @@ LEFT JOIN sch_base_point point ON point_uuid = ivt.struct_uuid where 1=1 - and ivt.canuse_qty>0 + and ivt.canuse_qty>=0 OPTION 输入.material_uuid <> "" ivt.material_uuid = 输入.material_uuid ENDOPTION @@ -241,7 +241,7 @@ LEFT JOIN sch_base_point point ON point_uuid = ivt.struct_uuid where ivt.quality_status in(1,2) - and ivt.canuse_qty>0 + and ivt.canuse_qty>=0 OPTION 输入.material_uuid <> "" ivt.material_uuid = 输入.material_uuid ENDOPTION diff --git a/wms/hd/nladmin-system/src/main/java/org/nl/wms/st/out/service/wql/ST_WorkprocedureiosOut_01.wql b/wms/hd/nladmin-system/src/main/java/org/nl/wms/st/out/service/wql/ST_WorkprocedureiosOut_01.wql index 2500258..9b81bde 100644 --- a/wms/hd/nladmin-system/src/main/java/org/nl/wms/st/out/service/wql/ST_WorkprocedureiosOut_01.wql +++ b/wms/hd/nladmin-system/src/main/java/org/nl/wms/st/out/service/wql/ST_WorkprocedureiosOut_01.wql @@ -87,7 +87,7 @@ point.is_delete = '0' AND point.point_type = '02' AND point.lock_type = '00' - AND structivt.canuse_qty > 0 + AND structivt.canuse_qty >= 0 AND point.is_used = '1' and structivt.workprocedure_id = 输入.ivt_workprocedure_id and structivt.is_full = 输入.is_full