Commit fdd772d1 authored by wangjunqiang's avatar wangjunqiang

add hmilog and change folder

parent fb48713f
...@@ -13,39 +13,60 @@ ...@@ -13,39 +13,60 @@
<log4net> <log4net>
<logger name="Log"> <logger name="Log">
<level value="INFO"/> <level value="INFO" />
<appender-ref ref="RollingLog"/> <appender-ref ref="RollingLog" />
</logger> </logger>
<logger name="Err"> <logger name="Err">
<level value="ERROR"/> <level value="ERROR" />
<appender-ref ref="RollingErr"/> <appender-ref ref="RollingErr" />
</logger> </logger>
<logger name="HmiInfo">
<level value="INFO" />
<appender-ref ref="HmiRollingLog" />
</logger>
<appender name="RollingLog" type="log4net.Appender.RollingFileAppender"> <appender name="RollingLog" type="log4net.Appender.RollingFileAppender">
<file value="Logs\InfoLog_"/> <file value="..\GC_Config\GC_Set\Logs\InfoLog_" />
<appendToFile value="true"/> <appendToFile value="true" />
<rollingStyle value="Date"/> <rollingStyle value="Date" />
<datePattern value="yyyyMMdd'.txt'"/> <datePattern value="yyyyMMdd'.txt'" />
<staticLogFileName value="false"/> <staticLogFileName value="false" />
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="Record Time:%d Thread ID:[%thread]- Info:%m%n"/> <conversionPattern value="Record Time:%d Thread ID:[%thread]- Info:%m%n" />
</layout> </layout>
<filter type="log4net.Filter.LevelRangeFilter"> <filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="INFO"/> <param name="LevelMin" value="INFO" />
<param name="LevelMax" value="INFO"/> <param name="LevelMax" value="INFO" />
</filter> </filter>
</appender> </appender>
<appender name="HmiRollingLog" type="log4net.Appender.RollingFileAppender">
<file value="..\GC_Config\GC_Set\Logs\HmiLog_" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<datePattern value="yyyyMMdd'.txt'" />
<staticLogFileName value="false" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="Record Time:%d Info:%m%n" />
</layout>
<filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="INFO" />
<param name="LevelMax" value="INFO" />
</filter>
</appender>
<appender name="RollingErr" type="log4net.Appender.RollingFileAppender"> <appender name="RollingErr" type="log4net.Appender.RollingFileAppender">
<file value="Logs\ErrLog_"/> <file value="..\GC_Config\GC_Set\Logs\ErrLog_" />
<appendToFile value="true"/> <appendToFile value="true" />
<rollingStyle value="Date"/> <rollingStyle value="Date" />
<datePattern value="yyyyMMdd'.txt'"/> <datePattern value="yyyyMMdd'.txt'" />
<staticLogFileName value="false"/> <staticLogFileName value="false" />
<layout type="log4net.Layout.PatternLayout"> <layout type="log4net.Layout.PatternLayout">
<conversionPattern value="Record Time:%d Thread ID:[%thread]- Error:%m%n"/> <conversionPattern value="Record Time:%d Thread ID:[%thread]- Error:%m%n" />
</layout> </layout>
<filter type="log4net.Filter.LevelRangeFilter"> <filter type="log4net.Filter.LevelRangeFilter">
<param name="LevelMin" value="ERROR"/> <param name="LevelMin" value="ERROR" />
<param name="LevelMax" value="ERROR"/> <param name="LevelMax" value="ERROR" />
</filter> </filter>
</appender> </appender>
</log4net> </log4net>
......
...@@ -44,13 +44,12 @@ namespace GcDevicePc ...@@ -44,13 +44,12 @@ namespace GcDevicePc
} }
public void InitAppFolder() public void InitAppFolder()
{ {
string tmpFolder; string tmpFolder;
globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.RunFolder = System.Windows.Forms.Application.StartupPath; globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.ConfigFolder = System.Windows.Forms.Application.StartupPath;
tmpFolder = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.RunFolder; tmpFolder = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.ConfigFolder;
globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.MethodFolder = Path.Combine(tmpFolder, "仪器方法"); globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.MethodFolder = Path.Combine(tmpFolder, "仪器方法");
CheckFolderandFile(0, globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.MethodFolder); CheckFolderandFile(0, globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.MethodFolder);
...@@ -78,8 +77,49 @@ namespace GcDevicePc ...@@ -78,8 +77,49 @@ namespace GcDevicePc
} }
public void InitAppFolderGC()
{
string tmpFolder;
globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.ConfigFolder = System.Windows.Forms.Application.StartupPath+"\\..\\GC_Config\\GC_Set";
CheckFolderandFile(0, globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.ConfigFolder);
tmpFolder = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.ConfigFolder;
globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.MethodFolder = Path.Combine(tmpFolder, "仪器方法");
CheckFolderandFile(0, globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.MethodFolder);
globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.StatusFolder = Path.Combine(tmpFolder, "仪器状态");
CheckFolderandFile(0, globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.StatusFolder);
globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.RunTabFolder = Path.Combine(tmpFolder, "运行表");
CheckFolderandFile(0, globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.RunTabFolder);
globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.DataFolder = Path.Combine(tmpFolder, "历史数据");
CheckFolderandFile(0, globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.DataFolder);
globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.FwFolder = Path.Combine(tmpFolder, "固件更新");
CheckFolderandFile(0, globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.FwFolder);
globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.StartUpFolder = Path.Combine(tmpFolder, "启动参数");
CheckFolderandFile(0, globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.StartUpFolder);
globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.TmpFolder = Path.Combine(tmpFolder, "tmpfile");
CheckFolderandFile(0, globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.TmpFolder);
globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.LogFolder = Path.Combine(tmpFolder, "Logs");
CheckFolderandFile(0, globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.LogFolder);
tmpFolder = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.StatusFolder;
globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.SubStatusFolder = Path.Combine(tmpFolder, "子状态");
CheckFolderandFile(0, globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.SubStatusFolder);
}
public void InitAppDefaultConfig() public void InitAppDefaultConfig()
{ {
String filefolder = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.ConfigFolder;
List<String> foldername = new List<string> List<String> foldername = new List<string>
{ {
globaldata.remoteFolder + "仪器方法\\", globaldata.remoteFolder + "仪器方法\\",
...@@ -89,9 +129,9 @@ namespace GcDevicePc ...@@ -89,9 +129,9 @@ namespace GcDevicePc
List<String> localfoldername = new List<string> List<String> localfoldername = new List<string>
{ {
System.Windows.Forms.Application.StartupPath + "\\仪器方法\\", filefolder + "\\仪器方法\\",
System.Windows.Forms.Application.StartupPath + "\\仪器状态\\", filefolder + "\\仪器状态\\",
System.Windows.Forms.Application.StartupPath + "\\运行表\\" filefolder+ "\\运行表\\"
}; };
List<String> filename = new List<string> List<String> filename = new List<string>
......
...@@ -7,6 +7,7 @@ namespace GcDevicePc.Common ...@@ -7,6 +7,7 @@ namespace GcDevicePc.Common
public static class Log public static class Log
{ {
private static readonly ILog logInfo = LogManager.GetLogger("Log"); private static readonly ILog logInfo = LogManager.GetLogger("Log");
private static readonly ILog hmiInfo = LogManager.GetLogger("HmiInfo");
private static readonly ILog logErr = LogManager.GetLogger("Err"); private static readonly ILog logErr = LogManager.GetLogger("Err");
/// <summary> /// <summary>
...@@ -17,6 +18,16 @@ namespace GcDevicePc.Common ...@@ -17,6 +18,16 @@ namespace GcDevicePc.Common
{ {
logInfo.Info(msg); logInfo.Info(msg);
} }
/// <summary>
/// 记录HMI的消息
/// </summary>
/// <param name="msg">消息内容</param>
public static void HmiInfo(string msg)
{
hmiInfo.Info(msg);
}
/// <summary> /// <summary>
/// 记录异常信息 /// 记录异常信息
/// </summary> /// </summary>
......
...@@ -34,8 +34,7 @@ namespace GcDevicePc.ConfigDlg ...@@ -34,8 +34,7 @@ namespace GcDevicePc.ConfigDlg
tb循环次数.Text = CProfileDevice.m_DevParam.runtable.u16CycleTimes.ToString(); tb循环次数.Text = CProfileDevice.m_DevParam.runtable.u16CycleTimes.ToString();
tb等待时间.Text = CProfileDevice.m_DevParam.runtable.u16WaitTime.ToString(); tb等待时间.Text = CProfileDevice.m_DevParam.runtable.u16WaitTime.ToString();
string folderName = System.Windows.Forms.Application.StartupPath; string pathString = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.RunTabFolder;
string pathString = System.IO.Path.Combine(folderName, "运行表");
if (System.IO.Directory.Exists(pathString) == false) if (System.IO.Directory.Exists(pathString) == false)
{ {
System.IO.Directory.CreateDirectory(pathString); System.IO.Directory.CreateDirectory(pathString);
...@@ -98,8 +97,7 @@ namespace GcDevicePc.ConfigDlg ...@@ -98,8 +97,7 @@ namespace GcDevicePc.ConfigDlg
private void btn保存_Click(object sender, EventArgs e) private void btn保存_Click(object sender, EventArgs e)
{ {
string folderName = System.Windows.Forms.Application.StartupPath; string pathString = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.RunTabFolder;
string pathString = System.IO.Path.Combine(folderName, "运行表");
if (System.IO.Directory.Exists(pathString) == false) if (System.IO.Directory.Exists(pathString) == false)
{ {
System.IO.Directory.CreateDirectory(pathString); System.IO.Directory.CreateDirectory(pathString);
......
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace GcDevicePc.Controls
{
class MillisecondTimer : IComponent, IDisposable
{
private static TimerCaps caps;
private int interval;
private bool isRunning;
private int resolution;
private TimerCallback timerCallback;
private int timerID;
public int Interval
{
get
{
return this.interval;
}
set
{
if ((value < caps.periodMin) || (value > caps.periodMax))
{
throw new Exception("超出计时范围!");
}
this.interval = value;
}
}
/// <summary>
///
/// </summary>
public bool IsRunning
{
get
{
return this.isRunning;
}
}
/// <summary>
///
/// </summary>
public ISite Site
{
set;
get;
}
public event EventHandler Disposed; // 这个事件实现了IComponet接口
public event EventHandler Tick;
static MillisecondTimer()
{
timeGetDevCaps(ref caps, Marshal.SizeOf(caps));
}
public MillisecondTimer()
{
this.interval = caps.periodMin; //
this.resolution = caps.periodMin; //
this.isRunning = false;
this.timerCallback = new TimerCallback(this.TimerEventCallback);
}
public MillisecondTimer(IContainer container)
: this()
{
container.Add(this);
}
~MillisecondTimer()
{
timeKillEvent(this.timerID);
}
public void Start()
{
if (!this.isRunning)
{
this.timerID = timeSetEvent(this.interval, this.resolution, this.timerCallback, 0, 1); // 间隔性地运行
if (this.timerID == 0)
{
throw new Exception("无法启动计时器");
}
this.isRunning = true;
}
}
public void Stop()
{
if (this.isRunning)
{
timeKillEvent(this.timerID);
this.isRunning = false;
}
}
/// <summary>
/// 实现IDisposable接口
/// </summary>
public void Dispose()
{
timeKillEvent(this.timerID);
GC.SuppressFinalize(this);
EventHandler disposed = this.Disposed;
if (disposed != null)
{
disposed(this, EventArgs.Empty);
}
}
//*************************************************** 内部函数 ******************************************************************
[DllImport("winmm.dll")]
private static extern int timeSetEvent(int delay, int resolution, TimerCallback callback, int user, int mode);
[DllImport("winmm.dll")]
private static extern int timeKillEvent(int id);
[DllImport("winmm.dll")]
private static extern int timeGetDevCaps(ref TimerCaps caps, int sizeOfTimerCaps);
// The timeGetDevCaps function queries the timer device to determine its resolution.
private void TimerEventCallback(int id, int msg, int user, int param1, int param2)
{
if (this.Tick != null)
{
this.Tick(this, null); // 引发事件
}
}
//*************************************************** 内部类型 ******************************************************************
private delegate void TimerCallback(int id, int msg, int user, int param1, int param2); // timeSetEvent所对应的回调函数的签名
/// <summary>
/// 定时器的分辨率(resolution)。单位是ms,毫秒
/// </summary>
[StructLayout(LayoutKind.Sequential)]
private struct TimerCaps
{
public int periodMin;
public int periodMax;
}
}
}
...@@ -11,12 +11,13 @@ namespace GcDevicePc.GCBuffer ...@@ -11,12 +11,13 @@ namespace GcDevicePc.GCBuffer
public struct FolderInfo public struct FolderInfo
{ {
public string DataFolder; //数据保存目录 public string DataFolder; //数据保存目录
public string RunFolder; //当前程序运行目录 public string ConfigFolder; //程序配置目录
public string MethodFolder; //当前方法目录 public string MethodFolder; //当前方法目录
public string StatusFolder; //当前配置目录 public string StatusFolder; //当前配置目录
public string SubStatusFolder; //当前配置子目录 public string SubStatusFolder; //当前配置子目录
public string RunTabFolder; //当前运行表目录 public string RunTabFolder; //当前运行表目录
public string FwFolder; //固件更新目录 public string FwFolder; //固件更新目录
public string StartUpFolder; //启动配置目录
public string TmpFolder; //TMPFile目录 public string TmpFolder; //TMPFile目录
public string LogFolder; //Log目录 public string LogFolder; //Log目录
} }
...@@ -76,12 +77,13 @@ namespace GcDevicePc.GCBuffer ...@@ -76,12 +77,13 @@ namespace GcDevicePc.GCBuffer
public PCBuffer() public PCBuffer()
{ {
gcpcinfo.pcfolderinfo.DataFolder = null; gcpcinfo.pcfolderinfo.DataFolder = null;
gcpcinfo.pcfolderinfo.RunFolder = null; gcpcinfo.pcfolderinfo.ConfigFolder = null;
gcpcinfo.pcfolderinfo.MethodFolder = null; gcpcinfo.pcfolderinfo.MethodFolder = null;
gcpcinfo.pcfolderinfo.StatusFolder = null; gcpcinfo.pcfolderinfo.StatusFolder = null;
gcpcinfo.pcfolderinfo.SubStatusFolder = null; gcpcinfo.pcfolderinfo.SubStatusFolder = null;
gcpcinfo.pcfolderinfo.RunTabFolder = null; gcpcinfo.pcfolderinfo.RunTabFolder = null;
gcpcinfo.pcfolderinfo.FwFolder = null; gcpcinfo.pcfolderinfo.FwFolder = null;
gcpcinfo.pcfolderinfo.StartUpFolder = null;
gcpcinfo.pcfolderinfo.TmpFolder = null; gcpcinfo.pcfolderinfo.TmpFolder = null;
gcpcinfo.pcfolderinfo.LogFolder = null; gcpcinfo.pcfolderinfo.LogFolder = null;
...@@ -102,7 +104,7 @@ namespace GcDevicePc.GCBuffer ...@@ -102,7 +104,7 @@ namespace GcDevicePc.GCBuffer
gcpcinfo.outputinfo.port = 0; gcpcinfo.outputinfo.port = 0;
string file = System.Windows.Forms.Application.StartupPath + "\\startup.ini"; string file = System.Windows.Forms.Application.StartupPath+ "\\..\\GC_Config\\GC_Set\\启动参数" + "\\startup.ini";
if (File.Exists(file)) if (File.Exists(file))
......
...@@ -373,6 +373,7 @@ ...@@ -373,6 +373,7 @@
<Compile Include="Controls\HMIStatus.Designer.cs"> <Compile Include="Controls\HMIStatus.Designer.cs">
<DependentUpon>HMIStatus.cs</DependentUpon> <DependentUpon>HMIStatus.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Controls\MillisecondTimer.cs" />
<Compile Include="Controls\PictureMenu.cs"> <Compile Include="Controls\PictureMenu.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
...@@ -446,12 +447,6 @@ ...@@ -446,12 +447,6 @@
<Compile Include="ListViewTest.designer.cs"> <Compile Include="ListViewTest.designer.cs">
<DependentUpon>ListViewTest.cs</DependentUpon> <DependentUpon>ListViewTest.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="MainBase.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainBase.Designer.cs">
<DependentUpon>MainBase.cs</DependentUpon>
</Compile>
<Compile Include="MainForm.cs"> <Compile Include="MainForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
...@@ -687,9 +682,6 @@ ...@@ -687,9 +682,6 @@
<EmbeddedResource Include="ListViewTest.resx"> <EmbeddedResource Include="ListViewTest.resx">
<DependentUpon>ListViewTest.cs</DependentUpon> <DependentUpon>ListViewTest.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="MainBase.resx">
<DependentUpon>MainBase.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx"> <EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
......
...@@ -10,7 +10,9 @@ using GcDevicePc.CK_UI; ...@@ -10,7 +10,9 @@ using GcDevicePc.CK_UI;
using Ini.Net; using Ini.Net;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using GcDevicePc.ConfigMethod; using GcDevicePc.ConfigMethod;
using GcDevicePc.Controls;
using GcDevicePc.GCBuffer; using GcDevicePc.GCBuffer;
using GcDevicePc.IniParam;
namespace GcDevicePc namespace GcDevicePc
{ {
...@@ -107,6 +109,159 @@ namespace GcDevicePc ...@@ -107,6 +109,159 @@ namespace GcDevicePc
} }
#region 数据保存定时事件
private MillisecondTimer _logTimer;
private void InitLogTimer()
{
_logTimer = new MillisecondTimer();
_logTimer.Tick += logTimer_Tick; ;
_logTimer.Interval = 1000 * 60; //1min
_logTimer.Start();
}
private void logTimer_Tick(object sender, EventArgs e)
{
string status_info = "";
string other_info = "";
string temp_info = "";
if (globaldata.m_hmibuffer.gcinfo.hmistatus == 4)
{
status_info = " HMI进行单次运行 ";
}
else if (globaldata.m_hmibuffer.gcinfo.hmistatus == 2)
{
status_info = " HMI进行批处理 ";
}
else if (globaldata.m_hmibuffer.gcinfo.hmistatus == 0)
{
status_info = " HMI空闲 ";
}
else
{
status_info = " HMI状态未知 ";
}
if (globaldata.m_hmibuffer.gcinfo.hmistatus == 4 || globaldata.m_hmibuffer.gcinfo.hmistatus == 2)
{
switch (globaldata.m_hmibuffer.gcinfo.methodstatus)
{
case 0:
case 1:
status_info += "方法空闲 ";
break;
case 2:
status_info += "方法平衡中 ";
break;
case 3:
status_info += "方法已就绪 ";
break;
case 4:
case 5:
status_info += "方法运行中 ";
break;
case 6:
status_info += "方法后处理 ";
break;
case 7:
status_info += "方法后处理完毕 ";
break;
case 8:
status_info += "信号稳定中 ";
break;
case 9:
status_info += "设备断开 ";
break;
default:
status_info += "设备连接 ";
break;
}
}
if (globaldata.m_hmibuffer.gcinfo.hmistatus == 2)
{
status_info += "运行进度 " + globaldata.m_hmibuffer.gcinfo.batno.ToString() + "/" +
globaldata.m_hmibuffer.gcinfo.batruncount.ToString();
}
Log.HmiInfo(status_info);
other_info = "点火状态:";
switch (globaldata.m_dpbuffer.ShowList.showDet.fDetStatue)
{
case 0:
other_info += "未点火";
break;
case 1:
other_info += "点火中";
break;
case 2:
other_info += "点火成功";
break;
case 3:
other_info += "点火失败";
break;
case 4:
other_info += "火焰熄灭";
break;
case 5:
other_info += "重新点火";
break;
default:
other_info += "状态错误";
break;
}
other_info += " FID:" + globaldata.m_dpbuffer.ShowList.showDet.fDetValue.ToString("0.000");
Log.HmiInfo(other_info);
if (CProfileDevice.m_DevParam.syspara.u16InjPortFront == 1)
{
temp_info += "前进样口:" + globaldata.m_dpbuffer.ShowList.showtemp.FPActualTemp.ToString("#0.00") + " / " +
globaldata.m_dpbuffer.ShowList.showtemp.FPSetTemp.ToString("0");
}
if (CProfileDevice.m_DevParam.syspara.u16InjPortBehind == 1)
{
temp_info += "后进样口:" + globaldata.m_dpbuffer.ShowList.showtemp.BPActualTemp.ToString("#0.00") + " / " +
globaldata.m_dpbuffer.ShowList.showtemp.BPSetTemp.ToString("0");
}
if (CProfileDevice.m_DevParam.syspara.u16Col == 1)
{
temp_info += "柱箱:" + globaldata.m_dpbuffer.ShowList.showtemp.ColActualTemp.ToString("#0.00") + " / " +
globaldata.m_dpbuffer.ShowList.showtemp.ColSetTemp.ToString("0");
}
if (CProfileDevice.m_DevParam.syspara.u16DetNum >= 1)
{
if (CProfileDevice.m_DevParam.syspara.u16DetFront == 1)
{
temp_info += "前检测:" + globaldata.m_dpbuffer.ShowList.showtemp.fDetActualTemp.ToString("#0.00") +
" / " + globaldata.m_dpbuffer.ShowList.showtemp.fDetSetTemp.ToString("0");
}
if (CProfileDevice.m_DevParam.syspara.u16DetInter == 1)
{
temp_info += "中检测:" + globaldata.m_dpbuffer.ShowList.showtemp.iDetActualTemp.ToString("#0.00") +
" / " + globaldata.m_dpbuffer.ShowList.showtemp.iDetSetTemp.ToString("0");
}
if (CProfileDevice.m_DevParam.syspara.u16DetBehind == 1)
{
temp_info += "后检测:" + globaldata.m_dpbuffer.ShowList.showtemp.bDetActualTemp.ToString("#0.00") +
" / " + globaldata.m_dpbuffer.ShowList.showtemp.bDetSetTemp.ToString("0");
}
Log.HmiInfo(temp_info);
}
}
#endregion
/// <summary> /// <summary>
/// 主窗口载入 /// 主窗口载入
/// </summary> /// </summary>
...@@ -118,6 +273,9 @@ namespace GcDevicePc ...@@ -118,6 +273,9 @@ namespace GcDevicePc
InitConfig(); InitConfig();
//系统检测日志
InitLogTimer();
_debugForm = new Formdebug(); _debugForm = new Formdebug();
_debugForm.MdiParent = this; _debugForm.MdiParent = this;
_debugForm.Dock = DockStyle.Fill; _debugForm.Dock = DockStyle.Fill;
...@@ -165,7 +323,7 @@ namespace GcDevicePc ...@@ -165,7 +323,7 @@ namespace GcDevicePc
try try
{ {
int opensys = 0; int opensys = 0;
String tmpfile = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.RunFolder + "\\startup.ini"; String tmpfile = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.StartUpFolder + "\\startup.ini";
globaldata.starttimer = 0x7FFFFFFF; globaldata.starttimer = 0x7FFFFFFF;
IniFile IniParser = new IniFile(tmpfile); IniFile IniParser = new IniFile(tmpfile);
...@@ -1480,7 +1638,7 @@ namespace GcDevicePc ...@@ -1480,7 +1638,7 @@ namespace GcDevicePc
{ {
OpenFileDialog fileDlg = new OpenFileDialog(); OpenFileDialog fileDlg = new OpenFileDialog();
fileDlg.Multiselect = false; fileDlg.Multiselect = false;
fileDlg.InitialDirectory = Application.StartupPath + "\\仪器方法"; fileDlg.InitialDirectory = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.MethodFolder;
fileDlg.Title = "请选择方法文件"; fileDlg.Title = "请选择方法文件";
fileDlg.Filter = "配置文件(*.ini)|*.ini"; fileDlg.Filter = "配置文件(*.ini)|*.ini";
if (fileDlg.ShowDialog() == DialogResult.OK) if (fileDlg.ShowDialog() == DialogResult.OK)
...@@ -1531,7 +1689,7 @@ namespace GcDevicePc ...@@ -1531,7 +1689,7 @@ namespace GcDevicePc
{ {
OpenFileDialog fileDlg = new OpenFileDialog(); OpenFileDialog fileDlg = new OpenFileDialog();
fileDlg.Multiselect = false; fileDlg.Multiselect = false;
fileDlg.InitialDirectory = Application.StartupPath + "\\仪器方法"; fileDlg.InitialDirectory = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.MethodFolder;
fileDlg.Title = "请选择方法文件"; fileDlg.Title = "请选择方法文件";
fileDlg.Filter = "配置文件(*.ini)|*.ini"; fileDlg.Filter = "配置文件(*.ini)|*.ini";
if (fileDlg.ShowDialog() == DialogResult.OK) if (fileDlg.ShowDialog() == DialogResult.OK)
......
...@@ -27,7 +27,7 @@ namespace GcDevicePc.ProThread ...@@ -27,7 +27,7 @@ namespace GcDevicePc.ProThread
{ {
try try
{ {
string file = System.Windows.Forms.Application.StartupPath + "\\CarLine" + "\\Ingredient.ini"; string file = System.Windows.Forms.Application.StartupPath+ "\\..\\GC_Config\\GC_DataPro" + "\\CarLine" + "\\Ingredient.ini";
int[] datano = new int[6] {1, 1, 1, 1, 1, 1}; int[] datano = new int[6] {1, 1, 1, 1, 1, 1};
if (File.Exists(file)) if (File.Exists(file))
...@@ -51,19 +51,19 @@ namespace GcDevicePc.ProThread ...@@ -51,19 +51,19 @@ namespace GcDevicePc.ProThread
datano[0] = Convert.ToInt32(sid); datano[0] = Convert.ToInt32(sid);
} }
if (sname == "苯") if (sname == "苯" || sname == "C6H6")
{ {
c6h6 = true; c6h6 = true;
datano[1] = Convert.ToInt32(sid); datano[1] = Convert.ToInt32(sid);
} }
if (sname == "甲苯") if (sname == "甲苯" || sname == "C7H8")
{ {
c7h8 = true; c7h8 = true;
datano[2] = Convert.ToInt32(sid); datano[2] = Convert.ToInt32(sid);
} }
if (sname == "二甲苯") if (sname == "二甲苯" || sname == "C8H10")
{ {
c8h10 = true; c8h10 = true;
datano[3] = Convert.ToInt32(sid); datano[3] = Convert.ToInt32(sid);
......
...@@ -146,6 +146,7 @@ namespace GcDevicePc ...@@ -146,6 +146,7 @@ namespace GcDevicePc
/// </summary> /// </summary>
private void PreLoadingProc() private void PreLoadingProc()
{ {
globaldata.m_appinit.InitAppFolderGC();
_appInitInfo = "系统初始化开始"; _appInitInfo = "系统初始化开始";
_appInitInfo = "检测本地网络"; _appInitInfo = "检测本地网络";
globaldata.m_appinit.LocalNetworkCheck(); globaldata.m_appinit.LocalNetworkCheck();
......
...@@ -27,7 +27,7 @@ namespace GcDevicePc ...@@ -27,7 +27,7 @@ namespace GcDevicePc
private void autorun_CheckedChanged(object sender, EventArgs e) private void autorun_CheckedChanged(object sender, EventArgs e)
{ {
string file = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.RunFolder + "\\startup.ini"; string file = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.StartUpFolder + "\\startup.ini";
INIOperation test = new INIOperation(file); INIOperation test = new INIOperation(file);
// string value; // string value;
int count = 0; int count = 0;
...@@ -80,7 +80,7 @@ namespace GcDevicePc ...@@ -80,7 +80,7 @@ namespace GcDevicePc
private void appstartup_CheckedChanged(object sender, EventArgs e) private void appstartup_CheckedChanged(object sender, EventArgs e)
{ {
string file = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.RunFolder + "\\startup.ini"; string file = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.StartUpFolder + "\\startup.ini";
INIOperation test = new INIOperation(file); INIOperation test = new INIOperation(file);
string value; string value;
if(this.appstartup.Checked) if(this.appstartup.Checked)
...@@ -144,7 +144,7 @@ namespace GcDevicePc ...@@ -144,7 +144,7 @@ namespace GcDevicePc
private void UserConfig_Load(object sender, EventArgs e) private void UserConfig_Load(object sender, EventArgs e)
{ {
string file = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.RunFolder + "\\startup.ini"; string file = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.StartUpFolder + "\\startup.ini";
INIOperation test = new INIOperation(file); INIOperation test = new INIOperation(file);
string MAC = test.INIGetStringValue("NetWorkConfig", "MAC地址", null); string MAC = test.INIGetStringValue("NetWorkConfig", "MAC地址", null);
string value = test.INIGetStringValue("StartUp", "自启动", null); string value = test.INIGetStringValue("StartUp", "自启动", null);
...@@ -280,7 +280,7 @@ namespace GcDevicePc ...@@ -280,7 +280,7 @@ namespace GcDevicePc
bool ret = false; bool ret = false;
string newMac = string.Format(String.Format("{0:X2}:{1:X2}:{2:X2}:{3:X2}:{4:X2}:{5:X2}",mac1.Text,mac2.Text,mac3.Text,mac4.Text,mac5.Text,mac6.Text)); string newMac = string.Format(String.Format("{0:X2}:{1:X2}:{2:X2}:{3:X2}:{4:X2}:{5:X2}",mac1.Text,mac2.Text,mac3.Text,mac4.Text,mac5.Text,mac6.Text));
string file = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.RunFolder + "\\startup.ini"; string file = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.StartUpFolder + "\\startup.ini";
INIOperation test = new INIOperation(file); INIOperation test = new INIOperation(file);
ret = test.INIWriteValue(file, "NetWorkConfig", "MAC地址", newMac); ret = test.INIWriteValue(file, "NetWorkConfig", "MAC地址", newMac);
...@@ -316,7 +316,7 @@ namespace GcDevicePc ...@@ -316,7 +316,7 @@ namespace GcDevicePc
int i = 0; int i = 0;
string file = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.RunFolder + "\\startup.ini"; string file = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.StartUpFolder + "\\startup.ini";
INIOperation test = new INIOperation(file); INIOperation test = new INIOperation(file);
string myMAC = test.INIGetStringValue("NetWorkConfig", "MAC地址", null); string myMAC = test.INIGetStringValue("NetWorkConfig", "MAC地址", null);
try try
......
...@@ -169,7 +169,7 @@ namespace GcDevicePc ...@@ -169,7 +169,7 @@ namespace GcDevicePc
string file; string file;
OpenFileDialog fileDlg = new OpenFileDialog(); OpenFileDialog fileDlg = new OpenFileDialog();
fileDlg.Multiselect = false; fileDlg.Multiselect = false;
fileDlg.InitialDirectory = Application.StartupPath + "\\仪器方法"; fileDlg.InitialDirectory = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.TmpFolder;
fileDlg.Title = "请选择方法文件"; fileDlg.Title = "请选择方法文件";
fileDlg.Filter = "更新程序(*.*)|*.*"; fileDlg.Filter = "更新程序(*.*)|*.*";
...@@ -276,14 +276,14 @@ namespace GcDevicePc ...@@ -276,14 +276,14 @@ namespace GcDevicePc
while (!mre.WaitOne(500)) while (!mre.WaitOne(500))
{ {
hmicount = mysearch.HMICount(); hmicount = mysearch.HMICount();
invokeDelegate update_hmiip = () =>
this.Invoke(new Action(() =>
{ {
this.hmilist.Text = "搜索到" + hmicount + "个"; this.hmilist.Text = "搜索到" + hmicount + "个";
}; }));
Invoke(update_hmiip);
} }
invokeDelegate add_hmiip = () => this.Invoke(new Action(() =>
{ {
hmilist.Items.Clear(); hmilist.Items.Clear();
//SearchRet = globaldata.hHMIList; //SearchRet = globaldata.hHMIList;
...@@ -292,8 +292,7 @@ namespace GcDevicePc ...@@ -292,8 +292,7 @@ namespace GcDevicePc
{ {
hmilist.Items.Add(((globaldata.DeviceInfo)(SearchRet[i])).IpAddr); hmilist.Items.Add(((globaldata.DeviceInfo)(SearchRet[i])).IpAddr);
} }
}; }));
Invoke(add_hmiip);
mysearch.ThStop(); mysearch.ThStop();
} }
...@@ -361,7 +360,7 @@ namespace GcDevicePc ...@@ -361,7 +360,7 @@ namespace GcDevicePc
string firmDire = null; string firmDire = null;
string fullfilename = null; string fullfilename = null;
bool updatestart = false; bool updatestart = false;
firmDire = Application.StartupPath + "\\固件更新\\"; firmDire = globaldata.m_pcbuffer.gcpcinfo.pcfolderinfo.FwFolder;
//try //try
//{ //{
...@@ -388,11 +387,11 @@ namespace GcDevicePc ...@@ -388,11 +387,11 @@ namespace GcDevicePc
{ {
if (globaldata.m_hmibuffer.gcinfo.hmistatus == 5) if (globaldata.m_hmibuffer.gcinfo.hmistatus == 5)
{ {
invokeDelegate updatestatue_up = () =>
this.Invoke(new Action(() =>
{ {
this.label7.Text = "更新中..."; this.label7.Text = "更新中...";
}; }));
Invoke(updatestatue_up);
updatestart = true; updatestart = true;
} }
...@@ -400,11 +399,10 @@ namespace GcDevicePc ...@@ -400,11 +399,10 @@ namespace GcDevicePc
{ {
if (globaldata.m_hmibuffer.gcinfo.hmistatus == 0) if (globaldata.m_hmibuffer.gcinfo.hmistatus == 0)
{ {
invokeDelegate updatestatue_up = () => this.Invoke(new Action(() =>
{ {
this.label7.Text = "更新完成..."; this.label7.Text = "更新完成...";
}; }));
Invoke(updatestatue_up);
updatefirm_ok = true; updatefirm_ok = true;
sendfirm_ok = false; sendfirm_ok = false;
......
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