From 3fee17cbe796a10b206c1d726cdcf4c6371f46ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E6=B1=9F=E7=8E=AE?= Date: Tue, 20 Sep 2022 18:19:20 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B0=8F=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../whxr/whxr_weighing/ItemProtocol.java | 6 +++ .../whxr_weighing/WhxrWeighingDefination.java | 1 + .../WhxrWeighingDeviceDriver.java | 44 +++++++++++++++++++ 3 files changed, 51 insertions(+) diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/whxr/whxr_weighing/ItemProtocol.java b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/whxr/whxr_weighing/ItemProtocol.java index 7fa616a..5c0fc25 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/whxr/whxr_weighing/ItemProtocol.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/whxr/whxr_weighing/ItemProtocol.java @@ -45,6 +45,7 @@ public class ItemProtocol { public static String item_to_middle_scale_error = "to_middle_scale_error"; public static String item_to_big_scale_error = "to_big_scale_error"; public static String item_to_formuladtl_id = "to_formuladtl_id"; + public static String item_small_scale_weight = "small_scale_weight"; private WhxrWeighingDeviceDriver driver; @@ -180,6 +181,10 @@ public class ItemProtocol { return this.getOpcStringValue(item_to_formuladtl_id); } + public Float getSmall_scale_weight() { + return this.getOpcFloatValue(item_small_scale_weight); + } + //是否有货 public int hasGoods(int move) { return move; @@ -243,6 +248,7 @@ public class ItemProtocol { list.add(new ItemDto(item_middle_scale_error, "中秤误差值", "DB600.REAL200")); list.add(new ItemDto(item_big_scale_error, "大秤误差值", "DB600.REAL204")); list.add(new ItemDto(item_formuladtl_id, "配方明细标识", "DB600.STRING208.50")); + list.add(new ItemDto(item_small_scale_weight, "小称当前重量", "DB600.REAL260")); return list; } diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/whxr/whxr_weighing/WhxrWeighingDefination.java b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/whxr/whxr_weighing/WhxrWeighingDefination.java index 05cb887..cbe6821 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/whxr/whxr_weighing/WhxrWeighingDefination.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/whxr/whxr_weighing/WhxrWeighingDefination.java @@ -78,6 +78,7 @@ public class WhxrWeighingDefination implements OpcDeviceDriverDefination { list.add(new ItemDto(ItemProtocol.item_middle_scale_error, "中秤误差值", "DB600.REAL812")); list.add(new ItemDto(ItemProtocol.item_big_scale_error, "大秤误差值", "DB600.REAL816")); list.add(new ItemDto(ItemProtocol.item_formuladtl_id, "配方明细标识", "DB600.S820")); + list.add(new ItemDto(ItemProtocol.item_small_scale_weight, "小称当前重量", "DB600.REAL1076")); return list; } diff --git a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/whxr/whxr_weighing/WhxrWeighingDeviceDriver.java b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/whxr/whxr_weighing/WhxrWeighingDeviceDriver.java index e6275e3..bb9a3ac 100644 --- a/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/whxr/whxr_weighing/WhxrWeighingDeviceDriver.java +++ b/hd/nladmin-system/src/main/java/org/nl/acs/device_driver/whxr/whxr_weighing/WhxrWeighingDeviceDriver.java @@ -89,6 +89,9 @@ public class WhxrWeighingDeviceDriver extends AbstractOpcDeviceDriver implements String formuladtl_id = ""; Float masterbucket_qty = 0.0f; + // 小称当前重量 + Float small_scale_weight = 0.0f; + boolean requireSucess = false; int branchProtocol = 0; @@ -266,6 +269,47 @@ public class WhxrWeighingDeviceDriver extends AbstractOpcDeviceDriver implements enter(json); } break; + case 9: + // 小称单桶投料确认 + if (!requireSucess && ObjectUtil.isNotEmpty(this.material_code) + && !this.material_code.equals("0") + && !StrUtil.equals(this.bucketunique, "0") + && ObjectUtil.isNotEmpty(this.bucketunique)) { + JSONObject json = new JSONObject(); + json.put("device_code", this.getDeviceCode()); + json.put("type", "1.3"); + json.put("formula_code", formula_code); + json.put("material_code", material_code); + json.put("abarrel_weighing", abarrel_weighing); + json.put("last_abarrel_weighing", last_abarrel_weighing); + json.put("needout_qty", needout_qty); + json.put("formuladtl_id", formuladtl_id); + json.put("bucketunique", bucketunique); + json.put("masterbucket_qty", masterbucket_qty); + json.put("all_weight", all_weight); + json.put("error", String.valueOf(error)); + enter(json); + } + break; + case 10: + // 小称单桶强制投料确认 + if (!requireSucess) { + JSONObject json = new JSONObject(); + json.put("device_code", this.getDeviceCode()); + json.put("type", "1.4"); + json.put("formula_code", formula_code); + json.put("material_code", material_code); + json.put("abarrel_weighing", abarrel_weighing); + json.put("last_abarrel_weighing", last_abarrel_weighing); + json.put("needout_qty", needout_qty); + json.put("formuladtl_id", formuladtl_id); + json.put("bucketunique", bucketunique); + json.put("masterbucket_qty", masterbucket_qty); + json.put("all_weight", all_weight); + json.put("error", "0"); + enter(json); + } + break; } } last_mode = mode;