| | |
| | | import org.jeecg.modules.eam.dto.EchartsDto; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.entity.EamEquipmentExtend; |
| | | import org.jeecg.modules.eam.entity.EamThirdMaintenanceWorkPlanSheet; |
| | | import org.jeecg.modules.eam.mapper.EamEquipmentMapper; |
| | | import org.jeecg.modules.eam.request.EamEquipmentQuery; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentExtendService; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.jeecg.modules.eam.service.IEamThirdMaintenanceWorkPlanSheetService; |
| | | import org.jeecg.modules.eam.tree.FindsEquipmentEamCenterUtil; |
| | | import org.jeecg.modules.eam.tree.FindsEquipmentProductionUtil; |
| | | import org.jeecg.modules.eam.vo.EamEquipmentTree; |
| | |
| | | private IBaseFactoryUserService baseFactoryUserService; |
| | | @Autowired |
| | | private IBaseFactoryService baseFactoryService; |
| | | @Autowired |
| | | private IEamThirdMaintenanceWorkPlanSheetService eamThirdMaintenanceWorkPlanSheetService; |
| | | @Autowired |
| | | private IEamEquipmentExtendService iEamEquipmentExtendService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | eamEquipmentExtend.setRepairStatus(EquipmentRepairStatus.NORMAL.name()); |
| | | equipmentExtendService.save(eamEquipmentExtend); |
| | | |
| | | // 处理三保保养计划(不再进行日期比较) |
| | | eamThirdMaintenanceWorkPlanSheetService.createMaintenancePlan(eamEquipment, eamEquipment.getLatestThirdMaintenance()); |
| | | eamThirdMaintenanceWorkPlanSheetService.createMaintenancePlan(eamEquipment, eamEquipment.getNextThirdMaintenance()); |
| | | |
| | | //插入设备履历 @EquipmentHistoryLog |
| | | return eamEquipment; |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public EamEquipment updateEquipment(EamEquipment eamEquipment){ |
| | | if (eamEquipment == null) { |
| | | return null; |
| | | if (eamEquipment == null) return null; |
| | | |
| | | if (eamEquipment.getNextThirdMaintenance() != null && |
| | | eamEquipment.getThirdMaintenancePeriod() != null) { |
| | | |
| | | org.jeecg.common.util.DateUtils.calculateMaintenanceDates( |
| | | eamEquipment.getNextThirdMaintenance(), |
| | | eamEquipment.getThirdMaintenancePeriod(), |
| | | newDate -> eamEquipment.setNextThirdMaintenance(newDate), |
| | | latestDate -> eamEquipment.setLatestThirdMaintenance(latestDate) |
| | | ); |
| | | } |
| | | |
| | | // 获取旧数据 |
| | | EamEquipmentExtend old = iEamEquipmentExtendService.getById(eamEquipment.getId()); |
| | | if (old == null) return null; |
| | | |
| | | // 提取新旧日期避免重复访问 |
| | | Date newLatest = eamEquipment.getLatestThirdMaintenance(); |
| | | Date newNext = eamEquipment.getNextThirdMaintenance(); |
| | | Date oldLatest = old.getLatestThirdMaintenance(); |
| | | Date oldNext = old.getNextThirdMaintenance(); |
| | | |
| | | // 处理保养日期变更 |
| | | eamThirdMaintenanceWorkPlanSheetService.processMaintenanceDateChange(eamEquipment, oldLatest, newLatest); |
| | | eamThirdMaintenanceWorkPlanSheetService.processMaintenanceDateChange(eamEquipment, oldNext, newNext); |
| | | |
| | | // 更新主表和扩展表 |
| | | eamEquipmentMapper.updateById(eamEquipment); |
| | | EamEquipmentExtend eamEquipmentExtend = new EamEquipmentExtend(); |
| | | BeanUtils.copyProperties(eamEquipment, eamEquipmentExtend); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 获取可生成二保工单的设备列表 |
| | | */ |
| | | @Override |
| | | public List<EamEquipment> selectSecondMaintenanceEquipmentList(){ |
| | | QueryWrapper<EamEquipment> queryWrapper = new QueryWrapper<>(); |
| | | queryWrapper.eq("e.del_flag", CommonConstant.DEL_FLAG_0); |
| | | queryWrapper.ne("ext.maintenance_status", MaintenanceStatusEnum.PROHIBITED.name()); |
| | | queryWrapper.isNotNull("ext.next_second_maintenance"); |
| | | return this.getBaseMapper().selectSecondMaintenanceEquipmentList(queryWrapper); |
| | | } |
| | | |
| | | /** |
| | | * 设备管理首页-技术状态 |
| | | * @return |
| | | */ |