|
|
@ -9,6 +9,7 @@ using DS.WMS.Core.Fee.Entity;
|
|
|
|
using DS.WMS.Core.Info.Entity;
|
|
|
|
using DS.WMS.Core.Info.Entity;
|
|
|
|
using DS.WMS.Core.Invoice.Dtos;
|
|
|
|
using DS.WMS.Core.Invoice.Dtos;
|
|
|
|
using DS.WMS.Core.Invoice.Interface;
|
|
|
|
using DS.WMS.Core.Invoice.Interface;
|
|
|
|
|
|
|
|
using DS.WMS.Core.Op.Entity;
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
using DS.WMS.Core.Sys.Entity;
|
|
|
|
using DS.WMS.Core.Sys.Interface;
|
|
|
|
using DS.WMS.Core.Sys.Interface;
|
|
|
|
using Mapster;
|
|
|
|
using Mapster;
|
|
|
@ -40,9 +41,14 @@ namespace DS.WMS.Core.Invoice.Method
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="request"></param>
|
|
|
|
/// <param name="request"></param>
|
|
|
|
/// <returns></returns>
|
|
|
|
/// <returns></returns>
|
|
|
|
public async Task<DataResult<InvoiceList>> GetListAsync(PageRequest<string> request)
|
|
|
|
public async Task<DataResult<InvoiceList>> GetListAsync(PageRequest<NumberQuery> request)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var query = TenantDb.Queryable<Entity.Invoice>()
|
|
|
|
var query = TenantDb.Queryable<Entity.Invoice>()
|
|
|
|
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(request.OtherQueryCondition?.Number), x =>
|
|
|
|
|
|
|
|
SqlFunc.Subqueryable<ApplicationDetail>().InnerJoin<FeeRecord>((d, f) => d.RecordId == f.Id && f.BusinessType == BusinessType.OceanShippingExport)
|
|
|
|
|
|
|
|
.InnerJoin<SeaExport>((d, f, s) => f.BusinessId == s.Id).Where((d, f, s) =>
|
|
|
|
|
|
|
|
s.CustomerNo.Contains(request.OtherQueryCondition.Number) || s.BookingNo.Contains(request.OtherQueryCondition.Number) ||
|
|
|
|
|
|
|
|
s.MBLNO.Contains(request.OtherQueryCondition.Number) || s.CustomerNum.Contains(request.OtherQueryCondition.Number)).Any())
|
|
|
|
.Select((i) => new InvoiceDto
|
|
|
|
.Select((i) => new InvoiceDto
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Details = SqlFunc.Subqueryable<ApplicationDetail>().Where(d => d.ApplicationId == i.Id)
|
|
|
|
Details = SqlFunc.Subqueryable<ApplicationDetail>().Where(d => d.ApplicationId == i.Id)
|
|
|
@ -56,13 +62,14 @@ namespace DS.WMS.Core.Invoice.Method
|
|
|
|
OriginalProcessedAmount = d.OriginalProcessedAmount
|
|
|
|
OriginalProcessedAmount = d.OriginalProcessedAmount
|
|
|
|
}),
|
|
|
|
}),
|
|
|
|
InvoiceApplicationList = SqlFunc.Subqueryable<ApplicationDetail>().LeftJoin<InvoiceApplication>((d, a) =>
|
|
|
|
InvoiceApplicationList = SqlFunc.Subqueryable<ApplicationDetail>().LeftJoin<InvoiceApplication>((d, a) =>
|
|
|
|
d.ApplicationId == i.Id && d.Category == DetailCategory.InvoiceIssuance && d.RefId == a.Id)
|
|
|
|
d.ApplicationId == i.Id && d.RefId == a.Id)
|
|
|
|
.WhereIF(!string.IsNullOrEmpty(request.OtherQueryCondition), (d, a) => a.ApplicationNO.Contains(request.OtherQueryCondition))
|
|
|
|
.WhereIF(request.OtherQueryCondition != null && !string.IsNullOrEmpty(request.OtherQueryCondition.Number),
|
|
|
|
|
|
|
|
(d, a) => a.ApplicationNO.Contains(request.OtherQueryCondition.Number))
|
|
|
|
.GroupBy((d, a) => a.ApplicationNO).ToList((d, a) => a.ApplicationNO)
|
|
|
|
.GroupBy((d, a) => a.ApplicationNO).ToList((d, a) => a.ApplicationNO)
|
|
|
|
}, true).MergeTable();
|
|
|
|
}, true).MergeTable();
|
|
|
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrEmpty(request.OtherQueryCondition))
|
|
|
|
//if (!string.IsNullOrEmpty(request.OtherQueryCondition?.Number))
|
|
|
|
query = query.Where(i => i.InvoiceNO.Contains(request.OtherQueryCondition) || i.BillNO.Contains(request.OtherQueryCondition));
|
|
|
|
// query = query.Where(i => i.InvoiceNO.Contains(request.OtherQueryCondition.Number) || i.BillNO.Contains(request.OtherQueryCondition.Number));
|
|
|
|
|
|
|
|
|
|
|
|
var whereList = request.GetConditionalModels(Db);
|
|
|
|
var whereList = request.GetConditionalModels(Db);
|
|
|
|
var result = await query.Where(whereList).ToQueryPageAsync(request.PageCondition);
|
|
|
|
var result = await query.Where(whereList).ToQueryPageAsync(request.PageCondition);
|
|
|
|