From 18f773cabb7c36f7acbe6b0ed3bfb125f7aaaec2 Mon Sep 17 00:00:00 2001 From: zds <2388969634@qq.com> Date: Mon, 26 Dec 2022 10:39:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/AutoformulaServiceImpl.java | 32 +++++++++++++++++++ .../org/nl/wms/pf/wql/QPF_AUTOFORMULA02.wql | 20 ++++++++++++ .../views/wms/pf/initformula/DivDialog.vue | 23 +++++-------- 3 files changed, 60 insertions(+), 15 deletions(-) diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/AutoformulaServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/AutoformulaServiceImpl.java index e78d38b0..e8199058 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/AutoformulaServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/AutoformulaServiceImpl.java @@ -4520,6 +4520,8 @@ public class AutoformulaServiceImpl implements AutoformulaService { * @return */ JSONObject autoCalculationBy03(JSONObject json){ + // + WQLObject PDM_BI_WasteBallTime = WQLObject.getWQLObject("PDM_BI_WasteBallTime"); //工令 String workorder_id = json.getString("workorder_id"); //软废下限 @@ -4550,6 +4552,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { double net_qty = workorder_qty; double chunfen_qty = -1; + double ball_time = -1; //rf最高开单重量 HashMap rf_plan_map = new HashMap(); @@ -4715,11 +4718,39 @@ public class AutoformulaServiceImpl implements AutoformulaService { tableDtl.add(jo); }); } + List doubles = new ArrayList(); rf_list.forEach((value)->{ JSONObject jo = (JSONObject) value; jo.put("bucket_type","01"); tableDtl.add(jo); + + //获取bom第一个碳化钨 + JSONObject bomdtl = WQL.getWO("QPF_AUTOFORMULA02") + .addParam("material_id",jo.getString("material_id")) + .addParam("flag","8") + .process() + .uniqueResult(0); + + if(bomdtl!=null){ + JSONObject WasteBallTime = PDM_BI_WasteBallTime.query("material_id='"+bomdtl.getString("material_id")+"'").uniqueResult(0); + if(WasteBallTime!=null){ + String mater_code = jo.getString("material_code"); + String[] strs = mater_code.split("-"); + + String brf = strs[strs.length-1]; + + String now_qty = WasteBallTime.getString( brf.toLowerCase()+"_qty"); + if (StrUtil.isNotEmpty(now_qty)) { + doubles.add(Double.valueOf(now_qty)); + } + } + } }); + //进行集合排序 + Collections.sort(doubles, Collections.reverseOrder()); + if(doubles.size()>0){ + ball_time = doubles.get(0); + } yzj_list.forEach((value)->{ JSONObject jo = (JSONObject) value; jo.put("is_need_manage","1"); @@ -4842,6 +4873,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { JSONObject result = new JSONObject(); result.put("tableDtl",dtl_new); result.put("chunfen_qty",chunfen_qty); + result.put("ball_time",ball_time); return result; } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/wql/QPF_AUTOFORMULA02.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/wql/QPF_AUTOFORMULA02.wql index 92921f43..361186df 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/wql/QPF_AUTOFORMULA02.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/wql/QPF_AUTOFORMULA02.wql @@ -350,3 +350,23 @@ ENDQUERY ENDIF + IF 输入.flag = "8" + QUERY + SELECT + bomdtl.* + FROM + MD_PD_ProductBOM bom + LEFT JOIN md_pd_productbomdtl bomdtl ON bom.bom_id = bomdtl.bom_id + WHERE + 1 = 1 + AND bom.is_delete = '0' + AND bom.is_used = '1' + AND bomdtl.material_prop_scode = '09030101' + OPTION 输入.material_id <> "" + bom.material_id = 输入.material_id + ENDOPTION + ORDER BY bomdtl.seqno DESC + ENDSELECT + ENDQUERY + ENDIF + diff --git a/mes/qd/src/views/wms/pf/initformula/DivDialog.vue b/mes/qd/src/views/wms/pf/initformula/DivDialog.vue index 0a5204ca..3bd2e09a 100644 --- a/mes/qd/src/views/wms/pf/initformula/DivDialog.vue +++ b/mes/qd/src/views/wms/pf/initformula/DivDialog.vue @@ -431,6 +431,7 @@ export default { mstrow: {}, tabledis: [], XLList: [], + ball_time: '0', chunfen_qty: '0', form: { waste_limit_down: 0, waste_limit_uo: 0 }, form2: { @@ -1104,11 +1105,16 @@ export default { .then(_ => { this.form.workorder_qty = parseFloat(this.chunfen_qty) this.fullscreenLoading = true - autoformula.autoCalculation(this.form).then(res => { + autoformula.autoCalculation(this.form).then(res2 => { this.crud.notify('自动计算成功!') - this.tableDtl = res.tableDtl + debugger + this.tableDtl = res2.tableDtl this.form2.total_qty1 = 0 this.form2.add_qty1 = 0 + this.ball_time = res2.ball_time + if ((parseFloat(this.ball_time) > 0)) { + this.form.ball_time = parseFloat(this.ball_time) + } for (let i = 0; i < this.tableDtl.length; i++) { const row = this.tableDtl[i] row.edit = true @@ -1119,19 +1125,6 @@ export default { } this.tableDtl.splice(i, 1, row) } - /* this.tabledis = res.tabledis - this.form2.total_qty2 = 0 - this.form2.add_qty2 = 0 - for (let i = 0; i < this.tabledis.length; i++) { - const row = this.tabledis[i] - row.edit = true - if (row.is_need_manage === '1') { - this.form2.total_qty2 = this.form2.total_qty2 + parseFloat(row.formula_qty) - } else { - this.form2.add_qty2 = this.form2.add_qty2 + parseFloat(row.formula_qty) - } - this.tabledis.splice(i, 1, row) - }*/ this.fullscreenLoading = false }).catch(() => { this.fullscreenLoading = false