From 370716346afe816e154f58a9f3e66798e96b33d8 Mon Sep 17 00:00:00 2001 From: liyongde <1419499670@qq.com> Date: Sun, 30 Mar 2025 19:19:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AE=A1=E8=8A=AF=E5=BA=93=E5=90=AF?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../wms/sch/manage/AutoCallEmptyVehicle.java | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCallEmptyVehicle.java b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCallEmptyVehicle.java index 4a2c39db2..bbef2f09b 100644 --- a/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCallEmptyVehicle.java +++ b/lms/nladmin-system/src/main/java/org/nl/wms/sch/manage/AutoCallEmptyVehicle.java @@ -384,49 +384,49 @@ public class AutoCallEmptyVehicle { JSONArray device_ja = new JSONArray(); device_ja.add(device_jo); // 获取管芯数据 -// JSONObject device_data = wmsToAcsService.getPointStatus(device_ja); -// JSONObject data = device_data.getJSONArray("data").getJSONObject(0); + JSONObject device_data = wmsToAcsService.getPointStatus(device_ja); + JSONObject data = device_data.getJSONArray("data").getJSONObject(0); JSONArray task_rows = new JSONArray(); boolean same_flag = false; // todo: 临时测试 // 原:false - boolean need_cz = true; -// for (int i = 0; i < rows.size(); i++) { -// JSONObject row = rows.getJSONObject(i); -// int num = row.getIntValue("num"); -// if (num == 2) { -// same_flag = true; -// } -// String material_code = row.getString("paper_code"); -// for (int j = 1; j < 13; j++) { -// String material_key = "material" + j; -// String qty_key = "qty" + j; -// String ivt_code = data.getString(material_key); -// int ivt_num = data.getIntValue(qty_key); -// if (StrUtil.isNotEmpty(ivt_code) && ivt_code.equals(material_code)) { -// JSONObject task_jo = new JSONObject(); -// task_jo.put("device_code", j); -// task_jo.put("material_code", material_code); -// if (ivt_num >= num) { -// task_jo.put("qty", num); -// num = 0; -// } else { -// task_jo.put("qty", ivt_num); -// num -= ivt_num; -// } -// task_rows.add(task_jo); -// if (num == 0) { -// break; -// } -// } -// -// } -// if (num > 0) { -// log.info("子卷号为:" + row.getString("pcsn") + "所需的纸管在纸管库中库存不足!不进行套管"); -// } else { -// need_cz = true; -// } -// } + boolean need_cz = false; + for (int i = 0; i < rows.size(); i++) { + JSONObject row = rows.getJSONObject(i); + int num = row.getIntValue("num"); + if (num == 2) { + same_flag = true; + } + String material_code = row.getString("paper_code"); + for (int j = 1; j < 13; j++) { + String material_key = "material" + j; + String qty_key = "qty" + j; + String ivt_code = data.getString(material_key); + int ivt_num = data.getIntValue(qty_key); + if (StrUtil.isNotEmpty(ivt_code) && ivt_code.equals(material_code)) { + JSONObject task_jo = new JSONObject(); + task_jo.put("device_code", j); + task_jo.put("material_code", material_code); + if (ivt_num >= num) { + task_jo.put("qty", num); + num = 0; + } else { + task_jo.put("qty", ivt_num); + num -= ivt_num; + } + task_rows.add(task_jo); + if (num == 0) { + break; + } + } + + } + if (num > 0) { + log.info("子卷号为:" + row.getString("pcsn") + "所需的纸管在纸管库中库存不足!不进行套管"); + } else { + need_cz = true; + } + } if (need_cz) { //生成出纸管的任务 JSONObject jo = new JSONObject();