| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | |
| | | List<Map<String, Object>> records = inspectionOrderList.getRecords(); |
| | | for (Map<String, Object> record : records) { |
| | | String id = (String)record.get("id"); |
| | | String equipmentId = (String)record.get("equipmentId"); |
| | | String status = (String)record.get("status"); |
| | | String inspectionStandardId = (String)record.get("inspectionStandardId"); |
| | | List<InspectionCycleVo> inspectionCycles = inspectionOrderService.getInspectionCycleByEqId(inspectionStandardId); |
| | | record.put("inspectionCycles",inspectionCycles); |
| | | // String equipmentId = (String)record.get("equipmentId"); |
| | | // String status = (String)record.get("status"); |
| | | // String inspectionStandardId = (String)record.get("inspectionStandardId"); |
| | | // List<InspectionCycleVo> inspectionCycles = inspectionOrderService.getInspectionCycleByEqId(inspectionStandardId); |
| | | // record.put("inspectionCycles",inspectionCycles); |
| | | |
| | | List<Map<String, Object>> inspectionOrderDetails = inspectionOrderService.getInspectionOrderDetailByOrderId(id); |
| | | record.put("inspectionOrderDetails",inspectionOrderDetails); |
| | | |
| | | |
| | | List<InspectionOrderDetail> failCount = inspectionOrderDetailService.lambdaQuery() |
| | | .eq(InspectionOrderDetail::getInspectionOrderId, id) |
| | | .eq(InspectionOrderDetail::getJudgmentResult, "fail") |
| | | .eq(InspectionOrderDetail::getDelFlag, 0).list(); |
| | | // List<InspectionOrderDetail> failCount = inspectionOrderDetailService.lambdaQuery() |
| | | // .eq(InspectionOrderDetail::getInspectionOrderId, id) |
| | | // .eq(InspectionOrderDetail::getJudgmentResult, "fail") |
| | | // .eq(InspectionOrderDetail::getDelFlag, 0).list(); |
| | | // |
| | | // List<InspectionOrderDetail> passCount = inspectionOrderDetailService.lambdaQuery() |
| | | // .eq(InspectionOrderDetail::getInspectionOrderId, id) |
| | | // .eq(InspectionOrderDetail::getJudgmentResult,"pass") |
| | | // .eq(InspectionOrderDetail::getDelFlag, 0).list(); |
| | | // record.put("result","正常:"+passCount.size()+","+"异常:"+failCount.size()); |
| | | |
| | | List<InspectionOrderDetail> passCount = inspectionOrderDetailService.lambdaQuery() |
| | | .eq(InspectionOrderDetail::getInspectionOrderId, id) |
| | | .eq(InspectionOrderDetail::getJudgmentResult,"pass") |
| | | .eq(InspectionOrderDetail::getDelFlag, 0).list(); |
| | | record.put("result","正常:"+passCount.size()+","+"异常:"+failCount.size()); |
| | | |
| | | if("5".equals(status) ){ |
| | | record.put("distable",true); |
| | | }else{ |
| | | record.put("distable",false); |
| | | } |
| | | // if("5".equals(status) ){ |
| | | // record.put("distable",true); |
| | | // }else{ |
| | | // record.put("distable",false); |
| | | // } |
| | | } |
| | | return Result.ok(inspectionOrderList); |
| | | } |
| | |
| | | for (InspectionOrderDetail inspectionOrderDetail : inspectionOrderDetailList) { |
| | | String id = inspectionOrder.getId(); |
| | | String inspectionStandardDetailId = inspectionOrderDetail.getInspectionStandardDetailId(); |
| | | //点检项目id |
| | | String inspectionProjectId = inspectionOrderDetail.getInspectionProjectId(); |
| | | |
| | | //点检标准 |
| | | DailyInspectionStandardDetail dailyInspectionStandardDetail = dailyInspectionStandardDetailService.getById(inspectionStandardDetailId); |
| | | //点检项目 |
| | | InspectionProject inspectionProject = inspectionProjectService.getById(inspectionProjectId); |
| | | |
| | | //点检明细添加 |
| | | inspectionOrderDetail.setId(""); |
| | | inspectionOrderDetail.setInspectionOrderId(id); |
| | | inspectionOrderDetail.setLocation(dailyInspectionStandardDetail.getLocation()); |
| | |
| | | inspectionOrderDetailService.save(inspectionOrderDetail); |
| | | } |
| | | }else{ |
| | | //生产线设备,按照生产线来进行点检 |
| | | String lineId = equipment.getLineId(); |
| | | if(StringUtils.isBlank(lineId)){ |
| | | return Result.error("生产线设备没有关联到产线编号"); |
| | | } |
| | | List<DailyInspectionStandard> dailyInspectionStandards = dailyInspectionStandardService.lambdaQuery() |
| | | .eq(DailyInspectionStandard::getEquipmentId, lineId) |
| | | .eq(DailyInspectionStandard::getVersionStatus, "2") |
| | | .eq(DailyInspectionStandard::getDelFlag, "0").list(); |
| | | if(CollectionUtils.isEmpty(dailyInspectionStandards)){ |
| | | return Result.error("设备对应的产线没有配置点检标准"); |
| | | } |
| | | if(dailyInspectionStandards.size()>0) { |
| | | DailyInspectionStandard dailyInspectionStandard = dailyInspectionStandards.get(0); |
| | | //保存点检工单子表数据 |
| | |
| | | } |
| | | } |
| | | inspectionOrder.setActualEndTime(new Date()); |
| | | inspectionOrder.setInspectionOrderUda2(sysUser.getRealname()); |
| | | boolean b = inspectionOrderService.updateById(inspectionOrder); |
| | | if (!b) { |
| | | return Result.error("报工失败!"); |
| | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | *生产设备自主维护点检表 报表 |
| | | * 2024-3-27 qsw |
| | | */ |
| | | @GetMapping("findInspectionProjectList") |
| | | public Result<?> findInspectionProjectList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize, |
| | | @RequestParam Map<String, Object> params) { |
| | | IPage<Map<String, Object>> dayInspectionProjectList = inspectionOrderService.findDayInspectionProjectList(pageNo, 1000, params); |
| | | List<Map<String, Object>> records = dayInspectionProjectList.getRecords(); |
| | | List<Map<String, Object>> maps = new ArrayList<>(); |
| | | for (Map<String, Object> record : records) { |
| | | if(maps.size()>0){ |
| | | Boolean flag = false; |
| | | for (Map<String, Object> map : maps) { |
| | | if(map.containsValue(record.get("name")) && map.containsValue(record.get("detectionStandard"))){ |
| | | map.put(record.get("createTime").toString(),record.get("insResult")); |
| | | flag = true; |
| | | } |
| | | } |
| | | if(flag == false){ |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("name",record.get("name")); |
| | | hashMap.put("equipmentNum",record.get("equipmentNum")); |
| | | hashMap.put("equipmentName",record.get("equipmentName")); |
| | | hashMap.put("detectionStandard",record.get("detectionStandard")); |
| | | hashMap.put(record.get("createTime").toString(),record.get("insResult")); |
| | | maps.add(hashMap); |
| | | } |
| | | }else{ |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("name",record.get("name")); |
| | | hashMap.put("equipmentNum",record.get("equipmentNum")); |
| | | hashMap.put("equipmentName",record.get("equipmentName")); |
| | | hashMap.put("detectionStandard",record.get("detectionStandard")); |
| | | hashMap.put(record.get("createTime").toString(),record.get("insResult")); |
| | | maps.add(hashMap); |
| | | } |
| | | } |
| | | return Result.ok(maps); |
| | | } |
| | | |
| | | /** |
| | | *生产设备自主维护周点检表 报表 |
| | | * 2024-3-27 qsw |
| | | */ |
| | | @GetMapping("findWeekInspectionProjectList") |
| | | public Result<?> findWeekInspectionProjectList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize, |
| | | @RequestParam Map<String, Object> params) { |
| | | IPage<Map<String, Object>> dayInspectionProjectList = inspectionOrderService.findWeekInspectionProjectList(pageNo, 1000, params); |
| | | List<Map<String, Object>> records = dayInspectionProjectList.getRecords(); |
| | | List<Map<String, Object>> maps = new ArrayList<>(); |
| | | for (Map<String, Object> record : records) { |
| | | if(maps.size()>0){ |
| | | Boolean flag = false; |
| | | for (Map<String, Object> map : maps) { |
| | | if(map.containsValue(record.get("name")) && map.containsValue(record.get("detectionStandard"))){ |
| | | map.put(record.get("createTime").toString(),record.get("insResult")); |
| | | flag = true; |
| | | } |
| | | } |
| | | if(flag == false){ |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("name",record.get("name")); |
| | | hashMap.put("equipmentNum",record.get("equipmentNum")); |
| | | hashMap.put("equipmentName",record.get("equipmentName")); |
| | | hashMap.put("detectionStandard",record.get("detectionStandard")); |
| | | hashMap.put(record.get("createTime").toString(),record.get("insResult")); |
| | | maps.add(hashMap); |
| | | } |
| | | }else{ |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("name",record.get("name")); |
| | | hashMap.put("equipmentNum",record.get("equipmentNum")); |
| | | hashMap.put("equipmentName",record.get("equipmentName")); |
| | | hashMap.put("detectionStandard",record.get("detectionStandard")); |
| | | hashMap.put(record.get("createTime").toString(),record.get("insResult")); |
| | | maps.add(hashMap); |
| | | } |
| | | } |
| | | return Result.ok(maps); |
| | | } |
| | | |
| | | |
| | | /** |
| | | *生产设备自主维护点检表 报表 |
| | | * 2024-3-27 qsw |
| | | */ |
| | | @GetMapping("findInspectionForms") |
| | | public Result<?> findInspectionForms(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "1000") Integer pageSize, |
| | | @RequestParam Map<String, Object> params) { |
| | | |
| | | // HashMap<String, Object> mapEquipment = new HashMap<>(); |
| | | // HashMap<String, Object> mapStandard = new HashMap<>(); |
| | | HashMap<String, Object> mapResult = new HashMap<>(); |
| | | |
| | | |
| | | |
| | | String num = (String)params.get("num"); |
| | | Equipment equipment = equipmentService.getOne(new LambdaQueryWrapper<Equipment>().eq(Equipment::getNum, num).eq(Equipment::getDelFlag, 0)); |
| | | |
| | | // mapEquipment.put("num",equipment.getNum()); |
| | | |
| | | |
| | | List<Map<String, Object>> list1 = this.getInspectionStandars(num); |
| | | List<Map<String, Object>> list2 = this.getUserQianzi(num); |
| | | |
| | | mapResult.put("equipentNum",equipment.getNum()); |
| | | mapResult.put("equipentName",equipment.getName()); |
| | | mapResult.put("list1",list1); |
| | | mapResult.put("list2",list2); |
| | | |
| | | return Result.ok(mapResult); |
| | | } |
| | | |
| | | List<Map<String, Object>> getInspectionStandars(String num){ |
| | | List<Map<String, Object>> maps = new ArrayList<>(); |
| | | List<Map<String, Object>> dayInspectionStandard = inspectionOrderService.findDayInspectionStandard(num); |
| | | for (Map<String, Object> map : dayInspectionStandard) { |
| | | String name = (String)map.get("name"); |
| | | String detectionStandard = (String)map.get("detectionStandard"); |
| | | List<Map<String, Object>> record = inspectionOrderService.findDayInspectionStandardProject(name, detectionStandard); |
| | | |
| | | for (Map<String, Object> r : record) { |
| | | if(maps.size()>0){ |
| | | Boolean flag = false; |
| | | for (Map<String, Object> map1 : maps) { |
| | | if(map1.containsValue(r.get("name")) && map1.containsValue(r.get("detectionStandard"))){ |
| | | map1.put(r.get("dayTime").toString(),r.get("insResult")); |
| | | flag = true; |
| | | } |
| | | } |
| | | if(flag == false){ |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("name",r.get("name")); |
| | | hashMap.put("detectionStandard",r.get("detectionStandard")); |
| | | hashMap.put(r.get("dayTime").toString(),r.get("insResult")); |
| | | maps.add(hashMap); |
| | | } |
| | | }else{ |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("name",r.get("name")); |
| | | hashMap.put("detectionStandard",r.get("detectionStandard")); |
| | | hashMap.put(r.get("dayTime").toString(),r.get("insResult")); |
| | | maps.add(hashMap); |
| | | |
| | | } |
| | | } |
| | | } |
| | | return maps; |
| | | } |
| | | List<Map<String, Object>> getUserQianzi(String num){ |
| | | List<Map<String, Object>> maps2 = new ArrayList<>(); |
| | | List<Map<String, Object>> userQianZi = inspectionOrderService.getUserQianZi(num); |
| | | for (Map<String, Object> map : userQianZi) { |
| | | if(maps2.size()>0){ |
| | | Boolean flag = false; |
| | | for (Map<String, Object> map1 : maps2) { |
| | | if(map1.containsValue("维护责任人")){ |
| | | map1.put(map.get("dayTime").toString(),map.get("inspectionUserName")); |
| | | flag = true; |
| | | } |
| | | } |
| | | if(flag == false){ |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("inspectionUserName","维护责任人"); |
| | | hashMap.put(map.get("dayTime").toString(),map.get("inspectionUserName")); |
| | | maps2.add(hashMap); |
| | | } |
| | | }else{ |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("inspectionUserName","维护责任人"); |
| | | hashMap.put(map.get("dayTime").toString(),map.get("inspectionUserName")); |
| | | maps2.add(hashMap); |
| | | } |
| | | } |
| | | return maps2; |
| | | } |
| | | |
| | | } |