zhuyiyi 1 місяць тому
батько
коміт
7897a9a9d5

+ 128 - 0
BizCom/Dao/CeErpUpFileSupplier.cs

@@ -0,0 +1,128 @@
+using Castle.ActiveRecord;
+using NHibernate.Criterion;
+using System;
+using System.Text;
+
+namespace BizCom
+{
+    [ActiveRecord("CE_ErpUpFileSupplier")]
+    public class CeErpUpFileSupplier : ComBase<CeErpUpFileSupplier>
+    {
+
+        /// <summary>
+        /// 
+        /// </summary>
+        [PrimaryKey(PrimaryKeyType.Native)]
+        public int ID { get; set; }
+
+        public int _supplierId = 0;
+        /// <summary>
+        /// 车间id
+        /// </summary>
+        [Property]
+        public int supplierId
+        {
+            get { return _supplierId; }
+            set { _supplierId = value; }
+        }
+
+        public string _payment = "";
+        /// <summary>
+        /// 金额
+        /// </summary>
+        [Property]
+        public string payment
+        {
+            get { return _payment; }
+            set { _payment = value; }
+        }
+
+        public string _size = "";
+        /// <summary>
+        /// 尺寸
+        /// </summary>
+        [Property]
+        public string size
+        {
+            get { return _size; }
+            set { _size = value; }
+        }
+
+        public string _number = "";
+        /// <summary>
+        /// 数量
+        /// </summary>
+        [Property]
+        public string number
+        {
+            get { return _number; }
+            set { _number = value; }
+        }
+
+        public string _seller_memo = "";
+        /// <summary>
+        /// 备注
+        /// </summary>
+        [Property]
+        public string seller_memo
+        {
+            get { return _seller_memo; }
+            set { _seller_memo = value; }
+        }
+
+        public string _shopIds = "";
+        /// <summary>
+        /// 店铺
+        /// </summary>
+        [Property]
+        public string shopIds
+        {
+            get { return _shopIds; }
+            set { _shopIds = value; }
+        }
+
+        public string _noShopIds = "";
+        /// <summary>
+        /// 禁止店铺
+        /// </summary>
+        [Property]
+        public string noShopIds
+        {
+            get { return _noShopIds; }
+            set { _noShopIds = value; }
+        }
+
+        public string _address = "";
+        /// <summary>
+        /// 地区
+        /// </summary>
+        [Property]
+        public string address
+        {
+            get { return _address; }
+            set { _address = value; }
+        }
+
+        public string _filterText = "";
+        /// <summary>
+        /// 排除条件
+        /// </summary>
+        [Property]
+        public string filterText
+        {
+            get { return _filterText; }
+            set { _filterText = value; }
+        }
+
+        public bool _isOpen = false;
+        /// <summary>
+        /// 排除条件
+        /// </summary>
+        [Property]
+        public bool isOpen
+        {
+            get { return _isOpen; }
+            set { _isOpen = value; }
+        }
+    }
+}

+ 5 - 1
SiteCore/Handler/sync.getbase.cs

