25111501 参数保存和赋值调整为浮点数

This commit is contained in:
moxiliang
2025-11-15 09:04:42 +08:00
parent 3d09844886
commit 59f3812c9e
37 changed files with 268 additions and 524 deletions

View File

@@ -199,6 +199,7 @@ namespace SLC1_N
}
catch (Exception ex)
{
bt_BtnUpload.Enabled = true;
MessageBox.Show(ex.Message);
mxlLog.Instance.Error($"参数界面上传异常,行号{ex.StackTrace} ", ex);
}
@@ -388,15 +389,15 @@ namespace SLC1_N
Form1.f1.GetYiqiParam(CH, PorN).delaytime1 = Convert.ToInt32(tb_DelayTime1.Text);
Form1.f1.GetYiqiParam(CH, PorN).delaytime2 = Convert.ToInt32(tb_DelayTime2.Text);
Form1.f1.GetYiqiParam(CH, PorN).relievedelay = Convert.ToInt32(tb_RelieveDelay.Text);
Form1.f1.GetYiqiParam(CH, PorN).evolume = Convert.ToInt32(tb_Evolume.Text);
Form1.f1.GetYiqiParam(CH, PorN).evolume = StringToFloat(tb_Evolume.Text);
Form1.f1.GetYiqiParam(CH, PorN).fptoplimit = Convert.ToInt32(tb_FPtoplimit.Text);
Form1.f1.GetYiqiParam(CH, PorN).fplowlimit = Convert.ToInt32(tb_FPlowlimit.Text);
Form1.f1.GetYiqiParam(CH, PorN).balanpremax = Convert.ToInt32(tb_BalanPreMax.Text);
Form1.f1.GetYiqiParam(CH, PorN).balanpremin = Convert.ToInt32(tb_BalanPreMin.Text);
Form1.f1.GetYiqiParam(CH, PorN).fptoplimit = StringToFloat(tb_FPtoplimit.Text);
Form1.f1.GetYiqiParam(CH, PorN).fplowlimit = StringToFloat(tb_FPlowlimit.Text);
Form1.f1.GetYiqiParam(CH, PorN).balanpremax = StringToFloat(tb_BalanPreMax.Text);
Form1.f1.GetYiqiParam(CH, PorN).balanpremin = StringToFloat(tb_BalanPreMin.Text);
Form1.f1.GetYiqiParam(CH, PorN).leaktoplimit = Convert.ToInt32(tb_Leaktoplimit.Text);
Form1.f1.GetYiqiParam(CH, PorN).leaklowlimit = Convert.ToInt32(tb_Leaklowlimit.Text);
Form1.f1.GetYiqiParam(CH, PorN).leaktoplimit = StringToFloat(tb_Leaktoplimit.Text);
Form1.f1.GetYiqiParam(CH, PorN).leaklowlimit = StringToFloat(tb_Leaklowlimit.Text);
Form1.f1.GetYiqiParam(CH, PorN).punit = cb_PUnit.SelectedIndex;
Form1.f1.GetYiqiParam(CH, PorN).lunit = cb_LUnit.SelectedIndex;
@@ -407,6 +408,11 @@ namespace SLC1_N
//MessageBox.Show("仪器编号:" + CH + "保存" + i + "组参数成功!");
}
private float StringToFloat(string value, float defaultValue = 0f)
{
return float.TryParse(value, out float result) ? result : defaultValue;
}
// 读取本地参数记录
private void ReadParametersJson(string CH, string i, string PorN)
{