diff --git a/uploadFile.aspx.cs b/uploadFile.aspx.cs index 0c9855d..80985ab 100644 --- a/uploadFile.aspx.cs +++ b/uploadFile.aspx.cs @@ -26,6 +26,7 @@ using SQLData; using NHibernate.Mapping; using System.Collections.Generic; using System.Linq; +using NPOI.OpenXmlFormats.Shared; public partial class uploadFile : System.Web.UI.Page { @@ -252,134 +253,24 @@ public partial class uploadFile : System.Web.UI.Page entity.MemoOpt = 0; } - if (entity.payment < 500) + if (string.IsNullOrEmpty(entity.OtherMemo) && !entity.ctid.Contains("S_")) { - if (entity.seller_memo.Contains("插卡") && entity.ProductCount != null && !entity.seller_memo.Contains("S_")) + int supplierId = 0; + try { - if (num >= 100) - { - entity.IsVerifyToSupplier = true; - entity.SupplierId = 3; - entity.FinishPlaceTime = DateTime.Now; - } + supplierId = getsupplierId(entity); + } - if (((((entity.seller_memo.Contains("条幅彩色") && !entity.seller_memo.Contains("辽宁") && !entity.seller_memo.Contains("山东")) || entity.seller_memo.Contains("贡锻布") || entity.seller_memo.Contains("贡缎布") || entity.seller_memo.Contains("旗帜布")) && !entity.seller_memo.Contains("双喷")) || (entity.seller_memo.Contains("帆布") && !entity.seller_memo.Contains("帆布袋") && !entity.seller_memo.Contains("封边尺寸"))) && !entity.seller_memo.Contains("电子稿")) + catch (Exception ex) + { + XLog.SaveLog(0, "上传自动指派车间发生错误!" + ex); + } + if (supplierId > 0) { entity.IsVerifyToSupplier = true; - entity.SupplierId = 98; + entity.SupplierId = supplierId; entity.FinishPlaceTime = DateTime.Now; } - - } - string patterns = "出货|加急|顺丰|打印|专版|当天发"; - if (!Regex.IsMatch(entity.seller_memo, patterns) && string.IsNullOrEmpty(entity.OtherMemo) && !entity.ctid.Contains("S_")) - { - if (entity.payment <= 300 && num >= 200 && num <= 3000 && entity.ShopId != 14 && entity.ShopId != 99) - { - //300克铜板纸/铜版纸300克-覆哑膜/覆膜/不覆膜-直角/裁切 - if (!entity.seller_memo.Contains("opp") && !entity.seller_memo.Contains("按文件") && !entity.seller_memo.Contains("流苏") && !entity.seller_memo.Contains("排序") && !entity.seller_memo.Contains("烫金")) - { - if ((entity.seller_memo.Contains("直角") || entity.seller_memo.Contains("裁切")) && (entity.seller_memo.Contains("300克铜板纸") || entity.seller_memo.Contains("300克铜板纸")) && (entity.seller_memo.Contains("覆哑膜") || entity.seller_memo.Contains("覆膜") || entity.seller_memo.Contains("不覆膜"))) - { - entity.IsVerifyToSupplier = true; - entity.SupplierId = 14; - entity.FinishPlaceTime = DateTime.Now; - } - } - - } - if (entity.payment <= 100 && num > 500 && num <= 1500) - { - //数量0-1500 - //0-80*54 - string pattern = @"\b(\d{1,5}[x\*]\d{1,5}(mm|cm))\b"; - string memo = entity.seller_memo.Replace("MM", "mm").Replace("CM", "cm"); - Regex reg = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.Multiline, TimeSpan.FromSeconds(2));//2秒后超时 - MatchCollection matches = reg.Matches(memo);//设定要查找的字符串 - string size = ""; - double min_width = 80; - double min_height = 54; - double width = 0; - double height = 0; - bool isIn = false; - try - { - if (matches[0].Success) - { - size = matches[0].Groups[0].Value; - size = size.Replace("mm", ""); - size = size.Replace("cm", ""); - string[] size_list = size.Split('x'); - if (size_list.Length > 1) - { - width = Convert.ToDouble(size_list[0]); - height = Convert.ToDouble(size_list[1]); - } - - if ((width <= min_width && height <= min_height) || (height <= min_width && width <= min_height)) - { - isIn = true; - } - if (width < 30 || height < 30) - { - isIn = false; - } - } - - } - catch (Exception ex) - { - - } - - //铜版纸不干胶-覆亮膜 - if (isIn && entity.seller_memo.Contains("铜版纸不干胶") && entity.seller_memo.Contains("覆亮膜") && !entity.seller_memo.Contains("烫金") && !entity.seller_memo.Contains("排序")) - { - entity.IsVerifyToSupplier = true; - entity.SupplierId = 64; - entity.FinishPlaceTime = DateTime.Now; - } - } - if (entity.payment <= 500 && num > 200 && num <= 5000) - { - //数量0-5000 - if (entity.seller_memo.Contains("透明不干胶")) - { - entity.IsVerifyToSupplier = true; - entity.SupplierId = 64; - entity.FinishPlaceTime = DateTime.Now; - } - } - if (entity.payment <= 100 && num > 200 && num <= 1000) - { - //数量0-1000 - if (entity.seller_memo.Contains("铜版纸不干胶") && entity.seller_memo.Contains("覆哑膜")) - { - entity.IsVerifyToSupplier = true; - entity.SupplierId = 64; - entity.FinishPlaceTime = DateTime.Now; - } - } - if (entity.payment <= 500 && num > 0 && num <= 50) - { - //数量0-50 - if (entity.seller_memo.Contains("领淘550灯布海报") || entity.seller_memo.Contains("领淘户外写真海报")) - { - entity.IsVerifyToSupplier = true; - entity.SupplierId = 59; - entity.FinishPlaceTime = DateTime.Now; - } - } - if (entity.payment <= 500 && num > 0 && num <= 50) - { - //数量0-50 - if ((entity.seller_memo.Contains("桌布") && (entity.seller_memo.Contains("白底") || entity.seller_memo.Contains("蓝底") || entity.seller_memo.Contains("红底"))) || (entity.seller_memo.Contains("双喷") && entity.seller_memo.Contains("班旗") && entity.seller_memo.Contains("旗帜布") && (entity.seller_memo.Contains("左缝筒") || entity.seller_memo.Contains("四角打孔") || entity.seller_memo.Contains("净裁")))) - { - entity.IsVerifyToSupplier = true; - entity.SupplierId = 90; - entity.FinishPlaceTime = DateTime.Now; - } - } } if (entity.ProductId == 2690) @@ -537,15 +428,18 @@ public partial class uploadFile : System.Web.UI.Page { int supplierId = 0; StringBuilder sql = new StringBuilder(); - sql.AppendFormat("select * from CE_ErpUpFileSupplier "); - DataTable cellEx = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0]; - + sql.AppendFormat("select * from CE_ErpUpFileSupplier where isOpen = 1", ""); + DataTable cellEx = CeErpTradeCell.ExecuteDataset(sql.ToString()).Tables[0]; + if (entity == null) + { + return supplierId; + } int num = getProductCount(entity.seller_memo); foreach (DataRow row in cellEx.Rows) { bool isIn = true; //判断材质工艺都要符合 - if (Convert.IsDBNull(row["seller_memo"])) + if (!Convert.IsDBNull(row["seller_memo"]) && !string.IsNullOrEmpty(row["seller_memo"].ToString())) { string memo = row["seller_memo"].ToString(); @@ -564,7 +458,7 @@ public partial class uploadFile : System.Web.UI.Page continue; } //判断金额符不符合 - if (!Convert.IsDBNull(row["payment"])) + if (!Convert.IsDBNull(row["payment"]) && !string.IsNullOrEmpty(row["payment"].ToString())) { string payment = row["payment"].ToString(); string[] paymentList = payment.Split('-'); @@ -586,7 +480,7 @@ public partial class uploadFile : System.Web.UI.Page } } - if (!Convert.IsDBNull(row["size"])) + if (!Convert.IsDBNull(row["size"]) && !string.IsNullOrEmpty(row["size"].ToString())) { string pattern = @"\b(\d{1,5}[x\*]\d{1,5}(mm|cm))\b"; string memo = entity.seller_memo.Replace("MM", "mm").Replace("CM", "cm"); @@ -635,6 +529,7 @@ public partial class uploadFile : System.Web.UI.Page } } + if (!string.IsNullOrEmpty(sizeList[1])) { string[] sizeItemList = sizeList[1].Split('x'); @@ -655,7 +550,7 @@ public partial class uploadFile : System.Web.UI.Page } } //判断数量是否符合 - if (!Convert.IsDBNull(row["number"])) + if (!Convert.IsDBNull(row["number"]) && !string.IsNullOrEmpty(row["number"].ToString())) { string numberText = row["number"].ToString(); @@ -679,7 +574,7 @@ public partial class uploadFile : System.Web.UI.Page } } //判断店铺符不符合 - if (!Convert.IsDBNull(row["shopIds"])) + if (!Convert.IsDBNull(row["shopIds"]) && !string.IsNullOrEmpty(row["shopIds"].ToString())) { List shopids = row["shopIds"].ToString().Split(',').ToList(); @@ -688,8 +583,18 @@ public partial class uploadFile : System.Web.UI.Page continue; } } + //判断店铺符不符合 + if (!Convert.IsDBNull(row["noShopIds"]) && !string.IsNullOrEmpty(row["noShopIds"].ToString())) + { + List shopids = row["noShopIds"].ToString().Split(',').ToList(); + + if (shopids.Contains(entity.ShopId.ToString())) + { + continue; + } + } //地区不符合 - if (!Convert.IsDBNull(row["address"])) + if (!Convert.IsDBNull(row["address"]) && !string.IsNullOrEmpty(row["address"].ToString())) { if (!Regex.IsMatch(entity.seller_memo, row["address"].ToString().Replace("、", "|"))) { @@ -697,13 +602,15 @@ public partial class uploadFile : System.Web.UI.Page } } //限制条件 - if (!Convert.IsDBNull(row["filterText"])) + if (!Convert.IsDBNull(row["filterText"]) && !string.IsNullOrEmpty(row["filterText"].ToString())) { - if (!Regex.IsMatch(entity.seller_memo, row["filterText"].ToString().Replace("/", "|"))) + if (Regex.IsMatch(entity.seller_memo, row["filterText"].ToString().Replace("/", "|"))) { continue; } } + supplierId = Convert.ToInt32(row["supplierId"]); + break; } return supplierId;