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 51f78efd..eb5b2680 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 @@ -4888,6 +4888,8 @@ public class AutoformulaServiceImpl implements AutoformulaService { * @return */ JSONObject autoCalculationBy03_ruanfei(JSONObject json){ + WQLObject MD_PD_ProductMaterialSet = WQLObject.getWQLObject("MD_PD_ProductMaterialSet"); + WQLObject MD_PD_FormingMaterial = WQLObject.getWQLObject("MD_PD_FormingMaterial"); //定义返回值 JSONObject ret = new JSONObject(); ret.put("chunfen_qty","-1"); @@ -5205,7 +5207,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { ret.put("chunfen_qty",sum_chunfen.get()); rf_list2 = new JSONArray(); xl_list2 = new JSONArray(); - cxj_list = new JSONArray(); +// cxj_list = new JSONArray(); yzj_list = new JSONArray(); cw_list = new JSONArray(); }else{ @@ -5406,7 +5408,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { //若Cp<=Wp,更新Wp=Wp-Cp,结束 if(Cp<=W){ if(Cp>0){ - if(Cp > cw_limit_down){ + if(true){//Cp > cw_limit_down JSONObject C_weight = new JSONObject(); C_weight.put("formula_qty",Cp); //钨分类id @@ -5425,7 +5427,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { double Wp = NumberUtil.round(W-Cp,6).doubleValue(); if(Wp>0){ - if(Wp > cw_limit_down){ + if(true){//(Wp > cw_limit_down JSONObject W_weight = new JSONObject(); W_weight.put("formula_qty",NumberUtil.round(Wp,6).doubleValue()); //钨分类id @@ -5578,7 +5580,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { if(C_bu>0){ //Wp=Wp+W补 Cp = Cp + C_bu; - if(Cp > cw_limit_down){ + if(true){//cw_limit_down //计算非碳化钨需补重量 double finalR3p_jian = R3p_jian; bj_bomdlts_map.forEach((key, bj_bomdlt)->{ @@ -5691,7 +5693,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { if(C_bu>0){ //Wp=Wp+W补 Cp = Cp + C_bu; - if(Cp > cw_limit_down){ + if(true){//Cp > cw_limit_down JSONObject C_weight = new JSONObject(); C_weight.put("formula_qty",Cp); //钨分类id @@ -5914,7 +5916,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { }else{ //Wp=Wp+W补 W = W + W_bu; - if(W <= cw_limit_down){ + if(true){//W <= cw_limit_down //用新料补足剩余部分 bomdlts_need_map.forEach((key,bomdlt)->{ //获取Y1、X1、X2….剩余>0的物料 @@ -6024,7 +6026,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { } //Wp=Wp+W补 W = W + W_bu; - if(W <= cw_limit_down){ + if(true){//W <= cw_limit_down //用新料补足剩余部分 bomdlts_need_map.forEach((key,bomdlt)->{ //获取Y1、X1、X2….剩余>0的物料 @@ -6108,6 +6110,85 @@ public class AutoformulaServiceImpl implements AutoformulaService { throw new BadRequestException("满足条件的软废库存为0,请按其他模式配粉!"); } } + //3.计算成型剂 + JSONArray bomdlts2 = WQL.getWO("QPF_AUTOFORMULA01") + .addParam("material_id",material_id) + .addParam("is_need_manage","0") + .addParam("flag","1") + .process().getResultJSONArray(0); + //各成型剂需配总量 + HashMap bomdlts2_map = new HashMap(); + for(int i=0;i{ + String set_material_id = rf_dis.getString("material_id"); + //R1p*纯粉系数 + double net_rate_qty = rf_dis.getDouble("formula_qty")*net_rate_map.get(set_material_id)/100.0; +// double net_rate_qty = rf_dis.getDouble("net_rate_qty"); + JSONObject ProductMaterialSet = MD_PD_ProductMaterialSet.query("set_type='02' and material_id='"+material_id+"' and set_material_id='"+set_material_id+"'").uniqueResult(0); + if(ProductMaterialSet == null){ + throw new BadRequestException("产品"+material_code+"未配置改配模式可配粉软废信息!"); + } + //是否计算成型剂 + String is_calculate_forming = ProductMaterialSet.getString("is_calculate_forming"); + if("1".equals(is_calculate_forming)){ + //循环成型剂 + for(int k=0;k{ + //需配成型剂重量 + double formula_qty = bomdlts2_now.getDouble("formula_qty"); + //当前软废已配 + double now_formula_qty = bomdlts2_now.getDouble("now_formula_qty"); + //已配小于需配 + if(now_formula_qty