From b5e9917ef2c728548a101bf94495328c767d9abe Mon Sep 17 00:00:00 2001 From: zhouhongjun <565221961@qq.com> Date: Mon, 8 Jul 2024 10:08:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=B7=E6=A0=BC=E5=8D=95=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E5=BC=B9=E5=87=BA=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Entities/Prices/PriceListAppService.cs | 8 ++++++++ .../Entities/Prices/PriceListAppServiceBJ.cs | 9 +++++++++ .../Entities/Prices/PriceListAppServiceYinDu.cs | 8 ++++++++ 3 files changed, 25 insertions(+) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs index 948ac471..497acd31 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppService.cs @@ -152,6 +152,8 @@ namespace Win.Sfs.SettleAccount.Entities.Prices else { hasRepeat.IsCancel = false; + + checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, item.LU, string.Empty, $"零件号:{item.LU},与已存在合同签订时间、价格重复", string.Empty)); } } @@ -161,6 +163,12 @@ namespace Win.Sfs.SettleAccount.Entities.Prices await _settleAccountDbContext.BulkUpdateAsync(oldPrices).ConfigureAwait(false); await _settleAccountDbContext.BulkInsertAsync(newPriceNoRepeat).ConfigureAwait(false); await transaction.CommitAsync().ConfigureAwait(false); + + if (checkList.Count > 0) + { + var fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false); + return new JsonResult(new { code = ApplicationConsts.ImportFailCode, message = "导入失败", fileName }); + } } catch (Exception) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs index 66e36a83..54664e89 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceBJ.cs @@ -143,6 +143,8 @@ namespace Win.Sfs.SettleAccount.Entities.Prices else { hasRepeat.IsCancel = false; + + checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, item.LU, string.Empty, $"零件号:{item.LU},与已存在合同签订时间、价格重复", string.Empty)); } } @@ -152,6 +154,13 @@ namespace Win.Sfs.SettleAccount.Entities.Prices await _settleAccountDbContext.BulkUpdateAsync(oldPrices).ConfigureAwait(false); await _settleAccountDbContext.BulkInsertAsync(newPriceNoRepeat).ConfigureAwait(false); await transaction.CommitAsync().ConfigureAwait(false); + + if (checkList.Count > 0) + { + var fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false); + return new JsonResult(new { code = ApplicationConsts.ImportFailCode, message = "导入失败", fileName }); + } + } catch (Exception) { diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceYinDu.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceYinDu.cs index 708f692f..5aa2e3b0 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceYinDu.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/Prices/PriceListAppServiceYinDu.cs @@ -138,6 +138,8 @@ namespace Win.Sfs.SettleAccount.Entities.Prices else { hasRepeat.IsCancel = false; + + checkList.Add(new ErrorExportDto(string.Empty, string.Empty, string.Empty, string.Empty, item.LU, string.Empty, $"零件号:{item.LU},与已存在合同签订时间、价格重复", string.Empty)); } } @@ -147,6 +149,12 @@ namespace Win.Sfs.SettleAccount.Entities.Prices await _settleAccountDbContext.BulkUpdateAsync(oldPrices).ConfigureAwait(false); await _settleAccountDbContext.BulkInsertAsync(newPriceNoRepeat).ConfigureAwait(false); await transaction.CommitAsync().ConfigureAwait(false); + + if (checkList.Count > 0) + { + var fileName = await ExportErrorReportAsync(checkList).ConfigureAwait(false); + return new JsonResult(new { code = ApplicationConsts.ImportFailCode, message = "导入失败", fileName }); + } } catch (Exception) {