Warehouses #1
@@ -17,32 +17,84 @@ namespace FaKrosnoApi.Controllers
|
||||
}
|
||||
|
||||
[HttpGet("by-order-number")]
|
||||
public async Task<ActionResult<CustomerOrderDto?>> GetByCustomerOrderNumber([FromQuery] Guid customerOrderNumber)
|
||||
public async Task<ActionResult<CustomerOrderDto?>> GetByCustomerOrderNumber(
|
||||
[FromQuery] Guid customerOrderNumber)
|
||||
{
|
||||
CustomerOrderDto? customerOrder = await service.GetByOrderNumber(customerOrderNumber);
|
||||
return customerOrder != null ? Ok(customerOrder) : NotFound();
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("by-co-number")]
|
||||
public async Task<ActionResult<CustomerOrderDto?>> GetByCoNumber([FromQuery] string customerOrderNumber)
|
||||
{
|
||||
CustomerOrderDto? customerOrder = await service.GetByCoNumber(customerOrderNumber);
|
||||
return customerOrder != null ? Ok(customerOrder) : NotFound();
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("lines-by-co-number")]
|
||||
public async Task<ActionResult<IEnumerable<CustomerOrderLineDto>?>> GetLinesByCoNumber(
|
||||
[FromQuery] string customerOrderNumber)
|
||||
{
|
||||
var customerOrderLines = await service.GetLinesByCoNumber(customerOrderNumber);
|
||||
return customerOrderLines != null ? Ok(customerOrderLines) : NotFound();
|
||||
}
|
||||
|
||||
[HttpGet("items-by-co-number")]
|
||||
public async Task<ActionResult<CustomerOrderDto?>> GetItemsByCoNumber([FromQuery] string customerOrderNumber)
|
||||
public async Task<ActionResult<IEnumerable<CustomerOrderLineItemDto>?>> GetItemsByCoNumber(
|
||||
[FromQuery] string customerOrderNumber)
|
||||
{
|
||||
var customerOrderLineItems = await service.GetItemsByCoNumber(customerOrderNumber);
|
||||
return customerOrderLineItems != null ? Ok(customerOrderLineItems) : NotFound();
|
||||
}
|
||||
|
||||
|
||||
[HttpGet("by-customer-and-po")]
|
||||
public async Task<ActionResult<CustomerOrderDto?>> GetByCustomerAndPo([FromQuery] string customerNumber, [FromQuery] int customerSequence, [FromQuery] string poNumber)
|
||||
public async Task<ActionResult<CustomerOrderDto?>> GetByCustomerAndPo([FromQuery] string customerNumber,
|
||||
[FromQuery] int customerSequence, [FromQuery] string poNumber)
|
||||
{
|
||||
CustomerOrderDto? customerOrder =
|
||||
await service.GetByCustomerAndPo(customerNumber, customerSequence, 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)
|
||||
{
|
||||
IList<CustomerOrderDto> customerOrders =
|
||||
await service.GetListByCustomerAndPo(customerNumber, customerSequence, poNumber);
|
||||
|
||||
foreach (CustomerOrderDto customerOrder in customerOrders)
|
||||
{
|
||||
customerOrder.CustomerOrderLines = await service.GetLinesByCoNumber(customerOrder.CoNum) ?? [];
|
||||
|
||||
foreach (CustomerOrderLineDto customerOrderLine in customerOrder.CustomerOrderLines)
|
||||
{
|
||||
customerOrderLine.CustomerOrderLineItems =
|
||||
await service.GetItemsByCoNumber(customerOrder.CoNum) ?? [];
|
||||
}
|
||||
}
|
||||
|
||||
return Ok(customerOrders);
|
||||
}
|
||||
|
||||
[HttpGet("list-by-customer")]
|
||||
public async Task<ActionResult<IList<CustomerOrderDto?>>> GetListByCustomer([FromQuery] string customerNumber,
|
||||
[FromQuery] int customerSequence)
|
||||
{
|
||||
IList<CustomerOrderDto> customerOrders = await service.GetListByCustomer(customerNumber, customerSequence);
|
||||
|
||||
foreach (CustomerOrderDto customerOrder in customerOrders)
|
||||
{
|
||||
customerOrder.CustomerOrderLines = await service.GetLinesByCoNumber(customerOrder.CoNum) ?? [];
|
||||
|
||||
foreach (CustomerOrderLineDto customerOrderLine in customerOrder.CustomerOrderLines)
|
||||
{
|
||||
customerOrderLine.CustomerOrderLineItems =
|
||||
await service.GetItemsByCoNumber(customerOrder.CoNum) ?? [];
|
||||
}
|
||||
}
|
||||
|
||||
return Ok(customerOrders);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -100,8 +100,8 @@ namespace SytelineSaAppEfDataModel.Dtos
|
||||
public string UfFkrEdiAddIntDest { get; set; }
|
||||
public string UfFkrEdiCustPoLineNum { get; set; }
|
||||
public string UfFkrEdiPlaceOrPortDischarge { get; set; }
|
||||
public string RoutingCode { get; set; }
|
||||
public string DeliveryCallNumber { get; set; }
|
||||
public string? RoutingCode { get; set; }
|
||||
public string? DeliveryCallNumber { get; set; }
|
||||
public string UnloadingPoint { get; set; }
|
||||
public string DestinationPoint { get; set; }
|
||||
public string NewStatus { get; set; }
|
||||
|
||||
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AutoMapper.Configuration.Annotations;
|
||||
|
||||
namespace SytelineSaAppEfDataModel.Dtos
|
||||
{
|
||||
@@ -20,5 +21,7 @@ namespace SytelineSaAppEfDataModel.Dtos
|
||||
public DateTime CreatedDate { get; set; }
|
||||
public string FoundNumbers { get; set; }
|
||||
public int ScheduleOrderId { get; set; }
|
||||
|
||||
[Ignore] public string PoNumber { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace SytelineSaAppEfDataModel.Dtos;
|
||||
|
||||
public class ItemCustPriceAllDto
|
||||
public class ItemCustPriceAllDto : DtoBase
|
||||
{
|
||||
public string SiteRef { get; set; }
|
||||
public string Item { get; set; }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace SytelineSaAppEfDataModel.Dtos;
|
||||
|
||||
public class ItemDto
|
||||
public class ItemDto : DtoBase
|
||||
{
|
||||
public string ItemCode { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
@@ -73,6 +73,29 @@ namespace SytelineSaAppEfDataModel.Services
|
||||
.Select(x => mapper.Map<CustomerOrderDto>(x)).FirstOrDefaultAsync();
|
||||
}
|
||||
|
||||
public async Task<IList<CustomerOrderDto>> GetListByCustomerAndPo(string customerNumber, int customerSequence,
|
||||
string poNumber)
|
||||
{
|
||||
return await context.CustomerOrders
|
||||
.Where(x => x.CustNum == customerNumber && x.CustSeq == customerSequence && x.CustPo == poNumber)
|
||||
.Select(x => mapper.Map<CustomerOrderDto>(x)).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<List<CustomerOrderDto>> GetListByCustomer(string customerNumber, int customerSequence)
|
||||
{
|
||||
return await context.CustomerOrders.Where(x => x.CustNum == customerNumber && x.CustSeq == customerSequence)
|
||||
.Select(x => mapper.Map<CustomerOrderDto>(x)).ToListAsync();
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<CustomerOrderLineDto>?> GetLinesByCoNumber(string customerOrderNumber)
|
||||
{
|
||||
List<CustomerOrderLineDto> customerOrderLines = await context.CustomerOrderLines
|
||||
.Where(x => x.CoNum == customerOrderNumber).Select(x => mapper.Map<CustomerOrderLineDto>(x))
|
||||
.ToListAsync();
|
||||
|
||||
return customerOrderLines;
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<CustomerOrderLineItemDto>?> GetItemsByCoNumber(string customerOrderNumber)
|
||||
{
|
||||
List<CustomerOrderLineItemDto> customerOrderLineItems = await context.CustomerOrderLineItems
|
||||
|
||||
@@ -13,6 +13,12 @@ namespace SytelineSaAppEfDataModel.Services
|
||||
Task<CustomerOrderDto?> GetByOrderNumber(Guid orderNumber);
|
||||
Task<CustomerOrderDto?> GetByCoNumber(string orderNumber);
|
||||
Task<CustomerOrderDto?> GetByCustomerAndPo(string customerNumber, int customerSequence, string poNumber);
|
||||
|
||||
Task<IList<CustomerOrderDto>> GetListByCustomerAndPo(string customerNumber, int customerSequence,
|
||||
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