|
|
@@ -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;
|