| | |
| | | package org.jeecg.modules.eam.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.sun.org.apache.regexp.internal.RE; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.mapper.RepairOrderMapper; |
| | | import org.jeecg.modules.eam.service.*; |
| | | import org.jeecg.modules.eam.vo.RepairReportExportVo; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | |
| | | private IFaultInfoService faultInfoService; |
| | | @Value("${jeecg.path.upload}") |
| | | private String upLoadPath; |
| | | @Autowired |
| | | private IRepairOrderService repairOrderService; |
| | | |
| | | @Autowired |
| | | private RepairOrderMapper repairOrderMapper; |
| | | |
| | | |
| | | /** |
| | |
| | | LoginUser curUser= (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | equipmentReportRepair.setStatus("1"); |
| | | equipmentReportRepair.setSource("1"); |
| | | // equipmentReportRepair.setType("1"); |
| | | equipmentReportRepair.setIsCreateOrder(0); |
| | | equipmentReportRepairService.save(equipmentReportRepair); |
| | | Equipment equipment = equipmentService.getById(equipmentReportRepair.getEquipmentId()); |
| | | String IS_PRODUCT_YES = "yes"; |
| | | if(IS_PRODUCT_YES.equals(equipmentReportRepair.getErrUda1())){ |
| | | String num = sysIdentityService.getNumByTypeAndLength("QuanlityConfirm",4); |
| | |
| | | quanlityConfirm.setQuantity(equipmentReportRepair.getQuantity()); |
| | | quanlityConfirm.setOperator(curUser.getId()); |
| | | quanlityConfirmService.save(quanlityConfirm); |
| | | MessageDTO qMessageDTO = new MessageDTO(); |
| | | qMessageDTO.setTitle("质量隐患确认提醒"); |
| | | qMessageDTO.setContent("统一编号为【"+equipment.getNum()+"】的设备需要进行质量隐患确认,请移步至质量隐患确认进行确认!单据号【"+num+"】"); |
| | | qMessageDTO.setCategory("质量隐患确认"); |
| | | qMessageDTO.setFromUser("质量隐患确认提醒小助手"); |
| | | qMessageDTO.setToUser(curUser.getUsername()); |
| | | sysBaseApi.sendSysAnnouncement(qMessageDTO); |
| | | String fNum = sysIdentityService.getNumByTypeAndLength("FaultInfo",4); |
| | | FaultInfo faultInfo = new FaultInfo(); |
| | | faultInfo.setNum(fNum); |
| | | faultInfo.setQuanlityId(quanlityConfirm.getId()); |
| | | faultInfo.setOperater(quanlityConfirm.getOperator()); |
| | | faultInfo.setIsConfirm(IS_PRODUCT_NO); |
| | | String eId = equipmentReportRepair.getEquipmentId(); |
| | | Equipment equipment = equipmentService.getById(eId); |
| | | faultInfo.setEquipModel(equipment.getModel()); |
| | | faultInfo.setEquipName(equipment.getName()); |
| | | faultInfo.setEquipNum(equipment.getNum()); |
| | | faultInfoService.save(faultInfo); |
| | | |
| | | MessageDTO fMessageDTO = new MessageDTO(); |
| | | fMessageDTO.setTitle("设备事故登记提醒"); |
| | | fMessageDTO.setContent("统一编号为【"+equipment.getNum()+"】的设备需要进行事故登记,请移步至设备事故登记表完成确认!单据号【"+fNum+"】"); |
| | | fMessageDTO.setCategory("设备事故登记确认"); |
| | | fMessageDTO.setFromUser("设备事故登记提醒小助手"); |
| | | fMessageDTO.setToUser(curUser.getUsername()); |
| | | sysBaseApi.sendSysAnnouncement(fMessageDTO); |
| | | } |
| | | Equipment equipment = equipmentService.getById(equipmentReportRepair.getEquipmentId()); |
| | | equipment.setEquipmentStatus("2"); |
| | | String teamId = equipment.getTeamId(); |
| | | if(ObjectUtils.isNotNull(teamId)){ |
| | |
| | | } |
| | | |
| | | @PutMapping("/accept") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Result<?> accept(@RequestBody EquipmentReportRepair equipmentReportRepair ){ |
| | | if(equipmentReportRepair.getErrUda1().equals("yes")){ |
| | | QuanlityConfirm quanlityConfirm = quanlityConfirmService.getOne(new QueryWrapper<QuanlityConfirm>().eq("report_id",equipmentReportRepair.getId()),false); |
| | | if(ObjectUtils.isNotNull(quanlityConfirm)){ |
| | | String isConfirm1 = quanlityConfirm.getIsConfirm(); |
| | | FaultInfo faultInfo = faultInfoService.getOne(new QueryWrapper<FaultInfo>().eq("quanlity_id",quanlityConfirm.getId()),false); |
| | | if(ObjectUtils.isNotNull(faultInfo)){ |
| | | String isConfirm2 = faultInfo.getIsConfirm(); |
| | | if(!isConfirm1.equals("yes")||!isConfirm2.equals("yes")){ |
| | | return Result.error("验收失败,产品质量隐患确认和事故登记尚未完成,请完成确认后再进行验收"); |
| | | if(equipmentReportRepair.getErrUda4().equals("1")){ |
| | | if(equipmentReportRepair.getErrUda1().equals("yes")){ |
| | | QuanlityConfirm quanlityConfirm = quanlityConfirmService.getOne(new QueryWrapper<QuanlityConfirm>().eq("report_id",equipmentReportRepair.getId()),false); |
| | | if(ObjectUtils.isNotNull(quanlityConfirm)){ |
| | | String isConfirm1 = quanlityConfirm.getIsConfirm(); |
| | | FaultInfo faultInfo = faultInfoService.getOne(new QueryWrapper<FaultInfo>().eq("quanlity_id",quanlityConfirm.getId()),false); |
| | | if(ObjectUtils.isNotNull(faultInfo)){ |
| | | String isConfirm2 = faultInfo.getIsConfirm(); |
| | | if(!isConfirm1.equals("yes")||!isConfirm2.equals("yes")){ |
| | | return Result.error("验收失败,产品质量隐患确认和事故登记尚未完成,请完成确认后再进行验收"); |
| | | } |
| | | }else { |
| | | return Result.error("验收失败,未生成事故登记单"); |
| | | } |
| | | }else { |
| | | return Result.error("验收失败,未生成事故登记单"); |
| | | return Result.error("验收失败,未生成产品质量确认"); |
| | | } |
| | | }else { |
| | | return Result.error("验收失败,未生成产品质量确认"); |
| | | } |
| | | LoginUser user= (LoginUser)SecurityUtils.getSubject().getPrincipal(); |
| | | equipmentReportRepair.setStatus("5"); |
| | | equipmentReportRepair.setAcceptTime(new Date()); |
| | | Date start = equipmentReportRepair.getFaultTime(); |
| | | Date end = equipmentReportRepair.getAcceptTime(); |
| | | if(ObjectUtils.isNotNull(start)){ |
| | | long timeDifference =end.getTime() - start.getTime(); |
| | | BigDecimal hours = new BigDecimal(timeDifference) |
| | | .divide(new BigDecimal(60 * 60 * 1000), 3, BigDecimal.ROUND_HALF_EVEN); |
| | | equipmentReportRepair.setFaultHour(hours); |
| | | } |
| | | equipmentReportRepairService.updateById(equipmentReportRepair); |
| | | String equipmentId = equipmentReportRepair.getEquipmentId(); |
| | | if(StringUtils.isNotBlank(equipmentId)){ |
| | | Equipment equipment = equipmentService.getById(equipmentId); |
| | | equipment.setEquipmentStatus("1"); |
| | | equipmentService.updateById(equipment); |
| | | } |
| | | return Result.OK("验收成功"); |
| | | }else { |
| | | equipmentReportRepair.setStatus("2"); |
| | | equipmentReportRepairService.updateById(equipmentReportRepair); |
| | | RepairOrder repairOrder = repairOrderService.getOne(new QueryWrapper<RepairOrder>().eq("report_repair_id",equipmentReportRepair.getId()),false); |
| | | if(ObjectUtils.isNotNull(repairOrder)){ |
| | | |
| | | repairOrderMapper.updateRepair(repairOrder.getId()); |
| | | // repairOrder.setStatus("3"); |
| | | // repairOrder.setActualEndTime(null); |
| | | // repairOrderService.updateById(repairOrder); |
| | | } |
| | | return Result.OK("已驳回"); |
| | | } |
| | | LoginUser user= (LoginUser)SecurityUtils.getSubject().getPrincipal(); |
| | | equipmentReportRepair.setStatus("5"); |
| | | equipmentReportRepair.setAcceptTime(new Date()); |
| | | Date start = equipmentReportRepair.getFaultTime(); |
| | | Date end = equipmentReportRepair.getAcceptTime(); |
| | | if(ObjectUtils.isNotNull(start)){ |
| | | long timeDifference =end.getTime() - start.getTime(); |
| | | BigDecimal hours = new BigDecimal(timeDifference) |
| | | .divide(new BigDecimal(60 * 60 * 1000), 3, BigDecimal.ROUND_HALF_EVEN); |
| | | equipmentReportRepair.setFaultHour(hours); |
| | | } |
| | | equipmentReportRepairService.updateById(equipmentReportRepair); |
| | | String equipmentId = equipmentReportRepair.getEquipmentId(); |
| | | if(StringUtils.isNotBlank(equipmentId)){ |
| | | Equipment equipment = equipmentService.getById(equipmentId); |
| | | equipment.setEquipmentStatus("1"); |
| | | equipmentService.updateById(equipment); |
| | | } |
| | | return Result.OK("验收成功"); |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 导出excel |
| | | * |