- Completo gestione Template KIT
This commit is contained in:
Samuele Locatelli
2025-04-10 08:09:11 +02:00
parent 4049a29407
commit 62fb0e38b3
20 changed files with 326 additions and 61 deletions
+5 -5
View File
@@ -145,13 +145,13 @@
{
<input type="time" class="form-control disabled text-secondary" @bind="@EditRecord.InizioStato" disabled></input>
}
<label for="floatingComm">Inizio</label>
<label>Inizio</label>
</div>
</div>
<div class="col-4 col-lg-2 my-2">
<div class="form-floating">
<input type="number" class="form-control" @bind="@EditRecord.PzBuoni" step="1"></input>
<label for="floatingComm">Pezzi</label>
<label>Pezzi</label>
</div>
</div>
<div class="col-4 col-lg-2 my-2 ps-0">
@@ -162,7 +162,7 @@
<option value="@item.Key">@item.Value</option>
}
</select>
<label for="floatingComm">T.Ciclo</label>
<label>T.Ciclo</label>
</div>
</div>
</div>
@@ -191,13 +191,13 @@
{
<input type="time" class="form-control disabled" @bind="@EditRecord.InizioStato" disabled></input>
}
<label for="floatingComm">Inizio</label>
<label>Inizio</label>
</div>
</div>
<div class="col-6 my-2">
<div class="form-floating">
<input type="number" id="minProd" name="minProd" class="form-control" @bind="@EditRecord.MinProd" step="0.1" placeholder="0.0" min="0" max="1440"></input>
<label for="floatingComm">Durata (min)</label>
<label>Durata (min)</label>
</div>
</div>
</div>
+4 -2
View File
@@ -77,7 +77,10 @@ namespace MP.Data.Services
}
else
{
result = await Task.FromResult(dbController.ArticoliGetSearch(numRecord, azienda, searchVal));
result = dbController.ArticoliGetSearch(numRecord, azienda, searchVal);
#if false
result = await Task.FromResult(dbController.ArticoliGetSearch(numRecord, azienda, searchVal));
#endif
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(currKey, rawData, LongCache);
@@ -104,7 +107,6 @@ namespace MP.Data.Services
// cerco in redis...
string currKey = $"{redisBaseKey}:Conf";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<ConfigModel>>($"{rawData}");
+1 -1
View File
@@ -4,7 +4,7 @@
@using Microsoft.AspNetCore.Components.Authorization
@inject AuthenticationStateProvider AuthenticationStateProvider
@inject MessageService MService
@inject MsgServiceSpec MService
<div class="d-flex w-100 justify-content-between">
<div class="px-2">
+1 -1
View File
@@ -129,7 +129,7 @@ namespace MP.SPEC.Components
await MpIoApiCall.addTask2Exe(currRecord.IdxMacchina, "setArt", currRecord.CodArticolo);
string odlPad = currRecord.IdxOdl.ToString(padCodXdl);
await MpIoApiCall.addTask2Exe(currRecord.IdxMacchina, "setComm", $"ODL{odlPad}");
//await MpIoApiCall.addTask2Exe(currRecord.IdxMacchina, "setComm", $"ODL{currRecord.IdxOdl:00000000}");
//await MpIoApiCall.addTask2Exe(EditRecord.IdxMacchina, "setComm", $"ODL{EditRecord.IdxOdl:00000000}");
await MpIoApiCall.addTask2Exe(currRecord.IdxMacchina, "setPzComm", $"{currRecord.NumPezzi}");
// richiesto anche sync DB
+1 -1
View File
@@ -42,7 +42,7 @@ namespace MP.SPEC.Components
try
{
answ = (currRecord.IdxPromessa == record.IdxPromessa) ? "table-info" : "";
//answ = ((currRecord.IdxMacchina == record.IdxMacchina) && (currRecord.CodArticolo == record.CodArticolo) && (currRecord.CodFase == record.CodFase)) ? "table-info" : "";
//answ = ((EditRecord.IdxMacchina == record.IdxMacchina) && (EditRecord.CodArticolo == record.CodArticolo) && (EditRecord.CodFase == record.CodFase)) ? "table-info" : "";
}
catch
{ }
+39
View File
@@ -0,0 +1,39 @@
<div class="row">
<div class="col-12 col-lg-6 col-xl-4 mb-2">
<div class="row">
<div class="col-8 col-md-9 pe-0">
<div class="form-floating small">
<input type="text" class="form-control" @bind="SearchVal">
<label><i class="fa-solid fa-magnifying-glass"></i> @($"Ricerca {SearchMinChar}+ char")</label>
</div>
</div>
<div class="col-4 col-md-3 ps-0">
<div class="form-floating small">
<input type="number" class="form-control text-end" @bind="Num2Displ">
<label># Displ</label>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-6 col-xl-8 mb-2">
<div class="form-floating">
<select class="form-select form-select-sm" disabled="@ListArtDisabled" @bind="@CodArtSel">
<option value="" selected>-- Nessuno --</option>
@if (ListArticoli == null)
{
<option value="" disabled>No record found</option>
}
else
{
@foreach (var item in ListArticoli)
{
<option value="@item.Key">@item.Value</option>
}
}
</select>
<label for="floatingSelect">Selezione Articolo (@DisplayCount / <b>@TotalCount</b>)</label>
</div>
</div>
</div>
+143
View File
@@ -0,0 +1,143 @@
using Microsoft.AspNetCore.Components;
using MP.Data.Services;
using NLog;
namespace MP.SPEC.Components
{
public partial class SelectCodArt
{
#region Public Properties
[Parameter]
public EventCallback<string> E_CodArt { get; set; }
[Parameter]
public int SearchMinChar { get; set; }
#endregion Public Properties
#region Protected Properties
protected string CodArtSel
{
get => codArtSel;
set
{
if (codArtSel != value)
{
codArtSel = value;
E_CodArt.InvokeAsync(CodArtSel).ConfigureAwait(false);
}
}
}
protected int DisplayCount { get; set; } = 0;
protected bool ListArtDisabled { get => string.IsNullOrEmpty(SearchVal) || SearchVal.Length < SearchMinChar; }
protected Dictionary<string, string>? ListArticoli { get; set; } = null;
protected Dictionary<string, string> ListArticoliAll { get; set; } = new Dictionary<string, string>();
[Inject]
protected ListSelectDataSrv MDataService { get; set; } = null!;
protected int Num2Displ
{
get => num2Displ;
set
{
if (num2Displ != value)
{
num2Displ = value;
FiltArticoli();
}
}
}
protected string SearchVal
{
get => searchVal;
set
{
if (value.Length >= SearchMinChar || string.IsNullOrEmpty(value))
{
if (searchVal != value)
{
searchVal = value;
var pUpd = Task.Run(async () =>
{
await ReloadArticoli();
});
pUpd.Wait();
}
}
}
}
protected int TotalCount { get; set; } = 0;
#endregion Protected Properties
#region Protected Methods
protected void FiltArticoli()
{
bool done = false;
if (!ListArtDisabled)
{
if (ListArticoliAll != null)
{
TotalCount = ListArticoliAll.Count;
ListArticoli = ListArticoliAll.Take(Num2Displ).ToDictionary(x => x.Key, x => x.Value);
DisplayCount = ListArticoli.Count;
done = true;
}
}
if (!done)
{
TotalCount = 0;
ListArticoli = new Dictionary<string, string>();
DisplayCount = 0;
}
}
protected async Task GetArticoli()
{
if (!ListArtDisabled)
{
Log.Debug("START GetArticoli");
var rawData = await MDataService.ArticoliGetSearch(10000, "*", searchVal);
// trasformo!
if (rawData != null)
{
ListArticoliAll = rawData.ToDictionary(x => x.CodArticolo, x => $"{x.CodArticolo} | {x.DescArticolo} | {x.Disegno}");
}
Log.Debug("END GetArticoli");
}
}
protected async Task ReloadArticoli()
{
await GetArticoli();
FiltArticoli();
}
#endregion Protected Methods
#region Private Fields
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Private Properties
private string codArtSel { get; set; } = "";
private int num2Displ { get; set; } = 20;
private string searchVal { get; set; } = "";
#endregion Private Properties
}
}
@@ -1,6 +1,6 @@
namespace MP.SPEC.Data
{
public class MessageService
public class MsgServiceSpec
{
#region Public Events
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2504.919</Version>
<Version>6.16.2504.1007</Version>
<UserSecretsId>1800a78a-6ff1-40f9-b490-87fb8bfc1394</UserSecretsId>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
+1 -1
View File
@@ -1,7 +1,7 @@
@page "/Contacts"
@using MP.SPEC.Data
@inject MessageService AppMService
@inject MsgServiceSpec AppMService
<div class="row mx-2">
<div class="col-12 col-lg-8 offset-lg-2">
+1 -1
View File
@@ -18,7 +18,7 @@ namespace MP.SPEC.Pages
protected MpDataService MDService { get; set; } = null!;
[Inject]
protected MessageService MessageService { get; set; } = null!;
protected MsgServiceSpec MessageService { get; set; } = null!;
#endregion Protected Properties
+71 -30
View File
@@ -6,7 +6,8 @@
<div class="px-0">
<div class="d-flex justify-content-between">
<div class="px-2">
<h3>KIT </h3>
<span class="fs-3 mb-0">KIT</span>
<small class="small">Definizione KIT multiprodotto per singolo ciclo</small>
</div>
<div class="px-2">
</div>
@@ -16,7 +17,7 @@
@if (enabKitCount)
{
<div class="input-group me-2">
<button class="btn btn-success" style="min-width: 8rem;" @onclick="() => DoAddNew(true)">Nuovo <i class="bi bi-plus-square"></i></button>
<button class="btn btn-success" style="min-width: 8rem;" @onclick="() => DoAddNew(true)">Nuovo KIT <i class="bi bi-plus-square"></i></button>
</div>
}
<div class="input-group me-2" style="min-width: 20rem;">
@@ -31,40 +32,80 @@
</div>
</div>
</div>
@if (currRecord != null)
@if (EditRecord != null)
{
<div class="row">
@if (doSearchArt)
{
<dialog class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog">
<div class="modal-dialog modal-xl">
<div class="modal-content p-2">
<div class="modal-title d-flex justify-content-between">
<div class="px-0">
<h3>Selezione Articoli da ricerca</h3>
</div>
<div class="px-0">
<button class="btn btn-outline-dark" @onclick="() => SearchArtToggle()"><i class="fa-solid fa-xmark"></i></button>
</div>
</div>
<div class="modal-body">
<SelectCodArt SearchMinChar="@minChar" E_CodArt="SetCodArtChild"></SelectCodArt>
</div>
</div>
</div>
</dialog>
}
<div class="row mt-2">
<div class="col-12">
<div class="card mb-5">
<div class="card">
<div class="card-header bg-primary text-light">Modifica</div>
<div class="card-body">
<div class="row">
<div class="col-3">
<div class="input-group">
<span class="input-group-text">Art Parent</span>
<input type="text" class="form-control disabled" placeholder="Cod Parent" @bind-value="@currRecord.CodArtParent">
<div class="form-floating">
@if (string.IsNullOrEmpty(EditRecord.CodArtParent))
{
<input type="text" class="form-control" placeholder="Cod Parent" @bind="@EditRecord.CodArtParent">
}
else
{
<input type="text" class="form-control disabled" disabled placeholder="Cod Parent" @bind="@EditRecord.CodArtParent">
}
<label>Cod Art Parent</label>
</div>
</div>
<div class="col-3">
<div class="input-group">
<span class="input-group-text">Art Child</span>
<input type="text" class="form-control" placeholder="CodChild" @bind-value="@currRecord.CodArtChild">
</div>
</div>
<div class="col-2">
<div class="input-group" title="Qty">
<span class="input-group-text">Qty relativa</span>
<input type="number" class="form-control" placeholder="Qty child/parent" @bind-value="@currRecord.Qty">
</div>
</div>
<div class="col-2">
<button class="btn btn-warning w-100" @onclick="() => DoCancel()">Annulla <i class="bi bi-x-circle"></i></button>
</div>
<div class="col-2">
@if (currRecord.Qty > 0 && !string.IsNullOrEmpty(currRecord.CodArtParent) && !string.IsNullOrEmpty(currRecord.CodArtChild))
@if (string.IsNullOrEmpty(EditRecord.CodArtChild))
{
<button class="btn btn-success w-100" @onclick="() => DoUpdate(currRecord)">Salva <i class="bi bi-save"></i></button>
<div class="input-group">
<button class="btn btn-success" @onclick="() => SearchArtToggle()"><i class="fa-brands fa-searchengin fa-2x"></i></button>
<div class="form-floating">
<input type="text" class="form-control" placeholder="CodChild" @bind-value="@EditRecord.CodArtChild">
<label>Cod Art Child</label>
</div>
</div>
}
else
{
<div class="form-floating">
<input type="text" class="form-control disabled" disabled placeholder="CodChild" @bind-value="@EditRecord.CodArtChild">
<label>Cod Art Child</label>
</div>
}
</div>
<div class="col-2">
<div class="form-floating">
<input type="number" class="form-control text-end" placeholder="Qty child/parent" @bind-value="@EditRecord.Qty">
<label>Qty rel Art/Kit</label>
</div>
</div>
<div class="col-2 align-content-center">
<button class="btn btn-lg btn-warning w-100" @onclick="() => DoCancel()">Annulla <i class="bi bi-x-circle"></i></button>
</div>
<div class="col-2 align-content-center">
@if (EditRecord.Qty > 0 && !string.IsNullOrEmpty(EditRecord.CodArtParent) && !string.IsNullOrEmpty(EditRecord.CodArtChild))
{
<button class="btn btn-lg btn-success w-100" @onclick="() => DoUpdate(EditRecord)">Salva <i class="bi bi-save"></i></button>
}
else
{
@@ -91,7 +132,7 @@
@if (enabKitSearch && !string.IsNullOrEmpty(SearchParent) && totalCount == 0)
{
<div class="input-group me-2">
<button class="btn btn-success" style="min-width: 8rem;" @onclick="() => DoAddNew(false)">Aggiungi Cod Parent Cercato <i class="bi bi-plus-square"></i></button>
<button class="btn btn-success" style="min-width: 8rem;" @onclick="() => DoAddNew(false)">Aggiungi KIT Cercato <i class="bi bi-plus-square"></i></button>
</div>
}
</div>
@@ -104,14 +145,14 @@
<thead>
<tr>
<th>
@if (currRecord != null)
@if (EditRecord != null)
{
<button @onclick="() => ResetSel()" class="btn btn-primary btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
}
</th>
<th><i class="fa-solid fa-sitemap"></i> Articolo Parent</th>
<th><i class="fa-solid fa-file"></i> Articolo Child</th>
<th><i class="fa-solid fa-hashtag"></i> KIT Qty</th>
<th><i class="fa-solid fa-sitemap"></i> Cod Kit (Parent)</th>
<th><i class="fa-solid fa-file"></i> Articolo (Child)</th>
<th><i class="fa-solid fa-hashtag"></i> Art/Kit Qty</th>
<th></th>
</tr>
</thead>
+47 -11
View File
@@ -29,7 +29,7 @@ namespace MP.SPEC.Pages
public void Dispose()
{
currRecord = null;
EditRecord = null;
ListTipoArt = null;
ListAziende = null;
SearchRecords = null;
@@ -146,7 +146,7 @@ namespace MP.SPEC.Pages
codParent = "";
}
}
currRecord = new TemplateKitModel()
EditRecord = new TemplateKitModel()
{
CodArtParent = codParent,
CodArtChild = "",
@@ -157,7 +157,7 @@ namespace MP.SPEC.Pages
protected async Task DoCancel()
{
currRecord = null;
EditRecord = null;
ReloadData();
await Task.Delay(1);
}
@@ -171,7 +171,7 @@ namespace MP.SPEC.Pages
CodArtChild = "",//selRec.CodArtParent,
Qty = selRec.Qty
};
currRecord = newRec;
EditRecord = newRec;
await Task.Delay(1);
}
@@ -187,7 +187,7 @@ namespace MP.SPEC.Pages
await Task.Delay(1);
var done = await MDService.TemplateKitDelete(selRec);
currRecord = null;
EditRecord = null;
ReloadData();
await Task.Delay(1);
}
@@ -199,7 +199,7 @@ namespace MP.SPEC.Pages
await Task.Delay(1);
var done = await MDService.TemplateKitUpsert(selRec);
currRecord = null;
EditRecord = null;
ReloadData();
await Task.Delay(1);
}
@@ -239,7 +239,7 @@ namespace MP.SPEC.Pages
protected void ResetData()
{
currRecord = null;
EditRecord = null;
}
protected void ResetParent()
@@ -250,12 +250,12 @@ namespace MP.SPEC.Pages
protected void ResetSel()
{
currRecord = null;
EditRecord = null;
}
protected void SelRecord(TemplateKitModel selRec)
{
currRecord = selRec;
EditRecord = selRec;
}
protected void SetNumPage(int newNum)
@@ -271,7 +271,7 @@ namespace MP.SPEC.Pages
protected void UpdateData()
{
currRecord = null;
EditRecord = null;
ReloadData();
}
@@ -279,14 +279,27 @@ namespace MP.SPEC.Pages
#region Private Fields
private TemplateKitModel? currRecord = null;
/// <summary>
/// Boolear controllo visualizzazione ricerca articoli
/// </summary>
private bool doSearchArt = false;
private TemplateKitModel? EditRecord = null;
private bool enabKitCount = false;
private bool enabKitSearch = false;
private List<AnagGruppi>? ListAziende;
private List<TemplateKitModel>? ListRecords;
private List<ListValues>? ListTipoArt;
private int minChar = 2;
private string sCodChild = "";
private List<TemplateKitModel>? SearchRecords;
#endregion Private Fields
@@ -294,6 +307,7 @@ namespace MP.SPEC.Pages
#region Private Properties
private int _currPage { get; set; } = 1;
private int _numRecord { get; set; } = 10;
private int currPage
@@ -325,6 +339,7 @@ namespace MP.SPEC.Pages
}
private string sCodParent { get; set; } = "";
private bool ShowCharts { get; set; } = false;
#endregion Private Properties
@@ -342,6 +357,27 @@ namespace MP.SPEC.Pages
isLoading = false;
}
/// <summary>
/// Toggle modale ricerca articoli
/// </summary>
private void SearchArtToggle()
{
doSearchArt = !doSearchArt;
}
/// <summary>
/// Salva selezione articolo
/// </summary>
/// <param name="codArt"></param>
private void SetCodArtChild(string codArt)
{
if (EditRecord != null)
{
EditRecord.CodArtChild = codArt;
doSearchArt = false;
}
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -22,7 +22,7 @@ namespace MP.SPEC.Pages
public partial class TestBtn
{
[Inject]
protected MessageService MService { get; set; } = null!;
protected MsgServiceSpec MService { get; set; } = null!;
public EventCallback<string> newBcMsg { get; set; }
+4 -2
View File
@@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.FileProviders;
using MP.Data.Services;
using MP.SPEC.Components;
using MP.SPEC.Data;
using MP.SPEC.Services;
@@ -56,12 +57,13 @@ builder.Services.AddRazorPages();
builder.Services.AddServerSideBlazor();
builder.Services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
builder.Services.AddSingleton<MpDataService>();
builder.Services.AddScoped<MessageService>();
builder.Services.AddSingleton<ListSelectDataSrv>();
builder.Services.AddSingleton<IOApiService>();
builder.Services.AddScoped<MsgServiceSpec>();
builder.Services.AddBlazoredLocalStorage();
builder.Services.AddBlazoredSessionStorage();
builder.Services.AddHttpClient();
builder.Services.AddSingleton<IOApiService>();
logger.Info("Aggiunti services");
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2504.919</h4>
<h4>Versione: 6.16.2504.1007</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2504.919
6.16.2504.1007
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2504.919</version>
<version>6.16.2504.1007</version>
<url>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/MP.SPEC.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-SPEC/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1
View File
@@ -9,6 +9,7 @@
},
"AllowedHosts": "*",
"ConnectionStrings": {
"MP.All": "Server=localhost\\SQLEXPRESS;Database=MoonPro; User ID=steamware;Password=viadante16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"MP.Data": "Server=localhost\\SQLEXPRESS;Database=MoonPro; User ID=steamware;Password=viadante16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"MP.Flux": "Server=localhost\\SQLEXPRESS;Database=MoonPro_FluxData; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"MP.Inve": "Server=localhost\\SQLEXPRESS;Database=MoonPro_MAG; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
+1
View File
@@ -48,6 +48,7 @@
},
"AllowedHosts": "*",
"ConnectionStrings": {
"MP.All": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"MP.Data": "Server=SQL2016DEV;Database=MoonPro; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"MP.Flux": "Server=SQL2016DEV;Database=MoonPro_FluxData; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",
"MP.Inve": "Server=SQL2016DEV;Database=MoonPro_MAG; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.SPEC;",