|
|
@ -913,7 +913,7 @@ namespace BBWY.Server.Business |
|
|
|
relationPurchaseOrderRequestV2.PlatformCommissionRatio = 0.05M; |
|
|
|
|
|
|
|
List<OrderDropShipping> insertOrderDropShippingList = new List<OrderDropShipping>(); |
|
|
|
List<OrderDropShipping> updateOrderDropShippingList = new List<OrderDropShipping>(); |
|
|
|
List<IUpdate<OrderDropShipping>> updateOrderDropShippingList = new List<IUpdate<OrderDropShipping>>(); |
|
|
|
IInsert<OrderCost> insertOrderCost = null; |
|
|
|
IUpdate<OrderCost> updateOrderCost = null; |
|
|
|
IDelete<PurchaseOrder> deletePurchaseOrder = null; |
|
|
@ -928,9 +928,10 @@ namespace BBWY.Server.Business |
|
|
|
deletePurchaseOrder = fsql.Delete<PurchaseOrder>().Where(po => oldPourchaseIdList.Contains(po.Id)); |
|
|
|
deleteOrderCostDetail = fsql.Delete<OrderCostDetail>().Where(ocd => ocd.OrderId == dbOrder.Id); |
|
|
|
|
|
|
|
foreach (var orderDropShipping in relationPurchaseOrderRequestV2.OrderDropShippingList) |
|
|
|
foreach (var odsRequest in relationPurchaseOrderRequestV2.OrderDropShippingList) |
|
|
|
{ |
|
|
|
#region 代发信息表
|
|
|
|
var orderDropShipping = odsRequest.Map<OrderDropShipping>(); |
|
|
|
if (orderDropShipping.Id == 0) |
|
|
|
{ |
|
|
|
orderDropShipping.Id = idGenerator.NewLong(); |
|
|
@ -940,11 +941,11 @@ namespace BBWY.Server.Business |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
updateOrderDropShippingList.Add(orderDropShipping); |
|
|
|
updateOrderDropShippingList.Add(fsql.Update<OrderDropShipping>().SetSource(orderDropShipping).IgnoreColumns(new string[] { "CreateTime", "ShopId" })); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
foreach (var relationOrderSku in orderDropShipping.RelationPurchaseOrderSkuList) |
|
|
|
foreach (var relationOrderSku in odsRequest.RelationPurchaseOrderSkuList) |
|
|
|
{ |
|
|
|
#region OrderSku
|
|
|
|
var updateOrderSku = fsql.Update<OrderSku>().Set(osku => osku.OrderDropShippingId, orderDropShipping.Id) |
|
|
@ -960,15 +961,15 @@ namespace BBWY.Server.Business |
|
|
|
ProductId = relationOrderSku.ProductId, |
|
|
|
PurchaseMethod = Enums.PurchaseMethod.线下采购, |
|
|
|
StorageType = Enums.StorageType.代发, |
|
|
|
PurchaseOrderId = orderDropShipping.PurchaseOrderId, |
|
|
|
PurchasePlatform = orderDropShipping.PurchasePlatform, |
|
|
|
PurchaseOrderId = odsRequest.PurchaseOrderId, |
|
|
|
PurchasePlatform = odsRequest.PurchasePlatform, |
|
|
|
PurchaseQuantity = relationOrderSku.Quantity, |
|
|
|
RemainingQuantity = 0, |
|
|
|
ShopId = dbOrder.ShopId, |
|
|
|
SkuId = relationOrderSku.SkuId, |
|
|
|
SingleConsumableAmount = 0, |
|
|
|
SingleFirstFreight = 0, |
|
|
|
SingleFreight = orderDropShipping.PurchaseFreight / orderDropShipping.RelationPurchaseOrderSkuList.Count() / relationOrderSku.Quantity, |
|
|
|
SingleFreight = odsRequest.PurchaseFreight / odsRequest.RelationPurchaseOrderSkuList.Count() / relationOrderSku.Quantity, |
|
|
|
SingleOperationAmount = 0, |
|
|
|
SingleStorageAmount = 0, |
|
|
|
SingleSkuAmount = relationOrderSku.SingleSkuAmount, |
|
|
@ -989,11 +990,11 @@ namespace BBWY.Server.Business |
|
|
|
OperationAmount = 0, |
|
|
|
OrderId = dbOrder.Id, |
|
|
|
ProductId = relationOrderSku.ProductId, |
|
|
|
PurchaseFreight = orderDropShipping.PurchaseFreight / orderDropShipping.RelationPurchaseOrderSkuList.Count(), |
|
|
|
PurchaseFreight = odsRequest.PurchaseFreight / odsRequest.RelationPurchaseOrderSkuList.Count(), |
|
|
|
SkuAmount = relationOrderSku.SingleSkuAmount * relationOrderSku.Quantity, |
|
|
|
SkuId = relationOrderSku.SkuId, |
|
|
|
StorageAmount = 0, |
|
|
|
TotalCost = relationOrderSku.SingleSkuAmount * relationOrderSku.Quantity + orderDropShipping.PurchaseFreight / orderDropShipping.RelationPurchaseOrderSkuList.Count(), |
|
|
|
TotalCost = relationOrderSku.SingleSkuAmount * relationOrderSku.Quantity + odsRequest.PurchaseFreight / odsRequest.RelationPurchaseOrderSkuList.Count(), |
|
|
|
UnitCost = purchaseOrder.UnitCost, |
|
|
|
PurchaseOrderPKId = purchaseOrder.Id |
|
|
|
}); |
|
|
@ -1065,11 +1066,8 @@ namespace BBWY.Server.Business |
|
|
|
if (updateOrderDropShippingList.Count() > 0) |
|
|
|
{ |
|
|
|
foreach (var update in updateOrderDropShippingList) |
|
|
|
{ |
|
|
|
fsql.Update<OrderDropShipping>().SetSource(update).IgnoreColumns(new string[] { "CreateTime", "ShopId" }); |
|
|
|
} |
|
|
|
update.ExecuteAffrows(); |
|
|
|
} |
|
|
|
|
|
|
|
if (dbOrder.StorageType != Enums.StorageType.代发) |
|
|
|
{ |
|
|
|
fsql.Update<Order>(dbOrder.Id) |
|
|
|