This commit is contained in:
zds
2022-10-13 20:28:55 +08:00
parent f2492eee65
commit 1bdc1b1df7
7 changed files with 117 additions and 67 deletions

View File

@@ -33,7 +33,8 @@ public enum MaterOptTypeEnum {
SPARE(22, "23", "备品备件", "('1503644361789935616')", ""),
SBGZ(23, "24", "设备故障", "('1541964046385942528')", ""),
TJJ_AND_OTHER(24, "25", "添加剂和其他有色金属粉", "('1503644361697660928','1503644362838511616')", ""),
BJID(25, "26", "备品备件", "1503644361789935616", "");
BJID(25, "26", "备品备件", "1503644361789935616", ""),
THW_AND_GF_AND_TJJ(26, "27", "碳化钨、钴粉、添加剂", "('1503644361664106496','1503644362192588800','1503644361697660928')", "");

View File

@@ -77,6 +77,9 @@
(device.device_code like 输入.device_code or
device.device_name like 输入.device_code)
ENDOPTION
OPTION 输入.device_id <> ""
device.device_id = 输入.device_id
ENDOPTION
OPTION 输入.pcsn <> ""
WorkOrder.pcsn like 输入.pcsn
ENDOPTION

View File

@@ -700,29 +700,51 @@ public class AcceptFormulaServiceImpl implements AcceptFormulaService {
//该批次配粉重量
double X22p = bomdlt_Cr3C2.getDouble("bom_ivt_qty");
AtomicReference<Double> Z_sum = new AtomicReference<>(0.0);
AtomicReference<Double> Z_sum_per = new AtomicReference<>(0.0);
//计算不需要移库的添加剂(抑制剂)
yzj_map.forEach((key,tjj_map_jo)->{
//获取添加剂id
String tjj_material_id = tjj_map_jo.getString("material_id");
JSONObject tjj_finished = WQL.getWO("QPF_AUTOFORMULA02")
.addParam("material_id",bomdlt_Cr3C2.getString("material_id"))
.addParam("pcsn",bomdlt_Cr3C2.getString("pcsn"))
.addParam("item_material_id",tjj_material_id)
.addParam("flag","5")
.process()
.uniqueResult(0);
if(tjj_finished!=null){
//质保书含量比
double value = tjj_finished.getDouble("value");
//当前含量重量
double finished = X22p*value/100.0;
//累计各碳化钨中已含添加剂重量百分比
Z_sum_per.set(Z_sum_per.get() + value/100.0);
//累计各碳化钨中已含添加剂重量
Z_sum.set(Z_sum.get() + finished);
}
});
//获取碳含量
JSONObject FactoryWarranty = bomdlts_plan_map.get(bomdlt_Cr3C2.getString("material_id"));
//该批次含碳比
double X22 = FactoryWarranty.getDouble("is_tan");
// X1减=[产品碳平衡*X1- X1* X22碳含量]/(1- * X22含量)
//X22p减=产品碳平衡*(Z_sum已+CT1_weight)-CT1-Z_sum已/1- X22碳含量- X22Z1含量+产品碳平衡*X22Z1含量
double X22_jian = CT1_weight*(c_balance/100.0-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-Z_sum_per.get()+(c_balance/100.0)*Z_sum_per.get());
//更新碳化钨配粉重量
double bom_ivt_qty = X22p-X22_jian;
if(bom_ivt_qty < 0){
throw new BadRequestException("碳化钨配粉结果为负数,当前配粉无解!");
}
double C = X22_jian;
double C = X22_jian + bom_ivt_qty*Z_sum_per.get();
if(C < 0){
throw new BadRequestException("补碳结果为负数,当前配粉无解!");
}else if(C >= 0){
bomdlt_Cr3C2.put("bom_ivt_qty",bom_ivt_qty);
bomdlts_plan_map.put(bomdlt_Cr3C2.getString("material_id"),bomdlt_Cr3C2);
//统计除钨以外其他总重
AtomicReference<Double> total_sum = new AtomicReference<>(0.0);
total_sum.set(total_sum.get() + bomdlt_Cr3C2.getDouble("bom_ivt_qty"));
//计算不需要移库的添加剂(抑制剂)
yzj_map.forEach((key,tjj_map_jo)->{
//获取添加剂id
@@ -763,7 +785,6 @@ public class AcceptFormulaServiceImpl implements AcceptFormulaService {
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){
@@ -782,24 +803,6 @@ public class AcceptFormulaServiceImpl implements AcceptFormulaService {
C_weight.put("is_active","1");
C_weight.put("quality_scode","01");
cw_list.add(C_weight);
total_sum.set(total_sum.get() + C);
}
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);
}
}
}
@@ -817,9 +820,31 @@ public class AcceptFormulaServiceImpl implements AcceptFormulaService {
//该批次配粉重量
double X22p = bomdlt_Cr3C2.getDouble("bom_ivt_qty");
// X1减=[产品碳平衡*X1-(X1)* X1碳含量]/1-X1碳含量
AtomicReference<Double> Z_sum = new AtomicReference<>(0.0);
//计算不需要移库的添加剂(抑制剂)
yzj_map.forEach((key,tjj_map_jo)->{
//获取添加剂id
String tjj_material_id = tjj_map_jo.getString("material_id");
JSONObject tjj_finished = WQL.getWO("QPF_AUTOFORMULA01")
.addParam("material_id",bomdlt_Cr3C2.getString("material_id"))
.addParam("pcsn",bomdlt_Cr3C2.getString("pcsn"))
.addParam("item_material_id",tjj_material_id)
.addParam("flag","5")
.process()
.uniqueResult(0);
if(tjj_finished!=null){
//质保书含量比
double value = tjj_finished.getDouble("value");
//当前含量重量
double finished = X22p*value/100.0;
//累计各碳化钨中已含添加剂重量
Z_sum.set(Z_sum.get() + finished);
}
});
// X21p减=[(X21p)* X21碳含量+软废含碳量-产品碳平衡*(X21p+软废碳化钨)]/X21碳含量
//解得钨粉重量
double X22_jian = CT1_weight*(c_balance/100.0-X22/100.0) / (1-X22/100.0);
double X22_jian = (CT1 - (c_balance/100.0)*(CT1_weight)) / (X22/100.0);
//更新碳化钨配粉重量
double bom_ivt_qty = X22p-X22_jian;
if(bom_ivt_qty<=0){