zoule 3 months ago
parent
commit
c7b3c42588
50 changed files with 413 additions and 375 deletions
  1. 19 120
      XdCxRhDW.App/App.config
  2. 2 2
      XdCxRhDW.App/Controllers/FindRefController.cs
  3. 4 4
      XdCxRhDW.App/Controllers/LogController.cs
  4. 57 56
      XdCxRhDW.App/Controllers/PosController.cs
  5. 11 11
      XdCxRhDW.App/Controllers/ResultController.cs
  6. 1 1
      XdCxRhDW.App/Controllers/TaskController.cs
  7. 1 1
      XdCxRhDW.App/Controllers/XlController.cs
  8. 1 1
      XdCxRhDW.App/CorTools/XlCalculateForm.cs
  9. 1 1
      XdCxRhDW.App/EditForms/EditorTar.cs
  10. 1 1
      XdCxRhDW.App/EditForms/FixedStationEditor.cs
  11. 2 2
      XdCxRhDW.App/EditForms/RHDTOParamEditor.cs
  12. 1 1
      XdCxRhDW.App/EditForms/SatEditor.cs
  13. 2 2
      XdCxRhDW.App/EditForms/SigDelayEditor.cs
  14. 1 1
      XdCxRhDW.App/EditForms/SigEditor.cs
  15. 1 1
      XdCxRhDW.App/EditForms/TargetEditor.cs
  16. 4 4
      XdCxRhDW.App/EditForms/TaskEditor.cs
  17. 1 1
      XdCxRhDW.App/EditForms/TaskEditorSignal.cs
  18. 2 2
      XdCxRhDW.App/EditForms/X1D1DTOParamEditor.cs
  19. 2 2
      XdCxRhDW.App/EditForms/X2D1DTOParamEditor.cs
  20. 2 2
      XdCxRhDW.App/EditForms/X2DTOParamEditor.cs
  21. 2 2
      XdCxRhDW.App/EditForms/X3DTOParamEditor.cs
  22. 2 2
      XdCxRhDW.App/EditForms/X3DfoParamEditor.cs
  23. 3 3
      XdCxRhDW.App/LogHelper.cs
  24. 36 36
      XdCxRhDW.App/MainForm.cs
  25. 3 3
      XdCxRhDW.App/PopupControl/ShowCgCtrl.cs
  26. 1 1
      XdCxRhDW.App/PopupControl/ShowCheckCtrl.cs
  27. 1 1
      XdCxRhDW.App/PopupControl/ShowCxCtrl.cs
  28. 5 5
      XdCxRhDW.App/UserControl/CtrlCgRes.cs
  29. 4 4
      XdCxRhDW.App/UserControl/CtrlFixedStation.cs
  30. 17 17
      XdCxRhDW.App/UserControl/CtrlHome.cs
  31. 4 4
      XdCxRhDW.App/UserControl/CtrlSat.cs
  32. 8 8
      XdCxRhDW.App/UserControl/CtrlSignal.cs
  33. 1 1
      XdCxRhDW.App/UserControl/CtrlSysSettings.cs
  34. 4 4
      XdCxRhDW.App/UserControl/CtrlTarget.cs
  35. 2 2
      XdCxRhDW.App/UserControl/CtrlTx.cs
  36. 2 2
      XdCxRhDW.App/UserControl/CtrlXl.cs
  37. 1 1
      XdCxRhDW.App/UserControl/RHGDOPParam.cs
  38. 1 1
      XdCxRhDW.App/UserControl/X1D1GDOPParam.cs
  39. 1 1
      XdCxRhDW.App/UserControl/X2D1GDOPParam.cs
  40. 1 1
      XdCxRhDW.App/UserControl/X2DFGDOPParam.cs
  41. 1 1
      XdCxRhDW.App/UserControl/X3DFGDOPParam .cs
  42. 1 1
      XdCxRhDW.App/UserControl/X3GDOPParam.cs
  43. 67 2
      XdCxRhDW.App/XdCxRhDW.App.csproj
  44. 21 0
      XdCxRhDW.App/packages.config
  45. 5 6
      XdCxRhDW.Repostory/04.XdCxRhDW.Repostory.csproj
  46. 80 0
      XdCxRhDW.Repostory/EFContext/MySqlContext.cs
  47. 15 42
      XdCxRhDW.Repostory/EFContext/RHDWContext.cs
  48. 5 5
      XdCxRhDW.Repostory/XlRepository.cs
  49. 1 1
      XdCxRhDW.Repostory/app.config
  50. 2 2
      XdCxRhDW.Repostory/packages.config

+ 19 - 120
XdCxRhDW.App/App.config

@@ -1,7 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
 <configuration>
+	<configSections>
+		<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
+	</configSections>
 	<connectionStrings>
 		<add name="DbCon" connectionString="Data Source=Database.db" providerName="System.Data.SQLite.EF6" />
+		<add name="MySql" connectionString="server=192.168.1.5;uid=root;pwd=123456;database=test" providerName="MySql.Data.MySqlClient" />
 		<add name="LogDbCon" connectionString="Data Source=Log.db" providerName="System.Data.SQLite.EF6" />
 	</connectionStrings>
 	<appSettings>
@@ -31,124 +35,19 @@
 	<startup>
 		<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
 	</startup>
-  <runtime>
-    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
-      <dependentAssembly>
-        <assemblyIdentity name="System.Threading.Tasks.Extensions" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Serilog" publicKeyToken="24c2f752a8e58a10" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Diagnostics.DiagnosticSource" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-6.0.2.0" newVersion="6.0.2.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Numerics.Vectors" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-4.1.5.0" newVersion="4.1.5.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Threading.Channels" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Npgsql" publicKeyToken="5d8b90d52f46fda7" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-8.0.7.0" newVersion="8.0.7.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.IO.Pipelines" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Google.Protobuf" publicKeyToken="a7d26565bac4d604" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-3.30.1.0" newVersion="3.30.1.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="ZstdSharp" publicKeyToken="8d151af33a4ad5cf" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-0.8.5.0" newVersion="0.8.5.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Formats.Asn1" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Text.Encodings.Web" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Microsoft.Bcl.HashCode" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Microsoft.Extensions.Logging.Abstractions" publicKeyToken="adb9793829ddae60" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-9.0.0.3" newVersion="9.0.0.3" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Microsoft.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Autofac" publicKeyToken="17863af14b0044da" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-8.2.0.0" newVersion="8.2.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Web.Http" publicKeyToken="31bf3856ad364e35" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Web.Http.Owin" publicKeyToken="31bf3856ad364e35" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Microsoft.Owin.Security" publicKeyToken="31bf3856ad364e35" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-4.2.2.0" newVersion="4.2.2.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="System.Web.Cors" publicKeyToken="31bf3856ad364e35" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="Microsoft.Web.Infrastructure" publicKeyToken="31bf3856ad364e35" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="2.0.0.0" />
-      </dependentAssembly>
-      <dependentAssembly>
-        <assemblyIdentity name="MySql.Data" publicKeyToken="c5687fc88969c44d" culture="neutral" />
-        <bindingRedirect oldVersion="0.0.0.0-9.2.0.0" newVersion="9.2.0.0" />
-      </dependentAssembly>
-    </assemblyBinding>
-  </runtime>
+
+	<system.data>
+		<DbProviderFactories>
+			<add
+			 name="MySQL Data Provider"
+			 invariant="MySql.Data.MySqlClient"
+			 description=".Net Framework Data Provider for MySQL"
+			 type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data" />
+		</DbProviderFactories>
+	</system.data>
+	<entityFramework>
+		<providers>
+			<provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=9.3.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d"></provider>
+		</providers>
+	</entityFramework>
 </configuration>

+ 2 - 2
XdCxRhDW.App/Controllers/FindRefController.cs

