From 045128ca645bf1668c6c3b050746e90cd8935258 Mon Sep 17 00:00:00 2001
From: guoyujie <guoyujie@ng.com>
Date: 星期四, 25 十二月 2025 15:25:04 +0800
Subject: [PATCH] 提交 产品名称判断逻辑

---
 north-glass-erp/northglass-erp/src/stores/sd/companySet/洛阳北玻.js              |    2 +-
 north-glass-erp/src/main/resources/mapper/sd/ProductMapper.xml               |    4 ++--
 north-glass-erp/northglass-erp/src/stores/sd/companySet/金华天成.js              |    2 +-
 north-glass-erp/northglass-erp/src/stores/sd/companySet/新疆恒鑫.js              |    2 +-
 north-glass-erp/src/main/java/com/example/erp/service/sd/ProductService.java |   18 +++++++++++++++---
 north-glass-erp/northglass-erp/src/views/sd/product/CreateProduct.vue        |   11 +++++++++--
 north-glass-erp/northglass-erp/src/stores/sd/companySet/天津北玻.js              |    2 +-
 north-glass-erp/northglass-erp/src/stores/sd/companySet/上海北玻.js              |    2 +-
 8 files changed, 31 insertions(+), 12 deletions(-)

diff --git "a/north-glass-erp/northglass-erp/src/stores/sd/companySet/\344\270\212\346\265\267\345\214\227\347\216\273.js" "b/north-glass-erp/northglass-erp/src/stores/sd/companySet/\344\270\212\346\265\267\345\214\227\347\216\273.js"
index 3b5d0f2..85636fb 100644
--- "a/north-glass-erp/northglass-erp/src/stores/sd/companySet/\344\270\212\346\265\267\345\214\227\347\216\273.js"
+++ "b/north-glass-erp/northglass-erp/src/stores/sd/companySet/\344\270\212\346\265\267\345\214\227\347\216\273.js"
@@ -30,7 +30,7 @@
         deliveryDate:15,//璁㈠崟鍒涘缓閫佽揣鏃ユ湡 澶╂触7澶╋紝甯稿窞7澶╋紝涔変箤15澶╋紝鏂扮枂15澶�
         columnName:'鍥惧彿',
         selectOrderReviewShow:true, //璁㈠崟棣栭〉鍔犲伐鍗曞鏍告寜閽槸鍚︽樉绀�
-        productName:"product_name",
+        productName:"product_abbreviation",
         decValue:3,//璁㈠崟淇濈暀浣嶆暟锛屽ぉ娲�3浣�,甯稿窞2浣�
         label:1,//鏍囩绫诲瀷锛堣嚜瀹氫箟鎵撳嵃鏍囩甯稿窞2锛屽叾浠�1锛�
         calculateType:1,//璁㈠崟璁$畻鏂瑰紡
diff --git "a/north-glass-erp/northglass-erp/src/stores/sd/companySet/\345\244\251\346\264\245\345\214\227\347\216\273.js" "b/north-glass-erp/northglass-erp/src/stores/sd/companySet/\345\244\251\346\264\245\345\214\227\347\216\273.js"
index 2d6b5fb..741c470 100644
--- "a/north-glass-erp/northglass-erp/src/stores/sd/companySet/\345\244\251\346\264\245\345\214\227\347\216\273.js"
+++ "b/north-glass-erp/northglass-erp/src/stores/sd/companySet/\345\244\251\346\264\245\345\214\227\347\216\273.js"
@@ -30,7 +30,7 @@
         deliveryDate:7,//璁㈠崟鍒涘缓閫佽揣鏃ユ湡 澶╂触7澶╋紝甯稿窞7澶╋紝涔変箤15澶╋紝鏂扮枂15澶�
         columnName:'鍥惧彿',//鎵撳嵃鐢熶骇鍗曟椂闇�瑕佹樉绀虹殑鍒楀悕锛屾病鏈変负绌�
         selectOrderReviewShow:true, //璁㈠崟棣栭〉鍔犲伐鍗曞鏍告寜閽槸鍚︽樉绀�
-        productName:"product_name",//浜у搧鍒涘缓鏌ラ噸瀛楁
+        productName:"product_abbreviation",//浜у搧鍒涘缓鏌ラ噸瀛楁
         decValue:3,//璁㈠崟淇濈暀浣嶆暟锛屽ぉ娲�3浣�,甯稿窞2浣�
         label:1,//鏍囩绫诲瀷,甯稿窞涓�2锛屽叾浠栦负1
         calculateType:1,//璁㈠崟璁$畻鏂瑰紡
