diff --git a/IOB-WIN-NEXT/DATA/CONF/L020_Rest.json b/IOB-WIN-NEXT/DATA/CONF/L020_Rest.json index 286fe115..462e916c 100644 --- a/IOB-WIN-NEXT/DATA/CONF/L020_Rest.json +++ b/IOB-WIN-NEXT/DATA/CONF/L020_Rest.json @@ -2,18 +2,6 @@ "timeOutSec": 60, "apiUrl": "http://192.168.80.61:8733/DRIVER_MES/rest/", "mMapRead": { - //"GetQtyTot": { - // "name": "GetQtyTot", - // "description": "Contatore GTot", - // //"memAddr": "", - // "tipoMem": "Int", - // //"index": 0, - // //"size": 4, - // "func": "LAST", - // //"period": 60, - // "factor": 1, - // "displOrdinal": 1 - //} }, "mMapWrite": { }, @@ -54,38 +42,6 @@ "ListPrevCall": [ "GetToken" ], "SamplePeriod": 1000 }, - //"GetStateAlarm": { - // "Method": "Get", - // "Url": "getsingleladderio/[[token]]/Y/200", - // "Name": "Macchina in Allarme", - // "OutVarName": "AlarmState", - // "ListPrevCall": [ "GetToken" ], - // "SamplePeriod": 2000 - //}, - //"GetStateCaution": { - // "Method": "Get", - // "Url": "getsingleladderio/[[token]]/Y/201", - // "Name": "Macchina in Caution", - // "OutVarName": "CautionState", - // "ListPrevCall": [ "GetToken" ], - // "SamplePeriod": 2000 - //}, - //"GetStateStart": { - // "Method": "Get", - // "Url": "getsingleladderio/[[token]]/Y/222", - // "Name": "Macchina in Start", - // "OutVarName": "StartState", - // "ListPrevCall": [ "GetToken" ], - // "SamplePeriod": 2000 - //}, - //"GetStateStop": { - // "Method": "Get", - // "Url": "getsingleladderio/[[token]]/Y/223", - // "Name": "Macchina in Stop", - // "OutVarName": "StopState", - // "ListPrevCall": [ "GetToken" ], - // "SamplePeriod": 2000 - //}, "GetQtyTot": { "Method": "Get", "Url": "gettotalquantity/[[token]]", diff --git a/IOB-WIN-NEXT/DATA/CONF/L020_Rest.wrong.json b/IOB-WIN-NEXT/DATA/CONF/L020_Rest.wrong.json new file mode 100644 index 00000000..7d130a3b --- /dev/null +++ b/IOB-WIN-NEXT/DATA/CONF/L020_Rest.wrong.json @@ -0,0 +1,129 @@ +{ + "timeOutSec": 60, + "apiUrl": "http://192.168.80.61:8733/DRIVER_MES/rest/", + "mMapRead": { + }, + "mMapWrite": { + }, + "CallList": { + "GetConnection": { + "Method": "Get", + "Url": "checkconnection", + "Name": "Connection", + "OutVarName": "Connected" + }, + "GetToken": { + "Method": "Get", + "Url": "gettoken/mecmaticames/mecmatica@mes", + "OutVarName": "token", + "SamplePeriod": 1000 + }, + "GetLampGreen": { + "Method": "Get", + "Url": "getsingleladderio/[[token]]/Y/8E", + "Name": "Lampada Verde", + "OutVarName": "LampGreen", + "ListPrevCall": [ "GetToken" ], + "SamplePeriod": 1000 + }, + "GetLampYellow": { + "Method": "Get", + "Url": "getsingleladderio/[[token]]/Y/21", + "Name": "Lampada Gialla", + "OutVarName": "LampYellow", + "ListPrevCall": [ "GetToken" ], + "SamplePeriod": 1000 + }, + "GetLampRed": { + "Method": "Get", + "Url": "getsingleladderio/[[token]]/Y/22", + "Name": "Lampada Rossa", + "OutVarName": "LampRed", + "ListPrevCall": [ "GetToken" ], + "SamplePeriod": 1000 + }, + //"GetStateAlarm": { + // "Method": "Get", + // "Url": "getsingleladderio/[[token]]/Y/200", + // "Name": "Macchina in Allarme", + // "OutVarName": "AlarmState", + // "ListPrevCall": [ "GetToken" ], + // "SamplePeriod": 2000 + //}, + //"GetStateCaution": { + // "Method": "Get", + // "Url": "getsingleladderio/[[token]]/Y/201", + // "Name": "Macchina in Caution", + // "OutVarName": "CautionState", + // "ListPrevCall": [ "GetToken" ], + // "SamplePeriod": 2000 + //}, + //"GetStateStart": { + // "Method": "Get", + // "Url": "getsingleladderio/[[token]]/Y/222", + // "Name": "Macchina in Start", + // "OutVarName": "StartState", + // "ListPrevCall": [ "GetToken" ], + // "SamplePeriod": 2000 + //}, + //"GetStateStop": { + // "Method": "Get", + // "Url": "getsingleladderio/[[token]]/Y/223", + // "Name": "Macchina in Stop", + // "OutVarName": "StopState", + // "ListPrevCall": [ "GetToken" ], + // "SamplePeriod": 2000 + //}, + "GetQtyTot": { + "Method": "Get", + "Url": "gettotalquantity/[[token]]", + "Name": "Contapezzi Assoluto", + "OutVarName": "ContapezziAssoluto", + "ListPrevCall": [ "GetToken" ] + }, + "GetQtyReq": { + "Method": "Get", + "Url": "getneededquantity/[[token]]", + "Name": "Qta Richiesta", + "OutVarName": "setPzComm", + "ListPrevCall": [ "GetToken" ] + }, + "GetQtyProd": { + "Method": "Get", + "Url": "getworkedquantity/[[token]]", + "Name": "Contapezzi Parziale", + "OutVarName": "ContapezziParziale", + "ListPrevCall": [ "GetToken" ] + }, + "GetCycleTime": { + "Method": "Get", + "Url": "getcycletime/[[token]]", + "Name": "tempoCiclo (sec)", + "OutVarName": "LastTC", + "ListPrevCall": [ "GetToken" ] + }, + "GetProgName": { + "Method": "Get", + "Url": "getmainprogram/[[token]]", + "Name": "Programma MAIN", + "OutVarName": "PROG", + "ListPrevCall": [ "GetToken" ] + }, + "GetCurrAlarm": { + "Method": "Get", + "Url": "getalarm/[[token]]", + "Name": "Allarme attivo", + "OutVarName": "AlarmActive", + "ListPrevCall": [ "GetToken" ], + "SamplePeriod": 2000 + }, + "GetAllAlarmLog": { + "Method": "Get", + "Url": "getallalarmlog/[[token]]", + "Name": "Log Allarmi (last)", + "OutVarName": "", + "ListPrevCall": [ "GetToken" ], + "SamplePeriod": 20000 + } + } +} \ No newline at end of file diff --git a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj index f2ee6630..ac78c3ca 100644 --- a/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj +++ b/IOB-WIN-NEXT/IOB-WIN-NEXT.csproj @@ -528,6 +528,7 @@ + PreserveNewest diff --git a/IOB-WIN-NEXT/IobRest/Base.cs b/IOB-WIN-NEXT/IobRest/Base.cs index a72b6105..20488e79 100644 --- a/IOB-WIN-NEXT/IobRest/Base.cs +++ b/IOB-WIN-NEXT/IobRest/Base.cs @@ -33,9 +33,9 @@ namespace IOB_WIN_NEXT.IobRest lgInfo($"Richiesto Adapter IobRest.Base con i parametri seguenti | ADDR: {IOBConf.cncIpAddr} | PORT: {IOBConf.cncPort}"); lastPING = DateTime.Now.AddHours(-1); // predispongo configurazione specifica Rest... - if (!string.IsNullOrEmpty(getOptJsonKVP("REST_CONF"))) + if (!string.IsNullOrEmpty(getOptPar("REST_CONF"))) { - setupRestConf(getOptJsonKVP("REST_CONF")); + setupRestConf(getOptPar("REST_CONF")); } } @@ -537,7 +537,7 @@ namespace IOB_WIN_NEXT.IobRest protected void setupRestConf(string restConfFile) { // se ho file specifico - if (!string.IsNullOrEmpty(getOptJsonKVP("REST_CONF"))) + if (!string.IsNullOrEmpty(getOptPar("REST_CONF"))) { string rawData = ""; // leggo file e decodifico... diff --git a/IOB-WIN-NEXT/IobRest/Citizen.cs b/IOB-WIN-NEXT/IobRest/Citizen.cs index 6d2dc8e4..45f78ca7 100644 --- a/IOB-WIN-NEXT/IobRest/Citizen.cs +++ b/IOB-WIN-NEXT/IobRest/Citizen.cs @@ -32,13 +32,16 @@ namespace IOB_WIN_NEXT.IobRest redKeyAlarm = redisMan.redHash($"IOB:Status:{cIobConf.codIOB}:Alarm:LastRead"); lastPING = DateTime.Now.AddHours(-1); // predispongo configurazione specifica Rest... + lgInfo("Rest - 01"); if (!string.IsNullOrEmpty(getOptPar("REST_CONF"))) { setupRestConf(getOptPar("REST_CONF")); } + lgInfo("Rest - 02"); // fixme todo levare forzatura test iniziale... - if (EnableTest || true) + if (EnableTest) { + lgInfo("Rest - 03"); // test folder salvataggio log var appPath = System.Reflection.Assembly.GetExecutingAssembly().Location; var fPath = Directory.GetParent(appPath).FullName; @@ -47,8 +50,10 @@ namespace IOB_WIN_NEXT.IobRest { Directory.CreateDirectory(basePath); } + lgInfo("Rest - 04"); string token = TestCitizenCall("gettoken/mecmaticames/mecmatica@mes"); + token = token.Replace("\"", ""); string gLamp = TestCitizenCall($"getsingleladderio/{token}/Y/8E"); string yLamp = TestCitizenCall($"getsingleladderio/{token}/Y/21"); string rLamp = TestCitizenCall($"getsingleladderio/{token}/Y/22"); @@ -545,8 +550,9 @@ namespace IOB_WIN_NEXT.IobRest /// private string TestCitizenCall(string urlReq) { + lgInfo($"TestCitizenCall: {urlReq}"); string answ = ExecuteCallGet(urlReq); - lgInfo($"Call: {urlReq} | resp: {answ}"); + lgInfo($"TestCitizenCall resp: {answ}"); return answ; } diff --git a/IOB-WIN-NEXT/postBuildTgt.bat b/IOB-WIN-NEXT/postBuildTgt.bat index 65df715e..b3f3386d 100644 --- a/IOB-WIN-NEXT/postBuildTgt.bat +++ b/IOB-WIN-NEXT/postBuildTgt.bat @@ -69,6 +69,9 @@ REM ROBOCOPY . \\192.168.0.12\Steamware\IOB-WIN-NEXT-DEB /MIR REM IOB-WIN-SIM REM ROBOCOPY . \\IOB-WIN-SIMULA\Steamware\IOB-WIN-NEXT-DEB /MIR +REM IOBVPN4MACHINE +ROBOCOPY . \\10.51.90.5\Steamware\IOB-WIN-NEXT-DEB /MIR + goto END :END