diff --git a/DNSD_DB/DNSD_DB.csproj b/DNSD_DB/DNSD_DB.csproj index 4e7c0a0..6e76936 100644 --- a/DNSD_DB/DNSD_DB.csproj +++ b/DNSD_DB/DNSD_DB.csproj @@ -36,14 +36,14 @@ - - ..\packages\Chloe.5.27.0\lib\net46\Chloe.dll + + ..\packages\Chloe.5.30.0\lib\net46\Chloe.dll ..\packages\Chloe.Extension.5.25.0\lib\net46\Chloe.Extension.dll - - ..\packages\Chloe.SQLite.5.27.0\lib\net46\Chloe.SQLite.dll + + ..\packages\Chloe.SQLite.5.30.0\lib\net46\Chloe.SQLite.dll diff --git a/DNSD_DB/packages.config b/DNSD_DB/packages.config index 1c941cc..e7bb4e8 100644 --- a/DNSD_DB/packages.config +++ b/DNSD_DB/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/NDSD-Screwdriver/MainForm.cs b/NDSD-Screwdriver/MainForm.cs index 97fe3d4..4e415fa 100644 --- a/NDSD-Screwdriver/MainForm.cs +++ b/NDSD-Screwdriver/MainForm.cs @@ -93,8 +93,6 @@ namespace NDSD_Screwdriver tool = new DengTool(); tool.Start(); - - FlashThreadTime(); var memorySetting = MemorySetting.Current; @@ -168,7 +166,7 @@ namespace NDSD_Screwdriver /// private void DOTest_Click(object sender, EventArgs e) { - //string str = serialPort.Read(); + ScrewdriverTest screwdriverTest = new ScrewdriverTest(server, DOperateInfo); screwdriverTest.Show(); } @@ -230,7 +228,7 @@ namespace NDSD_Screwdriver monitorEntities.Add(new MonitorEntity() { RowIndex = i, - RowEntitys = InitRows(i) + RowEntitys = InitRows() }); } //更新值 @@ -452,7 +450,7 @@ namespace NDSD_Screwdriver } if(_flashflag) timer.Stop(); - Thread.Sleep(500); + //刷新IO的状态 for (int i = 0; i < RFIDStatesEntities.Count; i++) { @@ -507,9 +505,8 @@ namespace NDSD_Screwdriver /// /// 初始化一行 /// - /// 当前的初始化行数 /// - private List InitRows(int rowNo) + private List InitRows() { List rowEntities = new List(); for (int i = 0; i < 3; i++) diff --git a/NDSD-Screwdriver/MemorySetting.cs b/NDSD-Screwdriver/MemorySetting.cs index e4e072e..4765b49 100644 --- a/NDSD-Screwdriver/MemorySetting.cs +++ b/NDSD-Screwdriver/MemorySetting.cs @@ -40,6 +40,9 @@ namespace NDSD_Screwdriver public String Com { get; set; } + + + public String ServiceIp { get; set; } = "tcp://127.0.0.1:7789"; } diff --git a/NDSD-Screwdriver/NDSD_Screwdriver.csproj b/NDSD-Screwdriver/NDSD_Screwdriver.csproj index 2819a31..5bffb32 100644 --- a/NDSD-Screwdriver/NDSD_Screwdriver.csproj +++ b/NDSD-Screwdriver/NDSD_Screwdriver.csproj @@ -33,16 +33,16 @@ 4 - - ..\packages\Chloe.5.27.0\lib\net46\Chloe.dll + + ..\packages\Chloe.5.30.0\lib\net46\Chloe.dll - - ..\packages\Chloe.SQLite.5.27.0\lib\net46\Chloe.SQLite.dll + + ..\packages\Chloe.SQLite.5.30.0\lib\net46\Chloe.SQLite.dll - - ..\packages\NewLife.Core.10.10.2024.803\lib\net461\NewLife.Core.dll + + ..\packages\NewLife.Core.11.0.2024.826-beta0719\lib\net461\NewLife.Core.dll ..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll @@ -57,8 +57,8 @@ ..\Dll\System.Data.SQLite.dll - - ..\packages\System.IO.Ports.8.0.0\lib\net462\System.IO.Ports.dll + + ..\packages\System.IO.Ports.9.0.0-preview.7.24405.7\lib\net462\System.IO.Ports.dll @@ -88,13 +88,13 @@ - ..\packages\TouchSocket.2.1.0-rc.11\lib\net472\TouchSocket.dll + ..\packages\TouchSocket.2.1.0-rc.17\lib\net472\TouchSocket.dll - ..\packages\TouchSocket.Core.2.1.0-rc.11\lib\net472\TouchSocket.Core.dll + ..\packages\TouchSocket.Core.2.1.0-rc.17\lib\net472\TouchSocket.Core.dll - ..\packages\TouchSocket.SerialPorts.2.1.0-rc.11\lib\net472\TouchSocket.SerialPorts.dll + ..\packages\TouchSocket.SerialPorts.2.1.0-rc.17\lib\net472\TouchSocket.SerialPorts.dll @@ -122,6 +122,7 @@ + @@ -182,7 +183,7 @@ - + \ No newline at end of file diff --git a/NDSD-Screwdriver/Tool/ClientFactory.cs b/NDSD-Screwdriver/Tool/ClientFactory.cs new file mode 100644 index 0000000..3b329d2 --- /dev/null +++ b/NDSD-Screwdriver/Tool/ClientFactory.cs @@ -0,0 +1,46 @@ +using System; +using System.Text; +using TouchSocket.Sockets; + +namespace NDSD_Screwdriver.Tool +{ + public class ClientFactory + { + + + TcpClient client = new TcpClient(); + + private IWaitingClient waitClient; + + public ClientFactory(string ip) + { + + client.ConnectAsync(ip).ConfigureAwait(false).GetAwaiter().GetResult(); + + //调用CreateWaitingClient获取到IWaitingClient的对象。 + waitClient = client.CreateWaitingClient(new WaitingOptions() + { + FilterFunc = response => //设置用于筛选的fun委托,当返回为true时,才会响应返回 + true + }); + + } + + + public byte[] Send(string str) + { + + //然后使用SendThenReturn。 + byte[] returnData = waitClient.SendThenReturn(Encoding.UTF8.GetBytes(str)); + Console.WriteLine($"收到回应消息:{Encoding.UTF8.GetString(returnData)}"); + + + return returnData; + + //同时,如果适配器收到数据后,返回的并不是字节,而是IRequestInfo对象时,可以使用SendThenResponse. + //ResponsedData responsedData = await waitClient.SendThenResponse(Encoding.UTF8.GetBytes("RRQM")); + //IRequestInfo requestInfo = responsedData.RequestInfo;//同步收到的RequestInfo + } + + } +} \ No newline at end of file diff --git a/NDSD-Screwdriver/Tool/SerialPortFactory1.cs b/NDSD-Screwdriver/Tool/SerialPortFactory1.cs index 38d2122..2623509 100644 --- a/NDSD-Screwdriver/Tool/SerialPortFactory1.cs +++ b/NDSD-Screwdriver/Tool/SerialPortFactory1.cs @@ -3,7 +3,8 @@ using NewLife.Log; using NewLife; using System.IO.Ports; - +using System.Net.Http; +using NewLife.Http; using TouchSocket.Core; using TouchSocket.SerialPorts; using TouchSocket.Sockets; @@ -18,7 +19,7 @@ namespace NDSD_Screwdriver.Tool public SerialPortFactory(string portName) { clientSerialPortClient.Connecting = (client, e) => EasyTask.CompletedTask;//即将连接到端口 - clientSerialPortClient.Connected = (client, e) => { return EasyTask.CompletedTask; };//成功连接到端口 + clientSerialPortClient.Connected = (client, e) => EasyTask.CompletedTask;//成功连接到端口 clientSerialPortClient.Setup(new TouchSocket.Core.TouchSocketConfig() .SetSerialPortOption(new SerialPortOption() { diff --git a/NDSD-Screwdriver/packages.config b/NDSD-Screwdriver/packages.config index 57e2393..c0d0a5c 100644 --- a/NDSD-Screwdriver/packages.config +++ b/NDSD-Screwdriver/packages.config @@ -1,17 +1,17 @@  - - - + + + - + - - - + + + \ No newline at end of file diff --git a/NDSD-TouchSocket/NDSD_TouchSocket.csproj b/NDSD-TouchSocket/NDSD_TouchSocket.csproj index 1d0cbac..95891fa 100644 --- a/NDSD-TouchSocket/NDSD_TouchSocket.csproj +++ b/NDSD-TouchSocket/NDSD_TouchSocket.csproj @@ -33,8 +33,8 @@ - - ..\packages\NewLife.Core.10.10.2024.803\lib\net461\NewLife.Core.dll + + ..\packages\NewLife.Core.11.0.2024.826-beta0719\lib\net461\NewLife.Core.dll ..\NDSD-Screwdriver\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll @@ -45,8 +45,8 @@ - - ..\packages\System.IO.Ports.8.0.0\lib\net462\System.IO.Ports.dll + + ..\packages\System.IO.Ports.9.0.0-preview.7.24405.7\lib\net462\System.IO.Ports.dll @@ -74,13 +74,13 @@ - ..\packages\TouchSocket.2.1.0-rc.11\lib\net472\TouchSocket.dll + ..\packages\TouchSocket.2.1.0-rc.17\lib\net472\TouchSocket.dll - ..\packages\TouchSocket.Core.2.1.0-rc.11\lib\net472\TouchSocket.Core.dll + ..\packages\TouchSocket.Core.2.1.0-rc.17\lib\net472\TouchSocket.Core.dll - ..\packages\TouchSocket.SerialPorts.2.1.0-rc.11\lib\net472\TouchSocket.SerialPorts.dll + ..\packages\TouchSocket.SerialPorts.2.1.0-rc.17\lib\net472\TouchSocket.SerialPorts.dll @@ -96,7 +96,7 @@ - + \ No newline at end of file diff --git a/NDSD-TouchSocket/TcpServer.cs b/NDSD-TouchSocket/TcpServer.cs index 707be32..34ae1a7 100644 --- a/NDSD-TouchSocket/TcpServer.cs +++ b/NDSD-TouchSocket/TcpServer.cs @@ -178,17 +178,6 @@ namespace NDSD_TouchSocket } } - //private void BufferMemory(byte[] bytes) - //{ - // if (bytes[4] == 0x00 && bytes[5] == 0xB9) - // { - // BufferAnalysis.JudgeSingle(false); - // } - // else if (bytes[4] == 0xFF && bytes[5] == 0xF9) - // { - // BufferAnalysis.JudgeSingle(true); - // } - //} } } diff --git a/NDSD-TouchSocket/packages.config b/NDSD-TouchSocket/packages.config index 718d1cd..6db6ccc 100644 --- a/NDSD-TouchSocket/packages.config +++ b/NDSD-TouchSocket/packages.config @@ -1,15 +1,15 @@  - + - + - - - + + + \ No newline at end of file