|
|
|
@ -4,6 +4,7 @@ using Khd.Core.Domain.Auth;
|
|
|
|
using Khd.Core.Domain.Dto.webapi;
|
|
|
|
using Khd.Core.Domain.Dto.webapi;
|
|
|
|
using Khd.Core.Domain.Models;
|
|
|
|
using Khd.Core.Domain.Models;
|
|
|
|
using Khd.Core.EntityFramework;
|
|
|
|
using Khd.Core.EntityFramework;
|
|
|
|
|
|
|
|
using Khd.Core.Library.Extensions;
|
|
|
|
using Khd.Core.Library.Mapper;
|
|
|
|
using Khd.Core.Library.Mapper;
|
|
|
|
using Khd.Core.Plc;
|
|
|
|
using Khd.Core.Plc;
|
|
|
|
using Khd.Core.Plc.S7;
|
|
|
|
using Khd.Core.Plc.S7;
|
|
|
|
@ -62,6 +63,7 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
private object order_code;
|
|
|
|
private object order_code;
|
|
|
|
private int UpState;//对应上件站点的状态,0为良好 1为损坏
|
|
|
|
private int UpState;//对应上件站点的状态,0为良好 1为损坏
|
|
|
|
private SerialPortModel serialPortModel;
|
|
|
|
private SerialPortModel serialPortModel;
|
|
|
|
|
|
|
|
private SerialPortModel virtualSerialPortModel;
|
|
|
|
private SerialPortHelper serialPortHelper;
|
|
|
|
private SerialPortHelper serialPortHelper;
|
|
|
|
List<BasePlcpoint> basePlcpoints = new List<BasePlcpoint>();
|
|
|
|
List<BasePlcpoint> basePlcpoints = new List<BasePlcpoint>();
|
|
|
|
object timerjilu;
|
|
|
|
object timerjilu;
|
|
|
|
@ -245,17 +247,40 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
string ip = NetworkHelper.GetFirstLocalIPv4Address();
|
|
|
|
|
|
|
|
if ("192.168.2.26".Equals(ip))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// 获取所有可用的串口名称
|
|
|
|
|
|
|
|
string[] portNames = SerialPort.GetPortNames();
|
|
|
|
|
|
|
|
//虚拟串口
|
|
|
|
|
|
|
|
virtualSerialPortModel = new SerialPortModel();
|
|
|
|
|
|
|
|
virtualSerialPortModel = new SerialPortModel();
|
|
|
|
|
|
|
|
virtualSerialPortModel.PortName = "COM10";
|
|
|
|
|
|
|
|
virtualSerialPortModel.BaudRate = 9600;
|
|
|
|
|
|
|
|
virtualSerialPortModel.DataBits = 8;
|
|
|
|
|
|
|
|
virtualSerialPortModel.Parity = Parity.None;
|
|
|
|
|
|
|
|
virtualSerialPortModel.StopBits = StopBits.One;
|
|
|
|
|
|
|
|
serialPortHelper = new SerialPortHelper();
|
|
|
|
|
|
|
|
serialPortHelper.OpenVirtualMyConn(virtualSerialPortModel);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//扫码枪串口
|
|
|
|
serialPortModel = new SerialPortModel();
|
|
|
|
serialPortModel = new SerialPortModel();
|
|
|
|
serialPortModel.PortName = "COM1";
|
|
|
|
serialPortModel.PortName = "COM1";
|
|
|
|
serialPortModel.BaudRate = 9600;
|
|
|
|
serialPortModel.BaudRate = 9600;
|
|
|
|
serialPortModel.DataBits = 8;
|
|
|
|
serialPortModel.DataBits = 8;
|
|
|
|
serialPortModel.Parity = Parity.None;
|
|
|
|
serialPortModel.Parity = Parity.None;
|
|
|
|
serialPortModel.StopBits = StopBits.One;
|
|
|
|
serialPortModel.StopBits = StopBits.One;
|
|
|
|
serialPortHelper = new SerialPortHelper();
|
|
|
|
// serialPortHelper = new SerialPortHelper();
|
|
|
|
serialPortHelper.OpenMyConn(serialPortModel);
|
|
|
|
serialPortHelper.OpenMyConn(serialPortModel);
|
|
|
|
Thread scanThread = new Thread(ScanMessage);
|
|
|
|
Thread scanThread = new Thread(ScanMessage);
|
|
|
|
scanThread.IsBackground = true;
|
|
|
|
scanThread.IsBackground = true;
|
|
|
|
scanThread.Start();
|
|
|
|
scanThread.Start();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -342,6 +367,8 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void TaskOrderTimer(object? obj)
|
|
|
|
private void TaskOrderTimer(object? obj)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
while (true)
|
|
|
|
while (true)
|
|
|
|
|