mengshunguo 1 month ago
parent
commit
5080aada0d
1 changed files with 13 additions and 11 deletions
  1. 13 11
      SCADA_DAQ/Customer/UctFrmMain.xaml.cs

+ 13 - 11
SCADA_DAQ/Customer/UctFrmMain.xaml.cs

@@ -57,20 +57,21 @@ namespace SCADA_DAQ.Customer
         /// <summary>
         /// 条形码的索引
         /// </summary>
-        int Barcode;
+        int BarcodeIndx;
 
         /// <summary>
         /// 长的索引
         /// </summary>
-        int Long;
+        int LongIndx;
 
         /// <summary>
         /// 宽的索引
         /// </summary>
-        int Wide;
+        int WideIndx;
         /// <summary>
-        /// /
+        /// /条码
         /// </summary>
+        string Barcode;
         public UctFrmMain()
         {
             InitializeComponent();
@@ -84,10 +85,11 @@ namespace SCADA_DAQ.Customer
 
         private void BarcodeReader1_BarCodeReceived(object sender, SCADA.BarcodeReader.BarcodeReceivedEventArgs e)
         {
-            if (e.Barcode == null || e.Barcode == "" || e.Barcode == "NoRead")
+            if (e.Barcode == null || e.Barcode == "" || e.Barcode == "NoRead" || e.Barcode == this.Barcode)
             {
                 return;
             }
+            this.Barcode = e.Barcode;
             var _long = BarcodeInfo[e.Barcode]?.Long;
             var _wide = BarcodeInfo[e.Barcode]?.Wide;
             if (_long == null || _wide == null)
@@ -165,15 +167,15 @@ namespace SCADA_DAQ.Customer
                         ExcelData.Columns.Add(col);
                         if (cellValue == "条形码")
                         {
-                            Barcode = i;
+                            BarcodeIndx = i;
                         }
                         if (cellValue == "长")
                         {
-                            Long = i;
+                            LongIndx = i;
                         }
                         if (cellValue == "宽")
                         {
-                            Wide = i;
+                            WideIndx = i;
                         }
                     }
                     else
@@ -199,19 +201,19 @@ namespace SCADA_DAQ.Customer
                     if (row.GetCell(j) != null)
                     {
                         dr[j] = row.GetCell(j).ToString();
-                        if (j == Barcode)
+                        if (j == BarcodeIndx)
                         {
                             var barcode = row.GetCell(j).ToString();
                             barcodeInfo.Barcode = barcode;
                             key = barcode;
                             BarcodeInfo.Add(key, new BarcodeInformation() { Barcode = barcode });
                         }
-                        if (j == Long)
+                        if (j == LongIndx)
                         {
                             barcodeInfo.Long = row.GetCell(j).ToString();
                             BarcodeInfo[key].Long = row.GetCell(j).ToString();
                         }
-                        if (j == Wide)
+                        if (j == WideIndx)
                         {
                             barcodeInfo.Wide = row.GetCell(j).ToString();
                             BarcodeInfo[key].Wide = row.GetCell(j).ToString();