fix gestione null x ricette legacy

This commit is contained in:
Samuele E. Locatelli
2020-10-27 16:16:36 +01:00
parent 0392251697
commit eb8cb57ae2
@@ -747,7 +747,26 @@ namespace Thermo.Active.Controllers.WebApi
return checkError;
}
// reset ActTemp
Dictionary<int, bool> resetTCamEnab = new Dictionary<int, bool>();
Dictionary<int, double> resetTCamTemp = new Dictionary<int, double>();
foreach (var item in NcAdapter.RecipeLiveData.ChannelSetpoints)
{
resetTCamEnab.Add(item.Key, false);
resetTCamTemp.Add(item.Key, 0);
}
checkError = ncAdapter.WriteRecipeWarmChTCamTempAct(resetTCamTemp);
if (checkError.IsError())
{
ThermoActiveLogger.LogError($"WriteCurrentRecipeToPlc | WriteRecipeWarmChTCamTempAct error | {checkError.exception}");
return checkError;
}
// write to PLC TempRif (°C)
if (NcAdapter.RecipeLiveData.ChannelTCamTempReq == null)
{
NcAdapter.RecipeLiveData.ChannelTCamTempReq = resetTCamTemp;
}
checkError = ncAdapter.WriteRecipeWarmChTCamTempSet(NcAdapter.RecipeLiveData.ChannelTCamTempReq);
if (checkError.IsError())
{
@@ -756,6 +775,10 @@ namespace Thermo.Active.Controllers.WebApi
}
// write to PLC TCamChEnab
if (NcAdapter.RecipeLiveData.ChannelTCamEnab == null)
{
NcAdapter.RecipeLiveData.ChannelTCamEnab = resetTCamEnab;
}
checkError = ncAdapter.WriteRecipeWarmChTCamEnab(NcAdapter.RecipeLiveData.ChannelTCamEnab);
if (checkError.IsError())
{
@@ -763,18 +786,6 @@ namespace Thermo.Active.Controllers.WebApi
return checkError;
}
// reset ActTemp
Dictionary<int, double> resetTCamTemp = new Dictionary<int, double>();
foreach (var item in NcAdapter.RecipeLiveData.ChannelTCamEnab)
{
resetTCamTemp.Add(item.Key, 0);
}
checkError = ncAdapter.WriteRecipeWarmChTCamTempAct(resetTCamTemp);
if (checkError.IsError())
{
ThermoActiveLogger.LogError($"WriteCurrentRecipeToPlc | WriteRecipeWarmChTCamTempAct error | {checkError.exception}");
return checkError;
}