Implentata scansione barcode e lista articoli nel form scheda
This commit is contained in:
18
SteUp.Shared/Core/Dto/ArticoliInGrigliaDto.cs
Normal file
18
SteUp.Shared/Core/Dto/ArticoliInGrigliaDto.cs
Normal file
@@ -0,0 +1,18 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SteUp.Shared.Core.Dto;
|
||||
|
||||
public class ArticoliInGrigliaDto
|
||||
{
|
||||
[JsonPropertyName("codMart")]
|
||||
public string CodMart { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("descrizione")]
|
||||
public string Descrizione { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("barcode")]
|
||||
public string Barcode { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("codMsgr")]
|
||||
public string CodMsgr { get; set; } = string.Empty;
|
||||
}
|
||||
15
SteUp.Shared/Core/Dto/RetrieveGrigliaPluRequestDto.cs
Normal file
15
SteUp.Shared/Core/Dto/RetrieveGrigliaPluRequestDto.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SteUp.Shared.Core.Dto;
|
||||
|
||||
public class RetrieveGrigliaPluRequestDto
|
||||
{
|
||||
[JsonPropertyName("codMdep")]
|
||||
public string? CodMdep { get; set; }
|
||||
|
||||
[JsonPropertyName("codJfas")]
|
||||
public string? CodJfas { get; set; }
|
||||
|
||||
[JsonPropertyName("activityTypeId")]
|
||||
public string? ActivityTypeId { get; set; }
|
||||
}
|
||||
@@ -17,6 +17,7 @@ public class Scheda : EntityBase<Scheda>
|
||||
public string Rilevatore { get; set; } = string.Empty;
|
||||
public Ispezione? Ispezione { get; set; }
|
||||
|
||||
public List<SchedaArticolo> Articoli { get; set; } = [];
|
||||
public List<string>? ImageNames { get; set; }
|
||||
|
||||
public string? DescrizioneReparto { get; set; }
|
||||
|
||||
24
SteUp.Shared/Core/Entities/SchedaArticolo.cs
Normal file
24
SteUp.Shared/Core/Entities/SchedaArticolo.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace SteUp.Shared.Core.Entities;
|
||||
|
||||
public class SchedaArticolo
|
||||
{
|
||||
[Key]
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required]
|
||||
public int SchedaId { get; set; }
|
||||
|
||||
[ForeignKey(nameof(SchedaId))]
|
||||
public Scheda Scheda { get; set; } = null!;
|
||||
|
||||
[Required]
|
||||
[MaxLength(64)]
|
||||
public string Barcode { get; set; } = string.Empty;
|
||||
|
||||
[Required]
|
||||
[MaxLength(256)]
|
||||
public string Descrizione { get; set; } = string.Empty;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using MudBlazor;
|
||||
using SteUp.Shared.Components.SingleElements.Modal;
|
||||
using SteUp.Shared.Components.SingleElements.Modal.ExceptionModal;
|
||||
using SteUp.Shared.Core.Dto;
|
||||
using SteUp.Shared.Core.Entities;
|
||||
|
||||
@@ -86,4 +87,48 @@ public abstract class ModalHelper
|
||||
|
||||
return await modal.Result;
|
||||
}
|
||||
|
||||
public static async Task<DialogResult?> OpenSelectArt(IDialogService dialog, List<ArticoliInGrigliaDto>? articoli)
|
||||
{
|
||||
var modal = await dialog.ShowAsync<ModalSelectArt>(
|
||||
"ModalSelectArt",
|
||||
new DialogParameters<ModalSelectArt>
|
||||
{
|
||||
{ x => x.Articoli, articoli }
|
||||
},
|
||||
new DialogOptions
|
||||
{
|
||||
FullScreen = false,
|
||||
CloseButton = false,
|
||||
NoHeader = true,
|
||||
BackdropClick = true,
|
||||
FullWidth = true,
|
||||
MaxWidth = MaxWidth.ExtraLarge
|
||||
}
|
||||
);
|
||||
|
||||
return await modal.Result;
|
||||
}
|
||||
|
||||
public static async Task ShowError(IDialogService dialog, string message)
|
||||
{
|
||||
var modal = await dialog.ShowAsync<ModalError>(
|
||||
"ModalError",
|
||||
new DialogParameters<ModalError>
|
||||
{
|
||||
{ x => x.ErrorMessage, message }
|
||||
},
|
||||
new DialogOptions
|
||||
{
|
||||
FullScreen = false,
|
||||
CloseButton = false,
|
||||
NoHeader = true,
|
||||
BackdropClick = true,
|
||||
FullWidth = true,
|
||||
MaxWidth = MaxWidth.ExtraLarge
|
||||
}
|
||||
);
|
||||
|
||||
await modal.Result;
|
||||
}
|
||||
}
|
||||
@@ -8,4 +8,6 @@ public interface IIntegrySteupService
|
||||
Task<List<PuntoVenditaDto>> RetrievePuntiVendita();
|
||||
Task<List<JtbFasiDto>> RetrieveReparti();
|
||||
Task<List<ActivityTypeDto>> RetrieveActivityType();
|
||||
Task<List<ArticoliInGrigliaDto>?> RetrieveGrigliaPlu(RetrieveGrigliaPluRequestDto request);
|
||||
Task<ArticoliInGrigliaDto?> RetrieveArtFromBarcode(string barcode);
|
||||
}
|
||||
@@ -19,5 +19,17 @@ public class IntegrySteupService(IIntegryApiRestClient integryApiRestClient) : I
|
||||
public Task<List<ActivityTypeDto>> RetrieveActivityType() =>
|
||||
integryApiRestClient.AuthorizedGet<List<ActivityTypeDto>>($"{BaseRequest}/retrieveActivityType")!;
|
||||
|
||||
public Task<List<ArticoliInGrigliaDto>?> RetrieveGrigliaPlu(RetrieveGrigliaPluRequestDto request) =>
|
||||
integryApiRestClient.AuthorizedPost<List<ArticoliInGrigliaDto>?>($"{BaseRequest}/retrieveGrigliaPlu", request);
|
||||
|
||||
public Task<ArticoliInGrigliaDto?> RetrieveArtFromBarcode(string barcode) =>
|
||||
integryApiRestClient.AuthorizedGet<ArticoliInGrigliaDto?>(
|
||||
$"{BaseRequest}/retrieveArtFromBarcode",
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{ "barcode", barcode }
|
||||
}
|
||||
);
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user