zhuyiyi 7 months ago
parent
commit
eccfffd0b2
3 changed files with 48 additions and 52 deletions
  1. 14 17
      SiteCore/Handler/sync.order.cs
  2. 28 17
      SiteCore/taobao/commonHelper.cs
  3. 6 18
      SiteCore/taobao/preSalesHelper.cs

+ 14 - 17
SiteCore/Handler/sync.order.cs

@@ -844,7 +844,12 @@ namespace SiteCore.Handler
                     apiVo.orderRemarks = memo;
                     apiVo.remarkSign = memoopt;
                     designHelper.API_WorkCore(apiVo);//changeDesign/orderRemarks
-
+                    CeErpTradeCellExtend ceErpTradeCellExtend = CeErpTradeCellExtend.getByTid(entity.ctid);
+                    if (ceErpTradeCellExtend != null && ceErpTradeCellExtend.orderFrom == 30)
+                    {
+                        //dataHelper.api_orderBack(entity.ctid, "0", "");
+                    }
+                    commonHelper.sendSpuData(entity, ceErpTradeCellExtend);
                     apiDesign.API_GetPrintData_ModifyOrder(entity.ctid, memo, ismemoopt, false);
                     returnSuccessMsg("保存成功!");
                     return;
@@ -979,6 +984,8 @@ namespace SiteCore.Handler
                     entity.Update();
                     returnSuccessMsg("保存成功!");
                     LogHelper.addLog(entity.ctid, CurrentUser.UserID, "额外:" + entity.OtherMemo, entity.OrderState);
+                    CeErpTradeCellExtend ceErpTradeCellExtend = CeErpTradeCellExtend.getByTid(ctid);
+                    ceErpTradeCellExtend = commonHelper.sendSpuData(entity, ceErpTradeCellExtend);
                     return;
                 }
 
@@ -1372,6 +1379,11 @@ namespace SiteCore.Handler
                     entity.UpdateTime = DateTime.Now;
                     entity.Update();
                     LogHelper.addLog(entity.ctid, CurrentUser.UserID, "手动领单", entity.OrderState, 1);
+                    CeErpTradeCellExtend ceErpTradeCellExtend = CeErpTradeCellExtend.getByTid(entity.ctid);
+                    if (ceErpTradeCellExtend != null && ceErpTradeCellExtend.orderFrom == 30)
+                    {
+                        //dataHelper.api_orderBack(entity.ctid, "0", "");
+                    }
                     returnSuccessMsg("领单成功!");
                     return;
                 }
@@ -12897,22 +12909,7 @@ namespace SiteCore.Handler
                 if (!string.IsNullOrEmpty(spu_id))
                 {
                     CeErpTradeCell ceErpTradeCell = CeErpTradeCell.GetByCtid(ctid);
-
-                    string result = designHelper.API_CheckOrderTo(ceErpTradeCellExtend.ctid, ceErpTradeCellExtend.spu_id, ceErpTradeCell.ShopId);
-                    ceErpTradeCellExtend.ToType = result;
-                    if (commonHelper.spu_products.Contains(ceErpTradeCell.ProductId) || ceErpTradeCell.seller_memo.IndexOf("手绘") > -1 || ceErpTradeCell.seller_memo.IndexOf("电子稿") > -1 || ceErpTradeCell.isDianziOrder > 0)
-                    {
-                        ceErpTradeCellExtend.ToType = "外协";
-                    }
-                    if ((ceErpTradeCell.seller_memo.Contains("改稿") || ceErpTradeCell.OtherMemo.Contains("改稿")) && commonHelper.spu_shopIds.Contains(ceErpTradeCell.ShopId) && !commonHelper.spu_oldProducts.Contains(ceErpTradeCell.ProductId))
-                    {
-                        ceErpTradeCellExtend.ToType = "内部";
-                    }
-                    if ("外协".Equals(ceErpTradeCellExtend.ToType))
-                    {
-                        string sql_pay = "update CE_ErpTradeCell with(rowlock) set DispatchSort=2 where ctid='" + ctid + "';";
-                        CeErpTradeCell.ExecuteNonQuery(sql_pay.ToString());
-                    }
+                    ceErpTradeCellExtend = commonHelper.sendSpuData(ceErpTradeCell, ceErpTradeCellExtend);
                 }
                 if (ceErpTradeCellExtend.ID == 0)
                 {

+ 28 - 17
SiteCore/taobao/commonHelper.cs

@@ -2163,6 +2163,7 @@ namespace SiteCore
                                 { "Userid",cytUserId },
                                 //{ "pwd", "lt666888" },
                                 { "LTOrderId", ceErpTradeCell.OrderSn },
+                                { "OrderId", ceErpTradeCell.ctid },
                                 { "CourierNumber", exinfo.out_sid },
                                 { "ExpressCompanyName", exinfo.company_name }
                             };
