Переглянути джерело

拦截尺寸,增加指派共创权限

zhuyiyi 3 тижнів тому
батько
коміт
95b6431800

Різницю між файлами не показано, бо вона завелика
+ 0 - 0
SiteCore/Handler/sync.order.cs


+ 55 - 11
SiteCore/taobao/commonHelper.cs

@@ -24,18 +24,9 @@ using System.Runtime.Remoting.Metadata.W3cXsd2001;
 using NPOI.OpenXmlFormats.Shared;
 using static SiteCore.taoObj.work_core_vo;
 using System.Linq;
-using NHibernate.Mapping;
-using System.Reflection.Emit;
-using NPOI.SS.Formula.Functions;
 using System.Security.Cryptography;
-using NHibernate.Hql.Ast;
-using System.Security.Principal;
-using Microsoft.SqlServer.Server;
 using System.Net.Http.Headers;
 using System.Net.Http;
-using System.Threading.Tasks;
-using System.Diagnostics;
-using NPOI.Util;
 
 namespace SiteCore
 {
@@ -3361,10 +3352,63 @@ namespace SiteCore
                 LogHelper.addLog(ceErpTrade.tid, 0, "老客户订单号:" + last_tid, Convert.ToInt32(OrderState.待设计));
             }
             DbHelper.DbConn.ExecuteNonQuery(string.Format("UPDATE [dbo].[CE_ErpTradeCell] set VipCustomer = {1} WHERE tid='{0}';", ceErpTrade.tid, VipCustomer));
-
             return;
         }
 
