Primo OK x lampeggio se selezionato in SMART (ma indica NONs caricabile)
This commit is contained in:
+129
-18
@@ -151,7 +151,7 @@ namespace AppData
|
||||
{
|
||||
string answ = "";
|
||||
// recupero ultima call
|
||||
string redKey = $"{ComLib.redNestAnsw}:LAST_CALL";
|
||||
string redKey = $"{redNestAnsw}:LAST_CALL";
|
||||
answ = memLayer.ML.getRSV(redKey);
|
||||
return answ;
|
||||
}
|
||||
@@ -439,7 +439,7 @@ namespace AppData
|
||||
if (hasValReq)
|
||||
{
|
||||
// invia a redis una richiesta...
|
||||
ComLib.sendMaterials();
|
||||
sendMaterials();
|
||||
// recupero PRIMO batchID da validare
|
||||
int nextBatchId = 0;
|
||||
try
|
||||
@@ -451,7 +451,7 @@ namespace AppData
|
||||
if (nextBatchId > 0)
|
||||
{
|
||||
// richiedo!
|
||||
ComLib.sendBatchReq(nextBatchId, "Estimation", 1);
|
||||
sendBatchReq(nextBatchId, "Estimation", 1);
|
||||
// registro su DB nesting iniziato... QUANDO MI RISPONDE dovrò verificare che era un abtch x VALIDAZIONE
|
||||
DataLayer.man.taBL.updateStatus(nextBatchId, (int)BatchStatus.EstimationRequested, "", 0);
|
||||
answ = true;
|
||||
@@ -863,9 +863,9 @@ namespace AppData
|
||||
foreach (Part currItem in PartList)
|
||||
{
|
||||
// calcolo parametri...
|
||||
PostProcList = ComLib.getPostProcList(currItem.OptParameters);
|
||||
ProcessesReq = ComLib.getProcessesReq(currItem.OptParameters);
|
||||
pdfFilePath = ComLib.getPdfFilePath(currItem.OptParameters);
|
||||
PostProcList = getPostProcList(currItem.OptParameters);
|
||||
ProcessesReq = getProcessesReq(currItem.OptParameters);
|
||||
pdfFilePath = getPdfFilePath(currItem.OptParameters);
|
||||
DataLayer.man.taIL.updateFromNesting(currItem.PartId, currItem.MatId, PostProcList, ProcessesReq, pdfFilePath);
|
||||
}
|
||||
}
|
||||
@@ -1451,7 +1451,7 @@ namespace AppData
|
||||
/// </summary>
|
||||
/// <param name="SheetID"></param>
|
||||
/// <returns></returns>
|
||||
public bool resetPostUnload(int SheetID = 0)
|
||||
public bool resetSheetUnload(int SheetID = 0)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
@@ -1470,9 +1470,8 @@ namespace AppData
|
||||
/// <returns></returns>
|
||||
public static string getCurrentCss(int sheetID)
|
||||
{
|
||||
// recupero da REDIS!
|
||||
string redKey = $"{ComLib.machineUnloadArea(sheetID)}:Css";
|
||||
string redKeyBase = $"{ComLib.machineUnloadArea(sheetID)}";
|
||||
// area REDIS!
|
||||
string redKeyBase = $"{machineUnloadArea(sheetID)}";
|
||||
// TTL standard
|
||||
int dataCacheTTL = memLayer.ML.cdvi("cssCacheTTL");
|
||||
dataCacheTTL = dataCacheTTL <= 0 ? 60 : dataCacheTTL;
|
||||
@@ -1519,18 +1518,22 @@ namespace AppData
|
||||
|
||||
|
||||
// FIX BIN
|
||||
answ = ComLib.saveItemData(answ, redKeyBase, "ItemsBin", itemsBin, dataCacheTTL);
|
||||
answ = updateCssByItemList(answ, redKeyBase, "ItemsBin", itemsBin, dataCacheTTL);
|
||||
|
||||
// FIX CART
|
||||
answ = ComLib.saveItemData(answ, redKeyBase, "ItemsCart", itemsCart, dataCacheTTL);
|
||||
answ = updateCssByItemList(answ, redKeyBase, "ItemsCart", itemsCart, dataCacheTTL);
|
||||
|
||||
// FIX Scaricati
|
||||
answ = ComLib.saveItemData(answ, redKeyBase, "ItemsDepo", itemsDepo, dataCacheTTL);
|
||||
answ = updateCssByItemList(answ, redKeyBase, "ItemsDepo", itemsDepo, dataCacheTTL);
|
||||
|
||||
// FIX SEC-OP
|
||||
answ = ComLib.saveItemData(answ, redKeyBase, "ItemsSecOp", itemsSecOp, dataCacheTTL);
|
||||
answ = updateCssByItemList(answ, redKeyBase, "ItemsSecOp", itemsSecOp, dataCacheTTL);
|
||||
|
||||
// FIXED SEL da array oggetti selezionati...
|
||||
answ = updateCssByPickedItems(answ, redKeyBase, "ItemsSel", dataCacheTTL);
|
||||
|
||||
|
||||
#if false
|
||||
string rawData = memLayer.ML.getRSV($"{redKeyBase}:ItemsSel");
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
@@ -1550,17 +1553,89 @@ namespace AppData
|
||||
// FIX CSS!
|
||||
answ = answ.Replace("#ItemsSel", replaceVal);
|
||||
replaceVal = "";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// INFINE serializzo e salvo tutti gli items trovati...
|
||||
string serVal = JsonConvert.SerializeObject(itemsAll);
|
||||
memLayer.ML.setRSV($"{redKeyBase}:ItemsAll", serVal, dataCacheTTL);
|
||||
|
||||
// salvo redis css!
|
||||
memLayer.ML.setRSV(redKey, answ, dataCacheTTL);
|
||||
memLayer.ML.setRSV($"{redKeyBase}:Css", answ, dataCacheTTL);
|
||||
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Registra che un dato ITEM è stato prelevato in fase di scarico da ID foglio + datamatrix
|
||||
/// </summary>
|
||||
/// <param name="sheetID">ID foglio</param>
|
||||
/// <param name="deviceId">Cod del device di scarico</param>
|
||||
/// <param name="itemDtmx">Cod datamatrix ITEM</param>
|
||||
/// <returns></returns>
|
||||
public static bool saveItemPickup(int sheetID, string deviceId, string itemDtmx)
|
||||
{
|
||||
// area REDIS!
|
||||
string redKeyBase = $"{machineUnloadArea(sheetID)}";
|
||||
bool answ = false;
|
||||
string rawData = memLayer.ML.getRSV($"{redKeyBase}:ItemsSel");
|
||||
Dictionary<string, string> dictData = new Dictionary<string, string>();
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
dictData = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawData);
|
||||
}
|
||||
try
|
||||
{
|
||||
// cerco chiave device...
|
||||
if (dictData.ContainsKey(deviceId))
|
||||
{
|
||||
// sostituisco
|
||||
dictData[deviceId] = itemDtmx;
|
||||
}
|
||||
else
|
||||
{
|
||||
dictData.Add(deviceId, itemDtmx);
|
||||
}
|
||||
// salvo!
|
||||
rawData = JsonConvert.SerializeObject(dictData);
|
||||
memLayer.ML.setRSV($"{redKeyBase}:ItemsSel", rawData);
|
||||
answ = true;
|
||||
// reset memoria redis del CSS x obbligare refresh...
|
||||
memLayer.ML.setRSV($"{redKeyBase}:Css", "");
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
/// <summary>
|
||||
/// Registra che un dato ITEM è stato prelevato in fase di scarico da ID foglio + datamatrix
|
||||
/// </summary>
|
||||
/// <param name="sheetID">ID foglio</param>
|
||||
/// <param name="deviceId">Cod del device di scarico</param>
|
||||
/// <returns></returns>
|
||||
public static bool resetItemPickup(int sheetID, string deviceId)
|
||||
{
|
||||
// area REDIS!
|
||||
string redKeyBase = $"{machineUnloadArea(sheetID)}";
|
||||
bool answ = false;
|
||||
string rawData = memLayer.ML.getRSV($"{redKeyBase}:ItemsSel");
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<string, string> dictData = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawData);
|
||||
// cerco chiave device...
|
||||
if (dictData.ContainsKey(deviceId))
|
||||
{
|
||||
// sostituisco
|
||||
dictData.Remove(deviceId);
|
||||
}
|
||||
answ = true;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processa elenco items e salva in redis valori x css, elenchi, ...
|
||||
@@ -1571,7 +1646,7 @@ namespace AppData
|
||||
/// <param name="itemList">Elenco items specifici</param>
|
||||
/// <param name="dataCacheTTL">TTL della cache x salvataggio valori</param>
|
||||
/// <returns></returns>
|
||||
public static string saveItemData(string currCss, string redKeyBase, string varName, List<string> itemList, int dataCacheTTL)
|
||||
public static string updateCssByItemList(string currCss, string redKeyBase, string varName, List<string> itemList, int dataCacheTTL)
|
||||
{
|
||||
string replaceVal = "";
|
||||
if (itemList.Count > 0)
|
||||
@@ -1586,7 +1661,6 @@ namespace AppData
|
||||
}
|
||||
// FIX CSS!
|
||||
currCss = currCss.Replace($"#{varName}", replaceVal);
|
||||
replaceVal = "";
|
||||
//serializzo e salvo
|
||||
string serVal = JsonConvert.SerializeObject(itemList);
|
||||
memLayer.ML.setRSV($"{redKeyBase}:{varName}", serVal, dataCacheTTL);
|
||||
@@ -1594,6 +1668,43 @@ namespace AppData
|
||||
return currCss;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Processa elenco items e salva in redis valori x css, elenchi, ...
|
||||
/// </summary>
|
||||
/// <param name="currCss">CSS corrente</param>
|
||||
/// <param name="redKeyBase">HASH abse x area REDIS</param>
|
||||
/// <param name="varName">nome variabile x elenco items</param>
|
||||
/// <param name="dataCacheTTL">TTL della cache x salvataggio valori</param>
|
||||
/// <returns></returns>
|
||||
public static string updateCssByPickedItems(string currCss, string redKeyBase, string varName, int dataCacheTTL)
|
||||
{
|
||||
string replaceVal = "";
|
||||
string rawData = memLayer.ML.getRSV($"{redKeyBase}:ItemsSel");
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<string, string> dictData = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawData);
|
||||
// ciclo x cercare x ogni chiave (sessione utente)
|
||||
foreach (var item in dictData)
|
||||
{
|
||||
replaceVal += $"#{item.Value},";
|
||||
}
|
||||
if (replaceVal.Length > 1)
|
||||
{
|
||||
replaceVal = replaceVal.Remove(replaceVal.Length - 1);
|
||||
}
|
||||
// FIX CSS!
|
||||
currCss = currCss.Replace("#ItemsSel", replaceVal);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
|
||||
}
|
||||
return currCss;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user