20230306更新

old
xiaoguo 2 years ago
parent 869cbeb439
commit 7eb89ad4fd

@ -35,18 +35,11 @@
this.uiAvatar = new Sunny.UI.UIAvatar();
this.uiNavBar = new Sunny.UI.UINavBar();
this.uiStyleManager = new Sunny.UI.UIStyleManager(this.components);
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.plcStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.plcStatusValue = new System.Windows.Forms.ToolStripStatusLabel();
this.torqueStatusValue = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusMessage = new System.Windows.Forms.ToolStripStatusLabel();
this.timer = new System.Windows.Forms.Timer(this.components);
((System.ComponentModel.ISupportInitialize)(this.uiSplitContainer)).BeginInit();
this.uiSplitContainer.Panel1.SuspendLayout();
this.uiSplitContainer.Panel2.SuspendLayout();
this.uiSplitContainer.SuspendLayout();
this.uiNavBar.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.SuspendLayout();
//
// uiTabControl1
@ -61,7 +54,7 @@
this.uiTabControl1.Name = "uiTabControl1";
this.uiTabControl1.SelectedIndex = 0;
this.uiTabControl1.ShowCloseButton = true;
this.uiTabControl1.Size = new System.Drawing.Size(1002, 757);
this.uiTabControl1.Size = new System.Drawing.Size(1002, 789);
this.uiTabControl1.SizeMode = System.Windows.Forms.TabSizeMode.Fixed;
this.uiTabControl1.TabIndex = 0;
this.uiTabControl1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@ -82,7 +75,7 @@
// uiSplitContainer.Panel2
//
this.uiSplitContainer.Panel2.Controls.Add(this.uiTabControl1);
this.uiSplitContainer.Size = new System.Drawing.Size(1145, 757);
this.uiSplitContainer.Size = new System.Drawing.Size(1145, 789);
this.uiSplitContainer.SplitterDistance = 132;
this.uiSplitContainer.SplitterWidth = 11;
this.uiSplitContainer.TabIndex = 4;
@ -107,7 +100,7 @@
this.uiNavMenu1.ShowNodeToolTips = true;
this.uiNavMenu1.ShowSecondBackColor = true;
this.uiNavMenu1.ShowTips = true;
this.uiNavMenu1.Size = new System.Drawing.Size(132, 757);
this.uiNavMenu1.Size = new System.Drawing.Size(132, 789);
this.uiNavMenu1.Style = Sunny.UI.UIStyle.Custom;
this.uiNavMenu1.TabIndex = 0;
this.uiNavMenu1.TipsFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@ -147,75 +140,22 @@
//
this.uiStyleManager.DPIScale = true;
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.plcStatus,
this.plcStatusValue,
this.torqueStatusValue,
this.toolStripStatusMessage});
this.statusStrip1.Location = new System.Drawing.Point(0, 902);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(1145, 32);
this.statusStrip1.TabIndex = 5;
this.statusStrip1.Text = "statusStrip";
//
// plcStatus
//
this.plcStatus.Font = new System.Drawing.Font("Microsoft YaHei UI", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.plcStatus.ForeColor = System.Drawing.Color.Black;
this.plcStatus.Name = "plcStatus";
this.plcStatus.Size = new System.Drawing.Size(129, 27);
this.plcStatus.Text = "PLC通信状态";
//
// plcStatusValue
//
this.plcStatusValue.BackColor = System.Drawing.Color.White;
this.plcStatusValue.Font = new System.Drawing.Font("Microsoft YaHei UI", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.plcStatusValue.Name = "plcStatusValue";
this.plcStatusValue.Size = new System.Drawing.Size(36, 27);
this.plcStatusValue.Text = " ";
//
// torqueStatusValue
//
this.torqueStatusValue.BackColor = System.Drawing.Color.White;
this.torqueStatusValue.Font = new System.Drawing.Font("Microsoft YaHei UI", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.torqueStatusValue.Name = "torqueStatusValue";
this.torqueStatusValue.Size = new System.Drawing.Size(36, 27);
this.torqueStatusValue.Text = " ";
//
// toolStripStatusMessage
//
this.toolStripStatusMessage.Font = new System.Drawing.Font("Microsoft YaHei UI", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.toolStripStatusMessage.Name = "toolStripStatusMessage";
this.toolStripStatusMessage.Size = new System.Drawing.Size(0, 27);
//
// timer
//
this.timer.Enabled = true;
this.timer.Interval = 3000;
this.timer.Tick += new System.EventHandler(this.timer_TickAsync);
//
// MainForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1145, 934);
this.Controls.Add(this.uiSplitContainer);
this.Controls.Add(this.uiNavBar);
this.Controls.Add(this.statusStrip1);
this.Name = "MainForm";
this.Text = "配置管理";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.ZoomScaleRect = new System.Drawing.Rectangle(15, 15, 800, 450);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing);
this.uiSplitContainer.Panel1.ResumeLayout(false);
this.uiSplitContainer.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.uiSplitContainer)).EndInit();
this.uiSplitContainer.ResumeLayout(false);
this.uiNavBar.ResumeLayout(false);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
@ -227,12 +167,6 @@
private Sunny.UI.UIAvatar uiAvatar;
private Sunny.UI.UINavBar uiNavBar;
private Sunny.UI.UIStyleManager uiStyleManager;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel plcStatus;
private System.Windows.Forms.ToolStripStatusLabel plcStatusValue;
private System.Windows.Forms.ToolStripStatusLabel torqueStatusValue;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusMessage;
private System.Windows.Forms.Timer timer;
}
}

