Aggiunto salvataggio su redis del processing di veto di un particolare...
This commit is contained in:
@@ -25,9 +25,7 @@ namespace GMW.WebUserControls
|
||||
eventoUDC_qta = "UDC_QTY";
|
||||
codLineaKo = "W1000";
|
||||
tipoUdcLinea = "Sterratura";
|
||||
#if true
|
||||
IdxPosizioneIn = memLayer.ML.cdvi("IdxPosizioneSterrati");
|
||||
#endif
|
||||
IdxPosizioneOut = memLayer.ML.cdvi("IdxPosizioneSterratiTemp");
|
||||
IdxPosizioneOutTempName = "IdxPosizioneSterratiTemp";
|
||||
sVarIdxCella = "IdxCellaLineaST";
|
||||
@@ -204,8 +202,14 @@ namespace GMW.WebUserControls
|
||||
string udcDest = "";
|
||||
// imposto particolare!
|
||||
currParticolare = newPart;
|
||||
|
||||
|
||||
// verifico che il particolare NON SIA in veto...
|
||||
if(checkPartVetoByLinea(currParticolare))
|
||||
{
|
||||
Postazione.messaggiText += " - Attenzione, PARTICOLARE NON ATTIVATO / NON PERMESSO sulla LINEA!";
|
||||
Postazione.CssClass = "stileComandoKo";
|
||||
}
|
||||
else
|
||||
{
|
||||
int idxCellaCurr = 0;
|
||||
try
|
||||
{
|
||||
@@ -295,6 +299,7 @@ namespace GMW.WebUserControls
|
||||
Postazione.CssClass = "stileComandoOk";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -578,72 +583,6 @@ namespace GMW.WebUserControls
|
||||
Response.Redirect(user_std.pagCorrente);
|
||||
}
|
||||
}
|
||||
#if false
|
||||
/// <summary>
|
||||
/// effettua il consumo di tutti gli UDC inviati come array di stringhe
|
||||
/// </summary>
|
||||
/// <param name="UDC_P"></param>
|
||||
private void consumaUdc(string[] UDC_P)
|
||||
{
|
||||
if (UDC_P.Length > 0)
|
||||
{
|
||||
// ciclo
|
||||
foreach (string udc_p in UDC_P)
|
||||
{
|
||||
// se UDC è NON vuoto ed esiste
|
||||
if (udc_p != "" && MagClass.magazzino.checkUDC(udc_p))
|
||||
{
|
||||
// se è consumabile (IdxPosizione > 0)...
|
||||
if (MagClass.magazzino.udcMpIsConsumabile(udc_p))
|
||||
{
|
||||
// consumo UDC
|
||||
MagClass.magazzino.scaricaUdcMpWip(udc_p, Request.UserHostName);
|
||||
// sposta UDC da posizione corrente a nessuna...
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
///associa nuovo UDC ad elenco UDC
|
||||
/// </summary>
|
||||
/// <param name="newUdcChild">UDC da associare come child</param>
|
||||
/// <param name="UDC_P">vettore di UDC da associare come parent</param>
|
||||
private void associaUdc(string newUdcChild, string[] UDC_P)
|
||||
{
|
||||
if (UDC_P.Length > 0)
|
||||
{
|
||||
// ciclo
|
||||
foreach (string udc_p in UDC_P)
|
||||
{
|
||||
// se UDC è NON vuoto ed esiste
|
||||
if (udc_p != "" && MagClass.magazzino.checkUDC(udc_p))
|
||||
{
|
||||
MagClass.magazzino.associaUdcParent(newUdcChild, udc_p);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// verifica che il vettore di UDC abbia tutto lo stesso particolare e lo restituisce, altrimenti restituisce ""
|
||||
/// </summary>
|
||||
/// <param name="UDC_P">vettore di UDC da verificare</param>
|
||||
private string checkPartUDC(string[] UDC_P)
|
||||
{
|
||||
string answ = "";
|
||||
if (UDC_P.Length > 0)
|
||||
{
|
||||
// imposto il primo particolare...
|
||||
answ = MagClass.magazzino.getParticolareByUDC(UDC_P[0]);
|
||||
// ciclo
|
||||
foreach (string udc_p in UDC_P)
|
||||
{
|
||||
if (MagClass.magazzino.getParticolareByUDC(udc_p) != answ) answ = ""; // se uno è diverso "azzero"
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// effettua reset dati
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
using SteamWare;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
|
||||
namespace GMW_data
|
||||
{
|
||||
@@ -1031,6 +1034,14 @@ namespace GMW_data
|
||||
{
|
||||
tipoLinea = "FSC";
|
||||
}
|
||||
else if (Postazione.currNomeLinea.IndexOf("LM - ") >= 0)
|
||||
{
|
||||
tipoLinea = "LM";
|
||||
}
|
||||
else if (Postazione.currNomeLinea.IndexOf("LS - ") >= 0)
|
||||
{
|
||||
tipoLinea = "LS";
|
||||
}
|
||||
else
|
||||
{
|
||||
tipoLinea = "ND";
|
||||
@@ -1113,6 +1124,66 @@ namespace GMW_data
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Verifica un particolare SE ABBIA un veto data la linea
|
||||
/// </summary>
|
||||
/// <param name="codParticolare"></param>
|
||||
/// <returns></returns>
|
||||
public virtual bool checkPartVetoByLinea(string codParticolare)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco se avessi già in redis un controllo particolare/linea attivo e il suo risultato...
|
||||
string mHash = memLayer.ML.redHash($"lineePartVeto:{Postazione.currCodLinea}:{codParticolare}");
|
||||
if (memLayer.ML.getRSV(mHash) != "")
|
||||
{
|
||||
// recupero info...
|
||||
bool.TryParse(memLayer.ML.getRSV(mHash), out answ);
|
||||
}
|
||||
else
|
||||
{
|
||||
// se non ho attributi sulal linea è già SENZA veto...
|
||||
DS_magazzino.ConfLineaDataTable tabConf = MagClass.magazzino.taConfLin.getByLinea(Postazione.currCodLinea);
|
||||
if (tabConf.Count > 0)
|
||||
{
|
||||
// verifico PRIMO RECORD x capire se sono in modalità "passa"
|
||||
if (tabConf[0].Modo == 1)
|
||||
{
|
||||
//--> IMPOSTO VETO
|
||||
answ = true;
|
||||
// cerco il recordo del particolare x TOGLIERE VETO
|
||||
foreach (var item in tabConf)
|
||||
{
|
||||
// se trovo il record corrente
|
||||
if (item.Valore == codParticolare)
|
||||
{
|
||||
// tolgo veto ed esco!
|
||||
answ = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// modalità NON PASSA
|
||||
else
|
||||
{
|
||||
// cerco il recordo del particolare x METTERE IL VETO
|
||||
foreach (var item in tabConf)
|
||||
{
|
||||
// se trovo il record corrente
|
||||
if (item.Valore == codParticolare)
|
||||
{
|
||||
// metto veto ed esco!
|
||||
answ = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// salvo in redis x 5 minuti il controllo fatto...
|
||||
memLayer.ML.setRSV(mHash, answ.ToString(), 5 * 60);
|
||||
}
|
||||
// restituisco risultato!
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Processa UDC nuovo (eventualmente creando) e vecchio (eventualmente consumando)
|
||||
/// </summary>
|
||||
/// <param name="idxCellaCurr"></param>
|
||||
|
||||
Reference in New Issue
Block a user