using BO.BO; using BO.Utils; using BO.Utils.BillRpc; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; namespace QualityAndOrder { public partial class QualityOrderForm : Form, IAfterLogin { #region IAfterLogin public string RoleName { get { return "验质员"; } } public Form Generate() { return this; } #endregion private delegate void InvokeHandler(); List> hogGradeList; List houseList; List sanctionList; List weightBills; HouseAndSanctionEdit Dmo; Thread syncThread; readonly Color btnSelectForeColor = Color.FromArgb(255, 255, 255); readonly Color btnSelectBackColor = Color.FromArgb(66, 163, 218); Color btnUnSelectForeColor = SystemColors.ControlText; Color btnUnSelectBackColor = Color.FromArgb(225, 225, 225); public QualityOrderForm() { InitializeComponent(); testTimeInput.Date = DateTime.Today; this.uTabControl1.Selected += (sender, e) => { this.Text = e.TabPage.Text; }; sanctionGrid.AutoGenerateColumns = false; weightBillGrid.AutoGenerateColumns = false; weightBillGrid.DataSource = null; hogGradeList = BaseInfoRpcUtil.GetBaseInfoEntity("GetHogGradeList"); houseList = HouseSplitEntity.Init(BaseInfoRpcUtil.GetBaseInfoEntity("GetLiveColonyHouseList")); sanctionList = SanctionSplit3Part.Init(BaseInfoRpcUtil.GetSanctionList()); AddKeyPadForTab1(); AddHogGradeBtn(); BindSanctionGrid(); AddHouseBtn(); numberBox.LostFocus += (sender, e) => { flag = 1; }; sanctionGrid.GotFocus += (sender, e) => { flag = 2; }; syncThread = new Thread(SyncTask); syncThread.Start(); this.FormClosing += delegate { if (syncThread.IsAlive) syncThread.Abort(); if (tb2SyncThread != null && tb2SyncThread.IsAlive) tb2SyncThread.Abort(); }; Tab2Init(); } private void SyncTask() { while (true) { Thread.Sleep(2000); this.Invoke(new InvokeHandler(delegate() { BindNumberLabel(); })); } } int flag = 1; List