diff --git a/Seyounth.Hyosung.Data/ServiceExtensions.cs b/Seyounth.Hyosung.Data/ServiceExtensions.cs index 439ce32..c9c1447 100644 --- a/Seyounth.Hyosung.Data/ServiceExtensions.cs +++ b/Seyounth.Hyosung.Data/ServiceExtensions.cs @@ -17,22 +17,22 @@ public static class ServiceExtensions services.AddSingleton(s => { //#if RELEASE - SqlSugarScope sqlSugar = new SqlSugarScope(new ConnectionConfig() - { - DbType = DbType.SqlServer, - ConnectionString = connectionString, - IsAutoCloseConnection = true, - } - ); + // SqlSugarScope sqlSugar = new SqlSugarScope(new ConnectionConfig() + // { + // DbType = DbType.SqlServer, + // ConnectionString = connectionString, + // IsAutoCloseConnection = true, + // } + // ); //#elif DEBUG - //SqlSugarScope sqlSugar = new SqlSugarScope(new ConnectionConfig() - // { - // DbType = DbType.Sqlite, - // ConnectionString = "Data Source=hyosung.db", - // IsAutoCloseConnection = true, - // InitKeyType = InitKeyType.Attribute - // } - //); + SqlSugarScope sqlSugar = new SqlSugarScope(new ConnectionConfig() + { + DbType = DbType.Sqlite, + ConnectionString = "Data Source=hyosung.db", + IsAutoCloseConnection = true, + InitKeyType = InitKeyType.Attribute + } + ); //#endif return sqlSugar; }); @@ -50,13 +50,14 @@ public static class ServiceExtensions public static void UseHyosungData(this IServiceProvider provider) { - //var db = provider.GetRequiredService(); - //db.DbMaintenance.CreateDatabase(); - //db.CodeFirst.InitTables(typeof(VarietyEntity), - // typeof(PalletEntity), - // typeof(ScannedYarnEntity), - // typeof(TrayEntity), - // typeof(AgvBinEntity), - // typeof(DictEntity)); + var db = provider.GetRequiredService(); + db.DbMaintenance.CreateDatabase(); + db.CodeFirst.InitTables(typeof(VarietyEntity), + typeof(PalletEntity), + typeof(ScannedYarnEntity), + typeof(TrayEntity), + typeof(AgvBinEntity), + typeof(DictEntity) + ); } } \ No newline at end of file diff --git a/Seyounth.Hyosung.Runtime/HyosungRuntime.cs b/Seyounth.Hyosung.Runtime/HyosungRuntime.cs index bd7c972..ab816ca 100644 --- a/Seyounth.Hyosung.Runtime/HyosungRuntime.cs +++ b/Seyounth.Hyosung.Runtime/HyosungRuntime.cs @@ -38,10 +38,10 @@ public class HyosungRuntime( public async Task StartAsync(CancellationToken token) { - reportExportService.ExportNoExportAsync(); + //reportExportService.ExportNoExportAsync(); //启动扫码服务 - await hyosungScannerService.StartAsync(token); - await printer.StartAsync(token); + // await hyosungScannerService.StartAsync(token); + // await printer.StartAsync(token); //最后启动PLC服务 hyosungPlcService.OnPlcRequestScanProduct += OnPlcRequestScanProduct; hyosungPlcService.OnPlcRequestScanFixture += OnPlcRequestScanFixture; @@ -52,7 +52,7 @@ public class HyosungRuntime( hyosungPlcService.OnRequestPrintLabel += OnPlcRequestPrintLabel; hyosungPlcService.OnRequestGetPrintLableOption += OnRequestGetPrintLabel; hyosungPlcService.OnRequestScanEntry += OnPlcRequestScanEntry; - await hyosungPlcService.StartAsync(token); + // await hyosungPlcService.StartAsync(token); } private async Task OnPlcRequestScanEntry(int arg) diff --git a/Seyounth.Hyosung.sln b/Seyounth.Hyosung.sln index 9fdec85..33aff7f 100644 --- a/Seyounth.Hyosung.sln +++ b/Seyounth.Hyosung.sln @@ -16,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HyosungTester", "HyosungTes EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Seyounth.Hyosung", "Seyounth.Hyosung\Seyounth.Hyosung.csproj", "{16C5CC9B-FEA9-4B1E-805F-C6DBF5865DC0}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Core", "Core", "{7501BD09-1C80-49A5-AA06-C4254F666407}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/Seyounth.Hyosung/ViewModels/HomeViewModel.cs b/Seyounth.Hyosung/ViewModels/HomeViewModel.cs index d2dfbaa..f23126e 100644 --- a/Seyounth.Hyosung/ViewModels/HomeViewModel.cs +++ b/Seyounth.Hyosung/ViewModels/HomeViewModel.cs @@ -41,15 +41,15 @@ public partial class HomeViewModel : ObservableObject _yarnCarSide = new(); _yarnCarSide.Add("正面"); _yarnCarSide.Add("反面"); - _varieties = new ObservableCollection(varietyService.GetAll()); + // _varieties = new ObservableCollection(varietyService.GetAll()); DispatcherTimer timer = new DispatcherTimer(); - timer = new DispatcherTimer(); - // 设置定时器间隔,这里设置为 1 秒,可根据实际需求调整 - timer.Interval = TimeSpan.FromSeconds(1); - // 为定时器的 Tick 事件添加处理方法 - timer.Tick += Timer_Tick; - // 启动定时器 - timer.Start(); + // timer = new DispatcherTimer(); + // // 设置定时器间隔,这里设置为 1 秒,可根据实际需求调整 + // timer.Interval = TimeSpan.FromSeconds(1); + // // 为定时器的 Tick 事件添加处理方法 + // timer.Tick += Timer_Tick; + // // 启动定时器 + // timer.Start(); } private void Timer_Tick(object? sender, EventArgs e) diff --git a/Seyounth.Hyosung/Views/MainWindow.xaml b/Seyounth.Hyosung/Views/MainWindow.xaml index f738b98..7548245 100644 --- a/Seyounth.Hyosung/Views/MainWindow.xaml +++ b/Seyounth.Hyosung/Views/MainWindow.xaml @@ -32,6 +32,15 @@ + + + + + +