优化
This commit is contained in:
@@ -262,8 +262,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
其中:软废还要返回各成型剂含量*/
|
其中:软废还要返回各成型剂含量*/
|
||||||
//主桶
|
//主桶
|
||||||
JSONArray tableDtl = new JSONArray();
|
JSONArray tableDtl = new JSONArray();
|
||||||
//副桶
|
|
||||||
JSONArray tabledis = new JSONArray();
|
|
||||||
if(xl_list!=null){
|
if(xl_list!=null){
|
||||||
List<JSONObject> list = JSONObject.parseArray(xl_list.toJSONString(), JSONObject.class);
|
List<JSONObject> list = JSONObject.parseArray(xl_list.toJSONString(), JSONObject.class);
|
||||||
Collections.sort(list, (JSONObject o1, JSONObject o2) -> {
|
Collections.sort(list, (JSONObject o1, JSONObject o2) -> {
|
||||||
@@ -288,11 +286,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
});
|
});
|
||||||
} //二次投料
|
} //二次投料
|
||||||
if("1".equals(is_again_put)){
|
if("1".equals(is_again_put)){
|
||||||
rf_list.forEach((value)->{
|
|
||||||
JSONObject jo = (JSONObject) value;
|
|
||||||
jo.put("bucket_type","02");
|
|
||||||
tabledis.add(jo);
|
|
||||||
});
|
|
||||||
yzj_list.forEach((value)->{
|
yzj_list.forEach((value)->{
|
||||||
JSONObject jo = (JSONObject) value;
|
JSONObject jo = (JSONObject) value;
|
||||||
jo.put("is_need_manage","1");
|
jo.put("is_need_manage","1");
|
||||||
@@ -435,108 +428,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
dtl_new.add(jo);
|
dtl_new.add(jo);
|
||||||
}
|
}
|
||||||
|
|
||||||
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"))) {
|
|
||||||
jo.put("is_"+jo.getString("formingtype_code"),"100");
|
|
||||||
}else if(StrUtil.isNotEmpty(material_type_id) && MaterOptTypeEnum.RD_AND_PG.getClass_idStr().contains(material_type_id)){//软废
|
|
||||||
String jo_material_id = jo.getString("material_id");
|
|
||||||
JSONArray bomdlts = WQL.getWO("QPF_AUTOFORMULA01")
|
|
||||||
.addParam("material_id",jo_material_id)
|
|
||||||
.addParam("flag","1")
|
|
||||||
.process().getResultJSONArray(0);
|
|
||||||
//各成型剂需配总量
|
|
||||||
HashMap<String,Double> bomdlts_map = new HashMap<String,Double>();
|
|
||||||
bomdlts_map.put("09030102",0.0);
|
|
||||||
bomdlts_map.put("CXJ001",0.0);
|
|
||||||
bomdlts_map.put("CXJ003",0.0);
|
|
||||||
bomdlts_map.put("CXJ004",0.0);
|
|
||||||
bomdlts_map.put("CXJ005",0.0);
|
|
||||||
bomdlts_map.put("CXJ006",0.0);
|
|
||||||
bomdlts_map.put("CXJ007",0.0);
|
|
||||||
bomdlts_map.put("CXJ008",0.0);
|
|
||||||
bomdlts_map.put("CXJ002",0.0);
|
|
||||||
for(int j=0;j<bomdlts.size();j++){
|
|
||||||
JSONObject bomdtl = bomdlts.getJSONObject(j);
|
|
||||||
String formingtype_code = bomdtl.getString("formingtype_code");
|
|
||||||
if( bomdtl.getString("class_code").equals("09030102")){
|
|
||||||
bomdlts_map.put("09030102",bomdlts_map.get("09030102")+bomdtl.getDouble("standard_rate"));
|
|
||||||
}else if(bomdlts_map.containsKey(formingtype_code)){
|
|
||||||
bomdlts_map.put(formingtype_code,bomdlts_map.get(formingtype_code)+bomdtl.getDouble("standard_rate"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
bomdlts_map.forEach((key,bomdlts2_now)->{
|
|
||||||
if(bomdlts2_now>0){
|
|
||||||
jo.put("is_"+key,bomdlts2_now+"");
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}else if(StrUtil.isNotEmpty(material_type_id) && MaterOptTypeEnum.THW.getClass_idStr().contains(material_type_id)){//碳化钨新料
|
|
||||||
//获取碳含量
|
|
||||||
JSONObject FactoryWarranty = WQL.getWO("QPF_AUTOFORMULA01")
|
|
||||||
.addParam("material_id",jo.getString("material_id"))
|
|
||||||
.addParam("pcsn",jo.getString("pcsn"))
|
|
||||||
.addParam("flag","3")
|
|
||||||
.process()
|
|
||||||
.uniqueResult(0);
|
|
||||||
if(FactoryWarranty==null){
|
|
||||||
jo.put("is_tan","0");
|
|
||||||
}else{
|
|
||||||
//含碳比
|
|
||||||
double value = FactoryWarranty.getDouble("value");
|
|
||||||
//更新含碳比
|
|
||||||
jo.put("is_tan",value);
|
|
||||||
}
|
|
||||||
//获取碳化铬
|
|
||||||
JSONObject FactoryWarranty2 = WQL.getWO("QPF_AUTOFORMULA01")
|
|
||||||
.addParam("material_id",jo.getString("material_id"))
|
|
||||||
.addParam("dtlmaterial_id","CJZB00021")
|
|
||||||
.addParam("pcsn",jo.getString("pcsn"))
|
|
||||||
.addParam("flag","33")
|
|
||||||
.process()
|
|
||||||
.uniqueResult(0);
|
|
||||||
if(FactoryWarranty2==null){
|
|
||||||
jo.put("is_CJZB00021","0");
|
|
||||||
}else{
|
|
||||||
//含碳比
|
|
||||||
double value = FactoryWarranty2.getDouble("value");
|
|
||||||
//更新含碳比
|
|
||||||
jo.put("is_CJZB00021",value);
|
|
||||||
}
|
|
||||||
//获取碳化钒
|
|
||||||
JSONObject FactoryWarranty3 = WQL.getWO("QPF_AUTOFORMULA01")
|
|
||||||
.addParam("material_id",jo.getString("material_id"))
|
|
||||||
.addParam("dtlmaterial_id","CJZB00020")
|
|
||||||
.addParam("pcsn",jo.getString("pcsn"))
|
|
||||||
.addParam("flag","33")
|
|
||||||
.process()
|
|
||||||
.uniqueResult(0);
|
|
||||||
if(FactoryWarranty3==null){
|
|
||||||
jo.put("is_CJZB00020","0");
|
|
||||||
}else{
|
|
||||||
//含碳比
|
|
||||||
double value = FactoryWarranty3.getDouble("value");
|
|
||||||
//更新含碳比
|
|
||||||
jo.put("is_CJZB00020",value);
|
|
||||||
}
|
|
||||||
}else if(MaterOptTypeEnum.GF.getClass_idStr().contains(jo.getString("material_id")) ||(StrUtil.isNotEmpty(material_type_id) && MaterOptTypeEnum.GF.getClass_idStr().contains(material_type_id))){//钴粉新料
|
|
||||||
//如果该物料是钴粉
|
|
||||||
jo.put("is_09030102","100");
|
|
||||||
}else if(MaterOptTypeEnum.TF.getClass_idStr().contains(jo.getString("material_id")) ||(StrUtil.isNotEmpty(material_type_id) && MaterOptTypeEnum.TF.getClass_idStr().contains(material_type_id))){//C粉新料
|
|
||||||
//如果该物料是c粉
|
|
||||||
jo.put("is_tan","100");
|
|
||||||
}
|
|
||||||
tabledis_new.add(jo);
|
|
||||||
}
|
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("tabledis",tabledis_new);
|
|
||||||
result.put("tableDtl",dtl_new);
|
result.put("tableDtl",dtl_new);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -3136,8 +3028,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
其中:软废还要返回各成型剂含量*/
|
其中:软废还要返回各成型剂含量*/
|
||||||
//主桶
|
//主桶
|
||||||
JSONArray tableDtl = new JSONArray();
|
JSONArray tableDtl = new JSONArray();
|
||||||
//副桶
|
|
||||||
JSONArray tabledis = new JSONArray();
|
|
||||||
if(xl_list!=null){
|
if(xl_list!=null){
|
||||||
List<JSONObject> list = JSONObject.parseArray(xl_list.toJSONString(), JSONObject.class);
|
List<JSONObject> list = JSONObject.parseArray(xl_list.toJSONString(), JSONObject.class);
|
||||||
Collections.sort(list, (JSONObject o1, JSONObject o2) -> {
|
Collections.sort(list, (JSONObject o1, JSONObject o2) -> {
|
||||||
@@ -3286,7 +3176,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
dtl_new.add(jo);
|
dtl_new.add(jo);
|
||||||
}
|
}
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("tabledis",tabledis);
|
|
||||||
result.put("tableDtl",dtl_new);
|
result.put("tableDtl",dtl_new);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -3416,15 +3305,19 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
JSONObject jo = now_ivts.getJSONObject(j);
|
JSONObject jo = now_ivts.getJSONObject(j);
|
||||||
double can_qty = net_qty*add_rate/100.0;
|
double can_qty = net_qty*add_rate/100.0;
|
||||||
JSONObject jo2 = new JSONObject();
|
JSONObject jo2 = new JSONObject();
|
||||||
jo2.put("can_qty",can_qty);
|
String ivt_material_id = jo.getString("material_id");
|
||||||
jo2.put("can_left_qty",can_qty);
|
double net_rate = net_rate_map.get(ivt_material_id);
|
||||||
|
|
||||||
|
double net_can_qty = can_qty/(net_rate/100.0);
|
||||||
|
jo2.put("can_qty",net_can_qty);
|
||||||
|
jo2.put("can_left_qty",net_can_qty);
|
||||||
rf_plan_map.put(set_material_id,jo2);
|
rf_plan_map.put(set_material_id,jo2);
|
||||||
|
|
||||||
double sum_ivt_qty = jo.getDouble("sum_ivt_qty");
|
double sum_ivt_qty = jo.getDouble("sum_ivt_qty");
|
||||||
if(can_qty >= sum_ivt_qty){
|
if(net_can_qty >= sum_ivt_qty){
|
||||||
jo.put("can_qty",sum_ivt_qty);
|
jo.put("can_qty",sum_ivt_qty);
|
||||||
}else{
|
}else{
|
||||||
jo.put("can_qty",can_qty);
|
jo.put("can_qty",net_can_qty);
|
||||||
}
|
}
|
||||||
ivts.add(jo);
|
ivts.add(jo);
|
||||||
}
|
}
|
||||||
@@ -4656,6 +4549,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
//纯粉重量
|
//纯粉重量
|
||||||
double net_qty = workorder_qty;
|
double net_qty = workorder_qty;
|
||||||
|
|
||||||
|
double chunfen_qty = -1;
|
||||||
|
|
||||||
//rf最高开单重量
|
//rf最高开单重量
|
||||||
HashMap<String,JSONObject> rf_plan_map = new HashMap<String,JSONObject>();
|
HashMap<String,JSONObject> rf_plan_map = new HashMap<String,JSONObject>();
|
||||||
|
|
||||||
@@ -4698,19 +4593,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
return item.getDouble("net_rate");
|
return item.getDouble("net_rate");
|
||||||
}
|
}
|
||||||
));
|
));
|
||||||
|
|
||||||
//获取c_balance
|
|
||||||
Map<String, Double> c_balance_map = MaterialSets.stream().filter(Objects::nonNull)
|
|
||||||
.collect(Collectors.toMap(
|
|
||||||
object -> {
|
|
||||||
JSONObject item = (JSONObject) object;
|
|
||||||
return item.getString("set_material_id");
|
|
||||||
},
|
|
||||||
object -> {
|
|
||||||
JSONObject item = (JSONObject) object;
|
|
||||||
return item.getDouble("c_balance");
|
|
||||||
}
|
|
||||||
));
|
|
||||||
WQLObject wo_param = WQLObject.getWQLObject("sys_param");
|
WQLObject wo_param = WQLObject.getWQLObject("sys_param");
|
||||||
JSONObject param = wo_param.query("is_active='1' and is_delete='0' and code='IS_LIMIT_RF'").uniqueResult(0);
|
JSONObject param = wo_param.query("is_active='1' and is_delete='0' and code='IS_LIMIT_RF'").uniqueResult(0);
|
||||||
if (ObjectUtil.isEmpty(param)) {
|
if (ObjectUtil.isEmpty(param)) {
|
||||||
@@ -4789,16 +4671,17 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
if(rf_ivts>=waste_limit_down_weight){//软废库存足够
|
if(rf_ivts>=waste_limit_down_weight){//软废库存足够
|
||||||
JSONObject ret = this.autoCalculationBy03_ruanfei(json);
|
JSONObject ret = this.autoCalculationBy03_ruanfei(json);
|
||||||
|
chunfen_qty = ret.getDouble("chunfen_qty");
|
||||||
rf_list = ret.getJSONArray("rf_list");
|
rf_list = ret.getJSONArray("rf_list");
|
||||||
xl_list = ret.getJSONArray("xl_list");
|
xl_list = ret.getJSONArray("xl_list");
|
||||||
cxj_list = ret.getJSONArray("cxj_list");
|
cxj_list = ret.getJSONArray("cxj_list");
|
||||||
yzj_list = ret.getJSONArray("yzj_list");
|
yzj_list = ret.getJSONArray("yzj_list");
|
||||||
cw_list = ret.getJSONArray("cw_list");
|
cw_list = ret.getJSONArray("cw_list");
|
||||||
}else{
|
}else{
|
||||||
throw new BadRequestException("产品"+material_code+"配粉开单失败,软废库存不足!");
|
throw new BadRequestException("软废库存纯粉重量为"+NumberUtil.round(rf_ivts,3).doubleValue()+"公斤,不足下限!");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
throw new BadRequestException("产品"+material_code+"配粉开单失败,软废库存不足!");
|
throw new BadRequestException("软废库存纯粉重量为0公斤,不足下限!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4809,8 +4692,6 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
其中:软废还要返回各成型剂含量*/
|
其中:软废还要返回各成型剂含量*/
|
||||||
//主桶
|
//主桶
|
||||||
JSONArray tableDtl = new JSONArray();
|
JSONArray tableDtl = new JSONArray();
|
||||||
//副桶
|
|
||||||
JSONArray tabledis = new JSONArray();
|
|
||||||
if(xl_list!=null){
|
if(xl_list!=null){
|
||||||
List<JSONObject> list = JSONObject.parseArray(xl_list.toJSONString(), JSONObject.class);
|
List<JSONObject> list = JSONObject.parseArray(xl_list.toJSONString(), JSONObject.class);
|
||||||
Collections.sort(list, (JSONObject o1, JSONObject o2) -> {
|
Collections.sort(list, (JSONObject o1, JSONObject o2) -> {
|
||||||
@@ -4959,8 +4840,8 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
dtl_new.add(jo);
|
dtl_new.add(jo);
|
||||||
}
|
}
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
result.put("tabledis",tabledis);
|
|
||||||
result.put("tableDtl",dtl_new);
|
result.put("tableDtl",dtl_new);
|
||||||
|
result.put("chunfen_qty",chunfen_qty);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4973,6 +4854,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
JSONObject autoCalculationBy03_ruanfei(JSONObject json){
|
JSONObject autoCalculationBy03_ruanfei(JSONObject json){
|
||||||
//定义返回值
|
//定义返回值
|
||||||
JSONObject ret = new JSONObject();
|
JSONObject ret = new JSONObject();
|
||||||
|
ret.put("chunfen_qty","-1");
|
||||||
//工令
|
//工令
|
||||||
String workorder_id = json.getString("workorder_id");
|
String workorder_id = json.getString("workorder_id");
|
||||||
//软废下限
|
//软废下限
|
||||||
@@ -5096,15 +4978,19 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
JSONObject jo = now_ivts.getJSONObject(j);
|
JSONObject jo = now_ivts.getJSONObject(j);
|
||||||
double can_qty = net_qty*add_rate/100.0;
|
double can_qty = net_qty*add_rate/100.0;
|
||||||
JSONObject jo2 = new JSONObject();
|
JSONObject jo2 = new JSONObject();
|
||||||
jo2.put("can_qty",can_qty);
|
String ivt_material_id = jo.getString("material_id");
|
||||||
jo2.put("can_left_qty",can_qty);
|
double net_rate = net_rate_map.get(ivt_material_id);
|
||||||
|
|
||||||
|
double net_can_qty = NumberUtil.roundDown(can_qty/(net_rate/100.0),4).doubleValue();
|
||||||
|
jo2.put("can_qty",net_can_qty);
|
||||||
|
jo2.put("can_left_qty",net_can_qty);
|
||||||
rf_plan_map.put(set_material_id,jo2);
|
rf_plan_map.put(set_material_id,jo2);
|
||||||
|
|
||||||
double sum_ivt_qty = jo.getDouble("sum_ivt_qty");
|
double sum_ivt_qty = jo.getDouble("sum_ivt_qty");
|
||||||
if(can_qty >= sum_ivt_qty){
|
if(net_can_qty >= sum_ivt_qty){
|
||||||
jo.put("can_qty",sum_ivt_qty);
|
jo.put("can_qty",sum_ivt_qty);
|
||||||
}else{
|
}else{
|
||||||
jo.put("can_qty",can_qty);
|
jo.put("can_qty",net_can_qty);
|
||||||
}
|
}
|
||||||
ivts.add(jo);
|
ivts.add(jo);
|
||||||
}
|
}
|
||||||
@@ -5173,7 +5059,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
for(int i=0;i<ivts_new.size();i++){
|
for(int i=0;i<ivts_new.size();i++){
|
||||||
JSONObject ivt_new = ivts_new.getJSONObject(i);
|
JSONObject ivt_new = ivts_new.getJSONObject(i);
|
||||||
double ivt_qty = ivt_new.getDouble("can_qty");
|
double ivt_qty = ivt_new.getDouble("can_qty");
|
||||||
ivt_qty = NumberUtil.roundDown(ivt_qty,3).doubleValue();
|
ivt_qty = NumberUtil.roundDown(ivt_qty,4).doubleValue();
|
||||||
if(ivt_qty <=0){
|
if(ivt_qty <=0){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -5220,7 +5106,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
if(bomdlts_need_map.containsKey(fi_bomdtl_material_id)){
|
if(bomdlts_need_map.containsKey(fi_bomdtl_material_id)){
|
||||||
JSONObject bomdlt = bomdlts_need_map.get(fi_bomdtl_material_id);
|
JSONObject bomdlt = bomdlts_need_map.get(fi_bomdtl_material_id);
|
||||||
double left_qty = bomdlt.getDouble("left_qty");
|
double left_qty = bomdlt.getDouble("left_qty");
|
||||||
left_qty = NumberUtil.round(left_qty,3).doubleValue();
|
left_qty = NumberUtil.roundDown(left_qty,4).doubleValue();
|
||||||
if(left_qty==0){
|
if(left_qty==0){
|
||||||
continue outer;
|
continue outer;
|
||||||
}
|
}
|
||||||
@@ -5247,17 +5133,16 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
//更新产品所需物料的所需重量
|
//更新产品所需物料的所需重量
|
||||||
JSONObject bomdlt = bomdlts_need_map.get(fi_bomdtl_material_id);
|
JSONObject bomdlt = bomdlts_need_map.get(fi_bomdtl_material_id);
|
||||||
double left_qty = bomdlt.getDouble("left_qty");
|
double left_qty = bomdlt.getDouble("left_qty");
|
||||||
left_qty = NumberUtil.round(left_qty,3).doubleValue();
|
left_qty = NumberUtil.roundDown(left_qty,4).doubleValue();
|
||||||
if(left_qty<now_qty){
|
if(left_qty<now_qty){
|
||||||
left_qty = 0;
|
left_qty = 0;
|
||||||
bomdlt.put("left_qty",left_qty);
|
bomdlt.put("left_qty",left_qty);
|
||||||
bomdlts_need_map.put(fi_bomdtl_material_id,bomdlt);
|
bomdlts_need_map.put(fi_bomdtl_material_id,bomdlt);
|
||||||
}else{
|
}else{
|
||||||
left_qty = NumberUtil.round(left_qty - now_qty,3).doubleValue();
|
left_qty = NumberUtil.roundDown(left_qty - now_qty,4).doubleValue();
|
||||||
bomdlt.put("left_qty",left_qty);
|
bomdlt.put("left_qty",left_qty);
|
||||||
bomdlts_need_map.put(fi_bomdtl_material_id,bomdlt);
|
bomdlts_need_map.put(fi_bomdtl_material_id,bomdlt);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
//当前已配重量
|
//当前已配重量
|
||||||
ivt_new.put("formula_qty",rf_up_formula_qty);
|
ivt_new.put("formula_qty",rf_up_formula_qty);
|
||||||
@@ -5271,12 +5156,29 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
rf_map.put(ivt_new.getString("stockrecord_id"),ivt_new);
|
rf_map.put(ivt_new.getString("stockrecord_id"),ivt_new);
|
||||||
rf_list.add(ivt_new);
|
rf_list.add(ivt_new);
|
||||||
}
|
}
|
||||||
|
//bj_bomdlts_map中所有需补重量和
|
||||||
|
AtomicReference<Double> sum_chunfen = new AtomicReference<>(0.0);
|
||||||
|
for(int i=0;i<rf_list.size();i++){
|
||||||
|
JSONObject jo = rf_list.getJSONObject(i);
|
||||||
|
double net_rate = jo.getDouble("net_rate");
|
||||||
|
double net_rate_qty = jo.getDouble("formula_qty")*net_rate/100.0;
|
||||||
|
sum_chunfen.set(sum_chunfen.get()+ NumberUtil.roundDown(net_rate_qty,3).doubleValue());
|
||||||
|
}
|
||||||
|
double new_net_qty = net_qty - 1;
|
||||||
|
if(sum_chunfen.get() < new_net_qty){
|
||||||
|
ret.put("chunfen_qty",sum_chunfen.get());
|
||||||
|
rf_list2 = new JSONArray();
|
||||||
|
xl_list2 = new JSONArray();
|
||||||
|
cxj_list = new JSONArray();
|
||||||
|
yzj_list = new JSONArray();
|
||||||
|
cw_list = new JSONArray();
|
||||||
|
}else{
|
||||||
//用新料补足剩余部分
|
//用新料补足剩余部分
|
||||||
JSONArray finalXl_list = xl_list;
|
JSONArray finalXl_list = xl_list;
|
||||||
bomdlts_need_map.forEach((key, bomdlt)->{
|
bomdlts_need_map.forEach((key, bomdlt)->{
|
||||||
String bomdtl_material_id = bomdlt.getString("material_id");
|
String bomdtl_material_id = bomdlt.getString("material_id");
|
||||||
double left_qty = bomdlt.getDouble("left_qty");
|
double left_qty = bomdlt.getDouble("left_qty");
|
||||||
left_qty = NumberUtil.round(left_qty,3).doubleValue();
|
left_qty = NumberUtil.roundDown(left_qty,4).doubleValue();
|
||||||
String is_need_move = bomdlt.getString("is_need_move");
|
String is_need_move = bomdlt.getString("is_need_move");
|
||||||
//获取Y1、X1、X2….剩余>0的物料
|
//获取Y1、X1、X2….剩余>0的物料
|
||||||
if(left_qty>0){
|
if(left_qty>0){
|
||||||
@@ -5308,7 +5210,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
double ivt_qty = now_ivt.getDouble("sum_ivt_qty");
|
double ivt_qty = now_ivt.getDouble("sum_ivt_qty");
|
||||||
ivt_qty = NumberUtil.roundDown(ivt_qty,3).doubleValue();
|
ivt_qty = NumberUtil.roundDown(ivt_qty,4).doubleValue();
|
||||||
if(ivt_qty <=0 || ivt_qty<0.01){
|
if(ivt_qty <=0 || ivt_qty<0.01){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -5339,7 +5241,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
now_ivt.put("need_sum_qty",bomdlt.getString("need_sum_qty"));
|
now_ivt.put("need_sum_qty",bomdlt.getString("need_sum_qty"));
|
||||||
now_ivt.put("is_need_move",bomdlt.getString("is_need_move"));
|
now_ivt.put("is_need_move",bomdlt.getString("is_need_move"));
|
||||||
now_ivt.put("is_need_manage","1");
|
now_ivt.put("is_need_manage","1");
|
||||||
left_qty = NumberUtil.round(left_qty - ivt_qty,3).doubleValue();
|
left_qty = NumberUtil.round(left_qty - ivt_qty,4).doubleValue();
|
||||||
finalXl_list.add(now_ivt);
|
finalXl_list.add(now_ivt);
|
||||||
//如果该物料是碳化钨
|
//如果该物料是碳化钨
|
||||||
if(MaterOptTypeEnum.THW.getClass_idStr().contains(now_ivt.getString("material_type_id"))){
|
if(MaterOptTypeEnum.THW.getClass_idStr().contains(now_ivt.getString("material_type_id"))){
|
||||||
@@ -5851,14 +5753,14 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
JSONObject ivt_new = rf_list.getJSONObject(i);
|
JSONObject ivt_new = rf_list.getJSONObject(i);
|
||||||
//R1p*R1纯粉系数
|
//R1p*R1纯粉系数
|
||||||
double net_rate_qty = ivt_new.getDouble("formula_qty")*ivt_new.getDouble("net_rate")/100.0;
|
double net_rate_qty = ivt_new.getDouble("formula_qty")*ivt_new.getDouble("net_rate")/100.0;
|
||||||
W = NumberUtil.round(W - net_rate_qty,3).doubleValue();
|
W = NumberUtil.round(W - net_rate_qty,4).doubleValue();
|
||||||
}
|
}
|
||||||
//桶重量 - (R1p*R1纯粉系数+ R2p*R2纯粉系数…) - (Y1p+X1p+X2p…)
|
//桶重量 - (R1p*R1纯粉系数+ R2p*R2纯粉系数…) - (Y1p+X1p+X2p…)
|
||||||
for(int i=0;i<xl_list.size();i++){
|
for(int i=0;i<xl_list.size();i++){
|
||||||
JSONObject bomdlt = xl_list.getJSONObject(i);
|
JSONObject bomdlt = xl_list.getJSONObject(i);
|
||||||
//Y1p+X1p+X2p
|
//Y1p+X1p+X2p
|
||||||
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,4).doubleValue();
|
||||||
}
|
}
|
||||||
if(W<=0){
|
if(W<=0){
|
||||||
W = 0;
|
W = 0;
|
||||||
@@ -5966,7 +5868,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
//R3p减=W补+Y1补+Z1补+ Z2补
|
//R3p减=W补+Y1补+Z1补+ Z2补
|
||||||
double W_bu = NumberUtil.round(R3p_jian - sum_bu.get(),3).doubleValue();
|
double W_bu = NumberUtil.round(R3p_jian - sum_bu.get(),4).doubleValue();
|
||||||
if(W_bu<=0) {
|
if(W_bu<=0) {
|
||||||
if (rf_list.size() == 1) {
|
if (rf_list.size() == 1) {
|
||||||
throw new BadRequestException("无解!");
|
throw new BadRequestException("无解!");
|
||||||
@@ -6014,7 +5916,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
});
|
});
|
||||||
// R3p=R3p-R3p减/ R3纯粉系数
|
// R3p=R3p-R3p减/ R3纯粉系数
|
||||||
double r3_formula_qty = R3p.getDouble("formula_qty");
|
double r3_formula_qty = R3p.getDouble("formula_qty");
|
||||||
r3_formula_qty = NumberUtil.round(r3_formula_qty - R3p_jian/(R3p.getDouble("net_rate")/100.0),3).doubleValue();
|
r3_formula_qty = NumberUtil.round(r3_formula_qty - R3p_jian/(R3p.getDouble("net_rate")/100.0),4).doubleValue();
|
||||||
R3p.put("formula_qty",r3_formula_qty);
|
R3p.put("formula_qty",r3_formula_qty);
|
||||||
rf_map.put(R3p.getString("stockrecord_id"),R3p);
|
rf_map.put(R3p.getString("stockrecord_id"),R3p);
|
||||||
if(r3_formula_qty<=0){
|
if(r3_formula_qty<=0){
|
||||||
@@ -6080,7 +5982,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
//R3p减=W补+Y1补+Z1补+ Z2补
|
//R3p减=W补+Y1补+Z1补+ Z2补
|
||||||
double W_bu = NumberUtil.round(R3p_jian + R2p_jian - sum_bu.get(),3).doubleValue();
|
double W_bu = NumberUtil.round(R3p_jian + R2p_jian - sum_bu.get(),4).doubleValue();
|
||||||
if(W_bu<=0) {
|
if(W_bu<=0) {
|
||||||
throw new BadRequestException("无解!");
|
throw new BadRequestException("无解!");
|
||||||
}
|
}
|
||||||
@@ -6135,7 +6037,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
});
|
});
|
||||||
// R3p=R3p-R3p减/ R3纯粉系数
|
// R3p=R3p-R3p减/ R3纯粉系数
|
||||||
double r3_formula_qty = R3p.getDouble("formula_qty");
|
double r3_formula_qty = R3p.getDouble("formula_qty");
|
||||||
r3_formula_qty = NumberUtil.round(r3_formula_qty - r3_formula_qty/(R3p.getDouble("net_rate")/100.0),3).doubleValue();
|
r3_formula_qty = NumberUtil.round(r3_formula_qty - r3_formula_qty/(R3p.getDouble("net_rate")/100.0),4).doubleValue();
|
||||||
R3p.put("formula_qty",r3_formula_qty);
|
R3p.put("formula_qty",r3_formula_qty);
|
||||||
rf_map.put(R3p.getString("stockrecord_id"),R3p);
|
rf_map.put(R3p.getString("stockrecord_id"),R3p);
|
||||||
if(r3_formula_qty<=0){
|
if(r3_formula_qty<=0){
|
||||||
@@ -6143,7 +6045,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
}
|
}
|
||||||
// R2p=R2p-R2p减/ R2纯粉系数
|
// R2p=R2p-R2p减/ R2纯粉系数
|
||||||
double r2_formula_qty = R2p.getDouble("formula_qty");
|
double r2_formula_qty = R2p.getDouble("formula_qty");
|
||||||
r2_formula_qty = NumberUtil.round(r2_formula_qty - R2p_jian/(R2p.getDouble("net_rate")/100.0),3).doubleValue();
|
r2_formula_qty = NumberUtil.round(r2_formula_qty - R2p_jian/(R2p.getDouble("net_rate")/100.0),4).doubleValue();
|
||||||
R2p.put("formula_qty",r2_formula_qty);
|
R2p.put("formula_qty",r2_formula_qty);
|
||||||
rf_map.put(R2p.getString("stockrecord_id"),R2p);
|
rf_map.put(R2p.getString("stockrecord_id"),R2p);
|
||||||
if(r2_formula_qty<=0){
|
if(r2_formula_qty<=0){
|
||||||
@@ -6186,7 +6088,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
if(bomdlts_plan.getString("is_flag").equals("-1")){
|
if(bomdlts_plan.getString("is_flag").equals("-1")){
|
||||||
String bomdtl_material_id = bomdlts_plan.getString("material_id");
|
String bomdtl_material_id = bomdlts_plan.getString("material_id");
|
||||||
double left_qty = bomdlts_plan.getDouble("formula_qty");
|
double left_qty = bomdlts_plan.getDouble("formula_qty");
|
||||||
left_qty = NumberUtil.round(left_qty,3).doubleValue();
|
left_qty = NumberUtil.round(left_qty,4).doubleValue();
|
||||||
String is_need_move = bomdlts_plan.getString("is_need_move");
|
String is_need_move = bomdlts_plan.getString("is_need_move");
|
||||||
String prior_level = bomdlts_plan.getString("prior_level");
|
String prior_level = bomdlts_plan.getString("prior_level");
|
||||||
if (StrUtil.isEmpty(prior_level)) {
|
if (StrUtil.isEmpty(prior_level)) {
|
||||||
@@ -6215,7 +6117,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
double ivt_qty = now_ivt.getDouble("sum_ivt_qty");
|
double ivt_qty = now_ivt.getDouble("sum_ivt_qty");
|
||||||
ivt_qty = NumberUtil.roundDown(ivt_qty,3).doubleValue();
|
ivt_qty = NumberUtil.roundDown(ivt_qty,4).doubleValue();
|
||||||
if(ivt_qty<=0 || ivt_qty<0.01){
|
if(ivt_qty<=0 || ivt_qty<0.01){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -6238,7 +6140,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
now_ivt.put("material_type","01");
|
now_ivt.put("material_type","01");
|
||||||
now_ivt.put("is_need_move",bomdlts_plan.getString("is_need_move"));
|
now_ivt.put("is_need_move",bomdlts_plan.getString("is_need_move"));
|
||||||
now_ivt.put("is_need_manage","1");
|
now_ivt.put("is_need_manage","1");
|
||||||
left_qty = NumberUtil.round(left_qty - ivt_qty,3).doubleValue();
|
left_qty = NumberUtil.round(left_qty - ivt_qty,4).doubleValue();
|
||||||
xl_list3.add(now_ivt);
|
xl_list3.add(now_ivt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6284,12 +6186,17 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
xl_list_map.put(key,jo_xl);
|
xl_list_map.put(key,jo_xl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
JSONArray finalXl_list1 = xl_list2;
|
||||||
xl_list_map.forEach((key, bomdlts_plan)->{
|
xl_list_map.forEach((key, bomdlts_plan)->{
|
||||||
xl_list2.add(bomdlts_plan);
|
finalXl_list1.add(bomdlts_plan);
|
||||||
});
|
});
|
||||||
|
xl_list2 = finalXl_list1;
|
||||||
|
JSONArray finalRf_list = rf_list2;
|
||||||
rf_map.forEach((key, bomdlts_plan)->{
|
rf_map.forEach((key, bomdlts_plan)->{
|
||||||
rf_list2.add(bomdlts_plan);
|
finalRf_list.add(bomdlts_plan);
|
||||||
});
|
});
|
||||||
|
rf_list2 = finalRf_list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ret.put("rf_list",rf_list2);
|
ret.put("rf_list",rf_list2);
|
||||||
@@ -6347,7 +6254,7 @@ public class AutoformulaServiceImpl implements AutoformulaService {
|
|||||||
result = this.autoCalculationBy01(workorder);
|
result = this.autoCalculationBy01(workorder);
|
||||||
JSONArray tableDtl = result.getJSONArray("tableDtl");
|
JSONArray tableDtl = result.getJSONArray("tableDtl");
|
||||||
//副桶
|
//副桶
|
||||||
JSONArray tabledis = result.getJSONArray("tabledis");
|
JSONArray tabledis = new JSONArray();
|
||||||
workorder.put("tabledis",tabledis);
|
workorder.put("tabledis",tabledis);
|
||||||
workorder.put("tableDtl",tableDtl);
|
workorder.put("tableDtl",tableDtl);
|
||||||
workorder.put("remark","自动开单");
|
workorder.put("remark","自动开单");
|
||||||
|
|||||||
@@ -80,6 +80,7 @@
|
|||||||
style="width: 210px"
|
style="width: 210px"
|
||||||
placeholder="是否二次投料"
|
placeholder="是否二次投料"
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
|
disabled
|
||||||
@change="storChange2"
|
@change="storChange2"
|
||||||
>
|
>
|
||||||
<el-option
|
<el-option
|
||||||
@@ -314,15 +315,6 @@
|
|||||||
disabled
|
disabled
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- <el-form-item label="添加物料重量" prop="add_qty2">
|
|
||||||
<el-input-number
|
|
||||||
v-model="form2.add_qty2"
|
|
||||||
:controls="false"
|
|
||||||
:precision="3"
|
|
||||||
:min="0"
|
|
||||||
disabled
|
|
||||||
/>
|
|
||||||
</el-form-item>-->
|
|
||||||
</el-form>
|
</el-form>
|
||||||
</div>
|
</div>
|
||||||
<span class="crud-opts-right2">
|
<span class="crud-opts-right2">
|
||||||
@@ -439,6 +431,7 @@ export default {
|
|||||||
mstrow: {},
|
mstrow: {},
|
||||||
tabledis: [],
|
tabledis: [],
|
||||||
XLList: [],
|
XLList: [],
|
||||||
|
chunfen_qty: '0',
|
||||||
form: { waste_limit_down: 0, waste_limit_uo: 0 },
|
form: { waste_limit_down: 0, waste_limit_uo: 0 },
|
||||||
form2: {
|
form2: {
|
||||||
total_qty1: '0',
|
total_qty1: '0',
|
||||||
@@ -480,6 +473,7 @@ export default {
|
|||||||
this.button1 = true
|
this.button1 = true
|
||||||
this.button2 = false
|
this.button2 = false
|
||||||
}
|
}
|
||||||
|
this.form.is_again_put = '0'
|
||||||
if (this.form.is_again_put === '1' && this.form.formula_type === '00') {
|
if (this.form.is_again_put === '1' && this.form.formula_type === '00') {
|
||||||
this.button3 = false
|
this.button3 = false
|
||||||
} else {
|
} else {
|
||||||
@@ -498,7 +492,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.tableDtl.splice(i, 1, row)
|
this.tableDtl.splice(i, 1, row)
|
||||||
}
|
}
|
||||||
this.tabledis = res.tabledis
|
/* this.tabledis = res.tabledis
|
||||||
this.form2.total_qty2 = 0
|
this.form2.total_qty2 = 0
|
||||||
this.form2.add_qty2 = 0
|
this.form2.add_qty2 = 0
|
||||||
for (let i = 0; i < this.tabledis.length; i++) {
|
for (let i = 0; i < this.tabledis.length; i++) {
|
||||||
@@ -510,7 +504,7 @@ export default {
|
|||||||
this.form2.add_qty2 = this.form2.add_qty2 + parseFloat(row.formula_qty)
|
this.form2.add_qty2 = this.form2.add_qty2 + parseFloat(row.formula_qty)
|
||||||
}
|
}
|
||||||
this.tabledis.splice(i, 1, row)
|
this.tabledis.splice(i, 1, row)
|
||||||
}
|
}*/
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
moveUp(index, item) {
|
moveUp(index, item) {
|
||||||
@@ -1099,6 +1093,16 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
autoCalculation() {
|
autoCalculation() {
|
||||||
|
if (this.form.formula_type === '03') {
|
||||||
|
this.fullscreenLoading = true
|
||||||
|
autoformula.autoCalculation(this.form).then(res => {
|
||||||
|
this.crud.notify('自动计算成功!')
|
||||||
|
this.chunfen_qty = res.chunfen_qty
|
||||||
|
this.fullscreenLoading = false
|
||||||
|
if ((parseFloat(this.chunfen_qty) > 0) && (parseFloat(this.chunfen_qty) < parseFloat(this.form.workorder_qty))) {
|
||||||
|
this.$confirm('软废纯粉重量为' + parseFloat(this.chunfen_qty) + '公斤,不足工令重量,是否继续?')
|
||||||
|
.then(_ => {
|
||||||
|
this.form.workorder_qty = parseFloat(this.chunfen_qty)
|
||||||
this.fullscreenLoading = true
|
this.fullscreenLoading = true
|
||||||
autoformula.autoCalculation(this.form).then(res => {
|
autoformula.autoCalculation(this.form).then(res => {
|
||||||
this.crud.notify('自动计算成功!')
|
this.crud.notify('自动计算成功!')
|
||||||
@@ -1115,7 +1119,7 @@ export default {
|
|||||||
}
|
}
|
||||||
this.tableDtl.splice(i, 1, row)
|
this.tableDtl.splice(i, 1, row)
|
||||||
}
|
}
|
||||||
this.tabledis = res.tabledis
|
/* this.tabledis = res.tabledis
|
||||||
this.form2.total_qty2 = 0
|
this.form2.total_qty2 = 0
|
||||||
this.form2.add_qty2 = 0
|
this.form2.add_qty2 = 0
|
||||||
for (let i = 0; i < this.tabledis.length; i++) {
|
for (let i = 0; i < this.tabledis.length; i++) {
|
||||||
@@ -1127,11 +1131,68 @@ export default {
|
|||||||
this.form2.add_qty2 = this.form2.add_qty2 + parseFloat(row.formula_qty)
|
this.form2.add_qty2 = this.form2.add_qty2 + parseFloat(row.formula_qty)
|
||||||
}
|
}
|
||||||
this.tabledis.splice(i, 1, row)
|
this.tabledis.splice(i, 1, row)
|
||||||
}
|
}*/
|
||||||
this.fullscreenLoading = false
|
this.fullscreenLoading = false
|
||||||
}).catch(() => {
|
}).catch(() => {
|
||||||
this.fullscreenLoading = false
|
this.fullscreenLoading = false
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
.catch(_ => {
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.tableDtl = res.tableDtl
|
||||||
|
this.form2.total_qty1 = 0
|
||||||
|
this.form2.add_qty1 = 0
|
||||||
|
for (let i = 0; i < this.tableDtl.length; i++) {
|
||||||
|
const row = this.tableDtl[i]
|
||||||
|
row.edit = true
|
||||||
|
if (row.is_need_manage === '1') {
|
||||||
|
this.form2.total_qty1 = this.form2.total_qty1 + parseFloat(row.formula_qty)
|
||||||
|
} else {
|
||||||
|
this.form2.add_qty1 = this.form2.add_qty1 + parseFloat(row.formula_qty)
|
||||||
|
}
|
||||||
|
this.tableDtl.splice(i, 1, row)
|
||||||
|
}
|
||||||
|
this.fullscreenLoading = false
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
this.fullscreenLoading = false
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
this.fullscreenLoading = true
|
||||||
|
autoformula.autoCalculation(this.form).then(res => {
|
||||||
|
this.crud.notify('自动计算成功!')
|
||||||
|
this.tableDtl = res.tableDtl
|
||||||
|
this.form2.total_qty1 = 0
|
||||||
|
this.form2.add_qty1 = 0
|
||||||
|
for (let i = 0; i < this.tableDtl.length; i++) {
|
||||||
|
const row = this.tableDtl[i]
|
||||||
|
row.edit = true
|
||||||
|
if (row.is_need_manage === '1') {
|
||||||
|
this.form2.total_qty1 = this.form2.total_qty1 + parseFloat(row.formula_qty)
|
||||||
|
} else {
|
||||||
|
this.form2.add_qty1 = this.form2.add_qty1 + parseFloat(row.formula_qty)
|
||||||
|
}
|
||||||
|
this.tableDtl.splice(i, 1, row)
|
||||||
|
}
|
||||||
|
/* this.tabledis = res.tabledis
|
||||||
|
this.form2.total_qty2 = 0
|
||||||
|
this.form2.add_qty2 = 0
|
||||||
|
for (let i = 0; i < this.tabledis.length; i++) {
|
||||||
|
const row = this.tabledis[i]
|
||||||
|
row.edit = true
|
||||||
|
if (row.is_need_manage === '1') {
|
||||||
|
this.form2.total_qty2 = this.form2.total_qty2 + parseFloat(row.formula_qty)
|
||||||
|
} else {
|
||||||
|
this.form2.add_qty2 = this.form2.add_qty2 + parseFloat(row.formula_qty)
|
||||||
|
}
|
||||||
|
this.tabledis.splice(i, 1, row)
|
||||||
|
}*/
|
||||||
|
this.fullscreenLoading = false
|
||||||
|
}).catch(() => {
|
||||||
|
this.fullscreenLoading = false
|
||||||
|
})
|
||||||
|
}
|
||||||
},
|
},
|
||||||
submit() {
|
submit() {
|
||||||
if (this.tableDtl.length === 0) {
|
if (this.tableDtl.length === 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user