@ -28,9 +28,6 @@ namespace GuideScreen.Control
//所有有功能的菜单
private List<MenuModel> allMenuModels = null;
//plc 控制服务
//private PLCController pLCController = null;
//是否管理员已登录
private bool isAdminLogin = false;
@ -48,11 +45,6 @@ namespace GuideScreen.Control
this.uiNavMenu1.MenuItemClick += UiNavMenu1_MenuItemClick;
this.uiNavBar.MenuItemClick += UiNavBar_MenuItemClick;
//获取plc 服务控制
//pLCControllerService = DIManager.GetContainerObject<IPLCControllerService>();
//pLCControllerService.ErrorMessage += PLCControllerService_ErrorMessage;
//pLCControllerService.InfoMessage += PLCControllerService_InfoMessage;
//日志服务
logService = DIManager.GetContainerObject<ILogService>();
@ -220,68 +212,5 @@ namespace GuideScreen.Control
}
#endregion
#region PLC 相关
//打开PLC
//private async Task OpenPLCAsync()
//{
// var address = systemService.GetSystemConfig(SystemConfigKeys.PLCAddress.ToString());
// var port = systemService.GetSystemConfig(SystemConfigKeys.PLCPort.ToString());
// await pLCControllerService.ConnectionAsync(address.ConfigValue);
//}
//private async Task GetHeartbeatAsync(bool isGetRunType)
//{
// if (!isGetRunType)
// {
// this.Invoke(new Action(() =>
// {
// plcStatusValue.Text = " ";
// }));
// return;
// }
// var value = await pLCControllerService.GetHeartbeatAsync();
// this.Invoke(new Action(() =>
// {
// plcStatusValue.ForeColor = Color.Green;
// plcStatusValue.Text = "正常";
// }));
//}
private void timer_TickAsync(object sender, EventArgs e)
{
isSwitch = !isSwitch;
//获取plc心跳
//await GetHeartbeatAsync(isSwitch);
}
private void PLCControllerService_InfoMessage(object sender, string e)
{
e.WriteInfoLog();
}
private void PLCControllerService_ErrorMessage(object sender, string e)
{
Task.Run(() =>
{
this.Invoke(new Action(() =>
{
toolStripStatusMessage.Text = e;
toolStripStatusMessage.ForeColor = Color.Red;
plcStatusValue.ForeColor = Color.Red;
plcStatusValue.Text = "异常";
e.WriteErrorLog();
}));
}).ConfigureAwait(false);
}
#endregion
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
// await pLCControllerService.CloseConnectionAsync();
}
}
}

@ -120,9 +120,6 @@
<metadata name="uiStyleManager.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>462, 17</value>
</metadata>
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>606, 17</value>
</metadata>
<metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>727, 17</value>
</metadata>

