|
|
@ -10,6 +10,7 @@ using Newtonsoft.Json.Linq; |
|
|
|
using SDKAdapter; |
|
|
|
using SDKAdapter.PurchasePlatform.Client; |
|
|
|
using SDKAdapter.PurchasePlatform.Models; |
|
|
|
using System.Text; |
|
|
|
using Yitter.IdGenerator; |
|
|
|
|
|
|
|
namespace BBWYB.Server.Business |
|
|
@ -44,43 +45,82 @@ namespace BBWYB.Server.Business |
|
|
|
public PreviewOrderResponse PreviewPurchaseOrder(PreviewOrderRequest request) |
|
|
|
{ |
|
|
|
nLogManager.Default().Info($"PreviewPurchaseOrder {JsonConvert.SerializeObject(request)}"); |
|
|
|
var response = ppPlatformClientFactory.GetClient((AdapterEnums.PlatformType)request.Platform) |
|
|
|
.PreviewOrder(new PP_PreviewOrderRequest() |
|
|
|
{ |
|
|
|
AppKey = request.AppKey, |
|
|
|
AppSecret = request.AppSecret, |
|
|
|
AppToken = request.AppToken, |
|
|
|
Consignee = new PP_ConsigneeRequest() |
|
|
|
{ |
|
|
|
Address = request.Consignee.Address, |
|
|
|
City = request.Consignee.City, |
|
|
|
ContactName = request.Consignee.ContactName, |
|
|
|
County = request.Consignee.County, |
|
|
|
Mobile = request.Consignee.Mobile, |
|
|
|
Province = request.Consignee.Province, |
|
|
|
TelePhone = request.Consignee.TelePhone, |
|
|
|
Town = request.Consignee.Town |
|
|
|
}, |
|
|
|
Platform = (AdapterEnums.PlatformType)request.Platform, |
|
|
|
PurchaseMode = (AdapterEnums.PurchaseMode)request.PurchaseOrderMode, |
|
|
|
OrderProductParamList = request.CargoParamList.Select(p => new PP_OrderProductParamRequest() |
|
|
|
{ |
|
|
|
ProductId = p.ProductId, |
|
|
|
Quantity = p.Quantity, |
|
|
|
SkuId = p.SkuId, |
|
|
|
SpecId = p.SpecId |
|
|
|
}).ToList() |
|
|
|
}); |
|
|
|
if (request.Consignee == null || |
|
|
|
string.IsNullOrEmpty(request.Consignee.Address) || |
|
|
|
string.IsNullOrEmpty(request.Consignee.Mobile) || |
|
|
|
string.IsNullOrEmpty(request.Consignee.ContactName)) |
|
|
|
throw new BusinessException("缺少收货人信息"); |
|
|
|
if (request.PurchaseAccountList == null || request.PurchaseAccountList.Count() == 0) |
|
|
|
throw new BusinessException("缺少采购账号"); |
|
|
|
if (request.CargoParamGroupList == null || request.CargoParamGroupList.Count() == 0) |
|
|
|
throw new BusinessException("缺少报价参数"); |
|
|
|
|
|
|
|
var extJArray = new List<object>(); |
|
|
|
var errorBuilder = new StringBuilder(); |
|
|
|
var freightAmount = 0M; |
|
|
|
var productAmount = 0M; |
|
|
|
var totalAmount = 0M; |
|
|
|
|
|
|
|
foreach (var cargoParamGroup in request.CargoParamGroupList) |
|
|
|
{ |
|
|
|
var purchaseAccount = request.PurchaseAccountList.FirstOrDefault(pa => pa.PurchasePlatformId == cargoParamGroup.PurchasePlatform); |
|
|
|
if (purchaseAccount == null) |
|
|
|
throw new BusinessException($"缺少{cargoParamGroup.PurchasePlatform}采购平台账号,请在店铺配置中设置"); |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
var response = ppPlatformClientFactory.GetClient((AdapterEnums.PlatformType)cargoParamGroup.PurchasePlatform) |
|
|
|
.PreviewOrder(new PP_PreviewOrderRequest() |
|
|
|
{ |
|
|
|
AppKey = purchaseAccount.AppKey, |
|
|
|
AppSecret = purchaseAccount.AppSecret, |
|
|
|
AppToken = purchaseAccount.AppToken, |
|
|
|
Consignee = new PP_ConsigneeRequest() |
|
|
|
{ |
|
|
|
Address = request.Consignee.Address, |
|
|
|
City = request.Consignee.City, |
|
|
|
ContactName = request.Consignee.ContactName, |
|
|
|
County = request.Consignee.County, |
|
|
|
Mobile = request.Consignee.Mobile, |
|
|
|
Province = request.Consignee.Province, |
|
|
|
TelePhone = request.Consignee.TelePhone, |
|
|
|
Town = request.Consignee.Town |
|
|
|
}, |
|
|
|
Platform = (AdapterEnums.PlatformType)cargoParamGroup.PurchasePlatform, |
|
|
|
PurchaseMode = (AdapterEnums.PurchaseMode)request.PurchaseOrderMode, |
|
|
|
OrderProductParamList = cargoParamGroup.CargoParamList.Select(p => new PP_OrderProductParamRequest() |
|
|
|
{ |
|
|
|
ProductId = p.ProductId, |
|
|
|
Quantity = p.Quantity, |
|
|
|
SkuId = p.SkuId, |
|
|
|
SpecId = p.SpecId |
|
|
|
}).ToList() |
|
|
|
}); |
|
|
|
|
|
|
|
if (cargoParamGroup.PurchasePlatform == Enums.Platform.阿里巴巴) |
|
|
|
extJArray.Add(new { cargoParamGroup.PurchaserId, cargoParamGroup.PurchasePlatform, OrderTradeTypeCode = response.Extensions }); |
|
|
|
|
|
|
|
freightAmount += response.FreightAmount; |
|
|
|
productAmount += response.ProductAmount; |
|
|
|
totalAmount += response.TotalAmount; |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
errorBuilder.AppendLine($"采购商:{cargoParamGroup.PurchaserName}"); |
|
|
|
errorBuilder.AppendLine(ex.Message); |
|
|
|
throw new BusinessException(errorBuilder.ToString()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return new PreviewOrderResponse() |
|
|
|
{ |
|
|
|
Extensions = response.Extensions, |
|
|
|
FreightAmount = response.FreightAmount, |
|
|
|
ProductAmount = response.ProductAmount, |
|
|
|
TotalAmount = response.TotalAmount |
|
|
|
Extensions = JsonConvert.SerializeObject(extJArray), |
|
|
|
FreightAmount = freightAmount, |
|
|
|
ProductAmount = productAmount, |
|
|
|
TotalAmount = totalAmount |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void CreatePurchaseOrder(CreateOrderRequest request) |
|
|
|
{ |
|
|
|
nLogManager.Default().Info($"CreatePurchaseOrder\r\n{JsonConvert.SerializeObject(request)}"); |
|
|
@ -91,117 +131,131 @@ namespace BBWYB.Server.Business |
|
|
|
if (dbOrder.OrderState != Enums.OrderState.等待采购 && dbOrder.OrderState != Enums.OrderState.待出库) |
|
|
|
throw new BusinessException("只能为等待采购或待出库的订单进行采购"); |
|
|
|
|
|
|
|
if (request.Consignee == null || |
|
|
|
string.IsNullOrEmpty(request.Consignee.Address) || |
|
|
|
string.IsNullOrEmpty(request.Consignee.Mobile) || |
|
|
|
string.IsNullOrEmpty(request.Consignee.ContactName)) |
|
|
|
throw new BusinessException("缺少收货人信息"); |
|
|
|
if (request.PurchaseAccountList == null || request.PurchaseAccountList.Count() == 0) |
|
|
|
throw new BusinessException("缺少采购账号"); |
|
|
|
if (request.CargoParamGroupList == null || request.CargoParamGroupList.Count() == 0) |
|
|
|
throw new BusinessException("缺少下单商品参数"); |
|
|
|
|
|
|
|
var deleteOrderCostDetail = fsql.Delete<OrderCostDetail>().Where(ocd => ocd.OrderId == dbOrder.Id); |
|
|
|
var isRepurchase = fsql.Select<OrderCost>(dbOrder.Id).Any(); |
|
|
|
|
|
|
|
#region 合并重复的采购sku
|
|
|
|
var repeatPurchaseSkuGroups = request.CargoParamList.GroupBy(p => p.SkuId).ToList(); |
|
|
|
foreach (var group in repeatPurchaseSkuGroups) |
|
|
|
{ |
|
|
|
if (group.Count() > 1) |
|
|
|
{ |
|
|
|
var repeatSkus = group.ToList(); |
|
|
|
foreach (var repeatSku in repeatSkus) |
|
|
|
request.CargoParamList.Remove(repeatSku); |
|
|
|
request.CargoParamList.Add(new CargoParamRequest() |
|
|
|
{ |
|
|
|
BelongSkuId = repeatSkus[0].BelongSkuId, |
|
|
|
ProductId = repeatSkus[0].ProductId, |
|
|
|
SkuId = repeatSkus[0].SkuId, |
|
|
|
SpecId = repeatSkus[0].SpecId, |
|
|
|
Quantity = repeatSkus.Sum(s => s.Quantity) |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
var orderSkus = fsql.Select<OrderSku>().Where(osku => osku.Price != 0 && osku.OrderId == request.OrderId).ToList(); |
|
|
|
var orderSkuIds = orderSkus.Select(osku => osku.Id).ToList(); |
|
|
|
|
|
|
|
var client = ppPlatformClientFactory.GetClient((AdapterEnums.PlatformType)request.Platform); |
|
|
|
|
|
|
|
var createOrderResponse = client.CreateOrder(new PP_CreateOrderRequest() |
|
|
|
{ |
|
|
|
AppKey = request.AppKey, |
|
|
|
AppSecret = request.AppSecret, |
|
|
|
AppToken = request.AppToken, |
|
|
|
Consignee = new PP_ConsigneeRequest() |
|
|
|
{ |
|
|
|
Address = request.Consignee.Address, |
|
|
|
City = request.Consignee.City, |
|
|
|
ContactName = request.Consignee.ContactName, |
|
|
|
County = request.Consignee.County, |
|
|
|
Mobile = request.Consignee.Mobile, |
|
|
|
Province = request.Consignee.Province, |
|
|
|
TelePhone = request.Consignee.TelePhone, |
|
|
|
Town = request.Consignee.Town |
|
|
|
}, |
|
|
|
Platform = (AdapterEnums.PlatformType)request.Platform, |
|
|
|
PurchaseMode = (AdapterEnums.PurchaseMode)request.PurchaseOrderMode, |
|
|
|
Extensions = request.Extensions, |
|
|
|
Remark = request.Remark, |
|
|
|
OrderProductParamList = request.CargoParamList.Select(p => new PP_OrderProductParamRequest() |
|
|
|
{ |
|
|
|
ProductId = p.ProductId, |
|
|
|
Quantity = p.Quantity, |
|
|
|
SkuId = p.SkuId, |
|
|
|
SpecId = p.SpecId |
|
|
|
}).ToList() |
|
|
|
}); |
|
|
|
|
|
|
|
var purchaseOrderSimpleInfo = client.QueryOrderDetail(new PP_QueryOrderDetailRequest() |
|
|
|
{ |
|
|
|
AppKey = request.AppKey, |
|
|
|
AppSecret = request.AppSecret, |
|
|
|
AppToken = request.AppToken, |
|
|
|
OrderId = createOrderResponse.OrderId |
|
|
|
}); |
|
|
|
|
|
|
|
nLogManager.Default().Info($"QueryOrderDetail\r\nShopOrderId {request.OrderId}\r\n purchaseOrderSimpleInfo\r\n{JsonConvert.SerializeObject(purchaseOrderSimpleInfo)}"); |
|
|
|
|
|
|
|
var extJArray = JsonConvert.DeserializeObject<JArray>(request.Extensions); |
|
|
|
//IList<PP_QueryOrderDetailResponse> purchaseOrderSimpleInfoList = new List<PP_QueryOrderDetailResponse>();
|
|
|
|
|
|
|
|
List<OrderCostDetail> insertOrderCostDetails = new List<OrderCostDetail>(); |
|
|
|
List<OrderPurchaseInfo> insertOrderPurchaseInfos = new List<OrderPurchaseInfo>(); |
|
|
|
IInsert<OrderCost> insertOrderCost = null; |
|
|
|
IUpdate<OrderCost> updateOrderCost = null; |
|
|
|
IInsert<OrderPurchaseInfo> insertOrderPurchaseInfo = null; |
|
|
|
IUpdate<OrderPurchaseInfo> updateOrderPurchaseInfo = null; |
|
|
|
var totalPurchaseAmount = 0M; |
|
|
|
|
|
|
|
foreach (var orderSku in orderSkus) |
|
|
|
foreach (var cargoParamGroup in request.CargoParamGroupList) |
|
|
|
{ |
|
|
|
#region 计算当前sku的采购成本和采购运费
|
|
|
|
var currentOrderSkuProductAmount = 0M; //采购成本
|
|
|
|
var currentOrderSkuCargoParamList = request.CargoParamList.Where(p => p.BelongSkuId == orderSku.SkuId); //找当前skuId的采购skuId
|
|
|
|
currentOrderSkuProductAmount = purchaseOrderSimpleInfo.ItemList.Where(p => currentOrderSkuCargoParamList.Any(p1 => p1.SkuId == p.SkuId))?.Sum(p => p.ProductAmount) ?? 0M; |
|
|
|
var purchaseAccount = request.PurchaseAccountList.FirstOrDefault(pa => pa.PurchasePlatformId == cargoParamGroup.PurchasePlatform); |
|
|
|
if (purchaseAccount == null) |
|
|
|
throw new BusinessException($"缺少{cargoParamGroup.PurchasePlatform}采购平台账号,请在店铺配置中设置"); |
|
|
|
|
|
|
|
var currentOrderSkuFreightAmount = purchaseOrderSimpleInfo.FreightAmount / orderSkus.Count(); //采购运费(按sku数均分)
|
|
|
|
#endregion
|
|
|
|
var client = ppPlatformClientFactory.GetClient((AdapterEnums.PlatformType)cargoParamGroup.PurchasePlatform); |
|
|
|
var extJson = extJArray.FirstOrDefault(j => j.Value<string>("PurchaserId") == cargoParamGroup.PurchaserId); |
|
|
|
|
|
|
|
#region 成本明细
|
|
|
|
var orderCostDetail = new OrderCostDetail() |
|
|
|
var createOrderResponse = client.CreateOrder(new PP_CreateOrderRequest() |
|
|
|
{ |
|
|
|
Id = idGenerator.NewLong(), |
|
|
|
ConsumableAmount = 0, |
|
|
|
CreateTime = DateTime.Now, |
|
|
|
DeductionQuantity = orderSku.ItemTotal.Value, |
|
|
|
DeliveryExpressFreight = 0, |
|
|
|
FirstFreight = 0, |
|
|
|
//OperationAmount = 0,
|
|
|
|
InStorageAmount = 0, |
|
|
|
OutStorageAmount = 0, |
|
|
|
OrderId = request.OrderId, |
|
|
|
ProductId = orderSku.ProductId, |
|
|
|
PurchaseFreight = currentOrderSkuFreightAmount, |
|
|
|
//PurchaseOrderPKId = purchaseOrder.Id,
|
|
|
|
PurchaseOrderId = purchaseOrderSimpleInfo.OrderId, |
|
|
|
SkuAmount = currentOrderSkuProductAmount, |
|
|
|
SkuId = orderSku.SkuId, |
|
|
|
StorageAmount = 0 |
|
|
|
//UnitCost = purchaseOrder.UnitCost,
|
|
|
|
//TotalCost = currentOrderSkuProductAmount + currentOrderSkuFreightAmount//purchaseOrder.UnitCost * orderSku.ItemTotal.Value
|
|
|
|
}; |
|
|
|
//orderCostDetail.SkuGrossProfit = orderSku.Price.Value * orderCostDetail.DeductionQuantity - avgPreferential - (orderCostDetail.TotalCost + orderCostDetail.DeliveryExpressFreight) - orderSku.Price.Value * orderCostDetail.DeductionQuantity * createOnlinePurchaseOrderRequest.PlatformCommissionRatio;
|
|
|
|
insertOrderCostDetails.Add(orderCostDetail); |
|
|
|
#endregion
|
|
|
|
AppKey = purchaseAccount.AppKey, |
|
|
|
AppSecret = purchaseAccount.AppSecret, |
|
|
|
AppToken = purchaseAccount.AppToken, |
|
|
|
Consignee = new PP_ConsigneeRequest() |
|
|
|
{ |
|
|
|
Address = request.Consignee.Address, |
|
|
|
City = request.Consignee.City, |
|
|
|
ContactName = request.Consignee.ContactName, |
|
|
|
County = request.Consignee.County, |
|
|
|
Mobile = request.Consignee.Mobile, |
|
|
|
Province = request.Consignee.Province, |
|
|
|
TelePhone = request.Consignee.TelePhone, |
|
|
|
Town = request.Consignee.Town |
|
|
|
}, |
|
|
|
Platform = (AdapterEnums.PlatformType)purchaseAccount.PurchasePlatformId, |
|
|
|
PurchaseMode = (AdapterEnums.PurchaseMode)request.PurchaseOrderMode, |
|
|
|
Extensions = extJson.Value<string>("OrderTradeTypeCode"), |
|
|
|
Remark = request.Remark, |
|
|
|
OrderProductParamList = cargoParamGroup.CargoParamList.Select(p => new PP_OrderProductParamRequest() |
|
|
|
{ |
|
|
|
ProductId = p.ProductId, |
|
|
|
Quantity = p.Quantity, |
|
|
|
SkuId = p.SkuId, |
|
|
|
SpecId = p.SpecId |
|
|
|
}).ToList() |
|
|
|
}); |
|
|
|
|
|
|
|
var purchaseOrderSimpleInfo = client.QueryOrderDetail(new PP_QueryOrderDetailRequest() |
|
|
|
{ |
|
|
|
AppKey = purchaseAccount.AppKey, |
|
|
|
AppSecret = purchaseAccount.AppSecret, |
|
|
|
AppToken = purchaseAccount.AppToken, |
|
|
|
OrderId = createOrderResponse.OrderId |
|
|
|
}); |
|
|
|
|
|
|
|
totalPurchaseAmount += purchaseOrderSimpleInfo.TotalAmount; |
|
|
|
//purchaseOrderSimpleInfoList.Add(purchaseOrderSimpleInfo);
|
|
|
|
|
|
|
|
var belongSkuGroups = cargoParamGroup.CargoParamList.GroupBy(p => p.BelongSkuId); |
|
|
|
foreach (var belongSkuGroup in belongSkuGroups) |
|
|
|
{ |
|
|
|
var belongSkuId = belongSkuGroup.Key; |
|
|
|
var currentOrderSkuProductAmount = 0M; //采购成本
|
|
|
|
var currentOrderSkuCargoParamList = cargoParamGroup.CargoParamList.Where(p => p.BelongSkuId == belongSkuId); //找当前skuId的采购skuId
|
|
|
|
currentOrderSkuProductAmount = purchaseOrderSimpleInfo.ItemList.Where(p => currentOrderSkuCargoParamList.Any(p1 => p1.SkuId == p.SkuId)) |
|
|
|
?.Sum(p => p.ProductAmount) ?? 0M; |
|
|
|
var currentOrderSkuFreightAmount = purchaseOrderSimpleInfo.FreightAmount / belongSkuGroups.Count(); //采购运费(按sku数均分)
|
|
|
|
|
|
|
|
#region 成本明细
|
|
|
|
var orderSku = orderSkus.FirstOrDefault(osku => osku.SkuId == belongSkuId); |
|
|
|
var orderCostDetail = new OrderCostDetail() |
|
|
|
{ |
|
|
|
Id = idGenerator.NewLong(), |
|
|
|
ConsumableAmount = 0, |
|
|
|
CreateTime = DateTime.Now, |
|
|
|
DeductionQuantity = orderSku.ItemTotal.Value, |
|
|
|
DeliveryExpressFreight = 0, |
|
|
|
FirstFreight = 0, |
|
|
|
//OperationAmount = 0,
|
|
|
|
InStorageAmount = 0, |
|
|
|
OutStorageAmount = 0, |
|
|
|
OrderId = request.OrderId, |
|
|
|
ProductId = orderSku.ProductId, |
|
|
|
PurchaseFreight = currentOrderSkuFreightAmount, |
|
|
|
PurchaseOrderId = purchaseOrderSimpleInfo.OrderId, |
|
|
|
SkuAmount = currentOrderSkuProductAmount, |
|
|
|
SkuId = belongSkuId, |
|
|
|
StorageAmount = 0 |
|
|
|
}; |
|
|
|
insertOrderCostDetails.Add(orderCostDetail); |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 订单采购信息
|
|
|
|
var orderPurchaserInfo = new OrderPurchaseInfo() |
|
|
|
{ |
|
|
|
Id = idGenerator.NewLong(), |
|
|
|
OrderId = request.OrderId, |
|
|
|
CreateTime = DateTime.Now, |
|
|
|
PurchaseAccountId = purchaseAccount.Id, |
|
|
|
PurchaseAccountName = purchaseAccount.AccountName, |
|
|
|
PurchaseMethod = Enums.PurchaseMethod.线上采购, |
|
|
|
PurchaseOrderId = createOrderResponse.OrderId, |
|
|
|
PurchasePlatform = cargoParamGroup.PurchasePlatform, |
|
|
|
PurchaserName = cargoParamGroup.PurchaserName, |
|
|
|
ShopId = request.ShopId |
|
|
|
}; |
|
|
|
insertOrderPurchaseInfos.Add(orderPurchaserInfo); |
|
|
|
#endregion
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#region 订单成本
|
|
|
@ -213,7 +267,7 @@ namespace BBWYB.Server.Business |
|
|
|
IsManualEdited = false, |
|
|
|
PlatformCommissionRatio = 0, |
|
|
|
PreferentialAmount = 0, |
|
|
|
PurchaseAmount = purchaseOrderSimpleInfo.TotalAmount |
|
|
|
PurchaseAmount = totalPurchaseAmount |
|
|
|
}; |
|
|
|
//orderCost.PlatformCommissionAmount = dbOrder.OrderSellerPrice * orderCost.PlatformCommissionRatio;
|
|
|
|
orderCost.Profit = dbOrder.OrderSellerPrice + |
|
|
@ -230,38 +284,13 @@ namespace BBWYB.Server.Business |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 订单采购信息
|
|
|
|
var orderPurchaserInfo = new OrderPurchaseInfo() |
|
|
|
{ |
|
|
|
OrderId = request.OrderId, |
|
|
|
CreateTime = DateTime.Now, |
|
|
|
PurchaseAccountId = request.PurchaseAccountId, |
|
|
|
PurchaseAccountName = request.PurchaseAccountName, |
|
|
|
PurchaseMethod = Enums.PurchaseMethod.线上采购, |
|
|
|
PurchaseOrderId = createOrderResponse.OrderId, |
|
|
|
PurchasePlatform = request.Platform, |
|
|
|
PurchaserName = request.PurchaserName, |
|
|
|
ShopId = request.ShopId |
|
|
|
}; |
|
|
|
|
|
|
|
if (!isRepurchase) |
|
|
|
{ |
|
|
|
insertOrderPurchaseInfo = fsql.Insert(orderPurchaserInfo); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
updateOrderPurchaseInfo = fsql.Update<OrderPurchaseInfo>().SetSource(orderPurchaserInfo).IgnoreColumns(a => new { a.CreateTime }); |
|
|
|
} |
|
|
|
#endregion
|
|
|
|
|
|
|
|
fsql.Transaction(() => |
|
|
|
{ |
|
|
|
deleteOrderCostDetail.ExecuteAffrows(); |
|
|
|
fsql.Insert(insertOrderCostDetails).ExecuteAffrows(); |
|
|
|
fsql.Insert(insertOrderPurchaseInfos).ExecuteAffrows(); |
|
|
|
updateOrderCost?.ExecuteAffrows(); |
|
|
|
insertOrderCost?.ExecuteAffrows(); |
|
|
|
insertOrderPurchaseInfo?.ExecuteAffrows(); |
|
|
|
updateOrderPurchaseInfo?.ExecuteAffrows(); |
|
|
|
fsql.Update<Order>(request.OrderId).SetIf(dbOrder.OrderState == Enums.OrderState.等待采购, o => o.OrderState, Model.Enums.OrderState.待出库) |
|
|
|
.Set(o => o.IsPurchased, true) |
|
|
|
.ExecuteAffrows(); |
|
|
|