修改总用水量与总用电量

main
肖果 2 months ago
parent 98d4563571
commit cc2e1bec43

@ -66,6 +66,12 @@ namespace GuideScreen.Common.Repositories
/// <returns></returns> /// <returns></returns>
decimal WaterTotal(); decimal WaterTotal();
/// <summary>
/// 获取总用电量
/// </summary>
/// <returns></returns>
decimal ElectricityTotal();
/// <summary> /// <summary>
/// 获取厕位使用计 /// 获取厕位使用计
/// </summary> /// </summary>

@ -321,8 +321,24 @@ namespace GuideScreen.Common.Repositories.Impl
{ {
using (var context = GSDBContext.GetDbContext()) using (var context = GSDBContext.GetDbContext())
{ {
var val = context.PLCDeviceRecordDayEntities.Where(f => f.PointName == PLCPointNameByEnergyMonitoring.WaterConsumption).Sum(f => (decimal?)f.RecordValue); // var val = context.PLCDeviceRecordDayEntities.Where(f => f.PointName == PLCPointNameByEnergyMonitoring.WaterConsumption).Sum(f => (decimal?)f.RecordValue);
//根据侧位数量计算
var val = context.PLCDeviceRecordDayEntities.Where(f => f.DeviceName == PLCDeviceNames.ToiletPosition).Sum(f => (decimal?)f.RecordValue);
return val ?? 0;
}
}
/// <summary>
/// 获取总用电量
/// </summary>
/// <returns></returns>
public decimal ElectricityTotal()
{
using (var context = GSDBContext.GetDbContext())
{
//var val = context.PLCDeviceRecordDayEntities.Where(f => f.PointName == PLCPointNameByEnergyMonitoring.ElectricityConsumption).Sum(f => (decimal?)f.RecordValue);
//根据侧位数量计算
var val = context.PLCDeviceRecordDayEntities.Where(f => f.DeviceName == PLCDeviceNames.ToiletPosition).Sum(f => (decimal?)f.RecordValue);
return val ?? 0; return val ?? 0;
} }
} }

@ -99,6 +99,12 @@ namespace GuideScreen.Common.Services
/// <returns></returns> /// <returns></returns>
decimal WaterTotal(); decimal WaterTotal();
/// <summary>
/// 获取总用电量
/// </summary>
/// <returns></returns>
decimal ElectricityTotal();
/// <summary> /// <summary>
/// 获取厕位使用计 /// 获取厕位使用计
/// </summary> /// </summary>

@ -135,6 +135,7 @@ namespace GuideScreen.Common.Services.Impl
DeviceName = PLCDeviceNames.EnergyMonitoring, DeviceName = PLCDeviceNames.EnergyMonitoring,
PointName = name, PointName = name,
PointNote = note, PointNote = note,
RecordValue = Convert.ToDecimal(value)
}; };
if (dateTime.HasValue) if (dateTime.HasValue)
{ {
@ -235,6 +236,17 @@ namespace GuideScreen.Common.Services.Impl
return ret; return ret;
} }
/// <summary>
/// 获取总用电量
/// </summary>
/// <returns></returns>
public decimal ElectricityTotal()
{
var ret = this.deviceRecordRepository.ElectricityTotal();
return ret;
}
/// <summary> /// <summary>
/// 获取厕位使用计 /// 获取厕位使用计
/// </summary> /// </summary>

@ -235,44 +235,44 @@ namespace GuideScreen.Common.Services.Impl
/// <summary> /// <summary>
/// 获取今日用电量 /// 获取今日用电量
/// </summary> /// </summary>
public float GetTodayElectricityConsumption(float total) //public float GetTodayElectricityConsumption(float total)
{ //{
//获取昨天用电总量 // //获取昨天用电总量
decimal yesterday = deviceRecordService.GetEnergyMonitoringByDay(PLCPointNameByEnergyMonitoring.ElectricityConsumption, DateTime.Now.AddDays(-1)); // decimal yesterday = deviceRecordService.GetEnergyMonitoringByDay(PLCPointNameByEnergyMonitoring.ElectricityConsumption, DateTime.Now.AddDays(-1));
//如果昨日没有记录或为0,就将当前用电量添加当昨日防止今日用电量为0 // //如果昨日没有记录或为0,就将当前用电量添加当昨日防止今日用电量为0
if (yesterday > 0) // if (yesterday > 0)
{ // {
return total - float.Parse(yesterday.ToString()); // return total - float.Parse(yesterday.ToString());
} // }
else // else
{ // {
deviceRecordService.UpdateEnergyMonitoringByToday(PLCPointNameByEnergyMonitoring.ElectricityConsumption, "用电量", total, DateTime.Now.AddDays(-1)); // deviceRecordService.UpdateEnergyMonitoringByToday(PLCPointNameByEnergyMonitoring.ElectricityConsumption, "用电量", total, DateTime.Now.AddDays(-1));
} // }
return 0; // return 0;
} //}
/// <summary> /// <summary>
/// 获取今日用水量 /// 获取今日用水量
/// </summary> /// </summary>
public float GetTodayWarterConsumption(float total) //public float GetTodayWarterConsumption(float total)
{ //{
//获取昨天用电总量 // //获取昨天用电总量
decimal yesterday = deviceRecordService.GetEnergyMonitoringByDay(PLCPointNameByEnergyMonitoring.WaterConsumption, DateTime.Now.AddDays(-1)); // decimal yesterday = deviceRecordService.GetEnergyMonitoringByDay(PLCPointNameByEnergyMonitoring.WaterConsumption, DateTime.Now.AddDays(-1));
//如果昨日没有记录或为0,就将当前用电量添加当昨日防止今日用电量为0 // //如果昨日没有记录或为0,就将当前用电量添加当昨日防止今日用电量为0
if (yesterday > 0) // if (yesterday > 0)
{ // {
return total - float.Parse(yesterday.ToString()); // return total - float.Parse(yesterday.ToString());
} // }
else // else
{ // {
deviceRecordService.UpdateEnergyMonitoringByToday(PLCPointNameByEnergyMonitoring.WaterConsumption, "用水量", total, DateTime.Now.AddDays(-1)); // deviceRecordService.UpdateEnergyMonitoringByToday(PLCPointNameByEnergyMonitoring.WaterConsumption, "用水量", total, DateTime.Now.AddDays(-1));
} // }
return 0; // return 0;
} //}
/// <summary> /// <summary>
/// 获取总用水量 /// 获取总用水量
/// </summary> /// </summary>
@ -286,5 +286,19 @@ namespace GuideScreen.Common.Services.Impl
} }
return value; return value;
} }
/// <summary>
/// 获取总用电量
/// </summary>
/// <returns></returns>
public decimal GetElectricityTotal()
{
var value = deviceRecordService.ElectricityTotal();
if (value > 0)
{
value = Math.Round(value, 2);
}
return value;
}
} }
} }

