限制NG为98
This commit is contained in:
@@ -81,11 +81,14 @@ namespace LargeSquareOne
|
||||
// 保存
|
||||
private void btnSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
// 更新当前通道数据
|
||||
if (_currentChannel != null)
|
||||
var errList = _config.Channels.Where(x => x.AllContent.Contains("NG") && x.DefaultValue != 98).ToList();
|
||||
if (errList.Count > 0)
|
||||
{
|
||||
_currentChannel.DefaultValue = (int)numDefaultValue.Value;
|
||||
var errArr = errList.Select(it => it.DefaultValue).ToArray();
|
||||
MessageBox.Show($"NG写给PLC的值必须为98,不能为{string.Join(",", errArr)}");
|
||||
return;
|
||||
}
|
||||
|
||||
CommonMethods.SaveToJson(CommonMethods.ChannelPath, _config);
|
||||
MessageBox.Show("保存成功!");
|
||||
}
|
||||
@@ -122,12 +125,12 @@ namespace LargeSquareOne
|
||||
|
||||
private void numDefaultValue_Validating(object sender, CancelEventArgs e)
|
||||
{
|
||||
if ((int)numDefaultValue.Value == 98)
|
||||
{
|
||||
MessageBox.Show("98: 扫码NG(不允许在界面配置)");
|
||||
e.Cancel = true;
|
||||
return;
|
||||
}
|
||||
//if ((int)numDefaultValue.Value == 98)
|
||||
//{
|
||||
// MessageBox.Show("98: 扫码NG(不允许在界面配置)");
|
||||
// e.Cancel = true;
|
||||
// return;
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user