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