#20250519 总装因数据写入错误导致界面卡顿,定位到数据库连接字符串 在连接时未复制的问题

This commit is contained in:
HM-CN\zhengxuan.zhang
2025-05-19 14:41:50 +08:00
parent f9836f7b87
commit c0510d956c
16 changed files with 45 additions and 34 deletions
+6 -4
View File
@@ -107,6 +107,8 @@ namespace NSAnalysis
InitializeComponent();
SQLHelper.connStr = DatabaseDfn.SqlConnectStr();
//
#region
ThemeResolutionService.LoadPackageFile(ConfigDfn.strTheme);
@@ -385,10 +387,10 @@ namespace NSAnalysis
private void CenterControl_FormClosed(object sender, FormClosedEventArgs e)
{
MyBase.TraceWriteLine("-------------海克斯康面隙分析软件程序关闭---------------------");
//LogDebugDfn.strEndTime = DateTime.Now.ToString("yyyy.MM.dd HH-mm-ss");
//string CopyFileName = ConfigDfn.strFileFolder + "\\DebugFiles\\" + "Debug(" + LogDebugDfn.strStartTime + " To " + LogDebugDfn.strEndTime + ")" + ".txt";
//if (File.Exists(LogDebugDfn.strDebugFile))
// File.Copy(LogDebugDfn.strDebugFile, CopyFileName);
LogDebugDfn.strEndTime = DateTime.Now.ToString("yyyy.MM.dd HH-mm-ss");
string CopyFileName = ConfigDfn.strFileFolder + "\\DebugFiles\\" + "Debug(" + LogDebugDfn.strStartTime + " To " + LogDebugDfn.strEndTime + ")" + ".txt";
if (File.Exists(LogDebugDfn.strDebugFile))
File.Copy(LogDebugDfn.strDebugFile, CopyFileName);
System.Environment.Exit(0);
}
+16 -4
View File
@@ -292,12 +292,16 @@ namespace NSAnalysis
public static string SqlConnectStr()
{
string strConnectString = "";
strConnectString = @"Data Source=" + SqlServerName
LoadConfig();
strConnectString = @"Data Source=" + SqlServerName
+ ";initial Catalog=" + SqlDbName
+ ";User ID=" + SqlUserName
+ ";password=" + SqlPassword + ";";
return strConnectString;
MyBase.TraceWriteLine("数据库连接字符串:" + strConnectString);
return strConnectString;
}
public static void LoadConfig()
@@ -307,6 +311,14 @@ namespace NSAnalysis
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);
}
}
}
+3 -3
View File
@@ -90,9 +90,9 @@ namespace NSAnalysis
gCLMSModeID = FileIni.ReadInt(ConfigDfn.strConfigFile, "Chery", "CLMSModeID", 1);
gAuthorizationMode = FileIni.ReadInt(ConfigDfn.strConfigFile, "Chery", "AuthorizationMode", 1);
#endregion Log文件
if (gAuthorizationMode == 1)
#endregion Log文件
//Application.Run(new CenterControl());
if (gAuthorizationMode == 1)
{
MyBase.TraceWriteLine("Log in using the CLMS authorization.");
Binary file not shown.
Binary file not shown.
+9 -21
View File
@@ -1,21 +1,9 @@
2025-03-07 11:51:04.897----软件Program Main函数开始执行--
2025-03-07 11:51:04.904--加载配置文件——>开始
2025-03-07 11:51:04.933--加载配置文件——>完成
2025-03-07 11:51:04.935--Log in using the CLMS authorization.
2025-03-07 11:51:07.433-- 进入显示车身模式!显示车身界面。
2025-03-07 11:51:07.943--启动PLC写线程!
2025-03-07 11:51:07.978-- 进入解析CSV文件模式,开始解析扫码CSV文件!
2025-03-07 11:51:07.980--软件首次启动, Nextsense EH3 CSV读取路径存在;不清空,读取NextSense生成 CSV报告路径下的所有文件,路径为:D:\cherytestEH3
2025-03-07 11:51:07.981--连接PLC....
2025-03-07 11:51:07.981--软件首次启动, Nextsense EHY CSV读取路径存在;不清空,读取NextSense生成 CSV报告路径下的所有文件,路径为:D:\cherytestEHY
2025-03-07 11:51:08.881--存在EHY CSV文件,开始解析:
2025-03-07 11:51:08.888--Copy D:\test\5mm_SelfTest_20250304_141005.csv TO D:\HexagonProjects\2024-20-奇瑞间隙面差\奇瑞间隙面差总装代码资料\Code\Analysis\bin\x64\Debug\File\NextSenseCSVBackup\5mm_SelfTest_20250304_141005.csv Done. 备份完成
2025-03-07 11:51:08.894--开始解析NextSense EHY CSV 报告:D:\test\5mm_SelfTest_20250304_141005.csv
2025-03-07 11:51:11.466--PLC S7连接失败。
2025-03-07 11:51:14.826--解析NextSense 自检报告完毕!检查数量=4
2025-03-07 11:51:14.832--开始生成客户所需要的CSV格式文件:
2025-03-07 11:51:14.835--客户自检报告生成完毕,路径为:D:\QMLTest\20250307115114_SelfMeasure20250307115108.csv
2025-03-07 11:51:14.859--连接PLC失败
2025-03-07 11:51:14.975--Right EH3 UI Refresh tmrRefreshData (strVIN.Length==21)CarTypeEHY ;VIN: LNNBBDEC8RDA23997
2025-03-07 11:51:14.985--Right EHY UI Refresh tmrRefreshData (strVIN.Length==21)CarTypeEHY ;VIN: LNNBBDEC8RDA23997
2025-03-07 11:51:15.160--显示右侧EHY车身数据界面。
2025-05-19 14:11:36.576----软件Program Main函数开始执行--
2025-05-19 14:11:36.578--加载配置文件——>开始
2025-05-19 14:11:36.625--数据库连接 SqlServerName127.0.0.1
2025-05-19 14:11:36.626--数据库连接 SqlUserNamesa
2025-05-19 14:11:36.627--数据库连接 SqlPasswordHexagon123
2025-05-19 14:11:36.629--数据库连接 SqlDbNameNextSenseStandardDB
2025-05-19 14:11:36.630--加载配置文件——>完成
2025-05-19 14:11:36.631--Log in using the CLMS authorization.
2025-05-19 14:11:36.758--CLMS check license failed! Please authorize the operation.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+6
View File
@@ -77,6 +77,12 @@
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PLCModule\PLCModule\4.PLCModule.csproj">
<Project>{43566B10-5883-40B5-82B1-505D91629B33}</Project>
<Name>4.PLCModule</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
+5 -2
View File
@@ -1,4 +1,5 @@
using System;
using PLCBaseFunction;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
@@ -32,7 +33,9 @@ namespace DAL
if (iFlag == 0)
{
iFlag++;//必须放在前面,这样才起左右,放在后面,不会赋值 如果不点击确定的话
MessageBox.Show("数据库打开连接失败,请检查数据库是否正确连接!原因:" + ex.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
MyBase.TraceWriteLine(" 数据库打开连接失败" +ex.ToString());
MessageBox.Show("数据库打开连接失败,请检查数据库是否正确连接!原因:" + ex.ToString(), "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
return conn;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.