diff --git a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs index 07e300af2..3706029de 100644 --- a/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs +++ b/be/Modules/Store/src/Win_in.Sfs.Wms.Store.Application/Notes/BackFlushNotes/BackFlushNoteAppService.cs @@ -58,7 +58,12 @@ public class BackFlushNoteAppService : { if (backFlushNotes != null && backFlushNotes.Count > 0) { + // 主零件号 var itemCodes = backFlushNotes.Select(t => t.ItemCode); + // 从零件号 + var detailsItemCodes = backFlushNotes.SelectMany(t => t.Details).Select(t => t.ItemCode); + itemCodes = itemCodes.Concat(detailsItemCodes).Distinct(); + List itemBasicDtos = await _itemBasicAppService.GetByCodesAsync(itemCodes).ConfigureAwait(false); backFlushNotes.ForEach(t => @@ -70,8 +75,12 @@ public class BackFlushNoteAppService : t.ItemDesc2 = itemBasicDto.Desc2; t.Details.ForEach(tDetail => { - tDetail.ItemDesc1 = itemBasicDto.Desc1; - tDetail.ItemDesc2 = itemBasicDto.Desc2; + var detailsItemBasicDto = itemBasicDtos.FirstOrDefault(w => w.Code == tDetail.ItemCode); + if (detailsItemBasicDto != null) + { + tDetail.ItemDesc1 = detailsItemBasicDto.Desc1; + tDetail.ItemDesc2 = detailsItemBasicDto.Desc2; + } }); } });