@@ -343,7 +343,11 @@ namespace SiteCore.Handler
         {
             string curPemExpress = CurrentUser.User.pemExpress;
             string sql = "select * from CE_ErpMailInfo  where cpCode like 'LINK_%' and id in (" + curPemExpress + ");";
-            DataTable dt = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
+            DataTable dt = new DataTable();
+            if (string.IsNullOrEmpty(curPemExpress))
+            {
+                dt = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
+            }
             con.Response.Write(Utils.Serialization.JsonString.DataTable2MiniAjaxJson(dt));
 
             //string sql = "select id, ParentID ,Code,Name as name from CE_ErpPrintModel where ParentID=0";

+ 270 - 384
SiteCore/Handler/sync.order.cs

@@ -53,6 +53,7 @@ using static ICSharpCode.SharpZipLib.Zip.ExtendedUnixData;
 using static SiteCore.taoObj.Api_tmc_refund_info_Obj;
 using System.Threading.Tasks;
 using SiteCore.taoObj.WebApi;
+using System.Web.UI.WebControls.WebParts;
 
 namespace SiteCore.Handler
 {
@@ -12771,41 +12772,8 @@ namespace SiteCore.Handler
             returnSuccess(JsonConvert.SerializeObject(new { list }));
         }
 
-        Dictionary<int, Dictionary<string, string>> supplierMap = new Dictionary<int, Dictionary<string, string>>()
-        {
-            //chy----19
-            {19, new Dictionary<string, string> {{"不干胶", "不干胶"}, {"卡片", "卡片"}, { "宣传单", "宣传单" }, { "手提袋", "手提袋" } }},
-             //GD-CYT-----64
-            {64, new Dictionary<string, string> {{"不干胶", "不干胶"}, {"卡片", "卡片"}, {"杯套", "杯套"}}},
-             //ZHX----3
-            {3, new Dictionary<string, string> {{"不干胶", "不干胶"}, {"卡片", "卡片"}, {"插卡", "插卡"}, {"uv", "uv"}, { "班旗", "班旗" }}},
-            //JK----97
-            {97, new Dictionary<string, string> {{"uv", "uv"}}},
-            //ZT----70
-            {70, new Dictionary<string, string> {{"uv", "uv"}}},
-            //GD-CYTUV---126
-            {126, new Dictionary<string, string> {{"uv", "uv"}}},
-             //LHCY-----98
-            {98, new Dictionary<string, string> {{"条幅", "条幅"}, {"帆布", "帆布"}, { "贡缎布", "贡缎布" }, { "纱幔", "纱幔" }, { "班旗", "班旗" } }},
-             //XD-----90
-            {90, new Dictionary<string, string> {{"条幅", "条幅"}, {"桌布", "桌布"}, { "班旗", "班旗" } }},
-            //CYCY-----14
-            {14, new Dictionary<string, string> {{"卡片", "卡片"}, {"宣传单", "宣传单"}, {"杯套", "杯套"}}},
-            //THLZY----122
-            {122, new Dictionary<string, string> {{ "烫画", "烫画" }, { "冷转印", "冷转印" }}}
-        };
-        //其他改名
-        Dictionary<int, string> suppliers = new Dictionary<int, string>()
-        {
-            {15,"滴塑" }, {119,"数码" }, {121,"数码" }, {110,"刮刮卡" }, {10,"数码" },
-            {5,"海报" }, {80,"数码" }, {96,"数码" }, {9,"金属标" },
-            {7,"综合" }, {116,"棉卡" }, {59,"海报" }, {37,"不干胶" },
-            {81,"金属标" }, {30,"卡片" }, {111,"种子纸" }, {72,"金属标" },
-            {13,"数码" }, {45,"卷标" }, {31,"联单" }, {118,"海报" },
-            {71,"数码" }, {70,"uv" },{93,"金属标" },{105,"uv" },{97,"数码" },
-            {49,"暖心贴" }, {117,"手提袋" },{108,"写真布" },{44,"PVC" },{32,"扇子" },
-            {4,"不干胶" },{106,"不干胶" },{94,"纸杯" },{100,"暖心贴" },{114,"定制衫" },{ 129,"种子纸"},{ 125,"胶带"},{ 127,"PET透卡"}
-        };
+
+
         //不统计
         List<int> no_suppliers = new List<int>()
         {
@@ -12816,17 +12784,7 @@ namespace SiteCore.Handler
         {
             136,114,34,96
         };
-        //配件单
-        Dictionary<string, List<string>> maps = new Dictionary<string, List<string>>()
-        {
-            {"绳子",new List<string>(){"帆布", "卡片", "吊牌", "旗帜布" } },
-            {"棉绳",new List<string>(){ "卡片", "吊牌" } },
-            {"别针",new List<string>(){ "卡片", "吊牌" } },
-            {"刮刮膜",new List<string>(){ "卡片", "刮刮卡" } },
-            {"流苏",new List<string>(){ "卡片", "吊牌" } },
-            {"旗杆",new List<string>(){ "班旗" } },
-            {"牙签",new List<string>(){ "不干胶" } }
-        };
+
 
         public void get_place_order_data()
         {
@@ -12850,49 +12808,19 @@ namespace SiteCore.Handler
                 endtime = dateTime.ToString("yyyy-MM-dd 00:00:00");
                 end = DateTime.Parse(endtime);
             }
-            List<int> smSupplier = new List<int>() { 97, 121, 119, 80 };
+
             string startMonthDate = commonHelper.FirstDayOfMonth(DateTime.Now).ToString("yyyy-MM-dd 00:00:00");
             string endMonthDate = commonHelper.LastDayOfMonth(DateTime.Now).ToString("yyyy-MM-dd 23:59:59");
-            string sql = string.Format("select SupplierId,ProductId,seller_memo,ProductCount,ProductName,payment,SupplierName,UnusualTime,FinishPlaceTime,OrderState,FinishDeliveryTime,AfterSaleState=0,AfterSaleReason = '',delivery=0,shopId from view_ErpTradeCell where ( ( FinishPlaceTime BETWEEN '{0}' AND '{1}' ) OR ( OrderState = 6 AND UnusualTag = 5 AND IsRefund <= 1 ) )  AND IsSample = 0 and SupplierId > 0 ", starttime, endtime);
+            string sql = string.Format("select SupplierId,ProductId,seller_memo,ProductCount,ProductName,payment,SupplierName,UnusualTime,FinishPlaceTime,OrderState,FinishDeliveryTime,AfterSaleState=0,AfterSaleReason = '',delivery=0,shopId,UnusualTag from view_ErpTradeCell where ( ( FinishPlaceTime BETWEEN '{0}' AND '{1}' ) OR ( OrderState = 6 AND UnusualTag = 5 AND IsRefund <= 1 ) )  AND IsSample = 0 and SupplierId > 0 ", starttime, endtime);
             DataTable data = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
 
-            sql = string.Format("SELECT SupplierId, ProductId, seller_memo, ProductCount, ProductName, payment, SupplierName, UnusualTime, FinishPlaceTime, OrderState, FinishDeliveryTime, AfterSaleState,AfterSaleReason,delivery=0,shopId  FROM view_ErpTradeCell  WHERE ( AfterSalePreTime BETWEEN '{0}' AND '{1}' )  AND IsSample = 0  AND SupplierId > 0  AND FinishPlaceTime IS NOT NULL", startMonthDate, endMonthDate);
+            sql = string.Format("SELECT SupplierId, ProductId, seller_memo, ProductCount, ProductName, payment, SupplierName, UnusualTime, FinishPlaceTime, OrderState, FinishDeliveryTime, AfterSaleState,AfterSaleReason,delivery=0,shopId,UnusualTag  FROM view_ErpTradeCell  WHERE ( HandleTime BETWEEN '{0}' AND '{1}' )  AND IsSample = 0  AND SupplierId > 0  AND FinishPlaceTime IS NOT NULL", startMonthDate, endMonthDate);
             DataTable afterSaleData = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
             data.Merge(afterSaleData);
 
-            sql = string.Format("SELECT SupplierId, ProductId, seller_memo, ProductCount, ProductName, payment, SupplierName, UnusualTime, FinishPlaceTime, OrderState, FinishDeliveryTime, AfterSaleState=0,AfterSaleReason = '',delivery=1,shopId FROM view_ErpTradeCell  WHERE orderstate = 6  AND IsSample = 0  AND SupplierId > 0  AND  FinishPlaceTime > '2025-11-01 00:00:31.000' AND IsRefund <= 1 AND status = 'NOT_SHIPPED' AND LEN( ProductName ) > 0 AND SupplierId not in (86,10,105,86)", startMonthDate, endMonthDate);
+            sql = string.Format("SELECT SupplierId, ProductId, seller_memo, ProductCount, ProductName, payment, SupplierName, UnusualTime, FinishPlaceTime, OrderState, FinishDeliveryTime, AfterSaleState=0,AfterSaleReason = '',delivery=1,shopId,UnusualTag FROM view_ErpTradeCell  WHERE orderstate = 6  AND IsSample = 0  AND SupplierId > 0  AND  FinishPlaceTime > '2025-11-01 00:00:31.000' AND IsRefund <= 1 AND LEN( ProductName ) > 0 AND SupplierId not in (86,10,105,86)", startMonthDate, endMonthDate);
             DataTable deliveryData = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
             data.Merge(deliveryData);
-            //获取商品发货时间
-            string timer_sql = string.Format("select * from CE_ErpSupplierProductTime");
-            DataTable timer_data = DbHelper.DbConn.ExecuteDataset(timer_sql).Tables[0];
-
-            Dictionary<int, List<CeErpSupplierProductTime>> timer_map = new Dictionary<int, List<CeErpSupplierProductTime>>();
-            foreach (DataRow datarow in timer_data.Rows)
-            {
-                List<CeErpSupplierProductTime> list = null;
-                int supplierId = Convert.ToInt32(datarow["SupplierId"]);
-                if (timer_map.ContainsKey(supplierId))
-                {
-                    timer_map.TryGetValue(supplierId, out list);
-                }
-                else
-                {
-                    list = new List<CeErpSupplierProductTime>();
-                    timer_map.Add(supplierId, list);
-                    timer_map.TryGetValue(supplierId, out list);
-                }
-                CeErpSupplierProductTime ceErpSupplierProductTime = new CeErpSupplierProductTime();
-
-                ceErpSupplierProductTime.quantity = Convert.ToInt32(datarow["quantity"]);
-                ceErpSupplierProductTime.dayDeadLine = datarow["dayDeadLine"].ToString();
-                ceErpSupplierProductTime.deadLine = datarow["deadLine"].ToString();
-                ceErpSupplierProductTime.productId = datarow["productId"].ToString();
-                ceErpSupplierProductTime.craft = datarow["craft"].ToString();
-                ceErpSupplierProductTime.sendDay = Convert.ToInt32(datarow["sendDay"]);
-                list.Add(ceErpSupplierProductTime);
-
-            }
 
             //不干胶-----1,卡片-----29
             Dictionary<string, Dictionary<string, int>> other_map = new Dictionary<string, Dictionary<string, int>>();
@@ -12910,27 +12838,8 @@ namespace SiteCore.Handler
                 }
                 string seller_memo = row["seller_memo"].ToString();
 
-                bool ispj = false;//是否配件单
-                bool isfirst = true;//第一个配
+                bool ispj = commonHelper.placeDataIsPeijian(seller_memo);//是否配件单
 
-                maps.Keys.ForEach(key =>
-                {
-                    //备注包含配件
-                    if (seller_memo.Contains(key) && isfirst)
-                    {
-                        List<string> list = maps[key];
-                        ispj = true;
-                        isfirst = false;
-                        for (int i = 0; i < list.Count; i++)
-                        {
-                            if (seller_memo.Contains(list[i]))
-                            {
-                                ispj = false;
-                                break;
-                            }
-                        }
-                    }
-                });
                 if (ispj)
                 {
                     continue;
@@ -12949,35 +12858,18 @@ namespace SiteCore.Handler
                 seller_memo = seller_memo.Replace("横幅", "条幅");
                 seller_memo = seller_memo.Replace("锦旗", "条幅");
 
-                string map_key = "";
-                string type = "";
+                string map_key = commonHelper.placeDataGetMapKey(seller_memo, supplierId);
+                string type = commonHelper.placeDataGetMapKey(seller_memo, supplierId);
 
-                if (supplierMap.ContainsKey(supplierId))
-                {
-                    foreach (var kvp in supplierMap[supplierId])
-                    {
-                        if (seller_memo.Contains(kvp.Key))
-                        {
-                            map_key = kvp.Value;
-                            type = kvp.Value;
-                            break;
-                        }
-                    }
-                }
                 if (map_key == "")
                 {
-
                     type = ProductName;
                     map_key = ProductName;
-                    if (smSupplier.Contains(supplierId))
-                    {
-                        type = "数码";
-                        map_key = "数码";
-                    }
                 }
-                if ("其他".Equals(map_key) && suppliers.ContainsKey(supplierId))
+
+                if ("其他".Equals(map_key) && commonHelper.suppliers.ContainsKey(supplierId))
                 {
-                    map_key = suppliers[supplierId];
+                    map_key = commonHelper.suppliers[supplierId];
                 }
 
                 map_key += "_" + row["SupplierName"].ToString();
@@ -13010,99 +12902,9 @@ namespace SiteCore.Handler
                 DateTime palceTimeTwoEnd = DateTime.Parse(palceTime.ToString("yyyy-MM-dd 23:59:59")).AddHours(2);
 
                 DateTime FinishPlaceTime = DateTime.Parse(row["FinishPlaceTime"].ToString());
-                //GD-CYT-----64
-                DateTime two = palceTimeStart.AddHours(14);
-                DateTime three = palceTimeStart.AddHours(15);
-                DateTime four = palceTimeStart.AddHours(16);
-                DateTime six = palceTimeStart.AddHours(18);
-                bool istoday = false;
-                if (supplierId == 64 && "不干胶".Equals(type) && !seller_memo.Contains("牙签"))
-                {
-                    //下午四点前 500-1000
-                    string count = row["ProductCount"].ToString();
-                    if (count != null && count.Length > 0)
-                    {
-                        int productCount = commonHelper.getPlaceProductCount(count);
-                        if (productCount >= 500 && productCount <= 1000)
-                        {
-
-                            if (DateTime.Compare(FinishPlaceTime, four) < 0)
-                            {
-                                istoday = true;
-                            }
-                        }
-
-                    }
-                }
-                //UV
-                else if ("uv".Equals(type))
-                {
-
-                    //ZT----70
-                    //ZHX----3
-
-                    if (DateTime.Compare(FinishPlaceTime, four) < 0 && (supplierId == 70 || supplierId == 3))
-                    {
-                        istoday = true;
-                    }
-                    //JK----97
-                    //HZX----105
-                    if (DateTime.Compare(FinishPlaceTime, two) < 0 && (supplierId == 97 || supplierId == 105))
-                    {
-                        istoday = true;
-                    }
-                    if (DateTime.Compare(FinishPlaceTime, six) < 0 && (supplierId == 126))
-                    {
-                        istoday = true;
-                    }
 
-                }
-                //帆布---52|条幅---27
-                else if ("帆布".Equals(type) || "条幅".Equals(type))
-                {
-                    //LHCY-----98
-                    if (DateTime.Compare(FinishPlaceTime, three) < 0 && (supplierId == 98))
-                    {
-                        istoday = true;
-                    }
-                }
-                //条幅
-                else if ("条幅".Equals(type))
-                {
-                    //XD-----90
-                    if (DateTime.Compare(FinishPlaceTime, two) < 0 && (supplierId == 90))
-                    {
-                        istoday = true;
-                    }
-                }
-                //桌布
-                else if ("桌布".Equals(type))
-                {
-                    //XD-----90
-                    if (DateTime.Compare(FinishPlaceTime, three) < 0 && (supplierId == 90))
-                    {
-                        istoday = true;
-                    }
-                }
-                //DL---10
-                //AYTW---119
-                //FS-CYT-DY ----80
-                //JK----97
-                else if (supplierId == 10 || supplierId == 119 || supplierId == 80 || supplierId == 97)
-                {
-                    if (DateTime.Compare(FinishPlaceTime, three) < 0)
-                    {
-                        istoday = true;
-                    }
-                }
-                // QC---121
-                else if (supplierId == 121)
-                {
-                    if (DateTime.Compare(FinishPlaceTime, six) < 0)
-                    {
-                        istoday = true;
-                    }
-                }
+                //GD-CYT-----64
+                bool istoday = commonHelper.placeDataIsToday(row, type);
 
                 if (afterSaleState == 0 && delivery == 0)
                 {
@@ -13110,11 +12912,6 @@ namespace SiteCore.Handler
                     if (DateTime.Compare(start, palceTime) < 0 && DateTime.Compare(end, palceTime) > 0)
                     {
                         map["dayTotal"]++;
-                        if (supplierId == 97)
-                        {
-                            supplierId = 97;
-
-                        }
                     }
 
                     if (Convert.ToDecimal(row["payment"]) >= 500)
@@ -13165,132 +12962,15 @@ namespace SiteCore.Handler
                 else
                 {
                     map["deliveryNum"]++;
-                    try
+                    if (no_shop.Contains(shopId))
                     {
-                        if (no_shop.Contains(shopId))
-                        {
-                            continue;
-                        }
-                        if (istoday)
-                        {
-                            map["unusua"]++;
-                            continue;
-                        }
-                        if (supplierId == 0 || productId == 0)
-                        {
-                            continue;
-                        }
-
-                        //没配置时间
-                        if (!timer_map.ContainsKey(supplierId))
-                        {
-                            continue;
-                        }
-                        List<CeErpSupplierProductTime> timmerList = timer_map[supplierId];
-                        if (timmerList.Count == 0)
-                        {
-                            continue;
-                        }
-                        string[] productIds = null;
-                        string finishPlaceTime = row["FinishPlaceTime"].ToString();
-                        string sellmer_mome = row["seller_memo"].ToString();
-                        string txtCount = row["ProductCount"].ToString();
-                        DateTime placeTime = DateTime.Now;
-
-                        if (string.IsNullOrEmpty(finishPlaceTime))
-                        {
-                            continue;
-                        }
-                        placeTime = DateTime.Parse(finishPlaceTime);
-                        bool isSendTime = false;
-                        foreach (CeErpSupplierProductTime productTime in timmerList)
-                        {
-                            string txtIds = productTime.productId;
-                            string[] crafts = { };
-                            int count = productTime.quantity;
-                            if (string.IsNullOrEmpty(txtIds))
-                            {
-                                continue;
-                            }
-                            if (count > 0)
-                            {
-                                int quantity = commonHelper.handleProductCount(txtCount, true);
-                                //订单数量大于写入的数量则跳过
-                                if (quantity > count)
-                                {
-                                    continue;
-                                }
-                            }
-                            productIds = txtIds.Split(',');
-                            if (productIds.Contains(productId.ToString()))
-                            {
-                                string textCraft = productTime.craft;
-                                textCraft = textCraft.Replace(",", ",");//统一格式
-                                if (!string.IsNullOrEmpty(textCraft))
-                                {
-                                    crafts = textCraft.Split(',');
-                                }
-                                if (crafts.Length > 0)
-                                {
-                                    bool isinCraft = false;
-                                    for (int i = 0; i < crafts.Length; i++)
-                                    {
-                                        if (sellmer_mome.IndexOf(crafts[i]) >= 0)
-                                        {
-                                            isinCraft = true;
-                                            break;
-                                        }
-                                    }
-                                    //有写工艺并且备注中没匹配中则跳过
-                                    if (!isinCraft)
-                                    {
-                                        continue;
-                                    }
-                                }
-                                DateTime deadLine = DateTime.Parse(productTime.deadLine);
-                                DateTime dayDeadLine = DateTime.Parse(productTime.dayDeadLine);
-
-                                int sendDay = productTime.sendDay;
-
-                                //订单发货时间
-                                DateTime sendtime = placeTime;
-
-                                //下单时间小于当日发货时间则不用判断
-                                //当日发货必须发货
-                                if (dayDeadLine.Hour > 0 && dayDeadLine.Hour > placeTime.Hour)
-                                {
-                                    sendtime = DateTime.Parse(placeTime.ToString("yyyy-MM-dd 23:59:59"));
-                                }
-                                else if (deadLine.Hour > 0 && deadLine.Hour > placeTime.Hour)
-                                {
-                                    //在截稿时间之前下单的可以减去一天时间
-                                    sendDay = Math.Max(1, sendDay - 1);
-                                    sendtime = DateTime.Parse(placeTime.ToString("yyyy-MM-dd 00:00:00")).AddDays(sendDay);
-                                }
-                                else
-                                {
-                                    sendDay = Math.Max(1, sendDay - 1);
-                                    sendtime = DateTime.Parse(placeTime.ToString("yyyy-MM-dd 23:59:59")).AddDays(sendDay);
-                                }
-
-                                //判断有没有到发货日期大于0还没到发货时间
-                                if (DateTime.Compare(sendtime.Date, DateTime.Now.Date) < 0)
-                                {
-                                    //匹配到就不要继续匹配了   
-                                    isSendTime = true;
-                                    break;
-                                }
-                            }
-                        }
-                        if (isSendTime)
-                        {
-                            map["unusua"]++;
-                        }
+                        continue;
                     }
-                    catch (Exception ex)
+                    if (!Convert.IsDBNull(row["UnusualTag"]) && Convert.ToInt32(row["UnusualTag"]) == 5)
                     {
-                        XLog.SaveLog(0, row["ctid"].ToString() + "更新发货异常订单错误:" + ex);
+                        map["unusua"]++;
                     }
+                    continue;
 
                 }
 
@@ -13344,6 +13024,8 @@ namespace SiteCore.Handler
             writeGridDataTableJson(dtNew.Rows.Count, dtNew);
         }
 
+
+
         public void get_place_all_order_data()
         {
             string date1 = GetPostString("date1");
@@ -13402,7 +13084,6 @@ namespace SiteCore.Handler
                 list.Add(ceErpSupplierProductTime);
 
             }
-            List<int> smSupplier = new List<int>() { 97, 121, 119, 80 };
             foreach (DataRow row in data.Rows)
             {
                 //存储数据
@@ -13416,27 +13097,8 @@ namespace SiteCore.Handler
                 }
                 string seller_memo = row["seller_memo"].ToString();
 
-                bool ispj = false;//是否配件单
-                bool isfirst = true;//第一个配
+                bool ispj = commonHelper.placeDataIsPeijian(seller_memo);//是否配件单
 
-                maps.Keys.ForEach(key =>
-                {
-                    //备注包含配件
-                    if (seller_memo.Contains(key) && isfirst)
-                    {
-                        List<string> list = maps[key];
-                        ispj = true;
-                        isfirst = false;
-                        for (int i = 0; i < list.Count; i++)
-                        {
-                            if (seller_memo.Contains(list[i]))
-                            {
-                                ispj = false;
-                                break;
-                            }
-                        }
-                    }
-                });
                 if (ispj)
                 {
                     continue;
@@ -13455,35 +13117,17 @@ namespace SiteCore.Handler
                 seller_memo = seller_memo.Replace("横幅", "条幅");
                 seller_memo = seller_memo.Replace("锦旗", "条幅");
 
-                string map_key = "";
-                string type = "";
+                string map_key = commonHelper.placeDataGetMapKey(seller_memo, supplierId);
+                string type = commonHelper.placeDataGetMapKey(seller_memo, supplierId);
 
-                if (supplierMap.ContainsKey(supplierId))
-                {
-                    foreach (var kvp in supplierMap[supplierId])
-                    {
-                        if (seller_memo.Contains(kvp.Key))
-                        {
-                            map_key = kvp.Value;
-                            type = kvp.Value;
-                            break;
-                        }
-                    }
-                }
                 if (map_key == "")
                 {
-
                     type = ProductName;
                     map_key = ProductName;
-                    if (smSupplier.Contains(supplierId))
-                    {
-                        type = "数码";
-                        map_key = "数码";
-                    }
                 }
-                if ("其他".Equals(map_key) && suppliers.ContainsKey(supplierId))
+                if ("其他".Equals(map_key) && commonHelper.suppliers.ContainsKey(supplierId))
                 {
-                    map_key = suppliers[supplierId];
+                    map_key = commonHelper.suppliers[supplierId];
                 }
 
                 map_key += "_" + row["SupplierName"].ToString();
@@ -15299,6 +14943,248 @@ namespace SiteCore.Handler
             DataTable dt = WebCache.GetData("view_ErpAssignLog", dStruct);
             writeGridDataTableJson(dStruct.TotalCount, dt);
         }
+
+        public void change_upfile_status()
+        {
+            int id = GetPostInt("id");
+
+            CeErpUpFileSupplier ceErpUpFileSupplier = CeErpUpFileSupplier.Get(id);
+            if (ceErpUpFileSupplier != null)
+            {
+                ceErpUpFileSupplier.isOpen = !ceErpUpFileSupplier.isOpen;
+                ceErpUpFileSupplier.Update();
+            }
+
+            returnSuccessMsg("保存成功");
+        }
+
+        public void test_seller_memo_upfile()
+        {
+            string ctid = GetPostString("ctid");
+
+            CeErpTradeCell ce = CeErpTradeCell.GetByCtid(ctid);
+
+            if (ce == null)
+            {
+                returnErrorMsg("查无订单");
+                return;
+            }
+            int supplierId = getsupplierId(ce);
+            if (supplierId > 0)
+            {
+                CeErpSupplier ceErpSupplier = CeErpSupplier.Get(supplierId);
+                if (ceErpSupplier != null)
+                {
+                    returnSuccessMsg(ceErpSupplier.ComName);
+                    return;
+                }
+            }
+            returnErrorMsg("未匹配到车间");
+            return;
+        }
+
+        private int getsupplierId(CeErpTradeCell entity)
+        {
+            int supplierId = 0;
+            StringBuilder sql = new StringBuilder();
+            sql.AppendFormat("select * from CE_ErpUpFileSupplier where isOpen = 1");
+            DataTable cellEx = DbHelper.DbConn.ExecuteDataset(sql.ToString()).Tables[0];
+
+            int num = getProductCount(entity.seller_memo);
+            foreach (DataRow row in cellEx.Rows)
+            {
+                bool isIn = true;
+                //判断材质工艺都要符合
+                if (!Convert.IsDBNull(row["seller_memo"]) && !string.IsNullOrEmpty(row["seller_memo"].ToString()))
+                {
+                    string memo = row["seller_memo"].ToString();
+
+                    string[] memolist = memo.Split('+');
+                    for (int i = 0; i < memolist.Length; i++)
+                    {
+                        if (!Regex.IsMatch(entity.seller_memo, memolist[i].Replace("/", "|")))
+                        {
+                            isIn = false;
+                        }
+                    }
+                }
+
+                if (!isIn)
+                {
+                    continue;
+                }
+                //判断金额符不符合
+                if (!Convert.IsDBNull(row["payment"]) && !string.IsNullOrEmpty(row["payment"].ToString()))
+                {
+                    string payment = row["payment"].ToString();
+                    string[] paymentList = payment.Split('-');
+
+                    if (!string.IsNullOrEmpty(paymentList[0]))
+                    {
+                        if (entity.payment < Convert.ToDouble(paymentList[0]))
+                        {
+                            continue;
+                        }
+                    }
+
+                    if (!string.IsNullOrEmpty(paymentList[1]))
+                    {
+                        if (entity.payment > Convert.ToDouble(paymentList[1]))
+                        {
+                            continue;
+                        }
+                    }
+                }
+
+                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");
+                    Regex reg = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.Multiline, TimeSpan.FromSeconds(2));//2秒后超时
+                    MatchCollection matches = reg.Matches(memo);//设定要查找的字符串
+                    double width = 0;
+                    double height = 0;
+                    try
+                    {
+                        if (matches[0].Success)
+                        {
+                            string sizematches = matches[0].Groups[0].Value;
+                            sizematches = sizematches.Replace("mm", "");
+                            sizematches = sizematches.Replace("cm", "");
+                            string[] size_list = sizematches.Split('x');
+                            if (size_list.Length > 1)
+                            {
+                                width = Convert.ToDouble(size_list[0]);
+                                height = Convert.ToDouble(size_list[1]);
+                            }
+
+                        }
+
+                    }
+                    catch (Exception ex)
+                    {
+
+                    }
+                    string size = row["size"].ToString();
+                    string[] sizeList = size.Split('-');
+                    if (!string.IsNullOrEmpty(sizeList[0]))
+                    {
+                        string[] sizeItemList = sizeList[0].Split('x');
+                        //第一个尺寸格式不正确
+                        if (sizeItemList.Length < 2)
+                        {
+                            continue;
+                        }
+                        double sizeWidth = Convert.ToDouble(sizeItemList[0]);
+                        double sizeheight = Convert.ToDouble(sizeItemList[1]);
+                        //备注尺寸要大于第一个尺寸
+
+                        if (!((width > sizeWidth && height > sizeheight) || (width > sizeheight && height > sizeWidth)))
+                        {
+                            continue;
+                        }
+
+                    }
+
+                    if (!string.IsNullOrEmpty(sizeList[1]))
+                    {
+                        string[] sizeItemList = sizeList[1].Split('x');
+                        //第二个尺寸格式不正确
+                        if (sizeItemList.Length < 2)
+                        {
+                            continue;
+                        }
+                        double sizeWidth = Convert.ToDouble(sizeItemList[0]);
+                        double sizeheight = Convert.ToDouble(sizeItemList[1]);
+                        //备注尺寸要大于第二个尺寸
+
+                        if (!((width < sizeWidth && height < sizeheight) || (width < sizeheight && height < sizeWidth)))
+                        {
+                            continue;
+                        }
+
+                    }
+                }
+                //判断数量是否符合
+                if (!Convert.IsDBNull(row["number"]) && !string.IsNullOrEmpty(row["number"].ToString()))
+                {
+                    string numberText = row["number"].ToString();
+
+                    string[] numberTextList = numberText.Split('-');
+                    int number = 0;
+                    if (!string.IsNullOrEmpty(numberTextList[0]))
+                    {
+                        number = Convert.ToInt32(numberTextList[0]);
+                        if (number > num)
+                        {
+                            continue;
+                        }
+                    }
+                    if (!string.IsNullOrEmpty(numberTextList[1]))
+                    {
+                        number = Convert.ToInt32(numberTextList[1]);
+                        if (number < num)
+                        {
+                            continue;
+                        }
+                    }
+                }
+                //判断店铺符不符合
+                if (!Convert.IsDBNull(row["shopIds"]) && !string.IsNullOrEmpty(row["shopIds"].ToString()))
+                {
+                    List<string> shopids = row["shopIds"].ToString().Split(',').ToList();
+
+                    if (!shopids.Contains(entity.ShopId.ToString()))
+                    {
+                        continue;
+                    }
+                }
+                //地区不符合
+                if (!Convert.IsDBNull(row["address"]) && !string.IsNullOrEmpty(row["address"].ToString()))
+                {
+                    if (!Regex.IsMatch(entity.seller_memo, row["address"].ToString().Replace("、", "|")))
+                    {
+                        continue;
+                    }
+                }
+                //限制条件
+                if (!Convert.IsDBNull(row["filterText"]) && !string.IsNullOrEmpty(row["filterText"].ToString()))
+                {
+                    if (!Regex.IsMatch(entity.seller_memo, row["filterText"].ToString().Replace("/", "|")))
+                    {
+                        continue;
+                    }
+                }
+                supplierId = Convert.ToInt32(row["supplierId"]);
+                break;
+            }
+
+            return supplierId;
+        }
+
+        public static int getProductCount(string txt)
+        {
+            // 提取"个"或"张"前面的数字
+            int unit = 0;
+            try
+            {
+                string unitPattern = @"(\d+)(?=个|张|本|套|件|卷|劵|条|箱 )";
+                System.Text.RegularExpressions.Match unitMatch = Regex.Match(txt, unitPattern);
+                string unitNum = unitMatch.Success ? unitMatch.Groups[1].Value : "1";
+
+                if (!int.TryParse(unitNum, out unit))
+                {
+                    return 0;
+                }
+
+            }
+            catch (Exception ex)
+            {
+
+            }
+            return unit;
+        }
+
     }
 }
 

