|
@ -363,10 +363,11 @@ namespace BBWY.Server.Business |
|
|
if (request.EndDate != null) |
|
|
if (request.EndDate != null) |
|
|
request.EndDate = request.EndDate.Value.Date.AddDays(1).AddSeconds(-1); |
|
|
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)) |
|
|
if (!string.IsNullOrEmpty(request.PurchaseOrderId)) |
|
|
{ |
|
|
{ |
|
|
select = select.Where(p => p.Id == request.PurchaseOrderId); |
|
|
select = select.Where((po, pa) => po.Id == request.PurchaseOrderId); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
@ -376,17 +377,52 @@ namespace BBWY.Server.Business |
|
|
.WhereIf(!string.IsNullOrEmpty(request.Sku), posku => posku.SkuId == request.Sku) |
|
|
.WhereIf(!string.IsNullOrEmpty(request.Sku), posku => posku.SkuId == request.Sku) |
|
|
.WhereIf(!string.IsNullOrEmpty(request.Spu), posku => posku.ProductId == request.Spu); |
|
|
.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) |
|
|
select = select.WhereIf(request.PurchaserName != null, (po, pa) => po.PurchaserName == request.PurchaserName) |
|
|
.WhereIf(request.PurchaseOrderState != null, p => p.OrderState == request.PurchaseOrderState) |
|
|
.WhereIf(request.PurchaseOrderState != null, (po, pa) => po.OrderState == request.PurchaseOrderState) |
|
|
.WhereIf(request.StartDate != null, p => p.CreateTime >= request.StartDate) |
|
|
.WhereIf(request.StartDate != null, (po, pa) => po.CreateTime >= request.StartDate) |
|
|
.WhereIf(request.EndDate != null, p => p.CreateTime <= request.EndDate); |
|
|
.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) |
|
|
.Count(out var total) |
|
|
.Page(request.PageIndex, request.PageSize) |
|
|
.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 purchaseOrderIdList = purchaseOrderList.Select(p => p.Id).ToList(); |
|
|
var purchaseOrderSkuList = fsql.Select<PurchaseOrderSku>().Where(posku => purchaseOrderIdList.Contains(posku.PurchaseOrderId)).ToList<PurchaseOrderSkuResponse>(); |
|
|
var purchaseOrderSkuList = fsql.Select<PurchaseOrderSku>().Where(posku => purchaseOrderIdList.Contains(posku.PurchaseOrderId)).ToList<PurchaseOrderSkuResponse>(); |
|
@ -409,7 +445,9 @@ namespace BBWY.Server.Business |
|
|
.ExecuteAffrows(); |
|
|
.ExecuteAffrows(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
return new PayPurchaseOrderResponse() { Success= payOrderResponse.Success, |
|
|
return new PayPurchaseOrderResponse() |
|
|
|
|
|
{ |
|
|
|
|
|
Success = payOrderResponse.Success, |
|
|
Msg = payOrderResponse.Msg |
|
|
Msg = payOrderResponse.Msg |
|
|
}; |
|
|
}; |
|
|
} |
|
|
} |
|
|