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 443dd5c7..56df23d8 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 @@ -645,6 +645,8 @@ public class AutoformulaServiceImpl implements AutoformulaService { yzj_map.put(tjj_material_id,tjj_map_jo); } }); + JSONObject W_weight = new JSONObject(); + AtomicReference W = new AtomicReference<>(0.0); //判断已含添加剂与需配添加剂大小 yzj_map.forEach((key,tjj_map_now)->{ //需配添加剂重量 @@ -663,7 +665,25 @@ public class AutoformulaServiceImpl implements AutoformulaService { tjj_map_now.put("quality_scode","01"); yzj_list.add(tjj_map_now); } + if(finished_qty>0){ + W.set(W.get() + finished_qty); + } }); + if(W.get() > 0){ + W_weight.put("formula_qty",W.get()); + //钨分类id + W_weight.put("material_id","1503644362234531840"); + W_weight.put("material_name","钨粉"); + W_weight.put("material_code","09030103"); + W_weight.put("material_type","02"); + W_weight.put("is_need_move","0"); + W_weight.put("is_need_manage","1"); + W_weight.put("is_rf_xl","0"); + W_weight.put("ivt_level","01"); + W_weight.put("is_active","1"); + W_weight.put("quality_scode","01"); + cw_list.add(W_weight); + } }else{//大于等于2条库粗你明细时 //最后一个为X22p JSONObject bomdlt_Cr3C2_X22p = bomdlts_Cr3C2.getJSONObject(bomdlts_Cr3C2.size()-1); @@ -751,6 +771,8 @@ public class AutoformulaServiceImpl implements AutoformulaService { }); } + JSONObject W_weight = new JSONObject(); + AtomicReference W = new AtomicReference<>(0.0); //判断已含添加剂与需配添加剂大小 yzj_map.forEach((key,tjj_map_now)->{ //需配添加剂重量 @@ -769,7 +791,25 @@ public class AutoformulaServiceImpl implements AutoformulaService { tjj_map_now.put("quality_scode","01"); yzj_list.add(tjj_map_now); } + if(finished_qty>0){ + W.set(W.get() + finished_qty); + } }); + if(W.get() > 0){ + W_weight.put("formula_qty",W.get()); + //钨分类id + W_weight.put("material_id","1503644362234531840"); + W_weight.put("material_name","钨粉"); + W_weight.put("material_code","09030103"); + W_weight.put("material_type","02"); + W_weight.put("is_need_move","0"); + W_weight.put("is_need_manage","1"); + W_weight.put("is_rf_xl","0"); + W_weight.put("ivt_level","01"); + W_weight.put("is_active","1"); + W_weight.put("quality_scode","01"); + cw_list.add(W_weight); + } } } @@ -843,6 +883,8 @@ public class AutoformulaServiceImpl implements AutoformulaService { } }); } + JSONObject W_weight = new JSONObject(); + AtomicReference W = new AtomicReference<>(0.0); //判断已含添加剂与需配添加剂大小 yzj_map.forEach((key,tjj_map_now)->{ //需配添加剂重量 @@ -861,7 +903,25 @@ public class AutoformulaServiceImpl implements AutoformulaService { tjj_map_now.put("quality_scode","01"); yzj_list.add(tjj_map_now); } + if(finished_qty>0){ + W.set(W.get() + finished_qty); + } }); + if(W.get() > 0){ + W_weight.put("formula_qty",W.get()); + //钨分类id + W_weight.put("material_id","1503644362234531840"); + W_weight.put("material_name","钨粉"); + W_weight.put("material_code","09030103"); + W_weight.put("material_type","02"); + W_weight.put("is_need_move","0"); + W_weight.put("is_need_manage","1"); + W_weight.put("is_rf_xl","0"); + W_weight.put("ivt_level","01"); + W_weight.put("is_active","1"); + W_weight.put("quality_scode","01"); + cw_list.add(W_weight); + } } } } @@ -1537,6 +1597,8 @@ public class AutoformulaServiceImpl implements AutoformulaService { tjj_map.put(tjj_material_id,tjj_map_jo); } }); + JSONObject W_weight = new JSONObject(); + AtomicReference W = new AtomicReference<>(0.0); //判断已含添加剂与需配添加剂大小 tjj_map.forEach((key,tjj_map_now)->{ //需配添加剂重量 @@ -1554,8 +1616,26 @@ public class AutoformulaServiceImpl implements AutoformulaService { tjj_map_now.put("is_active","1"); tjj_map_now.put("quality_scode","01"); yzj_list.add(tjj_map_now); + if(finished_qty>0){ + W.set(W.get() + finished_qty); + } } }); + if(W.get() > 0){ + W_weight.put("formula_qty",W.get()); + //钨分类id + W_weight.put("material_id","1503644362234531840"); + W_weight.put("material_name","钨粉"); + W_weight.put("material_code","09030103"); + W_weight.put("material_type","02"); + W_weight.put("is_need_move","0"); + W_weight.put("is_need_manage","1"); + W_weight.put("is_rf_xl","0"); + W_weight.put("ivt_level","01"); + W_weight.put("is_active","1"); + W_weight.put("quality_scode","01"); + cw_list.add(W_weight); + } }else{//大于等于2条库粗你明细时 //最后一个为X22p JSONObject bomdlt_Cr3C2_X22p = bomdlts_Cr3C2.getJSONObject(bomdlts_Cr3C2.size()-1); @@ -1641,6 +1721,8 @@ public class AutoformulaServiceImpl implements AutoformulaService { } }); } + JSONObject W_weight = new JSONObject(); + AtomicReference W = new AtomicReference<>(0.0); //判断已含添加剂与需配添加剂大小 tjj_map.forEach((key,tjj_map_now)->{ //需配添加剂重量 @@ -1659,7 +1741,25 @@ public class AutoformulaServiceImpl implements AutoformulaService { tjj_map_now.put("quality_scode","01"); yzj_list.add(tjj_map_now); } + if(finished_qty>0){ + W.set(W.get() + finished_qty); + } }); + if(W.get() > 0){ + W_weight.put("formula_qty",W.get()); + //钨分类id + W_weight.put("material_id","1503644362234531840"); + W_weight.put("material_name","钨粉"); + W_weight.put("material_code","09030103"); + W_weight.put("material_type","02"); + W_weight.put("is_need_move","0"); + W_weight.put("is_need_manage","1"); + W_weight.put("is_rf_xl","0"); + W_weight.put("ivt_level","01"); + W_weight.put("is_active","1"); + W_weight.put("quality_scode","01"); + cw_list.add(W_weight); + } } } } @@ -1729,6 +1829,8 @@ public class AutoformulaServiceImpl implements AutoformulaService { } }); } + JSONObject W_weight = new JSONObject(); + AtomicReference W = new AtomicReference<>(0.0); //判断已含添加剂与需配添加剂大小 tjj_map.forEach((key,tjj_map_now)->{ //需配添加剂重量 @@ -1747,7 +1849,25 @@ public class AutoformulaServiceImpl implements AutoformulaService { tjj_map_now.put("quality_scode","01"); yzj_list.add(tjj_map_now); } + if(finished_qty>0){ + W.set(W.get() + finished_qty); + } }); + if(W.get() > 0){ + W_weight.put("formula_qty",W.get()); + //钨分类id + W_weight.put("material_id","1503644362234531840"); + W_weight.put("material_name","钨粉"); + W_weight.put("material_code","09030103"); + W_weight.put("material_type","02"); + W_weight.put("is_need_move","0"); + W_weight.put("is_need_manage","1"); + W_weight.put("is_rf_xl","0"); + W_weight.put("ivt_level","01"); + W_weight.put("is_active","1"); + W_weight.put("quality_scode","01"); + cw_list.add(W_weight); + } } } } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/auToTask/AutoCreateRepair.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/auToTask/AutoCreateRepair.java index f80daa1c..be2f752b 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/auToTask/AutoCreateRepair.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/auToTask/AutoCreateRepair.java @@ -37,90 +37,93 @@ public class AutoCreateRepair { JSONObject json = fileArr.getJSONObject(i); String devicerecord_id = json.getString("devicerecord_id"); - JSONObject jsonPlanMst = planMstTab.query("devicerecord_id = '" + devicerecord_id + "' and is_active = '1'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(jsonPlanMst)) { - // 2.1 判断维修计划表中:实际开始时间、实际结束时间 为空 - String real_start_date = jsonPlanMst.getString("real_start_date"); - String real_end_date = jsonPlanMst.getString("real_end_date"); + JSONArray jsonPlanMstArr = planMstTab.query("devicerecord_id = '" + devicerecord_id + "' and is_active = '1'").getResultJSONArray(0); + if (ObjectUtil.isNotEmpty(jsonPlanMstArr)) { + for (int j = 0; j < jsonPlanMstArr.size(); j++) { + JSONObject jsonPlanMst = jsonPlanMstArr.getJSONObject(j); + // 2.1 判断维修计划表中:实际开始时间、实际结束时间 为空 + String real_start_date = jsonPlanMst.getString("real_start_date"); + String real_end_date = jsonPlanMst.getString("real_end_date"); - // 2.2 根据源单号为维修计划id查询 维修单 --条件未删除、未审核 - JSONObject jsonRepairMst = repairMstTab.query("source_bill_id = '" + jsonPlanMst.getString("repair_plan_id") + "' and is_delete = '0' and invstatus != '99'").uniqueResult(0); - if (ObjectUtil.isEmpty(real_start_date) && ObjectUtil.isEmpty(real_end_date)) { - if (ObjectUtil.isEmpty(jsonRepairMst)) { - // 2.3 判断周期 - String maintenancecycle = jsonPlanMst.getString("maintenancecycle"); - String plan_start_date = jsonPlanMst.getString("plan_start_date").replace("-", ""); - String today = DateUtil.today().replace("-", ""); - // 准备参数 - JSONObject param = new JSONObject(); - param.put("devicerecord_id",jsonPlanMst.getString("devicerecord_id")); - param.put("maintenancecycle","01"); - param.put("plan_start_date",jsonPlanMst.getString("plan_start_date")); - param.put("source_bill_id",jsonPlanMst.getString("repair_plan_id")); - param.put("source_bill_code",jsonPlanMst.getString("repair_plan_code")); + // 2.2 根据源单号为维修计划id查询 维修单 --条件未删除、未审核 + JSONObject jsonRepairMst = repairMstTab.query("source_bill_id = '" + jsonPlanMst.getString("repair_plan_id") + "' and is_delete = '0' and invstatus != '99'").uniqueResult(0); + if (ObjectUtil.isEmpty(real_start_date) && ObjectUtil.isEmpty(real_end_date)) { + if (ObjectUtil.isEmpty(jsonRepairMst)) { + // 2.3 判断周期 + String maintenancecycle = jsonPlanMst.getString("maintenancecycle"); + String plan_start_date = jsonPlanMst.getString("plan_start_date").replace("-", ""); + String today = DateUtil.today().replace("-", ""); + // 准备参数 + JSONObject param = new JSONObject(); + param.put("devicerecord_id",jsonPlanMst.getString("devicerecord_id")); + param.put("maintenancecycle","01"); + param.put("plan_start_date",jsonPlanMst.getString("plan_start_date")); + param.put("source_bill_id",jsonPlanMst.getString("repair_plan_id")); + param.put("source_bill_code",jsonPlanMst.getString("repair_plan_code")); - // 计算 当前日期 - 维修计划日期 后的天数 - String num = String.valueOf(NumberUtil.sub(today, plan_start_date)); + // 计算 当前日期 - 维修计划日期 后的天数 + String num = String.valueOf(NumberUtil.sub(today, plan_start_date)); - // 周期为年 :当前日期-维修计划开始时间 <= 15 天时,新增维修单 - if (StrUtil.equals(maintenancecycle,"01")) { - if (Integer.parseInt(num) <= 15) { - this.createRepair(param); - } - // 周期为季度 :当前日期-维修计划开始时间 <= 10 天时,新增维修单 - } else if (StrUtil.equals(maintenancecycle,"02")) { - if (Integer.parseInt(num) <= 10) { - this.createRepair(param); - } - // 周期为月 :当前日期-维修计划开始时间 <= 7 天时,新增维修单 - } else if (StrUtil.equals(maintenancecycle,"03")) { - if (Integer.parseInt(num) <= 7) { - this.createRepair(param); - } - // 周期为周 :当前日期-维修计划开始时间 <= 3 天时,新增维修单 - } else if (StrUtil.equals(maintenancecycle,"04")) { - if (Integer.parseInt(num) <= 3) { - this.createRepair(param); + // 周期为年 :当前日期-维修计划开始时间 <= 15 天时,新增维修单 + if (StrUtil.equals(maintenancecycle,"01")) { + if (Integer.parseInt(num) <= 15) { + this.createRepair(param); + } + // 周期为季度 :当前日期-维修计划开始时间 <= 10 天时,新增维修单 + } else if (StrUtil.equals(maintenancecycle,"02")) { + if (Integer.parseInt(num) <= 10) { + this.createRepair(param); + } + // 周期为月 :当前日期-维修计划开始时间 <= 7 天时,新增维修单 + } else if (StrUtil.equals(maintenancecycle,"03")) { + if (Integer.parseInt(num) <= 7) { + this.createRepair(param); + } + // 周期为周 :当前日期-维修计划开始时间 <= 3 天时,新增维修单 + } else if (StrUtil.equals(maintenancecycle,"04")) { + if (Integer.parseInt(num) <= 3) { + this.createRepair(param); + } } } - } - } else { - // 3 如果保养实际开始时间 和 保养实际结束时间不为空 并且查不到对应单据 - if (ObjectUtil.isEmpty(jsonRepairMst)) { - // 取维修实际结束日期:用当前日期 - 维修实际结束日期 - String maintenancecycle = jsonPlanMst.getString("maintenancecycle"); - String rep_real_end_date = jsonPlanMst.getString("real_end_date").replace("-", ""); - String today = DateUtil.today().replace("-", ""); + } else { + // 3 如果保养实际开始时间 和 保养实际结束时间不为空 并且查不到对应单据 + if (ObjectUtil.isEmpty(jsonRepairMst)) { + // 取维修实际结束日期:用当前日期 - 维修实际结束日期 + String maintenancecycle = jsonPlanMst.getString("maintenancecycle"); + String rep_real_end_date = jsonPlanMst.getString("real_end_date").replace("-", ""); + String today = DateUtil.today().replace("-", ""); - // 准备参数 - JSONObject param = new JSONObject(); - param.put("devicerecord_id",jsonPlanMst.getString("devicerecord_id")); - param.put("maintenancecycle","01"); - param.put("plan_start_date",jsonPlanMst.getString("plan_start_date")); - param.put("source_bill_id",jsonPlanMst.getString("repair_plan_id")); - param.put("source_bill_code",jsonPlanMst.getString("repair_plan_code")); - // 计算 当前日期 - 维修实际结束 后的天数 - String num = String.valueOf(NumberUtil.sub(today, rep_real_end_date)); + // 准备参数 + JSONObject param = new JSONObject(); + param.put("devicerecord_id",jsonPlanMst.getString("devicerecord_id")); + param.put("maintenancecycle","01"); + param.put("plan_start_date",jsonPlanMst.getString("plan_start_date")); + param.put("source_bill_id",jsonPlanMst.getString("repair_plan_id")); + param.put("source_bill_code",jsonPlanMst.getString("repair_plan_code")); + // 计算 当前日期 - 维修实际结束 后的天数 + String num = String.valueOf(NumberUtil.sub(today, rep_real_end_date)); - // 周期为年 :当前日期-维修实际结束 <= 15 天时,新增维修单 - if (StrUtil.equals(maintenancecycle,"01")) { - if (Integer.parseInt(num) <= 15) { - this.createRepair(param); - } - // 周期为季度 :当前日期-维修实际结束 <= 10 天时,新增维修单 - } else if (StrUtil.equals(maintenancecycle,"02")) { - if (Integer.parseInt(num) <= 10) { - this.createRepair(param); - } - // 周期为月 :当前日期-维修实际结束 <= 7 天时,新增维修单 - } else if (StrUtil.equals(maintenancecycle,"03")) { - if (Integer.parseInt(num) <= 7) { - this.createRepair(param); - } - // 周期为周 :当前日期-维修实际结束 <= 3 天时,新增维修单 - } else if (StrUtil.equals(maintenancecycle,"04")) { - if (Integer.parseInt(num) <= 3) { - this.createRepair(param); + // 周期为年 :当前日期-维修实际结束 <= 15 天时,新增维修单 + if (StrUtil.equals(maintenancecycle,"01")) { + if (Integer.parseInt(num) <= 15) { + this.createRepair(param); + } + // 周期为季度 :当前日期-维修实际结束 <= 10 天时,新增维修单 + } else if (StrUtil.equals(maintenancecycle,"02")) { + if (Integer.parseInt(num) <= 10) { + this.createRepair(param); + } + // 周期为月 :当前日期-维修实际结束 <= 7 天时,新增维修单 + } else if (StrUtil.equals(maintenancecycle,"03")) { + if (Integer.parseInt(num) <= 7) { + this.createRepair(param); + } + // 周期为周 :当前日期-维修实际结束 <= 3 天时,新增维修单 + } else if (StrUtil.equals(maintenancecycle,"04")) { + if (Integer.parseInt(num) <= 3) { + this.createRepair(param); + } } } } 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 202c744b..54bd4a54 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 @@ -37,80 +37,83 @@ public class AutoCreateUpkeep { JSONObject json = fileArr.getJSONObject(i); String devicerecord_id = json.getString("devicerecord_id"); - JSONObject jsonPlanMst = planMstTab.query("devicerecord_id = '" + devicerecord_id + "' and is_active = '1'").uniqueResult(0); - if (ObjectUtil.isNotEmpty(jsonPlanMst)) { - // 2.1 判断保养计划表中:实际开始时间、实际结束时间 为空 - String real_start_date = jsonPlanMst.getString("real_start_date"); - String real_end_date = jsonPlanMst.getString("real_end_date"); + JSONArray jsonPlanMstArr = planMstTab.query("devicerecord_id = '" + devicerecord_id + "' and is_active = '1'").getResultJSONArray(0); + if (ObjectUtil.isNotEmpty(jsonPlanMstArr)) { + for (int j = 0; j < jsonPlanMstArr.size(); j++) { + JSONObject jsonPlanMst = jsonPlanMstArr.getJSONObject(j); + // 2.1 判断保养计划表中:实际开始时间、实际结束时间 为空 + String real_start_date = jsonPlanMst.getString("real_start_date"); + String real_end_date = jsonPlanMst.getString("real_end_date"); - // 2.2 根据源单号为保养计划id查询 保养单 --条件未删除、未审核 - JSONObject jsonMainMst = mainMstTab.query("source_bill_id = '" + jsonPlanMst.getString("maint_plan_id") + "' and is_delete = '0' and invstatus != '99'").uniqueResult(0); - if (ObjectUtil.isEmpty(real_start_date) && ObjectUtil.isEmpty(real_end_date)) { - if (ObjectUtil.isEmpty(jsonMainMst)) { - // 2.3 判断周期 - String maintenancecycle = jsonPlanMst.getString("maintenancecycle"); - String plan_start_date = jsonPlanMst.getString("plan_start_date").replace("-", ""); - String today = DateUtil.today().replace("-", ""); - // 准备参数 - JSONObject param = new JSONObject(); - param.put("devicerecord_id",jsonPlanMst.getString("devicerecord_id")); - param.put("maintenancecycle","01"); - 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")); + // 2.2 根据源单号为保养计划id查询 保养单 --条件未删除、未审核 + JSONObject jsonMainMst = mainMstTab.query("source_bill_id = '" + jsonPlanMst.getString("maint_plan_id") + "' and is_delete = '0' and invstatus != '99'").uniqueResult(0); + if (ObjectUtil.isEmpty(real_start_date) && ObjectUtil.isEmpty(real_end_date)) { + if (ObjectUtil.isEmpty(jsonMainMst)) { + // 2.3 判断周期 + String maintenancecycle = jsonPlanMst.getString("maintenancecycle"); + String plan_start_date = jsonPlanMst.getString("plan_start_date").replace("-", ""); + String today = DateUtil.today().replace("-", ""); + // 准备参数 + JSONObject param = new JSONObject(); + param.put("devicerecord_id",jsonPlanMst.getString("devicerecord_id")); + param.put("maintenancecycle","01"); + 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")); - // 计算 当前日期 - 保养计划日期 后的天数 - String num = String.valueOf(NumberUtil.sub(today, plan_start_date)); + // 计算 当前日期 - 保养计划日期 后的天数 + String num = String.valueOf(NumberUtil.sub(today, plan_start_date)); - // 周期为年 :当前日期-保养计划日期 <= 15 天时,新增保养单 - if (StrUtil.equals(maintenancecycle,"01")) { - if (Integer.parseInt(num) <= 15) { - this.createMain(param); - } - // 周期为月 :当前日期-保养计划日期 <= 7 天时,新增保养单 - } else if (StrUtil.equals(maintenancecycle,"02")) { - if (Integer.parseInt(num) <= 7) { - this.createMain(param); - } - // 周期为周 :当前日期-保养计划日期 <= 3 天时,新增保养单 - } else if (StrUtil.equals(maintenancecycle,"03")) { - if (Integer.parseInt(num) <= 3) { - this.createMain(param); + // 周期为年 :当前日期-保养计划日期 <= 15 天时,新增保养单 + if (StrUtil.equals(maintenancecycle,"01")) { + if (Integer.parseInt(num) <= 15) { + this.createMain(param); + } + // 周期为月 :当前日期-保养计划日期 <= 7 天时,新增保养单 + } else if (StrUtil.equals(maintenancecycle,"02")) { + if (Integer.parseInt(num) <= 7) { + this.createMain(param); + } + // 周期为周 :当前日期-保养计划日期 <= 3 天时,新增保养单 + } else if (StrUtil.equals(maintenancecycle,"03")) { + if (Integer.parseInt(num) <= 3) { + this.createMain(param); + } } } - } - } else { - // 3 如果保养实际开始时间 和 保养实际结束时间不为空 并且查不到对应单据 - if (ObjectUtil.isEmpty(jsonMainMst)) { - // 取保养实际结束日期:用当前日期 - 保养实际结束日期 - String maintenancecycle = jsonPlanMst.getString("maintenancecycle"); - String rep_real_end_date = jsonPlanMst.getString("real_end_date").replace("-", ""); - String today = DateUtil.today().replace("-", ""); + } else { + // 3 如果保养实际开始时间 和 保养实际结束时间不为空 并且查不到对应单据 + if (ObjectUtil.isEmpty(jsonMainMst)) { + // 取保养实际结束日期:用当前日期 - 保养实际结束日期 + String maintenancecycle = jsonPlanMst.getString("maintenancecycle"); + String rep_real_end_date = jsonPlanMst.getString("real_end_date").replace("-", ""); + String today = DateUtil.today().replace("-", ""); - // 准备参数 - JSONObject param = new JSONObject(); - param.put("devicerecord_id",jsonPlanMst.getString("devicerecord_id")); - param.put("maintenancecycle","01"); - 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")); - // 计算 当前日期 - 保养实际结束 后的天数 - String num = String.valueOf(NumberUtil.sub(today, rep_real_end_date)); + // 准备参数 + JSONObject param = new JSONObject(); + param.put("devicerecord_id",jsonPlanMst.getString("devicerecord_id")); + param.put("maintenancecycle","01"); + 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")); + // 计算 当前日期 - 保养实际结束 后的天数 + String num = String.valueOf(NumberUtil.sub(today, rep_real_end_date)); - // 周期为年 :当前日期-保养实际结束 <= 15 天时,新增保养单 - if (StrUtil.equals(maintenancecycle,"01")) { - if (Integer.parseInt(num) <= 15) { - this.createMain(param); - } - // 周期为月 :当前日期-保养实际结束 <= 7 天时,新增保养单 - } else if (StrUtil.equals(maintenancecycle,"02")) { - if (Integer.parseInt(num) <= 7) { - this.createMain(param); - } - // 周期为周 :当前日期-保养实际结束 <= 3 天时,新增保养单 - } else if (StrUtil.equals(maintenancecycle,"03")) { - if (Integer.parseInt(num) <= 3) { - this.createMain(param); + // 周期为年 :当前日期-保养实际结束 <= 15 天时,新增保养单 + if (StrUtil.equals(maintenancecycle,"01")) { + if (Integer.parseInt(num) <= 15) { + this.createMain(param); + } + // 周期为月 :当前日期-保养实际结束 <= 7 天时,新增保养单 + } else if (StrUtil.equals(maintenancecycle,"02")) { + if (Integer.parseInt(num) <= 7) { + this.createMain(param); + } + // 周期为周 :当前日期-保养实际结束 <= 3 天时,新增保养单 + } else if (StrUtil.equals(maintenancecycle,"03")) { + if (Integer.parseInt(num) <= 3) { + this.createMain(param); + } } } } 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 d5915721..94ee59a6 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 @@ -724,9 +724,11 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService { @Override public Map queryBom(Map whereJson, Pageable page) { String material_code = MapUtil.getStr(whereJson, "material_code"); + String material_id = MapUtil.getStr(whereJson, "material_id"); HashMap map = new HashMap<>(); map.put("flag", "5"); if (ObjectUtil.isNotEmpty(material_code)) map.put("material_code", "%"+material_code+"%"); + if (ObjectUtil.isNotEmpty(material_id)) map.put("material_id", material_id); JSONObject jsonObject = WQL.getWO("EM_BI_DEVICEREPAIR001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.sparepart_only_id ASC"); 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 fe5fa6a7..04c1f3ea 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 @@ -117,6 +117,10 @@ public class DevicerepairplanmstServiceImpl implements DevicerepairplanmstServic WQLObject mstTab = WQLObject.getWQLObject("EM_BI_DeviceRepairPlanMst"); WQLObject dtlTab = WQLObject.getWQLObject("EM_BI_DeviceRepairPlanDtl"); + // 校验 : 是否有相同设备 相同周期 + JSONObject jsonObject = mstTab.query("devicerecord_id = '" + whereJson.getString("devicerecord_id") + "' and maintenancecycle = '" + whereJson.getString("maintenancecycle") + "' and is_delete = '0'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(jsonObject)) throw new BadRequestException("此设备已经存在此周期的计划"); + // 插入主表 JSONObject jsonMst = new JSONObject(); jsonMst.put("repair_plan_id", IdUtil.getSnowflake(1,1).nextId()); @@ -239,6 +243,10 @@ public class DevicerepairplanmstServiceImpl implements DevicerepairplanmstServic WQLObject mstTab = WQLObject.getWQLObject("EM_BI_DeviceRepairPlanMst"); WQLObject dtlTab = WQLObject.getWQLObject("EM_BI_DeviceRepairPlanDtl"); + // 校验 : 是否有相同设备 相同周期 + JSONObject jsonObject = mstTab.query("devicerecord_id = '" + whereJson.getString("devicerecord_id") + "' and maintenancecycle = '" + whereJson.getString("maintenancecycle") + "' and is_delete = '0'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(jsonObject)) throw new BadRequestException("此设备已经存在此周期的计划"); + // 插入主表 JSONObject jsonMst = new JSONObject(); jsonMst.put("repair_plan_id", IdUtil.getSnowflake(1,1).nextId()); 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 f4818cb9..28632cac 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 @@ -186,6 +186,10 @@ mater.material_name like 输入.material_code) ENDOPTION + OPTION 输入.material_id <> "" + mater.material_id = 输入.material_id + ENDOPTION + group by mst.material_id,mst.pcsn,mst.sparepart_only_id ENDSELECT 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 45b1ee49..26394a08 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 @@ -117,6 +117,10 @@ public class DevicemaintenanceplanmstServiceImpl implements Devicemaintenancepla WQLObject mstTab = WQLObject.getWQLObject("EM_BI_DeviceMaintenancePlanMst"); WQLObject dtlTab = WQLObject.getWQLObject("EM_BI_DeviceMaintenancePlanDtl"); + // 校验:相同的设备、周期只能存在一个 + JSONObject jsonObject = mstTab.query("devicerecord_id = '" + whereJson.getString("devicerecord_id") + "' and maintenancecycle = '" + whereJson.getString("maintenancecycle") + "' and is_delete = '0'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(jsonObject)) throw new BadRequestException("此计划的周期只能存在一个"); + // 插入主表 JSONObject jsonMst = new JSONObject(); jsonMst.put("maint_plan_id", IdUtil.getSnowflake(1,1).nextId()); @@ -263,6 +267,10 @@ public class DevicemaintenanceplanmstServiceImpl implements Devicemaintenancepla WQLObject mstTab = WQLObject.getWQLObject("EM_BI_DeviceMaintenancePlanMst"); WQLObject dtlTab = WQLObject.getWQLObject("EM_BI_DeviceMaintenancePlanDtl"); + // 校验:相同的设备、周期只能存在一个 + JSONObject jsonObject = mstTab.query("devicerecord_id = '" + whereJson.getString("devicerecord_id") + "' and maintenancecycle = '" + whereJson.getString("maintenancecycle") + "' and is_delete = '0'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(jsonObject)) throw new BadRequestException("此计划的周期只能存在一个"); + // 插入主表 JSONObject jsonMst = new JSONObject(); jsonMst.put("maint_plan_id", IdUtil.getSnowflake(1,1).nextId()); diff --git a/mes/qd/src/views/wms/basedata/em/devicebom/AddDialog.vue b/mes/qd/src/views/wms/basedata/em/devicebom/AddDialog.vue index 8b339fc6..3d3bd29a 100644 --- a/mes/qd/src/views/wms/basedata/em/devicebom/AddDialog.vue +++ b/mes/qd/src/views/wms/basedata/em/devicebom/AddDialog.vue @@ -28,19 +28,20 @@ :load-options="loadClass" style="width: 200px;" placeholder="请选择" + :disabled="crud.status.view > 0" /> - + - + @@ -65,6 +66,7 @@ type="primary" icon="el-icon-check" size="mini" + :disabled="crud.status.view > 0" @click="putMaterial" > 添加物料 @@ -106,20 +108,20 @@ :controls="false" :precision="0" :min="0" - :disabled="scope.row.edit" + :disabled="crud.status.view > 0" /> @@ -163,7 +165,6 @@ export default { watch: { dialogShow: { handler(newValue, oldValue) { - debugger this.dialogVisible = newValue } } @@ -194,8 +195,8 @@ 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.crud.query.class_idStr = this.class_idStr + // this.crud.toQuery() this.queryClassId() }) }, @@ -214,7 +215,6 @@ export default { } }, [CRUD.HOOK.afterToEdit]() { - debugger const data = { 'device_bom_id': this.form.device_bom_id } @@ -222,6 +222,40 @@ export default { this.form.tableData = res }) }, + [CRUD.HOOK.afterToView]() { + const data = { + 'device_bom_id': this.form.device_bom_id + } + crudDevicebom.getDtl(data).then(res => { + this.form.tableData = res + }) + }, + [CRUD.HOOK.afterToCU](crud, form) { + debugger + if (!form.device_bom_code) { + this.queryClassId() + } else { + this.getSubTypes(form.material_type_id) + } + }, + getSubTypes(id) { + crudClassstandard.getClassSuperior(id).then(res => { + debugger + const date = res.content + this.buildClass(date) + this.classes = date + }) + }, + buildClass(classes) { + classes.forEach(data => { + if (data.children) { + this.buildClass(data.children) + } + if (data.hasChildren && !data.children) { + data.children = null + } + }) + }, handleClose(done) { this.$confirm('确认关闭?') .then(_ => { diff --git a/mes/qd/src/views/wms/basedata/em/devicebom/index.vue b/mes/qd/src/views/wms/basedata/em/devicebom/index.vue index 85f5022a..c4119950 100644 --- a/mes/qd/src/views/wms/basedata/em/devicebom/index.vue +++ b/mes/qd/src/views/wms/basedata/em/devicebom/index.vue @@ -67,7 +67,11 @@ - + + + diff --git a/mes/qd/src/views/wms/pf/formula/DivDialog.vue b/mes/qd/src/views/wms/pf/formula/DivDialog.vue index caecd41a..45379e50 100644 --- a/mes/qd/src/views/wms/pf/formula/DivDialog.vue +++ b/mes/qd/src/views/wms/pf/formula/DivDialog.vue @@ -286,6 +286,7 @@ + diff --git a/mes/qd/src/views/wms/sb/repair/devicerepairpa/AddChangeDialog.vue b/mes/qd/src/views/wms/sb/repair/devicerepairpa/AddChangeDialog.vue index 31c20bea..44b81e72 100644 --- a/mes/qd/src/views/wms/sb/repair/devicerepairpa/AddChangeDialog.vue +++ b/mes/qd/src/views/wms/sb/repair/devicerepairpa/AddChangeDialog.vue @@ -107,7 +107,7 @@ - + @@ -137,6 +137,7 @@ export default { fileBom: [], fileBomJson: null, fileBomindex: null, + openBom: null, bomShow: false, dialogVisible: false } @@ -192,6 +193,7 @@ export default { this.bomShow = true this.nowindex = index this.nowrow = row + this.openBom = row }, tableChanged2(row) { debugger diff --git a/mes/qd/src/views/wms/sb/repair/devicerepairpa/BomDialog.vue b/mes/qd/src/views/wms/sb/repair/devicerepairpa/BomDialog.vue index 73b37d09..18d6fd55 100644 --- a/mes/qd/src/views/wms/sb/repair/devicerepairpa/BomDialog.vue +++ b/mes/qd/src/views/wms/sb/repair/devicerepairpa/BomDialog.vue @@ -6,6 +6,7 @@ destroy-on-close width="1000px" @close="close" + @open="open" > - +