可测试版本

This commit is contained in:
杨晓东 2026-01-30 10:10:14 +08:00
parent f6f77a58c4
commit ac6c2cb260
6 changed files with 49 additions and 24 deletions

View File

@ -33,7 +33,7 @@
this.buttonDisconnect = new System.Windows.Forms.Button(); this.buttonDisconnect = new System.Windows.Forms.Button();
this.textBoxLog = new System.Windows.Forms.TextBox(); this.textBoxLog = new System.Windows.Forms.TextBox();
this.statusStrip1 = new System.Windows.Forms.StatusStrip(); this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel3 = new System.Windows.Forms.ToolStripStatusLabel();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.button6 = new System.Windows.Forms.Button(); this.button6 = new System.Windows.Forms.Button();
this.label8 = new System.Windows.Forms.Label(); this.label8 = new System.Windows.Forms.Label();
@ -57,13 +57,14 @@
this.label3 = new System.Windows.Forms.Label(); this.label3 = new System.Windows.Forms.Label();
this.panelLed = new System.Windows.Forms.Panel(); this.panelLed = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel();
this.statusStrip2 = new System.Windows.Forms.StatusStrip();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.miniToolStrip = new System.Windows.Forms.StatusStrip(); this.miniToolStrip = new System.Windows.Forms.StatusStrip();
this.statusStrip1.SuspendLayout();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.bsPF2)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bsPF2)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.bsPF)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.bsPF)).BeginInit();
this.panel3.SuspendLayout(); this.panel3.SuspendLayout();
this.statusStrip2.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// buttonConnect // buttonConnect
@ -109,7 +110,6 @@
// //
this.statusStrip1.AutoSize = false; this.statusStrip1.AutoSize = false;
this.statusStrip1.Dock = System.Windows.Forms.DockStyle.None; this.statusStrip1.Dock = System.Windows.Forms.DockStyle.None;
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabel1 });
this.statusStrip1.Location = new System.Drawing.Point(72, 26); this.statusStrip1.Location = new System.Drawing.Point(72, 26);
this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 13, 0); this.statusStrip1.Padding = new System.Windows.Forms.Padding(1, 0, 13, 0);
@ -120,11 +120,12 @@
this.statusStrip1.Text = "miniToolStrip"; this.statusStrip1.Text = "miniToolStrip";
this.statusStrip1.Visible = false; this.statusStrip1.Visible = false;
// //
// toolStripStatusLabel1 // toolStripStatusLabel3
// //
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1"; this.toolStripStatusLabel3.Name = "toolStripStatusLabel3";
this.toolStripStatusLabel1.Size = new System.Drawing.Size(54, 14); this.toolStripStatusLabel3.Size = new System.Drawing.Size(54, 20);
this.toolStripStatusLabel1.Text = "未连接"; this.toolStripStatusLabel3.Text = "未连接";
this.toolStripStatusLabel3.Click += new System.EventHandler(this.toolStripStatusLabel3_Click);
// //
// panel1 // panel1
// //
@ -372,6 +373,7 @@
// //
// panel3 // panel3
// //
this.panel3.Controls.Add(this.statusStrip2);
this.panel3.Controls.Add(this.panelLed); this.panel3.Controls.Add(this.panelLed);
this.panel3.Controls.Add(this.statusStrip1); this.panel3.Controls.Add(this.statusStrip1);
this.panel3.Controls.Add(this.label3); this.panel3.Controls.Add(this.label3);
@ -383,6 +385,18 @@
this.panel3.Size = new System.Drawing.Size(1008, 47); this.panel3.Size = new System.Drawing.Size(1008, 47);
this.panel3.TabIndex = 7; this.panel3.TabIndex = 7;
// //
// statusStrip2
//
this.statusStrip2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.statusStrip2.Dock = System.Windows.Forms.DockStyle.None;
this.statusStrip2.ImageScalingSize = new System.Drawing.Size(20, 20);
this.statusStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.toolStripStatusLabel3 });
this.statusStrip2.Location = new System.Drawing.Point(35, 12);
this.statusStrip2.Name = "statusStrip2";
this.statusStrip2.Size = new System.Drawing.Size(71, 25);
this.statusStrip2.TabIndex = 13;
this.statusStrip2.Text = "statusStrip2";
//
// timer1 // timer1
// //
this.timer1.Interval = 1000; this.timer1.Interval = 1000;
@ -413,20 +427,24 @@
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Name = "MainForm"; this.Name = "MainForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "孚冈-宜搭数据数据转发";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainFormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainFormClosing);
this.Load += new System.EventHandler(this.Form1_Load); this.Load += new System.EventHandler(this.Form1_Load);
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.panel1.ResumeLayout(false); this.panel1.ResumeLayout(false);
this.panel1.PerformLayout(); this.panel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.bsPF2)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bsPF2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.bsPF)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.bsPF)).EndInit();
this.panel3.ResumeLayout(false); this.panel3.ResumeLayout(false);
this.panel3.PerformLayout(); this.panel3.PerformLayout();
this.statusStrip2.ResumeLayout(false);
this.statusStrip2.PerformLayout();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
} }
private System.Windows.Forms.StatusStrip statusStrip2;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel3;
private System.Windows.Forms.Button button6; private System.Windows.Forms.Button button6;
private System.Windows.Forms.Label label8; private System.Windows.Forms.Label label8;
@ -443,7 +461,6 @@
private System.Windows.Forms.Button buttonDisconnect; private System.Windows.Forms.Button buttonDisconnect;
private System.Windows.Forms.TextBox textBoxLog; private System.Windows.Forms.TextBox textBoxLog;
private System.Windows.Forms.StatusStrip statusStrip1; private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.ComboBox comboBox1;

