This commit is contained in:
zaccaria.majid
2023-10-30 15:13:05 +01:00
12 changed files with 311 additions and 83 deletions
+3 -1
View File
@@ -57,7 +57,9 @@ namespace MP_TAB_SERV.Components
{
var listMulti = await TDataService.VMSFDGetAll();
ListMacchine = listMulti.Where(x => x.IdxMacchina.Contains($"{RecMSE?.IdxMacchina}#")).ToDictionary(x => x.IdxMacchina, x => $"{x.IdxMacchina.Replace($"{RecMSE?.IdxMacchina}#", "")}");
ListMacchine = listMulti
.Where(x => x.IdxMacchina.Contains($"{RecMSE?.IdxMacchina}#"))
.ToDictionary(x => x.IdxMacchina, x => x.CodMaccArticolo);
if (ListMacchine.Count > 0 && string.IsNullOrEmpty(idxMaccSel))
{
+28
View File
@@ -0,0 +1,28 @@
<div class="row">
<div class="col-12">
<MachSel RecMSE="RecMSE" E_MachSel="SetMacc"></MachSel>
</div>
@if (needConfProd)
{
<div class="col-12 text-danger">
<div class="fs-3">@lblWarnHead</div>
<div class="small">@lblWarnBody <b>@numPz2Conf</b></div>
</div>
@if (!odlOk)
{
<div class="col-12">
<button class="btn btn-warning w-100"><i class="fa fa-check"></i> Fix ODL</button>
</div>
}
}
<div class="col-12">
Slave machine man
</div>
@if (!needConfProd)
{
<div class="col-12">
ODL setup (full)
</div>
}
</div>
+138
View File
@@ -0,0 +1,138 @@
using global::Microsoft.AspNetCore.Components;
using MP.Data.DatabaseModels;
namespace MP_TAB_SERV.Components
{
public partial class OdlMan
{
#region Public Properties
/// <summary>
/// Post update restituisco nuova lista dati
/// </summary>
[Parameter]
public EventCallback<List<MappaStatoExpl>> E_Updated { get; set; }
/// <summary>
/// Verifica ODL OK (ovvero caricato x macchina...)
/// </summary>
public bool odlOk
{
get => (RecMSE != null && RecMSE.IdxOdl > 0);
}
[Parameter]
public MappaStatoExpl? RecMSE { get; set; } = null;
#endregion Public Properties
#region Protected Methods
/// <summary>
/// Aggiorno...
/// </summary>
/// <param name="newDate"></param>
protected async Task DoUpdate()
{
isProcessing = true;
await Task.Delay(1);
isProcessing = false;
await Task.Delay(1);
}
protected override async Task OnParametersSetAsync()
{
await Task.Delay(1);
checkAll();
}
protected async Task SetMacc(string selIdxMacc)
{
isProcessing = true;
await Task.Delay(10);
IdxMaccSel = selIdxMacc;
await DoUpdate();
isProcessing = false;
await Task.Delay(10);
}
#endregion Protected Methods
#region Private Fields
private string lblWarnBody = "Pezzi da confermare: ";
private string lblWarnHead = "Attenzione";
private int numPz2Conf = 0;
#endregion Private Fields
#region Private Properties
private string IdxMaccSel { get; set; } = "";
private int IdxOdl
{
get => RecMSE != null ? RecMSE.IdxOdl ?? 0 : 0;
}
private bool isProcessing { get; set; } = false;
#endregion Private Properties
#region Private Methods
private void checkAll()
{
checkConfProd();
}
private bool needConfProd = true;
/// <summary>
/// verifica se sia necessario confermare la produzione PRIMA di operare sull'ODL
/// </summary>
private void checkConfProd()
{
// verifica se sia necessario confermare produzione
int pz2conf = 0;
#if false
DS_ProdTempi.stp_PzProd_getByMacchinaRow rigaProd;
try
{
rigaProd = DataLayerObj.taPzProd2conf.GetData(idxMacchinaFix)[0];
pz2conf = rigaProd.pezziNonConfermati;
needConfProd = (pz2conf > 0 && !isSlave);
}
catch (Exception exc)
{
logger.lg.scriviLog(string.Format("Errore recupero pezzi da confermare per la macchina {0}{1}{2}", idxMacchinaFix, Environment.NewLine, exc), tipoLog.ERROR);
}
// se necessario mostro warning...
if (needConfProd)
{
// SE mancasse ODL mostro info x poter caricare ODL retrodatato
if (odlOk)
{
lblWarningHead.Text = traduci("ConfProdBeforeContinueHead");
lblWarningBody.Text = traduci("ConfProdBeforeContinueBody");
lblNumPz2Conf.Text = string.Format("{0} pz NC", pz2conf);
}
else
{
lblWarningHead.Text = traduci("setOdlBeforeContinueHead");
lblWarningBody.Text = traduci("setOdlBeforeContinueBody");
lblNumPz2Conf.Text = string.Format("{0} pz NC", pz2conf);
}
}
divPz2Conf.Visible = needConfProd;
divWarn.Visible = needConfProd;
lbtFixOdl.Visible = !odlOk;
mod_ODL1.isEnabled = !needConfProd;
#endif
}
#endregion Private Methods
}
}
-5
View File
@@ -1,5 +0,0 @@
<h3>OdlProdFix</h3>
@code {
}
-5
View File
@@ -1,5 +0,0 @@
<h3>OdlSetup</h3>
@code {
}
+51 -38
View File
@@ -18,13 +18,13 @@ namespace MP_TAB_SERV.Components
/// registrato nuovo valore
/// </summary>
[Parameter]
public EventCallback<bool> E_newVal { get; set; }
public EventCallback<bool> E_reset { get; set; }
/// <summary>
/// registrato nuovo valore
/// Post update restituisco nuova lista dati
/// </summary>
[Parameter]
public EventCallback<bool> E_reset { get; set; }
public EventCallback<List<MappaStatoExpl>> E_Updated { get; set; }
/// <summary>
/// Verifica ODL OK (ovvero caricato x macchina...)
@@ -39,42 +39,17 @@ namespace MP_TAB_SERV.Components
#endregion Public Properties
#region Public Methods
/// <summary>
/// Aggiorno valori produzione alla data richiesta...
/// </summary>
/// <param name="newDate"></param>
public async Task doUpdate()
{
isProcessing = true;
await Task.Delay(1);
datiProdAct = await TabDServ.StatoProdMacchina(IdxMaccSel, dtReqUpdate);
// aggiorno visualizzazione...
numPzProdotti = datiProdAct.PzTotODL;
numPz2Rec = datiProdAct.Pz2RecTot;
numPzScaConf = datiProdAct.PzConfScarto;
numPzBuoniConf = datiProdAct.PzConfBuoni;
numPzProdotti2Rec = datiProdAct.Pz2RecTot;
numPzScarto2Rec = datiProdAct.Pz2RecScarto;
dtInizio = RecMSE?.DataInizioOdl ?? DateTime.Today.AddMonths(-2);
dtFine = dtReqUpdate;
isProcessing = false;
await Task.Delay(1);
}
#endregion Public Methods
#region Protected Properties
protected string ConfBg
{
get => showInnov ? "bg-warning text-dark" : "bg-success text-light";
}
protected string ConfTitle
{
get => showInnov ? "Nascondi conferma" : "Mostra conferma";
}
protected string ConfBg
{
get => showInnov ? "bg-warning text-dark" : "bg-success text-light";
}
/// <summary>
/// Dati produzioen rilevati
@@ -130,8 +105,11 @@ namespace MP_TAB_SERV.Components
}
protected int numPzProdotti { get; set; } = 0;
protected int numPzProdotti2Rec { get; set; } = 0;
protected int numPzScaConf { get; set; } = 0;
protected int numPzScarto2Rec { get; set; } = 0;
[Inject]
@@ -144,6 +122,28 @@ namespace MP_TAB_SERV.Components
#region Protected Methods
/// <summary>
/// Aggiorno valori produzione alla data richiesta...
/// </summary>
/// <param name="newDate"></param>
protected async Task DoUpdate()
{
isProcessing = true;
await Task.Delay(1);
datiProdAct = await TabDServ.StatoProdMacchina(IdxMaccSel, dtReqUpdate);
// aggiorno visualizzazione...
numPzProdotti = datiProdAct.PzTotODL;
numPz2Rec = datiProdAct.Pz2RecTot;
numPzScaConf = datiProdAct.PzConfScarto;
numPzBuoniConf = datiProdAct.PzConfBuoni;
numPzProdotti2Rec = datiProdAct.Pz2RecTot;
numPzScarto2Rec = datiProdAct.Pz2RecScarto;
dtInizio = RecMSE?.DataInizioOdl ?? DateTime.Today.AddMonths(-2);
dtFine = dtReqUpdate;
isProcessing = false;
await Task.Delay(1);
}
protected override async Task OnInitializedAsync()
{
lblOut = "";
@@ -154,7 +154,7 @@ namespace MP_TAB_SERV.Components
enablePzProdLasciati = SMServ.GetConfBool("enablePzProdLasciati");
confRett = SMServ.GetConfBool("confRett");
modoConfProd = SMServ.GetConfInt("modoConfProd");
await doUpdate();
await DoUpdate();
}
}
@@ -182,10 +182,10 @@ namespace MP_TAB_SERV.Components
// sollevo evento!
dtReqUpdate = DateTime.Now;
numPzLasciati = 0;
await doUpdate();
isProcessing = false;
await DoUpdate();
await Task.Delay(1);
await E_newVal.InvokeAsync(true);
await RefreshData();
isProcessing = false;
}
protected void setConfirmBtn(bool newVal)
@@ -198,7 +198,7 @@ namespace MP_TAB_SERV.Components
isProcessing = true;
await Task.Delay(10);
IdxMaccSel = selIdxMacc;
await doUpdate();
await DoUpdate();
isProcessing = false;
await Task.Delay(10);
}
@@ -217,8 +217,11 @@ namespace MP_TAB_SERV.Components
#region Private Fields
private bool confRett = false;
private bool enablePzProdLasciati = false;
private string lblOut = "";
private int modoConfProd = 0;
#endregion Private Fields
@@ -226,7 +229,9 @@ namespace MP_TAB_SERV.Components
#region Private Properties
private DateTime dtReqUpdate { get; set; } = DateTime.Now;
private string IdxMaccSel { get; set; } = "";
private bool isProcessing { get; set; } = false;
private int MatrOpr
@@ -235,6 +240,7 @@ namespace MP_TAB_SERV.Components
}
private int numPzLasc { get; set; } = 0;
private bool showConfirm { get; set; } = true;
private bool showInnov { get; set; } = false;
@@ -262,6 +268,13 @@ namespace MP_TAB_SERV.Components
return fatto;
}
private async Task RefreshData()
{
List<MappaStatoExpl> ListMSE = await MDataService.MseGetAll(true);
await MServ.SaveMse(ListMSE);
await E_Updated.InvokeAsync(ListMSE);
}
#endregion Private Methods
#if false
+19 -25
View File
@@ -4,15 +4,15 @@
<div class="offcanvas offcanvas-end text-start" tabindex="-1" id="offcanvasTabMenu" aria-labelledby="offcanvasTabMenuLabel">
<div class="offcanvas-header bg-secondary text-light" style="z-index: 9999">
<div class="d-flex flex-row">
<div class="p-0">
<img src="images/LogoSteamware.png" class="img-fluid" width="40px" />
<div class="py-0 px-2">
<img src="images/LogoEgw.png" class="img-fluid" width="60" />
</div>
<div class="p-0 pl-1">
<div class="flex-row">
<b class="modal-title fs-2">EgalWare</b>
</div>
<div class="flex-row">
<small>Main Menu</small>
<small>MES Solutions</small>
</div>
</div>
</div>
@@ -26,36 +26,30 @@
</div>
<div class="d-flex flex-column">
<div class="list-group">
@foreach (var item in MenuItems)
{
<a class="p-2 list-group-item list-group-item-action" href="@item.NavigateUrl" style="@isActive(item.NavigateUrl)"><i class="fa fa-lg @item.icona pe-2"></i> @item.Testo</a>
<button class="p-2 list-group-item list-group-item-action @cssActive(item.NavigateUrl) link-underline link-underline-opacity-0 link-underline-opacity-75-hover" @onclick="() => SetPage(item.NavigateUrl)" data-bs-dismiss="offcanvas"><i class="fa fa-lg @item.icona pe-2"></i> @item.Testo</button>
}
</div>
</div>
<div class="my-4">
<button type="button" class="btn btn-secondary w-100" data-bs-dismiss="offcanvas" aria-label="Close">Chiudi</button>
</div>
<div class="my-4">
<div class="d-flex justify-content-center">
<div class="py-0 px-2">
<img src="images/LogoSteamware.png" class="img-fluid" width="60" />
</div>
<div class="p-0 pl-1">
<div class="flex-row">
<b class="modal-title fs-1">MAPO MES</b>
</div>
<div class="flex-row">
<small>TAB Controller - MES Suite</small>
</div>
</div>
</div>
</div>
</div>
</div>
@code {
[Parameter]
public List<LinkMenu> MenuItems { get; set; } = new List<LinkMenu>();
[Inject]
protected NavigationManager navManager { get; set; } = null!;
protected string isActive(string currUri)
{
string answ = "";
if (navManager.Uri.Contains(currUri))
{
answ = "background-color: #212427; color: #fff";
}
return answ;
}
}
+37
View File
@@ -0,0 +1,37 @@
using global::Microsoft.AspNetCore.Components;
using MP.Data.DatabaseModels;
namespace MP_TAB_SERV.Components
{
public partial class SlideMenu
{
#region Public Properties
[Parameter]
public List<LinkMenu> MenuItems { get; set; } = new List<LinkMenu>();
#endregion Public Properties
#region Protected Properties
[Inject]
protected NavigationManager navManager { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected string cssActive(string currUri)
{
return navManager.Uri.Contains(currUri) ? "bg-dark text-light" : "";
}
protected async Task SetPage(string tgtUrl)
{
await Task.Delay(1);
navManager.NavigateTo(tgtUrl);
}
#endregion Protected Methods
}
}
+1 -1
View File
@@ -9,6 +9,6 @@
else
{
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<ProdConfirm RecMSE="CurrMSE" E_newVal="RefreshMBlock"></ProdConfirm>
<ProdConfirm RecMSE="CurrMSE" E_Updated="RefreshData"></ProdConfirm>
<ProdStat RecMSE="CurrMSE"></ProdStat>
}
+3 -6
View File
@@ -1,15 +1,12 @@
@page "/odl"
<MseSampler SampleMult="0.5" E_Updated="RefreshData"></MseSampler>
@if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null)
{
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
}
else
{
<div>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
</div>
<MachSel></MachSel>
<OdlProdFix></OdlProdFix>
<OdlSetup></OdlSetup>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<OdlMan RecMSE="CurrMSE" E_Updated="RefreshData"></OdlMan>
}
+29
View File
@@ -40,6 +40,35 @@ namespace MP_TAB_SERV.Pages
}
}
protected async Task RefreshData(List<MappaStatoExpl> newList)
{
var ListMSE = newList;
if (!string.IsNullOrEmpty(IdxMacc))
{
var rawData = ListMSE.Find(x => x.IdxMacchina == IdxMacc);
if (rawData != null)
{
CurrMSE = rawData;
}
else
{
await RefreshMBlock();
}
}
await InvokeAsync(StateHasChanged);
}
protected async Task RefreshMBlock()
{
// recupero MSE macchina....
if (!string.IsNullOrEmpty(IdxMacc))
{
CurrMSE = await MsgServ.GetMachineMse(IdxMacc);
}
}
#endregion Private Methods
}
}
+2 -2
View File
@@ -102,7 +102,7 @@ namespace MP.Data.Services
return Task.FromResult(dbController.MacchineGetAll());
}
public async Task<List<MappaStatoExpl>> MseGetAll()
public async Task<List<MappaStatoExpl>> MseGetAll(bool forceDb = false)
{
int maxAge = 2000;
int.TryParse(_configuration.GetValue<string>("ServerConf:maxAge"), out maxAge);
@@ -111,7 +111,7 @@ namespace MP.Data.Services
List<MappaStatoExpl>? result = new List<MappaStatoExpl>();
// cerco in redis...
RedisValue rawData = redisDb.StringGet(redisMseKey);
if (rawData.HasValue)
if (rawData.HasValue && !forceDb)
{
result = JsonConvert.DeserializeObject<List<MappaStatoExpl>>($"{rawData}");
stopWatch.Stop();