| | |
| | | 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; |
| | |
| | | //import org.jeecg.modules.system.entity.SysUploadRela; |
| | | //import org.jeecg.modules.system.service.IUploadRelaService; |
| | | //import org.jeecg.modules.system.service.IUploadService; |
| | | import org.jeecg.modules.eam.vo.InspectionResultVo; |
| | | import org.jeecg.modules.eam.vo.SysFileNameVo; |
| | | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| | | import org.jeecgframework.poi.excel.def.NormalExcelConstants; |
| | | import org.jeecgframework.poi.excel.entity.ExportParams; |
| | |
| | | import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.unit.DataUnit; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | |
| | | @Autowired |
| | | private IEquipmentReportRepairService equipmentReportRepairService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private IdentityService sysIdentityService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private IEamEquipmentService equipmentService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private IDailyInspectionStandardService dailyInspectionStandardService; |
| | | |
| | | @Autowired |
| | | @Lazy |
| | | private IAreaService areaService; |
| | | |
| | | // @Autowired |
| | | // private IUploadRelaService uploadRelaService; |
| | |
| | | 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); |
| | | // for (Map<String, Object> inspectionOrderDetail : inspectionOrderDetails) { |
| | | // //获取订单明细示意图 |
| | | //// List<SysUploadRela> sysUploadRelas = uploadRelaService.lambdaQuery().eq(SysUploadRela::getBusId, (String)inspectionOrderDetail.get("inspectionStandardDetailId")).eq(SysUploadRela::getDelFlag, 0).list(); |
| | | // List<SysUploadRela> sysUploadRelas = sysBaseApi.listByBusIdAndBusType ((String)inspectionOrderDetail.get("inspectionStandardDetailId"),null); |
| | | // if(sysUploadRelas.size()>0){ |
| | | //// List<SysUploadRela> uploadRelas = uploadRelaService.listByBusIdAndBusType((String)inspectionOrderDetail.get("inspectionStandardDetailId"), "daily_inspection_standard_photo"); |
| | | // List<SysUploadRela> uploadRelas = sysBaseApi.listByBusIdAndBusType ((String)inspectionOrderDetail.get("inspectionStandardDetailId"),"daily_inspection_standard_photo"); |
| | | // SysUpload upload = new SysUpload(); |
| | | // if (CollectionUtils.isNotEmpty(uploadRelas)) { |
| | | //// upload = uploadService.getById(uploadRelas.get(0).getUploadId()); |
| | | // upload = sysBaseApi.getUploadById(uploadRelas.get(0).getUploadId()); |
| | | // } |
| | | // inspectionOrderDetail.put("upload",upload); |
| | | // }else{ |
| | | // SysUpload upload = new SysUpload(); |
| | | // inspectionOrderDetail.put("upload",upload); |
| | | // } |
| | | // } |
| | | 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); |
| | | } |
| | |
| | | } |
| | | inspectionOrder.setInspectionDeadline(date); |
| | | inspectionOrder.setInspectionStandardType("1"); |
| | | inspectionOrder.setStatus("3");//3:未开始 |
| | | inspectionOrderService.save(inspectionOrder); |
| | | List<InspectionOrderDetail> inspectionOrderDetailList = inspectionOrder.getInspectionOrderDetailList(); |
| | | for (InspectionOrderDetail inspectionOrderDetail : inspectionOrderDetailList) { |
| | | String id = inspectionOrder.getId(); |
| | | String inspectionStandardDetailId = inspectionOrderDetail.getInspectionStandardDetailId(); |
| | | String inspectionProjectId = inspectionOrderDetail.getInspectionProjectId(); |
| | | |
| | | DailyInspectionStandardDetail dailyInspectionStandardDetail = dailyInspectionStandardDetailService.getById(inspectionStandardDetailId); |
| | | InspectionProject inspectionProject = inspectionProjectService.getById(inspectionProjectId); |
| | | String equipmentId = inspectionOrder.getEquipmentId(); |
| | | Equipment equipment = equipmentService.getById(equipmentId); |
| | | String isLineEquip = equipment.getIsLineEquip(); |
| | | if("no".equals(isLineEquip)){ |
| | | List<InspectionOrderDetail> inspectionOrderDetailList = inspectionOrder.getInspectionOrderDetailList(); |
| | | 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()); |
| | | inspectionOrderDetail.setPhoto(dailyInspectionStandardDetail.getPhoto()); |
| | | inspectionOrderDetail.setInspectionMethod(inspectionProject.getInspectionMethod()); |
| | | inspectionOrderDetail.setInspectionTool(inspectionProject.getInspectionTool()); |
| | | inspectionOrderDetail.setAnalysisMethod(inspectionProject.getAnalysisMethod()); |
| | | inspectionOrderDetail.setTestValueType(inspectionProject.getTestValueType()); |
| | | inspectionOrderDetail.setDetectionStandard(inspectionProject.getDetectionStandard()); |
| | | inspectionOrderDetail.setAcceptabilityLimit(inspectionProject.getAcceptabilityLimit()); |
| | | |
| | | inspectionOrderDetail.setId(""); |
| | | inspectionOrderDetail.setInspectionOrderId(id); |
| | | inspectionOrderDetail.setLocation(dailyInspectionStandardDetail.getLocation()); |
| | | inspectionOrderDetail.setPhoto(dailyInspectionStandardDetail.getPhoto()); |
| | | inspectionOrderDetail.setInspectionMethod(inspectionProject.getInspectionMethod()); |
| | | inspectionOrderDetail.setInspectionTool(inspectionProject.getInspectionTool()); |
| | | inspectionOrderDetail.setAnalysisMethod(inspectionProject.getAnalysisMethod()); |
| | | inspectionOrderDetail.setTestValueType(inspectionProject.getTestValueType()); |
| | | inspectionOrderDetail.setDetectionStandard(inspectionProject.getDetectionStandard()); |
| | | inspectionOrderDetail.setAcceptabilityLimit(inspectionProject.getAcceptabilityLimit()); |
| | | 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); |
| | | //保存点检工单子表数据 |
| | | List<DailyInspectionStandardDetail> dailyInspectionStandardDetailList = dailyInspectionStandardDetailService.lambdaQuery() |
| | | .eq(DailyInspectionStandardDetail::getDailyInspectionStandardId,dailyInspectionStandard.getId()) |
| | | .eq(DailyInspectionStandardDetail::getInspectionCycleId,inspectionOrder.getInspectionCycleId()) |
| | | .eq(DailyInspectionStandardDetail::getDelFlag,"0").list(); |
| | | for(DailyInspectionStandardDetail dailyInspectionStandardDetail : dailyInspectionStandardDetailList){ |
| | | String inspectionProjectId = dailyInspectionStandardDetail.getInspectionProjectId(); |
| | | |
| | | inspectionOrderDetailService.save(inspectionOrderDetail); |
| | | InspectionOrderDetail inspectionOrderDetail = new InspectionOrderDetail(); |
| | | inspectionOrderDetail.setInspectionOrderId(inspectionOrder.getId()); |
| | | inspectionOrderDetail.setInspectionProjectId(inspectionProjectId); |
| | | inspectionOrderDetail.setInspectionStandardDetailId(dailyInspectionStandardDetail.getId()); |
| | | inspectionOrderDetail.setLocation(dailyInspectionStandardDetail.getLocation()); |
| | | inspectionOrderDetail.setPhoto(dailyInspectionStandardDetail.getPhoto()); |
| | | InspectionProject inspectionProject = inspectionProjectService.getById(inspectionProjectId); |
| | | if(inspectionProject != null){ |
| | | inspectionOrderDetail.setDetectionStandard(inspectionProject.getDetectionStandard()); |
| | | } |
| | | inspectionOrderDetailService.save(inspectionOrderDetail); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return Result.OK("添加成功!"); |
| | | } |
| | | |
| | |
| | | inspectionOrderDetailService.updateById(inspectionOrderDetail); |
| | | } |
| | | |
| | | List<InspectionOrderDetail> inspectionOrderDetailList = inspectionOrder.getInspectionOrderDetailList(); |
| | | for (InspectionOrderDetail inspectionOrderDetail : inspectionOrderDetailList) { |
| | | String inspectionStandardDetailId = inspectionOrderDetail.getInspectionStandardDetailId(); |
| | | String inspectionProjectId = inspectionOrderDetail.getInspectionProjectId(); |
| | | String equipmentId = inspectionOrder.getEquipmentId(); |
| | | Equipment equipment = equipmentService.getById(equipmentId); |
| | | String isLineEquip = equipment.getIsLineEquip(); |
| | | if("no".equals(isLineEquip)){ |
| | | List<InspectionOrderDetail> inspectionOrderDetailList = inspectionOrder.getInspectionOrderDetailList(); |
| | | for (InspectionOrderDetail inspectionOrderDetail : inspectionOrderDetailList) { |
| | | String inspectionStandardDetailId = inspectionOrderDetail.getInspectionStandardDetailId(); |
| | | String inspectionProjectId = inspectionOrderDetail.getInspectionProjectId(); |
| | | |
| | | DailyInspectionStandardDetail dailyInspectionStandardDetail = dailyInspectionStandardDetailService.getById(inspectionStandardDetailId); |
| | | InspectionProject inspectionProject = inspectionProjectService.getById(inspectionProjectId); |
| | | DailyInspectionStandardDetail dailyInspectionStandardDetail = dailyInspectionStandardDetailService.getById(inspectionStandardDetailId); |
| | | InspectionProject inspectionProject = inspectionProjectService.getById(inspectionProjectId); |
| | | |
| | | inspectionOrderDetail.setId(""); |
| | | inspectionOrderDetail.setInspectionOrderId(id); |
| | | inspectionOrderDetail.setLocation(dailyInspectionStandardDetail.getLocation()); |
| | | inspectionOrderDetail.setInspectionMethod(inspectionProject.getInspectionMethod()); |
| | | inspectionOrderDetail.setInspectionTool(inspectionProject.getInspectionTool()); |
| | | inspectionOrderDetail.setAnalysisMethod(inspectionProject.getAnalysisMethod()); |
| | | inspectionOrderDetail.setTestValueType(inspectionProject.getTestValueType()); |
| | | inspectionOrderDetail.setDetectionStandard(inspectionProject.getDetectionStandard()); |
| | | inspectionOrderDetail.setAcceptabilityLimit(inspectionProject.getAcceptabilityLimit()); |
| | | inspectionOrderDetail.setId(""); |
| | | inspectionOrderDetail.setInspectionOrderId(id); |
| | | inspectionOrderDetail.setLocation(dailyInspectionStandardDetail.getLocation()); |
| | | inspectionOrderDetail.setInspectionMethod(inspectionProject.getInspectionMethod()); |
| | | inspectionOrderDetail.setInspectionTool(inspectionProject.getInspectionTool()); |
| | | inspectionOrderDetail.setAnalysisMethod(inspectionProject.getAnalysisMethod()); |
| | | inspectionOrderDetail.setTestValueType(inspectionProject.getTestValueType()); |
| | | inspectionOrderDetail.setDetectionStandard(inspectionProject.getDetectionStandard()); |
| | | inspectionOrderDetail.setAcceptabilityLimit(inspectionProject.getAcceptabilityLimit()); |
| | | |
| | | inspectionOrderDetailService.save(inspectionOrderDetail); |
| | | inspectionOrderDetailService.save(inspectionOrderDetail); |
| | | } |
| | | }else{ |
| | | String lineId = equipment.getLineId(); |
| | | List<DailyInspectionStandard> dailyInspectionStandards = dailyInspectionStandardService.lambdaQuery() |
| | | .eq(DailyInspectionStandard::getEquipmentId, lineId) |
| | | .eq(DailyInspectionStandard::getVersionStatus, "2") |
| | | .eq(DailyInspectionStandard::getDelFlag, "0").list(); |
| | | if(dailyInspectionStandards.size()>0) { |
| | | DailyInspectionStandard dailyInspectionStandard = dailyInspectionStandards.get(0); |
| | | //保存点检工单子表数据 |
| | | List<DailyInspectionStandardDetail> dailyInspectionStandardDetailList = dailyInspectionStandardDetailService.lambdaQuery() |
| | | .eq(DailyInspectionStandardDetail::getDailyInspectionStandardId,dailyInspectionStandard.getId()) |
| | | .eq(DailyInspectionStandardDetail::getInspectionCycleId,inspectionOrder.getInspectionCycleId()) |
| | | .eq(DailyInspectionStandardDetail::getDelFlag,"0").list(); |
| | | for(DailyInspectionStandardDetail dailyInspectionStandardDetail : dailyInspectionStandardDetailList){ |
| | | String inspectionProjectId = dailyInspectionStandardDetail.getInspectionProjectId(); |
| | | |
| | | InspectionOrderDetail inspectionOrderDetail = new InspectionOrderDetail(); |
| | | inspectionOrderDetail.setInspectionOrderId(inspectionOrder.getId()); |
| | | inspectionOrderDetail.setInspectionProjectId(inspectionProjectId); |
| | | inspectionOrderDetail.setInspectionStandardDetailId(dailyInspectionStandardDetail.getId()); |
| | | inspectionOrderDetail.setLocation(dailyInspectionStandardDetail.getLocation()); |
| | | inspectionOrderDetail.setPhoto(dailyInspectionStandardDetail.getPhoto()); |
| | | InspectionProject inspectionProject = inspectionProjectService.getById(inspectionProjectId); |
| | | if(inspectionProject != null){ |
| | | inspectionOrderDetail.setDetectionStandard(inspectionProject.getDetectionStandard()); |
| | | } |
| | | inspectionOrderDetailService.save(inspectionOrderDetail); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | String inspectionUserId = inspectionOrder.getInspectionUserId(); |
| | |
| | | |
| | | @RequestMapping(value = "/editStatus", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<String> editStatus(@RequestBody InspectionOrder inspectionOrder) { |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String status = inspectionOrder.getStatus(); |
| | | if("6".equals(status)){ |
| | | inspectionOrder.setInspectionOrderUda1(sysUser.getRealname()); |
| | | inspectionOrder.setRepairConfirmDate(new Date()); |
| | | } |
| | | boolean b = inspectionOrderService.updateById(inspectionOrder); |
| | | if (b) { |
| | | return Result.OK("下发成功!"); |
| | |
| | | String status = order.getStatus(); |
| | | if ("5".equals(status)) { |
| | | |
| | | List<InspectionOrderDetail> inspectionOrderDetails = inspectionOrderDetailService.lambdaQuery() |
| | | .eq(InspectionOrderDetail::getInspectionOrderId, id) |
| | | .eq(InspectionOrderDetail::getDelFlag, 0).list(); |
| | | |
| | | ArrayList<String> strings = new ArrayList<>(); |
| | | for (InspectionOrderDetail inspectionOrderDetail : inspectionOrderDetails) { |
| | | strings.add(inspectionOrderDetail.getId()); |
| | | } |
| | | // List<InspectionOrderDetail> inspectionOrderDetails = inspectionOrderDetailService.lambdaQuery() |
| | | // .eq(InspectionOrderDetail::getInspectionOrderId, id) |
| | | // .eq(InspectionOrderDetail::getDelFlag, 0).list(); |
| | | // |
| | | // ArrayList<String> strings = new ArrayList<>(); |
| | | // for (InspectionOrderDetail inspectionOrderDetail : inspectionOrderDetails) { |
| | | // strings.add(inspectionOrderDetail.getId()); |
| | | // } |
| | | List<EquipmentReportRepair> equipmentReportRepairs = equipmentReportRepairService.lambdaQuery() |
| | | .in(EquipmentReportRepair::getSourceId, strings) |
| | | .eq(EquipmentReportRepair::getSourceId, id) |
| | | .eq(EquipmentReportRepair::getDelFlag, 0).list(); |
| | | |
| | | if(equipmentReportRepairs.size()>0){ |
| | |
| | | |
| | | @RequestMapping(value = "/report", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<String> report(@RequestBody InspectionOrder inspectionOrder) { |
| | | // LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | // String userId = sysUser.getId(); |
| | | // inspectionOrder.setInspectionUserId(userId); |
| | | List<InspectionOrderDetail> inspectionOrderDetailList = inspectionOrder.getInspectionOrderDetailList(); |
| | | boolean flag = false; |
| | | String num = ""; |
| | | for (InspectionOrderDetail orderDetail : inspectionOrderDetailList) { |
| | | inspectionOrderDetailService.updateById(orderDetail); |
| | | |
| | | String treatmentMeasure = orderDetail.getTreatmentMeasure();//1:自行处置 2: 故障报修 |
| | | if ("2".equals(treatmentMeasure)) { |
| | | if(flag == true){ |
| | | continue; |
| | | } |
| | | EquipmentReportRepair equipmentReportRepair = new EquipmentReportRepair(); |
| | | equipmentReportRepair.setNum("RCNum001"); |
| | | num = sysIdentityService.getNumByTypeAndLength("EquipmentReportRepair", 4); |
| | | equipmentReportRepair.setNum(num); |
| | | equipmentReportRepair.setStatus("1"); |
| | | equipmentReportRepair.setSource("2"); |
| | | equipmentReportRepair.setType("2");//类型(1被动报修,2主动报修) |
| | | equipmentReportRepair.setIsCreateOrder(0); |
| | | equipmentReportRepair.setEquipmentId(inspectionOrder.getEquipmentId()); |
| | | equipmentReportRepair.setFaultDescription(orderDetail.getAbnormalDesc()); |
| | | equipmentReportRepair.setFaultTime(new Date(System.currentTimeMillis())); |
| | | equipmentReportRepair.setIsStop("1"); |
| | | equipmentReportRepair.setStatus("1"); |
| | | equipmentReportRepair.setSource("2"); |
| | | equipmentReportRepair.setSourceId(orderDetail.getId()); |
| | | equipmentReportRepair.setSourceId(inspectionOrder.getId()); |
| | | equipmentReportRepair.setErrUda1("no"); |
| | | equipmentReportRepair.setErrUda2(sysUser.getRealname()); |
| | | equipmentReportRepairService.save(equipmentReportRepair); |
| | | flag = true; |
| | | } |
| | | } |
| | | inspectionOrder.setActualEndTime(new Date()); |
| | | inspectionOrder.setInspectionOrderUda2(sysUser.getRealname()); |
| | | boolean b = inspectionOrderService.updateById(inspectionOrder); |
| | | if (!b) { |
| | | return Result.error("报工失败!"); |
| | | } else { |
| | | if(flag){ |
| | | return Result.ok("点检结果异常,已自动生成故障报修单,单号为"+num+"!"); |
| | | }else{ |
| | | return Result.ok("报工成功!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/normalReport", method = {RequestMethod.PUT, RequestMethod.POST}) |
| | | public Result<String> normalReport(@RequestBody InspectionOrder inspectionOrder) { |
| | | List<InspectionOrderDetail> inspectionOrderDetailList = inspectionOrder.getInspectionOrderDetailList(); |
| | | for (InspectionOrderDetail orderDetail : inspectionOrderDetailList) { |
| | | orderDetail.setInspectionProjectResult("1"); |
| | | inspectionOrderDetailService.updateById(orderDetail); |
| | | } |
| | | inspectionOrder.setActualEndTime(new Date()); |
| | | boolean b = inspectionOrderService.updateById(inspectionOrder); |
| | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | *生产设备自主维护点检表 报表 |
| | | * 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> mapResult = new HashMap<>(); |
| | | |
| | | String equipmentNum = (String)params.get("num"); |
| | | String dataTime = (String)params.get("dataTime"); |
| | | Equipment equipment = equipmentService.getOne(new LambdaQueryWrapper<Equipment>().eq(Equipment::getNum, equipmentNum).eq(Equipment::getDelFlag, 0)); |
| | | if(equipment == null){ |
| | | return Result.error("设备统一编号不存在!"); |
| | | } |
| | | String workCenterId = equipment.getWorkCenterId(); |
| | | Area area = areaService.getById(workCenterId); |
| | | |
| | | DailyInspectionStandard standard = dailyInspectionStandardService.getOne(new LambdaQueryWrapper<DailyInspectionStandard>() |
| | | .eq(DailyInspectionStandard::getEquipmentId, equipment.getId()) |
| | | .eq(DailyInspectionStandard::getDelFlag, 0) |
| | | .eq(DailyInspectionStandard::getVersion, "2")); |
| | | |
| | | |
| | | |
| | | List<Map<String, Object>> list1 = this.getInspectionStandars(equipmentNum,"day",dataTime); |
| | | List<Map<String, Object>> list2 = this.getUserQianzi(equipmentNum,"day",dataTime); |
| | | List<Map<String, Object>> list3 = this.getCheckUserQianzi(equipmentNum,"day",dataTime); |
| | | List<Map<String, Object>> list4 = this.getInspectionStandars(equipmentNum, "week",dataTime); |
| | | List<Map<String, Object>> list5 = this.getUserQianzi(equipmentNum,"week",dataTime); |
| | | List<Map<String, Object>> list6 = this.getCheckUserQianzi(equipmentNum,"week",dataTime); |
| | | |
| | | mapResult.put("equipentNum",equipment.getNum()); |
| | | mapResult.put("equipentName",equipment.getName()); |
| | | mapResult.put("equipmentModel",equipment.getModel()); |
| | | mapResult.put("equipmentModel",equipment.getModel()); |
| | | if(area != null){ |
| | | mapResult.put("workCenterName",area.getName()); |
| | | } |
| | | mapResult.put("regulations",standard.getDisUda1()); |
| | | |
| | | mapResult.put("list1",list1); |
| | | mapResult.put("list2",list2); |
| | | mapResult.put("list3",list3); |
| | | mapResult.put("list4",list4); |
| | | mapResult.put("list5",list5); |
| | | mapResult.put("list6",list6); |
| | | |
| | | return Result.ok(mapResult); |
| | | } |
| | | |
| | | List<Map<String, Object>> getInspectionStandars(String equipmentNum,String cycleUnit,String dataTime){ |
| | | List<Map<String, Object>> maps = new ArrayList<>(); |
| | | List<Map<String, Object>> dayInspectionStandard = inspectionOrderService.findDayInspectionStandard(equipmentNum,cycleUnit); |
| | | 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(equipmentNum,name, detectionStandard,dataTime); |
| | | List<InspectionResultVo> listS = new ArrayList<>(); |
| | | 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; |
| | | InspectionResultVo inspectionResultVo = new InspectionResultVo(); |
| | | inspectionResultVo.setDayTime((String)r.get("dayTime")); |
| | | inspectionResultVo.setWeekOfMonth((Integer)r.get("weekOfMonth")); |
| | | inspectionResultVo.setInsResult((String)r.get("insResult")); |
| | | listS.add(inspectionResultVo); |
| | | |
| | | map1.put("dataList",listS); |
| | | |
| | | } |
| | | } |
| | | 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")); |
| | | InspectionResultVo inspectionResultVo = new InspectionResultVo(); |
| | | inspectionResultVo.setDayTime((String)r.get("dayTime")); |
| | | inspectionResultVo.setWeekOfMonth((Integer)r.get("weekOfMonth")); |
| | | inspectionResultVo.setInsResult((String)r.get("insResult")); |
| | | listS.add(inspectionResultVo); |
| | | |
| | | hashMap.put("dataList",listS);//---- |
| | | 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")); |
| | | |
| | | InspectionResultVo inspectionResultVo = new InspectionResultVo(); |
| | | inspectionResultVo.setDayTime((String)r.get("dayTime")); |
| | | inspectionResultVo.setInsResult((String)r.get("insResult")); |
| | | inspectionResultVo.setWeekOfMonth((Integer)r.get("weekOfMonth")); |
| | | listS.add(inspectionResultVo); |
| | | hashMap.put("dataList",listS); |
| | | |
| | | maps.add(hashMap); |
| | | } |
| | | } |
| | | } |
| | | return maps; |
| | | } |
| | | |
| | | List<Map<String, Object>> getUserQianzi(String equipmentNum,String cycleUnit,String dataTime){ |
| | | List<Map<String, Object>> maps2 = new ArrayList<>(); |
| | | List<InspectionResultVo> listIn = new ArrayList<>(); |
| | | List<Map<String, Object>> userQianZi = inspectionOrderService.getUserQianZi(equipmentNum,cycleUnit,dataTime); |
| | | 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; |
| | | InspectionResultVo inspectionResultVo = new InspectionResultVo(); |
| | | inspectionResultVo.setDayTime((String)map.get("dayTime")); |
| | | inspectionResultVo.setInspectionUserName((String)map.get("inspectionUserName")); |
| | | inspectionResultVo.setWeekOfMonth((Integer)map.get("weekOfMonth")); |
| | | listIn.add(inspectionResultVo); |
| | | |
| | | map1.put("dataList",listIn); |
| | | } |
| | | } |
| | | if(flag == false){ |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("inspectionUserName","维护责任人签字"); |
| | | // hashMap.put(map.get("dayTime").toString(),map.get("inspectionUserName")); |
| | | // maps2.add(hashMap); |
| | | InspectionResultVo inspectionResultVo = new InspectionResultVo(); |
| | | inspectionResultVo.setDayTime((String)map.get("dayTime")); |
| | | inspectionResultVo.setInspectionUserName((String)map.get("inspectionUserName")); |
| | | inspectionResultVo.setWeekOfMonth((Integer)map.get("weekOfMonth")); |
| | | listIn.add(inspectionResultVo); |
| | | hashMap.put("dataList",listIn);//--- |
| | | hashMap.put("dataList",listIn); |
| | | } |
| | | }else{ |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("inspectionUserName","维护责任人签字"); |
| | | // hashMap.put(map.get("dayTime").toString(),map.get("inspectionUserName")); |
| | | // maps2.add(hashMap); |
| | | InspectionResultVo inspectionResultVo = new InspectionResultVo(); |
| | | inspectionResultVo.setDayTime((String)map.get("dayTime")); |
| | | inspectionResultVo.setInspectionUserName((String)map.get("inspectionUserName")); |
| | | inspectionResultVo.setWeekOfMonth((Integer)map.get("weekOfMonth")); |
| | | listIn.add(inspectionResultVo); |
| | | hashMap.put("dataList",listIn); |
| | | |
| | | maps2.add(hashMap); |
| | | } |
| | | } |
| | | return maps2; |
| | | } |
| | | |
| | | List<Map<String, Object>> getCheckUserQianzi(String num,String cycleUnit,String dataTime){ |
| | | List<Map<String, Object>> maps3 = new ArrayList<>(); |
| | | List<InspectionResultVo> listRe = new ArrayList<>(); |
| | | List<Map<String, Object>> checkUserQianZi = inspectionOrderService.getUserQianZi(num,cycleUnit,dataTime); |
| | | for (Map<String, Object> map : checkUserQianZi) { |
| | | if(maps3.size()>0){ |
| | | Boolean flag = false; |
| | | for (Map<String, Object> map1 : maps3) { |
| | | if(map1.containsValue("检查责任人签字")){ |
| | | // map1.put(map.get("dayTime").toString(),map.get("repairConfirmPerson")); |
| | | InspectionResultVo inspectionResultVo = new InspectionResultVo(); |
| | | inspectionResultVo.setDayTime((String)map.get("dayTime")); |
| | | inspectionResultVo.setRepairConfirmPerson((String)map.get("repairConfirmPerson")); |
| | | inspectionResultVo.setWeekOfMonth((Integer)map.get("weekOfMonth")); |
| | | listRe.add(inspectionResultVo); |
| | | |
| | | map1.put("dataList",listRe); |
| | | flag = true; |
| | | } |
| | | } |
| | | if(flag == false){ |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("repairConfirmPerson","检查责任人签字"); |
| | | // hashMap.put(map.get("dayTime").toString(),map.get("repairConfirmPerson")); |
| | | // maps3.add(hashMap); |
| | | InspectionResultVo inspectionResultVo = new InspectionResultVo(); |
| | | inspectionResultVo.setDayTime((String)map.get("dayTime")); |
| | | inspectionResultVo.setRepairConfirmPerson((String)map.get("repairConfirmPerson")); |
| | | inspectionResultVo.setWeekOfMonth((Integer)map.get("weekOfMonth")); |
| | | listRe.add(inspectionResultVo); |
| | | hashMap.put("dataList",listRe); |
| | | |
| | | maps3.add(hashMap);//--- |
| | | } |
| | | }else{ |
| | | HashMap<String, Object> hashMap = new HashMap<>(); |
| | | hashMap.put("repairConfirmPerson","检查责任人签字"); |
| | | // hashMap.put(map.get("dayTime").toString(),map.get("repairConfirmPerson")); |
| | | // maps3.add(hashMap); |
| | | InspectionResultVo inspectionResultVo = new InspectionResultVo(); |
| | | inspectionResultVo.setDayTime((String)map.get("dayTime")); |
| | | inspectionResultVo.setRepairConfirmPerson((String)map.get("repairConfirmPerson")); |
| | | inspectionResultVo.setWeekOfMonth((Integer)map.get("weekOfMonth")); |
| | | listRe.add(inspectionResultVo); |
| | | hashMap.put("dataList",listRe); |
| | | |
| | | maps3.add(hashMap); |
| | | } |
| | | } |
| | | return maps3; |
| | | } |
| | | } |