Fix finali refresh corretto x UNLOAD

This commit is contained in:
Samuele E. Locatelli
2020-08-13 13:17:31 +02:00
parent dcb8f324b7
commit 5c09ff4080
2 changed files with 81 additions and 13 deletions
+42 -3
View File
@@ -1199,6 +1199,24 @@ namespace AppData
return answ;
}
/// <summary>
/// Chiave BATCH corrente su redis
/// </summary>
/// <param name="machine"></param>
/// <returns></returns>
protected static string redCurrBatchId(string machine)
{
string answ = "";
if (string.IsNullOrEmpty(machine))
{
answ = $"{redProdReq}:CurrBatchID";
}
else
{
answ = $"{redProdReq}:CurrBatchID:{machine}";
}
return answ;
}
/// <summary>
/// Chiave Bunk corrente su redis
/// </summary>
/// <param name="machine"></param>
@@ -1241,12 +1259,32 @@ namespace AppData
{
resetCurrBunk();
resetCurrSheet();
setCurrBunkId(machine, -2);
setCurrSheetId(machine, -2);
setCurrBatchId(machine, 0);
setCurrBunkId(machine, 0);
setCurrSheetId(machine, 0);
redisFirstBunk = null;
}
/// <summary>
/// Cache redis del BunkID in lavorazione sulla macchina
/// <param name="machine"></param>
/// </summary>
public static int getCurrBatchId(string macchina)
{
int answ = -1;
string rawData = memLayer.ML.getRSV(redCurrBatchId(macchina));
int.TryParse(rawData, out answ);
return answ;
}
/// <summary>
/// Salvataggio in redis del BunkID in lavorazione sulla macchina
/// </summary>
public static void setCurrBatchId(string macchina, int BatchID)
{
memLayer.ML.setRSV(redCurrBatchId(macchina), BatchID.ToString());
}
/// <summary>
/// Cache redis del BunkID in lavorazione sulla macchina
/// <param name="machine"></param>
/// </summary>
public static int getCurrBunkId(string macchina)
{
@@ -1264,6 +1302,7 @@ namespace AppData
}
/// <summary>
/// Cache redis del SheetID in lavorazione sulla macchina
/// <param name="machine"></param>
/// </summary>
public static int getCurrSheetId(string macchina)
{
@@ -1277,7 +1316,7 @@ namespace AppData
/// </summary>
public static void setCurrSheetId(string macchina, int SheetID)
{
memLayer.ML.setRSV(redCurrBunkId(macchina), SheetID.ToString());
memLayer.ML.setRSV(redCurrSheetId(macchina), SheetID.ToString());
}
/// <summary>
/// Cache redis del PRIMO bunk da lavorare
+39 -10
View File
@@ -16,12 +16,25 @@ namespace NKC_WF
if (!Page.IsPostBack)
{
((SiteMaster)this.Master).showSearch = false;
BatchId = -1;
SheetId = -1;
doUpdate();
}
}
protected int savedBatchId
{
get
{
return ComLib.getCurrBatchId(machine);
}
}
protected int savedSheetId
{
get
{
return ComLib.getCurrSheetId(machine);
}
}
/// <summary>
/// BatchId corrente...
/// </summary>
@@ -30,11 +43,11 @@ namespace NKC_WF
set
{
hfBatchID.Value = value.ToString();
ComLib.setCurrBunkId(machine, value);
ComLib.setCurrBatchId(machine, value);
}
get
{
int answ = ComLib.getCurrBunkId(machine);
int answ = 0;
int.TryParse(hfBatchID.Value, out answ);
return answ;
}
@@ -51,7 +64,7 @@ namespace NKC_WF
}
get
{
int answ = ComLib.getCurrSheetId(machine);
int answ = 0;
int.TryParse(hfSheetID.Value, out answ);
return answ;
}
@@ -72,6 +85,8 @@ namespace NKC_WF
if (doUpdate)
{
cmp_MU_svgViewer.doUpdate();
upnlDrawings.DataBind();
upnlDrawings.Update();
upnlTitle.Update();
}
}
@@ -85,16 +100,21 @@ namespace NKC_WF
DS_App.StackListRow currBunk = ComLib.getCurrBunk();
if (currBunk != null)
{
if (BatchId != currBunk.BatchID)
bool chgBtLocal = BatchId != currBunk.BatchID;
bool chgBtCache = savedBatchId != currBunk.BatchID;
if (chgBtLocal || chgBtCache)
{
BatchId = currBunk.BatchID;
SheetId = 0;
needUpdate = true;
}
DS_App.SheetListRow currSheet = ComLib.getCurrSheet(BatchId, machine);
if (currSheet != null)
{
if (SheetId != currSheet.SheetID)
bool chgShLocal = SheetId != currSheet.SheetID;
bool chgShCache = savedSheetId != currSheet.SheetID;
if (chgShLocal || chgShCache)
{
SheetId = currSheet.SheetID;
needUpdate = true;
@@ -104,8 +124,8 @@ namespace NKC_WF
else
{
BatchId = 0;
SheetId = 0;
ComLib.setCurrBunkId(machine, 0);
ComLib.setCurrSheetId(machine, 0);
ComLib.man.resetSheetUnload(0);
}
// se sheet/bunk 0 --> update!
@@ -120,6 +140,13 @@ namespace NKC_WF
{
// in base al num di sec dell'ora decido cosa aggiornare...
int counter = numWaitSvg;
// ogni x cicli resetto batch/Foglio
if (counter % 15 == 0)
{
//BatchId = -3;
SheetId = -3;
}
// ora faccio verifiche
doUpdate();
// ogni x cicli
if (counter % 10 == 0)
@@ -165,7 +192,9 @@ namespace NKC_WF
{
get
{
return memLayer.ML.getRCnt(redProdReq);
int answ = 999;
answ = memLayer.ML.getRCnt(redProdReq);
return answ;
}
}
/// <summary>
@@ -173,7 +202,7 @@ namespace NKC_WF
/// </summary>
protected void incrNumWait()
{
if (numWaitSvg > 20)
if (numWaitSvg > 30)
{
memLayer.ML.resetRCnt(redProdReq);
Response.Redirect(Request.RawUrl);