Merge branch 'Feature/AddPodlClone' into develop

This commit is contained in:
Samuele Locatelli
2022-10-05 10:24:30 +02:00
16 changed files with 175 additions and 57 deletions
+3
View File
@@ -465,6 +465,8 @@ namespace MP.Data.Controllers
.DbSetPODL
.Where(x => (x.IdxOdl == 0) && (x.KeyRichiesta.Contains(keyRichPart) || keyRichPart == "*") && (codArt == "*" || x.CodArticolo.Contains(codArt)))
.AsNoTracking()
.Include(m => m.MachineNav)
.Include(a => a.ArticoloNav)
.OrderBy(x => x.InsertDate)
.ToList();
}
@@ -625,6 +627,7 @@ namespace MP.Data.Controllers
currRec.KeyRichiesta = editRec.KeyRichiesta;
currRec.NumPezzi = editRec.NumPezzi;
currRec.Tcassegnato = editRec.Tcassegnato;
currRec.Note = editRec.Note;
dbCtx.Entry(currRec).State = EntityState.Modified;
}
else
+11
View File
@@ -55,6 +55,17 @@ namespace MP.Data.DatabaseModels
}
}
/// <summary>
/// Navigazione oggetto Machine
/// </summary>
[ForeignKey("IdxMacchina")]
public virtual Macchine MachineNav { get; set; } = null!;
/// <summary>
/// Navigazione oggetto Articolo
/// </summary>
[ForeignKey("CodArticolo")]
public virtual AnagArticoli ArticoloNav { get; set; } = null!;
#endregion Public Properties
}
}
-4
View File
@@ -133,10 +133,6 @@ namespace MP.SPEC.Components
}
private int totalCount { get; set; } = 0;
//{
// get => MessageService.totalCount;
// set => MessageService.totalCount = value;
//}
#endregion Private Properties
+15 -1
View File
@@ -25,6 +25,7 @@ else
<th># pz</th>
<th><i class="fa-solid fa-clock"></i> T.Ciclo</th>
<th><i class="fa-solid fa-pen-to-square"></i> Note</th>
<th title="Attivabile"><i class="fa-regular fa-square-check"></i> Att</th>
<th></th>
</tr>
</thead>
@@ -33,14 +34,17 @@ else
{
<tr class="@checkSelect(@record.CodArticolo)">
<td>
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm"><i class="bi bi-pencil-square"></i></button>
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm" title="Modifica Record"><i class="bi bi-pencil-square"></i></button>
<button @onclick="() => cloneRecord(record)" class="btn btn-info btn-sm" title="Duplica Record"><i class="bi bi-clipboard-check"></i></button>
</td>
<td>
@record.CodArticolo
<div class="small textConsensed text-secondary">@record.ArticoloNav.DescArticolo</div>
</td>
<td>@tradFase(record.KeyRichiesta)</td>
<td>
@record.IdxMacchina
<div class="small textConsensed text-secondary">@record.MachineNav.Descrizione</div>
</td>
<td>
@record.NumPezzi
@@ -49,6 +53,16 @@ else
@record.Tcassegnato.ToString("N3")
</td>
<td>@record.Note</td>
<td>
@if (@record.Attivabile)
{
<i class="fa-regular fa-square-check text-success"></i>
}
else
{
<i class="fa-regular fa-square text-secondary"></i>
}
</td>
<td>
@if (POdlDelEnabled(record.IdxOdl))
{
+34 -5
View File
@@ -15,6 +15,9 @@ namespace MP.SPEC.Components
[Parameter]
public EventCallback<PODLModel> RecordSel { get; set; }
[Parameter]
public EventCallback<int> updateRecordCount { get; set; }
#endregion Public Properties
#region Public Methods
@@ -51,6 +54,31 @@ namespace MP.SPEC.Components
#region Protected Methods
protected async Task cloneRecord(PODLModel selRec)
{
// creo record duplicato...
PODLModel newRec = new PODLModel()
{
Attivabile = selRec.Attivabile,
CodArticolo = selRec.CodArticolo,
CodCli = selRec.CodCli,
CodGruppo = selRec.CodGruppo,
DueDate = selRec.DueDate,
IdxMacchina = selRec.IdxMacchina,
IdxOdl = selRec.IdxOdl,
IdxPromessa = 0,
InsertDate = selRec.InsertDate,
KeyBCode = selRec.KeyBCode,
KeyRichiesta = selRec.KeyRichiesta,
Note = $"DUPLICATED - {selRec.Note}",
NumPezzi = selRec.NumPezzi,
Priorita = selRec.Priorita,
PzPallet = selRec.PzPallet,
Tcassegnato = selRec.Tcassegnato
};
await RecordSel.InvokeAsync(newRec);
}
/// <summary>
/// Eliminazione record selezionato (previa conferma)
/// </summary>
@@ -73,6 +101,10 @@ namespace MP.SPEC.Components
MsgService.EA_SearchUpdated += OnSeachUpdated;
MsgService.EA_StatoSearch += MsgService_EA_StatoSearch;
ListStati = await MDService.AnagStatiComm();
}
protected override async Task OnParametersSetAsync()
{
await reloadData();
}
@@ -148,11 +180,7 @@ namespace MP.SPEC.Components
set => MsgService.StateSel = value;
}
private int totalCount
{
get => MsgService.totalCount;
set => MsgService.totalCount = value;
}
private int totalCount { get; set; } = 0;
#endregion Private Properties
@@ -182,6 +210,7 @@ namespace MP.SPEC.Components
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
await updateRecordCount.InvokeAsync(totalCount);
isLoading = false;
}
+5 -3
View File
@@ -98,14 +98,16 @@
}
}
</select>
@if (dtMax == null)
@if (selDtMax == null)
{
<button class="btn btn-primary" @onclick="() => setDtMax()"><i class="fa-regular fa-calendar-check"></i></button>
}
else
{
<label class="input-group-text" for="flusso" title="Selezionare il tipo di flusso"><i class="fa-solid fa-sliders"></i></label>
<input class="form" @bind="@dtMax" type="datetime-local" title="Data massima eventi da visualizzare">
<label class="input-group-text" for="flusso" title="Selezionare la data minima eventi da visualizzare"><i class="fa-regular fa-calendar-minus"></i></label>
<input class="form-control" @bind="@selDtMin" type="datetime-local" title="Data minima eventi da visualizzare">
<label class="input-group-text" for="flusso" title="Selezionare la data massima eventi da visualizzare"><i class="fa-regular fa-calendar-plus"></i></label>
<input class="form-control" @bind="@selDtMax" type="datetime-local" title="Selezionare la data massima eventi da visualizzare">
}
</div>
</div>
+8 -6
View File
@@ -182,6 +182,7 @@ namespace MP.SPEC.Components
currFilt.CurrPage = 0;
currFilt.lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
currFilt.dtMax = RoundDatetime(5);
currFilt.dtMin = RoundDatetime(5).AddHours(-2);
SelFilter = currFilt;
}
@@ -201,11 +202,11 @@ namespace MP.SPEC.Components
// fermo udpate
liveUpdate = false;
// se non ho data rif uso adesso...
DateTime dtMax = SelFilter.dtMax == null ? DateTime.Now : (DateTime)SelFilter.dtMax;
DateTime dtMin = SelFilter.dtMin == null ? DateTime.Now : (DateTime)SelFilter.dtMin;
DateTime dtMax = selDtMax == null ? DateTime.Now : (DateTime)selDtMax;
DateTime dtMin = selDtMin == null ? DateTime.Now : (DateTime)selDtMin;
// aggiungo 2 sec
dtMax = dtMax.AddSeconds(15);
dtMin = dtMin.AddMinutes(-30);
//dtMin = dtMin.AddMinutes(-30);
await MDService.DossiersTakeParamsSnapshotLast(selMacchina, dtMin, dtMax);
lastUpdate = $"{DateTime.Now:yyyy/MM/dd HH:mm:ss}";
}
@@ -213,6 +214,7 @@ namespace MP.SPEC.Components
protected void toggleParams()
{
showEditPar = !showEditPar;
selDtMax = null;
}
protected async Task toggleUpdate()
@@ -225,7 +227,7 @@ namespace MP.SPEC.Components
}
else
{
dtMax = null;
selDtMax = null;
}
}
@@ -244,7 +246,7 @@ namespace MP.SPEC.Components
#region Private Properties
private DateTime? dtMax
private DateTime? selDtMax
{
get => SelFilter.dtMax;
set
@@ -263,7 +265,7 @@ namespace MP.SPEC.Components
}
}
}
private DateTime? dtMin
private DateTime? selDtMin
{
get => SelFilter.dtMin;
set
+44 -30
View File
@@ -368,7 +368,7 @@ namespace MP.SPEC.Data
redisDb.StringSet(currKey, "", TimeSpan.FromSeconds(1));
return answ;
}
/// <summary>
/// Effettua salvataggio snapshot parametri (con stored) + svuota eventuale cache redis
/// </summary>
@@ -421,35 +421,6 @@ namespace MP.SPEC.Data
return answ;
}
/// <summary>
/// Esegue flush memoria redis dato pattern
/// </summary>
/// <param name="pattern"></param>
/// <returns></returns>
private async Task<bool> ExecFlushRedisPattern(RedisValue pattern)
{
bool answ = false;
var listEndpoints = redisConnAdmin.GetEndPoints();
foreach (var endPoint in listEndpoints)
{
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
var server = redisConnAdmin.GetServer(endPoint);
if (server != null)
{
var keyList = server.Keys(redisDb.Database, pattern);
foreach (var item in keyList)
{
await redisDb.KeyDeleteAsync(item);
}
// brutalmente rimuovo intero contenuto DB... DANGER
//await server.FlushDatabaseAsync();
answ = true;
}
}
return answ;
}
/// <summary>
/// Elenco ultimi n record flux log dato macchina e flusso (ordinato x data registrazione)
/// </summary>
@@ -670,15 +641,25 @@ namespace MP.SPEC.Data
#region Private Fields
private const string redisBaseAddr = "MP:";
private const string redisConfKey = redisBaseAddr + "SPEC:Cache:Config";
private const string redisDossByMac = redisBaseAddr + "SPEC:Cache:DossByMac";
private const string redisFluxByMac = redisBaseAddr + "SPEC:Cache:FluxByMac";
private const string redisMacByFlux = redisBaseAddr + "SPEC:Cache:MacByFlux";
private const string redisMacList = redisBaseAddr + "SPEC:Cache:MacList";
private const string redisStatoCom = redisBaseAddr + "SPEC:Cache:StatoCom";
private const string redisTipoArt = redisBaseAddr + "SPEC:Cache:TipoArt";
private static IConfiguration _configuration = null!;
private static ILogger<MpDataService> _logger = null!;
private static Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
@@ -699,5 +680,38 @@ namespace MP.SPEC.Data
private int redisLongTimeCache = 5;
#endregion Private Fields
#region Private Methods
/// <summary>
/// Esegue flush memoria redis dato pattern
/// </summary>
/// <param name="pattern"></param>
/// <returns></returns>
private async Task<bool> ExecFlushRedisPattern(RedisValue pattern)
{
bool answ = false;
var listEndpoints = redisConnAdmin.GetEndPoints();
foreach (var endPoint in listEndpoints)
{
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
var server = redisConnAdmin.GetServer(endPoint);
if (server != null)
{
var keyList = server.Keys(redisDb.Database, pattern);
foreach (var item in keyList)
{
await redisDb.KeyDeleteAsync(item);
}
// brutalmente rimuovo intero contenuto DB... DANGER
//await server.FlushDatabaseAsync();
answ = true;
}
}
return answ;
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2209.2717</Version>
<Version>6.16.2210.510</Version>
</PropertyGroup>
<ItemGroup>
+2 -1
View File
@@ -135,7 +135,8 @@
{
<tr class="@checkSelect(@record.CodArticolo)">
<td>
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm"><i class="bi bi-pencil-square"></i></button>
<button @onclick="() => selRecord(record)" class="btn btn-primary btn-sm" title="Modifica Record"><i class="bi bi-pencil-square"></i></button>
<button @onclick="() => cloneRecord(record)" class="btn btn-info btn-sm" title="Duplica Record"><i class="bi bi-clipboard-check"></i></button>
</td>
<td>
<div>@record.CodArticolo</div>
+19
View File
@@ -136,6 +136,10 @@ namespace MP.SPEC.Pages
}
ListAziende = await MDService.ElencoAziende();
ListTipoArt = await MDService.AnagTipoArtLV();
}
protected override async Task OnParametersSetAsync()
{
await reloadData();
}
@@ -155,6 +159,21 @@ namespace MP.SPEC.Pages
currRecord = selRec;
await Task.Delay(1);
}
protected async Task cloneRecord(AnagArticoli selRec)
{
// creo record duplicato...
AnagArticoli newRec = new AnagArticoli()
{
Azienda = selRec.Azienda,
CodArticolo = selRec.CodArticolo,
DescArticolo = $"CLONE - { selRec.DescArticolo }",
Disegno = selRec.Disegno,
Tipo=selRec.Tipo
};
currRecord = newRec;
await Task.Delay(1);
}
protected async Task update(AnagArticoli selRec)
{
+25 -3
View File
@@ -42,7 +42,7 @@
</select>
</div>
</div>
</div>
@if (currRecord != null)
{
@@ -77,6 +77,12 @@
</div>
</div>
<div class="col-3">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm"># pz</span>
<input type="text" class="form-control" aria-label="Num Pezzi" aria-describedby="inputGroup-sizing-sm" @bind-value="@currRecord.NumPezzi">
<span class="input-group-text" id="inputGroup-sizing-sm">T.Ciclo</span>
<input type="text" class="form-control" aria-label="Tempo Ciclo" aria-describedby="inputGroup-sizing-sm" @bind-value="@currRecord.Tcassegnato">
</div>
</div>
<div class="col-3">
<div class="input-group input-group-sm">
@@ -94,7 +100,6 @@
</div>
</div>
<div class="row mt-2">
<div class="col-3">
<div class="input-group input-group-sm">
<div class="input-group input-group-sm">
@@ -129,6 +134,23 @@
</div>
</div>
</div>
<div class="col-6">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Note</span>
<input type="text" class="form-control" aria-label="Note" aria-describedby="inputGroup-sizing-sm" @bind-value="@currRecord.Note">
</div>
</div>
</div>
<div class="row mt-2">
<div class="col-3">
<span class="input-group-text" id="inputGroup-sizing-sm" title="Attivabile">Att</span>
<div class="form-check form-check-sm form-switch py-1" title="Attivabile">
<input class="form-check-input" type="checkbox" id="mySwitch" name="setupAlarms" title="Attivabile" @bind="@currRecord.Attivabile">
</div>
</div>
<div class="col-3">
</div>
<div class="col-3">
<div class="d-grid gap-2">
<button class="btn btn-warning" @onclick="() => cancel()">Annulla <i class="bi bi-x-circle"></i></button>
@@ -195,7 +217,7 @@
}
else
{
<ListPODL PagerResetReq="pgResetReq" RecordSel="@selRecord"></ListPODL>
<ListPODL PagerResetReq="pgResetReq" RecordSel="@selRecord" updateRecordCount="UpdateTotCount"></ListPODL>
}
</div>
<div class="card-footer py-1">
+5
View File
@@ -155,6 +155,11 @@ namespace MP.SPEC.Pages
await Task.Delay(1);
}
protected void UpdateTotCount(int newTotCount)
{
totalCount = newTotCount;
}
#endregion Protected Methods
#region Private Fields
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2209.2717</h4>
<h4>Versione: 6.16.2210.510</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2209.2717
6.16.2210.510
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2209.2717</version>
<version>6.16.2210.510</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>