diff --git "a/north-glass-erp/northglass-erp/src/stores/sd/companySet/\346\226\260\347\226\206\346\201\222\351\221\253.js" "b/north-glass-erp/northglass-erp/src/stores/sd/companySet/\346\226\260\347\226\206\346\201\222\351\221\253.js"
index 266dd9f..dffa7ae 100644
--- "a/north-glass-erp/northglass-erp/src/stores/sd/companySet/\346\226\260\347\226\206\346\201\222\351\221\253.js"
+++ "b/north-glass-erp/northglass-erp/src/stores/sd/companySet/\346\226\260\347\226\206\346\201\222\351\221\253.js"
@@ -30,7 +30,7 @@
         deliveryDate:15,//璁㈠崟鍒涘缓閫佽揣鏃ユ湡 澶╂触7澶╋紝甯稿窞7澶╋紝涔変箤15澶╋紝鏂扮枂15澶�
         columnName:'鍥惧彿',//鎵撳嵃鐢熶骇鍗曟椂闇�瑕佹樉绀虹殑鍒楀悕锛屾病鏈変负绌�
         selectOrderReviewShow:true, //璁㈠崟棣栭〉鍔犲伐鍗曞鏍告寜閽槸鍚︽樉绀�
-        productName:"product_name",//浜у搧鍒涘缓鏃堕噸澶嶉獙璇侊紝鈥榩roduct_abbreviation鈥�
+        productName:"product_abbreviation",//浜у搧鍒涘缓鏃堕噸澶嶉獙璇侊紝鈥榩roduct_abbreviation鈥�
         decValue:2,//璁㈠崟淇濈暀浣嶆暟锛屽ぉ娲�3浣�,甯稿窞2浣�
         label:1,//鏍囩绫诲瀷,甯稿窞涓�2锛屽叾浠栦负1
         calculateType:2,//璁㈠崟璁$畻鏂瑰紡
diff --git "a/north-glass-erp/northglass-erp/src/stores/sd/companySet/\346\264\233\351\230\263\345\214\227\347\216\273.js" "b/north-glass-erp/northglass-erp/src/stores/sd/companySet/\346\264\233\351\230\263\345\214\227\347\216\273.js"
index 8bb59f2..ddfd2dd 100644
--- "a/north-glass-erp/northglass-erp/src/stores/sd/companySet/\346\264\233\351\230\263\345\214\227\347\216\273.js"
+++ "b/north-glass-erp/northglass-erp/src/stores/sd/companySet/\346\264\233\351\230\263\345\214\227\347\216\273.js"
@@ -30,7 +30,7 @@
         deliveryDate:15,//璁㈠崟鍒涘缓閫佽揣鏃ユ湡 澶╂触7澶╋紝甯稿窞7澶╋紝涔変箤15澶╋紝鏂扮枂15澶�
         columnName:'鍥惧彿',
         selectOrderReviewShow:true, //璁㈠崟棣栭〉鍔犲伐鍗曞鏍告寜閽槸鍚︽樉绀�
-        productName:"product_name",
+        productName:"product_abbreviation",
         decValue:3,//璁㈠崟淇濈暀浣嶆暟锛屽ぉ娲�3浣�,甯稿窞2浣�
         label:1,//鏍囩绫诲瀷锛堣嚜瀹氫箟鎵撳嵃鏍囩甯稿窞2锛屽叾浠�1锛�
         calculateType:1,//璁㈠崟璁$畻鏂瑰紡
diff --git "a/north-glass-erp/northglass-erp/src/stores/sd/companySet/\351\207\221\345\215\216\345\244\251\346\210\220.js" "b/north-glass-erp/northglass-erp/src/stores/sd/companySet/\351\207\221\345\215\216\345\244\251\346\210\220.js"
index 72d4562..9a434ac 100644
--- "a/north-glass-erp/northglass-erp/src/stores/sd/companySet/\351\207\221\345\215\216\345\244\251\346\210\220.js"
+++ "b/north-glass-erp/northglass-erp/src/stores/sd/companySet/\351\207\221\345\215\216\345\244\251\346\210\220.js"
@@ -30,7 +30,7 @@
         deliveryDate:15,//璁㈠崟鍒涘缓閫佽揣鏃ユ湡 澶╂触7澶╋紝甯稿窞7澶╋紝涔変箤15澶╋紝鏂扮枂15澶�
         columnName:'鍥惧彿',//鎵撳嵃鐢熶骇鍗曟椂闇�瑕佹樉绀虹殑鍒楀悕锛屾病鏈変负绌�
         selectOrderReviewShow:true, //璁㈠崟棣栭〉鍔犲伐鍗曞鏍告寜閽槸鍚︽樉绀�
