优化
This commit is contained in:
@@ -637,7 +637,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
//BOM中碳化钨需含总碳
|
//BOM中碳化钨需含总碳
|
||||||
double CT2 = new_qty*(sum_Cr3C2/100.0)*(c_balance/100.0);
|
double CT2 = new_qty*(sum_Cr3C2/100.0)*(c_balance/100.0);
|
||||||
if(CT1==CT2){//配粉结束
|
//配粉结束
|
||||||
|
if(CT1==CT2){
|
||||||
//判断已含添加剂与需配添加剂大小
|
//判断已含添加剂与需配添加剂大小
|
||||||
yzj_map.forEach((key,tjj_map_now)->{
|
yzj_map.forEach((key,tjj_map_now)->{
|
||||||
//需配添加剂重量
|
//需配添加剂重量
|
||||||
@@ -657,7 +658,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
yzj_list.add(tjj_map_now);
|
yzj_list.add(tjj_map_now);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else if(CT1<CT2){//需配碳粉
|
}else
|
||||||
|
//需配碳粉
|
||||||
|
if(CT1<CT2){
|
||||||
if(bomdlts_Cr3C2.size()==1){//只配库存明细时
|
if(bomdlts_Cr3C2.size()==1){//只配库存明细时
|
||||||
//假设碳粉重量为W
|
//假设碳粉重量为W
|
||||||
JSONObject bomdlt_Cr3C2 = bomdlts_Cr3C2.getJSONObject(0);
|
JSONObject bomdlt_Cr3C2 = bomdlts_Cr3C2.getJSONObject(0);
|
||||||
@@ -694,8 +697,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
//该批次含碳比
|
//该批次含碳比
|
||||||
double X22 = FactoryWarranty.getDouble("is_tan");
|
double X22 = FactoryWarranty.getDouble("is_tan");
|
||||||
//解得碳粉重量 X22p减=[产品碳平衡*(X22p+Z已总)-Z已总- (X22p)* X22碳含量]/(1- X22碳含量)
|
//解得碳粉重量 X22p减=[产品碳平衡*(X22p+Z已总)-Z已总- (X22p)* X22碳含量]/(1- X22碳含量)
|
||||||
double X22_jian = ((c_balance/100.0)*(X22p+ Z_sum.get())- Z_sum.get() -X22p*(X22/100.0))/(1-X22/100.0);
|
double X22_jian = ((c_balance/100.0)*(CT1_weight+Z_sum.get())-(CT1+Z_sum.get()))/(1-X22/100.0);
|
||||||
|
|
||||||
//更新碳化钨配粉重量
|
//更新碳化钨配粉重量
|
||||||
double bom_ivt_qty = X22p-X22_jian;
|
double bom_ivt_qty = X22p-X22_jian;
|
||||||
if(bom_ivt_qty < 0){
|
if(bom_ivt_qty < 0){
|
||||||
@@ -991,7 +993,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if(CT1>CT2){//需配钨粉
|
}else
|
||||||
|
//需配钨粉
|
||||||
|
if(CT1>CT2){
|
||||||
if(bomdlts_Cr3C2.size()==1){//只配库存明细时
|
if(bomdlts_Cr3C2.size()==1){//只配库存明细时
|
||||||
//假设钨粉重量为W
|
//假设钨粉重量为W
|
||||||
JSONObject bomdlt_Cr3C2 = bomdlts_Cr3C2.getJSONObject(0);
|
JSONObject bomdlt_Cr3C2 = bomdlts_Cr3C2.getJSONObject(0);
|
||||||
@@ -1023,9 +1027,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
Z_sum.set(Z_sum.get() + finished);
|
Z_sum.set(Z_sum.get() + finished);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// X21p减=[(X21p)* X21碳含量+软废含碳量-产品碳平衡*(X21p+软废碳化钨)]/X21碳含量
|
||||||
//解得钨粉重量
|
//解得钨粉重量
|
||||||
double X22_jian = X22p - (c_balance/100.0)*(X22p+Z_sum.get())/(X22/100.0);
|
double X22_jian = (CT1 - (c_balance/100.0)*(CT1_weight)) / (X22/100.0);
|
||||||
//更新碳化钨配粉重量
|
//更新碳化钨配粉重量
|
||||||
double bom_ivt_qty = X22p-X22_jian;
|
double bom_ivt_qty = X22p-X22_jian;
|
||||||
if(bom_ivt_qty<=0){
|
if(bom_ivt_qty<=0){
|
||||||
@@ -1085,9 +1089,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
double W = new_qty - total_sum.get();
|
double W = new_qty - total_sum.get();
|
||||||
if(W<0){
|
/* if(W<0){
|
||||||
throw new BadRequestException("加钨粉为负数,当前配粉无解!");
|
throw new BadRequestException("加钨粉为负数,当前配粉无解!");
|
||||||
}
|
}*/
|
||||||
if(W>0){
|
if(W>0){
|
||||||
JSONObject W_weight = new JSONObject();
|
JSONObject W_weight = new JSONObject();
|
||||||
W_weight.put("formula_qty",W);
|
W_weight.put("formula_qty",W);
|
||||||
@@ -1158,7 +1162,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
//设X21p减=0,解方程
|
//设X21p减=0,解方程
|
||||||
if(flag){
|
if(flag){
|
||||||
//X22p减 = [(X11p* X11碳含量+X12p* X12碳含量+X21p* X21碳含量+X22p* X22碳含量)-产品碳平衡*(X11p+X12p+X21p+X22p+Z已总)]/X22碳含量
|
//X22p减 = [(X11p* X11碳含量+X12p* X12碳含量+X21p* X21碳含量+X22p* X22碳含量)-产品碳平衡*(X11p+X12p+X21p+X22p+Z已总)]/X22碳含量
|
||||||
double X22_jian = (CT1 - (c_balance/100.0)*(CT1_weight+Z_sum.get()))/(X22/100.0);
|
double X22_jian = (CT1 - (c_balance/100.0)*(CT1_weight))/(X22/100.0);
|
||||||
//更新碳化钨配粉重量
|
//更新碳化钨配粉重量
|
||||||
double bom_ivt_qty = X22p-X22_jian;
|
double bom_ivt_qty = X22p-X22_jian;
|
||||||
if(bom_ivt_qty<0){
|
if(bom_ivt_qty<0){
|
||||||
@@ -1253,7 +1257,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
if(!flag){
|
if(!flag){
|
||||||
//设X22p减=X22p,解方程
|
//设X22p减=X22p,解方程
|
||||||
//X21p减 =[( X11p* X11碳含量+X12p* X12碳含量+(X21p)* X21碳含量)-产品碳平衡*(X11p+X12p+X21p+X22p+Z已总)]/X21碳含量
|
//X21p减 =[( X11p* X11碳含量+X12p* X12碳含量+(X21p)* X21碳含量)-产品碳平衡*(X11p+X12p+X21p+X22p+Z已总)]/X21碳含量
|
||||||
double X21_jian = ((CT1-X22c) - (c_balance/100.0)*(CT1_weight+ Z_sum.get()))/(X21/100.0);
|
double X21_jian = ((CT1-X22c) - (c_balance/100.0)*(CT1_weight))/(X21/100.0);
|
||||||
if(X21_jian<0){
|
if(X21_jian<0){
|
||||||
throw new BadRequestException("碳化钨减掉结果为负数,当前配粉无解!");
|
throw new BadRequestException("碳化钨减掉结果为负数,当前配粉无解!");
|
||||||
}
|
}
|
||||||
@@ -1329,9 +1333,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
});
|
});
|
||||||
|
|
||||||
double W = new_qty - total_sum.get();
|
double W = new_qty - total_sum.get();
|
||||||
if(W<0){
|
/*if(W<0){
|
||||||
throw new BadRequestException("加钨粉为负数,当前配粉无解!");
|
throw new BadRequestException("加钨粉为负数,当前配粉无解!");
|
||||||
}
|
}*/
|
||||||
if(W>0){
|
if(W>0){
|
||||||
JSONObject W_weight = new JSONObject();
|
JSONObject W_weight = new JSONObject();
|
||||||
W_weight.put("formula_qty",W);
|
W_weight.put("formula_qty",W);
|
||||||
@@ -1725,7 +1729,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
|
|
||||||
//BOM中碳化钨需含总碳
|
//BOM中碳化钨需含总碳
|
||||||
double CT2 = workorder_qty*(sum_Cr3C2/100.0)*(c_balance/100.0);
|
double CT2 = workorder_qty*(sum_Cr3C2/100.0)*(c_balance/100.0);
|
||||||
if(CT1==CT2){//配粉结束
|
//配粉结束
|
||||||
|
if(CT1==CT2){
|
||||||
//判断已含添加剂与需配添加剂大小
|
//判断已含添加剂与需配添加剂大小
|
||||||
tjj_map.forEach((key,tjj_map_now)->{
|
tjj_map.forEach((key,tjj_map_now)->{
|
||||||
//需配添加剂重量
|
//需配添加剂重量
|
||||||
@@ -1745,7 +1750,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
yzj_list.add(tjj_map_now);
|
yzj_list.add(tjj_map_now);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else if(CT1<CT2){//需配碳粉
|
}else
|
||||||
|
//需配碳粉
|
||||||
|
if(CT1<CT2){
|
||||||
if(bomdlts_Cr3C2.size()==1){//只配库存明细时
|
if(bomdlts_Cr3C2.size()==1){//只配库存明细时
|
||||||
//假设碳粉重量为W
|
//假设碳粉重量为W
|
||||||
JSONObject bomdlt_Cr3C2 = bomdlts_Cr3C2.getJSONObject(0);
|
JSONObject bomdlt_Cr3C2 = bomdlts_Cr3C2.getJSONObject(0);
|
||||||
@@ -1778,8 +1785,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
//解得碳粉重量 X22p减=[产品碳平衡*(X22p+Z已总)-Z已总- (X22p)* X22碳含量]/(1- X22碳含量)
|
//解得碳粉重量 X22p减=[产品碳平衡*(X22p+Z已总)-Z已总- (X22p)* X22碳含量]/(1- X22碳含量)
|
||||||
double X22_jian = ((c_balance/100.0)*(X22p+ Z_sum.get())- Z_sum.get() -X22p*(X22/100.0))/(1-X22/100.0);
|
double X22_jian = ((c_balance/100.0)*(CT1_weight+Z_sum.get())-(CT1+Z_sum.get()))/(1-X22/100.0);
|
||||||
|
|
||||||
//更新碳化钨配粉重量
|
//更新碳化钨配粉重量
|
||||||
double bom_ivt_qty = X22p-X22_jian;
|
double bom_ivt_qty = X22p-X22_jian;
|
||||||
if(bom_ivt_qty < 0){
|
if(bom_ivt_qty < 0){
|
||||||
@@ -2076,7 +2082,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if(CT1>CT2){//需配钨粉
|
}else
|
||||||
|
//需配钨粉
|
||||||
|
if(CT1>CT2){
|
||||||
if(bomdlts_Cr3C2.size()==1){//只配库存明细时
|
if(bomdlts_Cr3C2.size()==1){//只配库存明细时
|
||||||
//假设钨粉重量为W
|
//假设钨粉重量为W
|
||||||
JSONObject bomdlt_Cr3C2 = bomdlts_Cr3C2.getJSONObject(0);
|
JSONObject bomdlt_Cr3C2 = bomdlts_Cr3C2.getJSONObject(0);
|
||||||
@@ -2107,9 +2115,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
Z_sum.set(Z_sum.get() + finished);
|
Z_sum.set(Z_sum.get() + finished);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// X21p减= [(X21p)* X21碳含量+软废含碳量-产品碳平衡*(X21p+软废碳化钨)]/X21碳含量
|
||||||
//解得钨粉重量
|
//解得钨粉重量
|
||||||
double X22_jian = X22p - (c_balance/100.0)*(X22p+Z_sum.get())/(X22/100.0);
|
double X22_jian =(CT1 - (c_balance/100.0)*(CT1_weight))/(X22/100.0);
|
||||||
//更新碳化钨配粉重量
|
//更新碳化钨配粉重量
|
||||||
double bom_ivt_qty = X22p-X22_jian;
|
double bom_ivt_qty = X22p-X22_jian;
|
||||||
if(bom_ivt_qty<=0){
|
if(bom_ivt_qty<=0){
|
||||||
@@ -2171,9 +2179,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
double W = new_qty - total_sum.get();
|
double W = new_qty - total_sum.get();
|
||||||
if(W<0){
|
/* if(W<0){
|
||||||
throw new BadRequestException("加钨粉为负数,当前配粉无解!");
|
throw new BadRequestException("加钨粉为负数,当前配粉无解!");
|
||||||
}
|
}*/
|
||||||
if(W>0){
|
if(W>0){
|
||||||
JSONObject W_weight = new JSONObject();
|
JSONObject W_weight = new JSONObject();
|
||||||
W_weight.put("formula_qty",W);
|
W_weight.put("formula_qty",W);
|
||||||
@@ -2243,7 +2251,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
//设X21p减=0,解方程
|
//设X21p减=0,解方程
|
||||||
if(flag){
|
if(flag){
|
||||||
//X22p减 = [(X11p* X11碳含量+X12p* X12碳含量+X21p* X21碳含量+X22p* X22碳含量)-产品碳平衡*(X11p+X12p+X21p+X22p+Z已总)]/X22碳含量
|
//X22p减 = [(X11p* X11碳含量+X12p* X12碳含量+X21p* X21碳含量+X22p* X22碳含量)-产品碳平衡*(X11p+X12p+X21p+X22p+Z已总)]/X22碳含量
|
||||||
double X22_jian = (CT1 - (c_balance/100.0)*(CT1_weight+Z_sum.get()))/(X22/100.0);
|
double X22_jian = (CT1 - (c_balance/100.0)*(CT1_weight))/(X22/100.0);
|
||||||
//更新碳化钨配粉重量
|
//更新碳化钨配粉重量
|
||||||
double bom_ivt_qty = X22p-X22_jian;
|
double bom_ivt_qty = X22p-X22_jian;
|
||||||
if(bom_ivt_qty<0){
|
if(bom_ivt_qty<0){
|
||||||
@@ -2312,9 +2320,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
double W = new_qty - total_sum.get();
|
double W = new_qty - total_sum.get();
|
||||||
/* if(W<0){
|
|
||||||
throw new BadRequestException("加钨粉为负数,当前配粉无解!");
|
|
||||||
}*/
|
|
||||||
if(W>0){
|
if(W>0){
|
||||||
JSONObject W_weight = new JSONObject();
|
JSONObject W_weight = new JSONObject();
|
||||||
W_weight.put("formula_qty",W);
|
W_weight.put("formula_qty",W);
|
||||||
@@ -2336,7 +2341,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
if(!flag){
|
if(!flag){
|
||||||
//设X22p减=X22p,解方程
|
//设X22p减=X22p,解方程
|
||||||
//X21p减 =[( X11p* X11碳含量+X12p* X12碳含量+(X21p)* X21碳含量)-产品碳平衡*(X11p+X12p+X21p+X22p+Z已总)]/X21碳含量
|
//X21p减 =[( X11p* X11碳含量+X12p* X12碳含量+(X21p)* X21碳含量)-产品碳平衡*(X11p+X12p+X21p+X22p+Z已总)]/X21碳含量
|
||||||
double X21_jian = ((CT1-X22c) - (c_balance/100.0)*(CT1_weight+ Z_sum.get()))/(X21/100.0);
|
double X21_jian = ((CT1-X22c) - (c_balance/100.0)*(CT1_weight))/(X21/100.0);
|
||||||
if(X21_jian<0){
|
if(X21_jian<0){
|
||||||
throw new BadRequestException("碳化钨减掉结果为负数,当前配粉无解!");
|
throw new BadRequestException("碳化钨减掉结果为负数,当前配粉无解!");
|
||||||
}
|
}
|
||||||
@@ -2410,9 +2415,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
double W = new_qty - total_sum.get();
|
double W = new_qty - total_sum.get();
|
||||||
if(W<0){
|
/*if(W<0){
|
||||||
throw new BadRequestException("加钨粉为负数,当前配粉无解!");
|
throw new BadRequestException("加钨粉为负数,当前配粉无解!");
|
||||||
}
|
}*/
|
||||||
if(W>0){
|
if(W>0){
|
||||||
JSONObject W_weight = new JSONObject();
|
JSONObject W_weight = new JSONObject();
|
||||||
W_weight.put("formula_qty",W);
|
W_weight.put("formula_qty",W);
|
||||||
@@ -3232,9 +3237,9 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
double need_qty = bomdlt.getDouble("formula_qty");
|
double need_qty = bomdlt.getDouble("formula_qty");
|
||||||
W = NumberUtil.round(W - need_qty,3).doubleValue();
|
W = NumberUtil.round(W - need_qty,3).doubleValue();
|
||||||
}
|
}
|
||||||
if(W<0){
|
/*if(W<0){
|
||||||
throw new BadRequestException("补钨粉重量为负数,请检查bom及其他参数!");
|
throw new BadRequestException("补钨粉重量为负数,请检查bom及其他参数!");
|
||||||
}
|
}*/
|
||||||
if(W>0){
|
if(W>0){
|
||||||
JSONObject W_weight = new JSONObject();
|
JSONObject W_weight = new JSONObject();
|
||||||
W_weight.put("formula_qty",W);
|
W_weight.put("formula_qty",W);
|
||||||
|
|||||||
Reference in New Issue
Block a user