View File

@ -262,7 +262,7 @@ namespace YiDa_WinForm
await _mqttService.MqttClientStartAsync(); await _mqttService.MqttClientStartAsync();
LogHelper.AppendLog("连接成功!"); LogHelper.AppendLog("连接成功!");
panelLed.BackColor = Color.Green; panelLed.BackColor = Color.Green;
toolStripStatusLabel1.Text = "已连接"; toolStripStatusLabel3.Text = "已连接";
buttonConnect.Enabled = false; buttonConnect.Enabled = false;
buttonDisconnect.Enabled = true; buttonDisconnect.Enabled = true;
@ -280,7 +280,7 @@ namespace YiDa_WinForm
{ {
panelLed.BackColor = Color.Red; panelLed.BackColor = Color.Red;
LogHelper.AppendLog($"连接失败:{ex.Message}"); LogHelper.AppendLog($"连接失败:{ex.Message}");
toolStripStatusLabel1.Text = "连接失败"; toolStripStatusLabel3.Text = "连接失败";
} }
} }
@ -294,7 +294,7 @@ namespace YiDa_WinForm
await _mqttService.MqttClientStopAsync(); await _mqttService.MqttClientStopAsync();
LogHelper.AppendLog("已断开连接"); LogHelper.AppendLog("已断开连接");
panelLed.BackColor = Color.Red; panelLed.BackColor = Color.Red;
toolStripStatusLabel1.Text = "未连接"; toolStripStatusLabel3.Text = "未连接";
buttonConnect.Enabled = true; buttonConnect.Enabled = true;
buttonDisconnect.Enabled = false; buttonDisconnect.Enabled = false;
@ -375,7 +375,7 @@ namespace YiDa_WinForm
{ {
try try
{ {
if (toolStripStatusLabel1.Text != "已连接") //如果 MQTT 没连接,就不允许上传。 if (toolStripStatusLabel3.Text != "已连接") //如果 MQTT 没连接,就不允许上传。
{ {
MessageBox.Show("请先连接MQTT网关"); MessageBox.Show("请先连接MQTT网关");
return; return;
@ -635,7 +635,7 @@ namespace YiDa_WinForm
InitDailyRodCheckTimes(); InitDailyRodCheckTimes();
// ========== 修改:如果网关已连接,重启早晚固定检查定时器 ========== // ========== 修改:如果网关已连接,重启早晚固定检查定时器 ==========
if (toolStripStatusLabel1.Text == "已连接") if (toolStripStatusLabel3.Text == "已连接")
{ {
StartDailyRodFixedTimers(); StartDailyRodFixedTimers();
} }
@ -838,7 +838,7 @@ namespace YiDa_WinForm
// 2. 使用静态标记 _isRodImageUploaded 判断是否报警 // 2. 使用静态标记 _isRodImageUploaded 判断是否报警
if (!_isRodImageUploaded) if (!_isRodImageUploaded)
{ {
string alarmContent = $"连杆测试超时未上传图片!当前时间:{now:yyyy-MM-dd HH:mm:ss},配置间隔:{_lastStrengthInterval}分钟"; string alarmContent = $"连杆测试超时未上传图片!<br>当前时间:{now:yyyy-MM-dd HH:mm:ss}";
this.Invoke(new Action(() => SendDingDingAlarm(alarmContent, true))); this.Invoke(new Action(() => SendDingDingAlarm(alarmContent, true)));
} }
else else
@ -870,7 +870,7 @@ namespace YiDa_WinForm
// 2. 使用静态标记 _isScrapImageUploaded 判断是否报警(核心:上传成功则不报警) // 2. 使用静态标记 _isScrapImageUploaded 判断是否报警(核心:上传成功则不报警)
if (!_isScrapImageUploaded) if (!_isScrapImageUploaded)
{ {
string alarmContent = $"报废上传超时未上传凭证!当前时间:{now:yyyy-MM-dd HH:mm:ss},配置间隔:{_lastScrapInterval}分钟"; string alarmContent = $"报废上传超时未上传凭证!<br>当前时间:{now:yyyy-MM-dd HH:mm:ss}";
this.Invoke(new Action(() => SendDingDingAlarm(alarmContent, false))); this.Invoke(new Action(() => SendDingDingAlarm(alarmContent, false)));
} }
else else
@ -890,8 +890,8 @@ namespace YiDa_WinForm
{ {
LogHelper.AppendLog($"【钉钉报警】{(isRodAlarm ? "" : "")}{alarmContent}"); LogHelper.AppendLog($"【钉钉报警】{(isRodAlarm ? "" : "")}{alarmContent}");
await _uploadService.SendDingDingTextAlarmAsync(alarmContent, isRodAlarm); await _uploadService.SendDingDingTextAlarmAsync(alarmContent, isRodAlarm);
MessageBox.Show($"已发送钉钉{(isRodAlarm ? "" : "")}报警:{alarmContent}", "报警提示", MessageBoxButtons.OK, // MessageBox.Show($"已发送钉钉{(isRodAlarm ? "连杆" : "报废")}报警:{alarmContent}", "报警提示", MessageBoxButtons.OK,
MessageBoxIcon.Warning); // MessageBoxIcon.Warning);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -1091,7 +1091,7 @@ namespace YiDa_WinForm
if (!_isMorningRodUploaded) if (!_isMorningRodUploaded)
{ {
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
string morningAlarmContent = $"【早上连杆强制上传报警】当前时间{now:yyyy-MM-dd HH:mm:ss}已超过工作开始后30分钟{_morningCheckTime:hh\\:mm}),未上传连杆测试图片!"; string morningAlarmContent = $"【早上连杆强制上传报警】<br>当前时间{now:yyyy-MM-dd HH:mm:ss}<br>已超过工作开始后30分钟{_morningCheckTime:hh\\:mm}<br>未上传连杆测试图片!";
this.Invoke(new Action(() => SendDingDingAlarm(morningAlarmContent, true))); this.Invoke(new Action(() => SendDingDingAlarm(morningAlarmContent, true)));
} }
else else
@ -1114,7 +1114,7 @@ namespace YiDa_WinForm
if (!_isEveningRodUploaded) if (!_isEveningRodUploaded)
{ {
DateTime now = DateTime.Now; DateTime now = DateTime.Now;
string eveningAlarmContent = $"【晚上连杆强制上传报警】当前时间{now:yyyy-MM-dd HH:mm:ss}已超过工作结束前30分钟{_eveningCheckTime:hh\\:mm}),未上传连杆测试图片!"; string eveningAlarmContent = $"【晚上连杆强制上传报警】<br>当前时间{now:yyyy-MM-dd HH:mm:ss}<br>已超过工作结束前30分钟{_eveningCheckTime:hh\\:mm}<br>未上传连杆测试图片!";
this.Invoke(new Action(() => SendDingDingAlarm(eveningAlarmContent, true))); this.Invoke(new Action(() => SendDingDingAlarm(eveningAlarmContent, true)));
} }
else else
@ -1359,7 +1359,7 @@ namespace YiDa_WinForm
{ {
return string.Equals(value?.ToString(), "无错误", StringComparison.Ordinal) ? "合格" : "不合格"; return string.Equals(value?.ToString(), "无错误", StringComparison.Ordinal) ? "合格" : "不合格";
} }
else if (paramName == "开模总数实时" || paramName == "托模次数" || paramName == "报废图片") else if (paramName == "开模总数实时" || paramName == "托模次数" || paramName == "报废图片" || paramName == "连杆测试")
{ {
return "合格"; return "合格";
} }
@ -1435,5 +1435,10 @@ namespace YiDa_WinForm
private void label6_Click(object sender, EventArgs e) private void label6_Click(object sender, EventArgs e)
{ {
} }
private void toolStripStatusLabel3_Click(object sender, EventArgs e)
{
}
} }
} }

View File

@ -126,6 +126,9 @@
<metadata name="bsPF.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="bsPF.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 93</value> <value>17, 93</value>
</metadata> </metadata>
<metadata name="statusStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>170, 131</value>
</metadata>
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>100, 93</value> <value>100, 93</value>
</metadata> </metadata>

View File

@ -388,14 +388,14 @@ namespace YiDa_WinForm.Service
// 5. 构造报警消息(区分连杆/报废) // 5. 构造报警消息(区分连杆/报废)
string alarmTitle = isRodAlarm ? "连杆测试报警" : "报废上传报警"; string alarmTitle = isRodAlarm ? "连杆测试报警" : "报废上传报警";
string alarmDesc = isRodAlarm ? "未上传图片" : "未上传报废凭证"; string alarmDesc = isRodAlarm ? "未及时提供强度测试图片" : "未及时提供报废图片";
var msg = new var msg = new
{ {
msgtype = "markdown", msgtype = "markdown",
markdown = new markdown = new
{ {
title = alarmTitle, title = alarmTitle,
text = $"## {alarmTitle}\n\n> 报警时间:{ymdhms}\n\n> 报警内容:{alarmContent}\n\n> 状态:{alarmDesc}" text = $"## **{alarmTitle}**<br>报警内容:{alarmContent}"
} }
}; };