|
|
@ -257,6 +257,7 @@ namespace BBWYB.Server.Business |
|
|
|
List<OrderPurchaseSkuInfo> insertOrderPurchaseSkuInfos = new List<OrderPurchaseSkuInfo>(); |
|
|
|
List<long> updatePurchaseTimeSchemeIdList = new List<long>(); |
|
|
|
List<OrderPurchaseRelationInfo> insertOrderPurchaseRelationInfoList = new List<OrderPurchaseRelationInfo>(); |
|
|
|
List<string> updatePurchaseTimeLimitTaskOrderSkuList = new List<string>(); |
|
|
|
|
|
|
|
#region 待更新
|
|
|
|
IList<long> updateOrderCostDetailIdList = fsql.Select<OrderCostDetail>() |
|
|
@ -342,6 +343,7 @@ namespace BBWYB.Server.Business |
|
|
|
//采购单总件数,由于1688运费只存在订单层,sku层没有运费,所以需要以订单总件数为基础等比计算采购运费
|
|
|
|
var purchaseSkuTotalQuantity = purchaseOrderSimpleInfo.ItemList.Sum(x => x.Quantity); |
|
|
|
var belongSkuGroups = cargoParamGroup.CargoParamList.GroupBy(p => p.BelongSkuId); |
|
|
|
var belongSkuIdList = belongSkuGroups.Select(bsg => bsg.Key).ToList(); |
|
|
|
foreach (var belongSkuGroup in belongSkuGroups) |
|
|
|
{ |
|
|
|
var belongSkuId = belongSkuGroup.Key; |
|
|
@ -402,7 +404,7 @@ namespace BBWYB.Server.Business |
|
|
|
PurchaserId = cargoParamGroup.PurchaserId, |
|
|
|
PurchaserName = cargoParamGroup.PurchaserName, |
|
|
|
ShopId = request.ShopId, |
|
|
|
BelongSkuIds = string.Join(",", belongSkuGroups.Select(bsg => bsg.Key)), |
|
|
|
BelongSkuIds = string.Join(",", belongSkuIdList), |
|
|
|
IsEnabled = true, |
|
|
|
Remark = !string.IsNullOrEmpty(cargoParamGroup.Remark) ? cargoParamGroup.Remark : request.Remark |
|
|
|
}; |
|
|
@ -425,6 +427,14 @@ namespace BBWYB.Server.Business |
|
|
|
insertOrderPurchaseSkuInfos.Add(orderPurchaseSkuInfo); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 采购限时任务
|
|
|
|
foreach (var belongSkuId in belongSkuIdList) |
|
|
|
{ |
|
|
|
if (!updatePurchaseTimeLimitTaskOrderSkuList.Any(x => x == belongSkuId)) |
|
|
|
updatePurchaseTimeLimitTaskOrderSkuList.Add(belongSkuId); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
|
|
|
|
#region 订单成本
|
|
|
@ -464,6 +474,15 @@ namespace BBWYB.Server.Business |
|
|
|
fsql.Update<OrderPurchaseInfo>(updatePurchaseOrderIdList).Set(opi => opi.IsEnabled, false).ExecuteAffrows(); |
|
|
|
if (updateOrderCostDetailIdList.Count() > 0) |
|
|
|
fsql.Update<OrderCostDetail>(updateOrderCostDetailIdList).Set(ocd => ocd.IsEnabled, false).ExecuteAffrows(); |
|
|
|
if (updatePurchaseTimeLimitTaskOrderSkuList.Count() > 0) |
|
|
|
{ |
|
|
|
fsql.Update<TimeLimitTask>().Set(t => t.CompletionTime, DateTime.Now) |
|
|
|
.SetIf(dbOrder.PayTime != null, t => t.IsTimely == DateTime.Now < t.ExpirationTime) |
|
|
|
.Where(t => t.OrderId == request.OrderId) |
|
|
|
.Where(t => updatePurchaseTimeLimitTaskOrderSkuList.Contains(t.SkuId)) |
|
|
|
.Where(t => t.CompletionTime == null) |
|
|
|
.ExecuteAffrows(); |
|
|
|
} |
|
|
|
|
|
|
|
fsql.Insert(insertOrderCostDetails).ExecuteAffrows(); |
|
|
|
fsql.Insert(insertOrderPurchaseInfos).ExecuteAffrows(); |
|
|
|