修改读取逻辑

This commit is contained in:
gongxh
2022-05-06 15:23:30 +08:00
parent 0e459f231a
commit 64238fee13
8 changed files with 199 additions and 121 deletions

View File

@@ -166,9 +166,9 @@ namespace CleanMachineHMI
{
try
{
if (Global.PlcItemMd_X_List != null && Global.PlcItemMd_X_List.Count > 0)
if (PlcOperationHelper.Instance.PlcItemMd_X_List != null && PlcOperationHelper.Instance.PlcItemMd_X_List.Count > 0)
{
List<PlcItem> tempLst = Global.PlcItemMd_X_List.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_X_List.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
foreach (PlcItem item in tempLst)
{
Invoke(new Action(() =>
@@ -183,9 +183,9 @@ namespace CleanMachineHMI
}
}
if (Global.PlcItemMd_Y_List != null && Global.PlcItemMd_Y_List.Count > 0)
if (PlcOperationHelper.Instance.PlcItemMd_Y_List != null && PlcOperationHelper.Instance.PlcItemMd_Y_List.Count > 0)
{
List<PlcItem> tempLst = Global.PlcItemMd_Y_List.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_Y_List.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
foreach (PlcItem item in tempLst)
{
Invoke(new Action(() =>
@@ -220,7 +220,7 @@ namespace CleanMachineHMI
string plcItemNameAddress = pic.Name.Replace("picb_", "");
if (plcItemNameAddress.StartsWith("M"))
{
PlcItem tmpPlc = Global.PlcItemMd_M_List.First(x => x.PlcItemPriAddress == plcItemNameAddress.Replace("M", ""));
PlcItem tmpPlc = PlcOperationHelper.Instance.PlcItemMd_M_List.First(x => x.PlcItemPriAddress == plcItemNameAddress.Replace("M", ""));
if (tmpPlc != null)
{
ttp.SetToolTip(pic, tmpPlc.PlcItemName);
@@ -228,7 +228,7 @@ namespace CleanMachineHMI
}
else
{
PlcItem tmpPlc = Global.PlcItemMd_X_List.First(x => x.PlcItemPriAddress == Convert.ToInt32(plcItemNameAddress.Replace("X", ""), 10).ToString());
PlcItem tmpPlc = PlcOperationHelper.Instance.PlcItemMd_X_List.First(x => x.PlcItemPriAddress == Convert.ToInt32(plcItemNameAddress.Replace("X", ""), 10).ToString());
if (tmpPlc != null)
{
ttp.SetToolTip(pic, tmpPlc.PlcItemName);