通信组可编辑
This commit is contained in:
@@ -56,6 +56,7 @@ namespace LargeSquareOne
|
||||
ReadOnly = true,
|
||||
DataPropertyName = "PlcNum",
|
||||
DefaultCellStyle = new DataGridViewCellStyle(){Alignment=DataGridViewContentAlignment.MiddleCenter},
|
||||
Frozen = true
|
||||
},
|
||||
new DataGridViewTextBoxColumn
|
||||
{
|
||||
@@ -64,6 +65,7 @@ namespace LargeSquareOne
|
||||
Width = 120,
|
||||
DataPropertyName = "GroupName",
|
||||
DefaultCellStyle = new DataGridViewCellStyle(){Alignment=DataGridViewContentAlignment.MiddleCenter},
|
||||
Frozen = true
|
||||
},
|
||||
new DataGridViewTextBoxColumn
|
||||
{
|
||||
@@ -72,6 +74,7 @@ namespace LargeSquareOne
|
||||
Width = 150,
|
||||
DataPropertyName = "Start",
|
||||
DefaultCellStyle = new DataGridViewCellStyle(){Alignment=DataGridViewContentAlignment.MiddleCenter},
|
||||
Frozen = true
|
||||
},
|
||||
new DataGridViewTextBoxColumn
|
||||
{
|
||||
@@ -435,12 +438,13 @@ namespace LargeSquareOne
|
||||
).ToList();
|
||||
|
||||
|
||||
// 允许同一个PLC内有多个相同的组名 by clm 20260804
|
||||
// 3. 只在同一个PLC内检查地址是否冲突
|
||||
if (groupsInSamePLC.Any(g => g.GroupName.Equals(config.GroupName, StringComparison.OrdinalIgnoreCase)))
|
||||
{
|
||||
ShowError($"在PLC {config.PlcNum} 中,组名 {config.GroupName} 已被使用");
|
||||
return false;
|
||||
}
|
||||
//if (groupsInSamePLC.Any(g => g.GroupName.Equals(config.GroupName, StringComparison.OrdinalIgnoreCase)))
|
||||
//{
|
||||
// ShowError($"在PLC {config.PlcNum} 中,组名 {config.GroupName} 已被使用");
|
||||
// return false;
|
||||
//}
|
||||
//Console.WriteLine("\n筛选后的配置:");
|
||||
//foreach (var g in groupsInSamePLC)
|
||||
//{
|
||||
@@ -464,18 +468,19 @@ namespace LargeSquareOne
|
||||
return false;
|
||||
}
|
||||
|
||||
// 取消该检查 by clm 20260804
|
||||
// 检查地址范围冲突
|
||||
foreach (var other in groupsInSamePLC)
|
||||
{
|
||||
int otherStart = int.Parse(other.Start.Substring(1));
|
||||
int otherEnd = otherStart + other.Length - 1;
|
||||
//foreach (var other in groupsInSamePLC)
|
||||
//{
|
||||
// int otherStart = int.Parse(other.Start.Substring(1));
|
||||
// int otherEnd = otherStart + other.Length - 1;
|
||||
|
||||
if (!(endAddress < otherStart || startAddress > otherEnd))
|
||||
{
|
||||
ShowError($"地址范围与组 \"{other.GroupName}\" 冲突");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// if (!(endAddress < otherStart || startAddress > otherEnd))
|
||||
// {
|
||||
// ShowError($"地址范围与组 \"{other.GroupName}\" 冲突");
|
||||
// return false;
|
||||
// }
|
||||
//}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -505,7 +510,7 @@ namespace LargeSquareOne
|
||||
}
|
||||
|
||||
// 检查地址范围(根据实际需求调整范围)
|
||||
if (addressNum < 0 || addressNum > 9999)
|
||||
if (addressNum < 0 || addressNum > 30000)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user