zhuyiyi пре 5 месеци
родитељ
комит
b5d60aa1ba

+ 26 - 9
SiteCore/Handler/sync.order.cs

@@ -63,6 +63,7 @@ namespace SiteCore.Handler
 
             string poscode = CurrentUser.UserPost.Post.Code;
             DataStruct dStruct = GetPostStruct();
+
             //string a = SecurityHelper.DecryptSymmetric("YDaPXIhsKgw=");
             //jiemiUtils.ossFileDecrypt("C:\\Users\\231010\\Downloads\\opp袋.xlsx");
             //apiHelper.Api_SyncOrderByTime("598825");
@@ -128,6 +129,7 @@ namespace SiteCore.Handler
                 }
                 Debug.WriteLine(index++);
             }*/
+            //string a = commonHelper.convertQNMemo("48x61mm-4款各40个-铜版纸-不干胶-覆膜模切-tb963561715-金陵-顺丰到付.粘成品.6.5cm牙签-老客户改稿找金陵拉群-16发", CeErpTradeCell.GetByCtid("2879265072537265386"));
 
             List<string> lw = new List<string>();
             string tid = GetPostString("ctid");
@@ -184,15 +186,7 @@ namespace SiteCore.Handler
                 }
                 if (buyernick.Length > 0)
                 {
-                    CeErpTrade ceErpTrade = CeErpTrade.GetByName(buyernick);
-                    if (ceErpTrade == null)
-                    {
-                        lw.Add(string.Format("buyer_nick='{0}'", buyernick));
-                    }
-                    else
-                    {
-                        lw.Add(string.Format("(buyer_id='{0}' or buyer_nick='{0}')", ceErpTrade.buyer_id, buyernick));
-                    }
+                    lw.Add(string.Format("buyer_nick='{0}'", buyernick));
                 }
                 string dw = GetDateMinuteWhere("pay_time", date1, date2);
                 if (dw.Length > 0)
@@ -826,6 +820,7 @@ namespace SiteCore.Handler
                 if (entity != null)
                 {
                     string memo = GetPostString("seller_memo");
+                    string qn_memo = GetPostString("qn_memo");
                     memo = memo.Replace(" ", "");
                     if (memo.Contains("补差"))
                     {
@@ -875,8 +870,25 @@ namespace SiteCore.Handler
                         }
 
 
+
                         LogHelper.addLog(entity.ctid, CurrentUser.UserID, "系统修改为:" + memo, entity.OrderState, 1);
                     }
+                    if (!string.IsNullOrEmpty(qn_memo) && !(entity.IsSample > 0 || entity.ctid.Contains("N_") || entity.seller_memo.Contains("现货") || entity.seller_memo.Contains("礼物")))
+                    {
+                        if (entity.OrderState >= 5)
+                        {
+                            returnErrorMsg("无法修改备注,设计稿已使用原备注,修改后下载文件会无法对应");
+                            return;
+                        }
+                        string delMemo = commonHelper.convertQNMemo(qn_memo, ref entity);
+                        if (string.IsNullOrEmpty(delMemo))
+                        {
+                            returnErrorMsg("备注不规范,无法识别");
+                            return;
+                        }
+                        memo = delMemo;
+                        LogHelper.addLog(entity.ctid, CurrentUser.UserID, "系统千牛修改为:" + memo, entity.OrderState, 1);
+                    }
                     commonHelper.getCytPrice(entity);
                     int memoopt = GetPostInt("MemoOpt");
                     Boolean ismemoopt = false;
@@ -11114,11 +11126,16 @@ namespace SiteCore.Handler
                         {
                             entity.OrderState = 3;
                         }
+
                         commonHelper.getCytPrice(entity);
                         if ((entity.OtherMemo.Contains("老客户") || entity.OtherMemo.Contains("老顾客")) && entity.OtherMemo.Contains("改稿"))
                         {
                             tmcHelper.dealOldCustomerEntityTag(ref entity, ceErpTrade);
                         }
+                        if (entity.IsSample > 1 || entity.seller_memo.Contains("现货") || entity.seller_memo.Contains("礼物"))
+                        {
+                            entity.OrderState = 6;
+                        }
                     }
                     entity.Update();
                     LogHelper.addLog(entity.ctid, CurrentUser.UserID, "审核通过", entity.OrderState);

+ 1 - 1
SiteCore/taobao/apiShengda.cs

@@ -255,7 +255,7 @@ namespace SiteCore.Handler
                         {
                             cpCode = "YTO-SD";
                         }
-                        if ("SF".Equals(expressName) && expressCompany.IndexOf("到付") > -1)
+                        if ("SF".Equals(expressName))
                         {
                             cpCode = "SF-SD";
                         }

+ 264 - 0
SiteCore/taobao/commonHelper.cs

