* Added new Controllers to API
* Added methods to get WZs for specific client
This commit is contained in:
@@ -9,4 +9,5 @@ public interface IMaterialTransactionService
|
||||
Task<IEnumerable<MaterialTransactionDto>> GetByWzNumbers(ISet<string> wzNumbers);
|
||||
Task<IEnumerable<MaterialTransactionDto>> GetByOrderNumber(string orderNumber);
|
||||
Task<IEnumerable<MaterialTransactionDto>> GetOrderNumbersByWz(ISet<string> wzNumbers);
|
||||
Task<IEnumerable<MaterialTransactionDto>> GetByCustomerNumber(string customerNumber, int customerSequence);
|
||||
}
|
||||
@@ -66,4 +66,21 @@ public class MaterialTransactionService(SytelineSaAppDbContext context, IMapper
|
||||
|
||||
return result.Select(x => mapper.Map<MaterialTransactionDto>(x));
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<MaterialTransactionDto>> GetByCustomerNumber(string customerNumber, int customerSequence)
|
||||
{
|
||||
IList<string> coNumbers = await context.CustomerOrders
|
||||
.Where(x => x.CustNum == customerNumber && x.CustSeq == customerSequence && (x.Stat == "P" || x.Stat == "O"))
|
||||
.Select(x => x.CoNum).ToListAsync();
|
||||
|
||||
List<MaterialTransactionDto> result = new List<MaterialTransactionDto>();
|
||||
|
||||
foreach (string coNumber in coNumbers)
|
||||
{
|
||||
IEnumerable<MaterialTransactionDto> materialTransactions = await GetByOrderNumber(coNumber);
|
||||
result.AddRange(materialTransactions);
|
||||
}
|
||||
|
||||
return result.OrderByDescending(x => x.CreateDate);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user