@@ -2698,9 +2699,8 @@ namespace SiteCore
             return responseStr;
         }
 
-        public static List<int> spu_products = new List<int>() { 4, 13, 19, 24, 28, 32, 40, 51, 57, 1971, 2319, 2377, 2521, 2524, 2533, 2538, 2542, 2554, 2556, 2557, 2559, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2568, 2569, 2570, 2571, 2572, 2619, 2625, 2634, 2636, 2637, 2638, 2645, 2646 };
+        public static List<int> spu_products = new List<int>() { 4, 13, 19, 24, 28, 32, 40, 51, 57, 1971, 2319, 2377, 2521, 2524, 2533, 2538, 2542, 2554, 2556, 2557, 2559, 2560, 2561, 2562, 2563, 2564, 2565, 2566, 2568, 2569, 2570, 2571, 2572, 2619, 2625, 2636, 2637, 2638, 2645, 2646 };
         public static List<int> spu_shopIds = new List<int>() { 5, 6, 8, 10, 11, 12, 14, 15, 16, 18, 24, 27, 28, 31, 32, 56, 61 };
-        public static List<int> spu_oldProducts = new List<int>() { 4, 13, 2524, 2533, 2554, 2557 };
 
         public static void setSpuData(CeErpTrade father)
         {
@@ -2728,21 +2728,7 @@ namespace SiteCore
                     if (!string.IsNullOrEmpty(spu_id))
                     {
                         CeErpTradeCell ceErpTradeCell = CeErpTradeCell.GetByCtid(ceErpTradeCellExtend.ctid);
-                        string result = designHelper.API_CheckOrderTo(ceErpTradeCellExtend.ctid, ceErpTradeCellExtend.spu_id, ceErpTradeCell.ShopId);
-                        ceErpTradeCellExtend.ToType = result;
-                        if (spu_products.Contains(ceErpTradeCell.ProductId) || ceErpTradeCell.seller_memo.IndexOf("手绘") > -1 || ceErpTradeCell.seller_memo.IndexOf("电子稿") > -1 || ceErpTradeCell.isDianziOrder > 0)
-                        {
-                            ceErpTradeCellExtend.ToType = "外协";
-                        }
-                        if ((ceErpTradeCell.seller_memo.Contains("改稿") || ceErpTradeCell.OtherMemo.Contains("改稿")) && spu_shopIds.Contains(ceErpTradeCell.ShopId) && !spu_oldProducts.Contains(ceErpTradeCell.ProductId))
-                        {
-                            ceErpTradeCellExtend.ToType = "内部";
-                        }
-                        if ("外协".Equals(ceErpTradeCellExtend.ToType))
-                        {
-                            string sql_pay = "update CE_ErpTradeCell with(rowlock) set DispatchSort=2 where ctid='" + ceErpTradeCellExtend.ctid + "';";
-                            CeErpTradeCell.ExecuteNonQuery(sql_pay.ToString());
-                        }
+                        ceErpTradeCellExtend = sendSpuData(ceErpTradeCell, ceErpTradeCellExtend);
                     }
 
                     if (ceErpTradeCellExtend.ID == 0)
@@ -2763,6 +2749,31 @@ namespace SiteCore
             }
         }
 
