Preliminary models added to test
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Thermo.Active.Model.DTOModels.Recipe
|
||||
{
|
||||
public class DTOModule
|
||||
{
|
||||
public int Id { get; set; } = 0;
|
||||
public int ActualDuration { get; set; } = 0;
|
||||
public int ActualDelay { get; set; } = 0;
|
||||
public int EstimDuration { get; set; } = 0;
|
||||
public int EstimDelay { get; set; } = 0;
|
||||
public List<int> PrevModId { get; set; } = new List<int>();
|
||||
public RBStatus Status { get; set; }
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is DTOModule item))
|
||||
return false;
|
||||
|
||||
if (Id!= item.Id)
|
||||
return false;
|
||||
if (ActualDuration != item.ActualDuration)
|
||||
return false;
|
||||
if (ActualDelay != item.ActualDelay)
|
||||
return false;
|
||||
if (PrevModId != item.PrevModId)
|
||||
return false;
|
||||
if (EstimDelay != item.EstimDelay)
|
||||
return false;
|
||||
if (!Status.Equals(item.Status))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
public struct RBStatus
|
||||
{
|
||||
public bool Visible { get; set; }
|
||||
public bool Executing { get; set; }
|
||||
public bool HasError { get; set; }
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is RBStatus item))
|
||||
return false;
|
||||
|
||||
if (Visible != item.Visible)
|
||||
return false;
|
||||
if (Executing != item.Executing)
|
||||
return false;
|
||||
if (HasError != item.HasError)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Thermo.Active.Model.DTOModels.Recipe
|
||||
{
|
||||
public class DTOModuleConfigModel
|
||||
{
|
||||
public int Id;
|
||||
public string Label;
|
||||
public BlockType Type;
|
||||
public BlockSection Section;
|
||||
public int IdMainParam = -1; // -1 = non visibile
|
||||
public bool DelayVisible;
|
||||
public int VisualPriority;
|
||||
}
|
||||
|
||||
public enum BlockType
|
||||
{
|
||||
HEATING,
|
||||
DRAWING,
|
||||
MOVEMENT,
|
||||
VACUUM,
|
||||
COOLING,
|
||||
EXTRACTION
|
||||
}
|
||||
public enum BlockSection
|
||||
{
|
||||
HEATING,
|
||||
FORMING,
|
||||
EXTRACTION
|
||||
}
|
||||
}
|
||||
@@ -102,6 +102,8 @@
|
||||
<Compile Include="DTOModels\DTOAxesModel.cs" />
|
||||
<Compile Include="DTOModels\DTOAxisNameModel.cs" />
|
||||
<Compile Include="DTOModels\DTOClientConfigurationModel.cs" />
|
||||
<Compile Include="DTOModels\Recipe\DTOModule.cs" />
|
||||
<Compile Include="DTOModels\Recipe\DTOModuleConfigModel.cs" />
|
||||
<Compile Include="DTOModels\Recipe\DTORecipeParam.cs" />
|
||||
<Compile Include="DTOModels\Recipe\DTORecipeConfigModel .cs" />
|
||||
<Compile Include="DTOModels\DTONetworkMonitor.cs" />
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
using CMS_CORE_Library.Models;
|
||||
using Thermo.Active.Model.DTOModels;
|
||||
using Thermo.Active.NC;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web.Http;
|
||||
using static CMS_CORE_Library.Models.DataStructures;
|
||||
using static Thermo.Active.Config.ServerConfig;
|
||||
using static Thermo.Active.Model.Constants;
|
||||
using Thermo.Active.Model.DTOModels.Recipe;
|
||||
|
||||
namespace Thermo.Active.Controllers.WebApi
|
||||
{
|
||||
[RoutePrefix("api/ModBlock")]
|
||||
public class ModulesController : ApiController
|
||||
{
|
||||
[Route("current"), HttpGet]
|
||||
public IHttpActionResult GetModules()
|
||||
{
|
||||
using (NcAdapter ncAdapter = new NcAdapter())
|
||||
{
|
||||
// Try connection
|
||||
CmsError libraryError = ncAdapter.Connect();
|
||||
if (libraryError.errorCode != 0)
|
||||
return NotFound();
|
||||
|
||||
CmsError cmsError = ncAdapter.ReadFullRecipe(out Dictionary<string, DTORecipeParam> currRecipe);
|
||||
if (cmsError.IsError())
|
||||
return BadRequest(cmsError.localizationKey);
|
||||
|
||||
return Ok(currRecipe);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -222,6 +222,7 @@
|
||||
<Compile Include="Attributes\SignalRAuthorizeAttribute.cs" />
|
||||
<Compile Include="Controllers\SignalR\NcHub.cs" />
|
||||
<Compile Include="Controllers\WebApi\ApiAlarmController.cs" />
|
||||
<Compile Include="Controllers\WebApi\ModulesController.cs" />
|
||||
<Compile Include="Controllers\WebApi\RecipeController.cs" />
|
||||
<Compile Include="Controllers\WebApi\AuthorizationController.cs" />
|
||||
<Compile Include="Controllers\WebApi\CmsConnectController.cs" />
|
||||
|
||||
Reference in New Issue
Block a user