@ -432,9 +432,9 @@ namespace GuideScreen.UI
// //
this.lblWaterMeter.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold); this.lblWaterMeter.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold);
this.lblWaterMeter.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(65)))), ((int)(((byte)(128)))), ((int)(((byte)(195))))); this.lblWaterMeter.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(65)))), ((int)(((byte)(128)))), ((int)(((byte)(195)))));
this.lblWaterMeter.Location = new System.Drawing.Point(210, 241); this.lblWaterMeter.Location = new System.Drawing.Point(216, 241);
this.lblWaterMeter.Name = "lblWaterMeter"; this.lblWaterMeter.Name = "lblWaterMeter";
this.lblWaterMeter.Size = new System.Drawing.Size(79, 38); this.lblWaterMeter.Size = new System.Drawing.Size(144, 38);
this.lblWaterMeter.Style = Sunny.UI.UIStyle.Custom; this.lblWaterMeter.Style = Sunny.UI.UIStyle.Custom;
this.lblWaterMeter.StyleCustomMode = true; this.lblWaterMeter.StyleCustomMode = true;
this.lblWaterMeter.TabIndex = 19; this.lblWaterMeter.TabIndex = 19;
@ -446,7 +446,7 @@ namespace GuideScreen.UI
// //
this.uiLabel21.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold); this.uiLabel21.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold);
this.uiLabel21.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(65)))), ((int)(((byte)(128)))), ((int)(((byte)(195))))); this.uiLabel21.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(65)))), ((int)(((byte)(128)))), ((int)(((byte)(195)))));
this.uiLabel21.Location = new System.Drawing.Point(203, 210); this.uiLabel21.Location = new System.Drawing.Point(228, 210);
this.uiLabel21.Name = "uiLabel21"; this.uiLabel21.Name = "uiLabel21";
this.uiLabel21.Size = new System.Drawing.Size(93, 38); this.uiLabel21.Size = new System.Drawing.Size(93, 38);
this.uiLabel21.Style = Sunny.UI.UIStyle.Custom; this.uiLabel21.Style = Sunny.UI.UIStyle.Custom;
@ -460,9 +460,9 @@ namespace GuideScreen.UI
// //
this.lblElectricityMeter.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold); this.lblElectricityMeter.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold);
this.lblElectricityMeter.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(65)))), ((int)(((byte)(128)))), ((int)(((byte)(195))))); this.lblElectricityMeter.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(65)))), ((int)(((byte)(128)))), ((int)(((byte)(195)))));
this.lblElectricityMeter.Location = new System.Drawing.Point(69, 241); this.lblElectricityMeter.Location = new System.Drawing.Point(22, 241);
this.lblElectricityMeter.Name = "lblElectricityMeter"; this.lblElectricityMeter.Name = "lblElectricityMeter";
this.lblElectricityMeter.Size = new System.Drawing.Size(79, 38); this.lblElectricityMeter.Size = new System.Drawing.Size(191, 38);
this.lblElectricityMeter.Style = Sunny.UI.UIStyle.Custom; this.lblElectricityMeter.Style = Sunny.UI.UIStyle.Custom;
this.lblElectricityMeter.StyleCustomMode = true; this.lblElectricityMeter.StyleCustomMode = true;
this.lblElectricityMeter.TabIndex = 17; this.lblElectricityMeter.TabIndex = 17;
@ -474,7 +474,7 @@ namespace GuideScreen.UI
// //
this.uiLabel18.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold); this.uiLabel18.Font = new System.Drawing.Font("微软雅黑", 14.25F, System.Drawing.FontStyle.Bold);
this.uiLabel18.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(65)))), ((int)(((byte)(128)))), ((int)(((byte)(195))))); this.uiLabel18.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(65)))), ((int)(((byte)(128)))), ((int)(((byte)(195)))));
this.uiLabel18.Location = new System.Drawing.Point(56, 211); this.uiLabel18.Location = new System.Drawing.Point(55, 211);
this.uiLabel18.Name = "uiLabel18"; this.uiLabel18.Name = "uiLabel18";
this.uiLabel18.Size = new System.Drawing.Size(105, 38); this.uiLabel18.Size = new System.Drawing.Size(105, 38);
this.uiLabel18.Style = Sunny.UI.UIStyle.Custom; this.uiLabel18.Style = Sunny.UI.UIStyle.Custom;
@ -779,7 +779,7 @@ namespace GuideScreen.UI
// pictureBox10 // pictureBox10
// //
this.pictureBox10.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox10.Image"))); this.pictureBox10.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox10.Image")));
this.pictureBox10.Location = new System.Drawing.Point(219, 155); this.pictureBox10.Location = new System.Drawing.Point(244, 155);
this.pictureBox10.Name = "pictureBox10"; this.pictureBox10.Name = "pictureBox10";
this.pictureBox10.Size = new System.Drawing.Size(61, 52); this.pictureBox10.Size = new System.Drawing.Size(61, 52);
this.pictureBox10.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox10.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@ -799,7 +799,7 @@ namespace GuideScreen.UI
// pictureBox9 // pictureBox9
// //
this.pictureBox9.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox9.Image"))); this.pictureBox9.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox9.Image")));
this.pictureBox9.Location = new System.Drawing.Point(78, 155); this.pictureBox9.Location = new System.Drawing.Point(77, 155);
this.pictureBox9.Name = "pictureBox9"; this.pictureBox9.Name = "pictureBox9";
this.pictureBox9.Size = new System.Drawing.Size(61, 52); this.pictureBox9.Size = new System.Drawing.Size(61, 52);
this.pictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; this.pictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;

