|
|
|
|
@ -1,31 +1,21 @@
|
|
|
|
|
using Khd.Core.Domain.Models;
|
|
|
|
|
using Khd.Core.EntityFramework;
|
|
|
|
|
using Khd.Core.Plc.S7.Types;
|
|
|
|
|
using Masuit.Tools.Logging;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
|
using Microsoft.Win32;
|
|
|
|
|
using OfficeOpenXml;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Threading;
|
|
|
|
|
using Thrift.Protocol;
|
|
|
|
|
using Thrift.Server;
|
|
|
|
|
using Thrift.Transport;
|
|
|
|
|
using ThriftService;
|
|
|
|
|
using Z.EntityFramework.Plus;
|
|
|
|
|
using Jc.SnowId;
|
|
|
|
|
using Masuit.Tools;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using Khd.Core.Wpf.Scan;
|
|
|
|
|
using System.IO.Ports;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
|
|
|
|
|
namespace Khd.Core.Wpf.Form
|
|
|
|
|
{
|
|
|
|
|
@ -42,6 +32,8 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
private DispatcherTimer ShowOrderMessage;//呈现PLC机柜信息
|
|
|
|
|
private object order_code;
|
|
|
|
|
private int UpState;//对应上件站点的状态,0为良好 1为损坏
|
|
|
|
|
private SerialPortModel serialPortModel;
|
|
|
|
|
private SerialPortHelper serialPortHelper;
|
|
|
|
|
List<BasePlcpoint> basePlcpoints = new List<BasePlcpoint>();
|
|
|
|
|
object timerjilu;
|
|
|
|
|
public class barcodeinfo
|
|
|
|
|
@ -55,6 +47,37 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
public List<barcodeinfo> barcodeLsit = new List<barcodeinfo>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void ScanMessage()
|
|
|
|
|
{
|
|
|
|
|
while (true)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
if (SystemData.isUpdate)
|
|
|
|
|
{
|
|
|
|
|
if (!string.IsNullOrEmpty(SystemData.message))
|
|
|
|
|
{
|
|
|
|
|
Dispatcher.Invoke(() =>
|
|
|
|
|
{
|
|
|
|
|
var focusedElement = FocusManager.GetFocusedElement(this);
|
|
|
|
|
if (focusedElement is TextBox textBox)
|
|
|
|
|
{
|
|
|
|
|
textBox.Text = SystemData.message;
|
|
|
|
|
SystemData.isUpdate = false;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
//检测到哪个文本框获取到了焦点
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
Thread.Sleep(500);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string selectedId;
|
|
|
|
|
//FormShowSelect formSelect;
|
|
|
|
|
// public static int WeekNo = CommonHelper.WeekOfYear(DateTime.Now, new System.Globalization.CultureInfo("zh-CN"));
|
|
|
|
|
@ -79,6 +102,18 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
MaxHeight = SystemParameters.MaximizedPrimaryScreenHeight;
|
|
|
|
|
WindowState = WindowState.Maximized;
|
|
|
|
|
}
|
|
|
|
|
serialPortModel = new SerialPortModel();
|
|
|
|
|
serialPortModel.PortName = "COM7";
|
|
|
|
|
serialPortModel.BaudRate = 9600;
|
|
|
|
|
serialPortModel.DataBits = 8;
|
|
|
|
|
serialPortModel.Parity = Parity.None;
|
|
|
|
|
serialPortModel.StopBits = StopBits.One;
|
|
|
|
|
serialPortHelper = new SerialPortHelper();
|
|
|
|
|
serialPortHelper.OpenMyConn(serialPortModel);
|
|
|
|
|
|
|
|
|
|
Thread scanThread = new Thread(ScanMessage);
|
|
|
|
|
scanThread.IsBackground = true;
|
|
|
|
|
scanThread.Start();
|
|
|
|
|
//加载dategrid信息
|
|
|
|
|
//LoadMaterial_GetMessage("");
|
|
|
|
|
//连接PLC判断
|
|
|
|
|
@ -375,7 +410,6 @@ namespace Khd.Core.Wpf.Form
|
|
|
|
|
MessageBox.Show("请输入有效的数字");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 料箱扫描
|
|
|
|
|
/// </summary>
|
|
|
|
|
|