* Extended CustomerOrdersController and CustomerOrderService
This commit is contained in:
@@ -56,6 +56,13 @@ namespace FaKrosnoApi.Controllers
|
||||
return customerOrder != null ? Ok(customerOrder) : NotFound();
|
||||
}
|
||||
|
||||
[HttpGet("by-po")]
|
||||
public async Task<ActionResult<CustomerOrderDto?>> GetByPo([FromQuery] string poNumber)
|
||||
{
|
||||
CustomerOrderDto? customerOrder = await service.GetByPo(poNumber);
|
||||
return customerOrder != null ? Ok(customerOrder) : NotFound();
|
||||
}
|
||||
|
||||
[HttpGet("list-by-customer-and-po")]
|
||||
public async Task<ActionResult<IList<CustomerOrderDto?>>> GetListByCustomerAndPo(
|
||||
[FromQuery] string customerNumber, [FromQuery] int customerSequence, [FromQuery] string poNumber)
|
||||
|
||||
@@ -73,6 +73,13 @@ namespace SytelineSaAppEfDataModel.Services
|
||||
.Select(x => mapper.Map<CustomerOrderDto>(x)).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<CustomerOrderDto?> GetByPo(string poNumber)
|
||||
{
|
||||
return await context.CustomerOrders.Where(x => x.CustPo == poNumber && x.Stat == "O")
|
||||
.OrderByDescending(x => x.CreateDate).Select(x => mapper.Map<CustomerOrderDto>(x))
|
||||
.FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<IList<CustomerOrderDto>> GetListByCustomerAndPo(string customerNumber, int customerSequence,
|
||||
string poNumber)
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace SytelineSaAppEfDataModel.Services
|
||||
Task<IList<CustomerOrderDto>> GetListByCustomerAndPo(string customerNumber, int customerSequence,
|
||||
string poNumber);
|
||||
|
||||
Task<CustomerOrderDto?> GetByPo(string poNumber);
|
||||
Task<List<CustomerOrderDto>> GetListByCustomer(string customerNumber, int customerSequence);
|
||||
Task<IEnumerable<CustomerOrderLineDto>?> GetLinesByCoNumber(string customerOrderNumber);
|
||||
Task<IEnumerable<CustomerOrderLineItemDto>?> GetItemsByCoNumber(string customerOrderNumber);
|
||||
|
||||
Reference in New Issue
Block a user