+ 71 - 0
SiteCore/Handler/sync.shop.cs

@@ -690,5 +690,76 @@ namespace SiteCore.Handler
             returnErrorMsg("没有找到数据");
         }
 
+
+        public void get_erp_upFileList()
+        {
+            DataStruct dStruct = GetPostStruct();
+            List<string> lw = new List<string>();
+            string tid = GetPostString("ctid");
+            if (tid.Length > 0) lw.Add(string.Format("ctid like '%{0}%' ", tid));
+
+            dStruct.MainWhere = string.Join(" and ", lw.ToArray());
+            dStruct.Order = "ID DESC";
+            DataTable dt = WebCache.GetData("view_ErpUpFileSupplier", dStruct);
+            writeGridDataTableJson(dStruct.TotalCount, dt);
+        }
+
+        public void save_erp_upFileInfo()
+        {
+            int id = GetPostInt("id");
+            int supplierId = GetPostInt("supplierId");
+            string payment = GetPostString("payment");
+            string size = GetPostString("size");
+            string number = GetPostString("number");
+            string seller_memo = GetPostString("seller_memo");
+            string shopIds = GetPostString("shopIds");
+            string noShopIds = GetPostString("noShopIds");
+            string address = GetPostString("address");
+            string filterText = GetPostString("filterText");
+            CeErpUpFileSupplier ceErpUpFileSupplier = null;
+
+            if (id > 0)
+            {
+                ceErpUpFileSupplier = CeErpUpFileSupplier.Get(id);
+            }
+
+            if (ceErpUpFileSupplier == null)
+            {
+                ceErpUpFileSupplier = new CeErpUpFileSupplier();
+            }
+
+            ceErpUpFileSupplier.supplierId = supplierId;
+            ceErpUpFileSupplier.payment = payment;
+            ceErpUpFileSupplier.size = size;
+            ceErpUpFileSupplier.number = number;
+            ceErpUpFileSupplier.seller_memo = seller_memo;
+            ceErpUpFileSupplier.shopIds = shopIds;
+            ceErpUpFileSupplier.noShopIds = noShopIds;
+            ceErpUpFileSupplier.address = address;
+            ceErpUpFileSupplier.filterText = filterText;
+            if (ceErpUpFileSupplier.ID > 0)
+            {
+                ceErpUpFileSupplier.Update();
+            }
+            else
+            {
+                ceErpUpFileSupplier.Create();
+            }
+
+            returnSuccessMsg("保存成功");
+        }
+
+        public void del_erp_upFileInfo()
+        {
+            int id = GetPostInt("id");
+
+            CeErpUpFileSupplier ceErpUpFileSupplier = CeErpUpFileSupplier.Get(id);
+            if (ceErpUpFileSupplier != null)
+            {
+                ceErpUpFileSupplier.Delete();
+            }
+            returnSuccessMsg("操作成功");
+        }
+
     }
 }

