| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.dto.message.MessageDTO; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.PermissionData; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.api.ISysBaseAPI; |
| | | import org.jeecg.common.system.base.entity.SysUpload; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.base.entity.Constructor; |
| | | import org.jeecg.modules.base.service.IConstructorService; |
| | | import org.jeecg.modules.base.service.IFactoryModelService; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.model.DepartVo; |
| | | import org.jeecg.modules.eam.service.*; |
| | |
| | | |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | |
| | | import org.jeecg.modules.system.entity.SysDepart; |
| | | import org.jeecg.modules.system.service.ISysDepartService; |
| | | import org.jeecgframework.poi.excel.ExcelImportUtil; |
| | | import org.jeecgframework.poi.excel.entity.ImportParams; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Autowired |
| | | private IProcessParametersTemplateDetailService processParametersTemplateDetailService; |
| | | |
| | | @Autowired |
| | | @Autowired |
| | | private IEquipmentProcessParametersService equipmentProcessParametersService; |
| | | |
| | | @Autowired |
| | | @Autowired |
| | | private IEquipmentPrecisionParametersService equipmentPrecisionParametersService; |
| | | |
| | | @Autowired |
| | |
| | | |
| | | @Autowired |
| | | private IProcessParametersTemplateService processParametersTemplateService; |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private ISysBaseAPI sysBaseApi; |
| | |
| | | |
| | | @Autowired |
| | | private IEquipmentCategoryService equipmentCategoryService; |
| | | |
| | | @Autowired |
| | | private ISysDepartService departService; |
| | | |
| | | @Autowired |
| | | private ITeamService teamService; |
| | | |
| | | @Autowired |
| | | private IConstructorService constructorService; |
| | | |
| | | @Autowired |
| | | private IAreaService areaService; |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | | * |
| | |
| | | if(StringUtils.isNotBlank(equipment.getEquipmentCategoryId())){ |
| | | queryWrapper.eq("equipment_category_id",equipment.getEquipmentCategoryId()); |
| | | } |
| | | |
| | | queryWrapper.isNull("line_id"); |
| | | queryWrapper.eq("status","1"); |
| | | queryWrapper.eq("del_flag",0); |
| | | queryWrapper.orderByDesc("create_time"); |
| | |
| | | * 设备保修 获取设备列表组件 |
| | | * qsw 2023-7-14 |
| | | */ |
| | | |
| | | @GetMapping(value = "/getEquipmentList") |
| | | @PermissionData |
| | | public Result<IPage<Equipment>> getEquipmentList(Equipment equipment, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<Equipment> queryWrapper = QueryGenerator.initQueryWrapper(equipment, req.getParameterMap()); |
| | | // queryWrapper.eq("status","1"); |
| | | // queryWrapper.eq("del_flag",0); |
| | | Page<Equipment> page = new Page<Equipment>(pageNo, pageSize); |
| | | IPage<Equipment> pageList = equipmentService.page(page, queryWrapper); |
| | | IPage<Equipment> pageList = equipmentService.getEquipmentList(page, equipment); |
| | | return Result.OK(pageList); |
| | | } |
| | | |
| | |
| | | @DeleteMapping(value = "/delete") |
| | | public Result<String> delete(@RequestParam(name="id",required=true) String id) { |
| | | Equipment equipment = equipmentService.getById(id); |
| | | equipmentService.update(new UpdateWrapper<Equipment>().eq("line_id",id).set("line_id",null).set("is_meta",null)); |
| | | equipment.setDelFlag(1); |
| | | equipmentService.updateById(equipment); |
| | | return Result.OK("删除成功!"); |
| | |
| | | @GetMapping(value = "/getResumeCalibrationRecordList") |
| | | public Result<?> getResumeCalibrationRecordList(@RequestParam("pageNo") Integer pageNo, @RequestParam("pageSize") Integer pageSize, @RequestParam Map<String, Object> params) { |
| | | IPage<Map<String, Object>> resumeCalibrationRecordList = equipmentService.getResumeCalibrationRecordList(pageNo, pageSize, params); |
| | | for (Map<String, Object> record : resumeCalibrationRecordList.getRecords()) { |
| | | String id = (String)record.get("id"); |
| | | String status = (String)record.get("status"); |
| | | String managementMode = (String)record.get("managementMode"); |
| | | if("4".equals(status)){ |
| | | if("data".equals(managementMode)){ |
| | | List<CalibrationOrderDetail> calibrationOrderDetails = calibrationOrderDetailService.lambdaQuery() |
| | | .eq(CalibrationOrderDetail::getCalibrationOrderId, id) |
| | | .eq(CalibrationOrderDetail::getJudgmentResult, "fail") |
| | | .eq(CalibrationOrderDetail::getDelFlag,"0").list(); |
| | | if(calibrationOrderDetails.size()>0){ |
| | | record.put("calibrationResult","异常"); |
| | | }else{ |
| | | record.put("calibrationResult","正常常"); |
| | | } |
| | | }else{ |
| | | List<CalibrationOrderReport> calibrationOrderReports = calibrationOrderReportService.lambdaQuery() |
| | | .eq(CalibrationOrderReport::getCalibrationOrderId, id) |
| | | .eq(CalibrationOrderReport::getJudgmentResult, "fail") |
| | | .eq(CalibrationOrderReport::getDelFlag, "0").list(); |
| | | if(calibrationOrderReports.size()>0){ |
| | | record.put("calibrationResult","异常"); |
| | | }else{ |
| | | record.put("calibrationResult","正常常"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // for (Map<String, Object> record : resumeCalibrationRecordList.getRecords()) { |
| | | // String id = (String)record.get("id"); |
| | | // String status = (String)record.get("status"); |
| | | // String managementMode = (String)record.get("managementMode"); |
| | | // if("4".equals(status)){ |
| | | // if("data".equals(managementMode)){ |
| | | // List<CalibrationOrderDetail> calibrationOrderDetails = calibrationOrderDetailService.lambdaQuery() |
| | | // .eq(CalibrationOrderDetail::getCalibrationOrderId, id) |
| | | // .eq(CalibrationOrderDetail::getJudgmentResult, "fail") |
| | | // .eq(CalibrationOrderDetail::getDelFlag,"0").list(); |
| | | // if(calibrationOrderDetails.size()>0){ |
| | | // record.put("calibrationResult","异常"); |
| | | // }else{ |
| | | // record.put("calibrationResult","正常常"); |
| | | // } |
| | | // }else{ |
| | | // List<CalibrationOrderReport> calibrationOrderReports = calibrationOrderReportService.lambdaQuery() |
| | | // .eq(CalibrationOrderReport::getCalibrationOrderId, id) |
| | | // .eq(CalibrationOrderReport::getJudgmentResult, "fail") |
| | | // .eq(CalibrationOrderReport::getDelFlag, "0").list(); |
| | | // if(calibrationOrderReports.size()>0){ |
| | | // record.put("calibrationResult","异常"); |
| | | // }else{ |
| | | // record.put("calibrationResult","正常常"); |
| | | // } |
| | | // } |
| | | // } |
| | | // } |
| | | return Result.ok(resumeCalibrationRecordList); |
| | | } |
| | | |
| | |
| | | queryWrapper.in("equipment_status",statusList); |
| | | IPage<Equipment> pageList = equipmentService.page(page, queryWrapper); |
| | | return Result.OK(pageList); |
| | | }/** |
| | | } |
| | | /** |
| | | * 导入 |
| | | * @return |
| | | */ |
| | | @RequestMapping(value = "/importExcel", method = RequestMethod.POST) |
| | | @Transactional(rollbackFor = Exception.class) |
| | | //工区、型号、设备状态、技术状态、ABC标识有空值;维护部门、维修班组为编码需要有对照值。 |
| | | public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) { |
| | | MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; |
| | | LoginUser user= (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | |
| | | try { |
| | | List<EquipmentImportVo> list = ExcelImportUtil.importExcel(file.getInputStream(), EquipmentImportVo.class, params); |
| | | for(int i = 0;i<list.size();i++){ |
| | | Equipment equipment = new Equipment(); |
| | | EquipmentImportVo equipmentImportVo = list.get(i); |
| | | EquipmentCategory equipmentCategory = equipmentCategoryService.getOne(new QueryWrapper<EquipmentCategory>().eq("name",equipmentImportVo.getEquipmentCategoryName()),false); |
| | | String equipmentCategoryName = equipmentImportVo.getEquipmentCategoryName(); |
| | | String useId = equipmentImportVo.getUseId(); |
| | | String areaId = equipmentImportVo.getFactoryModelId(); |
| | | String manageId = equipmentImportVo.getManageId(); |
| | | String constructorId = equipmentImportVo.getConstructorId(); |
| | | String teamId = equipmentImportVo.getTeamId(); |
| | | String propertyStatus = equipmentImportVo.getPropertyStatus(); |
| | | String abc = equipmentImportVo.getEquipmentImportanceId(); |
| | | if(StringUtils.isBlank(equipmentImportVo.getNum())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:统一编码缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getName())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备名称缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getUseId())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:使用部门缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getEquipmentUda1())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:工区缺失,请填写必填项后再导入;"; |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getEquipmentImportanceId())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:ABC标识缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // continue; |
| | | // } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getManageId())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:维护部门缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getTeamId())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:维修班组缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getEquipmentImportanceId())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:ABC标识缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getEquipmentCategoryName())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备分类缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getEquipmentStatus())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备状态缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getTechnologyStatus())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备技术缺失,请填写必填项后再导入;"; |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:技术状态缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getFactoryModelId())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:车间缺失,请填写必填项后再导入;"; |
| | | else if(StringUtils.isBlank(equipmentImportVo.getModel())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备型号缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getWorkCenterId())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:产线缺失,请填写必填项后再导入;"; |
| | | else if(StringUtils.isBlank(useId)){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:使用部门缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(ObjectUtils.isNotNull(equipmentImportVo.getWarrantyStart())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:质保开始日期缺失,请填写必填项后再导入;"; |
| | | else if(StringUtils.isBlank(areaId)){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:工区缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getPropertyStatus())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:资产状态缺失,请填写必填项后再导入;"; |
| | | else if(StringUtils.isBlank(manageId)){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:维护部门缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | //非必填项 |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getEquipmentUda5())){ |
| | | else if(StringUtils.isBlank(equipmentCategoryName)){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备分类缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | else if(StringUtils.isBlank(teamId)){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:维修班组缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | //非必填项 |
| | | // else if(ObjectUtils.isNotNull(equipmentImportVo.getWarrantyStart())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:质保开始日期缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getPropertyStatus())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:资产状态缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getEquipmentUda5())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:功能位置缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getLocation())){ |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getLocation())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:安装位置缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getLeaveFactoryDate())){ |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getLeaveFactoryDate())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:出厂日期缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getProjectApprovalNo())){ |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getProjectApprovalNo())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:立项卡号缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getFundSource())){ |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getFundSource())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:资金来源缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getAcceptanceCheckDate())){ |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getAcceptanceCheckDate())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:验收日期缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getLeaveFactoryDate())){ |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getLeaveFactoryDate())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:出厂日期缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getFactoryNo())){ |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getFactoryNo())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:出厂编号缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if( StringUtils.isBlank(equipmentImportVo.getConstructorId())){ |
| | | // else if( StringUtils.isBlank(equipmentImportVo.getConstructorId())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:资产制造商缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getModel())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备型号缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | } |
| | | else if(StringUtils.isBlank(equipmentImportVo.getSpecification())){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备规格缺失,请填写必填项后再导入;"; |
| | | exceptionNum++; |
| | | } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getSpecification())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备规格缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | // else if(StringUtils.isBlank(equipmentImportVo.getGpo())){ |
| | | // exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:设备功率缺失,请填写必填项后再导入;"; |
| | | // exceptionNum++; |
| | | // } |
| | | else if(ObjectUtils.isNull(equipmentCategory)) |
| | | { |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:该设备所属类别不存在,请先维护设备类别;"; |
| | | exceptionNum++; |
| | | } |
| | | else{ |
| | | if(equipmentImportVo.getPropertyStatus().equals("warranty")){ |
| | | SysDepart use = departService.getOne(new QueryWrapper<SysDepart>().eq("depart_name",useId.trim()).eq("del_flag",0),false); |
| | | if(ObjectUtils.isNotNull(use)){ |
| | | equipment.setUseId(use.getId()); |
| | | }else { |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:不存在该使用部门,请维护部门数据后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | Area area = areaService.getOne(new QueryWrapper<Area>().eq("name",areaId.trim()).eq("del_flag",0)); |
| | | Area area1 = areaService.getOne(new QueryWrapper<Area>().eq("num",areaId.trim()).eq("del_flag",0)); |
| | | if(ObjectUtils.isNotNull(area)){ |
| | | equipment.setFactoryModelId(area.getId()); |
| | | }else if(ObjectUtils.isNotNull(area1)) { |
| | | equipment.setFactoryModelId(area1.getId()); |
| | | }else { |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:不存在该工区,请维护工区数据后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | SysDepart manage = departService.getOne(new QueryWrapper<SysDepart>().eq("depart_name",manageId.trim()).eq("del_flag",0)); |
| | | if(ObjectUtils.isNotNull(manage)){ |
| | | equipment.setManageId(manage.getId()); |
| | | }else{ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:不存在该维护部门,请先维护部门数据后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | EquipmentCategory equipmentCategory = equipmentCategoryService |
| | | .getOne(new QueryWrapper<EquipmentCategory>() |
| | | .eq("name",equipmentCategoryName.trim()).eq("del_flag",0),false); |
| | | if(ObjectUtils.isNotNull(equipmentCategory)){ |
| | | equipment.setEquipmentCategoryId(equipmentCategory.getId()); |
| | | } |
| | | else { |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:不存在该设备分类,请先维护设备分类数据后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | Team team = teamService.getOne(new QueryWrapper<Team>().eq("name",teamId.trim()).eq("del_flag",0),false); |
| | | Team team1 = teamService.getOne(new QueryWrapper<Team>().eq("num",teamId.trim()).eq("del_flag",0),false); |
| | | if(ObjectUtils.isNotNull(team)){ |
| | | equipment.setTeamId(team.getId()); |
| | | }else if(ObjectUtils.isNotNull(team1)) { |
| | | equipment.setTeamId(team1.getId()); |
| | | }else { |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:不存在该班组,请先维护班组数据后再导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | if(StringUtils.isNotBlank(constructorId)){ |
| | | Constructor constructor = constructorService.getByName(constructorId.trim()); |
| | | if(ObjectUtils.isNotNull(constructor)){ |
| | | equipment.setConstructorId(constructor.getId()); |
| | | }else { |
| | | constructor = new Constructor(); |
| | | constructor.setName(constructorId); |
| | | constructor.setDelFlag(0); |
| | | constructorService.save(constructor); |
| | | equipment.setConstructorId(constructor.getId()); |
| | | } |
| | | } |
| | | if(StringUtils.isNotBlank(propertyStatus)&&propertyStatus.equals("warranty")){ |
| | | if( |
| | | ObjectUtils.isNull(equipmentImportVo.getWarrantyStart()) |
| | | ||ObjectUtils.isNull(equipmentImportVo.getWarrantyEnd()) |
| | | ){ |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:该设备处于质保期,质保信息缺失,请先维护质保开始时间或结束时间;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | |
| | | }else{ |
| | | Equipment oriEquipment = equipmentService.getOne(new QueryWrapper<Equipment>().eq("num",equipmentImportVo.getNum()),false); |
| | | Equipment oriEquipment = equipmentService |
| | | .getOne(new QueryWrapper<Equipment>() |
| | | .eq("num",equipmentImportVo.getNum()).eq("del_flag",0),false); |
| | | if(ObjectUtils.isNull(oriEquipment)){ |
| | | Equipment equipment = new Equipment(); |
| | | equipment.setNum(equipmentImportVo.getNum()) |
| | | .setName(equipmentImportVo.getName()) |
| | | .setUseId(equipmentImportVo.getUseId()) |
| | | .setEquipmentUda1(equipmentImportVo.getEquipmentUda1()) |
| | | .setManageId(equipmentImportVo.getManageId()) |
| | | .setTeamId(equipmentImportVo.getTeamId()) |
| | | .setTechnologyStatus(equipmentImportVo.getTechnologyStatus()) |
| | | .setEquipmentImportanceId(equipmentImportVo.getEquipmentImportanceId()) |
| | | .setEquipmentCategoryId(equipmentCategory.getId()) |
| | | .setSpecificEquipment(equipmentImportVo.getKeyEquipmentIdentification()) |
| | | .setSecurityConfiguration(equipmentImportVo.getSecurityConfiguration()) |
| | | .setCoolingSystem(equipmentImportVo.getCoolingSystem()) |
| | | .setFireExtinguisher(equipmentImportVo.getFireExtinguisher()) |
| | | .setFireExtinguisherValidityPeriod(equipmentImportVo.getFireExtinguisherValidityPeriod()) |
| | | .setOperatingSystem(equipmentImportVo.getOperatingSystem()) |
| | | .setSystem(equipmentImportVo.getSystem()) |
| | | .setPort(equipmentImportVo.getPort()) |
| | | .setCoordinateNum(equipmentImportVo.getCoordinateNum()) |
| | |
| | | .setFundSource(equipmentImportVo.getFundSource()) |
| | | .setAcceptanceCheckDate(equipmentImportVo.getAcceptanceCheckDate()) |
| | | .setFactoryNumber(equipmentImportVo.getFactoryNumber()) |
| | | .setConstructorId(equipmentImportVo.getConstructorId()) |
| | | .setSourceCountry(equipmentImportVo.getSourceCountry()) |
| | | .setModel(equipmentImportVo.getModel()) |
| | | .setSpecification(equipmentImportVo.getSpecification()) |
| | | .setFactoryModelId(equipmentImportVo.getFactoryModelId()) |
| | | .setWorkCenterId(equipmentImportVo.getWorkCenterId()) |
| | | .setPropertyStatus(equipmentImportVo.getPropertyStatus()) |
| | | .setWarrantyStart(equipmentImportVo.getWarrantyStart()) |
| | | .setWarrantyEnd(equipmentImportVo.getWarrantyEnd()) |
| | | .setIsLineEquip("no") |
| | | .setIsLine("no") |
| | | .setNextTechnologyStatusQualificationTime(equipmentImportVo.getNextTechnologyStatusQualificationTime()) |
| | | .setGpo(equipmentImportVo.getGpo()); |
| | | if(equipmentCategory.getEquipmentCategoryUda1().equals("weldingMachine")){ |
| | | equipment.setCheckPeriod(365*3+""); |
| | | } |
| | | if(equipmentCategory.getEquipmentCategoryUda1().equals("filesCarousel")){ |
| | | equipment.setCheckPeriod(365*4+""); |
| | | } |
| | | if(equipmentCategory.getEquipmentCategoryUda1().equals("tester")){ |
| | | equipment.setCheckPeriod(365*1+""); |
| | | } |
| | | if( |
| | | !equipmentCategory.getEquipmentCategoryUda1().equals("weldingMachine") |
| | | &&!equipmentCategory.getEquipmentCategoryUda1().equals("filesCarousel") |
| | | &&!equipmentCategory.getEquipmentCategoryUda1().equals("tester") |
| | | ){ |
| | | if(StringUtils.isNotBlank(abc)){ |
| | | if(abc.equals("A")){ |
| | | equipment.setCheckPeriod(365*3+""); |
| | | } |
| | | if( |
| | | abc.equals("B") |
| | | ||abc.equals("C") |
| | | ||abc.equals("D") |
| | | ){ |
| | | equipment.setCheckPeriod(365*4+""); |
| | | } |
| | | } |
| | | } |
| | | equipmentService.save(equipment); |
| | | }else { |
| | | exceptionInfo = exceptionInfo+"第"+(i+2)+"行导入失败,原因:统一编码已存在,数据重复导入;"; |
| | | exceptionNum++; |
| | | continue; |
| | | } |
| | | } |
| | | |
| | | } |
| | | } |
| | | if(exceptionNum!=0){ |
| | |
| | | } |
| | | return Result.error("文件导入失败!"); |
| | | } |
| | | @GetMapping(value = "/getEquipmentStansdardList") |
| | | @PermissionData |
| | | public Result<IPage<DailyInspectionStandardDetail>> getEquipmentStansdardList(DailyInspectionStandardDetail standardDetail, |
| | | @RequestParam(name="pageNo", defaultValue="1") Integer pageNo, |
| | | @RequestParam(name="pageSize", defaultValue="10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | QueryWrapper<DailyInspectionStandardDetail> queryWrapper = QueryGenerator.initQueryWrapper(standardDetail, req.getParameterMap()); |
| | | Page<DailyInspectionStandardDetail> page = new Page<DailyInspectionStandardDetail>(pageNo, pageSize); |
| | | IPage<DailyInspectionStandardDetail> pageList = equipmentService.getStandardList(page,standardDetail.getEquipmentId(),standardDetail.getType()); |
| | | return Result.OK(pageList); |
| | | } |
| | | @PostMapping("addLine") |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<?> addLine(@RequestBody Equipment equipment){ |
| | | equipment.setIsLineEquip("no"); |
| | | equipment.setIsLine("yes"); |
| | | equipmentService.save(equipment); |
| | | List<Equipment> equipmentList = equipment.getEquipmentOfLineTable(); |
| | | for(Equipment equipment1:equipmentList){ |
| | | equipment1.setId(equipment1.getShowId()); |
| | | equipment1.setIsLineEquip("yes"); |
| | | equipment1.setLineId(equipment.getId()); |
| | | } |
| | | equipmentService.updateBatchById(equipmentList); |
| | | return Result.OK("添加成功"); |
| | | } |
| | | @PutMapping("editLine") |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public Result<?> editLine(@RequestBody Equipment equipment){ |
| | | equipmentService.updateById(equipment); |
| | | equipmentService.update(new UpdateWrapper<Equipment>() |
| | | .eq("line_id",equipment.getId()) |
| | | .set("line_id",null) |
| | | .set("is_meta",null) |
| | | .set("is_line_equip","no")); |
| | | List<Equipment> equipmentList = equipment.getEquipmentOfLineTable(); |
| | | for(Equipment equipment1:equipmentList){ |
| | | equipment1.setLineId(equipment.getId()); |
| | | String id = equipment1.getId(); |
| | | if(StringUtils.isBlank(id)){ |
| | | equipment1.setId(equipment1.getShowId()); |
| | | } |
| | | equipment1.setIsLineEquip("yes"); |
| | | } |
| | | equipmentService.updateBatchById(equipmentList); |
| | | return Result.OK("编辑成功"); |
| | | } |
| | | |
| | | |
| | | } |