diff --git a/ds-wms-service/DS.WMS.Core/Application/Dtos/ApplicationRequest.cs b/ds-wms-service/DS.WMS.Core/Application/Dtos/ApplicationRequest.cs
index 3a440832..b80edb55 100644
--- a/ds-wms-service/DS.WMS.Core/Application/Dtos/ApplicationRequest.cs
+++ b/ds-wms-service/DS.WMS.Core/Application/Dtos/ApplicationRequest.cs
@@ -17,7 +17,7 @@ namespace DS.WMS.Core.Application.Dtos
///
/// 业务信息
///
- public List Items { get; set; } = [];
+ public List Items { get; set; } = [];
///
/// 汇率转换信息
diff --git a/ds-wms-service/DS.WMS.Core/Application/Dtos/BizOperation.cs b/ds-wms-service/DS.WMS.Core/Application/Dtos/BizOperation.cs
new file mode 100644
index 00000000..905c4fb4
--- /dev/null
+++ b/ds-wms-service/DS.WMS.Core/Application/Dtos/BizOperation.cs
@@ -0,0 +1,94 @@
+using DS.WMS.Core.Op.Entity;
+using System.ComponentModel.DataAnnotations;
+using System.Diagnostics.CodeAnalysis;
+using System.Runtime.Serialization;
+
+namespace DS.WMS.Core.Application.Dtos
+{
+ ///
+ /// 业务ID与类型
+ ///
+ public class BizItem
+ {
+ public static readonly BizItemComparer DefaultComparer = new();
+
+ ///
+ /// 业务ID
+ ///
+ public long Id { get; set; }
+
+ ///
+ /// 业务类型
+ ///
+ public BusinessType BusinessType { get; set; }
+
+
+ public class BizItemComparer : IEqualityComparer
+ {
+ public bool Equals(BizItem? x, BizItem? y)
+ {
+ if (x == null || y == null)
+ return false;
+
+ return x.Id == y.Id && x.BusinessType == y.BusinessType;
+ }
+
+ public int GetHashCode([DisallowNull] BizItem obj)
+ {
+ return obj.Id.GetHashCode() ^ (int)obj.BusinessType;
+ }
+ }
+ }
+
+ ///
+ /// 费用对象/单位
+ ///
+ public class FeeClient : BizItem
+ {
+ ///
+ /// 费用对象ID
+ ///
+ public long CustomerId { get; set; }
+ }
+
+ public class BizOperation : IValidatableObject
+ {
+ ///
+ /// 请求值(object类型,根据业务按需传值)
+ ///
+ public object Value { get; set; }
+
+ ///
+ /// 业务ID与类型
+ ///
+ public List? Items { get; set; }
+
+ ///
+ /// 业务ID
+ ///
+ [IgnoreDataMember]
+ public IEnumerable? Ids => Items?.Select(x => x.Id).Distinct();
+
+ ///
+ /// 业务类型
+ ///
+ [IgnoreDataMember]
+ public IEnumerable? Types => Items?.Select(x => x.BusinessType).Distinct();
+
+ public IEnumerable Validate(ValidationContext validationContext)
+ {
+ if (Items == null || Items.Count == 0)
+ {
+ yield return new ValidationResult($"缺少请求参数:{nameof(Items)}");
+ }
+ }
+ }
+
+ public class BizOperation : BizOperation
+ {
+ ///
+ /// 请求值(根据业务按需传值)
+ ///
+ public new T Value { get; set; }
+ }
+}
diff --git a/ds-wms-service/DS.WMS.Core/Application/Interface/IInvoiceApplicationService.cs b/ds-wms-service/DS.WMS.Core/Application/Interface/IInvoiceApplicationService.cs
index 3930c048..d0547a30 100644
--- a/ds-wms-service/DS.WMS.Core/Application/Interface/IInvoiceApplicationService.cs
+++ b/ds-wms-service/DS.WMS.Core/Application/Interface/IInvoiceApplicationService.cs
@@ -36,7 +36,7 @@ namespace DS.WMS.Core.Application.Interface
///
/// 业务ID与业务类型
///
- Task> GetFeesAsync(params BizItem[] items);
+ Task> GetFeesAsync(params FeeClient[] items);
///
/// 删除发票明细
diff --git a/ds-wms-service/DS.WMS.Core/Application/Interface/IPaymentApplicationService.cs b/ds-wms-service/DS.WMS.Core/Application/Interface/IPaymentApplicationService.cs
index 2b02652c..0803ef9c 100644
--- a/ds-wms-service/DS.WMS.Core/Application/Interface/IPaymentApplicationService.cs
+++ b/ds-wms-service/DS.WMS.Core/Application/Interface/IPaymentApplicationService.cs
@@ -36,7 +36,7 @@ namespace DS.WMS.Core.Application.Interface
///
/// 业务ID与业务类型
///
- Task> GetFeesAsync(params BizItem[] items);
+ Task> GetFeesAsync(IEnumerable items);
///
/// 设置是否收到发票
@@ -46,6 +46,5 @@ namespace DS.WMS.Core.Application.Interface
///
Task SetInvoiceReceivedAsync(bool isInvoiceReceived, params long[] ids);
-
}
}
diff --git a/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs b/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs
index 4ed6ca8d..ed1e260c 100644
--- a/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs
+++ b/ds-wms-service/DS.WMS.Core/Application/Method/InvoiceApplicationService.cs
@@ -176,7 +176,7 @@ namespace DS.WMS.Core.Application.Method
var query1 = TenantDb.Queryable()
.InnerJoin((s, f) => s.Id == f.BusinessId && f.BusinessType == BusinessType.OceanShippingExport)
.Where((s, f) => f.FeeStatus == FeeStatus.AuditPassed)
- .GroupBy((s, f) => s.Id)
+ .GroupBy((s, f) => new { s.Id, f.CustomerId })
.Select((s, f) => new BizInvoiceApplication
{
Id = s.Id,
@@ -231,10 +231,11 @@ namespace DS.WMS.Core.Application.Method
///
/// 业务ID与业务类型
///
- public async Task> GetFeesAsync(params BizItem[] items)
+ public async Task> GetFeesAsync(params FeeClient[] items)
{
- var bizIds = items.Select(x => x.Id).ToList();
- var types = items.Select(x => x.BusinessType).ToList();
+ var bizIds = items.Select(x => x.Id).Distinct();
+ var types = items.Select(x => x.BusinessType).Distinct();
+ var cIds = items.Select(x => x.CustomerId).Distinct();
var list = await TenantDb.Queryable()
.Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && f.FeeStatus == FeeStatus.AuditPassed)
@@ -412,11 +413,12 @@ namespace DS.WMS.Core.Application.Method
protected override async Task> GetDetailsAsync(ApplicationRequest request)
{
- var ids1 = request.Items.Select(x => x.Id);
- var ids2 = request.Items.Select(x => x.BusinessType);
+ var ids1 = request.Items.Select(x => x.Id).Distinct();
+ var ids2 = request.Items.Select(x => x.BusinessType).Distinct();
+ var ids3 = request.Items.Select(x => x.CustomerId).Distinct();
- var list = await TenantDb.Queryable().Where(x =>
- ids1.Contains(x.BusinessId) && ids2.Contains(x.BusinessType) && x.FeeStatus == FeeStatus.AuditPassed)
+ var list = await TenantDb.Queryable().Where(x => x.FeeStatus == FeeStatus.AuditPassed &&
+ ids1.Contains(x.BusinessId) && ids2.Contains(x.BusinessType) && ids3.Contains(x.CustomerId))
.Where(request.GetQueryConditions(Db))
.Select(x => new ApplicationDetail
{
diff --git a/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationService.cs b/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationService.cs
index 9b83205c..6c687ea9 100644
--- a/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationService.cs
+++ b/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationService.cs
@@ -8,7 +8,6 @@ using DS.WMS.Core.Application.Interface;
using DS.WMS.Core.Fee.Dtos;
using DS.WMS.Core.Fee.Entity;
using DS.WMS.Core.Info.Entity;
-using DS.WMS.Core.Invoice.Dtos;
using DS.WMS.Core.Op.Entity;
using DS.WMS.Core.Sys.Entity;
using SqlSugar;
@@ -123,15 +122,11 @@ namespace DS.WMS.Core.Application.Method
///
public async Task>> GetBizListAsync(PageRequest request)
{
- var queryList = CreateBizQuery();
+ var query = CreateBizQuery();
+ var whereList = request.GetConditionalModels(Db);
+ query = query.Where(whereList);
- if (!request.QueryCondition.IsNullOrEmpty())
- {
- var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
- queryList = queryList.Where(whereList);
- }
-
- var result = await queryList.ToQueryPageAsync(request.PageCondition);
+ var result = await query.ToQueryPageAsync(request.PageCondition);
if (result.Data.Count > 0)
{
@@ -164,17 +159,17 @@ namespace DS.WMS.Core.Application.Method
var query1 = TenantDb.Queryable()
.InnerJoin((s, f) => s.Id == f.BusinessId && f.BusinessType == BusinessType.OceanShippingExport)
.Where((s, f) => f.FeeStatus == FeeStatus.AuditPassed)
- .GroupBy((s, f) => s.Id)
+ .GroupBy((s, f) => new { s.Id, f.CustomerId })
.Select((s, f) => new BizPaymentApplication
{
Id = s.Id,
BusinessType = BusinessType.OceanShippingExport,
CustomerNo = s.CustomerNo, //委托编号
+ ClientName = s.CustomerName, //委托单位
MBLNO = s.MBLNO,
HBLNO = s.HBLNO,
- CustomerId = s.CustomerId,
- CustomerName = s.CustomerName,//结费单位
- ClientName = s.CustomerName, //委托单位
+ CustomerId = f.CustomerId,
+ CustomerName = f.CustomerName, //结费单位
AccountDate = s.AccountDate,
BookingNO = s.BookingNo, //订舱编号
CntrTotal = s.CntrTotal,
@@ -196,12 +191,14 @@ namespace DS.WMS.Core.Application.Method
f.FeeType == FeeType.Payable && f.Currency == FeeCurrency.USD_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
UnpaidOther = SqlFunc.Subqueryable().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Payable && f.Currency != FeeCurrency.USD_CODE && f.Currency != FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
+
UnreceivedRMB = SqlFunc.Subqueryable().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Receivable && f.Currency == FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
UnreceivedUSD = SqlFunc.Subqueryable().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Receivable && f.Currency == FeeCurrency.USD_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
UnreceivedOther = SqlFunc.Subqueryable().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Receivable && f.Currency != FeeCurrency.USD_CODE && f.Currency != FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount)),
+
UnpaidRMBInv = SqlFunc.Subqueryable().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
f.FeeType == FeeType.Payable && f.Currency == FeeCurrency.RMB_CODE).Select(f => SqlFunc.AggregateSum(f.Amount - f.InvoiceAmount - f.OrderInvoiceAmount + f.OrderInvSettlementAmount)),
UnpaidUSDInv = SqlFunc.Subqueryable().Where(f => f.BusinessId == s.Id && f.FeeStatus == FeeStatus.AuditPassed &&
@@ -219,13 +216,15 @@ namespace DS.WMS.Core.Application.Method
///
/// 业务ID与业务类型
///
- public async Task> GetFeesAsync(params BizItem[] items)
+ public async Task> GetFeesAsync(IEnumerable items)
{
- var bizIds = items.Select(x => x.Id).ToList();
- var types = items.Select(x => x.BusinessType).ToList();
+ var ids = items.Select(x => x.Id).Distinct();
+ var types = items.Select(x => x.BusinessType).Distinct();
+ var cIds = items.Select(x => x.CustomerId).Distinct();
var list = await TenantDb.Queryable()
- .Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && f.FeeStatus == FeeStatus.AuditPassed)
+ .Where(f => ids.Contains(f.BusinessId) && types.Contains(f.BusinessType) &&
+ cIds.Contains(f.CustomerId) && f.FeeStatus == FeeStatus.AuditPassed)
.Select(f => new FeePaymentDto
{
RecordId = f.Id,
@@ -381,11 +380,12 @@ namespace DS.WMS.Core.Application.Method
protected override async Task> GetDetailsAsync(ApplicationRequest request)
{
- var ids1 = request.Items.Select(x => x.Id);
- var ids2 = request.Items.Select(x => x.BusinessType);
+ var ids1 = request.Items.Select(x => x.Id).Distinct();
+ var ids2 = request.Items.Select(x => x.BusinessType).Distinct();
+ var ids3 = request.Items.Select(x => x.CustomerId).Distinct();
- var list = await TenantDb.Queryable().Where(x =>
- ids1.Contains(x.BusinessId) && ids2.Contains(x.BusinessType) && x.FeeStatus == FeeStatus.AuditPassed)
+ var list = await TenantDb.Queryable().Where(x => x.FeeStatus == FeeStatus.AuditPassed &&
+ ids1.Contains(x.BusinessId) && ids2.Contains(x.BusinessType) && ids3.Contains(x.CustomerId))
.Where(request.GetQueryConditions(Db))
.Select(x => new ApplicationDetail
{
@@ -563,7 +563,7 @@ namespace DS.WMS.Core.Application.Method
}
}
}
-
+
}
protected override DataResult PreSubmitApproval(List applications)
diff --git a/ds-wms-service/DS.WMS.Core/Fee/Dtos/AuditRequest.cs b/ds-wms-service/DS.WMS.Core/Fee/Dtos/AuditRequest.cs
index 13077106..33dabffb 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Dtos/AuditRequest.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Dtos/AuditRequest.cs
@@ -1,4 +1,4 @@
-using System.Diagnostics.CodeAnalysis;
+using DS.WMS.Core.Application.Dtos;
using DS.WMS.Core.Op.Entity;
namespace DS.WMS.Core.Fee.Dtos
@@ -56,51 +56,6 @@ namespace DS.WMS.Core.Fee.Dtos
public List Items { get; set; }
}
- public class BizItem
- {
- public static readonly BizItemComparer DefaultComparer = new BizItemComparer();
-
- ///
- /// 业务ID
- ///
- public long Id { get; set; }
-
- ///
- /// 业务类型
- ///
- public BusinessType BusinessType { get; set; }
-
-
- public class BizItemComparer : IEqualityComparer
- {
- public bool Equals(BizItem? x, BizItem? y)
- {
- if (x == null || y == null)
- return false;
-
- return x.Id == y.Id && x.BusinessType == y.BusinessType;
- }
-
- public int GetHashCode([DisallowNull] BizItem obj)
- {
- return obj.Id.GetHashCode() ^ (int)obj.BusinessType;
- }
- }
- }
-
- public class BizOperation
- {
- ///
- /// 请求值(object类型,根据业务按需传值)
- ///
- public object Value { get; set; }
-
- ///
- /// 业务ID与类型
- ///
- public List Items { get; set; }
- }
-
public class AuditDetailRequest : BizItem
{
public string? QueryCondition { get; set; }
diff --git a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs
index 311ab6b3..abf94668 100644
--- a/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs
+++ b/ds-wms-service/DS.WMS.Core/Fee/Method/FeeAuditService.cs
@@ -748,7 +748,7 @@ namespace DS.WMS.Core.Fee.Method
BillAuditStatus = x.BillAuditStatus
}).FirstAsync();
if (biz == null)
- return DataResult.Failed(MultiLanguageConst.Operation_Failed);
+ return DataResult.Failed(MultiLanguageConst.EmptyData);
}
else
{
@@ -761,7 +761,7 @@ namespace DS.WMS.Core.Fee.Method
BusinessType = x.BusinessType
}).FirstAsync();
if (fee == null)
- return DataResult.Failed(MultiLanguageConst.Operation_Failed);
+ return DataResult.Failed(MultiLanguageConst.EmptyData);
fee.Reason = callback.RejectReason;
}
diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Interface/IFreeInvoiceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Interface/IFreeInvoiceService.cs
index 8453dbff..8977f171 100644
--- a/ds-wms-service/DS.WMS.Core/Invoice/Interface/IFreeInvoiceService.cs
+++ b/ds-wms-service/DS.WMS.Core/Invoice/Interface/IFreeInvoiceService.cs
@@ -21,8 +21,7 @@ namespace DS.WMS.Core.Invoice.Interface
///
/// 业务ID与业务类型
///
- Task> GetFeesAsync(params BizItem[] items);
-
+ Task> GetFeesAsync(params FeeClient[] items);
}
}
diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/FreeInvoiceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/FreeInvoiceService.cs
index 8e86e0c2..d5888255 100644
--- a/ds-wms-service/DS.WMS.Core/Invoice/Method/FreeInvoiceService.cs
+++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/FreeInvoiceService.cs
@@ -56,7 +56,7 @@ namespace DS.WMS.Core.Invoice.Method
if (!request.QueryCondition.IsNullOrEmpty())
{
- var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition);
+ var whereList = request.GetConditionalModels(Db);
query = query.Where(whereList);
}
@@ -120,13 +120,15 @@ namespace DS.WMS.Core.Invoice.Method
///
/// 业务ID与业务类型
///
- public async Task> GetFeesAsync(params BizItem[] items)
+ public async Task> GetFeesAsync(params FeeClient[] items)
{
- var bizIds = items.Select(x => x.Id).ToList();
- var types = items.Select(x => x.BusinessType).ToList();
+ var bizIds = items.Select(x => x.Id).Distinct();
+ var types = items.Select(x => x.BusinessType).Distinct();
+ var cIds = items.Select(x => x.CustomerId).Distinct();
var list = await TenantDb.Queryable()
- .Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && AllowedStatus.Contains(f.FeeStatus))
+ .Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && cIds.Contains(f.CustomerId) &&
+ AllowedStatus.Contains(f.FeeStatus))
.Select(f => new FeeInvoiceDto
{
RecordId = f.Id,
diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/GeneralInvoiceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/GeneralInvoiceService.cs
index a1ea3b81..bbbe6a44 100644
--- a/ds-wms-service/DS.WMS.Core/Invoice/Method/GeneralInvoiceService.cs
+++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/GeneralInvoiceService.cs
@@ -149,8 +149,6 @@ namespace DS.WMS.Core.Invoice.Method
return Task.Factory.StartNew(UpdateInvoiceApplications, new List { invoice });
}
-
-
protected override async Task OnDeleteDetailAsync(List invoices, DeleteOption deleteOption)
{
var list = invoices.SelectMany(x => x.Details).Where(x => x.DetailId.HasValue).Select(x => new ApplicationDetail
diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/FreeInvoiceController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/FreeInvoiceController.cs
index 2dbca283..4c581fde 100644
--- a/ds-wms-service/DS.WMS.FeeApi/Controllers/FreeInvoiceController.cs
+++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/FreeInvoiceController.cs
@@ -53,7 +53,7 @@ namespace DS.WMS.FeeApi.Controllers
/// 业务ID与业务类型
///
[HttpPost, Route("GetFees")]
- public async Task> GetFeesAsync([FromBody] BizItem[] items)
+ public async Task> GetFeesAsync([FromBody] FeeClient[] items)
{
return await _service.GetFeesAsync(items);
}
diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/InvoiceApplicationController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/InvoiceApplicationController.cs
index e1b35463..6f5673b7 100644
--- a/ds-wms-service/DS.WMS.FeeApi/Controllers/InvoiceApplicationController.cs
+++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/InvoiceApplicationController.cs
@@ -66,7 +66,7 @@ namespace DS.WMS.FeeApi.Controllers
/// 业务ID和类型
///
[HttpPost, Route("GetFees")]
- public async Task> GetFeesAsync([FromBody] params BizItem[] items)
+ public async Task> GetFeesAsync([FromBody] params FeeClient[] items)
{
if (items == null || items.Length == 0)
return DataResult.Failed("缺少请求参数");
diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentApplicationController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentApplicationController.cs
index e102f523..4b0d2492 100644
--- a/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentApplicationController.cs
+++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentApplicationController.cs
@@ -60,10 +60,10 @@ namespace DS.WMS.FeeApi.Controllers
///
/// 根据业务编号及类型获取关联费用记录
///
- /// 业务ID和类型
+ ///
///
[HttpPost, Route("GetFees")]
- public async Task> GetFeesAsync([FromBody] params BizItem[] items)
+ public async Task> GetFeesAsync([FromBody] params FeeClient[] items)
{
if (items == null || items.Length == 0)
return DataResult.Failed("缺少请求参数");