From f6261adaab448e52a83e3615242dab1ad33023ec Mon Sep 17 00:00:00 2001
From: zhou zhou <3272660260@qq.com>
Date: 星期五, 20 三月 2026 10:55:47 +0800
Subject: [PATCH] #需求第六条

---
 src/main/java/com/zy/asrs/task/WorkMastScheduler.java       |   40 +++++++++++++++++++++++++++++++++++++---
 src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java |   10 ++++++++--
 2 files changed, 45 insertions(+), 5 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
index 5277f6f..da394a3 100644
--- a/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -531,8 +531,14 @@
                             throw new CoolException("鏈嶅姟鍣ㄥ唴閮ㄩ敊璇紝璇疯仈绯荤鐞嗗憳");
                         }
                     }
-                    // 浜岀骇鍒嗙被
-                    Tag secTag = tagService.selectByName(matParam.getGroupName(), 3);
+                    //2026.3.20淇敼闇�姹俋_锛孴_鐨勯兘鏄垚鍝� 鍏朵粬鐨勫叏鏄厤浠�
+                    String groupName = null;
+                    if (matParam.getMatnr().startsWith("T_") || matParam.getMatnr().startsWith("X_")) {
+                        groupName = "鎴愬搧";
+                    }else {
+                        groupName = "閰嶄欢";
+                    }
+                    Tag secTag = tagService.selectByName(groupName, 3);
                     if (secTag == null) {
                         NodeUtils nodeUtils = new NodeUtils();
                         nodeUtils.executePath(priTag.getId());
diff --git a/src/main/java/com/zy/asrs/task/WorkMastScheduler.java b/src/main/java/com/zy/asrs/task/WorkMastScheduler.java
index 1c60f79..5113cf1 100644
--- a/src/main/java/com/zy/asrs/task/WorkMastScheduler.java
+++ b/src/main/java/com/zy/asrs/task/WorkMastScheduler.java
@@ -1,12 +1,17 @@
 package com.zy.asrs.task;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.plugins.Page;
+import com.core.common.Cools;
+import com.core.exception.CoolException;
+import com.zy.asrs.entity.Mat;
+import com.zy.asrs.entity.Tag;
 import com.zy.asrs.entity.Task;
 import com.zy.asrs.entity.WrkMast;
-import com.zy.asrs.service.MesService;
-import com.zy.asrs.service.TaskService;
-import com.zy.asrs.service.WrkMastService;
+import com.zy.asrs.service.*;
 import com.zy.asrs.task.core.ReturnT;
 import com.zy.asrs.task.handler.WorkMastHandler;
+import com.zy.common.utils.NodeUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -33,6 +38,10 @@
     private TaskService taskService;
     @Resource
     private MesService mesService;
+    @Autowired
+    private MatService matService;
+    @Autowired
+    private TagService tagService;
     // TODO锛歳eporterTask()
 
     @Scheduled(cron = "0/3 * * * * ? ")
@@ -65,4 +74,29 @@
         }
     }
 
+    @Scheduled(cron = "0/3 * * * * ? ")
+    private void autoSyncMatGroup(){
+        Page<Mat> page = new Page<>(1, 20);
+        //寤虹珛鎴愬搧鍜屽浠秚ag鍚庢妸14锛�15鏇挎崲涓哄疄闄卛d
+        page = matService.selectPage(page, new EntityWrapper<Mat>().notIn("tag_id", 14,15));
+        List<Mat> matList = page.getRecords();
+        for (Mat mat : matList) {
+            String groupName = null;
+            if (mat.getMatnr().startsWith("T_") || mat.getMatnr().startsWith("X_")) {
+                groupName = "鎴愬搧";
+            }else {
+                groupName = "閰嶄欢";
+            }
+            Tag secTag = tagService.selectByName(groupName, 3);
+            if (Cools.isEmpty(secTag)) {
+                continue;
+            }
+            mat.setTagId(secTag.getId());
+            matService.updateById(mat);
+
+        }
+
+    }
+
+
 }

--
Gitblit v1.9.1