+        public static bool interceptionSizeUnit(string size, CeErpProduct ceErpProduct)
+        {
+            size = size.Replace(",", ",");
+            size = size.Replace("C", "c");
+            size = size.Replace("M", "m");
+
+            List<string> list = ExtractUnitsOnly(size);
+            if (list.Count == 0)
+            {
+                return true;
+            }
+            if (ceErpProduct == null)
+            {
+                return true;
+            }
+            //未设置的不处理
+            if (string.IsNullOrEmpty(ceErpProduct.SizeUnit))
+            {
+                return true;
+            }
+            //提取到的单位数量不符合
+            if (size.Contains(",") && size.Split(',').Length != list.Count)
+            {
+                return false;
+            }
+            if (size.Contains("+") && size.Split('+').Length != list.Count)
+            {
+                return false;
+            }
+            list = list.Distinct().ToList();
+            //不能同时存在两个尺寸单位
+            if (list.Count != 1)
+            {
+                return false;
+            }
+            if (!list[0].Equals(ceErpProduct.SizeUnit))
+            {
+                return false;
+            }
+            return true;
+        }
+        static List<string> ExtractUnitsOnly(string text)
+        {
+            List<string> units = new List<string>();
+            string pattern = @"(cm|mm)";
+
+            foreach (Match match in Regex.Matches(text, pattern))
+            {
+                units.Add(match.Value);
+            }
+
+            return units;
+        }
+
         public static string getProductCount(string txt)
         {
             txt = txt.Replace(",", ",");
@@ -3377,7 +3421,7 @@ namespace SiteCore
                 string kuanNum = kuanMatch.Success ? kuanMatch.Groups[1].Value : "1";
 
                 // 提取"个"或"张"前面的数字
-                string unitPattern = @"(\d+)(?=个|张|本|套|件|卷|劵 )";
+                string unitPattern = @"(\d+)(?=个|张|本|套|件|卷|劵|条|箱 )";
                 Match unitMatch = Regex.Match(txtList[i], unitPattern);
                 string unitNum = unitMatch.Success ? unitMatch.Groups[1].Value : "1";
                 int kuan = 1;

+ 56 - 0
SiteCore/taobao/tmcHelper.cs

@@ -2049,6 +2049,20 @@ namespace SiteCore
                 {
                     entity.NewProduct = 1;
                 }
+                bool size_result = commonHelper.interceptionSizeUnit(entity.ProductSize, ceErpProduct);
+                if (!size_result)
+                {
+                    entity.OrderState = 0;
+                    CeErpMessageTip ct = new CeErpMessageTip();
+                    ct.tid = entity.tid;
+                    ct.sectionId = 0;
+                    ct.userId = entity.CustomerUserId;
+                    ct.type = 3;
+                    ct.isVisit = false;
+                    ct.content = entity.tid + ",领单尺寸单位不符合规范,尺寸单位为:" + ceErpProduct.SizeUnit;
+                    ct.Create();
+                    LogHelper.addLog(entity.ctid, entity.CustomerUserId, "尺寸单位不符合规范!" + entity.seller_memo, entity.OrderState);
+                }
             }
             if (isNull)
             {
@@ -2232,6 +2246,20 @@ namespace SiteCore
                 {
                     entity.NewProduct = 1;
                 }
+                bool size_result = commonHelper.interceptionSizeUnit(entity.ProductSize, ceErpProduct);
+                if (!size_result)
+                {
+                    entity.OrderState = 0;
+                    CeErpMessageTip ct = new CeErpMessageTip();
+                    ct.tid = entity.tid;
+                    ct.sectionId = 0;
+                    ct.userId = entity.CustomerUserId;
+                    ct.type = 3;
+                    ct.isVisit = false;
+                    ct.content = entity.tid + ",领单尺寸单位不符合规范,尺寸单位为:" + ceErpProduct.SizeUnit;
+                    ct.Create();
+                    LogHelper.addLog(entity.ctid, entity.CustomerUserId, "尺寸单位不符合规范!" + entity.seller_memo, entity.OrderState);
+                }
             }
             if (isNull)
             {
@@ -3007,6 +3035,20 @@ namespace SiteCore
                 {
                     entity.NewProduct = 1;
                 }
+                bool size_result = commonHelper.interceptionSizeUnit(entity.ProductSize, ceErpProduct);
+                if (!size_result)
+                {
+                    entity.OrderState = 0;
+                    CeErpMessageTip ceErpMessageTip = new CeErpMessageTip();
+                    ceErpMessageTip.tid = entity.tid;
+                    ceErpMessageTip.sectionId = 0;
+                    ceErpMessageTip.userId = entity.CustomerUserId;
+                    ceErpMessageTip.type = 3;
+                    ceErpMessageTip.isVisit = false;
+                    ceErpMessageTip.content = entity.tid + ",领单尺寸单位不符合规范,尺寸单位为:" + ceErpProduct.SizeUnit;
+                    ceErpMessageTip.Create();
+                    LogHelper.addLog(entity.ctid, entity.CustomerUserId, "尺寸单位不符合规范!" + entity.seller_memo, entity.OrderState);
+                }
             }
             if (ishave)
             {
@@ -3444,6 +3486,20 @@ namespace SiteCore
                 {
                     entity.NewProduct = 1;
                 }
+                bool size_result = commonHelper.interceptionSizeUnit(entity.ProductSize, ceErpProduct);
+                if (!size_result)
+                {
+                    entity.OrderState = 0;
+                    CeErpMessageTip ceErpMessageTip = new CeErpMessageTip();
+                    ceErpMessageTip.tid = entity.tid;
+                    ceErpMessageTip.sectionId = 0;
+                    ceErpMessageTip.userId = entity.CustomerUserId;
+                    ceErpMessageTip.type = 3;
+                    ceErpMessageTip.isVisit = false;
+                    ceErpMessageTip.content = entity.tid + ",领单尺寸单位不符合规范,尺寸单位为:" + ceErpProduct.SizeUnit;
+                    ceErpMessageTip.Create();
+                    LogHelper.addLog(entity.ctid, entity.CustomerUserId, "尺寸单位不符合规范!" + entity.seller_memo, entity.OrderState);
+                }
             }
             if (ishave)
             {

+ 23 - 3
Web/js/index.js

@@ -212,7 +212,7 @@ function getMyTipOrder() {
                             callback: function (action) {
                                 if (action == "前往处理") {
                                     goToCheckOrder(ids);
-                                    
+
                                 }
                                 setTimeout(function () {
                                     getMyTipOrder();
@@ -291,11 +291,11 @@ function getMyTipOrder() {
                             if (action == "前往处理") {
                                 ids = ids.substring(0, ids.length - 1);
                                 goToHandleOrder(ids, toOrderState);
-                                
+
                             }
                             else if (action == "稍后提醒") {
                                 laterTipIdx = 30;
-                               
+
                             }
                             setTimeout(function () {
                                 getMyTipOrder();
@@ -420,6 +420,26 @@ function getMyTipOrder() {
                 });
             }
         }, function (data) { }, false)
+
+        postAjax("size_order_tip", "", function (data) {
+            if (data.length > 0) {
+                let content = "";
+                data.map(item => {
+                    content += item.content;
+                })
+                if (content != "") {
+                    mini.showMessageBox({
+                        title: "提示",
+                        iconCls: "mini-messagebox-question",
+                        buttons: ["我知道了"],
+                        message: content,
+                        callback: function (action) {
+
+                        }
+                    });
+                }
+            }
+        }, function (data) { }, false);
     }
     else {
         laterTipIdx--;

Деякі файли не було показано, через те що забагато файлів було змінено