Merge branch 'release/IobGomba09'

This commit is contained in:
Samuele Locatelli
2023-09-18 12:07:03 +02:00
3 changed files with 83 additions and 164 deletions
+10 -10
View File
@@ -4,16 +4,16 @@
"name": "reqIN",
"description": "Registra Peso IN",
"memAddr": "000",
"tipoMem": "SOAP",
"tipoMem": "String",
"index": 0,
"size": 1,
"displayOrder": 5
"displayOrder": 5
},
"reqOUT": {
"name": "reqOUT",
"description": "Registra Peso OUT",
"memAddr": "000",
"tipoMem": "SOAP",
"tipoMem": "String",
"index": 0,
"size": 1,
"displayOrder": 6
@@ -22,7 +22,7 @@
"name": "RM",
"description": "Codice Pesata",
"memAddr": "000",
"tipoMem": "SOAP",
"tipoMem": "String",
"index": 0,
"size": 1,
"displayOrder": 7
@@ -31,7 +31,7 @@
"name": "Cod1",
"description": "Codice Cliente",
"memAddr": "000",
"tipoMem": "SOAP",
"tipoMem": "String",
"index": 0,
"size": 1,
"displayOrder": 8
@@ -40,7 +40,7 @@
"name": "Cod2",
"description": "Targa Automezzo",
"memAddr": "000",
"tipoMem": "SOAP",
"tipoMem": "String",
"index": 0,
"size": 1,
"displayOrder": 9
@@ -49,7 +49,7 @@
"name": "Cod3",
"description": "Codice Articolo",
"memAddr": "000",
"tipoMem": "SOAP",
"tipoMem": "String",
"index": 0,
"size": 1,
"displayOrder": 10
@@ -58,7 +58,7 @@
"name": "Cod4",
"description": "Note Ingresso",
"memAddr": "000",
"tipoMem": "SOAP",
"tipoMem": "String",
"index": 0,
"size": 1,
"displayOrder": 11
@@ -67,7 +67,7 @@
"name": "Cod5",
"description": "Note Uscita",
"memAddr": "000",
"tipoMem": "SOAP",
"tipoMem": "String",
"index": 0,
"size": 1,
"displayOrder": 12
@@ -76,7 +76,7 @@
"name": "Cod6",
"description": "Note",
"memAddr": "000",
"tipoMem": "SOAP",
"tipoMem": "String",
"index": 0,
"size": 1,
"displayOrder": 13
+1 -1
View File
@@ -3050,7 +3050,7 @@ namespace IOB_WIN_NEXT.Iob
if (demFactDynData > 1)
{
lgTrace($"Non eseguo processDynData: fatt veto {demFactDynData}");
// ricudo...
// riduco...
demFactDynData--;
}
else
+72 -153
View File
@@ -102,6 +102,13 @@ namespace IOB_WIN_NEXT.IobSoap
#endregion Public Constructors
public enum gombaTaskType
{
reqIN,
reqOUT,
}
#region Public Methods
/// <summary>
@@ -113,12 +120,9 @@ namespace IOB_WIN_NEXT.IobSoap
{
/*---------------------------------------
* fixme todo fare !!!
* gestione execute task SPECIFICI x il sizer:
* - recupero anagrafice variety/layout (attivi)
* - recupero grower
* - invio batch da accodare
* - recupero dati da sizer (OVE disponibili)
* - recupero batch corrente (modalità force/resync?)
* gestione execute task SPECIFICI x pesa:
* - salva i parametri richiesta (RM, cod1..cod6)
* - esegue metodo richiesta (IN/OUT)
*
*---------------------------------------*/
@@ -127,14 +131,14 @@ namespace IOB_WIN_NEXT.IobSoap
if (task2exe != null)
{
// FIXME TODO FARE !!!
// va inserita la richiesta di pesatura IN piuttosto che OUT (2 comandi? 1 solo con parametro? vedere Baglietto)
#if false
// va inserita la richiesta di pesatura IN piuttosto che OUT (2 comandi)
// controllo se memMap != null...
if (memMap != null)
{
bool taskOk = false;
string taskVal = "";
// cerco task specifici: se ho startSetup --> imposto bit DBB701.DBB0.4
// cerco task specifici: qui sono NON standard...
foreach (var item in task2exe)
{
taskOk = false;
@@ -145,12 +149,6 @@ namespace IOB_WIN_NEXT.IobSoap
// controllo sulla KEY...
switch (tName)
{
case taskType.setSupplier:
string cmdArgs = item.Value;
taskVal = executeSetSupplier(cmdArgs);
break;
case taskType.setParameter:
// richiedo da URL i parametri WRITE da popolare
lgInfo("Chiamata setParameter --> processMemWriteRequests");
@@ -183,8 +181,8 @@ namespace IOB_WIN_NEXT.IobSoap
else
{
lgError($"Attenzione! memMap è nullo, non posso eseguire task2exe!");
}
#endif
}
}
return taskDone;
@@ -209,7 +207,7 @@ namespace IOB_WIN_NEXT.IobSoap
// riordino DESC
listPesateCurr = weightArray.OrderByDescending(x => x.dateIn).ToList();
sw.Stop();
lgInfo($"SOAP: effettuata chiamata reqWeightList in {sw.Elapsed.TotalMilliseconds}ms | {dataFrom} --> {dataTo} | {listPesateCurr.Count} rec");
lgInfo($"getDynData | SOAP: effettuata chiamata reqWeightList in {sw.Elapsed.TotalMilliseconds}ms | {dataFrom} --> {dataTo} | {listPesateCurr.Count} rec");
// verifico se siano pesate nuove o meno...
if (listPesateCurr.Count != listPesateArch.Count)
@@ -229,6 +227,10 @@ namespace IOB_WIN_NEXT.IobSoap
{
// prendo la prima
var firstRec = listPesateCurr.Find(x => x.rm == listRmCurr[0]);
if (firstRec != null)
{
outVal.Add("RM", firstRec.rm);
}
// accodo x invio pesata valide IN se presenti...
if (firstRec.dateInSpecified)
{
@@ -250,34 +252,6 @@ namespace IOB_WIN_NEXT.IobSoap
tmpPesate.Add(firstRec);
listPesateArch = tmpPesate;
}
#if false
// ciclo i vari indici rimasti
foreach (var item in listRmCurr)
{
// recupero pesata da indice ordinato...
var rec = listPesateCurr.Find(x => x.rm == item);
// accodo x invio pesata valide IN se presenti...
if (rec.dateInSpecified)
{
// invio record SOLO PESO
outVal.Add("lastWeightIn", $"{rec.weightIn}");
// registro record completo ultima pesata
outVal.Add("lastRecIn", formatPesata(rec, true));
}
// accodo x invio pesata valide OUT se presenti...
if (rec.dateOutSpecified)
{
// invio record SOLO PESO
outVal.Add("lastWeightOut", $"{rec.weightIn}");
// registro record completo ultima pesata
outVal.Add("lastRecOut", formatPesata(rec, false));
}
}
// salvo nuovo elenco pesate
listPesateArch = listPesateCurr;
#endif
}
lastReadPLC = DateTime.Now;
return outVal;
@@ -305,20 +279,6 @@ namespace IOB_WIN_NEXT.IobSoap
currVal += formatCode(rec.cod4);
currVal += formatCode(rec.cod5);
currVal += formatCode(rec.cod6);
#if false
if (!string.IsNullOrEmpty(rec.cod1))
currVal += $" | {rec.cod1}";
if (!string.IsNullOrEmpty(rec.cod2))
currVal += $" | {rec.cod2}";
if (!string.IsNullOrEmpty(rec.cod3))
currVal += $" | {rec.cod3}";
if (!string.IsNullOrEmpty(rec.cod4))
currVal += $" | {rec.cod4}";
if (!string.IsNullOrEmpty(rec.cod5))
currVal += $" | {rec.cod5}";
if (!string.IsNullOrEmpty(rec.cod6))
currVal += $" | {rec.cod6}";
#endif
return currVal;
}
@@ -328,43 +288,6 @@ namespace IOB_WIN_NEXT.IobSoap
return $" | {code}";
}
/// <summary>
/// Effettua processing CUSTOM x Icoel:
/// - recupera elenco batch delle 2 linee
/// - invia al sistema
/// </summary>
public override void processCustomTaskLF()
{
lgInfo($"Richiesto processCustomTaskLF");
// FIXME TODO FARE !!!
// forse NON necessario
#if false
var currBatch = IcoelSizer.GetCurrentBatch();
lgTrace("SOAP: effettuata chiamata IcoelSizer.GetCurrentBatch()");
if (currBatch != null)
{
// verifico se i batch siano variati... e quindi da inviare...
bool doSend = (currBatchList == null || currBatchList.Count == 0);
if (currBatch.Count > 0 && !doSend)
{
foreach (var item in currBatch)
{
// se variato ID è cambiato
doSend = doSend || (currBatchList[item.Key].Id != item.Value.Id);
}
}
// se devo inviare impacchetto dati
if (doSend)
{
accodaRawData(rawTransfType.IcoelBatch, currBatch);
currBatchList = currBatch;
}
}
#endif
lastReadPLC = DateTime.Now;
}
/// <summary>
/// Effettua lettura semafori principale <paramref name="currDispData">Parametri da
@@ -391,41 +314,6 @@ namespace IOB_WIN_NEXT.IobSoap
B_input += (1 << 4);
}
// FIXME TODO FARE !!!
// se risponde è VERDE... altrimenti grigia... e basta!
#if false
if (currBatchList == null)
{
// se nullo --> provo a leggere!
var currBatch = IcoelSizer.GetCurrentBatch();
lgTrace("SOAP: effettuata chiamata IcoelSizer.GetCurrentBatch()");
if (currBatch != null)
{
currBatchList = currBatch;
accodaRawData(rawTransfType.IcoelBatch, currBatch);
}
}
else
{
//se i perf parameters mi danno valire > 0 x quantità frutta...
if (perfParamDict != null && perfParamDict.Count > 0)
{
if (perfParamDict.ContainsKey("VelFruttiMinuto"))
{
if (perfParamDict["VelFruttiMinuto"] > 0)
{
B_input += (1 << 1);
}
// metto manuale
else
{
B_input += (1 << 4);
}
}
}
}
#endif
// accodo NON emergenza
B_input += (1 << 7);
}
@@ -557,30 +445,61 @@ namespace IOB_WIN_NEXT.IobSoap
{
foreach (var item in updatedPar)
{
// FIXME TODO FARE !!!
// rivedere: unico parametro da scrivere è il richiesta pesata (IN/OUT) con aprametri 1..6 opzionali... pensarci su...
#if false
// cerco se sia setSupplier
if (item.uid == "setSupplier")
// salvo i valori di setup x prox pesata...
upsertKey(item.uid, item.reqValue);
bool fatto = false;
// se è richiesta pesata IN/OUT --> mando chiamata
if (item.uid == "reqIN")
{
string reqVal = !string.IsNullOrEmpty(item.reqValue) ? item.reqValue : item.value;
// chiamo
var taskVal = executeSetSupplier(reqVal);
bool fatto = taskVal.StartsWith("REQUEST");
// se fatto --> aggiorno!
if (fatto)
{
//item.value = item.reqValue;
item.reqValue = "";
item.lastRead = DateTime.Now;
item.UM = "";
}
}
#endif
fatto = reqWeight(true);
}
else if (item.uid == "reqOUT")
{
fatto = reqWeight(false);
}
// se fatto --> aggiorno!
if (fatto)
{
//item.value = item.reqValue;
item.reqValue = "";
item.lastRead = DateTime.Now;
item.UM = "";
}
}
}
/// <summary>
/// Esegue richiesta PESO
/// </summary>
/// <param name="reqIN">Tipo richiesta: IN (true) / OUT (false)</param>
/// <returns></returns>
protected bool reqWeight(bool reqIN)
{
bool fatto = false;
try
{
Stopwatch sw = new Stopwatch();
sw.Start();
// preparo parametri
string tipoRic = reqIN ? "IN" : "OUT";
string rm = string.IsNullOrEmpty(currProdData["RM"]) ? $"{DateTime.Now:yyyyMMdd-HHmmss}" : currProdData["RM"];
string Cod1 = string.IsNullOrEmpty(currProdData["Cod1"]) ? "" : currProdData["Cod1"];
string Cod2 = string.IsNullOrEmpty(currProdData["Cod2"]) ? "" : currProdData["Cod2"];
string Cod3 = string.IsNullOrEmpty(currProdData["Cod3"]) ? "" : currProdData["Cod3"];
string Cod4 = string.IsNullOrEmpty(currProdData["Cod4"]) ? "" : currProdData["Cod4"];
string Cod5 = string.IsNullOrEmpty(currProdData["Cod5"]) ? "" : currProdData["Cod5"];
string Cod6 = string.IsNullOrEmpty(currProdData["Cod6"]) ? "" : currProdData["Cod6"];
// faccio chiamata
var answ = gombaConn.memWeight(tipoRic, rm, Cod1, Cod2, Cod3, Cod4, Cod5, Cod6);
fatto = answ.feedback == "C";
sw.Stop();
lgInfo($"SOAP: effettuata chiamata reqWeightList in {sw.Elapsed.TotalMilliseconds}ms | {dataFrom} --> {dataTo}");
}
catch (Exception exc)
{
lgError($"reqWeight | errore richiesta pesatura{Environment.NewLine}{exc}");
}
return fatto;
}
#endregion Protected Methods