From f70cb44257527142942c805854ff75a195393974 Mon Sep 17 00:00:00 2001 From: mahao Date: Mon, 7 Aug 2023 09:44:30 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=BC=E5=85=A5=E8=BF=94?= =?UTF-8?q?=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Constant/ApplicationConsts.cs | 11 ++++++- .../Entities/BQ/BBAC_SA_SERVICE.cs | 7 ++-- .../Entities/BQ/HBPO_SA_SERVICE.cs | 7 ++-- .../Entities/BQ/PUB_SA_SERVICE.cs | 33 +++++++++++-------- .../Entities/BQ/PURCHASE_PRICE_SERVICE.cs | 13 ++++---- .../BQ/TB_RePartsRelationship_SERVICE.cs | 7 ++-- .../CodeSettingAppService.cs | 6 ++-- .../MaterialRelationshipAppService.cs | 8 +++-- .../Entities/Prices/PriceListAppService.cs | 7 ++-- .../Entities/Prices/PriceListAppServiceBJ.cs | 7 ++-- 10 files changed, 64 insertions(+), 42 deletions(-) diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Constant/ApplicationConsts.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Constant/ApplicationConsts.cs index b2e81f87..dfac17d6 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Constant/ApplicationConsts.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Constant/ApplicationConsts.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -112,6 +112,15 @@ namespace Win.Sfs.SettleAccount.Constant /// public const string SuccessStr = "Success"; + /// + /// Success + /// + public const int SuccessCode = 200; + + /// + /// 导入失败Code + /// + public const int ImportFailCode = 400; /// /// FIS发出未结算输出表 diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs index d0cac882..f9802711 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/BBAC_SA_SERVICE.cs @@ -109,7 +109,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase /// 导入 /// [HttpPost] - public async Task ImportAsync([FromForm] IFormFileCollection files) + public async Task ImportAsync([FromForm] IFormFileCollection files) { #region 导入数据转换、数据校验 ExportImporter _exportImporter = new ExportImporter(); @@ -138,7 +138,8 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase if (checkList.Count > 0) { - return await ExportErrorReportAsync(checkList); + string fileName = await ExportErrorReportAsync(checkList); + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); } #endregion @@ -147,7 +148,7 @@ public class BBAC_SA_SERVICE : SettleAccountApplicationBase //await SaDataHandleAsync(importBBACSaDetails); } - return ApplicationConsts.SuccessStr; + return new JsonResult(new { Code = 200, Message = "导入成功" }); } #endregion diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs index 317f2f88..d5fe29d0 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/HBPO_SA_SERVICE.cs @@ -108,7 +108,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase /// 导入 /// [HttpPost] - public async Task ImportAsync([FromForm] IFormFileCollection files) + public async Task ImportAsync([FromForm] IFormFileCollection files) { #region 导入数据转换、数据校验 ExportImporter _exportImporter = new ExportImporter(); @@ -136,7 +136,8 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase if (checkList.Count > 0) { - return await ExportErrorReportAsync(checkList); + string fileName = await ExportErrorReportAsync(checkList); + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); } #endregion @@ -149,7 +150,7 @@ public class HBPO_SA_SERVICE : SettleAccountApplicationBase await SaDataHandleAsync(importCN5HBOPSaDetails, "CN5"); } - return ApplicationConsts.SuccessStr; + return new JsonResult(new { Code = 200, Message = "导入成功" }); } #endregion diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs index 76829264..975fcefe 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PUB_SA_SERVICE.cs @@ -107,9 +107,9 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase /// 导入 /// [HttpPost] - public async Task ImportByBusinessTypeAsync([FromForm] PUB_SAImportRequestDto pubSaImportRequestDto) + public async Task ImportByBusinessTypeAsync([FromForm] PUB_SAImportRequestDto pubSaImportRequestDto) { - string result = string.Empty; + IActionResult result = new JsonResult(null); switch (pubSaImportRequestDto.BusinessType) { case EnumBusinessType.None: @@ -428,7 +428,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase /// /// 直供件BBAC导入 /// - private async Task ImportZhiGongJianBBACAsync([FromForm] IFormFileCollection files) + private async Task ImportZhiGongJianBBACAsync([FromForm] IFormFileCollection files) { #region 导入数据转换 ExportImporter _exportImporter = new ExportImporter(); @@ -440,7 +440,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase var checkList = await CheckAsync(importPubSaDetails); if (checkList.Count > 0) { - return await ExportErrorReportAsync(checkList); + string fileName = await ExportErrorReportAsync(checkList); + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); } #endregion @@ -450,7 +451,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase /// /// 直供件HBPO导入 /// - private async Task ImportZhiGongJianHBPOAsync([FromForm] IFormFileCollection files) + private async Task ImportZhiGongJianHBPOAsync([FromForm] IFormFileCollection files) { #region 导入数据转换 ExportImporter _exportImporter = new ExportImporter(); @@ -469,7 +470,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase var checkList = await CheckAsync(importPubSaDetails); if (checkList.Count > 0) { - return await ExportErrorReportAsync(checkList); + string fileName = await ExportErrorReportAsync(checkList); + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); } #endregion @@ -479,7 +481,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase /// /// 买单件HBPO导入 /// - private async Task ImportMaiDanJianHBPOAsync([FromForm] IFormFileCollection files) + private async Task ImportMaiDanJianHBPOAsync([FromForm] IFormFileCollection files) { #region 导入数据转换 ExportImporter _exportImporter = new ExportImporter(); @@ -497,7 +499,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase var checkList = await CheckAsync(importPubSaDetails); if (checkList.Count > 0) { - return await ExportErrorReportAsync(checkList); + string fileName = await ExportErrorReportAsync(checkList); + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); } #endregion @@ -507,7 +510,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase /// /// 备件导入 /// - private async Task ImportBeiJianAsync([FromForm] IFormFileCollection files) + private async Task ImportBeiJianAsync([FromForm] IFormFileCollection files) { #region 导入数据转换 ExportImporter _exportImporter = new ExportImporter(); @@ -525,7 +528,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase var checkList = await CheckAsync(importPubSaDetails); if (checkList.Count > 0) { - return await ExportErrorReportAsync(checkList); + string fileName = await ExportErrorReportAsync(checkList); + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); } #endregion @@ -535,7 +539,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase /// /// 印度件导入 /// - private async Task ImportYinDuJianAsync([FromForm] IFormFileCollection files) + private async Task ImportYinDuJianAsync([FromForm] IFormFileCollection files) { #region 导入数据转换 ExportImporter _exportImporter = new ExportImporter(); @@ -547,7 +551,8 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase var checkList = await CheckAsync(importPubSaDetails); if (checkList.Count > 0) { - return await ExportErrorReportAsync(checkList); + string fileName = await ExportErrorReportAsync(checkList); + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); } #endregion @@ -580,7 +585,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase /// /// 结算数据处理 /// - private async Task SaDataHandleAsync(List pubSaDetails, EnumBusinessType businessType) + private async Task SaDataHandleAsync(List pubSaDetails, EnumBusinessType businessType) { //客户零件关系 var materialRelationships = new List(); @@ -636,7 +641,7 @@ public class PUB_SA_SERVICE : SettleAccountApplicationBase } #endregion - return ApplicationConsts.SuccessStr; + return new JsonResult(new { Code = 200, Message = "导入成功" }); } /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs index 279f5878..cd39e8ee 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/PURCHASE_PRICE_SERVICE.cs @@ -48,7 +48,7 @@ public class PURCHASE_PRICE_SERVICE : SettleAccountApplicationBase [HttpPost] - public async Task ImportAsync([FromForm] IFormFileCollection files) + public async Task ImportAsync([FromForm] IFormFileCollection files) { ExportImporter _exportImporter = new ExportImporter(); var result = await _exportImporter.UploadExcelImport(files, _excelImportService); @@ -68,6 +68,11 @@ public class PURCHASE_PRICE_SERVICE : SettleAccountApplicationBase 0) + { + string fileName = await ExportErrorReportAsync(checkList); + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); + } foreach (var itm in _ls) { var _first = _repository.FirstOrDefault(p => p.LU == itm.LU); @@ -81,11 +86,7 @@ public class PURCHASE_PRICE_SERVICE : SettleAccountApplicationBase 0) - { - return await ExportErrorReportAsync(checkList); - } - return ApplicationConsts.SuccessStr; + return new JsonResult(new { Code = 200, Message = "导入成功" }); } /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/TB_RePartsRelationship_SERVICE.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/TB_RePartsRelationship_SERVICE.cs index d592dd9e..b40a9378 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/TB_RePartsRelationship_SERVICE.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/BQ/TB_RePartsRelationship_SERVICE.cs @@ -58,7 +58,7 @@ public class TB_RePartsRelationship_SERVICE : SettleAccountApplicationBase [HttpPost] - public async Task ImportAsync([FromForm] IFormFileCollection files) + public async Task ImportAsync([FromForm] IFormFileCollection files) { ExportImporter _exportImporter = new ExportImporter(); var result = await _exportImporter.UploadExcelImport(files, _excelImportService); @@ -91,7 +91,8 @@ public class TB_RePartsRelationship_SERVICE : SettleAccountApplicationBase 0) { - return await ExportErrorReportAsync(checkList); + string fileName = await ExportErrorReportAsync(checkList); + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); } foreach (var itm in _ls) { @@ -106,7 +107,7 @@ public class TB_RePartsRelationship_SERVICE : SettleAccountApplicationBase diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/CodeSettingTables/CodeSettingAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/CodeSettingTables/CodeSettingAppService.cs index 7b60b55e..7dc40219 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/CodeSettingTables/CodeSettingAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/CodeSettingTables/CodeSettingAppService.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Linq; @@ -65,7 +65,7 @@ namespace Win.Sfs.SettleAccount.Entities.CodeSettingTables /// [HttpPost] [DisableRequestSizeLimit] - public async Task CodeSettingUploadExcelImport([FromForm] IFormFileCollection files) + public async Task CodeSettingUploadExcelImport([FromForm] IFormFileCollection files) { ExportImporter _exportImporter = new ExportImporter(); var result = await _exportImporter.UploadExcelImport(files, _excelImportService); @@ -87,7 +87,7 @@ namespace Win.Sfs.SettleAccount.Entities.CodeSettingTables } var bulkConfig = new BulkConfig { SetOutputIdentity = true, BatchSize = 10000 }; //_repository.GetDbContext().BulkInsert(_ls, bulkConfig); - return ApplicationConsts.SuccessStr; + return new JsonResult(new { Code = 200, Message = "导入成功" }); } /// diff --git a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs index b3dcc89a..d62f87a5 100644 --- a/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs +++ b/code/src/Modules/SettleAccount/src/SettleAccount.Application/Entities/MaterialRelationships/MaterialRelationshipAppService.cs @@ -10,6 +10,7 @@ using Volo.Abp.Application.Dtos; using Volo.Abp.Caching; using Win.Abp.Snowflakes; using Win.Sfs.BaseData.ImportExcelCommon; +using Win.Sfs.SettleAccount.Bases; using Win.Sfs.SettleAccount.CommonManagers; using Win.Sfs.SettleAccount.Constant; using Win.Sfs.SettleAccount.Entities.BQ.Dtos; @@ -51,7 +52,7 @@ public class MaterialRelationshipAppService : SettleAccountApplicationBase [HttpPost] - public async Task ImportAsync([FromForm] MaterialRelationshipImportRequestDto materialRelationshipImportRequestDto) + public async Task ImportAsync([FromForm] MaterialRelationshipImportRequestDto materialRelationshipImportRequestDto) { ExportImporter _exportImporter = new ExportImporter(); var result = await _exportImporter.UploadExcelImport(materialRelationshipImportRequestDto.Files, _excelImportService); @@ -73,7 +74,8 @@ public class MaterialRelationshipAppService : SettleAccountApplicationBase 0) { - return await ExportErrorReportAsync(checkList); + string fileName = await ExportErrorReportAsync(checkList); + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); } foreach (var itm in _ls) { @@ -90,7 +92,7 @@ public class MaterialRelationshipAppService : SettleAccountApplicationBase 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 64166057..9df9f0f6 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 @@ -70,7 +70,7 @@ public class PriceListAppService : SettleAccountApplicationBase /// 导入 /// [HttpPost] - public virtual async Task ImportAsync([FromForm] IFormFileCollection files, string version) + public virtual async Task ImportAsync([FromForm] IFormFileCollection files, string version) { var checkList = new List(); ExportImporter _exportImporter = new ExportImporter(); @@ -100,7 +100,8 @@ public class PriceListAppService : SettleAccountApplicationBase } if (checkList.Count > 0) { - return await ExportErrorReportAsync(checkList); + string fileName = await ExportErrorReportAsync(checkList); + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); } #endregion @@ -110,7 +111,7 @@ public class PriceListAppService : SettleAccountApplicationBase } await _priceListManager.ImportAsync(entityList.ToList(), version); - return ApplicationConsts.SuccessStr; + return new JsonResult(new { Code = 200, Message = "导入成功" }); } /// 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 f1521726..f79dd504 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 @@ -48,7 +48,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices /// 导入 /// [HttpPost] - public async Task ImportAsync([FromForm] IFormFileCollection files, string version) + public async Task ImportAsync([FromForm] IFormFileCollection files, string version) { var checkList = new List(); ExportImporter _exportImporter = new ExportImporter(); @@ -79,7 +79,8 @@ namespace Win.Sfs.SettleAccount.Entities.Prices } if (checkList.Count > 0) { - return await ExportErrorReportAsync(checkList); + string fileName = await ExportErrorReportAsync(checkList); + return new JsonResult(new { Code = ApplicationConsts.ImportFailCode, fileName = fileName }); } #endregion @@ -89,7 +90,7 @@ namespace Win.Sfs.SettleAccount.Entities.Prices } await _priceListManagerBJ.ImportAsync(entityList, version); - return ApplicationConsts.SuccessStr; + return new JsonResult(new { Code = 200, Message = "导入成功" }); } ///