|
@ -2864,6 +2864,8 @@ namespace BBWYB.Server.Business |
|
|
|
|
|
|
|
|
IUpdate<OrderPurchaseInfo> updatePurchaseOrder = null; |
|
|
IUpdate<OrderPurchaseInfo> updatePurchaseOrder = null; |
|
|
|
|
|
|
|
|
|
|
|
IDictionary<string, OP_EditPriceSkuRequest> oskuPriceEditParamDictionary = new Dictionary<string, OP_EditPriceSkuRequest>(); |
|
|
|
|
|
|
|
|
var ppclient = ppPlatformClientFactory.GetClient(AdapterEnums.PlatformType.阿里巴巴); |
|
|
var ppclient = ppPlatformClientFactory.GetClient(AdapterEnums.PlatformType.阿里巴巴); |
|
|
|
|
|
|
|
|
var totalPurchaseProductAmount = 0M; |
|
|
var totalPurchaseProductAmount = 0M; |
|
@ -2911,21 +2913,34 @@ namespace BBWYB.Server.Business |
|
|
var orderSku = dbOrderSkus.FirstOrDefault(osku => osku.SkuId == belongSkuId); |
|
|
var orderSku = dbOrderSkus.FirstOrDefault(osku => osku.SkuId == belongSkuId); |
|
|
if (isEditOrderPrice) |
|
|
if (isEditOrderPrice) |
|
|
{ |
|
|
{ |
|
|
orderSku.Price = currentOrderSkuProductAmount / orderSku.ItemTotal; |
|
|
if (!oskuPriceEditParamDictionary.TryGetValue(orderSku.SkuId, out OP_EditPriceSkuRequest editSkuPrice)) |
|
|
orderSku.BuyerPayFreight = currentPurchaseFreight; |
|
|
|
|
|
if (!op_EditPriceSkuRequests.Any(x => x.SkuId == orderSku.SkuId)) |
|
|
|
|
|
{ |
|
|
{ |
|
|
op_EditPriceSkuRequests.Add(new OP_EditPriceSkuRequest() |
|
|
editSkuPrice = new OP_EditPriceSkuRequest() |
|
|
{ |
|
|
{ |
|
|
Freight = currentPurchaseFreight ?? 0M, |
|
|
SkuId = orderSku.SkuId, |
|
|
InPackAmountPrice = orderSku.InPackAmount ?? 0M, |
|
|
|
|
|
OrderSkuId = orderSku.Id.ToString(), |
|
|
OrderSkuId = orderSku.Id.ToString(), |
|
|
Price = orderSku.Price ?? 0M, |
|
|
InPackAmountPrice = orderSku.InPackAmount ?? 0M |
|
|
SkuId = orderSku.SkuId |
|
|
}; |
|
|
}); |
|
|
oskuPriceEditParamDictionary.Add(orderSku.SkuId, editSkuPrice); |
|
|
updateOrderSkuList.Add(fsql.Update<OrderSku>(orderSku.Id).Set(osku => osku.Price, orderSku.Price) |
|
|
|
|
|
.Set(osku => osku.BuyerPayFreight, orderSku.BuyerPayFreight)); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
editSkuPrice.Price += currentOrderSkuProductAmount / (orderSku.ItemTotal ?? 1M); |
|
|
|
|
|
editSkuPrice.Freight += currentPurchaseFreight ?? 0M; |
|
|
|
|
|
|
|
|
|
|
|
//orderSku.Price =
|
|
|
|
|
|
//orderSku.BuyerPayFreight = currentPurchaseFreight;
|
|
|
|
|
|
//if (!op_EditPriceSkuRequests.Any(x => x.SkuId == orderSku.SkuId))
|
|
|
|
|
|
//{
|
|
|
|
|
|
// op_EditPriceSkuRequests.Add(new OP_EditPriceSkuRequest()
|
|
|
|
|
|
// {
|
|
|
|
|
|
// Freight = currentPurchaseFreight ?? 0M,
|
|
|
|
|
|
// InPackAmountPrice = orderSku.InPackAmount ?? 0M,
|
|
|
|
|
|
// OrderSkuId = orderSku.Id.ToString(),
|
|
|
|
|
|
// Price = orderSku.Price ?? 0M,
|
|
|
|
|
|
// SkuId = orderSku.SkuId
|
|
|
|
|
|
// });
|
|
|
|
|
|
// updateOrderSkuList.Add(fsql.Update<OrderSku>(orderSku.Id).Set(osku => osku.Price, orderSku.Price)
|
|
|
|
|
|
// .Set(osku => osku.BuyerPayFreight, orderSku.BuyerPayFreight));
|
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
#endregion
|
|
|
#endregion
|
|
@ -2938,8 +2953,24 @@ namespace BBWYB.Server.Business |
|
|
updateOrderCostDetailList.Add(fsql.Update<OrderCostDetail>().SetSource(dbOrderSkuDetail)); |
|
|
updateOrderCostDetailList.Add(fsql.Update<OrderCostDetail>().SetSource(dbOrderSkuDetail)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (isEditOrderPrice) |
|
|
if (isEditOrderPrice) |
|
|
{ |
|
|
{ |
|
|
|
|
|
#region 更新订单sku金额
|
|
|
|
|
|
foreach (var editSkuPriceKey in oskuPriceEditParamDictionary.Keys) |
|
|
|
|
|
{ |
|
|
|
|
|
oskuPriceEditParamDictionary.TryGetValue(editSkuPriceKey, out var editSkuPrice); |
|
|
|
|
|
var orderSku = dbOrderSkus.FirstOrDefault(osku => osku.SkuId == editSkuPrice.SkuId); |
|
|
|
|
|
orderSku.Price = editSkuPrice.Price; |
|
|
|
|
|
orderSku.BuyerPayFreight = editSkuPrice.Freight; |
|
|
|
|
|
|
|
|
|
|
|
op_EditPriceSkuRequests.Add(editSkuPrice); |
|
|
|
|
|
updateOrderSkuList.Add(fsql.Update<OrderSku>(orderSku.Id).Set(osku => osku.Price, orderSku.Price) |
|
|
|
|
|
.Set(osku => osku.BuyerPayFreight, orderSku.BuyerPayFreight)); |
|
|
|
|
|
} |
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region 更新订单金额
|
|
|
dbOrder.OrderTotalPrice = totalPurchaseProductAmount + totalPurchaseFreight; |
|
|
dbOrder.OrderTotalPrice = totalPurchaseProductAmount + totalPurchaseFreight; |
|
|
dbOrder.OrderSellerPrice = totalPurchaseProductAmount; |
|
|
dbOrder.OrderSellerPrice = totalPurchaseProductAmount; |
|
|
dbOrder.FreightPrice = totalPurchaseFreight; |
|
|
dbOrder.FreightPrice = totalPurchaseFreight; |
|
@ -2948,6 +2979,7 @@ namespace BBWYB.Server.Business |
|
|
.Set(o => o.FreightPrice, dbOrder.FreightPrice); |
|
|
.Set(o => o.FreightPrice, dbOrder.FreightPrice); |
|
|
|
|
|
|
|
|
updatePurchaseOrder = fsql.Update<OrderPurchaseInfo>(orderPurchaseInfo.Id).Set(opi => opi.IsAutoEditOrderPrice, Enums.AutoEditOrderPriceType.已平价); |
|
|
updatePurchaseOrder = fsql.Update<OrderPurchaseInfo>(orderPurchaseInfo.Id).Set(opi => opi.IsAutoEditOrderPrice, Enums.AutoEditOrderPriceType.已平价); |
|
|
|
|
|
#region
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#region 订单Sku成本
|
|
|
#region 订单Sku成本
|
|
|