From e6f8b7defcc69e43fb9eda3664975863bb29e141 Mon Sep 17 00:00:00 2001 From: schangxiang@126.com <schangxiang@126.com> Date: 周二, 10 9月 2024 12:48:12 +0800 Subject: [PATCH] 在验证 --- DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/App.config | 6 +- DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/UnitTest1.cs | 41 +++++++++++++ DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/App - 生产环境.config | 49 ++++++++++++++++ DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/App - 本机环境.config | 49 ++++++++++++++++ DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/iWare_SCADA_Test.csproj | 4 + 5 files changed, 146 insertions(+), 3 deletions(-) diff --git "a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/App - \346\234\254\346\234\272\347\216\257\345\242\203.config" "b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/App - \346\234\254\346\234\272\347\216\257\345\242\203.config" new file mode 100644 index 0000000..c5a3127 --- /dev/null +++ "b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/App - \346\234\254\346\234\272\347\216\257\345\242\203.config" @@ -0,0 +1,49 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> + + <appSettings> + + <!--net use x: \\192.168.216.133\Destination /savecred /persistent:yes + net use z: \\192.168.216.130\kistler /savecred /persistent:yes + net use y: \\192.168.216.6\data /savecred /persistent:yes + net use u: \\192.168.216.130\NutrunnerData /savecred /persistent:yes--> + + <!-- 鍒ゆ柇宸ュ簭鏄惁璺冲簭鐨勫熀鍑嗛厤缃� --> + <add key="WorkingProcedureAllStr" value="OP05OP10OP20OP30OP35OP40OP50OP60OP70OP80" /> + <add key="WorkPeiceIDPath" value="Y:\qualified" /> + <!-- op30宸ュ簭鐨勫伐浣嶈川閲忎俊鎭� --> + <add key="OP30QualityDataFor36Station" value="Z:\" /> + <add key="OP30QualityDataFor45Station" value="U:\" /> + <add key="OP60QualityData" value="V:\" /> + <add key="OP20QualityData" value="W:\" /> + <add key="OP80QualityData" value="X:\CA4GC20TD\" /> + <!--<add key="WorkPeiceIDPath" value="C:\Users\13650\Desktop\yiqi" />--> + <add key="HeartBeatAlertInterval" value="2000" /> + </appSettings> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> + </startup> + <entityFramework> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> + <connectionStrings> + <!--<add name="SCADA_DF22001_CORE" connectionString="Server=.;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />--> + <!--<add name="SCADA_DF22001_CORE" connectionString="Server=10.10.40.166;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />--> + <add name="SCADA_DF22001_CORE" connectionString="Server=.;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" /> + <add name="SCModel" connectionString="data source=.;initial catalog=SCTest_new;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" /> + </connectionStrings> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration> \ No newline at end of file diff --git "a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/App - \347\224\237\344\272\247\347\216\257\345\242\203.config" "b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/App - \347\224\237\344\272\247\347\216\257\345\242\203.config" new file mode 100644 index 0000000..77079ef --- /dev/null +++ "b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/App - \347\224\237\344\272\247\347\216\257\345\242\203.config" @@ -0,0 +1,49 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<configuration> + <configSections> + <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 --> + <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" /> + </configSections> + + <appSettings> + + <!--net use x: \\192.168.216.133\Destination /savecred /persistent:yes + net use z: \\192.168.216.130\kistler /savecred /persistent:yes + net use y: \\192.168.216.6\data /savecred /persistent:yes + net use u: \\192.168.216.130\NutrunnerData /savecred /persistent:yes--> + + <!-- 鍒ゆ柇宸ュ簭鏄惁璺冲簭鐨勫熀鍑嗛厤缃� --> + <add key="WorkingProcedureAllStr" value="OP05OP10OP20OP30OP35OP40OP50OP60OP70OP80" /> + <add key="WorkPeiceIDPath" value="Y:\qualified" /> + <!-- op30宸ュ簭鐨勫伐浣嶈川閲忎俊鎭� --> + <add key="OP30QualityDataFor36Station" value="Z:\" /> + <add key="OP30QualityDataFor45Station" value="U:\" /> + <add key="OP60QualityData" value="V:\" /> + <add key="OP20QualityData" value="W:\" /> + <add key="OP80QualityData" value="X:\CA4GC20TD\" /> + <!--<add key="WorkPeiceIDPath" value="C:\Users\13650\Desktop\yiqi" />--> + <add key="HeartBeatAlertInterval" value="2000" /> + </appSettings> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /> + </startup> + <entityFramework> + <providers> + <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" /> + </providers> + </entityFramework> + <connectionStrings> + <!--<add name="SCADA_DF22001_CORE" connectionString="Server=.;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />--> + <!--<add name="SCADA_DF22001_CORE" connectionString="Server=10.10.40.166;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />--> + <add name="SCADA_DF22001_CORE" connectionString="Server=192.168.216.203;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" /> + <add name="SCModel" connectionString="data source=192.168.216.203;initial catalog=SCTest_new;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" /> + </connectionStrings> + <runtime> + <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> + <dependentAssembly> + <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" /> + <bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" /> + </dependentAssembly> + </assemblyBinding> + </runtime> +</configuration> \ No newline at end of file diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/App.config b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/App.config index 43752b4..77079ef 100644 --- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/App.config +++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/App.config @@ -20,7 +20,7 @@ <add key="OP30QualityDataFor45Station" value="U:\" /> <add key="OP60QualityData" value="V:\" /> <add key="OP20QualityData" value="W:\" /> - <add key="OP80QualityData_Test" value="X:\CA4GC20TD_Test\" /> + <add key="OP80QualityData" value="X:\CA4GC20TD\" /> <!--<add key="WorkPeiceIDPath" value="C:\Users\13650\Desktop\yiqi" />--> <add key="HeartBeatAlertInterval" value="2000" /> </appSettings> @@ -35,8 +35,8 @@ <connectionStrings> <!--<add name="SCADA_DF22001_CORE" connectionString="Server=.;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />--> <!--<add name="SCADA_DF22001_CORE" connectionString="Server=10.10.40.166;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" />--> - <add name="SCADA_DF22001_CORE" connectionString="Server=.;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" /> - <add name="SCModel" connectionString="data source=.;initial catalog=SCTest_new;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" /> + <add name="SCADA_DF22001_CORE" connectionString="Server=192.168.216.203;Database=iWare.SCADA;User=sa;Password=123abc.com;MultipleActiveResultSets=True" providerName="System.Data.SqlClient" /> + <add name="SCModel" connectionString="data source=192.168.216.203;initial catalog=SCTest_new;integrated security=True;MultipleActiveResultSets=True;App=EntityFramework" providerName="System.Data.SqlClient" /> </connectionStrings> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/UnitTest1.cs b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/UnitTest1.cs index 7b96e1e..82f9363 100644 --- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/UnitTest1.cs +++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/UnitTest1.cs @@ -16,6 +16,47 @@ [TestClass] public class UnitTest1 { + + [TestMethod] + public void TestMethoEntityValidatizzz() + { + try + { + WorkPieceLog aa = null; + using (DbModel db = new DbModel()) + { + aa = db.WorkPieceLog.Where(x => x.Id == 588877956636741).FirstOrDefault(); + } + + var isRight = SystemBussinessHelper.ValidateIsRightWorkPieceID(aa.WorkPieceID); + if (isRight) + { + } + } + catch (DbEntityValidationException dbEx) + { + //var bb = dbEx.EntityValidationErrors.ToList(); + //var pp = bb.First().ValidationErrors.ToList(); + //var z = JsonConvert.SerializeObject(pp); + + var errorMessages = + dbEx.EntityValidationErrors + .SelectMany(validationResult => validationResult.ValidationErrors) + .Select(m => m.ErrorMessage); + + var fullErrorMessage = string.Join(", ", errorMessages); + + //throw new DbEntityValidationException(exceptionMessage, exception.EntityValidationErrors); + } + catch (Exception) + { + + throw; + } + + + } + [TestMethod] public void TestMethoEntityValidationErrors() { diff --git a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/iWare_SCADA_Test.csproj b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/iWare_SCADA_Test.csproj index ea3853e..6eb56d0 100644 --- a/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/iWare_SCADA_Test.csproj +++ b/DataCapture/iWare_SCADA_DataCapture/iWare_SCADA_Test/iWare_SCADA_Test.csproj @@ -69,6 +69,10 @@ <Compile Include="Properties\AssemblyInfo.cs" /> </ItemGroup> <ItemGroup> + <None Include="App - 鏈満鐜.config"> + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> + </None> + <None Include="App - 鐢熶骇鐜.config" /> <None Include="App.config" /> <None Include="packages.config" /> </ItemGroup> -- Gitblit v1.9.3