Merge branch 'Release/FixNavigazioneGiacenza'

This commit is contained in:
Samuele Locatelli
2022-12-01 13:10:06 +01:00
18 changed files with 246 additions and 193 deletions
-15
View File
@@ -719,22 +719,7 @@ namespace MP.Data.Controllers
g => g.IdxMacchina,
m => m.IdxMacchina,
(g, m) => m
//(m, g) => new Macchine
//{
// IdxMacchina = m.IdxMacchina,
// CodMacchina = m.CodMacchina,
// Descrizione = m.Descrizione,
// Nome = m.Nome,
// Note = m.Note,
// url = m.url,
// locazione = m.locazione,
// css = m.css,
// RowNum = m.RowNum,
// ColNum = m.ColNum
//}
)
//.Distinct()
.AsNoTracking()
.OrderBy(x => x.IdxMacchina)
.ToList();
+7 -4
View File
@@ -254,11 +254,14 @@ else
<div>
@record.IdxODL
</div>
@if (record.IdxODL > 0)
@if (giacenzeConf == "true")
{
<div>
<span class="badge bg-primary textConsensed"><a href="Giacenze?IdxOdl=@record.IdxODL" target="_blank" class="text-light text-decoration-none">APRI GIACENZE</a></span>
</div>
@if (record.IdxODL > 0)
{
<div>
<span class="badge bg-primary textConsensed"><a href="Giacenze?IdxOdl=@record.IdxODL" target="_blank" class="text-light text-decoration-none">APRI GIACENZE</a></span>
</div>
}
}
</div>
</td>
+8
View File
@@ -79,6 +79,7 @@ namespace MP.SPEC.Components
#region Protected Fields
protected string selAzienda = "*";
protected string giacenzeConf = "false";
#endregion Protected Fields
@@ -221,11 +222,18 @@ namespace MP.SPEC.Components
}
}
//prtected bool hasLic
//{
// get => selAzienda == "GIACOVELLI";
//}
protected override async Task OnInitializedAsync()
{
await MDService.ConfigResetCache();
ListGruppiFase = await MDService.ElencoGruppiFase();
ListStati = await MDService.AnagStatiComm();
selAzienda = await MDService.tryGetConfig("AZIENDA");
giacenzeConf = await MDService.tryGetConfig("SPEC_ShowGiacenze");
ListArticoli = await MDService.ArticoliGetSearch(100000, selAzienda, "");
ListMacchine = await MDService.MacchineGetFilt("*");
await reloadData(true);
+12 -4
View File
@@ -2,13 +2,18 @@
<table class="table table-striped table-sm">
<thead>
<tr>
<th>#</th>
<th>
Lotto
@if (!string.IsNullOrEmpty(BatchSel))
{
<button @onclick="() => resetSel()" title="Click per Reset" class="btn btn-info btn-sm"><i class="bi bi-arrow-counterclockwise"></i></button>
}
else
{
<span>#</span>
}
</th>
<th>
Lotto
</th>
<th>Prodotto</th>
<th>Tipo</th>
@@ -25,13 +30,16 @@
{
@foreach (var item in elencoGiacenze)
{
<tr>
<tr class="@checkSelect(item)">
<td class="fw-bold">
@item.IdxRG
</td>
<td class="small textConsensed">
<button @onclick="() => saveSel(item.IdentRG)">@item.IdentRG</button>
<div class="d-flex justify-content-between">
<span>@item.IdentRG</span>
<button class="btn btn-sm btn-primary" @onclick="() => saveSel(item.IdentRG)"><i class="fa-solid fa-arrow-right"></i></button>
</div>
</td>
<td>
+16
View File
@@ -19,6 +19,22 @@ namespace MP.SPEC.Components
#region Protected Properties
public string checkSelect(AnagGiacenzeModel recordSel)
{
string answ = "";
if (BatchSel != null)
{
try
{
answ = (BatchSel == recordSel.IdentRG) ? "table-info" : "";
}
catch
{ }
}
return answ;
}
protected List<AnagGiacenzeModel>? elencoGiacenze { get; set; } = null;
#endregion Protected Properties
+23 -1
View File
@@ -1,7 +1,9 @@
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.WebUtilities;
using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.SPEC.Data;
using MP.SPEC.Pages;
using MP.SPEC.Services;
using NLog;
@@ -72,10 +74,15 @@ namespace MP.SPEC.Components
[Inject]
protected IOApiService MpIoApiCall { get; set; } = null!;
[Inject]
protected NavigationManager NavManager { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected int odlCercato = 0;
/// <summary>
/// Registra chiusura ODL alla data indicata
/// </summary>
@@ -138,6 +145,14 @@ namespace MP.SPEC.Components
protected override async Task OnInitializedAsync()
{
if (NavManager.Uri.Contains("ODL?"))
{
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
if (QueryHelpers.ParseQuery(uri.Query).TryGetValue("IdxOdl", out var _idxOdl))
{
odlCercato = int.Parse(_idxOdl);
}
}
ListStati = await MDService.AnagStatiComm();
}
@@ -411,7 +426,14 @@ namespace MP.SPEC.Components
isLoading = true;
SearchRecords = await MDService.ListODLFilt(currFilter.IsActive, currFilter.SearchVal, currFilter.CodFase, currFilter.CodReparto, currFilter.IdxMacchina, currFilter.DtStart, currFilter.DtEnd);
totalCount = SearchRecords.Count;
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
if (NavManager.Uri.Contains("ODL?"))
{
ListRecords = SearchRecords.Where(x => x.IdxOdl == odlCercato).Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
}
else
{
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
}
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
isLoading = false;
+19 -20
View File
@@ -1,32 +1,31 @@
<div class="bg-info p-2">
<div class="selBlock p-2">
<div class="bg-light">
<table class="table table-striped table-sm">
<thead>
<tr>
<th>ODL</th>
</tr>
</thead>
<tbody>
@if (elencoODL == null || elencoODL.Count == 0)
{
<div class="alert alert-warning" role="alert">No record</div>
}
else
{
@if (elencoODL == null || elencoODL.Count == 0)
{
<div class="alert alert-warning" role="alert">No record</div>
}
else
{
<table class="table table-striped table-sm">
<thead>
<tr class="text-center">
<th>ODL</th>
</tr>
</thead>
<tbody>
@foreach (var item in elencoODL)
{
<tr>
<tr class="text-center">
<td class="fw-bold">
<a class="btn btn-sm btn-primary" target="_blank">
<a class="btn btn-sm btn-primary" href="Giacenze?IdxOdl=@item" target="_blank" title="Mostra Giacenze per ODL">
@item
</a>
</td>
</tr>
}
}
</tbody>
</table>
</tbody>
</table>
}
</div>
</div>
+1 -1
View File
@@ -22,7 +22,7 @@ namespace MP.SPEC.Components
{
[Parameter]
public string BatchSel { get; set; }
public string BatchSel { get; set; } = null!;
private List<int> elencoODL { get; set; } = new List<int>();
+17 -17
View File
@@ -23,7 +23,7 @@
{
foreach (var item in ListGruppiFase)
{
<option value="@item.CodGruppo">@item.DescrGruppo</option>
<option value="@item.CodGruppo">@item.DescrGruppo</option>
}
}
</select>
@@ -42,7 +42,7 @@
{
foreach (var item in ListMacchine)
{
<option value="@item.IdxMacchina">@item.Descrizione</option>
<option value="@item.IdxMacchina">@item.Descrizione</option>
}
}
</select>
@@ -61,7 +61,7 @@
{
foreach (var item in ListStati)
{
<option value="@item.value">@item.label</option>
<option value="@item.value">@item.label</option>
}
}
</select>
@@ -69,20 +69,20 @@
</div>
@if (!isActive || hasOdl)
{
<div class="small mt-2">
<label class="px-2" for="dtMin" title="Selezionare inizio periodo">Inizio Periodo</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="dtMin" title="Selezionare inizio periodo"><i class="fa-regular fa-calendar-minus"></i></label>
<input class="form-control" @bind="@selDtStart" id="dtMin" type="datetime-local" title="Data minima eventi da visualizzare">
</div>
<div class="small mt-2">
<label class="px-2" for="dtMax" title="Selezionare fine periodo">Fine Periodo</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="dtMax" title="Selezionare fine periodo"><i class="fa-regular fa-calendar-plus"></i></label>
<input class="form-control" @bind="@selDtEnd" id="dtMax" type="datetime-local" title="Selezionare fine periodo">
</div>
<div class="small mt-2">
<label class="px-2" for="dtMin" title="Selezionare inizio periodo">Inizio Periodo</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="dtMin" title="Selezionare inizio periodo"><i class="fa-regular fa-calendar-minus"></i></label>
<input class="form-control" @bind="@selDtStart" id="dtMin" type="datetime-local" title="Data minima eventi da visualizzare">
</div>
<div class="small mt-2">
<label class="px-2" for="dtMax" title="Selezionare fine periodo">Fine Periodo</label>
</div>
<div class="px-2 input-group">
<label class="input-group-text" for="dtMax" title="Selezionare fine periodo"><i class="fa-regular fa-calendar-plus"></i></label>
<input class="form-control" @bind="@selDtEnd" id="dtMax" type="datetime-local" title="Selezionare fine periodo">
</div>
}
</div>
</div>
+8 -3
View File
@@ -177,7 +177,8 @@ namespace MP.SPEC.Data
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string readType = "DB";
string currKey = $"{redisArtList}:{azienda}";
string sKey = string.IsNullOrEmpty(searchVal) ? "***" : searchVal;
string currKey = $"{redisArtList}:{azienda}:{sKey}";
// cerco in redis dato valore sel macchina...
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
@@ -1073,8 +1074,12 @@ namespace MP.SPEC.Data
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<PODLModel>($"{rawData}");
readType = "REDIS";
var rawResult = JsonConvert.DeserializeObject<PODLModel>($"{rawData}");
if (rawResult != null)
{
result = rawResult;
readType = "REDIS";
}
}
else
{
+1 -1
View File
@@ -5,7 +5,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP.SPEC</RootNamespace>
<Version>6.16.2211.3015</Version>
<Version>6.16.2212.113</Version>
</PropertyGroup>
<ItemGroup>
+66 -57
View File
@@ -1,68 +1,77 @@
@page "/Giacenze"
<div class="card">
<div class="card-header">
<div class="d-flex justify-content-between">
<div class="px-2">
<h3>Giacenze</h3>
</div>
@if (odlExp == null)
{
<LoadingDataSmall></LoadingDataSmall>
}
else
{
<div class="px-2 text-center">
<div>
<b>ODL @(odlExp.IdxOdl.ToString(padCodXdl))</b>
</div>
<div class="d-flex justify-content-between small">
<div class="px-2">
@odlExp.DataInizio
</div>
<div class="px-2">
>>
</div>
<div class="px-2">
@odlExp.DataFine
</div>
</div>
@if (giacenzeConf == "false")
{
<div class="alert alert-danger">NOT ALLOWED</div>
}
else
{
<div class="card">
<div class="card-header">
<div class="d-flex justify-content-between">
<div class="px-2">
<h3>Giacenze</h3>
</div>
<div class="px-2 text-end">
<div>
<b>@odlExp.CodArticolo</b>
</div>
<div class="small">
@odlExp.DescArticolo
</div>
</div>
}
</div>
</div>
<div class="card-body">
@if (IdxOdl == 0)
{
<LoadingData></LoadingData>
}
else
{
<div class="row">
<div class="@mainTabCss">
<ListGiacenze IdxOdl="@IdxOdl" BatchSelected="saveBatch"></ListGiacenze>
</div>
@if (!string.IsNullOrEmpty(BatchSel))
@if (odlExp == null)
{
<div class="col-2">
<ListOdlLotto BatchSel="@BatchSel"></ListOdlLotto>
<LoadingDataSmall></LoadingDataSmall>
}
else
{
<div class="px-2 text-center">
<div>
<b>ODL @(odlExp.IdxOdl.ToString(padCodXdl))</b>
</div>
<div class="d-flex justify-content-between small">
<div class="px-2">
@odlExp.DataInizio
</div>
<div class="px-2">
>>
</div>
<div class="px-2">
@odlExp.DataFine
</div>
</div>
</div>
<div class="px-2 text-end">
<div>
<b>@odlExp.CodArticolo</b>
</div>
<div class="small">
@odlExp.DescArticolo
</div>
</div>
}
</div>
}
</div>
@*<div class="card-footer">
</div>
<div class="card-body">
@if (IdxOdl == 0)
{
<LoadingData></LoadingData>
}
else
{
<div class="row">
<div class="d-flex justify-content-between">
<div class="@mainTabCss">
<ListGiacenze IdxOdl="@IdxOdl" BatchSelected="saveBatch"></ListGiacenze>
</div>
@if (!string.IsNullOrEmpty(BatchSel))
{
<div class="col-2">
<ListOdlLotto BatchSel="@BatchSel"></ListOdlLotto>
</div>
}
</div>
</div>
}
</div>
@*<div class="card-footer">
</div>*@
</div>
</div>
}
+3
View File
@@ -26,6 +26,8 @@ namespace MP.SPEC.Pages
protected override async Task OnInitializedAsync()
{
await MDService.ConfigResetCache();
giacenzeConf = await MDService.tryGetConfig("SPEC_ShowGiacenze");
await Task.Delay(1);
padCodXdl = await MDService.tryGetConfig("padCodXdl");
var uri = NavManager.ToAbsoluteUri(NavManager.Uri);
@@ -47,6 +49,7 @@ namespace MP.SPEC.Pages
private NavigationManager NavManager { get; set; } = null!;
private string padCodXdl { get; set; } = "00000";
private string giacenzeConf = "false";
[Inject]
private ISessionStorageService sessionStorage { get; set; } = null!;
+45 -58
View File
@@ -68,7 +68,7 @@
<div class="row">
<div class="col-3 pe-0">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Search</span>
<span class="input-group-text" id="inputGroup-sizing-sm">Ricerca</span>
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@artSearch">
</div>
</div>
@@ -131,23 +131,11 @@
<div class="input-group input-group-sm">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Gruppo</span>
<select @bind="@currRecord.CodGruppo" class="form-select">
@if (ListGruppiFase != null)
{
foreach (var item in ListGruppiFase)
{
@if (item.CodGruppo == currRecordControlli.CodGruppo)
{
<option value="@item.CodGruppo" selected>@item.CodGruppo | @item.DescrGruppo</option>
}
else
{
<option value="@item.CodGruppo">@item.CodGruppo | @item.DescrGruppo</option>
}
}
}
</select>
@if (currGruppoSel != null)
{
<input @bind-value="@currGruppoSel.DescrGruppo" class="form-control" disabled />
@* <option value="@currGruppoSel.CodGruppo" selected>@currGruppoSel.CodGruppo | @currGruppoSel.DescrGruppo</option> *@
}
</div>
</div>
</div>
@@ -209,7 +197,7 @@
</div>
<div class="col-3">
<div class="d-grid gap-2">
@if (currRecord.CodArticolo != "" && currRecord.CodFase != "" && currRecord.CodGruppo != "" && currRecord.IdxMacchina != "")
@if (currRecord.CodArticolo != "" && currRecord.CodFase != "" && selReparto != "*" && currRecord.IdxMacchina != "")
{
<button class="btn btn-success" @onclick="() => update(currRecord)">Salva <i class="bi bi-save"></i></button>
}
@@ -221,47 +209,46 @@
</div>
</div>
}
else if (addEnabled)
@* else if (addEnabled)
{
<div class="row">
<div class="col-4">
@*<button class="btn btn-success" @onclick="() => reqNewPODL()">@btnNewText <i class="bi bi-plus-square"></i></button>*@
</div>
@if (reqNew)
{
<div class="col-4">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Azienda</span>
<select @bind="@currAzienda" class="form-select">
@if (ListAziende != null)
{
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
{
<option value="@item.CodGruppo">@item.DescrGruppo</option>
}
}
</select>
</div>
</div>
<div class="col-4">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Search</span>
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@artSearch">
<span class="input-group-text" id="inputGroup-sizing-sm">Articolo</span>
<select @bind="@currArticolo" class="form-select">
@if (ListArticoli != null)
{
foreach (var item in ListArticoli.Where(x => x.Azienda == currAzienda).ToList())
{
<option value="@item.CodArticolo">@item.CodArticolo | @item.DescArticolo | @item.Disegno</option>
}
}
</select>
</div>
</div>
}
</div>
<div class="row">
<div class="col-4">
</div>
@if (reqNew)
{
<div class="col-4">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Azienda</span>
<select @bind="@currAzienda" class="form-select">
@if (ListAziende != null)
{
foreach (var item in ListAziende.Where(x => x.CodGruppo != "*").ToList())
{
<option value="@item.CodGruppo">@item.DescrGruppo</option>
}
}
</select>
</div>
</div>
<div class="col-4">
<div class="input-group input-group-sm">
<span class="input-group-text" id="inputGroup-sizing-sm">Search</span>
<input type="text" class="form-control" aria-label="Art search" aria-describedby="inputGroup-sizing-sm" @bind-value="@artSearch">
<span class="input-group-text" id="inputGroup-sizing-sm">Articolo</span>
<select @bind="@currArticolo" class="form-select">
@if (ListArticoli != null)
{
foreach (var item in ListArticoli.Where(x => x.Azienda == currAzienda).ToList())
{
<option value="@item.CodArticolo">@item.CodArticolo | @item.DescArticolo | @item.Disegno</option>
}
}
</select>
</div>
</div>
}
</div>
}*@
</div>
<div class="card-body">
+17 -9
View File
@@ -109,7 +109,6 @@ namespace MP.SPEC.Pages
ListGruppiFase = allGruppiData.Where(x => x.SelEnabled).ToList();
}
ListStati = await MDService.AnagStatiComm();
//ListArticoli = await MDService.ArticoliGetSearch(100, currAzienda, artSearch);
currAzienda = await MDService.tryGetConfig("AZIENDA");
padCodXdl = await MDService.tryGetConfig("padCodXdl");
}
@@ -138,16 +137,17 @@ namespace MP.SPEC.Pages
/// <returns></returns>
protected async Task reqNewPODL()
{
#if false
if (ListArticoli != null && ListArticoli.Count > 0)
{
//var firstArt = ListArticoli.FirstOrDefault();
//currArticolo = firstArt != null ? firstArt.CodArticolo : "";
var firstArt = ListArticoli.FirstOrDefault(x => x.Azienda.StartsWith(currAzienda));
if (firstArt != null)
{
currArticolo = firstArt.Azienda;
currArticolo = firstArt.CodArticolo;
}
}
}
#endif
artSearch = "";
string codExt = $"{currFase}";
string codGruppo = "";
if (ListGruppiFase != null && ListGruppiFase.Count > 0)
@@ -198,6 +198,7 @@ namespace MP.SPEC.Pages
return;
await Task.Delay(1);
var clonedRec = MP.Data.Utils.POdlExt.convertToPOdl(selRec);
clonedRec.CodGruppo = currGruppoSel.CodGruppo;
var done = await MDService.POdlUpdateRecord(clonedRec);
await callSyncDb(clonedRec);
currRecord = null;
@@ -221,6 +222,8 @@ namespace MP.SPEC.Pages
private PODLExpModel currRecordControlli = new PODLExpModel();
private AnagGruppi currGruppoSel = new AnagGruppi();
private List<AnagArticoli>? ListArticoli;
private List<AnagGruppi>? ListAziende;
@@ -231,8 +234,6 @@ namespace MP.SPEC.Pages
private List<ListValues>? ListStati;
private List<PODLExpModel>? SearchRecords;
#endregion Private Fields
#region Private Properties
@@ -338,7 +339,7 @@ namespace MP.SPEC.Pages
set
{
_currRecord = value;
artSearch = value == null ? "" : value.CodArticolo;
artSearch = value == null ? "" : value.CodArticolo.Substring(0,2);
}
}
@@ -421,9 +422,16 @@ namespace MP.SPEC.Pages
{
isLoading = true;
await Task.Delay(1);
ListMacchine = await MDService.MacchineGetFilt(selReparto);
ListArticoli = await MDService.ArticoliGetSearch(100, currAzienda, artSearch);
if (ListGruppiFase != null)
{
var firstGroup = ListGruppiFase.Where(x => x.CodGruppo == selReparto).FirstOrDefault();
if (firstGroup != null)
{
currGruppoSel = firstGroup;
}
}
isLoading = false;
}
protected string header
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2211.3015</h4>
<h4>Versione: 6.16.2212.113</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2211.3015
6.16.2212.113
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2211.3015</version>
<version>6.16.2212.113</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>