diff --git a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Transactions/TransactionAppService.cs b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Transactions/TransactionAppService.cs index 1ff0c197d..e54d7b221 100644 --- a/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Transactions/TransactionAppService.cs +++ b/be/Modules/Inventory/src/Win_in.Sfs.Wms.Inventory.Application/Transactions/TransactionAppService.cs @@ -133,6 +133,17 @@ public class TransactionAppService public virtual async Task> GetItemSerialList(List itemCodes,string erpLocationCode,DateTime startDateTime,DateTime endDateTime) { var itemSerialDtos = new List(); + if (!itemCodes.Any()) + { + var itemBasicDtos_i= await _itemBasicAppService.GetAllListByFilterAsync(new SfsBaseDataRequestInputBase()).ConfigureAwait(false); + var itemBasicDtos_t = await _repository.GetListAsync().ConfigureAwait(false); + + itemCodes.AddRange(itemBasicDtos_i.Select(p => p.Code)); + itemCodes.AddRange(itemBasicDtos_t.Select(p => p.ItemCode)); + + itemCodes=itemCodes.Distinct().ToList(); + } + foreach (var itemCode in itemCodes) { var itemSerialDto = new ReportItemSerialDto(); @@ -151,12 +162,16 @@ public class TransactionAppService //所有这个零件的事务 var transactions=await _repository.GetListAsync(p => p.ItemCode == itemCode).ConfigureAwait(false); - if (string.IsNullOrEmpty(erpLocationCode)) + if (!string.IsNullOrEmpty(erpLocationCode)) { transactions = transactions.Where(p => p.LocationErpCode == erpLocationCode).ToList(); } - var locationDtos=await _locationAppService.GetAllAsync().ConfigureAwait(false); + var locationDtos=await _locationAppService.GetAllAsync().ConfigureAwait(false); + if (!string.IsNullOrEmpty(erpLocationCode)) + { + locationDtos = locationDtos.Where(p => p.ErpLocationCode == erpLocationCode).ToList(); + } var groupKey= locationDtos.GroupBy(p => p.ErpLocationCode); foreach (var keyGroup in groupKey)