Commit b4191e67 authored by wangjunqiang's avatar wangjunqiang

添加一些判断条件,严格化约束

parent daaefa58
......@@ -130,7 +130,7 @@ namespace GcDevicePc
startTime = DateTime.Now;
// toolStripStatusLabeSystme.Text = string.Format("状态:{0}", Formstr);
timespan = System.DateTime.Now - startTime;
timespan = DateTime.Now - startTime;
toolStripStatusLabelusertime.Text = String.Format("运行时间:{0}", timespan.Days.ToString() + "天" + timespan.Hours.ToString() + "时" + timespan.Minutes.ToString() + "分" + timespan.Seconds.ToString() + "秒");
//显示方法名称
......@@ -281,9 +281,6 @@ namespace GcDevicePc
return (Environment.TickCount - (long)vLastInputInfo.dwTime)/1000;
}
public void SendPCCMD(bool flag)
{
if (flag) //打开运行
......@@ -348,13 +345,12 @@ namespace GcDevicePc
{
globaldata.OS_STOP = false;
}
worker.ReportProgress(100);
break;
}
else
{
if (i % 20 == 0)
if (i % 10 == 0)
{
if (globaldata.OS_STOP)
{
......@@ -365,11 +361,15 @@ namespace GcDevicePc
hmiopt.WriteStopVal();
}
}
Thread.Sleep(100);
if (i != 99)
{
worker.ReportProgress(i);
break;
}
}
if (worker.CancellationPending) // 如果用户取消则跳出处理数据代码
......@@ -377,6 +377,8 @@ namespace GcDevicePc
e.Cancel = true;
break;
}
Thread.Sleep(100);
}
}
......@@ -415,9 +417,8 @@ namespace GcDevicePc
{
worker.ReportProgress(100);
break;
}
else
{
}else{
if (i % 20 == 0 && i != 0)
{
if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.RunType == 0)
......
......@@ -320,9 +320,9 @@ namespace GcDevicePc.ProThread
/// 获取HMI运行状态
/// </summary>
/// <param name="state"></param>
private void GetHMIState(ref ushort[] state)
private int GetHMIState(ref ushort[] state)
{
int ret = 0;
int ret = -1;
try
{
ret = GetState(globaldata.hmistatus, 9, ref state);
......@@ -346,6 +346,7 @@ namespace GcDevicePc.ProThread
Log.Error(e.Message);
}
return ret;
}
/// <summary>
......@@ -715,8 +716,11 @@ namespace GcDevicePc.ProThread
private void update_hmidata()
{
UInt16[] hmistate = new UInt16[9];
GetHMIState(ref hmistate);
int ret = -1;
ret = GetHMIState(ref hmistate);
if (ret == 0)
{
globaldata.m_hmibuffer.gcinfo.batno = hmistate[0];
globaldata.m_hmibuffer.gcinfo.batruncount = hmistate[1];
globaldata.m_hmibuffer.gcinfo.oneruntime = hmistate[2];
......@@ -736,9 +740,6 @@ namespace GcDevicePc.ProThread
if (globaldata.m_hmibuffer.gcinfo.methodstatus == 4 || globaldata.m_hmibuffer.gcinfo.methodstatus == 5)
{
globaldata.m_hmibuffer.gcinfo.NowStartTime = Get_Method_StartTime();
//Get_Method_StartEndTime(ref globaldata.m_hmibuffer.gcinfo.NowStartTime, ref globaldata.m_hmibuffer.gcinfo.NowEndTime);
}
//获取结束时间
......@@ -748,6 +749,8 @@ namespace GcDevicePc.ProThread
}
}
}
/// <summary>
/// 更新通道采集数据
/// </summary>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment