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

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

parents cf8e02e8 b4191e67
...@@ -27,7 +27,7 @@ namespace GcDevicePc ...@@ -27,7 +27,7 @@ namespace GcDevicePc
this.Controls.Add(adjust); this.Controls.Add(adjust);
} }
public void Show() public new void Show()
{ {
base.Show(); base.Show();
if (adjust != null) if (adjust != null)
......
...@@ -27,7 +27,7 @@ namespace GcDevicePc ...@@ -27,7 +27,7 @@ namespace GcDevicePc
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.Controls.Add(adjust); this.Controls.Add(adjust);
} }
public void Show() public new void Show()
{ {
base.Show(); base.Show();
if (adjust != null) if (adjust != null)
......
...@@ -28,7 +28,7 @@ namespace GcDevicePc ...@@ -28,7 +28,7 @@ namespace GcDevicePc
} }
public void Show() public new void Show()
{ {
base.Show(); base.Show();
if (total != null) if (total != null)
......
...@@ -8,6 +8,7 @@ using System.Text; ...@@ -8,6 +8,7 @@ using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking; using WeifenLuo.WinFormsUI.Docking;
using GcDevicePc.CK_UI; using GcDevicePc.CK_UI;
using GcDevicePc.Common;
namespace GcDevicePc namespace GcDevicePc
...@@ -46,7 +47,7 @@ namespace GcDevicePc ...@@ -46,7 +47,7 @@ namespace GcDevicePc
} }
catch (Exception e) catch (Exception e)
{ {
Log.Error(e.Message);
} }
} }
} }
......
...@@ -14,7 +14,7 @@ namespace GcDevicePc ...@@ -14,7 +14,7 @@ namespace GcDevicePc
{ {
public partial class MDIBase : Form public partial class MDIBase : Form
{ {
private int childFormNumber = 0; //private int childFormNumber = 0;
private static FormUser _userForm; //用户界面 private static FormUser _userForm; //用户界面
private static Formdebug _debugForm; //调试界面 private static Formdebug _debugForm; //调试界面
...@@ -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) //打开运行
...@@ -312,9 +309,7 @@ namespace GcDevicePc ...@@ -312,9 +309,7 @@ namespace GcDevicePc
if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.RunType == 2) if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.RunType == 2)
{ {
hmiopt.WriteBatVal(); hmiopt.WriteBatVal();
hmiopt.WriteStartVal(); hmiopt.WriteStartVal();
WaitHMIWork(); WaitHMIWork();
} }
...@@ -330,6 +325,7 @@ namespace GcDevicePc ...@@ -330,6 +325,7 @@ namespace GcDevicePc
{ {
hmiopt.WriteSTDBatVal(); hmiopt.WriteSTDBatVal();
hmiopt.WriteStartVal(); hmiopt.WriteStartVal();
} }
} }
...@@ -349,13 +345,12 @@ namespace GcDevicePc ...@@ -349,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)
{ {
...@@ -366,11 +361,15 @@ namespace GcDevicePc ...@@ -366,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) // 如果用户取消则跳出处理数据代码
...@@ -378,6 +377,8 @@ namespace GcDevicePc ...@@ -378,6 +377,8 @@ namespace GcDevicePc
e.Cancel = true; e.Cancel = true;
break; break;
} }
Thread.Sleep(100);
} }
} }
...@@ -416,9 +417,8 @@ namespace GcDevicePc ...@@ -416,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)
...@@ -1178,20 +1178,23 @@ namespace GcDevicePc ...@@ -1178,20 +1178,23 @@ namespace GcDevicePc
/// <param name="runtablename">批处理文件名(带.ini)</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;
RunTableHelper runtable = new RunTableHelper(folder, runtablename); RunTableHelper runtable = new RunTableHelper(folder, runtablename);
if (!String.IsNullOrEmpty(globaldata.connection_ip)) if (!String.IsNullOrEmpty(globaldata.connection_ip))
{ {
string lfilename;
string rfilename;
FileServerClient rtclient = new FileServerClient(); FileServerClient rtclient = new FileServerClient();
rtclient.WtClientInit(globaldata.connection_ip, globaldata.fileserverport); rtclient.WtClientInit(globaldata.connection_ip, globaldata.fileserverport);
if (File.Exists(Path.Combine(folder, runtablename)))
{
rtclient.WtClientCopytoServer("RunMethod.ini", Path.Combine(folder, runtablename), globaldata.remoteFolder + "运行表\\"); rtclient.WtClientCopytoServer("RunMethod.ini", Path.Combine(folder, runtablename), globaldata.remoteFolder + "运行表\\");
SendPCCMD(false); SendPCCMD(false);
}
rtclient.WtClientClose();
globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_RunTab = Path.Combine(folder, runtablename); globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_RunTab = Path.Combine(folder, runtablename);
ret = true; //ret = true;
} }
} }
...@@ -1203,21 +1206,24 @@ namespace GcDevicePc ...@@ -1203,21 +1206,24 @@ namespace GcDevicePc
/// <param name="count">批处理运行次数</param> /// <param name="count">批处理运行次数</param>
private void RunTableOptWithCount(String folder, String runtablename, ushort count) private void RunTableOptWithCount(String folder, String runtablename, ushort count)
{ {
bool ret = false; //bool ret = false;
RunTableHelper runtable = new RunTableHelper(folder, runtablename); RunTableHelper runtable = new RunTableHelper(folder, runtablename);
if (!String.IsNullOrEmpty(globaldata.connection_ip)) if (!String.IsNullOrEmpty(globaldata.connection_ip))
{ {
string lfilename;
string rfilename;
FileServerClient rtclient = new FileServerClient(); FileServerClient rtclient = new FileServerClient();
rtclient.WtClientInit(globaldata.connection_ip, globaldata.fileserverport); rtclient.WtClientInit(globaldata.connection_ip, globaldata.fileserverport);
if (File.Exists(Path.Combine(folder, runtablename)))
{
rtclient.WtClientCopytoServer("RunMethodStd.ini", Path.Combine(folder, runtablename), globaldata.remoteFolder + "运行表\\"); rtclient.WtClientCopytoServer("RunMethodStd.ini", Path.Combine(folder, runtablename), globaldata.remoteFolder + "运行表\\");
hmiopt.SetBatCount(count); hmiopt.SetBatCount(count);
SendSTDCMD(); SendSTDCMD();
}
rtclient.WtClientClose();
globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_RunTab = Path.Combine(folder, runtablename); globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_RunTab = Path.Combine(folder, runtablename);
ret = true; //ret = true;
} }
} }
......
...@@ -164,7 +164,7 @@ namespace GcDevicePc ...@@ -164,7 +164,7 @@ namespace GcDevicePc
} }
catch (Exception e) catch (Exception e)
{ {
Log.Error(e.Message);
} }
} }
......
...@@ -81,8 +81,12 @@ namespace GcDevicePc.Module ...@@ -81,8 +81,12 @@ namespace GcDevicePc.Module
public int UpdateData2(float[] data) public int UpdateData2(float[] data)
{ {
UInt16[] buf = new UInt16[4] { 0, 0, 0, 0 }; UInt16[] buf = new UInt16[4] { 0, 0, 0, 0 };
int ret = 1;
if (workflag)
{
GetMaVal(data, ref buf); GetMaVal(data, ref buf);
int ret = rtumodbus.WriteMultipleRegs(1, 1, 4, ref buf); ret = rtumodbus.WriteMultipleRegs(1, 1, 4, ref buf);
}
return ret; return ret;
} }
......
...@@ -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);
...@@ -346,6 +346,7 @@ namespace GcDevicePc.ProThread ...@@ -346,6 +346,7 @@ namespace GcDevicePc.ProThread
Log.Error(e.Message); Log.Error(e.Message);
} }
return ret;
} }
/// <summary> /// <summary>
...@@ -715,8 +716,11 @@ namespace GcDevicePc.ProThread ...@@ -715,8 +716,11 @@ 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);
if (ret == 0)
{
globaldata.m_hmibuffer.gcinfo.batno = hmistate[0]; globaldata.m_hmibuffer.gcinfo.batno = hmistate[0];
globaldata.m_hmibuffer.gcinfo.batruncount = hmistate[1]; globaldata.m_hmibuffer.gcinfo.batruncount = hmistate[1];
globaldata.m_hmibuffer.gcinfo.oneruntime = hmistate[2]; globaldata.m_hmibuffer.gcinfo.oneruntime = hmistate[2];
...@@ -736,9 +740,6 @@ namespace GcDevicePc.ProThread ...@@ -736,9 +740,6 @@ namespace GcDevicePc.ProThread
if (globaldata.m_hmibuffer.gcinfo.methodstatus == 4 || globaldata.m_hmibuffer.gcinfo.methodstatus == 5) if (globaldata.m_hmibuffer.gcinfo.methodstatus == 4 || globaldata.m_hmibuffer.gcinfo.methodstatus == 5)
{ {
globaldata.m_hmibuffer.gcinfo.NowStartTime = Get_Method_StartTime(); 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 ...@@ -748,6 +749,8 @@ namespace GcDevicePc.ProThread
} }
} }
}
/// <summary> /// <summary>
/// 更新通道采集数据 /// 更新通道采集数据
/// </summary> /// </summary>
......
using System; using System;
using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using GcDevicePc.Common;
using GcDevicePc.ProThread;
namespace GcDevicePc namespace GcDevicePc
{ {
......
...@@ -17,7 +17,7 @@ namespace GcDevicePc ...@@ -17,7 +17,7 @@ namespace GcDevicePc
private String _appInitInfo = "系统初始化开始"; private String _appInitInfo = "系统初始化开始";
private int _initSec; private int _initSec;
private int _initStep; //private int _initStep;
private static Thread _tPreload; private static Thread _tPreload;
private MainForm _mMainForm; private MainForm _mMainForm;
......
...@@ -179,13 +179,12 @@ namespace GcDevicePc ...@@ -179,13 +179,12 @@ namespace GcDevicePc
if(globaldata.DeviceList.Count > 0) if(globaldata.DeviceList.Count > 0)
{ {
this.hmiip.Text = ((globaldata.DeviceInfo)globaldata.DeviceList[globaldata.DeviceList.Count - 1]).IpAddr; this.hmiip.Text = ((globaldata.DeviceInfo)globaldata.DeviceList[0]).IpAddr;
this.hmigw.Text = ((globaldata.DeviceInfo)globaldata.DeviceList[globaldata.DeviceList.Count - 1]).Gateway; this.hmigw.Text = ((globaldata.DeviceInfo)globaldata.DeviceList[0]).Gateway;
this.hminm.Text = ((globaldata.DeviceInfo)globaldata.DeviceList[globaldata.DeviceList.Count - 1]).Netmask; this.hminm.Text = ((globaldata.DeviceInfo)globaldata.DeviceList[0]).Netmask;
} }
///获取本地的IP地址
///
try try
{ {
ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration");
......
...@@ -32,7 +32,7 @@ namespace GcDevicePc ...@@ -32,7 +32,7 @@ namespace GcDevicePc
void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{ {
this.Close();//执行完之后,直接关闭页面 this.Close();
} }
void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
......
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