+ 238 - 13
SiteCore/taobao/commonHelper.cs

@@ -27,12 +27,223 @@ using System.Linq;
 using System.Security.Cryptography;
 using System.Net.Http.Headers;
 using System.Net.Http;
+using NHibernate.Linq;
+using NPOI.SS.Formula.Functions;
 
 namespace SiteCore
 {
     public class commonHelper
     {
 
+
+        //配件单
+        public static Dictionary<string, List<string>> maps = new Dictionary<string, List<string>>()
+        {
+            {"绳子",new List<string>(){"帆布", "卡片", "吊牌", "旗帜布" } },
+            {"棉绳",new List<string>(){ "卡片", "吊牌" } },
+            {"别针",new List<string>(){ "卡片", "吊牌" } },
+            {"刮刮膜",new List<string>(){ "卡片", "刮刮卡" } },
+            {"流苏",new List<string>(){ "卡片", "吊牌" } },
+            {"旗杆",new List<string>(){ "班旗" } },
+            {"牙签",new List<string>(){ "不干胶" } }
+        };
+
+        //其他改名
+        public static Dictionary<int, string> suppliers = new Dictionary<int, string>()
+        {
+            {15,"滴塑" }, {119,"数码" }, {121,"数码" }, {110,"刮刮卡" }, {10,"数码" },
+            {5,"海报" }, {80,"数码" }, {96,"数码" }, {9,"金属标" },
+            {7,"综合" }, {116,"棉卡" }, {59,"海报" }, {37,"不干胶" },
+            {81,"金属标" }, {30,"卡片" }, {111,"种子纸" }, {72,"金属标" },
+            {13,"数码" }, {45,"卷标" }, {31,"联单" }, {118,"海报" },
+            {71,"数码" }, {70,"uv" },{93,"金属标" },{105,"uv" },{97,"数码" },
+            {49,"暖心贴" }, {117,"手提袋" },{108,"写真布" },{44,"PVC" },{32,"扇子" },
+            {4,"不干胶" },{106,"不干胶" },{94,"纸杯" },{100,"暖心贴" },{114,"定制衫" },{ 129,"种子纸"},{ 125,"胶带"},{ 127,"PET透卡"}
+        };
+
+        public static Dictionary<int, Dictionary<string, string>> supplierMap = new Dictionary<int, Dictionary<string, string>>()
+        {
+            //chy----19
+            {19, new Dictionary<string, string> {{"不干胶", "不干胶"}, {"卡片", "卡片"}, { "宣传单", "宣传单" }, { "手提袋", "手提袋" } }},
+             //GD-CYT-----64
+            {64, new Dictionary<string, string> {{"不干胶", "不干胶"}, {"卡片", "卡片"}, {"杯套", "杯套"}}},
+             //ZHX----3
+            {3, new Dictionary<string, string> {{"不干胶", "不干胶"}, {"卡片", "卡片"}, {"插卡", "插卡"}, {"uv", "uv"}, { "班旗", "班旗" }}},
+            //JK----97
+            {97, new Dictionary<string, string> {{"uv", "uv"}}},
+            //ZT----70
+            {70, new Dictionary<string, string> {{"uv", "uv"}}},
+            //GD-CYTUV---126
+            {126, new Dictionary<string, string> {{"uv", "uv"}}},
+             //LHCY-----98
+            {98, new Dictionary<string, string> {{"条幅", "条幅"}, {"帆布", "帆布"}, { "贡缎布", "贡缎布" }, { "纱幔", "纱幔" }, { "班旗", "班旗" } }},
+             //XD-----90
+            {90, new Dictionary<string, string> {{"条幅", "条幅"}, {"桌布", "桌布"}, { "班旗", "班旗" } }},
+            //CYCY-----14
+            {14, new Dictionary<string, string> {{"卡片", "卡片"}, {"宣传单", "宣传单"}, {"杯套", "杯套"}}},
+            //THLZY----122
+            {122, new Dictionary<string, string> {{ "烫画", "烫画" }, { "冷转印", "冷转印" }}}
+        };
+
+        public static bool placeDataIsPeijian(string seller_memo)
+        {
+            bool ispj = false;//是否配件单
+            bool isfirst = true;//第一个配
+
+            maps.Keys.ForEach(key =>
+            {
+                //备注包含配件
+                if (seller_memo.Contains(key) && isfirst)
+                {
+                    List<string> list = maps[key];
+                    ispj = true;
+                    isfirst = false;
+                    for (int i = 0; i < list.Count; i++)
+                    {
+                        if (seller_memo.Contains(list[i]))
+                        {
+                            ispj = false;
+                            break;
+                        }
+                    }
+                }
+            });
+            return ispj;
+        }
+
+        public static string placeDataGetMapKey(string seller_memo, int supplierId)
+        {
+            string map_key = "";
+            List<int> smSupplier = new List<int>() { 97, 121, 119, 80 };
+            if (supplierMap.ContainsKey(supplierId))
+            {
+                foreach (var kvp in supplierMap[supplierId])
+                {
+                    if (seller_memo.Contains(kvp.Key))
+                    {
+                        map_key = kvp.Value;
+                        break;
+                    }
+                }
+            }
+            if (map_key == "")
+            {
+                if (smSupplier.Contains(supplierId))
+                {
+                    map_key = "数码";
+                }
+            }
+            return map_key;
+        }
+
+        public static bool placeDataIsToday(DataRow row, string type)
+        {
+            bool istoday = false;
+            int supplierId = Convert.ToInt32(row["SupplierId"]);
+            string seller_memo = row["seller_memo"].ToString();
+
+            DateTime palceTime = DateTime.Parse(row["FinishPlaceTime"].ToString());
+            DateTime palceTimeStart = DateTime.Parse(palceTime.ToString("yyyy-MM-dd 00:00:00"));
+
+            DateTime FinishPlaceTime = DateTime.Parse(row["FinishPlaceTime"].ToString());
+            //GD-CYT-----64
+            DateTime two = palceTimeStart.AddHours(14);
+            DateTime three = palceTimeStart.AddHours(15);
+            DateTime four = palceTimeStart.AddHours(16);
+            DateTime six = palceTimeStart.AddHours(18);
+
+            string patterns = "牙签|烫金|电线胶|PVC不干胶覆哑膜|内部模切|牛皮纸不干胶";
+            if (supplierId == 64 && "不干胶".Equals(type) && !Regex.IsMatch(seller_memo, patterns))
+            {
+                //下午四点前 500-1000
+                string count = row["ProductCount"].ToString();
+                if (count != null && count.Length > 0)
+                {
+                    int productCount = commonHelper.getPlaceProductCount(count);
+                    if (productCount >= 500 && productCount <= 1000)
+                    {
+
+                        if (DateTime.Compare(FinishPlaceTime, four) < 0)
+                        {
+                            istoday = true;
+                        }
+                    }
+
+                }
+            }
+            //UV
+            else if ("uv".Equals(type))
+            {
+
+                //ZT----70
+                //ZHX----3
+
+                if (DateTime.Compare(FinishPlaceTime, four) < 0 && (supplierId == 70 || supplierId == 3))
+                {
+                    istoday = true;
+                }
+                //JK----97
+                //HZX----105
+                if (DateTime.Compare(FinishPlaceTime, two) < 0 && (supplierId == 97 || supplierId == 105))
+                {
+                    istoday = true;
+                }
+                if (DateTime.Compare(FinishPlaceTime, six) < 0 && (supplierId == 126))
+                {
+                    istoday = true;
+                }
+
+            }
+            //帆布---52|条幅---27
+            else if ("帆布".Equals(type) || "条幅".Equals(type))
+            {
+                //LHCY-----98
+                if (DateTime.Compare(FinishPlaceTime, three) < 0 && (supplierId == 98))
+                {
+                    istoday = true;
+                }
+            }
+            //条幅
+            else if ("条幅".Equals(type))
+            {
+                //XD-----90
+                if (DateTime.Compare(FinishPlaceTime, two) < 0 && (supplierId == 90))
+                {
+                    istoday = true;
+                }
+            }
+            //桌布
+            else if ("桌布".Equals(type))
+            {
+                //XD-----90
+                if (DateTime.Compare(FinishPlaceTime, three) < 0 && (supplierId == 90))
+                {
+                    istoday = true;
+                }
+            }
+            //DL---10
+            //AYTW---119
+            //FS-CYT-DY ----80
+            //JK----97
+            else if (supplierId == 10 || supplierId == 119 || supplierId == 80 || supplierId == 97)
+            {
+                if (DateTime.Compare(FinishPlaceTime, three) < 0)
+                {
+                    istoday = true;
+                }
+            }
+            // QC---121
+            else if (supplierId == 121)
+            {
+                if (DateTime.Compare(FinishPlaceTime, six) < 0)
+                {
+                    istoday = true;
+                }
+            }
+
+            return istoday;
+        }
+
         public static void autoRefreshRefundState()
         {
             StringBuilder sql = new StringBuilder();
@@ -517,7 +728,6 @@ namespace SiteCore
                 list.Add(ceErpSupplierProductTime);
 
             }
-
             List<string> tLst = new List<string>();
             if (dt != null && dt.Rows.Count > 0)
             {
@@ -525,14 +735,37 @@ namespace SiteCore
                 {
                     try
                     {
-
                         int supplierId = Convert.ToInt32(row["SupplierId"]);
                         int productId = Convert.ToInt32(row["productId"]);
                         if (supplierId == 0 || productId == 0)
                         {
                             continue;
                         }
+                        string seller_memo = row["seller_memo"].ToString();
+                        string finishPlaceTime = row["FinishPlaceTime"].ToString();
+                        DateTime placeTime = DateTime.Now;
 
+                        if (string.IsNullOrEmpty(finishPlaceTime))
+                        {
+                            continue;
+                        }
+                        placeTime = DateTime.Parse(finishPlaceTime);
+
+                        //订单发货时间
+                        DateTime sendtime = placeTime;
+
+                        string type = placeDataGetMapKey(seller_memo, supplierId);
+                        bool istoday = placeDataIsToday(row, type);
+
+                        //需要当天发货
+                        if (istoday)
+                        {
+                            if (DateTime.Compare(sendtime.Date, DateTime.Now.Date) < 0)
+                            {
+                                tLst.Add("'" + row["ctid"].ToString() + "'");
+                                continue;
+                            }
+                        }
                         //没配置时间
                         if (!timer_map.ContainsKey(supplierId))
                         {
@@ -544,16 +777,9 @@ namespace SiteCore
                             continue;
                         }
                         string[] productIds = null;
-                        string finishPlaceTime = row["FinishPlaceTime"].ToString();
-                        string sellmer_mome = row["seller_memo"].ToString();
+
                         string txtCount = row["ProductCount"].ToString();
-                        DateTime placeTime = DateTime.Now;
 
-                        if (string.IsNullOrEmpty(finishPlaceTime))
-                        {
-                            continue;
-                        }
-                        placeTime = DateTime.Parse(finishPlaceTime);
                         foreach (CeErpSupplierProductTime productTime in timmerList)
                         {
                             string txtIds = productTime.productId;
@@ -586,7 +812,7 @@ namespace SiteCore
                                     bool isinCraft = false;
                                     for (int i = 0; i < crafts.Length; i++)
                                     {
-                                        if (sellmer_mome.IndexOf(crafts[i]) >= 0)
+                                        if (seller_memo.IndexOf(crafts[i]) >= 0)
                                         {
                                             isinCraft = true;
                                             break;
@@ -603,8 +829,7 @@ namespace SiteCore
 
                                 int sendDay = productTime.sendDay;
 
-                                //订单发货时间
-                                DateTime sendtime = placeTime;
+
 
                                 //下单时间小于当日发货时间则不用判断
                                 //当日发货必须发货

+ 1 - 1
SiteCore/taobao/refundTmcHelper.cs

@@ -108,9 +108,9 @@ namespace SiteCore
                 }
                 Content tObj = refundFullObj.content;
                 CeErpTrade trade = CeErpTrade.Get(tObj.refOid);
-                commonHelper.sendOrderInfo(trade.tid, "", trade.buyer_id, trade.buyer_nick, 1);
                 if (trade != null)
                 {
+                    commonHelper.sendOrderInfo(trade.tid, "", trade.buyer_id, trade.buyer_nick, 1);
                     try
                     {
                         //apiDesign.API_GetPrintData_Refund(CeErpTradeCell.GetByTid(tObj.refOid));//退款同步设计师系统

+ 17 - 5
Web/DicPage.aspx

@@ -185,12 +185,14 @@
                 shopIds: shopIds.join(",")
             }
             postAjax("save_shop_info", params, function (data) {
-                resultShow(data); 
+                resultShow(data);
             })
         }
         var selectShopId = 0;
         function saveShopDesignFun() {
             let designId = mini.get("showDesign").getValue();
+
+            let productNames = mini.get("showDesign").getText();
             let id = $("#hId").val();
 
             let data = []
@@ -207,6 +209,7 @@
             };
             postAjax("save_dic_info", params, function (data) {
                 shop_list[index].designIds = designId
+                shop_list[index].productNames = productNames
                 canceShopDesignFun();
             })
         }
@@ -220,8 +223,10 @@
                 shop.designIds = "";
             }
             mini.get("showDesign").setValue(shop.designIds);
+            mini.get("showDesign").setText(shop.productNames);
             mini.get("showDesign_win").show();
         }
+
         function getDesignInfo() {
 
             if (shopList.length == 0 || productList.length == 0) {
@@ -251,7 +256,7 @@
                                     break;
                                 }
                             }
-                            info = { shopId: item.shopId, name: name, ids: [] };
+                            info = { shopId: item.shopId, name: name, ids: [], productNames: [] };
                             list.push(info);
                             index = list.length - 1;
                         } else {
@@ -259,6 +264,7 @@
                         }
                         if (item.designId != 0) {
                             info.ids.push(item.designId);
+                            info.productNames.push(item.PType);
 
                         } else {
                             info.id = item.ID;
@@ -267,7 +273,7 @@
                     })
                     let shopids = []
                     list.map(item => {
-                        shop_list.push({ id: item.id || "", shopId: item.shopId, designIds: item.ids.join(",") || "", shopName: item.name })
+                        shop_list.push({ id: item.id || "", shopId: item.shopId, designIds: item.ids.join(",") || "", shopName: item.name, productNames: item.productNames.join(",") })
                         shopids.push(item.shopId);
                     })
                     mini.get("designPemShop").setValue(shopids.join(","));
@@ -289,7 +295,13 @@
         }
 
     </script>
+    <style>
+        #showDesign_win .mini-panel-body {
+            overflow-y: scroll;
+        }
+    </style>
 </head>
