|
@@ -85,13 +85,14 @@ namespace SCADA_DAQ.Customer
|
|
|
|
|
|
private void BarcodeReader1_BarCodeReceived(object sender, SCADA.BarcodeReader.BarcodeReceivedEventArgs e)
|
|
private void BarcodeReader1_BarCodeReceived(object sender, SCADA.BarcodeReader.BarcodeReceivedEventArgs e)
|
|
{
|
|
{
|
|
- if (e.Barcode == null || e.Barcode == "" || e.Barcode == "NoRead" || e.Barcode == this.Barcode)
|
|
|
|
|
|
+ if (e.Barcode == null || e.Barcode == "" || e.Barcode == "NoRead" || e.Barcode == this.Barcode
|
|
|
|
+ || BarcodeInfo.Count == 0 || !(BarcodeInfo.ContainsKey(e.Barcode)))
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
this.Barcode = e.Barcode;
|
|
this.Barcode = e.Barcode;
|
|
- var _long = BarcodeInfo[e.Barcode]?.Long;
|
|
|
|
- var _wide = BarcodeInfo[e.Barcode]?.Wide;
|
|
|
|
|
|
+ var _long = BarcodeInfo[e.Barcode].Long;
|
|
|
|
+ var _wide = BarcodeInfo[e.Barcode].Wide;
|
|
if (_long == null || _wide == null)
|
|
if (_long == null || _wide == null)
|
|
{
|
|
{
|
|
return;
|
|
return;
|
|
@@ -104,30 +105,31 @@ namespace SCADA_DAQ.Customer
|
|
TextContent.Text = e.Barcode;
|
|
TextContent.Text = e.Barcode;
|
|
TextContentTime.Text = e.TimeStamp.ToLongTimeString();
|
|
TextContentTime.Text = e.TimeStamp.ToLongTimeString();
|
|
//ASCIICode.Text = Encoding.UTF8.GetString(_byte);
|
|
//ASCIICode.Text = Encoding.UTF8.GetString(_byte);
|
|
- ASCIICode.Text = string.Join(" ",Encoding.UTF8.GetString(_byte));
|
|
|
|
|
|
+ LongAndWide.Text = string.Join("", ASCIIEncoding.ASCII.GetString(_byte));
|
|
|
|
+ ASCIICode.Text = string.Join(" ", _byte);
|
|
});
|
|
});
|
|
- using (var serialcomm = new SerialPort()
|
|
|
|
- {
|
|
|
|
- PortName = CustomerEnv.CustomerConfig.SerialModel.PortName,
|
|
|
|
- BaudRate = CustomerEnv.CustomerConfig.SerialModel.BaudRate,
|
|
|
|
- DataBits = CustomerEnv.CustomerConfig.SerialModel.DataBits,
|
|
|
|
- StopBits = CustomerEnv.CustomerConfig.SerialModel.StopBits,
|
|
|
|
- Parity = CustomerEnv.CustomerConfig.SerialModel.Parity,
|
|
|
|
- ReadTimeout = CustomerEnv.CustomerConfig.SerialModel.Timeout,
|
|
|
|
- ReadBufferSize = 102400
|
|
|
|
- })
|
|
|
|
- {
|
|
|
|
- try
|
|
|
|
- {
|
|
|
|
- serialcomm.Open();
|
|
|
|
- serialcomm.Write(_byte, 0, _byte.Count());
|
|
|
|
- }
|
|
|
|
- catch
|
|
|
|
- {
|
|
|
|
|
|
+ //using (var serialcomm = new SerialPort()
|
|
|
|
+ //{
|
|
|
|
+ // PortName = CustomerEnv.CustomerConfig.SerialModel.PortName,
|
|
|
|
+ // BaudRate = CustomerEnv.CustomerConfig.SerialModel.BaudRate,
|
|
|
|
+ // DataBits = CustomerEnv.CustomerConfig.SerialModel.DataBits,
|
|
|
|
+ // StopBits = CustomerEnv.CustomerConfig.SerialModel.StopBits,
|
|
|
|
+ // Parity = CustomerEnv.CustomerConfig.SerialModel.Parity,
|
|
|
|
+ // ReadTimeout = CustomerEnv.CustomerConfig.SerialModel.Timeout,
|
|
|
|
+ // ReadBufferSize = 102400
|
|
|
|
+ //})
|
|
|
|
+ //{
|
|
|
|
+ // try
|
|
|
|
+ // {
|
|
|
|
+ // serialcomm.Open();
|
|
|
|
+ // serialcomm.Write(_byte, 0, _byte.Count());
|
|
|
|
+ // }
|
|
|
|
+ // catch
|
|
|
|
+ // {
|
|
|
|
|
|
- }
|
|
|
|
- serialcomm.Dispose();
|
|
|
|
- }
|
|
|
|
|
|
+ // }
|
|
|
|
+ // serialcomm.Dispose();
|
|
|
|
+ //}
|
|
}
|
|
}
|
|
|
|
|
|
private void MyButton_Click(object sender, OpenFileButton.OpenFileButtonMouseEventArgs e)
|
|
private void MyButton_Click(object sender, OpenFileButton.OpenFileButtonMouseEventArgs e)
|