b0b7659ada
* Added Selected process and select process action * Added Heads signalR and configuration
89 lines
3.1 KiB
C#
89 lines
3.1 KiB
C#
using Step.Model.ConfigModels;
|
|
using Step.Model.DTOModels;
|
|
using System.Collections.Generic;
|
|
using System.Web.Http;
|
|
using static Step.Config.ServerConfig;
|
|
using static Step.Utils.Constants;
|
|
|
|
namespace Step.Controllers.WebApi
|
|
{
|
|
[RoutePrefix("api/configuration")]
|
|
public class ConfigurationController : ApiController
|
|
{
|
|
[Route("areas"), HttpGet]
|
|
public IHttpActionResult GetStartupConfiguration()
|
|
{
|
|
DTOStartupConfigurationModel startupConfiguration = new DTOStartupConfigurationModel()
|
|
{
|
|
ProductionConfig = ProductionConfig,
|
|
AlarmsConfig = AlarmsConfig,
|
|
ScadaConfig = ScadaConfig,
|
|
MaintenanceConfig = MaintenanceConfig,
|
|
ReportConfig = ReportConfig,
|
|
ToolingConfig = ToolingConfig,
|
|
UtilitiesConfig = UtilitiesConfig
|
|
};
|
|
|
|
return Ok(startupConfiguration);
|
|
}
|
|
|
|
[Route("client"), HttpGet]
|
|
public IHttpActionResult GetInfoConfiguration()
|
|
{
|
|
DTOClientConfigurationModel clientConfiguration = new DTOClientConfigurationModel()
|
|
{
|
|
NcVendor = NcConfig.NcVendor,
|
|
ShowHMI = NcConfig.showNcHMI,
|
|
DefaultLanguage = ServerStartupConfig.Language,
|
|
NcIp = NcConfig.NcIpAddress,
|
|
NcPort = NcConfig.NcPort
|
|
};
|
|
|
|
return Ok(clientConfiguration);
|
|
}
|
|
|
|
[Route("softKeys"), HttpGet]
|
|
public IHttpActionResult GetSoftKeysConfig()
|
|
{
|
|
Dictionary<int, List<DTOSoftKeyConfigModel>> output = new Dictionary<int, List<DTOSoftKeyConfigModel>>();
|
|
foreach (var softkey in SoftKeysConfig)
|
|
{
|
|
// Check if category exists
|
|
if (!output.ContainsKey(softkey.Category))
|
|
{
|
|
// Add category if not exits
|
|
output.Add(softkey.Category, new List< DTOSoftKeyConfigModel>());
|
|
}
|
|
|
|
// Create subkeys dictionary for group
|
|
Dictionary<int, string> tmpSubKey = new Dictionary<int, string>();
|
|
if (softkey.Type == SOFTKEY_TYPE.GROUP && softkey.SubKeys != null)
|
|
{
|
|
tmpSubKey = new Dictionary<int, string>();
|
|
foreach (var subkey in softkey.SubKeys)
|
|
{
|
|
tmpSubKey.Add(subkey.Id, subkey.Text);
|
|
}
|
|
}
|
|
// Add to the category the new softkey
|
|
output[softkey.Category].Add(new DTOSoftKeyConfigModel()
|
|
{
|
|
Id = softkey.Id,
|
|
Category = softkey.Category,
|
|
OperatorConfirmationNeeded = softkey.OperatorConfirmationNeeded,
|
|
Type = softkey.Type,
|
|
SubKeys = tmpSubKey
|
|
});
|
|
|
|
}
|
|
|
|
return Ok(output);
|
|
}
|
|
|
|
[Route("heads"), HttpGet]
|
|
public IHttpActionResult GetHeadConfig()
|
|
{
|
|
return Ok(HeadsConfig);
|
|
}
|
|
}
|
|
} |