+
 <body>
     <div style="display: none">
         <input runat="server" type="hidden" id="hClass" />
@@ -299,12 +311,12 @@
         <input type="hidden" id="hPemShop" />
         <a id="code_href" target="_blank" href="#">提示</a>
     </div>
-    <div id="showDesign_win" class="mini-window" title="店铺技能" style="width: 750px; height: 170px; position: relative; display: none">
+    <div id="showDesign_win" class="mini-window" title="店铺技能" style="width: 750px; height: 500px; position: relative; display: none">
         <table class="win_tb" border="0" cellpadding="0" cellspacing="1">
             <tr>
                 <td class="td1"></td>
                 <td class="td2" colspan="3">
-                    <div id="showDesign" class="mini-combobox" url="./Handler/sync.ashx?t=get_sel_product" style="width: 750px;" popupwidth="300" textfield="name" valuefield="id" multiselect="true" showclose="true">
+                    <div id="showDesign" class="mini-textboxlist" url="./Handler/sync.ashx?t=get_sel_product" style="width: 700px;" popupwidth="300" textfield="name" valuefield="id" multiselect="true" showclose="true" onvalidation="onComboValidation">
                         <div property="columns">
                             <div header="全部" field="name"></div>
                         </div>

+ 241 - 0
Web/EArc/UploadFile.aspx

