From 6cb4e6647b0e2e8c0cafa38a07666e07709bcf54 Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期一, 19 一月 2026 13:06:05 +0800
Subject: [PATCH] 物料新增,修改功能 优化

---
 src/main/java/com/zy/asrs/utils/MatExcelListener.java |   69 ++++++++++++++++++----------------
 1 files changed, 36 insertions(+), 33 deletions(-)

diff --git a/src/main/java/com/zy/asrs/utils/MatExcelListener.java b/src/main/java/com/zy/asrs/utils/MatExcelListener.java
index 0c7ff89..27b3cef 100644
--- a/src/main/java/com/zy/asrs/utils/MatExcelListener.java
+++ b/src/main/java/com/zy/asrs/utils/MatExcelListener.java
@@ -61,7 +61,7 @@
         Long tagId;
         // 鍒嗙被
         // 涓�绾у垎绫�
-        if (!Cools.isEmpty(excel.getPriClass()) && !Cools.isEmpty(excel.getSecClass())) {
+        if (!Cools.isEmpty(excel.getPriClass())) {
             Tag priTag = tagService.selectByName(excel.getPriClass(), 2);
             if (priTag == null) {
                 Tag top = tagService.getTop();
@@ -92,38 +92,40 @@
                     throw new CoolException("淇濆瓨涓�绾у垎绫诲け璐�");
                 }
             }
-            // 浜岀骇鍒嗙被
-            Tag secTag = tagService.selectByName(excel.getSecClass(), 3);
-            if (secTag == null) {
-                NodeUtils nodeUtils = new NodeUtils();
-                nodeUtils.executePath(priTag.getId());
-                secTag = new Tag(
-                        null,    // 缂栧彿
-                        excel.getSecClass(),    // 鍚嶇О
-                        priTag.getId(),    // 鐖剁骇
-                        priTag.getName(),    // 鐖剁骇鍚嶇О
-                        nodeUtils.path.toString(),    // 鍏宠仈璺緞
-                        nodeUtils.pathName.toString(),    // 鍏宠仈璺緞鍚�
-                        0,    // 绫诲瀷
-                        null,    // 璐熻矗浜�
-                        null,    // 鍥剧墖
-                        null,    // 绠�瑕佹弿杩�
-                        null,    // 鏁伴噺
-                        3,    // 绛夌骇
-                        null,    // 鎺掑簭
-                        1,    // 鐘舵��
-                        now,    // 娣诲姞鏃堕棿
-                        null,    // 娣诲姞浜哄憳
-                        now,    // 淇敼鏃堕棿
-                        null,    // 淇敼浜哄憳
-                        null    // 澶囨敞
-                );
-                if (tagMapper.insert(secTag) == 0) {
-                    throw new CoolException("淇濆瓨浜岀骇鍒嗙被澶辫触");
-                }
-            }
-            tagId = secTag.getId();
-        } else {
+//            // 浜岀骇鍒嗙被
+//            Tag secTag = tagService.selectByName(excel.getSecClass(), 3);
+//            if (secTag == null) {
+//                NodeUtils nodeUtils = new NodeUtils();
+//                nodeUtils.executePath(priTag.getId());
+//                secTag = new Tag(
+//                        null,    // 缂栧彿
+//                        excel.getSecClass(),    // 鍚嶇О
+//                        priTag.getId(),    // 鐖剁骇
+//                        priTag.getName(),    // 鐖剁骇鍚嶇О
+//                        nodeUtils.path.toString(),    // 鍏宠仈璺緞
+//                        nodeUtils.pathName.toString(),    // 鍏宠仈璺緞鍚�
+//                        0,    // 绫诲瀷
+//                        null,    // 璐熻矗浜�
+//                        null,    // 鍥剧墖
+//                        null,    // 绠�瑕佹弿杩�
+//                        null,    // 鏁伴噺
+//                        3,    // 绛夌骇
+//                        null,    // 鎺掑簭
+//                        1,    // 鐘舵��
+//                        now,    // 娣诲姞鏃堕棿
+//                        null,    // 娣诲姞浜哄憳
+//                        now,    // 淇敼鏃堕棿
+//                        null,    // 淇敼浜哄憳
+//                        null    // 澶囨敞
+//                );
+//                if (tagMapper.insert(secTag) == 0) {
+//                    throw new CoolException("淇濆瓨浜岀骇鍒嗙被澶辫触");
+//                }
+//            }
+            tagId = priTag.getId();
+        }
+
+        else {
             tagId = tagService.getTop().getId();
         }
         // 鍟嗗搧
@@ -131,6 +133,7 @@
         if (mat == null) {
             mat = excel;
             mat.setTagId(tagId);
+            mat.setLocType(tagId);
             if (!matService.insert(mat)) {
                 throw new CoolException("淇濆瓨鍟嗗搧淇℃伅澶辫触锛屽晢鍝佺紪鐮侊細" + excel.getMatnr());
             }

--
Gitblit v1.9.1