Merge branch 'Release/AddTab03CiCd01'

This commit is contained in:
Samuele Locatelli
2023-12-18 10:36:06 +01:00
67 changed files with 1967 additions and 1040 deletions
+22
View File
@@ -699,6 +699,28 @@ INVE:installer:
- *hashBuild
- *nexusUpload
TAB3:installer:
stage: installer
tags:
- win
variables:
APP_NAME: MP-TAB-SERV
SOL_NAME: MP-TAB3
NEXUS_PATH: MP-TAB3
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
rules:
- if: $CI_COMMIT_BRANCH == 'master'
- if: $CI_COMMIT_BRANCH == 'develop'
needs: ["TAB3:build"]
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish -p:verbosity=quiet
# qui il deploy su nexus...
- *hashBuild
- *nexusUpload
# CONF:installer:
# stage: installer
# tags:
+5
View File
@@ -0,0 +1,5 @@
{
"recommendations": [
"cweijan.dbclient-jdbc"
]
}
@@ -0,0 +1,8 @@
@if (ShowInsFermata)
{
<button class="btn w-100 btn-lg flashingRed mb-2 p-3" @onclick="@GoToFermate"><i class="fa fa-lg fa-exclamation-triangle"></i> DICHIARARE FERMO <i class="fa fa-lg fa-exclamation-triangle"></i></button>
}
@if (ShowReqControls)
{
<button class="btn w-100 btn-lg flashingPurple mb-2 p-3" @onclick="GoToControls"><i class="fa fa-lg fa-flask"></i> EFFETTUARE CONTROLLO<i class="fa fa-lg fa-flask"></i></button>
}
@@ -0,0 +1,136 @@
using Microsoft.AspNetCore.Components;
using MP.Data.DatabaseModels;
using MP.Data.Services;
using MP_TAB_SERV.Shared;
namespace MP_TAB_SERV.Components
{
public partial class CheckControls
{
#region Public Properties
[Parameter]
public MappaStatoExpl? RecMSE { get; set; } = null;
#endregion Public Properties
#region Protected Properties
/// <summary>
/// Determina se dato lo stato dell'impianto si debba mostrare btn fermata perché
/// - fermo &gt; xx min (da web.config, es 20')
/// - impianto fermo (controllando idxStato: priorità &gt; 1)
/// </summary>
protected bool CheckShowInsFermata
{
get
{
bool answ = false;
int idxStato = 0;
double durata = 0;
int durMinWarning = SMServ.GetConfInt("durMinWarning");
if (RecMSE != null)
{
idxStato = RecMSE.IdxStato ?? 0;
durata = RecMSE.Durata ?? 0;
if (durata >= durMinWarning)
{
try
{
// in questo caso controllo idxStato... e recupero priorità se > 1 -->
// richiesta qualifica
answ = SMServ.GetStateRow(idxStato).Priorita > 1;
}
catch
{ }
}
}
return answ;
}
}
/// <summary>
/// Verifica necessità visualizzare il check controlli
/// </summary>
protected async Task<bool> CheckShowReqControls()
{
bool answ = false;
if (RecMSE != null)
{
// SE abilitata gestione controlli...
bool enableCtrl = SMServ.GetConfBool("enableControlli");
if (enableCtrl)
{
int intervalloControlli = SMServ.GetConfInt("intervalloControlli");
// cerco ultimo controllo fatto
DateTime lastControl = DateTime.Now.AddYears(-1);
try
{
var tabCtrls = await TabDServ.RegControlliLast(RecMSE.IdxMacchina);
if (tabCtrls != null && tabCtrls.Count > 0)
{
var thisRec = tabCtrls.FirstOrDefault();
if (thisRec != null)
{
lastControl = thisRec.DataOra;
if (Math.Abs(DateTime.Now.Subtract(lastControl).TotalMinutes) >= intervalloControlli)
{
answ = true;
}
}
}
}
catch
{ }
}
}
return answ;
}
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
protected bool ShowInsFermata { get; set; } = false;
protected bool ShowReqControls { get; set; } = false;
[Inject]
protected SharedMemService SMServ { get; set; } = null!;
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
protected DateTime lastCheck = DateTime.Today;
protected string lastIdxMacc = "";
#endregion Protected Properties
#region Protected Methods
protected void GoToControls()
{
NavMan.NavigateTo("controls");
}
protected void GoToFermate()
{
NavMan.NavigateTo("prod-stop");
}
protected override async Task OnParametersSetAsync()
{
if (RecMSE != null)
{
DateTime adesso = DateTime.Now;
if (adesso.Subtract(lastCheck).TotalSeconds > 15 || lastIdxMacc != RecMSE.IdxMacchina)
{
ShowInsFermata = CheckShowInsFermata;
ShowReqControls = await CheckShowReqControls();
lastIdxMacc = RecMSE.IdxMacchina;
lastCheck = adesso;
}
}
}
#endregion Protected Methods
}
}
@@ -0,0 +1,63 @@
.flashingPurple {
animation-duration: 0.75s;
animation-timing-function: steps(2);
animation-iteration-count: infinite;
animation-direction: alternate;
animation-play-state: running;
animation-name: flsBlue;
transform: translateZ(0);
}
@keyframes flsBlue {
from {
color: #ffc107;
background-color: #7623c8;
/*border: 5px solid #dc3545;*/
}
to {
color: #FFF;
background-color: #00b1ec;
/*border: 5px solid #ffc107;*/
}
}
.flashingRed {
animation-duration: 0.75s;
animation-timing-function: steps(2);
animation-iteration-count: infinite;
animation-direction: alternate;
animation-play-state: running;
animation-name: flsRed;
transform: translateZ(0);
}
@keyframes flsRed {
from {
color: #ffc107;
background-color: #c82332;
/*border: 5px solid #dc3545;*/
}
to {
color: #FFF;
background-color: #ecb100;
/*border: 5px solid #ffc107;*/
}
}
.flashingBlue {
animation-duration: 0.75s;
animation-timing-function: steps(2);
animation-iteration-count: infinite;
animation-direction: alternate;
animation-play-state: running;
animation-name: flsBlue;
transform: translateZ(0);
}
@keyframes flsBlue {
from {
color: #ffc107;
background-color: #2323c8;
/*border: 5px solid #dc3545;*/
}
to {
color: #FFF;
background-color: #00b1ec;
/*border: 5px solid #ffc107;*/
}
}
@@ -0,0 +1,71 @@
.flashingPurple {
animation-duration: 0.75s;
animation-timing-function: steps(2);
animation-iteration-count: infinite;
animation-direction: alternate;
animation-play-state: running;
animation-name: flsBlue;
transform: translateZ(0);
}
@keyframes flsBlue {
from {
color: #ffc107;
background-color: #7623c8;
/*border: 5px solid #dc3545;*/
}
to {
color: #FFF;
background-color: #00b1ec;
/*border: 5px solid #ffc107;*/
}
}
.flashingRed {
animation-duration: 0.75s;
animation-timing-function: steps(2);
animation-iteration-count: infinite;
animation-direction: alternate;
animation-play-state: running;
animation-name: flsRed;
transform: translateZ(0);
}
@keyframes flsRed {
from {
color: #ffc107;
background-color: #c82332;
/*border: 5px solid #dc3545;*/
}
to {
color: #FFF;
background-color: #ecb100;
/*border: 5px solid #ffc107;*/
}
}
.flashingBlue {
animation-duration: 0.75s;
animation-timing-function: steps(2);
animation-iteration-count: infinite;
animation-direction: alternate;
animation-play-state: running;
animation-name: flsBlue;
transform: translateZ(0);
}
@keyframes flsBlue {
from {
color: #ffc107;
background-color: #2323c8;
/*border: 5px solid #dc3545;*/
}
to {
color: #FFF;
background-color: #00b1ec;
/*border: 5px solid #ffc107;*/
}
}
+1
View File
@@ -0,0 +1 @@
.flashingPurple{animation-duration:.75s;animation-timing-function:steps(2);animation-iteration-count:infinite;animation-direction:alternate;animation-play-state:running;animation-name:flsBlue;transform:translateZ(0);}@keyframes flsBlue{from{color:#ffc107;background-color:#7623c8;}to{color:#fff;background-color:#00b1ec;}}.flashingRed{animation-duration:.75s;animation-timing-function:steps(2);animation-iteration-count:infinite;animation-direction:alternate;animation-play-state:running;animation-name:flsRed;transform:translateZ(0);}@keyframes flsRed{from{color:#ffc107;background-color:#c82332;}to{color:#fff;background-color:#ecb100;}}.flashingBlue{animation-duration:.75s;animation-timing-function:steps(2);animation-iteration-count:infinite;animation-direction:alternate;animation-play-state:running;animation-name:flsBlue;transform:translateZ(0);}@keyframes flsBlue{from{color:#ffc107;background-color:#2323c8;}to{color:#fff;background-color:#00b1ec;}}
+19 -5
View File
@@ -1,9 +1,23 @@
<div class="row bg-dark text-light px-2">
<div class="col-6 text-left">
<b>MP-TAB2 @(DateTime.Today.Year)</b> | <span class="small">v.@version</span>
<div class="row bg-dark text-light px-2 small">
<div class="col-4 text-left text-nowrap pe-0">
<b>MP-TAB2 @(DateTime.Today.Year)</b> <span class="small" style="font-size:0.6rem;">v.@version</span>
</div>
<div class="col-6 text-end">
<span class="small">@($"{DateTime.Now:HH:mm:ss}")</span> | <a class="text-light" href="https://www.egalware.com/" target="_blank"><img class="img-fluid" width="16" src="images/LogoEgw.png" /> Egalware </a>
<div class="col-4 d-flex flex-column justify-content-center">
@if (typeScadLogin > 0)
{
@if (CurrExpVal < 0)
{
<div class="text-danger">TIMER SCADUTO!</div>
}
else
{
<ProgBar currVal="@CurrExpVal" maxVal="@MaxExpVal" singleLine="true" baseUM="m" yelLim="@yLimit" redLim="@rLimit"></ProgBar>
}
}
</div>
<div class="col-4 text-end d-flex align-items-center justify-content-end">
<span class="small">@($"{DateTime.Now:HH:mm:ss}")</span> | <a class="text-light text-decoration-none" href="https://www.egalware.com/" target="_blank"><img class="img-fluid" width="16" src="images/LogoEgw.png" /> Egalware </a>
</div>
</div>
+60 -32
View File
@@ -6,13 +6,6 @@ namespace MP_TAB_SERV.Components
{
public partial class CmpFooter : IDisposable
{
[Inject]
protected SharedMemService SMServ { get; set; } = null!;
[Inject]
protected MessageService MsgServ { get; set; } = null!;
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
#region Public Methods
public void Dispose()
@@ -25,26 +18,47 @@ namespace MP_TAB_SERV.Components
}
}
public double CurrExpVal { get; set; } = 50;
public double MaxExpVal { get; set; } = 100;
public double yLimit { get; set; } = 30;
public double rLimit { get; set; } = 10;
public string timeUm
{
get
{
string answ = "m";
if (CurrExpVal > 60)
{
answ = "h";
}
else if (CurrExpVal > 1440)
{
answ = "gg";
}
return answ;
}
}
public void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
{
var diffOfTime = DateTime.Now - MsgServ.dtLastAction;
var pUpd = Task.Run(async () =>
{
if (typeScadLogin > 0)
{
await Task.Delay(1);
await InvokeAsync(() => StateHasChanged());
if(diffOfTime.Minutes >= dtTimerScadenzaLogin)
{
NavMan.NavigateTo("logout");
}
//Log.Trace("CmpFooter Timer elapsed");
});
var diffOfTime = DateTime.Now.Subtract(MsgServ.dtLastAction);
CurrExpVal = MaxExpVal - diffOfTime.TotalMinutes;
}
await InvokeAsync(() => StateHasChanged());
});
pUpd.Wait();
}
public void StartTimer()
{
int tOutPeriod = dtTimerScadenzaLogin * 60000;
int tOutPeriod = 1000;
aTimer = new System.Timers.Timer(tOutPeriod);
aTimer.Elapsed += ElapsedTimer;
aTimer.Enabled = true;
@@ -53,37 +67,51 @@ namespace MP_TAB_SERV.Components
#endregion Public Methods
#region Protected Properties
protected int dtScadLogin { get; set; } = 0;
[Inject]
protected MessageService MsgServ { get; set; } = null!;
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
[Inject]
protected SharedMemService SMServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
int dtTimerScadenzaLogin { get; set; } = 0;
protected int typeScadLogin { get; set; } = 0;
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
var rawVers = typeof(Program).Assembly.GetName().Version;
version = rawVers != null ? rawVers : new Version("0.0.0.0");
//dtTimerScadenzaLogin = SMServ.GetConfInt("TAB_dtTimerScadLogin");
//dtTimerScadenzaLogin = SMServ.GetConfInt("TAB_dtTimerScadLogin");
//if (dtTimerScadenzaLogin > 0)
//{
// //StartTimer();
//}
typeScadLogin = SMServ.GetConfInt("TAB_TypeScadLogin");
dtScadLogin = SMServ.GetConfInt("TAB_dtTimerScadLogin");
MaxExpVal = dtScadLogin;
yLimit = MaxExpVal * 0.3;
rLimit = MaxExpVal * 0.1;
StartTimer();
}
//protected override void OnInitialized()
//{
//}
#endregion Protected Methods
#region Private Fields
private System.Timers.Timer aTimer = null!;
private static Logger Log = LogManager.GetCurrentClassLogger();
private System.Timers.Timer aTimer = null!;
private Version version = null!;
#endregion Private Fields
#region Private Properties
private int dtTimerScadenzaLogin { get; set; } = 0;
#endregion Private Properties
}
}
+11 -10
View File
@@ -1,17 +1,18 @@
<div class="top-row d-flex justify-content-between text-light">
<div class="col-4">
<span>
<div class="col-4 d-flex">
<div class="pe-1">
<button class="btn btn-sm @ResetClass" @onclick="() => ForceReload()" title="Update"><i class="fa-solid fa-rotate"></i></button>
@UserName
</span>
<sub>[@MatrOpr]</sub>
</div>
<div class="small fw-light lh-sm">
<div class="small">@UserName</div>
<small>@MatrOpr</small>
</div>
</div>
<div class="col-4 text-center d-flex justify-content-center">
<div class="text-decoration-none text-light" @onclick="()=>backToSM()">
<i class="fa-solid fa-house"></i> &nbsp;
<div class="col-4 text-center d-flex justify-content-center px-0">
<div class="btn btn-outline-info p-1 text-decoration-none text-light" @onclick="()=>backToSM()">
<i class="fa-solid fa-house"></i>
MapoTAB2
&nbsp;
<img src="images/LogoSteamware.png" style="height: 1rem" />
<img src="images/LogoSteamware.png" style="height: 1.3rem" />
</div>
</div>
<div class="col-4 text-end">
+45 -31
View File
@@ -15,6 +15,8 @@ namespace MP_TAB_SERV.Components
[Parameter]
public List<LinkMenu> CurrMenuItems { get; set; } = new List<LinkMenu>();
[Parameter]
public EventCallback<bool> EA_UserIsOk { get; set; }
#endregion Public Properties
@@ -27,12 +29,13 @@ namespace MP_TAB_SERV.Components
#region Protected Properties
protected string CurrOprTknLS { get; set; } = null!;
//protected Guid CurrDevGuid { get; set; }
protected string LastOpenedPage { get; set; } = null!;
protected string CurrMacc { get; set; } = null!;
protected string CurrOprTknRedis { get; set; } = null!;
protected DateTime expDT { get; set; } = DateTime.Now;
protected int expLoginType { get; set; } = 0;
protected bool HideMenu
{
@@ -63,7 +66,15 @@ namespace MP_TAB_SERV.Components
protected async Task RefreshLogIn(string decodValue)
{
bool done = await MsgServ.DoLogIn(decodValue);
bool done = false;
if (expLoginType == 0)
{
done = await MsgServ.DoLogIn(decodValue, false);
}
else
{
done = await MsgServ.DoLogIn(decodValue, true);
}
if (done)
{
if (!string.IsNullOrEmpty(LastOpenedPage) && !string.IsNullOrEmpty(CurrMacc))
@@ -84,7 +95,7 @@ namespace MP_TAB_SERV.Components
Log.Info("Start ForceReload");
ResetClass = "btn-warning";
await InvokeAsync(StateHasChanged);
var currToken = await MsgServ.GetCurrOperDtoAsync();
var currToken = await MsgServ.GetCurrOperDtoLSAsync();
var lastOpr = await MsgServ.GetLastMatrOprAsync();
// reset cache varie
await MsgServ.ClearLocalStor();
@@ -92,7 +103,7 @@ namespace MP_TAB_SERV.Components
await MDataService.FlushCache();
// salvo di nuovo opr
await MsgServ.SetLastMatrOprAsync(lastOpr);
await MsgServ.SetCurrOperDtoAsync(currToken);
await MsgServ.SetCurrOperDtoLSAsync(currToken);
// reload MStor
await ReloadMemStor();
// calcolo tempo esecuzione
@@ -121,46 +132,49 @@ namespace MP_TAB_SERV.Components
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
int expDays = SMServ.GetConfInt("cookieDayExpire");
expDT = DateTime.Now.AddDays(expDays);
expLoginType = SMServ.GetConfInt("TAB_TypeScadLogin");
var CurrDevGuid = await MsgServ.GetCurrDevGuidLSAsync();
CurrOprTknLS = await MsgServ.GetCurrOperDtoAsync();
LastOpenedPage = await MsgServ.LastOpenedPageGet();
CurrMacc = await MsgServ.IdxMaccGet();
var decodedUrl = Uri.UnescapeDataString(CurrOprTknLS);
// verifico se non avessi dati operatore
//var diffOfTime = DateTime.Now - MsgServ.dtLastAction;
//if (diffOfTime.Minutes >= 1)
//{
// NavMan.NavigateTo("logout");
//}
//else
if (MsgServ.RigaOper == null)
//if (string.IsNullOrEmpty(CurrDevGuid.ToString()))
if (CurrDevGuid == Guid.Empty)
{
await RefreshLogIn(decodedUrl);
CurrDevGuid = Guid.NewGuid();
await MsgServ.SetCurrDevGuidLSAsync(CurrDevGuid);
}
CurrOprTknRedis = await TDService.OperatoreGetRedis(MatrOpr);
LastOpenedPage = await MsgServ.LastOpenedPageGet();
CurrMacc = await MsgServ.IdxMaccGet();
CurrOprTknLS = await MsgServ.GetCurrOperDtoLSAsync();
var decodedUrl = Uri.UnescapeDataString(CurrOprTknLS);
if (!string.IsNullOrEmpty(CurrOprTknLS))
{
var decryptedData = MsgServ.DecryptData(CurrOprTknLS);
if (!string.IsNullOrEmpty(decryptedData))
{
var oprObj = JsonConvert.DeserializeObject<userTknDTO>(decryptedData);
if (oprObj != null)
{
MsgServ.RigaOper = oprObj.currOpr;
}
}
}
if (CurrOprTknRedis == "")
CurrOprTknRedis = await TDService.OperatoreGetRedis(MatrOpr, CurrDevGuid);
if (string.IsNullOrEmpty(CurrOprTknRedis))
{
if (!NavMan.Uri.Contains("reg-new-device"))
{
NavMan.NavigateTo("reg-new-device", true);
}
}
else if (CurrOprTknRedis != "")
else if (!string.IsNullOrEmpty(CurrOprTknRedis) && CurrOprTknRedis == CurrOprTknLS)
{
//if (!NavMan.Uri.Contains("status-map"))
//{
//}
//if (LastOpenedPage != "")
//{
// NavMan.NavigateTo(LastOpenedPage, true);
//}
await RefreshLogIn(decodedUrl);
await EA_UserIsOk.InvokeAsync(true);
}
}
+9 -4
View File
@@ -10,6 +10,9 @@ namespace MP_TAB_SERV.Components
{
#region Public Properties
[Parameter]
public EventCallback<bool> E_Updated { get; set; }
[Parameter]
public MappaStatoExpl? RecMSE { get; set; } = null;
@@ -45,28 +48,28 @@ namespace MP_TAB_SERV.Components
get => showInsert ? "Nascondi Controllo" : "Registra Controllo";
}
protected bool enableControlli { get; set; } = true;
protected List<RegistroControlliModel> ListComplete { get; set; } = new List<RegistroControlliModel>();
protected List<RegistroControlliModel> ListPaged { get; set; } = new List<RegistroControlliModel>();
[Inject]
protected MessageService MServ { get; set; } = null!;
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
[Inject]
protected SharedMemService SMServ { get; set; } = null!;
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected bool enableControlli { get; set; } = true;
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
if (RecMSE != null)
{
enableControlli = SMServ.GetConfBool("enableControlli");
IdxMaccSel = RecMSE.IdxMacchina;
DateTime fine = DateTime.Today.AddDays(1);
@@ -83,6 +86,7 @@ namespace MP_TAB_SERV.Components
showInsert = false;
showNote = false;
await doUpdate();
await E_Updated.InvokeAsync(false);
isProcessing = false;
}
@@ -99,6 +103,7 @@ namespace MP_TAB_SERV.Components
showInsert = false;
showNote = false;
await doUpdate();
await E_Updated.InvokeAsync(true);
isProcessing = false;
}
+32 -6
View File
@@ -1,6 +1,7 @@
using global::Microsoft.AspNetCore.Components;
using MP.Data.DatabaseModels;
using MP.Data.Services;
using MP_TAB_SERV.Shared;
using System;
using System.Reflection.Metadata;
@@ -28,43 +29,68 @@ namespace MP_TAB_SERV.Components
if (idxMaccSel != value)
{
idxMaccSel = value;
MsgServ.UserPrefSet(idxMaccCurr, value);
E_MachSel.InvokeAsync(value).ConfigureAwait(false);
}
}
}
private string idxMaccSel { get; set; } = "";
[Inject]
protected MessageService MsgServ { get; set; } = null!;
protected Dictionary<string, string>? ListMacchine { get; set; } = null;
[Inject]
protected SharedMemService MServ { get; set; } = null!;
protected SharedMemService SMServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected string idxMaccCurr
{
get
{
string answ = "";
if (RecMSE != null)
{
answ = RecMSE?.IdxMacchina ?? "";
}
return answ;
}
}
protected override async Task OnParametersSetAsync()
{
// inizilamente riporto machcina corrente da MSE
if (RecMSE != null)
{
// verifico se la macchina sia configurata tra le MSFD...
if (MServ.DictMacchMulti.ContainsKey(RecMSE?.IdxMacchina))
if (SMServ.DictMacchMulti.ContainsKey(RecMSE.IdxMacchina))
{
isMulti = MServ.DictMacchMulti[RecMSE?.IdxMacchina] == 1;
isMulti = SMServ.DictMacchMulti[RecMSE.IdxMacchina] == 1;
}
if (isMulti)
{
var listMulti = await TDataService.VMSFDGetAll();
ListMacchine = listMulti
.Where(x => x.IdxMacchina.Contains($"{RecMSE?.IdxMacchina}#"))
.Where(x => x.IdxMacchina.Contains($"{RecMSE.IdxMacchina}#"))
.ToDictionary(x => x.IdxMacchina, x => x.CodMaccArticolo);
if (ListMacchine.Count > 0 && string.IsNullOrEmpty(idxMaccSel))
{
IdxMaccSel = ListMacchine.FirstOrDefault().Key;
//await E_MachSel.InvokeAsync(idxMaccSel);
// cerco se ho in storage la macchina selezionata...
var idxMSel = MsgServ.UserPrefGet(idxMaccCurr);
if (!string.IsNullOrEmpty(idxMSel))
{
idxMaccSel = idxMSel;
}
else
{
IdxMaccSel = ListMacchine.FirstOrDefault().Key;
}
}
}
}
+20 -8
View File
@@ -1,5 +1,6 @@
using EgwCoreLib.Razor;
using global::Microsoft.AspNetCore.Components;
using Microsoft.EntityFrameworkCore.SqlServer.Query.Internal;
using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.Data.Services;
@@ -118,6 +119,11 @@ namespace MP_TAB_SERV.Components
}
}
/// <summary>
/// Dati produzioen rilevati
/// </summary>
protected StatoProdModel? datiProdAct { get; set; } = null;
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
@@ -127,6 +133,9 @@ namespace MP_TAB_SERV.Components
[Inject]
protected NavigationManager NavMan { get; set; } = null!;
[Inject]
protected StatusData SDService { get; set; } = null!;
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
@@ -159,15 +168,9 @@ namespace MP_TAB_SERV.Components
{
imgBasePath = $"{Environment.CurrentDirectory}/images/";
}
await Task.Delay(1);
}
/// <summary>
/// Dati produzioen rilevati
/// </summary>
protected StatoProdModel? datiProdAct { get; set; } = null;
protected override async Task OnParametersSetAsync()
{
DateTime adesso = DateTime.Now;
@@ -175,7 +178,16 @@ namespace MP_TAB_SERV.Components
// controllo SE avessi idxMacchSub --> rileggo!
if (RecMSE != null)
{
datiProdAct = await TabDServ.StatoProdMacchina(RecMSE.IdxMacchina, adesso);
if (SDService.MachNumPzGet(RecMSE.IdxMacchina) != RecMSE.NumPezzi)
{
datiProdAct = await TabDServ.StatoProdMacchina(RecMSE.IdxMacchina, adesso);
SDService.MachProdStSet(RecMSE.IdxMacchina, datiProdAct);
SDService.MachNumPzSet(RecMSE.IdxMacchina, RecMSE.NumPezzi);
}
else
{
datiProdAct = SDService.MachProdStGet(RecMSE.IdxMacchina);
}
}
if (!string.IsNullOrEmpty(IdxMacchSub) && RecMSE != null)
{
+15 -9
View File
@@ -57,7 +57,7 @@ namespace MP_TAB_SERV.Components
}
[Inject]
protected StatusData MDataService { get; set; } = null!;
protected StatusData SDService { get; set; } = null!;
[Inject]
protected MessageService MServ { get; set; } = null!;
@@ -68,13 +68,19 @@ namespace MP_TAB_SERV.Components
protected void ElapsedTimer(object? source, System.Timers.ElapsedEventArgs e)
{
var pUpd = Task.Run(async () =>
{
aTimer.Interval = fastRefreshMs;
await InvokeAsync(RefreshData);
//Log.Trace("MseSampler Timer elapsed");
});
pUpd.Wait();
try
{
var pUpd = Task.Run(async () =>
{
aTimer.Interval = fastRefreshMs;
await InvokeAsync(RefreshData);
});
pUpd.Wait();
}
catch (Exception exc)
{
Log.Error($"Eccezione durante MseSampler.ElapsedTimer{Environment.NewLine}{exc}");
}
}
protected override void OnInitialized()
@@ -107,7 +113,7 @@ namespace MP_TAB_SERV.Components
private async Task RefreshData()
{
List<MappaStatoExpl> ListMSE = await MDataService.MseGetAll();
List<MappaStatoExpl> ListMSE = await SDService.MseGetAll();
await MServ.SaveMse(ListMSE);
await E_Updated.InvokeAsync(ListMSE);
}
+5 -4
View File
@@ -225,17 +225,18 @@
</div>
<div class="col-12 col-md-6 mb-2 mt-2">
<div class="input-group input-group-lg">
<input type="text" class="form-control w-25" placeholder="Cerca" aria-label="Cerca">
<button class="btn btn-outline-secondary px-2" @onclick="SearchPodlReset"><i class="fa-solid fa-x"></i></button>
<input type="text" class="form-control w-25 small" placeholder="Cerca" aria-label="Cerca" @bind="@SearchPodl">
<select class="form-select w-50" @bind="IdxPOdlSel">
@foreach (var item in ListODL)
{
<option value="@item.value">@item.label</option>
}
</select>
<div class="input-group-text">
<div class="input-group-text px-1">
<input class="form-check-input mt-0 me-1" id="chk_all" type="checkbox" @bind="ShowAll">
<label class="form-check-label" for="" chk_all">
Tutti
<label class="form-check-label form-check-label-sm" for="chk_all">
tutti
</label>
</div>
</div>
+134 -39
View File
@@ -86,6 +86,7 @@ namespace MP_TAB_SERV.Components
protected IJSRuntime JSRuntime { get; set; } = null!;
protected List<vSelOdlModel> ListODL { get; set; } = new List<vSelOdlModel>();
protected List<vSelOdlModel> ListODLAll { get; set; } = new List<vSelOdlModel>();
[Inject]
protected MailService MailServ { get; set; } = null!;
@@ -107,6 +108,23 @@ namespace MP_TAB_SERV.Components
get => IdxOdl > 0;
}
protected string SearchPodl
{
get => searchPodl;
set
{
if (searchPodl != value)
{
searchPodl = value;
var pUpd = Task.Run(async () =>
{
await ReloadData(true);
});
pUpd.Wait();
}
}
}
protected bool ShowAll
{
get => showAll;
@@ -130,6 +148,25 @@ namespace MP_TAB_SERV.Components
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
/// <summary>
/// Verifica se la tavola SIA in fase di attrezzaggio, ovvero SE:
/// - sia un impianto MULTI (= con + tavole)
/// - sia già attrezzata
/// </summary>
protected bool tavHasOdl
{
get
{
bool answ = false;
// se è multi controllo
if (isMulti)
{
answ = !emptyOdlMacc;
}
return answ;
}
}
#endregion Protected Properties
#region Protected Methods
@@ -150,8 +187,15 @@ namespace MP_TAB_SERV.Components
// verifico attrezzaggio su macchina corrente o se multi su parent
string idxMacc2check = isMulti ? IdxMaccParent : IdxMaccSel;
StatoMacchineModel rigaStato = TabDServ.StatoMacchina(idxMacc2check);
//calcolo stato attrezzaggio, hard coded!!!
inAttr = (rigaStato.IdxStato == 2);
// calcolo stato attrezzaggio, hard coded!!!
if (isMulti)
{
inAttr = (rigaStato.IdxStato == 2 && tavHasOdl);
}
else
{
inAttr = rigaStato.IdxStato == 2;
}
// se in attr --> carico podlCurr...
if (inAttr && RecMSE != null)
{
@@ -242,7 +286,7 @@ namespace MP_TAB_SERV.Components
await advStep(currStep++);
// cancella dati correnti ODL
DoRemoveCurrOdlData();
DoRemoveCurrOdlData(false);
await advStep(currStep++);
}
catch
@@ -423,15 +467,15 @@ namespace MP_TAB_SERV.Components
inAttr = false;
IdxPOdlSel = 0;
RecMSE = null;
await advStep(currStep++);
// faccio refresh e riporto
await RefreshData();
await CheckAttr();
await advStep(currStep++);
// chiudo update...
isProcessing = false;
//await InvokeAsync(StateHasChanged);
await InvokeAsync(StateHasChanged);
// qui rimando a pag principale...
NavMan.NavigateTo("status-map", true);
//NavMan.NavigateTo("status-map", true);
}
/// <summary>
@@ -454,6 +498,18 @@ namespace MP_TAB_SERV.Components
// preparo gestione progress display
MaxVal = 11;
int currStep = 0;
if (isMulti)
{
try
{
StatoMacchineModel rigaStato = TabDServ.StatoMacchina(IdxMaccParent);
// controllo se NON SONO già in attrezzaggio...
inAttr = (rigaStato.IdxStato == 2);
}
catch
{ }
}
await advStep(currStep);
isProcessing = true;
DateTime adesso = DateTime.Now;
@@ -493,13 +549,6 @@ namespace MP_TAB_SERV.Components
}
}
await advStep(currStep++);
#if false
// se fosse multi cambio dati di promODL x successivo setup...
if (isMulti)
{
currPodl.IdxMacchina = IdxMaccSel;
}
#endif
// fix idxmacchina selezionata (x ogni macchina, singola o multi...)
currPodl.IdxMacchina = IdxMaccSel;
// 2018.07.24 verifico se devo lavorare come ODL classico o come RPO (Richiesta /
@@ -630,7 +679,7 @@ namespace MP_TAB_SERV.Components
checkBtnStatus();
fixSplitBtn(false);
// faccio refresh e riporto
await TabDServ.FlushCache("ODL");
await TabDServ.FlushOdlCache();
IdxPOdlSel = 0;
RecMSE = null;
await RefreshData();
@@ -663,7 +712,19 @@ namespace MP_TAB_SERV.Components
emailAdmDest = rawEmailDest.Split(',').ToList();
if (RecMSE != null)
{
IdxMaccSel = RecMSE.IdxMacchina;
if (string.IsNullOrEmpty(IdxMaccSel))
{
IdxMaccSel = RecMSE.IdxMacchina;
}
isMulti = SMServ.DictMacchMulti[RecMSE.IdxMacchina] == 1;
if (isMulti)
{
var idxMSel = MServ.UserPrefGet(IdxMaccSel);
if (!string.IsNullOrEmpty(idxMSel))
{
IdxMaccSel = idxMSel;
}
}
IdxMaccParent = getIdxMaccParent();
// verifica stato inAttr
await CheckAttr();
@@ -672,12 +733,6 @@ namespace MP_TAB_SERV.Components
checkAll();
}
protected override async Task OnParametersSetAsync()
{
isMulti = SMServ.DictMacchMulti[RecMSE?.IdxMacchina] == 1;
await ReloadData(false);
}
protected async Task ProdEnd()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi fine produzione?"))
@@ -817,6 +872,11 @@ namespace MP_TAB_SERV.Components
tcRichAttr = newTCRich;
}
protected void SearchPodlReset()
{
SearchPodl = "";
}
protected async Task SendFixEndSetup()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi invio FIX chiusura attrezzaggio ad impianto?"))
@@ -879,6 +939,7 @@ namespace MP_TAB_SERV.Components
IdxMaccSel = selIdxMacc;
// recupero dati
RecMSE = TabDServ.MseGetSub(IdxMaccParent, selIdxMacc, true);
await CheckAttr();
await ReloadData(true);
await DoUpdate();
if (showOdlDetail || inAttr)
@@ -933,6 +994,9 @@ namespace MP_TAB_SERV.Components
private int gPeriodReopenOdlTav = 1;
private string IdxMaccSel = "";
#if false
private string IdxMaccSelLast = "";
#endif
private int idxPOdlSel = 0;
@@ -964,6 +1028,7 @@ namespace MP_TAB_SERV.Components
private int PzPallet = 1;
private string searchPodl = "";
private bool showAll = false;
private bool showChkCloseOdlVal = false;
@@ -972,7 +1037,6 @@ namespace MP_TAB_SERV.Components
private bool showOdlProvv = false;
private bool showReopenOdlTav = false;
private bool showSplitOdlOnTav = false;
private decimal tcRichAttr = 1;
#endregion Private Fields
@@ -990,11 +1054,10 @@ namespace MP_TAB_SERV.Components
private string cssDetailOdl
{
get => IdxPOdlSel > 0 ? "bg-primary text-light" : "bg-warning";
get => IdxPOdlSel > 0 ? "bg-info text-light" : "bg-warning";
}
private ODLExpModel currOdl { get; set; } = new ODLExpModel();
private PODLExpModel currPodl { get; set; } = new PODLExpModel();
/// <summary>
@@ -1138,14 +1201,18 @@ namespace MP_TAB_SERV.Components
{ }
// ora verifico SE E SOLO SE è ANCORA in attrezzaggio
#if false
if (inAttr)
{
// ora verifico SE ALTRA TAVOLA ha ODL...
if (dtChiusura.AddMinutes(gPeriodReopenOdlTav) > adesso)
{
answ = showReopenOdlTav;
}
#endif
// ora verifico SE ALTRA TAVOLA ha ODL...
if (dtChiusura.AddMinutes(gPeriodReopenOdlTav) > adesso)
{
answ = showReopenOdlTav;
}
#if false
}
#endif
}
}
return answ;
@@ -1173,11 +1240,15 @@ namespace MP_TAB_SERV.Components
// ora verifico SE ALTRA TAVOLA ha ODL...
if (!emptyOdlAltraMacc)
{
#if false
// ora verifico SE E SOLO SE è ANCORA in attrezzaggio
if (inAttr)
{
answ = showSplitOdlOnTav;
}
#endif
answ = showSplitOdlOnTav;
#if false
}
#endif
}
}
}
@@ -1185,6 +1256,8 @@ namespace MP_TAB_SERV.Components
}
}
private decimal tcRichAttr { get; set; } = 1;
private string titleOdlDetail
{
get => IdxPOdlSel > 0 ? "Verifica parametri attrezzaggio NUOVO PODL" : inAttr ? "Parametri PODL in Attrezzaggio" : "Parametri ODL Corrente";
@@ -1206,6 +1279,17 @@ namespace MP_TAB_SERV.Components
private void checkAll()
{
if (string.IsNullOrEmpty(IdxMaccParent))
{
if (isMulti)
{
IdxMaccParent = getIdxMaccParent();
}
else
{
IdxMaccParent = IdxMaccSel;
}
}
checkConfProd();
}
@@ -1426,7 +1510,7 @@ namespace MP_TAB_SERV.Components
/// <summary>
/// Rimozione dati e parametri (TAB e su PLC) x ODL corrente
/// </summary>
private void DoRemoveCurrOdlData()
private void DoRemoveCurrOdlData(bool nav2detail)
{
// invio task x end produzione...
string setArtVal = "NO ART";
@@ -1453,8 +1537,11 @@ namespace MP_TAB_SERV.Components
TabDServ.addTask4Machine(machine.IdxMacchinaSlave, taskType.setComm, setCommVal);
}
}
// rimando a pagina dettaglio...
NavMan.NavigateTo("machine-detail", true);
// se richiesto rimando a pagina dettaglio...
if (nav2detail)
{
NavMan.NavigateTo("machine-detail", true);
}
}
#if false
@@ -1550,7 +1637,15 @@ namespace MP_TAB_SERV.Components
}
if (!string.IsNullOrEmpty(IdxMaccSel))
{
ListODL = await TabDServ.VSOdlGetUnused(IdxMaccParent, ShowAll, numDayOdl);
ListODLAll = await TabDServ.VSOdlGetUnused(IdxMaccParent, ShowAll, numDayOdl);
if (string.IsNullOrEmpty(SearchPodl))
{
ListODL = ListODLAll;
}
else
{
ListODL = ListODLAll.Where(x => x.label.Contains(SearchPodl, StringComparison.InvariantCultureIgnoreCase) || x.value == 0).ToList();
}
Log.Trace($"found {ListODL.Count} rec");
if (forceReload)
{
@@ -1564,14 +1659,14 @@ namespace MP_TAB_SERV.Components
// imposto tcRichAttr in base allo stato...
if (odlOk)
{
// prendo TCRich da ODL...
if (IdxOdl > 0)
// prendo TCRich da PODL...
if (IdxPOdlSel > 0)
{
tcRichAttr = currOdl.TCRichAttr;
tcRichAttr = currPodl.Tcassegnato;
}
else
{
tcRichAttr = currPodl.Tcassegnato;
tcRichAttr = currOdl.TCRichAttr;
}
}
}
+1 -8
View File
@@ -1,12 +1,5 @@
<div class="textCondens mb-1">
@*<div class="col-6 text-end">
<b>Gestione stampa etichette <i class="fa fa-long-arrow-right" aria-hidden="true"></i></b>
<br />
Gestione etichette per l'ODL con modulo MAG
</div>*@
@*<div class="col-6">
</div>*@
<a runat="server" href="@navUrl" target="_blank" class="btn btn-primary btn-sm w-100 py-2 px-4">MAG &nbsp; <i class="fa-solid fa-print"></i></a>
<a runat="server" href="@navUrl" target="_blank" class="btn btn-primary btn-sm w-100 py-2 px-4">MAG &nbsp;<i class="fa-solid fa-print"></i></a>
</div>
+80 -86
View File
@@ -3,18 +3,17 @@
<div class="col-12 mt-1">
<MachSel RecMSE="RecMSE" E_MachSel="SetMacc"></MachSel>
</div>
<div class="d-flex justify-content-between mt-2">
<div class="col-12 d-flex justify-content-between">
<div class="col-12 mt-2">
<div class="row">
@if (enableMagPrint)
{
<div class="px-1 col-6">
<div class="col-6">
<PrintMag RecMSE="RecMSE"></PrintMag>
</div>
}
@if (odlOk)
{
<div class="px-1 @ConfCssWidth">
<div class="@ConfCssWidth">
<button class="btn btn-sm @ConfBg py-2 px-4" style="width: 100%" @onclick="()=>ToggleConfProd()">
<i class="fa-solid fa-check pe-1"></i><span>@ConfTitle</span>
</button>
@@ -30,7 +29,6 @@
@if (showInnov)
{
@*class="d-flex justify-content-between"*@
<div class="cardBg p-2 mt-2">
<div class="d-flex justify-content-between">
<div class="col-6">
@@ -80,11 +78,11 @@
}
else if (showConfirm && lblPz2RecBuoni < 0 && chkPzBuoniNeg)
{
<div class="alert bg-danger text-light fw-bold text-center">Pezzi buoni negativi!</div>
<div class="btn btn-danger btn-lg text-light fw-bold text-center w-100 h-100">Pezzi buoni negativi!</div>
}
else
{
<div class="alert bg-info text-dark fw-bold text-center">Completare le modifiche!</div>
<btn class="btn btn-info btn-lg w-100 h-100" disabled>Completare le modifiche!</btn>
}
</div>
</div>
@@ -95,91 +93,87 @@
</div>
}
<div class="row textCondens mt-2">
<div class="col-4 py-1 text-start text-uppercase">
<b>Dati Globali ODL</b>
<div class="col-12 py-0 text-start text-uppercase lh-1 fw-bold">
Dati Globali ODL
</div>
<div class="d-flex justify-content-between flex-wrap mt-2">
<div class="col-6 col-sm-3 p-1">
<div class="text-center h-100 w-100 p-2" style=" background-color: #fff3cd; border-radius: .5rem;">
<div class="text-truncate">
<span class="text-dark small">[A] NUOVI Pz.Prod</span>
</div>
<div class="text-dark d-flex align-items-center text-center justify-content-center">
@if (isProcessing)
{
<i class="fa-solid fa-spinner span"></i>
}
else
{
<span class="fw-bold" style="font-size: 3vh">@numPzProdotti2Rec</span>
}
</div>
<div class="col-6 col-sm-3 py-1">
<div class="text-center h-100 px-2 shadows" style=" background-color: #fff3cd; border-radius: .5rem;">
<div class="text-truncate lh-sm pt-1">
<span class="text-dark small">[A] NUOVI Pz.Prod</span>
</div>
<div class="text-dark d-flex align-items-center text-center justify-content-center">
@if (isProcessing)
{
<i class="fa-solid fa-spinner span"></i>
}
else
{
<span class="fw-bold fs-3">@numPzProdotti2Rec</span>
}
</div>
</div>
<div class="col-6 col-sm-3 p-1">
<div class="text-center h-100 w-100 p-2" style=" background-color: #cff4fc; border-radius: .5rem;">
<div class="text-truncate">
<span class="text-dark small">Pz Prodotti TOT [A+B+C]</span>
</div>
<div class="text-dark d-flex align-items-center text-center justify-content-center">
@if (isProcessing)
{
<i class="fa-solid fa-spinner span"></i>
}
else
{
<span class="fw-bold" style="font-size: 3vh">@numPzProdotti</span>
}
</div>
</div>
</div>
<div class="col-6 col-sm-3 p-1">
<div class="text-center h-100 w-100 p-2" style=" background-color: #f8d7da; border-radius: .5rem;">
<div class="text-truncate">
<span class="text-dark small">[B] Scarti VERS.</span>
</div>
<div class="text-dark d-flex align-items-center text-center justify-content-center">
@if (isProcessing)
{
<i class="fa-solid fa-spinner span"></i>
}
else
{
<span class="fw-bold" style="font-size: 3vh">@numPzScaConf</span>
}
</div>
</div>
</div>
<div class="col-6 col-sm-3 p-1">
<div class="text-center h-100 w-100 p-2" style=" background-color: #d1e7dd; border-radius: .5rem;">
<div class="text-truncate">
<span class="text-dark small">[C] Pz Buoni VERS.</span>
</div>
<div class="text-dark d-flex align-items-center text-center justify-content-center">
@if (isProcessing)
{
<i class="fa-solid fa-spinner span"></i>
}
else
{
<span class="fw-bold" style="font-size: 3vh">@numPzBuoniConf</span>
}
</div>
</div>
</div>
</div>
<div class="d-flex justify-content-between p-3 pe-4">
<div class="col-6 col-sm-3 py-1">
<div class="text-center h-100 px-2" style=" background-color: #cff4fc; border-radius: .5rem;">
<div class="text-truncate lh-sm pt-1">
<span class="text-dark small">Pz Prodotti TOT [A+B+C]</span>
</div>
<div class="text-dark d-flex align-items-center text-center justify-content-center">
@if (isProcessing)
{
<i class="fa-solid fa-spinner span"></i>
}
else
{
<span class="fw-bold fs-3">@numPzProdotti</span>
}
</div>
</div>
</div>
<div class="col-6 col-sm-3 py-1">
<div class="text-center h-100 px-2" style=" background-color: #f8d7da; border-radius: .5rem;">
<div class="text-truncate lh-sm pt-1">
<span class="text-dark small">[B] Scarti VERS.</span>
</div>
<div class="text-dark d-flex align-items-center text-center justify-content-center">
@if (isProcessing)
{
<i class="fa-solid fa-spinner span"></i>
}
else
{
<span class="fw-bold fs-3">@numPzScaConf</span>
}
</div>
</div>
</div>
<div class="col-6 col-sm-3 py-1">
<div class="text-center h-100 px-2" style=" background-color: #d1e7dd; border-radius: .5rem;">
<div class="text-truncate lh-sm pt-1">
<span class="text-dark small">[C] Pz Buoni VERS.</span>
</div>
<div class="text-dark d-flex align-items-center text-center justify-content-center">
@if (isProcessing)
{
<i class="fa-solid fa-spinner span"></i>
}
else
{
<span class="fw-bold fs-3">@numPzBuoniConf</span>
}
</div>
</div>
</div>
</div>
<div class="row textCondens mt-1 py-1">
<div class="col-6">
<a class="btn btn-info btn-sm w-100 py-2 px-4" style="min-width: 72px; min-height: 39px" href="scrap"><i class="fa fa-bug"></i> Reg. SCARTI</a>
<a class="btn btn-info btn-sm w-100 py-2 " style="min-width: 6rem;" href="scrap"><i class="fa fa-bug"></i> Reg. SCARTI</a>
</div>
<div class="ms-2 col-6">
<a class="btn btn-primary btn-sm w-100 py-2 px-4" style="min-width: 72px; min-height: 39px" href="controls"><i class="fa fa-wrench"></i> Reg. CONTROLLI</a>
<div class=" col-6">
<a class="btn btn-primary btn-sm w-100 py-2" style="min-width: 6rem;" href="controls"><i class="fa fa-wrench"></i> Reg. CONTROLLI</a>
</div>
</div>
@* <div class="d-flex justify-content-between p-3 pe-4">
</div> *@
</div>
@if (!string.IsNullOrEmpty(lblOut))
{
+31 -453
View File
@@ -82,7 +82,7 @@ namespace MP_TAB_SERV.Components
protected StatusData MDataService { get; set; } = null!;
[Inject]
protected MessageService MServ { get; set; } = null!;
protected MessageService MsgServ { get; set; } = null!;
protected int numPz2Rec { get; set; } = 0;
@@ -151,18 +151,37 @@ namespace MP_TAB_SERV.Components
await Task.Delay(1);
}
protected override async Task OnInitializedAsync()
protected override void OnInitialized()
{
enablePzProdLasciati = SMServ.GetConfBool("enablePzProdLasciati");
chkPzBuoniNeg = SMServ.GetConfBool("TAB_ChkConfPz");
confRett = SMServ.GetConfBool("confRett");
enableMagPrint = SMServ.GetConfBool("enableMagPrint");
modoConfProd = SMServ.GetConfInt("modoConfProd");
}
protected override async Task OnParametersSetAsync()
{
lblOut = "";
numPzLasciati = 0;
if (RecMSE != null)
if (RecMSE != null && string.IsNullOrEmpty(IdxMaccSel))
{
// verifico SE fosse doppia...
bool isMulti = false;
// verifico se la macchina sia configurata tra le MSFD...
if (SMServ.DictMacchMulti.ContainsKey(RecMSE.IdxMacchina))
{
isMulti = SMServ.DictMacchMulti[RecMSE.IdxMacchina] == 1;
}
IdxMaccSel = RecMSE.IdxMacchina;
enablePzProdLasciati = SMServ.GetConfBool("enablePzProdLasciati");
chkPzBuoniNeg = SMServ.GetConfBool("TAB_ChkConfPz");
confRett = SMServ.GetConfBool("confRett");
enableMagPrint = SMServ.GetConfBool("enableMagPrint");
modoConfProd = SMServ.GetConfInt("modoConfProd");
if (isMulti)
{
var idxMSel = MsgServ.UserPrefGet(IdxMaccSel);
if (!string.IsNullOrEmpty(idxMSel))
{
IdxMaccSel = idxMSel;
}
}
await DoUpdate();
}
}
@@ -170,9 +189,9 @@ namespace MP_TAB_SERV.Components
protected async Task SalvaConfPz()
{
isProcessing = true;
await Task.Delay(1);
// effettua conferma con conf da DB del tipo (giorni / turni / periodo
bool fatto = effettuaConfermaProd();
await TabDServ.FlushCache("StatoProd");
// refresh tabella dati tablet...
await TabDServ.RicalcMse(IdxMaccSel, 0);
// rileggo e salvo..
@@ -180,7 +199,7 @@ namespace MP_TAB_SERV.Components
if (ListMSE != null)
{
// salvo in LocalStorage...
await MServ.SaveMse(ListMSE);
await MsgServ.SaveMse(ListMSE);
// aggiorno MSE attuale
RecMSE = ListMSE.Find(x => x.IdxMacchina == IdxMaccSel);
}
@@ -188,8 +207,6 @@ namespace MP_TAB_SERV.Components
lblOut = $"Confermata produzione {numPzConfermati - numPzLasciati} pezzi (+{numPzLasciati} pz lasciati, +{numPzScarto2Rec} pz scarto) |{dtReqUpdate:HH:mm:ss} | {dtReqUpdate:ddd yyyy.MM.dd}";
// cambio button conferma...
showInnov = false;
// sollevo evento!
//dtReqUpdate = DateTime.Now;
numPzLasciati = 0;
await DoUpdate();
await Task.Delay(1);
@@ -250,7 +267,7 @@ namespace MP_TAB_SERV.Components
private int MatrOpr
{
get => MServ.MatrOpr;
get => MsgServ.MatrOpr;
}
private int numPzLasc { get; set; } = 0;
@@ -285,451 +302,12 @@ namespace MP_TAB_SERV.Components
private async Task RefreshData()
{
List<MappaStatoExpl> ListMSE = await MDataService.MseGetAll(true);
await MServ.SaveMse(ListMSE);
await MsgServ.SaveMse(ListMSE);
await E_Updated.InvokeAsync(ListMSE);
}
#endregion Private Methods
#if false
/// <summary>
/// restituisce css disabled SE odl NON OK...
/// </summary>
public string cssBtnConf
{
get
{
return odlOk ? "" : "disabled";
}
}
/// <summary>
/// Data-Ora ultimo update valori produzione
/// </summary>
public DateTime dtReqUpdate
{
get
{
DateTime answ = DateTime.Now;
DateTime.TryParse(hfDtReqUpdate.Value, out answ);
return answ;
}
set
{
hfDtReqUpdate.Value = $"{value}";
}
}
protected DateTime dtFine
{
set
{
lblFine.Text = value.ToString();
}
}
/// <summary>
/// Numero pezzi PRODOTTI da ultima conferma
/// </summary>
protected DateTime dtInizio
{
set
{
lblInizio.Text = value.ToString();
}
}
/// <summary>
/// Numero pezzi PRODOTTI da ultima conferma
/// </summary>
protected int numPz2Rec
{
set
{
lblPz2RecTot.Text = value.ToString();
}
}
/// <summary>
/// Numero pezzi BUONI già confermati
/// </summary>
protected int numPzBuoniConf
{
set
{
lblPzConfBuoni.Text = value.ToString();
}
}
/// <summary>
/// Numero pezzi confermati (buoni - scarto)
/// </summary>
protected int numPzConfermati
{
get
{
return numPzProdotti2Rec - numPzScarto2Rec;
}
}
/// <summary>
/// Numero pezzi da LASCIARE non dichiarati
/// </summary>
protected int numPzLasciati
{
set
{
txtNumLasciati.Text = value.ToString();
}
get
{
int answ = 0;
try
{
answ = Convert.ToInt32(txtNumLasciati.Text);
}
catch
{ }
return answ;
}
}
/// <summary>
/// Numero pezzi PRODOTTI GLOBALI
/// </summary>
protected int numPzProdotti
{
set
{
lblPzTotODL.Text = value.ToString();
}
}
/// <summary>
/// Numero pezzi PRODOTTI da registrare
/// </summary>
/// da ultima conferma
protected int numPzProdotti2Rec
{
set
{
txtNumPezzi.Text = value.ToString();
}
get
{
int answ = 0;
try
{
answ = Convert.ToInt32(txtNumPezzi.Text);
}
catch
{ }
return answ;
}
}
/// <summary>
/// Numero pezzi SCARTO già confermati
/// </summary>
protected int numPzScaConf
{
set
{
lblPzConfScarto.Text = value.ToString();
}
}
/// <summary>
/// Numero pezzi SCARTATI da registrare
/// </summary>
protected int numPzScarto2Rec
{
set
{
lblPz2RecScarto.Text = value.ToString();
memLayer.ML.setSessionVal("lblPz2RecScarto", value);
}
get
{
int answ = 0;
try
{
answ = memLayer.ML.IntSessionObj("lblPz2RecScarto");
}
catch
{ }
return answ;
}
}
protected void ddlSubMacc_DataBound(object sender, EventArgs e)
{
// se ho in memoria un valore LO REIMPOSTO...
if (!string.IsNullOrEmpty(subMaccSel))
{
// se è una SUB machcina (contiene "#")
if (subMaccSel.Contains("#"))
{
// provo a preselezionare...
try
{
ddlSubMacc.SelectedValue = subMaccSel;
}
catch
{ }
}
// altrimenti salvo!
else
{
subMaccSel = ddlSubMacc.SelectedValue;
}
}
}
protected void ddlSubMacc_SelectedIndexChanged(object sender, EventArgs e)
{
subMaccSel = ddlSubMacc.SelectedValue;
// salvo ODL
DataLayerObj.taMSE.getByIdxMaccAndSub(idxMacchinaSel, subMaccSel);
//altri controlli
checkAll();
}
/// <summary>
/// salvo produzione
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void lbtSalva_Click(object sender, EventArgs e)
{
// effettua conferma con conf da DB del tipo (giorni / turni / periodo
bool fatto = effettuaConfermaProd();
// refresh tabella dati tablet...
DataLayerObj.taMSE.forceRecalc(0, idxMacchinaSel);
// mostro output
lblOut.Text = string.Format("Confermata la produzione per {0} pezzi! (+{1} pz scarto) alle {2:yyyy-MM-dd HH:mm:ss}", numPzConfermati, numPzScarto2Rec, dtReqUpdate);
// cambio button conferma...
switchBtnConferma(!txtNumPezzi.Enabled);
// sollevo evento!
if (eh_newVal != null)
{
eh_newVal(this, new EventArgs());
}
dtReqUpdate = DateTime.Now;
doUpdate();
}
/// <summary>
/// caricamento pagina
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
checkAll();
if (isMulti)
{
// sollevo evento!
if (eh_reset != null)
{
eh_reset(this, new EventArgs());
}
}
}
}
/// <summary>
/// Update pz lasciati --&gt; aggiorno!
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtNumLasciati_TextChanged(object sender, EventArgs e)
{
lblOut.Text = "";
updatePzBuoni();
}
/// <summary>
/// update post modifica pz buoni
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void txtNumPezzi_TextChanged(object sender, EventArgs e)
{
lblOut.Text = "";
updatePzBuoni();
}
/// <summary>
/// ODL correntemente sulla macchina
/// - cerca in Redis (TTL 5 sec)
/// - altrimenti recupera da DB...
/// </summary>
protected void updateOdl()
{
// userò ODL del turno
int answ = 0;
// cerco da redis...
int.TryParse(DataLayerObj.currODL(idxMacchinaSel, true), out answ);
// salvo!
idxOdl = answ;
}
private void checkAll()
{
updateOdl();
checkConfig();
fixSelMacc();
checkOdl();
lblOut.Text = "";
switchBtnConferma(false);
lbtShowConfProd.Visible = odlOk;
lblConfProd.Visible = !odlOk;
}
/// <summary>
/// verifica config x modalità permesse
/// </summary>
private void checkConfig()
{
// verifico SE sia permesso gestire i "Pezzi lasciati" in macchina...
lblNumLasciati.Visible = enablePzProdLasciati;
txtNumLasciati.Visible = enablePzProdLasciati;
lblEmptyNumLasciati.Visible = !enablePzProdLasciati;
}
/// <summary>
/// Verifica se abbia un ODL ATTIVO
/// </summary>
private void checkOdl()
{
lbtShowConfProd.Visible = odlOk;
lblConfProd.Visible = !odlOk;
lblMancaODL.Visible = !odlOk;
}
/// <summary>
/// Registra conferma produzione in modalità nuova (con rettifica pezzi lasciati) o legacy
/// (con anticipo periodo)
/// </summary>
private bool effettuaConfermaProd()
{
bool fatto = false;
if (confRett)
{
// confermo al netto dei pezzi lasciati...
fatto = DataLayerObj.confermaProdMacchinaFull(idxMacchinaSel, memLayer.ML.CRI("modoConfProd"), numPzConfermati - numPzLasciati, numPzLasciati, numPzScarto2Rec, dtReqUpdate);
}
else
{
fatto = DataLayerObj.confermaProdMacchina(idxMacchinaSel, memLayer.ML.CRI("modoConfProd"), numPzConfermati, numPzScarto2Rec, dtReqUpdate);
}
return fatto;
}
/// <summary>
/// Se la machcina è MULTI --&gt; mostro selettore
/// </summary>
private void fixSelMacc()
{
divSelMacc.Visible = isMulti;
if (isMulti)
{
try
{
// salvo selezione submacc
ddlSubMacc.DataBind();
subMaccSel = ddlSubMacc.SelectedValue;
}
catch
{ }
}
updateOdl();
}
/// <summary>
/// Reset parametri x calcolo pezzi (no pezzi lasciati, dataora attuale...)
/// </summary>
private void resetParam()
{
dtReqUpdate = DateTime.Now;
numPzLasciati = 0;
}
/// <summary>
/// determina comportamento btn conferma
/// </summary>
private void switchBtnConferma(bool showConf)
{
// aggiorno valori rilevati
resetParam();
doUpdate();
divInnovazioni.Visible = showConf;
if (showConf)
{
try
{
updatePzBuoni();
// sollevo evento!
if (eh_inserting != null)
{
eh_inserting(this, new EventArgs());
}
}
catch
{
txtNumPezzi.Text = "0";
logger.lg.scriviLog(string.Format("Errore recupero pezzi da confermare per la macchina {0}", idxMacchinaSel), tipoLog.ERROR);
}
}
if (showConf)
{
lblShowConfProd.Text = "Nascondi Conferma";
}
else
{
lblShowConfProd.Text = "Mostra Conferma";
// sollevo evento!
if (eh_reset != null)
{
eh_reset(this, new EventArgs());
}
}
}
/// <summary>
/// aggiorna visualizzazione pz buoni /prodotti - scarti)
/// </summary>
private void updatePzBuoni()
{
if (confRett)
{
// cambio le qta di pezzi confermati...
lblPz2RecBuoni.Text = (numPzConfermati - numPzLasciati).ToString();
}
else
{
// se ho dei pezzi lasciati RICALCOLO la data...
if (numPzLasciati > 0)
{
// calcolo la data..
DS_ProdTempi.TempiCicloRilevatiDataTable tab = DataLayerObj.taTempiCicloRilevati.getLastPzByMaccQta(idxMacchinaSel, DateTime.Now, numPzLasciati);
if (tab.Rows.Count > 0)
{
dtReqUpdate = tab[0].DataOraRif.AddSeconds(1);
}
// aggiorno
doUpdate();
}
lblPz2RecBuoni.Text = numPzConfermati.ToString();
}
// aggiorno la data calcolo + pezzi buoni...
lblDtRec.Text = dtReqUpdate.ToString();
}
#endif
}
}
+3 -3
View File
@@ -1,9 +1,9 @@

