update test ODL x TAB3
This commit is contained in:
@@ -38,9 +38,25 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
<div class="col-12">
|
||||
Slave machine man
|
||||
</div>
|
||||
@if (showSplitOdlOnTavVal || showReopOdlTav)
|
||||
{
|
||||
<div class="col-12 bg-danger py-3">
|
||||
<div class="row">
|
||||
<div class="col-12 col-md-6">
|
||||
@if (showSplitOdlOnTavVal)
|
||||
{
|
||||
<button class="btn btn-lg btn-warning w-100" @onclick="OdlSetSameAsOtherTav"><i class="fa fa-check"></i> Attrezza stesso ODL da altra tavola <i class="fa fa-check"></i></button>
|
||||
}
|
||||
</div>
|
||||
<div class="col-12 col-md-6">
|
||||
@if (showReopOdlTav)
|
||||
{
|
||||
<button class="btn btn-lg btn-info w-100" @onclick="OdlReopenTav"><i class="fa fa-exclamation-triangle"></i> Riprendi ODL chiuso su tavola <i class="fa-solid fa-check me-1"></i></button>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<div class="col-12">
|
||||
Check articolo in revisione
|
||||
</div>
|
||||
@@ -243,9 +259,12 @@
|
||||
</div>
|
||||
}
|
||||
}
|
||||
<div class="col-12 col-md-6 p-2">
|
||||
<button class="btn btn-lg btn-success w-100" @onclick="() => SendFixEndSetup()"><i class="fa-solid fa-wrench me-1"></i> Fix Chiusura Attrezzaggio (PLC)</button>
|
||||
</div>
|
||||
@if (!inAttr && enableFixSetup)
|
||||
{
|
||||
<div class="col-12 col-md-6 p-2">
|
||||
<button class="btn btn-lg btn-success w-100" @onclick="() => SendFixEndSetup()"><i class="fa-solid fa-wrench me-1"></i> Fix Chiusura Attrezzaggio (PLC)</button>
|
||||
</div>
|
||||
}
|
||||
<div class="col-12 col-md-6 p-2">
|
||||
<button class="btn btn-lg btn-info w-100" disabled="@needConfProd"><i class="fa-solid fa-triangle-exclamation me-1"></i> Mostra Riattrezzaggio</button>
|
||||
</div>
|
||||
|
||||
@@ -5,7 +5,6 @@ using MP.Data.DatabaseModels;
|
||||
using MP.Data.Objects;
|
||||
using MP.Data.Services;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Text;
|
||||
using static MP.Data.Objects.Enums;
|
||||
|
||||
@@ -102,7 +101,7 @@ namespace MP_TAB_SERV.Components
|
||||
/// </summary>
|
||||
protected bool odlOk
|
||||
{
|
||||
get => (RecMSE != null && RecMSE.IdxOdl > 0);
|
||||
get => IdxOdl > 0;
|
||||
}
|
||||
|
||||
protected bool ShowAll
|
||||
@@ -189,6 +188,70 @@ namespace MP_TAB_SERV.Components
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua ripresa ODL su tavola
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected async Task OdlReopenTav()
|
||||
{
|
||||
MaxVal = 3;
|
||||
int currStep = 0;
|
||||
await advStep(currStep);
|
||||
isProcessing = true;
|
||||
// chiamo stored x riprendere ODL (toglie data chiusura...)
|
||||
var rowRes = TabDServ.OdlReopenOdlMacc(IdxMaccSel);
|
||||
if (rowRes != null && rowRes.IdxOdl > 0)
|
||||
{
|
||||
// messaggio utente
|
||||
string evText = "Registrato riapertura ODL {0} | art {1}";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine(String.Format(evText, rowRes.IdxOdl, rowRes.CodArticolo));
|
||||
lblOut = sb.ToString();
|
||||
}
|
||||
await advStep(currStep++);
|
||||
// update button x setup da altra tavola...
|
||||
checkAll();
|
||||
// faccio refresh e riporto
|
||||
await RefreshData();
|
||||
await CheckAttr();
|
||||
await advStep(currStep++);
|
||||
// chiudo update...
|
||||
isProcessing = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua split ODL da ALTRA tavola su tav corrente
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected async Task OdlSetSameAsOtherTav()
|
||||
{
|
||||
MaxVal = 3;
|
||||
int currStep = 0;
|
||||
await advStep(currStep);
|
||||
isProcessing = true;
|
||||
// se ho ODL su altra macchina...
|
||||
if (IdxOdlAltra > 0)
|
||||
{
|
||||
await TabDServ.OdlDividiDaAltraTavola(IdxOdlAltra, MatrOpr, IdxMaccSel);
|
||||
// messaggio utente
|
||||
string evText = "Registrata inizio attrezzaggio da split ODL {0} (come da altra tavola)";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.AppendLine(String.Format(evText, IdxOdlAltra));
|
||||
lblOut = sb.ToString();
|
||||
}
|
||||
await advStep(currStep++);
|
||||
// update button x setup da altra tavola...
|
||||
checkAll();
|
||||
// faccio refresh e riporto
|
||||
await RefreshData();
|
||||
await CheckAttr();
|
||||
await advStep(currStep++);
|
||||
// chiudo update...
|
||||
isProcessing = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registrazione Fine Setup / Inizio Produzione
|
||||
/// </summary>
|
||||
@@ -280,8 +343,7 @@ namespace MP_TAB_SERV.Components
|
||||
lblOut = sb.ToString().Replace("---", "<br/>");
|
||||
// update buttons...
|
||||
checkAll();
|
||||
// imposto odl...
|
||||
idxOdl = idxODLStart;
|
||||
// reset vari
|
||||
IdxPOdlSel = 0;
|
||||
inAttr = false;
|
||||
IdxPOdlSel = 0;
|
||||
@@ -485,7 +547,7 @@ namespace MP_TAB_SERV.Components
|
||||
checkBtnStatus();
|
||||
fixSplitBtn(false);
|
||||
// faccio refresh e riporto
|
||||
idxOdl = idxODL_curr;
|
||||
await TabDServ.FlushCache("ODL");
|
||||
IdxPOdlSel = 0;
|
||||
RecMSE = null;
|
||||
await RefreshData();
|
||||
@@ -505,6 +567,10 @@ namespace MP_TAB_SERV.Components
|
||||
modoConfProd = SMServ.GetConfInt("modoConfProd");
|
||||
enableRPO = SMServ.GetConfBool("enableRPO");
|
||||
enableSchedaTecnica = SMServ.GetConfBool("enableSchedaTecnica");
|
||||
enableFixSetup = SMServ.GetConfBool("OptEnableFixSetup");
|
||||
showSplitOdlOnTav = SMServ.GetConfBool("showSplitOdlOnTav");
|
||||
showReopenOdlTav = SMServ.GetConfBool("showReopenOdlTav");
|
||||
gPeriodReopenOdlTav = SMServ.GetConfInt("gPeriodReopenOdlTav");
|
||||
string rawEmailDest = SMServ.GetConf("_adminEmail");
|
||||
emailAdmDest = rawEmailDest.Split(',').ToList();
|
||||
if (RecMSE != null)
|
||||
@@ -663,6 +729,32 @@ namespace MP_TAB_SERV.Components
|
||||
tcRichAttr = newTCRich;
|
||||
}
|
||||
|
||||
protected async Task SendFixEndSetup()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi invio FIX chiusura atrtezzaggio ad impianto?"))
|
||||
return;
|
||||
|
||||
string ts = string.Format("{0:yyMMdd}T{0:HHmmss.fff}Z", DateTime.Now);
|
||||
string outData = $"TS:{ts}|MATR:{MatrOpr}|ODL:{IdxOdl}";
|
||||
TabDServ.addTask4Machine(IdxMaccSel, taskType.fixStopSetup, outData);
|
||||
outData = "Inserita richiesta invio Fix chiusura attrezzaggio " + outData;
|
||||
lblOut = outData;
|
||||
// se è master --> chiamo update child!
|
||||
if (isMaster)
|
||||
{
|
||||
// invio eventi ad IOB slave...
|
||||
var slaveList = SMServ.ListM2S
|
||||
.Where(x => x.IdxMacchina.Equals(IdxMaccSel, StringComparison.InvariantCultureIgnoreCase))
|
||||
.ToList();
|
||||
foreach (var machine in slaveList)
|
||||
{
|
||||
// invio chiusura attrezzaggio
|
||||
outData = $"TS:{ts}|MATR:{MatrOpr}|ODL:{IdxOdl}|master machine:{IdxMaccSel}";
|
||||
TabDServ.addTask4Machine(machine.IdxMacchinaSlave, taskType.fixStopSetup, outData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected async Task SendWarnTcChangeReq(int idxOdl, decimal tcAss, decimal tcRich)
|
||||
{
|
||||
// carico altri parametri email...
|
||||
@@ -713,76 +805,11 @@ namespace MP_TAB_SERV.Components
|
||||
}
|
||||
}
|
||||
|
||||
private string txtForceCloseOdl
|
||||
{
|
||||
get => forceCloseOdl ? Traduci("ForceCloseODL") : Traduci("SplitCurrODL");
|
||||
}
|
||||
|
||||
private async Task ReloadXDL(bool reloadFromOdl)
|
||||
{
|
||||
int currIdxPOdl = IdxPOdlSel;
|
||||
if (RecMSE != null)
|
||||
{
|
||||
if (reloadFromOdl)
|
||||
{
|
||||
currIdxPOdl = RecMSE.IdxPOdl ?? 0;
|
||||
}
|
||||
// se ho PODL valido...
|
||||
if (currIdxPOdl > 0)
|
||||
{
|
||||
currPodl = await TabDServ.PODLExp_getByKey(currIdxPOdl);
|
||||
}
|
||||
else
|
||||
{
|
||||
currPodl = new PODLExpModel()
|
||||
{
|
||||
IdxOdl = RecMSE.IdxOdl ?? 0,
|
||||
KeyRichiesta = "-",
|
||||
CodArticolo = RecMSE.CodArticolo,
|
||||
DescArticolo = RecMSE.CodArticolo,
|
||||
NumPezzi = RecMSE.NumPezzi,
|
||||
Tcassegnato = RecMSE.TCAssegnato
|
||||
};
|
||||
}
|
||||
}
|
||||
// update a runtime dati ODL se assegnato
|
||||
if (currPodl.IdxOdl > 0)
|
||||
{
|
||||
currOdl = await TabDServ.OdlByIdx(currPodl.IdxOdl, false);
|
||||
}
|
||||
}
|
||||
|
||||
protected string Traduci(string lemma)
|
||||
{
|
||||
return SMServ.Traduci($"{baseLang}_{lemma}".ToUpper());
|
||||
}
|
||||
|
||||
protected async Task SendFixEndSetup()
|
||||
{
|
||||
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Confermi invio FIX chiusura atrtezzaggio ad impianto?"))
|
||||
return;
|
||||
|
||||
string ts = string.Format("{0:yyMMdd}T{0:HHmmss.fff}Z", DateTime.Now);
|
||||
string outData = $"TS:{ts}|MATR:{MatrOpr}|ODL:{IdxOdl}";
|
||||
TabDServ.addTask4Machine(IdxMaccSel, taskType.fixStopSetup, outData);
|
||||
outData = "Inserita richiesta invio Fix chiusura attrezzaggio " + outData;
|
||||
lblOut = outData;
|
||||
// se è master --> chiamo update child!
|
||||
if (isMaster)
|
||||
{
|
||||
// invio eventi ad IOB slave...
|
||||
var slaveList = SMServ.ListM2S
|
||||
.Where(x => x.IdxMacchina.Equals(IdxMaccSel, StringComparison.InvariantCultureIgnoreCase))
|
||||
.ToList();
|
||||
foreach (var machine in slaveList)
|
||||
{
|
||||
// invio chiusura attrezzaggio
|
||||
outData = $"TS:{ts}|MATR:{MatrOpr}|ODL:{idxOdl}|master machine:{IdxMaccSel}";
|
||||
TabDServ.addTask4Machine(machine.IdxMacchinaSlave, taskType.fixStopSetup, outData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Private Fields
|
||||
@@ -797,6 +824,8 @@ namespace MP_TAB_SERV.Components
|
||||
|
||||
private List<string> emailAdmDest = new List<string>();
|
||||
|
||||
private bool enableFixSetup = false;
|
||||
|
||||
private bool enableRPO = true;
|
||||
|
||||
private bool enableSchedaTecnica = false;
|
||||
@@ -807,9 +836,9 @@ namespace MP_TAB_SERV.Components
|
||||
|
||||
private bool forceCloseOdl = true;
|
||||
|
||||
private string IdxMaccSel = "";
|
||||
private int gPeriodReopenOdlTav = 1;
|
||||
|
||||
private int idxOdl = 0;
|
||||
private string IdxMaccSel = "";
|
||||
|
||||
private int idxPOdlSel = 0;
|
||||
|
||||
@@ -845,6 +874,10 @@ namespace MP_TAB_SERV.Components
|
||||
|
||||
private bool showOdlDetail = false;
|
||||
|
||||
private bool showReopenOdlTav = false;
|
||||
|
||||
private bool showSplitOdlOnTav = false;
|
||||
|
||||
private decimal tcRichAttr = 1;
|
||||
|
||||
#endregion Private Fields
|
||||
@@ -859,19 +892,67 @@ namespace MP_TAB_SERV.Components
|
||||
set { MServ.UserPrefGet("Lang"); }
|
||||
}
|
||||
|
||||
private PODLExpModel currPodl { get; set; } = new PODLExpModel();
|
||||
private string cssDetailOdl
|
||||
{
|
||||
get => IdxPOdlSel > 0 ? "bg-primary text-light" : "bg-warning";
|
||||
}
|
||||
|
||||
private ODLExpModel currOdl { get; set; } = new ODLExpModel();
|
||||
|
||||
private PODLExpModel currPodl { get; set; } = new PODLExpModel();
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se l'ALTRA macchina NON abbia ODL valido (== 0)
|
||||
/// </summary>
|
||||
private bool emptyOdlAltraMacc
|
||||
{
|
||||
get => IdxOdlAltra == 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica se la macchina NON abbia ODL valido (== 0)
|
||||
/// </summary>
|
||||
private bool emptyOdlMacc
|
||||
{
|
||||
get => IdxOdl == 0;
|
||||
}
|
||||
|
||||
private bool endProdDisabled
|
||||
{
|
||||
get => !odlOk || needConfProd;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Variabile idxMacc parent x selezione ODL
|
||||
/// </summary>
|
||||
private string IdxMaccParent { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Valore calcolato key ODL corrente...
|
||||
/// </summary>
|
||||
private int IdxOdl
|
||||
{
|
||||
get => RecMSE != null ? RecMSE.IdxOdl ?? 0 : 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Valore calcolato key ODL altra tavola attivo...
|
||||
/// </summary>
|
||||
private int IdxOdlAltra
|
||||
{
|
||||
get
|
||||
{
|
||||
int answ = 0;
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
var tabOdlAltra = await TabDServ.OdlCurrByMacc(idxMaccAltraTav, false);
|
||||
answ = tabOdlAltra.IdxOdl;
|
||||
});
|
||||
pUpd.Wait();
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private string lblWarnBody
|
||||
{
|
||||
get => odlOk ? Traduci("ConfProdBeforeContinueBody") : Traduci("setOdlBeforeContinueBody");
|
||||
@@ -882,7 +963,6 @@ namespace MP_TAB_SERV.Components
|
||||
get => odlOk ? Traduci("ConfProdBeforeContinueHead") : Traduci("setOdlBeforeContinueHead");
|
||||
}
|
||||
|
||||
|
||||
private int MatrOpr
|
||||
{
|
||||
get => MServ.MatrOpr;
|
||||
@@ -901,11 +981,6 @@ namespace MP_TAB_SERV.Components
|
||||
}
|
||||
}
|
||||
|
||||
private bool endProdDisabled
|
||||
{
|
||||
get => !odlOk || needConfProd;
|
||||
}
|
||||
|
||||
private int numPz2Conf
|
||||
{
|
||||
get
|
||||
@@ -923,18 +998,100 @@ namespace MP_TAB_SERV.Components
|
||||
}
|
||||
}
|
||||
|
||||
private string txtBtnOdlDetail
|
||||
/// <summary>
|
||||
/// Verifica visibilità btn riprendi ODL su 2° tavola SE:
|
||||
/// - sia un impianto MULTI (= con + tavole)
|
||||
/// - sia disattrezzata la tavola
|
||||
/// - in tab congif: se sia abilitato la ripresa ODL sulla seconda tavola
|
||||
/// - in tab config: sia il grace period
|
||||
/// - NON SIANO passati i minuti indicati dalla chiusura
|
||||
/// </summary>
|
||||
private bool showReopOdlTav
|
||||
{
|
||||
get => showOdlDetail ? "Nascondi Dettaglio ODL" : "MOSTRA Dettaglio ODL Corrente";
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
// se è multi controllo
|
||||
if (isMulti)
|
||||
{
|
||||
// verifico se NON HA ODL...
|
||||
if (emptyOdlMacc)
|
||||
{
|
||||
// verifico SE siamo nel gracePeriod... chiuso da meno di 1h
|
||||
DateTime adesso = DateTime.Now;
|
||||
DateTime dtChiusura = DateTime.Now.AddHours(-1);
|
||||
try
|
||||
{
|
||||
var lastOdl = TabDServ.OdlLastByMacc(IdxMaccSel, true);
|
||||
if (lastOdl != null)
|
||||
{
|
||||
dtChiusura = lastOdl.DataFine ?? DateTime.Now.AddHours(-1);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
// ora verifico SE E SOLO SE è ANCORA in attrezzaggio
|
||||
if (inAttr)
|
||||
{
|
||||
// ora verifico SE ALTRA TAVOLA ha ODL...
|
||||
if (dtChiusura.AddMinutes(gPeriodReopenOdlTav) > adesso)
|
||||
{
|
||||
answ = showReopenOdlTav;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica visibilità btn split ODL su 2° tavola SE:
|
||||
/// - sia un impianto MULTI (= con + tavole)
|
||||
/// - sia già attrezzata la prima tavola
|
||||
/// - in tab Congif: se sia abilitato lo split ODL sulla seconda tavola
|
||||
/// - la macchina SIA ANCORA in attrezzaggio (2019.07.08) = 2
|
||||
/// </summary>
|
||||
private bool showSplitOdlOnTavVal
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = false;
|
||||
// se è multi controllo
|
||||
if (isMulti)
|
||||
{
|
||||
// verifico se NON HA ODL ma ce l'ha altra tavola...
|
||||
if (emptyOdlMacc)
|
||||
{
|
||||
// ora verifico SE ALTRA TAVOLA ha ODL...
|
||||
if (!emptyOdlAltraMacc)
|
||||
{
|
||||
// ora verifico SE E SOLO SE è ANCORA in attrezzaggio
|
||||
if (inAttr)
|
||||
{
|
||||
answ = showSplitOdlOnTav;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
private string titleOdlDetail
|
||||
{
|
||||
get => IdxPOdlSel > 0 ? "Verifica parametri attrezzaggio NUOVO PODL" : inAttr ? "Parametri PODL in Attrezzaggio" : "Parametri ODL Corrente";
|
||||
}
|
||||
|
||||
private string cssDetailOdl
|
||||
private string txtBtnOdlDetail
|
||||
{
|
||||
get => IdxPOdlSel > 0 ? "bg-primary text-light" : "bg-warning";
|
||||
get => showOdlDetail ? "Nascondi Dettaglio ODL" : "MOSTRA Dettaglio ODL Corrente";
|
||||
}
|
||||
|
||||
private string txtForceCloseOdl
|
||||
{
|
||||
get => forceCloseOdl ? Traduci("ForceCloseODL") : Traduci("SplitCurrODL");
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
@@ -1284,6 +1441,40 @@ namespace MP_TAB_SERV.Components
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ReloadXDL(bool reloadFromOdl)
|
||||
{
|
||||
int currIdxPOdl = IdxPOdlSel;
|
||||
if (RecMSE != null)
|
||||
{
|
||||
if (reloadFromOdl)
|
||||
{
|
||||
currIdxPOdl = RecMSE.IdxPOdl ?? 0;
|
||||
}
|
||||
// se ho PODL valido...
|
||||
if (currIdxPOdl > 0)
|
||||
{
|
||||
currPodl = await TabDServ.PODLExp_getByKey(currIdxPOdl);
|
||||
}
|
||||
else
|
||||
{
|
||||
currPodl = new PODLExpModel()
|
||||
{
|
||||
IdxOdl = RecMSE.IdxOdl ?? 0,
|
||||
KeyRichiesta = "-",
|
||||
CodArticolo = RecMSE.CodArticolo,
|
||||
DescArticolo = RecMSE.CodArticolo,
|
||||
NumPezzi = RecMSE.NumPezzi,
|
||||
Tcassegnato = RecMSE.TCAssegnato
|
||||
};
|
||||
}
|
||||
}
|
||||
// update a runtime dati ODL se assegnato
|
||||
if (currPodl.IdxOdl > 0)
|
||||
{
|
||||
currOdl = await TabDServ.OdlByIdx(currPodl.IdxOdl, false);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<Version>6.16.2311.919</Version>
|
||||
<Version>6.16.2311.1016</Version>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>MP_TAB_SERV</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<body>
|
||||
<i>Modulo MAPOSPEC </i>
|
||||
<h4>Versione: 6.16.2311.919</h4>
|
||||
<h4>Versione: 6.16.2311.1016</h4>
|
||||
<br /> Note di rilascio:
|
||||
<ul>
|
||||
<li>
|
||||
|
||||
@@ -1 +1 @@
|
||||
6.16.2311.919
|
||||
6.16.2311.1016
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<item>
|
||||
<version>6.16.2311.919</version>
|
||||
<version>6.16.2311.1016</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>
|
||||
|
||||
@@ -848,6 +848,37 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
/// <summary>
|
||||
/// Attrezzo stesso ODL dell'altra tavola
|
||||
/// </summary>
|
||||
/// <param name="idxODL"></param>
|
||||
/// <param name="matrOpr"></param>
|
||||
/// <param name="idxMacchinaTo"></param>
|
||||
/// <returns></returns>
|
||||
public bool OdlDividiDaAltraTavola(int idxODL, int matrOpr, string idxMacchinaTo)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var IdxODL = new SqlParameter("@idxODL", idxODL);
|
||||
var MatrOpr = new SqlParameter("@MatrOpr", matrOpr);
|
||||
var IdxMaccTo = new SqlParameter("@IdxMacchinaTo", idxMacchinaTo);
|
||||
var result = dbCtx
|
||||
.Database
|
||||
.ExecuteSqlRaw("EXEC stp_ODL_dividiDaAltraTav @idxODL, @MatrOpr, @IdxMacchinaTo", IdxODL, MatrOpr, IdxMaccTo);
|
||||
fatto = result != 0;
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante OdlDividiDaAltraTavola{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fix ODL per macchine SLAVE
|
||||
@@ -946,6 +977,63 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo ODL data macchina
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public List<ODLModel> OdlLastByMacc(string idxMacchina)
|
||||
{
|
||||
List<ODLModel> dbResult = new List<ODLModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
dbResult = dbCtx
|
||||
.DbSetODL
|
||||
.FromSqlRaw("EXEC stp_ODL_getLastByMacchina @IdxMacchina", IdxMacchina)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante OdlLastByMacc{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Riapertura ULTIMO ODL data macchina
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public List<ODLModel> OdlReopenOdlMacc(string idxMacchina)
|
||||
{
|
||||
List<ODLModel> dbResult = new List<ODLModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
dbResult = dbCtx
|
||||
.DbSetODL
|
||||
.FromSqlRaw("EXEC stp_ODL_reopenOdlMacc @IdxMacchina", IdxMacchina)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione durante OdlReopenOdlMacc{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Setup ODL Postumo
|
||||
/// </summary>
|
||||
|
||||
@@ -10,6 +10,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
@@ -1154,14 +1155,41 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Fix ODL per macchine SLAVE
|
||||
/// Attrezzo stesso ODL dell'altra tavola
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="numDayPrev"></param>
|
||||
/// <param name="doInsert"></param>
|
||||
/// <param name="idxODL"></param>
|
||||
/// <param name="matrOpr"></param>
|
||||
/// <param name="idxMacchinaTo"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> OdlFixMachineSlave(string idxMacchina, int numDayPrev, int doInsert)
|
||||
public async Task<bool> OdlDividiDaAltraTavola(int idxODL, int matrOpr, string idxMacchinaTo)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
// inserisco evento
|
||||
answ = dbTabController.OdlDividiDaAltraTavola(idxODL, matrOpr, idxMacchinaTo);
|
||||
await FlushCache("ODL");
|
||||
await FlushCache("PODL");
|
||||
await FlushCache("VSODL");
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
string logMsg = $"Eccezione in OdlDividiDaAltraTavola | idxODL: {idxODL} | matrOpr: {matrOpr} | idxMacchinaTo: {idxMacchinaTo}{Environment.NewLine}{exc}";
|
||||
Log.Error(logMsg);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fix ODL per macchine SLAVE
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="numDayPrev"></param>
|
||||
/// <param name="doInsert"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> OdlFixMachineSlave(string idxMacchina, int numDayPrev, int doInsert)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
@@ -1209,6 +1237,72 @@ namespace MP.Data.Services
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ultimo ODL data macchina
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <param name="forceDb"></param>
|
||||
/// <returns></returns>
|
||||
public ODLModel OdlLastByMacc(string idxMacchina, bool forceDb)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
ODLModel result = new ODLModel();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ODL:{idxMacchina}:LAST";
|
||||
RedisValue rawData = redisDb.StringGet(currKey);
|
||||
if (rawData.HasValue && !forceDb)
|
||||
{
|
||||
result = JsonConvert.DeserializeObject<ODLModel>($"{rawData}");
|
||||
source = "REDIS";
|
||||
}
|
||||
else
|
||||
{
|
||||
var results = dbTabController.OdlLastByMacc(idxMacchina);
|
||||
// riordino
|
||||
result = results.FirstOrDefault();
|
||||
// serializzp e salvo...
|
||||
rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, UltraLongCache);
|
||||
}
|
||||
if (result == null)
|
||||
{
|
||||
result = new ODLModel();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"OdlLastByMacc | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Riapertura ULTIMO ODL data macchina
|
||||
/// </summary>
|
||||
/// <param name="idxMacchina"></param>
|
||||
/// <returns></returns>
|
||||
public ODLModel OdlReopenOdlMacc(string idxMacchina)
|
||||
{
|
||||
string source = "DB";
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
ODLModel result = new ODLModel();
|
||||
// cerco in redis...
|
||||
string currKey = $"{redisBaseKey}:ODL:{idxMacchina}:LAST";
|
||||
var results = dbTabController.OdlReopenOdlMacc(idxMacchina);
|
||||
// riordino
|
||||
result = results.FirstOrDefault();
|
||||
// serializzp e salvo...
|
||||
var rawData = JsonConvert.SerializeObject(result);
|
||||
redisDb.StringSet(currKey, rawData, UltraLongCache);
|
||||
if (result == null)
|
||||
{
|
||||
result = new ODLModel();
|
||||
}
|
||||
sw.Stop();
|
||||
Log.Debug($"OdlReopenOdlMacc | {source} | {sw.Elapsed.TotalMilliseconds}ms");
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco ODL data macchina e periodo
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user