* Added new Enrichers

* Added new Translators
* Changed in DTOs
* Further development
This commit is contained in:
2025-08-25 14:25:16 +02:00
parent cd3d939efe
commit 8b67aa3851
7 changed files with 94 additions and 10 deletions

View File

@@ -17,7 +17,8 @@ namespace FaKrosnoApi.Controllers
} }
[HttpGet("by-order-number")] [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); CustomerOrderDto? customerOrder = await service.GetByOrderNumber(customerOrderNumber);
return customerOrder != null ? Ok(customerOrder) : NotFound(); return customerOrder != null ? Ok(customerOrder) : NotFound();
@@ -30,19 +31,70 @@ namespace FaKrosnoApi.Controllers
return customerOrder != null ? Ok(customerOrder) : NotFound(); 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")] [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); var customerOrderLineItems = await service.GetItemsByCoNumber(customerOrderNumber);
return customerOrderLineItems != null ? Ok(customerOrderLineItems) : NotFound(); return customerOrderLineItems != null ? Ok(customerOrderLineItems) : NotFound();
} }
[HttpGet("by-customer-and-po")] [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 = CustomerOrderDto? customerOrder =
await service.GetByCustomerAndPo(customerNumber, customerSequence, poNumber); await service.GetByCustomerAndPo(customerNumber, customerSequence, poNumber);
return customerOrder != null ? Ok(customerOrder) : NotFound(); 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);
}
} }
} }

View File

@@ -100,8 +100,8 @@ namespace SytelineSaAppEfDataModel.Dtos
public string UfFkrEdiAddIntDest { get; set; } public string UfFkrEdiAddIntDest { get; set; }
public string UfFkrEdiCustPoLineNum { get; set; } public string UfFkrEdiCustPoLineNum { get; set; }
public string UfFkrEdiPlaceOrPortDischarge { get; set; } public string UfFkrEdiPlaceOrPortDischarge { get; set; }
public string RoutingCode { get; set; } public string? RoutingCode { get; set; }
public string DeliveryCallNumber { get; set; } public string? DeliveryCallNumber { get; set; }
public string UnloadingPoint { get; set; } public string UnloadingPoint { get; set; }
public string DestinationPoint { get; set; } public string DestinationPoint { get; set; }
public string NewStatus { get; set; } public string NewStatus { get; set; }

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using AutoMapper.Configuration.Annotations;
namespace SytelineSaAppEfDataModel.Dtos namespace SytelineSaAppEfDataModel.Dtos
{ {
@@ -20,5 +21,7 @@ namespace SytelineSaAppEfDataModel.Dtos
public DateTime CreatedDate { get; set; } public DateTime CreatedDate { get; set; }
public string FoundNumbers { get; set; } public string FoundNumbers { get; set; }
public int ScheduleOrderId { get; set; } public int ScheduleOrderId { get; set; }
[Ignore] public string PoNumber { get; set; }
} }
} }

View File

@@ -1,6 +1,6 @@
namespace SytelineSaAppEfDataModel.Dtos; namespace SytelineSaAppEfDataModel.Dtos;
public class ItemCustPriceAllDto public class ItemCustPriceAllDto : DtoBase
{ {
public string SiteRef { get; set; } public string SiteRef { get; set; }
public string Item { get; set; } public string Item { get; set; }

View File

@@ -1,6 +1,6 @@
namespace SytelineSaAppEfDataModel.Dtos; namespace SytelineSaAppEfDataModel.Dtos;
public class ItemDto public class ItemDto : DtoBase
{ {
public string ItemCode { get; set; } public string ItemCode { get; set; }
public string Description { get; set; } public string Description { get; set; }

View File

@@ -73,6 +73,29 @@ namespace SytelineSaAppEfDataModel.Services
.Select(x => mapper.Map<CustomerOrderDto>(x)).FirstOrDefaultAsync(); .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) public async Task<IEnumerable<CustomerOrderLineItemDto>?> GetItemsByCoNumber(string customerOrderNumber)
{ {
List<CustomerOrderLineItemDto> customerOrderLineItems = await context.CustomerOrderLineItems List<CustomerOrderLineItemDto> customerOrderLineItems = await context.CustomerOrderLineItems

View File

@@ -13,6 +13,12 @@ namespace SytelineSaAppEfDataModel.Services
Task<CustomerOrderDto?> GetByOrderNumber(Guid orderNumber); Task<CustomerOrderDto?> GetByOrderNumber(Guid orderNumber);
Task<CustomerOrderDto?> GetByCoNumber(string orderNumber); Task<CustomerOrderDto?> GetByCoNumber(string orderNumber);
Task<CustomerOrderDto?> GetByCustomerAndPo(string customerNumber, int customerSequence, string poNumber); 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); Task<IEnumerable<CustomerOrderLineItemDto>?> GetItemsByCoNumber(string customerOrderNumber);
} }
} }