@@ -3244,5 +3244,269 @@ namespace SiteCore
 
             return (total).ToString();
         }
+
+        public static string convertQNMemo(string itemMemo, ref CeErpTradeCell entity)
+        {
+            if (string.IsNullOrEmpty(itemMemo))
+            {
+                return "";
+            }
+            CeErpTrade father = CeErpTrade.Get(entity.tid);
+            //删除备注中的旺旺
+            if (father.type == "TMALL" || father.type == "TB")
+            {
+                string[] memoList = itemMemo.Split('-');
+
+                List<string> list = new List<string>(memoList);
+                string buyer_nick = "";
+                if ((itemMemo.IndexOf("logo") != -1 || itemMemo.IndexOf("LOGO") != -1))
+                {
+                    if (list.Count > 3)
+                    {
+                        buyer_nick = list[3];
+                    }
+                }
+                else if (itemMemo.IndexOf("补差") != -1 && list.Count < 6)
+                {
+                    if (list.Count > 1)
+                    {
+                        buyer_nick = list[1];
+                    }
+                }
+                else if (itemMemo.IndexOf("默拍单") != -1 && list.Count < 6)
+                {
+                    if (list.Count > 1)
+                    {
+                        buyer_nick = list[1];
+                    }
+                }
+                else if (itemMemo.IndexOf("寄样") != -1)
+                {
+                    if (list.Count > 3)
+                    {
+                        buyer_nick = list[3];
+                    }
+                }
+                else if (itemMemo.IndexOf("拿样订单") != -1)
+                {
+                    if (list.Count > 1)
+                    {
+                        buyer_nick = list[1];
+                    }
+                }
+                else if (itemMemo.IndexOf("礼物") != -1 && list.Count < 6)
+                {
+                    if (list.Count > 1)
+                    {
+                        buyer_nick = list[1];
+                    }
+                }
+                else
+                {
+                    if (list.Count > 5)
+                    {
+                        buyer_nick = list[5];
+                    }
+                }
+                itemMemo = string.Join("-", list);
+                itemMemo = itemMemo.Replace("-" + buyer_nick, string.Empty);
+            }
+            itemMemo = itemMemo.Replace("\r", " ");
+            itemMemo = itemMemo.Replace("\n", " ");
+            string[] acclist = itemMemo.Split('-');
+            string newmemo = "";
+
+            if (itemMemo.Contains("logo") || itemMemo.Contains("LOGO"))
+            {
+                if (acclist.Length < 4) return null;
+
+
+                string count = acclist[0];
+                string product = acclist[1];
+                string account = acclist[3];
+                DataRow cusInfo = tmcHelper.getUserInfoByAccount(account); //客服id
+
+                entity.ProductId = tmcHelper.getProductIdByName("logo");
+
+                entity.ProductCount = commonHelper.getProductCount(count);// commonHelper.changeCountFromChiness(count); ;
+
+                newmemo = "(" + entity.OrderSn + ")-";
+                string newOtherMemo = "";
+                for (int i = 0; i < acclist.Length; i++)
+                {
+                    if (i == 3) continue;
+                    if (i >= 4)
+                    {
+                        newOtherMemo += acclist[i];
+                    }
+                    else
+                        newmemo += acclist[i];
+
+                    if (i < acclist.Length - 2)
+                    {
+                        newmemo += "-";
+                    }
+
+                }
+
+                string sName = tmcHelper.getShopSNameByName(father.seller_nick);//获取店铺简称
+                newmemo += ("-" + sName);
+                if (father.buyer_nick.IndexOf("*") < 0)
+                {
+                    newmemo += ("-" + father.buyer_nick);
+                }
+                newmemo += ("-" + father.receiver_state);
+                if (cusInfo != null)
+                {
+                    newmemo += ("-" + Convert.ToString(cusInfo["Tb"]));
+                }
+
+                entity.seller_memo = newmemo;
+                entity.OtherMemo = newOtherMemo;
+            }
+            else
+            {
+                bool isXianhuo = false;
+                if (acclist[0] == "现货")
+                {
+                    isXianhuo = true;
+                    System.Array.Copy(acclist, 1, acclist, 0, acclist.Length - 1);
+                    System.Array.Resize(ref acclist, acclist.Length - 1);
+                }
+
+                if (acclist.Length < 6)
+                {
+                    return "";
+                }
+
+                string size = acclist[0];
+                string count = acclist[1];
+                bool isBuGanJiao = false;
+                string product = "";
+                string mt = "", ct = "";
+                string account = "";
+
+                itemMemo = itemMemo.Replace("PVC", "pvc");
+                if ((acclist[3] == "不干胶" || itemMemo.IndexOf("电子稿") != -1 || itemMemo.IndexOf("pvc卡片") != -1 || itemMemo.IndexOf("海报") != -1) && itemMemo.IndexOf("礼物") == -1)
+                {
+                    isBuGanJiao = true;
+                    product = acclist[3];
+                    mt = acclist[2];
+                }
+                else
+                {
+                    product = acclist[2];
+                    mt = acclist[3];
+                }
+                account = acclist[5];
+                ct = acclist[4];
+
+                if (acclist.Length >= 7)
+                {
+                    acclist[6] = acclist[6].Replace("(", "");
+                    acclist[6] = acclist[6].Replace(")", "");
+                    acclist[6] = acclist[6].Replace("(", "");
+                    acclist[6] = acclist[6].Replace(")", "");
+                    entity.MakeSupplier = acclist[6];
+                    acclist[6] = "(" + acclist[6] + ")";
+                }
+
+                entity.ProductId = tmcHelper.getProductIdByName(product);
+                if (entity.ProductId == 0)
+                {
+                    return "";
+                }
+                DataRow cusInfo = tmcHelper.getUserInfoByAccount(account); //客服id
+                if (cusInfo != null)
+                {
+                    entity.CustomerUserId = Convert.ToInt32(cusInfo["ID"]);
+                }
+
+                if (mt.IndexOf("铜板纸") != -1)
+                {
+                    mt = mt.Replace("铜板纸", "铜版纸");
+                }
+                entity.Material = mt;
+                entity.ProductSize = size;
+                entity.ProductCount = getProductCount(count); ;//commonHelper.changeCountFromChiness(count);
+                entity.Craft = ct;
+                newmemo = "(" + entity.OrderSn + ")-";
+                if (isXianhuo)
+                {
+                    newmemo += "现货-";
+                }
+                string newOtherMemo = "";
+                bool isMulity = true;
+                if (string.IsNullOrEmpty(entity.SplitTag))
+                {
+                    isMulity = false;
+                }
+                if (acclist.Length >= 7 && !isMulity)
+                {
+                    newmemo += acclist[6];
+                    newmemo += "-";
+                }
+                if (isMulity && acclist.Length >= 8)
+                {
+                    newmemo += acclist[7];
+                    newmemo += "-";
+                }
+
+                for (int i = 0; i < acclist.Length; i++)
+                {
+                    if ((isMulity && i == 6) || i == 5)
+                    {
+                        continue;
+                    }
+
+                    if ((i >= 7 && !isMulity) || (isMulity && i >= 8))
+                    {
+                        newOtherMemo += acclist[i];
+                        newOtherMemo += "-";
+
+                    }
+                    else
+                    {
+                        if ((i == 6 && !isMulity) || (isMulity && i == 7))
+                        {
+
+                            continue;
+
+                        }
+                        else
+                            newmemo += acclist[i];
+                        if (i != 2 && i != 3)
+                        {
+                            newmemo += "-";
+                        }
+                    }
+                }
+
+                string sName = tmcHelper.getShopSNameByName(father.seller_nick);//获取店铺简称
+                newmemo += (sName);
+                if (father.buyer_nick.IndexOf("*") < 0)
+                {
+                    newmemo += ("-" + father.buyer_nick);
+                }
+
+                newmemo += ("-" + father.receiver_state);
+                if (cusInfo != null)
+                {
+                    newmemo += ("-" + Convert.ToString(cusInfo["Tb"]));
+                }
+                if (!string.IsNullOrEmpty(entity.SplitTag))
+                {
+                    newmemo += "-[" + entity.SplitTag + "]";
+                }
+
+                newmemo = newmemo.Replace("\n", " ");
+
+                entity.seller_memo = newmemo;
+                entity.OtherMemo = newOtherMemo;
+            }
+
+
+            return newmemo;
+        }
     }
 }

+ 2 - 2
SiteCore/taobao/designHelper.cs

@@ -255,14 +255,14 @@ namespace SiteCore.Handler
             CeErpShop ceErpShop = CeErpShop.Get(ceErpTradeCell.ShopId);
 
             CeErpTradeCellExtend ceErpTradeCellExtend = CeErpTradeCellExtend.getByTid(ceErpTradeCell.ctid);
-            string sql = "select spu_id CE_ErpTradeOrder where tid = '" + ceErpTradeCell.tid + "'";
+            string sql = "select spu_id from CE_ErpTradeOrder where tid = '" + ceErpTradeCell.tid + "'";
             DataTable dt = DbHelper.DbConn.ExecuteDataset(sql).Tables[0];
             List<string> spu_list = new List<string>();
             if (dt != null && dt.Rows != null && dt.Rows.Count > 0)
             {
                 foreach (DataRow row in dt.Rows)
                 {
-                    spu_list.Add(row["sup_id"].ToString());
+                    spu_list.Add(row["spu_id"].ToString());
                 }
             }
             NameValueCollection PostVars = new NameValueCollection();