侧位使用统计数据源改为来自数据库统计

main
肖果 2 months ago
parent 0a08f1e34a
commit 98d4563571

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -65,5 +65,11 @@ namespace GuideScreen.Common.Repositories
/// </summary>
/// <returns></returns>
decimal WaterTotal();
/// <summary>
/// 获取厕位使用计
/// </summary>
/// <returns></returns>
IDictionary<string, decimal> ToiletTotal();
}
}

@ -326,5 +326,32 @@ namespace GuideScreen.Common.Repositories.Impl
return val ?? 0;
}
}
/// <summary>
/// 获取厕位使用计
/// </summary>
/// <returns></returns>
public IDictionary<string, decimal> ToiletTotal()
{
//返回集合
var retValues = new Dictionary<string, decimal>();
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;
}
}
}

@ -98,5 +98,11 @@ namespace GuideScreen.Common.Services
/// </summary>
/// <returns></returns>
decimal WaterTotal();
/// <summary>
/// 获取厕位使用计
/// </summary>
/// <returns></returns>
IDictionary<string, decimal> ToiletTotal();
}
}

@ -235,5 +235,17 @@ namespace GuideScreen.Common.Services.Impl
return ret;
}
/// <summary>
/// 获取厕位使用计
/// </summary>
/// <returns></returns>
public IDictionary<string, decimal> ToiletTotal()
{
var ret = this.deviceRecordRepository.ToiletTotal();
return ret;
}
}
}

@ -125,16 +125,28 @@ namespace GuideScreen.Common.Services.Impl
public IDictionary<string, int> ToiletPositionRecordTotal()
{
//厕所侧位使用统计
//var toilets = new Dictionary<string, int>
//{
// ["男厕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<string, int>
{
["男厕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<string, decimal> 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;
}
/// <summary>
@ -204,7 +225,7 @@ namespace GuideScreen.Common.Services.Impl
break;
//获取冲洗统计
case PLCDeviceNames.WashCount:
ToiletPositionRecordTotal();
//ToiletPositionRecordTotal();
break;
default:
break;

@ -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;
@ -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";

@ -67,6 +67,8 @@ namespace GuideScreen.UI
plcController = DIManager.GetContainerObject<PLCController>();
plcController.PointChnage += PlcController_PointChnage;
plcController.ErrorMessage += Controller_ErrorMessage;
ToileUseChartTotal();
//passengerFlowStatisticsController = DIManager.GetContainerObject<PassengerFlowStatisticsController>();
//passengerFlowStatisticsController.Action += PassengerFlowStatisticsController_Action;
//passengerFlowStatisticsController.ErrorMessage += Controller_ErrorMessage;

Loading…
Cancel
Save