-        productName:"product_name",
+        productName:"product_abbreviation",
         decValue:2,//璁㈠崟淇濈暀浣嶆暟锛屽ぉ娲�3浣�,甯稿窞2浣�
         label:1,//鏍囩绫诲瀷,甯稿窞涓�2锛屽叾浠栦负1
         calculateType:1,//璁㈠崟璁$畻鏂瑰紡
diff --git a/north-glass-erp/northglass-erp/src/views/sd/product/CreateProduct.vue b/north-glass-erp/northglass-erp/src/views/sd/product/CreateProduct.vue
index 2acb993..6aab802 100644
--- a/north-glass-erp/northglass-erp/src/views/sd/product/CreateProduct.vue
+++ b/north-glass-erp/northglass-erp/src/views/sd/product/CreateProduct.vue
@@ -178,7 +178,10 @@
   //鏌ヨ浜у搧鏄惁閲嶅
   request.post(`/product/selectProduct/${company.productName}`,product).then((res) =>{
     if(res.code==200){
-      if(res.data.data.length>0){
+      if(res.data.data!==undefined && res.data.data.length>0){
+        if(type==='copy'){
+          productTotal.value.state = 1
+        }
         ElMessage.warning(t('product.msg.productDuplication'))
       }else{
         saveProducts(product)
@@ -197,7 +200,11 @@
       if(props.productFlag===false){
         emit('changePage')
       }else{
-        router.push("/main/product/selectProduct")
+        if(productTotal.value.id){
+          router.push({path:'/main/product/createProduct',query:{id:productTotal.value.id,random:Math.random()}})
+        }else{
+          router.push("/main/product/selectProduct")
+        }
       }
     }
   })
diff --git a/north-glass-erp/src/main/java/com/example/erp/service/sd/ProductService.java b/north-glass-erp/src/main/java/com/example/erp/service/sd/ProductService.java
index 319c357..139b642 100644
--- a/north-glass-erp/src/main/java/com/example/erp/service/sd/ProductService.java
+++ b/north-glass-erp/src/main/java/com/example/erp/service/sd/ProductService.java
@@ -3,6 +3,7 @@
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.parser.Feature;
+import com.aspose.cad.internal.I.S;
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -93,12 +94,23 @@
         Map<String,Object> getProductJson = updateProduct(productDetails,product);
         Product getProduct = JSONObject.parseObject(JSONObject.toJSONString(getProductJson.get("title")), Product.class);
         List<ProductDetail> getProductDetails = JSONArray.parseArray(JSONObject.toJSONString(getProductJson.get("detail")), ProductDetail.class);
-        if(getProduct.getId()!=null){
-            map.put("data",productMapper.selectProductId(productName,getProduct.getProductAbbreviation(), getProduct.getId()));
+        String productNameVal = null;
+        if(Objects.equals(productName, "product_name")){
+            productNameVal = getProduct.getProductName();
         }else{
-            map.put("data",productMapper.selectProduct(productName,getProduct.getProductAbbreviation()));
+            productNameVal =  getProduct.getProductAbbreviation();
         }
 
+
+        if(!Objects.equals(productNameVal, "") && productNameVal!=null){
+            if(getProduct.getId()!=null ){
+                map.put("data",productMapper.selectProductId(productName,productNameVal, getProduct.getId()));
+            }else{
+                map.put("data",productMapper.selectProduct(productName,productNameVal));
+            }
+        }
+
+
         return map;
 
     }
diff --git a/north-glass-erp/src/main/resources/mapper/sd/ProductMapper.xml b/north-glass-erp/src/main/resources/mapper/sd/ProductMapper.xml
index f618b08..479afa7 100644
--- a/north-glass-erp/src/main/resources/mapper/sd/ProductMapper.xml
+++ b/north-glass-erp/src/main/resources/mapper/sd/ProductMapper.xml
@@ -90,11 +90,11 @@
     </select>
 
     <select id="selectProduct">
-        select * from sd.product where ${productName}=#{productNameValue}
+        select id from sd.product where ${productName}=#{productNameValue}
     </select>
 
     <select id="selectProductId">
-        select * from sd.product where ${productName}=#{productNameValue} and id != #{id}
+        select id from sd.product where ${productName}=#{productNameValue} and id != #{id}
     </select>
 
     <select id="getPageTotal" >

--
Gitblit v1.8.0