|
|
@ -259,7 +259,7 @@ namespace BBWY.Server.Business |
|
|
|
TradeMode = tradeMode, |
|
|
|
Extensions = cardId, |
|
|
|
AutoPay = request.AutoPay, |
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
var purchaseOrderSimpleInfo = platformSDKBusinessList.FirstOrDefault(p => p.Platform == purchasePlatform).GetOrderSimpleInfo(new GetOrderInfoRequest() |
|
|
@ -363,30 +363,66 @@ namespace BBWY.Server.Business |
|
|
|
if (request.EndDate != null) |
|
|
|
request.EndDate = request.EndDate.Value.Date.AddDays(1).AddSeconds(-1); |
|
|
|
|
|
|
|
var select = fsql.Select<PurchaseOrderV2>().Where(p => p.ShopId == request.ShopId); |
|
|
|
var select = fsql.Select<PurchaseOrderV2, PurchaseAccount>().LeftJoin((po, pa) => po.PurchaseAccountId == pa.Id) |
|
|
|
.Where((po, pa) => po.ShopId == request.ShopId); |
|
|
|
if (!string.IsNullOrEmpty(request.PurchaseOrderId)) |
|
|
|
{ |
|
|
|
select = select.Where(p => p.Id == request.PurchaseOrderId); |
|
|
|
select = select.Where((po, pa) => po.Id == request.PurchaseOrderId); |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (!string.IsNullOrEmpty(request.Spu) || !string.IsNullOrEmpty(request.Sku)) |
|
|
|
{ |
|
|
|
var childSelect = fsql.Select<PurchaseOrderSku>().As("posku") |
|
|
|
.WhereIf(!string.IsNullOrEmpty(request.Sku), posku => posku.SkuId == request.Sku) |
|
|
|
.WhereIf(!string.IsNullOrEmpty(request.Spu), posku => posku.ProductId == request.Spu); |
|
|
|
.WhereIf(!string.IsNullOrEmpty(request.Sku), posku => posku.SkuId == request.Sku) |
|
|
|
.WhereIf(!string.IsNullOrEmpty(request.Spu), posku => posku.ProductId == request.Spu); |
|
|
|
|
|
|
|
select = select.Where(p => childSelect.Where(posku => posku.PurchaseOrderId == p.Id).Any()); |
|
|
|
select = select.Where((po, pa) => childSelect.Where(posku => posku.PurchaseOrderId == po.Id).Any()); |
|
|
|
} |
|
|
|
select = select.WhereIf(request.PurchaserName != null, p => p.PurchaserName == request.PurchaserName) |
|
|
|
.WhereIf(request.PurchaseOrderState != null, p => p.OrderState == request.PurchaseOrderState) |
|
|
|
.WhereIf(request.StartDate != null, p => p.CreateTime >= request.StartDate) |
|
|
|
.WhereIf(request.EndDate != null, p => p.CreateTime <= request.EndDate); |
|
|
|
select = select.WhereIf(request.PurchaserName != null, (po, pa) => po.PurchaserName == request.PurchaserName) |
|
|
|
.WhereIf(request.PurchaseOrderState != null, (po, pa) => po.OrderState == request.PurchaseOrderState) |
|
|
|
.WhereIf(request.StartDate != null, (po, pa) => po.CreateTime >= request.StartDate) |
|
|
|
.WhereIf(request.EndDate != null, (po, pa) => po.CreateTime <= request.EndDate); |
|
|
|
} |
|
|
|
var purchaseOrderList = select.OrderByDescending(p => p.CreateTime) |
|
|
|
var purchaseOrderList = select.OrderByDescending((po, pa) => po.CreateTime) |
|
|
|
.Count(out var total) |
|
|
|
.Page(request.PageIndex, request.PageSize) |
|
|
|
.ToList<PurchaseOrderV2Response>(); |
|
|
|
.ToList((po, pa) => new PurchaseOrderV2Response |
|
|
|
{ |
|
|
|
Id = po.Id, |
|
|
|
ShopId = po.ShopId, |
|
|
|
OrderState = po.OrderState, |
|
|
|
PurchasePlatform = po.PurchasePlatform, |
|
|
|
ConsigneeContactName = po.ConsigneeContactName, |
|
|
|
ConsigneeMobile = po.ConsigneeMobile, |
|
|
|
ConsigneeProvince = po.ConsigneeProvince, |
|
|
|
ConsigneeCity = po.ConsigneeCity, |
|
|
|
ConsigneeCounty = po.ConsigneeCounty, |
|
|
|
ConsigneeTown = po.ConsigneeTown, |
|
|
|
ConsigneeAddress = po.ConsigneeAddress, |
|
|
|
PurchaserId = po.PurchaserId, |
|
|
|
PurchaserName = po.PurchaserName, |
|
|
|
PurchaseAccountId = po.PurchaseAccountId, |
|
|
|
PurchaseAccountName = pa.AccountName, |
|
|
|
PurchaseAmount = po.PurchaseAmount, |
|
|
|
ProductAmount = po.ProductAmount, |
|
|
|
PurchaseFreight = po.PurchaseFreight, |
|
|
|
QualityInspectionAmount = po.QualityInspectionAmount, |
|
|
|
InStorageAmount = po.InStorageAmount, |
|
|
|
ConsumableAmount = po.ConsumableAmount, |
|
|
|
FirstFreight = po.FirstFreight, |
|
|
|
IsConvertToStock = po.IsConvertToStock, |
|
|
|
Remark = po.Remark, |
|
|
|
CreateTime = po.CreateTime, |
|
|
|
PayTime = po.PayTime, |
|
|
|
SignTime = po.SignTime, |
|
|
|
CompletionTime = po.CompletionTime, |
|
|
|
PurchaseMethod = po.PurchaseMethod, |
|
|
|
PurchaseOrderMode = po.PurchaseOrderMode, |
|
|
|
ExpressName = po.ExpressName, |
|
|
|
WaybillNo = po.WaybillNo |
|
|
|
//PackState = po.PackState
|
|
|
|
}); |
|
|
|
|
|
|
|
var purchaseOrderIdList = purchaseOrderList.Select(p => p.Id).ToList(); |
|
|
|
var purchaseOrderSkuList = fsql.Select<PurchaseOrderSku>().Where(posku => purchaseOrderIdList.Contains(posku.PurchaseOrderId)).ToList<PurchaseOrderSkuResponse>(); |
|
|
@ -409,8 +445,10 @@ namespace BBWY.Server.Business |
|
|
|
.ExecuteAffrows(); |
|
|
|
} |
|
|
|
|
|
|
|
return new PayPurchaseOrderResponse() { Success= payOrderResponse.Success, |
|
|
|
Msg = payOrderResponse.Msg |
|
|
|
return new PayPurchaseOrderResponse() |
|
|
|
{ |
|
|
|
Success = payOrderResponse.Success, |
|
|
|
Msg = payOrderResponse.Msg |
|
|
|
}; |
|
|
|
} |
|
|
|
|
|
|
@ -421,7 +459,7 @@ namespace BBWY.Server.Business |
|
|
|
|
|
|
|
if (payOrderResponse.Success) |
|
|
|
{ |
|
|
|
var order =fsql.Select<PurchaseOrderV2>().Where(p => p.Id == request.OrderId).ToOne(); |
|
|
|
var order = fsql.Select<PurchaseOrderV2>().Where(p => p.Id == request.OrderId).ToOne(); |
|
|
|
fsql.Update<PurchaseOrderV2>(order) |
|
|
|
.Set(a => a.OrderState, Enums.PurchaseOrderState.已取消) |
|
|
|
.ExecuteAffrows(); |
|
|
|