+        public static CeErpTradeCellExtend sendSpuData(CeErpTradeCell ceErpTradeCell, CeErpTradeCellExtend ceErpTradeCellExtend)
+        {
+            string result = designHelper.API_CheckOrderTo(ceErpTradeCellExtend.ctid, ceErpTradeCellExtend.spu_id, ceErpTradeCell.ShopId);
+            ceErpTradeCellExtend.ToType = result;
+            if (spu_products.Contains(ceErpTradeCell.ProductId) || ceErpTradeCell.seller_memo.IndexOf("手绘") > -1 || ceErpTradeCell.seller_memo.IndexOf("电子稿") > -1 || ceErpTradeCell.isDianziOrder > 0)
+            {
+                ceErpTradeCellExtend.ToType = "外协";
+            }
+            if ((ceErpTradeCell.seller_memo.Contains("改稿") || ceErpTradeCell.OtherMemo.Contains("改稿")) && spu_shopIds.Contains(ceErpTradeCell.ShopId) && !spu_products.Contains(ceErpTradeCell.ProductId))
+            {
+                ceErpTradeCellExtend.ToType = "内部";
+            }
+            if ("外协".Equals(ceErpTradeCellExtend.ToType))
+            {
+                string sql_pay = "update CE_ErpTradeCell with(rowlock) set DispatchSort=2 where ctid='" + ceErpTradeCellExtend.ctid + "';";
+                CeErpTradeCell.ExecuteNonQuery(sql_pay.ToString());
+            }
+            if (ceErpTradeCellExtend.ID > 0)
+            {
+                ceErpTradeCellExtend.Update();
+            }
+            return ceErpTradeCellExtend;
+
+        }
+
         public static double calculationPrice(CeErpTradeCell ceErpTradeCell)
         {
             double price = 0;

+ 6 - 18
SiteCore/taobao/preSalesHelper.cs

@@ -1475,6 +1475,8 @@ namespace SiteCore.Handler
                     entity.Update();
                     returnSuccessMsg("保存成功!");
                     LogHelper.addLog(entity.ctid, UserID, name + "额外:" + entity.OtherMemo, entity.OrderState);
+                    CeErpTradeCellExtend ceErpTradeCellExtend = CeErpTradeCellExtend.getByTid(ctid);
+                    commonHelper.sendSpuData(entity, ceErpTradeCellExtend);
                     return;
                 }
 
@@ -1917,26 +1919,12 @@ namespace SiteCore.Handler
                 }
                 else
                 {
-                    if (!string.IsNullOrEmpty(ceErpTradeCellExtend.spu_id))
-                    {
-                        string result = designHelper.API_CheckOrderTo(ceErpTradeCellExtend.ctid, ceErpTradeCellExtend.spu_id, entity.ShopId);
-                        ceErpTradeCellExtend.ToType = result;
-                       
-                        if (commonHelper.spu_products.Contains(entity.ProductId) || entity.seller_memo.IndexOf("手绘") > -1 || entity.seller_memo.IndexOf("电子稿") > -1 || entity.isDianziOrder > 0)
-                        {
-                            ceErpTradeCellExtend.ToType = "外协";
-                        }
-                        if ((entity.seller_memo.Contains("改稿") || entity.OtherMemo.Contains("改稿")) && commonHelper.spu_shopIds.Contains(entity.ShopId) && !commonHelper.spu_oldProducts.Contains(entity.ProductId))
-                        {
-                            ceErpTradeCellExtend.ToType = "内部";
-                        }
-                        if ("外协".Equals(ceErpTradeCellExtend.ToType))
-                        {
-                            sql_pay = "update CE_ErpTradeCell with(rowlock) set DispatchSort=2 where ctid='" + ceErpTradeCellExtend.ctid + "';";
-                        }
-                    }
                     ceErpTradeCellExtend.Create();
                 }
+                if (!string.IsNullOrEmpty(ceErpTradeCellExtend.spu_id))
+                {
+                    ceErpTradeCellExtend = commonHelper.sendSpuData(entity, ceErpTradeCellExtend);
+                }
                 if (item.isGift == 1)
                 {
                     entity.SupplierId = Convert.ToInt32(webConfig.SampleOrderSupplier); //圆通仓库