@ -1,4 +1,4 @@
using GuideScreen.Common; using GuideScreen.Common;
using GuideScreen.Common.Common; using GuideScreen.Common.Common;
using GuideScreen.Common.Constants; using GuideScreen.Common.Constants;
using GuideScreen.Common.Models; using GuideScreen.Common.Models;
@ -22,37 +22,37 @@ namespace GuideScreen.UI
{ {
public partial class FormScreen : UIForm public partial class FormScreen : UIForm
{ {
//男厕使用数量 //男厕使用数量
private const string currentManNumStrFormat = "5/{0}"; private const string currentManNumStrFormat = "5/{0}";
//女厕使用数量 //女厕使用数量
private const string currentWomanNumStrFormat = "3/{0}"; private const string currentWomanNumStrFormat = "3/{0}";
//零点 //零点
private const string zeroTime = "00:00:00"; private const string zeroTime = "00:00:00";
//通用 //通用
private CommonController commonController; private CommonController commonController;
//今日客流量 //今日客流量
private int passengerFlowDayTotal = 0; private int passengerFlowDayTotal = 0;
//客流统计 //客流统计
private PassengerFlowStatisticsController passengerFlowStatisticsController; private PassengerFlowStatisticsController passengerFlowStatisticsController;
//客流总量 //客流总量
private int passengerFlowTotal = 0; private int passengerFlowTotal = 0;
//PLC相关 //PLC相关
private PLCController plcController; private PLCController plcController;
//今日厕所侧位使用统计 //今日厕所侧位使用统计
private IDictionary<string, int> toilets; private IDictionary<string, int> toilets;
//真空度x坐标 //真空度x坐标
private int vacuumIndex = 0; private int vacuumIndex = 0;
//今日气象 //今日气象
private WeatherController weatherController; private WeatherController weatherController;
public FormScreen() public FormScreen()
@ -80,15 +80,15 @@ namespace GuideScreen.UI
{ {
switch (e.ClickedItem.Text) switch (e.ClickedItem.Text)
{ {
case "后台管理": case "后台管理":
ControlForm form = new ControlForm(); ControlForm form = new ControlForm();
form.ShowDialog(); form.ShowDialog();
break; break;
case "报表": case "报表":
ChartForm from = new ChartForm(); ChartForm from = new ChartForm();
from.ShowDialog(); from.ShowDialog();
break; break;
case "关闭": case "关闭":
Close(); Close();
break; break;
@ -96,14 +96,14 @@ namespace GuideScreen.UI
break; break;
} }
if (e.ClickedItem.Text == "关闭") if (e.ClickedItem.Text == "关闭")
{ {
Close(); Close();
} }
} }
/// <summary> /// <summary>
/// 错误信息 /// 错误信息
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
@ -115,7 +115,7 @@ namespace GuideScreen.UI
} }
/// <summary> /// <summary>
/// 错误提示框 /// 错误提示框
/// </summary> /// </summary>
/// <param name="errMsg"></param> /// <param name="errMsg"></param>
/// <param name="isDialog"></param> /// <param name="isDialog"></param>
@ -138,33 +138,33 @@ namespace GuideScreen.UI
{ {
try try
{ {
//加载 //加载
plcController.Load(); plcController.Load();
//获取标题 //获取标题
lblTitle.Text = commonController.Title; lblTitle.Text = commonController.Title;
//报警数据 //报警数据
this.txtAlarm.Text = commonController.AlarmText; this.txtAlarm.Text = commonController.AlarmText;
//开启PLC通信 //开启PLC通信
plcController.Start(); plcController.Start();
//今日厕位使用情况 //今日厕位使用情况
toilets = plcController.ToiletPositionRecordTotalByToday(); toilets = plcController.ToiletPositionRecordTotalByToday();
//总统计 //总统计
passengerFlowTotal = plcController.GetToiletRecordTotal(); passengerFlowTotal = plcController.GetToiletRecordTotal();
PassengerFlowUpdate(); PassengerFlowUpdate();
//真空度 //真空度
VacuumChart(0); VacuumChart(0);
//获取天气信息 //获取天气信息
await GetWeather(); await GetWeather();
//用水量 //用水量
SetDayWarterAndelEctricity(); SetDayWarterAndelEctricity();
} }
@ -174,7 +174,7 @@ namespace GuideScreen.UI
} }
} }
#region 获取点位更新 #region 获取点位更新
private void PlcController_PointChnage(object sender, PLCPoint e) private void PlcController_PointChnage(object sender, PLCPoint e)
{ {
@ -186,21 +186,21 @@ namespace GuideScreen.UI
} }
catch (Exception ex) catch (Exception ex)
{ {
ErrorDialog("获取点位错误:" + ex.Message); ErrorDialog("获取点位错误:" + ex.Message);
ex.WriteErrorLog(); ex.WriteErrorLog();
} }
})); }));
} }
#endregion 获取点位更新 #endregion 获取点位更新
#region 厕所是否有人 #region 厕所是否有人
private void ToileUseChange(bool isMan, int num, bool use) private void ToileUseChange(bool isMan, int num, bool use)
{ {
if (isMan) if (isMan)
{ {
//男厕使用数量 //男厕使用数量
var manNum = plcController.Points.Where(f => f.Name.StartsWith("ToiletMan") && f.GetValue<bool>()).Count(); var manNum = plcController.Points.Where(f => f.Name.StartsWith("ToiletMan") && f.GetValue<bool>()).Count();
lblCurrentManNum.Text = string.Format(currentManNumStrFormat, manNum); lblCurrentManNum.Text = string.Format(currentManNumStrFormat, manNum);
switch (num) switch (num)
@ -209,7 +209,7 @@ namespace GuideScreen.UI
if (use) if (use)
{ {
pBoxManPitOne.Visible = true; pBoxManPitOne.Visible = true;
toilets["男厕1"]++; toilets["男厕1"]++;
} }
else else
{ {
@ -222,7 +222,7 @@ namespace GuideScreen.UI
if (use) if (use)
{ {
pBoxManPitTwo.Visible = true; pBoxManPitTwo.Visible = true;
toilets["男厕2"]++; toilets["男厕2"]++;
} }
else else
{ {
@ -235,7 +235,7 @@ namespace GuideScreen.UI
if (use) if (use)
{ {
pBoxUrinateMan1.Image = Resources.urinateFull; pBoxUrinateMan1.Image = Resources.urinateFull;
toilets["男厕3"]++; toilets["男厕3"]++;
} }
else else
{ {
@ -247,7 +247,7 @@ namespace GuideScreen.UI
if (use) if (use)
{ {
pBoxUrinateMan2.Image = Resources.urinateFull; pBoxUrinateMan2.Image = Resources.urinateFull;
toilets["男厕4"]++; toilets["男厕4"]++;
} }
else else
{ {
@ -259,7 +259,7 @@ namespace GuideScreen.UI
if (use) if (use)
{ {
pBoxUrinateMan3.Image = Resources.urinateFull; pBoxUrinateMan3.Image = Resources.urinateFull;
toilets["男厕5"]++; toilets["男厕5"]++;
} }
else else
{ {
@ -273,7 +273,7 @@ namespace GuideScreen.UI
} }
else else
{ {
//女厕使用数量 //女厕使用数量
var womanNum = plcController.Points.Where(f => f.Name.StartsWith("ToiletWoman") && f.GetValue<bool>()).Count(); var womanNum = plcController.Points.Where(f => f.Name.StartsWith("ToiletWoman") && f.GetValue<bool>()).Count();
lblCurrentWomanNum.Text = string.Format(currentWomanNumStrFormat, womanNum); lblCurrentWomanNum.Text = string.Format(currentWomanNumStrFormat, womanNum);
switch (num) switch (num)
@ -282,7 +282,7 @@ namespace GuideScreen.UI
if (use) if (use)
{ {
pBoxPitWomanOne.Visible = true; pBoxPitWomanOne.Visible = true;
toilets["女厕1"]++; toilets["女厕1"]++;
} }
else else
{ {
@ -294,7 +294,7 @@ namespace GuideScreen.UI
if (use) if (use)
{ {
pBoxPitWomanTwo.Visible = true; pBoxPitWomanTwo.Visible = true;
toilets["女厕2"]++; toilets["女厕2"]++;
} }
else else
{ {
@ -306,7 +306,7 @@ namespace GuideScreen.UI
if (use) if (use)
{ {
pBoxPitWomanThree.Visible = true; pBoxPitWomanThree.Visible = true;
toilets["女厕3"]++; toilets["女厕3"]++;
} }
else else
{ {
@ -324,49 +324,49 @@ namespace GuideScreen.UI
passengerFlowTotal++; passengerFlowTotal++;
} }
//更新客流信息 //更新客流信息
PassengerFlowUpdate(); PassengerFlowUpdate();
// ToileUseChartByDay(); // ToileUseChartByDay();
// ToileUseChartTotal(); // ToileUseChartTotal();
//计算用水量 //计算用水量
SetDayWarterAndelEctricity(); SetDayWarterAndelEctricity();
} }
#endregion 厕所是否有人 #endregion 厕所是否有人
#region 气象相关 #region 气象相关
/// <summary> /// <summary>
/// 获取气象信息 /// 获取气象信息
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private async Task GetWeather() private async Task GetWeather()
{ {
//获取城市实时天气 //获取城市实时天气
var weatherModel = await weatherController.GetWeatherNowAsync(); var weatherModel = await weatherController.GetWeatherNowAsync();
//获取城市天气质量 //获取城市天气质量
var airModel = await weatherController.GetWeatherAirAsync(); var airModel = await weatherController.GetWeatherAirAsync();
//获取城市天气指数 //获取城市天气指数
var levelModel = await weatherController.GetWeatherIndicesAsync(); var levelModel = await weatherController.GetWeatherIndicesAsync();
this.Invoke(new Action(() => this.Invoke(new Action(() =>
{ {
//设置城市实时天气 //设置城市实时天气
if (weatherModel != null && weatherModel.IsSuccee) if (weatherModel != null && weatherModel.IsSuccee)
{ {
DateTime.TryParse(weatherModel.UpdateTime, out DateTime dt); DateTime.TryParse(weatherModel.UpdateTime, out DateTime dt);
//lblWeatherUpdateTime.Text = dt.ToString("yyyy-MM-dd HH:mm:ss"); //lblWeatherUpdateTime.Text = dt.ToString("yyyy-MM-dd HH:mm:ss");
lblWeatherText.Text = weatherModel.Now.Text; lblWeatherText.Text = weatherModel.Now.Text;
lblWeatherWindDir.Text = weatherModel.Now.WindDir; lblWeatherWindDir.Text = weatherModel.Now.WindDir;
lblWeatherWindScale.Text = weatherModel.Now.WindScale.ToString() + "级"; lblWeatherWindScale.Text = weatherModel.Now.WindScale.ToString() + "级";
lblWeatherHumidity.Text = weatherModel.Now.Humidity.ToString() + "%"; lblWeatherHumidity.Text = weatherModel.Now.Humidity.ToString() + "%";
lblWeatherFeelsLike.Text = weatherModel.Now.FeelsLike.ToString() + "C°"; lblWeatherFeelsLike.Text = weatherModel.Now.FeelsLike.ToString() + "C°";
lblWeatherTemp.Text = weatherModel.Now.Temp.ToString() + "C°"; lblWeatherTemp.Text = weatherModel.Now.Temp.ToString() + "C°";
var icon = weatherModel.Now.Icon; var icon = weatherModel.Now.Icon;
if (icon == 151) if (icon == 151)
{ {
@ -374,12 +374,12 @@ namespace GuideScreen.UI
} }
pBoxWeatherIcon.Image = (Image)(Resources.ResourceManager.GetObject($"_{icon}")); pBoxWeatherIcon.Image = (Image)(Resources.ResourceManager.GetObject($"_{icon}"));
} }
//设置城市天气质量 //设置城市天气质量
if (airModel != null && airModel.IsSuccee) if (airModel != null && airModel.IsSuccee)
{ {
WeatherAir(airModel); WeatherAir(airModel);
} }
//设置城市天气指数 //设置城市天气指数
if (levelModel != null && levelModel.IsSuccee && levelModel.Daily.Length == 2) if (levelModel != null && levelModel.IsSuccee && levelModel.Daily.Length == 2)
{ {
lblWeatherUltravioletRay.Text = levelModel.Daily[0].Category; lblWeatherUltravioletRay.Text = levelModel.Daily[0].Category;
@ -389,7 +389,7 @@ namespace GuideScreen.UI
} }
/// <summary> /// <summary>
/// 显示空气质量 /// 显示空气质量
/// </summary> /// </summary>
/// <param name="model"></param> /// <param name="model"></param>
private void WeatherAir(WeatherAirModel model) private void WeatherAir(WeatherAirModel model)
@ -428,12 +428,12 @@ namespace GuideScreen.UI
btnAQI.Text = "AQI " + model.Now.Category; btnAQI.Text = "AQI " + model.Now.Category;
} }
#endregion 气象相关 #endregion 气象相关
#region 人流统计 #region 人流统计
/// <summary> /// <summary>
/// 人流经过 /// 人流经过
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
@ -442,7 +442,7 @@ namespace GuideScreen.UI
} }
/// <summary> /// <summary>
/// 客流量更新 /// 客流量更新
/// </summary> /// </summary>
private void PassengerFlowUpdate() private void PassengerFlowUpdate()
{ {
@ -457,89 +457,89 @@ namespace GuideScreen.UI
passengerFlowTotal = 1; passengerFlowTotal = 1;
} }
// lblPassengerFlowHistoryCount.Text = passengerFlowTotal.ToString("D8").Aggregate(string.Empty, (c, i) => c + i + " "); // lblPassengerFlowHistoryCount.Text = passengerFlowTotal.ToString("D8").Aggregate(string.Empty, (c, i) => c + i + " ");
//侧位图表 //侧位图表
ToileUseChartByDay(); ToileUseChartByDay();
//ToileUseChartTotal(); //ToileUseChartTotal();
} }
#endregion 人流统计 #endregion 人流统计
#region PLC获取点位 #region PLC获取点位
private void PointChange(PLCPoint e) private void PointChange(PLCPoint e)
{ {
Debug.WriteLine(Masuit.Tools.ObjectExtensions.ToJsonString(e)); Debug.WriteLine(Masuit.Tools.ObjectExtensions.ToJsonString(e));
switch (e.Name) switch (e.Name)
{ {
#region 侧位状态 #region 侧位状态
//男侧位1状态 //男侧位1状态
case PLCPointNameByToiletPosition.ToiletManStatus1: case PLCPointNameByToiletPosition.ToiletManStatus1:
ToileUseChange(true, 1, e.GetValue<bool>()); ToileUseChange(true, 1, e.GetValue<bool>());
break; break;
//男侧位2状态 //男侧位2状态
case PLCPointNameByToiletPosition.ToiletManStatus2: case PLCPointNameByToiletPosition.ToiletManStatus2:
ToileUseChange(true, 2, e.GetValue<bool>()); ToileUseChange(true, 2, e.GetValue<bool>());
break; break;
//男侧位3状态 //男侧位3状态
case PLCPointNameByToiletPosition.ToiletManStatus3: case PLCPointNameByToiletPosition.ToiletManStatus3:
ToileUseChange(true, 3, e.GetValue<bool>()); ToileUseChange(true, 3, e.GetValue<bool>());
break; break;
//男侧位4状态 //男侧位4状态
case PLCPointNameByToiletPosition.ToiletManStatus4: case PLCPointNameByToiletPosition.ToiletManStatus4:
ToileUseChange(true, 4, e.GetValue<bool>()); ToileUseChange(true, 4, e.GetValue<bool>());
break; break;
//男侧位5状态 //男侧位5状态
case PLCPointNameByToiletPosition.ToiletManStatus5: case PLCPointNameByToiletPosition.ToiletManStatus5:
ToileUseChange(true, 5, e.GetValue<bool>()); ToileUseChange(true, 5, e.GetValue<bool>());
break; break;
//女侧位1状态 //女侧位1状态
case PLCPointNameByToiletPosition.ToiletWomanStatus1: case PLCPointNameByToiletPosition.ToiletWomanStatus1:
ToileUseChange(false, 1, e.GetValue<bool>()); ToileUseChange(false, 1, e.GetValue<bool>());
break; break;
//女侧位2状态 //女侧位2状态
case PLCPointNameByToiletPosition.ToiletWomanStatus2: case PLCPointNameByToiletPosition.ToiletWomanStatus2:
ToileUseChange(false, 2, e.GetValue<bool>()); ToileUseChange(false, 2, e.GetValue<bool>());
break; break;
//女侧位3状态 //女侧位3状态
case PLCPointNameByToiletPosition.ToiletWomanStatus3: case PLCPointNameByToiletPosition.ToiletWomanStatus3:
ToileUseChange(false, 3, e.GetValue<bool>()); ToileUseChange(false, 3, e.GetValue<bool>());
break; break;
#endregion 侧位状态 #endregion 侧位状态
#region 能耗监控 #region 能耗监控
//用电量 //用电量
case PLCPointNameByEnergyMonitoring.ElectricityConsumption: case PLCPointNameByEnergyMonitoring.ElectricityConsumption:
//总电量 //总电量
lblElectricityMeter.Text = Convert.ToInt32(e.GetValue<float>()).ToString(); // lblElectricityMeter.Text = Convert.ToInt32(e.GetValue<float>()).ToString();
//今日电量 //今日电量
var str = Convert.ToInt32(plcController.GetTodayElectricityConsumption(e.GetValue<float>())).ToString(); // var str = Convert.ToInt32(plcController.GetTodayElectricityConsumption(e.GetValue<float>())).ToString();
//str = str.Aggregate(string.Empty, (c, i) => c + i + " "); //str = str.Aggregate(string.Empty, (c, i) => c + i + " ");
lblElectricQuantity.Text = $"今日耗电量 {str} 千瓦时"; // lblElectricQuantity.Text = $"今日耗电量 {str} 千瓦时";
break; break;
case PLCPointNameByEnergyMonitoring.WaterConsumption: case PLCPointNameByEnergyMonitoring.WaterConsumption:
//总用水量 //总用水量
//var waterValue = e.GetValue<float>();//* 0.001f; //var waterValue = e.GetValue<float>();//* 0.001f;
//lblWaterMeter.Text = Convert.ToInt32(waterValue).ToString(); //lblWaterMeter.Text = Convert.ToInt32(waterValue).ToString();
//今日用水量 //今日用水量
//var str1 = Convert.ToInt32(plcController.GetTodayWarterConsumption(waterValue)).ToString(); //var str1 = Convert.ToInt32(plcController.GetTodayWarterConsumption(waterValue)).ToString();
////str1 = str1.Aggregate(string.Empty, (c, i) => c + i + " "); ////str1 = str1.Aggregate(string.Empty, (c, i) => c + i + " ");
//lblDayWarter.Text = $"今日用水量 {str1} 吨 "; //lblDayWarter.Text = $"今日用水量 {str1} 吨 ";
break; break;
#endregion 能耗监控 #endregion 能耗监控
#region 环境监控 #region 环境监控
case PLCPointNameByEnvironmentalMonitoring.Temperature: case PLCPointNameByEnvironmentalMonitoring.Temperature:
var temperature = e.GetValue<Int16>(); var temperature = e.GetValue<Int16>();
var temperatureValue = Math.Round(165 * temperature / 1650f - 40, 2); var temperatureValue = Math.Round(165 * temperature / 1650f - 40, 2);
lblEnvirTempl.Text = temperatureValue + " °C"; lblEnvirTempl.Text = temperatureValue + " °C";
//processEnvirTempl.Value = Convert.ToInt32(temperatureValue) + 40; //processEnvirTempl.Value = Convert.ToInt32(temperatureValue) + 40;
break; break;
@ -551,24 +551,24 @@ namespace GuideScreen.UI
break; break;
case PLCPointNameByEnvironmentalMonitoring.NH3: case PLCPointNameByEnvironmentalMonitoring.NH3:
//暂无数据 //暂无数据
//var enviHydrogenSulfide = e.GetValue<float>(); //var enviHydrogenSulfide = e.GetValue<float>();
//lblEnviHydrogenSulfide.Text = Math.Round(enviHydrogenSulfide, 2).ToString() + " PPM"; //lblEnviHydrogenSulfide.Text = Math.Round(enviHydrogenSulfide, 2).ToString() + " PPM";
//processEnviHydrogenSulfide.Value = Convert.ToInt32(enviHydrogenSulfide); //processEnviHydrogenSulfide.Value = Convert.ToInt32(enviHydrogenSulfide);
break; break;
case PLCPointNameByEnvironmentalMonitoring.H2S: case PLCPointNameByEnvironmentalMonitoring.H2S:
//暂无数据 //暂无数据
//var ammoniaGas = e.GetValue<float>(); //var ammoniaGas = e.GetValue<float>();
//lblEnviAmmoniaGas.Text = Math.Round(ammoniaGas, 2).ToString() + " PPM"; //lblEnviAmmoniaGas.Text = Math.Round(ammoniaGas, 2).ToString() + " PPM";
//processEnviAmmoniaGas.Value = Convert.ToInt32(ammoniaGas); //processEnviAmmoniaGas.Value = Convert.ToInt32(ammoniaGas);
break; break;
#endregion 环境监控 #endregion 环境监控
#region 真空泵站 #region 真空泵站
//实时真空度 //实时真空度
case PLCPointNameByVacuumPumpingStation.RealTimeVacuum: case PLCPointNameByVacuumPumpingStation.RealTimeVacuum:
var realTimeVacuum = e.GetValue<Int16>(); var realTimeVacuum = e.GetValue<Int16>();
var value = Math.Abs(realTimeVacuum); var value = Math.Abs(realTimeVacuum);
@ -577,31 +577,31 @@ namespace GuideScreen.UI
lblVacuum.Text = $"-{value} KPa"; lblVacuum.Text = $"-{value} KPa";
VacuumChart(value); VacuumChart(value);
break; break;
//运行电流1 //运行电流1
case PLCPointNameByVacuumPumpingStation.RunningCurrent1: case PLCPointNameByVacuumPumpingStation.RunningCurrent1:
var runningCurrent = e.GetValue<Int16>(); var runningCurrent = e.GetValue<Int16>();
analogMeterElectricity1.Value = runningCurrent; analogMeterElectricity1.Value = runningCurrent;
lblElectricity1.Text = $"{runningCurrent} A"; lblElectricity1.Text = $"{runningCurrent} A";
break; break;
//运行频率1 //运行频率1
case PLCPointNameByVacuumPumpingStation.RunningFrequency1: case PLCPointNameByVacuumPumpingStation.RunningFrequency1:
var runningFrequency = e.GetValue<Int16>(); var runningFrequency = e.GetValue<Int16>();
analogMeterFrequency1.Value = runningFrequency; analogMeterFrequency1.Value = runningFrequency;
lblFrequency1.Text = $"{runningFrequency} HZ"; lblFrequency1.Text = $"{runningFrequency} HZ";
break; break;
//运行电流2 //运行电流2
case PLCPointNameByVacuumPumpingStation.RunningCurrent2: case PLCPointNameByVacuumPumpingStation.RunningCurrent2:
var runningCurrent2 = e.GetValue<Int16>(); var runningCurrent2 = e.GetValue<Int16>();
analogMeterElectricity2.Value = runningCurrent2; analogMeterElectricity2.Value = runningCurrent2;
lblElectricity2.Text = $"{runningCurrent2} A"; lblElectricity2.Text = $"{runningCurrent2} A";
break; break;
//运行频率2 //运行频率2
case PLCPointNameByVacuumPumpingStation.RunningFrequency2: case PLCPointNameByVacuumPumpingStation.RunningFrequency2:
var runningFrequency2 = e.GetValue<Int16>(); var runningFrequency2 = e.GetValue<Int16>();
analogMeterFrequency2.Value = runningFrequency2; analogMeterFrequency2.Value = runningFrequency2;
lblFrequency2.Text = $"{runningFrequency2} HZ"; lblFrequency2.Text = $"{runningFrequency2} HZ";
break; break;
//1号泵状态 //1号泵状态
case PLCPointNameByVacuumPumpingStation.PumpingStation1: case PLCPointNameByVacuumPumpingStation.PumpingStation1:
if (e.GetValue<bool>()) if (e.GetValue<bool>())
{ {
@ -612,7 +612,7 @@ namespace GuideScreen.UI
LedBulbOneRun.ForeColor = Color.Gray; LedBulbOneRun.ForeColor = Color.Gray;
} }
break; break;
//2号泵状态 //2号泵状态
case PLCPointNameByVacuumPumpingStation.PumpingStation2: case PLCPointNameByVacuumPumpingStation.PumpingStation2:
if (e.GetValue<bool>()) if (e.GetValue<bool>())
{ {
@ -623,28 +623,28 @@ namespace GuideScreen.UI
LedBulbTwoRun.ForeColor = Color.Gray; LedBulbTwoRun.ForeColor = Color.Gray;
} }
break; break;
//1号泵运行次数 //1号泵运行次数
case PLCPointNameByVacuumPumpingStation.PumpStartTimes1: case PLCPointNameByVacuumPumpingStation.PumpStartTimes1:
var pumpStartCount1 = e.GetValue<Int16>(); var pumpStartCount1 = e.GetValue<Int16>();
LedDisplayOneCount.Text = pumpStartCount1.ToString("D6"); LedDisplayOneCount.Text = pumpStartCount1.ToString("D6");
break; break;
//2号泵运行次数 //2号泵运行次数
case PLCPointNameByVacuumPumpingStation.PumpStartTimes2: case PLCPointNameByVacuumPumpingStation.PumpStartTimes2:
var pumpStartCount2 = e.GetValue<Int16>(); var pumpStartCount2 = e.GetValue<Int16>();
LedDisplayTwoCount.Text = pumpStartCount2.ToString("D6"); LedDisplayTwoCount.Text = pumpStartCount2.ToString("D6");
break; break;
//1号泵运行时间 //1号泵运行时间
case PLCPointNameByVacuumPumpingStation.PumpAccumulatedStartTime1: case PLCPointNameByVacuumPumpingStation.PumpAccumulatedStartTime1:
var pumpAccumulatedStartTime1 = e.GetValue<Int16>(); var pumpAccumulatedStartTime1 = e.GetValue<Int16>();
LedDisplayOneTime.Text = pumpAccumulatedStartTime1.ToString("D5") + "H"; LedDisplayOneTime.Text = pumpAccumulatedStartTime1.ToString("D5") + "H";
break; break;
//2号泵运行时间 //2号泵运行时间
case PLCPointNameByVacuumPumpingStation.PumpAccumulatedStartTime2: case PLCPointNameByVacuumPumpingStation.PumpAccumulatedStartTime2:
var pumpAccumulatedStartTime2 = e.GetValue<Int16>(); var pumpAccumulatedStartTime2 = e.GetValue<Int16>();
LedDisplayTwoTime.Text = pumpAccumulatedStartTime2.ToString("D5") + "H"; LedDisplayTwoTime.Text = pumpAccumulatedStartTime2.ToString("D5") + "H";
break; break;
#endregion 真空泵站 #endregion 真空泵站
default: default:
break; break;
@ -660,12 +660,12 @@ namespace GuideScreen.UI
} }
} }
#endregion PLC获取点位 #endregion PLC获取点位
#region 图表相关 #region 图表相关
/// <summary> /// <summary>
/// 人流量 /// 人流量
/// </summary> /// </summary>
//private void PassengerFlowChart(List<PassengerFlowStatisticsTotalModel> list) //private void PassengerFlowChart(List<PassengerFlowStatisticsTotalModel> list)
//{ //{
@ -684,15 +684,15 @@ namespace GuideScreen.UI
// option.ToolTip.Visible = true; // option.ToolTip.Visible = true;
// option.YAxis.Scale = true; // option.YAxis.Scale = true;
// option.XAxis.Name = "日期"; // option.XAxis.Name = "日期";
// option.XAxis.AxisLabel.Angle = 60;//(0° ~ 90°) // option.XAxis.AxisLabel.Angle = 60;//(0° ~ 90°)
// option.YAxis.Name = "数值"; // option.YAxis.Name = "数值";
// //数据显示小数位数 // //数据显示小数位数
// series.DecimalPlaces = 0; // series.DecimalPlaces = 0;
// option.Series.Add(series); // option.Series.Add(series);
// //坐标轴显示小数位数 // //坐标轴显示小数位数
// option.YAxis.AxisLabel.DecimalPlaces = 0; // option.YAxis.AxisLabel.DecimalPlaces = 0;
// option.XAxis.AxisLabel.DecimalPlaces = 0; // option.XAxis.AxisLabel.DecimalPlaces = 0;
// option.ToolTip.AxisPointer.Type = UIAxisPointerType.Shadow; // option.ToolTip.AxisPointer.Type = UIAxisPointerType.Shadow;
@ -701,13 +701,13 @@ namespace GuideScreen.UI
//} //}
/// <summary> /// <summary>
/// 今日厕位使用情况 /// 今日厕位使用情况
/// </summary> /// </summary>
private void ToileUseChartByDay() private void ToileUseChartByDay()
{ {
UIBarOption option = new UIBarOption(); UIBarOption option = new UIBarOption();
option.Title = new UITitle(); option.Title = new UITitle();
option.Title.Text = "今日厕位使用记录"; option.Title.Text = "今日厕位使用记录";
option.Title.SubText = string.Empty; option.Title.SubText = string.Empty;
var series = new UIBarSeries(); var series = new UIBarSeries();
@ -720,15 +720,15 @@ namespace GuideScreen.UI
option.ToolTip.Visible = true; option.ToolTip.Visible = true;
option.YAxis.Scale = true; option.YAxis.Scale = true;
option.XAxis.Name = "厕位"; option.XAxis.Name = "厕位";
//option.XAxis.AxisLabel.Angle = 60;//(0° ~ 90°) //option.XAxis.AxisLabel.Angle = 60;//(0° ~ 90°)
//option.YAxis.Name = "使用次数"; //option.YAxis.Name = "使用次数";
//数据显示小数位数 //数据显示小数位数
series.DecimalPlaces = 0; series.DecimalPlaces = 0;
option.Series.Add(series); option.Series.Add(series);
//坐标轴显示小数位数 //坐标轴显示小数位数
option.YAxis.AxisLabel.DecimalPlaces = 0; option.YAxis.AxisLabel.DecimalPlaces = 0;
option.XAxis.AxisLabel.DecimalPlaces = 0; option.XAxis.AxisLabel.DecimalPlaces = 0;
option.ToolTip.AxisPointer.Type = UIAxisPointerType.Shadow; option.ToolTip.AxisPointer.Type = UIAxisPointerType.Shadow;
@ -737,13 +737,13 @@ namespace GuideScreen.UI
} }
/// <summary> /// <summary>
/// 厕位使用统计 /// 厕位使用统计
/// </summary> /// </summary>
private void ToileUseChartTotal() private void ToileUseChartTotal()
{ {
UIBarOption option = new UIBarOption(); UIBarOption option = new UIBarOption();
option.Title = new UITitle(); option.Title = new UITitle();
option.Title.Text = "厕位使用统计"; option.Title.Text = "厕位使用统计";
option.Title.SubText = string.Empty; option.Title.SubText = string.Empty;
var series = new UIBarSeries(); var series = new UIBarSeries();
@ -757,15 +757,15 @@ namespace GuideScreen.UI
option.ToolTip.Visible = true; option.ToolTip.Visible = true;
option.YAxis.Scale = true; option.YAxis.Scale = true;
option.XAxis.Name = "厕位"; option.XAxis.Name = "厕位";
//option.XAxis.AxisLabel.Angle = 60;//(0° ~ 90°) //option.XAxis.AxisLabel.Angle = 60;//(0° ~ 90°)
//option.YAxis.Name = "使用次数"; //option.YAxis.Name = "使用次数";
//数据显示小数位数 //数据显示小数位数
series.DecimalPlaces = 0; series.DecimalPlaces = 0;
option.Series.Add(series); option.Series.Add(series);
//坐标轴显示小数位数 //坐标轴显示小数位数
option.YAxis.AxisLabel.DecimalPlaces = 0; option.YAxis.AxisLabel.DecimalPlaces = 0;
option.XAxis.AxisLabel.DecimalPlaces = 0; option.XAxis.AxisLabel.DecimalPlaces = 0;
option.ToolTip.AxisPointer.Type = UIAxisPointerType.Shadow; option.ToolTip.AxisPointer.Type = UIAxisPointerType.Shadow;
@ -776,7 +776,7 @@ namespace GuideScreen.UI
/// <summary> /// <summary>
/// 真空度曲线图 /// 真空度曲线图
/// </summary> /// </summary>
/// <param name="value"></param> /// <param name="value"></param>
private void VacuumChart(double value) private void VacuumChart(double value)
@ -789,13 +789,13 @@ namespace GuideScreen.UI
option.Title.Text = string.Empty; option.Title.Text = string.Empty;
option.Title.SubText = string.Empty; option.Title.SubText = string.Empty;
option.AddSeries(new UILineSeries("vacuumLine")); option.AddSeries(new UILineSeries("vacuumLine"));
//坐标轴显示小数位数 //坐标轴显示小数位数
option.XAxis.AxisLabel.DecimalPlaces = 0; option.XAxis.AxisLabel.DecimalPlaces = 0;
option.YAxis.AxisLabel.DecimalPlaces = 0; option.YAxis.AxisLabel.DecimalPlaces = 0;
chartVacuum.SetOption(option); chartVacuum.SetOption(option);
} }
//真空度过期 //真空度过期
if (vacuumIndex > 1000) if (vacuumIndex > 1000)
{ {
vacuumIndex = 0; vacuumIndex = 0;
@ -807,29 +807,44 @@ namespace GuideScreen.UI
} }
#endregion 图表相关 #endregion 图表相关
/// <summary> /// <summary>
/// 计算用水量 /// 计算用水量
/// </summary> /// </summary>
private void SetDayWarterAndelEctricity() private void SetDayWarterAndelEctricity()
{ {
var count = toilets.Values.Sum(); var count = toilets.Values.Sum();
//每用次1.6升水 //每用次0.8 升水
var value = Convert.ToSingle(Math.Round(count * 0.0016, 4)); var value = Convert.ToSingle(Math.Round(count * 0.8, 2));
var dayStr = value.ToString().Aggregate(string.Empty, (c, i) => c + i + " "); var dayStr = value.ToString().Aggregate(string.Empty, (c, i) => c + i + " ");
lblDayWarter.Text = $"今日用水量 {dayStr} 吨 "; lblDayWarter.Text = $"今日用水量 {dayStr} L";
//总用水量
lblWaterMeter.Text = (1.8m + Math.Round(plcController.GetWaterTotal()*0.8m / 1000m, 2)) + " 吨";
//今日用电量 单位kW.h每次 0.0003kW.h
var val = Convert.ToSingle(Math.Round(count * 0.0003, 4));
var str = val.ToString().Aggregate(string.Empty, (c, i) => c + i + " ");
lblElectricQuantity.Text = $"今日耗电量 {str} kW.h";
//总用电量
lblElectricityMeter.Text = (6.78m + Math.Round(plcController.GetElectricityTotal() * 0.0003m, 2)) + " kW.h";
plcController.AdddeviceRecord(new PLCPoint plcController.AdddeviceRecord(new PLCPoint
{ {
Device = PLCDeviceNames.EnergyMonitoring, Device = PLCDeviceNames.EnergyMonitoring,
Name = PLCPointNameByEnergyMonitoring.WaterConsumption, Name = PLCPointNameByEnergyMonitoring.WaterConsumption,
Note = "用水量", Note = "用水量",
DataType = typeof(float), DataType = typeof(float),
ObjectValue = value, ObjectValue = value,
}); });
//总用水量 plcController.AdddeviceRecord(new PLCPoint
lblWaterMeter.Text = plcController.GetWaterTotal().ToString(); {
Device = PLCDeviceNames.EnergyMonitoring,
Name = PLCPointNameByEnergyMonitoring.ElectricityConsumption,
Note = "用电量",
DataType = typeof(float),
ObjectValue = val,
});
} }
#region Timer #region Timer
@ -837,27 +852,27 @@ namespace GuideScreen.UI
private Random rd = new Random(); private Random rd = new Random();
/// <summary> /// <summary>
/// 日期时间 /// 日期时间
/// </summary> /// </summary>
/// <param name="sender"></param> /// <param name="sender"></param>
/// <param name="e"></param> /// <param name="e"></param>
private void timer1_Tick(object sender, EventArgs e) private void timer1_Tick(object sender, EventArgs e)
{ {
var dateTime = DateTime.Now; var dateTime = DateTime.Now;
//日期时间 //日期时间
lblTime.Text = dateTime.ToString("yyyy-MM-dd HH:mm:ss"); lblTime.Text = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
//星期 //星期
lblweek.Text = DateTime.Today.ToString("dddd", new System.Globalization.CultureInfo("zh-CN")); lblweek.Text = DateTime.Today.ToString("dddd", new System.Globalization.CultureInfo("zh-CN"));
//零点以后更新的数据 //零点以后更新的数据
if (dateTime.ToString("HH:mm:ss") == zeroTime) if (dateTime.ToString("HH:mm:ss") == zeroTime)
{ {
//更新厕位使用情况 //更新厕位使用情况
toilets = plcController.ToiletPositionRecordTotalByToday(); toilets = plcController.ToiletPositionRecordTotalByToday();
ToileUseChartByDay(); ToileUseChartByDay();
} }
} }
//定时更新气象数据 //定时更新气象数据
private async void timer2_Tick(object sender, EventArgs e) private async void timer2_Tick(object sender, EventArgs e)
{ {
await GetWeather(); await GetWeather();
@ -867,7 +882,7 @@ namespace GuideScreen.UI
private void timer3_Tick(object sender, EventArgs e) private void timer3_Tick(object sender, EventArgs e)
{ {
//报警数据 //报警数据
this.txtAlarm.Text = commonController.AlarmText; this.txtAlarm.Text = commonController.AlarmText;
} }
} }

Loading…
Cancel
Save