From b852254d90e7d1955db31db154193ec8ee84d8b3 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 09 九月 2026 10:57:59 +0800
Subject: [PATCH] feat(hrm): 新增员工用工性质、班组归属字段及考勤异常处理优化

---
 yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/stocktaking/plan/MesWmStockTakingPlanServiceImpl.java |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/stocktaking/plan/MesWmStockTakingPlanServiceImpl.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/stocktaking/plan/MesWmStockTakingPlanServiceImpl.java
index 621996a..ba290f6 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/stocktaking/plan/MesWmStockTakingPlanServiceImpl.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/stocktaking/plan/MesWmStockTakingPlanServiceImpl.java
@@ -2,6 +2,7 @@
 
 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;
@@ -12,10 +13,12 @@
 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;
@@ -122,6 +125,16 @@
         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) {
@@ -164,6 +177,16 @@
                 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);
+            }
+        }
     }
 
 }

--
Gitblit v1.9.3