diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/wql/em.xls b/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/wql/em.xls index da1db16a..abaef466 100644 Binary files a/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/wql/em.xls and b/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/wql/em.xls differ diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/AutoformulaServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/AutoformulaServiceImpl.java index 642ed795..ff0433a8 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/AutoformulaServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/service/impl/AutoformulaServiceImpl.java @@ -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{ //需配添加剂重量 @@ -657,8 +668,11 @@ public class AutoformulaServiceImpl implements AutoformulaService { yzj_list.add(tjj_map_now); } }); - }else if(CT1 Z_sum = new AtomicReference<>(0.0); + AtomicReference Z_sum_per = new AtomicReference<>(0.0); //计算不需要移库的添加剂(抑制剂) yzj_map.forEach((key,tjj_map_jo)->{ //获取添加剂id @@ -678,12 +693,13 @@ public class AutoformulaServiceImpl implements AutoformulaService { .process() .uniqueResult(0); if(tjj_finished!=null){ - //已配重量 - double finished_qty = tjj_map_jo.getDouble("finished_qty"); //质保书含量比 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); } @@ -693,35 +709,18 @@ public class AutoformulaServiceImpl implements AutoformulaService { JSONObject FactoryWarranty = bomdlts_plan_map.get(bomdlt_Cr3C2.getString("stockrecord_id")); //该批次含碳比 double X22 = FactoryWarranty.getDouble("is_tan"); - //解得碳粉重量 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); + //X22p减=(产品碳平衡*(Z_sum已+CT1_weight)-CT1-Z_sum已)/(1- X22碳含量- X22Z1含量+产品碳平衡*X22Z1含量) + 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 + Z_sum.get(); + double C = X22_jian + bom_ivt_qty*Z_sum_per.get(); 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); //计算不需要移库的添加剂(抑制剂) @@ -766,8 +765,28 @@ public class AutoformulaServiceImpl implements AutoformulaService { yzj_list.add(tjj_map_now); } }); + 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); + } + } - }else{//大于等于2条库粗你明细时 + } + //大于等于2条库粗你明细时 + else{ //最后一个为X22p JSONObject bomdlt_Cr3C2_X22p = bomdlts_Cr3C2.getJSONObject(bomdlts_Cr3C2.size()-1); //倒数第二为X21p @@ -789,45 +808,85 @@ public class AutoformulaServiceImpl implements AutoformulaService { double X21c = X21p*X21/100.0; - AtomicReference Z_sum = new AtomicReference<>(0.0); - //循环碳化钨 - for(int i=0;i{ - //获取添加剂id - String tjj_material_id = tjj_map_jo.getString("material_id"); - JSONObject tjj_finished = WQL.getWO("QPF_AUTOFORMULA01") - .addParam("material_id",jo.getString("material_id")) - .addParam("pcsn",jo.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 = bom_ivt_qty_jo*value/100.0; - //累计各碳化钨中已含添加剂重量 - Z_sum.set(Z_sum.get() + finished); - } - }); - } - boolean flag = true; //设X21p减=0,解方程 if(flag){ - // X22p减=[产品碳平衡*(X11p+X12p+X21p+X22p+Z已总) - (X11p* X11碳含量+X12p* X12碳含量+(X21)* X21碳含量+(X22p)* X22碳含量+Z已总)]/(1-X22碳含量) - double X22_jian = ((c_balance/100.0)*(CT1_weight+Z_sum.get())-(CT1+Z_sum.get()))/(1-X22/100.0); + AtomicReference Z_sum = new AtomicReference<>(0.0); + AtomicReference Z_sum_per = new AtomicReference<>(0.0); + //循环碳化钨 + for(int i=0;i{ + //获取添加剂id + String tjj_material_id = tjj_map_jo.getString("material_id"); + JSONObject tjj_finished = WQL.getWO("QPF_AUTOFORMULA01") + .addParam("material_id",jo.getString("material_id")) + .addParam("pcsn",jo.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 = bom_ivt_qty_jo*value/100.0; + //累计各碳化钨中已含添加剂重量百分比 + if(stockrecord_id.equals(bomdlt_Cr3C2_X22p.getString("stockrecord_id"))){ + Z_sum_per.set(Z_sum_per.get() + value/100.0); + } + //累计各碳化钨中已含添加剂重量 + Z_sum.set(Z_sum.get() + finished); + } + }); + } + //X22p减=(产品碳平衡*(Z_sum已+CT1_weight)-CT1-Z_sum已)/(1- X22碳含量- X22Z1含量+产品碳平衡*X22Z1含量) + 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){ flag = false; }else{ //解得钨粉重量 - double C = X22_jian + Z_sum.get(); + double C = X22_jian; + //统计除钨以外其他总重 + AtomicReference total_sum = new AtomicReference<>(0.0); + //循环碳化钨 + for(int i=0;i{ + //获取添加剂id + String tjj_material_id = tjj_map_jo.getString("material_id"); + JSONObject tjj_finished = WQL.getWO("QPF_AUTOFORMULA01") + .addParam("material_id",jo.getString("material_id")) + .addParam("pcsn",jo.getString("pcsn")) + .addParam("item_material_id",tjj_material_id) + .addParam("flag","5") + .process() + .uniqueResult(0); + if(tjj_finished!=null){ + //已配重量 + double finished_qty = tjj_map_jo.getDouble("finished_qty"); + //质保书含量比 + double value = tjj_finished.getDouble("value"); + //当前含量重量 + double finished = finalBom_ivt_qty_jo *value/100.0; + //累计各碳化钨中已含添加剂重量 + total_sum.set(total_sum.get()+finished); + } + }); + } + C = C + total_sum.get(); if(C<0){ flag = false; }else if(C>=0){ @@ -864,6 +923,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { } }); } + //判断已含添加剂与需配添加剂大小 yzj_map.forEach((key,tjj_map_now)->{ //需配添加剂重量 @@ -883,6 +943,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { yzj_list.add(tjj_map_now); } }); + if(C>0){ JSONObject C_weight = new JSONObject(); C_weight.put("formula_qty",C); @@ -899,22 +960,96 @@ 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); } } } } if(!flag){ + AtomicReference Z_sum = new AtomicReference<>(0.0); + AtomicReference Z22_sum_per = new AtomicReference<>(0.0); + AtomicReference Z21_sum_per = new AtomicReference<>(0.0); + //循环碳化钨 + for(int i=0;i{ + //获取添加剂id + String tjj_material_id = tjj_map_jo.getString("material_id"); + JSONObject tjj_finished = WQL.getWO("QPF_AUTOFORMULA01") + .addParam("material_id",jo.getString("material_id")) + .addParam("pcsn",jo.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 = bom_ivt_qty_jo*value/100.0; + //累计各碳化钨中已含添加剂重量百分比 + if(stockrecord_id.equals(bomdlt_Cr3C2_X21p.getString("stockrecord_id"))){ + Z21_sum_per.set(Z21_sum_per.get() + value/100.0); + } + if(stockrecord_id.equals(bomdlt_Cr3C2_X22p.getString("stockrecord_id"))){ + Z22_sum_per.set(Z22_sum_per.get() + value/100.0); + } + //累计各碳化钨中已含添加剂重量 + Z_sum.set(Z_sum.get() + finished); + } + }); + } //设X22p减=X22p,解方程 // 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+Z_sum.get()) - (CT1-X22c) - X22p-Z_sum.get())/(1-X21/100.0); + //X21p减=[(CT1_weight+z_sum已-X22p含抑制剂总和)*产品碳平衡-( CT1-X22p* X22碳含量+X22p)-(z_sum已-X22p含抑制剂总和)]/(1-X21碳含量-X21p抑制剂总含量+X21p抑制剂总含量*产品碳平衡) + double X21_jian = ((c_balance/100.0)*(CT1_weight+Z_sum.get()-Z22_sum_per.get()) - (CT1+X22p-X22p*X22c/100.0) -(Z_sum.get()-Z22_sum_per.get()))/(1-X21/100.0-Z21_sum_per.get() +Z21_sum_per.get()*(c_balance/100.0)); + + //更新碳化钨配粉重量 + double bom_ivt_qty = X21p-X21_jian; + //统计除钨以外其他总重 + AtomicReference total_sum = new AtomicReference<>(0.0); + //循环碳化钨 + for(int i=0;i{ + //获取添加剂id + String tjj_material_id = tjj_map_jo.getString("material_id"); + JSONObject tjj_finished = WQL.getWO("QPF_AUTOFORMULA01") + .addParam("material_id",jo.getString("material_id")) + .addParam("pcsn",jo.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 = finalBom_ivt_qty_jo *value/100.0; + //累计各碳化钨中已含添加剂重量 + total_sum.set(total_sum.get() + finished); + } + }); + } //解得钨粉重量 - double C = X22p + X21_jian + Z_sum.get(); + double C = X22p + X21_jian+total_sum.get(); if(C<0){ throw new BadRequestException("加碳粉为负数,当前配粉无解!"); }else if(C>=0){ - //更新碳化钨配粉重量 - double bom_ivt_qty = X21p-X21_jian; if(bom_ivt_qty<0){ throw new BadRequestException("碳化钨倒数第二条配粉结果为负数,当前配粉无解!"); } @@ -971,6 +1106,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { yzj_list.add(tjj_map_now); } }); + if(C>0){ JSONObject C_weight = new JSONObject(); C_weight.put("formula_qty",C); @@ -991,7 +1127,9 @@ public class AutoformulaServiceImpl implements AutoformulaService { } } } - }else if(CT1>CT2){//需配钨粉 + }else + //需配钨粉 + if(CT1>CT2){ if(bomdlts_Cr3C2.size()==1){//只配库存明细时 //假设钨粉重量为W JSONObject bomdlt_Cr3C2 = bomdlts_Cr3C2.getJSONObject(0); @@ -1023,9 +1161,9 @@ public class AutoformulaServiceImpl implements AutoformulaService { 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; if(bom_ivt_qty<=0){ @@ -1085,9 +1223,9 @@ public class AutoformulaServiceImpl implements AutoformulaService { } }); double W = new_qty - total_sum.get(); - if(W<0){ + /* if(W<0){ throw new BadRequestException("加钨粉为负数,当前配粉无解!"); - } + }*/ if(W>0){ JSONObject W_weight = new JSONObject(); W_weight.put("formula_qty",W); @@ -1158,7 +1296,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { //设X21p减=0,解方程 if(flag){ //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; if(bom_ivt_qty<0){ @@ -1253,7 +1391,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { if(!flag){ //设X22p减=X22p,解方程 //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){ throw new BadRequestException("碳化钨减掉结果为负数,当前配粉无解!"); } @@ -1329,9 +1467,9 @@ public class AutoformulaServiceImpl implements AutoformulaService { }); double W = new_qty - total_sum.get(); - if(W<0){ + /*if(W<0){ throw new BadRequestException("加钨粉为负数,当前配粉无解!"); - } + }*/ if(W>0){ JSONObject W_weight = new JSONObject(); W_weight.put("formula_qty",W); @@ -1490,7 +1628,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { JSONArray ivts_new = new JSONArray(); for(int i=0;i{ //需配添加剂重量 @@ -1745,8 +1884,11 @@ public class AutoformulaServiceImpl implements AutoformulaService { yzj_list.add(tjj_map_now); } }); - }else if(CT1 Z_sum = new AtomicReference<>(0.0); + AtomicReference Z_sum_per = new AtomicReference<>(0.0); //计算不需要移库的添加剂(抑制剂) tjj_map.forEach((key,tjj_map_jo)->{ //获取添加剂id @@ -1770,42 +1913,27 @@ public class AutoformulaServiceImpl implements AutoformulaService { .uniqueResult(0); if(tjj_finished!=null){ //质保书含量比 - double value_jo = tjj_finished.getDouble("value"); + double tjj_finished_value = tjj_finished.getDouble("value"); //当前含量重量 - double finished = X22p*value_jo/100.0; + double finished = X22p*tjj_finished_value/100.0; + + //累计各碳化钨中已含添加剂重量百分比 + Z_sum_per.set(Z_sum_per.get() + tjj_finished_value/100.0); //累计各碳化钨中已含添加剂重量 Z_sum.set(Z_sum.get() + finished); } }); - //解得碳粉重量 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); + //X22p减=(产品碳平衡*(Z_sum已+CT1_weight)-CT1-Z_sum已)/(1- X22碳含量- X22Z1含量+产品碳平衡*X22Z1含量) + 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 + Z_sum.get(); - - 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); + double C = X22_jian + bom_ivt_qty*Z_sum_per.get(); + if(C < 0){ + throw new BadRequestException("补碳结果为负数,当前配粉无解!"); } bomdlt_Cr3C2.put("bom_ivt_qty",bom_ivt_qty); bomdlts_plan_map.put(bomdlt_Cr3C2.getString("stockrecord_id"),bomdlt_Cr3C2); @@ -1832,6 +1960,24 @@ public class AutoformulaServiceImpl implements AutoformulaService { tjj_map.put(tjj_material_id,tjj_map_jo); } }); + + 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); + } //判断已含添加剂与需配添加剂大小 tjj_map.forEach((key,tjj_map_now)->{ //需配添加剂重量 @@ -1851,7 +1997,9 @@ public class AutoformulaServiceImpl implements AutoformulaService { yzj_list.add(tjj_map_now); } }); - }else{//大于等于2条库粗你明细时 + } + //大于等于2条库粗你明细时 + else{ //最后一个为X22p JSONObject bomdlt_Cr3C2_X22p = bomdlts_Cr3C2.getJSONObject(bomdlts_Cr3C2.size()-1); //倒数第二为X21p @@ -1873,65 +2021,86 @@ public class AutoformulaServiceImpl implements AutoformulaService { double X21c = X21p*X21/100.0; - AtomicReference Z_sum = new AtomicReference<>(0.0); - //循环碳化钨 - for(int i=0;i{ - //获取添加剂id - String tjj_material_id = tjj_map_jo.getString("material_id"); - JSONObject tjj_finished = WQL.getWO("QPF_AUTOFORMULA01") - .addParam("material_id",jo.getString("material_id")) - .addParam("pcsn",jo.getString("pcsn")) - .addParam("item_material_id",tjj_material_id) - .addParam("flag","5") - .process() - .uniqueResult(0); - if(tjj_finished!=null){ - //质保书含量比 - double value_jo = tjj_finished.getDouble("value"); - //当前含量重量 - double finished = bom_ivt_qty_jo*value_jo/100.0; - //累计各碳化钨中已含添加剂重量 - Z_sum.set(Z_sum.get() + finished); - } - }); - } - boolean flag = true; //设X21p减=0,解方程 if(flag){ - // X22p减=[产品碳平衡*(X11p+X12p+X21p+X22p+Z已总) - (X11p* X11碳含量+X12p* X12碳含量+(X21)* X21碳含量+(X22p)* X22碳含量+Z已总)]/(1-X22碳含量) - double X22_jian = ((c_balance/100.0)*(CT1_weight+Z_sum.get())-(CT1+Z_sum.get()))/(1-X22/100.0); + AtomicReference Z_sum = new AtomicReference<>(0.0); + AtomicReference Z_sum_per = new AtomicReference<>(0.0); + //循环碳化钨 + for(int i=0;i{ + //获取添加剂id + String tjj_material_id = tjj_map_jo.getString("material_id"); + JSONObject tjj_finished = WQL.getWO("QPF_AUTOFORMULA01") + .addParam("material_id",jo.getString("material_id")) + .addParam("pcsn",jo.getString("pcsn")) + .addParam("item_material_id",tjj_material_id) + .addParam("flag","5") + .process() + .uniqueResult(0); + if(tjj_finished!=null){ + //质保书含量比 + double tjj_finished_value = tjj_finished.getDouble("value"); + //当前含量重量 + double finished = bom_ivt_qty_jo*tjj_finished_value/100.0; + //累计各碳化钨中已含添加剂重量百分比 + if(stockrecord_id.equals(bomdlt_Cr3C2_X22p.getString("stockrecord_id"))){ + Z_sum_per.set(Z_sum_per.get() + tjj_finished_value/100.0); + } + //累计各碳化钨中已含添加剂重量 + Z_sum.set(Z_sum.get() + finished); + } + }); + } + //X22p减=(产品碳平衡*(Z_sum已+CT1_weight)-CT1-Z_sum已)/(1- X22碳含量- X22Z1含量+产品碳平衡*X22Z1含量) + 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){ flag = false; }else{ //解得钨粉重量 - double C = X22_jian + Z_sum.get(); + double C = X22_jian; + //统计除钨以外其他总重 + AtomicReference total_sum = new AtomicReference<>(0.0); + //循环碳化钨 + for(int i=0;i{ + //获取添加剂id + String tjj_material_id = tjj_map_jo.getString("material_id"); + JSONObject tjj_finished = WQL.getWO("QPF_AUTOFORMULA01") + .addParam("material_id",jo.getString("material_id")) + .addParam("pcsn",jo.getString("pcsn")) + .addParam("item_material_id",tjj_material_id) + .addParam("flag","5") + .process() + .uniqueResult(0); + if(tjj_finished!=null){ + //质保书含量比 + double tjj_finished_value = tjj_finished.getDouble("value"); + //当前含量重量 + double finished = finalBom_ivt_qty_jo *tjj_finished_value/100.0; + //累计各碳化钨中已含添加剂重量 + total_sum.set(total_sum.get()+finished); + } + }); + } + C = C + total_sum.get(); 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){ @@ -1965,6 +2134,25 @@ public class AutoformulaServiceImpl implements AutoformulaService { } }); } + + 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); + } //判断已含添加剂与需配添加剂大小 tjj_map.forEach((key,tjj_map_now)->{ //需配添加剂重量 @@ -1988,38 +2176,92 @@ public class AutoformulaServiceImpl implements AutoformulaService { } } if(!flag){ + AtomicReference Z_sum = new AtomicReference<>(0.0); + AtomicReference Z22_sum_per = new AtomicReference<>(0.0); + AtomicReference Z21_sum_per = new AtomicReference<>(0.0); + //循环碳化钨 + for(int i=0;i{ + //获取添加剂id + String tjj_material_id = tjj_map_jo.getString("material_id"); + JSONObject tjj_finished = WQL.getWO("QPF_AUTOFORMULA01") + .addParam("material_id",jo.getString("material_id")) + .addParam("pcsn",jo.getString("pcsn")) + .addParam("item_material_id",tjj_material_id) + .addParam("flag","5") + .process() + .uniqueResult(0); + if(tjj_finished!=null){ + //质保书含量比 + double tjj_finished_value = tjj_finished.getDouble("value"); + //当前含量重量 + double finished = bom_ivt_qty_jo*tjj_finished_value/100.0; + //累计各碳化钨中已含添加剂重量百分比 + if(stockrecord_id.equals(bomdlt_Cr3C2_X21p.getString("stockrecord_id"))){ + Z21_sum_per.set(Z21_sum_per.get() + tjj_finished_value/100.0); + } + if(stockrecord_id.equals(bomdlt_Cr3C2_X22p.getString("stockrecord_id"))){ + Z22_sum_per.set(Z22_sum_per.get() + tjj_finished_value/100.0); + } + //累计各碳化钨中已含添加剂重量 + Z_sum.set(Z_sum.get() + finished); + } + }); + } //设X22p减=X22p,解方程 - // 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+Z_sum.get()) - (CT1-X22c) - X22p-Z_sum.get())/(1-X21/100.0); + //X21p减=[(CT1_weight+z_sum已-X22p含抑制剂总和)*产品碳平衡-( CT1-X22p* X22碳含量+X22p)-(z_sum已-X22p含抑制剂总和)]/(1-X21碳含量-X21p抑制剂总含量+X21p抑制剂总含量*产品碳平衡) + double X21_jian = ((c_balance/100.0)*(CT1_weight+Z_sum.get()-Z22_sum_per.get()) - (CT1+X22p-X22p*X22c/100.0) -(Z_sum.get()-Z22_sum_per.get()))/(1-X21/100.0-Z21_sum_per.get() +Z21_sum_per.get()*(c_balance/100.0)); + + //更新碳化钨配粉重量 + double bom_ivt_qty = X21p-X21_jian; + //统计除钨以外其他总重 + AtomicReference total_sum = new AtomicReference<>(0.0); + //循环碳化钨 + for(int i=0;i{ + //获取添加剂id + String tjj_material_id = tjj_map_jo.getString("material_id"); + JSONObject tjj_finished = WQL.getWO("QPF_AUTOFORMULA01") + .addParam("material_id",jo.getString("material_id")) + .addParam("pcsn",jo.getString("pcsn")) + .addParam("item_material_id",tjj_material_id) + .addParam("flag","5") + .process() + .uniqueResult(0); + if(tjj_finished!=null){ + //质保书含量比 + double tjj_finished_value = tjj_finished.getDouble("value"); + //当前含量重量 + double finished = finalBom_ivt_qty_jo *tjj_finished_value/100.0; + //累计各碳化钨中已含添加剂重量 + total_sum.set(total_sum.get() + finished); + } + }); + } //解得钨粉重量 - double C = X22p + X21_jian + Z_sum.get(); + double C = X22p + X21_jian+total_sum.get(); if(C<0){ throw new BadRequestException("加碳粉为负数,当前配粉无解!"); }else if(C>=0){ - //更新碳化钨配粉重量 - double bom_ivt_qty = X21p-X21_jian; 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){ @@ -2054,6 +2296,24 @@ public class AutoformulaServiceImpl implements AutoformulaService { } }); } + + 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); + } //判断已含添加剂与需配添加剂大小 tjj_map.forEach((key,tjj_map_now)->{ //需配添加剂重量 @@ -2076,8 +2336,11 @@ public class AutoformulaServiceImpl implements AutoformulaService { } } } - }else if(CT1>CT2){//需配钨粉 - if(bomdlts_Cr3C2.size()==1){//只配库存明细时 + }else + //需配钨粉 + if(CT1>CT2){ + //只配库存明细时 + if(bomdlts_Cr3C2.size()==1){ //假设钨粉重量为W JSONObject bomdlt_Cr3C2 = bomdlts_Cr3C2.getJSONObject(0); //获取碳含量 @@ -2107,9 +2370,9 @@ public class AutoformulaServiceImpl implements AutoformulaService { 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; if(bom_ivt_qty<=0){ @@ -2171,9 +2434,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); @@ -2243,7 +2503,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { //设X21p减=0,解方程 if(flag){ //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; if(bom_ivt_qty<0){ @@ -2312,9 +2572,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); @@ -2336,7 +2593,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { if(!flag){ //设X22p减=X22p,解方程 //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){ throw new BadRequestException("碳化钨减掉结果为负数,当前配粉无解!"); } @@ -2410,9 +2667,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); @@ -2623,7 +2877,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { JSONArray ivts_new = new JSONArray(); for(int i=0;i0){ JSONObject W_weight = new JSONObject(); W_weight.put("formula_qty",W); @@ -3255,7 +3510,8 @@ public class AutoformulaServiceImpl implements AutoformulaService { //需配碳粉 if(CT1 "" + dtl.result = 输入.is_pass + ENDOPTION + ENDSELECT ENDPAGEQUERY ENDIF diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/wql/ql.xls b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/wql/ql.xls index 93bd617c..67ab4219 100644 Binary files a/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/wql/ql.xls and b/mes/hd/nladmin-system/src/main/java/org/nl/wms/ql/wql/ql.xls differ diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/auToTask/AutoCreateUpkeep.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/auToTask/AutoCreateUpkeep.java index ca1aa05e..043dd6e3 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/auToTask/AutoCreateUpkeep.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/auToTask/AutoCreateUpkeep.java @@ -60,6 +60,7 @@ public class AutoCreateUpkeep { param.put("plan_start_date",jsonPlanMst.getString("plan_start_date")); param.put("source_bill_id",jsonPlanMst.getString("maint_plan_id")); param.put("source_bill_code",jsonPlanMst.getString("maint_plan_code")); + param.put("maint_object",jsonPlanMst.getString("maint_object")); // 计算 当前日期 - 保养计划日期 后的天数 String num = String.valueOf(NumberUtil.sub(today, plan_start_date)); @@ -96,6 +97,8 @@ public class AutoCreateUpkeep { param.put("plan_start_date",jsonPlanMst.getString("plan_start_date")); param.put("source_bill_id",jsonPlanMst.getString("maint_plan_id")); param.put("source_bill_code",jsonPlanMst.getString("maint_plan_code")); + param.put("maint_object",jsonPlanMst.getString("maint_object")); + // 计算 当前日期 - 保养实际结束 后的天数 String num = String.valueOf(NumberUtil.sub(today, rep_real_end_date)); @@ -152,6 +155,7 @@ public class AutoCreateUpkeep { jsonMainMst.put("maintenancecycle",json.getString("maintenancecycle")); jsonMainMst.put("invstatus","01"); jsonMainMst.put("plan_start_date",json.getString("plan_start_date")); + jsonMainMst.put("maint_object",json.getString("maint_object")); jsonMainMst.put("detail_count",planDtlArr.size()); jsonMainMst.put("source_bill_id",json.get("source_bill_id")); jsonMainMst.put("source_bill_type","BYJH"); diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/bigscreen/service/impl/DeviceBigScreenServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/bigscreen/service/impl/DeviceBigScreenServiceImpl.java index 17fd4253..cbc37a3b 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/bigscreen/service/impl/DeviceBigScreenServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/bigscreen/service/impl/DeviceBigScreenServiceImpl.java @@ -93,7 +93,7 @@ public class DeviceBigScreenServiceImpl implements DeviceBigScreenService { json.put("dept_name_jm", "0"); } // 当前日期 - json.put("device_date", run_date); + json.put("device_date", run_date.substring(5, 10)); resultArr.add(json); } @@ -298,8 +298,13 @@ public class DeviceBigScreenServiceImpl implements DeviceBigScreenService { jsonObject.put("not_num", jsonObject.getString("need_num")); // 完成率:已保养台数/需保养台数 - String div = NumberUtil.div(jsonObject.getShort("end_num"), jsonObject.getShort("need_num")).toString(); - jsonObject.put("confirm_rate", NumberUtil.round(NumberUtil.mul(div, "100"), 2)); + try { + String div = NumberUtil.div(jsonObject.getShort("end_num"), jsonObject.getShort("need_num")).toString(); + jsonObject.put("confirm_rate", NumberUtil.round(NumberUtil.mul(div, "100"), 2)); + } catch (Exception e) { + jsonObject.put("confirm_rate", "0.0"); + } + resultArr.add(jsonObject); } @@ -418,12 +423,17 @@ public class DeviceBigScreenServiceImpl implements DeviceBigScreenService { String one_all_time = "0"; // 一台设备30天的维修时间 JSONArray jsonReArr = WQL.getWO("EM_DEVICEBIGSCREEN_03").addParamMap(map).process().getResultJSONArray(0); for (int k = 0; k < jsonReArr.size(); k++) { - JSONObject jsonObject = jsonReArr.getJSONObject(k); + Object o = jsonReArr.get(k); + JSONObject jsonObject = JSONObject.parseObject(o.toString()); Date date_finish_time = DateUtil.parse(jsonObject.getString("finish_time")); // 报修完成时间 Date date_create_time = DateUtil.parse(jsonObject.getString("create_time")); // 报修时间 // 一台设备一天的维修时间 - long one_day_time = DateUtil.between(date_create_time, date_finish_time, DateUnit.HOUR, false); + long one_day_time = 0; + try { + one_day_time = DateUtil.between(date_create_time, date_finish_time, DateUnit.HOUR, false); + } catch (Exception e) { + } one_all_time = NumberUtil.add(one_all_time,String.valueOf(one_day_time)).toString(); } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/rest/DevicerepairmstController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/rest/DevicerepairmstController.java index bb846d16..300f84bb 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/rest/DevicerepairmstController.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/rest/DevicerepairmstController.java @@ -66,6 +66,14 @@ public class DevicerepairmstController { return new ResponseEntity<>(devicerepairmstService.query4(whereJson, page), HttpStatus.OK); } + @GetMapping("/query5") + @Log("查询维修单维护5") + @ApiOperation("查询维修单维护5") + //@PreAuthorize("@el.check('devicerepairmst:list')") + public ResponseEntity query5(@RequestParam Map whereJson, Pageable page) { + return new ResponseEntity<>(devicerepairmstService.query5(whereJson, page), HttpStatus.OK); + } + @GetMapping("/queryBom") @Log("查询备件bom") @ApiOperation("查询备件bom") diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/DevicerepairmstService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/DevicerepairmstService.java index 4a0df3ab..ced6cd38 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/DevicerepairmstService.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/DevicerepairmstService.java @@ -202,4 +202,13 @@ public interface DevicerepairmstService { */ Map query4(Map whereJson, Pageable page); + /** + * 查询数据分页 + * + * @param whereJson 条件 + * @param page 分页参数 + * @return Map + */ + Map query5(Map whereJson, Pageable page); + } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/impl/DevicerepairmstServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/impl/DevicerepairmstServiceImpl.java index 792c1c0d..1c352b1e 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/impl/DevicerepairmstServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/impl/DevicerepairmstServiceImpl.java @@ -12,6 +12,7 @@ import com.alibaba.fastjson.JSON; import lombok.RequiredArgsConstructor; import org.nl.exception.BadRequestException; import org.nl.modules.security.service.dto.JwtUserDto; +import org.nl.modules.system.service.DeptService; import org.nl.modules.system.service.impl.ParamServiceImpl; import org.nl.modules.system.util.CodeUtil; import org.nl.utils.SpringContextHolder; @@ -364,6 +365,9 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService { jsonObject.put("measure", measure); recordTab.insert(jsonObject); + // 保存明细 + this.submitRepair(whereJson); + // 1.判断维修单明细中是否完成 都为是,不是则报错 JSONArray reDtlArr = reDtlTab.query("repair_id = '" + whereJson.getString("repair_id") + "'").getResultJSONArray(0); if (ObjectUtil.isEmpty(reDtlArr)) throw new BadRequestException("明细为空"); @@ -549,6 +553,7 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService { JSONObject jsonMst = reMstTab.query("repair_id = '" + whereJson.getString("repair_id") + "'").uniqueResult(0); jsonMst.put("invstatus", "05"); + jsonMst.put("outsourceback_remark", whereJson.getString("outsourceback_remark")); jsonMst.put("outsourceback_optid", currentUserId); jsonMst.put("outsourceback_optname", nickName); jsonMst.put("outsourceback_time", DateUtil.now()); @@ -991,4 +996,44 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService { return json; } + @Override + public Map query5(Map whereJson, Pageable page) { + DeptService deptService = SpringContextHolder.getBean(DeptService.class); + + String device_code = MapUtil.getStr(whereJson, "device_code"); + String repair_code = MapUtil.getStr(whereJson, "repair_code"); + String maintenancecycle = MapUtil.getStr(whereJson, "maintenancecycle"); + String invstatus = MapUtil.getStr(whereJson, "invstatus"); + String begin_time = MapUtil.getStr(whereJson, "begin_time"); + String end_time = MapUtil.getStr(whereJson, "end_time"); + String material_type_id = MapUtil.getStr(whereJson, "material_type_id"); + String class_idStr = (String) whereJson.get("class_idStr"); + + HashMap map = new HashMap<>(); + map.put("flag", "9"); + map.put("maintenancecycle",maintenancecycle); + map.put("invstatus",invstatus); + map.put("begin_time",begin_time); + map.put("end_time",end_time); + if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code","%"+device_code+"%"); + if (ObjectUtil.isNotEmpty(repair_code)) map.put("repair_code","%"+repair_code+"%"); + //处理物料当前节点的所有子节点 + if (!StrUtil.isEmpty(material_type_id)) { + map.put("material_type_id", material_type_id); + String classIds = classstandardService.getChildIdStr(material_type_id); + map.put("classIds", classIds); + } else if (ObjectUtil.isNotEmpty(class_idStr)) { + String classIds = classstandardService.getAllChildIdStr(class_idStr); + map.put("classIds", classIds); + } + // 归属部门 + String dept_id = MapUtil.getStr(whereJson, "dept_id"); + if (!StrUtil.isEmpty(dept_id)) { + String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id)); + map.put("deptIds", deptIds); + } + JSONObject json = WQL.getWO("EM_BI_DEVICEREPAIR001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.input_time DESC"); + return json; + } + } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/impl/DevicerepairplanmstServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/impl/DevicerepairplanmstServiceImpl.java index b1e6c58f..034599c9 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/impl/DevicerepairplanmstServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/impl/DevicerepairplanmstServiceImpl.java @@ -48,6 +48,7 @@ public class DevicerepairplanmstServiceImpl implements DevicerepairplanmstServic @Override public Map queryAll(Map whereJson, Pageable page) { String material_type_id = MapUtil.getStr(whereJson, "material_type_id"); + String repair_type = MapUtil.getStr(whereJson, "repair_type"); String device_code = MapUtil.getStr(whereJson, "device_code"); String maintenancecycle = MapUtil.getStr(whereJson, "maintenancecycle"); String repair_plan_code = MapUtil.getStr(whereJson, "repair_plan_code"); @@ -62,6 +63,7 @@ public class DevicerepairplanmstServiceImpl implements DevicerepairplanmstServic map.put("is_active", is_active); map.put("begin_time", begin_time); map.put("end_time", end_time); + map.put("repair_type", repair_type); if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code","%"+device_code+"%"); if (ObjectUtil.isNotEmpty(repair_plan_code)) map.put("repair_plan_code","%"+repair_plan_code+"%"); //处理物料当前节点的所有子节点 @@ -128,6 +130,7 @@ public class DevicerepairplanmstServiceImpl implements DevicerepairplanmstServic jsonMst.put("repair_plan_name",whereJson.getString("repair_plan_name")); jsonMst.put("devicerecord_id",whereJson.get("devicerecord_id")); jsonMst.put("maintenancecycle",whereJson.getString("maintenancecycle")); + jsonMst.put("repair_type",whereJson.getString("repair_type")); jsonMst.put("plan_start_date",whereJson.getString("plan_start_date")); jsonMst.put("detail_count",tableData.size()); jsonMst.put("create_id",currentUserId); @@ -169,6 +172,7 @@ public class DevicerepairplanmstServiceImpl implements DevicerepairplanmstServic jsonMst.put("repair_plan_name",whereJson.getString("repair_plan_name")); jsonMst.put("devicerecord_id",whereJson.get("devicerecord_id")); jsonMst.put("maintenancecycle",whereJson.getString("maintenancecycle")); + jsonMst.put("repair_type",whereJson.getString("repair_type")); jsonMst.put("plan_start_date",whereJson.getString("plan_start_date")); jsonMst.put("detail_count",tableData.size()); jsonMst.put("update_optid",currentUserId); @@ -268,6 +272,7 @@ public class DevicerepairplanmstServiceImpl implements DevicerepairplanmstServic jsonMst.put("repair_plan_name",whereJson.getString("repair_plan_name")); jsonMst.put("devicerecord_id",whereJson.get("devicerecord_id")); jsonMst.put("maintenancecycle",whereJson.getString("maintenancecycle")); + jsonMst.put("repair_type",whereJson.getString("repair_type")); jsonMst.put("plan_start_date",whereJson.getString("plan_start_date")); jsonMst.put("detail_count",tableData.size()); jsonMst.put("create_id",currentUserId); diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/wql/EM_BI_DEVICEREPAIR001.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/wql/EM_BI_DEVICEREPAIR001.wql index 304d224c..ab83df9e 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/wql/EM_BI_DEVICEREPAIR001.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/wql/EM_BI_DEVICEREPAIR001.wql @@ -27,6 +27,7 @@ 输入.sparepart_only_id TYPEAS s_string 输入.material_code TYPEAS s_string 输入.devicerecord_id TYPEAS s_string + 输入.deptIds TYPEAS f_string [临时表] @@ -372,6 +373,65 @@ ENDPAGEQUERY ENDIF + IF 输入.flag = "9" + PAGEQUERY + SELECT + mst.*, + class.class_name, + file.device_code, + file.device_name, + file.extend_code, + d1.name AS dept_name, + d2.name AS use_name + FROM + EM_BI_DeviceRepairMst mst + LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = mst.devicerecord_id + LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id + LEFT JOIN sys_dept d1 ON file.belong_deptid = d1.dept_id + LEFT JOIN sys_dept d2 ON file.use_groupid = d2.dept_id + WHERE + mst.is_delete = '0' + AND file.is_delete = '0' + AND mst.invstatus = '06' + + OPTION 输入.device_code <> "" + (file.device_code like 输入.device_code or + file.device_name like 输入.device_code) + ENDOPTION + + OPTION 输入.repair_code <> "" + (mst.repair_code like 输入.repair_code or + mst.repair_code like 输入.repair_code) + ENDOPTION + + OPTION 输入.classIds <> "" + class.class_id in 输入.classIds + ENDOPTION + + OPTION 输入.invstatus <> "" + mst.invstatus = 输入.invstatus + ENDOPTION + + OPTION 输入.maintenancecycle <> "" + mst.maintenancecycle = 输入.maintenancecycle + ENDOPTION + + OPTION 输入.begin_time <> "" + mst.plan_start_date >= 输入.begin_time + ENDOPTION + + OPTION 输入.end_time <> "" + mst.plan_start_date <= 输入.end_time + ENDOPTION + + OPTION 输入.deptIds <> "" + d2.dept_id in 输入.deptIds + ENDOPTION + + ENDSELECT + ENDPAGEQUERY + ENDIF + diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/wql/EM_BI_DEVICEREPAIRPLAN001.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/wql/EM_BI_DEVICEREPAIRPLAN001.wql index 8ed59224..ef8405ca 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/wql/EM_BI_DEVICEREPAIRPLAN001.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/wql/EM_BI_DEVICEREPAIRPLAN001.wql @@ -22,6 +22,7 @@ 输入.is_active TYPEAS s_string 输入.begin_time TYPEAS s_string 输入.end_time TYPEAS s_string + 输入.repair_type TYPEAS s_string [临时表] @@ -80,6 +81,10 @@ mst.maintenancecycle = 输入.maintenancecycle ENDOPTION + OPTION 输入.repair_type <> "" + mst.repair_type = 输入.repair_type + ENDOPTION + OPTION 输入.is_active <> "" mst.is_active = 输入.is_active ENDOPTION diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/wql/EM_BI_DEVICEREPAIRREQUEST001.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/wql/EM_BI_DEVICEREPAIRREQUEST001.wql index 2123b895..4ecdae6f 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/wql/EM_BI_DEVICEREPAIRREQUEST001.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/wql/EM_BI_DEVICEREPAIRREQUEST001.wql @@ -62,6 +62,7 @@ WHERE mst.is_delete = '0' AND file.is_delete = '0' + AND ISNULL(MST.is_passed) OPTION 输入.device_code <> "" (file.device_code like 输入.device_code or diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/rest/DevicerunrecordController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/rest/DevicerunrecordController.java index 19ce3aaf..e8e30bcc 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/rest/DevicerunrecordController.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/rest/DevicerunrecordController.java @@ -66,4 +66,13 @@ public class DevicerunrecordController { devicerunrecordService.deleteAll(ids); return new ResponseEntity<>(HttpStatus.OK); } + + + @PostMapping("/submit") + @Log("填报") + @ApiOperation("填报") + public ResponseEntity submit(@RequestBody JSONObject whereJson) { + devicerunrecordService.submit(whereJson); + return new ResponseEntity<>(HttpStatus.OK); + } } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/DevicerunrecordService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/DevicerunrecordService.java index 2d12f6da..c7f50c7c 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/DevicerunrecordService.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/DevicerunrecordService.java @@ -71,4 +71,12 @@ public interface DevicerunrecordService { * @param ids / */ void deleteAll(Long[] ids); + + + /** + * 填报 + * + * @param whereJson / + */ + void submit(JSONObject whereJson); } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/impl/DevicerunrecordServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/impl/DevicerunrecordServiceImpl.java index cd2ee714..699f23f8 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/impl/DevicerunrecordServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/service/impl/DevicerunrecordServiceImpl.java @@ -2,12 +2,16 @@ package org.nl.wms.sb.run.service.impl; +import cn.hutool.core.date.DateUnit; import cn.hutool.core.map.MapUtil; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSON; import lombok.RequiredArgsConstructor; import org.nl.exception.BadRequestException; +import org.nl.modules.system.service.DeptService; +import org.nl.utils.PageUtil; +import org.nl.utils.SpringContextHolder; import org.nl.wms.basedata.master.service.ClassstandardService; import org.nl.wms.sb.run.service.DevicerunrecordService; import org.nl.wms.sb.run.service.dto.DevicerunrecordDto; @@ -18,9 +22,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.data.domain.Pageable; import java.math.BigDecimal; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; @@ -46,16 +48,16 @@ public class DevicerunrecordServiceImpl implements DevicerunrecordService { @Override public Map queryAll(Map whereJson, Pageable page) { + DeptService deptService = SpringContextHolder.getBean(DeptService.class); + String material_type_id = MapUtil.getStr(whereJson, "material_type_id"); String class_idStr = MapUtil.getStr(whereJson, "class_idStr"); - String begin_time = MapUtil.getStr(whereJson, "begin_time"); - String end_time = MapUtil.getStr(whereJson, "end_time"); + String begin_time = MapUtil.getStr(whereJson, "begin_time").substring(0,10); + String end_time = MapUtil.getStr(whereJson, "end_time").substring(0,10); String device_code = MapUtil.getStr(whereJson, "device_code"); HashMap map = new HashMap<>(); - map.put("flag", "1"); - map.put("begin_time", begin_time); - map.put("end_time", end_time); + map.put("flag", "2"); if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code","%"+device_code+"%"); //处理物料当前节点的所有子节点 if (!StrUtil.isEmpty(material_type_id)) { @@ -66,7 +68,40 @@ public class DevicerunrecordServiceImpl implements DevicerunrecordService { String classIds = classstandardService.getAllChildIdStr(class_idStr); map.put("classIds", classIds); } - JSONObject json = WQL.getWO("EM_DEVICERUNRECORD001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "file.device_code ASC,run.run_date ASC"); + // 归属部门 + String dept_id = MapUtil.getStr(whereJson, "dept_id"); + if (!StrUtil.isEmpty(dept_id)) { + String deptIds = deptService.getChildIdStr(Long.parseLong(dept_id)); + map.put("deptIds", deptIds); + } + + ArrayList objects = new ArrayList<>(); + + Date begin_date = DateUtil.parse(begin_time); + Date end_date = DateUtil.parse(end_time); + long betweenDay = DateUtil.between(begin_date, end_date, DateUnit.DAY); + + if (betweenDay == 0) { + // 如果是某天则直接查 + map.put("run_date", begin_time); + JSONArray arr = WQL.getWO("EM_DEVICERUNRECORD001").addParamMap(map).process().getResultJSONArray(0); + objects.addAll(arr); + } else { + // 如果不是则根据日期递增循环查出 然后合并 + for (int i = 0; i <= betweenDay; i++) { + String day_time = DateUtil.offsetDay(begin_date, i).toString().substring(0,10); + map.put("run_date",day_time); + JSONArray arr = WQL.getWO("EM_DEVICERUNRECORD001").addParamMap(map).process().getResultJSONArray(0); + objects.addAll(arr); + } + } + + // 组织分页查询并返回 + Map json = PageUtil.toPage( + PageUtil.toPage(page.getPageNumber(), page.getPageSize(), objects), + objects.size() + ); + return json; } @@ -158,6 +193,12 @@ public class DevicerunrecordServiceImpl implements DevicerunrecordService { public void update(JSONObject whereJson) { WQLObject tab = WQLObject.getWQLObject("EM_BI_DeviceRunRecord"); String devicerecord_id = whereJson.getString("devicerecord_id"); + String runrecord_id = whereJson.getString("runrecord_id"); + + JSONObject jsonObject = tab.query("runrecord_id = '" + runrecord_id + "'").uniqueResult(0); + if (ObjectUtil.isEmpty(jsonObject)) { + throw new BadRequestException("请先填报"); + } JSONObject jsonFile = WQLObject.getWQLObject("EM_BI_EquipmentFile").query("devicerecord_id = '" + devicerecord_id + "'").uniqueResult(0); @@ -203,4 +244,59 @@ public class DevicerunrecordServiceImpl implements DevicerunrecordService { } } + @Override + @Transactional(rollbackFor = Exception.class) + public void submit(JSONObject whereJson) { + WQLObject tab = WQLObject.getWQLObject("EM_BI_DeviceRunRecord"); + + Long currentUserId = SecurityUtils.getCurrentUserId(); + String nickName = SecurityUtils.getNickName(); + String now = DateUtil.now(); + + String devicerecord_id = whereJson.getString("devicerecord_id"); + String run_date = whereJson.getString("run_date"); + + JSONObject jsonFile = WQLObject.getWQLObject("EM_BI_EquipmentFile").query("devicerecord_id = '" + devicerecord_id + "'").uniqueResult(0); + String status = jsonFile.getString("status"); + if (!"10,11,20,30,40".contains(status)) { + throw new BadRequestException("此设备不能填报"); + } + + double run_times = whereJson.getDoubleValue("run_times"); //生产时间 + double prepare_times = whereJson.getDoubleValue("prepare_times");//准备时间 + double error_times = whereJson.getDoubleValue("error_times"); //故障时间 + double adjust_times = whereJson.getDoubleValue("adjust_times"); //工装调整时间 + double product_qty = whereJson.getDoubleValue("product_qty"); //生产总量 + double nok_qty = whereJson.getDoubleValue("nok_qty"); //不合格数 + double theory_beat = jsonFile.getDoubleValue("theory_beat"); // 理论节拍 + + JSONObject jsonMst = tab.query("devicerecord_id = '" + devicerecord_id + "' and run_date = '" + run_date + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(jsonMst)) throw new BadRequestException("填报信息已存在"); + + JSONObject json = new JSONObject(); + json.put("runrecord_id", IdUtil.getSnowflake(1,1).nextId()); + json.put("devicerecord_id", whereJson.get("devicerecord_id")); + json.put("run_date", whereJson.getString("run_date")); + json.put("run_times", whereJson.get("run_times")); + json.put("prepare_times", whereJson.get("prepare_times")); + json.put("error_times", whereJson.get("error_times")); + json.put("adjust_times", whereJson.get("adjust_times")); + json.put("product_qty", whereJson.get("product_qty")); + json.put("nok_qty", whereJson.get("nok_qty")); + json.put("remark", whereJson.getString("remark")); + json.put("create_id", currentUserId); + json.put("create_name", nickName); + json.put("create_time", now); + // 计算OEE指标 + try { + BigDecimal div = NumberUtil.div(NumberUtil.sub(run_times, prepare_times, error_times, adjust_times), NumberUtil.sub(run_times, prepare_times, adjust_times)); + BigDecimal div1 = NumberUtil.div(NumberUtil.mul(div, theory_beat, product_qty), NumberUtil.sub(run_times, prepare_times, error_times, adjust_times)); + BigDecimal oee_value = NumberUtil.mul(div1, NumberUtil.div(NumberUtil.sub(product_qty, nok_qty), product_qty)); + json.put("oee_value", oee_value); + } catch (Exception e) { + json.put("oee_value", 0); + } + tab.insert(json); + } + } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/wql/EM_DEVICERUNRECORD001.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/wql/EM_DEVICERUNRECORD001.wql index 93e360df..773e9490 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/wql/EM_DEVICERUNRECORD001.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/run/wql/EM_DEVICERUNRECORD001.wql @@ -18,6 +18,8 @@ 输入.device_code TYPEAS s_string 输入.begin_time TYPEAS s_string 输入.end_time TYPEAS s_string + 输入.run_date TYPEAS s_string + 输入.deptIds TYPEAS f_string [临时表] @@ -77,5 +79,52 @@ ENDPAGEQUERY ENDIF + IF 输入.flag = "2" + QUERY + SELECT + file.devicerecord_id, + file.device_code, + file.device_name, + file.extend_code, + class.class_name, + 输入.run_date AS run_date, + run.runrecord_id, + run.run_times, + run.prepare_times, + run.error_times, + run.adjust_times, + run.product_qty, + run.nok_qty, + run.oee_value, + run.remark, + run.create_name, + run.create_time, + d1.name AS dept_name + FROM + EM_BI_EquipmentFile file + LEFT JOIN EM_BI_DeviceRunRecord run ON file.devicerecord_id = run.devicerecord_id AND 输入.run_date = run.run_date + LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id + LEFT JOIN sys_dept d1 ON file.use_groupid = d1.dept_id + WHERE + file.is_delete = '0' + AND file.status not in ('90','91') + + OPTION 输入.device_code <> "" + (file.device_code like 输入.device_code or + file.device_name like 输入.device_code) + ENDOPTION + + OPTION 输入.classIds <> "" + class.class_id in 输入.classIds + ENDOPTION + + OPTION 输入.deptIds <> "" + d1.dept_id in 输入.deptIds + ENDOPTION + + ENDSELECT + ENDQUERY + ENDIF + diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/stat/service/impl/DevicefaultcaeServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/stat/service/impl/DevicefaultcaeServiceImpl.java index 34878738..2863c7e3 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/stat/service/impl/DevicefaultcaeServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/stat/service/impl/DevicefaultcaeServiceImpl.java @@ -75,14 +75,43 @@ public class DevicefaultcaeServiceImpl implements DevicefaultcaeService { } JSONObject json = WQL.getWO("EM_DEVICEFAULTCAE01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "re.devicerecord_id DESC"); - // 处理平均故障间隔时间 && 平均故障修复时间 - WQLObject tab = WQLObject.getWQLObject("EM_BI_DeviceRepairRequest"); +/* // 处理平均故障间隔时间 && 平均故障修复时间 + WQLObject tab = WQLObject.getWQLObject("EM_BI_DeviceRepairRequest");*/ JSONArray content = json.getJSONArray("content"); for (int i = 0; i < content.size(); i++) { JSONObject jsonObject = content.getJSONObject(i); String devicerecord_id = jsonObject.getString("devicerecord_id"); - JSONArray arr = tab.query("devicerecord_id = '" + devicerecord_id + "' and is_delete = '0'").getResultJSONArray(0); + /* + * 平均故障间隔时间:运行时间/故障次数(运行时间查运行记录表,故障次数查报修单) + * 平均故障修复时间:故障时间/故障次数(故障时间查运行记录表) + */ + // 根据此设备查询运行记录表计算 运行时间和故障时间 + map.put("flag", "4"); + map.put("devicerecord_id", devicerecord_id); + JSONObject runAndErr_time = WQL.getWO("EM_DEVICEFAULTCAE01").addParamMap(map).process().uniqueResult(0); + if (ObjectUtil.isNotEmpty(runAndErr_time)) { + String run_times = runAndErr_time.getString("run_times"); // 运行时间 + String error_times = runAndErr_time.getString("error_times"); // 故障时间时间 + String error_num = jsonObject.getString("nunm"); // 故障次数 + + try { + // 计算平均故障间隔时间 + String avgVal_time = NumberUtil.div(NumberUtil.div(run_times, error_num).toString(), "60").toString(); + jsonObject.put("avgVal_time",NumberUtil.round(avgVal_time,2).toString()); + } catch (Exception e) { + jsonObject.put("avgVal_time","0"); + } + + try { + // 平均故障修复时间 + String avgRep_time = NumberUtil.div(NumberUtil.div(error_times, error_num).toString(), "60").toString(); + jsonObject.put("avgRep_time",NumberUtil.round(avgRep_time,2).toString()); + } catch (Exception e) { + jsonObject.put("avgRep_time","0"); + } + } + /*JSONArray arr = tab.query("devicerecord_id = '" + devicerecord_id + "' and is_delete = '0'").getResultJSONArray(0); // 计算平均故障修复时间 String nunm = jsonObject.getString("nunm"); String create_time_all = "0"; @@ -114,7 +143,7 @@ public class DevicefaultcaeServiceImpl implements DevicefaultcaeService { BigDecimal add = NumberUtil.add(NumberUtil.sub(re_end_time, re_begin_time).toString(), "1"); BigDecimal avgVal_time = NumberUtil.div(NumberUtil.mul(add, 24).toString(), nunm); - jsonObject.put("avgVal_time",avgVal_time.toString()); + jsonObject.put("avgVal_time",avgVal_time.toString());*/ } json.put("content",content); return json; diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/stat/wql/EM_DEVICEFAULTCAE01.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/stat/wql/EM_DEVICEFAULTCAE01.wql index a2811995..1543c479 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/stat/wql/EM_DEVICEFAULTCAE01.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/stat/wql/EM_DEVICEFAULTCAE01.wql @@ -144,6 +144,34 @@ WHERE is_delete = '0' + ENDSELECT + ENDQUERY + ENDIF + + IF 输入.flag = "4" + QUERY + SELECT + SUM(re.run_times) AS run_times, + SUM(re.error_times) AS error_times + FROM + EM_BI_DeviceRunRecord re + WHERE + 1=1 + + OPTION 输入.devicerecord_id <> "" + re.devicerecord_id = 输入.devicerecord_id + ENDOPTION + + OPTION 输入.begin_time <> "" + re.run_date >= 输入.begin_time + ENDOPTION + + OPTION 输入.end_time <> "" + re.run_date <= 输入.end_time + ENDOPTION + + group by re.devicerecord_id + ENDSELECT ENDQUERY ENDIF \ No newline at end of file diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/stat/wql/TASK_AUTOWEBSOCKETTSK.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/stat/wql/TASK_AUTOWEBSOCKETTSK.wql index 4b35dfa6..5bdf3e9e 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/stat/wql/TASK_AUTOWEBSOCKETTSK.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/stat/wql/TASK_AUTOWEBSOCKETTSK.wql @@ -340,6 +340,7 @@ WHEN '99' THEN '审核完毕' END ) + ELSE '报修' END ) AS invstatus, mst.real_start_date, @@ -367,8 +368,6 @@ WHERE st.is_delete = '0' AND (st.status <> '99') - AND mst.source_bill_type = 'BXD' - AND st.is_passed = '1' UNION diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/rest/DevicemaintenancemstController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/rest/DevicemaintenancemstController.java index 78f276d2..f1c9c201 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/rest/DevicemaintenancemstController.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/rest/DevicemaintenancemstController.java @@ -35,8 +35,8 @@ public class DevicemaintenancemstController { private final DevicemaintenancemstService devicemaintenancemstService; @GetMapping - @Log("查询设备保养单") - @ApiOperation("查询设备保养单") + @Log("查询设备保养单(维修班)") + @ApiOperation("查询设备保养单(维修班)") //@PreAuthorize("@el.check('devicemaintenancemst:list')") public ResponseEntity query(@RequestParam Map whereJson, Pageable page) { return new ResponseEntity<>(devicemaintenancemstService.queryAll(whereJson, page), HttpStatus.OK); @@ -52,13 +52,29 @@ public class DevicemaintenancemstController { @GetMapping("query3") - @Log("查询设备保养单") - @ApiOperation("查询设备保养单") + @Log("查询设备保养单填报(维修班)") + @ApiOperation("查询设备保养单填报(维修班)") //@PreAuthorize("@el.check('devicemaintenancemst:list')") public ResponseEntity query3(@RequestParam Map whereJson, Pageable page) { return new ResponseEntity<>(devicemaintenancemstService.query3(whereJson, page), HttpStatus.OK); } + @GetMapping("query4") + @Log("查询设备保养单(班组)") + @ApiOperation("查询设备保养单(班组)") + //@PreAuthorize("@el.check('devicemaintenancemst:list')") + public ResponseEntity query4(@RequestParam Map whereJson, Pageable page) { + return new ResponseEntity<>(devicemaintenancemstService.query4(whereJson, page), HttpStatus.OK); + } + + @GetMapping("query5") + @Log("查询设备保养单填报(班组)") + @ApiOperation("查询设备保养单填报(班组)") + //@PreAuthorize("@el.check('devicemaintenancemst:list')") + public ResponseEntity query5(@RequestParam Map whereJson, Pageable page) { + return new ResponseEntity<>(devicemaintenancemstService.query5(whereJson, page), HttpStatus.OK); + } + @PostMapping @Log("新增设备保养单") @ApiOperation("新增设备保养单") diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/service/DevicemaintenancemstService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/service/DevicemaintenancemstService.java index 931b2141..471f9648 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/service/DevicemaintenancemstService.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/service/DevicemaintenancemstService.java @@ -146,4 +146,22 @@ public interface DevicemaintenancemstService { * @return Map */ Map query3(Map whereJson, Pageable page); + + /** + * 查询数据分页 + * + * @param whereJson 条件 + * @param page 分页参数 + * @return Map + */ + Map query4(Map whereJson, Pageable page); + + /** + * 查询数据分页 + * + * @param whereJson 条件 + * @param page 分页参数 + * @return Map + */ + Map query5(Map whereJson, Pageable page); } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/service/impl/DevicemaintenancemstServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/service/impl/DevicemaintenancemstServiceImpl.java index 729058b8..0e26f3b6 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/service/impl/DevicemaintenancemstServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/service/impl/DevicemaintenancemstServiceImpl.java @@ -169,6 +169,7 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ jsonMst.put("maintenancecycle", whereJson.getString("maintenancecycle")); jsonMst.put("invstatus", "01"); jsonMst.put("plan_start_date", whereJson.getString("plan_start_date")); + jsonMst.put("maint_object", whereJson.getString("maint_object")); jsonMst.put("detail_count", tableData.size()); jsonMst.put("input_optid", currentUserId); jsonMst.put("input_optname", nickName); @@ -203,6 +204,7 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ jsonMst.put("devicerecord_id", whereJson.get("devicerecord_id")); jsonMst.put("maintenancecycle", whereJson.getString("maintenancecycle")); jsonMst.put("plan_start_date", whereJson.getString("plan_start_date")); + jsonMst.put("maint_object", whereJson.getString("maint_object")); jsonMst.put("detail_count", tableData.size()); mstTab.update(jsonMst); @@ -270,6 +272,7 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ // 更新保养单主表 JSONObject jsonMainMst = mainMstTab.query("maint_id = '" + whereJson.getString("maint_id") + "'").uniqueResult(0); jsonMainMst.put("invstatus", "03"); + jsonMainMst.put("update_optname",whereJson.getString("update_optname") ); jsonMainMst.put("real_start_date", DateUtil.now()); mainMstTab.update(jsonMainMst); @@ -318,6 +321,7 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ WQLObject lifeTab = WQLObject.getWQLObject("EM_BI_DeviceLifeCycle"); // 设备声明周期表 WQLObject dtlTab = WQLObject.getWQLObject("EM_BI_DeviceMaintenanceDtl"); + this.submitMain(whereJson); // 1.明细中的是否完成 :必须为全部完成 JSONArray dtlArr = dtlTab.query("maint_id = '" + maint_id + "'").getResultJSONArray(0); @@ -529,6 +533,7 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ String invstatus = MapUtil.getStr(whereJson, "invstatus"); String begin_time = MapUtil.getStr(whereJson, "begin_time"); String end_time = MapUtil.getStr(whereJson, "end_time"); + String maint_object = MapUtil.getStr(whereJson, "maint_object"); HashMap map = new HashMap<>(); map.put("flag", "4"); @@ -536,6 +541,39 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ map.put("invstatus", invstatus); map.put("begin_time", begin_time); map.put("end_time", end_time); + map.put("maint_object", maint_object); + if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code", "%" + device_code + "%"); + if (ObjectUtil.isNotEmpty(maint_code)) map.put("maint_code", "%" + maint_code + "%"); + //处理物料当前节点的所有子节点 + if (!StrUtil.isEmpty(material_type_id)) { + map.put("material_type_id", material_type_id); + String classIds = classstandardService.getChildIdStr(material_type_id); + map.put("classIds", classIds); + } else if (ObjectUtil.isNotEmpty(class_idStr)) { + String classIds = classstandardService.getAllChildIdStr(class_idStr); + map.put("classIds", classIds); + } + JSONObject json = WQL.getWO("EM_BIDEVICEMAINTENANCE001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "input_time DESC"); + return json; + } + + @Override + public Map query4(Map whereJson, Pageable page) { + String material_type_id = MapUtil.getStr(whereJson, "material_type_id"); + String class_idStr = MapUtil.getStr(whereJson, "class_idStr"); + String device_code = MapUtil.getStr(whereJson, "device_code"); + String maintenancecycle = MapUtil.getStr(whereJson, "maintenancecycle"); + String maint_code = MapUtil.getStr(whereJson, "maint_code"); + String invstatus = MapUtil.getStr(whereJson, "invstatus"); + String begin_time = MapUtil.getStr(whereJson, "begin_time"); + String end_time = MapUtil.getStr(whereJson, "end_time"); + + HashMap map = new HashMap<>(); + map.put("flag", "5"); + map.put("maintenancecycle", maintenancecycle); + map.put("invstatus", invstatus); + map.put("begin_time", begin_time); + map.put("end_time", end_time); if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code", "%" + device_code + "%"); if (ObjectUtil.isNotEmpty(maint_code)) map.put("maint_code", "%" + maint_code + "%"); //处理物料当前节点的所有子节点 @@ -551,4 +589,38 @@ public class DevicemaintenancemstServiceImpl implements DevicemaintenancemstServ return json; } + @Override + public Map query5(Map whereJson, Pageable page) { + String material_type_id = MapUtil.getStr(whereJson, "material_type_id"); + String class_idStr = MapUtil.getStr(whereJson, "class_idStr"); + String device_code = MapUtil.getStr(whereJson, "device_code"); + String maintenancecycle = MapUtil.getStr(whereJson, "maintenancecycle"); + String maint_code = MapUtil.getStr(whereJson, "maint_code"); + String invstatus = MapUtil.getStr(whereJson, "invstatus"); + String begin_time = MapUtil.getStr(whereJson, "begin_time"); + String end_time = MapUtil.getStr(whereJson, "end_time"); + String maint_object = MapUtil.getStr(whereJson, "maint_object"); + + HashMap map = new HashMap<>(); + map.put("flag", "6"); + map.put("maintenancecycle", maintenancecycle); + map.put("invstatus", invstatus); + map.put("begin_time", begin_time); + map.put("end_time", end_time); + map.put("maint_object", maint_object); + if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code", "%" + device_code + "%"); + if (ObjectUtil.isNotEmpty(maint_code)) map.put("maint_code", "%" + maint_code + "%"); + //处理物料当前节点的所有子节点 + if (!StrUtil.isEmpty(material_type_id)) { + map.put("material_type_id", material_type_id); + String classIds = classstandardService.getChildIdStr(material_type_id); + map.put("classIds", classIds); + } else if (ObjectUtil.isNotEmpty(class_idStr)) { + String classIds = classstandardService.getAllChildIdStr(class_idStr); + map.put("classIds", classIds); + } + JSONObject json = WQL.getWO("EM_BIDEVICEMAINTENANCE001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "input_time DESC"); + return json; + } + } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/service/impl/DevicemaintenanceplanmstServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/service/impl/DevicemaintenanceplanmstServiceImpl.java index 3f3a386e..1798597f 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/service/impl/DevicemaintenanceplanmstServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/service/impl/DevicemaintenanceplanmstServiceImpl.java @@ -56,6 +56,7 @@ public class DevicemaintenanceplanmstServiceImpl implements Devicemaintenancepla String is_active = MapUtil.getStr(whereJson, "is_active"); String begin_time = MapUtil.getStr(whereJson, "begin_time"); String end_time = MapUtil.getStr(whereJson, "end_time"); + String maint_object = MapUtil.getStr(whereJson, "maint_object"); String class_idStr = (String) whereJson.get("class_idStr"); HashMap map = new HashMap<>(); @@ -64,6 +65,7 @@ public class DevicemaintenanceplanmstServiceImpl implements Devicemaintenancepla map.put("is_active", is_active); map.put("begin_time", begin_time); map.put("end_time", end_time); + map.put("maint_object", maint_object); if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code","%"+device_code+"%"); if (ObjectUtil.isNotEmpty(maint_plan_code)) map.put("maint_plan_code","%"+maint_plan_code+"%"); //处理物料当前节点的所有子节点 @@ -132,6 +134,7 @@ public class DevicemaintenanceplanmstServiceImpl implements Devicemaintenancepla jsonMst.put("devicerecord_id", whereJson.getString("devicerecord_id")); jsonMst.put("maintenancecycle", whereJson.getString("maintenancecycle")); jsonMst.put("plan_start_date", whereJson.getString("plan_start_date")); + jsonMst.put("maint_object", whereJson.getString("maint_object")); jsonMst.put("detail_count", tableData.size()); jsonMst.put("create_id", currentUserId); jsonMst.put("create_name", nickName); @@ -174,6 +177,7 @@ public class DevicemaintenanceplanmstServiceImpl implements Devicemaintenancepla jsonMst.put("devicerecord_id", whereJson.getString("devicerecord_id")); jsonMst.put("maintenancecycle", whereJson.getString("maintenancecycle")); jsonMst.put("plan_start_date", whereJson.getString("plan_start_date")); + jsonMst.put("maint_object", whereJson.getString("maint_object")); jsonMst.put("detail_count", tableData.size()); jsonMst.put("update_optid", currentUserId); jsonMst.put("update_optname", nickName); @@ -268,9 +272,12 @@ public class DevicemaintenanceplanmstServiceImpl implements Devicemaintenancepla // 获取当前登陆用户 Long currentUserId = SecurityUtils.getCurrentUserId(); - String dept_str = deptService.getChildIdStr(currentUserId); - if (ObjectUtil.isNotEmpty(dept_str)) { - map.put("dept_str",dept_str); + JSONObject jsonUser = WQLObject.getWQLObject("sys_user").query("user_id = '" + currentUserId + "'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(jsonUser)) { + String dept_str = deptService.getChildIdStr(jsonUser.getLong("dept_id")); + if (ObjectUtil.isNotEmpty(dept_str)) { + map.put("dept_str",dept_str); + } } JSONObject json = WQL.getWO("EM_BIDEVICEMAINTENANCEPLAN001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "file.update_time DESC"); @@ -331,6 +338,7 @@ public class DevicemaintenanceplanmstServiceImpl implements Devicemaintenancepla jsonMst.put("devicerecord_id", whereJson.getString("devicerecord_id")); jsonMst.put("maintenancecycle", whereJson.getString("maintenancecycle")); jsonMst.put("plan_start_date", whereJson.getString("plan_start_date")); + jsonMst.put("maint_object", whereJson.getString("maint_object")); jsonMst.put("detail_count", tableData.size()); jsonMst.put("create_id", currentUserId); jsonMst.put("create_name", nickName); diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/wql/EM_BIDEVICEMAINTENANCE001.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/wql/EM_BIDEVICEMAINTENANCE001.wql index 209e97c5..c408ce44 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/wql/EM_BIDEVICEMAINTENANCE001.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/wql/EM_BIDEVICEMAINTENANCE001.wql @@ -22,6 +22,7 @@ 输入.invstatus TYPEAS s_string 输入.begin_time TYPEAS s_string 输入.end_time TYPEAS s_string + 输入.maint_object TYPEAS s_string [临时表] @@ -65,6 +66,7 @@ WHERE mst.is_delete = '0' AND file.is_delete = '0' + AND mst.maint_object = '02' OPTION 输入.device_code <> "" (file.device_code like 输入.device_code or @@ -193,6 +195,7 @@ WHERE mst.is_delete = '0' AND file.is_delete = '0' + AND mst.maint_object = '02' AND mst.invstatus not in ('01') OPTION 输入.device_code <> "" @@ -213,6 +216,237 @@ mst.maintenancecycle = 输入.maintenancecycle ENDOPTION + OPTION 输入.maint_object <> "" + mst.maint_object = 输入.maint_object + ENDOPTION + + OPTION 输入.begin_time <> "" + mst.plan_start_date >= 输入.begin_time + ENDOPTION + + OPTION 输入.end_time <> "" + mst.plan_start_date <= 输入.end_time + ENDOPTION + + OPTION 输入.invstatus <> "" + mst.invstatus = 输入.invstatus + ENDOPTION + + UNION + + SELECT + mst.*, + class.class_name, + file.device_code, + file.device_name, + file.extend_code, + d1.name AS dept_name, + d2.name AS use_name + FROM + EM_BI_DeviceMaintenanceMst mst + LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = mst.devicerecord_id + LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id + LEFT JOIN sys_dept d1 ON file.belong_deptid = d1.dept_id + LEFT JOIN sys_dept d2 ON file.use_groupid = d2.dept_id + WHERE + mst.is_delete = '0' + AND file.is_delete = '0' + AND mst.maint_object = '01' + AND mst.invstatus in ('04') + + OPTION 输入.device_code <> "" + (file.device_code like 输入.device_code or + file.device_name like 输入.device_code) + ENDOPTION + + OPTION 输入.maint_code <> "" + (mst.maint_code like 输入.maint_code or + mst.maint_code like 输入.maint_code) + ENDOPTION + + OPTION 输入.classIds <> "" + class.class_id in 输入.classIds + ENDOPTION + + OPTION 输入.maintenancecycle <> "" + mst.maintenancecycle = 输入.maintenancecycle + ENDOPTION + + OPTION 输入.maint_object <> "" + mst.maint_object = 输入.maint_object + ENDOPTION + + OPTION 输入.begin_time <> "" + mst.plan_start_date >= 输入.begin_time + ENDOPTION + + OPTION 输入.end_time <> "" + mst.plan_start_date <= 输入.end_time + ENDOPTION + + OPTION 输入.invstatus <> "" + mst.invstatus = 输入.invstatus + ENDOPTION + + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "5" + PAGEQUERY + SELECT + mst.*, + class.class_name, + file.device_code, + file.device_name, + file.extend_code, + d1.name AS dept_name, + d2.name AS use_name + FROM + EM_BI_DeviceMaintenanceMst mst + LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = mst.devicerecord_id + LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id + LEFT JOIN sys_dept d1 ON file.belong_deptid = d1.dept_id + LEFT JOIN sys_dept d2 ON file.use_groupid = d2.dept_id + WHERE + mst.is_delete = '0' + AND file.is_delete = '0' + AND mst.maint_object = '01' + + OPTION 输入.device_code <> "" + (file.device_code like 输入.device_code or + file.device_name like 输入.device_code) + ENDOPTION + + OPTION 输入.maint_code <> "" + (mst.maint_code like 输入.maint_code or + mst.maint_code like 输入.maint_code) + ENDOPTION + + OPTION 输入.classIds <> "" + class.class_id in 输入.classIds + ENDOPTION + + OPTION 输入.maintenancecycle <> "" + mst.maintenancecycle = 输入.maintenancecycle + ENDOPTION + + OPTION 输入.begin_time <> "" + mst.plan_start_date >= 输入.begin_time + ENDOPTION + + OPTION 输入.end_time <> "" + mst.plan_start_date <= 输入.end_time + ENDOPTION + + OPTION 输入.invstatus <> "" + mst.invstatus = 输入.invstatus + ENDOPTION + + ENDSELECT + ENDPAGEQUERY + ENDIF + + IF 输入.flag = "6" + PAGEQUERY + SELECT + mst.*, + class.class_name, + file.device_code, + file.device_name, + file.extend_code, + d1.name AS dept_name, + d2.name AS use_name + FROM + EM_BI_DeviceMaintenanceMst mst + LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = mst.devicerecord_id + LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id + LEFT JOIN sys_dept d1 ON file.belong_deptid = d1.dept_id + LEFT JOIN sys_dept d2 ON file.use_groupid = d2.dept_id + WHERE + mst.is_delete = '0' + AND file.is_delete = '0' + AND mst.maint_object = '01' + AND mst.invstatus not in ('01') + + OPTION 输入.device_code <> "" + (file.device_code like 输入.device_code or + file.device_name like 输入.device_code) + ENDOPTION + + OPTION 输入.maint_code <> "" + (mst.maint_code like 输入.maint_code or + mst.maint_code like 输入.maint_code) + ENDOPTION + + OPTION 输入.classIds <> "" + class.class_id in 输入.classIds + ENDOPTION + + OPTION 输入.maintenancecycle <> "" + mst.maintenancecycle = 输入.maintenancecycle + ENDOPTION + + OPTION 输入.maint_object <> "" + mst.maint_object = 输入.maint_object + ENDOPTION + + OPTION 输入.begin_time <> "" + mst.plan_start_date >= 输入.begin_time + ENDOPTION + + OPTION 输入.end_time <> "" + mst.plan_start_date <= 输入.end_time + ENDOPTION + + OPTION 输入.invstatus <> "" + mst.invstatus = 输入.invstatus + ENDOPTION + + UNION + + SELECT + mst.*, + class.class_name, + file.device_code, + file.device_name, + file.extend_code, + d1.name AS dept_name, + d2.name AS use_name + FROM + EM_BI_DeviceMaintenanceMst mst + LEFT JOIN EM_BI_EquipmentFile file ON file.devicerecord_id = mst.devicerecord_id + LEFT JOIN md_pb_classstandard class ON file.material_type_id = class.class_id + LEFT JOIN sys_dept d1 ON file.belong_deptid = d1.dept_id + LEFT JOIN sys_dept d2 ON file.use_groupid = d2.dept_id + WHERE + mst.is_delete = '0' + AND file.is_delete = '0' + AND mst.maint_object = '02' + AND mst.invstatus in ('04') + + OPTION 输入.device_code <> "" + (file.device_code like 输入.device_code or + file.device_name like 输入.device_code) + ENDOPTION + + OPTION 输入.maint_code <> "" + (mst.maint_code like 输入.maint_code or + mst.maint_code like 输入.maint_code) + ENDOPTION + + OPTION 输入.classIds <> "" + class.class_id in 输入.classIds + ENDOPTION + + OPTION 输入.maintenancecycle <> "" + mst.maintenancecycle = 输入.maintenancecycle + ENDOPTION + + OPTION 输入.maint_object <> "" + mst.maint_object = 输入.maint_object + ENDOPTION + OPTION 输入.begin_time <> "" mst.plan_start_date >= 输入.begin_time ENDOPTION diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/wql/EM_BIDEVICEMAINTENANCEPLAN001.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/wql/EM_BIDEVICEMAINTENANCEPLAN001.wql index c4f5fdd5..667e75fc 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/wql/EM_BIDEVICEMAINTENANCEPLAN001.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/upkeep/wql/EM_BIDEVICEMAINTENANCEPLAN001.wql @@ -25,6 +25,7 @@ 输入.is_active TYPEAS s_string 输入.begin_time TYPEAS s_string 输入.end_time TYPEAS s_string + 输入.maint_object TYPEAS s_string [临时表] @@ -95,6 +96,10 @@ mst.plan_start_date <= 输入.end_time ENDOPTION + OPTION 输入.maint_object <> "" + mst.maint_object = 输入.maint_object + ENDOPTION + ENDSELECT ENDPAGEQUERY ENDIF diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/service/impl/PhysicalQueryServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/service/impl/PhysicalQueryServiceImpl.java index f0a7d61d..ecd1086d 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/service/impl/PhysicalQueryServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/service/impl/PhysicalQueryServiceImpl.java @@ -141,7 +141,7 @@ public class PhysicalQueryServiceImpl implements PhysicalQueryService { JSONObject jsonResult1 = new JSONObject(); jsonResult1.put("prop", "0"); jsonResult1.put("label", "质检单号"); - jsonResultArr.add(jsonResult1); +// jsonResultArr.add(jsonResult1); JSONObject jsonResult2 = new JSONObject(); jsonResult2.put("prop", "1"); jsonResult2.put("label", "物料编码"); @@ -163,8 +163,8 @@ public class PhysicalQueryServiceImpl implements PhysicalQueryService { JSONObject jsonResult19 = new JSONObject(); jsonResult19.put("prop", "19"); jsonResult19.put("label", "金相备注"); - jsonResultArr.add(jsonResult2); - jsonResultArr.add(jsonResult20); +// jsonResultArr.add(jsonResult2); +// jsonResultArr.add(jsonResult20); jsonResultArr.add(jsonResult21); jsonResultArr.add(jsonResult3); jsonResultArr.add(jsonResult4); diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/service/impl/PowderOrderQueryServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/service/impl/PowderOrderQueryServiceImpl.java index d682ebde..37840653 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/service/impl/PowderOrderQueryServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/service/impl/PowderOrderQueryServiceImpl.java @@ -71,6 +71,27 @@ public class PowderOrderQueryServiceImpl implements PowderOrderQueryService { jsonResult.put(jsonDtl.getString("material_id") +"formula_qty",jsonDtl.getString("formula_qty")); } } + // 碳平衡 + jsonResult.put("3", json.getString("c_balance")); + // 时间 + jsonResult.put("4", json.getString("ball_time")); + // 球料比 + jsonResult.put("5", json.getString("ball_rate")); + // 液料比 + jsonResult.put("6", json.getString("liquid_rate")); + // 球磨机号 + HashMap map1 = new HashMap<>(); + map1.put("flag", "3"); + map1.put("product_series_id", json.getString("product_series_id")); + map1.put("workprocedure_id", "1472449856613257216"); + JSONObject jsonDevice1 = WQL.getWO("QPF_POINTCARD01").addParamMap(map1).process().uniqueResult(0); + map1.put("flag", "4"); + JSONObject jsonDevice2= WQL.getWO("QPF_POINTCARD01").addParamMap(map1).process().uniqueResult(0); + if (ObjectUtil.isNotEmpty(jsonDevice1) && ObjectUtil.isNotEmpty(jsonDevice2)) { + String device_code_1 = jsonDevice1.getString("device_code").substring(4, 6); + String device_code_2 = jsonDevice2.getString("device_code").substring(4, 6); + jsonResult.put("7", device_code_1 + "-" + device_code_2); + } jsonResultArr.add(jsonResult); } resultJson.put("content",jsonResultArr); @@ -81,19 +102,6 @@ public class PowderOrderQueryServiceImpl implements PowderOrderQueryService { public JSONArray getHeader() { JSONArray jsonResultArr = new JSONArray(); - JSONObject jsonResult1 = new JSONObject(); - jsonResult1.put("prop", "0"); - jsonResult1.put("label", "日期"); - jsonResultArr.add(jsonResult1); - JSONObject jsonResult2 = new JSONObject(); - jsonResult2.put("prop", "1"); - jsonResult2.put("label", "产品编码"); - jsonResultArr.add(jsonResult2); - JSONObject jsonResult3 = new JSONObject(); - jsonResult3.put("prop", "2"); - jsonResult3.put("label", "批号"); - jsonResultArr.add(jsonResult3); - String classIds = classstandardService.getAllChildIdStr(MaterOptTypeEnum.YL_AND_FL.getClass_idStr()); String RF = classstandardService.getAllChildIdStr(MaterOptTypeEnum.RF.getClass_idStr()); JSONArray resultJSONArray = WQL.getWO("QP_POWDERORDERQUERY01").addParam("flag", "2").addParam("classIds", classIds).addParam("rf", RF).process().getResultJSONArray(0); @@ -104,10 +112,10 @@ public class PowderOrderQueryServiceImpl implements PowderOrderQueryService { jsonResult4.put("prop",json.getString("material_id")); jsonResult4.put("label","物料" + NumberUtil.add(String.valueOf(i), "1") + ""); jsonResultArr.add(jsonResult4); - JSONObject jsonResult5 = new JSONObject(); - jsonResult5.put("prop",json.getString("material_code")+""); - jsonResult5.put("label","物料编码"); - jsonResultArr.add(jsonResult5); +// JSONObject jsonResult5 = new JSONObject(); +// jsonResult5.put("prop",json.getString("material_code")+""); +// jsonResult5.put("label","物料编码"); +// jsonResultArr.add(jsonResult5); JSONObject jsonResult6 = new JSONObject(); jsonResult6.put("prop",json.getString("material_id")+"pcsn"); jsonResult6.put("label","批次"); @@ -117,6 +125,28 @@ public class PowderOrderQueryServiceImpl implements PowderOrderQueryService { jsonResult7.put("label","重量"); jsonResultArr.add(jsonResult7); } + + JSONObject jsonResult1 = new JSONObject(); + jsonResult1.put("prop", "3"); + jsonResult1.put("label", "碳平衡(%)"); + jsonResultArr.add(jsonResult1); + JSONObject jsonResult2 = new JSONObject(); + jsonResult2.put("prop", "4"); + jsonResult2.put("label", "时间(h)"); + jsonResultArr.add(jsonResult2); + JSONObject jsonResult3 = new JSONObject(); + jsonResult3.put("prop", "5"); + jsonResult3.put("label", "球料比"); + jsonResultArr.add(jsonResult3); + JSONObject jsonResult8 = new JSONObject(); + jsonResult8.put("prop", "6"); + jsonResult8.put("label", "液料比"); + jsonResultArr.add(jsonResult8); + JSONObject jsonResult9 = new JSONObject(); + jsonResult9.put("prop", "7"); + jsonResult9.put("label", "球磨机号"); + jsonResultArr.add(jsonResult9); + return jsonResultArr; } } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/service/impl/RawUatWcQueryServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/service/impl/RawUatWcQueryServiceImpl.java index fed8bf11..6e264d2e 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/service/impl/RawUatWcQueryServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/service/impl/RawUatWcQueryServiceImpl.java @@ -128,7 +128,7 @@ public class RawUatWcQueryServiceImpl implements RawUatWcQueryService { // JSONArray jsonArr = WQL.getWO("RaUatWc_query_01").addParam("flag", "2").addParam("inspection_scheme_code",inspection_scheme_code).process().getResultJSONArray(0); JSONArray jsonArr = WQL.getWO("RaUatWc_query_01").addParam("flag", "5").process().getResultJSONArray(0); JSONArray jonsResuftArr = new JSONArray(); - JSONObject jsonResuft1 = new JSONObject(); +/* JSONObject jsonResuft1 = new JSONObject(); jsonResuft1.put("prop", "1"); jsonResuft1.put("label", "物料编码"); JSONObject jsonResuft2 = new JSONObject(); @@ -139,14 +139,14 @@ public class RawUatWcQueryServiceImpl implements RawUatWcQueryService { jsonResuft3.put("label", "批号"); JSONObject jsonResuft4 = new JSONObject(); jsonResuft4.put("prop", "4"); - jsonResuft4.put("label", "重量"); + jsonResuft4.put("label", "重量");*/ JSONObject jsonResuft5 = new JSONObject(); jsonResuft5.put("prop", "5"); jsonResuft5.put("label", "厂家"); - jonsResuftArr.add(jsonResuft1); + /* jonsResuftArr.add(jsonResuft1); jonsResuftArr.add(jsonResuft2); jonsResuftArr.add(jsonResuft3); - jonsResuftArr.add(jsonResuft4); + jonsResuftArr.add(jsonResuft4);*/ jonsResuftArr.add(jsonResuft5); for (int i = 0; i < jsonArr.size(); i++) { JSONObject json = jsonArr.getJSONObject(i); diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/wql/QP_POWDERORDERQUERY01.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/wql/QP_POWDERORDERQUERY01.wql index b8335d02..68d9f466 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/wql/QP_POWDERORDERQUERY01.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/statistics/wql/QP_POWDERORDERQUERY01.wql @@ -51,11 +51,17 @@ work.create_time, mater.material_code, work.pcsn, - mst.formula_id + mst.formula_id, + mst.ball_time, + mst.product_series_id, + ext.c_balance, + ext.ball_rate, + ext.liquid_rate FROM PDM_BI_WorkOrder work LEFT JOIN PDM_BI_Formula mst ON mst.workorder_id = work.workorder_id LEFT JOIN md_me_materialbase mater ON mater.material_id = work.material_id + LEFT JOIN MD_ME_ProducMaterialExt ext ON mater.material_id = ext.material_id WHERE mst.is_delete= '0' diff --git a/mes/qd/src/api/wms/sb/devicerunrecord.js b/mes/qd/src/api/wms/sb/devicerunrecord.js index 4c7749ff..942a6020 100644 --- a/mes/qd/src/api/wms/sb/devicerunrecord.js +++ b/mes/qd/src/api/wms/sb/devicerunrecord.js @@ -24,4 +24,12 @@ export function edit(data) { }) } -export default { add, edit, del } +export function submit(data) { + return request({ + url: 'api/devicerunrecord/submit', + method: 'post', + data + }) +} + +export default { add, edit, del, submit } diff --git a/mes/qd/src/assets/styles/element-ui.scss b/mes/qd/src/assets/styles/element-ui.scss index 8f7881c2..5c72fb9a 100644 --- a/mes/qd/src/assets/styles/element-ui.scss +++ b/mes/qd/src/assets/styles/element-ui.scss @@ -17,7 +17,7 @@ .cell { .el-tag { - margin-right: 0; + margin-right: 0px; } } @@ -41,7 +41,7 @@ text-align: center; .el-tag { - margin-right: 0; + margin-right: 0px; } } } @@ -69,7 +69,7 @@ // dropdown .el-dropdown-menu { a { - display: block + display: block; } } @@ -77,3 +77,46 @@ .el-range-editor.el-input__inner { display: inline-flex !important; } + +// to fix el-date-picker css style +.el-range-separator { + box-sizing: content-box; +} + +.el-menu--collapse +> div +> .el-submenu +> .el-submenu__title +.el-submenu__icon-arrow { + display: none; +} + +.el-form-search { + float: right; + .el-form-search-item { + margin-bottom: 0px; + .el-input__inner { + width: 140px; + } + } +} + +el-table .el-table__cell { + padding: 8px 0; +} + +.el-table--medium .el-table__cell { + padding: 6px 0; +} + +.el-table--small .el-table__cell { + padding: 3px 0; +} + +.el-table--mini .el-table__cell { + padding: 1px 0; +} + +.el-dialog__body { + padding: 20px 20px; +} diff --git a/mes/qd/src/views/wms/basedata/em/equipmentfile/AddDialog.vue b/mes/qd/src/views/wms/basedata/em/equipmentfile/AddDialog.vue index bb0f4bec..ecfe5d26 100644 --- a/mes/qd/src/views/wms/basedata/em/equipmentfile/AddDialog.vue +++ b/mes/qd/src/views/wms/basedata/em/equipmentfile/AddDialog.vue @@ -327,9 +327,6 @@ export default { use_deptid: [ { required: true, message: '使用部门不能为空', trigger: 'blur' } ], - device_bom_id: [ - { required: true, message: '设备Bom不能为空', trigger: 'blur' } - ], is_produceuse: [ { required: true, message: '生产用途不能为空', trigger: 'blur' } ] diff --git a/mes/qd/src/views/wms/pf/formula/DivDialog.vue b/mes/qd/src/views/wms/pf/formula/DivDialog.vue index cb661891..2eb78c0b 100644 --- a/mes/qd/src/views/wms/pf/formula/DivDialog.vue +++ b/mes/qd/src/views/wms/pf/formula/DivDialog.vue @@ -299,7 +299,7 @@ @@ -889,14 +889,6 @@ export default { this.tableDtl.push(value) } }, - is_rf_xl(row){ - let maxNum = 9999999999.0 - if(row.is_rf_xl === '1'){ - return parseFloat(row.sum_ivt_qty).toFixed(3) - }else{ - return parseFloat(maxNum).toFixed(3) - } - }, submit() { if (this.tableDtl.length === 0) { this.crud.notify('明细不能为空!') @@ -908,6 +900,16 @@ export default { return false } } + for (let i = 0; i < this.tableDtl.length; i++) { + if (this.tableDtl[i].status === '10') { + if(this.tableDtl[i].is_need_move === '1'){ + if (parseFloat(this.tableDtl[i].sum_ivt_qty) < parseFloat(this.tableDtl[i].formula_qty)) { + this.crud.notify('配粉重量不允许大于可用库存重量,明细序号为' + (i + 1) + '请检查!') + return false + } + } + } + } this.form.tableDtl = this.tableDtl formula.submit(this.form).then(res => { this.crud.notify('操作成功!') diff --git a/mes/qd/src/views/wms/pf/formula/ViewDialog.vue b/mes/qd/src/views/wms/pf/formula/ViewDialog.vue index 5e0ab01d..5e8c0fa1 100644 --- a/mes/qd/src/views/wms/pf/formula/ViewDialog.vue +++ b/mes/qd/src/views/wms/pf/formula/ViewDialog.vue @@ -275,6 +275,7 @@ + diff --git a/mes/qd/src/views/wms/sb/repair/devicegridcheck/index.vue b/mes/qd/src/views/wms/sb/repair/devicegridcheck/index.vue new file mode 100644 index 00000000..f8321e44 --- /dev/null +++ b/mes/qd/src/views/wms/sb/repair/devicegridcheck/index.vue @@ -0,0 +1,287 @@ + + + + + diff --git a/mes/qd/src/views/wms/sb/repair/devicerepair/AddDialog.vue b/mes/qd/src/views/wms/sb/repair/devicerepair/AddDialog.vue index fad14298..b17060bd 100644 --- a/mes/qd/src/views/wms/sb/repair/devicerepair/AddDialog.vue +++ b/mes/qd/src/views/wms/sb/repair/devicerepair/AddDialog.vue @@ -141,13 +141,15 @@ - + + + diff --git a/mes/qd/src/views/wms/sb/run/devicerunrecord/index.vue b/mes/qd/src/views/wms/sb/run/devicerunrecord/index.vue index f5101b44..f81afc9a 100644 --- a/mes/qd/src/views/wms/sb/run/devicerunrecord/index.vue +++ b/mes/qd/src/views/wms/sb/run/devicerunrecord/index.vue @@ -12,7 +12,7 @@ label-suffix=":" > - + + + + - + + + 填报 + + - - - + - + @@ -112,13 +131,22 @@ - - - - + + + + + + + + + + + + + - + @@ -148,11 +177,14 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css' import crudMaterialbase from '@/api/wms/basedata/master/materialbase' import DateRangePicker from '@/components/DateRangePicker' import DeviceDialog from '@/views/wms/sb/upkeep/devicemaintenanceplan/DeviceDialog' +import { getDepts } from '@/api/system/dept' +import PaDialog from '@/views/wms/sb/run/devicerunrecord/PaDialog' +const start = new Date() const defaultForm = { runrecord_id: null, device_code: null, devicerecord_id: null, run_date: null, run_times: null, prepare_times: null, error_times: null, adjust_times: null, product_qty: null, nok_qty: null, oee_value: null, remark: null, create_id: null, create_name: null, create_time: null } export default { name: 'Devicerunrecord', - components: { pagination, crudOperation, rrOperation, udOperation, Treeselect, DateRangePicker, DeviceDialog }, + components: { pagination, crudOperation, rrOperation, udOperation, Treeselect, DateRangePicker, DeviceDialog, PaDialog }, mixins: [presenter(), header(), form(defaultForm), crud()], cruds() { return CRUD({ @@ -162,20 +194,27 @@ export default { sort: 'runrecord_id,desc', crudMethod: { ...crudDevicerunrecord }, optShow: { - add: true, + add: false, edit: false, del: false, download: false, reset: true + }, + query: { + createTime: [start.daysAgo(0), new Date()] } }) }, data() { return { + open: true, classes: [], class_idStr: null, materOpt_code: '23', + depts: [], deviceDialog: false, + openParam: null, + addPaDialog: false, permission: { }, rules: { @@ -194,14 +233,20 @@ export default { crudMaterialbase.getMaterOptType(param).then(res => { this.class_idStr = res.class_idStr this.crud.query.class_idStr = this.class_idStr - this.crud.toQuery() this.queryClassId() }) + this.getDepts() }, methods: { // 钩子:在获取表格数据之前执行,false 则代表不获取数据 [CRUD.HOOK.beforeRefresh]() { - return true + debugger + if (this.open) { + this.open = false + return false + } else { + return true + } }, hand(value) { this.crud.toQuery() @@ -240,6 +285,38 @@ export default { tableChanged2(row) { this.form.devicerecord_id = row.devicerecord_id this.form.device_code = row.device_code + }, + // 获取弹窗内部门数据 + loadDepts({ action, parentNode, callback }) { + if (action === LOAD_CHILDREN_OPTIONS) { + getDepts({ enabled: true, pid: parentNode.id }).then(res => { + parentNode.children = res.content.map(function(obj) { + if (obj.hasChildren) { + obj.children = null + } + return obj + }) + setTimeout(() => { + callback() + }, 200) + }) + } + }, + getDepts() { + getDepts({ enabled: true }).then(res => { + this.depts = res.content.map(function(obj) { + if (obj.hasChildren) { + obj.children = null + } + return obj + }) + }) + }, + addPa() { + const _selectData = this.$refs.table.selection + const data = _selectData[0] + this.openParam = data + this.addPaDialog = true } } } diff --git a/mes/qd/src/views/wms/sb/stat/deviceooestat/index.vue b/mes/qd/src/views/wms/sb/stat/deviceooestat/index.vue index 2c42931e..f463ace9 100644 --- a/mes/qd/src/views/wms/sb/stat/deviceooestat/index.vue +++ b/mes/qd/src/views/wms/sb/stat/deviceooestat/index.vue @@ -48,6 +48,9 @@ +
+
设备oee=(生产时间-准备时间-故障时间-工装调整时间) / (生产时间-准备时间-工装调整时间) * 单个产品生产时间 * 生产总量 / (生产时间-准备时间-故障时间-工装调整时间) * (生产总量-不合格数) / 生产总量
+
diff --git a/mes/qd/src/views/wms/sb/stat/task/bigScreen.vue b/mes/qd/src/views/wms/sb/stat/task/bigScreen.vue index 291ec39a..40f75cf4 100644 --- a/mes/qd/src/views/wms/sb/stat/task/bigScreen.vue +++ b/mes/qd/src/views/wms/sb/stat/task/bigScreen.vue @@ -1,22 +1,22 @@ @@ -126,9 +143,12 @@ const defaultForm = { maint_code: null, + maint_object: null, devicerecord_id: null, maintenancecycle: '02', plan_start_date: null, + material_type_id: null, + device_code: null, tableData: [] } @@ -163,6 +183,9 @@ export default { dialogVisible: false, deviceDialog: false, itemDialog: false, + objectList: [ + { 'label': '维修班', 'value': '02' } + ], rules: { plan_start_date: [ { required: true, message: '计划开始日期不能为空', trigger: 'blur' } @@ -172,6 +195,9 @@ export default { ], devicerecord_id: [ { required: true, message: '设备不能为空', trigger: 'blur' } + ], + maint_object: [ + { required: true, message: '保养对象不能为空', trigger: 'blur' } ] } } @@ -224,6 +250,7 @@ export default { this.deviceDialog = true }, putItem() { + this.openParam = this.form this.itemDialog = true }, tableChanged1(row) { @@ -247,7 +274,8 @@ export default { }, tableChanged2(row) { this.form.devicerecord_id = row.devicerecord_id - this.form.device_code = row.device_code + this.form.material_type_id = row.material_type_id + this.form.device_code = row.device_name + '-' + row.device_code }, delRow(index, rows) { rows.splice(index, 1) diff --git a/mes/qd/src/views/wms/sb/upkeep/devicemaintenance/index.vue b/mes/qd/src/views/wms/sb/upkeep/devicemaintenance/index.vue index 4c8e36b2..e2d7f75d 100644 --- a/mes/qd/src/views/wms/sb/upkeep/devicemaintenance/index.vue +++ b/mes/qd/src/views/wms/sb/upkeep/devicemaintenance/index.vue @@ -115,6 +115,7 @@ + @@ -163,7 +164,7 @@ import {downloadFile} from "@/utils"; export default { name: 'Devicemaintenance', - dicts: ['EM_DEVICE_BY_INVSTATUS', 'EM_DEVICE_BY_INVTYPE'], + dicts: ['EM_DEVICE_BY_INVSTATUS', 'EM_DEVICE_BY_INVTYPE', 'EM_DEVICE_MAINT_OBJECT'], components: { AddDialog, pagination, crudOperation, rrOperation, udOperation, Treeselect, DateRangePicker }, mixins: [presenter(), header(), crud()], cruds() { @@ -210,6 +211,9 @@ export default { hand(value) { this.crud.toQuery() }, + formatMainObject(row, cloum) { + return this.dict.label.EM_DEVICE_MAINT_OBJECT[row.maint_object] + }, formatInvsName(row, cloum) { return this.dict.label.EM_DEVICE_BY_INVSTATUS[row.invstatus] }, diff --git a/mes/qd/src/views/wms/sb/upkeep/devicemaintenancegrid/AddDialog.vue b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancegrid/AddDialog.vue new file mode 100644 index 00000000..52724723 --- /dev/null +++ b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancegrid/AddDialog.vue @@ -0,0 +1,311 @@ + + + + + diff --git a/mes/qd/src/views/wms/sb/upkeep/devicemaintenancegrid/index.vue b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancegrid/index.vue new file mode 100644 index 00000000..1ca7b6aa --- /dev/null +++ b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancegrid/index.vue @@ -0,0 +1,277 @@ + + + + + diff --git a/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepa/ExecuteDialog.vue b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepa/ExecuteDialog.vue index faca60a1..104259e3 100644 --- a/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepa/ExecuteDialog.vue +++ b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepa/ExecuteDialog.vue @@ -8,12 +8,13 @@ destroy-on-close @close="close" > - - + + - + + 保存并结束 保存 关闭 @@ -183,6 +184,17 @@ export default { this.crud.toQuery() this.dialogVisible = false }) + }, + submitAndEnd() { + const data = this.form + if (this.form.update_optname === '') { + return this.crud.notify('保养人不能为空', CRUD.NOTIFICATION_TYPE.INFO) + } + crudDevicemaintenancemst.endMaintain(data).then(res => { + this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS) + this.dialogVisible = false + this.crud.toQuery() + }) } } } diff --git a/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepa/StartDialog.vue b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepa/StartDialog.vue new file mode 100644 index 00000000..368fb58e --- /dev/null +++ b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepa/StartDialog.vue @@ -0,0 +1,111 @@ + + + + diff --git a/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepa/index.vue b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepa/index.vue index 8022d616..ed7e98f1 100644 --- a/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepa/index.vue +++ b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepa/index.vue @@ -73,6 +73,22 @@ /> + + + + +
@@ -89,7 +105,7 @@ > 开始保养 - 保养执行 - + --> - 保养确认 + 保养验收
@@ -132,6 +148,7 @@ + @@ -150,6 +167,7 @@ + @@ -166,11 +184,12 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css' import crudMaterialbase from '@/api/wms/basedata/master/materialbase' import DateRangePicker from '@/components/DateRangePicker' import ExecuteDialog from '@/views/wms/sb/upkeep/devicemaintenancepa/ExecuteDialog' +import StartDialog from '@/views/wms/sb/upkeep/devicemaintenancepa/StartDialog' export default { name: 'Devicemaintenancepa', - dicts: ['EM_DEVICE_BY_INVSTATUS', 'EM_DEVICE_BY_INVTYPE'], - components: { ExecuteDialog, pagination, crudOperation, rrOperation, udOperation, Treeselect, DateRangePicker }, + dicts: ['EM_DEVICE_BY_INVSTATUS', 'EM_DEVICE_BY_INVTYPE', 'EM_DEVICE_MAINT_OBJECT'], + components: { ExecuteDialog, pagination, crudOperation, rrOperation, udOperation, Treeselect, DateRangePicker, StartDialog }, mixins: [presenter(), header(), crud()], cruds() { return CRUD({ @@ -199,6 +218,7 @@ export default { materOpt_code: '23', openParam: null, executeDialog: false, + startDialog: false, permission: { } } @@ -222,6 +242,9 @@ export default { hand(value) { this.crud.toQuery() }, + formatMainObject(row, cloum) { + return this.dict.label.EM_DEVICE_MAINT_OBJECT[row.maint_object] + }, formatInvsName(row, cloum) { return this.dict.label.EM_DEVICE_BY_INVSTATUS[row.invstatus] }, @@ -262,10 +285,8 @@ export default { if (data.invstatus !== '02') { return this.crud.notify('只能对提交状态的单据开始', CRUD.NOTIFICATION_TYPE.INFO) } - crudDevicemaintenancemst.startMaintain(data).then(res => { - this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS) - this.crud.toQuery() - }) + this.openParam = data + this.startDialog = true }, endMaintain() { const _selectData = this.$refs.table.selection @@ -273,10 +294,17 @@ export default { if (data.invstatus !== '03') { return this.crud.notify('只能对开始状态的单据结束', CRUD.NOTIFICATION_TYPE.INFO) } - crudDevicemaintenancemst.endMaintain(data).then(res => { - this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS) - this.crud.toQuery() + crudDevicemaintenancemst.getDtl(data).then(res => { + this.openParam = { + 'form': data, + 'tableData': res + } + this.executeDialog = true }) + // crudDevicemaintenancemst.endMaintain(data).then(res => { + // this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS) + // this.crud.toQuery() + // }) }, executeMaintain() { const _selectData = this.$refs.table.selection @@ -323,7 +351,10 @@ export default { if ('01,02,04,05,99'.includes(rows[i].invstatus)) { this.end_flag = true } - if ('01,02,03,05,99'.includes(rows[i].invstatus)) { + // if ('01,02,03,05,99'.includes(rows[i].invstatus)) { + // this.confirm_flag = true + // } + if (rows[i].maint_object !== '01') { this.confirm_flag = true } if (rows.length > 1) { diff --git a/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepagrid/ExecuteDialog.vue b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepagrid/ExecuteDialog.vue new file mode 100644 index 00000000..104259e3 --- /dev/null +++ b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepagrid/ExecuteDialog.vue @@ -0,0 +1,228 @@ + + + + diff --git a/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepagrid/StartDialog.vue b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepagrid/StartDialog.vue new file mode 100644 index 00000000..368fb58e --- /dev/null +++ b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepagrid/StartDialog.vue @@ -0,0 +1,111 @@ + + + + diff --git a/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepagrid/index.vue b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepagrid/index.vue new file mode 100644 index 00000000..18bf8541 --- /dev/null +++ b/mes/qd/src/views/wms/sb/upkeep/devicemaintenancepagrid/index.vue @@ -0,0 +1,380 @@ + + + + + diff --git a/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/AddDialog.vue b/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/AddDialog.vue index a5d02e88..ed085754 100644 --- a/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/AddDialog.vue +++ b/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/AddDialog.vue @@ -65,7 +65,24 @@ - + + + + + + + + @@ -133,7 +150,7 @@ - + @@ -141,6 +158,8 @@ const defaultForm = { maint_plan_code: null, + material_type_id: null, + maint_object: null, maint_plan_name: null, devicerecord_id: null, maintenancecycle: null, @@ -157,7 +176,7 @@ import CRUD, { form, crud } from '@crud/crud' export default { name: 'AddDialog', - dicts: ['EM_DEVICE_BY_CYCLE'], + dicts: ['EM_DEVICE_BY_CYCLE', 'EM_DEVICE_MAINT_OBJECT'], components: { ItemDialog, DeviceDialog }, mixins: [form(defaultForm), crud()], props: { @@ -193,6 +212,9 @@ export default { ], devicerecord_id: [ { required: true, message: '设备不能为空', trigger: 'blur' } + ], + maint_object: [ + { required: true, message: '保养对象不能为空', trigger: 'blur' } ] } } @@ -228,6 +250,7 @@ export default { this.deviceDialog = true }, putItem() { + this.openParam = this.form this.itemDialog = true }, formatLevel(row, cloum) { @@ -260,7 +283,8 @@ export default { }, tableChanged2(row) { this.form.devicerecord_id = row.devicerecord_id - this.form.device_code = row.device_code + this.form.device_code = row.device_name + '-' + row.device_code + this.form.material_type_id = row.material_type_id }, delRow(index, rows) { rows.splice(index, 1) diff --git a/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/CopyAddDialog.vue b/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/CopyAddDialog.vue index 81e6309e..a8f18ac4 100644 --- a/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/CopyAddDialog.vue +++ b/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/CopyAddDialog.vue @@ -68,7 +68,24 @@ - + + + + + + + + @@ -125,7 +142,7 @@ - + @@ -138,7 +155,7 @@ import CRUD, { crud } from '@crud/crud' export default { name: 'CopyAddDialog', - dicts: ['EM_DEVICE_BY_CYCLE'], + dicts: ['EM_DEVICE_BY_CYCLE', 'EM_DEVICE_MAINT_OBJECT'], components: { ItemDialog, DeviceDialog }, mixins: [crud()], props: { @@ -189,6 +206,7 @@ export default { this.crud.toQuery() }, putDevice() { + this.openParam = this.form1 this.deviceDialog = true }, putItem() { @@ -224,12 +242,14 @@ export default { }, tableChanged2(row) { this.form1.devicerecord_id = row.devicerecord_id - this.form1.device_code = row.device_code + this.form1.device_code = row.device_name + '-' + row.device_code + this.form1.material_type_id = row.material_type_id }, delRow(index, rows) { rows.splice(index, 1) }, submit() { + debugger const data = this.form1 if (data.maint_plan_name === null) { return this.crud.notify('计划名称不能为空', CRUD.NOTIFICATION_TYPE.INFO) @@ -243,6 +263,9 @@ export default { if (data.plan_start_date === null) { return this.crud.notify('计划开始日期不能为空', CRUD.NOTIFICATION_TYPE.INFO) } + if (data.maint_object === '') { + return this.crud.notify('保养对象不能为空', CRUD.NOTIFICATION_TYPE.INFO) + } if (data.tableData.length === 0) { return this.crud.notify('明细不能为空', CRUD.NOTIFICATION_TYPE.INFO) } diff --git a/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/ItemDialog.vue b/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/ItemDialog.vue index 8381192d..3168b45b 100644 --- a/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/ItemDialog.vue +++ b/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/ItemDialog.vue @@ -6,6 +6,7 @@ destroy-on-close width="1000px" @close="close" + @open="open" > { this.class_idStr = res.class_idStr this.crud.query.class_idStr = this.class_idStr - this.crud.toQuery() this.queryClassId() }) }, methods: { + open() { + this.query.material_type_id = this.openParam.material_type_id + this.crud.toQuery() + }, clickChange(item) { this.tableRadio = item }, diff --git a/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/index.vue b/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/index.vue index 7e44c8c6..d7e6a0e6 100644 --- a/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/index.vue +++ b/mes/qd/src/views/wms/sb/upkeep/devicemaintenanceplan/index.vue @@ -73,6 +73,22 @@ /> + + + + + @@ -111,6 +127,7 @@ + @@ -154,7 +171,7 @@ import CopyAddDialog from '@/views/wms/sb/upkeep/devicemaintenanceplan/CopyAddDi export default { name: 'Devicemaintenanceplan', - dicts: ['IS_OR_NOT', 'EM_DEVICE_BY_CYCLE'], + dicts: ['IS_OR_NOT', 'EM_DEVICE_BY_CYCLE', 'EM_DEVICE_MAINT_OBJECT'], components: { AddDialog, pagination, crudOperation, rrOperation, udOperation, Treeselect, DateRangePicker, CopyAddDialog }, mixins: [presenter(), header(), crud()], cruds() { @@ -229,6 +246,9 @@ export default { formatMainName(row, cloum) { return this.dict.label.EM_DEVICE_BY_CYCLE[row.maintenancecycle] }, + formatMainObject(row, cloum) { + return this.dict.label.EM_DEVICE_MAINT_OBJECT[row.maint_object] + }, copyAdd() { const _selectData = this.$refs.table.selection const data = { diff --git a/mes/qd/src/views/wms/statistics/phySicalQuery/index.vue b/mes/qd/src/views/wms/statistics/phySicalQuery/index.vue index 270ecc03..81a9e41d 100644 --- a/mes/qd/src/views/wms/statistics/phySicalQuery/index.vue +++ b/mes/qd/src/views/wms/statistics/phySicalQuery/index.vue @@ -124,7 +124,10 @@ style="width: 100%;" @selection-change="crud.selectionChangeHandler" > - + + + + diff --git a/mes/qd/src/views/wms/statistics/powderOrderQuery/index.vue b/mes/qd/src/views/wms/statistics/powderOrderQuery/index.vue index bd6847ef..be3a2fa9 100644 --- a/mes/qd/src/views/wms/statistics/powderOrderQuery/index.vue +++ b/mes/qd/src/views/wms/statistics/powderOrderQuery/index.vue @@ -75,7 +75,10 @@ style="width: 100%;" @selection-change="crud.selectionChangeHandler" > - + + + + diff --git a/mes/qd/src/views/wms/statistics/powderProductionQuery/index.vue b/mes/qd/src/views/wms/statistics/powderProductionQuery/index.vue index 3416a7d8..68ef8e42 100644 --- a/mes/qd/src/views/wms/statistics/powderProductionQuery/index.vue +++ b/mes/qd/src/views/wms/statistics/powderProductionQuery/index.vue @@ -57,10 +57,10 @@ @selection-change="crud.selectionChangeHandler" > - - - - + + + + diff --git a/mes/qd/src/views/wms/statistics/rawUatWcQuery/index.vue b/mes/qd/src/views/wms/statistics/rawUatWcQuery/index.vue index 9d106147..b1c314d7 100644 --- a/mes/qd/src/views/wms/statistics/rawUatWcQuery/index.vue +++ b/mes/qd/src/views/wms/statistics/rawUatWcQuery/index.vue @@ -96,7 +96,11 @@ style="width: 100%;" @selection-change="crud.selectionChangeHandler" > - + + + + + diff --git a/mes/qd/src/views/wms/statistics/sheetQuery/index.vue b/mes/qd/src/views/wms/statistics/sheetQuery/index.vue new file mode 100644 index 00000000..d325f041 --- /dev/null +++ b/mes/qd/src/views/wms/statistics/sheetQuery/index.vue @@ -0,0 +1,262 @@ + + + + + diff --git a/mes/qd/src/views/wms/statistics/stifleQuery/index.vue b/mes/qd/src/views/wms/statistics/stifleQuery/index.vue index c4ce82fb..716c7193 100644 --- a/mes/qd/src/views/wms/statistics/stifleQuery/index.vue +++ b/mes/qd/src/views/wms/statistics/stifleQuery/index.vue @@ -49,11 +49,11 @@ - - - - - + + + + +