diff --git a/IOB-UT/baseUtils.cs b/IOB-UT/baseUtils.cs
index 1dee24fa..b3385506 100644
--- a/IOB-UT/baseUtils.cs
+++ b/IOB-UT/baseUtils.cs
@@ -878,7 +878,7 @@ namespace IOB_UT
///
/// Metodi di WebPageScraping (es x compressori Atlas Copco)
///
- WPS
+ WebPageScrap
}
public enum gatherCycle
diff --git a/IOB-WIN/AdapterForm.cs b/IOB-WIN/AdapterForm.cs
index e83e092a..cbf4c487 100644
--- a/IOB-WIN/AdapterForm.cs
+++ b/IOB-WIN/AdapterForm.cs
@@ -628,7 +628,7 @@ namespace IOB_WIN
iobObj = new IobSiemensTorri(this, IOBConf);
start.Enabled = true;
break;
- case tipoAdapter.WPS:
+ case tipoAdapter.WebPageScrap:
iobObj = new IobWPS(this, IOBConf);
start.Enabled = true;
break;
diff --git a/IOB-WIN/DATA/CONF/3018.ini b/IOB-WIN/DATA/CONF/3018.ini
new file mode 100644
index 00000000..71c4256f
--- /dev/null
+++ b/IOB-WIN/DATA/CONF/3018.ini
@@ -0,0 +1,63 @@
+;Configurazione IOB-WIN
+[IOB]
+;Macchina filtraggio fanghi Aprochim x Jetco
+CNCTYPE=WebPageScrap
+PING_MS_TIMEOUT=500
+
+[MACHINE]
+VENDOR=Atlas Copco
+MODEL=GA18VP_13
+
+[CNC]
+IP=192.168.1.55
+;CPUTYPE=S71500
+;RACK=0
+;SLOT=0
+
+[SERVER]
+MPIP=http://192.168.1.7
+MPURL=/MP/IO
+CMDBASE=/IOB/input/
+CMDFLOG=/IOB/flog/
+CMDALIVE=/IOB
+CMDENABLED=/IOB/enabled/
+CMDADV1=?valore=
+CMDREBO=/sendReboot.aspx?idxMacchina=
+
+[MEMORY]
+ADDR_READ=DB550.DBB0
+ADDR_WRITE=DB701.DBB0
+SIZE_READ=1
+SIZE_WRITE=0
+;BIT0=CONN
+BIT1=DB550.DBB1
+;BIT2=PZCOUNT.STD.DB700.DBW22
+BIT3=DB550.DBB3
+BIT4=DB550.DBB4
+
+
+[BLINK]
+;MAX_COUNTER_BLINK = 30
+MAX_COUNTER_BLINK = 15
+;bit0 = 0
+;bit1 = 0
+;bit2 = 1
+;bit3 = 1
+;bit4 = 1
+;bit5 = 0
+;bit6 = 0
+;bit7 = 0
+BLINK_FILT=0
+;BLINK_FILT=28
+
+[OPTPAR]
+;PZCOUNT_MODE=STD.[PAR/MEM].info|BIT.indice
+; attenzione memoria sempre base BYTE (1604 DW --> 6416...)
+;PZCOUNT_MODE=STD.DB550.DBDW0
+;PZ_CAD_MADDR=1602
+;PZ_REQ_MADDR=1603
+;PZ_DONE_MADDR=1604
+;PZ_GTOT_MADDR=1605
+
+[BRANCH]
+NAME=develop
\ No newline at end of file
diff --git a/IOB-WIN/IOB-WIN.csproj b/IOB-WIN/IOB-WIN.csproj
index 8f0faa97..54ce443a 100644
--- a/IOB-WIN/IOB-WIN.csproj
+++ b/IOB-WIN/IOB-WIN.csproj
@@ -204,6 +204,9 @@
Always
+
+ Always
+
Always
diff --git a/IOB-WIN/IobWPS.cs b/IOB-WIN/IobWPS.cs
index 4ee3d960..3f4f5275 100644
--- a/IOB-WIN/IobWPS.cs
+++ b/IOB-WIN/IobWPS.cs
@@ -1,6 +1,8 @@
-using IOB_UT;
+using HtmlAgilityPack;
+using IOB_UT;
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Net.NetworkInformation;
namespace IOB_WIN
@@ -42,11 +44,9 @@ namespace IOB_WIN
// init connessione
setConnection();
- // test completo funzionalità, da TOGLIERE in prod...
-#if DEBUG
- wpsFullTest();
-#endif
#endif
+ // test completo funzionalità, da TOGLIERE in prod...
+ wpsFullTest();
}
///
/// Test funzioni WebPageScraping
@@ -57,798 +57,31 @@ namespace IOB_WIN
try
{
// faccio download preliminare pagina
-
- // salvo la pagina completa
-
+ var web = new HtmlWeb();
+ var htmlDoc = web.Load(baseUri);
+ if (htmlDoc.DocumentNode != null && htmlDoc.ParseErrors != null && !htmlDoc.ParseErrors.Any())
+ {
+ // salvo la pagina completa
+ lgInfo("--------------------------------------");
+ lgInfo("Curr ParsedText");
+ lgInfo("--------------------------------------");
+ lgInfo(htmlDoc.ParsedText);
+ lgInfo("");
+ lgInfo("--------------------------------------");
+ lgInfo("FULL TEXT");
+ lgInfo("--------------------------------------");
+ lgInfo(htmlDoc.Text);
+ lgInfo("--------------------------------------");
+ }
+ else
+ {
+ lgInfo("Errore in htmlDoc parse");
+ }
}
catch (Exception exc)
{
lgError(exc, "Eccezioen durante wpsFullTest");
}
}
-#if false
-
- ///
- /// Enum segnali status macchina (ByteStatus) come flag
- ///
- [Flags]
- public enum bitStatus
- {
- NONE = 0,
- POWER_ON = 1 << 0,
- AUTO = 1 << 1,
- RUN = 1 << 2,
- ERROR = 1 << 3,
- ALARM = 1 << 4,
- EMERG_OK = 1 << 5,
- DOOR_CLOSED = 1 << 6,
- READY_LOAD = 1 << 7
- }
- ///
- /// Enum segnali macchina ulteriori (ByteSignals)
- ///
- [Flags]
- public enum bitSignals
- {
- NONE = 0,
- TRANSF_AUTO = 1 << 0,
- PUNZ_AUTO = 1 << 1,
- BARR_TAV_RIPR = 1 << 2,
- ARIA_OK = 1 << 3,
- CONS_TRANS_OK = 1 << 4,
- TAV_A = 1 << 5,
- TAV_B = 1 << 6,
- RICH_ACCESSO = 1 << 7
- }
-
- ///
- /// LookUpTable di decodifica da CNC a segnali tipo bitmap MAPO
- ///
- Dictionary signLUT = new Dictionary();
- ///
- /// Oggetto MAIN x connessione KAWASAKI
- ///
- protected KRcc.Commu KAWASAKI_ref;
- ///
- /// Array delle risposte dal controllo KAWASAKI
- ///
- protected System.Collections.ArrayList resDataArray;
- ///
- /// Comando inviato al robot
- ///
- protected string comando;
- ///
- /// Variabile verifica thread comunicazione
- ///
- protected bool threadOk = false;
- ///
- /// Nome e seriale macchina
- ///
- protected string macName = "";
- ///
- /// Variabile STATUS corrente (8bit INT)
- ///
- protected string cStatus;
- ///
- /// Variabile SIGNALS corrente (8bit INT)
- ///
- protected string cSignals;
- ///
- /// Num pezzi prelevati
- ///
- protected int numPzPrel;
- ///
- /// Ultimo TC registrato da robot
- ///
- protected decimal lastRecTC;
- ///
- /// Ultima missione svolta da robot
- ///
- protected string lastMissRobot;
-
-
-
- ///
- /// Imposto connessione
- ///
- protected virtual void setConnection()
- {
- // Creo oggetto connessione NC
- parentForm.commPlcActive = true;
- lgInfo("Start init Adapter KAWASAKI all'IP {0} | --> IOB {1}", cIobConf.cncIpAddr, cIobConf.codIOB);
-
- // inizializzo correttamente aree memoria secondo CONF - iniFileName
- IniFile fIni = new IniFile(cIobConf.iniFileName);
- // fix enable prgName
- enablePrgName = fIni.ReadBoolean("CNC", "GETPRGNAME", true);
-
- // SE è necessario refresh...
- if (needRefresh)
- {
- lgInfo("Refreshing connection...");
- // ora tento avvio PLC... SE PING OK...
- if (testPing() == IPStatus.Success)
- {
- try
- {
- string connPar = string.Format("TCP {0}", cIobConf.cncIpAddr);
- KAWASAKI_ref = new KRcc.Commu(connPar);
- //KAWASAKI_ref = new KRcc.Commu("TCP 192.168.0.92");
- // disconnetto e connetto...
- if (utils.CRB("verbose"))
- {
- lgInfo("KAWASAKI: tryDisconnect");
- }
-
- //tryDisconnect();
- //lgInfo("KAWASAKI: tryConnect");
- //tryConnect();
- lgInfo("End init Adapter KAWASAKI");
- if (utils.CRB("verbose"))
- {
- lgInfo("KAWASAKI CONNESSIONE AVVENUTA");
- }
- }
- catch (Exception exc)
- {
- lgError(exc, "Errore in INIT KAWASAKI Commu");
- }
- needRefresh = false;
- }
- parentForm.commPlcActive = false;
- // gestione pzCounter
- if (utils.CRB("enableContapezzi"))
- {
- lgInfo("KAWASAKI: inizio gestione contapezzi");
- try
- {
- // verifico quale modalità sia richiesta: STD (6711) oppure BIT (Custom, con indicazione area)
- if (cIobConf.optPar.Count > 0 && cIobConf.optPar["PZCOUNT_MODE"] != "")
- {
- if (cIobConf.optPar["PZCOUNT_MODE"].StartsWith("STD"))
- {
- pzCntReload(true);
- // refresh associazione Macchina - IOB
- sendM2IOB();
- // per adesso imposto lettura fanuc == contapezzi (poi farà vera lettura...)
- lastCountCNC = contapezzi;
- }
- else
- {
- contapezzi = 0;
- lgInfo("Contapezzi STD disabilitato: modalità {0}", cIobConf.optPar["PZCOUNT_MODE"]);
- }
- }
- else
- {
- contapezzi = 0;
- lgInfo("Parametro mancante PZCOUNT_MODE");
- }
- }
- catch (Exception exc)
- {
- lgError(exc, "Errore in contapezzi KAWASAKI");
- }
- }
- }
- }
- ///
- /// Override disconnessione
- ///
- public override void tryDisconnect()
- {
- if (connectionOk)
- {
- string szStatusConnection = "";
- try
- {
- KAWASAKI_ref.disconnect();
- connectionOk = false;
- lgInfo(szStatusConnection);
- lgInfo("Effettuata disconnessione adapter KAWASAKI!");
- }
- catch (Exception exc)
- {
- lgFatal(exc, "Errore nella disconnessione dall'adapter KAWASAKI");
- }
- }
- else
- {
- lgError("IMPOSSIBILE effettuare disconnessione KAWASAKI: Connessione non disponibile...");
- }
- }
- ///
- /// Override connessione
- ///
- public override void tryConnect()
- {
- if (!connectionOk)
- {
- // controllo che il ping sia stato tentato almeno pingTestSec fa...
- if (DateTime.Now.Subtract(lastPING).TotalSeconds > utils.CRI("pingTestSec"))
- {
- if (verboseLog || periodicLog)
- {
- lgInfo("KAWASAKI: ConnKO - tryConnect");
- }
- // in primis salvo data ping...
- lastPING = DateTime.Now;
- // se passa il ping faccio il resto...
- if (testPing() == IPStatus.Success)
- {
- string szStatusConnection = "";
- try
- {
- // ora provo connessione...
- parentForm.commPlcActive = true;
- string connPar = string.Format("TCP {0}", cIobConf.cncIpAddr);
- KAWASAKI_ref.connect(connPar);
- parentForm.commPlcActive = false;
- lgInfo("szStatusConnection: " + KAWASAKI_ref.IsConnected);
- connectionOk = true;
- // refresh stato allarmi!!!
- if (connectionOk)
- {
- if (adpRunning)
- {
- // carico status allarmi (completo)
- lgInfo("Inizio refresh completo stato allarmi...");
- forceAlarmCheck();
- lgInfo("Completato refresh completo stato allarmi!");
- }
- else
- {
- lgInfo("Connessione OK");
- }
- }
- else
- {
- lgError("Impossibile procedere, connessione mancante...");
- }
- }
- catch (Exception exc)
- {
- lgFatal(string.Format("Errore nella connessione all'adapter KAWASAKI: {0}{1}{2}", szStatusConnection, Environment.NewLine, exc));
- connectionOk = false;
- lgInfo(string.Format("Eccezione in TryConnect, Adapter KAWASAKI NON running, pausa di {0} msec prima di ulteriori tentativi di riconnessione", utils.CRI("waitRecMSec")));
- }
- }
- else
- {
- // loggo no risposta ping ...
- connectionOk = false;
- if (verboseLog || periodicLog)
- {
- lgInfo(string.Format("Attenzione: KAWASAKI controllo PING fallito per IP {0}", cIobConf.cncIpAddr));
- }
- }
- }
- }
- // se non è ancora connesso faccio procesisng memoria caso disconnesso...
- if (!connectionOk)
- {
- // processo semafori ed invio...
- processMemoryDiscon();
- }
- }
-
- ///
- /// Oggetto per lettura counter pezzi PRELEVATI
- ///
- protected int pzPrelevati
- {
- get
- {
- int answ = 0;
- if (KAWASAKI_ref.IsConnected)
- {
- resDataArray = KAWASAKI_ref.command("TYPE i_prelevati", 3000); // num pz prelevati --> "0\r\n"
- int.TryParse(resDataArray[1].ToString().Replace("\n", "").Replace("\r", ""), out answ);
- }
- return answ;
- }
- }
- ///
- /// Oggetto per lettura ULTIMO TC rilevato
- ///
- protected decimal lastTC
- {
- get
- {
- decimal answ = 0;
- if (KAWASAKI_ref.IsConnected)
- {
- resDataArray = KAWASAKI_ref.command("TYPE r_tempo", 3000); // ultimo TCiclo rilevato --> " 349.19\r\n"
- decimal.TryParse(resDataArray[1].ToString().Replace("\n", "").Replace("\r", "").Replace(".", ","), out answ);
- }
- return answ;
- }
- }
- ///
- /// Oggetto per lettura/scrittura counter pezzi robot
- ///
- protected int pzCounter
- {
- get
- {
- int answ = 0;
- if (KAWASAKI_ref.IsConnected)
- {
- resDataArray = KAWASAKI_ref.command("TYPE i_cicli", 3000); // num cicli depositati/fatti --> " 0\r\n"
- int.TryParse(resDataArray[1].ToString().Replace("\n", "").Replace("\r", ""), out answ);
- }
- return answ;
- }
- set
- {
- if (KAWASAKI_ref.IsConnected)
- {
- comando = string.Format("i_cicli={0}", value);
- // scrivo valore cicli
- resDataArray = KAWASAKI_ref.command(comando, 3000); // imposto cicli depositati/fatti a 3 --> " 0\r\n"
- }
- }
- }
- ///
- /// Verifica se il thread 4 di comm sia attivo
- ///
- protected bool commThreadOk
- {
- get
- {
- bool answ = false;
- if (KAWASAKI_ref.IsConnected)
- {
- int retVal = 0;
- resDataArray = KAWASAKI_ref.command("TYPE TASK (1004)", 3000); // thread 4 ok --> " 1\r\n"
- int.TryParse(resDataArray[1].ToString().Replace("\n", "").Replace("\r", ""), out retVal);
- answ = (retVal == 1);
- }
- return answ;
- }
- }
- ///
- /// Recupera nome e seriale macchina
- ///
- protected string machineName
- {
- get
- {
- string answ = "";
- if (KAWASAKI_ref.IsConnected)
- {
- resDataArray = KAWASAKI_ref.command("TYPE $id_true", 3000); // id macchina --> "BX100N-B001 Sn. 2366\r\n"
- answ = resDataArray[1].ToString().Replace("\n", "").Replace("\r", "");
- }
- return answ;
- }
- }
- ///
- /// Recupera ultima missione svolta
- ///
- protected string lastMission
- {
- get
- {
- string answ = "";
- if (KAWASAKI_ref.IsConnected)
- {
- resDataArray = KAWASAKI_ref.command("TYPE $exe", 3000); // missione --> "\r\n" (vuoto, no missione)
- answ = resDataArray[1].ToString().Replace("\n", "").Replace("\r", "");
- }
- return answ;
- }
- }
- ///
- /// Restituisce stato macchina nel formato (da sx a dx):
- /// B0: POWER_ON
- /// B1: AUTO
- /// B2: RUN
- /// B3: ERROR
- /// B4: ALLARME
- /// B5: EMERGENZA OK
- /// B6: PORTA CHIUSA
- /// B7: PRONTO AL LOAD
- ///
- protected string currBitmapStatus
- {
- get
- {
- string answ = "";
- if (KAWASAKI_ref.IsConnected)
- {
- resDataArray = KAWASAKI_ref.command("TYPE $status", 3000); // status --> "0|0|1|0|0|1|0|0\r\n"
- answ = resDataArray[1].ToString().Replace("\n", "").Replace("\r", "").Replace("|", "");
-#if false
- // reverse stringa (B0 portato a sx)
- szBitmap = utils.reverseStr(szBitmap);
- // ora converto bitmap string in INT
- answ = Convert.ToInt32(szBitmap, 2);
-#endif
- }
- return answ;
- }
- }
- ///
- /// Restituisce SEGNALI macchina nel formato:
- /// B0: Transfer in auto
- /// B1: Punzonatrice in AUTO
- /// B2: Barriera tavola ripristinata
- /// B3: Aria in linea OK
- /// B4: Console Transfer in fuori ingombro
- /// B5: TAV A
- /// B6: TAV B
- /// B7: Richiesta accesso attiva
- ///
- protected string currBitmapSignals
- {
- get
- {
- string answ = "";
- if (KAWASAKI_ref.IsConnected)
- {
- resDataArray = KAWASAKI_ref.command("TYPE $signal", 3000); // segnali --> "1|0|1|1|1|0|0|0\r\n"
- answ = resDataArray[1].ToString().Replace("\n", "").Replace("\r", "").Replace("|", "");
-#if false
- // reverse stringa (B0 portato a sx)
- szBitmap = utils.reverseStr(szBitmap);
- // ora converto bitmap string in INT
- answ = Convert.ToInt32(szBitmap, 2);
-#endif
- }
- return answ;
- }
- }
-
- ///
- /// Effettua salvataggio del programma corrente
- ///
- /// Dir di riferimento
- /// Nome Programma (se mancasse *.as lo aggiunge)
- private void saveProgram(string progDir = "prog", string progName = "current.as")
- {
- // path completo
- progName = progName.EndsWith(".as") ? progName : progName + ".as";
- string prgPath = progName;// string.Format("{0}/{1}", progDir, progName);
- if (KAWASAKI_ref.IsConnected)
- {
- // comandi x setup programma...
- resDataArray = KAWASAKI_ref.command("ferma", 3000); // ferma processi (all) --> ""
- resDataArray = KAWASAKI_ref.command("togli", 3000); // toglie processi da pronta esecuzione --> ""
-
- //resp = com.command("SAVE nome_del_file", 3000); // salvataggio file... FORSE --> "\u0005\u0002Bnome_del_file.as\u0017" --> verificare DOVE salva...
-
- int ret = KAWASAKI_ref.save(prgPath); // SAVE current.as[RET]
- if (ret == 0)
- {
- // Success
- }
- if (ret == -1)
- {
- // Communication error
- }
- if (ret == -2)
- {
- // Robot Controller error
- }
- if (ret == -3)
- {
- // Internal error
- }
- }
- }
- ///
- /// Effettua invio del programma di alvorazione al ROBOT
- /// Dir di riferimento
- /// Nome Programma (se mancasse *.as lo aggiunge)
- ///
- private void sendProgram(string progDir = "prog", string progName = "default.as")
- {
- // path completo
- progName = progName.EndsWith(".as") ? progName : progName + ".as";
- string prgPath = progName;// string.Format("{0}/{1}", progDir, progName);
-
- // comandi x setup programma...
- resDataArray = KAWASAKI_ref.command("ferma", 3000); // ferma processi (all) --> ""
- resDataArray = KAWASAKI_ref.command("togli", 3000); // toglie processi da pronta esecuzione --> ""
-
- if (KAWASAKI_ref.IsConnected)
- {
- // carico...
- KAWASAKI_ref.asInquiry = delegate (string as_msg)
- {
- Console.WriteLine(as_msg); if (as_msg.StartsWith("Are you sure ?"))
- {
- return "0\n"; // 0 [RET]
- }
-
- if (as_msg.StartsWith("Load data?"))
- {
- return "1\n"; // 1 [RET]
- }
-
- return null;
- };
- int retLoad = KAWASAKI_ref.load(prgPath, "/Q"); // LOAD/Q default.as[RET]
- }
- }
-
-
- #region Metodi specifici (da verificare/completare in implementazione)
-
- ///
- /// Effettua vero processing contapezzi
- ///
- public override void processContapezzi()
- {
- if (utils.CRB("enableContapezzi"))
- {
- try
- {
- // hard coded... !!!FARE!!! rivedere megio conf
- lastCountCNC = pzCounter;
- // verifico quale modalità sia richiesta: STD (6711) oppure BIT (Custom, con indicazione area)
- if (cIobConf.optPar.Count > 0 && cIobConf.optPar["PZCOUNT_MODE"] != "")
- {
-#if false
- string memAddr = cIobConf.optPar["PZCOUNT_MODE"];
- if (memAddr.StartsWith("STD"))
- {
- // inizio verifica area memoria/parametro levando prima parte codice
- memAddr = memAddr.Replace("STD.", "");
- object outputVal = new object();
- // verifico se si tratta di lettura area DB... formato tipo STD.DB700.DBB22.W
- if (memAddr.StartsWith("DB"))
- {
- memAreaSiemens areaCounter = new memAreaSiemens(memAddr);
-
- if (utils.CRB("verbose"))
- {
- lgInfo("[0] area memoria: {1}.{2}.{3}", memAddr, areaCounter.DbNum, areaCounter.indiceMem, areaCounter.tipoMem);
- }
- // copio da blocco già letto... con switch x tipo dati --> tipo lettura... e salvo ultimo conteggio rilevato
- switch (areaCounter.tipoMem)
- {
- case "B":
- byte valB = RawInput[areaCounter.indiceMem];
- outputVal = valB;
- break;
- case "W":
- ushort valW = S7.Net.Types.Word.FromByteArray(RawInput.Skip(areaCounter.indiceMem).Take(2).ToArray());
- outputVal = valW;
- break;
- case "DW":
- uint valDW = S7.Net.Types.Word.FromByteArray(RawInput.Skip(areaCounter.indiceMem).Take(4).ToArray());
- outputVal = valDW;
-
- break;
- default:
- break;
- }
- // salvo...
- Int32.TryParse(outputVal.ToString(), out lastCountCNC);
- if (utils.CRB("verbose"))
- {
- lgInfo("[2] outputVal contapezzi: {0}", outputVal);
- lgInfo("[3] lastCountCNC contapezzi: {0}", lastCountCNC);
- }
- }
- stopwatch.Stop();
- }
-#endif
- }
- }
- catch (Exception exc)
- {
- lgError(exc, "Errore in contapezzi KAWASAKI");
- }
- }
- }
- ///
- /// Effettua processing del recupero delle OVERRIDE (spindle, feedrate, rapid)
- ///
- public override void processOverride()
- {
- }
- ///
- /// lettura bit semafori
- ///
- public override void readSemafori()
- {
- base.readSemafori();
- if (verboseLog)
- {
- lgInfo("inizio read semafori");
- }
-
- parentForm.sIN = Semaforo.SV;
-
- // effettuo TUTTE le letture
- threadOk = commThreadOk;
- cStatus = currBitmapStatus;
- cSignals = currBitmapSignals;
- lastCountCNC = pzCounter;
- // decodifica e gestione
- decodeToBaseBitmap();
- decodeOtherData();
- }
-
- ///
- /// Effettua decodifica aree memoria alla bitmap usata x MAPO
- ///
- private void decodeToBaseBitmap()
- {
- // init a zero...
- B_input = 0;
- /* -----------------------------------------------------
- * bitmap MAPO
- * B0: POWER_ON
- * B1: RUN
- * B2: pzCount
- * B3: allarme
- * B4: manuale
- * B5: emergenza
- * B6: error prog
- * B7: auto mode
- ----------------------------------------------------- */
- // bit 0 (poweron) imposto a 1 SE connected...
- B_input = KAWASAKI_ref.IsConnected ? 1 : 0;
- // RUN
- if (cStatus[2] == '1')
- {
- B_input += (1 << 1);
- }
- // ERROR prog/macchina
- if (cStatus[3] == '1')
- {
- B_input += (1 << 6);
- }
- // allarme
- if (cStatus[4] == '1')
- {
- B_input += (1 << 3);
- }
- // Automatico (porta chiusa)
- if (cStatus[6] == '1' || cStatus[1] == '1')
- {
- B_input += (1 << 4);
- }
- // NON EMERGENZA (1=armed, 0=triggered)
- if (cStatus[5] == '0')
- {
- B_input += (1 << 5);
- }
-
- // process ODL e contapezzi
- string currODL = "";
- try
- {
- currODL = utils.callUrl(urlGetCurrODL);
- // solo SE HO un ODL...
- if (currODL == "" || currODL == "0")
- {
- if (periodicLog)
- {
- lgInfo(string.Format("Kawasaki | Lettura ODL andata a vuoto: currODL: {0}", currODL));
- }
- }
- else
- { // se variato o scaduto timeout log...
- if (periodicLog || (currIdxODL.ToString() != currODL))
- {
- lgInfo(string.Format("Kawasaki | Lettura ODL, currODL: {0} --> currIdxODL prec: {1}", currODL, currIdxODL));
- }
- // provo a salvare nuovo ODL
- int.TryParse(currODL, out currIdxODL);
- }
- }
- catch (Exception exc)
- {
- if (DateTime.Now.Subtract(lastWarnODL).TotalSeconds > 15)
- {
- lgError(exc, "Errore in fase di chiamata URL x ODL corrente | URL chiamato: {0}", urlGetCurrODL);
- lastWarnODL = DateTime.Now;
- }
- }
- if (currODL != null && currODL != "" && currODL != "0")
- {
- // ora processo il contapezzi...
- // controllo se è passato intervallo minimo tra 2 controlli/elaborazioni x distanziare invio e ridurre letture
- if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay))
- {
- // se sono differenti MOSTRO...
- if (lastCountCNC != contapezzi)
- {
- // registro contapezzi
- lgInfo(string.Format("Differenza Contapezzi: READ: {0} | Interno {1}", lastCountCNC, contapezzi));
- }
- // verifico se variato contapezzi... e se passato ritardo minimo...
- if (lastCountCNC > contapezzi)
- {
- // salvo nuovo contapezzi (incremento di 1...)
- contapezzi++;
- // salvo in semaforo!
- B_input += (1 << 2);
- // registro contapezzi
- lgInfo(string.Format("Contapezzi KAWASAKI: {0} | Contapezzi interno {1}", lastCountCNC, contapezzi));
- }
-
- // invio a server contapezzi (aggiornato)
- string retVal = utils.callUrl(urlSetPzCount + contapezzi.ToString());
- // verifica se tutto OK
- if (retVal != "OK")
- {
- // errore salvataggio contapezzi
- lgInfo(string.Format("Errore salvataggio Contapezzi KAWASAKI {0} | Contapezzi interno {1} | Errore salvataggio: {2}", lastCountCNC, contapezzi, retVal));
- }
- // resetto timer...
- lastPzCountSend = DateTime.Now;
- }
- }
- else
- {
- if (DateTime.Now >= lastPzCountSend.AddMilliseconds(pzCountDelay))
- {
- lgInfo(string.Format("Attenzione: mancanza ODL non procedo con gestione contapezzi. Contapezzi KAWASAKI {0} | Contapezzi interno {1}", lastCountCNC, contapezzi));
- // resetto timer...
- lastPzCountSend = DateTime.Now;
- }
- }
-
- // log opzionale!
- if (verboseLog)
- {
- lgInfo(string.Format("Trasformazione B_input: {0}", B_input));
- }
- }
-
- ///
- /// Decodifica il resto dell'area x i dati accessori (allarmi, ...)
- ///
- private void decodeOtherData()
- {
- if (verboseLog)
- {
-
- }
- }
-
- ///
- /// Recupero programma in lavorazione
- ///
- ///
- public override string getPrgName()
- {
- // valore non presente in vers default... se gestito fare override
- string prgName = "";
- return prgName;
- }
- ///
- /// Recupero info sistema generiche
- ///
- public override Dictionary getSysInfo()
- {
- // valore non presente in vers default... se gestito fare override
- Dictionary outVal = new Dictionary();
- outVal.Add("MACHINE", machineName);
- return outVal;
- }
- ///
- /// Recupero dati dinamici...
- ///
- public override Dictionary getDynData()
- {
- // valore non presente in vers default... se gestito fare override
- Dictionary outVal = new Dictionary();
- outVal.Add("LAST_MISS", lastMissRobot);
- outVal.Add("LAST_TC", lastTC.ToString());
- outVal.Add("NUM_PZ_PREL", pzPrelevati.ToString());
- outVal.Add("NUM_PZ_LAV", pzCounter.ToString());
- outVal.Add("CURR_SIGNALS", currBitmapSignals.ToString());
- return outVal;
- }
-
- #endregion
-#endif
}
}
diff --git a/Jenkinsfile b/Jenkinsfile
index 73c0ff6f..67255e19 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -16,7 +16,7 @@ pipeline {
/* calcolo numero versione... diverso x branch MASTER/DEVELOP */
script {
- withEnv(['NEXT_BUILD_NUMBER=384']) {
+ withEnv(['NEXT_BUILD_NUMBER=385']) {
// env.versionNumber = VersionNumber(versionNumberString : '2.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true)
env.versionNumber = VersionNumber(versionNumberString : '2.3.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}')
env.APP_NAME = 'MAPO-IOB-WIN'