@ -1026,7 +1026,7 @@ namespace GuideScreen.UI
//
this.lblRealTimeVacuum.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.lblRealTimeVacuum.ForeColor = System.Drawing.Color.Yellow;
this.lblRealTimeVacuum.Location = new System.Drawing.Point(127, 252);
this.lblRealTimeVacuum.Location = new System.Drawing.Point(127, 245);
this.lblRealTimeVacuum.Name = "lblRealTimeVacuum";
this.lblRealTimeVacuum.Size = new System.Drawing.Size(116, 33);
this.lblRealTimeVacuum.Style = Sunny.UI.UIStyle.Custom;

@ -38,8 +38,9 @@ namespace GuideScreen.UI
private PLCController plcController;
//客流量
private int passengerFlowDayCount = 0;
//男厕使用数量
private const string currentManNumStrFormat = "5/{0}";
//女厕使用数量
private const string currentWomanNumStrFormat = "3/{0}";
public FormScreen()
@ -81,117 +82,18 @@ namespace GuideScreen.UI
//开启PLC通信
plcController.Start();
}
private void timer1_Tick(object sender, EventArgs e)
{
lblTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
#region 获取点位更新
private void PlcController_PointChnage(object sender, PLCPoint e)
{
switch (e.Name)
this.Invoke(new Action(() =>
{
#region 侧位状态
//男侧位1状态
case PLCPointNameByToiletPosition.ToiletManStatus1:
ToileUseChange(true, 1, e.GetValue<bool>());
break;
//男侧位2状态
case PLCPointNameByToiletPosition.ToiletManStatus2:
ToileUseChange(true, 2, e.GetValue<bool>());
break;
//男侧位3状态
case PLCPointNameByToiletPosition.ToiletManStatus3:
ToileUseChange(true, 3, e.GetValue<bool>());
break;
//男侧位4状态
case PLCPointNameByToiletPosition.ToiletManStatus4:
ToileUseChange(true, 4, e.GetValue<bool>());
break;
//男侧位5状态
case PLCPointNameByToiletPosition.ToiletManStatus5:
ToileUseChange(true, 5, e.GetValue<bool>());
break;
//女侧位1状态
case PLCPointNameByToiletPosition.ToiletWomanStatus1:
ToileUseChange(false, 1, e.GetValue<bool>());
break;
//女侧位2状态
case PLCPointNameByToiletPosition.ToiletWomanStatus2:
ToileUseChange(false, 2, e.GetValue<bool>());
break;
//女侧位3状态
case PLCPointNameByToiletPosition.ToiletWomanStatus3:
ToileUseChange(false, 3, e.GetValue<bool>());
break;
#endregion
#region 能耗监控
//用电量
case PLCPointNameEnergyMonitoring.ElectricityConsumption:
lblElectricityMeter.Text = Convert.ToInt32(e.GetValue<float>()).ToString();
break;
//用水量
#endregion
#region 环境监控
case PLCPointNameByEnvironmentalMonitoring.H2S:
lblAmmoniaGas.Text = Math.Round(e.GetValue<float>(), 1).ToString() + " PPM";
break;
case PLCPointNameByEnvironmentalMonitoring.NH3:
lblEnviHydrogenSulfide.Text = Math.Round(e.GetValue<float>(), 2).ToString() + " PPM";
break;
case PLCPointNameByEnvironmentalMonitoring.Temperature:
lblEnvirTempl.Text = Math.Round(e.GetValue<float>(), 1).ToString() + " °C";
break;
case PLCPointNameByEnvironmentalMonitoring.Humidity:
lblEnvirTempl.Text = Math.Round(e.GetValue<float>(), 1).ToString() + " %";
break;
#endregion
#region 真空泵站
//实时真空度
case PLCPointNameByVacuumPumpingStation.RealTimeVacuum:
AnalogMeter.Value = Convert.ToInt32(e.GetValue<float>());
lblRealTimeVacuum.Text = $"-{AnalogMeter.Value}";
break;
//1号泵状态
case PLCPointNameByVacuumPumpingStation.PumpingStation1:
if (e.GetValue<bool>())
{
lblOneState.Text = "运行";
lblOneState.ForeColor = Color.PaleGreen;
}
else
{
lblOneState.Text = "停运";
lblOneState.ForeColor = Color.Red;
}
break;
//2号泵状态
case PLCPointNameByVacuumPumpingStation.PumpingStation2:
if (e.GetValue<bool>())
{
lblTwoState.Text = "运行";
lblTwoState.ForeColor = Color.PaleGreen;
}
else
{
lblTwoState.Text = "停运";
lblTwoState.ForeColor = Color.Red;
}
break;
#endregion
PointChange(e);
default:
break;
}
}));
}
#endregion
#region 厕所是否有人
@ -388,7 +290,6 @@ namespace GuideScreen.UI
#endregion
#region 人流统计
/// <summary>
/// 人流经过
@ -418,9 +319,107 @@ namespace GuideScreen.UI
#endregion
#region PLC获取点位
private void PointChange()
private void PointChange(PLCPoint e)
{
switch (e.Name)
{
#region 侧位状态
//男侧位1状态
case PLCPointNameByToiletPosition.ToiletManStatus1:
ToileUseChange(true, 1, e.GetValue<bool>());
break;
//男侧位2状态
case PLCPointNameByToiletPosition.ToiletManStatus2:
ToileUseChange(true, 2, e.GetValue<bool>());
break;
//男侧位3状态
case PLCPointNameByToiletPosition.ToiletManStatus3:
ToileUseChange(true, 3, e.GetValue<bool>());
break;
//男侧位4状态
case PLCPointNameByToiletPosition.ToiletManStatus4:
ToileUseChange(true, 4, e.GetValue<bool>());
break;
//男侧位5状态
case PLCPointNameByToiletPosition.ToiletManStatus5:
ToileUseChange(true, 5, e.GetValue<bool>());
break;
//女侧位1状态
case PLCPointNameByToiletPosition.ToiletWomanStatus1:
ToileUseChange(false, 1, e.GetValue<bool>());
break;
//女侧位2状态
case PLCPointNameByToiletPosition.ToiletWomanStatus2:
ToileUseChange(false, 2, e.GetValue<bool>());
break;
//女侧位3状态
case PLCPointNameByToiletPosition.ToiletWomanStatus3:
ToileUseChange(false, 3, e.GetValue<bool>());
break;
#endregion
#region 能耗监控
//用电量
case PLCPointNameEnergyMonitoring.ElectricityConsumption:
lblElectricityMeter.Text = Convert.ToInt32(e.GetValue<float>()).ToString();
break;
//用水量
#endregion
#region 环境监控
case PLCPointNameByEnvironmentalMonitoring.H2S:
lblAmmoniaGas.Text = Math.Round(e.GetValue<float>(), 1).ToString() + " PPM";
break;
case PLCPointNameByEnvironmentalMonitoring.NH3:
lblEnviHydrogenSulfide.Text = Math.Round(e.GetValue<float>(), 2).ToString() + " PPM";
break;
case PLCPointNameByEnvironmentalMonitoring.Temperature:
lblEnvirTempl.Text = Math.Round(e.GetValue<float>(), 1).ToString() + " °C";
break;
case PLCPointNameByEnvironmentalMonitoring.Humidity:
lblEnvirTempl.Text = Math.Round(e.GetValue<float>(), 1).ToString() + " %";
break;
#endregion
#region 真空泵站
//实时真空度
case PLCPointNameByVacuumPumpingStation.RealTimeVacuum:
AnalogMeter.Value = Convert.ToInt32(e.GetValue<float>());
lblRealTimeVacuum.Text = $"-{AnalogMeter.Value}";
break;
//1号泵状态
case PLCPointNameByVacuumPumpingStation.PumpingStation1:
if (e.GetValue<bool>())
{
lblOneState.Text = "运行";
lblOneState.ForeColor = Color.PaleGreen;
}
else
{
lblOneState.Text = "停运";
lblOneState.ForeColor = Color.Red;
}
break;
//2号泵状态
case PLCPointNameByVacuumPumpingStation.PumpingStation2:
if (e.GetValue<bool>())
{
lblTwoState.Text = "运行";
lblTwoState.ForeColor = Color.PaleGreen;
}
else
{
lblTwoState.Text = "停运";
lblTwoState.ForeColor = Color.Red;
}
break;
#endregion
default:
break;
}
}
#endregion
@ -528,6 +527,15 @@ namespace GuideScreen.UI
this.ShowErrorTip(e, 3000);
}
/// <summary>
/// 日期时间
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void timer1_Tick(object sender, EventArgs e)
{
lblTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
}
private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
{

Loading…
Cancel
Save