From 3ba0d0d4cad54b51525b35495714841fadf1b8f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A6=20=E8=B5=B5?= <89237069@qq.com> Date: Tue, 12 Sep 2023 15:10:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Bases/BA_SERVICE.cs | 12 ++++++++++++ .../Entities/BQ/BBAC_BA_SERVICE.cs | 16 ++++++---------- .../Entities/BQ/BBAC_CAN_SA_SERVICE.cs | 4 ++-- .../Entities/BQ/HBPO_BA_SERVICE.cs | 15 +++------------ .../Entities/BQ/PUB_BA_SERVICE.cs | 13 ++++++++----- 5 files changed, 31 insertions(+), 29 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs index 3b11a42c..3773b689 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Bases/BA_SERVICE.cs @@ -529,7 +529,19 @@ namespace Win.Sfs.SettleAccount.Bases + protected async Task> CheckRepeat(List p_list) + { + var errorlist = p_list.GroupBy(p => new { p.PN, p.LU }).Where(p => p.Count() > 1).Select(p => new { p.Key.PN, p.Key.LU }).ToList(); + + List errors = new List(); + + foreach (var itm in errorlist) + { + errors.Add(new ERR_EXP_DTO() { Message = $"零件号{itm.LU},标识号(生产码){itm.PN}有重复数据!" }); + } + return errors; + } diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs index d276bbe2..c32da713 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_BA_SERVICE.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.EntityFrameworkCore; +using NetTaste; using NPOI.HPSF; using SettleAccount.Domain.BQ; using System; @@ -225,19 +226,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ /// public virtual async Task ReissueInvoiceExtend(List p_list) { - var errorlist= p_list.GroupBy(p => new { p.PN, p.LU }).Where(p => p.Count() > 1).Select(p => new { p.Key.PN, p.Key.LU }).ToList(); - List errors = new List(); - foreach (var itm in errorlist) + var errorlist = await CheckRepeat(p_list); + if (errorlist.Count > 0) { - errors.Add(new ERR_EXP_DTO() { Message=$"零件号{itm.LU},标识号(生产码){itm.PN}有重复数据!" }); - } - - if (errors.Count > 0) - { - return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errors) }); - + + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errorlist) }); + } var adjlist = ObjectMapper.Map, List>(p_list); diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs index 35fb78db..a323f932 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_CAN_SA_SERVICE.cs @@ -82,9 +82,9 @@ namespace Win.Sfs.SettleAccount.Entities.BQ /// /// /// - - [HttpPost] [UnitOfWork(false)] + [HttpPost] + public async Task GenerateInvoice([FromBody] string invbillNum) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs index c8a59b3e..9fe32c0f 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_BA_SERVICE.cs @@ -183,20 +183,11 @@ namespace Win.Sfs.SettleAccount.Entities.BQ /// public virtual async Task ReissueInvoiceExtend(List p_list) { - var errorlist = p_list.GroupBy(p => new { p.PN, p.LU }).Where(p => p.Count() > 1).Select(p => new { p.Key.PN, p.Key.LU }).ToList(); - - List errors = new List(); - - foreach (var itm in errorlist) - { - errors.Add(new ERR_EXP_DTO() { Message = $"零件号{itm.LU},标识号(生产码){itm.PN}有重复数据!" }); - } - - if (errors.Count > 0) + var errorlist = await CheckRepeat(p_list); + if (errorlist.Count > 0) { - return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errors) }); + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errorlist) }); } - var adjlist = ObjectMapper.Map, List>(p_list); if (adjlist == null && adjlist.Count == 0) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs index 105083dc..e873e2ab 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_BA_SERVICE.cs @@ -60,6 +60,14 @@ namespace Win.Sfs.SettleAccount.Entities.BQ [UnitOfWork(false)] public virtual async Task ReissueInvoiceExtend(List p_list) { + var errorlist = await CheckRepeat(p_list); + if (errorlist.Count > 0) + { + + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, Message = "错误提示文件已下载,请打开文件查看", fileName = await ExportErrorReportAsync(errorlist) }); + + } + var first = p_list.FirstOrDefault(); var invbillnum = first.InvBillNum; @@ -173,11 +181,6 @@ namespace Win.Sfs.SettleAccount.Entities.BQ if (invbillnum.Substring(0, 3) == "INV")//一次开票重开 { await ReissueFirstInvoice(publist, adjlist, dtos, version, invbillnum); - - - - - } else//二次开票 {