Commit b4191e67 authored by wangjunqiang's avatar wangjunqiang

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

parent daaefa58
...@@ -130,7 +130,7 @@ namespace GcDevicePc ...@@ -130,7 +130,7 @@ namespace GcDevicePc
startTime = DateTime.Now; startTime = DateTime.Now;
// toolStripStatusLabeSystme.Text = string.Format("状态:{0}", Formstr); // 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() + "秒"); toolStripStatusLabelusertime.Text = String.Format("运行时间:{0}", timespan.Days.ToString() + "天" + timespan.Hours.ToString() + "时" + timespan.Minutes.ToString() + "分" + timespan.Seconds.ToString() + "秒");
//显示方法名称 //显示方法名称
...@@ -281,9 +281,6 @@ namespace GcDevicePc ...@@ -281,9 +281,6 @@ namespace GcDevicePc
return (Environment.TickCount - (long)vLastInputInfo.dwTime)/1000; return (Environment.TickCount - (long)vLastInputInfo.dwTime)/1000;
} }
public void SendPCCMD(bool flag) public void SendPCCMD(bool flag)
{ {
if (flag) //打开运行 if (flag) //打开运行
...@@ -348,13 +345,12 @@ namespace GcDevicePc ...@@ -348,13 +345,12 @@ namespace GcDevicePc
{ {
globaldata.OS_STOP = false; globaldata.OS_STOP = false;
} }
worker.ReportProgress(100); worker.ReportProgress(100);
break; break;
} }
else else
{ {
if (i % 20 == 0) if (i % 10 == 0)
{ {
if (globaldata.OS_STOP) if (globaldata.OS_STOP)
{ {
...@@ -365,11 +361,15 @@ namespace GcDevicePc ...@@ -365,11 +361,15 @@ namespace GcDevicePc
hmiopt.WriteStopVal(); hmiopt.WriteStopVal();
} }
} }
Thread.Sleep(100);
if (i != 99) if (i != 99)
{
worker.ReportProgress(i); worker.ReportProgress(i);
break;
}
} }
if (worker.CancellationPending) // 如果用户取消则跳出处理数据代码 if (worker.CancellationPending) // 如果用户取消则跳出处理数据代码
...@@ -377,6 +377,8 @@ namespace GcDevicePc ...@@ -377,6 +377,8 @@ namespace GcDevicePc
e.Cancel = true; e.Cancel = true;
break; break;
} }
Thread.Sleep(100);
} }
} }
...@@ -415,9 +417,8 @@ namespace GcDevicePc ...@@ -415,9 +417,8 @@ namespace GcDevicePc
{ {
worker.ReportProgress(100); worker.ReportProgress(100);
break; break;
}
else }else{
{
if (i % 20 == 0 && i != 0) if (i % 20 == 0 && i != 0)
{ {
if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.RunType == 0) if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.RunType == 0)
......
...@@ -320,9 +320,9 @@ namespace GcDevicePc.ProThread ...@@ -320,9 +320,9 @@ namespace GcDevicePc.ProThread
/// 获取HMI运行状态 /// 获取HMI运行状态
/// </summary> /// </summary>
/// <param name="state"></param> /// <param name="state"></param>
private void GetHMIState(ref ushort[] state) private int GetHMIState(ref ushort[] state)
{ {
int ret = 0; int ret = -1;
try try
{ {
ret = GetState(globaldata.hmistatus, 9, ref state); ret = GetState(globaldata.hmistatus, 9, ref state);
...@@ -345,7 +345,8 @@ namespace GcDevicePc.ProThread ...@@ -345,7 +345,8 @@ namespace GcDevicePc.ProThread
{ {
Log.Error(e.Message); Log.Error(e.Message);
} }
return ret;
} }
/// <summary> /// <summary>
...@@ -715,37 +716,39 @@ namespace GcDevicePc.ProThread ...@@ -715,37 +716,39 @@ namespace GcDevicePc.ProThread
private void update_hmidata() private void update_hmidata()
{ {
UInt16[] hmistate = new UInt16[9]; UInt16[] hmistate = new UInt16[9];
GetHMIState(ref hmistate); int ret = -1;
ret = GetHMIState(ref hmistate);
globaldata.m_hmibuffer.gcinfo.batno = hmistate[0];
globaldata.m_hmibuffer.gcinfo.batruncount = hmistate[1]; if (ret == 0)
globaldata.m_hmibuffer.gcinfo.oneruntime = hmistate[2]; {
globaldata.m_hmibuffer.gcinfo.singlerun = hmistate[3]; globaldata.m_hmibuffer.gcinfo.batno = hmistate[0];
globaldata.m_hmibuffer.gcinfo.batrun = hmistate[4]; globaldata.m_hmibuffer.gcinfo.batruncount = hmistate[1];
globaldata.m_hmibuffer.gcinfo.methodstatus = hmistate[5]; globaldata.m_hmibuffer.gcinfo.oneruntime = hmistate[2];
globaldata.m_hmibuffer.gcinfo.waitstart = hmistate[6]; globaldata.m_hmibuffer.gcinfo.singlerun = hmistate[3];
globaldata.m_hmibuffer.gcinfo.hmistatus = hmistate[7]; globaldata.m_hmibuffer.gcinfo.batrun = hmistate[4];
globaldata.m_hmibuffer.gcinfo.runtime = hmistate[8]; globaldata.m_hmibuffer.gcinfo.methodstatus = hmistate[5];
globaldata.m_hmibuffer.gcinfo.waitstart = hmistate[6];
//额外设置 globaldata.m_hmibuffer.gcinfo.hmistatus = hmistate[7];
globaldata.m_dpbuffer.ShowList.showtime.runtimenow = hmistate[2]; globaldata.m_hmibuffer.gcinfo.runtime = hmistate[8];
globaldata.m_dpbuffer.ShowList.showtime.alltime = hmistate[8];
// Get_Method_StartEndTime(ref globaldata.m_hmibuffer.gcinfo.NowStartTime, ref globaldata.m_hmibuffer.gcinfo.NowEndTime); //额外设置
globaldata.m_dpbuffer.ShowList.showtime.runtimenow = hmistate[2];
//获取开始时间 globaldata.m_dpbuffer.ShowList.showtime.alltime = hmistate[8];
if (globaldata.m_hmibuffer.gcinfo.methodstatus == 4 || globaldata.m_hmibuffer.gcinfo.methodstatus == 5) // Get_Method_StartEndTime(ref globaldata.m_hmibuffer.gcinfo.NowStartTime, ref globaldata.m_hmibuffer.gcinfo.NowEndTime);
{
globaldata.m_hmibuffer.gcinfo.NowStartTime = Get_Method_StartTime(); //获取开始时间
if (globaldata.m_hmibuffer.gcinfo.methodstatus == 4 || globaldata.m_hmibuffer.gcinfo.methodstatus == 5)
//Get_Method_StartEndTime(ref globaldata.m_hmibuffer.gcinfo.NowStartTime, ref globaldata.m_hmibuffer.gcinfo.NowEndTime); {
globaldata.m_hmibuffer.gcinfo.NowStartTime = Get_Method_StartTime();
} }
//获取结束时间 //获取结束时间
if (globaldata.m_hmibuffer.gcinfo.methodstatus == 0 || globaldata.m_hmibuffer.gcinfo.methodstatus > 5) if (globaldata.m_hmibuffer.gcinfo.methodstatus == 0 || globaldata.m_hmibuffer.gcinfo.methodstatus > 5)
{ {
globaldata.m_hmibuffer.gcinfo.NowEndTime = Get_Method_EndTime(); globaldata.m_hmibuffer.gcinfo.NowEndTime = Get_Method_EndTime();
}
} }
} }
/// <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