优化
This commit is contained in:
@@ -3567,6 +3567,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}else{
|
||||
bomdlt.put("need_qty", "0");
|
||||
bomdlt.put("formula_qty", "0");
|
||||
//
|
||||
bomdlt.put("is_flag","0");
|
||||
bomdlts_need_map.put(bomdlt.getString("material_id"),bomdlt);
|
||||
}
|
||||
@@ -3856,8 +3857,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
double Y1_bu = finalR3p_jian *standard_rate;
|
||||
//Y12p=Y12p+Y1补
|
||||
Y1p = Y1p + Y1_bu;
|
||||
now_bomdtl.put("formula_qty",Y1p+now_bomdtl.getDouble("need_qty"));
|
||||
now_bomdtl.put("need_qty",Y1p+now_bomdtl.getDouble("need_qty"));
|
||||
now_bomdtl.put("formula_qty",Y1p);
|
||||
now_bomdtl.put("need_qty",Y1p);
|
||||
now_bomdtl.put("is_flag","-1");
|
||||
bomdlts_need_map.put(key,now_bomdtl);
|
||||
}
|
||||
@@ -3959,8 +3960,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
//Y12p=Y12p+Y1补
|
||||
Y1p = Y1p + Y1_bu;
|
||||
}
|
||||
now_bomdtl.put("formula_qty",Y1p+now_bomdtl.getDouble("need_qty"));
|
||||
now_bomdtl.put("need_qty",Y1p+now_bomdtl.getDouble("need_qty"));
|
||||
now_bomdtl.put("formula_qty",Y1p);
|
||||
now_bomdtl.put("need_qty",Y1p);
|
||||
now_bomdtl.put("is_flag","-1");
|
||||
bomdlts_need_map.put(key,now_bomdtl);
|
||||
}
|
||||
@@ -4164,8 +4165,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
double Y1_bu = R3p_jian *(standard_rate/100.0);
|
||||
//Y12p=Y12p+Y1补
|
||||
Y1p = Y1p + Y1_bu;
|
||||
now_bomdtl.put("formula_qty",Y1p+now_bomdtl.getDouble("need_qty"));
|
||||
now_bomdtl.put("need_qty",Y1p+now_bomdtl.getDouble("need_qty"));
|
||||
now_bomdtl.put("formula_qty",Y1p);
|
||||
now_bomdtl.put("need_qty",Y1p);
|
||||
now_bomdtl.put("is_flag","-1");
|
||||
bomdlts_need_map.put(key,now_bomdtl);
|
||||
}
|
||||
@@ -4240,8 +4241,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
//Y12p=Y12p+Y1补
|
||||
Y1p = Y1p + Y1_bu;
|
||||
}
|
||||
now_bomdtl.put("formula_qty",Y1p+now_bomdtl.getDouble("need_qty"));
|
||||
now_bomdtl.put("need_qty",Y1p+now_bomdtl.getDouble("need_qty"));
|
||||
now_bomdtl.put("formula_qty",Y1p);
|
||||
now_bomdtl.put("need_qty",Y1p);
|
||||
now_bomdtl.put("is_flag","-1");
|
||||
bomdlts_need_map.put(key,now_bomdtl);
|
||||
}
|
||||
@@ -4368,14 +4369,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
});
|
||||
//处理新料
|
||||
JSONArray xl_list3 = new JSONArray();
|
||||
for(int i=0;i<xl_list.size();i++){
|
||||
JSONObject jo_now = xl_list.getJSONObject(i);
|
||||
JSONObject bomdlts_jo = bomdlts_need_map.get(jo_now.getString("material_id"));
|
||||
if(!bomdlts_jo.getString("is_flag").equals("-1")){
|
||||
xl_list3.add(jo_now);
|
||||
}
|
||||
}
|
||||
//重新分配总需配库存
|
||||
bomdlts_need_map.forEach((key,bomdlts_plan)->{
|
||||
//不用添加新料的部分
|
||||
if(bomdlts_plan.getString("is_flag").equals("0")){
|
||||
bomdlts_plan.put("formula_qty","0");
|
||||
bomdlts_plan.put("is_rf_xl","1");
|
||||
@@ -4385,7 +4381,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
//bomdlts_plan.put("is_active","1");
|
||||
//bomdlts_plan.put("quality_scode","01");
|
||||
xl_list3.add(bomdlts_plan);
|
||||
}else if(bomdlts_plan.getString("is_flag").equals("-1")){
|
||||
}else
|
||||
//额外补料部分
|
||||
if(bomdlts_plan.getString("is_flag").equals("-1")){
|
||||
String bomdtl_material_id = bomdlts_plan.getString("material_id");
|
||||
double left_qty = bomdlts_plan.getDouble("formula_qty");
|
||||
left_qty = NumberUtil.round(left_qty,3).doubleValue();
|
||||
@@ -4457,7 +4455,17 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
//除了is_flag为-1的在上面代码已重新分配过,其他直接加入 xl_list3
|
||||
for(int i=0;i<xl_list.size();i++){
|
||||
JSONObject jo_now = xl_list.getJSONObject(i);
|
||||
JSONObject bomdlts_jo = bomdlts_need_map.get(jo_now.getString("material_id"));
|
||||
if(bomdlts_jo!=null){
|
||||
//为1表示未补料未重新分配过需配库存
|
||||
if(!bomdlts_jo.getString("is_flag").equals("-1")){
|
||||
xl_list3.add(jo_now);
|
||||
}
|
||||
}
|
||||
}
|
||||
//汇总新料库存
|
||||
HashMap<String,JSONObject> xl_list_map = new HashMap<String,JSONObject>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user