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

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

parents 75111627 5a2fce42
...@@ -123,13 +123,6 @@ namespace GcDevicePc ...@@ -123,13 +123,6 @@ namespace GcDevicePc
{ {
ret = mainclient.WtClientCopyfromServer(filename[i], getfile, foldername[i]); ret = mainclient.WtClientCopyfromServer(filename[i], getfile, foldername[i]);
Thread.Sleep(500);
//checkflag = filecheck.IsUse(getfile);
//while (checkflag != 0)
//{
// Thread.Sleep(200);
// checkflag = filecheck.IsUse(getfile);
//}
if (ret == 0) if (ret == 0)
{ {
Log.Info(filename[i].ToString() + " 同步成功"); Log.Info(filename[i].ToString() + " 同步成功");
...@@ -195,7 +188,7 @@ namespace GcDevicePc ...@@ -195,7 +188,7 @@ namespace GcDevicePc
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces(); NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in nics) foreach (NetworkInterface adapter in nics)
{ {
// if (adapter.Name == "本地连接") if (adapter.Name == "本地连接")
{ {
bool pd1 = (adapter.NetworkInterfaceType == NetworkInterfaceType.Ethernet || bool pd1 = (adapter.NetworkInterfaceType == NetworkInterfaceType.Ethernet ||
adapter.NetworkInterfaceType == NetworkInterfaceType.Wireless80211); adapter.NetworkInterfaceType == NetworkInterfaceType.Wireless80211);
...@@ -271,10 +264,5 @@ namespace GcDevicePc ...@@ -271,10 +264,5 @@ namespace GcDevicePc
} }
} }
public void InitDB()
{
}
} }
} }
...@@ -27,6 +27,7 @@ namespace GcDevicePc ...@@ -27,6 +27,7 @@ namespace GcDevicePc
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.Controls.Add(curdisp); this.Controls.Add(curdisp);
CheckForIllegalCrossThreadCalls = false;
} }
} }
} }
...@@ -31,15 +31,28 @@ namespace GcDevicePc.CK_UI ...@@ -31,15 +31,28 @@ namespace GcDevicePc.CK_UI
{ {
Island = false; Island = false;
} }
if(form!=null)
if (form != null)
{ {
form.Dispose(); form.Close();
if (!form.IsDisposed)
{
form.Dispose();
}
} }
} }
private void button2_Click(object sender, EventArgs e) //放弃 private void button2_Click(object sender, EventArgs e) //放弃
{ {
Island = false; Island = false;
if (form != null)
{
form.Close();
if (!form.IsDisposed)
{
form.Dispose();
}
}
} }
private void LandIn_Load(object sender, EventArgs e) private void LandIn_Load(object sender, EventArgs e)
...@@ -50,7 +63,7 @@ namespace GcDevicePc.CK_UI ...@@ -50,7 +63,7 @@ namespace GcDevicePc.CK_UI
private void textBox2_Click(object sender, EventArgs e) private void textBox2_Click(object sender, EventArgs e)
{ {
form = CKVocAnalyzer.NumForm.GetInstance((TextBox)sender);// new CKVocAnalyzer.NumForm((TextBox)sender); form = CKVocAnalyzer.NumForm.GetInstance((TextBox)sender);// new CKVocAnalyzer.NumForm((TextBox)sender);
form.Icon = this.Icon;
form.Show(); form.Show();
} }
} }
......
...@@ -31,7 +31,7 @@ namespace GcDevicePc.ConfigDlg ...@@ -31,7 +31,7 @@ namespace GcDevicePc.ConfigDlg
{ {
this.components = new System.ComponentModel.Container(); this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MethodBase)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MethodBase));
this.methodimgList = new System.Windows.Forms.ImageList(this.components); this.methodimgList = new System.Windows.Forms.ImageList();
this.Methodtitle = new System.Windows.Forms.Panel(); this.Methodtitle = new System.Windows.Forms.Panel();
this.mmixbtn = new System.Windows.Forms.Button(); this.mmixbtn = new System.Windows.Forms.Button();
this.mclose = new System.Windows.Forms.Button(); this.mclose = new System.Windows.Forms.Button();
......
...@@ -47,7 +47,12 @@ namespace GcDevicePc.GCBuffer ...@@ -47,7 +47,12 @@ namespace GcDevicePc.GCBuffer
public string ip; public string ip;
public string mask; public string mask;
public string gw; public string gw;
}
public struct OutPutInfo
{
public byte port;
} }
public struct ThreadInfo public struct ThreadInfo
...@@ -62,6 +67,8 @@ namespace GcDevicePc.GCBuffer ...@@ -62,6 +67,8 @@ namespace GcDevicePc.GCBuffer
public WorkInfo pcworkinfo; public WorkInfo pcworkinfo;
public ModuleInfo moduleinfo; public ModuleInfo moduleinfo;
public ThreadInfo pcthreadinfo; public ThreadInfo pcthreadinfo;
public OutPutInfo outputinfo;
} }
public PCInfo gcpcinfo = new PCInfo(); public PCInfo gcpcinfo = new PCInfo();
...@@ -91,7 +98,9 @@ namespace GcDevicePc.GCBuffer ...@@ -91,7 +98,9 @@ namespace GcDevicePc.GCBuffer
gcpcinfo.pcworkinfo.system_Statue = false; gcpcinfo.pcworkinfo.system_Statue = false;
gcpcinfo.pcworkinfo.work_Statue = 0; gcpcinfo.pcworkinfo.work_Statue = 0;
gcpcinfo.moduleinfo.ip = "192.168.1.54"; gcpcinfo.moduleinfo.ip = "";
gcpcinfo.outputinfo.port = 0;
string file = System.Windows.Forms.Application.StartupPath + "\\startup.ini"; string file = System.Windows.Forms.Application.StartupPath + "\\startup.ini";
...@@ -106,6 +115,9 @@ namespace GcDevicePc.GCBuffer ...@@ -106,6 +115,9 @@ namespace GcDevicePc.GCBuffer
string wtd624x_mask = test.INIGetStringValue("WTD624X", "MASK", null); string wtd624x_mask = test.INIGetStringValue("WTD624X", "MASK", null);
string wtd624x_gw = test.INIGetStringValue("WTD624X", "GW", null); string wtd624x_gw = test.INIGetStringValue("WTD624X", "GW", null);
string gc485 = test.INIGetStringValue("GC485", "COM", null);
//string senddata = test.INIGetStringValue("StartUp", "SendData", null); //string senddata = test.INIGetStringValue("StartUp", "SendData", null);
if (Convert.ToInt32(opensys) == 1) if (Convert.ToInt32(opensys) == 1)
...@@ -127,6 +139,11 @@ namespace GcDevicePc.GCBuffer ...@@ -127,6 +139,11 @@ namespace GcDevicePc.GCBuffer
{ {
gcpcinfo.moduleinfo.gw = wtd624x_gw; gcpcinfo.moduleinfo.gw = wtd624x_gw;
} }
if (!String.IsNullOrEmpty(gc485))
{
gcpcinfo.outputinfo.port = Convert.ToByte(gc485);
}
} }
// gcpcinfo.pcworkinfo.RunType = 0; //运行类型 0 打开运行 1 智能运行 2 批处理 // gcpcinfo.pcworkinfo.RunType = 0; //运行类型 0 打开运行 1 智能运行 2 批处理
......
...@@ -58,6 +58,8 @@ namespace GcDevicePc ...@@ -58,6 +58,8 @@ namespace GcDevicePc
/// </summary> /// </summary>
CKvocUpdata dataVOC = new CKvocUpdata(); CKvocUpdata dataVOC = new CKvocUpdata();
private DataOutput wtd624xOutput = new DataOutput();
#region Author by zjx #region Author by zjx
/// <summary> /// <summary>
/// 组件初始化 /// 组件初始化
...@@ -367,7 +369,7 @@ namespace GcDevicePc ...@@ -367,7 +369,7 @@ namespace GcDevicePc
if (i != 99) if (i != 99)
{ {
worker.ReportProgress(i); worker.ReportProgress(i);
break; //break;
} }
} }
...@@ -398,7 +400,7 @@ namespace GcDevicePc ...@@ -398,7 +400,7 @@ namespace GcDevicePc
public void WaitHMIFree() public void WaitHMIFree()
{ {
if (globaldata.m_hmibuffer.gcinfo.hmistatus != 0) // if (globaldata.m_hmibuffer.gcinfo.hmistatus != 0)
{ {
this.backgroundWorker1.RunWorkerAsync(); this.backgroundWorker1.RunWorkerAsync();
WaitForm form = new WaitForm(this.backgroundWorker1, "Free"); WaitForm form = new WaitForm(this.backgroundWorker1, "Free");
...@@ -463,7 +465,7 @@ namespace GcDevicePc ...@@ -463,7 +465,7 @@ namespace GcDevicePc
} }
public void WaitHMIWork() public void WaitHMIWork()
{ {
if (globaldata.m_hmibuffer.gcinfo.methodstatus < 0 || globaldata.m_hmibuffer.gcinfo.methodstatus > 5) // if (globaldata.m_hmibuffer.gcinfo.methodstatus < 0 || globaldata.m_hmibuffer.gcinfo.methodstatus > 5)
{ {
this.backgroundWorker2.RunWorkerAsync(); this.backgroundWorker2.RunWorkerAsync();
WaitForm form = new WaitForm(this.backgroundWorker2, "Work"); WaitForm form = new WaitForm(this.backgroundWorker2, "Work");
...@@ -548,8 +550,12 @@ namespace GcDevicePc ...@@ -548,8 +550,12 @@ namespace GcDevicePc
Slavetest = new GCModbusSlave(); Slavetest = new GCModbusSlave();
Slavetest.CModbusSlaveInit(1, 2, 3, 5); Slavetest.CModbusSlaveInit(1, 2, 3, 5);
Slave485test = new GCModbusSlave485(1, 9600); if (globaldata.m_pcbuffer.gcpcinfo.outputinfo.port != 0)
Slave485test.CModbusSlave485Init(1, 2, 3, 5); {
Slave485test = new GCModbusSlave485(globaldata.m_pcbuffer.gcpcinfo.outputinfo.port, 9600);
Slave485test.CModbusSlave485Init(1, 2, 3, 5);
}
} }
catch (Exception e) catch (Exception e)
...@@ -582,6 +588,9 @@ namespace GcDevicePc ...@@ -582,6 +588,9 @@ namespace GcDevicePc
dataVOC.CKvocUpdataStart(); dataVOC.CKvocUpdataStart();
mytcptest.DataRcvStart(); mytcptest.DataRcvStart();
if (!String.IsNullOrEmpty(globaldata.m_pcbuffer.gcpcinfo.moduleinfo.ip))
wtd624xOutput.DataOutStart();
} }
private void Stop_Thread() private void Stop_Thread()
...@@ -596,6 +605,9 @@ namespace GcDevicePc ...@@ -596,6 +605,9 @@ namespace GcDevicePc
mymodbus.HmiStatueStop(); mymodbus.HmiStatueStop();
mymodbus.ChannelDataStop(); mymodbus.ChannelDataStop();
} }
if (!String.IsNullOrEmpty(globaldata.m_pcbuffer.gcpcinfo.moduleinfo.ip))
wtd624xOutput.DataOutStop();
} }
/// <summary> /// <summary>
...@@ -992,7 +1004,7 @@ namespace GcDevicePc ...@@ -992,7 +1004,7 @@ namespace GcDevicePc
conmre.Set(); conmre.Set();
globaldata.m_pcbuffer.gcpcinfo.pcthreadinfo.HMI_Monitor_TH = 1; globaldata.m_pcbuffer.gcpcinfo.pcthreadinfo.HMI_Monitor_TH = 1;
Thread.Sleep(1500); Thread.Sleep(1000);
count = 0; count = 0;
...@@ -1008,18 +1020,22 @@ namespace GcDevicePc ...@@ -1008,18 +1020,22 @@ namespace GcDevicePc
} }
} }
count = 0; if (globaldata.m_pcbuffer.gcpcinfo.outputinfo.port != 0)
ret = Slave485test.CModbusSlave485Close();
while (ret != 0)
{ {
count++; count = 0;
ret = Slave485test.CModbusSlave485Close(); ret = Slave485test.CModbusSlave485Close();
Thread.Sleep(100); while (ret != 0)
if (count > 3)
{ {
break; count++;
ret = Slave485test.CModbusSlave485Close();
Thread.Sleep(100);
if (count > 3)
{
break;
}
} }
} }
} }
...@@ -1076,18 +1092,22 @@ namespace GcDevicePc ...@@ -1076,18 +1092,22 @@ namespace GcDevicePc
} }
} }
count = 0; if (globaldata.m_pcbuffer.gcpcinfo.outputinfo.port != 0)
ret = Slave485test.CModbusSlave485Close();
while (ret != 0)
{ {
count++; count = 0;
ret = Slave485test.CModbusSlave485Close(); ret = Slave485test.CModbusSlave485Close();
Thread.Sleep(100); while (ret != 0)
if (count > 3)
{ {
break; count++;
ret = Slave485test.CModbusSlave485Close();
Thread.Sleep(100);
if (count > 3)
{
break;
}
} }
} }
} }
......
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;
using System.Drawing; using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading; using System.Threading;
using System.Windows.Forms; using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using GcDevicePc.IniParam;
using System.IO; using System.IO;
using System.Runtime.InteropServices;
using GcDevicePc.ProThread; using GcDevicePc.ProThread;
using System.Security.Cryptography;
using System.Diagnostics; using System.Diagnostics;
using GcDevicePc.Common; using GcDevicePc.Common;
......
...@@ -100,7 +100,6 @@ namespace GcDevicePc.ProThread ...@@ -100,7 +100,6 @@ namespace GcDevicePc.ProThread
globaldata.starttimer = globaldata.m_hmibuffer.gcinfo.NowStartTime; globaldata.starttimer = globaldata.m_hmibuffer.gcinfo.NowStartTime;
NowTimeOld = globaldata.m_hmibuffer.gcinfo.NowStartTime; NowTimeOld = globaldata.m_hmibuffer.gcinfo.NowStartTime;
CurveDisPlay.curdisp.cleardata(); CurveDisPlay.curdisp.cleardata();
} }
else else
...@@ -191,9 +190,6 @@ namespace GcDevicePc.ProThread ...@@ -191,9 +190,6 @@ namespace GcDevicePc.ProThread
{ {
listPoint.Add(new double[] { Math.Round(time, 4), Math.Round(value, 6) }); listPoint.Add(new double[] { Math.Round(time, 4), Math.Round(value, 6) });
listRaw.Add(new double[] {((SignalBuffer.Channel_XY)globaldata.m_signalbuffer.Draw_Port[i]).ctimer, Math.Round(value, 6) }); listRaw.Add(new double[] {((SignalBuffer.Channel_XY)globaldata.m_signalbuffer.Draw_Port[i]).ctimer, Math.Round(value, 6) });
} }
......
...@@ -15,7 +15,7 @@ namespace GcDevicePc.ProThread ...@@ -15,7 +15,7 @@ namespace GcDevicePc.ProThread
ManualResetEvent outputmre = new ManualResetEvent(false); ManualResetEvent outputmre = new ManualResetEvent(false);
Thread t_DataOut; Thread t_DataOut;
private WTD624X wtd624x = new WTD624X(globaldata.m_pcbuffer.gcpcinfo.moduleinfo.ip, 502); private WTD624X wtd624x;
private bool c6h6 = false; private bool c6h6 = false;
private bool c7h8 = false; private bool c7h8 = false;
...@@ -157,28 +157,41 @@ namespace GcDevicePc.ProThread ...@@ -157,28 +157,41 @@ namespace GcDevicePc.ProThread
public void DataOutStart() public void DataOutStart()
{ {
if (outputmre != null) if (!String.IsNullOrEmpty(globaldata.m_pcbuffer.gcpcinfo.moduleinfo.ip))
{ {
outputmre.Reset(); wtd624x = new WTD624X(globaldata.m_pcbuffer.gcpcinfo.moduleinfo.ip, 502);
} }
t_DataOut = new Thread(OutPut_DataList); if (wtd624x!= null)
t_DataOut.IsBackground = true;
t_DataOut.Start();
if (!wtd624x.GetWorkFlag())
{ {
wtd624x.WTD624X_Open(); if (outputmre != null)
{
outputmre.Reset();
}
t_DataOut = new Thread(OutPut_DataList);
t_DataOut.IsBackground = true;
t_DataOut.Start();
if (!wtd624x.GetWorkFlag())
{
wtd624x.WTD624X_Open();
}
} }
} }
public void DataOutStop() public void DataOutStop()
{ {
outputmre.Set(); if (wtd624x != null)
if (wtd624x.GetWorkFlag())
{ {
wtd624x.WTD624X_Open(); outputmre.Set();
if (wtd624x.GetWorkFlag())
{
wtd624x.WTD624X_Open();
}
} }
} }
} }
......
...@@ -46,7 +46,7 @@ namespace GcDevicePc.ProThread ...@@ -46,7 +46,7 @@ namespace GcDevicePc.ProThread
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces(); NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
foreach (NetworkInterface adapter in nics) foreach (NetworkInterface adapter in nics)
{ {
// if (adapter.Name == "本地连接") if (adapter.Name == "本地连接")
{ {
bool pd1 = (adapter.NetworkInterfaceType == NetworkInterfaceType.Ethernet || adapter.NetworkInterfaceType == NetworkInterfaceType.Wireless80211); //判断是否是以太网连接 bool pd1 = (adapter.NetworkInterfaceType == NetworkInterfaceType.Ethernet || adapter.NetworkInterfaceType == NetworkInterfaceType.Wireless80211); //判断是否是以太网连接
if (pd1) if (pd1)
......
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