| | |
| | | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| | | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| | | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| | |
| | | import cn.iocoder.yudao.module.mes.dal.mysql.wm.stocktaking.plan.MesWmStockTakingPlanMapper; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmStockTakingTypeEnum; |
| | | import jakarta.annotation.Resource; |
| | | import org.quartz.CronExpression; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.validation.annotation.Validated; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | |
| | | /** |
| | | * MES 盘点方案 Service 实现类 |
| | | * |
| | | * @author 芋道源码 |
| | | * @author 超级管理员 |
| | | */ |
| | | @Service |
| | | @Validated |
| | |
| | | return stockTakingPlanMapper.selectPage(pageReqVO); |
| | | } |
| | | |
| | | @Override |
| | | public List<MesWmStockTakingPlanDO> getEnableAutoGeneratePlanList() { |
| | | return stockTakingPlanMapper.selectEnableAutoGenerateList(); |
| | | } |
| | | |
| | | @Override |
| | | public void updateStockTakingPlanLastGenerateTime(Long id, LocalDateTime time) { |
| | | stockTakingPlanMapper.updateById(new MesWmStockTakingPlanDO().setId(id).setLastGenerateTime(time)); |
| | | } |
| | | |
| | | private void validatePlanCodeUnique(Long id, String code) { |
| | | MesWmStockTakingPlanDO plan = stockTakingPlanMapper.selectByCode(code); |
| | | if (plan == null) { |
| | |
| | | throw exception(WM_STOCK_TAKING_PLAN_DYNAMIC_TIME_INVALID); |
| | | } |
| | | } |
| | | |
| | | // 校验定期自动生成配置:开启自动生成时 cron 必填且合法 |
| | | if (Boolean.TRUE.equals(saveReqVO.getAutoGenerate())) { |
| | | if (StrUtil.isBlank(saveReqVO.getGenerateCron())) { |
| | | throw exception(WM_STOCK_TAKING_PLAN_AUTO_GENERATE_CRON_REQUIRED); |
| | | } |
| | | if (!CronExpression.isValidExpression(saveReqVO.getGenerateCron())) { |
| | | throw exception(WM_STOCK_TAKING_PLAN_AUTO_GENERATE_CRON_INVALID); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |