Browse Source

采购单查询接口增加采购账号名称

AddValidOverTime
shanji 2 years ago
parent
commit
255c0d0b8a
  1. 10
      BBWY.Client/Models/APIModel/Response/BatchPurchase/PurchaseOrderV2Response.cs
  2. 4
      BBWY.Client/Views/BatchPurchase/BatchPurchaseOrderList.xaml
  3. 68
      BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs
  4. 3
      BBWY.Server.Model/Dto/Response/PurchaseOrderV2/PurchaseOrderV2Response.cs

10
BBWY.Client/Models/APIModel/Response/BatchPurchase/PurchaseOrderV2Response.cs

@ -82,11 +82,11 @@ namespace BBWY.Client.Models
public bool? IsConvertToStock { get; set; } = false;
/// <summary>
/// 是否订阅快递100
/// </summary>
///// <summary>
///// 是否订阅快递100
///// </summary>
public bool? IsSubscribeKuaiDi100 { get; set; } = false;
//public bool? IsSubscribeKuaiDi100 { get; set; } = false;
/// <summary>
/// 采购单状态(待付款=0,待发货=1,待收货=2,待质检=3,待打包=4,待结算=5,已完成=6)
@ -109,6 +109,8 @@ namespace BBWY.Client.Models
public long? PurchaseAccountId { get; set; }
public string PurchaseAccountName { get; set; }
/// <summary>
/// 采购金额(采购货款+采购运费)
/// </summary>

4
BBWY.Client/Views/BatchPurchase/BatchPurchaseOrderList.xaml

@ -206,9 +206,9 @@
<Border Width="1" Margin="5,5,0,5" Background="{StaticResource Border.Brush}"/>
<StackPanel x:Name="txt_consignee" Margin="5,0,0,0" Orientation="Horizontal" VerticalAlignment="Center">
<TextBlock Text="下单账号:"/>
<c:BButton Content="{Binding PurchaseAccountId}" Style="{StaticResource LinkButton}"
<c:BButton Content="{Binding PurchaseAccountName}" Style="{StaticResource LinkButton}"
Command="{Binding DataContext.CopyTextCommand,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type ListBox}}}"
CommandParameter="{Binding PurchaseAccountId}" Margin="5,0,0,0"/>
CommandParameter="{Binding PurchaseAccountName}" Margin="5,0,0,0"/>
<TextBlock Text="收货人:" Margin="5,0,0,0"/>
<c:BButton Content="{Binding ConsigneeContactName}" Style="{StaticResource LinkButton}"

68
BBWY.Server.Business/PurchaseOrderV2/BatchPurchase/BatchPurchaseBusiness.cs

@ -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();

3
BBWY.Server.Model/Dto/Response/PurchaseOrderV2/PurchaseOrderV2Response.cs

@ -5,11 +5,12 @@ namespace BBWY.Server.Model.Dto
{
public class PurchaseOrderV2Response : PurchaseOrderV2
{
public string PurchaseAccountName { get; set; }
public IList<PurchaseOrderSkuResponse> ItemList { get; set; }
}
public class PurchaseOrderV2ListResponse
{
{
public long Count { get; set; }
public IList<PurchaseOrderV2Response> ItemList { get; set; }

Loading…
Cancel
Save