新增小称

This commit is contained in:
张江玮
2022-09-20 18:19:20 +08:00
parent aad16643ee
commit 3fee17cbe7
3 changed files with 51 additions and 0 deletions

View File

@@ -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;
}

View File

@@ -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;
}

View File

@@ -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;