From 112597380821753a4390c10baae751d6805c3489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B5=87=E6=96=87=E9=BE=99?= Date: Thu, 7 Nov 2024 11:24:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E7=A5=A8=E6=94=AF=E6=8C=81=E5=8F=8C?= =?UTF-8?q?=E5=B8=81=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DS.WMS.Core/Invoice/Dtos/RequestItem.cs | 5 --- .../Invoice/Method/InvoiceService`1.cs | 38 +++++++------------ .../Method/ApplicationTaskService.cs | 30 +++++++-------- 3 files changed, 29 insertions(+), 44 deletions(-) diff --git a/ds-wms-service/DS.WMS.Core/Invoice/Dtos/RequestItem.cs b/ds-wms-service/DS.WMS.Core/Invoice/Dtos/RequestItem.cs index 1eb66b74..2cb23bbb 100644 --- a/ds-wms-service/DS.WMS.Core/Invoice/Dtos/RequestItem.cs +++ b/ds-wms-service/DS.WMS.Core/Invoice/Dtos/RequestItem.cs @@ -10,11 +10,6 @@ /// public long ApplicationId { get; set; } - /// - /// 发票申请币别 - /// - public string Currency { get; set; } - /// /// 本次RMB开票金额 /// 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 16ed527e..99591676 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 @@ -316,32 +316,20 @@ namespace DS.WMS.Core.Invoice.Method Currency = invoice.Currency, OriginalCurrency = item.Currency, ApplyAmount = item.ApplyAmount - item.ProcessedAmount, - OriginalAmount = item.OriginalAmount - item.OriginalProcessedAmount + OriginalAmount = item.OriginalAmount - item.OriginalProcessedAmount, + ExchangeRate = 1 }; var app = request.Applications.Find(x => x.ApplicationId == item.ApplicationId); - if (app != null) + if (app != null) //设置汇率 { - if (app.Currency == invoice.Currency) + var er = app.ExchangeRates?.FirstOrDefault(x => x.Currency == detail.OriginalCurrency); + if (er != null) { - detail.ExchangeRate = 1m; - } - else if (string.IsNullOrEmpty(app.Currency)) //原币申请 - { - detail.ExchangeRate = app.ExchangeRates.FirstOrDefault(x => x.Currency == item.Currency)?.ExchangeRate; - } - else - { - detail.ExchangeRate = app.ExchangeRates.FirstOrDefault(x => x.Currency == invoice.Currency)?.ExchangeRate; + detail.ExchangeRate = er.ExchangeRate; } } - if (!detail.ExchangeRate.HasValue) - detail.ExchangeRate = 1m; - - if (detail.ExchangeRate.HasValue) - detail.ApplyAmount *= detail.ExchangeRate.Value; - invoice.Details.Add(detail); } @@ -598,20 +586,22 @@ namespace DS.WMS.Core.Invoice.Method if (invoiceAmount == 0) return DataResult.Failed("开票金额不能为零"); - var totalRMB = details.Sum(x => x.ApplyAmount); - if (Math.Abs(invoiceAmount) > totalRMB) + var totalAmount = details.Sum(x => x.OriginalAmount); + if (Math.Abs(invoiceAmount) > totalAmount) return DataResult.Failed("申请开票金额不能大于剩余开票金额"); - if (totalRMB != invoiceAmount) //非全额开票 + if (totalAmount != invoiceAmount) //非全额开票 { - var rest = totalRMB - invoiceAmount; + var rest = totalAmount - invoiceAmount; foreach (var detail in details) { if (rest == 0) break; - detail.ApplyAmount = detail.ApplyAmount - rest; - rest = detail.ApplyAmount - rest; + detail.OriginalAmount = detail.OriginalAmount - rest; + rest = detail.OriginalAmount - rest; + + detail.ApplyAmount = detail.OriginalAmount * detail.ExchangeRate.GetValueOrDefault(); } } diff --git a/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/ApplicationTaskService.cs b/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/ApplicationTaskService.cs index 5ddac3ee..6cdf234c 100644 --- a/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/ApplicationTaskService.cs +++ b/ds-wms-service/DS.WMS.Core/TaskInteraction/Method/ApplicationTaskService.cs @@ -34,12 +34,12 @@ namespace DS.WMS.Core.TaskInteraction.Method DataResult result = DataResult.Success; var tasks = tasksList.FindAll(x => x.TaskStatus == TaskStatusEnum.Create); - var task2 = tasksList.FindAll(x => x.TaskStatus == TaskStatusEnum.Complete); + //var task2 = tasksList.FindAll(x => x.TaskStatus == TaskStatusEnum.Complete); await TenantDb.Ado.BeginTranAsync(); try { //状态待审核的任务 - if (tasks.Count > 0) + if (tasksList.Count > 0) { var flowIds = tasks.Select(x => x.FlowId.Value); var flowInstances = await Db.Queryable().Where(x => flowIds.Contains(x.Id)).ToListAsync(); @@ -72,21 +72,21 @@ namespace DS.WMS.Core.TaskInteraction.Method } } - //已完成审核的任务 - if (task2.Count > 0) - { - switch (request.TaskType) - { - case TaskBaseTypeEnum.APPLICATION_PAYMENT_AUDIT: - break; + ////已完成审核的任务 + //if (task2.Count > 0) + //{ + // switch (request.TaskType) + // { + // case TaskBaseTypeEnum.APPLICATION_PAYMENT_AUDIT: + // break; - case TaskBaseTypeEnum.APPLICATION_INVOICE_AUDIT: - break; + // case TaskBaseTypeEnum.APPLICATION_INVOICE_AUDIT: + // break; - default: - return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); - } - } + // default: + // return DataResult.FailedWithDesc(nameof(MultiLanguageConst.Operation_Failed)); + // } + //} await TenantDb.Ado.CommitTranAsync(); return result;