From f15ba605e991c8aa8ae7804ed25ea58f2b4f0b5f Mon Sep 17 00:00:00 2001 From: Administrator Date: Mon, 15 Nov 2021 15:10:14 +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 --- .vs/VSWorkspaceState.json | 7 ++++ .../SettleAccountImportService.cs | 36 ++++++++++--------- 2 files changed, 26 insertions(+), 17 deletions(-) create mode 100644 .vs/VSWorkspaceState.json diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 00000000..fd5a9563 --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,7 @@ +{ + "ExpandedNodes": [ + "" + ], + "SelectedNode": "\\WY.NewJit.sln (src\\Modules\\派格FIS\\WY.NewJit.sln)", + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs index 8b58e32f..310e0278 100644 --- a/src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs +++ b/src/Modules/SettleAccount/src/SettleAccount.Job/Services/SettleAccount/SettleAccountImportService.cs @@ -42,8 +42,8 @@ namespace TaskJob.Services public string ImportFile(Guid id, List fileName, List realfileName, List customConditions) { - - + + IExporter _excel = new ExcelExporter(); string fileSavePath = Environment.CurrentDirectory + @"\wwwroot\files\host\my-file-container\"; var version = customConditions.Where(p => p.Name == "Version").FirstOrDefault().Value; @@ -53,6 +53,7 @@ namespace TaskJob.Services var factory = customConditions.Where(p => p.Name == "Factory").FirstOrDefault().Value; //_versionRepository.Delete(version); //_repository.Delete(version); + List _setls = new List(); var _id = Guid.NewGuid(); foreach (var itm in fileName) @@ -62,9 +63,9 @@ namespace TaskJob.Services var filePath = fileSavePath + itm;//获取到导入的excel var exten = Path.GetExtension(fileSavePath); - List _setls = new List(); + List _errorList = new List(); - + var checkList = new List(); //var _chList = await _relrepository.GetAllAsync(GuidGenerator.Create(), true); //var _chls = _chList.Select(p => p.SettleMaterialCode).Distinct(); @@ -130,29 +131,22 @@ namespace TaskJob.Services else { // _setls= _inputService.Input(filePath); - var errorlist=new List(); - var dtoList = _inputService.Input(filePath,null,errorlist); + var errorlist = new List(); + var dtoList = _inputService.Input(filePath, null, errorlist); foreach (var dto in dtoList) { if (dto.KENNCode.Length == 6) { dto.KENNCode = "0" + dto.KENNCode; } - var _settleaccount=new Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount(Guid.NewGuid(), Guid.NewGuid(),dto.SettleYear, dto.KENNCode, + var _settleaccount = new Win.Sfs.SettleAccount.Entities.SettleAccounts.SettleAccount(Guid.NewGuid(), Guid.NewGuid(), dto.SettleYear, dto.KENNCode, dto.ChassisNumber, dto.Model, dto.CP5A, dto.CP7, dto.MaterialCode, dto.Qty, dto.SettlementID, dto.SettlementSupplier, - DateTime.Now.Month.ToString(), dto.SettleYear, _id, version, DateTime.Now,Guid.NewGuid()); + DateTime.Now.Month.ToString(), dto.SettleYear, _id, version, DateTime.Now, Guid.NewGuid()); _setls.Add(_settleaccount); } } - var _ls = _setls; - var a = _ls.Where(p => string.IsNullOrEmpty(p.KENNCode)); - var query = from arc in _ls - group arc by new { arc.ChassisNumber, arc.MaterialCode } into g - where g.Count() > 1 - select g; - _repository.Insert(_setls); - _versionRepository.Insert(_id,version, customerCode, customerCode); + @@ -160,7 +154,7 @@ namespace TaskJob.Services #region //var errorFileName = "错误文件.xlsx"; //checkList.Add(new ErrorExportDto(version, customerCode, string.Empty, string.Empty, string.Empty, string.Empty, string.Format("ERP物料号{0}底盘号 {1}有重复", "11111111111", "22222222222"), string.Empty)); - + //_service.ExportError(id,errorFileName, checkList); #endregion } @@ -169,6 +163,14 @@ namespace TaskJob.Services throw e; } } + + _setls = _setls.GroupBy(p => new { p.ChassisNumber, p.MaterialCode, p.KENNCode }).Select(p => p.FirstOrDefault()).ToList(); + _repository.Insert(_setls); + _versionRepository.Insert(_id, version, customerCode, customerCode); + + + + return id.ToString(); } }