| | |
| | | import org.jeecg.modules.eam.request.EamWeekMaintenanceQuery; |
| | | import org.jeecg.modules.eam.request.EamWeekMaintenanceRequest; |
| | | import org.jeecg.modules.eam.service.*; |
| | | import org.jeecg.modules.eam.vo.EquipmentInspectionStatistics; |
| | | import org.jeecg.modules.eam.vo.EquipmentMaintenanceStatistics; |
| | | import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; |
| | | import org.jeecg.modules.flowable.apithird.business.service.IFlowMyBusinessService; |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCommonService; |
| | | import org.jeecg.modules.flowable.service.IFlowDefinitionService; |
| | | import org.jeecg.modules.flowable.service.IFlowTaskService; |
| | | import org.jeecg.modules.system.service.IMdcProductionService; |
| | | import org.jeecg.modules.system.service.ISysUserService; |
| | | import org.jeecg.modules.system.vo.UserSelector; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | private IEamReportRepairService eamReportRepairService; |
| | | @Autowired |
| | | private IEamEquipmentExtendService eamEquipmentExtendService; |
| | | @Autowired |
| | | private IMdcProductionService mdcProductionService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | |
| | | order.setMaintenanceStatus(WeekMaintenanceStatusEnum.UNDER_MAINTENANCE.name()); |
| | | order.setActualStartTime(new Date()); |
| | | eamWeekMaintenanceOrderMapper.updateById(order); |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentMaintenanceStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name()); |
| | | return result.isSuccess(); |
| | | } |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentMaintenanceStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name()); |
| | | } |
| | | |
| | | return true; |
| | |
| | | entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.UNDER_MAINTENANCE.name()); |
| | | entity.setActualStartTime(new Date()); |
| | | eamWeekMaintenanceOrderMapper.updateById(entity); |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name()); |
| | | return result.isSuccess(); |
| | | } |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentMaintenanceStatus(entity.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_MAINTENANCE.name()); |
| | | |
| | | } |
| | | return true; |
| | | } |
| | |
| | | throw new JeecgBootException("设备不存在,添加失败!"); |
| | | } |
| | | LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if(sysUser == null || !BusinessCodeConst.PCR0001.equals(sysUser.getPost())) { |
| | | throw new JeecgBootException("不是操作工,无法领取此工单!"); |
| | | } |
| | | entity.setOperator(sysUser.getUsername()); |
| | | entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.UNDER_MAINTENANCE.name()); |
| | | entity.setActualStartTime(new Date()); |
| | |
| | | break; |
| | | case WAIT_FINAL_ACCEPTANCE: |
| | | values.put("dataId", entity.getId()); |
| | | values.put("organization", request.getInitialAcceptanceComment()); |
| | | values.put("comment", request.getInitialAcceptanceComment()); |
| | | request.setComment(request.getInitialAcceptanceComment()); |
| | | values.put("organization", request.getFinalAcceptanceComment()); |
| | | values.put("comment", request.getFinalAcceptanceComment()); |
| | | request.setComment(request.getFinalAcceptanceComment()); |
| | | //设置entity |
| | | entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.COMPLETE.name()); |
| | | entity.setFinalAcceptanceUser(user.getUsername()); |
| | |
| | | return eamWeekMaintenanceOrderMapper.selectList(queryWrapper); |
| | | } |
| | | |
| | | @Override |
| | | public List<EquipmentMaintenanceStatistics> equipmentMaintenanceStatistics(String productionId, LocalDate firstOfMonth, LocalDate today) { |
| | | if (StringUtils.isNotBlank(productionId)) { |
| | | //车间编码不为空 |
| | | List<String> productIds = mdcProductionService.recursionChildren(productionId); |
| | | if (CollectionUtil.isEmpty(productIds)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | List<EquipmentMaintenanceStatistics> list = this.baseMapper.equipmentMaintenanceStatistics(productIds, firstOfMonth.toString(), today.plusDays(1).toString()); |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return list; |
| | | } |
| | | List<EquipmentMaintenanceStatistics> list = this.baseMapper.equipmentMaintenanceStatistics(null, firstOfMonth.toString(), today.plusDays(1).toString()); |
| | | if (CollectionUtil.isEmpty(list)) { |
| | | return Collections.emptyList(); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | private boolean isUserAuthorized(FlowMyBusiness flowMyBusiness, LoginUser user) { |
| | | List<String> todoUsers = JSON.parseArray(flowMyBusiness.getTodoUsers(), String.class); |
| | | return todoUsers != null && todoUsers.contains(user.getUsername()); |