| | |
| | | import org.dromara.eims.domain.*; |
| | | import org.dromara.eims.domain.bo.EimsMaintPlanBo; |
| | | import org.dromara.eims.domain.vo.EimsMaintPlanVo; |
| | | import org.dromara.eims.domain.vo.EimsMaintStandVo; |
| | | import org.dromara.eims.mapper.EimsMaintOrderMapper; |
| | | import org.dromara.eims.mapper.EimsMaintOrditmMapper; |
| | | import org.dromara.eims.mapper.EimsMaintPlanMapper; |
| | | import org.dromara.eims.mapper.EimsMaintStandMapper; |
| | | import org.dromara.eims.service.IEimsMaintOrderService; |
| | | import org.dromara.eims.service.IEimsMaintPlanService; |
| | | import org.dromara.eims.service.IGenerateCodeService; |
| | |
| | | public class MaintPlanToOrderJob { |
| | | private final EimsMaintOrderMapper orderMapper; |
| | | |
| | | private final EimsMaintStandMapper standMapper; |
| | | |
| | | private final EimsMaintOrditmMapper orditmMapper; |
| | | |
| | | private final EimsMaintPlanMapper planMapper; |
| | | |
| | |
| | | order.setId(null); |
| | | order.setStatus(DictConstants.MAINT_ORDER_STATUS_DETAIL.DAIBAOYANG); |
| | | order.setPlanTime(createOrderTime); |
| | | order.setPlanId(planVo.getId()); |
| | | order.setMaintCode(codeService.generateCode("BYZD")); |
| | | EimsMaintPlan plan = MapstructUtils.convert(planVo, EimsMaintPlan.class); |
| | | assert plan != null; |
| | |
| | | if (!flag) continue; |
| | | planMapper.updateById(plan); |
| | | |
| | | //生成保养明细 |
| | | Long equId = plan.getEquId(); |
| | | List<EimsMaintStandVo> standList = standMapper.selectVoList(new LambdaQueryWrapper<EimsMaintStand>().eq(EimsMaintStand::getEquId, equId)); |
| | | //TODO 没有保养项,添加异常记录 |
| | | if(standList.isEmpty()) continue; |
| | | for (int j = 0; j < standList.size(); j++) { |
| | | EimsMaintStandVo stand = standList.get(j); |
| | | EimsMaintOrditm itm = new EimsMaintOrditm(); |
| | | itm.setOrderId(order.getId()); |
| | | itm.setEquId(equId); |
| | | itm.setItmName(stand.getName()); |
| | | itm.setItmAction(stand.getStand()); |
| | | itm.setItmUser(order.getMaintUser()); |
| | | orditmMapper.insert(itm); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | | return ExecuteResult.success("保养计划生成保养工单成功"); |
| | | } |