Commit 64091552 authored by wangwanxh@sina.com's avatar wangwanxh@sina.com

Merge branch 'wang_master' of https://gitee.com/wangwanxh/Vocs into wang_master

parents 107efa42 cfc13949
...@@ -13,7 +13,7 @@ namespace GcDevicePc ...@@ -13,7 +13,7 @@ namespace GcDevicePc
{ {
class AppInit class AppInit
{ {
/// <summary> /// <summary>
/// 检测文件和目录是否存在 /// 检测文件和目录是否存在
/// </summary> /// </summary>
......
...@@ -351,6 +351,17 @@ namespace GcDevicePc ...@@ -351,6 +351,17 @@ namespace GcDevicePc
} }
} }
public void SendSTDCMD()
{
hmiopt.WriteStopVal();
WaitHMIFree();
if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.system_Statue)
{
hmiopt.WriteSTDBatVal();
hmiopt.WriteStartVal();
}
}
private void SetMainFormMethodName(string text) private void SetMainFormMethodName(string text)
{ {
this.toolStripStatusLabelText.Text = "当前运行方法:" + text; this.toolStripStatusLabelText.Text = "当前运行方法:" + text;
...@@ -721,8 +732,6 @@ namespace GcDevicePc ...@@ -721,8 +732,6 @@ namespace GcDevicePc
// startbtn(); // startbtn();
} }
//点火失败或着火焰熄灭,停止系统 //点火失败或着火焰熄灭,停止系统
//if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.system_Statue && globaldata.m_hmibuffer.gcinfo.FireStatus[0] == 3 && globaldata.m_hmibuffer.gcinfo.methodstatus == 0 && globaldata.m_hmibuffer.gcinfo.hmistatus == 0) //if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.system_Statue && globaldata.m_hmibuffer.gcinfo.FireStatus[0] == 3 && globaldata.m_hmibuffer.gcinfo.methodstatus == 0 && globaldata.m_hmibuffer.gcinfo.hmistatus == 0)
//{ //{
...@@ -747,24 +756,28 @@ namespace GcDevicePc ...@@ -747,24 +756,28 @@ namespace GcDevicePc
switch (runtype) switch (runtype)
{ {
case 0: case 0:
ButtonControl_Status(dest[5], 0); //ButtonControl_Status(dest[5], 0);
DataControl_Status(dest[5], 0); DataControl_Status(dest[5], 0);
break; break;
case 2: case 2:
BAT_HeadInfo(dest[0], dest[1]); BAT_HeadInfo(dest[0], dest[1]);
ButtonControl_Status(dest[5], 2); // ButtonControl_Status(dest[5], 2);
DataControl_Status(dest[5], 2); DataControl_Status(dest[5], 2);
break; break;
case 3: case 3:
QuickRun_HeadInfo(); QuickRun_HeadInfo();
ButtonControl_Status(dest[5], 1); // ButtonControl_Status(dest[5], 1);
DataControl_Status(dest[5], 1); DataControl_Status(dest[5], 1);
break; break;
case 4: case 4:
SingleRun_HeadInfo(); SingleRun_HeadInfo();
ButtonControl_Status(dest[5], 0); // ButtonControl_Status(dest[5], 0);
// DataControl_Status(dest[5], 0); // DataControl_Status(dest[5], 0);
break; break;
case 7:
BAT_HeadInfo(dest[0], dest[1]);
DataControl_Status(dest[5], 7);
break;
default: default:
Common_HeadInfo(); Common_HeadInfo();
break; break;
...@@ -843,35 +856,35 @@ namespace GcDevicePc ...@@ -843,35 +856,35 @@ namespace GcDevicePc
} }
} }
void ButtonControl_Status(ushort flag, ushort runtype) //void ButtonControl_Status(ushort flag, ushort runtype)
{ //{
invokeDelegate update_ButtonStatus_UI = () => // invokeDelegate update_ButtonStatus_UI = () =>
{ // {
switch (flag) // switch (flag)
{ // {
case 0: // case 0:
case 1: // case 1:
case 2: // case 2:
// ChangeButton(0); // // ChangeButton(0);
break; // break;
case 3: //已就绪 // case 3: //已就绪
// if (runtype == 0 && globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.work_Statue != 1) // // if (runtype == 0 && globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.work_Statue != 1)
// ChangeButton(1); // // ChangeButton(1);
break; // break;
case 4: // case 4:
case 5: // case 5:
//ChangeButton(2); // //ChangeButton(2);
break; // break;
case 6: // case 6:
// ChangeButton(0); // // ChangeButton(0);
break; // break;
case 7: // case 7:
// ChangeButton(0); // // ChangeButton(0);
break; // break;
} // }
}; // };
Invoke(update_ButtonStatus_UI); // Invoke(update_ButtonStatus_UI);
} //}
/// <summary> /// <summary>
/// 显示系统连接状态和方法运行 /// 显示系统连接状态和方法运行
...@@ -1062,7 +1075,6 @@ namespace GcDevicePc ...@@ -1062,7 +1075,6 @@ namespace GcDevicePc
} }
Thread.Sleep(1000); Thread.Sleep(1000);
} }
} }
private void MDIBase_FormClosing(object sender, FormClosingEventArgs e) private void MDIBase_FormClosing(object sender, FormClosingEventArgs e)
...@@ -1243,9 +1255,6 @@ namespace GcDevicePc ...@@ -1243,9 +1255,6 @@ namespace GcDevicePc
WaitHMIWork(); WaitHMIWork();
Thread.Sleep(500); Thread.Sleep(500);
globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.system_Statue = true; globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.system_Statue = true;
globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.work_Statue = 0; globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.work_Statue = 0;
globaldata.starttimer = 0; globaldata.starttimer = 0;
...@@ -1272,7 +1281,11 @@ namespace GcDevicePc ...@@ -1272,7 +1281,11 @@ namespace GcDevicePc
hmiopt.FireUPWork(flag, time1, time2); hmiopt.FireUPWork(flag, time1, time2);
} }
//调试运行表接口 /// <summary>
/// 调试运行表接口
/// </summary>
/// <param name="folder">批处理目录</param>
/// <param name="runtablename">批处理文件名(带.ini)</param>
private void RunTableOpt(String folder, String runtablename) private void RunTableOpt(String folder, String runtablename)
{ {
bool ret = false; bool ret = false;
...@@ -1299,6 +1312,40 @@ namespace GcDevicePc ...@@ -1299,6 +1312,40 @@ namespace GcDevicePc
} }
} }
/// <summary>
/// 调试运行表接口
/// </summary>
/// <param name="folder">批处理目录</param>
/// <param name="runtablename">批处理文件名(带.ini)</param>
/// <param name="count">批处理运行次数</param>
private void RunTableOptWithCount(String folder, String runtablename, ushort count)
{
bool ret = false;
RunTableHelper runtable = new RunTableHelper(folder, runtablename);
if (!String.IsNullOrEmpty(globaldata.connection_ip))
{
string lfilename;
string rfilename;
FileServerClient rtclient = new FileServerClient();
rtclient.WtClientInit(globaldata.connection_ip, globaldata.fileserverport);
for (int i = 1; i < runtable._methodname.Count; i++)
{
rfilename = runtable._methodname[i];
lfilename = Path.Combine(globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.MethodFolder, rfilename);
rtclient.WtClientCopytoServer(rfilename, lfilename, globaldata.remoteFolder + "仪器方法\\");
Thread.Sleep(200);
}
rtclient.WtClientCopytoServer("RunMethodStd.ini", Path.Combine(folder, runtablename), globaldata.remoteFolder + "运行表\\");
hmiopt.SetBatCount(count);
SendSTDCMD();
globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_RunTab = Path.Combine(folder, runtablename);
ret = true;
}
}
/// <summary> /// <summary>
/// 更新所需,关闭HMI /// 更新所需,关闭HMI
/// </summary> /// </summary>
......
...@@ -53,6 +53,14 @@ namespace GcDevicePc.ProThread ...@@ -53,6 +53,14 @@ namespace GcDevicePc.ProThread
ret = m_modbus.WriteHoldingReg(148, mystate, this.strIP, this.netPost); ret = m_modbus.WriteHoldingReg(148, mystate, this.strIP, this.netPost);
} }
public void WriteSTDBatVal()
{
int ret;
ushort mystate = (ushort)0x1;
if (this.setflag)
ret = m_modbus.WriteHoldingReg(151, mystate, this.strIP, this.netPost);
}
public void WriteOpenVal() public void WriteOpenVal()
{ {
int ret; int ret;
...@@ -349,7 +357,30 @@ namespace GcDevicePc.ProThread ...@@ -349,7 +357,30 @@ namespace GcDevicePc.ProThread
} }
return (ret == 0) ? true : false; return (ret == 0) ? true : false;
} }
public bool SetBatCount(ushort val)
{
ushort mystate = val;
int ret = 0;
int count = 0;
ushort addr = 10;
if (this.setflag)
{
ret = m_modbus.WriteHoldingReg(addr, mystate, this.strIP, this.netPost);
while (ret != 0)
{
count++;
ret = m_modbus.WriteHoldingReg(addr, mystate, this.strIP, this.netPost);
Thread.Sleep(200);
if (count == 3)
break;
}
}
return (ret == 0) ? true : false;
}
} }
} }
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