优化
This commit is contained in:
@@ -123,7 +123,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
String value_is_active = "";
|
||||
if("1".equals(value)){
|
||||
value_is_active = "1";
|
||||
}//.addParam("is_active",value_is_active)
|
||||
}
|
||||
//获取库存集合
|
||||
JSONArray ivts = new JSONArray();
|
||||
for(int i=0;i<MaterialSets.size();i++){
|
||||
@@ -145,7 +145,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
for(int i=0;i<ivts.size();i++){
|
||||
JSONObject ivt = ivts.getJSONObject(i);
|
||||
String ivt_material_id = ivt.getString("material_id");
|
||||
if(ivt.getDouble("sum_ivt_qty")<=0){
|
||||
if(ivt.getDouble("sum_ivt_qty")<=0 || ivt.getDouble("sum_ivt_qty")<0.01){
|
||||
continue;
|
||||
}
|
||||
JSONObject ProductMaterialExt = MD_ME_ProductMaterialExt.query("material_id='"+ivt_material_id+"'").uniqueResult(0);
|
||||
@@ -276,6 +276,10 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
JSONArray dtl_new = new JSONArray();
|
||||
for(int i=0;i<tableDtl.size();i++){
|
||||
JSONObject jo = tableDtl.getJSONObject(i);
|
||||
double formula_qty = jo.getDouble("formula_qty");
|
||||
if(formula_qty < 0.001){
|
||||
continue;
|
||||
}
|
||||
String material_type_id = jo.getString("material_type_id");
|
||||
//成型剂
|
||||
if (StrUtil.isNotEmpty(jo.getString("formingtype_code"))) {
|
||||
@@ -376,6 +380,10 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
JSONArray tabledis_new = new JSONArray();
|
||||
for(int i=0;i<tabledis.size();i++){
|
||||
JSONObject jo = tabledis.getJSONObject(i);
|
||||
double formula_qty = jo.getDouble("formula_qty");
|
||||
if(formula_qty < 0.001){
|
||||
continue;
|
||||
}
|
||||
String material_type_id = jo.getString("material_type_id");
|
||||
//成型剂
|
||||
if (StrUtil.isNotEmpty(jo.getString("formingtype_code"))) {
|
||||
@@ -562,7 +570,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}
|
||||
for(int j=0;j<bom_materials.size();j++){
|
||||
JSONObject bom_material = bom_materials.getJSONObject(j);
|
||||
if(bom_material.getDouble("sum_ivt_qty")<=0){
|
||||
double sum_ivt_qty = bom_material.getDouble("sum_ivt_qty");
|
||||
if(sum_ivt_qty<=0 || sum_ivt_qty < 0.01){
|
||||
continue;
|
||||
}
|
||||
//设置物料类型为物料
|
||||
@@ -703,27 +712,10 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
if(bom_ivt_qty < 0){
|
||||
throw new BadRequestException("碳化钨配粉结果为负数,当前配粉无解!");
|
||||
}
|
||||
double C = X22_jian + Z_sum.get();
|
||||
double C = X22_jian;
|
||||
if(C < 0){
|
||||
throw new BadRequestException("补碳结果为负数,当前配粉无解!");
|
||||
}else if(C >= 0){
|
||||
if(C>0){
|
||||
JSONObject C_weight = new JSONObject();
|
||||
C_weight.put("formula_qty",C);
|
||||
//钨分类id
|
||||
C_weight.put("material_id","1503644362788179968");
|
||||
C_weight.put("material_name","碳粉");
|
||||
C_weight.put("material_code","09030104");
|
||||
C_weight.put("material_type","02");
|
||||
C_weight.put("is_need_move","0");
|
||||
C_weight.put("is_need_manage","1");
|
||||
C_weight.put("is_tan","100");
|
||||
C_weight.put("is_rf_xl","1");
|
||||
C_weight.put("ivt_level","01");
|
||||
C_weight.put("is_active","1");
|
||||
C_weight.put("quality_scode","01");
|
||||
cw_list.add(C_weight);
|
||||
}
|
||||
bomdlt_Cr3C2.put("bom_ivt_qty",bom_ivt_qty);
|
||||
bomdlts_plan_map.put(bomdlt_Cr3C2.getString("stockrecord_id"),bomdlt_Cr3C2);
|
||||
//计算不需要移库的添加剂(抑制剂)
|
||||
@@ -749,6 +741,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
yzj_map.put(tjj_material_id,tjj_map_jo);
|
||||
}
|
||||
});
|
||||
|
||||
//统计除钨以外其他总重
|
||||
AtomicReference<Double> total_sum = new AtomicReference<>(0.0);
|
||||
//判断已含添加剂与需配添加剂大小
|
||||
yzj_map.forEach((key,tjj_map_now)->{
|
||||
//需配添加剂重量
|
||||
@@ -766,8 +761,49 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
tjj_map_now.put("is_active","1");
|
||||
tjj_map_now.put("quality_scode","01");
|
||||
yzj_list.add(tjj_map_now);
|
||||
total_sum.set(total_sum.get()+need_qty-finished_qty);
|
||||
}
|
||||
});
|
||||
if(C>0){
|
||||
JSONObject C_weight = new JSONObject();
|
||||
C_weight.put("formula_qty",C);
|
||||
//钨分类id
|
||||
C_weight.put("material_id","1503644362788179968");
|
||||
C_weight.put("material_name","碳粉");
|
||||
C_weight.put("material_code","09030104");
|
||||
C_weight.put("material_type","02");
|
||||
C_weight.put("is_need_move","0");
|
||||
C_weight.put("is_need_manage","1");
|
||||
C_weight.put("is_tan","100");
|
||||
C_weight.put("is_rf_xl","1");
|
||||
C_weight.put("ivt_level","01");
|
||||
C_weight.put("is_active","1");
|
||||
C_weight.put("quality_scode","01");
|
||||
cw_list.add(C_weight);
|
||||
total_sum.set(total_sum.get()+C);
|
||||
}
|
||||
bomdlts_plan_map.forEach((key,bomdlts_plan_now)->{
|
||||
//需配添加剂重量
|
||||
double bom_ivt_qty_now = NumberUtil.round(bomdlts_plan_now.getDouble("bom_ivt_qty"),3).doubleValue();
|
||||
total_sum.set(total_sum.get() + bom_ivt_qty_now);
|
||||
});
|
||||
double W = new_qty - total_sum.get();
|
||||
if(W>0){
|
||||
JSONObject W_weight = new JSONObject();
|
||||
W_weight.put("formula_qty",W);
|
||||
//钨分类id
|
||||
W_weight.put("material_id","1503644362234531840");
|
||||
W_weight.put("material_name","钨粉");
|
||||
W_weight.put("material_code","09030103");
|
||||
W_weight.put("material_type","02");
|
||||
W_weight.put("is_need_move","0");
|
||||
W_weight.put("is_need_manage","1");
|
||||
W_weight.put("is_rf_xl","0");
|
||||
W_weight.put("ivt_level","01");
|
||||
W_weight.put("is_active","1");
|
||||
W_weight.put("quality_scode","01");
|
||||
cw_list.add(W_weight);
|
||||
}
|
||||
}
|
||||
}else{//大于等于2条库粗你明细时
|
||||
//最后一个为X22p
|
||||
@@ -829,7 +865,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
flag = false;
|
||||
}else{
|
||||
//解得钨粉重量
|
||||
double C = X22_jian + Z_sum.get();
|
||||
double C = X22_jian;
|
||||
if(C<0){
|
||||
flag = false;
|
||||
}else if(C>=0){
|
||||
@@ -866,6 +902,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//统计除钨以外其他总重
|
||||
AtomicReference<Double> total_sum = new AtomicReference<>(0.0);
|
||||
//判断已含添加剂与需配添加剂大小
|
||||
yzj_map.forEach((key,tjj_map_now)->{
|
||||
//需配添加剂重量
|
||||
@@ -883,8 +922,10 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
tjj_map_now.put("is_active","1");
|
||||
tjj_map_now.put("quality_scode","01");
|
||||
yzj_list.add(tjj_map_now);
|
||||
total_sum.set(total_sum.get()+need_qty-finished_qty);
|
||||
}
|
||||
});
|
||||
|
||||
if(C>0){
|
||||
JSONObject C_weight = new JSONObject();
|
||||
C_weight.put("formula_qty",C);
|
||||
@@ -901,6 +942,29 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
C_weight.put("is_active","1");
|
||||
C_weight.put("quality_scode","01");
|
||||
cw_list.add(C_weight);
|
||||
total_sum.set(total_sum.get()+C);
|
||||
}
|
||||
bomdlts_plan_map.forEach((key,bomdlts_plan_now)->{
|
||||
//需配添加剂重量
|
||||
double bom_ivt_qty_now = NumberUtil.round(bomdlts_plan_now.getDouble("bom_ivt_qty"),3).doubleValue();
|
||||
total_sum.set(total_sum.get() + bom_ivt_qty_now);
|
||||
});
|
||||
double W = new_qty - total_sum.get();
|
||||
if(W>0 && W>=0.001){
|
||||
JSONObject W_weight = new JSONObject();
|
||||
W_weight.put("formula_qty",W);
|
||||
//钨分类id
|
||||
W_weight.put("material_id","1503644362234531840");
|
||||
W_weight.put("material_name","钨粉");
|
||||
W_weight.put("material_code","09030103");
|
||||
W_weight.put("material_type","02");
|
||||
W_weight.put("is_need_move","0");
|
||||
W_weight.put("is_need_manage","1");
|
||||
W_weight.put("is_rf_xl","0");
|
||||
W_weight.put("ivt_level","01");
|
||||
W_weight.put("is_active","1");
|
||||
W_weight.put("quality_scode","01");
|
||||
cw_list.add(W_weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -911,7 +975,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
double X21_jian = ((c_balance/100.0)*(CT1_weight) - (CT1-X22c) - X22p)/(1-X21/100.0);
|
||||
|
||||
//解得钨粉重量
|
||||
double C = X22p + X21_jian + Z_sum.get();
|
||||
double C = X22p + X21_jian;
|
||||
if(C<0){
|
||||
throw new BadRequestException("加碳粉为负数,当前配粉无解!");
|
||||
}else if(C>=0){
|
||||
@@ -954,6 +1018,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}
|
||||
});
|
||||
}
|
||||
//统计除钨以外其他总重
|
||||
AtomicReference<Double> total_sum = new AtomicReference<>(0.0);
|
||||
//判断已含添加剂与需配添加剂大小
|
||||
yzj_map.forEach((key,tjj_map_now)->{
|
||||
//需配添加剂重量
|
||||
@@ -971,8 +1037,10 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
tjj_map_now.put("is_active","1");
|
||||
tjj_map_now.put("quality_scode","01");
|
||||
yzj_list.add(tjj_map_now);
|
||||
total_sum.set(total_sum.get() + need_qty-finished_qty);
|
||||
}
|
||||
});
|
||||
|
||||
if(C>0){
|
||||
JSONObject C_weight = new JSONObject();
|
||||
C_weight.put("formula_qty",C);
|
||||
@@ -989,6 +1057,29 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
C_weight.put("is_active","1");
|
||||
C_weight.put("quality_scode","01");
|
||||
cw_list.add(C_weight);
|
||||
total_sum.set(total_sum.get()+C);
|
||||
}
|
||||
bomdlts_plan_map.forEach((key,bomdlts_plan_now)->{
|
||||
//需配添加剂重量
|
||||
double bom_ivt_qty_now = NumberUtil.round(bomdlts_plan_now.getDouble("bom_ivt_qty"),3).doubleValue();
|
||||
total_sum.set(total_sum.get() + bom_ivt_qty_now);
|
||||
});
|
||||
double W = new_qty - total_sum.get();
|
||||
if(W>0 && W>=0.001){
|
||||
JSONObject W_weight = new JSONObject();
|
||||
W_weight.put("formula_qty",W);
|
||||
//钨分类id
|
||||
W_weight.put("material_id","1503644362234531840");
|
||||
W_weight.put("material_name","钨粉");
|
||||
W_weight.put("material_code","09030103");
|
||||
W_weight.put("material_type","02");
|
||||
W_weight.put("is_need_move","0");
|
||||
W_weight.put("is_need_manage","1");
|
||||
W_weight.put("is_rf_xl","0");
|
||||
W_weight.put("ivt_level","01");
|
||||
W_weight.put("is_active","1");
|
||||
W_weight.put("quality_scode","01");
|
||||
cw_list.add(W_weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1494,7 +1585,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
JSONArray ivts_new = new JSONArray();
|
||||
for(int i=0;i<ivts.size();i++){
|
||||
JSONObject ivt = ivts.getJSONObject(i);
|
||||
if(ivt.getDouble("sum_ivt_qty")<=0){
|
||||
if(ivt.getDouble("sum_ivt_qty")<=0 || ivt.getDouble("sum_ivt_qty")<0.01){
|
||||
continue;
|
||||
}
|
||||
String ivt_material_id = ivt.getString("material_id");
|
||||
@@ -1636,7 +1727,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}
|
||||
for(int j=0;j<bom_materials.size();j++){
|
||||
JSONObject bom_material = bom_materials.getJSONObject(j);
|
||||
if(bom_material.getDouble("sum_ivt_qty")<=0){
|
||||
if(bom_material.getDouble("sum_ivt_qty")<=0 || bom_material.getDouble("sum_ivt_qty")<0.01){
|
||||
continue;
|
||||
}
|
||||
double bom_ivt_qty = bom_material.getDouble("sum_ivt_qty");
|
||||
@@ -1791,28 +1882,11 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
if(bom_ivt_qty < 0){
|
||||
throw new BadRequestException("碳化钨配粉结果为负数,当前配粉无解!");
|
||||
}
|
||||
double C = X22_jian + Z_sum.get();
|
||||
double C = X22_jian;
|
||||
|
||||
if(C<0){
|
||||
throw new BadRequestException("加碳粉为负数,当前配粉无解!");
|
||||
}
|
||||
if(C>0){
|
||||
JSONObject C_weight = new JSONObject();
|
||||
C_weight.put("formula_qty",C);
|
||||
//碳化钨分类id
|
||||
C_weight.put("material_id","1503644362788179968");
|
||||
C_weight.put("material_name","碳粉");
|
||||
C_weight.put("material_code","09030104");
|
||||
C_weight.put("material_type","02");
|
||||
C_weight.put("is_need_move","0");
|
||||
C_weight.put("is_need_manage","1");
|
||||
C_weight.put("is_tan","100");
|
||||
C_weight.put("is_rf_xl","1");
|
||||
C_weight.put("ivt_level","01");
|
||||
C_weight.put("is_active","1");
|
||||
C_weight.put("quality_scode","01");
|
||||
cw_list.add(C_weight);
|
||||
}
|
||||
bomdlt_Cr3C2.put("bom_ivt_qty",bom_ivt_qty);
|
||||
bomdlts_plan_map.put(bomdlt_Cr3C2.getString("stockrecord_id"),bomdlt_Cr3C2);
|
||||
//计算不需要移库的添加剂
|
||||
@@ -1838,6 +1912,32 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
tjj_map.put(tjj_material_id,tjj_map_jo);
|
||||
}
|
||||
});
|
||||
//统计除钨以外其他总重
|
||||
AtomicReference<Double> total_sum = new AtomicReference<>(0.0);
|
||||
|
||||
if(C>0){
|
||||
JSONObject C_weight = new JSONObject();
|
||||
C_weight.put("formula_qty",C);
|
||||
//碳化钨分类id
|
||||
C_weight.put("material_id","1503644362788179968");
|
||||
C_weight.put("material_name","碳粉");
|
||||
C_weight.put("material_code","09030104");
|
||||
C_weight.put("material_type","02");
|
||||
C_weight.put("is_need_move","0");
|
||||
C_weight.put("is_need_manage","1");
|
||||
C_weight.put("is_tan","100");
|
||||
C_weight.put("is_rf_xl","1");
|
||||
C_weight.put("ivt_level","01");
|
||||
C_weight.put("is_active","1");
|
||||
C_weight.put("quality_scode","01");
|
||||
cw_list.add(C_weight);
|
||||
total_sum.set(total_sum.get() + C);
|
||||
}
|
||||
bomdlts_plan_map.forEach((key,bomdlts_plan_now)->{
|
||||
//需配添加剂重量
|
||||
double bom_ivt_qty_now = NumberUtil.round(bomdlts_plan_now.getDouble("bom_ivt_qty"),3).doubleValue();
|
||||
total_sum.set(total_sum.get() + bom_ivt_qty_now);
|
||||
});
|
||||
//判断已含添加剂与需配添加剂大小
|
||||
tjj_map.forEach((key,tjj_map_now)->{
|
||||
//需配添加剂重量
|
||||
@@ -1855,8 +1955,26 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
tjj_map_now.put("is_active","1");
|
||||
tjj_map_now.put("quality_scode","01");
|
||||
yzj_list.add(tjj_map_now);
|
||||
total_sum.set(total_sum.get() + need_qty-finished_qty);
|
||||
}
|
||||
});
|
||||
double W = new_qty - total_sum.get();
|
||||
if(W>0){
|
||||
JSONObject W_weight = new JSONObject();
|
||||
W_weight.put("formula_qty",W);
|
||||
//钨分类id
|
||||
W_weight.put("material_id","1503644362234531840");
|
||||
W_weight.put("material_name","钨粉");
|
||||
W_weight.put("material_code","09030103");
|
||||
W_weight.put("material_type","02");
|
||||
W_weight.put("is_need_move","0");
|
||||
W_weight.put("is_need_manage","1");
|
||||
W_weight.put("is_rf_xl","0");
|
||||
W_weight.put("ivt_level","01");
|
||||
W_weight.put("is_active","1");
|
||||
W_weight.put("quality_scode","01");
|
||||
cw_list.add(W_weight);
|
||||
}
|
||||
}else{//大于等于2条库粗你明细时
|
||||
//最后一个为X22p
|
||||
JSONObject bomdlt_Cr3C2_X22p = bomdlts_Cr3C2.getJSONObject(bomdlts_Cr3C2.size()-1);
|
||||
@@ -1917,27 +2035,10 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
flag = false;
|
||||
}else{
|
||||
//解得钨粉重量
|
||||
double C = X22_jian + Z_sum.get();
|
||||
double C = X22_jian;
|
||||
if(C<0){
|
||||
flag = false;
|
||||
}else if(C>=0){
|
||||
if(C>0){
|
||||
JSONObject C_weight = new JSONObject();
|
||||
C_weight.put("formula_qty",C);
|
||||
//钨分类id
|
||||
C_weight.put("material_id","1503644362788179968");
|
||||
C_weight.put("material_name","碳粉");
|
||||
C_weight.put("material_code","09030104");
|
||||
C_weight.put("material_type","02");
|
||||
C_weight.put("is_need_move","0");
|
||||
C_weight.put("is_need_manage","1");
|
||||
C_weight.put("is_tan","100");
|
||||
C_weight.put("is_rf_xl","1");
|
||||
C_weight.put("ivt_level","01");
|
||||
C_weight.put("is_active","1");
|
||||
C_weight.put("quality_scode","01");
|
||||
cw_list.add(C_weight);
|
||||
}
|
||||
bomdlt_Cr3C2_X22p.put("bom_ivt_qty",bom_ivt_qty);
|
||||
bomdlts_plan_map.put(bomdlt_Cr3C2_X22p.getString("stockrecord_id"),bomdlt_Cr3C2_X22p);
|
||||
if(bom_ivt_qty<=0){
|
||||
@@ -1971,6 +2072,32 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}
|
||||
});
|
||||
}
|
||||
//统计除钨以外其他总重
|
||||
AtomicReference<Double> total_sum = new AtomicReference<>(0.0);
|
||||
|
||||
if(C>0){
|
||||
JSONObject C_weight = new JSONObject();
|
||||
C_weight.put("formula_qty",C);
|
||||
//碳化钨分类id
|
||||
C_weight.put("material_id","1503644362788179968");
|
||||
C_weight.put("material_name","碳粉");
|
||||
C_weight.put("material_code","09030104");
|
||||
C_weight.put("material_type","02");
|
||||
C_weight.put("is_need_move","0");
|
||||
C_weight.put("is_need_manage","1");
|
||||
C_weight.put("is_tan","100");
|
||||
C_weight.put("is_rf_xl","1");
|
||||
C_weight.put("ivt_level","01");
|
||||
C_weight.put("is_active","1");
|
||||
C_weight.put("quality_scode","01");
|
||||
cw_list.add(C_weight);
|
||||
total_sum.set(total_sum.get() + C);
|
||||
}
|
||||
bomdlts_plan_map.forEach((key,bomdlts_plan_now)->{
|
||||
//需配添加剂重量
|
||||
double bom_ivt_qty_now = NumberUtil.round(bomdlts_plan_now.getDouble("bom_ivt_qty"),3).doubleValue();
|
||||
total_sum.set(total_sum.get() + bom_ivt_qty_now);
|
||||
});
|
||||
//判断已含添加剂与需配添加剂大小
|
||||
tjj_map.forEach((key,tjj_map_now)->{
|
||||
//需配添加剂重量
|
||||
@@ -1988,8 +2115,26 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
tjj_map_now.put("is_active","1");
|
||||
tjj_map_now.put("quality_scode","01");
|
||||
yzj_list.add(tjj_map_now);
|
||||
total_sum.set(total_sum.get() + need_qty-finished_qty);
|
||||
}
|
||||
});
|
||||
double W = new_qty - total_sum.get();
|
||||
if(W>0){
|
||||
JSONObject W_weight = new JSONObject();
|
||||
W_weight.put("formula_qty",W);
|
||||
//钨分类id
|
||||
W_weight.put("material_id","1503644362234531840");
|
||||
W_weight.put("material_name","钨粉");
|
||||
W_weight.put("material_code","09030103");
|
||||
W_weight.put("material_type","02");
|
||||
W_weight.put("is_need_move","0");
|
||||
W_weight.put("is_need_manage","1");
|
||||
W_weight.put("is_rf_xl","0");
|
||||
W_weight.put("ivt_level","01");
|
||||
W_weight.put("is_active","1");
|
||||
W_weight.put("quality_scode","01");
|
||||
cw_list.add(W_weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1998,7 +2143,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
// X21p减=[产品碳平衡*(X11p+X12p+X21p+X22p+Z已总) - (X11p* X11碳含量+X12p* X12碳含量+(X21p)* X21碳含量+Z已总+X22p)]/(1-X21碳含量)
|
||||
double X21_jian = ((c_balance/100.0)*(CT1_weight) - (CT1-X22c) - X22p)/(1-X21/100.0);
|
||||
//解得钨粉重量
|
||||
double C = X22p + X21_jian + Z_sum.get();
|
||||
double C = X22p + X21_jian;
|
||||
if(C<0){
|
||||
throw new BadRequestException("加碳粉为负数,当前配粉无解!");
|
||||
}else if(C>=0){
|
||||
@@ -2007,24 +2152,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
if(bom_ivt_qty<0){
|
||||
throw new BadRequestException("碳化钨倒数第二条配粉结果为负数,当前配粉无解!");
|
||||
}
|
||||
if(C>0){
|
||||
JSONObject C_weight = new JSONObject();
|
||||
C_weight.put("formula_qty",C);
|
||||
//钨分类id
|
||||
C_weight.put("material_id","1503644362788179968");
|
||||
C_weight.put("material_name","碳粉");
|
||||
C_weight.put("material_code","09030104");
|
||||
C_weight.put("material_type","02");
|
||||
C_weight.put("is_need_move","0");
|
||||
C_weight.put("is_need_manage","1");
|
||||
C_weight.put("is_tan","100");
|
||||
C_weight.put("is_rf_xl","1");
|
||||
C_weight.put("ivt_level","01");
|
||||
C_weight.put("is_active","1");
|
||||
C_weight.put("quality_scode","01");
|
||||
cw_list.add(C_weight);
|
||||
}
|
||||
|
||||
bomdlt_Cr3C2_X21p.put("bom_ivt_qty",bom_ivt_qty);
|
||||
bomdlts_plan_map.put(bomdlt_Cr3C2_X21p.getString("stockrecord_id"),bomdlt_Cr3C2_X21p);
|
||||
if(bom_ivt_qty<=0){
|
||||
@@ -2059,6 +2186,32 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}
|
||||
});
|
||||
}
|
||||
//统计除钨以外其他总重
|
||||
AtomicReference<Double> total_sum = new AtomicReference<>(0.0);
|
||||
|
||||
if(C>0){
|
||||
JSONObject C_weight = new JSONObject();
|
||||
C_weight.put("formula_qty",C);
|
||||
//碳化钨分类id
|
||||
C_weight.put("material_id","1503644362788179968");
|
||||
C_weight.put("material_name","碳粉");
|
||||
C_weight.put("material_code","09030104");
|
||||
C_weight.put("material_type","02");
|
||||
C_weight.put("is_need_move","0");
|
||||
C_weight.put("is_need_manage","1");
|
||||
C_weight.put("is_tan","100");
|
||||
C_weight.put("is_rf_xl","1");
|
||||
C_weight.put("ivt_level","01");
|
||||
C_weight.put("is_active","1");
|
||||
C_weight.put("quality_scode","01");
|
||||
cw_list.add(C_weight);
|
||||
total_sum.set(total_sum.get() + C);
|
||||
}
|
||||
bomdlts_plan_map.forEach((key,bomdlts_plan_now)->{
|
||||
//需配添加剂重量
|
||||
double bom_ivt_qty_now = NumberUtil.round(bomdlts_plan_now.getDouble("bom_ivt_qty"),3).doubleValue();
|
||||
total_sum.set(total_sum.get() + bom_ivt_qty_now);
|
||||
});
|
||||
//判断已含添加剂与需配添加剂大小
|
||||
tjj_map.forEach((key,tjj_map_now)->{
|
||||
//需配添加剂重量
|
||||
@@ -2076,8 +2229,26 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
tjj_map_now.put("is_active","1");
|
||||
tjj_map_now.put("quality_scode","01");
|
||||
yzj_list.add(tjj_map_now);
|
||||
total_sum.set(total_sum.get() + need_qty-finished_qty);
|
||||
}
|
||||
});
|
||||
double W = new_qty - total_sum.get();
|
||||
if(W>0){
|
||||
JSONObject W_weight = new JSONObject();
|
||||
W_weight.put("formula_qty",W);
|
||||
//钨分类id
|
||||
W_weight.put("material_id","1503644362234531840");
|
||||
W_weight.put("material_name","钨粉");
|
||||
W_weight.put("material_code","09030103");
|
||||
W_weight.put("material_type","02");
|
||||
W_weight.put("is_need_move","0");
|
||||
W_weight.put("is_need_manage","1");
|
||||
W_weight.put("is_rf_xl","0");
|
||||
W_weight.put("ivt_level","01");
|
||||
W_weight.put("is_active","1");
|
||||
W_weight.put("quality_scode","01");
|
||||
cw_list.add(W_weight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2178,9 +2349,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}
|
||||
});
|
||||
double W = new_qty - total_sum.get();
|
||||
/* if(W<0){
|
||||
throw new BadRequestException("加钨粉为负数,当前配粉无解!");
|
||||
}*/
|
||||
if(W>0){
|
||||
JSONObject W_weight = new JSONObject();
|
||||
W_weight.put("formula_qty",W);
|
||||
@@ -2414,9 +2582,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}
|
||||
});
|
||||
double W = new_qty - total_sum.get();
|
||||
/*if(W<0){
|
||||
throw new BadRequestException("加钨粉为负数,当前配粉无解!");
|
||||
}*/
|
||||
if(W>0){
|
||||
JSONObject W_weight = new JSONObject();
|
||||
W_weight.put("formula_qty",W);
|
||||
@@ -2627,7 +2792,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
JSONArray ivts_new = new JSONArray();
|
||||
for(int i=0;i<ivts.size();i++){
|
||||
JSONObject ivt = ivts.getJSONObject(i);
|
||||
if(ivt.getDouble("sum_ivt_qty") <=0){
|
||||
if(ivt.getDouble("sum_ivt_qty") <=0 || ivt.getDouble("sum_ivt_qty") <0.01){
|
||||
continue;
|
||||
}
|
||||
String ivt_material_id = ivt.getString("material_id");
|
||||
@@ -2734,6 +2899,10 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
JSONArray dtl_new = new JSONArray();
|
||||
for(int i=0;i<tableDtl.size();i++){
|
||||
JSONObject jo = tableDtl.getJSONObject(i);
|
||||
double formula_qty = jo.getDouble("formula_qty");
|
||||
if(formula_qty < 0.001){
|
||||
continue;
|
||||
}
|
||||
String material_type_id = jo.getString("material_type_id");
|
||||
//成型剂
|
||||
if (StrUtil.isNotEmpty(jo.getString("formingtype_code"))) {
|
||||
@@ -2957,7 +3126,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
JSONArray ivts_new = new JSONArray();
|
||||
for(int i=0;i<ivts.size();i++){
|
||||
JSONObject ivt = ivts.getJSONObject(i);
|
||||
if(ivt.getDouble("sum_ivt_qty") <=0){
|
||||
if(ivt.getDouble("sum_ivt_qty") <=0 || ivt.getDouble("sum_ivt_qty") <0.01){
|
||||
continue;
|
||||
}
|
||||
String ivt_material_id = ivt.getString("material_id");
|
||||
@@ -3111,7 +3280,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}
|
||||
double ivt_qty = now_ivt.getDouble("sum_ivt_qty");
|
||||
ivt_qty = NumberUtil.roundDown(ivt_qty,3).doubleValue();
|
||||
if(ivt_qty <=0){
|
||||
if(ivt_qty <=0 || ivt_qty<0.01){
|
||||
continue;
|
||||
}
|
||||
if(left_qty<ivt_qty){
|
||||
@@ -4017,7 +4186,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
||||
}
|
||||
double ivt_qty = now_ivt.getDouble("sum_ivt_qty");
|
||||
ivt_qty = NumberUtil.roundDown(ivt_qty,3).doubleValue();
|
||||
if(ivt_qty<=0){
|
||||
if(ivt_qty<=0 || ivt_qty<0.01){
|
||||
continue;
|
||||
}
|
||||
if(left_qty<ivt_qty){
|
||||
|
||||
Reference in New Issue
Block a user