From 1db768c7467e63a27bf257cf32a8b7197231cfef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Fri, 19 Jul 2024 16:15:27 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E7=94=9F=E6=88=90=E5=8F=91=E7=A5=A8?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E7=9A=84bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.Module.Core/Data/BaseModel.cs | 29 +- .../Entity/ApplicationDetailRelation.cs | 60 +++ .../Entity/FeeCodeInvoiceDetail.cs | 43 -- .../DS.WMS.Core/Invoice/Dtos/BuildOption.cs | 14 + .../Invoice/Method/GeneralInvoiceService.cs | 23 + .../Invoice/Method/InvoiceService`1.cs | 484 +++++++++++++----- .../Controllers/GeneralInvoiceController.cs | 2 +- .../DS.WMS.FeeApi/Logs/internal-nlog.txt | 168 ++++++ 8 files changed, 640 insertions(+), 183 deletions(-) create mode 100644 ds-wms-service/DS.WMS.Core/Application/Entity/ApplicationDetailRelation.cs delete mode 100644 ds-wms-service/DS.WMS.Core/Application/Entity/FeeCodeInvoiceDetail.cs create mode 100644 ds-wms-service/DS.WMS.Core/Invoice/Dtos/BuildOption.cs diff --git a/ds-wms-service/DS.Module.Core/Data/BaseModel.cs b/ds-wms-service/DS.Module.Core/Data/BaseModel.cs index 645b16a6..7b82c327 100644 --- a/ds-wms-service/DS.Module.Core/Data/BaseModel.cs +++ b/ds-wms-service/DS.Module.Core/Data/BaseModel.cs @@ -40,7 +40,7 @@ public abstract class BaseModel : IDeleted /// 创建人名称 /// [Description("创建人名称")] - [SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = true, ColumnDescription = "创建人名称", Length =50)] + [SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = true, ColumnDescription = "创建人名称", Length = 50)] public string CreateUserName { get; set; } /// /// 修改人 @@ -117,7 +117,7 @@ public abstract class BaseModelV2 : IDeleted /// 创建时间 /// [Description("创建时间")] - [SqlSugar.SugarColumn(IsOnlyIgnoreUpdate = true, ColumnDescription = "创建时间")] + [SugarColumn(IsOnlyIgnoreUpdate = true, ColumnDescription = "创建时间")] public DateTime CreateTime { get; set; } /// @@ -152,13 +152,34 @@ public abstract class BaseModelV2 : IDeleted /// 删除时间 /// [Description("删除时间")] - [SugarColumn(IsNullable = true, ColumnDescription = "删除时间")] + [SugarColumn(IsNullable = true, ColumnDescription = "删除时间", IsOnlyIgnoreInsert = true)] public DateTime? DeleteTime { get; set; } /// /// 删除人 /// [Description("删除人")] - [SugarColumn(IsNullable = true, ColumnDescription = "删除人")] + [SugarColumn(IsNullable = true, ColumnDescription = "删除人", IsOnlyIgnoreInsert = true)] public long? DeleteBy { get; set; } + + /// + /// 创建人名称 + /// + [Description("创建人名称")] + [SugarColumn(IsOnlyIgnoreUpdate = true, IsNullable = true, ColumnDescription = "创建人名称", Length = 50)] + public string? CreateUserName { get; set; } + + /// + /// 修改人名称 + /// + [Description("修改人名称")] + [SugarColumn(IsNullable = true, ColumnDescription = "修改人名称", Length = 50)] + public string? UpdateUserName { get; set; } + + /// + /// 删除人名称 + /// + [Description("删除人名称")] + [SugarColumn(IsNullable = true, ColumnDescription = "删除人名称", Length = 50, IsOnlyIgnoreInsert = true)] + public string? DeleteUserName { get; set; } } \ No newline at end of file diff --git a/ds-wms-service/DS.WMS.Core/Application/Entity/ApplicationDetailRelation.cs b/ds-wms-service/DS.WMS.Core/Application/Entity/ApplicationDetailRelation.cs new file mode 100644 index 00000000..dae1327e --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Application/Entity/ApplicationDetailRelation.cs @@ -0,0 +1,60 @@ +using DS.WMS.Core.Fee.Entity; +using SqlSugar; + +namespace DS.WMS.Core.Application.Entity +{ + /// + /// 费用代码与发票申请明细关系 + /// + [SugarTable("application_detail_relation", TableDescription = "发票明细与费用明细关系")] + public class ApplicationDetailRelation + { + /// + /// 费用明细ID + /// + [SugarColumn(IsPrimaryKey = true)] + public long DetailId { get; set; } + + /// + /// 发票明细 + /// + [Navigate(NavigateType.OneToOne, nameof(DetailId))] + public ApplicationDetail? Detail { get; set; } + + /// + /// 发票明细ID + /// + [SugarColumn(IsPrimaryKey = true)] + public long InvoiceDetailId { get; set; } + + /// + /// 发票明细 + /// + [Navigate(NavigateType.OneToOne, nameof(InvoiceDetailId))] + public InvoiceDetail? InvoiceDetail { get; set; } + + ///// + ///// 费用代码ID + ///// + //public long? FeeId { get; set; } + + ///// + ///// 费用代码 + ///// + //[Navigate(NavigateType.OneToOne, nameof(FeeId))] + //public FeeCode? FeeCode { get; set; } + + /// + /// 发票申请/发票ID + /// + [SugarColumn(ColumnDescription = "发票申请/发票ID", IsNullable = false)] + public long InvoiceId { get; set; } + + /// + /// 原始发票明细名称 + /// + [SugarColumn(ColumnDescription = "原始发票明细名称", IsNullable = false, Length = 50)] + public string OriginalName { get; set; } + + } +} diff --git a/ds-wms-service/DS.WMS.Core/Application/Entity/FeeCodeInvoiceDetail.cs b/ds-wms-service/DS.WMS.Core/Application/Entity/FeeCodeInvoiceDetail.cs deleted file mode 100644 index d21fedf6..00000000 --- a/ds-wms-service/DS.WMS.Core/Application/Entity/FeeCodeInvoiceDetail.cs +++ /dev/null @@ -1,43 +0,0 @@ -using DS.WMS.Core.Fee.Entity; -using SqlSugar; - -namespace DS.WMS.Core.Application.Entity -{ - /// - /// 费用代码与发票申请明细关系 - /// - [SugarTable("fee_code_invoice_detail", TableDescription = "费用代码与发票申请明细关系")] - public class FeeCodeInvoiceDetail - { - /// - /// 费用代码ID - /// - [SugarColumn(IsPrimaryKey = true)] - public long FeeCodeId { get; set; } - - /// - /// 费用代码 - /// - [Navigate(NavigateType.OneToOne, nameof(FeeCodeId))] - public FeeCode? FeeCode { get; set; } - - /// - /// 发票明细ID - /// - [SugarColumn(IsPrimaryKey = true)] - public long InvoiceDetailId { get; set; } - - /// - /// 费用代码 - /// - [Navigate(NavigateType.OneToOne, nameof(InvoiceDetailId))] - public InvoiceDetail? InvoiceDetail { get; set; } - - /// - /// 发票明细名称 - /// - [SugarColumn(ColumnDescription = "发票明细名称", Length = 50, IsNullable = false)] - public string DetailName { get; set; } = string.Empty; - - } -} diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Dtos/BuildOption.cs b/ds-wms-service/DS.WMS.Core/Invoice/Dtos/BuildOption.cs new file mode 100644 index 00000000..c791fe3d --- /dev/null +++ b/ds-wms-service/DS.WMS.Core/Invoice/Dtos/BuildOption.cs @@ -0,0 +1,14 @@ +namespace DS.WMS.Core.Invoice.Dtos +{ + /// + /// 发票明细操作类型 + /// + public enum BuildOption + { + Create, + + Update, + + Delete + } +} diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/GeneralInvoiceService.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/GeneralInvoiceService.cs index 04b8b7bf..502eb8b6 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Method/GeneralInvoiceService.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/GeneralInvoiceService.cs @@ -116,6 +116,8 @@ namespace DS.WMS.Core.Invoice.Method return DataResult>.Success(details); } + + protected override Task PreSaveAsync(Entity.Invoice invoice) { invoice.Type = InvoiceType.Applcation; @@ -123,11 +125,32 @@ namespace DS.WMS.Core.Invoice.Method return Task.FromResult(DataResult.Success); } + protected override async Task OnSaveAsync(Entity.Invoice invoice) + { + var list = invoice.Details?.Where(x => x.DetailId.HasValue).Select(x => new ApplicationDetail + { + Id = x.DetailId.GetValueOrDefault(), + ProcessedAmount = x.ApplyAmount, + OriginalProcessedAmount = x.OriginalAmount + }).ToList(); + + if (list != null && list.Count > 0) + { + //增加发票申请明细的已处理金额 + await TenantDb.Updateable(list) + .PublicSetColumns(x => x.ProcessedAmount, "+").PublicSetColumns(x => x.OriginalProcessedAmount, "+") + .UpdateColumns(x => new { x.ProcessedAmount, x.OriginalProcessedAmount }) + .ExecuteCommandAsync(); + } + } + protected override Task PostSaveAsync(Entity.Invoice invoice) { return Task.Factory.StartNew(UpdateInvoiceApplications, new List { invoice }); } + + protected override async Task OnDeleteDetailAsync(List invoices, DeleteOption deleteOption) { var list = invoices.SelectMany(x => x.Details).Where(x => x.DetailId.HasValue).Select(x => new ApplicationDetail diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs index 976163b8..6b5e7c51 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Method/InvoiceService`1.cs @@ -163,6 +163,7 @@ namespace DS.WMS.Core.Invoice.Method #pragma warning disable CS4014 + /// /// 提交发票开票 /// @@ -215,7 +216,8 @@ namespace DS.WMS.Core.Invoice.Method x.OriginalProcessedAmount, y.CustomerId }).ToListAsync(); - invoice.Details = new List(details.Count); + + invoice.Details ??= new List(details.Count); foreach (var item in details) { @@ -271,7 +273,8 @@ namespace DS.WMS.Core.Invoice.Method //将请求明细转换为数据库的费用明细 invoice.Details = request.Details.Select(x => new ApplicationDetail { - ApplicationId = x.ApplicationId, + Id = x.Id, + ApplicationId = x.ApplicationId == 0 ? x.ApplicationId : invoice.Id, RefId = x.RefId, DetailId = x.Id == 0 ? null : x.Id, RecordId = x.RecordId, @@ -280,17 +283,19 @@ namespace DS.WMS.Core.Invoice.Method FeeId = x.FeeId, FeeName = x.FeeName, FeeType = x.FeeType, - ApplyAmount = x.Amount, Currency = x.Currency, + ApplyAmount = x.ApplyAmount, ExchangeRate = x.ExchangeRate, OriginalAmount = x.OriginalAmount, OriginalCurrency = x.OriginalCurrency ?? (invoice.Currency.IsNullOrEmpty() ? x.Currency : invoice.Currency), }).ToList(); } - if (invoice.Details?.Count > 0) { + //筛选出新增的费用明细 + invoice.Details = invoice.Details.FindAll(x => x.Id == 0); + //金额禁止为0 if (invoice.Details.Any(x => x.ApplyAmount == 0 || x.OriginalAmount == 0)) return DataResult.FailedWithDesc(nameof(MultiLanguageConst.AmountCannotBeZero)); @@ -304,18 +309,15 @@ namespace DS.WMS.Core.Invoice.Method result = await PreSaveAsync(invoice); if (!result.Succeeded) return DataResult.Failed(result.Message, result.MultiCode); - - invoice.ApplyAmount = invoice.Details.Sum(x => x.ApplyAmount); - invoice.AmountUppercase = new Money(invoice.ApplyAmount).ToString(); - invoice.OriginalAmount = invoice.Details.Sum(x => x.OriginalAmount); - invoice.OtherInvoiceAmount = invoice.Details.Where(x => x.Currency != RMB_CODE).Sum(x => x.OriginalAmount); } await TenantDb.Ado.BeginTranAsync(); try { + BuildOption buildOption; if (invoice.Id == 0)//新增 { + buildOption = BuildOption.Create; //创建时需要生成申请单编号 var sequence = CommonService.Value.GetSequenceNext(); if (!sequence.Succeeded) @@ -328,30 +330,33 @@ namespace DS.WMS.Core.Invoice.Method } else//编辑 { - if (invoice.Details?.Count > 0) + buildOption = BuildOption.Update; + await TenantDb.Updateable(invoice).UpdateColumns(x => new { + x.InvoiceNO, + x.InvoiceDate, + //x.Currency, + x.ReceiptCurrency, + x.CustomerId, + x.CustomerName, + x.AutualCustomerName, + x.InvoiceHeader, + x.Account, + x.CustomerAddTel, + x.CustomerBank, + x.OperatorId, + x.TaxID, + x.TaxRate, + x.OrgId, + x.SaleDeptId + }).ExecuteCommandAsync(); + + if (invoice.Details?.Count > 0) await TenantDb.Insertable(invoice.Details).ExecuteCommandAsync(); - ////因需要重新生成明细,所以要先清空现有发票明细 - //await TenantDb.Deleteable().Where(x => x.ApplicationId == invoice.Id).ExecuteCommandAsync(); - } - else if (invoice.InvoiceDetails?.Count > 0) - { - //更新发票明细 + if (invoice.InvoiceDetails?.Count > 0) + //发票明细只有更新 await TenantDb.Updateable(invoice.InvoiceDetails).IgnoreColumns(x => new { x.Category }).ExecuteCommandAsync(); - } - - await TenantDb.Updateable(invoice).IgnoreColumns(x => new - { - x.BillNO, - x.IsLocked, - - x.CreateBy, - x.CreateTime, - x.Deleted, - x.DeleteBy, - x.DeleteTime - }).ExecuteCommandAsync(); } if (invoice.Details?.Count > 0) @@ -360,21 +365,26 @@ namespace DS.WMS.Core.Invoice.Method var fees = invoice.Details.Select(x => new FeeRecord { Id = x.RecordId, - InvoiceAmount = x.OriginalAmount + InvoiceAmount = x.OriginalAmount, + OrderInvSettlementAmount = x.OriginalAmount, }).ToList(); - await TenantDb.Updateable(fees) - .PublicSetColumns(x => x.InvoiceAmount, "+") - .UpdateColumns(x => new { x.InvoiceAmount }) - .ExecuteCommandAsync(); - await BuildInvoiceDetailAsync([invoice]); - if (invoice.InvoiceDetails?.Count > 0) - await TenantDb.Insertable(invoice.InvoiceDetails).ExecuteCommandAsync(); + var updateable = TenantDb.Updateable(fees).PublicSetColumns(x => x.InvoiceAmount, "+"); + if (invoice.Type == InvoiceType.Applcation) + updateable = updateable.PublicSetColumns(x => x.OrderInvSettlementAmount, "+") + .UpdateColumns(x => new { x.OrderInvSettlementAmount }); + + await updateable.UpdateColumns(x => new { x.InvoiceAmount }).ExecuteCommandAsync(); + + //生成发票明细 + await BuildInvoiceDetailAsync(invoice, buildOption); + + //重新计算发票总金额 + await RefreshInvoiceAsync([invoice]); } await OnSaveAsync(invoice); await TenantDb.Ado.CommitTranAsync(); - PostSaveAsync(invoice); return DataResult.Success(invoice); @@ -387,6 +397,199 @@ namespace DS.WMS.Core.Invoice.Method } } + /// + /// 生成发票明细 + /// + /// 发票 + /// 生成类型 + /// + protected async Task BuildInvoiceDetailAsync(TEntity invoice, BuildOption option) + { + if (invoice.Details == null || invoice.Details.Count == 0) + return; + + var ids = invoice.Details.Select(x => x.Id); + if (option == BuildOption.Create) + { + var feesCodes = await TenantDb.Queryable().InnerJoin((d, fc) => d.FeeId == fc.Id && ids.Contains(d.Id)) + .Select((d, fc) => new + { + DetailId = d.Id, + FeeId = fc.Id, + fc.GoodName + }).ToListAsync(); + var feeCodeGroups = feesCodes.GroupBy(x => x.GoodName).ToList(); + + invoice.InvoiceDetails = new List(feeCodeGroups.Count); + List relations = []; + foreach (var g in feeCodeGroups) + { + var invDetail = new InvoiceDetail + { + Id = SnowFlakeSingle.Instance.NextId(), + ApplicationId = invoice.Id, + Name = g.Key, + TaxRate = invoice.TaxRate, + TaxUnitPrice = invoice.Details.FindAll(x => g.Select(x => x.DetailId).Contains(x.Id)).Sum(x => x.ApplyAmount), + Category = DetailCategory.InvoiceIssuance + }; + invDetail.TaxAmount = invDetail.TaxUnitPrice * invoice.TaxRate; + invDetail.UnitPrice = invDetail.TaxUnitPrice - invDetail.TaxAmount; + + invoice.InvoiceDetails.Add(invDetail); + + foreach (var item in g) + { + relations.Add(new ApplicationDetailRelation + { + DetailId = item.DetailId, + InvoiceDetailId = invDetail.Id, + OriginalName = g.Key, + InvoiceId = invoice.Id + }); + } + } + + await TenantDb.Insertable(invoice.InvoiceDetails).ExecuteCommandAsync(); + await TenantDb.Insertable(relations).ExecuteCommandAsync(); + } + //更新时只处理增加的明细 + else if (option == BuildOption.Update) + { + //获取现有发票明细对应关系 + var relations = await TenantDb.Queryable().Where(x => x.InvoiceId == invoice.Id) + .Select(x => new + { + x.DetailId, + x.InvoiceDetailId, + x.OriginalName, + }).ToListAsync(); + var feeIds = invoice.Details.Select(x => x.FeeId); + var feesCodes = await TenantDb.Queryable().Where(x => feeIds.Contains(x.Id)) + .Select(x => new + { + FeeId = x.Id, + x.GoodName + }).ToListAsync(); + + invoice.InvoiceDetails = []; //新增的发票明细 + List invoiceDetailList = []; //更新的发票明细 + List relationList = []; //新增的明细关系 + + foreach (var detail in invoice.Details) + { + var goodsName = feesCodes.Find(x => x.FeeId == detail.FeeId)?.GoodName; //转换为发票明细名称 + var relation = relations.Find(x => string.Equals(x.OriginalName, goodsName, StringComparison.Ordinal)); + if (relation == null) //需要新增发票明细 + { + var invDetail = new InvoiceDetail + { + Id = SnowFlakeSingle.Instance.NextId(), + ApplicationId = invoice.Id, + Name = goodsName, + TaxRate = invoice.TaxRate, + TaxUnitPrice = detail.ApplyAmount, + Category = DetailCategory.InvoiceIssuance + }; + invDetail.TaxAmount = invDetail.TaxUnitPrice * invoice.TaxRate; + invDetail.UnitPrice = invDetail.TaxUnitPrice - invDetail.TaxAmount; + + invoice.InvoiceDetails.Add(invDetail); + + relationList.Add(new ApplicationDetailRelation + { + DetailId = detail.Id, + InvoiceDetailId = invDetail.Id, + InvoiceId = invoice.Id, + OriginalName = goodsName + }); + } + else //发票明细已存在,追加金额 + { + //添加到更新列表 + invoiceDetailList.Add(new InvoiceDetail + { + Id = relation.InvoiceDetailId, + TaxUnitPrice = detail.ApplyAmount + }); + } + } + + if (invoice.InvoiceDetails.Count > 0) + await TenantDb.Insertable(invoice.InvoiceDetails).ExecuteCommandAsync(); + + //执行发票明细金额更新 + if (invoiceDetailList.Count > 0) + { + var ids2 = invoiceDetailList.Select(x => x.Id); + var updateList = await TenantDb.Queryable().Where(x => ids2.Contains(x.Id)).Select(x => new InvoiceDetail + { + Id = x.Id, + TaxUnitPrice = x.TaxUnitPrice, + TaxRate = x.TaxRate, + TaxAmount = x.TaxAmount, + UnitPrice = x.UnitPrice + }).ToListAsync(); + foreach (var item in updateList) + { + var invDetail = invoiceDetailList.Find(x => x.Id == item.Id); + item.TaxUnitPrice += (invDetail?.TaxUnitPrice).GetValueOrDefault(); + item.TaxAmount = item.TaxUnitPrice * invoice.TaxRate; + item.UnitPrice = item.TaxUnitPrice - item.TaxAmount; + } + + await TenantDb.Updateable(updateList).UpdateColumns(x => new + { + x.TaxUnitPrice, + x.TaxAmount, + x.UnitPrice + }).ExecuteCommandAsync(); + } + + if (relationList.Count > 0) + await TenantDb.Insertable(relationList).ExecuteCommandAsync(); + } + else if (option == BuildOption.Delete) + { + } + + } + + /// + /// 重新计算发票的各项金额数据 + /// + /// 发票 + /// + protected async Task RefreshInvoiceAsync(List invoices) + { + var ids = invoices.Select(x => x.Id); + var details = await TenantDb.Queryable().Where(x => ids.Contains(x.ApplicationId)) + .Select(x => new { x.ApplicationId, x.Currency, x.ApplyAmount, x.OriginalAmount }).ToListAsync(); + var invDetails = await TenantDb.Queryable().Where(x => ids.Contains(x.ApplicationId)) + .Select(x => new { x.ApplicationId, x.TaxUnitPrice }).ToListAsync(); + + foreach (var invoice in invoices) + { + var currDetails = details.FindAll(x => x.ApplicationId == invoice.Id); + + invoice.ApplyAmount = currDetails.Sum(x => x.ApplyAmount); + invoice.AmountUppercase = new Money(invoice.ApplyAmount).ToString(); + invoice.OriginalAmount = currDetails.Sum(x => x.OriginalAmount); + invoice.OtherInvoiceAmount = currDetails.FindAll(x => x.Currency != RMB_CODE).Sum(x => x.OriginalAmount); + + invoice.InvoiceAmount = invDetails.FindAll(x => x.ApplicationId == invoice.Id).Sum(x => x.TaxUnitPrice); + } + + return await TenantDb.Updateable(invoices).UpdateColumns(x => new + { + x.ApplyAmount, + x.AmountUppercase, + x.OriginalAmount, + x.OtherInvoiceAmount, + x.InvoiceAmount + }).ExecuteCommandAsync(); + } + /// /// 用于发票的状态检查 /// @@ -429,32 +632,38 @@ namespace DS.WMS.Core.Invoice.Method /// public async Task DeleteAsync(params long[] ids) { - var apps = await TenantDb.Queryable().Where(x => ids.Contains(x.Id)).Select(x => new TEntity + await TenantDb.Ado.BeginTranAsync(); + try { - Id = x.Id, - IsLocked = x.IsLocked - }).ToListAsync(); - var details = await TenantDb.Queryable().Where(x => ids.Contains(x.ApplicationId)).Select( - x => new ApplicationDetail + var apps = await TenantDb.Queryable().Where(x => ids.Contains(x.Id)).Select(x => new TEntity { Id = x.Id, - ApplicationId = x.ApplicationId, - DetailId = x.DetailId, - RefId = x.RefId, - RecordId = x.RecordId, - ApplyAmount = x.ApplyAmount, - OriginalAmount = x.OriginalAmount + Type = x.Type, + IsLocked = x.IsLocked }).ToListAsync(); - foreach (var app in apps) - app.Details = details.FindAll(x => x.ApplicationId == app.Id); await TenantDb.Ado.BeginTranAsync(); + if (apps.Count == 0) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData)); - var result = PreDelete(apps); - if (!result.Succeeded) - return result; + var details = await TenantDb.Queryable().Where(x => ids.Contains(x.ApplicationId)).Select( + x => new ApplicationDetail + { + Id = x.Id, + ApplicationId = x.ApplicationId, + DetailId = x.DetailId, + RefId = x.RefId, + RecordId = x.RecordId, + ApplyAmount = x.ApplyAmount, + OriginalAmount = x.OriginalAmount + }).ToListAsync(); + + foreach (var app in apps) + app.Details = details.FindAll(x => x.ApplicationId == app.Id); + + var result = PreDelete(apps); + if (!result.Succeeded) + return result; - try - { await OnDeleteDetailAsync(apps, DeleteOption.Entire); await TenantDb.DeleteNav(x => ids.Contains(x.Id)).Include(x => x.Details).ExecuteCommandAsync(); await TenantDb.Ado.CommitTranAsync(); @@ -478,7 +687,10 @@ namespace DS.WMS.Core.Invoice.Method /// public async Task DeleteDetailAsync(params long[] ids) { - var details = await TenantDb.Queryable().Where(x => ids.Contains(x.Id)).Select( + await TenantDb.Ado.BeginTranAsync(); + try + { + var details = await TenantDb.Queryable().Where(x => ids.Contains(x.Id)).Select( x => new ApplicationDetail { Id = x.Id, @@ -489,28 +701,32 @@ namespace DS.WMS.Core.Invoice.Method ApplyAmount = x.ApplyAmount, OriginalAmount = x.OriginalAmount }).ToListAsync(); - var appIds = details.Select(x => x.ApplicationId).Distinct().ToList(); - var apps = await TenantDb.Queryable().Where(x => appIds.Contains(x.Id)).Select(x => new TEntity - { - Id = x.Id, - IsLocked = x.IsLocked - }).ToListAsync(); - foreach (var app in apps) - app.Details = details.FindAll(x => x.ApplicationId == app.Id); + if (details.Count == 0) + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.EmptyData)); - var result = PreDelete(apps); - if (!result.Succeeded) - return result; + var invIds = details.Select(x => x.ApplicationId).Distinct().ToList(); + var invoices = await TenantDb.Queryable().Where(x => invIds.Contains(x.Id)).Select(x => new TEntity + { + Id = x.Id, + Type = x.Type, + IsLocked = x.IsLocked + }).ToListAsync(); - await TenantDb.Ado.BeginTranAsync(); - try - { - await OnDeleteDetailAsync(apps, DeleteOption.DetailOnly); + foreach (var app in invoices) + app.Details = details.FindAll(x => x.ApplicationId == app.Id); + + var result = PreDelete(invoices); + if (!result.Succeeded) + return result; + + await OnDeleteDetailAsync(invoices, DeleteOption.DetailOnly); await TenantDb.Deleteable(details).ExecuteCommandAsync(); + //重新计算发票总金额 + await RefreshInvoiceAsync(invoices); await TenantDb.Ado.CommitTranAsync(); - PostDeleteAsync(apps, DeleteOption.Entire); + PostDeleteAsync(invoices, DeleteOption.Entire); return DataResult.Success; } @@ -529,8 +745,33 @@ namespace DS.WMS.Core.Invoice.Method /// public async Task DeleteInvoiceDetailAsync(params long[] ids) { - int rows = await TenantDb.Deleteable().Where(x => ids.Contains(x.Id)).ExecuteCommandAsync(); - return rows > 0 ? DataResult.Success : DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); + await TenantDb.Ado.BeginTranAsync(); + try + { + var invDetails = await TenantDb.Queryable().Where(x => ids.Contains(x.Id)) + .Select(x => new { x.ApplicationId, x.TaxUnitPrice }).ToListAsync(); + var groups = invDetails.GroupBy(x => x.ApplicationId); + foreach (var g in groups) + { + var list = g.Select(x => new TEntity { Id = g.Key, InvoiceAmount = g.Sum(x => x.TaxUnitPrice) }).ToList(); + //更新发票主表的开票金额 + await TenantDb.Updateable(list).PublicSetColumns(x => x.InvoiceAmount, "-") + .UpdateColumns(x => new { x.InvoiceAmount }).ExecuteCommandAsync(); + } + + await TenantDb.Deleteable().Where(x => ids.Contains(x.Id)).ExecuteCommandAsync(); + //删除对应关系 + await TenantDb.Deleteable().Where(x => ids.Contains(x.InvoiceDetailId)).ExecuteCommandAsync(); + + await TenantDb.Ado.CommitTranAsync(); + return DataResult.Success; + } + catch (Exception ex) + { + await TenantDb.Ado.RollbackTranAsync(); + await ex.LogAsync(Db); + return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); + } } /// @@ -554,12 +795,15 @@ namespace DS.WMS.Core.Invoice.Method /// protected virtual async Task OnDeleteDetailAsync(List invoices, DeleteOption deleteOption) { - var excludeIds = invoices.SelectMany(x => x.Details).Select(x => x.Id).ToList(); - //await TenantDb.Deleteable().Where(x => excludeIds.Contains(x.Id)).ExecuteCommandAsync(); + var appIds = invoices.Select(x => x.Id); if (deleteOption == DeleteOption.DetailOnly) { - var appIds = invoices.Select(x => x.Id).ToList(); + //删除明细需要同时变更发票明细 + foreach (var item in invoices) + BuildInvoiceDetailAsync(item, BuildOption.Delete); + + var excludeIds = invoices.SelectMany(x => x.Details).Select(x => x.Id); var details = await TenantDb.Queryable().Where(x => appIds.Contains(x.ApplicationId) && !excludeIds.Contains(x.Id)) .Select(x => new ApplicationDetail { @@ -577,24 +821,39 @@ namespace DS.WMS.Core.Invoice.Method item.AmountUppercase = new Money(item.ApplyAmount).ToString(); } - ////删除明细需要同时变更发票明细 - //await CreateInvoiceDetailsAsync(invoices); - //var invDetails = invoices.SelectMany(x => x.InvoiceDetails).ToList(); - //if (invDetails.Count > 0) - // await TenantDb.Insertable(invDetails).ExecuteCommandAsync(); - await TenantDb.Updateable(invoices).UpdateColumns(x => new { x.ApplyAmount, x.AmountUppercase }).ExecuteCommandAsync(); + + //删除明细之间的关系 + + } + else if (deleteOption == DeleteOption.Entire) + { + //删除发票主表则同时删除对应发票明细 + await TenantDb.Deleteable().Where(x => appIds.Contains(x.ApplicationId)).ExecuteCommandAsync(); + + //删除明细之间的关系 + await TenantDb.Deleteable().Where(x => appIds.Contains(x.InvoiceId)).ExecuteCommandAsync(); + } + + foreach (var item in invoices) + { + //还原费用表的已开票金额 + var fees = item.Details?.Select(x => new FeeRecord { Id = x.RecordId, InvoiceAmount = x.OriginalAmount }).ToList(); + + var updateable = TenantDb.Updateable(fees).PublicSetColumns(x => x.InvoiceAmount, "-"); + + if (item.Type == InvoiceType.Applcation) + updateable = updateable.PublicSetColumns(x => x.OrderInvSettlementAmount, "-") + .UpdateColumns(x => new { x.OrderInvSettlementAmount }); + + await updateable.UpdateColumns(x => new { x.InvoiceAmount }).ExecuteCommandAsync(); + } - //还原费用表的已开票金额 - var fees = invoices.SelectMany(x => x.Details).Select(x => new FeeRecord { Id = x.RecordId, InvoiceAmount = x.OriginalAmount }).ToList(); - await TenantDb.Updateable(fees) - .PublicSetColumns(it => it.InvoiceAmount, "-").UpdateColumns(x => new { x.InvoiceAmount }) - .ExecuteCommandAsync(); } /// @@ -604,51 +863,6 @@ namespace DS.WMS.Core.Invoice.Method /// 发票删除选项 protected virtual Task PostDeleteAsync(List invoices, DeleteOption deleteOption) => Task.CompletedTask; - /// - /// 生成发票明细 - /// - /// - /// - protected async Task BuildInvoiceDetailAsync(IEnumerable invoices) - { - foreach (var invoice in invoices) - { - if (invoice.Details?.Count > 0 && (invoice.InvoiceDetails == null || invoice.InvoiceDetails.Count == 0)) - { - var ids = invoice.Details.Select(x => x.RecordId).ToList(); - var feesCodes = await TenantDb.Queryable().InnerJoin((f, c) => f.FeeId == c.Id && ids.Contains(f.Id)) - .Select((f, c) => new - { - FeeId = c.Id, - c.GoodName - }).ToListAsync(); - - var list = feesCodes.GroupBy(x => x.GoodName).Select(x => new - { - Name = x.Key, - FeeIds = x.Select(y => y.FeeId) - }).ToList(); - invoice.InvoiceDetails = new List(list.Count); - foreach (var item in list) - { - var invDetail = new InvoiceDetail - { - ApplicationId = invoice.Id, - Name = item.Name, - TaxRate = invoice.TaxRate, - TaxUnitPrice = invoice.Details.FindAll(x => item.FeeIds.Contains(x.FeeId)).Sum(x => x.ApplyAmount), - Category = DetailCategory.InvoiceIssuance - }; - invDetail.TaxAmount = invDetail.TaxUnitPrice * invoice.TaxRate; - invDetail.UnitPrice = invDetail.TaxUnitPrice - invDetail.TaxAmount; - - invoice.InvoiceDetails.Add(invDetail); - invoice.InvoiceAmount = invoice.InvoiceDetails.Sum(x => x.TaxUnitPrice); - } - } - } - } - /// /// 设置发票的锁定状态 diff --git a/ds-wms-service/DS.WMS.FeeApi/Controllers/GeneralInvoiceController.cs b/ds-wms-service/DS.WMS.FeeApi/Controllers/GeneralInvoiceController.cs index d4169af9..9037fec8 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Controllers/GeneralInvoiceController.cs +++ b/ds-wms-service/DS.WMS.FeeApi/Controllers/GeneralInvoiceController.cs @@ -101,7 +101,7 @@ namespace DS.WMS.FeeApi.Controllers } /// - /// 删除发票明细 + /// 删除费用明细 /// /// 发票明细ID /// 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 74d142b7..1fb6dc3b 100644 --- a/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt +++ b/ds-wms-service/DS.WMS.FeeApi/Logs/internal-nlog.txt @@ -2945,3 +2945,171 @@ 2024-07-17 15:41:56.4414 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-17 15:41:56.4498 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile 2024-07-17 15:41:56.4498 Info Configuration initialized. +2024-07-18 11:27:43.4190 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-18 11:27:43.4666 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-18 11:27:43.4666 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-18 11:27:43.4898 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-18 11:27:43.4948 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-18 11:27:43.4948 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-18 11:27:43.4948 Info Configuration initialized. +2024-07-18 11:34:31.2142 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-18 11:34:31.2422 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-18 11:34:31.2450 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-18 11:34:31.2450 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-18 11:34:31.2450 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-18 11:34:31.2627 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-18 11:34:31.2627 Info Configuration initialized. +2024-07-18 11:38:08.5155 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-18 11:38:08.5914 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-18 11:38:08.6284 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-18 11:38:08.6636 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-18 11:38:08.6756 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-18 11:38:08.6830 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-18 11:38:08.6830 Info Configuration initialized. +2024-07-18 11:44:51.6688 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-18 11:44:51.7113 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-18 11:44:51.7181 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-18 11:44:51.7365 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-18 11:44:51.7460 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-18 11:44:51.7460 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-18 11:44:51.7460 Info Configuration initialized. +2024-07-18 13:35:21.5138 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-18 13:35:21.5612 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-18 13:35:21.5612 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-18 13:35:21.6011 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-18 13:35:21.6127 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-18 13:35:21.6127 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-18 13:35:21.6234 Info Configuration initialized. +2024-07-18 13:58:32.4861 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-18 13:58:32.5226 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-18 13:58:32.5280 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-18 13:58:32.5280 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-18 13:58:32.5469 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-18 13:58:32.5469 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-18 13:58:32.5469 Info Configuration initialized. +2024-07-18 16:42:24.0738 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-18 16:42:24.1256 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-18 16:42:24.1256 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-18 16:42:24.2047 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-18 16:42:24.2047 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-18 16:42:24.2047 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-18 16:42:24.2190 Info Configuration initialized. +2024-07-18 16:55:27.1766 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-18 16:55:27.2060 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-18 16:55:27.2060 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-18 16:55:27.2217 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-18 16:55:27.2217 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-18 16:55:27.2217 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-18 16:55:27.2336 Info Configuration initialized. +2024-07-18 17:22:41.4230 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-18 17:22:41.4910 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-18 17:22:41.4958 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-18 17:22:41.5180 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-18 17:22:41.5180 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-18 17:22:41.5300 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-18 17:22:41.5300 Info Configuration initialized. +2024-07-18 17:28:44.7162 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-18 17:28:44.7668 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-18 17:28:44.7668 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-18 17:28:44.7891 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-18 17:28:44.7963 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-18 17:28:44.7963 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-18 17:28:44.7963 Info Configuration initialized. +2024-07-18 17:41:32.0585 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-18 17:41:32.0991 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-18 17:41:32.0991 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-18 17:41:32.1223 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-18 17:41:32.1223 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-18 17:41:32.1223 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-18 17:41:32.1446 Info Configuration initialized. +2024-07-19 09:19:34.9862 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-19 09:19:35.0109 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-19 09:19:35.0109 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-19 09:19:35.0305 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-19 09:19:35.0305 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-19 09:19:35.0377 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-19 09:19:35.0377 Info Configuration initialized. +2024-07-19 11:24:38.2652 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-19 11:24:38.3020 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-19 11:24:38.3075 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-19 11:24:38.3254 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-19 11:24:38.3374 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-19 11:24:38.3374 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-19 11:24:38.3504 Info Configuration initialized. +2024-07-19 11:27:23.3357 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-19 11:27:23.3822 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-19 11:27:23.3822 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-19 11:27:23.4045 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-19 11:27:23.4121 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-19 11:27:23.4121 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-19 11:27:23.4121 Info Configuration initialized. +2024-07-19 11:29:46.6648 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-19 11:29:46.7253 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-19 11:29:46.7253 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-19 11:29:46.7540 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-19 11:29:46.7654 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-19 11:29:46.7654 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-19 11:29:46.7776 Info Configuration initialized. +2024-07-19 11:38:32.6478 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-19 11:38:32.7002 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-19 11:38:32.7002 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-19 11:38:32.7221 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-19 11:38:32.7304 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-19 11:38:32.7304 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-19 11:38:32.7425 Info Configuration initialized. +2024-07-19 13:37:25.8031 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-19 13:37:25.8405 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-19 13:37:25.8405 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-19 13:37:25.8681 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-19 13:37:25.8681 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-19 13:37:25.8681 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-19 13:37:25.8870 Info Configuration initialized. +2024-07-19 14:01:42.4487 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-19 14:01:42.5039 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-19 14:01:42.5083 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-19 14:01:42.5343 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-19 14:01:42.5458 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-19 14:01:42.5458 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-19 14:01:42.5666 Info Configuration initialized. +2024-07-19 14:25:22.8202 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-19 14:25:22.8617 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-19 14:25:22.8655 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-19 14:25:22.8655 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-19 14:25:22.8868 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-19 14:25:22.8868 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-19 14:25:22.8975 Info Configuration initialized. +2024-07-19 14:27:52.9955 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-19 14:27:53.0208 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-19 14:27:53.0461 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-19 14:27:53.0592 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-19 14:27:53.0592 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-19 14:27:53.0708 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-19 14:27:53.0708 Info Configuration initialized. +2024-07-19 14:43:21.1470 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-19 14:43:21.1798 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-19 14:43:21.1798 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-19 14:43:21.2084 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-19 14:43:21.2164 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-19 14:43:21.2164 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-19 14:43:21.2269 Info Configuration initialized. +2024-07-19 14:51:05.4318 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-19 14:51:05.4863 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-19 14:51:05.4931 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-19 14:51:05.5167 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-19 14:51:05.5309 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-19 14:51:05.5309 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-19 14:51:05.5439 Info Configuration initialized. +2024-07-19 14:54:06.9457 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-19 14:54:07.0147 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-19 14:54:07.0147 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-19 14:54:07.0368 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-19 14:54:07.0481 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-19 14:54:07.0560 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-19 14:54:07.0686 Info Configuration initialized. +2024-07-19 15:00:10.8049 Info Registered target NLog.Targets.FileTarget(Name=allfile) +2024-07-19 15:00:10.8635 Info Registered target NLog.Targets.FileTarget(Name=ownFile-web) +2024-07-19 15:00:10.8694 Info Registered target NLog.Targets.ColoredConsoleTarget(Name=console) +2024-07-19 15:00:10.8886 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-19 15:00:10.8983 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-19 15:00:10.8983 Warn Unused target detected. Add a rule for this target to the configuration. TargetName: allfile +2024-07-19 15:00:10.8983 Info Configuration initialized. From ee4e65033bca5d6938b3b08e09ec3e63549f1719 Mon Sep 17 00:00:00 2001 From: cjy Date: Fri, 19 Jul 2024 17:11:26 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=89=93=E5=8D=B0=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E6=B7=BB=E5=8A=A0=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=BC=96=E7=A0=81=E5=8F=8A=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.Module.OcrModule.csproj | 14 ++ .../DS.Module.OcrModule/IOcrService.cs | 14 ++ .../DS.Module.OcrModule/OcrService.cs | 13 ++ .../DS.WMS.Core/Sys/Dtos/SysPrintModuleRes.cs | 6 + .../Sys/Dtos/SysPrintTemplateReq.cs | 7 + .../Sys/Dtos/SysPrintTemplateRes.cs | 5 + .../Sys/Entity/SysPrintTemplate.cs | 6 + .../Sys/Interface/ISysPrintTemplateService.cs | 13 ++ .../Sys/Method/SysPrintTemplateService.cs | 27 ++++ .../Controllers/PrintController.cs | 145 ++++++++++-------- ds-wms-service/ds-wms-service.sln | 9 +- 11 files changed, 197 insertions(+), 62 deletions(-) create mode 100644 ds-wms-service/DS.Module.OcrModule/DS.Module.OcrModule.csproj create mode 100644 ds-wms-service/DS.Module.OcrModule/IOcrService.cs create mode 100644 ds-wms-service/DS.Module.OcrModule/OcrService.cs diff --git a/ds-wms-service/DS.Module.OcrModule/DS.Module.OcrModule.csproj b/ds-wms-service/DS.Module.OcrModule/DS.Module.OcrModule.csproj new file mode 100644 index 00000000..b3971ede --- /dev/null +++ b/ds-wms-service/DS.Module.OcrModule/DS.Module.OcrModule.csproj @@ -0,0 +1,14 @@ + + + + net8.0 + enable + enable + + + + + + + + diff --git a/ds-wms-service/DS.Module.OcrModule/IOcrService.cs b/ds-wms-service/DS.Module.OcrModule/IOcrService.cs new file mode 100644 index 00000000..bc82c6ad --- /dev/null +++ b/ds-wms-service/DS.Module.OcrModule/IOcrService.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.Module.OcrModule +{ + public interface IOcrService + { + + //public Task> + } +} diff --git a/ds-wms-service/DS.Module.OcrModule/OcrService.cs b/ds-wms-service/DS.Module.OcrModule/OcrService.cs new file mode 100644 index 00000000..95d16736 --- /dev/null +++ b/ds-wms-service/DS.Module.OcrModule/OcrService.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace DS.Module.OcrModule +{ + public class OcrService: IOcrService + { + + } +} diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/SysPrintModuleRes.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/SysPrintModuleRes.cs index 98762564..4dc3c1a5 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Dtos/SysPrintModuleRes.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/SysPrintModuleRes.cs @@ -51,5 +51,11 @@ namespace DS.WMS.Core.Sys.Dtos /// [Description("创建人名称")] public string CreateUserName { get; set; } + + + /// + /// 模板数量 + /// + public int TemplateCount { get; set; } } } diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/SysPrintTemplateReq.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/SysPrintTemplateReq.cs index 1fae40ec..eca7207d 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Dtos/SysPrintTemplateReq.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/SysPrintTemplateReq.cs @@ -23,6 +23,11 @@ namespace DS.WMS.Core.Sys.Dtos /// public long ModuleId { get; set; } /// + ///打印模板唯一编码 + /// + [Description("打印模板唯一编码")] + public string TemplateCode { get; set; } + /// ///打印模板名称 /// [Description("打印模板名称")] @@ -97,6 +102,8 @@ namespace DS.WMS.Core.Sys.Dtos { this.RuleFor(o => o.TemplateName) .NotEmpty().WithName("打印模板名称"); + this.RuleFor(o => o.TemplateCode) + .NotEmpty().WithName("打印模板唯一编码"); this.RuleFor(o => o.PrintType) .NotEmpty().WithName("打印类型"); } diff --git a/ds-wms-service/DS.WMS.Core/Sys/Dtos/SysPrintTemplateRes.cs b/ds-wms-service/DS.WMS.Core/Sys/Dtos/SysPrintTemplateRes.cs index fee65f5a..87d62a9f 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Dtos/SysPrintTemplateRes.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Dtos/SysPrintTemplateRes.cs @@ -23,6 +23,11 @@ namespace DS.WMS.Core.Sys.Dtos /// public long ModuleId { get; set; } /// + ///打印模板唯一编码 + /// + [Description("打印模板唯一编码")] + public string TemplateCode { get; set; } + /// ///打印模板名称 /// [Description("打印模板名称")] diff --git a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysPrintTemplate.cs b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysPrintTemplate.cs index 150edd1b..c3815ae2 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Entity/SysPrintTemplate.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Entity/SysPrintTemplate.cs @@ -15,6 +15,12 @@ public class SysPrintTemplate : BaseTenantModel [SqlSugar.SugarColumn(ColumnDescription = "打印模块Id", IsNullable = false, DefaultValue = "0")] public long ModuleId { get; set; } /// + ///打印模板唯一编码 + /// + [Description("打印模板唯一编码")] + [SqlSugar.SugarColumn(ColumnDescription = "打印模板唯一编码", IsNullable = false, Length = 50)] + public string TemplateCode { get; set; } + /// ///打印模板名称 /// [Description("打印模板名称")] diff --git a/ds-wms-service/DS.WMS.Core/Sys/Interface/ISysPrintTemplateService.cs b/ds-wms-service/DS.WMS.Core/Sys/Interface/ISysPrintTemplateService.cs index bfeab469..9367ec22 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Interface/ISysPrintTemplateService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Interface/ISysPrintTemplateService.cs @@ -60,5 +60,18 @@ namespace DS.WMS.Core.Sys.Interface /// /// public DataResult BatchDelPrintModule(IdModel req); + + + /// + /// 打印模块列表 + /// + /// + public Task>> GetOpenPrintModuleList(); + + /// + /// 打印模板列表 + /// + /// + public Task>> GetOpenPrintTemplateList(string id); } } diff --git a/ds-wms-service/DS.WMS.Core/Sys/Method/SysPrintTemplateService.cs b/ds-wms-service/DS.WMS.Core/Sys/Method/SysPrintTemplateService.cs index b805d936..77453c7a 100644 --- a/ds-wms-service/DS.WMS.Core/Sys/Method/SysPrintTemplateService.cs +++ b/ds-wms-service/DS.WMS.Core/Sys/Method/SysPrintTemplateService.cs @@ -10,6 +10,8 @@ using DS.Module.Core.Extensions; using DS.Module.Core.Data; using DS.Module.SqlSugar; using DS.WMS.Core.Code.Entity; +using Org.BouncyCastle.Ocsp; +using System.Collections.Generic; namespace DS.WMS.Core.Sys.Method { @@ -98,6 +100,11 @@ namespace DS.WMS.Core.Sys.Method { if (req.Id == 0) { + var isExist = db.Queryable().Where(x => x.TemplateCode == req.TemplateCode).First(); + if (isExist != null) + { + return DataResult.Failed("打印模板唯一编码已存在!"); + } var data = req.Adapt(); var entity = db.Insertable(data).ExecuteReturnEntity(); @@ -136,5 +143,25 @@ namespace DS.WMS.Core.Sys.Method } return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess); } + + public async Task>> GetOpenPrintModuleList() + { + var data = await db.Queryable().Where(x=>x.Disable == false) + .Select() + .Mapper(async it => + { + it.TemplateCount = await db.Queryable().Where(x => x.ModuleId == it.Id && x.Disable == false).CountAsync(); + } ) + .ToListAsync(); + return await Task.FromResult(DataResult>.Success(data)); + } + + public async Task>> GetOpenPrintTemplateList(string id) + { + var data = await db.Queryable().Where(x => x.Disable == false && x.ModuleId == long.Parse(id)) + .Select() + .ToListAsync(); + return await Task.FromResult(DataResult>.Success(data)); + } } } diff --git a/ds-wms-service/DS.WMS.MainApi/Controllers/PrintController.cs b/ds-wms-service/DS.WMS.MainApi/Controllers/PrintController.cs index a79d4a95..b8bdf807 100644 --- a/ds-wms-service/DS.WMS.MainApi/Controllers/PrintController.cs +++ b/ds-wms-service/DS.WMS.MainApi/Controllers/PrintController.cs @@ -5,6 +5,8 @@ using DS.Module.ExcelModule; using DS.Module.ExcelModule.Model; using DS.Module.PrintModule; using DS.WMS.Core.Code.Interface; +using DS.WMS.Core.Sys.Dtos; +using DS.WMS.Core.Sys.Interface; using LanguageExt.Common; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; @@ -17,78 +19,78 @@ namespace DS.WMS.MainApi.Controllers /// public class PrintController : ApiController { - private readonly IPrintService _invokeService; + private readonly ISysPrintTemplateService _invokeService; /// /// 构造函数 /// /// - public PrintController(IPrintService invokeService) + public PrintController(ISysPrintTemplateService invokeService) { _invokeService = invokeService; } - /// - /// 获取打印模块列表 - /// - /// - [HttpGet] - [Route("GetOpenPrintModuleList")] - [Obsolete] - public DataResult GetOpenPrintModuleList() - { - return _invokeService.GetOpenPrintModuleList(); - } + ///// + ///// 获取打印模块列表 + ///// + ///// + //[HttpGet] + //[Route("GetOpenPrintModuleList")] + //[Obsolete] + //public DataResult GetOpenPrintModuleList() + //{ + // return _invokeService.GetOpenPrintModuleList(); + //} - /// - /// 获取打印模板列表 - /// - /// - [HttpGet] - [Route("GetOpenPrintTemplateList")] - [Obsolete] - public DataResult GetOpenPrintTemplateList([FromQuery] string id) - { - return _invokeService.GetOpenPrintTemplateList(id); - } + ///// + ///// 获取打印模板列表 + ///// + ///// + //[HttpGet] + //[Route("GetOpenPrintTemplateList")] + //[Obsolete] + //public DataResult GetOpenPrintTemplateList([FromQuery] string id) + //{ + // return _invokeService.GetOpenPrintTemplateList(id); + //} - /// - /// 获取打印模板列表-异步 - /// - /// - [HttpGet] - [Obsolete] - [Route("GetOpenPrintTemplateListAsync")] - public async Task GetOpenPrintTemplateListAsync([FromQuery] string id) - { - return await _invokeService.GetOpenPrintTemplateListAsync(id); - } - /// - /// 获取Json打印信息 - /// - /// - /// - [HttpPost] - [Obsolete] - [Route("GetOpenJsonPrintInfo")] - public DataResult GetOpenJsonPrintInfo([FromBody] OpenJsonPrintReq req) - { - var res =_invokeService.GetOpenJsonPrintInfo(req); - return res; - } - /// - /// 获取Json打印信息-异步 - /// - /// - /// - [HttpPost] - [Obsolete] - [Route("GetOpenJsonPrintInfoAsync")] - public async Task GetOpenJsonPrintInfoAsync([FromBody] OpenJsonPrintReq req) - { - var res = await _invokeService.GetOpenJsonPrintInfoAsync(req); - return res; - } + ///// + ///// 获取打印模板列表-异步 + ///// + ///// + //[HttpGet] + //[Obsolete] + //[Route("GetOpenPrintTemplateListAsync")] + //public async Task GetOpenPrintTemplateListAsync([FromQuery] string id) + //{ + // return await _invokeService.GetOpenPrintTemplateListAsync(id); + //} + ///// + ///// 获取Json打印信息 + ///// + ///// + ///// + //[HttpPost] + //[Obsolete] + //[Route("GetOpenJsonPrintInfo")] + //public DataResult GetOpenJsonPrintInfo([FromBody] OpenJsonPrintReq req) + //{ + // var res =_invokeService.GetOpenJsonPrintInfo(req); + // return res; + //} + ///// + ///// 获取Json打印信息-异步 + ///// + ///// + ///// + //[HttpPost] + //[Obsolete] + //[Route("GetOpenJsonPrintInfoAsync")] + //public async Task GetOpenJsonPrintInfoAsync([FromBody] OpenJsonPrintReq req) + //{ + // var res = await _invokeService.GetOpenJsonPrintInfoAsync(req); + // return res; + //} ///// ///// 获取Json打印信息Stream ///// @@ -128,7 +130,28 @@ namespace DS.WMS.MainApi.Controllers // } //} + /// + /// 获取打印模块列表 + /// + /// + [HttpGet] + [Route("GetOpenPrintModuleList")] + public async Task>> GetOpenPrintModuleList() + { + return await _invokeService.GetOpenPrintModuleList(); + } + + /// + /// 获取打印模板列表 + /// + /// + [HttpGet] + [Route("GetOpenPrintTemplateList")] + public async Task>> GetOpenPrintTemplateList([FromQuery]string id) + { + return await _invokeService.GetOpenPrintTemplateList(id); + } /// /// 获取Json本地打印信息 /// diff --git a/ds-wms-service/ds-wms-service.sln b/ds-wms-service/ds-wms-service.sln index 17bf9ba3..7994ebf3 100644 --- a/ds-wms-service/ds-wms-service.sln +++ b/ds-wms-service/ds-wms-service.sln @@ -63,7 +63,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.WMS.TaskApi", "DS.WMS.Ta EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.Module.EmailModule", "DS.Module.EmailModule\DS.Module.EmailModule.csproj", "{4B51DCC1-62A5-49C5-978B-798E6B48F3C0}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS.WMS.PrintApi", "DS.WMS.PrintApi\DS.WMS.PrintApi.csproj", "{274B1D18-A15A-4917-A567-6FDCD090D5B0}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DS.WMS.PrintApi", "DS.WMS.PrintApi\DS.WMS.PrintApi.csproj", "{274B1D18-A15A-4917-A567-6FDCD090D5B0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DS.Module.OcrModule", "DS.Module.OcrModule\DS.Module.OcrModule.csproj", "{3EB9CA1E-5910-42A5-A64D-0CB435F6A64A}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -183,6 +185,10 @@ Global {274B1D18-A15A-4917-A567-6FDCD090D5B0}.Debug|Any CPU.Build.0 = Debug|Any CPU {274B1D18-A15A-4917-A567-6FDCD090D5B0}.Release|Any CPU.ActiveCfg = Release|Any CPU {274B1D18-A15A-4917-A567-6FDCD090D5B0}.Release|Any CPU.Build.0 = Release|Any CPU + {3EB9CA1E-5910-42A5-A64D-0CB435F6A64A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3EB9CA1E-5910-42A5-A64D-0CB435F6A64A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3EB9CA1E-5910-42A5-A64D-0CB435F6A64A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3EB9CA1E-5910-42A5-A64D-0CB435F6A64A}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -216,6 +222,7 @@ Global {8DAE16A3-E249-4C86-BEEC-DA8429FD837C} = {65D75DB2-12D5-4D1F-893D-9750905CE5E4} {4B51DCC1-62A5-49C5-978B-798E6B48F3C0} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} {274B1D18-A15A-4917-A567-6FDCD090D5B0} = {65D75DB2-12D5-4D1F-893D-9750905CE5E4} + {3EB9CA1E-5910-42A5-A64D-0CB435F6A64A} = {518DB9B5-80A8-4B2C-8570-52BD406458DE} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {66115F23-94B4-43C0-838E-33B5CF77F788}