You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
3.5 KiB
60 lines
3.5 KiB
2 years ago
|
using BBWYB.Server.Model;
|
||
|
using BBWYB.Server.Model.Db;
|
||
|
using BBWYB.Server.Model.Dto;
|
||
|
|
||
|
namespace BBWYB.Server.Business.Extensions
|
||
|
{
|
||
|
public static class PurchaseExpressOrderExtension
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// 计算快递单归属
|
||
|
/// </summary>
|
||
|
/// <param name="purchaseExpressOrder">必须是经过与快递单关系表进行联合查询的结果 (ExpressOrderRelationInfo-PurchaseExpressOrder)</param>
|
||
|
/// <param name="orderPurchaseInfoList"></param>
|
||
|
/// <param name="orderPurchaseRelationInfoList"></param>
|
||
|
/// <param name="orderPurchaseSkuInfoList"></param>
|
||
|
public static void CalculationBelongOrderSku(this PurchaseExpressOrderResponse purchaseExpressOrder,
|
||
|
IList<OrderPurchaseInfoResponse> orderPurchaseInfoList,
|
||
|
IList<OrderPurchaseRelationInfo> orderPurchaseRelationInfoList,
|
||
|
IList<OrderPurchaseSkuInfoResponse> orderPurchaseSkuInfoList)
|
||
|
{
|
||
|
var purchaseOrder = orderPurchaseInfoList.FirstOrDefault(po => po.PurchaseOrderId == purchaseExpressOrder.PurchaseOrderId);
|
||
|
if (purchaseOrder == null)
|
||
|
return;
|
||
|
if (purchaseOrder.PurchasePlatform == Enums.Platform.阿里巴巴)
|
||
|
{
|
||
|
var purchaseSkuIds = orderPurchaseSkuInfoList.Where(posku => posku.WaybillNo == purchaseExpressOrder.WaybillNo &&
|
||
|
posku.PurchaseOrderId == purchaseOrder.PurchaseOrderId)
|
||
|
.Select(posku => posku.PurchaseSkuId).ToList();
|
||
|
var orderSkuIds = orderPurchaseRelationInfoList.Where(ori => ori.PurchaseOrderId == purchaseOrder.PurchaseOrderId &&
|
||
|
purchaseSkuIds.Contains(ori.PurchaseSkuId))
|
||
|
.Select(ori => ori.BelongSkuId)
|
||
|
.Distinct()
|
||
|
.ToList();
|
||
|
purchaseOrder.BelongSkuIds = string.Join(",", orderSkuIds);
|
||
|
|
||
|
//var currentOrderSkuList = orderSkuList.Where(osku => osku.OrderId == purchaseOrder.OrderId &&
|
||
|
// orderSkuIds.Contains(osku.SkuId)).ToList();
|
||
|
//foreach (var osku in currentOrderSkuList)
|
||
|
//{
|
||
|
// if (osku.PurchaseExpressOrderList.Any(peo => peo.WaybillNo == purchaseExpressOrder.WaybillNo))
|
||
|
// continue;
|
||
|
// osku.PurchaseExpressOrderList.Add(purchaseExpressOrder);
|
||
|
//}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
purchaseOrder.BelongSkuIds = purchaseOrder.BelongSkuIds;
|
||
|
//var currentOrderSkuList = orderSkuList.Where(osku => osku.OrderId == purchaseOrder.OrderId &&
|
||
|
// purchaseOrder.BelongSkuIds.Contains(osku.SkuId)).ToList();
|
||
|
//foreach (var osku in currentOrderSkuList)
|
||
|
//{
|
||
|
// if (osku.PurchaseExpressOrderList.Any(peo => peo.WaybillNo == purchaseExpressOrder.WaybillNo))
|
||
|
// continue;
|
||
|
// osku.PurchaseExpressOrderList.Add(purchaseExpressOrder);
|
||
|
//}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|