| | |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.query.QueryGenerator; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.eam.entity.Equipment; |
| | | import org.jeecg.modules.eam.entity.EquipmentReportRepair; |
| | | import org.jeecg.modules.eam.entity.FaultDescription; |
| | | import org.jeecg.modules.eam.entity.QuanlityConfirm; |
| | | import org.jeecg.modules.eam.entity.*; |
| | | import org.jeecg.modules.eam.service.*; |
| | | import org.jeecg.modules.system.entity.SysUser; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | @Autowired |
| | | @Lazy |
| | | private IdentityService sysIdentityService; |
| | | @Autowired |
| | | private IFaultInfoService faultInfoService; |
| | | |
| | | |
| | | /** |
| | |
| | | quanlityConfirm.setQuantity(equipmentReportRepair.getQuantity()); |
| | | quanlityConfirm.setOperator(curUser.getId()); |
| | | quanlityConfirmService.save(quanlityConfirm); |
| | | 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); |
| | | |
| | | } |
| | | Equipment equipment = equipmentService.getById(equipmentReportRepair.getEquipmentId()); |
| | | equipment.setEquipmentStatus("2"); |
| | |
| | | |
| | | @PutMapping("/accept") |
| | | 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("验收失败,产品质量隐患确认和事故登记尚未完场,请完成确认后再进行验收"); |
| | | } |
| | | }else { |
| | | 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)){ |