| | |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.cal.plan.MesCalPlanMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.cal.MesCalPlanStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.cal.MesCalShiftTypeEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.md.autocode.MesMdAutoCodeRuleCodeEnum; |
| | | import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamShiftService; |
| | | import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService; |
| | | import jakarta.annotation.Resource; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | @Resource |
| | | @Lazy |
| | | private MesCalTeamShiftService teamShiftService; |
| | | @Resource |
| | | private MesMdAutoCodeRecordService autoCodeRecordService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public Long createPlan(MesCalPlanSaveReqVO createReqVO) { |
| | | // 前端通常会预生成编码;接口侧仍提供兜底,避免移动端、导入外的调用方漏传后流程中断。 |
| | | if (StrUtil.isBlank(createReqVO.getCode())) { |
| | | createReqVO.setCode(autoCodeRecordService.generateAutoCode( |
| | | MesMdAutoCodeRuleCodeEnum.CAL_PLAN_CODE.getCode())); |
| | | } |
| | | // 1. 校验编码唯一 |
| | | validatePlanCodeUnique(null, createReqVO.getCode()); |
| | | |