| | |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.constant.DataBaseConstant; |
| | | import org.jeecg.common.exception.JeecgBootException; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.common.util.oConvertUtils; |
| | | import org.jeecg.modules.eam.aspect.annotation.EquipmentHistoryLog; |
| | | import org.jeecg.modules.eam.constant.BusinessCodeConst; |
| | | import org.jeecg.modules.eam.constant.EquipmentMaintenanceStatus; |
| | | import org.jeecg.modules.eam.constant.EquipmentOperationTagEnum; |
| | | import org.jeecg.modules.eam.constant.InspectionStatus; |
| | | import org.jeecg.modules.eam.entity.EamEquipment; |
| | | import org.jeecg.modules.eam.entity.EamInspectionOrder; |
| | |
| | | import org.jeecg.modules.eam.mapper.EamInspectionOrderMapper; |
| | | import org.jeecg.modules.eam.request.EamInspectionOrderQuery; |
| | | import org.jeecg.modules.eam.request.EamInspectionOrderRequest; |
| | | import org.jeecg.modules.eam.service.IEamEquipmentService; |
| | | import org.jeecg.modules.eam.service.IEamInspectionOrderDetailService; |
| | | import org.jeecg.modules.eam.service.IEamInspectionOrderService; |
| | | import org.jeecg.modules.eam.service.IEamReportRepairService; |
| | | import org.jeecg.modules.eam.service.*; |
| | | import org.jeecg.modules.flowable.apithird.business.entity.FlowMyBusiness; |
| | | import org.jeecg.modules.flowable.apithird.business.service.impl.FlowMyBusinessServiceImpl; |
| | | import org.jeecg.modules.flowable.apithird.service.FlowCallBackServiceI; |
| | |
| | | private IMdcUserProductionService mdcUserProductionService; |
| | | @Autowired |
| | | private IEamReportRepairService eamReportRepairService; |
| | | @Autowired |
| | | private IEamEquipmentExtendService eamEquipmentExtendService; |
| | | |
| | | @Override |
| | | public IPage<EamInspectionOrder> queryPageList(Page<EamInspectionOrder> page, EamInspectionOrderQuery query) { |
| | |
| | | } |
| | | if (StrUtil.isNotBlank(eamInspectionOrderRequest.getOperator())) { |
| | | triggerProcess(eamInspectionOrder); |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentInspectionStatus(eamInspectionOrder.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_INSPECTION.name()); |
| | | } |
| | | return true; |
| | | } |
| | |
| | | |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public boolean editInspectionOrder(EamInspectionOrderRequest eamInspectionOrderRequest) { |
| | | EamInspectionOrder eamInspectionOrder = new EamInspectionOrder(); |
| | | BeanUtils.copyProperties(eamInspectionOrderRequest, eamInspectionOrder); |
| | | if (StrUtil.isNotEmpty(eamInspectionOrder.getOperator())) { |
| | | eamInspectionOrder.setInspectionStatus(InspectionStatus.UNDER_INSPECTION.name()); |
| | | triggerProcess(eamInspectionOrder); |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentInspectionStatus(eamInspectionOrder.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_INSPECTION.name()); |
| | | } |
| | | super.updateById(eamInspectionOrder); |
| | | //处理明细数据 |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public boolean takeInspectionOrder(String id) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | if(user == null || !BusinessCodeConst.PCR0001.equals(user.getPost())) { |
| | | throw new JeecgBootException("不是操作工,无法领取此工单!"); |
| | | } |
| | | EamInspectionOrder eamInspectionOrder = this.getById(id); |
| | | if (eamInspectionOrder == null) { |
| | | return false; |
| | |
| | | eamInspectionOrder.setInspectionStatus(InspectionStatus.UNDER_INSPECTION.name()); |
| | | this.triggerProcess(eamInspectionOrder); |
| | | this.updateById(eamInspectionOrder); |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentInspectionStatus(eamInspectionOrder.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_INSPECTION.name()); |
| | | return true; |
| | | } |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result<?> inspectionProcess(EamInspectionOrderRequest eamInspectionOrderRequest) { |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @EquipmentHistoryLog(operationTag = EquipmentOperationTagEnum.POINT_INSPECTION, businessTable = "eam_inspection_order") |
| | | public EamInspectionOrder inspectionProcess(EamInspectionOrderRequest eamInspectionOrderRequest) { |
| | | try { |
| | | // 检查请求参数 |
| | | if (!isValidRequest(eamInspectionOrderRequest)) { |
| | | return Result.error("非法参数"); |
| | | throw new JeecgBootException("非法参数"); |
| | | } |
| | | |
| | | // 获取当前登录用户 |
| | | LoginUser user = getCurrentUser(); |
| | | if (user == null || StrUtil.isBlank(user.getId())) { |
| | | return Result.error("账号不存在"); |
| | | throw new JeecgBootException("账号不存在"); |
| | | } |
| | | eamInspectionOrderRequest.setAssignee(user.getUsername()); |
| | | |
| | | // 获取点检工单信息 |
| | | EamInspectionOrder eamInspectionOrder = getEamInspectionOrder(eamInspectionOrderRequest.getDataId()); |
| | | if (eamInspectionOrder == null) { |
| | | return Result.error("未找到对应数据"); |
| | | throw new JeecgBootException("未找到对应数据"); |
| | | } |
| | | |
| | | // 获取流程业务记录 |
| | | FlowMyBusiness flowMyBusiness = getFlowMyBusiness(eamInspectionOrderRequest.getInstanceId()); |
| | | if (flowMyBusiness == null) { |
| | | return Result.error("流程记录不存在"); |
| | | throw new JeecgBootException("流程记录不存在"); |
| | | } |
| | | |
| | | // 检查用户是否有权限操作任务 |
| | | if (!isUserAuthorized(flowMyBusiness, user)) { |
| | | return Result.error("用户无权操作此任务"); |
| | | throw new JeecgBootException("用户无权操作此任务"); |
| | | } |
| | | |
| | | // 认领任务 |
| | | if (!claimTask(flowMyBusiness.getTaskId(), user)) { |
| | | return Result.error("任务不存在、已完成或已被他人认领"); |
| | | throw new JeecgBootException("任务不存在、已完成或已被他人认领"); |
| | | } |
| | | |
| | | // 设置流程变量 |
| | |
| | | updateEamInspectionOrderDetail(eamInspectionOrder); |
| | | } |
| | | |
| | | return Result.OK("操作成功"); |
| | | return eamInspectionOrder; |
| | | } catch (Exception e) { |
| | | return Result.error("操作失败:" + e.getMessage()); |
| | | throw new JeecgBootException("操作失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | eamInspectionOrderDetailService.remove(new QueryWrapper<EamInspectionOrderDetail>().eq("order_id", order.getId())); |
| | | eamInspectionOrderDetailService.saveBatch(request.getTableDetailList()); |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentInspectionStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.INSPECTION_CONFIRM.name()); |
| | | } else if (InspectionStatus.WAIT_CONFIRM.name().equals(order.getInspectionStatus()) && StrUtil.isNotEmpty(request.getConfirmDealType())) { |
| | | // 班组长确认任务 |
| | | order.setInspectionStatus(InspectionStatus.COMPLETE.name()); |
| | |
| | | order.setConfirmComment(request.getConfirmComment()); |
| | | order.setConfirmDealType(request.getConfirmDealType()); |
| | | order.setConfirmTime(new Date()); |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentInspectionStatus(order.getEquipmentId(), EquipmentMaintenanceStatus.NORMAL.name()); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (InspectionStatus.UNDER_INSPECTION.name().equals(type)) { |
| | | eamInspectionOrder.setOperator(loginUser.getUsername()); |
| | | this.triggerProcess(eamInspectionOrder); |
| | | //更新设备保养状态 |
| | | eamEquipmentExtendService.updateEquipmentInspectionStatus(eamInspectionOrder.getEquipmentId(), EquipmentMaintenanceStatus.UNDER_INSPECTION.name()); |
| | | } else { |
| | | eamInspectionOrder.setOperator(null); |
| | | } |