240 lines
8.6 KiB
C#
240 lines
8.6 KiB
C#
/**************************************************************************
|
||
*
|
||
* =================================
|
||
* CLR版本 :4.0.30319.42000
|
||
* 命名空间 :NSAnalysis
|
||
* 文件名称 :Define.cs
|
||
* =================================
|
||
* 创 建 者 :shupeng.wang
|
||
* 创建日期 :2021/6/9 14:58:52
|
||
* 功能描述 :
|
||
* 使用说明 :
|
||
* =================================
|
||
* 修改者 :
|
||
* 修改日期 :
|
||
* 修改内容 :
|
||
* =================================
|
||
*
|
||
***************************************************************************/
|
||
|
||
using BaseFunction;
|
||
using System;
|
||
using System.IO;
|
||
using System.Windows.Forms;
|
||
|
||
namespace NSAnalysis
|
||
{
|
||
public class LogDebugDfn
|
||
{
|
||
public static string strDebugFile = Application.StartupPath + "\\Debug.txt"; //保存操作log的文件
|
||
public static string strStartTime = "";//程序启动时间
|
||
public static string strEndTime = ""; //程序关闭时间
|
||
}
|
||
|
||
public class ConfigDfn
|
||
{
|
||
#region 全局变量
|
||
|
||
public static string strKeyFolder = Application.StartupPath + "\\Key";
|
||
public static string strFileFolder = Application.StartupPath + "\\File";
|
||
public static string strDFQFolder = Application.StartupPath + "\\DFQFiles";
|
||
public static string strDebugFileFolder = Application.StartupPath + "\\File\\DebugFiles\\";
|
||
public static string strThemePath = Application.StartupPath + "\\ThemeSkin\\";
|
||
public static string strTheme = Application.StartupPath + "\\ThemeSkin\\";
|
||
|
||
/// <summary>
|
||
/// CheryAnalysisConfig.ini绝对路径地址
|
||
/// </summary>
|
||
public static string strConfigFile = Application.StartupPath + "\\File\\AnalysisConfig.ini";
|
||
|
||
public static string strImageFile = Application.StartupPath + "\\Images\\";
|
||
public static string strExpiredTime = "";
|
||
|
||
public static string strSkinName = "";
|
||
public static string strHelpDocumentName = "";
|
||
public static int iDeleteFlieTime;
|
||
public static string strImagePath = "";
|
||
|
||
/// <summary>
|
||
/// true =中文 false =英语
|
||
/// </summary>
|
||
public static bool bLanguage = true;
|
||
|
||
public static bool bRememberMe = false;
|
||
public static string UserName = "";
|
||
public static string Password = "";
|
||
|
||
public static int gtm1_60 = 5000;
|
||
public static int gtmRMIDMode = 5000;
|
||
public static int gtmRCMMStatus = 6000;
|
||
|
||
public static string strNextSenseCSVEH3Path = "";
|
||
public static string strNextSenseCSVEHYPath = "";
|
||
public static string strNextSenseSelfMeasurePath = "";
|
||
public static string strPLCIP = "";
|
||
|
||
/// <summary>
|
||
/// NextSense 测量结果
|
||
/// </summary>
|
||
public static bool bMeasureResult = false;
|
||
|
||
public static string strMeasureTime = "";
|
||
|
||
public static double dFPY = 0.8;
|
||
public static double dFPY2 = 0.6;
|
||
|
||
public static string strCarModel = "";
|
||
public static string strEquipNo = "";
|
||
public static string strEquipName = "";
|
||
public static string strIOTAddress = "";
|
||
public static string strIOTCarTypeAddress = "";
|
||
public static int iStartIOTFlag = 1;
|
||
public static int iShowCarDataFlag = 0;
|
||
public static string strShowCarLR = "";
|
||
public static string strCOMPort = "";
|
||
|
||
public static int iCreateReportFlag = 0;
|
||
public static string strStationName = "";
|
||
public static string strUploadPath = "";
|
||
public static string strUploadPath2 = "";
|
||
public static double dLevel2 = 1.5;
|
||
|
||
public static double dLevel3 = 2.0;
|
||
public static string strReportPath = "";
|
||
public static string strReportPath2 = "";
|
||
|
||
/// <summary>
|
||
/// 公差带百分比
|
||
/// </summary>
|
||
public static double dTolerancePer = 0.0;
|
||
|
||
public static double dExceptionTolerancePer = 0.0;
|
||
public static string strPwd = "";
|
||
public static int iAnalysisCSVFlag = 1;
|
||
public static int iRecordEncoderFlag = 0;
|
||
public static int iIncludeRangeFlag = 0;
|
||
public static int iMeasureItemsCount = 0;
|
||
public static int iFailedCarCount = 0;
|
||
|
||
#endregion 全局变量
|
||
|
||
public static void LoadConfig()
|
||
{
|
||
string strSection = "";
|
||
|
||
#region 读取系统配置参数
|
||
|
||
strSection = "Chery";
|
||
iDeleteFlieTime = FileIni.ReadInt(ConfigDfn.strConfigFile, strSection, "DeleteDebugFileIntervalTime");
|
||
strSkinName = FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "ConfigSkinName");
|
||
strTheme += strSkinName;
|
||
strHelpDocumentName = FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "SoftwareHelpDocument");
|
||
strImagePath = strImageFile + FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "CNCPictureName");
|
||
bLanguage = FileIni.ReadBool(ConfigDfn.strConfigFile, strSection, "Language", 0);
|
||
bRememberMe = FileIni.ReadBool(ConfigDfn.strConfigFile, strSection, "RememberMe", 0);
|
||
strNextSenseCSVEH3Path = FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "NextsenseCSVEH3Path");
|
||
strNextSenseCSVEHYPath = FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "NextsenseCSVEHYPath");
|
||
strNextSenseSelfMeasurePath = FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "NextseneSelfMeasurePath");
|
||
strPwd = FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "Password");
|
||
iCreateReportFlag = FileIni.ReadInt(ConfigDfn.strConfigFile, strSection, "CreateReportFlag");
|
||
strUploadPath = FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "tavascanUploadPath");
|
||
strUploadPath2 = FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "blacklabelUploadPath");
|
||
dLevel2 = double.Parse(FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "Level2Times"));
|
||
dLevel3 = double.Parse(FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "Level3Times"));
|
||
strReportPath = FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "ReportCSVPath");
|
||
strReportPath2 = FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "ReportCSVPath2");
|
||
iAnalysisCSVFlag = FileIni.ReadInt(ConfigDfn.strConfigFile, strSection, "AnalysisCSVFlag");
|
||
iRecordEncoderFlag = FileIni.ReadInt(strConfigFile, strSection, "RecordEncoderFlag");
|
||
iIncludeRangeFlag = FileIni.ReadInt(strConfigFile, strSection, "IncludeRangeFlag");
|
||
iMeasureItemsCount = FileIni.ReadInt(strConfigFile, strSection, "MeasureCarItemsCount");
|
||
|
||
#endregion 读取系统配置参数
|
||
}
|
||
|
||
public static void LoadConfigFile()
|
||
{
|
||
try
|
||
{
|
||
#region 检查DLL是否存在
|
||
|
||
|
||
|
||
#endregion 检查DLL是否存在
|
||
|
||
MyBase.TraceWriteLine("加载配置文件——>开始");
|
||
if (File.Exists(strConfigFile))
|
||
{
|
||
LoadConfig();
|
||
|
||
DatabaseDfn.LoadConfig();
|
||
MyBase.TraceWriteLine("加载配置文件——>完成");
|
||
}
|
||
else
|
||
{
|
||
MyBase.TraceWriteLine("配置文件不存在!");
|
||
}
|
||
|
||
#region 检测文件夹,没有则创建
|
||
|
||
if (!Directory.Exists(ConfigDfn.strFileFolder))
|
||
Directory.CreateDirectory(ConfigDfn.strFileFolder);
|
||
if (!Directory.Exists(ConfigDfn.strDebugFileFolder))
|
||
Directory.CreateDirectory(ConfigDfn.strDebugFileFolder);
|
||
if (!Directory.Exists(ConfigDfn.strKeyFolder))
|
||
Directory.CreateDirectory(ConfigDfn.strKeyFolder);
|
||
if (!Directory.Exists(ConfigDfn.strThemePath))
|
||
Directory.CreateDirectory(ConfigDfn.strThemePath);
|
||
if (!Directory.Exists(ConfigDfn.strImageFile))
|
||
Directory.CreateDirectory(ConfigDfn.strImageFile);
|
||
if (!Directory.Exists(ConfigDfn.strDFQFolder))
|
||
Directory.CreateDirectory(ConfigDfn.strDFQFolder);
|
||
|
||
#endregion 检测文件夹,没有则创建
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
MyBase.TraceWriteLine("加载配置文件错误:" + ex.ToString());
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
|
||
public class DatabaseDfn
|
||
{
|
||
public static string SqlServerName = "";
|
||
public static string SqlDbName = "";
|
||
public static string SqlUserName = "";
|
||
public static string SqlPassword = "";
|
||
|
||
public static string SqlConnectStr()
|
||
{
|
||
string strConnectString = "";
|
||
|
||
LoadConfig();
|
||
strConnectString = @"Data Source=" + SqlServerName
|
||
+ ";initial Catalog=" + SqlDbName
|
||
+ ";User ID=" + SqlUserName
|
||
+ ";password=" + SqlPassword + ";";
|
||
|
||
MyBase.TraceWriteLine("数据库连接字符串:" + strConnectString);
|
||
|
||
return strConnectString;
|
||
}
|
||
|
||
public static void LoadConfig()
|
||
{
|
||
string strSection = "MSDB";
|
||
SqlServerName = FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "SqlServerName");
|
||
SqlUserName = FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "SqlUserName");
|
||
SqlPassword = FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "SqlPassword");
|
||
SqlDbName = FileIni.ReadString(ConfigDfn.strConfigFile, strSection, "SqlDbName");
|
||
|
||
//写入日志的
|
||
MyBase.TraceWriteLine("数据库连接 SqlServerName:" + SqlServerName);
|
||
MyBase.TraceWriteLine("数据库连接 SqlUserName:" + SqlUserName);
|
||
MyBase.TraceWriteLine("数据库连接 SqlPassword:" + SqlPassword);
|
||
MyBase.TraceWriteLine("数据库连接 SqlDbName:" + SqlDbName);
|
||
}
|
||
}
|
||
} |