@@ -0,0 +1,241 @@
+<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/View.master" AutoEventWireup="true" CodeFile="UploadFile.aspx.cs" Inherits="EArc_UploadFile" %>
+
+<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
+    <script type="text/javascript">
+        var exData = null;
+        var edit_id = "";
+        function addFn() {
+            edit_id = "";
+            $(".win_tb").find("input").val("");
+            $(".win_tb").find("textarea").val("");
+            mini.get("txtSupplier").setValue("");
+            mini.get("txtShopIds").setValue("");
+            mini.get("txtNoShopIds").setValue("");
+            mini.get("add_win").show();
+        }
+
+        function editFn(eid) {
+            edit_id = eid;
+            var rec = grid.getSelected();
+            mini.get("txtSupplier").setValue(rec.supplierId);
+
+            $("#txtPayment").val(rec.payment);
+            $("#txtSize").val(rec.size);
+            $("#txtNumber").val(rec.number);
+            $("#txtSeller_memo").val(rec.seller_memo);
+            mini.get("txtShopIds").setValue(rec.shopIds);
+            mini.get("txtNoShopIds").setValue(rec.noShopIds);
+            $("#txtAddress").val(rec.address);
+            $("#txtFilterText").val(rec.filterText);
+            mini.get("add_win").show();
+        }
+
+        function saveFn() {
+            var parms = new Object();
+            parms.id = edit_id;
+            parms.supplierId = mini.get("txtSupplier").getValue();
+
+            parms.payment = $("#txtPayment").val();
+            parms.size = $("#txtSize").val();
+            parms.number = $("#txtNumber").val();
+            parms.seller_memo = $("#txtSeller_memo").val();
+            parms.shopIds = mini.get("txtShopIds").getValue();
+            parms.noShopIds = mini.get("txtNoShopIds").getValue();
+            parms.address = $("#txtAddress").val();
+            parms.filterText = $("#txtFilterText").val();
+
+            postAjax("save_erp_upFileInfo", parms, function (data) {
+                mini.get("add_win").hide();
+                resultShow(data, "grid.reload();");
+            });
+        }
+
+        function delFn(eid) {
+            if (!confirm("确认删除?")) return;
+            postAjax("del_erp_upFileInfo", "id=" + eid, function (data) {
+                resultShow(data, "grid.reload();");
+            });
+        }
+
+
+        function cancelFn() {
+            mini.get("add_win").hide();
+        }
+
+        function actionRenderer(e) {
+            var grid = e.sender;
+            var record = e.record;
+            var id = record.ID;
+            var rowIndex = e.rowIndex;
+            var html = "";
+            html += getGridBtn("edit", "修改", "editFn('" + id + "')");
+            html += getGridBtn("stop", "删除", "delFn('" + id + "')");
+            return html;
+        }
+
+        function isopenRender(e) {
+            var grid = e.sender;
+            var record = e.record;
+            let state = record.isOpen == 1 ? "开启" : "关闭";
+            var html = `<span style="color:blue" onclick="changeStatus('${record.ID}')">${state}</span>`;
+            return html;
+        }
+        function changeStatus(e) {
+            postAjax("change_upfile_status", "id=" + e, function (data) {
+                resultShow(data, "grid.reload();");
+            });
+        }
+
+        function testSellerMemo() {
+            mini.prompt("请输入订单号:", "请输入",
+                function (action, value) {
+                    if (action == "ok") {
+                        postAjax("test_seller_memo_upfile", "ctid=" + value, function (data) {
+                            resultShow(data);
+                        });
+                    }
+                },
+                true
+            );
+        }
+        $(function () {
+
+        });
+
+
+    </script>
+    <style type="text/css">
+        .win_tb {
+            width: 96%;
+            margin-left: auto;
+            margin-right: auto;
+            margin-top: 10px;
+            background-color: #dedede;
+        }
+
+            .win_tb td {
+                height: 36px;
+                background-color: #fff;
+                font-size: 14px;
+                padding: 5px;
+            }
+
+            .win_tb input[type=text] {
+                width: 90%;
+                height: 24px;
+                font-size: 14px;
+            }
+
+            .win_tb input[type=checkbox] {
+                width: 18px;
+                height: 18px;
+            }
+
+            .win_tb select {
+                font-size: 14px;
+                height: 30px;
+                padding: 0px 5px;
+            }
+
+            .win_tb .td1 {
+                color: #666;
+                background-color: #F8F8F8;
+                text-align: center;
+            }
+
+            .win_tb .td2 {
+            }
+        /*.win_tb input{height:20px;}
+    .win_tb .td1{height:35px;width:120px;font-size:12px;text-align:center;}
+    .win_tb .td2{height:35px;width:280px;font-size:12pt;padding-left:5px;text-align:left;}*/
+    </style>
+</asp:Content>
+<asp:Content ID="Content2" ContentPlaceHolderID="btn" runat="Server">
+    <a class="mini-button mini-button-primary new_use_btn_blue" iconcls="icon-ok" onclick="testSellerMemo()">测试文件名</a>
+</asp:Content>
+<asp:Content ID="Content4" ContentPlaceHolderID="content" runat="Server">
+    <div class="mini-fit">
+        <div id="m_grid" class="mini-datagrid" style="width: 100%; height: 100%;" showemptytext="true" emptytext="暂无记录" url="../handler/sync.ashx?t=get_erp_upFileList">
+            <div property="columns">
+                <div field="supplierName" width="100" align="center" headeralign="center">车间名称</div>
+                <div field="payment" width="40" align="center" headeralign="center">金额</div>
+                <div field="size" width="40" align="center" headeralign="center">尺寸</div>
+                <div field="number" width="40" align="center" headeralign="center">数量</div>
+                <div field="seller_memo" width="140" align="center" headeralign="center">备注</div>
+                <div field="address" width="140" align="center" headeralign="center">地区</div>
+                <div field="filterText" width="80" align="center" headeralign="center">排除</div>
+                <div field="filterText" width="80" align="center" headeralign="center" renderer="isopenRender">状态</div>
+                <div name="action" width="120" headeralign="center" align="center" renderer="actionRenderer" cellstyle="padding:0;">#</div>
+            </div>
+        </div>
+    </div>
+
+    <div id="add_win" class="mini-window" title="上传信息" style="width: 750px; height: 400px; position: relative; display: none">
+        <table class="win_tb" border="0" cellpadding="0" cellspacing="1">
+            <tr>
+                <td class="td1">车间</td>
+                <td class="td2">
+                    <input id="txtSupplier" class="mini-combobox" style="width: 90%;" textfield="name" valuefield="id" required="true" allowinput="true" valuefromselect="true" url="../handler/sync.ashx?t=get_sel_supplier" />
+                </td>
+            </tr>
+            <tr>
+                <td class="td1">金额</td>
+                <td class="td2">
+                    <input type="text" id="txtPayment" />
+                </td>
+            </tr>
+            <tr>
+                <td class="td1">尺寸</td>
+                <td class="td2">
+                    <input type="text" id="txtSize" />
+                </td>
+            </tr>
+            <tr>
+                <td class="td1">数量</td>
+                <td class="td2">
+                    <input type="text" id="txtNumber" />
+                </td>
+            </tr>
+            <tr>
+                <td class="td1">备注</td>
+                <td class="td2">
+                    <input type="text" id="txtSeller_memo" />
+                </td>
+            </tr>
+
+            <tr>
+                <td class="td1">店铺</td>
+                <td class="td2">
+                    <input id="txtShopIds" class="mini-combobox" style="width: 90%;" textfield="name" valuefield="id" multiselect="true" showclose="true" allowinput="true" valuefromselect="true" url="../handler/sync.ashx?t=get_sel_shop" />
+                </td>
+            </tr>
+            <tr>
+                <td class="td1">禁止店铺</td>
+                <td class="td2">
+                    <input id="txtNoShopIds" class="mini-combobox" style="width: 90%;" textfield="name" valuefield="id" multiselect="true" showclose="true" allowinput="true" valuefromselect="true" url="../handler/sync.ashx?t=get_sel_shop" />
+                </td>
+            </tr>
+            <tr>
+                <td class="td1">排除</td>
+                <td class="td2">
+                    <input type="text" id="txtFilterText" />
+                </td>
+            </tr>
+            <tr>
+                <td class="td1">地区</td>
+                <td class="td2">
+                    <textarea type="text" id="txtAddress" class="min-textarea" style="width: 90%; height: 50px"></textarea>
+                </td>
+            </tr>
+            <tr>
+                <td colspan="4">
+                    <div class="win_btn" style="text-align: center;">
+                        <a class="mini-button" iconcls="icon-ok" onclick="saveFn">保存</a>&nbsp;
+                        <a class="mini-button" iconcls="icon-cancel" onclick="cancelFn">取消</a>
+                    </div>
+                </td>
+            </tr>
+        </table>
+    </div>
+</asp:Content>
+

