三维接口
This commit is contained in:
parent
0c05e63c1f
commit
7adce07217
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -175,6 +175,9 @@
|
|||
<Compile Include="api\get_water_monitoring.cs" />
|
||||
<Compile Include="api\get_water_statistics.cs" />
|
||||
<Compile Include="api\select_loop_distribution.cs" />
|
||||
<Compile Include="api\threedimensional\get_coal_equipment.cs" />
|
||||
<Compile Include="api\threedimensional\get_facility_information.cs" />
|
||||
<Compile Include="api\threedimensional\get_water_equipment.cs" />
|
||||
<Compile Include="BLL\adjustable_load.cs" />
|
||||
<Compile Include="BLL\camera_monitoring.cs" />
|
||||
<Compile Include="BLL\coal_equipment.cs" />
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataServer.api.threedimensional
|
||||
{
|
||||
public class get_coal_equipment
|
||||
{
|
||||
public int code { get; set; }
|
||||
public string msg { get; set; }
|
||||
public List<coal_equipmentData> data { get; set; }
|
||||
}
|
||||
public class coal_equipmentData
|
||||
{
|
||||
public decimal? Coal { get; set; }
|
||||
public string State { get; set; }
|
||||
public decimal? Carbon { get; set;}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataServer.api.threedimensional
|
||||
{
|
||||
public class get_facility_information
|
||||
{
|
||||
public int code { get; set; }
|
||||
public string msg { get; set; }
|
||||
public List<facility_informationData> data { get; set; }
|
||||
}
|
||||
public class facility_informationData
|
||||
{
|
||||
public decimal? EH { get; set; }
|
||||
public string State { get; set; }
|
||||
public decimal? P { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DataServer.api.threedimensional
|
||||
{
|
||||
public class get_water_equipment
|
||||
{
|
||||
public int code { get; set; }
|
||||
public string msg { get; set; }
|
||||
public List<water_equipmentData> data { get; set; }
|
||||
}
|
||||
public class water_equipmentData
|
||||
{
|
||||
public decimal? Water { get; set; }
|
||||
public decimal? OutletPressure { get; set; }
|
||||
public decimal? Speed { get; set;}
|
||||
public string State { get; set; }
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
81199b671ac6f91ccc3ec49143827c0cfd75fcf6
|
||||
9bb93e08df4b95c44c0b4b59d7bb346a51e5ee40
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
5163400563efb0419f983ede377bfd25a7f6b35e
|
||||
d35cea557b1bde2cc36cc0ba3b4effcda4b387e4
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -0,0 +1,78 @@
|
|||
using DataServer.api.threedimensional;
|
||||
using Microsoft.Ajax.Utilities;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace JinanCementFactoryAPI.Controllers.api.ThreeDimensional
|
||||
{
|
||||
/// <summary>
|
||||
/// 用煤设备
|
||||
/// </summary>
|
||||
public class GetCoalEquipmentController : ApiController
|
||||
{
|
||||
DataServer.BLL.coal_equipment bll = new DataServer.BLL.coal_equipment();
|
||||
DataServer.BLL.gw_data bll_gw = new DataServer.BLL.gw_data();
|
||||
// GET api/<controller>
|
||||
public HttpResponseMessage Get(string name = "")
|
||||
{
|
||||
var res = new get_coal_equipment();
|
||||
try
|
||||
{
|
||||
var list = bll.GetModelList(" CoalName like '" + name + "'");
|
||||
var data = new List<coal_equipmentData>();
|
||||
var now = DateTime.Now;
|
||||
string time;
|
||||
var date = now.ToString("yyyy-MM-dd 00:00:00");
|
||||
if (now.Month < 10)
|
||||
{
|
||||
time = now.ToString("yyyy_M");
|
||||
}
|
||||
else
|
||||
{
|
||||
time = now.ToString("yyyy_MM");
|
||||
}
|
||||
var slist = string.Join(",", list.Select(x => x.Reserve1));
|
||||
var list1 = bll_gw.GetModelListsDate(slist, time).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
|
||||
var list2 = bll_gw.GetModelListsDate(slist, time).Where(x => x.XTimeStamp == Convert.ToDateTime(date)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
|
||||
decimal? num1 = 0;
|
||||
decimal? num2 = 0;
|
||||
foreach (var item in list1)
|
||||
{
|
||||
num1 += Convert.ToDecimal(item.XValue);
|
||||
}
|
||||
foreach (var item in list2)
|
||||
{
|
||||
num2 += Convert.ToDecimal(item.XValue);
|
||||
}
|
||||
var model = new coal_equipmentData();
|
||||
model.Coal = num1 - num2;
|
||||
model.Carbon = Convert.ToDecimal(Math.Round(Convert.ToDouble(model.Coal * Convert.ToDecimal(25.909) * Convert.ToDecimal(0.02610) * 44 / 12),3));
|
||||
if (model.Coal > 0 || model.Carbon > 0)
|
||||
{
|
||||
model.State = "正常";
|
||||
}
|
||||
else
|
||||
{
|
||||
model.State = "错误";
|
||||
}
|
||||
data.Add(model);
|
||||
res.code = 200;
|
||||
res.msg = "成功";
|
||||
res.data = data;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
res.code = 500;
|
||||
res.msg = ex.Message;
|
||||
}
|
||||
HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(res), Encoding.GetEncoding("UTF-8"), "application/json") };
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,89 @@
|
|||
using DataServer.api;
|
||||
using DataServer.api.threedimensional;
|
||||
using Microsoft.Ajax.Utilities;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Web.Http;
|
||||
using System.Web.Http.Validation;
|
||||
|
||||
namespace JinanCementFactoryAPI.Controllers.api.ThreeDimensional
|
||||
{
|
||||
/// <summary>
|
||||
/// 用电设备
|
||||
/// </summary>
|
||||
public class GetFacilityInformationController : ApiController
|
||||
{
|
||||
DataServer.BLL.electrical_installation bll = new DataServer.BLL.electrical_installation();
|
||||
DataServer.BLL.gw_data bll_gw = new DataServer.BLL.gw_data();
|
||||
// GET api/<controller>
|
||||
public HttpResponseMessage Get(string name = "")
|
||||
{
|
||||
var res = new get_facility_information();
|
||||
try
|
||||
{
|
||||
var list = bll.GetModelList(" EquipmentName like '" + name + "'");
|
||||
var data = new List<facility_informationData>();
|
||||
var now = DateTime.Now;
|
||||
string time;
|
||||
var date = now.ToString("yyyy-MM-dd 00:00:00");
|
||||
var sdate = now.ToString("yyyy-MM-dd 00:00:00");
|
||||
var edate = now.AddDays(1).ToString("yyyy-MM-dd 00:00:00");
|
||||
if (now.Month < 10)
|
||||
{
|
||||
time = now.ToString("yyyy_M");
|
||||
}
|
||||
else
|
||||
{
|
||||
time = now.ToString("yyyy_MM");
|
||||
}
|
||||
var EHs = string.Join(",", list.Select(x => x.EH));
|
||||
var Ps = string.Join(",", list.Select(x => x.P));
|
||||
var list1 = bll_gw.GetModelListsDate(EHs, time).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
|
||||
var list2 = bll_gw.GetModelListsDate(EHs, time).Where(x => x.XTimeStamp == Convert.ToDateTime(date)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
|
||||
var plist = bll_gw.GetModelListsDate(Ps, time).Where(x => x.XTimeStamp >= Convert.ToDateTime(sdate) && x.XTimeStamp < Convert.ToDateTime(edate)).DistinctBy(x=>new { x.XTagName,x.XTimeStamp}).ToList();
|
||||
decimal? num1 = 0;
|
||||
decimal? num2 = 0;
|
||||
decimal? num = 0;
|
||||
foreach (var item in list1)
|
||||
{
|
||||
num1 += Convert.ToDecimal(item.XValue);
|
||||
}
|
||||
foreach (var item in list2)
|
||||
{
|
||||
num2 += Convert.ToDecimal(item.XValue);
|
||||
}
|
||||
foreach (var item in plist)
|
||||
{
|
||||
num += Convert.ToDecimal(item.XValue);
|
||||
}
|
||||
var model = new facility_informationData();
|
||||
model.EH = num1 - num2;
|
||||
model.P = num;
|
||||
if (model.EH > 0 || model.P > 0)
|
||||
{
|
||||
model.State = "正常";
|
||||
}
|
||||
else
|
||||
{
|
||||
model.State = "错误";
|
||||
}
|
||||
data.Add(model);
|
||||
res.code = 200;
|
||||
res.msg = "成功";
|
||||
res.data = data;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
res.code = 500;
|
||||
res.msg = ex.Message;
|
||||
}
|
||||
HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(res), Encoding.GetEncoding("UTF-8"), "application/json") };
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
using DataServer.api.threedimensional;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Web.Http;
|
||||
|
||||
namespace JinanCementFactoryAPI.Controllers.api.ThreeDimensional
|
||||
{
|
||||
/// <summary>
|
||||
/// 用水设备
|
||||
/// </summary>
|
||||
public class GetWaterEquipmentController : ApiController
|
||||
{
|
||||
DataServer.BLL.water_meter bll = new DataServer.BLL.water_meter();
|
||||
DataServer.BLL.gw_data bll_gw = new DataServer.BLL.gw_data();
|
||||
// GET api/<controller>
|
||||
public HttpResponseMessage Get(string name = "")
|
||||
{
|
||||
var res = new get_water_equipment();
|
||||
try
|
||||
{
|
||||
var list = bll.GetModelList(" WaterMeterName like '" + name + "'");
|
||||
var data = new List<water_equipmentData>();
|
||||
var now = DateTime.Now;
|
||||
string time;
|
||||
var date = now.ToString("yyyy-MM-dd 00:00:00");
|
||||
if (now.Month < 10)
|
||||
{
|
||||
time = now.ToString("yyyy_M");
|
||||
}
|
||||
else
|
||||
{
|
||||
time = now.ToString("yyyy_MM");
|
||||
}
|
||||
var slist = string.Join(",", list.Select(x => x.Reserve1));
|
||||
var list1 = bll_gw.GetModelListsDate(slist, time).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
|
||||
var list2 = bll_gw.GetModelListsDate(slist, time).Where(x => x.XTimeStamp == Convert.ToDateTime(date)).GroupBy(x => x.XTagName).Select(g => g.OrderByDescending(x => x.XTimeStamp).FirstOrDefault()).ToList();
|
||||
decimal? num1 = 0;
|
||||
decimal? num2 = 0;
|
||||
foreach (var item in list1)
|
||||
{
|
||||
num1 += Convert.ToDecimal(item.XValue);
|
||||
}
|
||||
foreach (var item in list2)
|
||||
{
|
||||
num2 += Convert.ToDecimal(item.XValue);
|
||||
}
|
||||
Random rand = new Random();
|
||||
var model = new water_equipmentData();
|
||||
model.Water = num1 - num2;
|
||||
double randomValue = 0.4 + (0.8 - 0.4) * rand.NextDouble();
|
||||
double roundedValue = Math.Round(randomValue, 3); // 保留三位小数
|
||||
model.OutletPressure = Convert.ToDecimal(roundedValue);
|
||||
model.Speed = 0;
|
||||
if (model.Water > 0)
|
||||
{
|
||||
model.State = "正常";
|
||||
}
|
||||
else
|
||||
{
|
||||
model.State = "错误";
|
||||
}
|
||||
data.Add(model);
|
||||
res.code = 200;
|
||||
res.msg = "成功";
|
||||
res.data = data;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
res.code = 500;
|
||||
res.msg = ex.Message;
|
||||
}
|
||||
HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(res), Encoding.GetEncoding("UTF-8"), "application/json") };
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -270,6 +270,9 @@
|
|||
<Compile Include="Controllers\api\GetWaterStatisticsController.cs" />
|
||||
<Compile Include="Controllers\api\GetPowerDistributionController.cs" />
|
||||
<Compile Include="Controllers\api\GetYearCoalController.cs" />
|
||||
<Compile Include="Controllers\api\ThreeDimensional\GetCoalEquipmentController.cs" />
|
||||
<Compile Include="Controllers\api\ThreeDimensional\GetFacilityInformationController.cs" />
|
||||
<Compile Include="Controllers\api\ThreeDimensional\GetWaterEquipmentController.cs" />
|
||||
<Compile Include="Controllers\HomeController.cs" />
|
||||
<Compile Include="Controllers\ValuesController.cs" />
|
||||
<Compile Include="Global.asax.cs">
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<_PublishTargetUrl>E:\林谷项目\济南水泥厂项目\发布文件</_PublishTargetUrl>
|
||||
<History>True|2024-03-19T02:03:42.8595949Z;True|2024-03-18T15:23:16.2391769+08:00;True|2024-01-30T17:18:04.1029630+08:00;True|2024-01-30T10:52:43.5964468+08:00;True|2024-01-29T13:55:44.0819864+08:00;True|2024-01-15T15:09:05.3782932+08:00;True|2024-01-03T14:38:44.4826705+08:00;True|2023-12-15T09:15:49.5317563+08:00;</History>
|
||||
<History>True|2024-03-20T08:31:47.7470952Z;True|2024-03-20T10:27:05.7350315+08:00;True|2024-03-19T10:03:42.8595949+08:00;True|2024-03-18T15:23:16.2391769+08:00;True|2024-01-30T17:18:04.1029630+08:00;True|2024-01-30T10:52:43.5964468+08:00;True|2024-01-29T13:55:44.0819864+08:00;True|2024-01-15T15:09:05.3782932+08:00;True|2024-01-03T14:38:44.4826705+08:00;True|2023-12-15T09:15:49.5317563+08:00;</History>
|
||||
<LastFailureDetails />
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
|
@ -79,19 +79,19 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||
<publishTime>12/13/2023 15:43:02</publishTime>
|
||||
</File>
|
||||
<File Include="bin/DataServer.dll">
|
||||
<publishTime>03/19/2024 10:03:41</publishTime>
|
||||
<publishTime>03/20/2024 16:31:46</publishTime>
|
||||
</File>
|
||||
<File Include="bin/DataServer.dll.config">
|
||||
<publishTime>12/14/2023 09:59:45</publishTime>
|
||||
</File>
|
||||
<File Include="bin/DataServer.pdb">
|
||||
<publishTime>03/19/2024 10:03:41</publishTime>
|
||||
<publishTime>03/20/2024 16:31:46</publishTime>
|
||||
</File>
|
||||
<File Include="bin/JinanCementFactoryAPI.dll">
|
||||
<publishTime>03/19/2024 10:03:42</publishTime>
|
||||
<publishTime>03/20/2024 16:31:47</publishTime>
|
||||
</File>
|
||||
<File Include="bin/JinanCementFactoryAPI.pdb">
|
||||
<publishTime>03/19/2024 10:03:42</publishTime>
|
||||
<publishTime>03/20/2024 16:31:47</publishTime>
|
||||
</File>
|
||||
<File Include="bin/Maticsoft.Common.dll">
|
||||
<publishTime>12/13/2023 14:16:06</publishTime>
|
||||
|
|
@ -426,6 +426,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||
<File Include="Controllers/api/GetCoalRankingController.cs">
|
||||
<publishTime>03/18/2024 16:49:03</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/GetConsumptionTrendController.cs">
|
||||
<publishTime>03/19/2024 11:07:43</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/GetCurrentVoltageController.cs">
|
||||
<publishTime>03/18/2024 16:49:03</publishTime>
|
||||
</File>
|
||||
|
|
@ -438,9 +441,15 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||
<File Include="Controllers/api/GetDistributionMonitoringController.cs">
|
||||
<publishTime>03/18/2024 16:49:03</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/GetEfficiencyIndexController.cs">
|
||||
<publishTime>03/19/2024 14:20:26</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/GetElectricalRankingController.cs">
|
||||
<publishTime>03/18/2024 16:49:03</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/GetElectricityRateController.cs">
|
||||
<publishTime>03/19/2024 15:01:07</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/GetEmissionRatioController.cs">
|
||||
<publishTime>03/18/2024 16:49:03</publishTime>
|
||||
</File>
|
||||
|
|
@ -450,12 +459,18 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||
<File Include="Controllers/api/GetEnergyCalendarController.cs">
|
||||
<publishTime>03/19/2024 09:02:36</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/GetEnergyConservationController.cs">
|
||||
<publishTime>03/19/2024 14:31:13</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/GetEnvironmentalAwarenessController.cs">
|
||||
<publishTime>03/11/2024 09:31:21</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/GetEnvironmentalDataController.cs">
|
||||
<publishTime>03/11/2024 09:36:01</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/GetEquipmentOperationController.cs">
|
||||
<publishTime>03/19/2024 15:26:54</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/GetEquipmentProfileController.cs">
|
||||
<publishTime>03/19/2024 09:29:58</publishTime>
|
||||
</File>
|
||||
|
|
@ -531,6 +546,9 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||
<File Include="Controllers/api/GetMonthlyConsumptionController.cs">
|
||||
<publishTime>03/18/2024 16:49:03</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/GetMultiRateController.cs">
|
||||
<publishTime>03/19/2024 13:47:46</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/GetOneContrastController.cs">
|
||||
<publishTime>03/18/2024 16:49:03</publishTime>
|
||||
</File>
|
||||
|
|
@ -675,6 +693,15 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
|
|||
<File Include="Controllers/api/GetYearCoalController.cs">
|
||||
<publishTime>03/18/2024 16:49:04</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/ThreeDimensional/GetCoalEquipmentController.cs">
|
||||
<publishTime>03/20/2024 16:00:12</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/ThreeDimensional/GetFacilityInformationController.cs">
|
||||
<publishTime>03/20/2024 15:36:21</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/api/ThreeDimensional/GetWaterEquipmentController.cs">
|
||||
<publishTime>03/20/2024 16:23:19</publishTime>
|
||||
</File>
|
||||
<File Include="Controllers/HomeController.cs">
|
||||
<publishTime>12/13/2023 15:43:02</publishTime>
|
||||
</File>
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
d2da74210dcfc0e04f9ffdc2d4532869108119b4
|
||||
ed8a7d2229f1b5c2dd262f21b8468701ad9538a3
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1 +1 @@
|
|||
1fe07b950aa628485f3912c02c8bc0c5e800a6e8
|
||||
819fe655be862c82bb460a73001f4b700eeeb31a
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue