diff --git a/SlnMesnac.Common/DLL/FJ500_ExtData.dll b/SlnMesnac.Common/DLL/FJ500_ExtData.dll new file mode 100644 index 0000000..f234dc9 Binary files /dev/null and b/SlnMesnac.Common/DLL/FJ500_ExtData.dll differ diff --git a/SlnMesnac.Common/GunHelper.cs b/SlnMesnac.Common/GunHelper.cs index 57c13e0..0e5d4db 100644 --- a/SlnMesnac.Common/GunHelper.cs +++ b/SlnMesnac.Common/GunHelper.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.DependencyInjection; +using FJ500Comm; +using Microsoft.Extensions.DependencyInjection; using System; using System.Collections.Generic; using System.IO; @@ -37,13 +38,17 @@ namespace SlnMesnac.Common public delegate void PushCode(string code); public static event PushCode PushCodeEvent; - - + private FJ500SP fj500sF = new FJ500SP(); + //初始化串口并启动接收数据 public void InstanceSerialPort() { try { + string[] data1 = new string[] { "123" }; + // string[] data = new string[] { "202408101111" }; + string aaa = fj500sF.SendData(data1, 1); + //端口名 注:因为使用的是USB转RS232 所以去设备管理器中查看一下虚拟com口的名字 serialPort.PortName = "COM1";// portName; //波特率 霍尼威尔扫码枪115200,普通9600 @@ -102,6 +107,12 @@ namespace SlnMesnac.Common /// public void SendData(string data) { + string[] data1 = new string[] { "123" }; + // string[] data = new string[] { "202408101111" }; + fj500sF.SendData( data1, 2); + + + byte[] buffer = GetBytesByCommand(data); serialPort.Write(buffer, 0, buffer.Length); diff --git a/SlnMesnac.Common/SlnMesnac.Common.csproj b/SlnMesnac.Common/SlnMesnac.Common.csproj index 526ea2e..1b54830 100644 --- a/SlnMesnac.Common/SlnMesnac.Common.csproj +++ b/SlnMesnac.Common/SlnMesnac.Common.csproj @@ -14,4 +14,10 @@ + + + DLL\FJ500_ExtData.dll + + + diff --git a/SlnMesnac.Library/FJ500_ExtData.dll b/SlnMesnac.Library/FJ500_ExtData.dll new file mode 100644 index 0000000..f234dc9 Binary files /dev/null and b/SlnMesnac.Library/FJ500_ExtData.dll differ diff --git a/SlnMesnac.WPF/ViewModel/ProdMgmtViewModel.cs b/SlnMesnac.WPF/ViewModel/ProdMgmtViewModel.cs index c2ce16e..f25f402 100644 --- a/SlnMesnac.WPF/ViewModel/ProdMgmtViewModel.cs +++ b/SlnMesnac.WPF/ViewModel/ProdMgmtViewModel.cs @@ -169,8 +169,8 @@ namespace SlnMesnac.WPF.ViewModel public ProdMgmtViewModel() { + gunHelper.InstanceSerialPort(); - StartProdPlanCommand = new RelayCommand(obj => StartProdPlan(obj)); StopProdPlanCommand = new RelayCommand(obj => StopProdPlan(obj)); _logger = App.ServiceProvider.GetService>();