<div class="d-flex justify-content-between">
<div class="col-6 py-1 text-start text-uppercase">
<div class="d-flex justify-content-between mt-2">
<div class="col-6 lh-1 text-start text-uppercase">
<b>Statistiche di produzione</b>
</div>
<div class="col-6 text-end pe-2">
<div class="col-6 lh-1 text-end pe-2">
@if (RecMSE != null)
{
<span>@($"ODL: {RecMSE.IdxOdl}")</span>
+82
View File
@@ -0,0 +1,82 @@

<ShowProcessing Message="Caricamento" IsProcessing="@isProcessing"></ShowProcessing>
<div class="bg-info p-2">
<div class="bg-dark">
<div class="d-flex justify-content-between">
<table class="table table-light table-sm table-striped mb-0">
<thead>
<tr class="text-start1">
<th class="fs-5 d-flex justify-content-between">
<div>
Esplosione scarti KIT
</div>
<div>
<button class="btn btn-danger" @onclick="DeleteKitSplit"><i class="fa-solid fa-trash-can"></i> Remove Split</button>
</div>
</th>
</tr>
</thead>
<tbody>
@if (TotalCount == 0)
{
<tr>
<td class="p-0">
<div class="alert fs-4">No record found</div>
</td>
</tr>
}
else
{
@foreach (var item in ListPaged)
{
<tr>
<td>
<div class="row">
<div class="col-4 fs-3">
<div>
Art: <b>@item.CodArticolo</b>
</div>
</div>
<div class="col-4 px-0 text-center text-nowrap d-flex justify-content-center">
<div class="px-2">
@if (item.Qta <= 0)
{
<button class="btn btn-secondary" disabled>&equiv;</button>
}
else
{
<button class="btn btn-warning" @onclick="() => modQty(item, -1)">&minus;</button>
}
</div>
<div>
<b class="fs-2">@item.Qta</b>
</div>
<div class="ps-1 fs-4">
<sub> &times;<span>pz</span></sub>
</div>
<div class="px-2">
@if (item.Qta >= item.QtaMax)
{
<button class="btn btn-secondary" disabled>&equiv;</button>
}
else
{
<button class="btn btn-success" @onclick="() => modQty(item, 1)">&plus;</button>
}
</div>
</div>
<div class="col-4 text-end small">
</div>
</div>
</td>
</tr>
}
}
</tbody>
</table>
</div>
</div>
</div>
+114
View File
@@ -0,0 +1,114 @@
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.Data.Services;
using NLog;
namespace MP_TAB_SERV.Components
{
public partial class ScrapKitMan
{
#region Public Properties
[Parameter]
public EventCallback<bool> E_Updated { get; set; }
[Parameter]
public RegistroScartiModel ParentKit { get; set; } = null!;
#endregion Public Properties
#region Protected Properties
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
protected List<RegistroScartiKitModel> ListComplete { get; set; } = new List<RegistroScartiKitModel>();
protected List<RegistroScartiKitModel> ListPaged { get; set; } = new List<RegistroScartiKitModel>();
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected async Task DeleteKitSplit()
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il dettaglio del KIT scartato?"))
return;
if (ParentKit != null)
{
await TabDServ.RegScartiKitDelete(ParentKit);
await ReloadData();
await E_Updated.InvokeAsync(true);
}
}
protected override async Task OnParametersSetAsync()
{
await ReloadData();
}
protected void UpdateTable()
{
// esegue paginazione
if (TotalCount > NumRecPage)
{
ListPaged = ListComplete.Skip((PageNum - 1) * NumRecPage).Take(NumRecPage).ToList();
}
else
{
ListPaged = ListComplete;
}
}
/// <summary>
/// Modifica qty del record
/// </summary>
/// <param name="currItem"></param>
/// <param name="delta"></param>
/// <returns></returns>
protected async Task modQty(RegistroScartiKitModel currItem, int delta)
{
currItem.Qta += delta;
await TabDServ.RegScartiKitUpdateQty(currItem);
}
#endregion Protected Methods
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private bool isProcessing = false;
private int NumRecPage = 10;
private int PageNum = 1;
private int TotalCount = 0;
#endregion Private Fields
#region Private Methods
private async Task ReloadData()
{
isProcessing = true;
await Task.Delay(1);
if (ParentKit != null)
{
ListComplete = await TabDServ.RegScartiKitGetFilt(ParentKit);
TotalCount = ListComplete.Count;
// esegue paginazione
UpdateTable();
}
isProcessing = false;
await Task.Delay(1);
}
#endregion Private Methods
}
}
+82 -32
View File
@@ -8,7 +8,7 @@
@if (enableScarti)
{
<div class="mb-2">
<ScrapEditor RecMSE="@RecMSE" E_Updated="doUpdate"></ScrapEditor>
<ScrapEditor RecMSE="@RecMSE" E_Updated="ReloadData"></ScrapEditor>
</div>
}
else
@@ -49,42 +49,92 @@
</tr>
</thead>
<tbody>
@foreach (var item in ListPaged)
@if (TotalCount == 0)
{
<tr>
<td>
<div class="row">
<div class="col-5 small">
<div>
Art: <b>@item.CodArticolo</b>
</div>
<div class="@($"text-{item.cssClass}")">
<i class="@item.icona"></i> @item.Descrizione
</div>
</div>
<div class="col-2 px-0 text-center">
<b class="fs-2">@item.Qta</b> pz
</div>
<div class="col-5 text-end small">
<div class="text-truncate">
@($"{item.DataOra:ddd dd.MM.yy HH:mm:ss}")
<i class="fa fa-clock-o" aria-hidden="true"></i>
</div>
<div class="text-truncate">
<b>@item.Operatore</b>
<i class="fa fa-user" aria-hidden="true"></i>
</div>
</div>
<div class="col-12 small text-secondary">
@if (!string.IsNullOrEmpty(item.Note))
{
<span>Nota: <b>@item.Note</b></span>
}
</div>
</div>
<td class="p-0">
<div class="alert fs-4">No record found</div>
</td>
</tr>
}
else
{
@foreach (var item in ListPaged)
{
<tr class="@selectedCss(item)">
<td>
<div class="row">
<div class="col-5 small">
<div>
Art: <b>@item.CodArticolo</b>
</div>
<div class="@($"text-{item.cssClass}")">
<i class="@item.icona"></i> @item.Descrizione
</div>
</div>
<div class="col-2 px-0 text-center text-nowrap d-flex justify-content-center">
<div>
<b class="fs-2">@item.Qta</b>
</div>
<div class="ps-1 fs-4">
@if (item.Tipo == "KIT")
{
<div class="d-flex justify-content-center align-items-center flex-wrap h-100">
<sub class="pe-1">&times;</sub>
@if (item.KitSplit)
{
<button class="btn btn-info" @onclick="()=>ShowKitDetail(item)" title="KIT esploso" style="max-width: 2.5rem;display: flex;justify-content: center;min-height: 2.375rem;align-items: center;">
<i class="fa-solid fa-box-open"></i>
</button>
}
else
{
<button class="btn btn-secondary" @onclick="()=>ShowKitDetail(item)" title="KIT non esploso">
<i class="fa-solid fa-box"></i>
</button>
}
</div>
}
else
{
<sub>
&times;
<span>pz</span>
</sub>
}
</div>
</div>
<div class="col-5 text-end small">
<div class="text-truncate">
@($"{item.DataOra:ddd dd.MM.yy HH:mm:ss}")
<i class="fa fa-clock-o" aria-hidden="true"></i>
</div>
<div class="text-truncate">
<b>@item.Operatore</b>
<i class="fa fa-user" aria-hidden="true"></i>
</div>
</div>
<div class="col-12 small text-secondary">
@if (!string.IsNullOrEmpty(item.Note))
{
<span>Nota: <b>@item.Note</b></span>
}
</div>
</div>
</td>
</tr>
@if (item.Equals(selItem))
{
<tr>
<td class="p-0">
<ScrapKitMan ParentKit="item" E_Updated="ForceReload"></ScrapKitMan>
</td>
</tr>
}
}
}
</tbody>
</table>
</div>
+48 -16
View File
@@ -21,7 +21,7 @@ namespace MP_TAB_SERV.Components
/// Aggiorno valori produzione alla data richiesta...
/// </summary>
/// <param name="newDate"></param>
public async Task doUpdate()
protected async Task ReloadData()
{
isProcessing = true;
await Task.Delay(1);
@@ -36,29 +36,36 @@ namespace MP_TAB_SERV.Components
await Task.Delay(1);
}
protected async Task ForceReload(bool DoClose)
{
if (DoClose)
{
selItem = null;
}
await ReloadData();
}
#endregion Public Methods
#region Protected Properties
protected bool enableScarti { get; set; } = true;
protected List<RegistroScartiModel> ListComplete { get; set; } = new List<RegistroScartiModel>();
protected List<RegistroScartiModel> ListPaged { get; set; } = new List<RegistroScartiModel>();
[Inject]
protected MessageService MServ { get; set; } = null!;
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
[Inject]
protected SharedMemService SMServ { get; set; } = null!;
[Inject]
protected TabDataService TabDServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected bool enableScarti { get; set; } = true;
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
@@ -69,32 +76,33 @@ namespace MP_TAB_SERV.Components
DateTime fine = DateTime.Today.AddDays(1);
DateTime inizio = fine.AddDays(-8);
CurrPeriodo = new Periodo(inizio, fine);
await doUpdate();
await ReloadData();
}
}
protected void SaveNumRec(int newNum)
{
NumRecPage = newNum;
UpdateTable();
}
protected void SavePage(int newNum)
{
PageNum = newNum;
UpdateTable();
}
protected string selectedCss(RegistroScartiModel currItem)
{
return currItem.Equals(selItem) ? "table-info" : "";
}
protected async Task SetMacc(string selIdxMacc)
{
isProcessing = true;
await Task.Delay(1);
IdxMaccSel = selIdxMacc;
await doUpdate();
await ReloadData();
isProcessing = false;
await Task.Delay(1);
}
@@ -104,7 +112,7 @@ namespace MP_TAB_SERV.Components
isProcessing = true;
await Task.Delay(1);
IdxOdl = selIdxOdl;
await doUpdate();
await ReloadData();
isProcessing = false;
await Task.Delay(1);
}
@@ -112,10 +120,33 @@ namespace MP_TAB_SERV.Components
protected async Task SetPeriodo(Periodo newPeriodo)
{
CurrPeriodo = newPeriodo;
await doUpdate();
await ReloadData();
}
protected async Task ShowKitDetail(RegistroScartiModel currItem)
{
isProcessing = true;
// deve essere != null in primis...
if (currItem != null)
{
// verifico se serve creare split dell'oggetto (hard coded!!!)
if (currItem.Tipo == "KIT" && !currItem.KitSplit)
{
await TabDServ.RegScartiKitSplit(currItem);
}
// faccio toggle show item (se era giŕ selezionato --> null!)
if (!currItem.Equals(selItem))
{
selItem = currItem;
}
else
{
selItem = null;
}
}
await ReloadData();
isProcessing = false;
}
protected void UpdateTable()
{
@@ -138,6 +169,7 @@ namespace MP_TAB_SERV.Components
private bool isProcessing = false;
private int NumRecPage = 10;
private int PageNum = 1;
private RegistroScartiModel? selItem = null;
private int TotalCount = 0;
private bool useOdl = false;
+4 -3
View File
@@ -37,12 +37,13 @@
</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 class="py-0 px-3">
<img src="images/LogoSteamware.png" class="img-fluid" width="80" />
</div>
<div class="p-0 pl-1">
<div class="py-1 px-0 lh-sm">
<div class="flex-row">
<b class="modal-title fs-1">MAPO MES</b>
<div class="small" style="font-size:0.8rem;">v.@version</div>
</div>
<div class="flex-row">
<small>TAB Controller - MES Suite</small>
+15 -2
View File
@@ -15,11 +15,12 @@ namespace MP_TAB_SERV.Components
#region Protected Properties
[Inject]
protected NavigationManager navManager { get; set; } = null!;
[Inject]
protected MessageService MsgServ { get; set; } = null!;
[Inject]
protected NavigationManager navManager { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
@@ -29,6 +30,12 @@ namespace MP_TAB_SERV.Components
return navManager.Uri.Contains(currUri) ? "bg-dark text-light" : "";
}
protected override void OnInitialized()
{
var rawVers = typeof(Program).Assembly.GetName().Version;
version = rawVers != null ? rawVers : new Version("0.0.0.0");
}
protected async Task SetPage(string tgtUrl)
{
await Task.Delay(1);
@@ -41,5 +48,11 @@ namespace MP_TAB_SERV.Components
}
#endregion Protected Methods
#region Private Fields
private Version version = null!;
#endregion Private Fields
}
}
+4 -3
View File
@@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<Version>6.16.2312.1115</Version>
<Version>6.16.2312.1810</Version>
<ImplicitUsings>enable</ImplicitUsings>
<RootNamespace>MP_TAB_SERV</RootNamespace>
</PropertyGroup>
@@ -14,11 +14,12 @@
<ItemGroup>
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS01.pubxml" />
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IISProfile.pubxml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="EgwCoreLib.Razor" Version="1.4.2311.1612" />
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2311.1612" />
<PackageReference Include="EgwCoreLib.Razor" Version="1.4.2312.1510" />
<PackageReference Include="EgwCoreLib.Utils" Version="1.4.2312.1510" />
<PackageReference Include="StackExchange.Redis" Version="2.2.4" />
</ItemGroup>
+1
View File
@@ -7,6 +7,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<AlarmsMan RecMSE="CurrMSE"></AlarmsMan>
}
+3 -2
View File
@@ -1,12 +1,13 @@
@page "/controls"
<MseSampler SampleMult="0.5" E_Updated="RefreshData"></MseSampler>
@if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null)
@if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null || IsLoading)
{
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<ControlsMan RecMSE="CurrMSE"></ControlsMan>
<ControlsMan RecMSE="CurrMSE" E_Updated="ForceReload"></ControlsMan>
}
+8
View File
@@ -41,6 +41,14 @@ namespace MP_TAB_SERV.Pages
await InvokeAsync(StateHasChanged);
}
protected async Task ForceReload()
{
IsLoading = true;
await Task.Delay(50);
IsLoading = false;
}
private bool IsLoading = false;
#endregion Protected Methods
#region Private Methods
+1
View File
@@ -7,6 +7,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<DeclarMan RecMSE="CurrMSE"></DeclarMan>
}
+1 -1
View File
@@ -1,7 +1,7 @@
@page "/"
@page "/home"
<img src="~/images/LogoEgw.png" />
<img src="images/LogoEgw.png" />
@code {
protected override async Task OnInitializedAsync()
+2 -3
View File
@@ -7,8 +7,7 @@
}
else
{
<div>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
</div>
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<IobInfoMan idxMacch="@IdxMacc"></IobInfoMan>
}
+19 -3
View File
@@ -39,10 +39,26 @@ namespace MP_TAB_SERV.Pages
protected override async Task OnInitializedAsync()
{
await Task.Delay(1);
await localStorage.SetItemAsync("currTkn", "");
await TDService.OperatoreDeleteRedis(MsgServ.MatrOpr);
await localStorage.SetItemAsync("currTkn", "");
await localStorage.SetItemAsync("CurrMach", "");
await localStorage.SetItemAsync("LastPage", "");
var CurrOprTknLS = await MsgServ.GetCurrOperDtoLSAsync();
var CurrDevGuid = await MsgServ.GetCurrDevGuidLSAsync();
if (!string.IsNullOrEmpty(CurrOprTknLS))
{
var decryptedData = MsgServ.DecryptData(CurrOprTknLS);
if (!string.IsNullOrEmpty(decryptedData))
{
var oprObj = JsonConvert.DeserializeObject<userTknDTO>(decryptedData);
if (oprObj != null)
{
MsgServ.RigaOper = oprObj.currOpr;
}
}
}
await TDService.OperatoreDeleteRedis(MsgServ.MatrOpr, CurrDevGuid);
MsgServ.RigaOper = null;
NavMan.NavigateTo("reg-new-device");
NavMan.NavigateTo("reg-new-device", true);
}
}
}
+1
View File
@@ -8,6 +8,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false" IdxMacchSub="@IdxMaccSubSel"></MachineBlock>
<ProdConfirm RecMSE="CurrMSE" E_Updated="RefreshData" E_MachSel="SetMacc"></ProdConfirm>
<ProdStat RecMSE="CurrMSE"></ProdStat>
+1 -1
View File
@@ -49,7 +49,7 @@ namespace MP_TAB_SERV.Pages
await RefreshMBlock();
}
}
await InvokeAsync(StateHasChanged);
//await InvokeAsync(StateHasChanged);
}
protected async Task RefreshMBlock()
+1
View File
@@ -7,6 +7,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<NotesMan RecMSE="CurrMSE"></NotesMan>
}
+2 -1
View File
@@ -1,12 +1,13 @@
@page "/odl"
<MseSampler SampleMult="0.05" E_Updated="RefreshData"></MseSampler>
<MseSampler SampleMult="0.5" E_Updated="RefreshData"></MseSampler>
@if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null)
{
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false" IdxMacchSub="@IdxMaccSubSel"></MachineBlock>
<OdlMan RecMSE="CurrMSE" E_Updated="RefreshData" E_MachSel="SetMacc"></OdlMan>
}
+1
View File
@@ -8,6 +8,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<ParamsMan RecMSE="CurrMSE"></ParamsMan>
}
+1
View File
@@ -7,6 +7,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<ProdPlanMan RecMSE="CurrMSE"></ProdPlanMan>
}
+3 -4
View File
@@ -8,9 +8,8 @@
}
else
{
<div>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
</div>
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<NotesEditor @ref="noteEdit" Title="Dichiarazione Fermo Retroattiva + Commento" RecMSE="CurrMSE" CanSave="false" E_DateSel="SetDate"></NotesEditor>
@@ -24,7 +23,7 @@ else
}
@foreach (var item in events2show)
{
<ProdStopMan objCss="@item.CssClass" objIcon="@item.Icon" objTxt="@(item.Label)" IdxEvento="@item.IdxTipo" E_EventSelected="EventRecord"></ProdStopMan>
<ProdStopMan objCss="@item.CssClass" objIcon="@item.Icon" objTxt="@(item.label)" IdxEvento="@item.value" E_EventSelected="EventRecord"></ProdStopMan>
}
</div>
}
+6 -6
View File
@@ -105,7 +105,7 @@ namespace MP_TAB_SERV.Pages
// se realtime
await TabDServ.EvListInsert(newRec, MP.Data.Objects.Enums.tipoInputEvento.barcode);
// resetta il microstato in modo da ricevere successive info HW
TabDServ.resetMicrostatoMacchina(IdxMacc);
await TabDServ.resetMicrostatoMacchina(IdxMacc);
}
else
{
@@ -211,7 +211,7 @@ namespace MP_TAB_SERV.Pages
rdm_nEvCheck = SMServ.GetConfInt("rdm_nEvCheck");
rdm_ChkOnly = SMServ.GetConfBool("rdm_ChkOnly");
// leggo gli altri dati
await ReloadData();
await ReloadData();
}
protected async Task RefreshData(List<MappaStatoExpl> newList)
@@ -229,7 +229,6 @@ namespace MP_TAB_SERV.Pages
await ReloadData();
}
}
await InvokeAsync(StateHasChanged);
}
protected void SetDate(DateTime newDate)
@@ -271,12 +270,13 @@ namespace MP_TAB_SERV.Pages
var eventsAll = await TabDServ.AnagEventiGetByMacch(IdxMacc);
if (eventsAll != null)
{
events2show = eventsAll.Where(x => x.EventoTablet).OrderBy(x => x.Label).ToList();
events2show = eventsAll.Where(x => x.EventoTablet).OrderBy(x => x.label).ToList();
}
}
catch
catch(Exception exc)
{
NavMan.NavigateTo("/", true);
Log.Error($"ProdStop: Eccezione in reloadData {Environment.NewLine}{exc}");
await MServ.LastOpenedPageSet("/");
}
}
}
+5 -7
View File
@@ -45,8 +45,6 @@ namespace MP_TAB_SERV.Pages
protected string CurrOprTknRedis { get; set; } = null!;
protected DateTime expDT { get; set; } = DateTime.Now;
protected int matrOpr
{
get
@@ -90,6 +88,7 @@ namespace MP_TAB_SERV.Pages
protected async Task FirstLogIn()
{
rigaOpr = await TDService.OperatoreSearch(matrOpr, authKey);
var devGuid = await MsgServ.GetCurrDevGuidLSAsync();
if (rigaOpr == null)
{
var deHash = TDService.DecryptData(authKey);
@@ -100,16 +99,16 @@ namespace MP_TAB_SERV.Pages
userTknDTO newUserTkn = new userTknDTO()
{
currOpr = rigaOpr,
expTime = expDT
DevGuid = devGuid
};
var jsonTkn = JsonConvert.SerializeObject(newUserTkn);
string hash = TDService.EncryptData(jsonTkn);
MsgServ.RigaOper = rigaOpr;
await MsgServ.SetCurrOperDtoAsync(hash);
await MsgServ.SetCurrOperDtoLSAsync(hash);
await MsgServ.SetLastMatrOprAsync(rigaOpr.MatrOpr);
await TDService.OperatoreSetRedis(matrOpr, hash);
NavMan.NavigateTo("status-map");
await TDService.OperatoreSetRedis(matrOpr, hash, devGuid);
NavMan.NavigateTo("status-map", true);
}
else
{
@@ -124,7 +123,6 @@ namespace MP_TAB_SERV.Pages
matrOpr = await MsgServ.GetLastMatrOprAsync();
TDService.ConfigGetVal("cookieDayExpire", ref expDays);
ShowScanBarcode = !SMServ.GetConfBool("TAB_WebCamHide");
expDT = DateTime.Now.AddDays(expDays);
oprsList = await TDService.ElencoOperatori();
}
+2 -1
View File
@@ -1,12 +1,13 @@
@page "/scrap"
<MseSampler SampleMult="0.5" E_Updated="RefreshData"></MseSampler>
<MseSampler SampleMult="0.25" E_Updated="RefreshData"></MseSampler>
@if (string.IsNullOrEmpty(IdxMacc) || CurrMSE == null)
{
<EgwCoreLib.Razor.LoadingData></EgwCoreLib.Razor.LoadingData>
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<ScrapMan RecMSE="CurrMSE"></ScrapMan>
}
+1
View File
@@ -8,6 +8,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
@if (enableSchedaTecnica)
{
+23 -4
View File
@@ -60,9 +60,13 @@
</div>
<div>
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between">
<div class="text-start">Prossima disconnessione:</div>
<div class="text-end"><b> @($"{DateTime.Now.AddMinutes(dtScadLogin)}")</b></div>
</li>
<li class="list-group-item d-flex justify-content-between">
<div class="text-start">User</div>
<div class="text-end"><b>USERNAME[999]</b></div>
<div class="text-end"><b> @($"{UserName}[{MatrOpr}]")</b></div>
</li>
<li class="list-group-item d-flex justify-content-between">
<div class="text-start">Server Time</div>
@@ -116,6 +120,16 @@
defCardModeIns = defCardMode;
}
private int MatrOpr
{
get => MsgServ.MatrOpr;
}
private string UserName
{
get => MsgServ.CognomeNome;
}
protected string btnMsStyle
{
get
@@ -191,7 +205,7 @@
if (_tcModIns != value)
{
_tcModIns = value;
MsgServ.UserPrefSave("TcMode", value);
MsgServ.UserPrefSet("TcMode", value);
}
}
}
@@ -206,7 +220,7 @@
if (_langIns != value)
{
_langIns = value;
MsgServ.UserPrefSave("Lang", value);
MsgServ.UserPrefSet("Lang", value);
}
}
}
@@ -220,7 +234,7 @@
if (_defCardMode != value)
{
_defCardMode = value;
MsgServ.UserPrefSave("DefCardMode", value);
MsgServ.UserPrefSet("DefCardMode", value);
}
}
}
@@ -244,11 +258,16 @@
Log.Debug($"Dimensioni schermo: {Width}x{Height}");
}
}
[Inject]
protected SharedMemService MStor { get; set; } = null!;
protected int dtScadLogin { get; set; } = 0;
protected async override Task OnInitializedAsync()
{
tcModIns = MsgServ.UserPrefSetup("TcMode", "ms");
langIns = MsgServ.UserPrefSetup("Lang", "IT");
defCardModeIns = MsgServ.UserPrefSetup("DefCardMode", "full");
dtScadLogin = MStor.GetConfInt("TAB_dtTimerScadLogin");
await Task.Delay(1);
if (string.IsNullOrEmpty(currIpv4))
{
+1
View File
@@ -7,6 +7,7 @@
}
else
{
<CheckControls RecMSE="CurrMSE"></CheckControls>
<MachineBlock RecMSE="CurrMSE" FullMode="false"></MachineBlock>
<h2>Gestione Turni</h2>
<div class="my-2 d-flex justify-content-center">
+1 -8
View File
@@ -38,14 +38,7 @@
<a class="dismiss">🗙</a>
</div>
@*<script src="_content/ZXingBlazor/lib/barcodereader/zxing.js"></script>
<script src="_content/ZXingBlazor/lib/barcodereader/barcode.js"></script>*@
@*<script src="_content/ZXingBlazor/lib/barcodereader/zxing.js"></script>*@
@*<script src="_content/ZXingBlazor/lib/zxing/zxing.min.js"></script>
<script src="MP/TAB3/_content/ZXingBlazor/lib/zxing/zxing.min.js"></script>*@
@*<script src="_content/ZXingBlazor/lib/barcodereader/barcode.js"></script>*@
<script src="~/lib//BarcodeReade.razor.js"></script>
@*<script src="~/lib//BarcodeReade.razor.js"></script>*@
<script src="lib/WindowSize.js"></script>
<script src="lib/bootstrap/js/bootstrap.bundle.js"></script>
<script src="_framework/blazor.server.js"></script>
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<WebPublishMethod>Package</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<ProjectGuid>e7a7c262-7807-4503-949d-5a6fe3df4400</ProjectGuid>
<DesktopBuildPackageLocation>bin\publish\MP.TAB3.zip</DesktopBuildPackageLocation>
<PackageAsSingleFile>true</PackageAsSingleFile>
<DeployIisAppPath>Default Web Site/MP/TAB3</DeployIisAppPath>
<TargetFramework>net6.0</TargetFramework>
<SelfContained>false</SelfContained>
</PropertyGroup>
</Project>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>Modulo MAPOSPEC </i>
<h4>Versione: 6.16.2312.1115</h4>
<h4>Versione: 6.16.2312.1810</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
6.16.2312.1115
6.16.2312.1810
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>6.16.2312.1115</version>
<version>6.16.2312.1810</version>
<url>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/MP-TAB-SERV.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/MP-TAB-SERV/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+2 -2
View File
@@ -6,8 +6,8 @@
<div class="page" @onclick="()=>handleBodyClick()">
<main>
<CmpTop CurrMenuItems="@CurrMenuItems"></CmpTop>
@if (MsgServ.RigaOper != null || NavMan.Uri.Contains("reg-new-device"))
<CmpTop CurrMenuItems="@CurrMenuItems" EA_UserIsOk="checkIfUserOk"></CmpTop>
@if (userIsOk || NavMan.Uri.Contains("reg-new-device"))
{
<article class="content pt-1 d-flex mb-5">
<div class="" id="@bodyTipe">
+47 -7
View File
@@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Components.Routing;
using Microsoft.JSInterop;
using MP.Data.DatabaseModels;
using MP.Data.Services;
using MP_TAB_SERV.Components;
using NLog;
namespace MP_TAB_SERV.Shared
@@ -65,14 +66,26 @@ namespace MP_TAB_SERV.Shared
protected string bodyTipe
{
get => NavMan.Uri.Contains("reg-new-device") ? "mainBodyNoSide" : "mainBody";
get => pageOk ? "mainBodyNoSide" : "mainBody";
}
protected bool pageOk
{
get
{
string currPage = NavMan.Uri;
return currPage.Contains("logout") || currPage.Contains("reg-new-device");
}
}
protected async Task handleBodyClick()
{
await Task.Delay(1);
await checkDtDiff2Logout();
if (!pageOk)
{
await checkDtDiff2Logout();
}
}
private int MatrOpr
@@ -81,32 +94,49 @@ namespace MP_TAB_SERV.Shared
}
protected int typeScadLogin { get; set; } = 0;
protected int dtScadLogin { get; set; } = 0;
protected Guid currDevGuid { get; set; } = new Guid();
protected async Task checkDtDiff2Logout()
{
var diffOfTime = DateTime.Now - MsgServ.dtLastAction;
TimeSpan tsDeltaAct = DateTime.Now.Subtract(MsgServ.dtLastAction);
TimeSpan tsDeltaSave = DateTime.Now.Subtract(MsgServ.dtLastSave);
switch (typeScadLogin)
{
case 0:
if (diffOfTime.Minutes >= dtScadLogin)
if (tsDeltaAct.Minutes >= dtScadLogin)
{
NavMan.NavigateTo("logout");
}
break;
case 1:
if (diffOfTime.Minutes >= dtScadLogin)
if (tsDeltaAct.Minutes >= dtScadLogin)
{
var userTkn = await TDataService.OperatoreGetRedis(MatrOpr);
var userTkn = await TDataService.OperatoreGetRedis(MatrOpr, currDevGuid);
if (!string.IsNullOrEmpty(userTkn))
{
await MsgServ.DoLogIn(userTkn);
await MsgServ.DoLogIn(userTkn, true);
MsgServ.dtLastAction = DateTime.Now;
MsgServ.dtLastSave = DateTime.Now;
}
else
{
NavMan.NavigateTo("logout");
}
}
else
{
// se fosse oltre 1 minuto da ultimo save --> salvo!
if (tsDeltaSave.TotalMinutes > 1)
{
var userTkn = await TDataService.OperatoreGetRedis(MatrOpr, currDevGuid);
if (!string.IsNullOrEmpty(userTkn))
{
await MsgServ.DoLogIn(userTkn, true);
MsgServ.dtLastAction = DateTime.Now;
MsgServ.dtLastSave = DateTime.Now;
}
}
}
break;
}
}
@@ -120,6 +150,9 @@ namespace MP_TAB_SERV.Shared
typeScadLogin = MStor.GetConfInt("TAB_TypeScadLogin");
dtScadLogin = MStor.GetConfInt("TAB_dtTimerScadLogin");
NavMan.LocationChanged += HandleLocationChanged;
currDevGuid = await MsgServ.GetCurrDevGuidLSAsync();
// verifica preliminare setup mdati
if (!MStor.MenuOk)
{
@@ -136,6 +169,13 @@ namespace MP_TAB_SERV.Shared
await Task.Delay(1);
}
protected bool userIsOk { get; set; } = false;
protected async Task checkIfUserOk(bool isOk)
{
await Task.Delay(1);
userIsOk = isOk;
}
protected async Task ReloadMemStor()
{
// in primis svuoto...
+22 -3
View File
@@ -14,9 +14,18 @@
foreach (var item in MenuItems)
{
<div class="nav-item px-2">
<NavLink class="nav-link px-2" @onclick="()=>SetPage(item.NavigateUrl)">
<i class="fa fa-lg @item.icona pe-2" aria-hidden="true"></i> @item.Testo
</NavLink>
@if (@linkActive(item.NavigateUrl))
{
<NavLink class="nav-link px-2 active" @onclick="()=>SetPage(item.NavigateUrl)">
<i class="fa fa-lg @item.icona pe-2" aria-hidden="true"></i> @item.Testo
</NavLink>
}
else
{
<NavLink class="nav-link px-2" @onclick="()=>SetPage(item.NavigateUrl)">
<i class="fa fa-lg @item.icona pe-2" aria-hidden="true"></i> @item.Testo
</NavLink>
}
</div>
}
}
@@ -34,6 +43,16 @@
[Inject]
protected NavigationManager navManager { get; set; } = null!;
protected bool linkActive(string objUrl)
{
bool answ = false;
if (navManager.Uri.Contains(objUrl))
{
answ = true;
}
return answ;
}
protected async Task SetPage(string tgtUrl)
{
await Task.Delay(1);
+1 -1
View File
@@ -17,7 +17,7 @@
"MP.Mag": "Server=SQL2016DEV;Database=MoonPro_MAG; User ID=sa;Password=keyhammer16; integrated security=False; MultipleActiveResultSets=True; App=MP.TAB3;"
},
"OptConf": {
"msRefresh": "2000",
"msRefresh": "4000",
"BaseAddr": "https://localhost:7295/MP/TAB3/",
"BaseUrl": "/MP/TAB3",
"ImgBasePath": "https://iis01.egalware.com/MP/images/macchine/small/",
+4
View File
@@ -34,5 +34,9 @@
{
"outputFile": "Components/ProdPlanMan.razor.css",
"inputFile": "Components/ProdPlanMan.razor.less"
},
{
"outputFile": "Components/CheckControls.razor.css",
"inputFile": "Components/CheckControls.razor.less"
}
]
+164 -47
View File
@@ -54,51 +54,6 @@ namespace MP.Data.Controllers
return dbResult;
}
/// <summary>
/// Elenco operatori
/// </summary>
/// <returns></returns>
public List<AnagOperatoriModel> ElencoOperatori()
{
List<AnagOperatoriModel> dbResult = new List<AnagOperatoriModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbOperatori
.Where(s => s.MatrOpr > 0)
.AsNoTracking()
.OrderBy(x => x.MatrOpr)
.ToList();
}
return dbResult;
}
/// <summary>
/// login operatori
/// </summary>
/// /// <param name="matrOpr"></param>
/// /// <param name="authKey"></param>
/// <returns></returns>
public AnagOperatoriModel OperatoreSearch(int matrOpr, string authKey)
{
AnagOperatoriModel dbResult = null;
AnagOperatoriModel answ = new AnagOperatoriModel();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbOperatori
.Where(s => (s.MatrOpr > 0) && (s.MatrOpr == matrOpr) && (s.authKey == authKey))
.AsNoTracking()
.FirstOrDefault();
if (dbResult != null)
{
answ = dbResult;
}
}
return answ;
}
/// <summary>
/// Registrato ACK allarme
/// </summary>
@@ -560,6 +515,25 @@ namespace MP.Data.Controllers
return fatto;
}
/// <summary>
/// Elenco operatori
/// </summary>
/// <returns></returns>
public List<AnagOperatoriModel> ElencoOperatori()
{
List<AnagOperatoriModel> dbResult = new List<AnagOperatoriModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbOperatori
.Where(s => s.MatrOpr > 0)
.AsNoTracking()
.OrderBy(x => x.MatrOpr)
.ToList();
}
return dbResult;
}
//stp_DDB_getNextByMacchinaFrom
/// <summary>
/// Eliminazione record EventList (SE trovato)
@@ -1264,6 +1238,33 @@ namespace MP.Data.Controllers
return answ;
}
/// <summary>
/// login operatori
/// </summary>
/// ///
/// <param name="matrOpr"></param>
/// ///
/// <param name="authKey"></param>
/// <returns></returns>
public AnagOperatoriModel OperatoreSearch(int matrOpr, string authKey)
{
AnagOperatoriModel dbResult = null;
AnagOperatoriModel answ = new AnagOperatoriModel();
using (var dbCtx = new MoonProContext(_configuration))
{
dbResult = dbCtx
.DbOperatori
.Where(s => (s.MatrOpr > 0) && (s.MatrOpr == matrOpr) && (s.authKey == authKey))
.AsNoTracking()
.FirstOrDefault();
if (dbResult != null)
{
answ = dbResult;
}
}
return answ;
}
/// <summary>
/// Stato prod macchina
/// </summary>
@@ -1444,6 +1445,25 @@ namespace MP.Data.Controllers
return fatto;
}
/// Restituisce elenco Ultimi RC macchina </summary> <param name="idxMacchina"></param>
/// <param name="idxODL"></param> <param name="dataFrom"></param> <param
/// name="dataTo"></param> <returns></returns>
public List<RegistroControlliModel> RegControlliLast(string idxMacchina)
{
List<RegistroControlliModel> dbResult = new List<RegistroControlliModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
var IdxMacc = new SqlParameter("@IdxMacchina", idxMacchina);
dbResult = dbCtx
.DbSetRegControlli
.FromSqlRaw("EXEC stp_RC_getLast @IdxMacchina", IdxMacc)
.AsNoTracking()
.ToList();
}
return dbResult;
}
/// <summary>
/// Aggiunta record RegistroScarti
/// </summary>
@@ -1558,9 +1578,8 @@ namespace MP.Data.Controllers
/// </summary>
/// <param name="newRec"></param>
/// <returns></returns>
public async Task<bool> RegScartiInsert(RegistroScartiModel newRec)
public bool RegScartiInsert(RegistroScartiModel newRec)
{
await Task.Delay(1);
bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration))
{
@@ -1583,6 +1602,104 @@ namespace MP.Data.Controllers
return fatto;
}
/// <summary>
/// Elimina scarti KIT dato record parent (e lo resetta)
/// </summary>
/// <param name="parentRec"></param>
/// <returns></returns>
public bool RegScartiKitDelete(RegistroScartiModel parentRec)
{
bool answ = false;
using (var dbCtx = new MoonProContext(_configuration))
{
var IdxMacc = new SqlParameter("@IdxMacchina", parentRec.IdxMacchina);
var DtRif = new SqlParameter("@DataOra", parentRec.DataOra);
var Causale = new SqlParameter("@Causale", parentRec.Causale);
var dbResult = dbCtx
.Database
.ExecuteSqlRaw("EXEC stp_RSK_Delete @IdxMacchina, @DataOra, @Causale", IdxMacc, DtRif, Causale);
answ = dbResult != 0;
}
return answ;
}
/// <summary>
/// Aggiorna un record scarti KIT ( SE ESISTE...)
/// </summary>
/// <param name="currRec"></param>
/// <returns></returns>
public bool RegScartiKitUpdateQty(RegistroScartiKitModel currRec)
{
bool answ = false;
using (var dbCtx = new MoonProContext(_configuration))
{
var IdxMacc = new SqlParameter("@IdxMacchina", currRec.IdxMacchina);
var DtRif = new SqlParameter("@DataOra", currRec.DataOra);
var Causale = new SqlParameter("@Causale", currRec.Causale);
var CodArticolo = new SqlParameter("@CodArticolo", currRec.CodArticolo);
var Qty = new SqlParameter("@Qty", currRec.Qta);
var dbResult = dbCtx
.Database
.ExecuteSqlRaw("EXEC stp_RSK_UpdateQty @IdxMacchina, @DataOra, @Causale, @CodArticolo, @Qty", IdxMacc, DtRif, Causale, CodArticolo, Qty);
answ = dbResult != 0;
}
return answ;
}
/// <summary>
/// Elenco scarti KIT dato record parent
/// </summary>
/// <param name="parentRec"></param>
/// <returns></returns>
public List<RegistroScartiKitModel> RegScartiKitGetFilt(RegistroScartiModel parentRec)
{
List<RegistroScartiKitModel> dbResult = new List<RegistroScartiKitModel>();
using (var dbCtx = new MoonProContext(_configuration))
{
var IdxMacc = new SqlParameter("@IdxMacchina", parentRec.IdxMacchina);
var DtRif = new SqlParameter("@DataRif", parentRec.DataOra);
var Causale = new SqlParameter("@Causale", parentRec.Causale);
dbResult = dbCtx
.DbSetRegScartiKit
.FromSqlRaw("EXEC stp_RSK_getByFilt @IdxMacchina, @DataRif, @Causale", IdxMacc, DtRif, Causale)
.AsNoTracking()
.ToList();
}
return dbResult;
}
/// <summary>
/// Aggiunta record RegistroScartiKit in tab RSK esplodendo x kit
/// </summary>
/// <param name="newRec"></param>
/// <returns></returns>
public async Task<bool> RegScartiKitSplit(RegistroScartiModel newRec)
{
await Task.Delay(1);
bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration))
{
var IdxMacchina = new SqlParameter("@idxMacchina", newRec.IdxMacchina);
var DataOra = new SqlParameter("@DataOra", newRec.DataOra);
var Causale = new SqlParameter("@Causale", newRec.Causale);
var CodArt = new SqlParameter("@CodArticolo", newRec.CodArticolo);
var Qta = new SqlParameter("@QtyKit", newRec.Qta);
var result = dbCtx
.DbSetRegWithCheck
.FromSqlRaw("exec dbo.stp_RSK_Split @idxMacchina, @DataOra, @Causale, @CodArticolo, @QtyKit", IdxMacchina, DataOra, Causale, CodArt, Qta)
.AsNoTracking()
.ToList();
// indico eseguito!
fatto = result.Count != 0;
}
return fatto;
}
/// <summary>
/// Effettua ricalcolo MSE x macchina indicata
/// </summary>
+2 -1
View File
@@ -10,6 +10,7 @@ namespace MP.Data.DTO
public class userTknDTO
{
public AnagOperatoriModel currOpr { get; set; } = null;
public DateTime expTime { get; set; } = DateTime.Now;
//public DateTime expTime { get; set; } = DateTime.Now;
public Guid DevGuid { get; set; }
}
}
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
#nullable disable
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace MP.Data.DatabaseModels
{
[Table("RegistroScartiKit")]
public partial class RegistroScartiKitModel
{
#region Public Properties
public string IdxMacchina { get; set; } = "";
public DateTime DataOra { get; set; } = DateTime.Now;
public string Causale { get; set; } = "";
public string CodArticoloKit { get; set; } = "";
public string CodArticolo { get; set; } = "";
public string Operatore { get; set; } = "";
public int Qta { get; set; } = 0;
public int QtaMax { get; set; } = 0;
public string Note { get; set; } = "";
public int MatrOpr { get; set; } = 0;
public DateTime? DataOraProdRec { get; set; } = null;
public string Descrizione { get; set; } = "";
public string cssClass { get; set; } = "";
public string icona { get; set; } = "";
public string DescArticolo { get; set; } = "";
public string Tipo { get; set; } = "";
#endregion Public Properties
}
}
+28 -1
View File
@@ -1,5 +1,7 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using System;
using System.Collections.Generic;
using static MP.Data.MgModels.RecipeModel;
#nullable disable
@@ -22,10 +24,35 @@ namespace MP.Data.DatabaseModels
public string CodArticolo { get; set; } = "";
public int MatrOpr { get; set; } = 0;
public DateTime? DataOraProdRec { get; set; } = null;
public bool KitSplit { get; set; } = false;
public string Descrizione { get; set; } = "";
public string cssClass { get; set; } = "";
public string icona { get; set; } = "";
public string DescArticolo { get; set; } = "";
public string Tipo { get; set; } = "";
#endregion Public Properties
public override bool Equals(object obj)
{
if (!(obj is RegistroScartiModel item))
return false;
if (IdxMacchina != item.IdxMacchina)
return false;
if (DataOra != item.DataOra)
return false;
if (Causale != item.Causale)
return false;
return true;
}
public override int GetHashCode()
{
return base.GetHashCode();
}
}
}
@@ -11,8 +11,8 @@ namespace MP.Data.DatabaseModels
public class vSelEventiBCodeModel
{
[Key]
public int IdxTipo { get; set; } = 0;
public string Label { get; set; } = "";
public int value { get; set; } = 0;
public string label { get; set; } = "";
public bool EventoTablet { get; set; } = true;
public string CssClass { get; set; } = "";
public string Icon { get; set; } = "";
+7 -2
View File
@@ -77,6 +77,7 @@ namespace MP.Data
public virtual DbSet<TurniMaccModel> DbSetTurniMacc { get; set; }
public virtual DbSet<RegistroControlliModel> DbSetRegControlli { get; set; }
public virtual DbSet<RegistroScartiModel> DbSetRegScarti { get; set; }
public virtual DbSet<RegistroScartiKitModel> DbSetRegScartiKit { get; set; }
public virtual DbSet<RegistroDichiarazioniModel> DbSetRegDich { get; set; }
public virtual DbSet<RegCheckModel> DbSetRegWithCheck { get; set; }
@@ -538,7 +539,7 @@ namespace MP.Data
modelBuilder.Entity<vSelEventiBCodeModel>(entity =>
{
entity.HasKey(e => e.IdxTipo);
entity.HasKey(e => e.value);
entity.ToView("v_selEventiBCode");
});
@@ -549,7 +550,11 @@ namespace MP.Data
});
modelBuilder.Entity<RegistroScartiModel>(entity =>
{
entity.HasKey(e => new { e.IdxMacchina, e.DataOra, e.Causale});
entity.HasKey(e => new { e.IdxMacchina, e.DataOra, e.Causale });
});
modelBuilder.Entity<RegistroScartiKitModel>(entity =>
{
entity.HasKey(e => new { e.IdxMacchina, e.DataOra, e.Causale, e.CodArticolo });
});
modelBuilder.Entity<FermiNonQualModel>(entity =>
+81 -55
View File
@@ -53,8 +53,6 @@ namespace MP.Data.Services
#endregion Public Events
#region Public Properties
#if false
protected bool _tReset { get; set; } = false;
protected bool tReset
@@ -76,10 +74,10 @@ namespace MP.Data.Services
{
EA_ResetFooterTimer?.Invoke();
}
}
}
#endif
public DateTime dtLastAction { get; set; } = DateTime.Now;
#region Public Properties
public string CognomeNome
{
@@ -120,6 +118,9 @@ namespace MP.Data.Services
}
}
public DateTime dtLastAction { get; set; } = DateTime.Now;
public DateTime dtLastSave { get; set; } = DateTime.Now;
public int MatrOpr
{
get
@@ -247,22 +248,70 @@ namespace MP.Data.Services
return SteamCrypto.DecryptString(encData, Constants.passPhrase);
}
public async Task<bool> DoLogIn(string decodValue, bool saveOpr)
{
bool answ = false;
//expDays = SMService.GetConfInt("cookieDayExpire");
//var expDT = DateTime.Now.AddDays(expDays);
var devGuid = await GetCurrDevGuidLSAsync();
// decifro i valori..
var decrVal = DecryptData(decodValue);
var opData = JsonConvert.DeserializeObject<userTknDTO>(decrVal);
if (opData != null)
{
var rigaOpr = await TDService.OperatoreSearch(opData.currOpr.MatrOpr, opData.currOpr.authKey);
if (rigaOpr != null)
{
userTknDTO newUserTkn = new userTknDTO()
{
currOpr = rigaOpr,
DevGuid = devGuid
};
var jsonTkn = JsonConvert.SerializeObject(newUserTkn);
string hash = TDService.EncryptData(jsonTkn);
RigaOper = rigaOpr;
await SetLastMatrOprAsync(rigaOpr.MatrOpr);
await SetCurrOperDtoLSAsync(hash);
if (saveOpr)
{
await TDService.OperatoreSetRedis(rigaOpr.MatrOpr, hash, devGuid);
}
answ = true;
}
}
return answ;
}
public string EncryptData(string rawData)
{
return SteamCrypto.EncryptString(rawData, Constants.passPhrase);
}
/// <summary>
/// Restituisce il record device GUID da localstorage
/// </summary>
/// <returns></returns>
public async Task<Guid> GetCurrDevGuidLSAsync()
{
Guid answ = new Guid();
var result = await localStorage.GetItemAsync<string>("devGuid");
if (result != null)
{
answ = Guid.Parse(result);
}
return answ;
}
/// <summary>
/// Restituisce il record OperatoreDTO da localstorage
/// </summary>
/// <returns></returns>
public async Task<string> GetCurrOperDtoAsync()
public async Task<string> GetCurrOperDtoLSAsync()
{
string answ = "";
var result = await localStorage.GetItemAsync<string>("currTkn");
if (result != null)
{
//var data = JsonConvert.DeserializeObject<userTknDTO>(result);
answ = result;
}
return answ;
@@ -344,6 +393,7 @@ namespace MP.Data.Services
{
await localStorage.SetItemAsync("CurrMach", machSel);
}
/// <summary>
/// Scrive sul local storage pagina corrente
/// </summary>
@@ -390,13 +440,24 @@ namespace MP.Data.Services
/// scrive il record OperatoreDTO nel localstorage
/// </summary>
/// <returns></returns>
public async Task<bool> SetCurrOperDtoAsync(string currTkn)
public async Task<bool> SetCurrOperDtoLSAsync(string currTkn)
{
bool answ = false;
await localStorage.SetItemAsync("currTkn", currTkn);
answ = true;
return answ;
}
/// <summary>
/// scrive il record Device GUID nel localstorage
/// </summary>
/// <returns></returns>
public async Task<bool> SetCurrDevGuidLSAsync(Guid currDevGuid)
{
bool answ = false;
await localStorage.SetItemAsync("devGuid", currDevGuid.ToString());
answ = true;
return answ;
}
/// <summary>
/// Scrive il valore di IPV4 del device nel localstoragee
@@ -438,48 +499,6 @@ namespace MP.Data.Services
return answ;
}
protected int expDays { get; set; } = 0;
public async Task<bool> DoLogIn(string decodValue)
{
bool answ = false;
expDays = SMService.GetConfInt("cookieDayExpire");
var expDT = DateTime.Now.AddDays(expDays);
// decifro i valori..
var decrVal = DecryptData(decodValue);
var opData = JsonConvert.DeserializeObject<userTknDTO>(decrVal);
if (opData != null)
{
var rigaOpr = await TDService.OperatoreSearch(opData.currOpr.MatrOpr, opData.currOpr.authKey);
if (rigaOpr != null)
{
userTknDTO newUserTkn = new userTknDTO()
{
currOpr = rigaOpr,
expTime = expDT
};
var jsonTkn = JsonConvert.SerializeObject(newUserTkn);
string hash = TDService.EncryptData(jsonTkn);
RigaOper = rigaOpr;
await SetLastMatrOprAsync(rigaOpr.MatrOpr);
await SetCurrOperDtoAsync(hash);
await TDService.OperatoreSetRedis(rigaOpr.MatrOpr, hash);
answ = true;
//if (LastOpenedPage != "" && CurrMacc != "")
//{
// NavMan.NavigateTo(LastOpenedPage);
//}
//else
//{
// NavMan.NavigateTo("status-map");
//}
}
}
return answ;
}
/// <summary>
/// Salva matrOpr nel localstorage
/// </summary>
@@ -492,6 +511,7 @@ namespace MP.Data.Services
return answ;
}
/// <summary>
/// Recupero singola preferenza utente
/// </summary>
@@ -509,12 +529,12 @@ namespace MP.Data.Services
}
/// <summary>
/// Salvo singola rpeferenza utente
/// Salvo singola preferenza utente
/// </summary>
/// <param name="chiave"></param>
/// <param name="valore"></param>
/// <returns></returns>
public bool UserPrefSave(string chiave, string valore)
public bool UserPrefSet(string chiave, string valore)
{
bool done = false;
var currDict = UsersPrefDict;
@@ -548,7 +568,7 @@ namespace MP.Data.Services
{
if (MatrOpr > 0)
{
UserPrefSave(chiave, defValue);
UserPrefSet(chiave, defValue);
}
}
return answ;
@@ -577,11 +597,11 @@ namespace MP.Data.Services
#region Protected Properties
protected int expDays { get; set; } = 0;
protected ILocalStorageService localStorage { get; set; } = null!;
protected TabDataService TDService { get; set; } = null!;
protected SharedMemService SMService { get; set; } = null!;
protected ISessionStorageService sessionStore { get; set; } = null!;
protected SharedMemService SMService { get; set; } = null!;
protected TabDataService TDService { get; set; } = null!;
#endregion Protected Properties
@@ -605,6 +625,12 @@ namespace MP.Data.Services
#endregion Private Fields
#region Private Properties
private Dictionary<string, string> UserPrefs { get; set; } = new Dictionary<string, string>();
#endregion Private Properties
#region Private Methods
private string machineMse(string idxMacc)
+81 -10
View File
@@ -35,7 +35,7 @@ namespace MP.Data.Services
}
else
{
dbController = new MP.Data.Controllers.MpMonController(configuration);
dbController = new Controllers.MpMonController(configuration);
StringBuilder sb = new StringBuilder();
sb.AppendLine($"StatusData | MpMonController OK");
Log.Info(sb.ToString());
@@ -59,7 +59,7 @@ namespace MP.Data.Services
#region Public Properties
public static MP.Data.Controllers.MpMonController dbController { get; set; } = null!;
public static Controllers.MpMonController dbController { get; set; } = null!;
/// <summary>
/// Dizionario dei tag configurati per IOB
@@ -114,17 +114,16 @@ namespace MP.Data.Services
public async Task<List<MappaStatoExpl>> MseGetAll(bool forceDb = false)
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
Stopwatch sw = new Stopwatch();
string source = "DB";
sw.Start();
List<MappaStatoExpl>? result = new List<MappaStatoExpl>();
// cerco in redis...
RedisValue rawData = redisDb.StringGet(Constants.redisMseKey);
if (rawData.HasValue && !forceDb)
{
result = JsonConvert.DeserializeObject<List<MappaStatoExpl>>($"{rawData}");
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"Read from REDIS: {ts.TotalMilliseconds}ms");
source = "REDIS";
}
else
{
@@ -132,17 +131,89 @@ namespace MP.Data.Services
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(Constants.redisMseKey, rawData, TimeSpan.FromMilliseconds(maxAge));
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"Read from DB: {ts.TotalMilliseconds}ms");
}
if (result == null)
{
result = new List<MappaStatoExpl>();
}
sw.Stop();
Log.Debug($"MseGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Restituisce numPezzi (ultimo) x macchina
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
public int MachNumPzGet(string idxMacchina)
{
int answ = 0;
if (MachineNumPz.ContainsKey(idxMacchina))
{
answ = MachineNumPz[idxMacchina];
}
return answ;
}
/// <summary>
/// Salva numPezzi x macchina
/// </summary>
/// <param name="idxMacchina"></param>
/// <param name="numPz"></param>
/// <returns></returns>
public bool MachNumPzSet(string idxMacchina, int numPz)
{
bool answ = false;
if (MachineNumPz.ContainsKey(idxMacchina))
{
MachineNumPz[idxMacchina] = numPz;
}
else
{
MachineNumPz.Add(idxMacchina, numPz);
}
answ = true;
return answ;
}
/// <summary>
/// Restituisce numPezzi (ultimo) x macchina
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
public StatoProdModel MachProdStGet(string idxMacchina)
{
StatoProdModel answ = new StatoProdModel();
if (MachineProdStatus.ContainsKey(idxMacchina))
{
answ = MachineProdStatus[idxMacchina];
}
return answ;
}
/// <summary>
/// Salva numPezzi x macchina
/// </summary>
/// <param name="idxMacchina"></param>
/// <param name="currStatus"></param>
/// <returns></returns>
public bool MachProdStSet(string idxMacchina, StatoProdModel currStatus)
{
bool answ = false;
if (MachineProdStatus.ContainsKey(idxMacchina))
{
MachineProdStatus[idxMacchina] = currStatus;
}
else
{
MachineProdStatus.Add(idxMacchina, currStatus);
}
answ = true;
return answ;
}
private Dictionary<string, int> MachineNumPz { get; set; } = new Dictionary<string, int>();
private Dictionary<string, StatoProdModel> MachineProdStatus { get; set; } = new Dictionary<string, StatoProdModel>();
#endregion Public Methods
#region Protected Fields
+261 -111
View File
@@ -6,6 +6,7 @@ using MP.Data.DTO;
using MP.Data.Objects;
using Newtonsoft.Json;
using NLog;
using Org.BouncyCastle.Asn1.IsisMtt.Ocsp;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
@@ -253,7 +254,6 @@ namespace MP.Data.Services
// cerco in redis...
string currKey = $"{redisBaseKey}:VSEB:{IdxMacch}";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<vSelEventiBCodeModel>>($"{rawData}");
@@ -513,6 +513,7 @@ namespace MP.Data.Services
}
return answ;
}
/// <summary>
/// Recupera il valore in formato DOUBLE
/// </summary>
@@ -841,6 +842,19 @@ namespace MP.Data.Services
return answ;
}
/// <summary>
/// Flush di tutta la cache relativa ad i dati ODL/PODL
/// </summary>
/// <returns></returns>
public async Task FlushOdlCache()
{
await FlushCache("ODL");
await FlushCache("PODL");
await FlushCache("VSODL");
await FlushCache("StatoMacc");
await FlushCache("MSFD");
}
/// <summary>
/// Recupero info IOB x TAB (da info registrate IOB-WIN--&gt; MP-IO)
/// </summary>
@@ -1225,9 +1239,7 @@ namespace MP.Data.Services
{
// inserisco evento
answ = dbTabController.OdlClearSetup(idxODL, idxMacchina);
await FlushCache("ODL");
await FlushCache("PODL");
await FlushCache("VSODL");
await FlushOdlCache();
}
catch (Exception exc)
{
@@ -1287,9 +1299,7 @@ namespace MP.Data.Services
{
// inserisco evento
answ = dbTabController.OdlDividiDaAltraTavola(idxODL, matrOpr, idxMacchinaTo);
await FlushCache("ODL");
await FlushCache("PODL");
await FlushCache("VSODL");
await FlushOdlCache();
}
catch (Exception exc)
{
@@ -1312,9 +1322,7 @@ namespace MP.Data.Services
{
// inserisco evento
answ = dbTabController.OdlFineProd(idxODL, idxMacchina);
await FlushCache("ODL");
await FlushCache("PODL");
await FlushCache("VSODL");
await FlushOdlCache();
}
catch (Exception exc)
{
@@ -1338,9 +1346,7 @@ namespace MP.Data.Services
{
// inserisco evento
answ = dbTabController.OdlFixMachineSlave(idxMacchina, numDayPrev, doInsert);
await FlushCache("ODL");
await FlushCache("PODL");
await FlushCache("VSODL");
await FlushOdlCache();
}
catch (Exception exc)
{
@@ -1367,9 +1373,7 @@ namespace MP.Data.Services
{
// inserisco evento
answ = dbTabController.OdlInizioSetup(idxODL, matrOpr, idxMacchina, tcRich, pzPallet, note);
await FlushCache("ODL");
await FlushCache("PODL");
await FlushCache("VSODL");
await FlushOdlCache();
}
catch (Exception exc)
{
@@ -1473,9 +1477,7 @@ namespace MP.Data.Services
// riordino
result = results.FirstOrDefault();
// svuoto cache
await FlushCache("ODL");
await FlushCache("PODL");
await FlushCache("VSODL");
await FlushOdlCache();
if (result == null)
{
result = new ODLModel();
@@ -1498,9 +1500,7 @@ namespace MP.Data.Services
{
// inserisco evento
answ = await Task.FromResult(dbTabController.OdlSetupPostumo(idxODL, idxMacchina));
await FlushCache("ODL");
await FlushCache("PODL");
await FlushCache("VSODL");
await FlushOdlCache();
}
catch (Exception exc)
{
@@ -1524,9 +1524,7 @@ namespace MP.Data.Services
{
// inserisco evento
answ = await Task.FromResult(dbTabController.OdlSetupPromPostuma(idxPromOdl, matrOpr, idxMacchina));
await FlushCache("ODL");
await FlushCache("PODL");
await FlushCache("VSODL");
await FlushOdlCache();
}
catch (Exception exc)
{
@@ -1555,9 +1553,7 @@ namespace MP.Data.Services
{
// inserisco evento
answ = await Task.FromResult(dbTabController.OdlSplit(idxODL, matrOpr, idxMacchina, TCRich, pzPallet, note, startNewOdl, qtyRich));
await FlushCache("ODL");
await FlushCache("PODL");
await FlushCache("VSODL");
await FlushOdlCache();
}
catch (Exception exc)
{
@@ -1583,9 +1579,7 @@ namespace MP.Data.Services
{
// inserisco evento
answ = dbTabController.OdlUpdate(idxODL, matrOpr, tCRichAttr, pzPallet, note);
await FlushCache("ODL");
await FlushCache("PODL");
await FlushCache("VSODL");
await FlushOdlCache();
}
catch (Exception exc)
{
@@ -1600,14 +1594,14 @@ namespace MP.Data.Services
/// </summary>
/// <param name="matrOpr"></param>
/// <returns></returns>
public async Task<bool> OperatoreDeleteRedis(int matrOpr)
public async Task<bool> OperatoreDeleteRedis(int matrOpr, Guid DevGuid)
{
string source = "REDIS";
Stopwatch sw = new Stopwatch();
sw.Start();
bool answ = false;
// cerco in redis...
string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}";
string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}:CurrDevGuid:{DevGuid}";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
@@ -1624,18 +1618,18 @@ namespace MP.Data.Services
}
/// <summary>
/// Scrive l'hash dell'oggetto curr opr
/// Legge l'oggetto operatore loggato
/// </summary>
/// <param name="matrOpr"></param>
/// <returns></returns>
public async Task<string> OperatoreGetRedis(int matrOpr)
public async Task<string> OperatoreGetRedis(int matrOpr, Guid currDevGuid)
{
string source = "REDIS";
Stopwatch sw = new Stopwatch();
sw.Start();
string answ = "";
// cerco in redis...
string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}";
string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}:CurrDevGuid:{currDevGuid}";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
@@ -1681,7 +1675,7 @@ namespace MP.Data.Services
/// </summary>
/// <param name="currOpr"></param>
/// <returns></returns>
public async Task<string> OperatoreSetRedis(int matrOpr, string currOpr)
public async Task<string> OperatoreSetRedis(int matrOpr, string currOpr, Guid currDevGuid)
{
setExpDays();
string source = "REDIS";
@@ -1689,7 +1683,7 @@ namespace MP.Data.Services
sw.Start();
string answ = "";
// cerco in redis...
string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}";
string currKey = $"{redisUserDataKey}:CurrOpr:{matrOpr}:CurrDevGuid:{currDevGuid}";
//RedisValue rawData = await redisDb.StringGetAsync(currKey);
// serializzo e salvo...
//rawData = JsonConvert.SerializeObject(currOpr);
@@ -1759,8 +1753,7 @@ namespace MP.Data.Services
{
// inserisco evento
answ = dbTabController.PODL_startSetup(editRec, matrOpr, tcRich, pzPallet, note, dtEvent);
await FlushCache("ODL");
await FlushCache("PODL");
await FlushOdlCache();
}
catch (Exception exc)
{
@@ -1968,6 +1961,42 @@ namespace MP.Data.Services
return answ;
}
/// <summary>
/// Restituisce elenco ULTIMI RC x macchina
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
public async Task<List<RegistroControlliModel>> RegControlliLast(string idxMacchina)
{
// setup parametri costanti
string source = "DB";
Stopwatch sw = new Stopwatch();
sw.Start();
List<RegistroControlliModel>? result = new List<RegistroControlliModel>();
// cerco in redis...
string currKey = $"{redisBaseKey}:RecContr:{idxMacchina}:LAST";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<RegistroControlliModel>>($"{rawData}");
source = "REDIS";
}
else
{
result = dbTabController.RegControlliLast(idxMacchina);
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(currKey, rawData, FastCache);
}
if (result == null)
{
result = new List<RegistroControlliModel>();
}
sw.Stop();
Log.Debug($"RegControlliLast | {source} | {sw.Elapsed.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Aggiunta record RegistroScarti
/// </summary>
@@ -2105,9 +2134,10 @@ namespace MP.Data.Services
try
{
// inserisco evento
answ = await dbTabController.RegScartiInsert(newRec);
answ = dbTabController.RegScartiInsert(newRec);
// reset cache eventi/commenti
await FlushCache("RegScarti");
await FlushCache("RegScartiKit");
}
catch (Exception exc)
{
@@ -2117,88 +2147,183 @@ namespace MP.Data.Services
return answ;
}
/// <summary>
/// Elimina elenco RSK da parent
/// </summary>
/// <param name="ParentRec"></param>
/// <returns></returns>
public async Task<bool> RegScartiKitDelete(RegistroScartiModel ParentRec)
{
bool answ = false;
try
{
// inserisco evento
answ = dbTabController.RegScartiKitDelete(ParentRec);
// reset cache eventi/commenti
await FlushCache("RegScarti");
await FlushCache("RegScartiKit");
}
catch (Exception exc)
{
string logMsg = $"Eccezione in RegScartiKitDelete | macchina: {ParentRec.IdxMacchina} | DataOra: {ParentRec.DataOra} | Causale: {ParentRec.Causale} | MatrOpr: {ParentRec.MatrOpr} | Qta {ParentRec.Qta} | Note: {ParentRec.Note}{Environment.NewLine}{exc}";
Log.Error(logMsg);
}
return answ;
}
/// <summary>
/// Restituisce elenco RSK filtrato x parent
/// </summary>
/// <param name="ParentRec"></param>
/// <returns></returns>
public async Task<List<RegistroScartiKitModel>> RegScartiKitGetFilt(RegistroScartiModel ParentRec)
{
// setup parametri costanti
string source = "DB";
Stopwatch sw = new Stopwatch();
sw.Start();
List<RegistroScartiKitModel>? result = new List<RegistroScartiKitModel>();
// cerco in redis...
string currKey = $"{redisBaseKey}:RegScartiKit:{ParentRec.IdxMacchina}:{ParentRec.DataOra:yyyyyMMdd-HHmm}:{ParentRec.Causale}";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<RegistroScartiKitModel>>($"{rawData}");
source = "REDIS";
}
else
{
result = dbTabController.RegScartiKitGetFilt(ParentRec);
// serializzp e salvo...
rawData = JsonConvert.SerializeObject(result);
await redisDb.StringSetAsync(currKey, rawData, FastCache);
}
if (result == null)
{
result = new List<RegistroScartiKitModel>();
}
sw.Stop();
Log.Debug($"RegScartiKitGetFilt | {source} | {sw.Elapsed.TotalMilliseconds}ms");
return result;
}
/// <summary>
/// Split record RegistroScarti --&gt; RegistroScartiKit
/// </summary>
/// <param name="newRec"></param>
/// <returns></returns>
public async Task<bool> RegScartiKitSplit(RegistroScartiModel newRec)
{
bool answ = false;
try
{
// inserisco evento
answ = await dbTabController.RegScartiKitSplit(newRec);
// reset cache eventi/commenti
await FlushCache("RegScarti");
await FlushCache("RegScartiKit");
}
catch (Exception exc)
{
string logMsg = $"Eccezione in RegScartiKitSplit | macchina: {newRec.IdxMacchina} | DataOra: {newRec.DataOra} | Causale: {newRec.Causale} | MatrOpr: {newRec.MatrOpr} | Qta {newRec.Qta} | Note: {newRec.Note}{Environment.NewLine}{exc}";
Log.Error(logMsg);
}
return answ;
}
/// <summary>
/// Update qty record singolo articolo di un KIT Scarti
/// </summary>
/// <param name="editRec"></param>
/// <returns></returns>
public async Task<bool> RegScartiKitUpdateQty(RegistroScartiKitModel editRec)
{
bool answ = false;
try
{
// aggiorno record
answ = dbTabController.RegScartiKitUpdateQty(editRec);
// reset cache eventi/commenti
await FlushCache("RegScarti");
await FlushCache("RegScartiKit");
}
catch (Exception exc)
{
string logMsg = $"Eccezione in RegScartiKitUpdateQty | macchina: {editRec.IdxMacchina} | DataOra: {editRec.DataOra} | Causale: {editRec.Causale} | MatrOpr: {editRec.MatrOpr} | Qta {editRec.Qta} | Note: {editRec.Note}{Environment.NewLine}{exc}";
Log.Error(logMsg);
}
return answ;
}
/// <summary>
/// Resetta (rileggendo) i dati della macchina
/// </summary>
/// <param name="idxMacchina"></param>
/// <returns></returns>
public Dictionary<string, string> resetDatiMacchina(string idxMacchina)
public async Task<Dictionary<string, string>> resetDatiMacchina(string idxMacchina)
{
Dictionary<string, string> answ = new Dictionary<string, string>();
#if false
string currHash = dtMaccHash(idxMacchina);
// inizio con un bel reset...
memLayer.ML.redFlushKey(currHash);
DS_applicazione.MSFDDataTable tabMSFD = new DS_applicazione.MSFDDataTable();
// 2018.01.08 SEMPRE senza singleton: instanzio un nuovo oggetto MapoDb
MapoDb connDb = new MapoDb();
tabMSFD = connDb.taMSFD.getByIdxMacc(idxMacchina);
bool trovato = false;
// se ho righe...
DS_applicazione.MSFDDataTable tab = new DS_applicazione.MSFDDataTable();
DS_applicazione.MSFDRow rigaMSFD;
if (tabMSFD.Rows.Count > 0)
{
try
{
rigaMSFD = tabMSFD[0];
trovato = true;
}
catch
{
rigaMSFD = tab.NewMSFDRow();
}
}
else
{
rigaMSFD = tab.NewMSFDRow();
}
if (trovato)
string currKey = $"{redisBaseKey}:MSFD";
await FlushCache(currKey);
var tabMSFD = await VMSFDGetByMacc(idxMacchina);
if (tabMSFD != null && tabMSFD.Count > 0)
{
var rigaMSFD = tabMSFD.FirstOrDefault();
// ora provo a compilare...
try
{
// salvo 1:1 i valori... STATO
answ.Add("IdxMicroStato", rigaMSFD.IdxMicroStato.ToString());
answ.Add("IdxStato", rigaMSFD.IdxStato.ToString());
answ.Add("CodArticolo", rigaMSFD.CodArticolo);
answ.Add("insEnabled", rigaMSFD.insEnabled.ToString());
answ.Add("sLogEnabled", rigaMSFD.sLogEnabled.ToString());
answ.Add("pallet", rigaMSFD.pallet);
answ.Add("CodArticolo_A", rigaMSFD.CodArticolo_A);
answ.Add("CodArticolo_B", rigaMSFD.CodArticolo_B);
answ.Add("TempoCicloBase", rigaMSFD.TempoCicloBase.ToString());
answ.Add("PzPalletProd", rigaMSFD.PzPalletProd.ToString());
answ.Add("MatrOpr", rigaMSFD.MatrOpr.ToString());
answ.Add("lastVal", rigaMSFD.lastVal);
answ.Add("TCBase", rigaMSFD.TempoCicloBase.ToString());
answ.Add("IdxMicroStato", $"{rigaMSFD.IdxMicroStato}");
answ.Add("IdxStato", $"{rigaMSFD.IdxStato}");
answ.Add("CodArticolo", $"{rigaMSFD.CodArticolo}");
answ.Add("insEnabled", $"{rigaMSFD.InsEnabled}");
answ.Add("sLogEnabled", $"{rigaMSFD.SLogEnabled}");
answ.Add("pallet", $"{rigaMSFD.Pallet}");
answ.Add("CodArticolo_A", $"{rigaMSFD.CodArticoloA}");
answ.Add("CodArticolo_B", $"{rigaMSFD.CodArticoloB}");
answ.Add("TempoCicloBase", $"{rigaMSFD.TempoCicloBase}");
answ.Add("PzPalletProd", $"{rigaMSFD.PzPalletProd}");
answ.Add("MatrOpr", $"{rigaMSFD.MatrOpr}");
answ.Add("lastVal", $"{rigaMSFD.LastVal}");
answ.Add("TCBase", $"{rigaMSFD.TempoCicloBase}");
//...e SETUP
answ.Add("CodMacc", rigaMSFD.codmacchina);
answ.Add("IdxFamIn", rigaMSFD.IdxFamigliaIngresso.ToString());
answ.Add("Multi", rigaMSFD.Multi.ToString());
answ.Add("BitFilt", rigaMSFD.BitFilt.ToString());
answ.Add("MaxVal", rigaMSFD.MaxVal.ToString());
answ.Add("BSR", rigaMSFD.BSR.ToString());
answ.Add("ExplodeBit", rigaMSFD.ExplodeBit.ToString());
answ.Add("NumBit", rigaMSFD.NumBit.ToString());
answ.Add("IdxFamMacc", rigaMSFD.IdxFamiglia.ToString());
answ.Add("simplePallet", rigaMSFD.simplePallet.ToString());
answ.Add("palletChange", rigaMSFD.palletChange.ToString());
answ.Add("CodMacc", rigaMSFD.Codmacchina);
answ.Add("IdxFamIn", $"{rigaMSFD.IdxFamigliaIngresso}");
answ.Add("Multi", $"{rigaMSFD.Multi}");
answ.Add("BitFilt", $"{rigaMSFD.BitFilt}");
answ.Add("MaxVal", $"{rigaMSFD.MaxVal}");
answ.Add("BSR", $"{rigaMSFD.Bsr}");
answ.Add("ExplodeBit", $"{rigaMSFD.ExplodeBit}");
answ.Add("NumBit", $"{rigaMSFD.NumBit}");
answ.Add("IdxFamMacc", $"{rigaMSFD.IdxFamiglia}");
answ.Add("simplePallet", $"{rigaMSFD.SimplePallet}");
answ.Add("palletChange", $"{rigaMSFD.PalletChange}");
// cerco dati master/slave...
var macSlave = await Macchine2Slave();
var mastList = macSlave
.Where(x => x.IdxMacchina.Equals(idxMacchina, StringComparison.InvariantCultureIgnoreCase))
.ToList();
var slaveList = macSlave
.Where(x => x.IdxMacchinaSlave.Equals(idxMacchina, StringComparison.InvariantCultureIgnoreCase))
.ToList();
string isMaster = mastList.Count > 0 ? "1" : "0";
string isSlave = slaveList.Count > 0 ? "1" : "0";
answ.Add("Master", isMaster);
answ.Add("Slave", isSlave);
}
catch (Exception exc)
{
Log.Info(string.Format("Errore in compilazione dati MSFD:{0}{1}", Environment.NewLine, exc), tipoLog.EXCEPTION);
Log.Error($"Errore in compilazione dati MSFD:{Environment.NewLine}{exc}");
}
// cerco dati master/slave...
string isMaster = connDb.taM2S.getByMaster(idxMacchina).Count > 0 ? "1" : "0";
string isSlave = connDb.taM2S.getBySlave(idxMacchina).Count > 0 ? "1" : "0";
answ.Add("Master", isMaster);
answ.Add("Slave", isSlave);
// verifico il timeout che cambia a seconda che sia vero o falso insEnabled...
int tOutShort = memLayer.ML.cdvi("TmOut.MS.S");
int tOutLong = memLayer.ML.cdvi("TmOut.MS.L");
int tOutShort = 0;
int tOutLong = 0;
ConfigGetVal("TmOut.MS.S", ref tOutShort);
ConfigGetVal("TmOut.MS.L", ref tOutLong);
int redDtMacTOut = tOutLong;
try
{
@@ -2209,13 +2334,8 @@ namespace MP.Data.Services
Log.Info($"Eccezione in calcolo timeout dati macchina: idxMacchina{idxMacchina} | TShort: {tOutShort} | TLong {tOutLong}{Environment.NewLine}{exc}");
}
// salvo in redis!
memLayer.ML.redSaveHashDict(currHash, answ, redDtMacTOut);
redisHashDictSet(currKey, answ, TimeSpan.FromSeconds(redDtMacTOut));
}
else
{
Log.Info("Errore in chiamata stp_MSFD_getMacc (connDb.taMSFD.getByIdxMacc(idxMacchina))");
}
#endif
return answ;
}
@@ -2223,7 +2343,7 @@ namespace MP.Data.Services
/// Effettua reset microstato macchina
/// </summary>
/// <param name="idxMacchina"></param>
public void resetMicrostatoMacchina(string idxMacchina)
public async Task resetMicrostatoMacchina(string idxMacchina)
{
// salvo microstato 0...
MicroStatoMacchinaModel newRecMS = new MicroStatoMacchinaModel()
@@ -2235,7 +2355,7 @@ namespace MP.Data.Services
};
var result = dbTabController.MicroStatoMacchinaUpsert(newRecMS);
// reset in redis
resetDatiMacchina(idxMacchina);
await resetDatiMacchina(idxMacchina);
}
/// <summary>
@@ -2632,7 +2752,7 @@ namespace MP.Data.Services
sw.Start();
StatoProdModel? result = new StatoProdModel();
// cerco in redis...
string currKey = $"{redisBaseKey}:StatoProd:{idxMacchina}:{dtReq:HHmmss}";
string currKey = $"{redisBaseKey}:StatoProd:{idxMacchina}:{dtReq:HHmm}";
RedisValue rawData = await redisDb.StringGetAsync(currKey);
//if (!string.IsNullOrEmpty($"{rawData}"))
if (rawData.HasValue)
@@ -3190,6 +3310,36 @@ namespace MP.Data.Services
return fatto;
}
/// <summary>
/// Salvataggio Dictionary come HashSet Redis
/// </summary>
/// <param name="currKey"></param>
/// <param name="dict"></param>
/// <param name="ttl"></param>
private bool redisHashDictSet(RedisKey currKey, Dictionary<string, string> dict, TimeSpan ttl)
{
bool fatto = false;
try
{
HashEntry[] data2ins = new HashEntry[dict.Count];
int i = 0;
foreach (KeyValuePair<string, string> kvp in dict)
{
data2ins[i] = new HashEntry(kvp.Key, kvp.Value);
i++;
}
// salvo!
redisDb.HashSet(currKey, data2ins);
redisDb.KeyExpire(currKey, ttl);
fatto = true;
}
catch (Exception exc)
{
Log.Error($"Eccezione in redisHashDictSet | currKey: {currKey}{Environment.NewLine}{exc}");
}
return fatto;
}
/// <summary>
/// registra su REDIS eventuale superamento numero limite di call x il metodo in oggetto
/// </summary>