diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/DTOs/KittingDTO.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/DTOs/KittingDTO.cs index 919062672..766c2706d 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/DTOs/KittingDTO.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application.Contracts/Kittings/DTOs/KittingDTO.cs @@ -20,3 +20,22 @@ public class KittingDTO : EntityDto, IHasCode, IHasName [Display(Name = "明细")] public List Details { set; get; }= new List(); } + +public class KittingErrorDto +{ + + [Display(Name = "Kitting编号")] + public string Code { get; set; } + + + [Display(Name = "零件代码")] + public string PartCode { get; set; } + + + [Display(Name = "错误信息")] + public string Content { get; set; } + + + +} + diff --git a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs index 5a68489e2..bd3f3bde9 100644 --- a/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs +++ b/be/Modules/BaseData/src/Win_in.Sfs.Basedata.Application/Kittings/KittingAppService.cs @@ -152,7 +152,21 @@ public class KittingAppService : SfsBaseDataWithCodeAppServiceBase(inputFileBytes).ToList(); var checklist=importList.GroupBy(p => new { p.Code, p.PartCode }).Where(g => g.Count() > 1).Select(p => new { Code = p.Key.Code, PartCode = p.Key.PartCode });//导入重复报错 - //检测是否导入重复 + //检测是否导入重复 + + + List errors = new List(); + if (checklist.Any()) + { + + foreach (var error in checklist) { + + errors.Add(new KittingErrorDto() { Code=error.Code,PartCode=error.PartCode, Content="记录有重复!" }); + } + + + + } @@ -179,6 +193,7 @@ public class KittingAppService : SfsBaseDataWithCodeAppServiceBase existCodeList.Contains(p.Code)).ToList();//新Kitting List existKittingInputList = new List(); - List existKittingDetailList = new List(); - List newKittingDetailList = new List(); + //List existKittingDetailList = new List(); + //List newKittingDetailList = new List(); foreach (var include in includeList) { var newDetail = existKittingList.Where(p => p.Code == include.Code).ToList(); @@ -334,12 +349,15 @@ public class KittingAppService : SfsBaseDataWithCodeAppServiceBase 0) + { + var fileContent= _excelService.Export(errors); + return new TestResult(fileContent.FileContents, ExportImportService.ContentType) { FileDownloadName="错误信息" }; + } - return new JsonResult(new { Code = 200, Message = "" }); - - - - + var fileContent1 = _excelService.Export(importList); + new TestResult(fileContent1.FileContents, ExportImportService.ContentType) { FileDownloadName = "导入文件" }; + return new JsonResult(new { Code = 200, FileDownloadName="" }); }