change-条码绑定添加数据采集模块

main
liuwf 10 months ago
parent abc138f620
commit 9cbadc5a7e

@ -68,7 +68,7 @@ namespace Admin.Core.Socket
return EasyTask.CompletedTask; return EasyTask.CompletedTask;
};//有客户端正在连接 };//有客户端正在连接
service.Connected = (client, e) => { client.Logger.Info($"{client.IP}:{client.Port} 客户端连接成功!目前客户端连接数{service.Count}"); service.Connected = (client, e) => { client.Logger.Info($"{client.IP}:{client.Port} 客户端连接成功!目前客户端连接数{service.Count}");
log.Info($"{client.IP}:{client.Port} 客户端连接成功!目前客户端连接数{service.Count}");
SetProdStoreClientId(client); SetProdStoreClientId(client);
return EasyTask.CompletedTask; return EasyTask.CompletedTask;
@ -89,6 +89,7 @@ namespace Admin.Core.Socket
try try
{ {
var mes = Encoding.UTF8.GetString(e.ByteBlock.Buffer, 0, e.ByteBlock.Len);//注意数据长度是byteBlock.Len var mes = Encoding.UTF8.GetString(e.ByteBlock.Buffer, 0, e.ByteBlock.Len);//注意数据长度是byteBlock.Len
log.Info("原始报文:"+mes);
//心跳包 //心跳包
if (mes== "heartbeat") if (mes== "heartbeat")
{ {
@ -104,6 +105,7 @@ namespace Admin.Core.Socket
} }
else else
{ {
log.Info("条码报文:" + mes);
ReceiveCodeDelegateEvent?.Invoke(client.IP,mes); ReceiveCodeDelegateEvent?.Invoke(client.IP,mes);
client.Logger.Info($"已从{client.IP}:{client.Port}》接收到信息:{mes}"); client.Logger.Info($"已从{client.IP}:{client.Port}》接收到信息:{mes}");
} }

@ -223,7 +223,7 @@
"Enabled": true, "Enabled": true,
//"IP": "127.0.0.1", //"IP": "127.0.0.1",
// "Port": 6000 // "Port": 6000
"IP": "10.10.92.72", "IP": "10.10.92.70",
"Port": 2014 "Port": 2014
}, },
{ {
@ -232,7 +232,7 @@
"PlcType": "Melsec", "PlcType": "Melsec",
"Enabled": true, "Enabled": true,
"IP": "10.10.92.22", "IP": "10.10.92.22",
"Port": 2015 "Port": 2014
}, },
{ {
"Id": 3, "Id": 3,
@ -240,7 +240,7 @@
"PlcType": "Melsec", "PlcType": "Melsec",
"Enabled": true, "Enabled": true,
"IP": "10.10.92.29", "IP": "10.10.92.29",
"Port": 2015 "Port": 2014
}, },
{ {
"Id": 4, "Id": 4,
@ -248,7 +248,7 @@
"PlcType": "Melsec", "PlcType": "Melsec",
"Enabled": true, "Enabled": true,
"IP": "10.10.92.10", "IP": "10.10.92.10",
"Port": 2015 "Port": 2014
}, },
{ {
"Id": 5, "Id": 5,
@ -256,7 +256,7 @@
"PlcType": "Melsec", "PlcType": "Melsec",
"Enabled": true, "Enabled": true,
"IP": "10.10.92.1", "IP": "10.10.92.1",
"Port": 2015 "Port": 2014
}, },
{ {
"Id": 6, "Id": 6,
@ -264,7 +264,7 @@
"PlcType": "Melsec", "PlcType": "Melsec",
"Enabled": true, "Enabled": true,
"IP": "10.10.92.49", "IP": "10.10.92.49",
"Port": 2015 "Port": 2014
}, },
{ {
"Id": 7, "Id": 7,

@ -26,7 +26,7 @@ namespace Aucma.Core.Palletiz.ViewModels
/// <summary> /// <summary>
/// 扫描记录刷新 /// 扫描记录刷新
/// </summary> /// </summary>
public delegate void RefreshInfo(); public delegate Task RefreshInfo();
public static event RefreshInfo? RefreshInfoEvent; public static event RefreshInfo? RefreshInfoEvent;

@ -32,15 +32,15 @@ namespace Aucma.Core.Palletiz.ViewModels
#region 加载DataGrid数据 #region 加载DataGrid数据
private async void LoadData() private async Task LoadData()
{ {
//Task.Run(() => await Task.Run(() =>
//{ {
try try
{ {
List<RecordInStore> list = await _recordInstoreServices.QueryAsync(x => (x.StoreCode == storeCodeA || x.StoreCode == storeCodeB) && x.InStoreTime >= DateTime.Today); List<RecordInStore> list = _recordInstoreServices.QueryAsync(x => (x.StoreCode == storeCodeA || x.StoreCode == storeCodeB) && x.InStoreTime >= DateTime.Today).Result;
if (list != null && list.Count > 0) if (list != null && list.Count > 0)
{ {
list.OrderByDescending(x => x.InStoreTime); list.OrderByDescending(x => x.InStoreTime);
@ -58,7 +58,7 @@ namespace Aucma.Core.Palletiz.ViewModels
Console.WriteLine("" + ex.Message.ToString()); Console.WriteLine("" + ex.Message.ToString());
} }
// }); });
//MaterialDataGrid.Add(new MaterialComplateInfo() { No = 1, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉SC", PlanAmount = 50, CompleteAmount = 10 }); //MaterialDataGrid.Add(new MaterialComplateInfo() { No = 1, ProductPlanCode = "8659452123",MaterialCode = "8659452123", MaterialName = "SC-AUCMA-农夫山泉SC", PlanAmount = 50, CompleteAmount = 10 });
@ -84,7 +84,9 @@ namespace Aucma.Core.Palletiz.ViewModels
/// 查询 /// 查询
/// </summary> /// </summary>
[RelayCommand] [RelayCommand]
private void ExecQuery(object obj) private async Task ExecQuery(object obj)
{
await Task.Run(() =>
{ {
string result = (string)obj; string result = (string)obj;
@ -100,11 +102,7 @@ namespace Aucma.Core.Palletiz.ViewModels
}); });
} }
} }
});
} }
#endregion #endregion
} }

Loading…
Cancel
Save