记录关联商品所有sku并可以快速关联
This commit is contained in:
1 parent
66f1381950
commit
d77ec5cc2e
9 files changed
+460
-3927
No files matched your search
@@ -1387,7 +1387,7 @@ namespace _29WxOrderWpf.Ctrls.BuyerCtrls
|
||||
Thread.Sleep(100);
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
if (buyer.wpf_browser != null)
|
||||
if (buyer.wpf_browser != null && buyer.wpf_browser.IsBrowserInitialized)
|
||||
{
|
||||
var frame = buyer.wpf_browser.GetBrowser().MainFrame;
|
||||
isInitial = buyer.wpf_browser != null && buyer.wpf_browser.IsBrowserInitialized && frame.IsValid;
|
||||
|
||||
@@ -302,24 +302,9 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
var pddBuyerAfterSales = GetPddBuyerAfterSales(order_ids);
|
||||
|
||||
// 读取关联拍单商品
|
||||
var urlMap = BaseClass.Build29WxObjString("order/wx_get_buy_prod_map");
|
||||
var dataMap = UserLogin.GetSignaturex()
|
||||
+ "&spu_codes=" + string.Join(",", orderItems.Select(oi => GetHtml.UrlEncodeUtf8(oi.out_product_id))) + "," + string.Join(",", orderItems.Select(oi => oi.product_id));
|
||||
dataMap += "&main_user_name=" + BaseClass.MainUserName;
|
||||
var resultMap = GetHtml.PostUtf8(urlMap, dataMap);
|
||||
if (string.IsNullOrEmpty(resultMap) || !resultMap.Contains("\"code\":200"))
|
||||
resultMap = GetHtml.PostUtf8(urlMap, dataMap);
|
||||
if (string.IsNullOrEmpty(resultMap) || !resultMap.Contains("\"code\":200"))
|
||||
{
|
||||
Dispatcher.Invoke(new Action(() =>
|
||||
{
|
||||
BaseMsgWindow.ShowError("订单读取失败 " + BaseRegex.GetStringJson(ref resultMap, "msg"));
|
||||
}));
|
||||
break;
|
||||
}
|
||||
List<WXBuyMapInfo> byuMapList = new List<WXBuyMapInfo>();
|
||||
try { byuMapList = JsonHelper.DeserializeJsonToList<WXBuyMapInfo>(JObject.Parse(resultMap)["data"].ParseToString()); } catch { }
|
||||
var buyMapList = GetBuyProdMap(orderItems);
|
||||
|
||||
var buyMapSkusList = GetBuyProdMapSkus(orderItems);
|
||||
|
||||
// 装载订单
|
||||
foreach (JObject jObj in jArr)
|
||||
@@ -347,14 +332,15 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
// 关联拍单关系 // 危险物品禁止拍单,仅关联安全商品
|
||||
//if (!GlobalConfig.lstDangerItemWord.Any(d => (item.title).ParseToString().Contains(d)))
|
||||
{
|
||||
item.BuyMap = byuMapList.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.out_product_id);
|
||||
item.BuyMap = buyMapList.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.out_product_id);
|
||||
if (item.BuyMap == null)
|
||||
item.BuyMap = byuMapList.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.out_product_id);
|
||||
item.BuyMap = buyMapList.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.out_product_id);
|
||||
if (item.BuyMap == null)
|
||||
item.BuyMap = byuMapList.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.product_id);
|
||||
item.BuyMap = buyMapList.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.product_id);
|
||||
if (item.BuyMap == null)
|
||||
item.BuyMap = byuMapList.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.product_id);
|
||||
item.BuyMap = buyMapList.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.product_id);
|
||||
}
|
||||
item.BuyMapSkus = buyMapSkusList.Where(s => s.spu_code == item.out_product_id || s.spu_code == item.product_id).OrderByDescending(s => s.mdy_time).ToList();
|
||||
|
||||
// 中转仓订单
|
||||
if (item.ItemOrder.orderItems.Count > 1)
|
||||
@@ -696,6 +682,87 @@ namespace _29WxOrderWpf.Ctrls.OrderCtrls
|
||||
return new List<order_pdd_buyer_after_sale>();
|
||||
}
|
||||
|
||||
public static List<WXBuyMapInfo> GetBuyProdMap(List<oms_wei_order_item_info> orderItems)
|
||||
{
|
||||
//foreach (var item in orderItems.ToList())
|
||||
//{
|
||||
// var buyMap = GlobalConfig.BuyMapList.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.out_product_id);
|
||||
// if (buyMap == null)
|
||||
// buyMap = GlobalConfig.BuyMapList.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.out_product_id);
|
||||
// if (buyMap == null)
|
||||
// buyMap = GlobalConfig.BuyMapList.FirstOrDefault(b => b.sku_code == item.out_sku_id && b.spu_code == item.product_id);
|
||||
// if (buyMap == null)
|
||||
// buyMap = GlobalConfig.BuyMapList.FirstOrDefault(b => b.sku_code == item.sku_attr_str && b.spu_code == item.product_id);
|
||||
|
||||
// if (buyMap != null)
|
||||
// orderItems.Remove(item);
|
||||
//}
|
||||
if (orderItems == null || orderItems.Count == 0)
|
||||
{
|
||||
return GlobalConfig.BuyMapList.Where(m => orderItems.Any(oi => m.spu_code == oi.out_product_id || m.spu_code == oi.product_id)).ToList();
|
||||
}
|
||||
|
||||
var urlMap = BaseClass.Build29WxObjString("order/wx_get_buy_prod_map");
|
||||
var dataMap = UserLogin.GetSignaturex()
|
||||
+ "&spu_codes=" + string.Join(",", orderItems.Select(oi => GetHtml.UrlEncodeUtf8(oi.out_product_id))) + "," + string.Join(",", orderItems.Select(oi => oi.product_id));
|
||||
dataMap += "&main_user_name=" + BaseClass.MainUserName;
|
||||
var resultMap = GetHtml.PostUtf8(urlMap, dataMap);
|
||||
if (string.IsNullOrEmpty(resultMap) || !resultMap.Contains("\"code\":200"))
|
||||
resultMap = GetHtml.PostUtf8(urlMap, dataMap);
|
||||
if (string.IsNullOrEmpty(resultMap) || !resultMap.Contains("\"code\":200"))
|
||||
{
|
||||
BaseMsgWindow.ShowAnimateMessage("订单关联读取失败 " + BaseRegex.GetStringJson(ref resultMap, "msg"), "Error", 5);
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
var buyMapList = JsonHelper.DeserializeJsonToList<WXBuyMapInfo>(JObject.Parse(resultMap)["data"].ParseToString());
|
||||
buyMapList = buyMapList.Where(b => !GlobalConfig.BuyMapList.Any(m => m.sku_code == b.sku_code && m.spu_code == b.spu_code)).ToList();
|
||||
GlobalConfig.BuyMapList.AddRange(buyMapList);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
return GlobalConfig.BuyMapList.Where(m => orderItems.Any(oi => m.spu_code == oi.out_product_id || m.spu_code == oi.product_id)).ToList();
|
||||
}
|
||||
|
||||
public static List<WXBuyMapSkusInfo> GetBuyProdMapSkus(List<oms_wei_order_item_info> orderItems)
|
||||
{
|
||||
//orderItems.RemoveAll(oi => GlobalConfig.BuyMapSkusList.Any(m => m.spu_code == oi.out_product_id || m.spu_code == oi.product_id));
|
||||
if (orderItems == null || orderItems.Count == 0)
|
||||
{
|
||||
return GlobalConfig.BuyMapSkusList.Where(m => orderItems.Any(oi => m.spu_code == oi.out_product_id || m.spu_code == oi.product_id)).ToList();
|
||||
}
|
||||
|
||||
var url = BaseClass.Build29WxObjString("order/wx_get_buy_pord_map_skus");
|
||||
var dataMap = UserLogin.GetSignaturex()
|
||||
+ "&spu_codes=" + string.Join(",", orderItems.Select(oi => GetHtml.UrlEncodeUtf8(oi.out_product_id))) + "," + string.Join(",", orderItems.Select(oi => oi.product_id));
|
||||
dataMap += "&main_user_name=" + BaseClass.MainUserName;
|
||||
var resultSkusMap = GetHtml.PostUtf8(url, dataMap);
|
||||
if (string.IsNullOrEmpty(resultSkusMap) || !resultSkusMap.Contains("\"code\":200"))
|
||||
{
|
||||
resultSkusMap = GetHtml.PostUtf8(url, dataMap);
|
||||
}
|
||||
if (string.IsNullOrEmpty(resultSkusMap) || !resultSkusMap.Contains("\"code\":200"))
|
||||
{
|
||||
BaseMsgWindow.ShowAnimateMessage("订单关联列表读取失败 " + BaseRegex.GetStringJson(ref resultSkusMap, "msg"), "Error", 5);
|
||||
return new List<WXBuyMapSkusInfo>();
|
||||
}
|
||||
try
|
||||
{
|
||||
var buyMapSkusList = JsonHelper.DeserializeJsonToList<WXBuyMapSkusInfo>(JObject.Parse(resultSkusMap)["data"].ParseToString());
|
||||
buyMapSkusList = buyMapSkusList.Where(b => !GlobalConfig.BuyMapSkusList.Any(m => m.map_goods_id == b.map_goods_id)).ToList();
|
||||
GlobalConfig.BuyMapSkusList.AddRange(buyMapSkusList);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new List<WXBuyMapSkusInfo>();
|
||||
}
|
||||
return GlobalConfig.BuyMapSkusList.Where(m => orderItems.Any(oi => m.spu_code == oi.out_product_id || m.spu_code == oi.product_id)).ToList();
|
||||
}
|
||||
|
||||
public void GetShopWaybillExceptionOrder()
|
||||
{
|
||||
foreach (var shop in GlobalConfig.ShopLoginList)
|
||||
|
||||
Reference in new issue
Block a user