修改
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
#if DEBUG
|
||||
|
||||
//#define USE_LOCAL_TCP_DEBUG
|
||||
#define USE_LOCAL_TCP_DEBUG
|
||||
#endif
|
||||
//启用心跳检查
|
||||
|
||||
@@ -60,6 +60,15 @@ namespace CleanMachineHMI
|
||||
#endregion
|
||||
|
||||
|
||||
private PlcOperationHelper()
|
||||
{
|
||||
_synchronization = SynchronizationContext.Current;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private SynchronizationContext _synchronization;
|
||||
|
||||
|
||||
private byte slaveAddress = byte.Parse(ConfigurationManager.AppSettings["SlaveAddress"]);
|
||||
|
||||
@@ -89,7 +98,7 @@ namespace CleanMachineHMI
|
||||
|
||||
|
||||
|
||||
public List<PlcItem> PlcItemMdList { get; set; } = new List<PlcItem>();
|
||||
public List<PlcItem> PlcItemMdList { get; set; } = new List<PlcItem>();
|
||||
public List<PlcItem> PlcItemMd_D_List { get; set; } = new List<PlcItem>();
|
||||
|
||||
public List<PlcItem> PlcItemMd_M_List { get; set; } = new List<PlcItem>();
|
||||
@@ -99,24 +108,29 @@ namespace CleanMachineHMI
|
||||
public List<PlcItem> PlcItemMd_Y_List { get; set; } = new List<PlcItem>();
|
||||
|
||||
|
||||
public void StartRead()
|
||||
{
|
||||
Thread th = new Thread(RefreshPlcItem)
|
||||
{
|
||||
IsBackground = true
|
||||
};
|
||||
th.Start();
|
||||
//public void StartRead()
|
||||
//{
|
||||
// Thread th = new Thread(RefreshPlcItem)
|
||||
// {
|
||||
// IsBackground = true
|
||||
// };
|
||||
// th.Start();
|
||||
|
||||
}
|
||||
//}
|
||||
|
||||
|
||||
|
||||
// public System.Threading.AutoResetEvent thEvent = new System.Threading.AutoResetEvent(false);
|
||||
|
||||
private void RefreshPlcItem()
|
||||
{
|
||||
while (Global.SysThIsRunFlag)
|
||||
{
|
||||
RefreshPlcItem_M();
|
||||
Instance.RefreshPlcItem_D();
|
||||
Instance.RefreshPlcItem_X();
|
||||
Instance.RefreshPlcItem_Y();
|
||||
RefreshPlcItem_D();
|
||||
RefreshPlcItem_X();
|
||||
RefreshPlcItem_Y();
|
||||
// thEvent.Set();
|
||||
// ShowWarningMsg();
|
||||
Thread.Sleep(100);
|
||||
}
|
||||
@@ -305,10 +319,10 @@ namespace CleanMachineHMI
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
if (item.PlcItemDataLength == 2)
|
||||
{
|
||||
ushort[] tmp_1 = new ushort[] { readBytArr_D[plcItemDeviationAddress], readBytArr_D[plcItemDeviationAddress + 1] };
|
||||
// ushort[] tmp_1 = new ushort[] { readBytArr_D[plcItemDeviationAddress], readBytArr_D[plcItemDeviationAddress + 1] };
|
||||
|
||||
#region 方法一 :Short数组转换为int数据 20201014 孙亚龙
|
||||
////低位 short 的字节数组。
|
||||
@@ -335,7 +349,32 @@ namespace CleanMachineHMI
|
||||
}
|
||||
}
|
||||
}
|
||||
HandleWaringLog(tmpReadAlarmBytArr_D);
|
||||
string priStr = "D";
|
||||
int index = 10;
|
||||
Global.CmWarningLogMd_List.Clear();
|
||||
for (var i = 0; i < 9; i++)
|
||||
{
|
||||
var plcitem = $"{priStr}{index + i}";
|
||||
|
||||
if (tmpReadAlarmBytArr_D[i] != 0)
|
||||
{
|
||||
var wanglist = Global.CheckWarng(tmpReadAlarmBytArr_D[i], plcitem);
|
||||
Global.CmWarningLogMd_List.AddRange(wanglist);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
if (Global.CmWarningLogMd_List.Count() > 0)
|
||||
{
|
||||
Global.ShowMainFrmAlarmMsg(true, EventArgs.Empty);
|
||||
}
|
||||
else
|
||||
{
|
||||
Global.ShowMainFrmAlarmMsg(false, EventArgs.Empty);
|
||||
}
|
||||
|
||||
|
||||
// HandleWaringLog(tmpReadAlarmBytArr_D);
|
||||
}
|
||||
#if RELEASE
|
||||
}
|
||||
@@ -346,6 +385,11 @@ namespace CleanMachineHMI
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//报警信息记录
|
||||
private void HandleWaringLog(ushort[] tmpReadAlarmBytArr_D)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user