修改
This commit is contained in:
@@ -337,7 +337,7 @@ namespace CleanMachineHMI
|
|||||||
{
|
{
|
||||||
if (PlcItemMd_M_List != null && PlcItemMd_M_List.Count > 0)
|
if (PlcItemMd_M_List != null && PlcItemMd_M_List.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (PlcItem item in PlcItemMd_M_List)
|
foreach (PlcItem item in PlcItemMd_M_List.Values)
|
||||||
{
|
{
|
||||||
string value = "";
|
string value = "";
|
||||||
if (Convert.ToInt32(item.PlcItemPriAddress) >= 200)
|
if (Convert.ToInt32(item.PlcItemPriAddress) >= 200)
|
||||||
@@ -398,7 +398,7 @@ namespace CleanMachineHMI
|
|||||||
{
|
{
|
||||||
if (PlcItemMd_D_List != null && PlcItemMd_D_List.Count > 0)
|
if (PlcItemMd_D_List != null && PlcItemMd_D_List.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (PlcItem item in PlcItemMd_D_List)
|
foreach (PlcItem item in PlcItemMd_D_List.Values)
|
||||||
{
|
{
|
||||||
var value = "";
|
var value = "";
|
||||||
if (!string.IsNullOrEmpty(item.PlcItemDeviationAddress))
|
if (!string.IsNullOrEmpty(item.PlcItemDeviationAddress))
|
||||||
@@ -899,7 +899,7 @@ namespace CleanMachineHMI
|
|||||||
{
|
{
|
||||||
if (PlcItemMd_X_List != null && PlcItemMd_X_List.Count > 0)
|
if (PlcItemMd_X_List != null && PlcItemMd_X_List.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (PlcItem item in PlcItemMd_X_List)
|
foreach (PlcItem item in PlcItemMd_X_List.Values)
|
||||||
{
|
{
|
||||||
string value = "";
|
string value = "";
|
||||||
if (!string.IsNullOrEmpty(item.PlcItemDeviationAddress))
|
if (!string.IsNullOrEmpty(item.PlcItemDeviationAddress))
|
||||||
@@ -960,7 +960,7 @@ namespace CleanMachineHMI
|
|||||||
{
|
{
|
||||||
if (PlcItemMd_Y_List != null && PlcItemMd_Y_List.Count > 0)
|
if (PlcItemMd_Y_List != null && PlcItemMd_Y_List.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (PlcItem item in PlcItemMd_Y_List)
|
foreach (PlcItem item in PlcItemMd_Y_List.Values)
|
||||||
{
|
{
|
||||||
string value = "";
|
string value = "";
|
||||||
if (!string.IsNullOrEmpty(item.PlcItemDeviationAddress))
|
if (!string.IsNullOrEmpty(item.PlcItemDeviationAddress))
|
||||||
@@ -1061,8 +1061,8 @@ namespace CleanMachineHMI
|
|||||||
switch (itemType)
|
switch (itemType)
|
||||||
{
|
{
|
||||||
case PlcItemTypeDesc.M:
|
case PlcItemTypeDesc.M:
|
||||||
|
PlcItemMd_M_List.TryGetValue(plcItemCode, out var item_M);
|
||||||
|
|
||||||
PlcItem item_M = PlcItemMd_M_List.Find(x => x.PlcItemCode == plcItemCode);
|
|
||||||
if (item_M == null)
|
if (item_M == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@@ -1077,7 +1077,8 @@ namespace CleanMachineHMI
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PlcItemTypeDesc.D:
|
case PlcItemTypeDesc.D:
|
||||||
PlcItem item_D = PlcItemMd_D_List.Find(x => x.PlcItemCode == plcItemCode);
|
PlcItemMd_D_List.TryGetValue(plcItemCode, out var item_D);
|
||||||
|
// PlcItem item_D = PlcItemMd_D_List.Find(x => x.PlcItemCode == plcItemCode);
|
||||||
if (item_D == null)
|
if (item_D == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@@ -1100,7 +1101,8 @@ namespace CleanMachineHMI
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PlcItemTypeDesc.X:
|
case PlcItemTypeDesc.X:
|
||||||
PlcItem item_X = PlcItemMd_X_List.Find(x => x.PlcItemCode == plcItemCode);
|
PlcItemMd_X_List.TryGetValue(plcItemCode, out var item_X);
|
||||||
|
//PlcItem item_X = PlcItemMd_X_List.Find(x => x.PlcItemCode == plcItemCode);
|
||||||
if (item_X == null)
|
if (item_X == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@@ -1115,7 +1117,8 @@ namespace CleanMachineHMI
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PlcItemTypeDesc.Y:
|
case PlcItemTypeDesc.Y:
|
||||||
PlcItem item_Y = PlcItemMd_Y_List.Find(x => x.PlcItemCode == plcItemCode);
|
PlcItemMd_Y_List.TryGetValue(plcItemCode, out var item_Y);
|
||||||
|
// PlcItem item_Y = PlcItemMd_Y_List.Find(x => x.PlcItemCode == plcItemCode);
|
||||||
if (item_Y == null)
|
if (item_Y == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@@ -1154,7 +1157,7 @@ namespace CleanMachineHMI
|
|||||||
switch (itemType)
|
switch (itemType)
|
||||||
{
|
{
|
||||||
case PlcItemTypeDesc.M:
|
case PlcItemTypeDesc.M:
|
||||||
PlcItem item_M = PlcItemMd_M_List.Find(x => x.PlcItemCode == plcItemCode);
|
PlcItemMd_M_List.TryGetValue(plcItemCode, out var item_M);
|
||||||
if (item_M == null)
|
if (item_M == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -1162,7 +1165,8 @@ namespace CleanMachineHMI
|
|||||||
master.WriteSingleCoil(slaveAddress, Convert.ToUInt16(item_M.PlcItemModbusAddress), bool.Parse(writeValue));
|
master.WriteSingleCoil(slaveAddress, Convert.ToUInt16(item_M.PlcItemModbusAddress), bool.Parse(writeValue));
|
||||||
return true;
|
return true;
|
||||||
case PlcItemTypeDesc.Y:
|
case PlcItemTypeDesc.Y:
|
||||||
PlcItem item_Y = PlcItemMd_Y_List.Find(x => x.PlcItemCode == plcItemCode);
|
PlcItemMd_Y_List.TryGetValue(plcItemCode, out var item_Y);
|
||||||
|
|
||||||
if (item_Y == null)
|
if (item_Y == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -1170,7 +1174,7 @@ namespace CleanMachineHMI
|
|||||||
master.WriteSingleCoil(slaveAddress, Convert.ToUInt16(item_Y.PlcItemModbusAddress), bool.Parse(writeValue));
|
master.WriteSingleCoil(slaveAddress, Convert.ToUInt16(item_Y.PlcItemModbusAddress), bool.Parse(writeValue));
|
||||||
return true;
|
return true;
|
||||||
case PlcItemTypeDesc.D:
|
case PlcItemTypeDesc.D:
|
||||||
PlcItem item_D = PlcItemMd_D_List.Find(x => x.PlcItemCode == plcItemCode);
|
PlcItemMd_D_List.TryGetValue(plcItemCode, out var item_D);
|
||||||
if (item_D == null)
|
if (item_D == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user