Реализовано взаимодействие со SCADA Fuxa
This commit is contained in:
parent
22aeb49964
commit
718ac5621b
@ -1,4 +1,5 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace ApiServer.Controllers
|
||||
{
|
||||
@ -6,22 +7,30 @@ namespace ApiServer.Controllers
|
||||
[Route("api/state")]
|
||||
public class StateContoller
|
||||
{
|
||||
[HttpGet]
|
||||
public byte GetActualState()
|
||||
{
|
||||
return GetActualStateFromCom.CurrentState;
|
||||
}
|
||||
//[HttpGet]
|
||||
//public byte GetActualState()
|
||||
//{
|
||||
// return GetActualStateFromCom.CurrentState;
|
||||
//}
|
||||
|
||||
[HttpGet]
|
||||
[Route("modbus")]
|
||||
public ActionResult<bool> GetActualState(int inputIndex)
|
||||
[Produces("application/json")]
|
||||
public JsonResult GetActualState()
|
||||
{
|
||||
if (inputIndex > 1)
|
||||
{
|
||||
return new NotFoundResult();
|
||||
//if (inputIndex > 1)
|
||||
//{
|
||||
//return new NotFoundResult();
|
||||
//throw new ArgumentOutOfRangeException(nameof(inputIndex), "Значение может быть от 0 до 1 включительно.");
|
||||
}
|
||||
return GetActualStateFromComWithModbus.CurrentState[inputIndex];
|
||||
//}
|
||||
var inputIndex = 1;
|
||||
var result = GetActualStateFromComWithModbus.CurrentState[inputIndex]
|
||||
? 1
|
||||
: 0;
|
||||
|
||||
var obj = new { CoilResult = result };
|
||||
|
||||
return new JsonResult(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
"windowsAuthentication": false,
|
||||
"anonymousAuthentication": true,
|
||||
"iisExpress": {
|
||||
"applicationUrl": "http://localhost:3819",
|
||||
"applicationUrl": "http://0.0.0.0:3819",
|
||||
"sslPort": 0
|
||||
}
|
||||
},
|
||||
@ -14,7 +14,7 @@
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "http://localhost:12344",
|
||||
"applicationUrl": "http://0.0.0.0:12344",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
}
|
||||
|
1
CyberSystem/fuxa-project.json
Normal file
1
CyberSystem/fuxa-project.json
Normal file
@ -0,0 +1 @@
|
||||
{"devices":{"0":{"id":"0","name":"FUXA Server","type":"FuxaServer","property":{},"enabled":true,"tags":{"t_f76a7b7e-ea8e4178":{"id":"t_f76a7b7e-ea8e4178","daq":{"restored":false,"enabled":false,"changed":false,"interval":60},"name":"Maser Connection Status","label":"Maser Connection Status","type":"number","memaddress":"d_cf82a6fa-17b24fab","sysType":1,"init":"","timestamp":1716223999827}},"polling":1000},"d_cf82a6fa-17b24fab":{"id":"d_cf82a6fa-17b24fab","property":{"address":"http://172.20.10.2:12344/api/state/modbus","port":null,"slot":null,"rack":null,"baudrate":9600,"databits":8,"stopbits":1,"parity":"None","method":"GET","format":"JSON"},"enabled":true,"tags":{"t_b5de94c1-5efd4df9":{"id":"t_b5de94c1-5efd4df9","daq":{"restored":false,"enabled":false,"changed":false,"interval":60},"name":"coilResult","label":"coilResult","type":"boolean","address":"coilResult","timestamp":1716223999840}},"name":"Master","type":"WebAPI","polling":1000}},"hmi":{"views":[{"id":"v_71057412b12-8119b","name":"MainView","profile":{"width":1024,"height":768,"bkcolor":"#ffffffff","margin":10},"items":{"HXT_94d610d6-0245443c":{"id":"HXT_94d610d6-0245443c","type":"svg-ext-html_switch","name":"switch_1","property":{"events":[],"actions":[],"variableId":"t_b5de94c1-5efd4df9","options":{"offValue":0,"onValue":1,"offBackground":"#ccc","onBackground":"#ccc","offText":"","onText":"","offSliderColor":"#fff","onSliderColor":"#0CC868","offTextColor":"#000","onTextColor":"#fff","fontSize":12,"fontFamily":"","radius":0,"height":22}},"label":"HtmlSwitch"}},"variables":{},"svgcontent":"<svg width=\"1024\" height=\"768\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:svg=\"http://www.w3.org/2000/svg\" xmlns:html=\"http://www.w3.org/1999/xhtml\">\n <filter id=\"blur-filter\" x=\"-3\" y=\"-3\" width=\"200\" height=\"200\">\n <feGaussianBlur stdDeviation=\"3\"/>\n </filter>\n <g>\n <title>Layer 1</title>\n <g data-name=\"switch_1\" id=\"HXT_94d610d6-0245443c\" type=\"svg-ext-html_switch\" fill=\"rgba(0,0,0,0)\" stroke=\"rgba(0,0,0,0)\">\n <rect stroke-width=\"0\" x=\"160\" y=\"166\" width=\"50\" height=\"28\" id=\"svg_5952492e-ff7f44c8\"/>\n <foreignObject x=\"160\" y=\"166\" height=\"28\" width=\"50\" id=\"H-HXT_62e91778-21d74eb1\">\n <LABEL style=\"width:calc(100% - 6px);height:calc(100% - 6px);text-align:center;background-color:#FFFFFF;color:#000000;margin: 3px 3px 3px 3px;\" class=\"md-switch\" id=\"T-HXT_62e91778-21d74eb1\">\n <NGX-SWITCH class=\"ng-star-inserted\">\n <LABEL style=\"border-radius: 0px;\" class=\"md-switch\">\n <DIV style=\"background-color: rgb(204, 204, 204);\" class=\"toggle-button\">\n <INPUT type=\"checkbox\"/>\n <DIV style=\"text-align: center; line-height: 22px; font-size: 12px; background-color: rgb(255, 255, 255); color: rgb(0, 0, 0);\" class=\"inner-circle\"></DIV>\n </DIV>\n </LABEL>\n </NGX-SWITCH>\n </LABEL>\n </foreignObject>\n </g>\n </g>\n</svg>"}],"layout":{"autoresize":false,"start":"v_71057412b12-8119b","navigation":{"bkcolor":"#F4F5F7","fgcolor":"#1D1D1D","logo":false,"mode":"over","type":"block"},"header":{"bkcolor":"#ffffff","fgcolor":"#000000","fontSize":13,"itemsAnchor":"left"},"showdev":true,"inputdialog":"false","hidenavigation":false,"theme":"","loginonstart":false,"loginoverlaycolor":"none","show_connection_error":true}},"version":"1.00","server":{"id":"0","name":"FUXA Server","type":"FuxaServer","property":{}}}
|
Loading…
Reference in New Issue
Block a user