From e7193d427385bee732dc5d8e77b3230435b1da5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Tue, 9 Jul 2024 17:59:09 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E4=BB=98=E8=B4=B9?= =?UTF-8?q?=E8=87=AA=E7=94=B1=E7=BB=93=E7=AE=97=E5=8F=8A=E5=85=B6=E6=98=8E?= =?UTF-8?q?=E7=BB=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Settlement/Dtos/FeeDto.cs | 6 +- .../DS.WMS.Core/Settlement/Dtos/FeeItem.cs | 146 +++++ .../Settlement/Dtos/PaymentSettlementDto.cs | 37 +- .../Settlement/Dtos/SettlementDetailDto.cs | 150 ++++- .../Settlement/Dtos/SettlementDto.cs | 5 +- .../Interface/IFreeSettlementService.cs | 16 - .../IPaymentFreeSettlementService.cs | 21 + .../Method/FreeSettlementService.cs | 135 ----- .../Method/PaymentFreeSettlementService.cs | 518 ++++++++++++++++++ .../PaymentFreeSettlementController.cs | 77 +++ .../DS.WMS.FeeApi/Logs/internal-nlog.txt | 14 + 11 files changed, 958 insertions(+), 167 deletions(-) create mode 100644 ds-wms-service/DS.WMS.Core/Settlement/Dtos/FeeItem.cs delete mode 100644 ds-wms-service/DS.WMS.Core/Settlement/Interface/IFreeSettlementService.cs create mode 100644 ds-wms-service/DS.WMS.Core/Settlement/Interface/IPaymentFreeSettlementService.cs delete mode 100644 ds-wms-service/DS.WMS.Core/Settlement/Method/FreeSettlementService.cs create mode 100644 ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentFreeSettlementService.cs create mode 100644 ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentFreeSettlementController.cs diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/FeeDto.cs b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/FeeDto.cs index c6b67c0c..33be6dd5 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/FeeDto.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/FeeDto.cs @@ -5,9 +5,9 @@ using DS.WMS.Core.Op.Entity; namespace DS.WMS.Core.Settlement.Dtos { /// - /// 费用记录返回实体 + /// 用于结算的按业务展示的费用组 /// - public class FeeBizDto + public class SettlementBiz { /// /// 业务Id @@ -205,7 +205,7 @@ namespace DS.WMS.Core.Settlement.Dtos /// /// 按业务分组的费用 /// - public class FeeDto : FeeBizDto + public class FeeDto : SettlementBiz { public long Id { get; set; } diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/FeeItem.cs b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/FeeItem.cs new file mode 100644 index 00000000..31a57406 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/FeeItem.cs @@ -0,0 +1,146 @@ +using DS.Module.Core; +using DS.WMS.Core.Fee.Method; +using DS.WMS.Core.Op.Entity; + +namespace DS.WMS.Core.Settlement.Dtos +{ + /// + /// 费用表单 + /// + public class FeeForm + { + readonly List _items; + + /// + /// 费用记录项 + /// + public List Items => _items; + + /// + /// 使用指定的数据源初始化统计。 + /// + /// 数据源 + public FeeForm(List source) + { + _items = source; + + UnchargedRMB = Items.FindAll(x => x.Currency == FeeServiceBase.RMB_CODE && x.FeeType == FeeType.Receivable).Sum(x => x.RestAmount); + UnchargedUSD = Items.FindAll(x => x.Currency == FeeServiceBase.RMB_CODE && x.FeeType == FeeType.Receivable).Sum(x => x.RestAmount); + UnchargedOther = Items.FindAll(x => x.Currency == FeeServiceBase.RMB_CODE && x.FeeType == FeeType.Receivable).Sum(x => x.RestAmount); + UnpaidRMB = Items.FindAll(x => x.Currency == FeeServiceBase.RMB_CODE && x.FeeType == FeeType.Payable).Sum(x => x.RestAmount); + UnpaidUSD = Items.FindAll(x => x.Currency == FeeServiceBase.RMB_CODE && x.FeeType == FeeType.Payable).Sum(x => x.RestAmount); + UnpaidOther = Items.FindAll(x => x.Currency == FeeServiceBase.RMB_CODE && x.FeeType == FeeType.Payable).Sum(x => x.RestAmount); + } + + /// + /// 人民币未收 + /// + public decimal UnchargedRMB { get; private set; } + + /// + /// 人民币未付 + /// + public decimal UnpaidRMB { get; private set; } + + /// + /// 美元未收 + /// + public decimal UnchargedUSD { get; private set; } + + /// + /// 美元未付 + /// + public decimal UnpaidUSD { get; private set; } + + /// + /// 其他未收 + /// + public decimal UnchargedOther { get; private set; } + + /// + /// 其他未付 + /// + public decimal UnpaidOther { get; private set; } + } + + /// + /// 费用项 + /// + public class FeeItem + { + /// + /// 费用记录ID + /// + public long Id { get; set; } + + /// + /// 业务ID + /// + public long BusinessId { get; set; } + + /// + /// 业务类型 + /// + public BusinessType BusinessType { get; set; } + + /// + /// 客户名称 + /// + public string? CustomerName { get; set; } + + /// + /// 费用名称 + /// + public string? FeeName { get; set; } + + /// + /// 费用类型 + /// + public FeeType FeeType { get; set; } + + /// + /// 金额 + /// + public decimal Amount { get; set; } + + /// + /// 币别 + /// + public string Currency { get; set; } + + /// + /// 未结金额 + /// + public decimal RestAmount { get; set; } + + /// + /// 本次结算金额 + /// + public decimal SettlementAmount { get; set; } + + /// + /// 原始汇率 + /// + public decimal? OriginalRate { get; set; } + + /// + /// 开票金额 + /// + public decimal? InvoiceAmount { get; set; } + + /// + /// 财务税率 + /// + public decimal AccTaxRate { get; set; } + + /// + /// 录入方式 + /// + public string? InputMethod { get; set; } + + /// + /// 备注 + /// + public string? Remark { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/PaymentSettlementDto.cs b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/PaymentSettlementDto.cs index cb72eea0..b04a7139 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/PaymentSettlementDto.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/PaymentSettlementDto.cs @@ -122,14 +122,6 @@ namespace DS.WMS.Core.Settlement.Dtos /// public decimal? AdvanceAmount { get; set; } - [IgnoreDataMember] - public List UnInvoiceList { get; set; } - - /// - /// 未开票金额 - /// - public string UnInvoiceAmount => string.Join(" ", UnInvoiceList ?? []); - /// /// 是否导出凭证 /// @@ -149,5 +141,34 @@ namespace DS.WMS.Core.Settlement.Dtos /// 是否生成支票 /// public bool IsGenerateCheck { get; set; } + + [IgnoreDataMember] + public List UnInvoiceList { get; set; } + + /// + /// 未开票金额 + /// + public string UnInvoiceAmount => string.Join(" ", UnInvoiceList ?? []); + + /// + /// 结算明细 + /// + public List? Details { get; set; } + } + + /// + /// 付费自由结算 + /// + public class FreePaymentSettlementDto : PaymentSettlementDto + { + /// + /// 结算明细 + /// + public new List? Details { get; set; } + + /// + /// 结算金额合计 + /// + public List? SummaryItems { get; set; } } } diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementDetailDto.cs b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementDetailDto.cs index 67b8b8fe..ac933e37 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementDetailDto.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementDetailDto.cs @@ -1,9 +1,11 @@ using System.Runtime.Serialization; +using DS.Module.Core; +using DS.WMS.Core.Op.Entity; namespace DS.WMS.Core.Settlement.Dtos { /// - /// 结算明细DTO + /// 付费申请结算明细DTO /// public class SettlementDetailDto { @@ -70,4 +72,150 @@ namespace DS.WMS.Core.Settlement.Dtos /// public string? Note { get; set; } } + + /// + /// 付费自由结算明细DTO + /// + public class FreeSettlementDetailDto + { + /// + /// ID + /// + public long Id { get; set; } + + /// + /// 费用记录ID + /// + public long RecordId { get; set; } + + /// + /// 业务ID + /// + public long BusinessId { get; set; } + + /// + /// 业务类型 + /// + public BusinessType BusinessType { get; set; } + + /// + /// 主提单号 + /// + public string? MBLNO { get; set; } + + /// + /// 分提单号 + /// + public string? HBLNO { get; set; } + + /// + /// 委托编号 + /// + public string? CustomerNo { get; set; } + + /// + /// 委托单位 + /// + public string? ClientName { get; set; } + + /// + /// 开船日期 + /// + public DateTime? ETD { get; set; } + + /// + /// 业务来源 + /// + public string? SourceName { get; set; } + + /// + /// 揽货人 + /// + public string? Sale { get; set; } + + /// + /// 会计期间 + /// + public string? AccountDate { get; set; } + + /// + /// 船名 + /// + public string? Vessel { get; set; } + + /// + /// 航次 + /// + public string? Voyage { get; set; } + + /// + /// 船公司 + /// + public string? Carrier { get; set; } + + /// + /// 经营单位 + /// + public string? Enterprise { get; set; } + + /// + /// 报关单号 + /// + public string? CustomNo { get; set; } + + /// + /// 客户/费用对象名称 + /// + public string? CustomerName { get; set; } + + /// + /// 费用名称 + /// + public string? FeeName { get; set; } + + /// + /// 费用类型 + /// + public FeeType FeeType { get; set; } + + /// + /// 结算金额 + /// + public decimal ApplyAmount { get; set; } + + /// + /// 币别 + /// + public string Currency { get; set; } + + /// + /// 折算汇率 + /// + public decimal? ExchangeRate { get; set; } + + /// + /// 原始汇率 + /// + public decimal? OriginalRate { get; set; } + + /// + /// 原始币别 + /// + public string OriginalCurrency { get; set; } + + /// + /// 原始金额 + /// + public decimal OriginalAmount { get; set; } + + /// + /// 更改单 + /// + public string? ChangeOrder { get; set; } + + /// + /// 备注 + /// + public string? Note { get; set; } + } } diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementDto.cs b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementDto.cs index 877200df..7d0d9e37 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementDto.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementDto.cs @@ -182,9 +182,6 @@ namespace DS.WMS.Core.Settlement.Dtos /// public DateTime CreateTime { get; set; } - /// - /// 结算明细 - /// - public List Details { get; set; } + } } diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Interface/IFreeSettlementService.cs b/ds-wms-service/DS.WMS.Core/Settlement/Interface/IFreeSettlementService.cs deleted file mode 100644 index 9bce9e03..00000000 --- a/ds-wms-service/DS.WMS.Core/Settlement/Interface/IFreeSettlementService.cs +++ /dev/null @@ -1,16 +0,0 @@ -using DS.Module.Core; -using DS.WMS.Core.Application.Dtos; -using DS.WMS.Core.Application.Interface; -using DS.WMS.Core.Settlement.Dtos; -using DS.WMS.Core.Settlement.Entity; - -namespace DS.WMS.Core.Settlement.Interface -{ - /// - /// 付费自由结算 - /// - public interface IFreeSettlementService : ISettlementService - { - - } -} diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Interface/IPaymentFreeSettlementService.cs b/ds-wms-service/DS.WMS.Core/Settlement/Interface/IPaymentFreeSettlementService.cs new file mode 100644 index 00000000..bacc386b --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Settlement/Interface/IPaymentFreeSettlementService.cs @@ -0,0 +1,21 @@ +using DS.Module.Core; +using DS.WMS.Core.Application.Interface; +using DS.WMS.Core.Settlement.Dtos; +using DS.WMS.Core.Settlement.Entity; + +namespace DS.WMS.Core.Settlement.Interface +{ + /// + /// 付费自由结算 + /// + public interface IPaymentFreeSettlementService : ISettlementService + { + /// + /// 获取待结算费用分页列表 + /// + /// + /// + /// 查询条件请参考中定义的字段 + Task>> GetBizListAsync(PageRequest request); + } +} diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Method/FreeSettlementService.cs b/ds-wms-service/DS.WMS.Core/Settlement/Method/FreeSettlementService.cs deleted file mode 100644 index 0b855503..00000000 --- a/ds-wms-service/DS.WMS.Core/Settlement/Method/FreeSettlementService.cs +++ /dev/null @@ -1,135 +0,0 @@ -using DS.Module.Core; -using DS.Module.Core.Extensions; -using DS.WMS.Core.Fee.Entity; -using DS.WMS.Core.Op.Entity; -using DS.WMS.Core.Settlement.Dtos; -using DS.WMS.Core.Settlement.Entity; -using DS.WMS.Core.Settlement.Interface; -using DS.WMS.Core.Sys.Entity; -using SqlSugar; - -namespace DS.WMS.Core.Settlement.Method -{ - /// - /// 付费自由结算 - /// - public class FreeSettlementService : SettlementService, IFreeSettlementService - { - /// - /// 初始化 - /// - /// - public FreeSettlementService(IServiceProvider provider) : base(provider) - { - } - - /// - /// 获取待结算费用分页列表 - /// - /// - /// - /// 查询条件请参考中定义的字段 - public async Task>> GeFeeListAsync(PageRequest request) - { - var whereList = request.GetConditionalModels(Db); - var result = await CreateQuery().Where(whereList) - .GroupBy(x => new { x.BusinessId, x.BusinessType }) - .Select() - .ToQueryPageAsync(request.PageCondition); - - if (result.Data.Count > 0) - { - //获取统计信息 - var ids = result.Data.Select(x => x.BusinessId); - var types = result.Data.Select(x => x.BusinessType).Distinct(); - var fees = await TenantDb.Queryable().Where(x => ids.Contains(x.BusinessId) && types.Contains(x.BusinessType)) - .Select(x => new - { - x.Currency, - x.FeeType, - //x.Amount, - //x.OrderAmount, - //x.SettlementAmount, - //x.OrderSettlementAmount, - x.InvoiceAmount, - UnSettlementAmount = x.Amount - x.SettlementAmount - x.OrderAmount + x.OrderSettlementAmount //剩余待结算 - }).ToListAsync(); - - //关联用户名称 - var userIds = result.Data.Select(x => x.CreateBy) - .Union(result.Data.Select(x => x.OperatorId)) - .Distinct(); - var users = await Db.Queryable().Where(x => userIds.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToListAsync(); - - var orgIds = result.Data.Select(x => x.SaleDeptId).Distinct(); - var orgs = await Db.Queryable().Where(x => orgIds.Contains(x.Id)).Select(x => new { x.Id, x.OrgName }).ToListAsync(); - - foreach (var item in result.Data) - { - item.UnpaidRMB = fees.FindAll(x => x.Currency == RMB_CODE && x.FeeType == FeeType.Payable).Sum(x => x.UnSettlementAmount); - item.UnpaidUSD = fees.FindAll(x => x.Currency == USD_CODE && x.FeeType == FeeType.Payable).Sum(x => x.UnSettlementAmount); - item.UnpaidOther = fees.FindAll(x => x.Currency != RMB_CODE && x.Currency != USD_CODE && x.FeeType == FeeType.Payable).Sum(x => x.UnSettlementAmount); - item.UnchargedRMB = fees.FindAll(x => x.Currency == RMB_CODE && x.FeeType == FeeType.Receivable).Sum(x => x.UnSettlementAmount); - item.UnchargedUSD = fees.FindAll(x => x.Currency == USD_CODE && x.FeeType == FeeType.Receivable).Sum(x => x.UnSettlementAmount); - item.UnchargedOther = fees.FindAll(x => x.Currency != RMB_CODE && x.Currency != USD_CODE && x.FeeType == FeeType.Receivable).Sum(x => x.UnSettlementAmount); - item.UnpaidInvoiceRMB = fees.FindAll(x => x.Currency == RMB_CODE && x.FeeType == FeeType.Payable && x.UnSettlementAmount == 0).Sum(x => x.InvoiceAmount); - item.UnpaidInvoiceUSD = fees.FindAll(x => x.Currency == USD_CODE && x.FeeType == FeeType.Payable && x.UnSettlementAmount == 0).Sum(x => x.InvoiceAmount); - - item.CreateByName = users.Find(x => x.Id == item.CreateBy)?.UserName; - item.Operator = users.Find(x => x.Id == item.OperatorId)?.UserName; - - item.SaleDeptName = orgs.Find(x => x.Id == item.SaleDeptId)?.OrgName; - } - } - - return result; - } - - //创建各项费用数据的查询并集 - internal ISugarQueryable CreateQuery() - { - var query1 = TenantDb.Queryable((f, s) => new JoinQueryInfos( - JoinType.Inner, s.Id == f.BusinessId && f.BusinessType == BusinessType.OceanShippingExport && f.FeeStatus == FeeStatus.AuditPassed && - (f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount) != 0)) - .Select((f, s) => new FeeDto - { - Id = f.Id, - FeeId = f.FeeId, - FeeCode = f.FeeCode, - FeeName = f.FeeName, - FeeType = f.FeeType, - CustomerId = f.CustomerId, - CustomerName = f.CustomerName, - BusinessId = f.BusinessId, - BusinessType = BusinessType.OceanShippingExport, - Currency = f.Currency, - DebitNo = f.DebitNo, - SaleOrgId = f.SaleOrgId, - SaleOrg = f.SaleOrg, - CreateBy = f.CreateBy, - - AccountDate = s.AccountDate, - BusinessDate = s.BusinessDate,//业务日期 - ClientName = s.CustomerName,//委托单位 - CustomerNo = s.CustomerNo, - CustomNo = s.CustomNo, - DischargePort = s.DischargePort, - ETD = s.ETD, - HBLNO = s.HBLNO, - LoadPort = s.LoadPort, - MBLNO = s.MBLNO, - OperatorId = s.OperatorId, - SaleDeptId = s.SaleDeptId, - Sale = s.Sale,//揽货人 - Vessel = s.Vessel,//船名 - Voyage = s.Voyno,//航次 - BookingNo = s.BookingNo, - Enterprise = s.Enterprise, - }); - - //海运进口 - - return TenantDb.UnionAll(new List> { query1 }); - } - } -} diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentFreeSettlementService.cs b/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentFreeSettlementService.cs new file mode 100644 index 00000000..063bbd05 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentFreeSettlementService.cs @@ -0,0 +1,518 @@ +using System.Text; +using DS.Module.Core; +using DS.Module.Core.Enums; +using DS.Module.Core.Extensions; +using DS.WMS.Core.Application.Dtos; +using DS.WMS.Core.Application.Entity; +using DS.WMS.Core.Code.Entity; +using DS.WMS.Core.Fee.Dtos; +using DS.WMS.Core.Fee.Entity; +using DS.WMS.Core.Op.Entity; +using DS.WMS.Core.Settlement.Dtos; +using DS.WMS.Core.Settlement.Entity; +using DS.WMS.Core.Settlement.Interface; +using DS.WMS.Core.Sys.Entity; +using SqlSugar; + +namespace DS.WMS.Core.Settlement.Method +{ + /// + /// 付费自由结算 + /// + public class PaymentFreeSettlementService : SettlementService, IPaymentFreeSettlementService + { + /// + /// 初始化 + /// + /// + public PaymentFreeSettlementService(IServiceProvider provider) : base(provider) + { + } + + /// + /// 获取待结算业务分页列表 + /// + /// + /// + /// 查询条件请参考中定义的字段 + public async Task>> GetBizListAsync(PageRequest request) + { + var whereList = request.GetConditionalModels(Db); + var result = await CreateBizQuery().Where(whereList).GroupBy(x => new { x.BusinessId, x.BusinessType }) + .Select().ToQueryPageAsync(request.PageCondition); + + if (result.Data.Count > 0) + { + //获取统计信息 + var ids = result.Data.Select(x => x.BusinessId); + var types = result.Data.Select(x => x.BusinessType).Distinct(); + var fees = await TenantDb.Queryable().Where(x => ids.Contains(x.BusinessId) && types.Contains(x.BusinessType)) + .Select(x => new + { + x.BusinessId, + x.BusinessType, + x.Currency, + x.FeeType, + //x.Amount, + //x.OrderAmount, + //x.SettlementAmount, + //x.OrderSettlementAmount, + x.InvoiceAmount, + UnSettledAmount = x.Amount - x.SettlementAmount - x.OrderAmount + x.OrderSettlementAmount //剩余待结算 + }).ToListAsync(); + + //关联用户名称 + var userIds = result.Data.Select(x => x.CreateBy) + .Union(result.Data.Select(x => x.OperatorId)) + .Distinct(); + var users = await Db.Queryable().Where(x => userIds.Contains(x.Id)).Select(x => new { x.Id, x.UserName }).ToListAsync(); + + var orgIds = result.Data.Select(x => x.SaleDeptId).Distinct(); + var orgs = await Db.Queryable().Where(x => orgIds.Contains(x.Id)).Select(x => new { x.Id, x.OrgName }).ToListAsync(); + + foreach (var item in result.Data) + { + item.UnpaidRMB = fees.FindAll(x => x.BusinessId == item.BusinessId && x.BusinessType == item.BusinessType && x.Currency == RMB_CODE && x.FeeType == FeeType.Payable).Sum(x => x.UnSettledAmount); + item.UnpaidUSD = fees.FindAll(x => x.BusinessId == item.BusinessId && x.BusinessType == item.BusinessType && x.Currency == USD_CODE && x.FeeType == FeeType.Payable).Sum(x => x.UnSettledAmount); + item.UnpaidOther = fees.FindAll(x => x.BusinessId == item.BusinessId && x.BusinessType == item.BusinessType && x.Currency != RMB_CODE && x.Currency != USD_CODE && x.FeeType == FeeType.Payable).Sum(x => x.UnSettledAmount); + item.UnchargedRMB = fees.FindAll(x => x.BusinessId == item.BusinessId && x.BusinessType == item.BusinessType && x.Currency == RMB_CODE && x.FeeType == FeeType.Receivable).Sum(x => x.UnSettledAmount); + item.UnchargedUSD = fees.FindAll(x => x.BusinessId == item.BusinessId && x.BusinessType == item.BusinessType && x.Currency == USD_CODE && x.FeeType == FeeType.Receivable).Sum(x => x.UnSettledAmount); + item.UnchargedOther = fees.FindAll(x => x.BusinessId == item.BusinessId && x.BusinessType == item.BusinessType && x.Currency != RMB_CODE && x.Currency != USD_CODE && x.FeeType == FeeType.Receivable).Sum(x => x.UnSettledAmount); + item.UnpaidInvoiceRMB = fees.FindAll(x => x.BusinessId == item.BusinessId && x.BusinessType == item.BusinessType && x.Currency == RMB_CODE && x.FeeType == FeeType.Payable && x.UnSettledAmount == 0).Sum(x => x.InvoiceAmount); + item.UnpaidInvoiceUSD = fees.FindAll(x => x.BusinessId == item.BusinessId && x.BusinessType == item.BusinessType && x.Currency == USD_CODE && x.FeeType == FeeType.Payable && x.UnSettledAmount == 0).Sum(x => x.InvoiceAmount); + + item.CreateByName = users.Find(x => x.Id == item.CreateBy)?.UserName; + item.Operator = users.Find(x => x.Id == item.OperatorId)?.UserName; + + item.SaleDeptName = orgs.Find(x => x.Id == item.SaleDeptId)?.OrgName; + } + } + + return result; + } + + //创建各项费用数据的查询并集 + internal ISugarQueryable CreateBizQuery() + { + var query1 = TenantDb.Queryable((f, s) => new JoinQueryInfos( + JoinType.Inner, s.Id == f.BusinessId && f.BusinessType == BusinessType.OceanShippingExport && f.FeeStatus == FeeStatus.AuditPassed && + (f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount) != 0)) + .Select((f, s) => new FeeDto + { + Id = f.Id, + FeeId = f.FeeId, + FeeCode = f.FeeCode, + FeeName = f.FeeName, + FeeType = f.FeeType, + CustomerId = f.CustomerId, + CustomerName = f.CustomerName, + BusinessId = f.BusinessId, + BusinessType = BusinessType.OceanShippingExport, + Currency = f.Currency, + DebitNo = f.DebitNo, + SaleOrgId = f.SaleOrgId, + SaleOrg = f.SaleOrg, + CreateBy = f.CreateBy, + + AccountDate = s.AccountDate, + BusinessDate = s.BusinessDate,//业务日期 + ClientName = s.CustomerName,//委托单位 + CustomerNo = s.CustomerNo, + CustomNo = s.CustomNo, + DischargePort = s.DischargePort, + ETD = s.ETD, + HBLNO = s.HBLNO, + LoadPort = s.LoadPort, + MBLNO = s.MBLNO, + OperatorId = s.OperatorId, + SaleDeptId = s.SaleDeptId, + Sale = s.Sale,//揽货人 + Vessel = s.Vessel,//船名 + Voyage = s.Voyno,//航次 + BookingNo = s.BookingNo, + Enterprise = s.Enterprise, + }); + + //海运进口 + + return TenantDb.UnionAll(new List> { query1 }); + } + + /// + /// 根据业务编号及类型获取关联费用记录 + /// + /// 业务ID与业务类型 + /// + public async Task> GetFeesAsync(params BizItem[] items) + { + var bizIds = items.Select(x => x.Id).ToList(); + var types = items.Select(x => x.BusinessType).ToList(); + + var list = await TenantDb.Queryable() + .Where(f => bizIds.Contains(f.BusinessId) && types.Contains(f.BusinessType) && f.FeeStatus == FeeStatus.AuditPassed && + (f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount) != 0) + .Select(f => new FeeItem + { + Id = f.Id, + BusinessId = f.BusinessId, + BusinessType = f.BusinessType, + CustomerName = f.CustomerName, + FeeName = f.FeeName, + FeeType = f.FeeType, + Amount = f.Amount, + Currency = f.Currency, + OriginalRate = f.ExchangeRate, + RestAmount = f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount, + SettlementAmount = f.Amount - f.SettlementAmount - f.OrderAmount + f.OrderSettlementAmount, + InvoiceAmount = f.InvoiceAmount, + AccTaxRate = f.AccTaxRate, + Remark = f.Remark + }).ToListAsync(); + + return DataResult.Success(new FeeForm(list)); + } + + /// + /// 获取付费自由结算及其明细 + /// + /// 结算单ID + /// + public async Task> GetAsync(long id) + { + var model = await TenantDb.Queryable().Select(x => new FreePaymentSettlementDto + { + Id = x.Id, + ApplicationNO = x.ApplicationNO, //申请编号 + SettlementNO = x.SettlementNO, //结算单号 + CustomerId = x.CustomerId, //结算单位 + CustomerName = x.CustomerName, + Mode = x.Mode, //结算类型 + SettlementDate = x.SettlementDate, //结算日期 + SettlementTypeId = x.SettlementTypeId, //结算方式 + CustomerBankId = x.CustomerBankId, //客户银行 + Account = x.Account, //客户账户 + Currency = x.Currency, //币别 + Amount = x.Amount, //金额 + ExchangeRate = x.ExchangeRate, //汇率 + IsLocked = x.IsLocked, //锁定状态 + SaleDeptId = x.SaleDeptId, //所属分部 + BillType = x.BillType, //单据类型 + Category = x.Category, //业务类别 + LedgerVoucherNO = x.LedgerVoucherNO, //总账凭证号 + RelativeNO = x.RelativeNO, //相关号码 + InvoiceAmount = x.InvoiceAmount, + InvoiceDate = x.InvoiceDate, + InvoiceNO = x.InvoiceNO, + Note = x.Note, //备注 + + AccountAmount = x.AccountAmount, //记账资料 + AccountCurrency = x.AccountCurrency, + AccountRate = x.AccountRate, + PrePayAmount = x.PrePayAmount, //预付支资料 + PrePayCurrency = x.PrePayCurrency, + PrePayRate = x.PrePayRate, + AHSRAmount = x.AHSRAmount, //实收支资料 + AHSRCurrency = x.AHSRCurrency, + AHSRRate = x.AHSRRate, + FinancialAmount = x.FinancialAmount,//财务费用 + FinancialCurrency = x.FinancialCurrency, + FinancialRate = x.FinancialRate, + AdvanceAmount = x.AdvanceAmount, //预收支资料 + AdvanceCurrency = x.AdvanceCurrency, + AdvanceRate = x.AdvanceRate, + }).FirstAsync(); + + if (model != null) + { + model.Details = await TenantDb.Queryable().Where(x => x.ApplicationId == id && x.Category == FeeCategory.PaidFreeSettlement) + .InnerJoin((d, f) => d.RecordId == f.Id) + .Select((d, f) => new FreeSettlementDetailDto + { + Id = d.Id, + RecordId = f.Id, + BusinessId = f.BusinessId, + BusinessType = f.BusinessType, + CustomerName = d.CustomerName, + FeeName = d.FeeName, + FeeType = d.FeeType, + ExchangeRate = d.ExchangeRate, + OriginalAmount = d.OriginalAmount, + OriginalCurrency = d.OriginalCurrency, + OriginalRate = f.ExchangeRate, + ApplyAmount = d.ApplyAmount, + Currency = d.Currency, + Note = d.Note + }).ToListAsync(); + + var gList = model.Details.GroupBy(x => x.BusinessType); + foreach (var g in gList) + { + var ids = g.Select(x => x.BusinessId); + switch (g.Key) + { + case BusinessType.OceanShippingExport: + var list1 = await TenantDb.Queryable().Where(x => ids.Contains(x.Id)) + .LeftJoin((s, cs) => s.SourceId == cs.Id) + .Select((s, cs) => new + { + s.Id, + s.MBLNO, + s.HBLNO, + s.CustomerNo, + ClientName = s.CustomerName, + s.ETD, + cs.SourceName, + s.Sale, + s.AccountDate, + s.Vessel, + Voyage = s.Voyno, + s.Carrier, + s.Enterprise, + s.CustomNo + }).ToListAsync(); + + foreach (var item in g) + { + var biz = list1.Find(x => x.Id == item.BusinessId); + if (biz != null) + { + item.MBLNO = biz.MBLNO; + item.HBLNO = biz.HBLNO; + item.CustomerNo = biz.CustomerNo; + item.ClientName = biz.ClientName; + item.ETD = biz.ETD; + item.SourceName = biz.SourceName; + item.Sale = biz.Sale; + item.AccountDate = biz.AccountDate; + item.Vessel = biz.Vessel; + item.Voyage = biz.Voyage; + item.Carrier = biz.Carrier; + item.Enterprise = biz.Enterprise; + item.CustomNo = biz.CustomNo; + } + } + + break; + + case BusinessType.OceanShippingImport: + break; + } + } + + model.SummaryItems = model.Details.GroupBy(x => new { x.FeeType, x.Currency }).Select(x => new SummaryItem + { + FeeType = x.Key.FeeType, + Currency = x.Key.Currency, + Amount = x.Sum(y => y.ApplyAmount) + }).ToList(); + } + + return DataResult.Success(model); + } + + /// + /// 提交结算单 + /// + /// + /// + public override async Task> SaveAsync(SettlementRequest request) + { + var settlement = request.Settlement; + if (settlement.SettlementDate == default) + settlement.SettlementDate = DateTime.Now; + + settlement.Mode = SettlementMode.Payment; + settlement.BillType = SettlementBillType.Payment; + + if (request.Details?.Count > 0) + { + var appIds = request.Details.Select(x => x.ApplicationId).Distinct(); + var appList = await TenantDb.Queryable().Where(x => appIds.Contains(x.Id)) + .Select(x => new + { + x.Id, + x.Status, + x.CustomerId, + x.CustomerName, + }).ToListAsync(); + if (appList.Count == 0) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData)); + + if (appList.Exists(x => x.Status != PaymentApplicationStatus.AuditPassed && x.Status != PaymentApplicationStatus.PartialSettlement)) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.ApplicationSelectStatusError)); + + if (appList.GroupBy(x => x.CustomerId).Select(x => x.Key).Count() > 1) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.DetailCustomerOnlyOne)); + + //金额禁止为0 + if (request.Details.Any(x => x.Amount == 0 || x.OriginalAmount == 0)) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.AmountCannotBeZero)); + + if (settlement.Id == 0) + { + var app = appList[0]; + settlement.CustomerId = app.CustomerId; + settlement.CustomerName = app.CustomerName; + } + + settlement.Details = request.Details.Select(x => new ApplicationDetail + { + ApplicationId = x.ApplicationId, + DetailId = x.Id, + RecordId = x.RecordId, + BusinessId = x.BusinessId, + BusinessType = x.BusinessType, + CustomerName = x.CustomerName ?? settlement.CustomerName, + FeeId = x.FeeId, + FeeName = x.FeeName, + FeeType = x.FeeType, + Category = FeeCategory.PaidFreeSettlement, + ApplyAmount = x.Amount, + Currency = x.Currency, + ExchangeRate = x.ExchangeRate, + OriginalAmount = x.OriginalAmount, + OriginalCurrency = x.OriginalCurrency ?? (settlement.Currency.IsNullOrEmpty() ? x.Currency : settlement.Currency), + }).ToList(); + + if (settlement.Details.Any(x => x.OriginalCurrency.IsNullOrEmpty())) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.OriginalCurrencyCanNotNull)); + + //获取剩余待结算金额 + var ids2 = settlement.Details.Select(x => x.DetailId); + var appDetails = await TenantDb.Queryable().Where(x => ids2.Contains(x.Id) && x.Category == FeeCategory.PaidApplication) + .Select(x => new + { + x.Id, + //RestAmount = x.ApplyAmount - x.ProcessedAmount, + OriginalRestAmount = x.OriginalAmount - x.OriginalProcessedAmount + }).ToListAsync(); + + StringBuilder sb = new(); + foreach (var detail in settlement.Details) + { + var item = appDetails.Find(x => x.Id == detail.DetailId); + if (item == null) + { + sb.Append(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.EmptyData))); + break; + } + + if (detail.OriginalAmount > 0 && detail.OriginalAmount > item.OriginalRestAmount) + { + sb.AppendFormat(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DetailExceedingLimit)), detail.FeeName); + sb.Append(";"); + continue; + } + else if (detail.OriginalAmount < 0 && detail.OriginalAmount < item.OriginalRestAmount) + { + sb.AppendFormat(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DetailExceedingLimit)), detail.FeeName); + sb.Append(";"); + continue; + } + } + if (sb.Length > 0) + return DataResult.Failed(sb.ToString()); + + settlement.Amount = settlement.Details.Sum(x => x.ApplyAmount); + } + + await TenantDb.Ado.BeginTranAsync(); + try + { + //关联导航属性插入 + if (settlement.Id == 0) + { + //创建时需要生成申请单编号 + var sequence = CommonService.Value.GetSequenceNext(); + if (!sequence.Succeeded) + { + return DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist); + } + settlement.ApplicationNO = "CP" + SnowFlakeSingle.Instance.NextId(); //申请编号 + settlement.SettlementNO = sequence.Data; //结算单号 + + await TenantDb.InsertNav(settlement).Include(x => x.Details).ExecuteCommandAsync(); + } + else + { + if (settlement.Details.Count > 0) + await TenantDb.Insertable(settlement.Details).ExecuteCommandAsync(); + + await TenantDb.Updateable(settlement).IgnoreColumns(x => new + { + x.ApplicationNO, + x.SettlementNO, + x.IsLocked, + x.CreateBy, + x.CreateTime, + x.Deleted, + x.DeleteBy, + x.DeleteTime + }).ExecuteCommandAsync(); + } + + if (request.Details?.Count > 0) + { + //更新申请明细的已处理金额 + var list = request.Details.Select(x => new ApplicationDetail + { + Id = x.Id, + ProcessedAmount = x.Amount, + OriginalProcessedAmount = x.OriginalAmount + }).ToList(); + await TenantDb.Updateable(list) + .PublicSetColumns(x => x.ProcessedAmount, "+") + .PublicSetColumns(x => x.OriginalProcessedAmount, "+") + .UpdateColumns(x => new { x.ProcessedAmount, x.OriginalProcessedAmount }) + .ExecuteCommandAsync(); + + //更新费用记录的已结算金额 + var fees = request.Details.Select(x => new FeeRecord + { + Id = x.RecordId, + SettlementAmount = x.OriginalAmount + }).ToList(); + await TenantDb.Updateable(fees) + .PublicSetColumns(x => x.SettlementAmount, "+") + .UpdateColumns(x => new { x.SettlementAmount }) + .ExecuteCommandAsync(); + } + + await TenantDb.Ado.CommitTranAsync(); + return DataResult.Success(settlement); + } + catch (Exception ex) + { + await TenantDb.Ado.RollbackTranAsync(); + await ex.LogAsync(Db); + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); + } + //finally + //{ + // if (request.Details?.Count > 0) + // await WriteBackStatusAsync(settlement); + //} + } + + protected override DataResult PreDelete(List settlements) + { + if (settlements.Any(x => x.IsLocked)) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.SettlementIsLocked)); + + return DataResult.Success; + } + + protected override async Task OnDeleteDetailAsync(List settlements) + { + await base.OnDeleteDetailAsync(settlements); + + var detailList = settlements.SelectMany(x => x.Details); + //还原费用表的已结算金额 + var fees = detailList.Select(x => new FeeRecord { Id = x.RecordId, SettlementAmount = x.OriginalAmount }).ToList(); + await TenantDb.Updateable(fees) + .PublicSetColumns(it => it.SettlementAmount, "-") + .UpdateColumns(x => new { x.SettlementAmount }) + .ExecuteCommandAsync(); + } + } +} diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentFreeSettlementController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentFreeSettlementController.cs new file mode 100644 index 00000000..7e1ac60c --- /dev/null +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentFreeSettlementController.cs @@ -0,0 +1,77 @@ +using DS.Module.Core; +using DS.Module.Core.Data; +using DS.WMS.Core.Settlement.Dtos; +using DS.WMS.Core.Settlement.Entity; +using DS.WMS.Core.Settlement.Interface; +using Microsoft.AspNetCore.Mvc; + +namespace DS.WMS.FeeApi.Controllers +{ + /// + /// 付费自由结算API + /// + public class PaymentFreeSettlementController : ApiController + { + readonly IPaymentFreeSettlementService _service; + + /// + /// 初始化 + /// + /// + public PaymentFreeSettlementController(IPaymentFreeSettlementService service) + { + _service = service; + } + + /// + /// 获取待结算费用分页列表 + /// + /// + /// + [HttpPost, Route("GetFeeList")] + public async Task>> GetFeeListAsync([FromBody] PageRequest request) + { + return await _service.GetBizListAsync(request); + } + + + /// + /// 根据付费申请创建结算单 + /// + /// + /// + [HttpPost, Route("Save")] + public async Task> SaveAsync([FromBody] SettlementRequest request) + { + return await _service.SaveAsync(request); + } + + /// + /// 删除申请单明细 + /// + /// 申请单明细ID + /// + [HttpPost, Route("DeleteDetail")] + public async Task DeleteDetailAsync([FromBody] IdModel model) + { + if (!ModelState.IsValid) + return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); + + return await _service.DeleteDetailAsync(model.Ids); + } + + /// + /// 删除申请单 + /// + /// 申请单ID + /// + [HttpPost, Route("Delete")] + public async Task DeleteAsync([FromBody] IdModel model) + { + if (!ModelState.IsValid) + return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); + + return await _service.DeleteAsync(model.Ids); + } + } +} diff --git a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt index b070bd53..3c53e5e4 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt @@ -2252,3 +2252,17 @@ 2024-07-08 17:48:22.1047 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config 2024-07-08 17:48:22.1047 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-07-08 17:48:22.1047 Info Configuration initialized. +2024-07-09 11:49:51.2234 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-09 11:49:51.2600 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-09 11:49:51.2600 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-09 11:49:51.2824 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-09 11:49:51.2824 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-09 11:49:51.2824 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-09 11:49:51.3056 Info Configuration initialized. +2024-07-09 11:54:05.4348 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-09 11:54:05.4650 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-09 11:54:05.4650 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-09 11:54:05.4790 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-09 11:54:05.4790 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-09 11:54:05.4790 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-09 11:54:05.4954 Info Configuration initialized. From 32242bc42f83154618df7d945d2c224461f0aa2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Wed, 10 Jul 2024 10:59:55 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=90=88=E5=B9=B6=E6=8F=90=E4=BA=A4?= =?UTF-8?q?=E7=BB=93=E7=AE=97=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Constants/MultiLanguageConst.cs | 2 +- .../Settlement/Entity/PaymentSettlement.cs | 6 + .../Method/PaymentFreeSettlementService.cs | 196 ++------------- .../Method/PaymentSettlementService.cs | 232 +++++------------- .../Settlement/Method/SettlementService`1.cs | 215 +++++++++++++++- 5 files changed, 304 insertions(+), 347 deletions(-) diff --git a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs index a4f4db56..7b2b94d0 100644 --- a/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs +++ b/ds-wms-service/DS.Module.Core/Constants/MultiLanguageConst.cs @@ -594,7 +594,7 @@ public static class MultiLanguageConst public const string ApplicationDeleteStatusError = "Application_Delete_StatusError"; [Description("申请明细的结算对象需与申请单一致")] public const string ApplicationCustomerDetail = "Application_Customer_Detail"; - [Description("申请明细的金额不能为零")] + [Description("申请明细的金额/原始金额不能为零")] public const string AmountCannotBeZero = "Amount_CannotBe_Zero"; [Description("申请明细需要设置原始申请金额")] public const string OriginalAmountCannotBeZero = "OriginalAmount_CannotBe_Zero"; diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Entity/PaymentSettlement.cs b/ds-wms-service/DS.WMS.Core/Settlement/Entity/PaymentSettlement.cs index ec4a8e74..b751ea5d 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Entity/PaymentSettlement.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Entity/PaymentSettlement.cs @@ -150,5 +150,11 @@ namespace DS.WMS.Core.Settlement.Entity /// [SugarColumn(ColumnDescription = "开票金额")] public decimal? InvoiceAmount { get; set; } + + /// + /// 凭证备注 + /// + [SugarColumn(ColumnDescription = "凭证备注", IsNullable = true, Length = 200)] + public string? VoucherRemark { get; set; } } } diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentFreeSettlementService.cs b/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentFreeSettlementService.cs index 063bbd05..de83cf0b 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentFreeSettlementService.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentFreeSettlementService.cs @@ -310,188 +310,42 @@ namespace DS.WMS.Core.Settlement.Method return DataResult.Success(model); } - /// - /// 提交结算单 - /// - /// - /// - public override async Task> SaveAsync(SettlementRequest request) + protected override async Task PreSaveAsync(PaymentSettlement settlement) { - var settlement = request.Settlement; - if (settlement.SettlementDate == default) - settlement.SettlementDate = DateTime.Now; - - settlement.Mode = SettlementMode.Payment; - settlement.BillType = SettlementBillType.Payment; - - if (request.Details?.Count > 0) - { - var appIds = request.Details.Select(x => x.ApplicationId).Distinct(); - var appList = await TenantDb.Queryable().Where(x => appIds.Contains(x.Id)) - .Select(x => new - { - x.Id, - x.Status, - x.CustomerId, - x.CustomerName, - }).ToListAsync(); - if (appList.Count == 0) - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData)); - - if (appList.Exists(x => x.Status != PaymentApplicationStatus.AuditPassed && x.Status != PaymentApplicationStatus.PartialSettlement)) - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.ApplicationSelectStatusError)); - - if (appList.GroupBy(x => x.CustomerId).Select(x => x.Key).Count() > 1) - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.DetailCustomerOnlyOne)); - - //金额禁止为0 - if (request.Details.Any(x => x.Amount == 0 || x.OriginalAmount == 0)) - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.AmountCannotBeZero)); - - if (settlement.Id == 0) - { - var app = appList[0]; - settlement.CustomerId = app.CustomerId; - settlement.CustomerName = app.CustomerName; - } - - settlement.Details = request.Details.Select(x => new ApplicationDetail - { - ApplicationId = x.ApplicationId, - DetailId = x.Id, - RecordId = x.RecordId, - BusinessId = x.BusinessId, - BusinessType = x.BusinessType, - CustomerName = x.CustomerName ?? settlement.CustomerName, - FeeId = x.FeeId, - FeeName = x.FeeName, - FeeType = x.FeeType, - Category = FeeCategory.PaidFreeSettlement, - ApplyAmount = x.Amount, - Currency = x.Currency, - ExchangeRate = x.ExchangeRate, - OriginalAmount = x.OriginalAmount, - OriginalCurrency = x.OriginalCurrency ?? (settlement.Currency.IsNullOrEmpty() ? x.Currency : settlement.Currency), - }).ToList(); - - if (settlement.Details.Any(x => x.OriginalCurrency.IsNullOrEmpty())) - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.OriginalCurrencyCanNotNull)); - - //获取剩余待结算金额 - var ids2 = settlement.Details.Select(x => x.DetailId); - var appDetails = await TenantDb.Queryable().Where(x => ids2.Contains(x.Id) && x.Category == FeeCategory.PaidApplication) - .Select(x => new - { - x.Id, - //RestAmount = x.ApplyAmount - x.ProcessedAmount, - OriginalRestAmount = x.OriginalAmount - x.OriginalProcessedAmount - }).ToListAsync(); - - StringBuilder sb = new(); - foreach (var detail in settlement.Details) + //获取剩余待结算金额 + var ids = settlement.Details.Select(x => x.RecordId); + var fees = await TenantDb.Queryable().Where(x => ids.Contains(x.Id) && x.FeeStatus == FeeStatus.AuditPassed) + .Select(x => new { - var item = appDetails.Find(x => x.Id == detail.DetailId); - if (item == null) - { - sb.Append(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.EmptyData))); - break; - } - - if (detail.OriginalAmount > 0 && detail.OriginalAmount > item.OriginalRestAmount) - { - sb.AppendFormat(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DetailExceedingLimit)), detail.FeeName); - sb.Append(";"); - continue; - } - else if (detail.OriginalAmount < 0 && detail.OriginalAmount < item.OriginalRestAmount) - { - sb.AppendFormat(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DetailExceedingLimit)), detail.FeeName); - sb.Append(";"); - continue; - } - } - if (sb.Length > 0) - return DataResult.Failed(sb.ToString()); - - settlement.Amount = settlement.Details.Sum(x => x.ApplyAmount); - } + x.Id, + OriginalRestAmount = x.Amount - x.SettlementAmount - x.OrderAmount + x.OrderSettlementAmount + }).ToListAsync(); - await TenantDb.Ado.BeginTranAsync(); - try + StringBuilder sb = new(); + foreach (var detail in settlement.Details) { - //关联导航属性插入 - if (settlement.Id == 0) + var item = fees.Find(x => x.Id == detail.DetailId); + if (item == null) { - //创建时需要生成申请单编号 - var sequence = CommonService.Value.GetSequenceNext(); - if (!sequence.Succeeded) - { - return DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist); - } - settlement.ApplicationNO = "CP" + SnowFlakeSingle.Instance.NextId(); //申请编号 - settlement.SettlementNO = sequence.Data; //结算单号 - - await TenantDb.InsertNav(settlement).Include(x => x.Details).ExecuteCommandAsync(); + sb.Append(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.EmptyData))); + break; } - else - { - if (settlement.Details.Count > 0) - await TenantDb.Insertable(settlement.Details).ExecuteCommandAsync(); - await TenantDb.Updateable(settlement).IgnoreColumns(x => new - { - x.ApplicationNO, - x.SettlementNO, - x.IsLocked, - x.CreateBy, - x.CreateTime, - x.Deleted, - x.DeleteBy, - x.DeleteTime - }).ExecuteCommandAsync(); + if (detail.OriginalAmount > 0 && detail.OriginalAmount > item.OriginalRestAmount) + { + sb.AppendFormat(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DetailExceedingLimit)), detail.FeeName); + sb.Append(";"); + continue; } - - if (request.Details?.Count > 0) + else if (detail.OriginalAmount < 0 && detail.OriginalAmount < item.OriginalRestAmount) { - //更新申请明细的已处理金额 - var list = request.Details.Select(x => new ApplicationDetail - { - Id = x.Id, - ProcessedAmount = x.Amount, - OriginalProcessedAmount = x.OriginalAmount - }).ToList(); - await TenantDb.Updateable(list) - .PublicSetColumns(x => x.ProcessedAmount, "+") - .PublicSetColumns(x => x.OriginalProcessedAmount, "+") - .UpdateColumns(x => new { x.ProcessedAmount, x.OriginalProcessedAmount }) - .ExecuteCommandAsync(); - - //更新费用记录的已结算金额 - var fees = request.Details.Select(x => new FeeRecord - { - Id = x.RecordId, - SettlementAmount = x.OriginalAmount - }).ToList(); - await TenantDb.Updateable(fees) - .PublicSetColumns(x => x.SettlementAmount, "+") - .UpdateColumns(x => new { x.SettlementAmount }) - .ExecuteCommandAsync(); + sb.AppendFormat(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DetailExceedingLimit)), detail.FeeName); + sb.Append(";"); + continue; } - - await TenantDb.Ado.CommitTranAsync(); - return DataResult.Success(settlement); } - catch (Exception ex) - { - await TenantDb.Ado.RollbackTranAsync(); - await ex.LogAsync(Db); - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); - } - //finally - //{ - // if (request.Details?.Count > 0) - // await WriteBackStatusAsync(settlement); - //} + + return sb.Length > 0 ? DataResult.Failed(sb.ToString()) : DataResult.Success; } protected override DataResult PreDelete(List settlements) diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentSettlementService.cs b/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentSettlementService.cs index a8d42c31..db230838 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentSettlementService.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentSettlementService.cs @@ -11,6 +11,7 @@ using DS.WMS.Core.Settlement.Dtos; using DS.WMS.Core.Settlement.Entity; using DS.WMS.Core.Settlement.Interface; using DS.WMS.Core.Sys.Entity; +using LanguageExt.Common; using SqlSugar; namespace DS.WMS.Core.Settlement.Method @@ -416,197 +417,82 @@ namespace DS.WMS.Core.Settlement.Method } } - /// - /// 提交结算单 - /// - /// - /// - public async override Task> SaveAsync(SettlementRequest request) + protected override async Task PreSaveAsync(PaymentSettlement settlement) { - var settlement = request.Settlement; - if (settlement.SettlementDate == default) - settlement.SettlementDate = DateTime.Now; - - settlement.Mode = SettlementMode.Payment; - settlement.BillType = SettlementBillType.Payment; - - if (request.Details?.Count > 0) - { - var appIds = request.Details.Select(x => x.ApplicationId).Distinct(); - var appList = await TenantDb.Queryable().Where(x => appIds.Contains(x.Id)) - .Select(x => new - { - x.Id, - x.Status, - x.CustomerId, - x.CustomerName, - }).ToListAsync(); - if (appList.Count == 0) - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData)); - - if (appList.Exists(x => x.Status != PaymentApplicationStatus.AuditPassed && x.Status != PaymentApplicationStatus.PartialSettlement)) - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.ApplicationSelectStatusError)); + var appIds = settlement.Details.Select(x => x.ApplicationId).Distinct(); + var appList = await TenantDb.Queryable().Where(x => appIds.Contains(x.Id)) + .Select(x => new + { + x.Id, + x.Status, + x.CustomerId, + x.CustomerName, + }).ToListAsync(); + if (appList.Count == 0) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData)); - if (appList.GroupBy(x => x.CustomerId).Select(x => x.Key).Count() > 1) - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.DetailCustomerOnlyOne)); + if (appList.Exists(x => x.Status != PaymentApplicationStatus.AuditPassed && x.Status != PaymentApplicationStatus.PartialSettlement)) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.ApplicationSelectStatusError)); - //金额禁止为0 - if (request.Details.Any(x => x.Amount == 0 || x.OriginalAmount == 0)) - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.AmountCannotBeZero)); + if (appList.GroupBy(x => x.CustomerId).Select(x => x.Key).Count() > 1) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.DetailCustomerOnlyOne)); - if (settlement.Id == 0) + //获取剩余待结算金额 + var ids2 = settlement.Details.Select(x => x.DetailId); + var appDetails = await TenantDb.Queryable().Where(x => ids2.Contains(x.Id) && x.Category == FeeCategory.PaidApplication) + .Select(x => new { - var app = appList[0]; - settlement.CustomerId = app.CustomerId; - settlement.CustomerName = app.CustomerName; - } - - settlement.Details = request.Details.Select(x => new ApplicationDetail - { - ApplicationId = x.ApplicationId, - DetailId = x.Id, - RecordId = x.RecordId, - BusinessId = x.BusinessId, - BusinessType = x.BusinessType, - CustomerName = x.CustomerName ?? settlement.CustomerName, - FeeId = x.FeeId, - FeeName = x.FeeName, - FeeType = x.FeeType, - Category = FeeCategory.PaidApplicationSettlement, - ApplyAmount = x.Amount, - Currency = x.Currency, - ExchangeRate = x.ExchangeRate, - OriginalAmount = x.OriginalAmount, - OriginalCurrency = x.OriginalCurrency ?? (settlement.Currency.IsNullOrEmpty() ? x.Currency : settlement.Currency), - }).ToList(); - - if (settlement.Details.Any(x => x.OriginalCurrency.IsNullOrEmpty())) - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.OriginalCurrencyCanNotNull)); - - //获取剩余待结算金额 - var ids2 = settlement.Details.Select(x => x.DetailId); - var appDetails = await TenantDb.Queryable().Where(x => ids2.Contains(x.Id) && x.Category == FeeCategory.PaidApplication) - .Select(x => new - { - x.Id, - //RestAmount = x.ApplyAmount - x.ProcessedAmount, - OriginalRestAmount = x.OriginalAmount - x.OriginalProcessedAmount - }).ToListAsync(); + x.Id, + //RestAmount = x.ApplyAmount - x.ProcessedAmount, + OriginalRestAmount = x.OriginalAmount - x.OriginalProcessedAmount + }).ToListAsync(); - StringBuilder sb = new(); - foreach (var detail in settlement.Details) + StringBuilder sb = new(); + foreach (var detail in settlement.Details) + { + var item = appDetails.Find(x => x.Id == detail.DetailId); + if (item == null) { - var item = appDetails.Find(x => x.Id == detail.DetailId); - if (item == null) - { - sb.Append(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.EmptyData))); - break; - } - - if (detail.OriginalAmount > 0 && detail.OriginalAmount > item.OriginalRestAmount) - { - sb.AppendFormat(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DetailExceedingLimit)), detail.FeeName); - sb.Append(";"); - continue; - } - else if (detail.OriginalAmount < 0 && detail.OriginalAmount < item.OriginalRestAmount) - { - sb.AppendFormat(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DetailExceedingLimit)), detail.FeeName); - sb.Append(";"); - continue; - } + sb.Append(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.EmptyData))); + break; } - if (sb.Length > 0) - return DataResult.Failed(sb.ToString()); - settlement.Amount = settlement.Details.Sum(x => x.ApplyAmount); - } - - await TenantDb.Ado.BeginTranAsync(); - try - { - //关联导航属性插入 - if (settlement.Id == 0) + if (detail.OriginalAmount > 0 && detail.OriginalAmount > item.OriginalRestAmount) { - //创建时需要生成申请单编号 - var sequence = CommonService.Value.GetSequenceNext(); - if (!sequence.Succeeded) - { - return DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist); - } - settlement.ApplicationNO = "CP" + SnowFlakeSingle.Instance.NextId(); //申请编号 - settlement.SettlementNO = sequence.Data; //结算单号 - - await TenantDb.InsertNav(settlement).Include(x => x.Details).ExecuteCommandAsync(); + sb.AppendFormat(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DetailExceedingLimit)), detail.FeeName); + sb.Append(";"); + continue; } - else + else if (detail.OriginalAmount < 0 && detail.OriginalAmount < item.OriginalRestAmount) { - if (settlement.Details.Count > 0) - await TenantDb.Insertable(settlement.Details).ExecuteCommandAsync(); - - await TenantDb.Updateable(settlement).IgnoreColumns(x => new - { - x.ApplicationNO, - x.SettlementNO, - x.IsLocked, - x.CreateBy, - x.CreateTime, - x.Deleted, - x.DeleteBy, - x.DeleteTime - }).ExecuteCommandAsync(); + sb.AppendFormat(MultiLanguageConst.GetDescription(nameof(MultiLanguageConst.DetailExceedingLimit)), detail.FeeName); + sb.Append(";"); + continue; } + } - if (request.Details?.Count > 0) - { - //更新申请明细的已处理金额 - var list = request.Details.Select(x => new ApplicationDetail - { - Id = x.Id, - ProcessedAmount = x.Amount, - OriginalProcessedAmount = x.OriginalAmount - }).ToList(); - await TenantDb.Updateable(list) - .PublicSetColumns(x => x.ProcessedAmount, "+") - .PublicSetColumns(x => x.OriginalProcessedAmount, "+") - .UpdateColumns(x => new { x.ProcessedAmount, x.OriginalProcessedAmount }) - .ExecuteCommandAsync(); - - //更新费用记录的已结算金额 - var fees = request.Details.Select(x => new FeeRecord - { - Id = x.RecordId, - SettlementAmount = x.OriginalAmount - }).ToList(); - await TenantDb.Updateable(fees) - .PublicSetColumns(x => x.SettlementAmount, "+") - .UpdateColumns(x => new { x.SettlementAmount }) - .ExecuteCommandAsync(); - } + return sb.Length > 0 ? DataResult.Failed(sb.ToString()) : DataResult.Success; + } - await TenantDb.Ado.CommitTranAsync(); - return DataResult.Success(settlement); - } - catch (Exception ex) - { - await TenantDb.Ado.RollbackTranAsync(); - await ex.LogAsync(Db); - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); - } - finally + protected override async Task OnSaveAsync(PaymentSettlement settlement) + { + //更新申请明细的已处理金额 + var list = settlement.Details.Select(x => new ApplicationDetail { - if (request.Details?.Count > 0) - await WriteBackStatusAsync(settlement); - } + Id = x.Id, + ProcessedAmount = x.ApplyAmount, + OriginalProcessedAmount = x.OriginalAmount + }).ToList(); + await TenantDb.Updateable(list) + .PublicSetColumns(x => x.ProcessedAmount, "+") + .PublicSetColumns(x => x.OriginalProcessedAmount, "+") + .UpdateColumns(x => new { x.ProcessedAmount, x.OriginalProcessedAmount }) + .ExecuteCommandAsync(); } - /// - /// 回写申请单的状态 - /// - /// 结算单 - /// - public async Task WriteBackStatusAsync(PaymentSettlement settlement) + protected override async Task PostSaveAsync(PaymentSettlement settlement) { + //回写付费申请的状态 var details = await TenantDb.Queryable() .InnerJoin((x, y) => x.DetailId == y.Id && y.ApplicationId == settlement.Id && y.Category == FeeCategory.PaidApplicationSettlement) .Where((x, y) => x.Category == FeeCategory.PaidApplication) @@ -638,6 +524,8 @@ namespace DS.WMS.Core.Settlement.Method } await TenantDb.Updateable(applications).UpdateColumns(x => new { x.Status }).ExecuteCommandAsync(); + + return await base.PostSaveAsync(settlement); } diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Method/SettlementService`1.cs b/ds-wms-service/DS.WMS.Core/Settlement/Method/SettlementService`1.cs index f7bfe460..6a116479 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Method/SettlementService`1.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Method/SettlementService`1.cs @@ -1,7 +1,10 @@ -using DS.Module.Core; +using System.Text; +using DS.Module.Core; using DS.Module.Core.Enums; +using DS.Module.Core.Extensions; using DS.WMS.Core.Application.Entity; using DS.WMS.Core.Application.Interface; +using DS.WMS.Core.Fee.Entity; using DS.WMS.Core.Fee.Method; using DS.WMS.Core.Settlement.Dtos; using DS.WMS.Core.Settlement.Entity; @@ -31,11 +34,217 @@ namespace DS.WMS.Core.Settlement.Method #region 保存 - public virtual Task> SaveAsync(SettlementRequest request) + /// + /// 提交结算单 + /// + /// + /// + public async Task> SaveAsync(SettlementRequest request) + { + var settlement = request.Settlement; + if (settlement.SettlementDate == default) + settlement.SettlementDate = DateTime.Now; + + settlement.Mode = SettlementMode.Payment; + settlement.BillType = SettlementBillType.Payment; + + TEntity? dbValue = default; + if (request.Settlement.Id > 0) + { + dbValue = await TenantDb.Queryable().Select(x => new TEntity + { + Id = x.Id, + IsLocked = x.IsLocked, + Mode = x.Mode + }).FirstAsync(x => x.Id == request.Settlement.Id); + + if (dbValue.IsLocked) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.SettlementIsLocked)); + } + var result = EnsureSettlement(request.Settlement, dbValue); + if (!result.Succeeded) + return DataResult.Failed(result.Message, result.MultiCode); + + if (request.Details?.Count > 0) + { + if (settlement.Id == 0) + { + var first = request.Details[0]; + settlement.CustomerId = first.CustomerId.GetValueOrDefault(); + settlement.CustomerName = first.CustomerName; + } + + settlement.Details = request.Details.Select(x => new ApplicationDetail + { + ApplicationId = x.ApplicationId, + DetailId = x.Id, + RecordId = x.RecordId, + BusinessId = x.BusinessId, + BusinessType = x.BusinessType, + CustomerName = x.CustomerName ?? settlement.CustomerName, + FeeId = x.FeeId, + FeeName = x.FeeName, + FeeType = x.FeeType, + Category = FeeCategory.PaidApplicationSettlement, + ApplyAmount = x.Amount, + Currency = x.Currency, + ExchangeRate = x.ExchangeRate, + OriginalAmount = x.OriginalAmount, + OriginalCurrency = x.OriginalCurrency ?? (settlement.Currency.IsNullOrEmpty() ? x.Currency : settlement.Currency), + }).ToList(); + + //金额禁止为0 + if (settlement.Details.Any(x => x.ApplyAmount == 0 || x.OriginalAmount == 0)) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.AmountCannotBeZero)); + + if (settlement.Details.Any(x => x.OriginalCurrency.IsNullOrEmpty())) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.OriginalCurrencyCanNotNull)); + + result = await PreSaveAsync(settlement); + if (!result.Succeeded) + return DataResult.Failed(result.Message, result.MultiCode); + + settlement.Amount = settlement.Details.Sum(x => x.ApplyAmount); + } + + await TenantDb.Ado.BeginTranAsync(); + try + { + //关联导航属性插入 + if (settlement.Id == 0) + { + //创建时需要生成申请单编号 + var sequence = CommonService.Value.GetSequenceNext(); + if (!sequence.Succeeded) + { + return DataResult.Failed(sequence.Message, MultiLanguageConst.SequenceSetNotExist); + } + settlement.ApplicationNO = "CP" + SnowFlakeSingle.Instance.NextId(); //申请编号 + settlement.SettlementNO = sequence.Data; //结算单号 + + await TenantDb.InsertNav(settlement).Include(x => x.Details).ExecuteCommandAsync(); + } + else + { + if (settlement.Details.Count > 0) + await TenantDb.Insertable(settlement.Details).ExecuteCommandAsync(); + + await TenantDb.Updateable(settlement).IgnoreColumns(x => new + { + x.ApplicationNO, + x.SettlementNO, + x.IsLocked, + x.CreateBy, + x.CreateTime, + x.Deleted, + x.DeleteBy, + x.DeleteTime + }).ExecuteCommandAsync(); + } + + await OnSaveAsync(settlement); + + if (settlement.Details?.Count > 0) + { + //更新费用记录的已结算金额 + var fees = settlement.Details.Select(x => new FeeRecord + { + Id = x.RecordId, + SettlementAmount = x.OriginalAmount + }).ToList(); + await TenantDb.Updateable(fees) + .PublicSetColumns(x => x.SettlementAmount, "+") + .UpdateColumns(x => new { x.SettlementAmount }) + .ExecuteCommandAsync(); + } + + await TenantDb.Ado.CommitTranAsync(); + return DataResult.Success(await PostSaveAsync(settlement)); + } + catch (Exception ex) + { + await TenantDb.Ado.RollbackTranAsync(); + await ex.LogAsync(Db); + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); + } + } + + /// + /// 用于结算单的状态检查 + /// + /// 提交的结算单 + /// 数据库值,新增时为null + /// + protected virtual DataResult EnsureSettlement(TEntity settlement, TEntity? dbValue) { - throw new NotImplementedException(); + return DataResult.Success; } + /// + /// 在保存前调用 + /// + /// 结算单 + /// + protected virtual Task PreSaveAsync(TEntity settlement) + { + return Task.FromResult(DataResult.Success); + } + + /// + /// 在保存时调用 + /// + /// 已保存的结算单 + /// + protected virtual Task OnSaveAsync(TEntity settlement) + { + return Task.CompletedTask; + } + + /// + /// 在保存完成后调用 + /// + /// 申请单 + protected virtual async Task PostSaveAsync(TEntity settlement) + { + if (settlement.Details?.Count > 0) + { + //更新费用记录状态 + var ids = settlement.Details.Where(x => x.RecordId > 0).Select(x => x.RecordId); + if (!ids.Any()) + return settlement; + + var fees = await TenantDb.Queryable().Where(x => ids.Contains(x.Id)) + .Select(x => new FeeRecord + { + Id = x.Id, + FeeStatus = x.FeeStatus, + Amount = x.Amount, + SettlementAmount = x.SettlementAmount, + OrderAmount = x.OrderAmount, + OrderSettlementAmount = x.OrderSettlementAmount + }).ToListAsync(); + + List list = new(fees.Count); + foreach (var item in fees) + { + var restAmount = item.Amount - item.SettlementAmount - item.OrderAmount + item.OrderSettlementAmount; + if (restAmount == 0) + { + item.FeeStatus = FeeStatus.SettlementCompleted; + list.Add(item); + } + else if (restAmount != item.Amount) + { + item.FeeStatus = FeeStatus.PartialSettlement; + list.Add(item); + } + } + + await TenantDb.Updateable(list).UpdateColumns(x => new { x.FeeStatus }).ExecuteCommandAsync(); + } + + return settlement; + } #endregion From 53d93b2fc4cfff76a6509198ce50697eb4b216ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Wed, 10 Jul 2024 17:30:37 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E7=94=A8=E4=BA=8E=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E7=9A=84=E4=BB=98=E8=B4=B9=E7=94=B3=E8=AF=B7=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ds-wms-service/DS.Module.Core/Data/IdModel.cs | 14 +- .../DS.Module.SqlSugar/SaasDbService.cs | 26 +- .../DS.Module.SqlSugar/SqlsugarAopHelper.cs | 6 +- .../DS.Module.SqlSugar/SqlsugarInstall.cs | 31 ++- .../Application/Dtos/ApplicationDetailDto.cs | 9 +- .../Application/Dtos/ApplicationDto.cs | 32 +-- .../Application/Dtos/PaymentApplicationDto.cs | 20 -- .../IPaymentApplicationAuditService.cs | 2 +- .../Method/PaymentApplicationAuditService.cs | 46 +--- .../Dtos/PaymentApplicationDtoV2.cs | 104 ++++++++ .../Settlement/Dtos/PaymentSettlementDto.cs | 2 +- .../Settlement/Dtos/SettlementDetailDto.cs | 17 ++ .../Settlement/Dtos/SettlementRequest.cs | 4 +- .../Interface/IPaymentSettlementService.cs | 2 +- .../Interface/ISettlementService`1.cs | 10 +- .../Method/PaymentFreeSettlementService.cs | 24 +- .../Method/PaymentSettlementService.cs | 101 +++++--- .../Settlement/Method/SettlementService`1.cs | 166 ++++++++----- .../PaymentApplicationAuditController.cs | 2 +- .../PaymentFreeSettlementController.cs | 14 ++ .../PaymentSettlementController.cs | 20 +- .../DS.WMS.FeeApi/Logs/internal-nlog.txt | 231 ++++++++++++++++++ 22 files changed, 690 insertions(+), 193 deletions(-) create mode 100644 ds-wms-service/DS.WMS.Core/Settlement/Dtos/PaymentApplicationDtoV2.cs diff --git a/ds-wms-service/DS.Module.Core/Data/IdModel.cs b/ds-wms-service/DS.Module.Core/Data/IdModel.cs index 0c0737b3..5ff5c459 100644 --- a/ds-wms-service/DS.Module.Core/Data/IdModel.cs +++ b/ds-wms-service/DS.Module.Core/Data/IdModel.cs @@ -16,7 +16,7 @@ public class IdModel : IValidatableObject /// /// 主键ids /// - public long[]? Ids { get; set; } + public long[] Ids { get; set; } /// /// 业务类型:1、海运出口 2、海运进口 @@ -46,3 +46,15 @@ public class IdModel : IValidatableObject } } } + +/// +/// ID实体的泛型版本 +/// +/// 请求值的类型 +public class IdModel : IdModel +{ + /// + /// 请求值 + /// + public new T? Value { get; set; } +} \ No newline at end of file diff --git a/ds-wms-service/DS.Module.SqlSugar/SaasDbService.cs b/ds-wms-service/DS.Module.SqlSugar/SaasDbService.cs index 6a536a37..59036587 100644 --- a/ds-wms-service/DS.Module.SqlSugar/SaasDbService.cs +++ b/ds-wms-service/DS.Module.SqlSugar/SaasDbService.cs @@ -99,7 +99,31 @@ public class SaasDbService : ISaasDbService //Logger.Log(LogLevel.Info, // DateTime.Now.ToString() + "\r\n" + // UtilMethods.GetSqlString(c.DbType, sql, pars)); - Console.WriteLine("执行的sql:" + sql); + + string sqlStr = sql; + foreach (var item in pars) + { + if (item.Value != null && item.Value != DBNull.Value) + { + string? strValue = string.Empty; + if (item.DbType == System.Data.DbType.String) + { + strValue = "'" + (string)item.Value + "'"; + } + else if (item.DbType == System.Data.DbType.Boolean) + { + strValue = (bool)item.Value ? "1" : "0"; + } + else + { + strValue = item.Value.ToString(); + } + + sqlStr = sqlStr.Replace(item.ParameterName, strValue); + } + } + + Console.WriteLine("执行的SQL:" + Environment.NewLine + sqlStr); }; //数据处理事件 diff --git a/ds-wms-service/DS.Module.SqlSugar/SqlsugarAopHelper.cs b/ds-wms-service/DS.Module.SqlSugar/SqlsugarAopHelper.cs index b6cd555b..d4e59b75 100644 --- a/ds-wms-service/DS.Module.SqlSugar/SqlsugarAopHelper.cs +++ b/ds-wms-service/DS.Module.SqlSugar/SqlsugarAopHelper.cs @@ -2,9 +2,7 @@ using DS.Module.Core.Data; using DS.Module.Core.Extensions; using DS.Module.UserModule; -using Newtonsoft.Json; using SqlSugar; -using SqlSugar.IOC; namespace DS.Module.SqlSugar { @@ -40,7 +38,7 @@ namespace DS.Module.SqlSugar //Logger.Log(LogLevel.Info, // DateTime.Now.ToString() + "\r\n" + // UtilMethods.GetSqlString(c.DbType, sql, pars)); - Console.WriteLine("执行的sql:" + sql); + Console.WriteLine("执行的SQL:" + Environment.NewLine + sql); }; //数据处理事件 @@ -123,7 +121,7 @@ namespace DS.Module.SqlSugar // Aop_Time = it.Time.ToString(), // DiffType = it.DiffType.ToString() //}; - //Console.WriteLine("执行的sql:" + log); + //Write logic // DbScoped.Sugar.GetConnection(1288018625843826680).Insertable(log).ExecuteCommand(); }; diff --git a/ds-wms-service/DS.Module.SqlSugar/SqlsugarInstall.cs b/ds-wms-service/DS.Module.SqlSugar/SqlsugarInstall.cs index 67f84269..4dd2f17e 100644 --- a/ds-wms-service/DS.Module.SqlSugar/SqlsugarInstall.cs +++ b/ds-wms-service/DS.Module.SqlSugar/SqlsugarInstall.cs @@ -102,7 +102,7 @@ public static class SqlsugarInstall { // 封装AOP // SqlsugarAopHelper.AopForSqlsugar(db, user, dbList, connectConfigList); - Console.WriteLine("开始加载sqlsugar模块 要走过滤 起了"); + //Console.WriteLine("开始加载sqlsugar模块 要走过滤 起了"); foreach (var c in connectConfigList) { var dbProvider = db.GetConnectionScope((string)c.ConfigId); @@ -115,8 +115,33 @@ public static class SqlsugarInstall //Logger.Log(LogLevel.Info, // DateTime.Now.ToString() + "\r\n" + // UtilMethods.GetSqlString(c.DbType, sql, pars)); - Console.WriteLine("执行的sql:" + DateTime.Now.ToString() + "\r\n" + - UtilMethods.GetSqlString(c.DbType, sql, pars)); + //Console.WriteLine("执行的sql:" + DateTime.Now.ToString() + "\r\n" + + // UtilMethods.GetSqlString(c.DbType, sql, pars)); + + string sqlStr = sql; + foreach (var item in pars) + { + if (item.Value != null && item.Value != DBNull.Value) + { + string? strValue = string.Empty; + if (item.DbType == System.Data.DbType.String) + { + strValue = "'" + (string)item.Value + "'"; + } + else if (item.DbType == System.Data.DbType.Boolean) + { + strValue = (bool)item.Value ? "1" : "0"; + } + else + { + strValue = item.Value.ToString(); + } + + sqlStr = sqlStr.Replace(item.ParameterName, strValue); + } + } + + Console.WriteLine("执行的SQL:" + Environment.NewLine + sqlStr); }; //数据处理事件 diff --git a/ds-wms-service/DS.WMS.Core/Application/Dtos/ApplicationDetailDto.cs b/ds-wms-service/DS.WMS.Core/Application/Dtos/ApplicationDetailDto.cs index cfb7cfaf..3783c840 100644 --- a/ds-wms-service/DS.WMS.Core/Application/Dtos/ApplicationDetailDto.cs +++ b/ds-wms-service/DS.WMS.Core/Application/Dtos/ApplicationDetailDto.cs @@ -19,6 +19,11 @@ namespace DS.WMS.Core.Application.Dtos /// public long ApplicationId { get; set; } + /// + /// 引用的明细ID(付费申请明细ID) + /// + public long? DetailId { get; set; } + /// /// 费用记录ID /// @@ -217,9 +222,9 @@ namespace DS.WMS.Core.Application.Dtos public decimal? OutstandingAmount { get; set; } /// - /// 已结算金额 + /// 申请/结算金额 /// - public decimal SettlementAmount { get; set; } + public decimal ApplyAmount { get; set; } /// /// 发票号 diff --git a/ds-wms-service/DS.WMS.Core/Application/Dtos/ApplicationDto.cs b/ds-wms-service/DS.WMS.Core/Application/Dtos/ApplicationDto.cs index beddc4ef..8dbdc9ef 100644 --- a/ds-wms-service/DS.WMS.Core/Application/Dtos/ApplicationDto.cs +++ b/ds-wms-service/DS.WMS.Core/Application/Dtos/ApplicationDto.cs @@ -60,10 +60,10 @@ namespace DS.WMS.Core.Application.Dtos /// public DateTime? AuditTime { get; set; } - /// - /// 审核备注 - /// - public string? AuditRemark { get; set; } + ///// + ///// 审核备注 + ///// + //public string? AuditRemark { get; set; } /// /// 是否已打印 @@ -75,20 +75,20 @@ namespace DS.WMS.Core.Application.Dtos /// public int PrintTimes { get; set; } - /// - /// 打印人 - /// - public long? PrinterId { get; set; } + ///// + ///// 打印人 + ///// + //public long? PrinterId { get; set; } - /// - /// 打印人名称 - /// - public string? PrinterName { get; set; } + ///// + ///// 打印人名称 + ///// + //public string? PrinterName { get; set; } - /// - /// 打印时间 - /// - public DateTime? PrintTime { get; set; } + ///// + ///// 打印时间 + ///// + //public DateTime? PrintTime { get; set; } /// /// 驳回原因 diff --git a/ds-wms-service/DS.WMS.Core/Application/Dtos/PaymentApplicationDto.cs b/ds-wms-service/DS.WMS.Core/Application/Dtos/PaymentApplicationDto.cs index 3cb63fa5..06ea6032 100644 --- a/ds-wms-service/DS.WMS.Core/Application/Dtos/PaymentApplicationDto.cs +++ b/ds-wms-service/DS.WMS.Core/Application/Dtos/PaymentApplicationDto.cs @@ -76,18 +76,6 @@ namespace DS.WMS.Core.Application.Dtos public decimal? RestAmountOther { get; set; } - /// - /// 未结人民币 - /// - public decimal? UnSettlementRMB { get; set; } - - /// - /// 未结美元 - /// - public decimal? UnSettlementUSD { get; set; } - - - public long? SettlementTypeId { get; set; } /// @@ -152,11 +140,6 @@ namespace DS.WMS.Core.Application.Dtos /// public string? ChequeRemarks { get; set; } - /// - /// 实付金额 - /// - public decimal? PayAmount { get; set; } - /// /// 业务编号 /// @@ -171,8 +154,5 @@ namespace DS.WMS.Core.Application.Dtos /// 入账申请编号 /// public string? AccountingApplicationNO { get; set; } - - public AuditStatusForQuery? AuditStatus { get; set; } } - } diff --git a/ds-wms-service/DS.WMS.Core/Application/Interface/IPaymentApplicationAuditService.cs b/ds-wms-service/DS.WMS.Core/Application/Interface/IPaymentApplicationAuditService.cs index 9ea51915..c4a52d28 100644 --- a/ds-wms-service/DS.WMS.Core/Application/Interface/IPaymentApplicationAuditService.cs +++ b/ds-wms-service/DS.WMS.Core/Application/Interface/IPaymentApplicationAuditService.cs @@ -16,7 +16,7 @@ namespace DS.WMS.Core.Application.Interface /// /// /// - Task>> GetListAsync(PageRequest request); + Task>> GetListAsync(PageRequest request); /// /// 获取申请单明细 diff --git a/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationAuditService.cs b/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationAuditService.cs index 1b39e51a..a826fa1e 100644 --- a/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationAuditService.cs +++ b/ds-wms-service/DS.WMS.Core/Application/Method/PaymentApplicationAuditService.cs @@ -5,7 +5,6 @@ using DS.WMS.Core.Application.Dtos; using DS.WMS.Core.Application.Entity; using DS.WMS.Core.Application.Interface; using DS.WMS.Core.Code.Entity; -using DS.WMS.Core.Fee.Dtos; using DS.WMS.Core.Fee.Entity; using DS.WMS.Core.Flow.Dtos; using DS.WMS.Core.Info.Entity; @@ -33,7 +32,7 @@ namespace DS.WMS.Core.Application.Method /// /// /// - public async Task>> GetListAsync(PageRequest request) + public async Task>> GetListAsync(PageRequest request) { var query = CreateListQuery(); @@ -41,42 +40,23 @@ namespace DS.WMS.Core.Application.Method { var whereList = Db.ConfigQuery.Context.Utilities.JsonToConditionalModels(request.QueryCondition); - int? index = null; - foreach (var item in whereList) + switch (request.OtherQueryCondition) { - ConditionalModel? model = item as ConditionalModel; - if (model == null) - continue; - - //设置了状态筛选 - if (string.Equals(model.FieldName, nameof(PaymentApplicationDto.AuditStatus)) && int.TryParse(model.FieldValue, out int statusValue)) - { - AuditStatusForQuery status = (AuditStatusForQuery)statusValue; - switch (status) - { - case AuditStatusForQuery.Pending: - query = query.Where(x => x.AuditerId == null); - break; - - case AuditStatusForQuery.Audited: - query = query.Where(x => x.AuditerId != null); - break; + case AuditStatusForQuery.Pending: + query = query.Where(x => x.AuditerId == null); + break; - case AuditStatusForQuery.MarkerOnly: - var ids = await GetCurrentFlowsQuery(AuditTypes).Select(x => x.BusinessId).ToListAsync(); - if (ids.Count == 0) - ids.Add(0L); - query = query.Where(x => ids.Contains(x.Id)); - break; - } + case AuditStatusForQuery.Audited: + query = query.Where(x => x.AuditerId != null); + break; - index = whereList.IndexOf(item); + case AuditStatusForQuery.MarkerOnly: + var ids = await GetCurrentFlowsQuery(AuditTypes).Select(x => x.BusinessId).ToListAsync(); + if (ids.Count == 0) + ids.Add(0L); + query = query.Where(x => ids.Contains(x.Id)); break; - } } - if (index.HasValue) - whereList.RemoveAt(index.Value); - query = query.Where(whereList); } diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/PaymentApplicationDtoV2.cs b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/PaymentApplicationDtoV2.cs new file mode 100644 index 00000000..ab6ae674 --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/PaymentApplicationDtoV2.cs @@ -0,0 +1,104 @@ +using DS.Module.Core.Enums; +using DS.WMS.Core.Application.Dtos; +using Masuit.Tools.Systems; + +namespace DS.WMS.Core.Settlement.Dtos +{ + /// + /// 用于结算的付费申请单 + /// + public class PaymentApplicationDtoV2 : ApplicationDto + { + /// + /// 申请单状态 + /// + public PaymentApplicationStatus Status { get; set; } + + public string StatusText => Status.GetDescription(); + + /// + /// 人民币申请金额 + /// + public decimal AmountRMB { get; set; } + + /// + /// 美元申请金额 + /// + public decimal AmountUSD { get; set; } + + /// + /// 本次结算人民币 + /// + public decimal SettlementRMB { get; set; } + + /// + /// 本次结算美元 + /// + public decimal SettlementUSD { get; set; } + + /// + /// 未结人民币 + /// + public decimal UnSettledRMB { get; set; } + + /// + /// 未结美元 + /// + public decimal UnSettledUSD { get; set; } + + + public long? SettlementTypeId { get; set; } + + /// + /// 结算方式名称 + /// + public string? SettlementTypeName { get; set; } + + /// + /// 结算人 + /// + public long? SettlerId { get; set; } + + /// + /// 结算人名称 + /// + public string? SettlerName { get; set; } + + /// + /// 结算时间 + /// + public DateTime? SettlementTime { get; set; } + + /// + /// 创建时间 + /// + public DateTime CreateTime { get; set; } + + /// + /// 创建人 + /// + public long CreateBy { get; set; } + + /// + /// 创建人名称 + /// + public string CreateByName { get; set; } + + public List? Details { get; set; } + + /// + /// 业务委托单位 + /// + public string? ClientName { get; set; } + + /// + /// 申请支付日期 + /// + public DateTime? PaymentDate { get; set; } + + /// + /// 实付金额 + /// + public decimal? PayAmount { get; set; } + } +} diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/PaymentSettlementDto.cs b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/PaymentSettlementDto.cs index b04a7139..078138a0 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/PaymentSettlementDto.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/PaymentSettlementDto.cs @@ -4,7 +4,7 @@ using DS.WMS.Core.Application.Dtos; namespace DS.WMS.Core.Settlement.Dtos { /// - /// 付费结算 + /// 付费申请结算 /// public class PaymentSettlementDto : SettlementDto { diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementDetailDto.cs b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementDetailDto.cs index ac933e37..540e83b5 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementDetailDto.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementDetailDto.cs @@ -1,6 +1,8 @@ using System.Runtime.Serialization; using DS.Module.Core; +using DS.Module.Core.Enums; using DS.WMS.Core.Op.Entity; +using Masuit.Tools.Systems; namespace DS.WMS.Core.Settlement.Dtos { @@ -19,6 +21,21 @@ namespace DS.WMS.Core.Settlement.Dtos /// public long ApplicationId { get; set; } + /// + /// 申请单号 + /// + public string ApplicationNO { get; set; } + + /// + /// 状态 + /// + public PaymentApplicationStatus Status { get; set; } + + /// + /// 状态文本 + /// + public string StatusText => Status.GetDescription(); + /// /// 结算金额 /// diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementRequest.cs b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementRequest.cs index 4867771e..2650d23b 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementRequest.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Dtos/SettlementRequest.cs @@ -14,8 +14,10 @@ namespace DS.WMS.Core.Settlement.Dtos public TEntity Settlement { get; set; } /// - /// 申请明细 + /// 结算费用明细 /// public List? Details { get; set; } + + //public List Applications { get; set; } } } diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Interface/IPaymentSettlementService.cs b/ds-wms-service/DS.WMS.Core/Settlement/Interface/IPaymentSettlementService.cs index d4ab0602..e7a3a887 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Interface/IPaymentSettlementService.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Interface/IPaymentSettlementService.cs @@ -30,7 +30,7 @@ namespace DS.WMS.Core.Settlement.Interface /// /// /// - Task>> GetApplicationListAsync(PageRequest request); + Task>> GetApplicationListAsync(PageRequest request); /// /// 获取付费申请的费用明细 diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Interface/ISettlementService`1.cs b/ds-wms-service/DS.WMS.Core/Settlement/Interface/ISettlementService`1.cs index 9c4bcaa1..334911c8 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Interface/ISettlementService`1.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Interface/ISettlementService`1.cs @@ -13,7 +13,7 @@ namespace DS.WMS.Core.Application.Interface /// /// 提交结算单 /// - /// + /// /// Task> SaveAsync(SettlementRequest request); @@ -30,5 +30,13 @@ namespace DS.WMS.Core.Application.Interface /// 结算单ID /// Task DeleteAsync(params long[] ids); + + /// + /// 设置结算单的锁定状态 + /// + /// 是否锁定 + /// 结算ID + /// + Task SetLockAsync(bool isLocked, params long[] ids); } } diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentFreeSettlementService.cs b/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentFreeSettlementService.cs index de83cf0b..3bc4ac37 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentFreeSettlementService.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentFreeSettlementService.cs @@ -356,17 +356,17 @@ namespace DS.WMS.Core.Settlement.Method return DataResult.Success; } - protected override async Task OnDeleteDetailAsync(List settlements) - { - await base.OnDeleteDetailAsync(settlements); - - var detailList = settlements.SelectMany(x => x.Details); - //还原费用表的已结算金额 - var fees = detailList.Select(x => new FeeRecord { Id = x.RecordId, SettlementAmount = x.OriginalAmount }).ToList(); - await TenantDb.Updateable(fees) - .PublicSetColumns(it => it.SettlementAmount, "-") - .UpdateColumns(x => new { x.SettlementAmount }) - .ExecuteCommandAsync(); - } + //protected override async Task OnDeleteDetailAsync(List settlements) + //{ + // await base.OnDeleteDetailAsync(settlements); + + // var detailList = settlements.SelectMany(x => x.Details); + // //还原费用表的已结算金额 + // var fees = detailList.Select(x => new FeeRecord { Id = x.RecordId, SettlementAmount = x.OriginalAmount }).ToList(); + // await TenantDb.Updateable(fees) + // .PublicSetColumns(it => it.SettlementAmount, "-") + // .UpdateColumns(x => new { x.SettlementAmount }) + // .ExecuteCommandAsync(); + //} } } diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentSettlementService.cs b/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentSettlementService.cs index db230838..809d6aed 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentSettlementService.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Method/PaymentSettlementService.cs @@ -11,13 +11,12 @@ using DS.WMS.Core.Settlement.Dtos; using DS.WMS.Core.Settlement.Entity; using DS.WMS.Core.Settlement.Interface; using DS.WMS.Core.Sys.Entity; -using LanguageExt.Common; using SqlSugar; namespace DS.WMS.Core.Settlement.Method { /// - /// 付费结算服务 + /// 付费申请结算服务 /// public class PaymentSettlementService : SettlementService, IPaymentSettlementService { @@ -153,13 +152,14 @@ namespace DS.WMS.Core.Settlement.Method AdvanceAmount = x.AdvanceAmount, //预收支资料 AdvanceCurrency = x.AdvanceCurrency, AdvanceRate = x.AdvanceRate, - }).FirstAsync(); + }).FirstAsync(x => x.Id == id); if (model != null) { - var details = await TenantDb.Queryable().Where(d => d.ApplicationId == id) - .LeftJoin((d, pd) => d.DetailId == pd.Id) - .LeftJoin((d, pd, pa) => pd.ApplicationId == pa.Id) + var details = await TenantDb.Queryable() + .InnerJoin((d, pd) => d.DetailId == pd.Id) + .InnerJoin((d, pd, pa) => pd.ApplicationId == pa.Id) + .Where(d => d.ApplicationId == id) .Select((d, pd, pa) => new { d.Id, @@ -168,6 +168,8 @@ namespace DS.WMS.Core.Settlement.Method //d.Currency, d.OriginalCurrency, d.OriginalAmount, + pa.ApplicationNO, + pa.Status, pa.CreateTime, pa.CreateBy, pa.PaymentDate, @@ -186,6 +188,8 @@ namespace DS.WMS.Core.Settlement.Method Ids = g.Select(x => x.Id), RMBApplyAmount = g.Where(x => x.OriginalCurrency == RMB_CODE).Sum(x => x.ApplyAmount), USDApplyAmount = g.Where(x => x.OriginalCurrency == USD_CODE).Sum(x => x.ApplyAmount), + ApplicationNO = firstItem.ApplicationNO, + Status = firstItem.Status, CreateTime = firstItem?.CreateTime, CreateBy = firstItem?.CreateBy, PaymentDate = firstItem?.PaymentDate, @@ -232,16 +236,16 @@ namespace DS.WMS.Core.Settlement.Method /// /// /// - public async Task>> GetApplicationListAsync(PageRequest request) + public async Task>> GetApplicationListAsync(PageRequest request) { - var query = TenantDb.Queryable().Where(a => a.Status == PaymentApplicationStatus.AuditPassed || a.Status == PaymentApplicationStatus.PartialSettlement) - .WhereIF(request.OtherQueryCondition != null && request.OtherQueryCondition.UnsettledOnly, - a => a.Status != PaymentApplicationStatus.SettlementCompleted && SqlFunc.Subqueryable().Where(d => d.ApplicationId == a.Id && (d.ApplyAmount - d.ProcessedAmount) != 0).Any()) + var query = TenantDb.Queryable() .InnerJoinIF(request.OtherQueryCondition != null && request.OtherQueryCondition.PortId.HasValue, - (a, d) => d.ApplicationId == a.Id) + (a, d) => a.Id == d.ApplicationId) .InnerJoinIF(request.OtherQueryCondition != null && request.OtherQueryCondition.PortId.HasValue, (a, d, s) => s.Id == d.BusinessId && (s.LoadPortId == request.OtherQueryCondition.PortId.Value || s.DischargePortId == request.OtherQueryCondition.PortId.Value)) - .Select(a => new PaymentApplicationDto + .GroupByIF(request.OtherQueryCondition != null && request.OtherQueryCondition.PortId.HasValue, + (a, d, s) => a.Id) + .Select(a => new PaymentApplicationDtoV2 { Id = a.Id, ApplicationNO = a.ApplicationNO, @@ -252,13 +256,13 @@ namespace DS.WMS.Core.Settlement.Method CustomerBank = a.CustomerBank.BankName, //结算对象银行 CustomerAccount = a.CustomerBank.Account, //结算对象账号 Currency = a.Currency, - AmountRMB = a.AmountRMB, //RMB申请金额 - AmountUSD = a.AmountUSD, //USD申请金额 + AmountRMB = a.AmountRMB.GetValueOrDefault(), //RMB申请金额 + AmountUSD = a.AmountUSD.GetValueOrDefault(), //USD申请金额 //RMB未结金额 - UnSettlementRMB = SqlFunc.Subqueryable().Where(d => d.Currency == RMB_CODE) + UnSettledRMB = SqlFunc.Subqueryable().Where(d => d.Currency == RMB_CODE) .Select(d => SqlFunc.AggregateSum(d.ApplyAmount - d.ProcessedAmount)), //USD未结金额 - UnSettlementUSD = SqlFunc.Subqueryable().Where(d => d.Currency == USD_CODE) + UnSettledUSD = SqlFunc.Subqueryable().Where(d => d.Currency == USD_CODE) .Select(d => SqlFunc.AggregateSum(d.ApplyAmount - d.ProcessedAmount)), SaleDeptId = a.SaleDeptId, //所属分部 SettlementTypeId = a.SettlementTypeId, @@ -273,6 +277,11 @@ namespace DS.WMS.Core.Settlement.Method Note = a.Note }); + if (request.OtherQueryCondition != null && request.OtherQueryCondition.UnsettledOnly) + query = query.Where(a => a.Status == PaymentApplicationStatus.AuditPassed || a.Status == PaymentApplicationStatus.PartialSettlement); + else + query = query.Where(a => a.Status == PaymentApplicationStatus.AuditPassed || a.Status == PaymentApplicationStatus.PartialSettlement || a.Status == PaymentApplicationStatus.SettlementCompleted); + var whereList = request.GetConditionalModels(Db); var result = await query.Where(whereList).ToQueryPageAsync(request.PageCondition); @@ -288,6 +297,9 @@ namespace DS.WMS.Core.Settlement.Method { item.CreateByName = users.Find(x => x.Id == item.CreateBy)?.UserName; item.SaleDeptName = orgs.Find(x => x.Id == item.SaleDeptId)?.OrgName; + + item.SettlementRMB = item.UnSettledRMB; + item.SettlementUSD = item.UnSettledUSD; } } @@ -314,7 +326,7 @@ namespace DS.WMS.Core.Settlement.Method FeeName = d.FeeName, FeeType = d.FeeType, //收付 Amount = d.ApplyAmount, //申请金额 - SettlementAmount = f.SettlementAmount, //已结算金额 + ApplyAmount = f.SettlementAmount, //已结算金额 RestAmount = d.ApplyAmount - d.ProcessedAmount, //剩余结算金额 CustomerId = f.CustomerId, CustomerName = d.CustomerName, @@ -349,7 +361,7 @@ namespace DS.WMS.Core.Settlement.Method RecordId = d.RecordId, FeeName = d.FeeName, FeeType = d.FeeType, //收付 - SettlementAmount = d.ApplyAmount, //结算金额 + ApplyAmount = d.ApplyAmount, //结算金额 CustomerId = f.CustomerId, CustomerName = d.CustomerName, OriginalCurrency = d.OriginalCurrency, //原始币别 @@ -479,7 +491,7 @@ namespace DS.WMS.Core.Settlement.Method //更新申请明细的已处理金额 var list = settlement.Details.Select(x => new ApplicationDetail { - Id = x.Id, + Id = x.DetailId.Value, ProcessedAmount = x.ApplyAmount, OriginalProcessedAmount = x.OriginalAmount }).ToList(); @@ -493,16 +505,17 @@ namespace DS.WMS.Core.Settlement.Method protected override async Task PostSaveAsync(PaymentSettlement settlement) { //回写付费申请的状态 - var details = await TenantDb.Queryable() - .InnerJoin((x, y) => x.DetailId == y.Id && y.ApplicationId == settlement.Id && y.Category == FeeCategory.PaidApplicationSettlement) - .Where((x, y) => x.Category == FeeCategory.PaidApplication) - .GroupBy((x, y) => x.ApplicationId).Select((x, y) => new - { - x.ApplicationId, - Count = SqlFunc.AggregateCount(x.Id), - ProcessedCount = SqlFunc.Subqueryable().Where(y => y.ApplicationId == x.ApplicationId && - y.Category == FeeCategory.PaidApplication && y.OriginalAmount - y.OriginalProcessedAmount == 0).Count() - }).ToListAsync(); + var ids = settlement.Details.Select(x => x.DetailId); + var appIds = await TenantDb.Queryable().Where(x => ids.Contains(x.Id) && x.Category == FeeCategory.PaidApplication) + .Select(x => x.ApplicationId).ToListAsync(); + + var details = await TenantDb.Queryable().Where(x => appIds.Contains(x.ApplicationId) && x.Category == FeeCategory.PaidApplication).GroupBy(x => x.ApplicationId).Select(x => new + { + x.ApplicationId, + Count = SqlFunc.AggregateCount(x.Id), + ProcessedCount = SqlFunc.Subqueryable().Where(y => y.ApplicationId == x.ApplicationId && + y.Category == FeeCategory.PaidApplication && y.OriginalAmount - y.OriginalProcessedAmount == 0).Count() + }).ToListAsync(); List applications = []; foreach (var item in details) @@ -541,13 +554,31 @@ namespace DS.WMS.Core.Settlement.Method { await base.OnDeleteDetailAsync(settlements); - var detailList = settlements.SelectMany(x => x.Details); - //还原费用表的已结算金额 - var fees = detailList.Select(x => new FeeRecord { Id = x.RecordId, SettlementAmount = x.OriginalAmount }).ToList(); - await TenantDb.Updateable(fees) - .PublicSetColumns(it => it.SettlementAmount, "-") - .UpdateColumns(x => new { x.SettlementAmount }) + //还原付费申请明细 + var list = settlements.FindAll(x => x.Mode == SettlementMode.Payment); + if (list.Count > 0) + { + var items = list.SelectMany(x => x.Details); + var ids = items.Select(x => x.DetailId); + var details = TenantDb.Queryable().Where(x => ids.Contains(x.Id) && x.Category == FeeCategory.PaidApplication) + .Select(x => new ApplicationDetail + { + Id = x.Id, + ProcessedAmount = x.ProcessedAmount, + OriginalProcessedAmount = x.OriginalProcessedAmount + }).ToList(); + + foreach (var detail in details) + { + var item = items.FirstOrDefault(x => x.DetailId == detail.Id); + detail.ProcessedAmount -= item.ApplyAmount; + detail.OriginalProcessedAmount -= item.OriginalAmount; + } + + await TenantDb.Updateable(details) + .UpdateColumns(x => new { x.ProcessedAmount, x.OriginalProcessedAmount }) .ExecuteCommandAsync(); + } } } diff --git a/ds-wms-service/DS.WMS.Core/Settlement/Method/SettlementService`1.cs b/ds-wms-service/DS.WMS.Core/Settlement/Method/SettlementService`1.cs index 6a116479..33e54a33 100644 --- a/ds-wms-service/DS.WMS.Core/Settlement/Method/SettlementService`1.cs +++ b/ds-wms-service/DS.WMS.Core/Settlement/Method/SettlementService`1.cs @@ -1,5 +1,4 @@ -using System.Text; -using DS.Module.Core; +using DS.Module.Core; using DS.Module.Core.Enums; using DS.Module.Core.Extensions; using DS.WMS.Core.Application.Entity; @@ -67,7 +66,7 @@ namespace DS.WMS.Core.Settlement.Method if (request.Details?.Count > 0) { - if (settlement.Id == 0) + if (settlement.Id == 0 && settlement.CustomerId == 0) { var first = request.Details[0]; settlement.CustomerId = first.CustomerId.GetValueOrDefault(); @@ -77,7 +76,7 @@ namespace DS.WMS.Core.Settlement.Method settlement.Details = request.Details.Select(x => new ApplicationDetail { ApplicationId = x.ApplicationId, - DetailId = x.Id, + DetailId = x.Id == 0 ? null : x.Id, RecordId = x.RecordId, BusinessId = x.BusinessId, BusinessType = x.BusinessType, @@ -213,34 +212,7 @@ namespace DS.WMS.Core.Settlement.Method if (!ids.Any()) return settlement; - var fees = await TenantDb.Queryable().Where(x => ids.Contains(x.Id)) - .Select(x => new FeeRecord - { - Id = x.Id, - FeeStatus = x.FeeStatus, - Amount = x.Amount, - SettlementAmount = x.SettlementAmount, - OrderAmount = x.OrderAmount, - OrderSettlementAmount = x.OrderSettlementAmount - }).ToListAsync(); - - List list = new(fees.Count); - foreach (var item in fees) - { - var restAmount = item.Amount - item.SettlementAmount - item.OrderAmount + item.OrderSettlementAmount; - if (restAmount == 0) - { - item.FeeStatus = FeeStatus.SettlementCompleted; - list.Add(item); - } - else if (restAmount != item.Amount) - { - item.FeeStatus = FeeStatus.PartialSettlement; - list.Add(item); - } - } - - await TenantDb.Updateable(list).UpdateColumns(x => new { x.FeeStatus }).ExecuteCommandAsync(); + await UpdateFeeStatus(ids); } return settlement; @@ -268,6 +240,9 @@ namespace DS.WMS.Core.Settlement.Method ProcessedAmount = x.ProcessedAmount, OriginalProcessedAmount = x.OriginalProcessedAmount }).ToListAsync(); + if (details.Count == 0) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData)); + var appIds = details.Select(x => x.ApplicationId).Distinct().ToList(); var apps = await TenantDb.Queryable().Where(x => appIds.Contains(x.Id)).Select(x => new TEntity { @@ -288,6 +263,15 @@ namespace DS.WMS.Core.Settlement.Method await OnDeleteDetailAsync(apps); await TenantDb.Deleteable(details).ExecuteCommandAsync(); + //更新结算单的结算总金额 + var apps2 = await TenantDb.Queryable().Where(x => appIds.Contains(x.ApplicationId) && !ids.Contains(x.Id)) + .GroupBy(x => x.ApplicationId).Select(x => new TEntity + { + Id = x.ApplicationId, + Amount = SqlFunc.AggregateSum(x.ApplyAmount) + }).ToListAsync(); + await TenantDb.Updateable(apps2).UpdateColumns(x => new { x.Amount }).ExecuteCommandAsync(); + await TenantDb.Ado.CommitTranAsync(); return DataResult.Success; } @@ -311,6 +295,8 @@ namespace DS.WMS.Core.Settlement.Method Id = x.Id, Mode = x.Mode }).ToListAsync(); + if (apps.Count == 0) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData)); var details = await TenantDb.Queryable().Where(x => ids.Contains(x.ApplicationId)).Select( x => new ApplicationDetail @@ -334,8 +320,12 @@ namespace DS.WMS.Core.Settlement.Method { await OnDeleteDetailAsync(apps); await TenantDb.DeleteNav(x => ids.Contains(x.Id)).Include(x => x.Details).ExecuteCommandAsync(); - await TenantDb.Ado.CommitTranAsync(); + + //更新费用结算状态 + var ids2 = details.Select(x => x.RecordId); + await UpdateFeeStatus(ids2); + return DataResult.Success; } catch (Exception ex) @@ -363,35 +353,97 @@ namespace DS.WMS.Core.Settlement.Method /// protected virtual async Task OnDeleteDetailAsync(List settlements) { - //还原付费申请明细 - var list = settlements.FindAll(x => x.Mode == SettlementMode.Payment); - if (list.Count > 0) - { - var items = list.SelectMany(x => x.Details); - var ids = items.Select(x => x.DetailId); - var details = TenantDb.Queryable().Where(x => ids.Contains(x.Id) && x.Category == FeeCategory.PaidApplication) - .Select(x => new ApplicationDetail - { - Id = x.Id, - ProcessedAmount = x.ProcessedAmount, - OriginalProcessedAmount = x.OriginalProcessedAmount - }).ToList(); + //还原费用表的已结算金额 + var fees = settlements.SelectMany(x => x.Details).Select(x => new FeeRecord { Id = x.RecordId, SettlementAmount = x.OriginalAmount }).ToList(); + await TenantDb.Updateable(fees) + .PublicSetColumns(it => it.SettlementAmount, "-") + .UpdateColumns(x => new { x.SettlementAmount }) + .ExecuteCommandAsync(); + } + + #endregion - foreach (var detail in details) - { - var item = items.FirstOrDefault(x => x.DetailId == detail.Id); - detail.ProcessedAmount -= item.ApplyAmount; - detail.OriginalProcessedAmount -= item.OriginalAmount; - } - await TenantDb.Updateable(details) - .UpdateColumns(x => new { x.ProcessedAmount, x.OriginalProcessedAmount }) - .ExecuteCommandAsync(); + /// + /// 设置结算单的锁定状态 + /// + /// 是否锁定 + /// 结算ID + /// + public async Task SetLockAsync(bool isLocked, params long[] ids) + { + var dtNow = DateTime.Now; + var userId = long.Parse(User.UserId); + List list = null; + if (isLocked) + { + list = ids.Select(x => new TEntity + { + Id = x, + IsLocked = isLocked, + LockTime = dtNow, + LockUserId = userId + }).ToList(); + } + else + { + list = ids.Select(x => new TEntity + { + Id = x, + IsLocked = isLocked, + UnlockTime = dtNow, + UnlockUserId = userId + }).ToList(); } - } - #endregion + return await TenantDb.Updateable(list).UpdateColumns(x => new + { + x.IsLocked, + x.LockTime, + x.UnlockTime, + x.LockUserId, + x.UnlockUserId + }).ExecuteCommandAsync() > 0 ? + DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); + } + /// + /// 更新费用的结算状态 + /// + /// 费用记录ID + /// + protected internal async Task UpdateFeeStatus(IEnumerable ids) + { + var fees = await TenantDb.Queryable().Where(x => ids.Contains(x.Id)) + .Select(x => new FeeRecord + { + Id = x.Id, + FeeStatus = x.FeeStatus, + Amount = x.Amount, + SettlementAmount = x.SettlementAmount, + OrderAmount = x.OrderAmount, + OrderSettlementAmount = x.OrderSettlementAmount + }).ToListAsync(); + if (fees.Count == 0) + return; + + List list = new(fees.Count); + foreach (var item in fees) + { + var restAmount = item.Amount - item.SettlementAmount - item.OrderAmount + item.OrderSettlementAmount; + if (restAmount == 0) + { + item.FeeStatus = FeeStatus.SettlementCompleted; + list.Add(item); + } + else if (restAmount != item.Amount) + { + item.FeeStatus = FeeStatus.PartialSettlement; + list.Add(item); + } + } + await TenantDb.Updateable(list).UpdateColumns(x => new { x.FeeStatus }).ExecuteCommandAsync(); + } } } diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentApplicationAuditController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentApplicationAuditController.cs index 37ecffb3..12bbfcc6 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentApplicationAuditController.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentApplicationAuditController.cs @@ -31,7 +31,7 @@ namespace DS.WMS.FeeApi.Controllers /// /// [HttpPost, Route("GetList")] - public async Task>> ListAsync([FromBody] PageRequest request) + public async Task>> ListAsync([FromBody] PageRequest request) { return await _auditService.GetListAsync(request); } diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentFreeSettlementController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentFreeSettlementController.cs index 7e1ac60c..a3df0c6d 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentFreeSettlementController.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentFreeSettlementController.cs @@ -73,5 +73,19 @@ namespace DS.WMS.FeeApi.Controllers return await _service.DeleteAsync(model.Ids); } + + /// + /// 设置结算单的锁定状态 + /// + /// + [HttpPost, Route("SetLock")] + public async Task SetLockAsync(IdModel model) + { + if (!ModelState.IsValid) + return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); + + bool isLocked = Convert.ToBoolean(model.Value); + return await _service.SetLockAsync(isLocked, model.Ids); + } } } diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentSettlementController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentSettlementController.cs index 1dd0f293..3c39d86e 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentSettlementController.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/PaymentSettlementController.cs @@ -52,7 +52,7 @@ namespace DS.WMS.FeeApi.Controllers /// /// [HttpPost, Route("GetApplicationList")] - public async Task>> GetApplicationListAsync([FromBody] PageRequest request) + public async Task>> GetApplicationListAsync([FromBody] PageRequest request) { return await _service.GetApplicationListAsync(request); } @@ -60,7 +60,7 @@ namespace DS.WMS.FeeApi.Controllers /// /// 获取付费申请的费用明细 /// - /// 申请单ID + /// 付费申请单ID /// [HttpGet, Route("GetApplicationDetails")] public async Task>> GetApplicationDetailsAsync(long id) @@ -69,7 +69,7 @@ namespace DS.WMS.FeeApi.Controllers } /// - /// 获取付费申请的费用明细 + /// 获取结算明细的费用明细 /// /// 申请明细ID /// @@ -123,5 +123,19 @@ namespace DS.WMS.FeeApi.Controllers return await _service.DeleteAsync(model.Ids); } + + /// + /// 设置结算单的锁定状态 + /// + /// + [HttpPost, Route("SetLock")] + public async Task SetLockAsync(IdModel model) + { + if (!ModelState.IsValid) + return DataResult.Failed(ModelState.GetErrorMessage(), MultiLanguageConst.IllegalRequest); + + bool isLocked = Convert.ToBoolean(model.Value); + return await _service.SetLockAsync(isLocked, model.Ids); + } } } diff --git a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt index 3c53e5e4..07b4eb3e 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt @@ -2266,3 +2266,234 @@ 2024-07-09 11:54:05.4790 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config 2024-07-09 11:54:05.4790 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-07-09 11:54:05.4954 Info Configuration initialized. +2024-07-10 11:40:15.2058 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 11:40:15.2450 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 11:40:15.2628 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 11:40:15.2771 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 11:40:15.2851 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 11:40:15.2851 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 11:40:15.2970 Info Configuration initialized. +2024-07-10 11:46:36.5322 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 11:46:36.6318 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 11:46:36.6406 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 11:46:36.6670 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 11:46:36.6835 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 11:46:36.6919 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 11:46:36.7069 Info Configuration initialized. +2024-07-10 11:50:46.3952 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 11:50:46.4422 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 11:50:46.4422 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 11:50:46.4689 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 11:50:46.4689 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 11:50:46.4839 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 11:50:46.4839 Info Configuration initialized. +2024-07-10 11:53:03.3009 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 11:53:03.3450 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 11:53:03.3660 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 11:53:03.4012 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 11:53:03.4150 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 11:53:03.4217 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 11:53:03.4217 Info Configuration initialized. +2024-07-10 11:55:00.6404 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 11:55:00.7028 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 11:55:00.7028 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 11:55:00.7487 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 11:55:00.7667 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 11:55:00.7667 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 11:55:00.7877 Info Configuration initialized. +2024-07-10 11:55:25.1570 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 11:55:25.2198 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 11:55:25.2198 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 11:55:25.2493 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 11:55:25.2599 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 11:55:25.2665 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 11:55:25.2665 Info Configuration initialized. +2024-07-10 11:59:17.7815 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 11:59:17.8304 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 11:59:17.8304 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 11:59:17.8535 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 11:59:17.8638 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 11:59:17.8638 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 11:59:17.8760 Info Configuration initialized. +2024-07-10 13:34:37.6477 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 13:34:37.6732 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 13:34:37.6918 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 13:34:37.7140 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 13:34:37.7217 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 13:34:37.7217 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 13:34:37.7322 Info Configuration initialized. +2024-07-10 14:04:49.7357 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 14:04:49.7912 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 14:04:49.7981 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 14:04:49.8251 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 14:04:49.8606 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 14:04:49.8606 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 14:04:49.8802 Info Configuration initialized. +2024-07-10 14:15:38.0626 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 14:15:38.0976 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 14:15:38.1299 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 14:15:38.1464 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 14:15:38.1541 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 14:15:38.1541 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 14:15:38.1541 Info Configuration initialized. +2024-07-10 14:24:28.8757 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 14:24:28.9277 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 14:24:28.9407 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 14:24:28.9637 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 14:24:28.9742 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 14:24:28.9742 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 14:24:28.9880 Info Configuration initialized. +2024-07-10 14:44:44.5964 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 14:44:44.7057 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 14:44:44.7057 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 14:44:44.7446 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 14:44:44.7589 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 14:44:44.7663 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 14:44:44.7833 Info Configuration initialized. +2024-07-10 14:48:29.1877 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 14:48:29.2591 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 14:48:29.2664 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 14:48:29.2895 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 14:48:29.3018 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 14:48:29.3018 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 14:48:29.3197 Info Configuration initialized. +2024-07-10 14:55:04.8946 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 14:55:04.9570 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 14:55:04.9570 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 14:55:04.9876 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 14:55:04.9876 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 14:55:05.0016 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 14:55:05.0016 Info Configuration initialized. +2024-07-10 14:55:44.3444 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 14:55:44.3951 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 14:55:44.4146 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 14:55:44.4414 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 14:55:44.4533 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 14:55:44.4533 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 14:55:44.4696 Info Configuration initialized. +2024-07-10 14:58:12.9358 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 14:58:12.9872 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 14:58:12.9872 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 14:58:13.0162 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 14:58:13.0289 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 14:58:13.0289 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 14:58:13.0509 Info Configuration initialized. +2024-07-10 15:09:04.8454 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 15:09:04.9132 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 15:09:04.9230 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 15:09:04.9485 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 15:09:04.9607 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 15:09:04.9670 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 15:09:04.9670 Info Configuration initialized. +2024-07-10 15:20:17.2025 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 15:20:17.2755 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 15:20:17.2810 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 15:20:17.3048 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 15:20:17.3147 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 15:20:17.3147 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 15:20:17.3311 Info Configuration initialized. +2024-07-10 15:25:58.8734 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 15:25:59.0403 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 15:25:59.0635 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 15:25:59.1047 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 15:25:59.1202 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 15:25:59.1321 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 15:25:59.1531 Info Configuration initialized. +2024-07-10 15:28:09.3659 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 15:28:09.4273 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 15:28:09.4273 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 15:28:09.4649 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 15:28:09.4844 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 15:28:09.4844 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 15:28:09.5108 Info Configuration initialized. +2024-07-10 15:32:33.0334 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 15:32:33.1033 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 15:32:33.1200 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 15:32:33.1557 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 15:32:33.1770 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 15:32:33.1853 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 15:32:33.1853 Info Configuration initialized. +2024-07-10 15:35:46.4754 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 15:35:46.6169 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 15:35:46.6169 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 15:35:46.6390 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 15:35:46.6390 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 15:35:46.6390 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 15:35:46.6604 Info Configuration initialized. +2024-07-10 15:46:57.2041 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 15:46:57.2845 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 15:46:57.2845 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 15:46:57.3176 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 15:46:57.3311 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 15:46:57.3311 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 15:46:57.3494 Info Configuration initialized. +2024-07-10 15:53:45.2044 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 15:53:45.2691 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 15:53:45.2691 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 15:53:45.3045 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 15:53:45.3175 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 15:53:45.3175 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 15:53:45.3328 Info Configuration initialized. +2024-07-10 16:13:10.7966 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 16:13:10.8602 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 16:13:10.8791 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 16:13:10.9133 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 16:13:10.9321 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 16:13:10.9406 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 16:13:10.9548 Info Configuration initialized. +2024-07-10 16:23:29.5797 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 16:23:29.6495 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 16:23:29.6613 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 16:23:29.6911 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 16:23:29.7133 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 16:23:29.7210 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 16:23:29.7210 Info Configuration initialized. +2024-07-10 16:31:01.0763 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 16:31:01.1324 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 16:31:01.1324 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 16:31:01.1624 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 16:31:01.1746 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 16:31:01.1746 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 16:31:01.1928 Info Configuration initialized. +2024-07-10 16:44:16.1731 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 16:44:16.2348 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 16:44:16.2348 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 16:44:16.2661 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 16:44:16.2661 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 16:44:16.2829 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 16:44:16.2829 Info Configuration initialized. +2024-07-10 16:45:32.9080 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 16:45:32.9935 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 16:45:32.9971 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 16:45:33.0816 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 16:45:33.0947 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 16:45:33.0947 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 16:45:33.0947 Info Configuration initialized. +2024-07-10 16:49:07.2693 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 16:49:07.3353 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 16:49:07.3423 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 16:49:07.3717 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 16:49:07.3908 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 16:49:07.3908 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 16:49:07.4270 Info Configuration initialized. +2024-07-10 16:52:17.9216 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 16:52:17.9840 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 16:52:17.9840 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 16:52:18.0243 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 16:52:18.0471 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 16:52:18.0471 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 16:52:18.0673 Info Configuration initialized. +2024-07-10 17:01:36.4738 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 17:01:36.5624 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 17:01:36.5624 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 17:01:36.6626 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 17:01:36.6732 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 17:01:36.6732 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 17:01:36.6864 Info Configuration initialized. +2024-07-10 17:10:02.8627 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-10 17:10:02.9033 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-10 17:10:02.9074 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-10 17:10:02.9237 Info NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c. File version: 5.2.8.2366. Product version: 5.2.8+f586f1341c46fa38aaaff4c641e7f0fa7e813943. GlobalAssemblyCache: False +2024-07-10 17:10:02.9237 Info Validating config: TargetNames=console, ownFile-web, ConfigItems=54, FilePath=D:\Source\Repos\DS8\ds-wms-service\DS.WMS.FeeApi\bin\Debug\net8.0\nlog.config +2024-07-10 17:10:02.9358 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-10 17:10:02.9358 Info Configuration initialized.