| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106 | 
							- using System;
 
- using System.Collections.Generic;
 
- using System.ComponentModel;
 
- using System.Data;
 
- using System.Drawing;
 
- using System.Linq;
 
- using System.Text;
 
- using System.Threading.Tasks;
 
- using System.Windows.Forms;
 
- using static MainForm.SQLHelper;
 
- namespace MainForm.FaForm
 
- {
 
-     public partial class BandBarodeDialog : Form
 
-     {
 
-         public string pcbCode { get; private set; }
 
-         public string _CarrierBarcode { private get;  set; }
 
-         public string _ProductBarcode { private get;  set; }
 
-         public string _PCBBarcode { private get; set; }
 
-         private Timer _inputTimer;
 
-         public BandBarodeDialog()
 
-         {
 
-             InitializeComponent();
 
-             //置顶
 
-             this.TopMost = true; 
 
-             // 设置窗口相对于父窗口居中
 
-             this.StartPosition = FormStartPosition.CenterParent;
 
-             this.Shown += MainForm_Shown;
 
-         }
 
-         private void BandBarodeDialog_Load(object sender, EventArgs e)
 
-         {
 
-             CarrierBarcode.Text = _CarrierBarcode;
 
-             ProductBarcode.Text = _ProductBarcode;
 
-             PCBBarcode.Text = _PCBBarcode;
 
-             Barcode.Text = string.Empty;
 
-             Form_Home.isNoStop=true;
 
-             // 初始化定时器
 
-             _inputTimer = new Timer();
 
-             _inputTimer.Interval = 500; // 500毫秒
 
-             _inputTimer.Tick += InputTimer_Tick;
 
-             // 绑定 TextChanged 事件
 
-             Barcode.TextChanged += PCBBarcode_TextChanged;
 
-         }
 
-         private void button1_Click(object sender, EventArgs e)
 
-         {
 
-             Close();
 
-         }
 
-         private void PCBBarcode_TextChanged(object sender, EventArgs e)
 
-         {
 
-             // 每次文本变化时重置定时器
 
-             _inputTimer.Stop();
 
-             _inputTimer.Start();
 
-         }
 
-         private void InputTimer_Tick(object sender, EventArgs e)
 
-         {
 
-             // 定时器触发,表示输入已经完成
 
-             _inputTimer.Stop();
 
-             // 处理条码
 
-             string pcbcode = Barcode.Text.Trim();
 
-             if (!string.IsNullOrEmpty(pcbcode))
 
-             {
 
-                 var Carrierdt = Db.Queryable<CarrierBind>()
 
-                   .Where(x => ( x.CarrierCode == _CarrierBarcode && x.PCBBarcode == pcbcode) || x.ProductBarcode == pcbcode)
 
-                   .OrderByDescending(x => x.ID)
 
-                   .Take(1)
 
-                   .ToList();
 
-                 if (Carrierdt != null && Carrierdt.Count > 0)
 
-                 {
 
-                     closeWin();
 
-                 }
 
-                 else
 
-                 {
 
-                     ErrorLab.Text=$"校验失败:PCB码[{pcbcode}]与载具码[{_CarrierBarcode}]未绑定";
 
-                 }
 
-             }
 
-         }
 
-         private void closeWin() {
 
-             _CarrierBarcode = string.Empty;
 
-             _ProductBarcode = string.Empty;
 
-             this.DialogResult= DialogResult.OK;
 
-             this.Close();
 
-         }
 
-         private void MainForm_Shown(object sender, EventArgs e)
 
-         {
 
-             // 将焦点设置到 textBox1
 
-             Barcode.Focus();
 
-         }
 
-         private void BandBarodeDialog_FormClosing(object sender, FormClosingEventArgs e)
 
-         {
 
-             Form_Home.isNoStop = false;
 
-         }
 
-     }
 
- }
 
 
  |