change-引入喷码机DLL

dev
liuwf 3 months ago
parent 58d5fa154d
commit 1908ab07d6

@ -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
/// <param name="data"></param>
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);

@ -14,4 +14,10 @@
<PackageReference Include="System.Text.Json" Version="8.0.4" />
</ItemGroup>
<ItemGroup>
<Reference Include="FJ500_ExtData">
<HintPath>DLL\FJ500_ExtData.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

@ -169,7 +169,7 @@ namespace SlnMesnac.WPF.ViewModel
public ProdMgmtViewModel()
{
gunHelper.InstanceSerialPort();
StartProdPlanCommand = new RelayCommand<string>(obj => StartProdPlan(obj));
StopProdPlanCommand = new RelayCommand<string>(obj => StopProdPlan(obj));

Loading…
Cancel
Save