@@ -28,7 +28,7 @@ namespace XdCxRhDW.App.Controllers
             try
             {
                 TaskInfo runTask;
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     if (dto.TaskID == null)
                     {
@@ -76,7 +76,7 @@ namespace XdCxRhDW.App.Controllers
             try
             {
                 TaskInfo runTask;
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     if (dto.TaskID == null)
                     {

+ 4 - 4
XdCxRhDW.App/Controllers/LogController.cs

@@ -34,7 +34,7 @@ namespace XdCxRhDW.App.Controllers
         {
             try
             {
-                using (RHDWLogContext db = new RHDWLogContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     LogRes res = new LogRes()
                     {
@@ -71,7 +71,7 @@ namespace XdCxRhDW.App.Controllers
         {
             try
             {
-                using (RHDWLogContext db = new RHDWLogContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var query = db.LogRes.AsQueryable();
                     if (!string.IsNullOrWhiteSpace(dto.Module) && dto.Module != "全部")
@@ -114,7 +114,7 @@ namespace XdCxRhDW.App.Controllers
         {
             try
             {
-                using (RHDWLogContext db = new RHDWLogContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var res = await db.LogRes.Select(p => p.Module).Distinct().ToListAsync();
                     var dtoRes = res.Select(p => new LogModulesResDto()
@@ -150,7 +150,7 @@ namespace XdCxRhDW.App.Controllers
             try
             {
                 var ids = dto.Select(p => p.ID);
-                using (RHDWLogContext db = new RHDWLogContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var delItems = await db.LogRes.Where(p => ids.Contains(p.ID)).ToListAsync();
                     var delItemsReal = db.LogRes.RemoveRange(delItems);

+ 57 - 56
XdCxRhDW.App/Controllers/PosController.cs

@@ -36,7 +36,7 @@ namespace XdCxRhDW.App.Controllers
         public async Task<AjaxResult<PosResDto>> PosX1D1Async(X1D1PosDto dto)
         {
             TaskInfo runTask;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 if (dto.TaskID == null)
                 {
@@ -59,7 +59,7 @@ namespace XdCxRhDW.App.Controllers
                 }
             }
 
-            using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+            using (MySqlContext db=new MySqlContext())
             {
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -140,7 +140,7 @@ namespace XdCxRhDW.App.Controllers
         public async Task<AjaxResult<PosResDto>> PosX1D1NoXlAsync(X1D1NoXlPosDto dto)
         {
             TaskInfo runTask;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 if (dto.TaskID == null)
                 {
@@ -176,8 +176,9 @@ namespace XdCxRhDW.App.Controllers
                 XdCxRhDW.Framework.LogHelper.Error($"推算卫星{dto.MainCode}的ECEF星历出错.{ephMain.msg}");
                 return Error<PosResDto>($"推算卫星{dto.MainCode}的ECEF星历出错");
             }
-            using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+            using (MySqlContext db=new MySqlContext())
             {
+                
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
                     SatTxLon = dto.SatTxLon,
@@ -268,7 +269,7 @@ namespace XdCxRhDW.App.Controllers
             {
                 TaskInfo runTask;
                 TargetInfo target = null;
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     if (dto.TaskID == null)
                     {
@@ -293,7 +294,7 @@ namespace XdCxRhDW.App.Controllers
                 }
                 if (!string.IsNullOrWhiteSpace(dto.Target))
                 {
-                    using (RHDWContext db = RHDWContext.GetContext())
+                    using (MySqlContext db = new MySqlContext())
                     {
                         target = await db.TargetInfos.FirstOrDefaultAsync(p => p.TargetName == dto.Target.Trim());
                         if (target == null)
@@ -307,7 +308,7 @@ namespace XdCxRhDW.App.Controllers
                         }
                     }
                 }
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
                     var StationRes = db.StationRes.Add(new StationRes()
                     {
@@ -398,9 +399,9 @@ namespace XdCxRhDW.App.Controllers
             }
             catch (Exception)
             {
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
-                    db.SyncDb();
+                    //db.SyncDb();
                 }
                 throw;
             }
@@ -417,7 +418,7 @@ namespace XdCxRhDW.App.Controllers
             {
                 TaskInfo runTask;
                 TargetInfo target = null;
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     if (dto.TaskID == null)
                     {
@@ -441,7 +442,7 @@ namespace XdCxRhDW.App.Controllers
                 }
                 if (!string.IsNullOrWhiteSpace(dto.Target))
                 {
-                    using (RHDWContext db = RHDWContext.GetContext())
+                    using (MySqlContext db = new MySqlContext())
                     {
                         target = await db.TargetInfos.FirstOrDefaultAsync(p => p.TargetName == dto.Target.Trim());
                         if (target == null)
@@ -506,7 +507,7 @@ namespace XdCxRhDW.App.Controllers
                 //dto.AdjaYbDto = Math.Round(refdt2 * 1e6, 3);
 
 
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
                     var StationRes = db.StationRes.Add(new StationRes()
                     {
@@ -615,9 +616,9 @@ namespace XdCxRhDW.App.Controllers
             }
             catch (Exception)
             {
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
-                    db.SyncDb();
+                    //db.SyncDb();
                 }
                 throw;
             }
@@ -635,7 +636,7 @@ namespace XdCxRhDW.App.Controllers
             {
                 TaskInfo runTask;
                 TargetInfo target = null;
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     if (dto.TaskID == null)
                     {
@@ -659,7 +660,7 @@ namespace XdCxRhDW.App.Controllers
                 }
                 if (!string.IsNullOrWhiteSpace(dto.Target))
                 {
-                    using (RHDWContext db = RHDWContext.GetContext())
+                    using (MySqlContext db = new MySqlContext())
                     {
                         target = await db.TargetInfos.FirstOrDefaultAsync(p => p.TargetName == dto.Target.Trim());
                         if (target == null)
@@ -673,7 +674,7 @@ namespace XdCxRhDW.App.Controllers
                         }
                     }
                 }
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
                     var StationRes = db.StationRes.Add(new StationRes()
                     {
@@ -755,9 +756,9 @@ namespace XdCxRhDW.App.Controllers
             }
             catch (Exception)
             {
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
-                    db.SyncDb();
+                    //db.SyncDb();
                 }
                 throw;
             }
@@ -775,7 +776,7 @@ namespace XdCxRhDW.App.Controllers
             {
                 TaskInfo runTask;
                 TargetInfo target = null;
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     if (dto.TaskID == null)
                     {
@@ -799,7 +800,7 @@ namespace XdCxRhDW.App.Controllers
                 }
                 if (!string.IsNullOrWhiteSpace(dto.Target))
                 {
-                    using (RHDWContext db = RHDWContext.GetContext())
+                    using (MySqlContext db = new MySqlContext())
                     {
                         target = await db.TargetInfos.FirstOrDefaultAsync(p => p.TargetName == dto.Target.Trim());
                         if (target == null)
@@ -856,7 +857,7 @@ namespace XdCxRhDW.App.Controllers
                 //dto.SxDto = dto1 * 1e6 + r.Next(-10, 10) + Math.Round(r.NextDouble(), 3);
                 //dto.XdDto = dto2 * 1e6 + r.Next(-10, 10) + Math.Round(r.NextDouble(), 3);
 
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
                     var StationRes = db.StationRes.Add(new StationRes()
                     {
@@ -940,9 +941,9 @@ namespace XdCxRhDW.App.Controllers
             }
             catch (Exception)
             {
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
-                    db.SyncDb();
+                    //db.SyncDb();
                 }
                 throw;
             }
@@ -959,7 +960,7 @@ namespace XdCxRhDW.App.Controllers
         public async Task<AjaxResult<PosResDto>> PosRhAsync(RHPosDto dto)
         {
             TaskInfo runTask;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 if (dto.TaskID == null)
                 {
@@ -981,7 +982,7 @@ namespace XdCxRhDW.App.Controllers
                     }
                 }
             }
-            using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+            using (MySqlContext db=new MySqlContext())
             {
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -1074,7 +1075,7 @@ namespace XdCxRhDW.App.Controllers
         public async Task<AjaxResult<PosResDto>> PosRhNoXlAsync(RHNoXlPosDto dto)
         {
             TaskInfo runTask;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 if (dto.TaskID == null)
                 {
@@ -1124,7 +1125,7 @@ namespace XdCxRhDW.App.Controllers
                 XdCxRhDW.Framework.LogHelper.Error($"推算卫星{dto.AdjaCode}的ECEF星历出错.{ephAdja.msg}");
                 return Error<PosResDto>($"推算卫星{dto.AdjaCode}的ECEF星历出错");
             }
-            using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+            using (MySqlContext db=new MySqlContext())
             {
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -1229,7 +1230,7 @@ namespace XdCxRhDW.App.Controllers
             {
                 TaskInfo runTask;
                 TargetInfo target = null;
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     if (dto.TaskID == null)
                     {
@@ -1253,7 +1254,7 @@ namespace XdCxRhDW.App.Controllers
                 }
                 if (!string.IsNullOrWhiteSpace(dto.Target))
                 {
-                    using (RHDWContext db = RHDWContext.GetContext())
+                    using (MySqlContext db = new MySqlContext())
                     {
                         target = await db.TargetInfos.FirstOrDefaultAsync(p => p.TargetName == dto.Target.Trim());
                         if (target == null)
@@ -1267,7 +1268,7 @@ namespace XdCxRhDW.App.Controllers
                         }
                     }
                 }
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
                     var StationRes = db.StationRes.Add(new StationRes()
                     {
@@ -1360,9 +1361,9 @@ namespace XdCxRhDW.App.Controllers
             }
             catch (Exception)
             {
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
-                    db.SyncDb();
+                    //db.SyncDb();
                 }
                 throw;
             }
@@ -1379,7 +1380,7 @@ namespace XdCxRhDW.App.Controllers
             {
                 TaskInfo runTask;
                 TargetInfo target = null;
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     if (dto.TaskID == null)
                     {
@@ -1403,7 +1404,7 @@ namespace XdCxRhDW.App.Controllers
                 }
                 if (!string.IsNullOrWhiteSpace(dto.Target))
                 {
-                    using (RHDWContext db = RHDWContext.GetContext())
+                    using (MySqlContext db = new MySqlContext())
                     {
                         target = await db.TargetInfos.FirstOrDefaultAsync(p => p.TargetName == dto.Target.Trim());
                         if (target == null)
@@ -1459,7 +1460,7 @@ namespace XdCxRhDW.App.Controllers
                     XdCxRhDW.Framework.LogHelper.Error($"推算卫星{dto.Adja2Code}的ECEF星历出错.{ephAdja2.msg}");
                     return Error<PosResDto>($"推算卫星{dto.Adja2Code}的ECEF星历出错");
                 }
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
                     var StationRes = db.StationRes.Add(new StationRes()
                     {
@@ -1555,9 +1556,9 @@ namespace XdCxRhDW.App.Controllers
             }
             catch (Exception)
             {
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
-                    db.SyncDb();
+                    //db.SyncDb();
                 }
                 throw;
             }
@@ -1575,7 +1576,7 @@ namespace XdCxRhDW.App.Controllers
             {
                 TaskInfo runTask;
                 TargetInfo target = null;
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     if (dto.TaskID == null)
                     {
@@ -1599,7 +1600,7 @@ namespace XdCxRhDW.App.Controllers
                 }
                 if (!string.IsNullOrWhiteSpace(dto.Target))
                 {
-                    using (RHDWContext db = RHDWContext.GetContext())
+                    using (MySqlContext db = new MySqlContext())
                     {
                         target = await db.TargetInfos.FirstOrDefaultAsync(p => p.TargetName == dto.Target.Trim());
                         if (target == null)
@@ -1613,7 +1614,7 @@ namespace XdCxRhDW.App.Controllers
                         }
                     }
                 }
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
                     var StationRes = db.StationRes.Add(new StationRes()
                     {
@@ -1700,9 +1701,9 @@ namespace XdCxRhDW.App.Controllers
             }
             catch (Exception)
             {
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
-                    db.SyncDb();
+                    //db.SyncDb();
                 }
                 throw;
             }
@@ -1719,7 +1720,7 @@ namespace XdCxRhDW.App.Controllers
             {
                 TaskInfo runTask;
                 TargetInfo target = null;
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     if (dto.TaskID == null)
                     {
@@ -1743,7 +1744,7 @@ namespace XdCxRhDW.App.Controllers
                 }
                 if (!string.IsNullOrWhiteSpace(dto.Target))
                 {
-                    using (RHDWContext db = RHDWContext.GetContext())
+                    using (MySqlContext db = new MySqlContext())
                     {
                         target = await db.TargetInfos.FirstOrDefaultAsync(p => p.TargetName == dto.Target.Trim());
                         if (target == null)
@@ -1799,7 +1800,7 @@ namespace XdCxRhDW.App.Controllers
                     XdCxRhDW.Framework.LogHelper.Error($"推算卫星{dto.Adja2Code}的ECEF星历出错.{ephAdja2.msg}");
                     return Error<PosResDto>($"推算卫星{dto.Adja2Code}的ECEF星历出错");
                 }
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
                     var StationRes = db.StationRes.Add(new StationRes()
                     {
@@ -1890,9 +1891,9 @@ namespace XdCxRhDW.App.Controllers
             }
             catch (Exception)
             {
-                using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+                using (MySqlContext db=new MySqlContext())
                 {
-                    db.SyncDb();
+                    //db.SyncDb();
                 }
                 throw;
             }
@@ -1909,7 +1910,7 @@ namespace XdCxRhDW.App.Controllers
         public async Task<AjaxResult<PosResDto>> PosX3TwoDfoAsync(X3TwoDfoPosDto dto)
         {
             TaskInfo runTask;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 if (dto.TaskID == null)
                 {
@@ -1931,7 +1932,7 @@ namespace XdCxRhDW.App.Controllers
                     }
                 }
             }
-            using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+            using (MySqlContext db=new MySqlContext())
             {
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -2029,7 +2030,7 @@ namespace XdCxRhDW.App.Controllers
         public async Task<AjaxResult<PosResDto>> PosX3TwoDfoNoXlAsync(X3TwoDfoNoXlPosDto dto)
         {
             TaskInfo runTask;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 if (dto.TaskID == null)
                 {
@@ -2093,7 +2094,7 @@ namespace XdCxRhDW.App.Controllers
                 XdCxRhDW.Framework.LogHelper.Error($"推算卫星{dto.Adja2Code}的ECEF星历出错.{ephAdja2.msg}");
                 return Error<PosResDto>($"推算卫星{dto.Adja2Code}的ECEF星历出错");
             }
-            using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+            using (MySqlContext db=new MySqlContext())
             {
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -2197,7 +2198,7 @@ namespace XdCxRhDW.App.Controllers
         public async Task<AjaxResult<PosResDto>> PosX2DtoDfoAsync(X2DtoDfoPosDto dto)
         {
             TaskInfo runTask;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 if (dto.TaskID == null)
                 {
@@ -2219,7 +2220,7 @@ namespace XdCxRhDW.App.Controllers
                     }
                 }
             }
-            using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+            using (MySqlContext db=new MySqlContext())
             {
                 var StationRes = db.StationRes.Add(new StationRes()
                 {
@@ -2310,7 +2311,7 @@ namespace XdCxRhDW.App.Controllers
         public async Task<AjaxResult<PosResDto>> PosX2DtoDfoNoXlAsync(X2DtoDfoNoXlPosDto dto)
         {
             TaskInfo runTask;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 if (dto.TaskID == null)
                 {
@@ -2360,7 +2361,7 @@ namespace XdCxRhDW.App.Controllers
                 XdCxRhDW.Framework.LogHelper.Error($"推算卫星{dto.AdjaCode}的ECEF星历出错.{ephAdja.msg}");
                 return Error<PosResDto>($"推算卫星{dto.AdjaCode}的ECEF星历出错");
             }
-            using (RHDWPartContext db = RHDWPartContext.GetContext(dto.SigTime, true))
+            using (MySqlContext db=new MySqlContext())
             {
                 var StationRes = db.StationRes.Add(new StationRes()
                 {

+ 11 - 11
XdCxRhDW.App/Controllers/ResultController.cs

@@ -53,7 +53,7 @@ namespace XdCxRhDW.App.Controllers
                 foreach (var item in list)
                 {
                     var dayFile = Path.Combine(dir, item);
-                    using (RHDWPartContext db = RHDWPartContext.GetContext(dayFile, readOnly: true))
+                    using (MySqlContext db=new MySqlContext())
                     {
                         if (db == null) continue;
                         var query = db.PosRes.Where(p => p.Deleted == 0 && p.SigTime >= start && p.SigTime <= end && p.TaskInfoID == dto.TaskInfoID);
@@ -105,7 +105,7 @@ namespace XdCxRhDW.App.Controllers
                     var dayFiles = Directory.EnumerateFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, yearDir), "*.db").OrderByDescending(p => Convert.ToInt32(new DirectoryInfo(p).Name.Substring(0, 4)));
                     foreach (var dayFile in dayFiles)
                     {
-                        using (RHDWPartContext db = RHDWPartContext.GetContext(dayFile, readOnly: true))
+                        using (MySqlContext db=new MySqlContext())
                         {
                             if (db == null) continue;
 
@@ -137,7 +137,7 @@ namespace XdCxRhDW.App.Controllers
         {
             try
             {
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     var tasks = await db.TaskInfos.Where(p => p.TaskState == EnumTaskState.Running).ToListAsync();
                     var res = tasks.Select(t => new TaskQueryResDto()
@@ -227,14 +227,14 @@ namespace XdCxRhDW.App.Controllers
                 }
                 end = dto.EndTime;
                 List<TargetInfo> targets;
-                using (RHDWContext dbBasic = RHDWContext.GetContext(true))
+                using (MySqlContext db=new MySqlContext())
                 {
-                    targets = await dbBasic.TargetInfos.ToListAsync();
+                    targets = await db.TargetInfos.ToListAsync();
                 }
                 foreach (var item in list)
                 {
                     var dayFile = Path.Combine(dir, item);
-                    using (RHDWPartContext db = RHDWPartContext.GetContext(dayFile, readOnly: true))
+                    using (MySqlContext db=new MySqlContext())
                     {
                         for (int i = 0; i < 2; i++)
                         {
@@ -268,7 +268,7 @@ namespace XdCxRhDW.App.Controllers
                             catch (Exception ex)
                             {
                                 LogHelper.Warning($"分区表结构不是最新,DayFile={dayFile},即将自动修改结构", ex).Wait(5000);
-                                db.SyncDb();
+                                //db.SyncDb();
                             }
                         }
 
@@ -309,14 +309,14 @@ namespace XdCxRhDW.App.Controllers
                 }
                 end = dto.EndTime;
                 List<TargetInfo> targets;
-                using (RHDWContext dbBasic = RHDWContext.GetContext(true))
+                using (MySqlContext db=new MySqlContext())
                 {
-                    targets = await dbBasic.TargetInfos.ToListAsync();
+                    targets = await db.TargetInfos.ToListAsync();
                 }
                 foreach (var item in list)
                 {
                     var dayFile = Path.Combine(dir, item);
-                    using (RHDWPartContext db = RHDWPartContext.GetContext(dayFile, readOnly: true))
+                    using (MySqlContext db=new MySqlContext())
                     {
                         if (db == null) continue;
                         var query = db.PosRes.Where(p => p.Deleted == 0 && p.SigTime >= start && p.SigTime <= end && p.TaskInfoID == dto.TaskInfoID);
@@ -396,7 +396,7 @@ namespace XdCxRhDW.App.Controllers
                             if (!int.TryParse(fileName, out _))
                                 continue;//副本db文件之类的不查询
                         }
-                        using (RHDWPartContext db = RHDWPartContext.GetContext(dayFile, readOnly: true))
+                        using (MySqlContext db=new MySqlContext())
                         {
                             if (db == null) continue;
                             var query = db.PosRes.Where(p => p.Deleted == 0 && p.TaskInfoID == dto.TaskInfoID);

+ 1 - 1
XdCxRhDW.App/Controllers/TaskController.cs

@@ -52,7 +52,7 @@ namespace XdCxRhDW.App.Controllers
         {
             try
             {
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var item = await db.TaskInfos.FirstOrDefaultAsync(p => p.ID == dto.ID);
                     if (item == null)

+ 1 - 1
XdCxRhDW.App/Controllers/XlController.cs

@@ -79,7 +79,7 @@ namespace XdCxRhDW.App.Controllers
                      }
                      Parallel.For(0, 50, i =>
                      {
-                         using (RHDWContext db = RHDWContext.GetContext())
+                         using (MySqlContext db = new MySqlContext())
                          {
                              db.XlInfos.AddRange(tmp);
                              db.SaveChanges();

+ 1 - 1
XdCxRhDW.App/CorTools/XlCalculateForm.cs

@@ -30,7 +30,7 @@ namespace XdCxRhDW.App.CorTools
             InitializeComponent();
             this.itemTle.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
             List<SatInfo> list1 = new List<SatInfo>();//配置的卫星
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 list1 = db.SatInfos.OrderBy(p=>p.SatCode).ToList();
             }

+ 1 - 1
XdCxRhDW.App/EditForms/EditorTar.cs

@@ -31,7 +31,7 @@ namespace XdCxRhDW.App.EditForms
         private async void SatEditor_Load(object sender, EventArgs e)
         {
             infos = new List<TargetInfo>();
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 var res = await db.TargetInfos.OrderBy(p => p.TargetName).ToListAsync();
                 infos.AddRange(res);

+ 1 - 1
XdCxRhDW.App/EditForms/FixedStationEditor.cs

@@ -40,7 +40,7 @@ namespace XdCxRhDW.App.EditForms
         {
             infos = new List<FixedStation>();
             List<SigInfo> sigs;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 var res = await db.FixedStation.ToListAsync();
                 infos.AddRange(res);

+ 2 - 2
XdCxRhDW.App/EditForms/RHDTOParamEditor.cs

@@ -41,11 +41,11 @@ namespace XdCxRhDW.App.EditForms
 
             StationRes station = null;
             CxRes cx = null;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 listSat = await db.SatInfos.ToListAsync();
             }
-            using (RHDWPartContext db = RHDWPartContext.GetContext(info.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 cg = await db?.CgRes.Where(m => m.ID == info.CgResID).FirstOrDefaultAsync();
                 cx = await db?.CxRes.Where(m => m.ID == info.CxResID).FirstOrDefaultAsync();

+ 1 - 1
XdCxRhDW.App/EditForms/SatEditor.cs

@@ -48,7 +48,7 @@ namespace XdCxRhDW.App.EditForms
                 this.searchLookUpEdit1.EditValue = info.Sat;
             }
             infos = new List<SatInfo>();
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 var res = await db.SatInfos.ToListAsync();
                 infos.AddRange(res);

+ 2 - 2
XdCxRhDW.App/EditForms/SigDelayEditor.cs

@@ -43,7 +43,7 @@ namespace XdCxRhDW.App.EditForms
         private async void SatEditor_Load(object sender, EventArgs e)
         {
             List<SatInfo> sats;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 sats = await db.SatInfos.ToListAsync();
             }
@@ -76,7 +76,7 @@ namespace XdCxRhDW.App.EditForms
                 }
                 var satInfo = (SatInfo)txtSat.EditValue;
                 List<SigDelay> list;
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     list = await db.SigDelays.Where(w => w.SigInfoId == sigId).ToListAsync();
                 }

+ 1 - 1
XdCxRhDW.App/EditForms/SigEditor.cs

@@ -59,7 +59,7 @@ namespace XdCxRhDW.App.EditForms
                 }
             }
             infos = new List<SigInfo>();
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 var res = await db.SigInfos.ToListAsync();
                 infos.AddRange(res);

+ 1 - 1
XdCxRhDW.App/EditForms/TargetEditor.cs

@@ -45,7 +45,7 @@ namespace XdCxRhDW.App.EditForms
                 this.txtTarColor.EditValue = clolrRes;
             }
             infos = new List<TargetInfo>();
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 var res =await db.TargetInfos.ToListAsync();
                 infos.AddRange(res);

+ 4 - 4
XdCxRhDW.App/EditForms/TaskEditor.cs

@@ -66,7 +66,7 @@ namespace XdCxRhDW.App.EditForms
         private async void TaskEditor_Load(object sender, EventArgs e)
         {
             List<SatInfo> sats;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 sats = await db.SatInfos.ToListAsync();
             }
@@ -81,7 +81,7 @@ namespace XdCxRhDW.App.EditForms
                 this.txtTaskType.SelectedIndex = (int)info.TaskType;
                 txtCapDir.Text = info.CapDir;
                 txtCapDirFormat.Text = info.CapDirFormat;
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     var satMain = await db.SatInfos.Where(w => w.SatCode == info.MainSat).FirstOrDefaultAsync();
                     var satAdja1 = await db.SatInfos.Where(w => w.SatCode == info.Adja1Sat).FirstOrDefaultAsync();
@@ -113,7 +113,7 @@ namespace XdCxRhDW.App.EditForms
 
                 if (this.Text == "添加任务")
                 {
-                    using (RHDWContext db = RHDWContext.GetContext(true))
+                    using (MySqlContext db = new MySqlContext())
                     {
                         if (db.TaskInfos.Any(p => p.TaskName == txtTaskName.Text))
                         {
@@ -124,7 +124,7 @@ namespace XdCxRhDW.App.EditForms
                 }
                 else
                 {
-                    using (RHDWContext db = RHDWContext.GetContext(true))
+                    using (MySqlContext db = new MySqlContext())
                     {
                         if (db.TaskInfos.Any(p => p.ID != info.ID && p.TaskName == txtTaskName.Text))
                         {

+ 1 - 1
XdCxRhDW.App/EditForms/TaskEditorSignal.cs

@@ -56,7 +56,7 @@ namespace XdCxRhDW.App.EditForms
             try
             {
                 gridTaskSignal.UseDefault(listSigInfo).UseMultiSelect().UseRowNumber().DrawGridColumnHeaderCheckBox();
-                using (var db = RHDWContext.GetContext(true))
+                using (MySqlContext db=new MySqlContext())
                 {
                     var fixedStations = await db.FixedStation.Where(p => p.Enable).ToListAsync();
                     var items = await db.SigInfos.OrderBy(p => p.FreqUp).ToListAsync();

+ 2 - 2
XdCxRhDW.App/EditForms/X1D1DTOParamEditor.cs

@@ -40,11 +40,11 @@ namespace XdCxRhDW.App.EditForms
         private async void X1D1DTOParamEditor_Load(object sender, EventArgs e)
         {
             this.layoutControl1.BestFit();
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 listSat = await db.SatInfos.ToListAsync();
             }
-            using (RHDWPartContext db = RHDWPartContext.GetContext(info.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 cg = await db?.CgRes.Where(m => m.ID == info.CgResID).FirstOrDefaultAsync();
                 cx = await db?.CxRes.Where(m => m.ID == info.CxResID).FirstOrDefaultAsync();

+ 2 - 2
XdCxRhDW.App/EditForms/X2D1DTOParamEditor.cs

@@ -43,11 +43,11 @@ namespace XdCxRhDW.App.EditForms
         {
             this.layoutControl1.BestFit();
             StationRes station = null;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 listSat = await db.SatInfos.ToListAsync();
             }
-            using (RHDWPartContext db = RHDWPartContext.GetContext(info.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 cg = await db?.CgRes.Where(m => m.ID == info.CgResID).FirstOrDefaultAsync();
                 station = await db?.StationRes.Where(m => m.ID == info.StationResID).FirstOrDefaultAsync();

+ 2 - 2
XdCxRhDW.App/EditForms/X2DTOParamEditor.cs

@@ -32,11 +32,11 @@ namespace XdCxRhDW.App.EditForms
         private async void X2DTOParamEditor_Load(object sender, EventArgs e)
         {
             this.layoutControl1.BestFit();
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 listSat = await db.SatInfos.ToListAsync();
             }
-            using (RHDWPartContext db = RHDWPartContext.GetContext(info.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 cg = await db?.CgRes.Where(m => m.ID == info.CgResID).FirstOrDefaultAsync();
                 station = await db?.StationRes.Where(m => m.ID == info.StationResID).FirstOrDefaultAsync();

+ 2 - 2
XdCxRhDW.App/EditForms/X3DTOParamEditor.cs

@@ -32,11 +32,11 @@ namespace XdCxRhDW.App.EditForms
         {
             this.layoutControl1.BestFit();
             StationRes station = null;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 listSat = await db.SatInfos.ToListAsync();
             }
-            using (RHDWPartContext db = RHDWPartContext.GetContext(info.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 cg = await db?.CgRes.Where(m => m.ID == info.CgResID).FirstOrDefaultAsync();
                 station = await db?.StationRes.Where(m => m.ID == info.StationResID).FirstOrDefaultAsync();

+ 2 - 2
XdCxRhDW.App/EditForms/X3DfoParamEditor.cs

@@ -32,11 +32,11 @@ namespace XdCxRhDW.App.EditForms
         private async void X3DTOParamEditor_Load(object sender, EventArgs e)
         {
             this.layoutControl1.BestFit();
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 listSat = await db.SatInfos.ToListAsync();
             }
-            using (RHDWPartContext db = RHDWPartContext.GetContext(info.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 cg = await db?.CgRes.Where(m => m.ID == info.CgResID).FirstOrDefaultAsync();
                 station = await db?.StationRes.Where(m => m.ID == info.StationResID).FirstOrDefaultAsync();

+ 3 - 3
XdCxRhDW.App/LogHelper.cs

@@ -17,7 +17,7 @@ namespace XdCxRhDW.App
             var pro = Process.GetCurrentProcess();
             try
             {
-                using (RHDWLogContext db = new RHDWLogContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     LogRes res = new LogRes()
                     {
@@ -41,7 +41,7 @@ namespace XdCxRhDW.App
             var pro = Process.GetCurrentProcess();
             try
             {
-                using (RHDWLogContext db = new RHDWLogContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     LogRes res = new LogRes()
                     {
@@ -71,7 +71,7 @@ namespace XdCxRhDW.App
             var pro = Process.GetCurrentProcess();
             try
             {
-                using (RHDWLogContext db = new RHDWLogContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     LogRes res = new LogRes()
                     {

+ 36 - 36
XdCxRhDW.App/MainForm.cs

@@ -76,7 +76,7 @@ namespace XdCxRhDW
         {
             this.text = this.Text;
             this.HtmlText = $"<size=12>{this.text}";
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 SysConfig.Config = db.SysSetings.FirstOrDefault();
             }
@@ -139,38 +139,38 @@ namespace XdCxRhDW
         {
             try
             {
-                using (RHDWContext db = RHDWContext.GetContext(true))
-                {
-                    if (File.Exists(db.DbFile))
-                    {
-                        FileInfo fInfo = new FileInfo(db.DbFile);
-                        if (fInfo.IsReadOnly)
-                        {
-                            fInfo.IsReadOnly = false;
-                        }
+                //using (MySqlContext db = new MySqlContext())
+                //{
+                //    if (File.Exists(db.DbFile))
+                //    {
+                //        FileInfo fInfo = new FileInfo(db.DbFile);
+                //        if (fInfo.IsReadOnly)
+                //        {
+                //            fInfo.IsReadOnly = false;
+                //        }
 
-                    }
+                //    }
 
-                }
-                using (RHDWLogContext db = new RHDWLogContext())
-                {
-                    if (File.Exists(db.DbFile))
-                    {
-                        FileInfo fInfo = new FileInfo(db.DbFile);
-                        if (fInfo.IsReadOnly)
-                        {
-                            fInfo.IsReadOnly = false;
-                        }
-                    }
-                }
-                using (RHDWContext db = RHDWContext.GetContext())
-                {
-                    db.SyncDb();
-                }
-                using (RHDWLogContext db = new RHDWLogContext())
-                {
-                    db.SyncDb();
-                }
+                //}
+                //using (MySqlContext db = new MySqlContext())
+                //{
+                //    if (File.Exists(db.DbFile))
+                //    {
+                //        FileInfo fInfo = new FileInfo(db.DbFile);
+                //        if (fInfo.IsReadOnly)
+                //        {
+                //            fInfo.IsReadOnly = false;
+                //        }
+                //    }
+                //}
+                //using (MySqlContext db = new MySqlContext())
+                //{
+                //    db.SyncDb();
+                //}
+                //using (MySqlContext db = new MySqlContext())
+                //{
+                //    db.SyncDb();
+                //}
             }
             catch (Exception ex)
             {
@@ -292,7 +292,7 @@ namespace XdCxRhDW
                 try
                 {
                     List<XlInfo> clearData = new List<XlInfo>();
-                    using (RHDWContext db = RHDWContext.GetContext())
+                    using (MySqlContext db = new MySqlContext())
                     {
                         DateTime dt = DateTime.Now.AddYears(-1);
                         clearData = await db.XlInfos.Where(p => p.UpdateTime < dt).Take(1000).ToListAsync();
@@ -329,7 +329,7 @@ namespace XdCxRhDW
                 {
                     List<XlInfo> calcItems = null;
                     List<SatInfo> satInfo = null;
-                    using (RHDWContext db = RHDWContext.GetContext(true))
+                    using (MySqlContext db = new MySqlContext())
                     {
                         calcItems = await db.XlInfos.Where(p => p.Lon == null).OrderByDescending(p => p.SatCode).Take(100).ToListAsync();
                         satInfo = await db.SatInfos.ToListAsync();
@@ -358,7 +358,7 @@ namespace XdCxRhDW
                             }
                             if (Level1.Any())
                             {
-                                using (RHDWContext db = RHDWContext.GetContext())
+                                using (MySqlContext db = new MySqlContext())
                                 {
                                     db.XlInfos.AddOrUpdate(Level1.ToArray());
                                     db.SaveChanges();
@@ -381,7 +381,7 @@ namespace XdCxRhDW
                             }
                             if (Level2.Any())
                             {
-                                using (RHDWContext db = RHDWContext.GetContext())
+                                using (MySqlContext db = new MySqlContext())
                                 {
                                     db.XlInfos.AddOrUpdate(Level2.ToArray());
                                     db.SaveChanges();
@@ -442,7 +442,7 @@ namespace XdCxRhDW
         {
             while (true)
             {
-                using (RHDWLogContext db = new RHDWLogContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     try
                     {

+ 3 - 3
XdCxRhDW.App/PopupControl/ShowCgCtrl.cs

@@ -37,12 +37,12 @@ namespace XdCxRhDW.App.PopupControl
         private async void ShowCgCtrl_Load(object sender, EventArgs e)
         {
             List<SatInfo> sats = null;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 sats = await db.SatInfos.ToListAsync();
             }
             List<ModelCg> list = new List<ModelCg>();
-            using (RHDWPartContext db = RHDWPartContext.GetContext(posItem.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 if (db == null) return;
                 var cgEntity = db.CgRes.Where(p => p.ID == posItem.CgResID).FirstOrDefault();
@@ -131,7 +131,7 @@ namespace XdCxRhDW.App.PopupControl
             var cgItem = e.Row as ModelCg;
             if (cgItem != null)
             {
-                using (RHDWPartContext db = RHDWPartContext.GetContext(cgItem.SigTime))
+                using (MySqlContext db=new MySqlContext())
                 {
                     if (db != null)
                     {

+ 1 - 1
XdCxRhDW.App/PopupControl/ShowCheckCtrl.cs

@@ -34,7 +34,7 @@ namespace XdCxRhDW.App.PopupControl
         {
             if (posItem.CheckResID == null)//没有检测结果
                 return;
-            using (RHDWPartContext db = RHDWPartContext.GetContext(posItem.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 if (db == null) return;
                 var items = await db.CheckRes.Where(p => p.ID == posItem.CheckResID).ToListAsync();

+ 1 - 1
XdCxRhDW.App/PopupControl/ShowCxCtrl.cs

@@ -32,7 +32,7 @@ namespace XdCxRhDW.App.PopupControl
         }
         private async void ShowCxCtrl_Load(object sender, EventArgs e)
         {
-            using (RHDWPartContext db = RHDWPartContext.GetContext(posItem.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 if (db == null) return;
                 var items = await db.CxRes.Where(p => p.ID == posItem.CxResID).ToListAsync();

+ 5 - 5
XdCxRhDW.App/UserControl/CtrlCgRes.cs

@@ -45,7 +45,7 @@ namespace XdCxRhDW.App.UserControl
             try
             {
                 List<TaskInfo> tskList = new List<TaskInfo>();
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     tskList = await db.TaskInfos.OrderByDescending(p => p.UpdateTime).ToListAsync();
                 }
@@ -68,7 +68,7 @@ namespace XdCxRhDW.App.UserControl
                 foreach (var groupItem in groupItems)
                 {
                     var ids = groupItem.Select(m => m.ID).ToList();
-                    using (RHDWPartContext db = RHDWPartContext.GetContext(groupItem.First().SigTime))
+                    using (MySqlContext db=new MySqlContext())
                     {
                         if (db != null)
                         {
@@ -165,7 +165,7 @@ namespace XdCxRhDW.App.UserControl
                         var dayFiles = Directory.EnumerateFiles(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, yearDir), "*.db").OrderByDescending(p => Convert.ToInt32(new DirectoryInfo(p).Name.Substring(0, 4)));
                         foreach (var dayFile in dayFiles)
                         {
-                            using (RHDWPartContext db = RHDWPartContext.GetContext(dayFile,readOnly:true))
+                            using (MySqlContext db=new MySqlContext())
                             {
                                 if (db == null) continue;
                                 if (db.CgRes.Any(p => p.TaskID == ((TaskInfo)txtTask.EditValue).ID))
@@ -190,7 +190,7 @@ namespace XdCxRhDW.App.UserControl
                 List<CgRes> list = new List<CgRes>();
                 while (endDay >= startDay)
                 {
-                    using (RHDWPartContext db = RHDWPartContext.GetContext(endDay, readOnly: true))
+                    using (MySqlContext db=new MySqlContext())
                     {
                         if (db != null)
                         {
@@ -205,7 +205,7 @@ namespace XdCxRhDW.App.UserControl
                                 catch (Exception ex)
                                 {
                                     LogHelper.Error($"同步分区表结构异常,Time={endDay:yyyyMMdd}", ex).Wait(5000);
-                                    db.SyncDb();
+                                    //db.SyncDb();
                                 }
                             }
 

+ 4 - 4
XdCxRhDW.App/UserControl/CtrlFixedStation.cs

@@ -26,7 +26,7 @@ namespace XdCxRhDW.App.UserControl
                     .UseAddAsync(Add)
                     .UseEditAsync<FixedStation>(Edit)
                     .UseDeleteAsync<FixedStation>(Delete).SetDisplayText(nameof(FixedStation.Value), val => $"{val}秒");
-                using (var db = RHDWContext.GetContext(true))
+                using (MySqlContext db=new MySqlContext())
                 {
                     var items = await db.FixedStation.OrderBy(p => p.StationName).ToListAsync();
                     list.AddRange(items);
@@ -46,7 +46,7 @@ namespace XdCxRhDW.App.UserControl
                 FixedStationEditor frm = new FixedStationEditor();
                 if (frm.ShowDialog() != DialogResult.OK) return null;
                 var addItem = frm.info;
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     db.FixedStation.Add(addItem);
                     await db.SaveChangesAsync();
@@ -68,7 +68,7 @@ namespace XdCxRhDW.App.UserControl
                 FixedStationEditor frm = new FixedStationEditor(editItem);
                 if (frm.ShowDialog() != DialogResult.OK) return null;
                 editItem = frm.info;
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var find = await db.FixedStation.Where(p => p.ID == editItem.ID).FirstOrDefaultAsync();
                     find.StationName = editItem.StationName;
@@ -95,7 +95,7 @@ namespace XdCxRhDW.App.UserControl
             try
             {
                 var ids = list.Select(p => p.ID);
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var delItems = await db.SatInfos.Where(p => ids.Contains(p.ID)).ToListAsync();
                     db.SatInfos.RemoveRange(delItems);

+ 17 - 17
XdCxRhDW.App/UserControl/CtrlHome.cs

@@ -64,7 +64,7 @@ namespace XdCxRhDW.App.UserControl
             {
                 var find = list.FirstOrDefault(p => p.ID == id);
                 if (find == null) return;
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     var item = await db.TaskInfos.FirstOrDefaultAsync(p => p.ID == id);
                     if (item == null) return;
@@ -137,7 +137,7 @@ namespace XdCxRhDW.App.UserControl
             try
             {
                 List<TxInfo> txList = new List<TxInfo>();
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var tasks = db.TaskInfos.OrderByDescending(p => p.UpdateTime).ToList();
                     list.AddRange(tasks);
@@ -359,7 +359,7 @@ namespace XdCxRhDW.App.UserControl
                 mapControl1.SetPosDataSource(listPos);
             }
             SatInfo sat1, sat2, sat3;
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 sat1 = db.SatInfos.Where(p => p.SatCode == tsk.MainSat).FirstOrDefault();
                 sat2 = db.SatInfos.Where(p => p.SatCode == tsk.Adja1Sat).FirstOrDefault();
@@ -404,7 +404,7 @@ namespace XdCxRhDW.App.UserControl
             mapControl1.DelFixedImg("Tx");
             var posItem = (e.Row as ModelPosRes);
             if (posItem == null) return;
-            using (RHDWPartContext db = RHDWPartContext.GetContext(posItem.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 var station = db?.StationRes.Where(p => p.ID == posItem.StationResID).FirstOrDefault();
                 if (station != null)
@@ -464,7 +464,7 @@ namespace XdCxRhDW.App.UserControl
                     if (frm.ShowDialog() != DialogResult.OK) return;
                     addItem = frm.info;
                     var addItemSignal = frm.selectedItem;
-                    using (RHDWContext db = RHDWContext.GetContext())
+                    using (MySqlContext db = new MySqlContext())
                     {
                         if (addItem.PosType == EnumPosType.X1D1CX)
                         {
@@ -508,7 +508,7 @@ namespace XdCxRhDW.App.UserControl
                 {
                     var editItem = gridView1.GetFocusedRow() as TaskInfo;
                     if (editItem == null) return;
-                    using (RHDWContext db = RHDWContext.GetContext())
+                    using (MySqlContext db = new MySqlContext())
                     {
 
                         List<TaskSig> taskSig = await db.TaskSigs.Where(w => w.TaskInfoID == editItem.ID).ToListAsync();
@@ -581,7 +581,7 @@ namespace XdCxRhDW.App.UserControl
                     if (tsk == null) return;
                     if (!DxHelper.MsgBoxHelper.ShowConfirm($"删除任务[{tsk.TaskName}]?"))
                         return;
-                    using (RHDWContext db = RHDWContext.GetContext())
+                    using (MySqlContext db = new MySqlContext())
                     {
                         var item = db.TaskInfos.FirstOrDefault(p => p.ID == tsk.ID);
                         db.TaskInfos.Remove(item);
@@ -614,7 +614,7 @@ namespace XdCxRhDW.App.UserControl
                         TxInfo cdb;
                         List<TaskSigDto> tskSigsDto = new List<TaskSigDto>();
                         List<FixedStation> fixedStations = null;
-                        using (RHDWContext db = RHDWContext.GetContext(true))
+                        using (MySqlContext db = new MySqlContext())
                         {
                             var dbSigs = await db.TaskSigs.Where(w => w.TaskInfoID == tsk.ID).Include(p => p.SigInfo).ToListAsync();
                             if (!dbSigs.Any())
@@ -719,7 +719,7 @@ namespace XdCxRhDW.App.UserControl
                             return;
                         }
                     }
-                    using (RHDWContext db = RHDWContext.GetContext())
+                    using (MySqlContext db = new MySqlContext())
                     {
                         var item = await db.TaskInfos.FirstOrDefaultAsync(p => p.ID == tsk.ID);
                         item.TaskState = EnumTaskState.Running;
@@ -738,7 +738,7 @@ namespace XdCxRhDW.App.UserControl
             {
                 try
                 {
-                    using (RHDWContext db = RHDWContext.GetContext())
+                    using (MySqlContext db = new MySqlContext())
                     {
                         var item = await db.TaskInfos.FirstOrDefaultAsync(p => p.ID == tsk.ID);
                         item.TaskState = EnumTaskState.Stopped;
@@ -954,7 +954,7 @@ namespace XdCxRhDW.App.UserControl
                 foreach (var groupItem in groupItems)
                 {
                     var ids = groupItem.Select(m => m.ID).ToList();
-                    using (RHDWPartContext db = RHDWPartContext.GetContext(groupItem.First().SigTime))
+                    using (MySqlContext db=new MySqlContext())
                     {
                         if (db == null) continue;
                         string sql = $"update posres set deleted=1 where deleted=0 and id in ({string.Join(",", ids)})";
@@ -987,7 +987,7 @@ namespace XdCxRhDW.App.UserControl
                 foreach (var groupItem in groupItems)
                 {
                     var ids = groupItem.Select(m => m.ID).ToList();
-                    using (RHDWPartContext db = RHDWPartContext.GetContext(groupItem.First().SigTime))
+                    using (MySqlContext db=new MySqlContext())
                     {
                         if (db == null) continue;
                         string sql = $"update posres set deleted=1 where deleted=0 and id in ({string.Join(",", ids)})";
@@ -1352,7 +1352,7 @@ namespace XdCxRhDW.App.UserControl
                 foreach (var groupItem in groupItems)
                 {
                     var ids = groupItem.Select(m => m.ID).ToList();
-                    using (RHDWPartContext db = RHDWPartContext.GetContext(groupItem.First().SigTime))
+                    using (MySqlContext db=new MySqlContext())
                     {
                         if (db == null) continue;
                         var tarItems = await db.PosRes.Where(p => p.Deleted == 0 && ids.Contains(p.ID)).ToArrayAsync();
@@ -1443,7 +1443,7 @@ namespace XdCxRhDW.App.UserControl
             {
                 if (items.Count == 0) return;
                 long? targetID = 0;
-                using (RHDWPartContext db = RHDWPartContext.GetContext(items.First().SigTime))
+                using (MySqlContext db=new MySqlContext())
                 {
                     if (db != null)
                     {
@@ -1455,7 +1455,7 @@ namespace XdCxRhDW.App.UserControl
                 TargetInfo info = null;
                 if (targetID > 0)
                 {
-                    using (RHDWContext db = RHDWContext.GetContext(true))
+                    using (MySqlContext db = new MySqlContext())
                     {
                         info = db.TargetInfos.FirstOrDefault(p => p.ID == targetID);
                     }
@@ -1469,7 +1469,7 @@ namespace XdCxRhDW.App.UserControl
                 foreach (var groupItems in groupData)
                 {
                     var ids = groupItems.Select(p => p.ID);
-                    using (RHDWPartContext db = RHDWPartContext.GetContext(groupItems.First().SigTime))
+                    using (MySqlContext db=new MySqlContext())
                     {
                         if (db == null) continue;
                         var tarItems = await db.PosRes.Where(p => p.Deleted == 0 && ids.Contains(p.ID)).ToArrayAsync();
@@ -1545,7 +1545,7 @@ namespace XdCxRhDW.App.UserControl
                 foreach (var groupItem in groupItems)
                 {
                     var ids = groupItem.Select(m => m.ID).ToList();
-                    using (RHDWPartContext db = RHDWPartContext.GetContext(groupItem.First().SigTime))
+                    using (MySqlContext db=new MySqlContext())
                     {
                         if (db == null) continue;
                         var array = await db.PosRes.Where(p => p.Deleted == 0 && ids.Contains(p.ID)).ToArrayAsync();

+ 4 - 4
XdCxRhDW.App/UserControl/CtrlSat.cs

@@ -26,7 +26,7 @@ namespace XdCxRhDW.App.UserControl
                     .UseAddAsync(Add)
                     .UseEditAsync<SatInfo>(Edit)
                     .UseDeleteAsync<SatInfo>(Delete);
-                using (var db = RHDWContext.GetContext(true))
+                using (MySqlContext db=new MySqlContext())
                 {
                     var items = await db.SatInfos.OrderBy(p => p.SatName).ToListAsync();
                     list.AddRange(items);
@@ -46,7 +46,7 @@ namespace XdCxRhDW.App.UserControl
                 SatEditor frm = new SatEditor();
                 if (frm.ShowDialog() != DialogResult.OK) return null;
                 var addItem = frm.info;
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     db.SatInfos.Add(addItem);
                     await db.SaveChangesAsync();
@@ -68,7 +68,7 @@ namespace XdCxRhDW.App.UserControl
                 SatEditor frm = new SatEditor(editItem);
                 if (frm.ShowDialog() != DialogResult.OK) return null;
                 editItem = frm.info;
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var find = await db.SatInfos.Where(p => p.ID == editItem.ID).FirstOrDefaultAsync();
                     find.SatName = editItem.SatName;
@@ -92,7 +92,7 @@ namespace XdCxRhDW.App.UserControl
             try
             {
                 var ids = list.Select(p => p.ID);
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var delItems = await db.SatInfos.Where(p => ids.Contains(p.ID)).ToListAsync();
                     db.SatInfos.RemoveRange(delItems);

+ 8 - 8
XdCxRhDW.App/UserControl/CtrlSignal.cs

@@ -38,7 +38,7 @@ namespace XdCxRhDW.App.UserControl
                    .UseEditAsync<SigDelay>(EditSigDelay)
                    .UseDeleteAsync<SigDelay>(DeleteSigDelay);
 
-                using (var db = RHDWContext.GetContext(true))
+                using (MySqlContext db=new MySqlContext())
                 {
                     var items = await db.SigInfos.OrderBy(p=>p.FreqUp).ToListAsync();
                     listSigInfo.AddRange(items);
@@ -69,7 +69,7 @@ namespace XdCxRhDW.App.UserControl
                 SigEditor frm = new SigEditor();
                 if (frm.ShowDialog() != DialogResult.OK) return null;
                 var addItem = frm.info;
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var sig = db.SigInfos.Add(addItem);
                     await db.SaveChangesAsync();
@@ -90,7 +90,7 @@ namespace XdCxRhDW.App.UserControl
                 SigEditor frm = new SigEditor(editItem);
                 if (frm.ShowDialog() != DialogResult.OK) return null;
                 editItem = frm.info;
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var find = await db.SigInfos.Where(p => p.ID == editItem.ID).FirstOrDefaultAsync();
                     find.FreqUp = editItem.FreqUp;
@@ -115,7 +115,7 @@ namespace XdCxRhDW.App.UserControl
             try
             {
                 var ids = list.Select(p => p.ID);
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var delayItems= db.SigDelays.Where(p => ids.Contains(p.SigInfoId));
                     db.SigDelays.RemoveRange(delayItems);
@@ -141,7 +141,7 @@ namespace XdCxRhDW.App.UserControl
                 SigDelayEditor frm = new SigDelayEditor(sigInfoId.ID);
                 if (frm.ShowDialog() != DialogResult.OK) return null;
                 var addItem = frm.info;
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     addItem.SigInfoId = sigInfoId.ID;
                     var sig = db.SigDelays.Add(addItem);
@@ -165,7 +165,7 @@ namespace XdCxRhDW.App.UserControl
                 SigDelayEditor frm = new SigDelayEditor(editItem, sigInfoId.ID);
                 if (frm.ShowDialog() != DialogResult.OK) return null;
                 editItem = frm.info;
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var find = await db.SigDelays.Where(p => p.ID == editItem.ID).FirstOrDefaultAsync();
                     find.SigInfoId = editItem.SigInfoId;
@@ -187,7 +187,7 @@ namespace XdCxRhDW.App.UserControl
             try
             {
                 var ids = list.Select(p => p.ID);
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var delItems = await db.SigDelays.Where(p => ids.Contains(p.ID)).ToListAsync();
                     db.SigDelays.RemoveRange(delItems);
@@ -208,7 +208,7 @@ namespace XdCxRhDW.App.UserControl
             listSigDelay.Clear();
             var sigInfoId = gridViewSignal.GetFocusedRow() as SigInfo;
             if (sigInfoId == null) return;
-            using (var db = RHDWContext.GetContext(true))
+            using (MySqlContext db=new MySqlContext())
             {
                 var delayItems = await db.SigDelays.Where(w => w.SigInfoId == sigInfoId.ID).OrderBy(p=>p.SatInfo.SatName).ToListAsync();
                 var sats = await db.SatInfos.ToListAsync();

+ 1 - 1
XdCxRhDW.App/UserControl/CtrlSysSettings.cs

@@ -106,7 +106,7 @@ namespace XdCxRhDW.App.UserControl
                     return;
                 }
                 bool needStartHttpSvr = false;
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var res = await db.SysSetings.FirstOrDefaultAsync();
                     if (res == null) res = new SysSetings();

+ 4 - 4
XdCxRhDW.App/UserControl/CtrlTarget.cs

@@ -33,7 +33,7 @@ namespace XdCxRhDW.App.UserControl
                 gridTar.UseDefault(list).UseMultiSelect().UseRowNumber()
                     .UseAddAsync(Add).UseEditAsync<TargetInfo>(Edit).UseDeleteAsync<TargetInfo>(Del);
 
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     var res = db.TargetInfos.OrderBy(p => p.TargetName).OrderBy(p => p.TargetName);
                     list.AddRange(await res.ToListAsync());
@@ -54,7 +54,7 @@ namespace XdCxRhDW.App.UserControl
                 TargetEditor frm = new TargetEditor();
                 if (frm.ShowDialog() != DialogResult.OK) return null;
                 var addItem = frm.info;
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     db.TargetInfos.Add(addItem);
                     await db.SaveChangesAsync();
@@ -75,7 +75,7 @@ namespace XdCxRhDW.App.UserControl
                 TargetEditor frm = new TargetEditor(editItem);
                 if (frm.ShowDialog() != DialogResult.OK) return null;
                 editItem = frm.info;
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var find = await db.TargetInfos.Where(p => p.ID == editItem.ID).FirstOrDefaultAsync();
                     find.TargetName = editItem.TargetName;
@@ -98,7 +98,7 @@ namespace XdCxRhDW.App.UserControl
             {
 
                 var ids = list.Select(p => p.ID);
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var delItems = await db.TargetInfos.Where(p => ids.Contains(p.ID)).ToListAsync();
                     db.TargetInfos.RemoveRange(delItems);

+ 2 - 2
XdCxRhDW.App/UserControl/CtrlTx.cs

@@ -35,7 +35,7 @@ namespace XdCxRhDW.App.UserControl
             try
             {
 
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     list = await db.TxInfos.ToListAsync();
                     var recTx = list.Find(p => p.TxType == EnumTxType.Rec);
@@ -131,7 +131,7 @@ namespace XdCxRhDW.App.UserControl
                 txRef.Lat = refLat;
                 tmp.Add(txRef);
 
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     foreach (var item in tmp)
                     {

+ 2 - 2
XdCxRhDW.App/UserControl/CtrlXl.cs

@@ -169,7 +169,7 @@ namespace XdCxRhDW.App.UserControl
             {
                 this.Enabled = false;
                 var ids = list.Select(p => p.ID);
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     var delItems = await db.XlInfos.Where(p => ids.Contains(p.ID)).ToListAsync();
                     db.XlInfos.RemoveRange(delItems);
@@ -195,7 +195,7 @@ namespace XdCxRhDW.App.UserControl
             try
             {
                 this.Enabled = false;
-                using (RHDWContext db = RHDWContext.GetContext())
+                using (MySqlContext db = new MySqlContext())
                 {
                     if (satCode == null)
                     {

+ 1 - 1
XdCxRhDW.App/UserControl/RHGDOPParam.cs

@@ -44,7 +44,7 @@ namespace XdCxRhDW.App.UserControl
             this.txtSatLocErr1.EditValue = 10000;
             PosResType = item.PosResType;
 
-            using (RHDWPartContext db = RHDWPartContext.GetContext(item.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 var cg = db?.CgRes.Where(m => m.ID == item.CgResID).FirstOrDefault();
                 var station = db?.StationRes.Where(m => m.ID == item.StationResID).FirstOrDefault();

+ 1 - 1
XdCxRhDW.App/UserControl/X1D1GDOPParam.cs

@@ -44,7 +44,7 @@ namespace XdCxRhDW.App.UserControl
             this.txtSatLocErr1.EditValue = 10000;
             this.txtCxErr.EditValue = 0.001;
             PosResType = item.PosResType;
-            using (RHDWPartContext db = RHDWPartContext.GetContext(item.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 var cg = db?.CgRes.Where(m => m.ID == item.CgResID).FirstOrDefault();
                 var station = db?.StationRes.Where(m => m.ID == item.StationResID).FirstOrDefault();

+ 1 - 1
XdCxRhDW.App/UserControl/X2D1GDOPParam.cs

@@ -48,7 +48,7 @@ namespace XdCxRhDW.App.UserControl
                 layoutControlItem14.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
             }
 
-            using (RHDWPartContext db = RHDWPartContext.GetContext(item.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 var cg = db?.CgRes.Where(m => m.ID == item.CgResID).FirstOrDefault();
                 var station = db?.StationRes.Where(m => m.ID == item.StationResID).FirstOrDefault();

+ 1 - 1
XdCxRhDW.App/UserControl/X2DFGDOPParam.cs

@@ -45,7 +45,7 @@ namespace XdCxRhDW.App.UserControl
             this.txtDfoErr1.EditValue = 0.01;
             this.txtDtousErr1.EditValue = 1;
             PosResType = item.PosResType;
-            using (RHDWPartContext db = RHDWPartContext.GetContext(item.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 var cg = db?.CgRes.Where(m => m.ID == item.CgResID).FirstOrDefault();
                 var station = db?.StationRes.Where(m => m.ID == item.StationResID).FirstOrDefault();

+ 1 - 1
XdCxRhDW.App/UserControl/X3DFGDOPParam .cs

@@ -43,7 +43,7 @@ namespace XdCxRhDW.App.UserControl
             this.txtEphVelErr1.EditValue = 0.1;
             this.txtDfoErr1.EditValue = 0.01;
             PosResType = item.PosResType;
-            using (RHDWPartContext db = RHDWPartContext.GetContext(item.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 var cg = db?.CgRes.Where(m => m.ID == item.CgResID).FirstOrDefault();
                 var station = db?.StationRes.Where(m => m.ID == item.StationResID).FirstOrDefault();

+ 1 - 1
XdCxRhDW.App/UserControl/X3GDOPParam.cs

@@ -44,7 +44,7 @@ namespace XdCxRhDW.App.UserControl
                 layoutControlItem14.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
             }
 
-            using (RHDWPartContext db = RHDWPartContext.GetContext(item.SigTime))
+            using (MySqlContext db=new MySqlContext())
             {
                 var cg = db?.CgRes.Where(m => m.ID == item.CgResID).FirstOrDefault();
                 var station = db?.StationRes.Where(m => m.ID == item.StationResID).FirstOrDefault();

+ 67 - 2
XdCxRhDW.App/XdCxRhDW.App.csproj

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="..\packages\EntityFramework.6.5.1\build\EntityFramework.props" Condition="Exists('..\packages\EntityFramework.6.5.1\build\EntityFramework.props')" />
   <Import Project="packages\EntityFramework.6.4.4\build\EntityFramework.props" Condition="Exists('packages\EntityFramework.6.4.4\build\EntityFramework.props')" />
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
@@ -62,6 +63,9 @@
   </PropertyGroup>
   <ItemGroup>
     <Reference Include="Accessibility" />
+    <Reference Include="BouncyCastle.Cryptography, Version=2.0.0.0, Culture=neutral, PublicKeyToken=072edcf4a5328938, processorArchitecture=MSIL">
+      <HintPath>..\packages\BouncyCastle.Cryptography.2.5.1\lib\net461\BouncyCastle.Cryptography.dll</HintPath>
+    </Reference>
     <Reference Include="DevExpress.BonusSkins.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
     <Reference Include="DevExpress.Charts.v23.2.Core, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
     <Reference Include="DevExpress.Data.Desktop.v23.2" />
@@ -89,8 +93,32 @@
     <Reference Include="DevExpress.XtraScheduler.v23.2.Core, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
     <Reference Include="DevExpress.XtraScheduler.v23.2.Core.Desktop, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
     <Reference Include="DevExpress.XtraTreeList.v23.2, Version=23.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
-    <Reference Include="EntityFramework">
-      <HintPath>..\EntityFramework.dll</HintPath>
+    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.5.1\lib\net45\EntityFramework.dll</HintPath>
+    </Reference>
+    <Reference Include="EntityFramework.SqlServer, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
+      <HintPath>..\packages\EntityFramework.6.5.1\lib\net45\EntityFramework.SqlServer.dll</HintPath>
+    </Reference>
+    <Reference Include="Google.Protobuf, Version=3.30.0.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604, processorArchitecture=MSIL">
+      <HintPath>..\packages\Google.Protobuf.3.30.0\lib\net45\Google.Protobuf.dll</HintPath>
+    </Reference>
+    <Reference Include="K4os.Compression.LZ4, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
+      <HintPath>..\packages\K4os.Compression.LZ4.1.3.8\lib\net462\K4os.Compression.LZ4.dll</HintPath>
+    </Reference>
+    <Reference Include="K4os.Compression.LZ4.Streams, Version=1.3.8.0, Culture=neutral, PublicKeyToken=2186fa9121ef231d, processorArchitecture=MSIL">
+      <HintPath>..\packages\K4os.Compression.LZ4.Streams.1.3.8\lib\net462\K4os.Compression.LZ4.Streams.dll</HintPath>
+    </Reference>
+    <Reference Include="K4os.Hash.xxHash, Version=1.0.8.0, Culture=neutral, PublicKeyToken=32cd54395057cec3, processorArchitecture=MSIL">
+      <HintPath>..\packages\K4os.Hash.xxHash.1.0.8\lib\net462\K4os.Hash.xxHash.dll</HintPath>
+    </Reference>
+    <Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
+    </Reference>
+    <Reference Include="MySql.Data, Version=9.3.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
+      <HintPath>..\packages\MySql.Data.9.3.0\lib\net462\MySql.Data.dll</HintPath>
+    </Reference>
+    <Reference Include="MySql.Data.EntityFramework, Version=9.3.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
+      <HintPath>..\packages\MySql.Data.EntityFramework.9.3.0\lib\net462\MySql.Data.EntityFramework.dll</HintPath>
     </Reference>
     <Reference Include="Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
@@ -99,27 +127,52 @@
     <Reference Include="PresentationCore" />
     <Reference Include="PresentationFramework" />
     <Reference Include="System" />
+    <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
+    </Reference>
     <Reference Include="System.ComponentModel" />
     <Reference Include="System.ComponentModel.DataAnnotations" />
     <Reference Include="System.Configuration" />
+    <Reference Include="System.Configuration.ConfigurationManager, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Configuration.ConfigurationManager.8.0.0\lib\net462\System.Configuration.ConfigurationManager.dll</HintPath>
+    </Reference>
     <Reference Include="System.Core" />
+    <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="System.Data.Linq" />
     <Reference Include="System.Data.SQLite">
       <HintPath>..\System.Data.SQLite.dll</HintPath>
     </Reference>
     <Reference Include="System.Deployment" />
+    <Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Diagnostics.DiagnosticSource.8.0.1\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
+    </Reference>
+    <Reference Include="System.IO.Pipelines, Version=5.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.IO.Pipelines.5.0.2\lib\net461\System.IO.Pipelines.dll</HintPath>
+    </Reference>
     <Reference Include="System.Management" />
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="System.Data" />
     <Reference Include="System.Drawing" />
+    <Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
+    </Reference>
     <Reference Include="System.Net.Http">
       <Private>True</Private>
     </Reference>
     <Reference Include="System.Numerics" />
+    <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
+    </Reference>
     <Reference Include="System.Runtime.Remoting" />
     <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.Runtime.Serialization.Formatters.Soap" />
     <Reference Include="System.Security" />
+    <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
+    </Reference>
     <Reference Include="System.Transactions" />
     <Reference Include="System.Web.Extensions" />
     <Reference Include="System.Web.Http">
@@ -130,6 +183,9 @@
     <Reference Include="System.Xml.Linq" />
     <Reference Include="UIAutomationClient" />
     <Reference Include="WindowsBase" />
+    <Reference Include="ZstdSharp, Version=0.8.5.0, Culture=neutral, PublicKeyToken=8d151af33a4ad5cf, processorArchitecture=MSIL">
+      <HintPath>..\packages\ZstdSharp.Port.0.8.5\lib\net462\ZstdSharp.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="Basic\BaseVm.cs" />
@@ -543,6 +599,7 @@
     <EmbeddedResource Include="PopupControl\ShowCxCtrl.resx">
       <DependentUpon>ShowCxCtrl.cs</DependentUpon>
     </EmbeddedResource>
+    <None Include="packages.config" />
     <None Include="Properties\licenses.licx" />
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
@@ -711,6 +768,14 @@ wmic process where name='多模式融合定位平台.exe' delete
 
 </PreBuildEvent>
   </PropertyGroup>
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\EntityFramework.6.5.1\build\EntityFramework.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.5.1\build\EntityFramework.props'))" />
+    <Error Condition="!Exists('..\packages\EntityFramework.6.5.1\build\EntityFramework.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\EntityFramework.6.5.1\build\EntityFramework.targets'))" />
+  </Target>
+  <Import Project="..\packages\EntityFramework.6.5.1\build\EntityFramework.targets" Condition="Exists('..\packages\EntityFramework.6.5.1\build\EntityFramework.targets')" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
        Other similar extension points exist, see Microsoft.Common.targets.
   <Target Name="BeforeBuild">

+ 21 - 0
XdCxRhDW.App/packages.config

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="BouncyCastle.Cryptography" version="2.5.1" targetFramework="net472" />
+  <package id="EntityFramework" version="6.5.1" targetFramework="net472" />
+  <package id="Google.Protobuf" version="3.30.0" targetFramework="net472" />
+  <package id="K4os.Compression.LZ4" version="1.3.8" targetFramework="net472" />
+  <package id="K4os.Compression.LZ4.Streams" version="1.3.8" targetFramework="net472" />
+  <package id="K4os.Hash.xxHash" version="1.0.8" targetFramework="net472" />
+  <package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net472" />
+  <package id="MySql.Data" version="9.3.0" targetFramework="net472" />
+  <package id="MySql.Data.EntityFramework" version="9.3.0" targetFramework="net472" />
+  <package id="System.Buffers" version="4.5.1" targetFramework="net472" />
+  <package id="System.Configuration.ConfigurationManager" version="8.0.0" targetFramework="net472" />
+  <package id="System.Diagnostics.DiagnosticSource" version="8.0.1" targetFramework="net472" />
+  <package id="System.IO.Pipelines" version="5.0.2" targetFramework="net472" />
+  <package id="System.Memory" version="4.5.5" targetFramework="net472" />
+  <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
+  <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
+  <package id="ZstdSharp.Port" version="0.8.5" targetFramework="net472" />
+</packages>

+ 5 - 6
XdCxRhDW.Repostory/04.XdCxRhDW.Repostory.csproj

@@ -72,11 +72,11 @@
     <Reference Include="Microsoft.Extensions.Logging.Abstractions, Version=9.0.0.3, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
       <HintPath>..\packages\Microsoft.Extensions.Logging.Abstractions.9.0.3\lib\net462\Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
     </Reference>
-    <Reference Include="MySql.Data, Version=9.2.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
-      <HintPath>..\packages\MySql.Data.9.2.0\lib\net462\MySql.Data.dll</HintPath>
+    <Reference Include="MySql.Data, Version=9.3.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
+      <HintPath>..\packages\MySql.Data.9.3.0\lib\net462\MySql.Data.dll</HintPath>
     </Reference>
-    <Reference Include="MySql.Data.EntityFramework, Version=9.2.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
-      <HintPath>..\packages\MySql.Data.EntityFramework.9.2.0\lib\net462\MySql.Data.EntityFramework.dll</HintPath>
+    <Reference Include="MySql.Data.EntityFramework, Version=9.3.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL">
+      <HintPath>..\packages\MySql.Data.EntityFramework.9.3.0\lib\net462\MySql.Data.EntityFramework.dll</HintPath>
     </Reference>
     <Reference Include="Npgsql, Version=8.0.7.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL">
       <HintPath>..\packages\Npgsql.8.0.7\lib\netstandard2.0\Npgsql.dll</HintPath>
@@ -157,8 +157,7 @@
     </Reference>
   </ItemGroup>
   <ItemGroup>
-    <Compile Include="EFContext\RHDWContext.cs" />
-    <Compile Include="EFContext\SqliteInterceptor.cs" />
+    <Compile Include="EFContext\MySqlContext.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="SysConfig.cs" />
     <Compile Include="XlRepository.cs" />

+ 80 - 0
XdCxRhDW.Repostory/EFContext/MySqlContext.cs

@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data.Common;
+using System.Data.Entity;
+using System.Data.Entity.ModelConfiguration.Conventions;
+using System.Data.SQLite;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using XdCxRhDW.Entity;
+
+namespace XdCxRhDW.Repostory
+{
+    public class MySqlContext: DbContext
+    {
+        public MySqlContext(DbConnection con)
+         : base(con, true)
+        {
+          
+        }
+
+        public MySqlContext(string nameOrConnectionString="MySql")
+        : base(nameOrConnectionString)
+        {
+        }
+
+        public Task<List<T>> SqlQueryAsync<T>(string sql)
+        {
+            return this.Database.SqlQuery<T>(sql).ToListAsync();
+        }
+        public Task<T> SqlQueryOneAsync<T>(string sql)
+        {
+            return this.Database.SqlQuery<T>(sql).FirstOrDefaultAsync();
+
+        }
+
+        protected override void OnModelCreating(DbModelBuilder modelBuilder)
+        {
+            this.Database.Log = msg =>
+            {
+            };
+            //modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
+            //modelBuilder.Configurations.AddFromAssembly(typeof(RHDWContext).Assembly);//自动加载Entity-Type
+            //var sqliteConnectionInitializer = new SqliteCreateDatabaseIfNotExists<RHDWContext>(modelBuilder);
+            //Database.SetInitializer(sqliteConnectionInitializer);
+            base.OnModelCreating(modelBuilder);
+        }
+        public DbSet<XlInfo> XlInfos { set; get; }
+
+        public DbSet<TaskInfo> TaskInfos { set; get; }
+
+        public DbSet<TaskSig> TaskSigs { set; get; }
+
+        public DbSet<TxInfo> TxInfos { get; set; }
+
+        public DbSet<SatInfo> SatInfos { get; set; }
+
+        public DbSet<FixedStation> FixedStation { get; set; }
+
+        public DbSet<SigInfo> SigInfos { get; set; }
+
+        public DbSet<SigDelay> SigDelays { get; set; }
+
+        public DbSet<TargetInfo> TargetInfos { get; set; }
+
+        public DbSet<SysSetings> SysSetings { get; set; }
+
+        public DbSet<TaskRunnningInfo> TaskRunnningInfos { get; set; }
+
+        //以下为Range分区表
+        public DbSet<LogRes> LogRes { set; get; }
+        public DbSet<StationRes> StationRes { get; set; }
+        public DbSet<CxRes> CxRes { get; set; }
+        public DbSet<CgRes> CgRes { get; set; }
+        public DbSet<CgXgfRes> CgXgfRes { get; set; }
+        public DbSet<PosRes> PosRes { get; set; }
+        public DbSet<CheckRes> CheckRes { get; set; }
+    }
+}

+ 15 - 42
XdCxRhDW.Repostory/EFContext/RHDWContext.cs

@@ -334,45 +334,27 @@ namespace XdCxRhDW.Repostory
     public class RHDWContext : DbContextBase
     {
         public string DbFile;
-        private bool readOnly = false;
-        private static RHDWContext rContext;
-        private static RHDWContext wContext;
-        public static RHDWContext GetContext(bool readOnly=false)
+        public static RHDWContext GetContext(bool readOnly = false)
         {
+            string conStr = ConfigurationManager.ConnectionStrings["DbCon"].ConnectionString.Trim();
+            if (conStr.EndsWith(";"))
+                conStr = conStr.Substring(0, conStr.Length - 1);
+            conStr = $"{conStr};Version=3";//Journal Mode=Off
             if (readOnly)
             {
-                if (rContext == null)
-                {
-                    string conStr = ConfigurationManager.ConnectionStrings["DbCon"].ConnectionString.Trim();
-                    if (conStr.EndsWith(";"))
-                        conStr = conStr.Substring(0, conStr.Length - 1);
-                    conStr = $"{conStr};Version=3;Journal Mode=Off;Read Only=True";
-                    SQLiteConnection con = new SQLiteConnection(conStr);
-                    var res = new RHDWContext(con);
-                    res.readOnly= readOnly;
-                    rContext = res;
-                    return res;
-                }
-                else
-                    return rContext;
+                conStr = $"{conStr};Read Only=True";
             }
-            else
+            SQLiteConnection con = new SQLiteConnection(conStr);
+            if (!readOnly)
             {
-                if (wContext == null)
-                {
-                    string conStr = ConfigurationManager.ConnectionStrings["DbCon"].ConnectionString.Trim();
-                    if (conStr.EndsWith(";"))
-                        conStr = conStr.Substring(0, conStr.Length - 1);
-                    conStr = $"{conStr};Version=3;Journal Mode=Off";
-                    SQLiteConnection con = new SQLiteConnection(conStr);
-                    var res = new RHDWContext(con);
-                    wContext = res;
-                    return res;
-                }
-                else
-                    return wContext;
+                //con.Open();
+                //var cmd = con.CreateCommand();
+                //cmd.CommandText = "PRAGMA journal_mode=WAL";
+                //cmd.ExecuteNonQuery();
+                //con.Close();
             }
-           
+            var res = new RHDWContext(con);
+            return res;
 
         }
         private RHDWContext(DbConnection con)
@@ -403,15 +385,6 @@ namespace XdCxRhDW.Repostory
             this.Database.Log = msg =>
             {
             };
-            if (!readOnly)
-            {
-                if (this.Database.Connection.State == System.Data.ConnectionState.Open)
-                {
-                    var cmd = this.Database.Connection.CreateCommand();
-                    cmd.CommandText = "PRAGMA journal_mode=WAL";
-                    cmd.ExecuteNonQuery();
-                }
-            }
             modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
             modelBuilder.Configurations.AddFromAssembly(typeof(RHDWContext).Assembly);//自动加载Entity-Type
             var sqliteConnectionInitializer = new SqliteCreateDatabaseIfNotExists<RHDWContext>(modelBuilder);

+ 5 - 5
XdCxRhDW.Repostory/XlRepository.cs

@@ -20,7 +20,7 @@ namespace XdCxRhDW.Repostory
         {
             try
             {
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     var res = await db.XlInfos.OrderByDescending(p => p.TimeUTC).OrderByDescending(p => p.Lon).Take(5000).ToListAsync();
                     return res;
@@ -34,7 +34,7 @@ namespace XdCxRhDW.Repostory
         }
         public static async Task<int> GetCount(int? satCode)
         {
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 if (satCode == null)
                 {
@@ -50,7 +50,7 @@ namespace XdCxRhDW.Repostory
         }
         public static async Task<List<SatInfo>> GetAllSat()
         {
-            using (RHDWContext db = RHDWContext.GetContext(true))
+            using (MySqlContext db = new MySqlContext())
             {
                 string sql = "select * from XlInfo where id in (select max(id) maxid from xlinfo group by satcode) order by satcode";
                 var data = await db.Database.SqlQuery<XlInfo>(sql).ToListAsync();
@@ -71,7 +71,7 @@ namespace XdCxRhDW.Repostory
         {
             try
             {
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     var topNumber = (currentPage - 1) * pageSize;
                     StringBuilder sb = new StringBuilder();
@@ -106,7 +106,7 @@ namespace XdCxRhDW.Repostory
                 //GetLatestAsync方法在索引列上使用了加减运算会导致索引失效,运算变慢,这个函数是对GetLatestAsyncOld的优化
                 //老的SQL很慢
                 //SELECT min(abs(JULIANDAY(TimeUTC)-JULIANDAY('2024-10-09 23:59:53'))) as NearDaySpan,* FROM XlInfo where satcode=40892
-                using (RHDWContext db = RHDWContext.GetContext(true))
+                using (MySqlContext db = new MySqlContext())
                 {
                     string sql = $"select * from XlInfo where SatCode={satCode} and TimeUTC>='{sigTime:yyyy-MM-dd HH:mm:ss}' order by TimeUTC limit 1";
                     var max = await db.Database.SqlQuery<XlInfo>(sql).FirstOrDefaultAsync();

+ 1 - 1
XdCxRhDW.Repostory/app.config

@@ -99,7 +99,7 @@
   <entityFramework>
     <providers>
       <provider invariantName="Oracle.ManagedDataAccess.Client" type="Oracle.ManagedDataAccess.EntityFramework.EFOracleProviderServices, Oracle.ManagedDataAccess.EntityFramework, Version=6.122.23.1, Culture=neutral, PublicKeyToken=89b483f429c47342" />
-    <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=9.2.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
+    <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.EntityFramework, Version=9.3.0.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d">
       </provider></providers>
   </entityFramework>
 </configuration>

+ 2 - 2
XdCxRhDW.Repostory/packages.config

@@ -11,8 +11,8 @@
   <package id="Microsoft.Bcl.HashCode" version="6.0.0" targetFramework="net472" />
   <package id="Microsoft.Extensions.DependencyInjection.Abstractions" version="9.0.3" targetFramework="net472" />
   <package id="Microsoft.Extensions.Logging.Abstractions" version="9.0.3" targetFramework="net472" />
-  <package id="MySql.Data" version="9.2.0" targetFramework="net472" />
-  <package id="MySql.Data.EntityFramework" version="9.2.0" targetFramework="net472" />
+  <package id="MySql.Data" version="9.3.0" targetFramework="net472" />
+  <package id="MySql.Data.EntityFramework" version="9.3.0" targetFramework="net472" />
   <package id="Npgsql" version="8.0.7" targetFramework="net472" />
   <package id="Oracle.ManagedDataAccess" version="23.7.0" targetFramework="net472" />
   <package id="Oracle.ManagedDataAccess.EntityFramework" version="23.7.0" targetFramework="net472" />