diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/rest/EquipmentfileController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/rest/EquipmentfileController.java index 4f7adc66..8dc6670b 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/rest/EquipmentfileController.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/rest/EquipmentfileController.java @@ -22,6 +22,8 @@ import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.Map; @RestController @@ -39,6 +41,12 @@ public class EquipmentfileController { public ResponseEntity query(@RequestParam Map whereJson, Pageable page){ return new ResponseEntity<>(equipmentfileService.queryAll(whereJson,page),HttpStatus.OK); } + @Log("导出月计划模板") + @ApiOperation("导出月计划模板") + @GetMapping(value = "/download") + public void download(HttpServletResponse response, @RequestParam Map whereJson) throws IOException { + equipmentfileService.download(equipmentfileService.query(whereJson), response); + } @PostMapping @Log("新增工令") diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/service/EquipmentfileService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/service/EquipmentfileService.java index 56a1568e..037dc398 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/service/EquipmentfileService.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/service/EquipmentfileService.java @@ -3,8 +3,12 @@ package org.nl.wms.basedata.em.service; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; +import org.nl.wms.pcs.service.dto.ProductplanprocDto; import org.springframework.data.domain.Pageable; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.util.List; import java.util.Map; @@ -18,6 +22,21 @@ public interface EquipmentfileService { */ Map queryAll(Map whereJson, Pageable page); + /** + * 查询数据分页 + * @param whereJson 条件 + * @return Map + */ + JSONArray query(Map whereJson); + /** + * 导出数据 + * + * @param ja 待导出的数据 + * @param response / + * @throws IOException / + */ + void download(JSONArray ja, HttpServletResponse response) throws IOException; + /** * 创建 * @param json / diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/service/impl/EquipmentfileServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/service/impl/EquipmentfileServiceImpl.java index a6de8e70..2947a785 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/service/impl/EquipmentfileServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/service/impl/EquipmentfileServiceImpl.java @@ -3,6 +3,7 @@ package org.nl.wms.basedata.em.service.impl; import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.ObjectUtil; @@ -16,11 +17,13 @@ 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.util.CodeUtil; +import org.nl.utils.FileUtil; import org.nl.utils.SecurityUtils; import org.nl.utils.SpringContextHolder; import org.nl.wms.basedata.em.service.EquipmentfileService; import org.nl.wms.basedata.master.constant.MaterOptTypeEnum; import org.nl.wms.basedata.master.service.ClassstandardService; +import org.nl.wms.pcs.service.dto.ProductplanprocDto; import org.nl.wms.pdm.service.WorkOrdereService; import org.nl.wql.WQL; import org.nl.wql.core.bean.WQLObject; @@ -29,6 +32,8 @@ import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; import java.util.*; @Service @@ -71,6 +76,41 @@ public class EquipmentfileServiceImpl implements EquipmentfileService { JSONObject json = WQL.getWO("QEM_EQUIPMENTFILE01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "equipmentfile.devicerecord_code"); return json; } + + @Override + public JSONArray query(Map whereJson) { + HashMap map = new HashMap<>(whereJson); + DeptService deptService = SpringContextHolder.getBean(DeptService.class); + map.put("flag", "11"); + String device_code = map.get("device_code"); + if (StrUtil.isNotEmpty(device_code)) { + map.put("device_code", "%" + device_code + "%"); + } + String manufacturer = map.get("manufacturer"); + if (StrUtil.isNotEmpty(manufacturer)) { + map.put("manufacturer", "%" + manufacturer + "%"); + } + String material_type_id = map.get("material_type_id"); + if (!StrUtil.isEmpty(material_type_id)) { + String classIds = classstandardService.getChildIdStr(material_type_id); + map.put("classIds", classIds); + } + String use_deptid = map.get("use_deptid"); + if (!StrUtil.isEmpty(use_deptid)) { + String deptIds = deptService.getChildIdStr(Long.parseLong(use_deptid)); + map.put("deptIds", deptIds); + } + String begin_time = map.get("begin_time"); + if (StrUtil.isNotEmpty(begin_time)) { + map.put("begin_time", begin_time.substring(0,10)); + } + String end_time = map.get("end_time"); + if (StrUtil.isNotEmpty(end_time)) { + map.put("end_time", end_time.substring(0,10)); + } + JSONArray json = WQL.getWO("QEM_EQUIPMENTFILE01").addParamMap(map).process().getResultJSONArray(0); + return json; + } @Override @Transactional(rollbackFor = Exception.class) public void create(JSONObject json) { @@ -283,4 +323,73 @@ public class EquipmentfileServiceImpl implements EquipmentfileService { JSONArray ja = EM_BI_DeviceBOM.query("is_delete='0' and is_used='1' and material_type_id='"+material_type_id+"'").getResultJSONArray(0); return ja; } + + + + @Override + @Transactional(rollbackFor = Exception.class) + public void download(JSONArray ja, HttpServletResponse response) throws IOException { + List> list = new ArrayList<>(); + WQLObject pdm_bi_workprocedure = WQLObject.getWQLObject("pdm_bi_workprocedure"); + for (int i = 0; i < ja.size(); i++) { + JSONObject jo = ja.getJSONObject(i); + Map dtl_map = new LinkedHashMap<>(); + dtl_map.put("设备代码", jo.getString("device_code")); + dtl_map.put("设备名称", jo.getString("device_name")); + dtl_map.put("内部自编号", jo.getString("extend_code")); + dtl_map.put("设备型号", jo.getString("device_model")); + dtl_map.put("设备规格", jo.getString("material_type_name")); + if(jo.getString("is_produceuse").equals("1")){ + dtl_map.put("生产用途", "生产"); + }else{ + dtl_map.put("生产用途", "非生产"); + } + String status = jo.getString("status"); + if(status.equals("00")){ + dtl_map.put("设备状态", "生成"); + }else if(status.equals("10")){ + dtl_map.put("设备状态", "正常"); + }else if(status.equals("11")){ + dtl_map.put("设备状态", "闲置"); + }else if(status.equals("20")){ + dtl_map.put("设备状态", "故障"); + }else if(status.equals("30")){ + dtl_map.put("设备状态", "维修"); + }else if(status.equals("40")){ + dtl_map.put("设备状态", "保养"); + }else if(status.equals("90")){ + dtl_map.put("设备状态", "报废"); + }else if(status.equals("91")){ + dtl_map.put("设备状态", "报废处理"); + } + dtl_map.put("启用日期", jo.getString("beginuse_date")); + dtl_map.put("使用部门", jo.getString("use_deptname")); + dtl_map.put("使用班组", jo.getString("use_groupname")); + dtl_map.put("供应商", jo.getString("supplier_name")); + dtl_map.put("制造商", jo.getString("manufacturer")); + dtl_map.put("制造国别", jo.getString("country_manufactur")); + dtl_map.put("出厂日期", jo.getString("leavefactory_date")); + dtl_map.put("出厂编号", jo.getString("leavefactory_number")); + dtl_map.put("图号", jo.getString("drawing_number")); + + String device_type = jo.getString("device_type"); + if(device_type.equals("01")){ + dtl_map.put("设备属性", "资产"); + }else if(device_type.equals("02")){ + dtl_map.put("设备属性", "普通设备"); + }else if(device_type.equals("03")){ + dtl_map.put("设备属性", "其他"); + } + dtl_map.put("工序", jo.getString("workprocedure_name")); + dtl_map.put("资产编码", jo.getString("assets_code")); + dtl_map.put("资产名称", jo.getString("assets_name")); + dtl_map.put("生成人", jo.getString("create_name")); + dtl_map.put("生成时间", jo.getString("create_time")); + + dtl_map.put("修改人", jo.getString("update_optname")); + dtl_map.put("修改时间", jo.getString("update_time")); + list.add(dtl_map); + } + FileUtil.downloadExcel(list, response); + } } diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/wql/QEM_EQUIPMENTFILE01.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/wql/QEM_EQUIPMENTFILE01.wql index 69ddb74f..ce88603c 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/wql/QEM_EQUIPMENTFILE01.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/basedata/em/wql/QEM_EQUIPMENTFILE01.wql @@ -100,6 +100,59 @@ ENDPAGEQUERY ENDIF + IF 输入.flag = "11" + QUERY + SELECT + equipmentfile.*, + workprocedure.workprocedure_name, + classstandard.class_name AS material_type_name, + dept1.name AS use_deptname, + dept2.name AS belong_deptname, + dept3.name AS use_groupname + FROM + em_bi_equipmentfile equipmentfile + LEFT JOIN pdm_bi_workprocedure workprocedure ON workprocedure.workprocedure_id = equipmentfile.workprocedure_id + LEFT JOIN md_pb_classstandard classstandard ON classstandard.class_id = equipmentfile.material_type_id + LEFT JOIN sys_dept dept1 ON dept1.dept_id = equipmentfile.use_deptid + LEFT JOIN sys_dept dept2 ON dept2.dept_id = equipmentfile.belong_deptid + LEFT JOIN sys_dept dept3 ON dept3.dept_id = equipmentfile.use_groupid + WHERE + equipmentfile.is_delete = '0' + OPTION 输入.is_produceuse <> "" + equipmentfile.is_produceuse = 输入.is_produceuse + ENDOPTION + OPTION 输入.status <> "" + equipmentfile.status = 输入.status + ENDOPTION + OPTION 输入.use_deptid <> "" + equipmentfile.use_deptid in 输入.deptIds + ENDOPTION + OPTION 输入.workprocedure_id <> "" + equipmentfile.workprocedure_id = 输入.workprocedure_id + ENDOPTION + OPTION 输入.device_type <> "" + equipmentfile.device_type = 输入.device_type + ENDOPTION + OPTION 输入.material_type_id <> "" + equipmentfile.material_type_id in 输入.classIds + ENDOPTION + OPTION 输入.device_code <> "" + (equipmentfile.device_code like 输入.device_code or equipmentfile.device_name like 输入.device_code) + ENDOPTION + OPTION 输入.manufacturer <> "" + equipmentfile.manufacturer like 输入.manufacturer + ENDOPTION + OPTION 输入.begin_time <> "" + equipmentfile.beginuse_date >= 输入.begin_time + ENDOPTION + OPTION 输入.end_time <> "" + equipmentfile.beginuse_date <= 输入.end_time + ENDOPTION + order by equipmentfile.devicerecord_code + ENDSELECT + ENDQUERY + ENDIF + IF 输入.flag = "2" QUERY SELECT 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 48515ace..da1db16a 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 e94f59f7..642ed795 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 @@ -1443,6 +1443,9 @@ public class AutoformulaServiceImpl implements AutoformulaService { //纯粉重量 double net_qty = workorder_qty; //1.需添加软废 + if(waste_limit_down==100 || waste_limit_up== 100){ + throw new BadRequestException("软废含量上限或下限不能等于100%!"); + } //R下 double waste_limit_down_weight = workorder_qty * waste_limit_down/100.0; //R上 @@ -3213,7 +3216,8 @@ public class AutoformulaServiceImpl implements AutoformulaService { } //BOM中碳化钨需含总碳 double CT2 = new_qty*(sum_Cr3C2/100.0)*(c_balance/100.0); - if(CT1==CT2){//配粉结束 + //配粉结束 + if(CT1==CT2){ double W = net_qty;//钨Wp=桶重量 - (R1p*R1纯粉系数+ R2p*R2纯粉系数…) - (Y1p+X1p+X2p…) //软废总碳 for(int i=0;iWp + double Wp = NumberUtil.round(W-Cp,6).doubleValue(); + if(Wp>0){ + JSONObject W_weight = new JSONObject(); + W_weight.put("formula_qty",NumberUtil.round(Wp,6).doubleValue()); + //钨分类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); + } + + if(Cp>0){ + JSONObject C_weight = new JSONObject(); + C_weight.put("formula_qty",Cp); + //钨分类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{ + //若Cp>Wp //解方程组 //获取最后一个配粉软废R3p JSONObject R3p = rf_list.getJSONObject(rf_list.size()-1); @@ -3391,15 +3420,13 @@ public class AutoformulaServiceImpl implements AutoformulaService { } } }); - //R3p减=C缺/[1-(R3的bom碳化钨含量*R3碳平衡+R3的bom碳化钨含量+Y1含量+Z1含量+Z2含量)] - double R3p_jian = C_que/(1.0-(rf3_Cr3C2*is_tan3+rf3_Cr3C2+sum_YZ.get())); + // R3p减=C缺/[1-(R3的bom碳化钨含量*R3碳平衡+Y1含量+Z1含量+Z2含量)] + double R3p_jian = C_que/(1.0-(rf3_Cr3C2*is_tan3+sum_YZ.get())); - R3p_jian = NumberUtil.round(R3p_jian,3).doubleValue(); + R3p_jian = NumberUtil.round(R3p_jian,6).doubleValue(); //C补=R3p减*R3的bom碳化钨含量*R3碳平衡+C缺 double C_bu = R3p_jian*rf3_Cr3C2*is_tan3+C_que; - //W补= R3p减*R3的bom碳化钨含量 - double W_bu = R3p_jian*rf3_Cr3C2; if(C_bu<=0) { if (rf_list.size() == 1) { throw new BadRequestException("无解!"); @@ -3434,29 +3461,12 @@ public class AutoformulaServiceImpl implements AutoformulaService { }); // R3p=R3p-R3p减/ R3纯粉系数 double r3_formula_qty = R3p.getDouble("formula_qty"); - r3_formula_qty = NumberUtil.round(r3_formula_qty - R3p_jian/(R3p.getDouble("net_rate")/100.0),3).doubleValue(); + r3_formula_qty = NumberUtil.round(r3_formula_qty - R3p_jian/(R3p.getDouble("net_rate")/100.0),6).doubleValue(); R3p.put("formula_qty",r3_formula_qty); rf_map.put(R3p.getString("stockrecord_id"),R3p); if(r3_formula_qty<=0){ rf_map.remove(R3p.getString("stockrecord_id")); } - if(W_bu>0){ - //Wp=W补 - JSONObject W_weight = new JSONObject(); - W_weight.put("formula_qty",W_bu); - //钨分类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); - } if(C_bu>0){ //Wp=Wp+W补 Cp = Cp + C_bu; @@ -3507,13 +3517,13 @@ public class AutoformulaServiceImpl implements AutoformulaService { } }); //除数 - double sub1 = R3p_jian*rf3_Cr3C2*is_tan3+C_que+R3p_jian*rf3_Cr3C2+ sum_he_R3p.get(); + double sub1 = R3p_jian*rf3_Cr3C2*is_tan3+C_que+ sum_he_R3p.get(); //被除数 - double sub2 = 1.0 - (sum_he.get() + rf2_Cr3C2 + rf2_Cr3C2*is_tan2); + double sub2 = 1.0 - (sum_he.get() + rf2_Cr3C2*is_tan2); /** - * R2p减 = (R3p*R3的bom碳化钨含量*R3碳平衡 + C缺 + R3p*R3的bom碳化钨含量 - * + R3p*Y1含量 + R3p*Z1含量 + R3p*Z2含量 - R3p)/(1-(Z2含量+Y1含量+Z1含量 - * +R2的bom碳化钨含量+R2的bom碳化钨含量*R2碳平衡)) + * R2p减 = + * (R3p*R3的bom碳化钨含量*R3碳平衡 + C缺+ R3p*Y1含量 + R3p*Z1含量 + R3p*Z2含量 - R3p)/ + * (1-(Z2含量+Y1含量+Z1含量+R2的bom碳化钨含量*R2碳平衡)) */ double R2p_jian = sub1/sub2; //计算非碳化钨需补重量 @@ -3553,7 +3563,7 @@ public class AutoformulaServiceImpl implements AutoformulaService { }); // R3p=R3p-R3p减/ R3纯粉系数 double r3_formula_qty = R3p.getDouble("formula_qty"); - r3_formula_qty = NumberUtil.round(r3_formula_qty - r3_formula_qty/(R3p.getDouble("net_rate")/100.0),3).doubleValue(); + r3_formula_qty = NumberUtil.round(r3_formula_qty - r3_formula_qty/(R3p.getDouble("net_rate")/100.0),6).doubleValue(); R3p.put("formula_qty",r3_formula_qty); rf_map.put(R3p.getString("stockrecord_id"),R3p); if(r3_formula_qty<=0){ @@ -3561,37 +3571,18 @@ public class AutoformulaServiceImpl implements AutoformulaService { } // R2p=R2p-R2p减/ R2纯粉系数 double r2_formula_qty = R2p.getDouble("formula_qty"); - r2_formula_qty = NumberUtil.round(r2_formula_qty - R2p_jian/(R2p.getDouble("net_rate")/100.0),3).doubleValue(); + r2_formula_qty = NumberUtil.round(r2_formula_qty - R2p_jian/(R2p.getDouble("net_rate")/100.0),6).doubleValue(); R2p.put("formula_qty",r2_formula_qty); rf_map.put(R2p.getString("stockrecord_id"),R2p); if(r2_formula_qty<=0){ rf_map.remove(R2p.getString("stockrecord_id")); } - //W补= R3p减*R3的bom碳化钨含量+ R2p减*R2的bom碳化钨含量 - double W_bu = R3p_jian*rf3_Cr3C2 + R2p_jian*rf2_Cr3C2; //C补=R3p减*R3的bom碳化钨含量*R3碳平衡+ R2p减*R2的bom碳化钨含量*R2碳平衡+C缺 double C_bu = R3p_jian*rf3_Cr3C2*is_tan3 + R2p_jian*rf2_Cr3C2*is_tan2 + C_que; //W补= R3p减*R3的bom碳化钨含量 if(C_bu<=0) { throw new BadRequestException("无解!"); }else{ - if(W_bu>0){ - //Wp=W补 - JSONObject W_weight = new JSONObject(); - W_weight.put("formula_qty",W_bu); - //钨分类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); - } if(C_bu>0){ //Wp=Wp+W补 Cp = Cp + C_bu; @@ -3617,7 +3608,10 @@ public class AutoformulaServiceImpl implements AutoformulaService { }else{ throw new BadRequestException("满足条件的软废为0,请按新料模式配粉!"); } - }else if(CT1>CT2){//需配钨粉 + + }else + //需配钨粉 + if(CT1>CT2){ //B、若有软废,先加钨Wp=桶重量 - (R1p*R1纯粉系数+ R2p*R2纯粉系数…) - (Y1p+X1p+X2p…) if(rf_list.size()!=0){ double W = net_qty; @@ -3635,7 +3629,9 @@ public class AutoformulaServiceImpl implements AutoformulaService { double need_qty = bomdlt.getDouble("formula_qty"); W = NumberUtil.round(W - need_qty,3).doubleValue(); } - + if(W<=0){ + W = 0; + } //解方程组 //获取最后一个配粉软废R3p JSONObject R3p = rf_list.getJSONObject(rf_list.size()-1); diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/wql/QPF_AUTOFORMULA01.wql b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/wql/QPF_AUTOFORMULA01.wql index 543ee282..dfab8008 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/wql/QPF_AUTOFORMULA01.wql +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/pf/wql/QPF_AUTOFORMULA01.wql @@ -348,7 +348,7 @@ OPTION 输入.set_type <> "" ProductMaterialSet.set_type = 输入.set_type ENDOPTION - order by classstandard.class_code asc + order by classstandard.class_code asc,ProductMaterialSet.set_material_id ENDSELECT ENDQUERY ENDIF diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/rest/DevicerepairrequestController.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/rest/DevicerepairrequestController.java index 1eb11e5d..45f7e57e 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/rest/DevicerepairrequestController.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/rest/DevicerepairrequestController.java @@ -40,6 +40,14 @@ public class DevicerepairrequestController { return new ResponseEntity<>(devicerepairrequestService.queryAll(whereJson, page), HttpStatus.OK); } + @GetMapping("/query2") + @Log("查询设备报修2") + @ApiOperation("查询设备报修2") + //@PreAuthorize("@el.check('devicerepairrequest:list')") + public ResponseEntity query2(@RequestParam Map whereJson, Pageable page) { + return new ResponseEntity<>(devicerepairrequestService.query2(whereJson, page), HttpStatus.OK); + } + @PostMapping @Log("新增设备报修") @ApiOperation("新增设备报修") diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/DevicerepairrequestService.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/DevicerepairrequestService.java index 698b2941..dc17599f 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/DevicerepairrequestService.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/DevicerepairrequestService.java @@ -26,6 +26,15 @@ public interface DevicerepairrequestService { */ Map queryAll(Map whereJson, Pageable page); + /** + * 查询数据分页 + * + * @param whereJson 条件 + * @param page 分页参数 + * @return Map + */ + Map query2(Map whereJson, Pageable page); + /** * 查询所有数据不分页 * diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/dto/DevicerepairrequestDto.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/dto/DevicerepairrequestDto.java index 6f78ea7c..1bc39b09 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/dto/DevicerepairrequestDto.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/dto/DevicerepairrequestDto.java @@ -80,4 +80,7 @@ public class DevicerepairrequestDto implements Serializable { /** 公司ID */ private Long syscompanyid; + + /** 班组配合人 */ + private String product_person_name; } 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 2cfc0a60..bf9f043e 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 @@ -289,6 +289,7 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService { // 1. 更新设备维修单主表 JSONObject jsonReMst = reMstTab.query("repair_id = '" + whereJson.getString("repair_id") + "'").uniqueResult(0); jsonReMst.put("invstatus", "03"); + jsonReMst.put("update_optname", whereJson.getString("update_optname")); jsonReMst.put("real_start_date", DateUtil.now()); reMstTab.update(jsonReMst); // 2.更新设备档案表 @@ -381,7 +382,7 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService { // 1.更新维修主表 JSONObject jsonReMst = reMstTab.query("repair_id = '" + whereJson.getString("repair_id") + "'").uniqueResult(0); - jsonReMst.put("update_optname", whereJson.getString("update_optname")); +// jsonReMst.put("update_optname", whereJson.getString("update_optname")); jsonReMst.put("product_person_name", whereJson.getString("product_person_name")); jsonReMst.put("update_time", DateUtil.now()); reMstTab.update(jsonReMst); diff --git a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/impl/DevicerepairrequestServiceImpl.java b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/impl/DevicerepairrequestServiceImpl.java index d2863b71..846c5ef5 100644 --- a/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/impl/DevicerepairrequestServiceImpl.java +++ b/mes/hd/nladmin-system/src/main/java/org/nl/wms/sb/repair/service/impl/DevicerepairrequestServiceImpl.java @@ -8,7 +8,9 @@ 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.util.CodeUtil; +import org.nl.utils.SpringContextHolder; import org.nl.wms.basedata.master.service.ClassstandardService; import org.nl.wms.sb.repair.service.DevicerepairrequestService; import org.nl.wms.sb.repair.service.dto.DevicerepairrequestDto; @@ -74,6 +76,44 @@ public class DevicerepairrequestServiceImpl implements DevicerepairrequestServic return json; } + @Override + public Map query2(Map whereJson, Pageable page) { + DeptService deptService = SpringContextHolder.getBean(DeptService.class); + + String material_type_id = MapUtil.getStr(whereJson, "material_type_id"); + String device_code = MapUtil.getStr(whereJson, "device_code"); + String request_code = MapUtil.getStr(whereJson, "request_code"); + String status = MapUtil.getStr(whereJson, "status"); + String begin_time = MapUtil.getStr(whereJson, "begin_time"); + String end_time = MapUtil.getStr(whereJson, "end_time"); + String class_idStr = (String) whereJson.get("class_idStr"); + + HashMap map = new HashMap<>(); + map.put("flag", "3"); + map.put("begin_time", begin_time); + map.put("end_time", end_time); + map.put("status", status); + if (ObjectUtil.isNotEmpty(device_code)) map.put("device_code","%"+device_code+"%"); + if (ObjectUtil.isNotEmpty(request_code)) map.put("request_code","%"+request_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_DEVICEREPAIRREQUEST001").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "mst.create_time DESC"); + return json; + } + @Override public List queryAll(Map whereJson) { WQLObject wo = WQLObject.getWQLObject("em_bi_devicerepairrequest"); @@ -176,7 +216,7 @@ public class DevicerepairrequestServiceImpl implements DevicerepairrequestServic jsonFile.put("status","20"); fileTab.update(jsonFile); - // 2.更新设备保修单 + // 2.更新设备报修单 JSONObject jsonRequest = requestTab.query("request_id = '" + whereJson.getString("request_id") + "'").uniqueResult(0); jsonRequest.put("is_passed", "1"); jsonRequest.put("status", "02"); @@ -192,6 +232,7 @@ public class DevicerepairrequestServiceImpl implements DevicerepairrequestServic jsonReMst.put("devicerecord_id", jsonRequest.get("devicerecord_id")); jsonReMst.put("maintenancecycle", "02"); jsonReMst.put("invstatus", "01"); + jsonReMst.put("product_person_name", jsonRequest.getString("product_person_name")); jsonReMst.put("fault_desc", jsonRequest.getString("fault_desc")); jsonReMst.put("fault_level", jsonRequest.getString("fault_level")); jsonReMst.put("plan_start_date", DateUtil.today()); 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 3e6cc875..2123b895 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 @@ -20,6 +20,7 @@ 输入.request_code TYPEAS s_string 输入.begin_time TYPEAS s_string 输入.end_time TYPEAS s_string + 输入.deptIds TYPEAS f_string [临时表] @@ -107,5 +108,61 @@ ENDPAGEQUERY ENDIF + IF 输入.flag = "3" + PAGEQUERY + SELECT + mst.*, + class.class_name, + file.device_code, + file.device_name, + file.extend_code, + class2.device_faultclass_name, + d1.name AS dept_name, + d2.name AS use_name + FROM + EM_BI_DeviceRepairRequest 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 EM_BI_DeviceFaultClass class2 ON mst.device_faultclass_id = class2.device_faultclass_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' + + OPTION 输入.device_code <> "" + (file.device_code like 输入.device_code or + file.device_name like 输入.device_code) + ENDOPTION + + OPTION 输入.request_code <> "" + (mst.request_code like 输入.request_code or + mst.request_code like 输入.request_code) + ENDOPTION + + OPTION 输入.classIds <> "" + class.class_id in 输入.classIds + ENDOPTION + + OPTION 输入.deptIds <> "" + d1.dept_id in 输入.deptIds + ENDOPTION + + OPTION 输入.status <> "" + mst.status = 输入.status + ENDOPTION + + OPTION 输入.begin_time <> "" + mst.create_time >= 输入.begin_time + ENDOPTION + + OPTION 输入.end_time <> "" + mst.create_time <= 输入.end_time + ENDOPTION + + ENDSELECT + ENDPAGEQUERY + ENDIF + diff --git a/mes/qd/src/views/wms/basedata/em/equipmentfile/index.vue b/mes/qd/src/views/wms/basedata/em/equipmentfile/index.vue index 45b94be4..4beb97b0 100644 --- a/mes/qd/src/views/wms/basedata/em/equipmentfile/index.vue +++ b/mes/qd/src/views/wms/basedata/em/equipmentfile/index.vue @@ -177,6 +177,16 @@ > 打印 + + 导出excel + - + - - + + - - - - + + + + - - - - + + + + - - - - - - - - + + + + + + + + @@ -261,6 +271,8 @@ import '@riophae/vue-treeselect/dist/vue-treeselect.css' import { getDepts } from '@/api/system/dept' import crudClassstandard from '@/api/wms/basedata/master/classstandard' import crudMaterialbase from '@/api/wms/basedata/master/materialbase' +import { download } from '@/api/data' +import { downloadFile } from '@/utils' export default { name: 'equipmentfile', @@ -459,6 +471,15 @@ export default { this.crud.toQuery() this.handleCurrentChange() }, + downdtl() { + crud.downloadLoading = true + download('/api/equipmentfile/download', this.crud.query).then(result => { + downloadFile(result, '设备档案', 'xlsx') + crud.downloadLoading = false + }).catch(() => { + crud.downloadLoading = false + }) + }, printCard() { const _selectData = this.$refs.table.selection if (_selectData.length > 1 || _selectData.length === 0) { diff --git a/mes/qd/src/views/wms/sb/repair/devicerepairpa/ExecuteDialog.vue b/mes/qd/src/views/wms/sb/repair/devicerepairpa/ExecuteDialog.vue index 852df758..6eff7242 100644 --- a/mes/qd/src/views/wms/sb/repair/devicerepairpa/ExecuteDialog.vue +++ b/mes/qd/src/views/wms/sb/repair/devicerepairpa/ExecuteDialog.vue @@ -8,12 +8,13 @@ destroy-on-close @close="close" > - - + + - + + 结束维修 保存 关闭 @@ -65,7 +66,7 @@ - + @@ -169,14 +170,19 @@ export default { }, submitMain() { const data = this.form - if (this.form.update_optname === '') { - return this.crud.notify('维修人不能为空', CRUD.NOTIFICATION_TYPE.INFO) - } crudDevicerepairmst.submitRepair(data).then(res => { this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS) this.crud.toQuery() this.dialogVisible = false }) + }, + endRepair() { + const data = this.form + crudDevicerepairmst.endRepair(data).then(res => { + this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS) + this.crud.toQuery() + this.dialogVisible = false + }) } } } diff --git a/mes/qd/src/views/wms/sb/repair/devicerepairpa/StartDialog.vue b/mes/qd/src/views/wms/sb/repair/devicerepairpa/StartDialog.vue new file mode 100644 index 00000000..a1e38ae6 --- /dev/null +++ b/mes/qd/src/views/wms/sb/repair/devicerepairpa/StartDialog.vue @@ -0,0 +1,111 @@ + + + + diff --git a/mes/qd/src/views/wms/sb/repair/devicerepairpa/index.vue b/mes/qd/src/views/wms/sb/repair/devicerepairpa/index.vue index 2d1d304e..bdaa0c87 100644 --- a/mes/qd/src/views/wms/sb/repair/devicerepairpa/index.vue +++ b/mes/qd/src/views/wms/sb/repair/devicerepairpa/index.vue @@ -89,7 +89,7 @@ > 开始维修 - 维修执行 + --> + + 维修领用 结束维修 - - 维修领用 - - 维修确认 + 班组验收 + @@ -197,11 +198,12 @@ import crudMaterialbase from '@/api/wms/basedata/master/materialbase' import ExecuteDialog from '@/views/wms/sb/repair/devicerepairpa/ExecuteDialog' import resuftDialog from '@/views/wms/sb/repair/devicerepairpa/resuftDialog' import ReceiveDialog from '@/views/wms/sb/repair/devicerepairpa/ReceiveDialog' +import StartDialog from '@/views/wms/sb/repair/devicerepairpa/StartDialog' export default { name: 'Devicerepairpa', dicts: ['EM_DEVICE_WX_INVTYPE', 'EM_DEVICE_WX_INVSTATUS', 'EM_FAULT_LEVEL'], - components: { pagination, crudOperation, rrOperation, udOperation, DateRangePicker, Treeselect, ExecuteDialog, resuftDialog, ReceiveDialog }, + components: { pagination, crudOperation, rrOperation, udOperation, DateRangePicker, Treeselect, ExecuteDialog, resuftDialog, ReceiveDialog, StartDialog }, mixins: [presenter(), header(), crud()], cruds() { return CRUD({ @@ -234,6 +236,7 @@ export default { executeDialog: false, resuftDialog: false, receiveDialog: false, + startDialog: false, permission: { } } @@ -300,18 +303,19 @@ export default { if (data.invstatus !== '02') { return this.crud.notify('只能对提交状态的单据维修', CRUD.NOTIFICATION_TYPE.INFO) } - crudDevicerepairmst.startRepair(data).then(res => { - this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS) - this.crud.toQuery() - }) + this.openParam = data + this.startDialog = true }, endRepair() { const _selectData = this.$refs.table.selection const data = _selectData[0] if (data.invstatus === '03' || data.invstatus === '05') { - crudDevicerepairmst.endRepair(data).then(res => { - this.crud.notify('操作成功', CRUD.NOTIFICATION_TYPE.SUCCESS) - this.crud.toQuery() + crudDevicerepairmst.getDtl(data).then(res => { + this.openParam = { + 'form': data, + 'tableData': res + } + this.executeDialog = true }) } else { return this.crud.notify('只能对开始或者委外验收的单据结束维修', CRUD.NOTIFICATION_TYPE.INFO) diff --git a/mes/qd/src/views/wms/sb/repair/devicevprs/index.vue b/mes/qd/src/views/wms/sb/repair/devicevprs/index.vue index 4f4e6593..73a1dfe1 100644 --- a/mes/qd/src/views/wms/sb/repair/devicevprs/index.vue +++ b/mes/qd/src/views/wms/sb/repair/devicevprs/index.vue @@ -20,6 +20,15 @@ placeholder="请选择" /> + + + + + + + + + + + @@ -187,8 +204,9 @@ import crudMaterialbase from '@/api/wms/basedata/master/materialbase' import PicDialog from '@/views/wms/sb/repair/devicerepairrequest/PicDialog' import DeviceDialog from '@/views/wms/sb/upkeep/devicemaintenanceplan/DeviceDialog' import FaultDialog from '@/views/wms/sb/repair/devicevprs/FaultDialog' +import { getDepts } from '@/api/system/dept' -const defaultForm = { device_faultclass_name: null, device_code: null, request_id: null, request_code: null, devicerecord_id: null, fault_time: null, device_faultclass_id: null, fault_desc: null, fault_level: null, remark: null, status: null, create_id: null, create_name: null, create_time: null, is_passed: null, process_id: null, process_name: null, process_time: null, finish_id: null, finish_name: null, finish_time: null, is_delete: null, sysdeptid: null, syscompanyid: null } +const defaultForm = { product_person_name: null, device_faultclass_name: null, device_code: null, request_id: null, request_code: null, devicerecord_id: null, fault_time: null, device_faultclass_id: null, fault_desc: null, fault_level: null, remark: null, status: null, create_id: null, create_name: null, create_time: null, is_passed: null, process_id: null, process_name: null, process_time: null, finish_id: null, finish_name: null, finish_time: null, is_delete: null, sysdeptid: null, syscompanyid: null } export default { name: 'Devicevprs', dicts: ['EM_FAULT_LEVEL'], @@ -197,7 +215,7 @@ export default { cruds() { return CRUD({ title: '设备报修', - url: 'api/devicerepairrequest', + url: 'api/devicerepairrequest/query2', idField: 'request_id', sort: 'request_id,desc', crudMethod: { ...crudDevicerepairrequest }, @@ -216,6 +234,7 @@ export default { faultDialog: false, classes: [], class_idStr: null, + depts: [], materOpt_code: '23', statusList: [ { 'label': '生成', 'value': '01' }, @@ -234,6 +253,9 @@ export default { ], fault_level: [ { required: true, message: '故障等级不能为空', trigger: 'blur' } + ], + product_person_name: [ + { required: true, message: '班组配合人不能为空', trigger: 'blur' } ] } } @@ -248,6 +270,7 @@ export default { this.crud.toQuery() this.queryClassId() }) + this.getDepts() }, methods: { // 钩子:在获取表格数据之前执行,false 则代表不获取数据 @@ -350,6 +373,32 @@ export default { tableChanged(row) { this.form.device_faultclass_id = row.device_faultclass_id this.form.device_faultclass_name = row.device_faultclass_name + }, + // 获取弹窗内部门数据 + 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 + }) + }) } } } 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 c129d874..4c8e36b2 100644 --- a/mes/qd/src/views/wms/sb/upkeep/devicemaintenance/index.vue +++ b/mes/qd/src/views/wms/sb/upkeep/devicemaintenance/index.vue @@ -98,7 +98,7 @@ :disabled="crud.selections.length !== 1" @click="createExcel" > - 生成设备保养 + 生成保养单