修改
This commit is contained in:
@@ -131,7 +131,7 @@ namespace CleanMachineHMI.FrmUserControl
|
|||||||
{
|
{
|
||||||
if (PlcOperationHelper.Instance.PlcItemMd_X_List != null && PlcOperationHelper.Instance.PlcItemMd_X_List.Count > 0)
|
if (PlcOperationHelper.Instance.PlcItemMd_X_List != null && PlcOperationHelper.Instance.PlcItemMd_X_List.Count > 0)
|
||||||
{
|
{
|
||||||
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_X_List.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_X_List.Values.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
||||||
foreach (PlcItem item in tempLst)
|
foreach (PlcItem item in tempLst)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ namespace CleanMachineHMI.FrmUserControl
|
|||||||
|
|
||||||
if (PlcOperationHelper.Instance.PlcItemMd_Y_List != null && PlcOperationHelper.Instance.PlcItemMd_Y_List.Count > 0)
|
if (PlcOperationHelper.Instance.PlcItemMd_Y_List != null && PlcOperationHelper.Instance.PlcItemMd_Y_List.Count > 0)
|
||||||
{
|
{
|
||||||
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_Y_List.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_Y_List.Values.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
||||||
foreach (PlcItem item in tempLst)
|
foreach (PlcItem item in tempLst)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -162,9 +162,9 @@ namespace CleanMachineHMI.FrmUserControl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Show_X_Y_Status(PlcOperationHelper.Instance.PlcItemMd_X_List);
|
Show_X_Y_Status(PlcOperationHelper.Instance.PlcItemMd_X_List.Values);
|
||||||
|
|
||||||
Show_X_Y_Status(PlcOperationHelper.Instance.PlcItemMd_Y_List);
|
Show_X_Y_Status(PlcOperationHelper.Instance.PlcItemMd_Y_List.Values);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ namespace CleanMachineHMI.FrmUserControl
|
|||||||
{
|
{
|
||||||
if (PlcOperationHelper.Instance.PlcItemMd_X_List != null && PlcOperationHelper.Instance.PlcItemMd_X_List.Count > 0)
|
if (PlcOperationHelper.Instance.PlcItemMd_X_List != null && PlcOperationHelper.Instance.PlcItemMd_X_List.Count > 0)
|
||||||
{
|
{
|
||||||
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_X_List.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_X_List.Values.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
||||||
foreach (PlcItem item in tempLst)
|
foreach (PlcItem item in tempLst)
|
||||||
{
|
{
|
||||||
var IO = new IOBlock();
|
var IO = new IOBlock();
|
||||||
@@ -147,7 +147,7 @@ namespace CleanMachineHMI.FrmUserControl
|
|||||||
|
|
||||||
if (PlcOperationHelper.Instance.PlcItemMd_Y_List != null && PlcOperationHelper.Instance.PlcItemMd_Y_List.Count > 0)
|
if (PlcOperationHelper.Instance.PlcItemMd_Y_List != null && PlcOperationHelper.Instance.PlcItemMd_Y_List.Count > 0)
|
||||||
{
|
{
|
||||||
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_Y_List.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_Y_List.Values.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
||||||
foreach (PlcItem item in tempLst)
|
foreach (PlcItem item in tempLst)
|
||||||
{
|
{
|
||||||
var IO = new IOBlock();
|
var IO = new IOBlock();
|
||||||
@@ -168,9 +168,9 @@ namespace CleanMachineHMI.FrmUserControl
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Show_X_Y_Status(PlcOperationHelper.Instance.PlcItemMd_X_List);
|
Show_X_Y_Status(PlcOperationHelper.Instance.PlcItemMd_X_List.Values);
|
||||||
|
|
||||||
Show_X_Y_Status(PlcOperationHelper.Instance.PlcItemMd_Y_List);
|
Show_X_Y_Status(PlcOperationHelper.Instance.PlcItemMd_Y_List.Values);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -71,6 +71,8 @@ namespace CleanMachineHMI.FrmUserControl
|
|||||||
private void btn_logout_Click(object sender, EventArgs e)
|
private void btn_logout_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Global.LoginForm.Show();
|
Global.LoginForm.Show();
|
||||||
|
Global.UserInfo = null;
|
||||||
|
Global.SysThIsRunFlag = false;
|
||||||
Global.MainFormNew.Hide();
|
Global.MainFormNew.Hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,11 +155,11 @@ namespace CleanMachineHMI.FrmUserControl
|
|||||||
List<PlcItem> tmpMdList;
|
List<PlcItem> tmpMdList;
|
||||||
if (!string.IsNullOrEmpty(ktb_plcMsg.Text.Trim()))
|
if (!string.IsNullOrEmpty(ktb_plcMsg.Text.Trim()))
|
||||||
{
|
{
|
||||||
tmpMdList = PlcOperationHelper.Instance. PlcItemMdList.FindAll(x => x.PlcItemCode.Contains(ktb_plcMsg.Text.Trim()) || x.PlcItemName.Contains(ktb_plcMsg.Text.Trim()));
|
tmpMdList = PlcOperationHelper.Instance. PlcItemMdList.Values.ToList().FindAll(x => x.PlcItemCode.Contains(ktb_plcMsg.Text.Trim()) || x.PlcItemName.Contains(ktb_plcMsg.Text.Trim()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tmpMdList = PlcOperationHelper.Instance.PlcItemMdList;
|
tmpMdList = PlcOperationHelper.Instance.PlcItemMdList.Values.ToList();
|
||||||
}
|
}
|
||||||
if (tmpMdList != null && tmpMdList.Count > 0)
|
if (tmpMdList != null && tmpMdList.Count > 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -135,14 +135,14 @@ namespace CleanMachineHMI
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public List<PlcItem> PlcItemMdList { get; set; } = new List<PlcItem>();
|
public Dictionary<string, PlcItem> PlcItemMdList { get; set; } = new Dictionary<string, PlcItem>();
|
||||||
public List<PlcItem> PlcItemMd_D_List { get; set; } = new List<PlcItem>();
|
public Dictionary<string, PlcItem> PlcItemMd_D_List { get; set; } = new Dictionary<string, PlcItem>();
|
||||||
|
|
||||||
public List<PlcItem> PlcItemMd_M_List { get; set; } = new List<PlcItem>();
|
public Dictionary<string, PlcItem> PlcItemMd_M_List { get; set; } = new Dictionary<string, PlcItem>();
|
||||||
|
|
||||||
public List<PlcItem> PlcItemMd_X_List { get; set; } = new List<PlcItem>();
|
public Dictionary<string, PlcItem> PlcItemMd_X_List { get; set; } = new Dictionary<string, PlcItem>();
|
||||||
|
|
||||||
public List<PlcItem> PlcItemMd_Y_List { get; set; } = new List<PlcItem>();
|
public Dictionary<string, PlcItem> PlcItemMd_Y_List { get; set; } = new Dictionary<string, PlcItem>();
|
||||||
|
|
||||||
|
|
||||||
public void StartRead()
|
public void StartRead()
|
||||||
@@ -283,20 +283,20 @@ namespace CleanMachineHMI
|
|||||||
switch (plcitem.PlcItemDataType)
|
switch (plcitem.PlcItemDataType)
|
||||||
{
|
{
|
||||||
case PlcItemTypeDesc.M:
|
case PlcItemTypeDesc.M:
|
||||||
PlcItemMd_M_List.Add(plcitem);
|
PlcItemMd_M_List.Add(plcitem.PlcItemCode, plcitem);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PlcItemTypeDesc.D:
|
case PlcItemTypeDesc.D:
|
||||||
PlcItemMd_D_List.Add(plcitem);
|
PlcItemMd_D_List.Add(plcitem.PlcItemCode, plcitem);
|
||||||
break;
|
break;
|
||||||
case PlcItemTypeDesc.X:
|
case PlcItemTypeDesc.X:
|
||||||
PlcItemMd_X_List.Add(plcitem);
|
PlcItemMd_X_List.Add(plcitem.PlcItemCode, plcitem);
|
||||||
break;
|
break;
|
||||||
case PlcItemTypeDesc.Y:
|
case PlcItemTypeDesc.Y:
|
||||||
PlcItemMd_Y_List.Add(plcitem);
|
PlcItemMd_Y_List.Add(plcitem.PlcItemCode, plcitem);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PlcItemMdList.Add(plcitem);
|
PlcItemMdList.Add(plcitem.PlcItemCode, plcitem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -334,7 +334,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)
|
||||||
@@ -395,7 +395,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))
|
||||||
@@ -855,7 +855,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))
|
||||||
@@ -916,7 +916,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))
|
||||||
@@ -959,7 +959,11 @@ namespace CleanMachineHMI
|
|||||||
|
|
||||||
public object ReadPlcItem(string plcItemCode)
|
public object ReadPlcItem(string plcItemCode)
|
||||||
{
|
{
|
||||||
PlcItem item = PlcItemMdList.Find(x => x.PlcItemCode == plcItemCode);
|
// PlcItem item = PlcItemMdList.Find(x => x.PlcItemCode == plcItemCode);
|
||||||
|
|
||||||
|
PlcItemMdList.TryGetValue(plcItemCode, out var item);
|
||||||
|
|
||||||
|
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@@ -1014,7 +1018,8 @@ namespace CleanMachineHMI
|
|||||||
{
|
{
|
||||||
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);
|
||||||
|
// PlcItem item_M = PlcItemMd_M_List.Find(x => x.PlcItemCode == plcItemCode);
|
||||||
if (item_M == null)
|
if (item_M == null)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
@@ -1029,7 +1034,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;
|
||||||
@@ -1052,7 +1058,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;
|
||||||
@@ -1067,7 +1074,10 @@ 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;
|
||||||
@@ -1106,7 +1116,8 @@ 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);
|
||||||
|
//PlcItem item_M = PlcItemMd_M_List.Find(x => x.PlcItemCode == plcItemCode);
|
||||||
if (item_M == null)
|
if (item_M == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -1114,7 +1125,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);
|
||||||
|
//PlcItem item_Y = PlcItemMd_Y_List.Find(x => x.PlcItemCode == plcItemCode);
|
||||||
if (item_Y == null)
|
if (item_Y == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -1122,7 +1134,10 @@ 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);
|
||||||
|
|
||||||
|
// PlcItem item_D = PlcItemMd_D_List.Find(x => x.PlcItemCode == plcItemCode);
|
||||||
if (item_D == null)
|
if (item_D == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ namespace CleanMachineHMI
|
|||||||
if (PlcOperationHelper.Instance.PlcItemMd_X_List != null && PlcOperationHelper.Instance.PlcItemMd_X_List.Count > 0)
|
if (PlcOperationHelper.Instance.PlcItemMd_X_List != null && PlcOperationHelper.Instance.PlcItemMd_X_List.Count > 0)
|
||||||
{
|
{
|
||||||
//List<BasPlcItemMd> tempLst = AppConfig.PlcItemMd_X_List.FindAll(x => x.PlcItemName != "备用").OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
//List<BasPlcItemMd> tempLst = AppConfig.PlcItemMd_X_List.FindAll(x => x.PlcItemName != "备用").OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
||||||
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_X_List.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_X_List.Values.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
||||||
int dataSum = tempLst.Count;
|
int dataSum = tempLst.Count;
|
||||||
int rowNum;
|
int rowNum;
|
||||||
if (dataSum % 2 == 0)
|
if (dataSum % 2 == 0)
|
||||||
@@ -265,7 +265,7 @@ namespace CleanMachineHMI
|
|||||||
if (PlcOperationHelper.Instance.PlcItemMd_Y_List != null && PlcOperationHelper.Instance.PlcItemMd_Y_List.Count > 0)
|
if (PlcOperationHelper.Instance.PlcItemMd_Y_List != null && PlcOperationHelper.Instance.PlcItemMd_Y_List.Count > 0)
|
||||||
{
|
{
|
||||||
//List<BasPlcItemMd> tempLst = AppConfig.PlcItemMd_Y_List.FindAll(x => x.PlcItemName != "备用").OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
//List<BasPlcItemMd> tempLst = AppConfig.PlcItemMd_Y_List.FindAll(x => x.PlcItemName != "备用").OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
||||||
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_Y_List.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_Y_List.Values.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
||||||
int dataSum = tempLst.Count;
|
int dataSum = tempLst.Count;
|
||||||
//int dataSum = AppConfig.PlcItemMd_Y_List.Count;
|
//int dataSum = AppConfig.PlcItemMd_Y_List.Count;
|
||||||
int rowNum;
|
int rowNum;
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ namespace CleanMachineHMI
|
|||||||
{
|
{
|
||||||
if (PlcOperationHelper.Instance.PlcItemMd_X_List != null && PlcOperationHelper.Instance.PlcItemMd_X_List.Count > 0)
|
if (PlcOperationHelper.Instance.PlcItemMd_X_List != null && PlcOperationHelper.Instance.PlcItemMd_X_List.Count > 0)
|
||||||
{
|
{
|
||||||
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_X_List.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_X_List.Values.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
||||||
foreach (PlcItem item in tempLst)
|
foreach (PlcItem item in tempLst)
|
||||||
{
|
{
|
||||||
Invoke(new Action(() =>
|
Invoke(new Action(() =>
|
||||||
@@ -188,7 +188,7 @@ namespace CleanMachineHMI
|
|||||||
|
|
||||||
if (PlcOperationHelper.Instance.PlcItemMd_Y_List != null && PlcOperationHelper.Instance.PlcItemMd_Y_List.Count > 0)
|
if (PlcOperationHelper.Instance.PlcItemMd_Y_List != null && PlcOperationHelper.Instance.PlcItemMd_Y_List.Count > 0)
|
||||||
{
|
{
|
||||||
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_Y_List.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
List<PlcItem> tempLst = PlcOperationHelper.Instance.PlcItemMd_Y_List.Values.OrderBy(x => Convert.ToInt32(x.PlcItemPriAddress)).ToList();
|
||||||
foreach (PlcItem item in tempLst)
|
foreach (PlcItem item in tempLst)
|
||||||
{
|
{
|
||||||
Invoke(new Action(() =>
|
Invoke(new Action(() =>
|
||||||
@@ -223,7 +223,7 @@ namespace CleanMachineHMI
|
|||||||
string plcItemNameAddress = pic.Name.Replace("picb_", "");
|
string plcItemNameAddress = pic.Name.Replace("picb_", "");
|
||||||
if (plcItemNameAddress.StartsWith("M"))
|
if (plcItemNameAddress.StartsWith("M"))
|
||||||
{
|
{
|
||||||
PlcItem tmpPlc = PlcOperationHelper.Instance.PlcItemMd_M_List.First(x => x.PlcItemPriAddress == plcItemNameAddress.Replace("M", ""));
|
PlcItem tmpPlc = PlcOperationHelper.Instance.PlcItemMd_M_List.Values.First(x => x.PlcItemPriAddress == plcItemNameAddress.Replace("M", ""));
|
||||||
if (tmpPlc != null)
|
if (tmpPlc != null)
|
||||||
{
|
{
|
||||||
ttp.SetToolTip(pic, tmpPlc.PlcItemName);
|
ttp.SetToolTip(pic, tmpPlc.PlcItemName);
|
||||||
@@ -231,7 +231,7 @@ namespace CleanMachineHMI
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PlcItem tmpPlc = PlcOperationHelper.Instance.PlcItemMd_X_List.First(x => x.PlcItemPriAddress == Convert.ToInt32(plcItemNameAddress.Replace("X", ""), 10).ToString());
|
PlcItem tmpPlc = PlcOperationHelper.Instance.PlcItemMd_X_List.Values.First(x => x.PlcItemPriAddress == Convert.ToInt32(plcItemNameAddress.Replace("X", ""), 10).ToString());
|
||||||
if (tmpPlc != null)
|
if (tmpPlc != null)
|
||||||
{
|
{
|
||||||
ttp.SetToolTip(pic, tmpPlc.PlcItemName);
|
ttp.SetToolTip(pic, tmpPlc.PlcItemName);
|
||||||
|
|||||||
7
CleanMachineHMI/frmMainNew.Designer.cs
generated
7
CleanMachineHMI/frmMainNew.Designer.cs
generated
@@ -175,7 +175,8 @@
|
|||||||
//
|
//
|
||||||
// kryptonLabel1
|
// kryptonLabel1
|
||||||
//
|
//
|
||||||
this.kryptonLabel1.Location = new System.Drawing.Point(804, 47);
|
this.kryptonLabel1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.kryptonLabel1.Location = new System.Drawing.Point(829, 47);
|
||||||
this.kryptonLabel1.Name = "kryptonLabel1";
|
this.kryptonLabel1.Name = "kryptonLabel1";
|
||||||
this.kryptonLabel1.PaletteMode = Krypton.Toolkit.PaletteMode.ProfessionalSystem;
|
this.kryptonLabel1.PaletteMode = Krypton.Toolkit.PaletteMode.ProfessionalSystem;
|
||||||
this.kryptonLabel1.Size = new System.Drawing.Size(82, 23);
|
this.kryptonLabel1.Size = new System.Drawing.Size(82, 23);
|
||||||
@@ -256,12 +257,10 @@
|
|||||||
//
|
//
|
||||||
// frmMainNew
|
// frmMainNew
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
||||||
this.ClientSize = new System.Drawing.Size(1008, 729);
|
this.ClientSize = new System.Drawing.Size(1008, 729);
|
||||||
this.Controls.Add(this.kryptonNavigator1);
|
this.Controls.Add(this.kryptonNavigator1);
|
||||||
this.Controls.Add(this.kryptonGroupBox1);
|
this.Controls.Add(this.kryptonGroupBox1);
|
||||||
this.MaximizeBox = false;
|
|
||||||
this.MinimizeBox = false;
|
this.MinimizeBox = false;
|
||||||
this.Name = "frmMainNew";
|
this.Name = "frmMainNew";
|
||||||
this.ShowIcon = false;
|
this.ShowIcon = false;
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ namespace CleanMachineHMI
|
|||||||
ButtonSpecAny bsa = sender as ButtonSpecAny;
|
ButtonSpecAny bsa = sender as ButtonSpecAny;
|
||||||
var page = bsa.Tag as KryptonPage;
|
var page = bsa.Tag as KryptonPage;
|
||||||
|
|
||||||
foreach(var ctrl in page.Controls)
|
foreach (var ctrl in page.Controls)
|
||||||
{
|
{
|
||||||
if (ctrl is Control)
|
if (ctrl is Control)
|
||||||
{
|
{
|
||||||
@@ -325,7 +325,13 @@ namespace CleanMachineHMI
|
|||||||
|
|
||||||
private void ShowWarningMsg()
|
private void ShowWarningMsg()
|
||||||
{
|
{
|
||||||
PlcItem item = PlcOperationHelper.Instance.PlcItemMd_D_List.FirstOrDefault(x => x.PlcItemCode == "AlarmPopUpMsg");
|
if (!PlcOperationHelper.Instance.PlcItemMd_D_List.TryGetValue("AlarmPopUpMsg", out var item))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// PlcItem item = PlcOperationHelper.Instance.PlcItemMd_D_List.FirstOrDefault(x => x.PlcItemCode == "AlarmPopUpMsg");
|
||||||
char[] tmpCharArr = Convert.ToString(Convert.ToInt32(item.PlcItemValue), 2).PadLeft(16, '0').Reverse().ToArray();
|
char[] tmpCharArr = Convert.ToString(Convert.ToInt32(item.PlcItemValue), 2).PadLeft(16, '0').Reverse().ToArray();
|
||||||
if (tmpCharArr.Contains('1'))
|
if (tmpCharArr.Contains('1'))
|
||||||
{
|
{
|
||||||
@@ -890,7 +896,7 @@ namespace CleanMachineHMI
|
|||||||
|
|
||||||
private void frmMainNew_Shown(object sender, EventArgs e)
|
private void frmMainNew_Shown(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// InitControl();
|
// InitControl();
|
||||||
}
|
}
|
||||||
private void InitControl()
|
private void InitControl()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<packages>
|
|
||||||
<package id="Krypton.Navigator" version="5.550.2108.1" targetFramework="net45" requireReinstallation="true" />
|
|
||||||
<package id="Krypton.Toolkit" version="5.550.2108.1" targetFramework="net45" requireReinstallation="true" />
|
|
||||||
<package id="Microsoft.ReportingServices.ReportViewerControl.Winforms" version="140.1000.523" targetFramework="net45" />
|
|
||||||
<package id="Microsoft.SqlServer.Types" version="14.0.314.76" targetFramework="net45" />
|
|
||||||
<package id="NModbus4" version="2.1.0" targetFramework="net45" />
|
|
||||||
</packages>
|
|
||||||
Reference in New Issue
Block a user