Commit f043db03 authored by liu's avatar liu

小细节修改

parent 2f1c2e54
using System; using GcDevicePc.CK_UI;
using System.ComponentModel;
using System.Windows.Forms;
using System.Diagnostics;
using System.IO;
using GcDevicePc.ProThread;
using GcDevicePc.Common; using GcDevicePc.Common;
using System.Threading;
using GcDevicePc.CK_UI;
using Ini.Net;
using System.Runtime.InteropServices;
using GcDevicePc.ConfigMethod; using GcDevicePc.ConfigMethod;
using GcDevicePc.Controls; using GcDevicePc.Controls;
using GcDevicePc.GCBuffer; using GcDevicePc.GCBuffer;
using GcDevicePc.IniParam; using GcDevicePc.IniParam;
using GcDevicePc.ProThread;
using Ini.Net;
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
namespace GcDevicePc namespace GcDevicePc
{ {
...@@ -21,7 +21,7 @@ namespace GcDevicePc ...@@ -21,7 +21,7 @@ namespace GcDevicePc
{ {
#region 相关变量 #region 相关变量
//private int childFormNumber = 0; //private int childFormNumber = 0;
private static FormUser _userForm; //用户界面 private static FormUser _userForm; //用户界面
private static Formdebug _debugForm; //调试界面 private static Formdebug _debugForm; //调试界面
private static EPCTips _EPCTipsForm; //EPC报警界面 private static EPCTips _EPCTipsForm; //EPC报警界面
...@@ -34,7 +34,7 @@ namespace GcDevicePc ...@@ -34,7 +34,7 @@ namespace GcDevicePc
private string Formstr;//窗口名称 private string Formstr;//窗口名称
private string statestr;//状态信息 private string statestr;//状态信息
// private Color stateColor=new Color();//状态颜色; // private Color stateColor=new Color();//状态颜色;
private bool IsStateColor = false; private bool IsStateColor = false;
System.DateTime startTime; //系统启动时间 System.DateTime startTime; //系统启动时间
TimeSpan timespan; TimeSpan timespan;
...@@ -106,9 +106,9 @@ namespace GcDevicePc ...@@ -106,9 +106,9 @@ namespace GcDevicePc
CKVocAnalyzer.Config.Instance.ReadAxisRange(); CKVocAnalyzer.Config.Instance.ReadAxisRange();
LogOperate.LogInit.Instance.path = CKVocAnalyzer.GlobalCKV.FolderLog; LogOperate.LogInit.Instance.path = CKVocAnalyzer.GlobalCKV.FolderLog;
LogOperate.LogInit.Instance.Init(); LogOperate.LogInit.Instance.Init();
CKVocAnalyzer.GlobalCKV.tcpservice.tcpStart(CKVocAnalyzer.GlobalCKV.hostadd, CKVocAnalyzer.GlobalCKV.tcpport); CKVocAnalyzer.GlobalCKV.tcpservice.tcpStart(CKVocAnalyzer.GlobalCKV.hostadd, CKVocAnalyzer.GlobalCKV.tcpport);
//自动删除 //自动删除
SpaceM.SpaceThread sthread = new SpaceM.SpaceThread(CKVocAnalyzer.GlobalCKV.HistDataPath,CKVocAnalyzer.GlobalCKV.SpaceSize,CKVocAnalyzer.GlobalCKV.SpaceTimes); SpaceM.SpaceThread sthread = new SpaceM.SpaceThread(CKVocAnalyzer.GlobalCKV.HistDataPath, CKVocAnalyzer.GlobalCKV.SpaceSize, CKVocAnalyzer.GlobalCKV.SpaceTimes);
sthread.SpaceStart(); sthread.SpaceStart();
Log.Info("System Init Success"); Log.Info("System Init Success");
...@@ -330,14 +330,14 @@ namespace GcDevicePc ...@@ -330,14 +330,14 @@ namespace GcDevicePc
_EPCTipsForm = new EPCTips(); _EPCTipsForm = new EPCTips();
_EPCTipsForm.MdiParent = this; _EPCTipsForm.MdiParent = this;
_EPCTipsForm.Location = new Point(0, ClientSize.Height- _EPCTipsForm.Height); _EPCTipsForm.Location = new Point(0, ClientSize.Height - _EPCTipsForm.Height);
_EPCTipsForm.Hide(); _EPCTipsForm.Hide();
// debugForm.Show(); // debugForm.Show();
Formstr = "用户界面"; Formstr = "用户界面";
startTime = DateTime.Now; startTime = DateTime.Now;
// toolStripStatusLabeSystme.Text = string.Format("状态:{0}", Formstr); // toolStripStatusLabeSystme.Text = string.Format("状态:{0}", Formstr);
timespan = 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() + "秒");
...@@ -351,7 +351,7 @@ namespace GcDevicePc ...@@ -351,7 +351,7 @@ namespace GcDevicePc
{ {
SetMainFormMethodName(globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName.Substring(globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName.LastIndexOf("\\") + 1)); SetMainFormMethodName(globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName.Substring(globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName.LastIndexOf("\\") + 1));
} }
title.Width = this.ClientSize.Width - 5; title.Width = this.ClientSize.Width - 5;
title.Location = new Point(0, 0); title.Location = new Point(0, 0);
...@@ -367,7 +367,7 @@ namespace GcDevicePc ...@@ -367,7 +367,7 @@ namespace GcDevicePc
autopensys(); autopensys();
this.SizeChanged += new EventHandler(this.MDIBase_SizeChanged); this.SizeChanged += new EventHandler(this.MDIBase_SizeChanged);
(title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOrdBtnClicked += PictureMenu1_PMOrdBtnClicked; (title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOrdBtnClicked += PictureMenu1_PMOrdBtnClicked;
(title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptBtnClicked += PictureMenu1_PMOptBtnClicked; (title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptBtnClicked += PictureMenu1_PMOptBtnClicked;
(title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMSysBtnClicked += PictureMenu1_PMSysBtnClicked; (title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMSysBtnClicked += PictureMenu1_PMSysBtnClicked;
...@@ -376,7 +376,7 @@ namespace GcDevicePc ...@@ -376,7 +376,7 @@ namespace GcDevicePc
//pictureMenu1.PMSysBtnClicked += PictureMenu1_PMSysBtnClicked; //pictureMenu1.PMSysBtnClicked += PictureMenu1_PMSysBtnClicked;
//点火接口 //点火接口
_userForm.autofire += new Fireport(fireupopt); _userForm.autofire += new Fireport(fireupopt);
//this.a = false; //this.a = false;
epcs = false; epcs = false;
timer2.Start(); timer2.Start();
...@@ -522,7 +522,7 @@ namespace GcDevicePc ...@@ -522,7 +522,7 @@ namespace GcDevicePc
LMessageBox dialog = new LMessageBox(this.Location, this.Size, true, "停止系统", "确定停止系统吗?", LMessageBox.MessageBoxPosition.MBP_Center); LMessageBox dialog = new LMessageBox(this.Location, this.Size, true, "停止系统", "确定停止系统吗?", LMessageBox.MessageBoxPosition.MBP_Center);
//if (dialog.ShowDialog() == DialogResult.OK) //if (dialog.ShowDialog() == DialogResult.OK)
//{ //{
//} //}
//DialogResult dr = MessageBox.Show("确定停止系统吗?", "停止系统", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly); //DialogResult dr = MessageBox.Show("确定停止系统吗?", "停止系统", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2, MessageBoxOptions.DefaultDesktopOnly);
...@@ -651,7 +651,7 @@ namespace GcDevicePc ...@@ -651,7 +651,7 @@ namespace GcDevicePc
globaldata.starttimer = 0x7FFFFFFF; globaldata.starttimer = 0x7FFFFFFF;
IniFile IniParser = new IniFile(tmpfile); IniFile IniParser = new IniFile(tmpfile);
if(IniParser.KeyExists("StartUp", "打开系统")) if (IniParser.KeyExists("StartUp", "打开系统"))
opensys = IniParser.ReadInteger("StartUp", "打开系统"); opensys = IniParser.ReadInteger("StartUp", "打开系统");
if ((opensys == 1 && globaldata.m_hmibuffer.gcinfo.methodstatus == 0) || globaldata.m_hmibuffer.gcinfo.methodstatus != 0) if ((opensys == 1 && globaldata.m_hmibuffer.gcinfo.methodstatus == 0) || globaldata.m_hmibuffer.gcinfo.methodstatus != 0)
...@@ -665,7 +665,7 @@ namespace GcDevicePc ...@@ -665,7 +665,7 @@ namespace GcDevicePc
// hmistatus_opensys(); // hmistatus_opensys();
//} //}
} }
catch(Exception ex) catch (Exception ex)
{ {
Log.Error(ex.Message); Log.Error(ex.Message);
} }
...@@ -759,12 +759,12 @@ namespace GcDevicePc ...@@ -759,12 +759,12 @@ namespace GcDevicePc
} }
} }
catch(Exception ex) catch (Exception ex)
{ {
Log.Error(ex.Message); Log.Error(ex.Message);
} }
} }
/// <summary> /// <summary>
/// 更新显示栏信息 /// 更新显示栏信息
/// </summary> /// </summary>
...@@ -794,17 +794,17 @@ namespace GcDevicePc ...@@ -794,17 +794,17 @@ namespace GcDevicePc
HmiStatus.Text = String.Format("状态:{0}", statestr); HmiStatus.Text = String.Format("状态:{0}", statestr);
timespan = System.DateTime.Now - startTime; timespan = System.DateTime.Now - startTime;
toolStripStatusLabelusertime.Text = String.Format("运行时间:{0}", toolStripStatusLabelusertime.Text = String.Format("运行时间:{0}",
timespan.Days.ToString() + "天" + timespan.Hours.ToString() + "时" + timespan.Minutes.ToString() + "分" + timespan.Seconds.ToString() + "秒"); timespan.Days.ToString() + "天" + timespan.Hours.ToString() + "时" + timespan.Minutes.ToString() + "分" + timespan.Seconds.ToString() + "秒");
// Trace.WriteLine(string.Format("时间{0},状态{1}", getIdleTick(),LandIn.Island),"sys"); // Trace.WriteLine(string.Format("时间{0},状态{1}", getIdleTick(),LandIn.Island),"sys");
//Console.WriteLine(t2.ToString()); //Console.WriteLine(t2.ToString());
//监视界面活动 //监视界面活动
if (getIdleTick()>60*30 && LandIn.Island) if (getIdleTick() > 60 * 30 && LandIn.Island)
{ {
if (_userForm != null) if (_userForm != null)
{ {
Formstr = "用户窗口"; Formstr = "用户窗口";
...@@ -813,7 +813,7 @@ namespace GcDevicePc ...@@ -813,7 +813,7 @@ namespace GcDevicePc
} }
LandIn.Island = false; LandIn.Island = false;
SetMenu(LandIn.Island); SetMenu(LandIn.Island);
Trace.WriteLine("进入自动销户","sys"); Trace.WriteLine("进入自动销户", "sys");
} }
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
...@@ -836,7 +836,7 @@ namespace GcDevicePc ...@@ -836,7 +836,7 @@ namespace GcDevicePc
LASTINPUTINFO vLastInputInfo = new LASTINPUTINFO(); LASTINPUTINFO vLastInputInfo = new LASTINPUTINFO();
vLastInputInfo.cbSize = Marshal.SizeOf(vLastInputInfo); vLastInputInfo.cbSize = Marshal.SizeOf(vLastInputInfo);
if (!GetLastInputInfo(ref vLastInputInfo)) return 0; if (!GetLastInputInfo(ref vLastInputInfo)) return 0;
return (Environment.TickCount - (long)vLastInputInfo.dwTime)/1000; return (Environment.TickCount - (long)vLastInputInfo.dwTime) / 1000;
} }
public void SendPCCMD(bool flag) public void SendPCCMD(bool flag)
...@@ -981,7 +981,7 @@ namespace GcDevicePc ...@@ -981,7 +981,7 @@ namespace GcDevicePc
catch catch
{ {
} }
} }
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
...@@ -991,11 +991,11 @@ namespace GcDevicePc ...@@ -991,11 +991,11 @@ namespace GcDevicePc
this.workProgress.Visible = false; this.workProgress.Visible = false;
autoResetEvent.Set(); autoResetEvent.Set();
} }
catch catch
{ {
} }
} }
private void WaitHMIFree() private void WaitHMIFree()
...@@ -1006,7 +1006,7 @@ namespace GcDevicePc ...@@ -1006,7 +1006,7 @@ namespace GcDevicePc
this.workProgress.Value = 0; this.workProgress.Value = 0;
this.backgroundWorker1.RunWorkerAsync(); this.backgroundWorker1.RunWorkerAsync();
} }
} }
private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e) private void backgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
...@@ -1074,7 +1074,7 @@ namespace GcDevicePc ...@@ -1074,7 +1074,7 @@ namespace GcDevicePc
catch catch
{ {
} }
} }
private void backgroundWorker2_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) private void backgroundWorker2_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
...@@ -1087,7 +1087,7 @@ namespace GcDevicePc ...@@ -1087,7 +1087,7 @@ namespace GcDevicePc
catch catch
{ {
} }
} }
private void WaitHMIWork() private void WaitHMIWork()
...@@ -1099,12 +1099,12 @@ namespace GcDevicePc ...@@ -1099,12 +1099,12 @@ namespace GcDevicePc
this.backgroundWorker2.RunWorkerAsync(); this.backgroundWorker2.RunWorkerAsync();
} }
} }
private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e) private void backgroundWorker1_ProgressChanged(object sender, ProgressChangedEventArgs e)
{ {
this.workProgress.Value = e.ProgressPercentage; this.workProgress.Value = e.ProgressPercentage;
} }
private void backgroundWorker2_ProgressChanged(object sender, ProgressChangedEventArgs e) private void backgroundWorker2_ProgressChanged(object sender, ProgressChangedEventArgs e)
{ {
this.workProgress.Value = e.ProgressPercentage; this.workProgress.Value = e.ProgressPercentage;
...@@ -1196,7 +1196,7 @@ namespace GcDevicePc ...@@ -1196,7 +1196,7 @@ namespace GcDevicePc
SetMainFormMethodName(tmpname); SetMainFormMethodName(tmpname);
globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName = Path.Combine(globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.MethodFolder, tmpname.ToString()); globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName = Path.Combine(globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.MethodFolder, tmpname.ToString());
if(globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.RunType == 2) if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.RunType == 2)
globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_BATMethodName = Path.Combine(globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.MethodFolder, tmpname.ToString()); globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_BATMethodName = Path.Combine(globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.MethodFolder, tmpname.ToString());
globaldata.m_profileMethod.SetMethodFullName(globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName); globaldata.m_profileMethod.SetMethodFullName(globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName);
...@@ -1207,7 +1207,7 @@ namespace GcDevicePc ...@@ -1207,7 +1207,7 @@ namespace GcDevicePc
globaldata.m_profileMethod.GetColTableElseAllPara(); globaldata.m_profileMethod.GetColTableElseAllPara();
globaldata.m_profileMethod.GetFidAllPara(); globaldata.m_profileMethod.GetFidAllPara();
globaldata.m_profileMethod.GetTcdAllPara(); globaldata.m_profileMethod.GetTcdAllPara();
globaldata.m_profileMethod.GetAuxiliaryAllPara(); globaldata.m_profileMethod.GetAuxiliaryAllPara();
} }
else else
{ {
...@@ -1217,15 +1217,15 @@ namespace GcDevicePc ...@@ -1217,15 +1217,15 @@ namespace GcDevicePc
catch catch
{ {
Log.Error("System Init Failed"); Log.Error("System Init Failed");
} }
statestr = "设备联机"; statestr = "设备联机";
IsStateColor=true; IsStateColor = true;
hmiopt = new HMIControl(globaldata.connection_ip, globaldata.datamodbusport); hmiopt = new HMIControl(globaldata.connection_ip, globaldata.datamodbusport);
mymodbus = new GcDataTh(globaldata.connection_ip, globaldata.datamodbusport); mymodbus = new GcDataTh(globaldata.connection_ip, globaldata.datamodbusport);
...@@ -1252,7 +1252,7 @@ namespace GcDevicePc ...@@ -1252,7 +1252,7 @@ namespace GcDevicePc
Slave485test = new GCModbusSlave485(globaldata.m_pcbuffer.gcpcinfo.outputinfo.port, 9600); Slave485test = new GCModbusSlave485(globaldata.m_pcbuffer.gcpcinfo.outputinfo.port, 9600);
Slave485test.CModbusSlave485Init(1, 2, 3, 5); Slave485test.CModbusSlave485Init(1, 2, 3, 5);
} }
} }
catch (Exception e) catch (Exception e)
{ {
...@@ -1265,7 +1265,7 @@ namespace GcDevicePc ...@@ -1265,7 +1265,7 @@ namespace GcDevicePc
IsStateColor = false; IsStateColor = false;
} }
} }
catch(Exception ex) catch (Exception ex)
{ {
Log.Error(ex.Message); Log.Error(ex.Message);
} }
...@@ -1518,7 +1518,7 @@ namespace GcDevicePc ...@@ -1518,7 +1518,7 @@ namespace GcDevicePc
case 4: case 4:
case 5: case 5:
//if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.work_Statue == 0) //if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.work_Statue == 0)
// startbtn(); // startbtn();
break; break;
case 6: case 6:
case 7: case 7:
...@@ -1685,7 +1685,7 @@ namespace GcDevicePc ...@@ -1685,7 +1685,7 @@ namespace GcDevicePc
// (this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 0; // (this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 0;
//} //}
if (flag!=10 && flag != 0) if (flag != 10 && flag != 0)
{ {
OSflag = true; OSflag = true;
...@@ -1719,7 +1719,7 @@ namespace GcDevicePc ...@@ -1719,7 +1719,7 @@ namespace GcDevicePc
if (data[0] == 1) if (data[0] == 1)
{ {
tips += "检测器通道一报警,报警码:"+ data[1].ToString(); tips += "检测器通道一报警,报警码:" + data[1].ToString();
} }
if (data[2] == 1) if (data[2] == 1)
{ {
...@@ -1756,7 +1756,7 @@ namespace GcDevicePc ...@@ -1756,7 +1756,7 @@ namespace GcDevicePc
_EPCTipsForm.MyProperty = tips; _EPCTipsForm.MyProperty = tips;
_EPCTipsForm.Show(); _EPCTipsForm.Show();
} }
} }
void Common_HeadInfo() void Common_HeadInfo()
...@@ -1772,7 +1772,7 @@ namespace GcDevicePc ...@@ -1772,7 +1772,7 @@ namespace GcDevicePc
string tmpFileName; string tmpFileName;
tmpFileName = globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName; tmpFileName = globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_MethodName;
SetMainFormMethodNameTH(tmpFileName.Substring(tmpFileName.LastIndexOf("\\") + 1) + " 单次运行"); SetMainFormMethodNameTH(tmpFileName.Substring(tmpFileName.LastIndexOf("\\") + 1) + " 单次运行");
} }
void QuickRun_HeadInfo() void QuickRun_HeadInfo()
...@@ -1810,23 +1810,23 @@ namespace GcDevicePc ...@@ -1810,23 +1810,23 @@ namespace GcDevicePc
globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_BATMethodName = System.IO.Path.Combine(globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.MethodFolder, runtable.INIGetStringValue("运行表", key[num], "无")); globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_BATMethodName = System.IO.Path.Combine(globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.MethodFolder, runtable.INIGetStringValue("运行表", key[num], "无"));
} }
} }
catch(Exception ex) catch (Exception ex)
{ {
Trace.Write(ex); Trace.Write(ex);
} }
} }
private void MDIBase_FormClosing(object sender, FormClosingEventArgs e) private void MDIBase_FormClosing(object sender, FormClosingEventArgs e)
{ {
DialogResult dr = new QuitForm().ShowDialog(); DialogResult dr = new QuitForm().ShowDialog();
uint ret = 0; uint ret = 0;
uint count = 0; uint count = 0;
if (dr == DialogResult.OK) //停止系统并退出 if (dr == DialogResult.OK) //停止系统并退出
{ {
...@@ -1879,8 +1879,8 @@ namespace GcDevicePc ...@@ -1879,8 +1879,8 @@ namespace GcDevicePc
// } // }
//} //}
} }
try try
...@@ -1964,10 +1964,10 @@ namespace GcDevicePc ...@@ -1964,10 +1964,10 @@ namespace GcDevicePc
try try
{ {
if(globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.system_Statue) if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.system_Statue)
{ {
MessageBox.Show("系统开启中......"); MessageBox.Show("系统开启中......");
return ; return;
} }
if (!String.IsNullOrEmpty(globaldata.connection_ip)) if (!String.IsNullOrEmpty(globaldata.connection_ip))
...@@ -2040,9 +2040,9 @@ namespace GcDevicePc ...@@ -2040,9 +2040,9 @@ namespace GcDevicePc
} }
} }
Console.WriteLine(""+ OSflag); Console.WriteLine("" + OSflag);
} }
catch(Exception ex) catch (Exception ex)
{ {
Trace.Write(ex); Trace.Write(ex);
} }
...@@ -2083,7 +2083,7 @@ namespace GcDevicePc ...@@ -2083,7 +2083,7 @@ namespace GcDevicePc
if (!String.IsNullOrEmpty(globaldata.connection_ip)) if (!String.IsNullOrEmpty(globaldata.connection_ip))
{ {
FileServerClient rtclient = new FileServerClient(); FileServerClient rtclient = new FileServerClient();
initret = rtclient.WtClientInit(globaldata.connection_ip, globaldata.fileserverport); initret = rtclient.WtClientInit(globaldata.connection_ip, globaldata.fileserverport);
if (initret == 1) if (initret == 1)
{ {
...@@ -2130,7 +2130,7 @@ namespace GcDevicePc ...@@ -2130,7 +2130,7 @@ namespace GcDevicePc
rtclient.WtClientClose(); rtclient.WtClientClose();
globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_RunTab = Path.Combine(folder, runtablename); globaldata.m_pcbuffer.gcpcinfo.pcfileinfo.cur_RunTab = Path.Combine(folder, runtablename);
} }
} }
return ret; return ret;
} }
...@@ -2144,7 +2144,7 @@ namespace GcDevicePc ...@@ -2144,7 +2144,7 @@ namespace GcDevicePc
if (!String.IsNullOrEmpty(globaldata.connection_ip)) if (!String.IsNullOrEmpty(globaldata.connection_ip))
{ {
hmiopt.SetBatCount(count); hmiopt.SetBatCount(count);
SendSTDCMD(); SendSTDCMD();
} }
} }
...@@ -2170,7 +2170,7 @@ namespace GcDevicePc ...@@ -2170,7 +2170,7 @@ namespace GcDevicePc
globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.system_Statue = false; globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.system_Statue = false;
globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.work_Statue = 0; globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.work_Statue = 0;
} }
Console.WriteLine(""+ OSflag); Console.WriteLine("" + OSflag);
} }
/// <summary> /// <summary>
...@@ -2184,7 +2184,7 @@ namespace GcDevicePc ...@@ -2184,7 +2184,7 @@ namespace GcDevicePc
{ {
hmiopt.HAirSwitch(val); hmiopt.HAirSwitch(val);
} }
private void UserLoginMenu_Click(object sender, EventArgs e) private void UserLoginMenu_Click(object sender, EventArgs e)
{ {
...@@ -2353,7 +2353,7 @@ namespace GcDevicePc ...@@ -2353,7 +2353,7 @@ namespace GcDevicePc
// f_auxtool.Show(); // f_auxtool.Show();
// } // }
//} //}
} }
UserConfig confu; UserConfig confu;
...@@ -2374,7 +2374,7 @@ namespace GcDevicePc ...@@ -2374,7 +2374,7 @@ namespace GcDevicePc
{ {
confu.Activate(); confu.Activate();
} }
} }
RunTables f_runtablef; RunTables f_runtablef;
private void MethodBatMenu_Click(object sender, EventArgs e) private void MethodBatMenu_Click(object sender, EventArgs e)
...@@ -2517,7 +2517,7 @@ namespace GcDevicePc ...@@ -2517,7 +2517,7 @@ namespace GcDevicePc
} }
} }
MethodMain myformbb; MethodMain myformbb;
private void MethodBrowseMenuItem_Click(object sender, EventArgs e) private void MethodBrowseMenuItem_Click(object sender, EventArgs e)
...@@ -2594,7 +2594,7 @@ namespace GcDevicePc ...@@ -2594,7 +2594,7 @@ namespace GcDevicePc
} }
} }
Console.WriteLine(" 后 "+ globaldata.m_hmibuffer.gcinfo.methodstatus); Console.WriteLine(" 后 " + globaldata.m_hmibuffer.gcinfo.methodstatus);
} }
WaveTotalForm total; WaveTotalForm total;
...@@ -2675,7 +2675,7 @@ namespace GcDevicePc ...@@ -2675,7 +2675,7 @@ namespace GcDevicePc
{ {
hist.Activate(); hist.Activate();
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -2761,7 +2761,7 @@ namespace GcDevicePc ...@@ -2761,7 +2761,7 @@ namespace GcDevicePc
{ {
showConfig.Activate(); showConfig.Activate();
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
...@@ -2942,7 +2942,7 @@ namespace GcDevicePc ...@@ -2942,7 +2942,7 @@ namespace GcDevicePc
if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.RunType == 0) if (globaldata.m_pcbuffer.gcpcinfo.pcworkinfo.RunType == 0)
{ {
hmiopt.WriteOpenVal(); hmiopt.WriteOpenVal();
//(this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 4; //(this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 4;
} }
cancelbtn(); cancelbtn();
...@@ -2986,11 +2986,12 @@ namespace GcDevicePc ...@@ -2986,11 +2986,12 @@ namespace GcDevicePc
/// <param name="boolrun"></param> /// <param name="boolrun"></param>
private void AutoAdjustRun(bool boolrun) private void AutoAdjustRun(bool boolrun)
{ {
if(boolrun) if (boolrun)
{ {
CurveDisPlay.curdisp.SetAutoAdjust(); CurveDisPlay.curdisp.SetAutoAdjust();
}else }
else
{ {
CurveDisPlay.curdisp.StopAutoAdjust(); CurveDisPlay.curdisp.StopAutoAdjust();
} }
...@@ -3011,12 +3012,12 @@ namespace GcDevicePc ...@@ -3011,12 +3012,12 @@ namespace GcDevicePc
{ {
SharedSpace.MControl.errstr = null; SharedSpace.MControl.errstr = null;
SharedSpace.MControl.zhouqi = globaldata.m_dpbuffer.ShowList.showtime.alltime; SharedSpace.MControl.zhouqi = globaldata.m_dpbuffer.ShowList.showtime.alltime;
if(SharedSpace.MControl.zhouqi*SharedSpace.MControl.runcount<=SharedSpace.MControl.dateend) if (SharedSpace.MControl.zhouqi * SharedSpace.MControl.runcount <= SharedSpace.MControl.dateend)
{ {
if (RunTableOpt(SharedSpace.MControl.path, SharedSpace.MControl.Name)==1&& SharedSpace.MControl.MethodType==1) if (RunTableOpt(SharedSpace.MControl.path, SharedSpace.MControl.Name) == 1 && SharedSpace.MControl.MethodType == 1)
{ {
Trace.WriteLine(string.Format("开始校准{0},{1}", SharedSpace.MControl.zhouqi, SharedSpace.MControl.runcount), "sys"); Trace.WriteLine(string.Format("开始校准{0},{1}", SharedSpace.MControl.zhouqi, SharedSpace.MControl.runcount), "sys");
SharedSpace.MControl.SetRun = true;//仪器进入校准环境 SharedSpace.MControl.SetRun = true;//仪器进入校准环境
...@@ -3030,9 +3031,10 @@ namespace GcDevicePc ...@@ -3030,9 +3031,10 @@ namespace GcDevicePc
CurveDisPlay.forcePurge = true; CurveDisPlay.forcePurge = true;
AutoAdjust = DateTime.Now.AddSeconds(SharedSpace.MControl.dateend); AutoAdjust = DateTime.Now.AddSeconds(SharedSpace.MControl.dateend);
} }
}else }
else
{ {
SharedSpace.MControl.errstr = "校准时间不够"; SharedSpace.MControl.errstr = "校准时间不够";
SharedSpace.MControl.SetOut = false; SharedSpace.MControl.SetOut = false;
...@@ -3056,11 +3058,11 @@ namespace GcDevicePc ...@@ -3056,11 +3058,11 @@ namespace GcDevicePc
SharedSpace.MControl.SetRun = false; SharedSpace.MControl.SetRun = false;
if (SharedSpace.Data.typesint == 2) if (SharedSpace.Data.typesint == 2)
{ {
CurveDisPlay.curdisp.ConfingAdjust(); CurveDisPlay.curdisp.ConfingAdjust();
} }
Trace.WriteLine("校准结束", "sys"); Trace.WriteLine("校准结束", "sys");
} }
if(SharedSpace.MControl.MethodType==2) if (SharedSpace.MControl.MethodType == 2)
{ {
SharedSpace.MControl.SetOut = false; SharedSpace.MControl.SetOut = false;
SharedSpace.MControl.SetRun = false; SharedSpace.MControl.SetRun = false;
...@@ -3076,8 +3078,8 @@ namespace GcDevicePc ...@@ -3076,8 +3078,8 @@ namespace GcDevicePc
if (SharedSpace.MControl.forceEnd && SharedSpace.MControl.SetOut && SharedSpace.MControl.SetRun) if (SharedSpace.MControl.forceEnd && SharedSpace.MControl.SetOut && SharedSpace.MControl.SetRun)
{ {
SharedSpace.MControl.IsEnd = false; SharedSpace.MControl.IsEnd = false;
if (RunTableOpt(SharedSpace.MControl.defaultPath, SharedSpace.MControl.defaultName) == 1&&SharedSpace.MControl.MethodType == 1) if (RunTableOpt(SharedSpace.MControl.defaultPath, SharedSpace.MControl.defaultName) == 1 && SharedSpace.MControl.MethodType == 1)
{ {
SharedSpace.MControl.SetOut = false; SharedSpace.MControl.SetOut = false;
SharedSpace.MControl.SetRun = false; SharedSpace.MControl.SetRun = false;
...@@ -3107,7 +3109,7 @@ namespace GcDevicePc ...@@ -3107,7 +3109,7 @@ namespace GcDevicePc
private void timer2_Tick(object sender, EventArgs e) private void timer2_Tick(object sender, EventArgs e)
{ {
epct++; epct++;
if (epct>20) if (epct > 20)
{ {
if (epcs == true) if (epcs == true)
{ {
...@@ -3123,7 +3125,7 @@ namespace GcDevicePc ...@@ -3123,7 +3125,7 @@ namespace GcDevicePc
tips_Show(globaldata.m_hmibuffer.gcinfo.EPCStatus); tips_Show(globaldata.m_hmibuffer.gcinfo.EPCStatus);
} }
} }
} }
private void changeVsi_Click(object sender, EventArgs e) private void changeVsi_Click(object sender, EventArgs e)
......
...@@ -199,7 +199,22 @@ namespace GcDevicePc.ProThread ...@@ -199,7 +199,22 @@ namespace GcDevicePc.ProThread
} }
} }
public void testr12(ushort addr, ushort statue)
{
int ret;
int count = 0;
ret = m_modbus.WriteSingleCoil(addr, statue, this.strIP, this.netPost);
while (ret != 0)
{
count++;
ret = m_modbus.WriteSingleCoil(addr, statue, this.strIP, this.netPost);
Thread.Sleep(100);
if (count == 3)
break;
}
}
/// <summary> /// <summary>
/// 点火 /// 点火
/// </summary> /// </summary>
......
...@@ -12,24 +12,24 @@ namespace GcDevicePc ...@@ -12,24 +12,24 @@ namespace GcDevicePc
Application.EnableVisualStyles(); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
bool createNew; bool createNew;
Application.Run(new TestForm()); //Application.Run(new TestForm());
{ {
//using (System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.ProductName, out createNew)) using (System.Threading.Mutex mutex = new System.Threading.Mutex(true, Application.ProductName, out createNew))
//{ {
// if (createNew) if (createNew)
// { {
// Application.Run(new StartForm()); Application.Run(new StartForm());
// mutex.ReleaseMutex(); mutex.ReleaseMutex();
// } }
// else else
// { {
// MessageBox.Show("应用程序已经在运行中..."); MessageBox.Show("应用程序已经在运行中...");
// System.Threading.Thread.Sleep(1000); System.Threading.Thread.Sleep(1000);
// Application.Exit(); Application.Exit();
// System.Diagnostics.Process.GetCurrentProcess().Kill(); System.Diagnostics.Process.GetCurrentProcess().Kill();
// // System.Environment.Exit(1); // System.Environment.Exit(1);
// } }
//} }
} }
} }
} }
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
this.gcTitle1 = new GcDevicePc.Controls.GCTitle(); this.gcTitle1 = new GcDevicePc.Controls.GCTitle();
this.button3 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button(); this.button4 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.SuspendLayout(); this.SuspendLayout();
// //
// button1 // button1
...@@ -47,7 +49,7 @@ ...@@ -47,7 +49,7 @@
// //
// button2 // button2
// //
this.button2.Location = new System.Drawing.Point(250, 364); this.button2.Location = new System.Drawing.Point(241, 318);
this.button2.Name = "button2"; this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(75, 23); this.button2.Size = new System.Drawing.Size(75, 23);
this.button2.TabIndex = 1; this.button2.TabIndex = 1;
...@@ -83,11 +85,27 @@ ...@@ -83,11 +85,27 @@
this.button4.UseVisualStyleBackColor = true; this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.Button4_Click); this.button4.Click += new System.EventHandler(this.Button4_Click);
// //
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(241, 274);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(100, 21);
this.textBox1.TabIndex = 5;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(357, 274);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(100, 21);
this.textBox2.TabIndex = 5;
//
// TestForm // TestForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 583); this.ClientSize = new System.Drawing.Size(800, 583);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button4); this.Controls.Add(this.button4);
this.Controls.Add(this.button3); this.Controls.Add(this.button3);
this.Controls.Add(this.gcTitle1); this.Controls.Add(this.gcTitle1);
...@@ -96,6 +114,7 @@ ...@@ -96,6 +114,7 @@
this.Name = "TestForm"; this.Name = "TestForm";
this.Text = "TestForm"; this.Text = "TestForm";
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout();
} }
...@@ -106,5 +125,7 @@ ...@@ -106,5 +125,7 @@
private Controls.GCTitle gcTitle1; private Controls.GCTitle gcTitle1;
private System.Windows.Forms.Button button3; private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4; private System.Windows.Forms.Button button4;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
} }
} }
\ No newline at end of file
using GcDevicePc.Common; using GcDevicePc.Common;
using GcDevicePc.ConfigMethod; using GcDevicePc.ConfigMethod;
using GcDevicePc.Controls; using GcDevicePc.Controls;
using GcDevicePc.ProThread;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
...@@ -115,16 +116,20 @@ namespace GcDevicePc ...@@ -115,16 +116,20 @@ namespace GcDevicePc
} }
HMIControl hMI = new HMIControl("172.16.1.58", 502);
private void button2_Click(object sender, EventArgs e) private void button2_Click(object sender, EventArgs e)
{ {
//MessageBox.Show("asd"); //MessageBox.Show("asd");
//this.pictureMenu1.PMOptbtnstatus = 4; //this.pictureMenu1.PMOptbtnstatus = 4;
//(this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 3; //(this.title.Controls.Find("pictureMenu1", true)[0] as PictureMenu).PMOptbtnstatus = 3;
//tinfliang //tinfliang
//LMessageBox box = new LMessageBox(); //LMessageBox box = new LMessageBox();
//box.Show(100, 100, this.Location, true, "1230", "3214", LMessageBox.MessageBoxType.MBT_ButtonOK); //box.Show(100, 100, this.Location, true, "1230", "3214", LMessageBox.MessageBoxType.MBT_ButtonOK);
hMI.testr12(Convert.ToUInt16(textBox1.Text), Convert.ToUInt16(textBox2.Text));
} }
private void Button3_Click(object sender, EventArgs e) private void Button3_Click(object sender, EventArgs 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