Fix gestione Citizen: riesce a partire!

This commit is contained in:
Samuele Locatelli
2024-11-12 10:57:44 +01:00
parent 8963b9e561
commit d016f07937
6 changed files with 144 additions and 49 deletions
-44
View File
@@ -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]]",
+129
View File
@@ -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
}
}
}
+1
View File
@@ -528,6 +528,7 @@
<None Include="DATA\CONF\FOV098.ini" />
<None Include="DATA\CONF\FOV099.ini" />
<None Include="DATA\CONF\L019.ini" />
<None Include="DATA\CONF\L020_Rest.wrong.json" />
<None Include="DATA\CONF\L020_Rest.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
+3 -3
View File
@@ -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...
+8 -2
View File
@@ -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
/// <returns></returns>
private string TestCitizenCall(string urlReq)
{
lgInfo($"TestCitizenCall: {urlReq}");
string answ = ExecuteCallGet(urlReq);
lgInfo($"Call: {urlReq} | resp: {answ}");
lgInfo($"TestCitizenCall resp: {answ}");
return answ;
}
+3
View File
@@ -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