+ 43 - 0
Web/EArc/UploadFile.aspx.cs

@@ -0,0 +1,43 @@
+using SiteCore;
+using SQLData;
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using Utils.Serialization;
+
+public partial class EArc_UploadFile : BasePage
+{
+    protected override void OnPreInit(EventArgs e)
+    {
+        _repTitle = "上传文件";
+        PmTag = "uploadFile";
+        //_selfCheckPermission = true;
+        _keyFilterVisible = true;
+        _addVisible = true;
+    }
+
+    protected void Page_Load(object sender, EventArgs e)
+    {
+        if (!IsPostBack)
+        {
+            //StringBuilder sql = new StringBuilder();
+            //sql.AppendFormat("select * from s_runinfotype");
+            //DataSet ds = DbHelper.DbConn.ExecuteDataset(sql.ToString());
+            //DataTable dt = ds.Tables[0];
+            //AppendScript("tData=" + JsonString.DataTable2Json(dt) + ";");
+
+            //selType.DataSource = dt;
+            //selType.DataValueField = "ID";
+            //selType.DataTextField = "Name";
+            //selType.DataBind();
+        }
+        //foreach (DataRow dr in dt.Rows)
+        //{
+        //}
+    }
+}

+ 2 - 11
Web/EDelivery/DemoOrder.aspx

