|
@@ -80,29 +80,49 @@ namespace SCADA_DAQ.Customer
|
|
|
if (BarcodeReader1 != null)
|
|
|
{
|
|
|
BarcodeReader1.BarCodeReceived += BarcodeReader1_BarCodeReceived;
|
|
|
+ Log.Info("获取到读码器实例");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void BarcodeReader1_BarCodeReceived(object sender, SCADA.BarcodeReader.BarcodeReceivedEventArgs e)
|
|
|
{
|
|
|
- if (e.Barcode == null || e.Barcode == "" || e.Barcode == "NoRead" || e.Barcode == this.Barcode
|
|
|
- || BarcodeInfo.Count == 0 || !(BarcodeInfo.ContainsKey(e.Barcode)))
|
|
|
+ string barCode = null;
|
|
|
+ if (e.Barcode.Substring(0, 6) == "QRCode")
|
|
|
{
|
|
|
+ barCode = e.Barcode.Substring(6, e.Barcode.Length - 6).Trim();
|
|
|
+ Log.Info($"收到条码{barCode}");
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ barCode = e.Barcode.Trim();
|
|
|
+ Log.Info($"收到条码{barCode}");
|
|
|
+ }
|
|
|
+ if (barCode == null || barCode == "" || barCode == "NoRead" || barCode == this.Barcode
|
|
|
+ || BarcodeInfo.Count == 0 || !BarcodeInfo.ContainsKey(barCode))
|
|
|
+ {
|
|
|
+ if(barCode == this.Barcode)
|
|
|
+ {
|
|
|
+ Log.Info($"重复读码{barCode}");
|
|
|
+ }
|
|
|
+ else if(!BarcodeInfo.ContainsKey(barCode))
|
|
|
+ {
|
|
|
+ Log.Info($"Ecexl表中无此条码{barCode}信息");
|
|
|
+ }
|
|
|
return;
|
|
|
}
|
|
|
- this.Barcode = e.Barcode;
|
|
|
- var _long = BarcodeInfo[e.Barcode].Long;
|
|
|
- var _wide = BarcodeInfo[e.Barcode].Wide;
|
|
|
+ var _long = BarcodeInfo[barCode].Long;
|
|
|
+ var _wide = BarcodeInfo[barCode].Wide;
|
|
|
if (_long == null || _wide == null)
|
|
|
{
|
|
|
+ Log.Info($"Excel表中此条码{Barcode}的长宽信息不完善");
|
|
|
return;
|
|
|
}
|
|
|
var _string = $"{_long}#{_wide}";
|
|
|
- Log.Info($"收到条码信息{e.Barcode},发送长宽信息{_string}");
|
|
|
+ Log.Info($"收到条码信息{barCode},发送长宽信息{_string}");
|
|
|
var _byte = ASCIIEncoding.ASCII.GetBytes(_string);
|
|
|
Dispatcher.Invoke(() =>
|
|
|
{
|
|
|
- TextContent.Text = e.Barcode;
|
|
|
+ TextContent.Text = barCode;
|
|
|
TextContentTime.Text = e.TimeStamp.ToLongTimeString();
|
|
|
//ASCIICode.Text = Encoding.UTF8.GetString(_byte);
|
|
|
LongAndWide.Text = string.Join("", ASCIIEncoding.ASCII.GetString(_byte));
|
|
@@ -123,6 +143,7 @@ namespace SCADA_DAQ.Customer
|
|
|
{
|
|
|
serialcomm.Open();
|
|
|
serialcomm.Write(_byte, 0, _byte.Count());
|
|
|
+ this.Barcode = barCode;
|
|
|
}
|
|
|
catch
|
|
|
{
|
|
@@ -171,11 +192,11 @@ namespace SCADA_DAQ.Customer
|
|
|
{
|
|
|
BarcodeIndx = i;
|
|
|
}
|
|
|
- if (cellValue == "长")
|
|
|
+ if (cellValue == "开料长")
|
|
|
{
|
|
|
LongIndx = i;
|
|
|
}
|
|
|
- if (cellValue == "宽")
|
|
|
+ if (cellValue == "开料宽")
|
|
|
{
|
|
|
WideIndx = i;
|
|
|
}
|