From 9cbadc5a7e9ce6c9c2190708fbcccec5694232e4 Mon Sep 17 00:00:00 2001 From: liuwf Date: Fri, 29 Mar 2024 18:10:56 +0800 Subject: [PATCH] =?UTF-8?q?change-=E6=9D=A1=E7=A0=81=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=95=B0=E6=8D=AE=E9=87=87=E9=9B=86=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Admin.Core.Socket/TouchSocketService.cs | 4 +++- Aucma.Core.CodeBinding/appsettings.json | 12 +++++----- .../ViewModels/MainWindowViewModel.cs | 2 +- .../ViewModels/StatisticsPageViewModel.cs | 22 +++++++++---------- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Admin.Core.Socket/TouchSocketService.cs b/Admin.Core.Socket/TouchSocketService.cs index d82de4d9..71c1b28c 100644 --- a/Admin.Core.Socket/TouchSocketService.cs +++ b/Admin.Core.Socket/TouchSocketService.cs @@ -68,7 +68,7 @@ namespace Admin.Core.Socket return EasyTask.CompletedTask; };//有客户端正在连接 service.Connected = (client, e) => { client.Logger.Info($"{client.IP}:{client.Port} 客户端连接成功!目前客户端连接数{service.Count}"); - + log.Info($"{client.IP}:{client.Port} 客户端连接成功!目前客户端连接数{service.Count}"); SetProdStoreClientId(client); return EasyTask.CompletedTask; @@ -89,6 +89,7 @@ namespace Admin.Core.Socket try { var mes = Encoding.UTF8.GetString(e.ByteBlock.Buffer, 0, e.ByteBlock.Len);//注意:数据长度是byteBlock.Len + log.Info("原始报文:"+mes); //心跳包 if (mes== "heartbeat") { @@ -104,6 +105,7 @@ namespace Admin.Core.Socket } else { + log.Info("条码报文:" + mes); ReceiveCodeDelegateEvent?.Invoke(client.IP,mes); client.Logger.Info($"已从{client.IP}:{client.Port}》接收到信息:{mes}"); } diff --git a/Aucma.Core.CodeBinding/appsettings.json b/Aucma.Core.CodeBinding/appsettings.json index e7610a5b..3020bd66 100644 --- a/Aucma.Core.CodeBinding/appsettings.json +++ b/Aucma.Core.CodeBinding/appsettings.json @@ -223,7 +223,7 @@ "Enabled": true, //"IP": "127.0.0.1", // "Port": 6000 - "IP": "10.10.92.72", + "IP": "10.10.92.70", "Port": 2014 }, { @@ -232,7 +232,7 @@ "PlcType": "Melsec", "Enabled": true, "IP": "10.10.92.22", - "Port": 2015 + "Port": 2014 }, { "Id": 3, @@ -240,7 +240,7 @@ "PlcType": "Melsec", "Enabled": true, "IP": "10.10.92.29", - "Port": 2015 + "Port": 2014 }, { "Id": 4, @@ -248,7 +248,7 @@ "PlcType": "Melsec", "Enabled": true, "IP": "10.10.92.10", - "Port": 2015 + "Port": 2014 }, { "Id": 5, @@ -256,7 +256,7 @@ "PlcType": "Melsec", "Enabled": true, "IP": "10.10.92.1", - "Port": 2015 + "Port": 2014 }, { "Id": 6, @@ -264,7 +264,7 @@ "PlcType": "Melsec", "Enabled": true, "IP": "10.10.92.49", - "Port": 2015 + "Port": 2014 }, { "Id": 7, diff --git a/Aucma.Core.Palletiz/ViewModels/MainWindowViewModel.cs b/Aucma.Core.Palletiz/ViewModels/MainWindowViewModel.cs index 07de3695..61b8647e 100644 --- a/Aucma.Core.Palletiz/ViewModels/MainWindowViewModel.cs +++ b/Aucma.Core.Palletiz/ViewModels/MainWindowViewModel.cs @@ -26,7 +26,7 @@ namespace Aucma.Core.Palletiz.ViewModels /// /// 扫描记录刷新 /// - public delegate void RefreshInfo(); + public delegate Task RefreshInfo(); public static event RefreshInfo? RefreshInfoEvent; diff --git a/Aucma.Core.Palletiz/ViewModels/StatisticsPageViewModel.cs b/Aucma.Core.Palletiz/ViewModels/StatisticsPageViewModel.cs index 2f4d9643..69cfb168 100644 --- a/Aucma.Core.Palletiz/ViewModels/StatisticsPageViewModel.cs +++ b/Aucma.Core.Palletiz/ViewModels/StatisticsPageViewModel.cs @@ -32,15 +32,15 @@ namespace Aucma.Core.Palletiz.ViewModels #region 加载DataGrid数据 - private async void LoadData() + private async Task LoadData() { - //Task.Run(() => - //{ + await Task.Run(() => + { try { - List list = await _recordInstoreServices.QueryAsync(x => (x.StoreCode == storeCodeA || x.StoreCode == storeCodeB) && x.InStoreTime >= DateTime.Today); + List list = _recordInstoreServices.QueryAsync(x => (x.StoreCode == storeCodeA || x.StoreCode == storeCodeB) && x.InStoreTime >= DateTime.Today).Result; if (list != null && list.Count > 0) { list.OrderByDescending(x => x.InStoreTime); @@ -58,7 +58,7 @@ namespace Aucma.Core.Palletiz.ViewModels Console.WriteLine("" + ex.Message.ToString()); } - // }); + }); //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 1, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉,SC", PlanAmount = 50, CompleteAmount = 10 }); @@ -84,9 +84,11 @@ namespace Aucma.Core.Palletiz.ViewModels /// 查询 /// [RelayCommand] - private void ExecQuery(object obj) + private async Task ExecQuery(object obj) { - + await Task.Run(() => + { + string result = (string)obj; List list = _recordInstoreServices.QueryAsync(x => (x.StoreCode == storeCodeA || x.StoreCode == storeCodeB) && x.BarCodeCode.Contains(result)).Result; if (list != null && list.Count > 0) @@ -100,11 +102,7 @@ namespace Aucma.Core.Palletiz.ViewModels }); } } - - - - - + }); } #endregion }