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
{ {
...@@ -108,7 +108,7 @@ namespace GcDevicePc ...@@ -108,7 +108,7 @@ namespace GcDevicePc
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,7 +330,7 @@ namespace GcDevicePc ...@@ -330,7 +330,7 @@ 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();
...@@ -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,7 +759,7 @@ namespace GcDevicePc ...@@ -759,7 +759,7 @@ namespace GcDevicePc
} }
} }
catch(Exception ex) catch (Exception ex)
{ {
Log.Error(ex.Message); Log.Error(ex.Message);
} }
...@@ -802,7 +802,7 @@ namespace GcDevicePc ...@@ -802,7 +802,7 @@ namespace GcDevicePc
//监视界面活动 //监视界面活动
if (getIdleTick()>60*30 && LandIn.Island) if (getIdleTick() > 60 * 30 && LandIn.Island)
{ {
if (_userForm != null) if (_userForm != null)
...@@ -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)
...@@ -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);
...@@ -1221,7 +1221,7 @@ namespace GcDevicePc ...@@ -1221,7 +1221,7 @@ namespace GcDevicePc
} }
statestr = "设备联机"; statestr = "设备联机";
IsStateColor=true; IsStateColor = true;
hmiopt = new HMIControl(globaldata.connection_ip, globaldata.datamodbusport); hmiopt = new HMIControl(globaldata.connection_ip, globaldata.datamodbusport);
...@@ -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);
} }
...@@ -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)
{ {
...@@ -1810,7 +1810,7 @@ namespace GcDevicePc ...@@ -1810,7 +1810,7 @@ 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);
} }
...@@ -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);
} }
...@@ -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>
...@@ -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;
...@@ -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();
} }
...@@ -3012,11 +3013,11 @@ namespace GcDevicePc ...@@ -3012,11 +3013,11 @@ 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;//仪器进入校准环境
...@@ -3032,7 +3033,8 @@ namespace GcDevicePc ...@@ -3032,7 +3033,8 @@ namespace GcDevicePc
} }
}else }
else
{ {
SharedSpace.MControl.errstr = "校准时间不够"; SharedSpace.MControl.errstr = "校准时间不够";
SharedSpace.MControl.SetOut = false; SharedSpace.MControl.SetOut = false;
...@@ -3060,7 +3062,7 @@ namespace GcDevicePc ...@@ -3060,7 +3062,7 @@ namespace GcDevicePc
} }
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;
...@@ -3077,7 +3079,7 @@ namespace GcDevicePc ...@@ -3077,7 +3079,7 @@ namespace GcDevicePc
{ {
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)
{ {
......
...@@ -200,6 +200,21 @@ namespace GcDevicePc.ProThread ...@@ -200,6 +200,21 @@ 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,7 +116,7 @@ namespace GcDevicePc ...@@ -115,7 +116,7 @@ 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");
...@@ -125,6 +126,10 @@ namespace GcDevicePc ...@@ -125,6 +126,10 @@ namespace GcDevicePc
//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