diff --git a/bigscreen/1920X1080/css/.DS_Store b/bigscreen/1920X1080/css/.DS_Store
deleted file mode 100644
index 3f0a13f..0000000
Binary files a/bigscreen/1920X1080/css/.DS_Store and /dev/null differ
diff --git a/bigscreen/1920X1080/images/.DS_Store b/bigscreen/1920X1080/images/.DS_Store
deleted file mode 100644
index a335e13..0000000
Binary files a/bigscreen/1920X1080/images/.DS_Store and /dev/null differ
diff --git a/bigscreen/1920X1080/js/.DS_Store b/bigscreen/1920X1080/js/.DS_Store
deleted file mode 100644
index 66f68c0..0000000
Binary files a/bigscreen/1920X1080/js/.DS_Store and /dev/null differ
diff --git a/bigscreen/css/.DS_Store b/bigscreen/css/.DS_Store
deleted file mode 100644
index 3f0a13f..0000000
Binary files a/bigscreen/css/.DS_Store and /dev/null differ
diff --git a/bigscreen/images/.DS_Store b/bigscreen/images/.DS_Store
deleted file mode 100644
index a335e13..0000000
Binary files a/bigscreen/images/.DS_Store and /dev/null differ
diff --git a/bigscreen/js/.DS_Store b/bigscreen/js/.DS_Store
deleted file mode 100644
index 66f68c0..0000000
Binary files a/bigscreen/js/.DS_Store and /dev/null differ
diff --git a/guidescreen/GuideScreen/GuideScreen.Common/Repositories/IPLCDeviceRecordRepository.cs b/guidescreen/GuideScreen/GuideScreen.Common/Repositories/IPLCDeviceRecordRepository.cs
index 57ef2c4..467ff8e 100644
--- a/guidescreen/GuideScreen/GuideScreen.Common/Repositories/IPLCDeviceRecordRepository.cs
+++ b/guidescreen/GuideScreen/GuideScreen.Common/Repositories/IPLCDeviceRecordRepository.cs
@@ -65,5 +65,17 @@ namespace GuideScreen.Common.Repositories
///
///
decimal WaterTotal();
+
+ ///
+ /// 获取总用电量
+ ///
+ ///
+ decimal ElectricityTotal();
+
+ ///
+ /// 获取厕位使用计
+ ///
+ ///
+ IDictionary ToiletTotal();
}
}
\ No newline at end of file
diff --git a/guidescreen/GuideScreen/GuideScreen.Common/Repositories/Impl/PLCDeviceRecordRepository.cs b/guidescreen/GuideScreen/GuideScreen.Common/Repositories/Impl/PLCDeviceRecordRepository.cs
index 2003703..9dc3dea 100644
--- a/guidescreen/GuideScreen/GuideScreen.Common/Repositories/Impl/PLCDeviceRecordRepository.cs
+++ b/guidescreen/GuideScreen/GuideScreen.Common/Repositories/Impl/PLCDeviceRecordRepository.cs
@@ -321,10 +321,53 @@ namespace GuideScreen.Common.Repositories.Impl
{
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;
+ }
+ }
+ ///
+ /// 获取总用电量
+ ///
+ ///
+ 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;
}
}
+
+ ///
+ /// 获取厕位使用计
+ ///
+ ///
+ public IDictionary ToiletTotal()
+ {
+
+ //返回集合
+ var retValues = new Dictionary();
+
+ using (var context = GSDBContext.GetDbContext())
+ {
+ var list = context.PLCDeviceRecordDayEntities
+ .Where(f => f.DeviceName == PLCDeviceNames.ToiletPosition)
+ .GroupBy(f => f.PointName).Select(f => new { PointName = f.Key, Sum = f.Sum(ff => ff.RecordValue) }).ToList();
+ if (list.Count > 0)
+ {
+ foreach (var item in list)
+ {
+ retValues.Add(item.PointName, item.Sum);
+ }
+ }
+ }
+
+ return retValues;
+ }
}
}
\ No newline at end of file
diff --git a/guidescreen/GuideScreen/GuideScreen.Common/Services/IPLCDeviceRecordService.cs b/guidescreen/GuideScreen/GuideScreen.Common/Services/IPLCDeviceRecordService.cs
index 3a9d9fc..6537f14 100644
--- a/guidescreen/GuideScreen/GuideScreen.Common/Services/IPLCDeviceRecordService.cs
+++ b/guidescreen/GuideScreen/GuideScreen.Common/Services/IPLCDeviceRecordService.cs
@@ -98,5 +98,17 @@ namespace GuideScreen.Common.Services
///
///
decimal WaterTotal();
+
+ ///
+ /// 获取总用电量
+ ///
+ ///
+ decimal ElectricityTotal();
+
+ ///
+ /// 获取厕位使用计
+ ///
+ ///
+ IDictionary ToiletTotal();
}
}
diff --git a/guidescreen/GuideScreen/GuideScreen.Common/Services/Impl/PLCDeviceRecordService.cs b/guidescreen/GuideScreen/GuideScreen.Common/Services/Impl/PLCDeviceRecordService.cs
index 86706a4..348a16a 100644
--- a/guidescreen/GuideScreen/GuideScreen.Common/Services/Impl/PLCDeviceRecordService.cs
+++ b/guidescreen/GuideScreen/GuideScreen.Common/Services/Impl/PLCDeviceRecordService.cs
@@ -135,6 +135,7 @@ namespace GuideScreen.Common.Services.Impl
DeviceName = PLCDeviceNames.EnergyMonitoring,
PointName = name,
PointNote = note,
+ RecordValue = Convert.ToDecimal(value)
};
if (dateTime.HasValue)
{
@@ -235,5 +236,28 @@ namespace GuideScreen.Common.Services.Impl
return ret;
}
+ ///
+ /// 获取总用电量
+ ///
+ ///
+ public decimal ElectricityTotal()
+ {
+ var ret = this.deviceRecordRepository.ElectricityTotal();
+
+ return ret;
+ }
+
+ ///
+ /// 获取厕位使用计
+ ///
+ ///
+ public IDictionary ToiletTotal()
+ {
+ var ret = this.deviceRecordRepository.ToiletTotal();
+
+ return ret;
+
+ }
+
}
}
diff --git a/guidescreen/GuideScreen/GuideScreen.UI/Controller/PLCController.cs b/guidescreen/GuideScreen/GuideScreen.UI/Controller/PLCController.cs
index 8bc8b85..581fc9e 100644
--- a/guidescreen/GuideScreen/GuideScreen.UI/Controller/PLCController.cs
+++ b/guidescreen/GuideScreen/GuideScreen.UI/Controller/PLCController.cs
@@ -125,16 +125,28 @@ namespace GuideScreen.Common.Services.Impl
public IDictionary ToiletPositionRecordTotal()
{
//厕所侧位使用统计
+ //var toilets = new Dictionary
+ //{
+ // ["男厕1"] = GetPointWashCount(PLCPointNameByWashCount.ToiletManCount1),
+ // ["男厕2"] = GetPointWashCount(PLCPointNameByWashCount.ToiletManCount2),
+ // ["男厕3"] = GetPointWashCount(PLCPointNameByWashCount.ToiletManCount3),
+ // ["男厕4"] = GetPointWashCount(PLCPointNameByWashCount.ToiletManCount4),
+ // ["男厕5"] = GetPointWashCount(PLCPointNameByWashCount.ToiletManCount5),
+ // ["女厕1"] = GetPointWashCount(PLCPointNameByWashCount.ToiletWomanCount1),
+ // ["女厕2"] = GetPointWashCount(PLCPointNameByWashCount.ToiletWomanCount2),
+ // ["女厕3"] = GetPointWashCount(PLCPointNameByWashCount.ToiletWomanCount3),
+ //};
+ var total = deviceRecordService.ToiletTotal();
var toilets = new Dictionary
{
- ["男厕1"] = GetPointWashCount(PLCPointNameByWashCount.ToiletManCount1),
- ["男厕2"] = GetPointWashCount(PLCPointNameByWashCount.ToiletManCount2),
- ["男厕3"] = GetPointWashCount(PLCPointNameByWashCount.ToiletManCount3),
- ["男厕4"] = GetPointWashCount(PLCPointNameByWashCount.ToiletManCount4),
- ["男厕5"] = GetPointWashCount(PLCPointNameByWashCount.ToiletManCount5),
- ["女厕1"] = GetPointWashCount(PLCPointNameByWashCount.ToiletWomanCount1),
- ["女厕2"] = GetPointWashCount(PLCPointNameByWashCount.ToiletWomanCount2),
- ["女厕3"] = GetPointWashCount(PLCPointNameByWashCount.ToiletWomanCount3),
+ ["男厕1"] = GetPointWashCount(total,PLCPointNameByToiletPosition.ToiletManStatus1),
+ ["男厕2"] = GetPointWashCount(total, PLCPointNameByToiletPosition.ToiletManStatus2),
+ ["男厕3"] = GetPointWashCount(total, PLCPointNameByToiletPosition.ToiletManStatus3),
+ ["男厕4"] = GetPointWashCount(total, PLCPointNameByToiletPosition.ToiletManStatus4),
+ ["男厕5"] = GetPointWashCount(total, PLCPointNameByToiletPosition.ToiletManStatus5),
+ ["女厕1"] = GetPointWashCount(total, PLCPointNameByToiletPosition.ToiletWomanStatus1),
+ ["女厕2"] = GetPointWashCount(total, PLCPointNameByToiletPosition.ToiletWomanStatus2),
+ ["女厕3"] = GetPointWashCount(total, PLCPointNameByToiletPosition.ToiletWomanStatus3),
};
return toilets;
@@ -172,10 +184,19 @@ namespace GuideScreen.Common.Services.Impl
return 0;
}
- private Int16 GetPointWashCount(string name)
+ //private Int16 GetPointWashCount(string name)
+ //{
+ // var point = Points.Where(f => f.Name == name).FirstOrDefault();
+ // return Convert.ToInt16(point?.ObjectValue);
+ //}
+
+ private int GetPointWashCount(IDictionary pairs , string name)
{
- var point = Points.Where(f => f.Name == name).FirstOrDefault();
- return Convert.ToInt16(point?.ObjectValue);
+ if (pairs.ContainsKey(name))
+ {
+ return Convert.ToInt32(pairs[name]);
+ }
+ return 0;
}
///
@@ -204,7 +225,7 @@ namespace GuideScreen.Common.Services.Impl
break;
//获取冲洗统计
case PLCDeviceNames.WashCount:
- ToiletPositionRecordTotal();
+ //ToiletPositionRecordTotal();
break;
default:
break;
@@ -214,44 +235,44 @@ namespace GuideScreen.Common.Services.Impl
///
/// 获取今日用电量
///
- public float GetTodayElectricityConsumption(float total)
- {
- //获取昨天用电总量
- decimal yesterday = deviceRecordService.GetEnergyMonitoringByDay(PLCPointNameByEnergyMonitoring.ElectricityConsumption, DateTime.Now.AddDays(-1));
- //如果昨日没有记录或为0,就将当前用电量添加当昨日,防止今日用电量为0
- if (yesterday > 0)
- {
- return total - float.Parse(yesterday.ToString());
+ //public float GetTodayElectricityConsumption(float total)
+ //{
+ // //获取昨天用电总量
+ // decimal yesterday = deviceRecordService.GetEnergyMonitoringByDay(PLCPointNameByEnergyMonitoring.ElectricityConsumption, DateTime.Now.AddDays(-1));
+ // //如果昨日没有记录或为0,就将当前用电量添加当昨日,防止今日用电量为0
+ // if (yesterday > 0)
+ // {
+ // return total - float.Parse(yesterday.ToString());
- }
- else
- {
- deviceRecordService.UpdateEnergyMonitoringByToday(PLCPointNameByEnergyMonitoring.ElectricityConsumption, "用电量", total, DateTime.Now.AddDays(-1));
- }
+ // }
+ // else
+ // {
+ // deviceRecordService.UpdateEnergyMonitoringByToday(PLCPointNameByEnergyMonitoring.ElectricityConsumption, "用电量", total, DateTime.Now.AddDays(-1));
+ // }
- return 0;
- }
+ // return 0;
+ //}
///
/// 获取今日用水量
///
- public float GetTodayWarterConsumption(float total)
- {
- //获取昨天用电总量
- decimal yesterday = deviceRecordService.GetEnergyMonitoringByDay(PLCPointNameByEnergyMonitoring.WaterConsumption, DateTime.Now.AddDays(-1));
- //如果昨日没有记录或为0,就将当前用电量添加当昨日,防止今日用电量为0
- if (yesterday > 0)
- {
- return total - float.Parse(yesterday.ToString());
+ //public float GetTodayWarterConsumption(float total)
+ //{
+ // //获取昨天用电总量
+ // decimal yesterday = deviceRecordService.GetEnergyMonitoringByDay(PLCPointNameByEnergyMonitoring.WaterConsumption, DateTime.Now.AddDays(-1));
+ // //如果昨日没有记录或为0,就将当前用电量添加当昨日,防止今日用电量为0
+ // if (yesterday > 0)
+ // {
+ // return total - float.Parse(yesterday.ToString());
- }
- else
- {
- deviceRecordService.UpdateEnergyMonitoringByToday(PLCPointNameByEnergyMonitoring.WaterConsumption, "用水量", total, DateTime.Now.AddDays(-1));
- }
+ // }
+ // else
+ // {
+ // deviceRecordService.UpdateEnergyMonitoringByToday(PLCPointNameByEnergyMonitoring.WaterConsumption, "用水量", total, DateTime.Now.AddDays(-1));
+ // }
- return 0;
- }
+ // return 0;
+ //}
///
/// 获取总用水量
///
@@ -265,5 +286,19 @@ namespace GuideScreen.Common.Services.Impl
}
return value;
}
+
+ ///
+ /// 获取总用电量
+ ///
+ ///
+ public decimal GetElectricityTotal()
+ {
+ var value = deviceRecordService.ElectricityTotal();
+ if (value > 0)
+ {
+ value = Math.Round(value, 2);
+ }
+ return value;
+ }
}
}
\ No newline at end of file
diff --git a/guidescreen/GuideScreen/GuideScreen.UI/FormScreen.Designer.cs b/guidescreen/GuideScreen/GuideScreen.UI/FormScreen.Designer.cs
index 1c3f716..4ddadba 100644
--- a/guidescreen/GuideScreen/GuideScreen.UI/FormScreen.Designer.cs
+++ b/guidescreen/GuideScreen/GuideScreen.UI/FormScreen.Designer.cs
@@ -432,9 +432,9 @@ namespace GuideScreen.UI
//
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.Location = new System.Drawing.Point(210, 241);
+ this.lblWaterMeter.Location = new System.Drawing.Point(216, 241);
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.StyleCustomMode = true;
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.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.Size = new System.Drawing.Size(93, 38);
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.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.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.StyleCustomMode = true;
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.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.Size = new System.Drawing.Size(105, 38);
this.uiLabel18.Style = Sunny.UI.UIStyle.Custom;
@@ -668,7 +668,7 @@ namespace GuideScreen.UI
// pictureBox16
//
this.pictureBox16.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox16.Image")));
- this.pictureBox16.Location = new System.Drawing.Point(186, 151);
+ this.pictureBox16.Location = new System.Drawing.Point(8, 150);
this.pictureBox16.Name = "pictureBox16";
this.pictureBox16.Size = new System.Drawing.Size(53, 52);
this.pictureBox16.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -678,7 +678,7 @@ namespace GuideScreen.UI
// pictureBox15
//
this.pictureBox15.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox15.Image")));
- this.pictureBox15.Location = new System.Drawing.Point(12, 151);
+ this.pictureBox15.Location = new System.Drawing.Point(191, 150);
this.pictureBox15.Name = "pictureBox15";
this.pictureBox15.Size = new System.Drawing.Size(49, 52);
this.pictureBox15.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -779,7 +779,7 @@ namespace GuideScreen.UI
// pictureBox10
//
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.Size = new System.Drawing.Size(61, 52);
this.pictureBox10.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -799,7 +799,7 @@ namespace GuideScreen.UI
// pictureBox9
//
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.Size = new System.Drawing.Size(61, 52);
this.pictureBox9.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -1711,7 +1711,7 @@ namespace GuideScreen.UI
this.uiPanel3.Controls.Add(this.lblTime);
this.uiPanel3.FillColor = System.Drawing.Color.Empty;
this.uiPanel3.Font = new System.Drawing.Font("微软雅黑", 12F);
- this.uiPanel3.Location = new System.Drawing.Point(9, 0);
+ this.uiPanel3.Location = new System.Drawing.Point(9, 2);
this.uiPanel3.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.uiPanel3.MinimumSize = new System.Drawing.Size(1, 1);
this.uiPanel3.Name = "uiPanel3";
diff --git a/guidescreen/GuideScreen/GuideScreen.UI/FormScreen.cs b/guidescreen/GuideScreen/GuideScreen.UI/FormScreen.cs
index 74596c7..1ad1924 100644
--- a/guidescreen/GuideScreen/GuideScreen.UI/FormScreen.cs
+++ b/guidescreen/GuideScreen/GuideScreen.UI/FormScreen.cs
@@ -1,4 +1,4 @@
-using GuideScreen.Common;
+using GuideScreen.Common;
using GuideScreen.Common.Common;
using GuideScreen.Common.Constants;
using GuideScreen.Common.Models;
@@ -22,37 +22,37 @@ namespace GuideScreen.UI
{
public partial class FormScreen : UIForm
{
- //вʹ
+ //男厕使用数量
private const string currentManNumStrFormat = "5/{0}";
- //Ůʹ
+ //女厕使用数量
private const string currentWomanNumStrFormat = "3/{0}";
- //
+ //零点
private const string zeroTime = "00:00:00";
- //ͨ
+ //通用
private CommonController commonController;
- //տ
+ //今日客流量
private int passengerFlowDayTotal = 0;
- //ͳ
+ //客流统计
private PassengerFlowStatisticsController passengerFlowStatisticsController;
- //
+ //客流总量
private int passengerFlowTotal = 0;
- //PLC
+ //PLC相关
private PLCController plcController;
- //ղλʹͳ
+ //今日厕所侧位使用统计
private IDictionary toilets;
- //նx
+ //真空度x坐标
private int vacuumIndex = 0;
- //
+ //今日气象
private WeatherController weatherController;
public FormScreen()
@@ -67,6 +67,8 @@ namespace GuideScreen.UI
plcController = DIManager.GetContainerObject();
plcController.PointChnage += PlcController_PointChnage;
plcController.ErrorMessage += Controller_ErrorMessage;
+
+ ToileUseChartTotal();
//passengerFlowStatisticsController = DIManager.GetContainerObject();
//passengerFlowStatisticsController.Action += PassengerFlowStatisticsController_Action;
//passengerFlowStatisticsController.ErrorMessage += Controller_ErrorMessage;
@@ -78,15 +80,15 @@ namespace GuideScreen.UI
{
switch (e.ClickedItem.Text)
{
- case "̨":
+ case "后台管理":
ControlForm form = new ControlForm();
form.ShowDialog();
break;
- case "":
+ case "报表":
ChartForm from = new ChartForm();
from.ShowDialog();
break;
- case "ر":
+ case "关闭":
Close();
break;
@@ -94,14 +96,14 @@ namespace GuideScreen.UI
break;
}
- if (e.ClickedItem.Text == "ر")
+ if (e.ClickedItem.Text == "关闭")
{
Close();
}
}
///
- /// Ϣ
+ /// 错误信息
///
///
///
@@ -113,7 +115,7 @@ namespace GuideScreen.UI
}
///
- /// ʾ
+ /// 错误提示框
///
///
///
@@ -136,33 +138,33 @@ namespace GuideScreen.UI
{
try
{
- //
+ //加载
plcController.Load();
- //ȡ
+ //获取标题
lblTitle.Text = commonController.Title;
- //
+ //报警数据
this.txtAlarm.Text = commonController.AlarmText;
- //PLCͨ
+ //开启PLC通信
plcController.Start();
- //ղλʹ
+ //今日厕位使用情况
toilets = plcController.ToiletPositionRecordTotalByToday();
- //ͳ
+ //总统计
passengerFlowTotal = plcController.GetToiletRecordTotal();
PassengerFlowUpdate();
- //ն
+ //真空度
VacuumChart(0);
- //ȡϢ
+ //获取天气信息
await GetWeather();
- //ˮ
+ //用水量
SetDayWarterAndelEctricity();
}
@@ -172,7 +174,7 @@ namespace GuideScreen.UI
}
}
- #region ȡλ
+ #region 获取点位更新
private void PlcController_PointChnage(object sender, PLCPoint e)
{
@@ -184,21 +186,21 @@ namespace GuideScreen.UI
}
catch (Exception ex)
{
- ErrorDialog("ȡλ" + ex.Message);
+ ErrorDialog("获取点位错误:" + ex.Message);
ex.WriteErrorLog();
}
}));
}
- #endregion ȡλ
+ #endregion 获取点位更新
- #region Ƿ
+ #region 厕所是否有人
private void ToileUseChange(bool isMan, int num, bool use)
{
if (isMan)
{
- //вʹ
+ //男厕使用数量
var manNum = plcController.Points.Where(f => f.Name.StartsWith("ToiletMan") && f.GetValue()).Count();
lblCurrentManNum.Text = string.Format(currentManNumStrFormat, manNum);
switch (num)
@@ -207,7 +209,7 @@ namespace GuideScreen.UI
if (use)
{
pBoxManPitOne.Visible = true;
- toilets["в1"]++;
+ toilets["男厕1"]++;
}
else
{
@@ -220,7 +222,7 @@ namespace GuideScreen.UI
if (use)
{
pBoxManPitTwo.Visible = true;
- toilets["в2"]++;
+ toilets["男厕2"]++;
}
else
{
@@ -233,7 +235,7 @@ namespace GuideScreen.UI
if (use)
{
pBoxUrinateMan1.Image = Resources.urinateFull;
- toilets["в3"]++;
+ toilets["男厕3"]++;
}
else
{
@@ -245,7 +247,7 @@ namespace GuideScreen.UI
if (use)
{
pBoxUrinateMan2.Image = Resources.urinateFull;
- toilets["в4"]++;
+ toilets["男厕4"]++;
}
else
{
@@ -257,7 +259,7 @@ namespace GuideScreen.UI
if (use)
{
pBoxUrinateMan3.Image = Resources.urinateFull;
- toilets["в5"]++;
+ toilets["男厕5"]++;
}
else
{
@@ -271,7 +273,7 @@ namespace GuideScreen.UI
}
else
{
- //Ůʹ
+ //女厕使用数量
var womanNum = plcController.Points.Where(f => f.Name.StartsWith("ToiletWoman") && f.GetValue()).Count();
lblCurrentWomanNum.Text = string.Format(currentWomanNumStrFormat, womanNum);
switch (num)
@@ -280,7 +282,7 @@ namespace GuideScreen.UI
if (use)
{
pBoxPitWomanOne.Visible = true;
- toilets["Ů1"]++;
+ toilets["女厕1"]++;
}
else
{
@@ -292,7 +294,7 @@ namespace GuideScreen.UI
if (use)
{
pBoxPitWomanTwo.Visible = true;
- toilets["Ů2"]++;
+ toilets["女厕2"]++;
}
else
{
@@ -304,7 +306,7 @@ namespace GuideScreen.UI
if (use)
{
pBoxPitWomanThree.Visible = true;
- toilets["Ů3"]++;
+ toilets["女厕3"]++;
}
else
{
@@ -322,49 +324,49 @@ namespace GuideScreen.UI
passengerFlowTotal++;
}
- //¿Ϣ
+ //更新客流信息
PassengerFlowUpdate();
// ToileUseChartByDay();
// ToileUseChartTotal();
- //ˮ
+ //计算用水量
SetDayWarterAndelEctricity();
}
- #endregion Ƿ
+ #endregion 厕所是否有人
- #region
+ #region 气象相关
///
- /// ȡϢ
+ /// 获取气象信息
///
///
private async Task GetWeather()
{
- //ȡʵʱ
+ //获取城市实时天气
var weatherModel = await weatherController.GetWeatherNowAsync();
- //ȡ
+ //获取城市天气质量
var airModel = await weatherController.GetWeatherAirAsync();
- //ȡָ
+ //获取城市天气指数
var levelModel = await weatherController.GetWeatherIndicesAsync();
this.Invoke(new Action(() =>
{
- //óʵʱ
+ //设置城市实时天气
if (weatherModel != null && weatherModel.IsSuccee)
{
DateTime.TryParse(weatherModel.UpdateTime, out DateTime dt);
//lblWeatherUpdateTime.Text = dt.ToString("yyyy-MM-dd HH:mm:ss");
lblWeatherText.Text = weatherModel.Now.Text;
lblWeatherWindDir.Text = weatherModel.Now.WindDir;
- lblWeatherWindScale.Text = weatherModel.Now.WindScale.ToString() + "";
+ lblWeatherWindScale.Text = weatherModel.Now.WindScale.ToString() + "级";
lblWeatherHumidity.Text = weatherModel.Now.Humidity.ToString() + "%";
- lblWeatherFeelsLike.Text = weatherModel.Now.FeelsLike.ToString() + "C";
- lblWeatherTemp.Text = weatherModel.Now.Temp.ToString() + "C";
+ lblWeatherFeelsLike.Text = weatherModel.Now.FeelsLike.ToString() + "C°";
+ lblWeatherTemp.Text = weatherModel.Now.Temp.ToString() + "C°";
var icon = weatherModel.Now.Icon;
if (icon == 151)
{
@@ -372,12 +374,12 @@ namespace GuideScreen.UI
}
pBoxWeatherIcon.Image = (Image)(Resources.ResourceManager.GetObject($"_{icon}"));
}
- //ó
+ //设置城市天气质量
if (airModel != null && airModel.IsSuccee)
{
WeatherAir(airModel);
}
- //óָ
+ //设置城市天气指数
if (levelModel != null && levelModel.IsSuccee && levelModel.Daily.Length == 2)
{
lblWeatherUltravioletRay.Text = levelModel.Daily[0].Category;
@@ -387,7 +389,7 @@ namespace GuideScreen.UI
}
///
- /// ʾ
+ /// 显示空气质量
///
///
private void WeatherAir(WeatherAirModel model)
@@ -426,12 +428,12 @@ namespace GuideScreen.UI
btnAQI.Text = "AQI " + model.Now.Category;
}
- #endregion
+ #endregion 气象相关
- #region ͳ
+ #region 人流统计
///
- ///
+ /// 人流经过
///
///
///
@@ -440,7 +442,7 @@ namespace GuideScreen.UI
}
///
- ///
+ /// 客流量更新
///
private void PassengerFlowUpdate()
{
@@ -455,89 +457,89 @@ namespace GuideScreen.UI
passengerFlowTotal = 1;
}
// lblPassengerFlowHistoryCount.Text = passengerFlowTotal.ToString("D8").Aggregate(string.Empty, (c, i) => c + i + " ");
- //λͼ
+ //侧位图表
ToileUseChartByDay();
//ToileUseChartTotal();
}
- #endregion ͳ
+ #endregion 人流统计
- #region PLCȡλ
+ #region PLC获取点位
private void PointChange(PLCPoint e)
{
Debug.WriteLine(Masuit.Tools.ObjectExtensions.ToJsonString(e));
switch (e.Name)
{
- #region λ״̬
+ #region 侧位状态
- //вλ1״̬
+ //男侧位1状态
case PLCPointNameByToiletPosition.ToiletManStatus1:
ToileUseChange(true, 1, e.GetValue());
break;
- //вλ2״̬
+ //男侧位2状态
case PLCPointNameByToiletPosition.ToiletManStatus2:
ToileUseChange(true, 2, e.GetValue());
break;
- //вλ3״̬
+ //男侧位3状态
case PLCPointNameByToiletPosition.ToiletManStatus3:
ToileUseChange(true, 3, e.GetValue());
break;
- //вλ4״̬
+ //男侧位4状态
case PLCPointNameByToiletPosition.ToiletManStatus4:
ToileUseChange(true, 4, e.GetValue());
break;
- //вλ5״̬
+ //男侧位5状态
case PLCPointNameByToiletPosition.ToiletManStatus5:
ToileUseChange(true, 5, e.GetValue());
break;
- //Ůλ1״̬
+ //女侧位1状态
case PLCPointNameByToiletPosition.ToiletWomanStatus1:
ToileUseChange(false, 1, e.GetValue());
break;
- //Ůλ2״̬
+ //女侧位2状态
case PLCPointNameByToiletPosition.ToiletWomanStatus2:
ToileUseChange(false, 2, e.GetValue());
break;
- //Ůλ3״̬
+ //女侧位3状态
case PLCPointNameByToiletPosition.ToiletWomanStatus3:
ToileUseChange(false, 3, e.GetValue());
break;
- #endregion λ״̬
+ #endregion 侧位状态
- #region ܺļ
+ #region 能耗监控
- //õ
+ //用电量
case PLCPointNameByEnergyMonitoring.ElectricityConsumption:
- //ܵ
- lblElectricityMeter.Text = Convert.ToInt32(e.GetValue()).ToString();
- //յ
- var str = Convert.ToInt32(plcController.GetTodayElectricityConsumption(e.GetValue())).ToString();
+ //总电量
+ // lblElectricityMeter.Text = Convert.ToInt32(e.GetValue()).ToString();
+ //今日电量
+ // var str = Convert.ToInt32(plcController.GetTodayElectricityConsumption(e.GetValue())).ToString();
//str = str.Aggregate(string.Empty, (c, i) => c + i + " ");
- lblElectricQuantity.Text = $"պĵ {str} ǧʱ";
+ // lblElectricQuantity.Text = $"今日耗电量 {str} 千瓦时";
break;
case PLCPointNameByEnergyMonitoring.WaterConsumption:
- //ˮ
+ //总用水量
//var waterValue = e.GetValue();//* 0.001f;
//lblWaterMeter.Text = Convert.ToInt32(waterValue).ToString();
- //ˮ
+ //今日用水量
//var str1 = Convert.ToInt32(plcController.GetTodayWarterConsumption(waterValue)).ToString();
////str1 = str1.Aggregate(string.Empty, (c, i) => c + i + " ");
- //lblDayWarter.Text = $"ˮ {str1} ";
+ //lblDayWarter.Text = $"今日用水量 {str1} 吨 ";
break;
- #endregion ܺļ
+ #endregion 能耗监控
- #region
+ #region 环境监控
case PLCPointNameByEnvironmentalMonitoring.Temperature:
var temperature = e.GetValue();
var temperatureValue = Math.Round(165 * temperature / 1650f - 40, 2);
- lblEnvirTempl.Text = temperatureValue + " C";
+ lblEnvirTempl.Text = temperatureValue + " °C";
//processEnvirTempl.Value = Convert.ToInt32(temperatureValue) + 40;
break;
@@ -549,24 +551,24 @@ namespace GuideScreen.UI
break;
case PLCPointNameByEnvironmentalMonitoring.NH3:
- //
+ //暂无数据
//var enviHydrogenSulfide = e.GetValue();
//lblEnviHydrogenSulfide.Text = Math.Round(enviHydrogenSulfide, 2).ToString() + " PPM";
//processEnviHydrogenSulfide.Value = Convert.ToInt32(enviHydrogenSulfide);
break;
case PLCPointNameByEnvironmentalMonitoring.H2S:
- //
+ //暂无数据
//var ammoniaGas = e.GetValue();
//lblEnviAmmoniaGas.Text = Math.Round(ammoniaGas, 2).ToString() + " PPM";
//processEnviAmmoniaGas.Value = Convert.ToInt32(ammoniaGas);
break;
- #endregion
+ #endregion 环境监控
- #region ձվ
+ #region 真空泵站
- //ʵʱն
+ //实时真空度
case PLCPointNameByVacuumPumpingStation.RealTimeVacuum:
var realTimeVacuum = e.GetValue();
var value = Math.Abs(realTimeVacuum);
@@ -575,31 +577,31 @@ namespace GuideScreen.UI
lblVacuum.Text = $"-{value} KPa";
VacuumChart(value);
break;
- //е1
+ //运行电流1
case PLCPointNameByVacuumPumpingStation.RunningCurrent1:
var runningCurrent = e.GetValue();
analogMeterElectricity1.Value = runningCurrent;
lblElectricity1.Text = $"{runningCurrent} A";
break;
- //Ƶ1
+ //运行频率1
case PLCPointNameByVacuumPumpingStation.RunningFrequency1:
var runningFrequency = e.GetValue();
analogMeterFrequency1.Value = runningFrequency;
lblFrequency1.Text = $"{runningFrequency} HZ";
break;
- //е2
+ //运行电流2
case PLCPointNameByVacuumPumpingStation.RunningCurrent2:
var runningCurrent2 = e.GetValue();
analogMeterElectricity2.Value = runningCurrent2;
lblElectricity2.Text = $"{runningCurrent2} A";
break;
- //Ƶ2
+ //运行频率2
case PLCPointNameByVacuumPumpingStation.RunningFrequency2:
var runningFrequency2 = e.GetValue();
analogMeterFrequency2.Value = runningFrequency2;
lblFrequency2.Text = $"{runningFrequency2} HZ";
break;
- //1ű״̬
+ //1号泵状态
case PLCPointNameByVacuumPumpingStation.PumpingStation1:
if (e.GetValue())
{
@@ -610,7 +612,7 @@ namespace GuideScreen.UI
LedBulbOneRun.ForeColor = Color.Gray;
}
break;
- //2ű״̬
+ //2号泵状态
case PLCPointNameByVacuumPumpingStation.PumpingStation2:
if (e.GetValue())
{
@@ -621,28 +623,28 @@ namespace GuideScreen.UI
LedBulbTwoRun.ForeColor = Color.Gray;
}
break;
- //1űд
+ //1号泵运行次数
case PLCPointNameByVacuumPumpingStation.PumpStartTimes1:
var pumpStartCount1 = e.GetValue();
LedDisplayOneCount.Text = pumpStartCount1.ToString("D6");
break;
- //2űд
+ //2号泵运行次数
case PLCPointNameByVacuumPumpingStation.PumpStartTimes2:
var pumpStartCount2 = e.GetValue();
LedDisplayTwoCount.Text = pumpStartCount2.ToString("D6");
break;
- //1űʱ
+ //1号泵运行时间
case PLCPointNameByVacuumPumpingStation.PumpAccumulatedStartTime1:
var pumpAccumulatedStartTime1 = e.GetValue();
LedDisplayOneTime.Text = pumpAccumulatedStartTime1.ToString("D5") + "H";
break;
- //2űʱ
+ //2号泵运行时间
case PLCPointNameByVacuumPumpingStation.PumpAccumulatedStartTime2:
var pumpAccumulatedStartTime2 = e.GetValue();
LedDisplayTwoTime.Text = pumpAccumulatedStartTime2.ToString("D5") + "H";
break;
- #endregion ձվ
+ #endregion 真空泵站
default:
break;
@@ -658,12 +660,12 @@ namespace GuideScreen.UI
}
}
- #endregion PLCȡλ
+ #endregion PLC获取点位
- #region ͼ
+ #region 图表相关
///
- ///
+ /// 人流量
///
//private void PassengerFlowChart(List list)
//{
@@ -682,15 +684,15 @@ namespace GuideScreen.UI
// option.ToolTip.Visible = true;
// option.YAxis.Scale = true;
- // option.XAxis.Name = "";
- // option.XAxis.AxisLabel.Angle = 60;//(0 ~ 90)
- // option.YAxis.Name = "ֵ";
+ // option.XAxis.Name = "日期";
+ // option.XAxis.AxisLabel.Angle = 60;//(0° ~ 90°)
+ // option.YAxis.Name = "数值";
- // //ʾСλ
+ // //数据显示小数位数
// series.DecimalPlaces = 0;
// option.Series.Add(series);
- // //ʾСλ
+ // //坐标轴显示小数位数
// option.YAxis.AxisLabel.DecimalPlaces = 0;
// option.XAxis.AxisLabel.DecimalPlaces = 0;
// option.ToolTip.AxisPointer.Type = UIAxisPointerType.Shadow;
@@ -699,13 +701,13 @@ namespace GuideScreen.UI
//}
///
- /// ղλʹ
+ /// 今日厕位使用情况
///
private void ToileUseChartByDay()
{
UIBarOption option = new UIBarOption();
option.Title = new UITitle();
- option.Title.Text = "ղλʹü¼";
+ option.Title.Text = "今日厕位使用记录";
option.Title.SubText = string.Empty;
var series = new UIBarSeries();
@@ -718,15 +720,15 @@ namespace GuideScreen.UI
option.ToolTip.Visible = true;
option.YAxis.Scale = true;
- option.XAxis.Name = "λ";
- //option.XAxis.AxisLabel.Angle = 60;//(0 ~ 90)
- //option.YAxis.Name = "ʹô";
+ option.XAxis.Name = "厕位";
+ //option.XAxis.AxisLabel.Angle = 60;//(0° ~ 90°)
+ //option.YAxis.Name = "使用次数";
- //ʾСλ
+ //数据显示小数位数
series.DecimalPlaces = 0;
option.Series.Add(series);
- //ʾСλ
+ //坐标轴显示小数位数
option.YAxis.AxisLabel.DecimalPlaces = 0;
option.XAxis.AxisLabel.DecimalPlaces = 0;
option.ToolTip.AxisPointer.Type = UIAxisPointerType.Shadow;
@@ -735,13 +737,13 @@ namespace GuideScreen.UI
}
///
- /// λʹͳ
+ /// 厕位使用统计
///
private void ToileUseChartTotal()
{
UIBarOption option = new UIBarOption();
option.Title = new UITitle();
- option.Title.Text = "λʹͳ";
+ option.Title.Text = "厕位使用统计";
option.Title.SubText = string.Empty;
var series = new UIBarSeries();
@@ -755,15 +757,15 @@ namespace GuideScreen.UI
option.ToolTip.Visible = true;
option.YAxis.Scale = true;
- option.XAxis.Name = "λ";
- //option.XAxis.AxisLabel.Angle = 60;//(0 ~ 90)
- //option.YAxis.Name = "ʹô";
+ option.XAxis.Name = "厕位";
+ //option.XAxis.AxisLabel.Angle = 60;//(0° ~ 90°)
+ //option.YAxis.Name = "使用次数";
- //ʾСλ
+ //数据显示小数位数
series.DecimalPlaces = 0;
option.Series.Add(series);
- //ʾСλ
+ //坐标轴显示小数位数
option.YAxis.AxisLabel.DecimalPlaces = 0;
option.XAxis.AxisLabel.DecimalPlaces = 0;
option.ToolTip.AxisPointer.Type = UIAxisPointerType.Shadow;
@@ -774,7 +776,7 @@ namespace GuideScreen.UI
///
- /// նͼ
+ /// 真空度曲线图
///
///
private void VacuumChart(double value)
@@ -787,13 +789,13 @@ namespace GuideScreen.UI
option.Title.Text = string.Empty;
option.Title.SubText = string.Empty;
option.AddSeries(new UILineSeries("vacuumLine"));
- //ʾСλ
+ //坐标轴显示小数位数
option.XAxis.AxisLabel.DecimalPlaces = 0;
option.YAxis.AxisLabel.DecimalPlaces = 0;
chartVacuum.SetOption(option);
}
- //նȹ
+ //真空度过期
if (vacuumIndex > 1000)
{
vacuumIndex = 0;
@@ -805,29 +807,44 @@ namespace GuideScreen.UI
}
- #endregion ͼ
+ #endregion 图表相关
///
- /// ˮ
+ /// 计算用水量
///
private void SetDayWarterAndelEctricity()
{
var count = toilets.Values.Sum();
- //ÿô1.6ˮ
- var value = Convert.ToSingle(Math.Round(count * 0.0016, 4));
+ //每用次0.8 升水
+ var value = Convert.ToSingle(Math.Round(count * 0.8, 2));
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
{
Device = PLCDeviceNames.EnergyMonitoring,
Name = PLCPointNameByEnergyMonitoring.WaterConsumption,
- Note = "ˮ",
+ Note = "用水量",
DataType = typeof(float),
ObjectValue = value,
});
- //ˮ
- lblWaterMeter.Text = plcController.GetWaterTotal().ToString();
+ plcController.AdddeviceRecord(new PLCPoint
+ {
+ Device = PLCDeviceNames.EnergyMonitoring,
+ Name = PLCPointNameByEnergyMonitoring.ElectricityConsumption,
+ Note = "用电量",
+ DataType = typeof(float),
+ ObjectValue = val,
+ });
+
}
#region Timer
@@ -835,27 +852,27 @@ namespace GuideScreen.UI
private Random rd = new Random();
///
- /// ʱ
+ /// 日期时间
///
///
///
private void timer1_Tick(object sender, EventArgs e)
{
var dateTime = DateTime.Now;
- //ʱ
+ //日期时间
lblTime.Text = dateTime.ToString("yyyy-MM-dd HH:mm:ss");
- //
+ //星期
lblweek.Text = DateTime.Today.ToString("dddd", new System.Globalization.CultureInfo("zh-CN"));
- //Ժµ
+ //零点以后更新的数据
if (dateTime.ToString("HH:mm:ss") == zeroTime)
{
- //²λʹ
+ //更新厕位使用情况
toilets = plcController.ToiletPositionRecordTotalByToday();
ToileUseChartByDay();
}
}
- //ʱ
+ //定时更新气象数据
private async void timer2_Tick(object sender, EventArgs e)
{
await GetWeather();
@@ -865,7 +882,7 @@ namespace GuideScreen.UI
private void timer3_Tick(object sender, EventArgs e)
{
- //
+ //报警数据
this.txtAlarm.Text = commonController.AlarmText;
}
}