diff --git a/Thermo.Active.Core/ThreadsFunctions.cs b/Thermo.Active.Core/ThreadsFunctions.cs index a4fea7f6..55299fba 100644 --- a/Thermo.Active.Core/ThreadsFunctions.cs +++ b/Thermo.Active.Core/ThreadsFunctions.cs @@ -1119,9 +1119,9 @@ public static class ThreadsFunctions ICollection cultureInfos = new List(); // Get nc available language - CmsError cmsError = ncAdapter.numericalControl.NC_GetAvailableLanguages(ref cultureInfos); - if (cmsError.IsError()) - ManageLibraryError(cmsError); + CmsError libraryError = ncAdapter.numericalControl.NC_GetAvailableLanguages(ref cultureInfos); + if (libraryError.IsError()) + ManageLibraryError(libraryError); // Filter available language with availableLanguages = availableLanguages.Where(x => cultureInfos.Any(y => y.TwoLetterISOLanguageName == x.IsoId)).ToList(); @@ -1180,15 +1180,15 @@ public static class ThreadsFunctions ThreadsHandler.Stop(); StatReset(); NcAdapter ncAdapter = new NcAdapter(); - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; // Run loop until NC is connected while (!ncAdapter.numericalControl.NC_IsConnected()) { // Try reconnection - cmsError = ncAdapter.Connect(); - if (cmsError.errorCode == CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND || cmsError.errorCode == CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING || cmsError.errorCode == CMS_ERROR_CODES.OSAI_TT_FOLDER_NOT_FOUND) - ManageLibraryError(cmsError); - else if (cmsError.errorCode != CMS_ERROR_CODES.OK) + libraryError = ncAdapter.Connect(); + if (libraryError.errorCode == CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND || libraryError.errorCode == CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING || libraryError.errorCode == CMS_ERROR_CODES.OSAI_TT_FOLDER_NOT_FOUND) + ManageLibraryError(libraryError); + else if (libraryError.errorCode != CMS_ERROR_CODES.OK) { ncAdapter.Dispose(); } @@ -1199,7 +1199,7 @@ public static class ThreadsFunctions Thread.Sleep(1000); } - if (!cmsError.IsError()) + if (!libraryError.IsError()) { if (ServerStartupConfig.AutoOpenCmsClient) StartCMSClient(); @@ -1231,12 +1231,12 @@ public static class ThreadsFunctions ConnThread.Abort(); } - public static void ManageLibraryError(CmsError cmsError) + public static void ManageLibraryError(CmsError libraryError) { - switch (cmsError.errorCode) + switch (libraryError.errorCode) { case CMS_ERROR_CODES.NC_PROD_ERROR: - ManageError(ERROR_LEVEL.WARNING, cmsError.localizationKey); + ManageError(ERROR_LEVEL.WARNING, libraryError.localizationKey); break; case CMS_ERROR_CODES.NOT_CONNECTED: @@ -1246,7 +1246,7 @@ public static class ThreadsFunctions case CMS_ERROR_CODES.SIEMENS_ENVIRONMENT_NOT_FOUND: case CMS_ERROR_CODES.OSAI_TT_FOLDER_NOT_FOUND: case CMS_ERROR_CODES.OPTION_NOT_CONSISTENT: - ManageError(ERROR_LEVEL.FATAL, cmsError.localizationKey); + ManageError(ERROR_LEVEL.FATAL, libraryError.localizationKey); break; case CMS_ERROR_CODES.SIEMENS_HMI_NOT_RUNNING: @@ -1254,11 +1254,11 @@ public static class ThreadsFunctions break; case CMS_ERROR_CODES.SELECTED_PROCESS: - ManageError(ERROR_LEVEL.WARNING, cmsError.localizationKey); + ManageError(ERROR_LEVEL.WARNING, libraryError.localizationKey); break; case CMS_ERROR_CODES.INTERNAL_ERROR: - ManageException(ERROR_LEVEL.FATAL, cmsError.exception); + ManageException(ERROR_LEVEL.FATAL, libraryError.exception); break; } } diff --git a/Thermo.Active.NC/NcAdapter.cs b/Thermo.Active.NC/NcAdapter.cs index 93730913..067d68e6 100644 --- a/Thermo.Active.NC/NcAdapter.cs +++ b/Thermo.Active.NC/NcAdapter.cs @@ -170,21 +170,21 @@ namespace Thermo.Active.NC // Get NC max process number ushort maxProcNumber = 0; - CmsError cmsError = numericalControl.NC_RProcessesNum(ref maxProcNumber); - if (cmsError.errorCode != 0) - return cmsError; + CmsError libraryError = numericalControl.NC_RProcessesNum(ref maxProcNumber); + if (libraryError.errorCode != 0) + return libraryError; // For each process for (ushort i = 1; i <= maxProcNumber; i++) { - cmsError = GetAxesPositionsByProcess(i, out DTOAxesModel axis); - if (cmsError.errorCode != 0) - return cmsError; + libraryError = GetAxesPositionsByProcess(i, out DTOAxesModel axis); + if (libraryError.errorCode != 0) + return libraryError; axes.Add(axis); } - return cmsError; + return libraryError; } public CmsError GetAxesPositionsBySelectedProcess(out DTOAxesModel axes) @@ -193,39 +193,39 @@ namespace Thermo.Active.NC // Get selectedProcess process number ushort selectedProcess = 0; - CmsError cmsError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); + if (libraryError.IsError()) + return libraryError; if (selectedProcess > 0) - cmsError = GetAxesPositionsByProcess(selectedProcess, out axes); + libraryError = GetAxesPositionsByProcess(selectedProcess, out axes); - return cmsError; + return libraryError; } public CmsError GetAxesPositionsByProcess(ushort processNum, out DTOAxesModel axes) { axes = new DTOAxesModel(); - CmsError cmsError = numericalControl.AXES_RInterpPosition(processNum, ref axes.interpolated); - if (cmsError.errorCode != 0) - return cmsError; + CmsError libraryError = numericalControl.AXES_RInterpPosition(processNum, ref axes.interpolated); + if (libraryError.errorCode != 0) + return libraryError; - cmsError = numericalControl.AXES_RMachinePosition(processNum, ref axes.machine); - if (cmsError.errorCode != 0) - return cmsError; + libraryError = numericalControl.AXES_RMachinePosition(processNum, ref axes.machine); + if (libraryError.errorCode != 0) + return libraryError; - cmsError = numericalControl.AXES_RProgrPosition(processNum, ref axes.programmePos); - if (cmsError.errorCode != 0) - return cmsError; + libraryError = numericalControl.AXES_RProgrPosition(processNum, ref axes.programmePos); + if (libraryError.errorCode != 0) + return libraryError; - cmsError = numericalControl.AXES_RDistanceToGo(processNum, ref axes.toGo); - if (cmsError.errorCode != 0) - return cmsError; + libraryError = numericalControl.AXES_RDistanceToGo(processNum, ref axes.toGo); + if (libraryError.errorCode != 0) + return libraryError; //numericalControl.AXES_RFollowingError(1, ref axes.followingErr); - return cmsError; + return libraryError; } public CmsError ReadAxisData(out List axesNames) @@ -234,14 +234,14 @@ namespace Thermo.Active.NC List plcAxes = new List(); // Read selected process ushort selectedProcess = 0; - CmsError cmsError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); + if (libraryError.IsError()) + return libraryError; if (selectedProcess != 0) { // Read axes names - cmsError = numericalControl.AXES_RAxesNames(selectedProcess, ref plcAxes); + libraryError = numericalControl.AXES_RAxesNames(selectedProcess, ref plcAxes); axesNames = plcAxes.Select(x => new DTOAxisNameModel() { @@ -252,7 +252,7 @@ namespace Thermo.Active.NC }).ToList(); } - return cmsError; + return libraryError; } #endregion Axes @@ -264,19 +264,19 @@ namespace Thermo.Active.NC public CmsError ManageStatusCommand() { - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; // recupero i dati //statusCmd = new List(); - cmsError = numericalControl.PLC_RStatusCommand(ref statusCmd); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RStatusCommand(ref statusCmd); + if (libraryError.IsError()) + return libraryError; // restituisco errore - return cmsError; + return libraryError; } public CmsError ManageConfRequest() { - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; if (RecipeLiveData != null) { // controllo SE HO richieste di configurazione @@ -287,7 +287,7 @@ namespace Thermo.Active.NC // se si in questo caso scrivo configurazione... WriteRecipeWarmConfig(); // Ack ! - cmsError = numericalControl.PLC_WAckConfRiskRequest(); + libraryError = numericalControl.PLC_WAckConfRiskRequest(); } } if (ThermoReqConfRecipeStr) @@ -295,9 +295,9 @@ namespace Thermo.Active.NC if (RecipeLiveData.RecipeParameters != null) { // copy data to PLC - cmsError = ReadFullRecipe(out Dictionary prevRecipe); - if (cmsError.IsError()) - return cmsError; + libraryError = ReadFullRecipe(out Dictionary prevRecipe); + if (libraryError.IsError()) + return libraryError; // save parameters to PLC!!! Dictionary updtRecipe = new Dictionary(); foreach (var item in RecipeLiveData.RecipeParameters) @@ -318,33 +318,33 @@ namespace Thermo.Active.NC // se si in questo caso scrivo configurazione attuale... WriteRecipeParams(updtRecipe); // Ack ! - cmsError = numericalControl.PLC_WAckConfRecipeRequest(); + libraryError = numericalControl.PLC_WAckConfRecipeRequest(); } } } - return cmsError; + return libraryError; } public CmsError ManageProdUpdate() { - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; // controllo SE HO segnalazioni produzione if (ThermoProdUpdatedStr) { // se si in questo caso leggo il record produzione... - cmsError = ReadProdInfoData(out ThermoModels.ProdInfoModel prodInfoData); - if (cmsError.IsError()) - return cmsError; + libraryError = ReadProdInfoData(out ThermoModels.ProdInfoModel prodInfoData); + if (libraryError.IsError()) + return libraryError; // do il bit di ack - cmsError = numericalControl.PLC_WAckProdUpdate(); + libraryError = numericalControl.PLC_WAckProdUpdate(); } else { // se รจ zero e il mio ack fosse 1 --> resetto il mio! } - return cmsError; + return libraryError; } @@ -355,54 +355,54 @@ namespace Thermo.Active.NC // Get date time DateTime dateTime = new DateTime(); - CmsError cmsError = numericalControl.NC_RDateTime(ref dateTime); - if (cmsError.errorCode != 0) - return cmsError; + CmsError libraryError = numericalControl.NC_RDateTime(ref dateTime); + if (libraryError.errorCode != 0) + return libraryError; genericData.DateTime = dateTime; // Get language CultureInfo lang = new CultureInfo("en"); - cmsError = numericalControl.NC_RLanguage(ref lang); - if (cmsError.errorCode != 0) - return cmsError; + libraryError = numericalControl.NC_RLanguage(ref lang); + if (libraryError.errorCode != 0) + return libraryError; genericData.Language = lang.TwoLetterISOLanguageName; string tmpInfo = ""; // Get serial number - cmsError = numericalControl.NC_RSerialNumber(ref tmpInfo); - if (cmsError.errorCode != 0) - return cmsError; + libraryError = numericalControl.NC_RSerialNumber(ref tmpInfo); + if (libraryError.errorCode != 0) + return libraryError; genericData.SerialNumber = tmpInfo; // Get software version - cmsError = numericalControl.NC_RSoftwareVersion(ref tmpInfo); - if (cmsError.errorCode != 0) - return cmsError; + libraryError = numericalControl.NC_RSoftwareVersion(ref tmpInfo); + if (libraryError.errorCode != 0) + return libraryError; genericData.NcSoftwareVersion = tmpInfo; // Get model name - cmsError = numericalControl.NC_RModelName(ref tmpInfo); - if (cmsError.errorCode != 0) - return cmsError; + libraryError = numericalControl.NC_RModelName(ref tmpInfo); + if (libraryError.errorCode != 0) + return libraryError; genericData.NcModel = tmpInfo; // Get machine number - cmsError = numericalControl.NC_RMachineNumber(NcConfig.MachineNumberHasLetters, ref tmpInfo); - if (cmsError.errorCode != 0) - return cmsError; + libraryError = numericalControl.NC_RMachineNumber(NcConfig.MachineNumberHasLetters, ref tmpInfo); + if (libraryError.errorCode != 0) + return libraryError; genericData.CmsMachineIdNumber = tmpInfo; // Get max process number ushort procNum = 0; - cmsError = numericalControl.NC_RProcessesNum(ref procNum); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.NC_RProcessesNum(ref procNum); + if (libraryError.IsError()) + return libraryError; // Max process number genericData.ProcessNumber = procNum; // Get Installation Date @@ -410,15 +410,15 @@ namespace Thermo.Active.NC // Get PLC version genericData.PlcVersion = "1.0.0"; // Get PLC version - cmsError = numericalControl.NC_RUnitOfMeasure(ref tmpInfo); - if (cmsError.errorCode != 0) - return cmsError; + libraryError = numericalControl.NC_RUnitOfMeasure(ref tmpInfo); + if (libraryError.errorCode != 0) + return libraryError; genericData.UnitOfMeasurement = tmpInfo; // Get Server version genericData.ServerVersion = SupportFunctions.GetSoftwareVersionAndBuildDate(); - return cmsError; + return libraryError; } public CmsError GetNcAlarms(out DTOAlarmsModel alarms) @@ -427,9 +427,9 @@ namespace Thermo.Active.NC List tmpAlarms = new List(); // Read NC active alarms - CmsError cmsError = numericalControl.NC_RActiveAlarms(ref tmpAlarms); - if (cmsError.errorCode != 0) - return cmsError; + CmsError libraryError = numericalControl.NC_RActiveAlarms(ref tmpAlarms); + if (libraryError.errorCode != 0) + return libraryError; // Create response list from NC data foreach (AlarmModel ncAlarm in tmpAlarms) @@ -447,9 +447,9 @@ namespace Thermo.Active.NC // Get NC max process number ushort maxProcNumber = 0; - cmsError = numericalControl.NC_RProcessesNum(ref maxProcNumber); - if (cmsError.errorCode != 0) - return cmsError; + libraryError = numericalControl.NC_RProcessesNum(ref maxProcNumber); + if (libraryError.errorCode != 0) + return libraryError; // For each process for (ushort i = 1; i <= maxProcNumber; i++) @@ -472,9 +472,9 @@ namespace Thermo.Active.NC List plcAlarms = new List(); // Read PLC Active Messages - cmsError = numericalControl.PLC_RActiveMessages(ref plcAlarms); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RActiveMessages(ref plcAlarms); + if (libraryError.IsError()) + return libraryError; bool restorationIsEnabled = false; foreach (PlcAlarmModel plcAlarm in plcAlarms) @@ -496,10 +496,10 @@ namespace Thermo.Active.NC RestorationIsEnabled = restorationIsEnabled }); } - if (cmsError.errorCode != 0) - return cmsError; + if (libraryError.errorCode != 0) + return libraryError; - return cmsError; + return libraryError; } public CmsError GetPowerOnData(out DTOPowerOnDataModel resultPowerOnData) @@ -514,18 +514,18 @@ namespace Thermo.Active.NC }; // Read pre and post power on data - CmsError cmsError = numericalControl.PLC_RPowerOnData(ref prePostPowerOn); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PLC_RPowerOnData(ref prePostPowerOn); + if (libraryError.IsError()) + return libraryError; // Set return object resultPowerOnData.PrePowerOn = prePostPowerOn.PrePowerOn; resultPowerOnData.PostPowerOn = prePostPowerOn.PostPowerOn; // Read axes procedure data from - cmsError = numericalControl.PLC_RAxesResetData(ref resultPowerOnData.AxisReset); + libraryError = numericalControl.PLC_RAxesResetData(ref resultPowerOnData.AxisReset); - return cmsError; + return libraryError; } public CmsError GetProcessesData(out DTOProcessesDataModel processesData) @@ -534,9 +534,9 @@ namespace Thermo.Active.NC // Get NC max process number ushort maxProcNumber = 0; - CmsError cmsError = numericalControl.NC_RProcessesNum(ref maxProcNumber); - if (cmsError.errorCode != 0) - return cmsError; + CmsError libraryError = numericalControl.NC_RProcessesNum(ref maxProcNumber); + if (libraryError.errorCode != 0) + return libraryError; PROC_STATUS status = PROC_STATUS.IDLE; // For each process get info @@ -544,9 +544,9 @@ namespace Thermo.Active.NC { ProcessDataModel tmpProcPP = new ProcessDataModel(); // Get process status - cmsError = numericalControl.PROC_RStatusAndData(i, ref tmpProcPP); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PROC_RStatusAndData(i, ref tmpProcPP); + if (libraryError.IsError()) + return libraryError; // if at least one process is in run, NC is running // Add to list @@ -572,7 +572,7 @@ namespace Thermo.Active.NC if (!processesData.IsRunning) { // Get process status - cmsError = numericalControl.PROC_RStatus(i, ref status); + libraryError = numericalControl.PROC_RStatus(i, ref status); if (status == PROC_STATUS.RUN || status == PROC_STATUS.HOLD) processesData.IsRunning = true; else @@ -581,27 +581,27 @@ namespace Thermo.Active.NC } // Read selected axes - cmsError = numericalControl.AXES_RSelectedAxis(ref processesData.SelectedAxis); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.AXES_RSelectedAxis(ref processesData.SelectedAxis); + if (libraryError.IsError()) + return libraryError; QueueStatusModel queueStatus = new QueueStatusModel(); // Get queue data - cmsError = numericalControl.FILES_RQueueDataByProcess(ref queueStatus, processesData.SelectedProcess); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.FILES_RQueueDataByProcess(ref queueStatus, processesData.SelectedProcess); + if (libraryError.IsError()) + return libraryError; // Get selectedProcessData SelectedProcessData selectedData = new SelectedProcessData(); - cmsError = numericalControl.PROC_RSelectedProcessData(processesData.SelectedProcess, ref selectedData); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PROC_RSelectedProcessData(processesData.SelectedProcess, ref selectedData); + if (libraryError.IsError()) + return libraryError; String UMeas = "mm"; // Get process status - cmsError = numericalControl.NC_RUnitOfMeasure(ref UMeas); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.NC_RUnitOfMeasure(ref UMeas); + if (libraryError.IsError()) + return libraryError; // Set data processesData.QueueStatus = queueStatus.Status; @@ -623,7 +623,7 @@ namespace Thermo.Active.NC processesData.FeedOverride = selectedData.FeedOverride; - return cmsError; + return libraryError; } public CmsError GetFunctionsMappedWithNC(out List functionsAccessList) @@ -631,11 +631,11 @@ namespace Thermo.Active.NC functionsAccessList = new List(); // Read plc functionality List functionalityList = null; - CmsError cmsError = numericalControl.PLC_RFunctionAccess(ref functionalityList); + CmsError libraryError = numericalControl.PLC_RFunctionAccess(ref functionalityList); // If empty return if (functionalityList == null || functionalityList.Count == 0) - return cmsError; + return libraryError; using (FunctionsAccessController functionsAccessController = new FunctionsAccessController()) { @@ -643,7 +643,7 @@ namespace Thermo.Active.NC functionsAccessList = functionsAccessController.GetFunctionsMappedWithPlc(functionalityList); } - return cmsError; + return libraryError; } public CmsError GetMainenancesCounter(out List counters) @@ -651,22 +651,22 @@ namespace Thermo.Active.NC // List of PLC counters counters = new List(); // Get counters values from PLC - CmsError cmsError = numericalControl.PLC_RMachineCounters(ref counters); + CmsError libraryError = numericalControl.PLC_RMachineCounters(ref counters); - return cmsError; + return libraryError; } public CmsError GetMaintenanceDataById(int maintenanceId, int userId, out DTOMaintenanceModel dTOMaintenance) { dTOMaintenance = null; - CmsError cmsError = GetMaintenancesWithPermissions(out List maintenance, userId); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = GetMaintenancesWithPermissions(out List maintenance, userId); + if (libraryError.IsError()) + return libraryError; dTOMaintenance = maintenance.Where(x => x.Id == maintenanceId).FirstOrDefault(); - return cmsError; + return libraryError; } public CmsError GetMaintenancesWithPermissions(out List dtoMaintenancesModel, int userId) @@ -675,9 +675,9 @@ namespace Thermo.Active.NC dtoMaintenancesModel = new List(); // Get counters values from PLC - CmsError cmsError = GetMainenancesCounter(out List counters); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = GetMainenancesCounter(out List counters); + if (libraryError.IsError()) + return libraryError; using (MaintenancesController maintenancesController = new MaintenancesController()) { @@ -804,7 +804,7 @@ namespace Thermo.Active.NC } } - return cmsError; + return libraryError; } public CmsError GetExpiredMaintenances(out List expiredMaintenance) @@ -813,9 +813,9 @@ namespace Thermo.Active.NC expiredMaintenance = new List(); // Get counters values from PLC - CmsError cmsError = GetMainenancesCounter(out List counters); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = GetMainenancesCounter(out List counters); + if (libraryError.IsError()) + return libraryError; using (MaintenancesController maintenancesController = new MaintenancesController()) { @@ -926,7 +926,7 @@ namespace Thermo.Active.NC } } - return cmsError; + return libraryError; } public CmsError GetUserSoftKeys(out List softKeys) @@ -935,9 +935,9 @@ namespace Thermo.Active.NC List plcSoftKeys = new List(); // Get softkeys data from PLC - CmsError cmsError = numericalControl.PLC_RUserSoftKeys(ref plcSoftKeys); - if (cmsError.IsError() || plcSoftKeys.Count == 0) - return cmsError; + CmsError libraryError = numericalControl.PLC_RUserSoftKeys(ref plcSoftKeys); + if (libraryError.IsError() || plcSoftKeys.Count == 0) + return libraryError; foreach (var softKey in SoftKeysConfig) { @@ -981,7 +981,7 @@ namespace Thermo.Active.NC } } - return cmsError; + return libraryError; } public CmsError GetNcSoftKeys(out List ncSoftKeys) @@ -990,9 +990,9 @@ namespace Thermo.Active.NC List plcSoftKeys = new List(); // Get Nc softkeys data from PLC - CmsError cmsError = numericalControl.PLC_RNcSoftKeys(ref plcSoftKeys); - if (cmsError.IsError() || plcSoftKeys.Count == 0) - return cmsError; + CmsError libraryError = numericalControl.PLC_RNcSoftKeys(ref plcSoftKeys); + if (libraryError.IsError() || plcSoftKeys.Count == 0) + return libraryError; foreach (var softKey in NcSoftKeysConfig) { @@ -1008,7 +1008,7 @@ namespace Thermo.Active.NC }); } - return cmsError; + return libraryError; } public CmsError GetHeadsData(out List heads) @@ -1020,9 +1020,9 @@ namespace Thermo.Active.NC List plcHeads = new List(); // Read value from PLC - CmsError cmsError = numericalControl.PLC_RHeadsData(plcHeads, headsNumber); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PLC_RHeadsData(plcHeads, headsNumber); + if (libraryError.IsError()) + return libraryError; foreach (var head in plcHeads) { @@ -1079,7 +1079,7 @@ namespace Thermo.Active.NC } } - return cmsError; + return libraryError; } #if false @@ -1093,9 +1093,9 @@ namespace Thermo.Active.NC List plcHeads = new List(); // Read value from PLC - CmsError cmsError = numericalControl.PLC_RHeadsData(plcHeads, headsNumber); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PLC_RHeadsData(plcHeads, headsNumber); + if (libraryError.IsError()) + return libraryError; foreach (var head in plcHeads) { @@ -1152,7 +1152,7 @@ namespace Thermo.Active.NC } } - return cmsError; + return libraryError; } #endif @@ -1160,9 +1160,9 @@ namespace Thermo.Active.NC { data = new List(); List ncData = new List(); - CmsError cmsError = numericalControl.PLC_ROperatorInputIsNeeded(ref ncData); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PLC_ROperatorInputIsNeeded(ref ncData); + if (libraryError.IsError()) + return libraryError; data = ncData.Select(x => new DTOM155InputModel() { @@ -1192,7 +1192,7 @@ namespace Thermo.Active.NC public CmsError ReadScadasData(List schemasToRead, out List scadas) { - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; scadas = new List(); List alreadyReadScada = new List(); @@ -1204,9 +1204,9 @@ namespace Thermo.Active.NC if (!alreadyReadScada.Contains(schema.Id)) { // Read one schema - cmsError = ReadScadaData(schema, out scadaValue); - if (cmsError.IsError()) - return cmsError; + libraryError = ReadScadaData(schema, out scadaValue); + if (libraryError.IsError()) + return libraryError; // Add value to return list scadas.Add(scadaValue); @@ -1215,7 +1215,7 @@ namespace Thermo.Active.NC } } - return cmsError; + return libraryError; } public CmsError ReadScadaData(ScadaSchemaModel schema, out DTOScadaModel scadaValue) @@ -1223,16 +1223,16 @@ namespace Thermo.Active.NC if (NcConfig.NcVendor != NC_VENDOR.SIEMENS) { // Read OSAI FANUC schema - CmsError cmsError = ReadNcScada(schema, out scadaValue); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = ReadNcScada(schema, out scadaValue); + if (libraryError.IsError()) + return libraryError; } else { // Read SIEMENS schema - CmsError cmsError = ReadSiemensScadaSiemens(schema, out scadaValue); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = ReadSiemensScadaSiemens(schema, out scadaValue); + if (libraryError.IsError()) + return libraryError; } return NO_ERROR; @@ -1241,17 +1241,17 @@ namespace Thermo.Active.NC public CmsError ReadGaugeData(out ThermoModels.GaugeModel gaugeData) { gaugeData = new ThermoModels.GaugeModel(); - CmsError cmsError = numericalControl.PLC_RGaugeData(ref gaugeData); + CmsError libraryError = numericalControl.PLC_RGaugeData(ref gaugeData); - return cmsError; + return libraryError; } public CmsError ReadProdInfoData(out ThermoModels.ProdInfoModel prodInfoData) { prodInfoData = new ThermoModels.ProdInfoModel(); - CmsError cmsError = numericalControl.PLC_RProdInfo(ref prodInfoData); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PLC_RProdInfo(ref prodInfoData); + if (libraryError.IsError()) + return libraryError; // do comparison with old record and if changed --> persist on DB! if (lastProdInfoData != null) @@ -1267,7 +1267,7 @@ namespace Thermo.Active.NC } } - return cmsError; + return libraryError; } /// /// Get historical prodinfo data from DB @@ -1278,7 +1278,7 @@ namespace Thermo.Active.NC /// public CmsError GetHistProdInfoData(out List prodInfoDataList, int numStart, int numRec) { - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; prodInfoDataList = new List(); using (ProdInfoController prodInfoController = new ProdInfoController()) @@ -1303,7 +1303,7 @@ namespace Thermo.Active.NC }).ToList(); } - return cmsError; + return libraryError; } /// /// Update requested prod quantity @@ -1313,14 +1313,14 @@ namespace Thermo.Active.NC /// public CmsError UpdateProdInfoData(short numTarget, bool newWorkOrder) { - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; using (ProdInfoController prodInfoController = new ProdInfoController()) { // registro dati aggiornati sul PLC - cmsError = numericalControl.PLC_WProdInfo(numTarget, newWorkOrder); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_WProdInfo(numTarget, newWorkOrder); + if (libraryError.IsError()) + return libraryError; // svuoto il db se richiesto reset... if (newWorkOrder) @@ -1329,16 +1329,16 @@ namespace Thermo.Active.NC } } - return cmsError; + return libraryError; } public CmsError ReadProdCycleData(out ThermoModels.ProdCycleModel prodCycleData) { prodCycleData = new ThermoModels.ProdCycleModel(); - CmsError cmsError = numericalControl.PLC_RProdCycle(ref prodCycleData); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PLC_RProdCycle(ref prodCycleData); + if (libraryError.IsError()) + return libraryError; - return cmsError; + return libraryError; } /// /// Vero metodo lettura ricetta da 2 aree memoria PLC @@ -1357,21 +1357,21 @@ namespace Thermo.Active.NC if (NcConfig.NcVendor == NC_VENDOR.S7NET) { Dictionary currPlcRecipe = new Dictionary(); - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; if (useLastRead && lastRecipe.Count > 0) { currentRecipe = lastRecipe; - return cmsError; + return libraryError; } else { - cmsError = numericalControl.PLC_RRecipeParamList(refreshOnlyRT, ref currPlcRecipe); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RRecipeParamList(refreshOnlyRT, ref currPlcRecipe); + if (libraryError.IsError()) + return libraryError; } - if (cmsError.IsError()) - return cmsError; + if (libraryError.IsError()) + return libraryError; DTORecipeParam currParam = new DTORecipeParam(); // leggo l'intero array delle DB... QUI FAKE sulle DB configurate... @@ -1484,9 +1484,9 @@ namespace Thermo.Active.NC newParameters.Add(item.Value.Id, (int)(item.Value.SetpointHMI * item.Value.ScaleFactor)); } // scrivo! - CmsError cmsError = numericalControl.PLC_WRecipeParameters(newParameters); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PLC_WRecipeParameters(newParameters); + if (libraryError.IsError()) + return libraryError; } else { @@ -1505,9 +1505,9 @@ namespace Thermo.Active.NC if (NcConfig.NcVendor == NC_VENDOR.S7NET) { // call NC for update - CmsError cmsError = numericalControl.PLC_WRecipeEdit(confirmUpdate); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PLC_WRecipeEdit(confirmUpdate); + if (libraryError.IsError()) + return libraryError; } else { @@ -1528,14 +1528,14 @@ namespace Thermo.Active.NC // solo x S7... if (NcConfig.NcVendor == NC_VENDOR.S7NET) { - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; // leggo stato ricetta da PLC Dictionary currPlcWarmers = new Dictionary(); - cmsError = numericalControl.PLC_RWarmerChannelList(ref currPlcWarmers); + libraryError = numericalControl.PLC_RWarmerChannelList(ref currPlcWarmers); - if (cmsError.IsError()) - return cmsError; + if (libraryError.IsError()) + return libraryError; // compongo con il resto delle info da config... do x scontato di avere TUTIT i 1024 channels List warmersConfig = RiskChannelConfig.Select(x => new DTOWarmers() @@ -1568,9 +1568,9 @@ namespace Thermo.Active.NC if (NcConfig.NcVendor == NC_VENDOR.S7NET) { // call NC for update - CmsError cmsError = numericalControl.PLC_WModeSel((int)mode); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PLC_WModeSel((int)mode); + if (libraryError.IsError()) + return libraryError; } else { @@ -1587,7 +1587,7 @@ namespace Thermo.Active.NC //ReadScadaDataSiemens(scadaSchema, out scadaValue); //return NO_ERROR; - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; scadaValue = new DTOScadaModel() { Id = scadaSchema.Id, @@ -1609,9 +1609,9 @@ namespace Thermo.Active.NC if (layer.Labels[i].MemEnabledIndex != null) { // Read enabled from PLC - cmsError = numericalControl.PLC_RScadaValue(layer.Labels[i].MemEnabledIndex, SCADA_MEM_TYPE.BOOL, ref val); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RScadaValue(layer.Labels[i].MemEnabledIndex, SCADA_MEM_TYPE.BOOL, ref val); + if (libraryError.IsError()) + return libraryError; // Populate & add new object into scada model scadaValue.Labels.Add(new DTOScadaLabelModel() { @@ -1631,9 +1631,9 @@ namespace Thermo.Active.NC if (layer.Buttons.ElementAtOrDefault(i) != null) { // Read enabled from PLC - cmsError = numericalControl.PLC_RScadaValue(layer.Buttons[i].Status.MemEnabledIndex, SCADA_MEM_TYPE.BOOL, ref val); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RScadaValue(layer.Buttons[i].Status.MemEnabledIndex, SCADA_MEM_TYPE.BOOL, ref val); + if (libraryError.IsError()) + return libraryError; // Populate & add new object into scada model scadaValue.Buttons.Add(new DTOScadaButtonModel() @@ -1646,9 +1646,9 @@ namespace Thermo.Active.NC if (layer.Images.ElementAtOrDefault(i) != null) { // Read isVisible from PLC - cmsError = numericalControl.PLC_RScadaValue(layer.Images[i].Status.MemVisibleIndex, SCADA_MEM_TYPE.BOOL, ref val); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RScadaValue(layer.Images[i].Status.MemVisibleIndex, SCADA_MEM_TYPE.BOOL, ref val); + if (libraryError.IsError()) + return libraryError; var negate = layer.Images[i].Status.Negate; // Populate & add new object into scada model @@ -1662,9 +1662,9 @@ namespace Thermo.Active.NC if (layer.ProgressBars.ElementAtOrDefault(i) != null) { // Read value from PLC - cmsError = numericalControl.PLC_RScadaValue(layer.ProgressBars[i].MemValueIndex, SCADA_MEM_TYPE.BYTE, ref val); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RScadaValue(layer.ProgressBars[i].MemValueIndex, SCADA_MEM_TYPE.BYTE, ref val); + if (libraryError.IsError()) + return libraryError; // Populate & add new object into scada model scadaValue.ProgressBars.Add(new DTOScadaProgressBarModel() { @@ -1679,9 +1679,9 @@ namespace Thermo.Active.NC { SCADA_MEM_TYPE type = SupportFunctions.GetMemTypeFromString(layer.Inputs[i].Status.Type); // Read value from PLC - cmsError = numericalControl.PLC_RScadaValue(layer.Inputs[i].Status.MemValueIndex, type, ref val2); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RScadaValue(layer.Inputs[i].Status.MemValueIndex, type, ref val2); + if (libraryError.IsError()) + return libraryError; // if type is real approximate to configurated decimal digits if (type == SCADA_MEM_TYPE.REAL) @@ -1704,15 +1704,15 @@ namespace Thermo.Active.NC else { // Read isVisible from PLC - cmsError = numericalControl.PLC_RScadaValue(layer.Inputs[i].Status.MemEnabledIndex, SCADA_MEM_TYPE.BOOL, ref val); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RScadaValue(layer.Inputs[i].Status.MemEnabledIndex, SCADA_MEM_TYPE.BOOL, ref val); + if (libraryError.IsError()) + return libraryError; SCADA_MEM_TYPE type = SupportFunctions.GetMemTypeFromString(layer.Inputs[i].Status.Type); // Read value from PLC - cmsError = numericalControl.PLC_RScadaValue(layer.Inputs[i].Status.MemValueIndex, type, ref val2); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RScadaValue(layer.Inputs[i].Status.MemValueIndex, type, ref val2); + if (libraryError.IsError()) + return libraryError; // Populate & add new object into scada model scadaValue.Inputs.Add(new DTOScadaInputModel() @@ -1730,14 +1730,14 @@ namespace Thermo.Active.NC } } - return cmsError; + return libraryError; } public CmsError ReadSiemensScadaSiemens(ScadaSchemaModel scadaSchema, out DTOScadaModel scadaValue) { List inputData = new List(); List booleanValue = new List(); - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; scadaValue = new DTOScadaModel() { Id = scadaSchema.Id, @@ -1814,9 +1814,9 @@ namespace Thermo.Active.NC if (layer.ProgressBars.ElementAtOrDefault(i) != null) { // Read value from PLC - cmsError = numericalControl.PLC_RScadaValue(layer.ProgressBars[i].MemValueIndex, SCADA_MEM_TYPE.BYTE, ref val); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RScadaValue(layer.ProgressBars[i].MemValueIndex, SCADA_MEM_TYPE.BYTE, ref val); + if (libraryError.IsError()) + return libraryError; // Populate & add new object into scada model scadaValue.ProgressBars.Add(new DTOScadaProgressBarModel() @@ -1859,14 +1859,14 @@ namespace Thermo.Active.NC //st.Start(); // Read input data ( value, isEnabled, value2, isEnabled2 ...) - cmsError = numericalControl.PLC_RScadaSiemens(ref inputData); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RScadaSiemens(ref inputData); + if (libraryError.IsError()) + return libraryError; // Read bolean values (isVisible, isEnabled, isEnabled ...) - cmsError = numericalControl.PLC_RScadaSiemens(ref booleanValue); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RScadaSiemens(ref booleanValue); + if (libraryError.IsError()) + return libraryError; for (int i = 0; i < booleanValue.Count() - 1; i++) { @@ -1928,7 +1928,7 @@ namespace Thermo.Active.NC //st.Stop(); //Console.WriteLine(st.ElapsedMilliseconds); - return cmsError; + return libraryError; } /// @@ -1938,18 +1938,18 @@ namespace Thermo.Active.NC /// public CmsError ReadFullRecipe(out Dictionary currRecipe) { - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; currRecipe = new Dictionary(); DTORecipeParam currParam = new DTORecipeParam(); // gestione errore - cmsError = ReadRecipeData(false, true, out currRecipe); - if (cmsError.IsError()) - return cmsError; + libraryError = ReadRecipeData(false, true, out currRecipe); + if (libraryError.IsError()) + return libraryError; // restituisco cod errore se trovato - return cmsError; + return libraryError; } /// @@ -1959,9 +1959,9 @@ namespace Thermo.Active.NC /// public CmsError WriteRecipeParams(Dictionary updtRecipe) { - CmsError cmsError = WriteRecipeParametersToPLC(updtRecipe); + CmsError libraryError = WriteRecipeParametersToPLC(updtRecipe); - return cmsError; + return libraryError; } /// @@ -1971,14 +1971,14 @@ namespace Thermo.Active.NC /// public CmsError GetRecipeOverview(out Dictionary currOverview) { - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; currOverview = new Dictionary(); // leggo la ricetta! var currRecipe = new Dictionary(); - cmsError = ReadFullRecipe(out currRecipe); - if (cmsError.IsError()) - return cmsError; + libraryError = ReadFullRecipe(out currRecipe); + if (libraryError.IsError()) + return libraryError; // leggo l'intero array delle DB... QUI FAKE sulle DB configurate... List recipeConfig = RecipeConfig.Select(x => new DTORecipeConfigModel() @@ -2043,7 +2043,7 @@ namespace Thermo.Active.NC } // restituisco cod errore se trovato - return cmsError; + return libraryError; } /// @@ -2053,22 +2053,22 @@ namespace Thermo.Active.NC /// public CmsError ReadModulesBlock(out Dictionary currModules) { - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; currModules = new Dictionary(); // gestione errore - cmsError = ReadModBlock(out currModules); - if (cmsError.IsError()) - return cmsError; + libraryError = ReadModBlock(out currModules); + if (libraryError.IsError()) + return libraryError; // restituisco cod errore se trovato - return cmsError; + return libraryError; } public CmsError ReadModBlock(out Dictionary currModules) { - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; currModules = new Dictionary(); DTOModulesBlock currVal = new DTOModulesBlock(); @@ -2076,7 +2076,7 @@ namespace Thermo.Active.NC if (NcConfig.NcVendor == NC_VENDOR.S7NET) { Dictionary currModBlock = new Dictionary(); - cmsError = numericalControl.PLC_RModulesBlockList(false, ref currModBlock); + libraryError = numericalControl.PLC_RModulesBlockList(false, ref currModBlock); foreach (var item in ModBlockConfig) { @@ -2109,7 +2109,7 @@ namespace Thermo.Active.NC } } } - return cmsError; + return libraryError; } /// @@ -2119,7 +2119,7 @@ namespace Thermo.Active.NC /// public CmsError ReadWarmers(out Dictionary currWarmers) { - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; currWarmers = new Dictionary(); DTOWarmers currVal = new DTOWarmers(); @@ -2127,7 +2127,7 @@ namespace Thermo.Active.NC if (NcConfig.NcVendor == NC_VENDOR.S7NET) { Dictionary currPlcWarmChan = new Dictionary(); - cmsError = numericalControl.PLC_RWarmerChannelList(ref currPlcWarmChan); + libraryError = numericalControl.PLC_RWarmerChannelList(ref currPlcWarmChan); foreach (var item in RiskChannelConfig) { @@ -2154,11 +2154,11 @@ namespace Thermo.Active.NC } // gestione errore - if (cmsError.IsError()) - return cmsError; + if (libraryError.IsError()) + return libraryError; // restituisco cod errore se trovato - return cmsError; + return libraryError; } /// @@ -2168,7 +2168,7 @@ namespace Thermo.Active.NC /// public CmsError GetWarmersResistances(out Dictionary currWarmersResistances) { - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; currWarmersResistances = new Dictionary(); // read and return config @@ -2181,7 +2181,7 @@ namespace Thermo.Active.NC } // restituisco cod errore se trovato - return cmsError; + return libraryError; } /// /// Get area for material from parameters list @@ -2190,22 +2190,22 @@ namespace Thermo.Active.NC /// public CmsError GetWarmMaterialArea(out Dictionary currAreaPerc) { - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; currAreaPerc = new Dictionary(); DTORecipeParam currParam = new DTORecipeParam(); var currRecipe = new Dictionary(); // read recipe - cmsError = ReadRecipeData(false, true, out currRecipe); - if (cmsError.IsError()) - return cmsError; + libraryError = ReadRecipeData(false, true, out currRecipe); + if (libraryError.IsError()) + return libraryError; // use 2 fixed data for calculus: general_sizes_sheet_dim_x / general_sizes_sheet_dim_y currAreaPerc.Add("X", getDimRatio(currRecipe["general_sizes_sheet_dim_x"])); currAreaPerc.Add("Y", getDimRatio(currRecipe["general_sizes_sheet_dim_y"])); // restituisco cod errore se trovato - return cmsError; + return libraryError; } protected double getDimRatio(DTORecipeParam singlePar) @@ -2231,9 +2231,9 @@ namespace Thermo.Active.NC /// public CmsError WriteRecipeWarmChSetpHMI(Dictionary updtSetpHmi) { - CmsError cmsError = numericalControl.PLC_WWarmerChSetpHmi(updtSetpHmi); + CmsError libraryError = numericalControl.PLC_WWarmerChSetpHmi(updtSetpHmi); - return cmsError; + return libraryError; } /// /// Write all warmers termocam data for recipe @@ -2242,9 +2242,9 @@ namespace Thermo.Active.NC /// public CmsError WriteRecipeWarmChSetpTermoCam(Dictionary updtSetpTCam) { - CmsError cmsError = numericalControl.PLC_WWarmerChSetpTCam(updtSetpTCam); + CmsError libraryError = numericalControl.PLC_WWarmerChSetpTCam(updtSetpTCam); - return cmsError; + return libraryError; } /// /// Write all warmers CONFIG data @@ -2254,16 +2254,16 @@ namespace Thermo.Active.NC public CmsError WriteRecipeWarmConfig() { Dictionary newData = new Dictionary(); - CmsError cmsError = NO_ERROR; + CmsError libraryError = NO_ERROR; // scrivo l'abilitazione dei canali... foreach (var item in RiskBoardConfig) { newData.Add(item.IdBoard, item.NumChannels > 0 ? 1 : 0); } - cmsError = numericalControl.PLC_WWarmerConfBoardEnabl(newData); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_WWarmerConfBoardEnabl(newData); + if (libraryError.IsError()) + return libraryError; // processo riflettori... newData = new Dictionary(); @@ -2271,15 +2271,15 @@ namespace Thermo.Active.NC { newData.Add(item.IdChannel, item.IdReflector); } - cmsError = numericalControl.PLC_WWarmerConfRefl(newData); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_WWarmerConfRefl(newData); + if (libraryError.IsError()) + return libraryError; // recupero parametro VUMin... ushort VUMin = 1; - cmsError = numericalControl.PLC_RWarmerConfVUMin(ref VUMin); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RWarmerConfVUMin(ref VUMin); + if (libraryError.IsError()) + return libraryError; // check div0! if (VUMin == 0) { @@ -2300,12 +2300,12 @@ namespace Thermo.Active.NC } newFloatTData.Add(item.IdChannel, minICh); } - cmsError = numericalControl.PLC_WWarmerConfMinCurr(newFloatTData); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_WWarmerConfMinCurr(newFloatTData); + if (libraryError.IsError()) + return libraryError; - return cmsError; + return libraryError; } #endregion Read Data @@ -2315,9 +2315,9 @@ namespace Thermo.Active.NC public CmsError PutNcSoftKeyClick(uint id) { // Write Nc softkey press to plc - CmsError cmsError = numericalControl.PLC_WNcSoftKey(id); + CmsError libraryError = numericalControl.PLC_WNcSoftKey(id); - return cmsError; + return libraryError; } public CmsError PutUserSoftKeyClick(uint id) @@ -2423,17 +2423,17 @@ namespace Thermo.Active.NC // Read Machine ID string strMachNumber = "0"; - CmsError cmsError = numericalControl.NC_RMachineNumber(NcConfig.MachineNumberHasLetters, ref strMachNumber); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.NC_RMachineNumber(NcConfig.MachineNumberHasLetters, ref strMachNumber); + if (libraryError.IsError()) + return libraryError; SupportFunctions.ConvertStringMachineNumberIntoNumber(strMachNumber, out bool containsLetters, out int machNumber); // Read Data from NC & elaborate it long NcCandy = 0; - cmsError = numericalControl.PLC_RCandy(ref NcCandy); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RCandy(ref NcCandy); + if (libraryError.IsError()) + return libraryError; bool bNC_OK = CandiesController.GetDataFromLincense(NcCandy, containsLetters, out long NCLic, out int NCMatr, out long NCParam); bool bNC_VALID = machNumber == NCMatr && bNC_OK; @@ -2449,17 +2449,17 @@ namespace Thermo.Active.NC // Read Expired Lincense Bit on NC bool bNcCandy = false; - cmsError = numericalControl.PLC_RExpiredCandy(ref bNcCandy); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_RExpiredCandy(ref bNcCandy); + if (libraryError.IsError()) + return libraryError; // Manage Expired Lincense Bit if (CandiesController.ElaborateExpiredBit(newDate, bNcCandy, out bool bNewCandy)) { //Write Expired Lincense Bit on NC - cmsError = numericalControl.PLC_WExpiredCandy(bNewCandy); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PLC_WExpiredCandy(bNewCandy); + if (libraryError.IsError()) + return libraryError; } return NO_ERROR; @@ -2482,8 +2482,8 @@ namespace Thermo.Active.NC public bool ReadHeadWTime(int Head, out uint hour) { hour = 0; - CmsError cmsError = numericalControl.PLC_RWorkedTimeHead(Head, ref hour); - if (cmsError.IsError()) + CmsError libraryError = numericalControl.PLC_RWorkedTimeHead(Head, ref hour); + if (libraryError.IsError()) return false; return true; @@ -2491,8 +2491,8 @@ namespace Thermo.Active.NC public bool ResetHeadWTime(int Head) { - CmsError cmsError = numericalControl.PLC_WResetWorkedTimeHead(Head); - if (cmsError.IsError()) + CmsError libraryError = numericalControl.PLC_WResetWorkedTimeHead(Head); + if (libraryError.IsError()) return false; return true; @@ -2501,8 +2501,8 @@ namespace Thermo.Active.NC public bool ReadMachineWTime(out uint hour) { hour = 0; - CmsError cmsError = numericalControl.PLC_RWorkedTimeMachine(ref hour); - if (cmsError.IsError()) + CmsError libraryError = numericalControl.PLC_RWorkedTimeMachine(ref hour); + if (libraryError.IsError()) return false; return true; @@ -2510,8 +2510,8 @@ namespace Thermo.Active.NC public bool ResetMachineWTime(uint hour) { - CmsError cmsError = numericalControl.PLC_WResetWorkedTimeMachine(hour); - if (cmsError.IsError()) + CmsError libraryError = numericalControl.PLC_WResetWorkedTimeMachine(hour); + if (libraryError.IsError()) return false; return true; @@ -2519,8 +2519,8 @@ namespace Thermo.Active.NC public bool ResetMaintenanceCounter(uint counter) { - CmsError cmsError = numericalControl.PLC_WResetMachineCounters(counter); - if (cmsError.IsError()) + CmsError libraryError = numericalControl.PLC_WResetMachineCounters(counter); + if (libraryError.IsError()) return false; return true; diff --git a/Thermo.Active.NC/NcFileAdapter.cs b/Thermo.Active.NC/NcFileAdapter.cs index 83366ebf..a7739b4f 100644 --- a/Thermo.Active.NC/NcFileAdapter.cs +++ b/Thermo.Active.NC/NcFileAdapter.cs @@ -83,18 +83,17 @@ namespace Thermo.Active.NC public CmsError GetFileInfo(string path, out InfoFile fileInfo) { fileInfo = new InfoFile(); - // CmsError cmsError = NO_ERROR; // if (FileExistWithNc(path)) - // cmsError = LocalPartProgramFileInfo(path, out fileInfo); + // libraryError = LocalPartProgramFileInfo(path, out fileInfo); // else - // cmsError = numericalControl.FILES_RGetFileInfo(path, ref fileInfo); + // libraryError = numericalControl.FILES_RGetFileInfo(path, ref fileInfo); - CmsError cmsError = numericalControl.FILES_RGetFileInfo(path, ref fileInfo); + CmsError libraryError = numericalControl.FILES_RGetFileInfo(path, ref fileInfo); - if (cmsError.IsError()) - return cmsError; + if (libraryError.IsError()) + return libraryError; string[] names = fileInfo.Name.Split('/'); if (names.Length > 0) @@ -128,15 +127,15 @@ namespace Thermo.Active.NC fileInfo = new DTOActiveImageAndNameDataModel(); PROGRAM_TYPE_ENUM program = PROGRAM_TYPE_ENUM.NONE; - CmsError cmsError = numericalControl.FILES_RGetProgramType(ref program); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.FILES_RGetProgramType(ref program); + if (libraryError.IsError()) + return libraryError; // Get selected process ushort selectedProcess = 0; - cmsError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); + if (libraryError.IsError()) + return libraryError; // JOB CASE if (program == PROGRAM_TYPE_ENUM.JOB) @@ -162,9 +161,9 @@ namespace Thermo.Active.NC else { string name = ""; - cmsError = numericalControl.PROC_RSelectedPPName(selectedProcess, ref name); - if (cmsError.IsError()) - return cmsError; + libraryError = numericalControl.PROC_RSelectedPPName(selectedProcess, ref name); + if (libraryError.IsError()) + return libraryError; fileInfo = new DTOActiveImageAndNameDataModel() { @@ -219,13 +218,13 @@ namespace Thermo.Active.NC dtoData = new DTOActiveProgramDataModel(); // Get selectedProcess process id ushort selectedProcess = 0; - CmsError cmsError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); + if (libraryError.IsError()) + return libraryError; // Read active program data ActiveProgramDataModel data = new ActiveProgramDataModel(); - cmsError = numericalControl.FILES_RActiveProgramData(selectedProcess, ref data); + libraryError = numericalControl.FILES_RActiveProgramData(selectedProcess, ref data); dtoData = new DTOActiveProgramDataModel() { @@ -234,7 +233,7 @@ namespace Thermo.Active.NC TimeLeft = data.TimeLeft }; - return cmsError; // TODO FIX OSAI + return libraryError; // TODO FIX OSAI } public CmsError SetActiveProgramInfo(string path, out DTOActiveProgramDataModel dtoData) @@ -242,12 +241,12 @@ namespace Thermo.Active.NC dtoData = new DTOActiveProgramDataModel(); // Get selectedProcess process id ushort selectedProcess = 1; - CmsError cmsError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); - //if (cmsError.IsError()) - // return cmsError; + CmsError libraryError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); + //if (libraryError.IsError()) + // return libraryError; ActiveProgramDataModel data = new ActiveProgramDataModel(); - cmsError = numericalControl.FILES_WSetActiveProgram(selectedProcess, path, ref data); + libraryError = numericalControl.FILES_WSetActiveProgram(selectedProcess, path, ref data); dtoData = new DTOActiveProgramDataModel() { @@ -256,7 +255,7 @@ namespace Thermo.Active.NC TimeLeft = data.TimeLeft }; - return cmsError; + return libraryError; } public CmsError DeactivateProgram(out DTOActiveProgramDataModel dtoData) @@ -264,12 +263,12 @@ namespace Thermo.Active.NC dtoData = new DTOActiveProgramDataModel(); // Get selectedProcess process id ushort selectedProcess = 0; - CmsError cmsError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); + if (libraryError.IsError()) + return libraryError; ActiveProgramDataModel data = new ActiveProgramDataModel(); - cmsError = numericalControl.FILES_WDeactivateProgram(selectedProcess); + libraryError = numericalControl.FILES_WDeactivateProgram(selectedProcess); dtoData = new DTOActiveProgramDataModel() { @@ -278,21 +277,21 @@ namespace Thermo.Active.NC TimeLeft = data.TimeLeft }; - return cmsError; + return libraryError; } public CmsError UploadPartProgram(string localPath, string fileName, out string newFilePath) { // Upload to NC newFilePath = ""; - CmsError cmsError = numericalControl.FILES_UploadPartProgram(localPath, fileName, ref newFilePath); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.FILES_UploadPartProgram(localPath, fileName, ref newFilePath); + if (libraryError.IsError()) + return libraryError; // Delete local file File.Delete(localPath + "\\" + fileName); - return cmsError; + return libraryError; } public CmsError UploadPartProgramAndActivate(string localPath, string fileName, out ActiveProgramDataModel programData) @@ -301,16 +300,16 @@ namespace Thermo.Active.NC // Get selectedProcess id ushort selectedProcess = 0; - CmsError cmsError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); + if (libraryError.IsError()) + return libraryError; if (!JOB_EXTENSIONS.Contains(Path.GetExtension(fileName))) { // Upload to NC - cmsError = UploadPartProgram(localPath, fileName, out string newFilePath); - if (cmsError.IsError()) - return cmsError; + libraryError = UploadPartProgram(localPath, fileName, out string newFilePath); + if (libraryError.IsError()) + return libraryError; // Custom part program management //if(String.IsNullOrEmpty(CMSMainProgramContent)) @@ -335,9 +334,9 @@ namespace Thermo.Active.NC // Get selectedProcess id ushort selectedProcess = 0; - CmsError cmsError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); + if (libraryError.IsError()) + return libraryError; queueItem = new DTOQueueModel() { @@ -362,7 +361,7 @@ namespace Thermo.Active.NC queueController.UpdateQueue(); } - return cmsError; + return libraryError; } public CmsError UpdateQueue() @@ -370,7 +369,7 @@ namespace Thermo.Active.NC // Get queue data List queueData = new List(); - CmsError cmsError = numericalControl.FILES_RQueueData(ref queueData); + CmsError libraryError = numericalControl.FILES_RQueueData(ref queueData); foreach (var item in queueData) { @@ -415,14 +414,14 @@ namespace Thermo.Active.NC } else // Upload & activate new part program - cmsError = numericalControl + libraryError = numericalControl .FILES_WLoadNextPartProgram( PartProgramQueue[item.ProcessId][QueueRunningIndexes[item.ProcessId]].AbsolutePath, QUEUE_FILE_NAME ); - if (cmsError.IsError()) - return cmsError; + if (libraryError.IsError()) + return libraryError; } } } @@ -451,9 +450,9 @@ namespace Thermo.Active.NC queueList = new List(); // Get selected process ushort selectedProcess = 0; - CmsError cmsError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); - if (cmsError.IsError()) - return cmsError; + CmsError libraryError = numericalControl.PROC_RSelectedProcess(ref selectedProcess); + if (libraryError.IsError()) + return libraryError; queueList = new List(); // Check if there is already a pp queue diff --git a/Thermo.Active/Controllers/SignalR/NcHub.cs b/Thermo.Active/Controllers/SignalR/NcHub.cs index 3816e810..fa220825 100644 --- a/Thermo.Active/Controllers/SignalR/NcHub.cs +++ b/Thermo.Active/Controllers/SignalR/NcHub.cs @@ -218,9 +218,9 @@ namespace Thermo.Active.Controllers.SignalR using (NcAdapter ncAdapter = new NcAdapter()) { ncAdapter.Connect(); - CmsError cmsError = ncAdapter.WriteM155Data(process, responseVal); - if (cmsError.IsError()) - throw new HubException(cmsError.localizationKey); + CmsError libraryError = ncAdapter.WriteM155Data(process, responseVal); + if (libraryError.IsError()) + throw new HubException(libraryError.localizationKey); } } @@ -230,9 +230,9 @@ namespace Thermo.Active.Controllers.SignalR using (NcAdapter ncAdapter = new NcAdapter()) { ncAdapter.Connect(); - CmsError cmsError = ncAdapter.WriteScada(memIndex, memType, value); - if (cmsError.IsError()) - throw new HubException(cmsError.localizationKey); + CmsError libraryError = ncAdapter.WriteScada(memIndex, memType, value); + if (libraryError.IsError()) + throw new HubException(libraryError.localizationKey); } } diff --git a/Thermo.Active/Controllers/WebApi/ApiMaintenanceController.cs b/Thermo.Active/Controllers/WebApi/ApiMaintenanceController.cs index 1038b45e..32479740 100644 --- a/Thermo.Active/Controllers/WebApi/ApiMaintenanceController.cs +++ b/Thermo.Active/Controllers/WebApi/ApiMaintenanceController.cs @@ -37,9 +37,9 @@ namespace Thermo.Active.Controllers.WebApi { ncAdapter.Connect(); // Get list of maintenances with user's permission - CmsError cmsError = ncAdapter.GetMaintenancesWithPermissions(out List maintenances, Convert.ToInt32(userId.Value)); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.GetMaintenancesWithPermissions(out List maintenances, Convert.ToInt32(userId.Value)); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); return Ok(maintenances); } @@ -67,11 +67,11 @@ namespace Thermo.Active.Controllers.WebApi using (NcAdapter ncAdapter = new NcAdapter()) { ncAdapter.Connect(); - CmsError cmsError = ncAdapter.GetMaintenanceDataById(dbMaint.MaintenanceId, Convert.ToInt32(userId.Value), out DTOMaintenanceModel maintenance); - if (cmsError.IsError()) + CmsError libraryError = ncAdapter.GetMaintenanceDataById(dbMaint.MaintenanceId, Convert.ToInt32(userId.Value), out DTOMaintenanceModel maintenance); + if (libraryError.IsError()) { maintenancesController.Delete(dbMaint); - return BadRequest(cmsError.localizationKey); + return BadRequest(libraryError.localizationKey); } PerformedMaintenanceModel performed = maintenancesController.PerformeMaintenance(maintenance.OriginalPlcCounter / 60, dbMaint.MaintenanceId, Convert.ToInt32(userId.Value), -2); @@ -81,9 +81,9 @@ namespace Thermo.Active.Controllers.WebApi return NotFound(); } - cmsError = ncAdapter.GetMaintenanceDataById(dbMaint.MaintenanceId, Convert.ToInt32(userId.Value), out DTOMaintenanceModel endMaintenance); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + libraryError = ncAdapter.GetMaintenanceDataById(dbMaint.MaintenanceId, Convert.ToInt32(userId.Value), out DTOMaintenanceModel endMaintenance); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); return Ok(endMaintenance); @@ -94,9 +94,9 @@ namespace Thermo.Active.Controllers.WebApi using (NcAdapter ncAdapter = new NcAdapter()) { ncAdapter.Connect(); - CmsError cmsError = ncAdapter.GetMaintenanceDataById(dbMaint.MaintenanceId, Convert.ToInt32(userId.Value), out DTOMaintenanceModel maintenance); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.GetMaintenanceDataById(dbMaint.MaintenanceId, Convert.ToInt32(userId.Value), out DTOMaintenanceModel maintenance); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); return Ok(maintenance); } @@ -139,9 +139,9 @@ namespace Thermo.Active.Controllers.WebApi using (NcAdapter ncAdapter = new NcAdapter()) { ncAdapter.Connect(); - CmsError cmsError = ncAdapter.GetMaintenanceDataById(dbMaint.MaintenanceId, Convert.ToInt32(userId.Value), out DTOMaintenanceModel maintenance); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.GetMaintenanceDataById(dbMaint.MaintenanceId, Convert.ToInt32(userId.Value), out DTOMaintenanceModel maintenance); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); return Ok(maintenance); } @@ -198,18 +198,18 @@ namespace Thermo.Active.Controllers.WebApi using (NcAdapter ncAdapter = new NcAdapter()) { ncAdapter.Connect(); - CmsError cmsError = ncAdapter.GetMaintenanceDataById(maintenanceId, Convert.ToInt32(userId.Value), out DTOMaintenanceModel maintData); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.GetMaintenanceDataById(maintenanceId, Convert.ToInt32(userId.Value), out DTOMaintenanceModel maintData); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); if (!maintData.CanPerform) return Unauthorized(); using (MaintenancesController maintenancesController = new MaintenancesController()) { - cmsError = ncAdapter.GetNcGenericData(out DTONcGenericDataModel data); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + libraryError = ncAdapter.GetNcGenericData(out DTONcGenericDataModel data); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); int controlWord = -1; if (maintData.CreatedByCms) @@ -225,9 +225,9 @@ namespace Thermo.Active.Controllers.WebApi if (performed == null) return NotFound(); - cmsError = ncAdapter.GetMaintenanceDataById(maintenanceId, Convert.ToInt32(userId.Value), out maintData); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + libraryError = ncAdapter.GetMaintenanceDataById(maintenanceId, Convert.ToInt32(userId.Value), out maintData); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); return Ok(maintData); } diff --git a/Thermo.Active/Controllers/WebApi/LanguageController.cs b/Thermo.Active/Controllers/WebApi/LanguageController.cs index 06d0ac3a..c4cc269a 100644 --- a/Thermo.Active/Controllers/WebApi/LanguageController.cs +++ b/Thermo.Active/Controllers/WebApi/LanguageController.cs @@ -27,9 +27,9 @@ namespace Thermo.Active.Controllers.WebApi ICollection cultureInfos = new List(); // Get nc available language - CmsError cmsError = ncAdapter.numericalControl.NC_GetAvailableLanguages(ref cultureInfos); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.numericalControl.NC_GetAvailableLanguages(ref cultureInfos); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); // Filter available language with availableLanguages = availableLanguages.Where(x => cultureInfos.Any(y => y.TwoLetterISOLanguageName == x.IsoId)).ToList(); } diff --git a/Thermo.Active/Controllers/WebApi/ModulesController.cs b/Thermo.Active/Controllers/WebApi/ModulesController.cs index 22927ded..4c5fe34d 100644 --- a/Thermo.Active/Controllers/WebApi/ModulesController.cs +++ b/Thermo.Active/Controllers/WebApi/ModulesController.cs @@ -33,11 +33,11 @@ namespace Thermo.Active.Controllers.WebApi return InternalServerError(); } - CmsError cmsError = ncAdapter.ReadModulesBlock(out Dictionary currModules); - if (cmsError.IsError()) + libraryError = ncAdapter.ReadModulesBlock(out Dictionary currModules); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"GetRecipeOverview error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"GetRecipeOverview error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } return Ok(currModules); diff --git a/Thermo.Active/Controllers/WebApi/NcFileController.cs b/Thermo.Active/Controllers/WebApi/NcFileController.cs index fb9b3c08..fd743aee 100644 --- a/Thermo.Active/Controllers/WebApi/NcFileController.cs +++ b/Thermo.Active/Controllers/WebApi/NcFileController.cs @@ -25,9 +25,9 @@ namespace Thermo.Active.Controllers.WebApi { ncAdapter.Connect(); - CmsError cmsError = ncAdapter.GetFileList(filePath, out List fileList); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.GetFileList(filePath, out List fileList); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); return Ok(fileList); } @@ -40,9 +40,9 @@ namespace Thermo.Active.Controllers.WebApi { ncAdapter.Connect(); - CmsError cmsError = ncAdapter.GetFileInfo(filePath, out InfoFile fileInfo); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.GetFileInfo(filePath, out InfoFile fileInfo); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); return Ok(fileInfo); } @@ -55,9 +55,9 @@ namespace Thermo.Active.Controllers.WebApi { ncAdapter.Connect(); - CmsError cmsError = ncAdapter.GetActiveFileInfo(filePath, out DTOActiveImageAndNameDataModel fileInfo); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.GetActiveFileInfo(filePath, out DTOActiveImageAndNameDataModel fileInfo); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); return Ok(fileInfo); } @@ -70,9 +70,9 @@ namespace Thermo.Active.Controllers.WebApi { ncAdapter.Connect(); - CmsError cmsError = ncAdapter.SetActiveProgramInfo(filePath, out DTOActiveProgramDataModel fileInfo); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.SetActiveProgramInfo(filePath, out DTOActiveProgramDataModel fileInfo); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); return Ok(fileInfo); } @@ -85,9 +85,9 @@ namespace Thermo.Active.Controllers.WebApi { ncAdapter.Connect(); - CmsError cmsError = ncAdapter.DeactivateProgram(out DTOActiveProgramDataModel fileInfo); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.DeactivateProgram(out DTOActiveProgramDataModel fileInfo); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); return Ok(fileInfo); } @@ -114,9 +114,9 @@ namespace Thermo.Active.Controllers.WebApi if (NcConfig.NcVendor == NC_VENDOR.OSAI) { // Clean upload folder only OSAI - CmsError cmsError = ncFileHandler.CleanUploadFolder(); - if (cmsError.IsError() && cmsError.errorCode != CMS_ERROR_CODES.FILE_NOT_FOUND) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncFileHandler.CleanUploadFolder(); + if (libraryError.IsError() && libraryError.errorCode != CMS_ERROR_CODES.FILE_NOT_FOUND) + return BadRequest(libraryError.localizationKey); } ActiveProgramDataModel programData = new ActiveProgramDataModel(); @@ -130,9 +130,9 @@ namespace Thermo.Active.Controllers.WebApi programs.Add(item.FileName); // Upload main program - CmsError cmsError = ncFileHandler.UploadPartProgramAndActivate(TEMP_PP_FOLDER, item.FileName, out programData); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncFileHandler.UploadPartProgramAndActivate(TEMP_PP_FOLDER, item.FileName, out programData); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); mainPPName = Path.GetFileNameWithoutExtension(programData.Path); } @@ -142,9 +142,9 @@ namespace Thermo.Active.Controllers.WebApi programs.Add(item.FileName); // Upload files - CmsError cmsError = ncFileHandler.UploadPartProgram(TEMP_PP_FOLDER, item.FileName, out string programPath); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncFileHandler.UploadPartProgram(TEMP_PP_FOLDER, item.FileName, out string programPath); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); } else if (item.ParameterName == "image") { @@ -348,9 +348,9 @@ namespace Thermo.Active.Controllers.WebApi if (repsParam == null || !int.TryParse(repsParam.Value, out int reps)) return BadRequest(); // Upload - CmsError cmsError = ncAdapter.UploadPartProgramAndAddToQueue(QUEUE_TMP_FOLDER, item.FileName, reps, out queueItem); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.UploadPartProgramAndAddToQueue(QUEUE_TMP_FOLDER, item.FileName, reps, out queueItem); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); } } else if (item.ParameterName == "image") @@ -370,9 +370,9 @@ namespace Thermo.Active.Controllers.WebApi { ncAdapter.Connect(); - CmsError cmsError = ncAdapter.RemoveFromQueue(processId, itemId); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.RemoveFromQueue(processId, itemId); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); } return Ok(); @@ -383,9 +383,9 @@ namespace Thermo.Active.Controllers.WebApi { using (NcFileAdapter ncAdapter = new NcFileAdapter()) { - CmsError cmsError = ncAdapter.MoveQueueItems(processId, itemsPositions.ObjectId, itemsPositions.NewPosition, out List queue); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.MoveQueueItems(processId, itemsPositions.ObjectId, itemsPositions.NewPosition, out List queue); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); return Ok(queue); } @@ -399,9 +399,9 @@ namespace Thermo.Active.Controllers.WebApi if (reps.Reps < 1) return BadRequest(INCORRECT_PARAMETERS_ERROR.localizationKey); - CmsError cmsError = ncAdapter.EditQueueItemReps(processId, itemId, reps.Reps, out DTOQueueModel queueItem); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.EditQueueItemReps(processId, itemId, reps.Reps, out DTOQueueModel queueItem); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); return Ok(queueItem); } @@ -412,9 +412,9 @@ namespace Thermo.Active.Controllers.WebApi { using (NcFileAdapter ncAdapter = new NcFileAdapter()) { - CmsError cmsError = ncAdapter.EmptyQueue(processId); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.EmptyQueue(processId); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); return Ok(); } @@ -427,9 +427,9 @@ namespace Thermo.Active.Controllers.WebApi { ncAdapter.Connect(); - CmsError cmsError = ncAdapter.StartWorkingQueue(processId); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.StartWorkingQueue(processId); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); return Ok(); } @@ -442,9 +442,9 @@ namespace Thermo.Active.Controllers.WebApi { ncAdapter.Connect(); - CmsError cmsError = ncAdapter.StopWorkingQueue(processId); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.StopWorkingQueue(processId); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); return Ok(); } diff --git a/Thermo.Active/Controllers/WebApi/ProdController.cs b/Thermo.Active/Controllers/WebApi/ProdController.cs index e9175d5d..571bc186 100644 --- a/Thermo.Active/Controllers/WebApi/ProdController.cs +++ b/Thermo.Active/Controllers/WebApi/ProdController.cs @@ -40,11 +40,11 @@ namespace Thermo.Active.Controllers.WebApi } // scrivo sul PLC il comando strobe richiesta AUTO! - CmsError cmsError = ncAdapter.StrobeMode(Model.DTOModels.ThermoProd.Mode.MANUAL); - if (cmsError.IsError()) + libraryError = ncAdapter.StrobeMode(Model.DTOModels.ThermoProd.Mode.MANUAL); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"RequestManual error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"RequestManual error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // ritorno solo fatto! @@ -69,11 +69,11 @@ namespace Thermo.Active.Controllers.WebApi } // scrivo sul PLC il comando strobe richiesta AUTO! - CmsError cmsError = ncAdapter.StrobeMode(Model.DTOModels.ThermoProd.Mode.AUTO); - if (cmsError.IsError()) + libraryError = ncAdapter.StrobeMode(Model.DTOModels.ThermoProd.Mode.AUTO); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"RequestAuto error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"RequestAuto error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // ritorno solo fatto! @@ -98,11 +98,11 @@ namespace Thermo.Active.Controllers.WebApi } // scrivo sul PLC il comando strobe richiesta AUTO! - CmsError cmsError = ncAdapter.StrobeMode(Model.DTOModels.ThermoProd.Mode.SETUP); - if (cmsError.IsError()) + libraryError = ncAdapter.StrobeMode(Model.DTOModels.ThermoProd.Mode.SETUP); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"RequestSetup error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"RequestSetup error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // ritorno solo fatto! @@ -129,11 +129,11 @@ namespace Thermo.Active.Controllers.WebApi } // scrivo sul PLC il comando strobe richiesta AUTO! - CmsError cmsError = ncAdapter.UpdateProdInfoData((short)requestQty, newWorkOrder); - if (cmsError.IsError()) + libraryError = ncAdapter.UpdateProdInfoData((short)requestQty, newWorkOrder); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"StartProd error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"StartProd error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // ritorno solo fatto! @@ -158,11 +158,11 @@ namespace Thermo.Active.Controllers.WebApi } // scrivo sul PLC il comando strobe richiesta AUTO! - CmsError cmsError = ncAdapter.ReadProdInfoData(out ThermoModels.ProdInfoModel prodInfoDat); - if (cmsError.IsError()) + libraryError = ncAdapter.ReadProdInfoData(out ThermoModels.ProdInfoModel prodInfoDat); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"GetProd error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"GetProd error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // ritorno solo fatto! @@ -187,11 +187,11 @@ namespace Thermo.Active.Controllers.WebApi } // scrivo sul PLC il comando strobe richiesta AUTO! - CmsError cmsError = ncAdapter.GetHistProdInfoData(out List prodInfoDataList, indexStart, numRecord); - if (cmsError.IsError()) + libraryError = ncAdapter.GetHistProdInfoData(out List prodInfoDataList, indexStart, numRecord); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"GetHistory error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"GetHistory error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // ritorno solo fatto! diff --git a/Thermo.Active/Controllers/WebApi/RecipeController.cs b/Thermo.Active/Controllers/WebApi/RecipeController.cs index 50011adc..bfb7ba55 100644 --- a/Thermo.Active/Controllers/WebApi/RecipeController.cs +++ b/Thermo.Active/Controllers/WebApi/RecipeController.cs @@ -34,11 +34,11 @@ namespace Thermo.Active.Controllers.WebApi return InternalServerError(); } - CmsError cmsError = ncAdapter.GetRecipeOverview(out Dictionary currOverview); - if (cmsError.IsError()) + libraryError = ncAdapter.GetRecipeOverview(out Dictionary currOverview); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"GetRecipeOverview error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"GetRecipeOverview error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } return Ok(currOverview); @@ -57,11 +57,11 @@ namespace Thermo.Active.Controllers.WebApi return InternalServerError(); } - CmsError cmsError = ncAdapter.ReadFullRecipe(out Dictionary currRecipe); - if (cmsError.IsError()) + libraryError = ncAdapter.ReadFullRecipe(out Dictionary currRecipe); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"GetRecipeOverview error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"GetRecipeOverview error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } return Ok(currRecipe); @@ -86,11 +86,11 @@ namespace Thermo.Active.Controllers.WebApi } // read recipe! - CmsError cmsError = ncAdapter.ReadFullRecipe(out Dictionary prevRecipe); - if (cmsError.IsError()) + libraryError = ncAdapter.ReadFullRecipe(out Dictionary prevRecipe); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"GetRecipeOverview error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"GetRecipeOverview error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } Dictionary updtRecipe = new Dictionary(); @@ -152,19 +152,19 @@ namespace Thermo.Active.Controllers.WebApi } // scrivo sul PLC il comando conferma! - CmsError cmsError = ncAdapter.ConfirmRecipeData(true); - if (cmsError.IsError()) + libraryError = ncAdapter.ConfirmRecipeData(true); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"ConfirmEdit error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"ConfirmEdit error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // recupero i dati LIVE dei parametri HMI della ricetta... - cmsError = ncAdapter.ReadFullRecipe(out Dictionary currRecipe); - if (cmsError.IsError()) + libraryError = ncAdapter.ReadFullRecipe(out Dictionary currRecipe); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"ConfirmEdit error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"ConfirmEdit error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // rileggo la ricetta @@ -208,19 +208,19 @@ namespace Thermo.Active.Controllers.WebApi } // scrivo sul PLC il comando annula! - CmsError cmsError = ncAdapter.ConfirmRecipeData(false); - if (cmsError.IsError()) + libraryError = ncAdapter.ConfirmRecipeData(false); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"ConfirmEdit error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"ConfirmEdit error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // recupero i dati LIVE dei parametri HMI della ricetta... - cmsError = ncAdapter.ReadFullRecipe(out Dictionary currRecipe); - if (cmsError.IsError()) + libraryError = ncAdapter.ReadFullRecipe(out Dictionary currRecipe); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"ConfirmEdit error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"ConfirmEdit error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } var currParams = new Dictionary(); @@ -262,7 +262,6 @@ namespace Thermo.Active.Controllers.WebApi } // chiamo metodo di lettura... - //CmsError cmsError = ServerConfigController.LoadRecipe(newName); bool fatto = ServerConfigController.LoadRecipe(newName); if (!fatto) { @@ -270,11 +269,11 @@ namespace Thermo.Active.Controllers.WebApi return NotFound(); } - CmsError cmsError = WriteCurrentRecipeToPlc(); - if (cmsError.IsError()) + libraryError = WriteCurrentRecipeToPlc(); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"ConfirmEdit error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"ConfirmEdit error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // ritorno solo fatto! @@ -300,11 +299,11 @@ namespace Thermo.Active.Controllers.WebApi return NotFound(); } - CmsError cmsError = WriteCurrentRecipeToPlc(); - if (cmsError.IsError()) + CmsError libraryError = WriteCurrentRecipeToPlc(); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"ConfirmEdit error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"ConfirmEdit error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } } @@ -323,9 +322,9 @@ namespace Thermo.Active.Controllers.WebApi { // recupero i dati LIVE dei parametri HMI della ricetta... - CmsError cmsError = ncAdapter.ReadFullRecipe(out Dictionary currRecipe); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.ReadFullRecipe(out Dictionary currRecipe); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); var currParams = new Dictionary(); foreach (var item in currRecipe) @@ -350,11 +349,11 @@ namespace Thermo.Active.Controllers.WebApi using (NcFileAdapter ncAdapter = new NcFileAdapter()) { // recupero i dati LIVE dei parametri HMI della ricetta... - CmsError cmsError = ncAdapter.ReadFullRecipe(out Dictionary currRecipe); - if (cmsError.IsError()) + CmsError libraryError = ncAdapter.ReadFullRecipe(out Dictionary currRecipe); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"SaveAs error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"SaveAs error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } var currParams = new Dictionary(); @@ -382,20 +381,20 @@ namespace Thermo.Active.Controllers.WebApi using (NcFileAdapter ncAdapter = new NcFileAdapter()) { // recupero i dati LIVE dei parametri HMI della ricetta... - CmsError cmsError = ncAdapter.ReadFullRecipe(out Dictionary currRecipe); - if (cmsError.IsError()) + CmsError libraryError = ncAdapter.ReadFullRecipe(out Dictionary currRecipe); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"SaveTemplate error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"SaveTemplate error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // recupero i dati LIVE dei carichi load dei cahnnels di riscaldo... - cmsError = ncAdapter.ReadWarmers(out Dictionary currWarmers); - if (cmsError.IsError()) + libraryError = ncAdapter.ReadWarmers(out Dictionary currWarmers); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"ReadWarmers error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"ReadWarmers error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // uso i valopri HMI... @@ -512,10 +511,10 @@ namespace Thermo.Active.Controllers.WebApi } // enable recipe! scrivo sul PLC il comando conferma! - CmsError cmsError = ncAdapter.ConfirmRecipeData(true); - if (cmsError.IsError()) + libraryError = ncAdapter.ConfirmRecipeData(true); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"ReadWarmers error | {cmsError.exception}"); + ThermoActiveLogger.LogError($"ReadWarmers error | {libraryError.exception}"); return checkError; } } diff --git a/Thermo.Active/Controllers/WebApi/ScadaController.cs b/Thermo.Active/Controllers/WebApi/ScadaController.cs index fdce1c0b..a222fc7d 100644 --- a/Thermo.Active/Controllers/WebApi/ScadaController.cs +++ b/Thermo.Active/Controllers/WebApi/ScadaController.cs @@ -41,9 +41,9 @@ namespace Thermo.Active.Controllers.WebApi { ncAdapter.Connect(); // Read the selected scada data - CmsError cmsError = ncAdapter.ReadScadaData(selectedScadaSchema, out DTOScadaModel values); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.ReadScadaData(selectedScadaSchema, out DTOScadaModel values); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); // Add to the subscriber list SubscribedScada.Add(selectedScadaSchema); @@ -77,9 +77,9 @@ namespace Thermo.Active.Controllers.WebApi using(NcAdapter ncAdapter = new NcAdapter()) { ncAdapter.Connect(); - CmsError cmsError = ncAdapter.ReadScadasData(ProductionScadaSchema, out List values); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.ReadScadasData(ProductionScadaSchema, out List values); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); ScadaDataAndSchema data = new ScadaDataAndSchema() @@ -150,9 +150,9 @@ namespace Thermo.Active.Controllers.WebApi if (memIndex == "") return BadRequest(INCORRECT_PARAMETERS_ERROR.localizationKey); - CmsError cmsError = ncAdapter.WriteScada(memIndex, memType, value); - if (cmsError.IsError()) - return BadRequest(cmsError.localizationKey); + CmsError libraryError = ncAdapter.WriteScada(memIndex, memType, value); + if (libraryError.IsError()) + return BadRequest(libraryError.localizationKey); } return Ok(); diff --git a/Thermo.Active/Controllers/WebApi/WarmersController.cs b/Thermo.Active/Controllers/WebApi/WarmersController.cs index cad3695c..2e2a5124 100644 --- a/Thermo.Active/Controllers/WebApi/WarmersController.cs +++ b/Thermo.Active/Controllers/WebApi/WarmersController.cs @@ -34,11 +34,11 @@ namespace Thermo.Active.Controllers.WebApi return InternalServerError(); } - CmsError cmsError = ncAdapter.ReadWarmers(out Dictionary currWarmers); - if (cmsError.IsError()) + libraryError = ncAdapter.ReadWarmers(out Dictionary currWarmers); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"GetRecipeOverview error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"GetRecipeOverview error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } return Ok(currWarmers); @@ -57,11 +57,11 @@ namespace Thermo.Active.Controllers.WebApi return InternalServerError(); } - CmsError cmsError = ncAdapter.GetWarmersResistances(out Dictionary currWarmers); - if (cmsError.IsError()) + libraryError = ncAdapter.GetWarmersResistances(out Dictionary currWarmers); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"GetCurrentWarmersResistances error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"GetCurrentWarmersResistances error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } return Ok(currWarmers); @@ -82,11 +82,11 @@ namespace Thermo.Active.Controllers.WebApi } // recupera aree % X / Y - CmsError cmsError = ncAdapter.GetWarmMaterialArea(out Dictionary currAreaPerc); - if (cmsError.IsError()) + libraryError = ncAdapter.GetWarmMaterialArea(out Dictionary currAreaPerc); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"GetCurrentAreaPerc error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"GetCurrentAreaPerc error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } return Ok(currAreaPerc); @@ -110,11 +110,11 @@ namespace Thermo.Active.Controllers.WebApi return InternalServerError(); } // scrivo sul PLC - CmsError cmsError = ncAdapter.WriteRecipeWarmChSetpHMI(channelsLoad); - if (cmsError.IsError()) + libraryError = ncAdapter.WriteRecipeWarmChSetpHMI(channelsLoad); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"WriteSetpoints error | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"WriteSetpoints error | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // ritorno solo fatto! @@ -145,19 +145,19 @@ namespace Thermo.Active.Controllers.WebApi } // scrivo sul PLC il comando conferma! - CmsError cmsError = ncAdapter.ConfirmRecipeData(true); - if (cmsError.IsError()) + libraryError = ncAdapter.ConfirmRecipeData(true); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"Warmers ConfirmEdit error | ConfirmRecipeData | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"Warmers ConfirmEdit error | ConfirmRecipeData | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // recupero i dati LIVE dei parametri HMI dei riscaldi... - cmsError = ncAdapter.ReadWarmers(out Dictionary currWarmers); - if (cmsError.IsError()) + libraryError = ncAdapter.ReadWarmers(out Dictionary currWarmers); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"Warmers ConfirmEdit error | ReadWarmers | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"Warmers ConfirmEdit error | ReadWarmers | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // rileggo la ricetta @@ -192,19 +192,19 @@ namespace Thermo.Active.Controllers.WebApi } // scrivo sul PLC il comando annula! - CmsError cmsError = ncAdapter.ConfirmRecipeData(false); - if (cmsError.IsError()) + libraryError = ncAdapter.ConfirmRecipeData(false); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"Warmers CancelEdit error | ConfirmRecipeData | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"Warmers CancelEdit error | ConfirmRecipeData | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // recupero i dati LIVE dei parametri HMI dei riscaldi... - cmsError = ncAdapter.ReadWarmers(out Dictionary currWarmers); - if (cmsError.IsError()) + libraryError = ncAdapter.ReadWarmers(out Dictionary currWarmers); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"Warmers ConfirmEdit error | ReadWarmers | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"Warmers ConfirmEdit error | ReadWarmers | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // rileggo la ricetta @@ -237,11 +237,11 @@ namespace Thermo.Active.Controllers.WebApi } // scrivo sul PLC - CmsError cmsError = ncAdapter.WriteRecipeWarmConfig(); - if (cmsError.IsError()) + libraryError = ncAdapter.WriteRecipeWarmConfig(); + if (libraryError.IsError()) { - ThermoActiveLogger.LogError($"Warmers SetConfig error | WriteRecipeWarmConfig | {cmsError.exception}"); - return BadRequest(cmsError.localizationKey); + ThermoActiveLogger.LogError($"Warmers SetConfig error | WriteRecipeWarmConfig | {libraryError.exception}"); + return BadRequest(libraryError.localizationKey); } // ritorno solo fatto! diff --git a/Thermo.Active/Properties/AssemblyInfo.cs b/Thermo.Active/Properties/AssemblyInfo.cs index fcb83848..98038fb7 100644 --- a/Thermo.Active/Properties/AssemblyInfo.cs +++ b/Thermo.Active/Properties/AssemblyInfo.cs @@ -31,4 +31,4 @@ using System.Runtime.InteropServices; // // You can specify all the values or you can default the Revision and Build Numbers // by using the '*' as shown below: -[assembly: AssemblyVersion("0.9.4")] +[assembly: AssemblyVersion("0.9.5")]