水含量单位修改 ppm 实时重量 三位小数点

This commit is contained in:
XingCheng3
2026-05-12 16:08:14 +08:00
parent 24e1fa423a
commit 1e908cf72f

View File

@@ -253,7 +253,7 @@ namespace MesWork.Pages
ConfigureWeightCard(weightBox, weightTitle, weightValue, weightUnit, topCardWidth, 128, 41F); ConfigureWeightCard(weightBox, weightTitle, weightValue, weightUnit, topCardWidth, 128, 41F);
weightBox.Location = new Point(margin, weightY); weightBox.Location = new Point(margin, weightY);
ConfigureMetricCard(station, waterBox, waterTitle, waterValue, waterUnit, "水含量", "%", margin + topCardWidth + gap, weightY, topCardWidth, 128, 28F); ConfigureMetricCard(station, waterBox, waterTitle, waterValue, waterUnit, "水含量", "ppm", margin + topCardWidth + gap, weightY, topCardWidth, 128, 28F);
metricBox.BackColor = Color.White; metricBox.BackColor = Color.White;
metricBox.Location = new Point(margin, metricY); metricBox.Location = new Point(margin, metricY);
@@ -339,7 +339,7 @@ namespace MesWork.Pages
valueLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(58)))), ((int)(((byte)(95))))); valueLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(58)))), ((int)(((byte)(95)))));
valueLabel.Location = new System.Drawing.Point(34, 20); valueLabel.Location = new System.Drawing.Point(34, 20);
valueLabel.Size = new System.Drawing.Size(Math.Max(150, width - 122), height - 40); valueLabel.Size = new System.Drawing.Size(Math.Max(150, width - 122), height - 40);
valueLabel.Text = "0.00"; valueLabel.Text = "0.000";
valueLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; valueLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
if (valueLabel.Parent != panel) if (valueLabel.Parent != panel)
panel.Controls.Add(valueLabel); panel.Controls.Add(valueLabel);
@@ -382,7 +382,7 @@ namespace MesWork.Pages
valueLabel.BackColor = panel.BackColor; valueLabel.BackColor = panel.BackColor;
valueLabel.Font = new System.Drawing.Font("微软雅黑", valueFontSize, System.Drawing.FontStyle.Bold); valueLabel.Font = new System.Drawing.Font("微软雅黑", valueFontSize, System.Drawing.FontStyle.Bold);
valueLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(58)))), ((int)(((byte)(95))))); valueLabel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(30)))), ((int)(((byte)(58)))), ((int)(((byte)(95)))));
int unitWidth = unit == "KG/L" ? 66 : 38; int unitWidth = unit == "KG/L" ? 66 : (unit == "ppm" ? 58 : 38);
int valueRightPadding = unitLabel == null ? 16 : unitWidth + 24; int valueRightPadding = unitLabel == null ? 16 : unitWidth + 24;
valueLabel.Location = new System.Drawing.Point(20, height >= 100 ? 24 : 20); valueLabel.Location = new System.Drawing.Point(20, height >= 100 ? 24 : 20);
valueLabel.Size = new System.Drawing.Size(Math.Max(72, width - 20 - valueRightPadding), height >= 100 ? height - 40 : height - 24); valueLabel.Size = new System.Drawing.Size(Math.Max(72, width - 20 - valueRightPadding), height >= 100 ? height - 40 : height - 24);
@@ -597,7 +597,7 @@ namespace MesWork.Pages
waterValue.Font = new Font("微软雅黑", 18F, FontStyle.Bold); waterValue.Font = new Font("微软雅黑", 18F, FontStyle.Bold);
waterValue.Location = new Point(660, 401); waterValue.Location = new Point(660, 401);
waterValue.Size = new Size(599, 164); waterValue.Size = new Size(599, 164);
waterValue.Text = "水含量0.00"; waterValue.Text = "水含量0.00 ppm";
waterValue.TextAlign = ContentAlignment.MiddleCenter; waterValue.TextAlign = ContentAlignment.MiddleCenter;
waterValue.AutoSize = false; waterValue.AutoSize = false;
@@ -745,7 +745,7 @@ namespace MesWork.Pages
{ {
weight = calibratedWeight; weight = calibratedWeight;
} }
string newTxt = Convert.ToDouble(weight).ToString("F2"); string newTxt = Convert.ToDouble(weight).ToString("F3");
if (lblWeight.Text != newTxt) lblWeight.Text = newTxt; if (lblWeight.Text != newTxt) lblWeight.Text = newTxt;
} }
} }
@@ -807,9 +807,9 @@ namespace MesWork.Pages
{ {
var lbl = station == 1 ? lbl_S1_Weight : lbl_S2_Weight; var lbl = station == 1 ? lbl_S1_Weight : lbl_S2_Weight;
if (lbl.InvokeRequired) if (lbl.InvokeRequired)
lbl.Invoke(new Action(() => lbl.Text = weight.ToString("F2"))); lbl.Invoke(new Action(() => lbl.Text = weight.ToString("F3")));
else else
lbl.Text = weight.ToString("F2"); lbl.Text = weight.ToString("F3");
} }
public void UpdateStationInfo(int station, string engineNo, string modelNo, string orderNo) public void UpdateStationInfo(int station, string engineNo, string modelNo, string orderNo)