@@ -6,17 +6,7 @@
    
 </asp:Content>
 <asp:Content ID="Content2" ContentPlaceHolderID="btn" runat="Server">
-       <table style="width: 100%;">
-        <tr>
-            <td style="width: 80%;">
-               <%-- <a id="id_sysWaybillBtn" class="mini-button mini-button-primary" style="padding: 2px 5px 2px 5px;" iconcls="icon-print" onclick="waybillFn()">系统打单</a>
-                <a class="mini-button mini-button-primary" style="padding: 2px 5px 2px 5px;" iconcls="icon-folder" onclick="returnOrderFn()">打回</a>
-                <a id="id_assignSupplier" runat="server" visible="false" class="mini-button mini-button-primary" style="padding: 2px 5px 2px 5px;" iconcls="icon-downgrade" onclick="assignSupplierFn()">供应商指派</a>
-                <a class="mini-button mini-button-danger" style="padding: 2px 5px 2px 5px;" iconcls="icon-print" onclick="CNwaybillFn()">菜鸟打单</a>
-                <a id="id_makeSupplier" runat="server" visible="false" class="mini-button mini-button-primary" style="padding: 2px 5px 2px 5px;" iconcls="icon-downgrade" onclick="makeSupplierFn()">制作车间设置</a>--%>
-            </td>
-        </tr>
-    </table>
+    <a id="btnExport" runat="server" class="mini-button mini-button-success new_use_btn_green" iconcls="icon-folder" onclick="exportFn()">导出</a>
 </asp:Content>
 
 <asp:Content ID="Content4" ContentPlaceHolderID="content" runat="Server">
@@ -27,6 +17,7 @@
                 <div type="checkcolumn" width="20"></div>
                 <div field="ctid" width="110" align="center" headeralign="center" renderer="orderIdRenderer">订单编号</div>
                 <div field="pay_time" width="80" align="center" headeralign="center" renderer="orderPTimeRenderer">付款时间</div>
+                <div field="seller_nick" width="80" align="center" visible="false" headeralign="center" renderer="orderPTimeRenderer">店铺</div>
                 <div field="payment" id="id_waitDelv_payment"  runat="server" visible="false" width="40" align="center" headeralign="center">金额</div>
                 <div field="IsSF" width="50" align="center" headeralign="center" renderer="SFRenderer">是否顺丰</div>
                 <div field="seller_memo" width="200" align="center" headeralign="center" renderer="memoRenderer">备注</div>

+ 1 - 0
Web/Global.asax

@@ -116,6 +116,7 @@
                                  typeof(CeErpPackData),
                                  typeof(CeErpInvoice),
                                  typeof(CeErpPackDataItem),
+                                 typeof(CeErpUpFileSupplier),
                                  typeof(CeErpAssignLog),
                                  typeof(CeErpSupplierProductTime),
                                  typeof(CeErpTradeCellFile),