diff --git a/BO/Utils/LoginRpcUtil.cs b/BO/Utils/LoginRpcUtil.cs index 69b69cb..745cf39 100644 --- a/BO/Utils/LoginRpcUtil.cs +++ b/BO/Utils/LoginRpcUtil.cs @@ -46,7 +46,7 @@ namespace BO.Utils } } - public static bool TestConnection() + public static bool TestConnection(int? millisecondsTimeout=null) { var url = ButcherAppContext.Context.UrlConfig.ServerUrl; if (string.IsNullOrEmpty(url)) @@ -55,7 +55,11 @@ namespace BO.Utils //{ //HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); var uri = new Uri(url); - return TestConnection(uri.Host, uri.Port, 1000); + if (millisecondsTimeout == null) + { + millisecondsTimeout = 50; + } + return TestConnection(uri.Host, uri.Port, millisecondsTimeout.Value); // HttpWebResponse resp = (HttpWebResponse)req.GetResponse(); diff --git a/ButcherManageClient/Login.cs b/ButcherManageClient/Login.cs index 9dc978a..3d6a0af 100644 --- a/ButcherManageClient/Login.cs +++ b/ButcherManageClient/Login.cs @@ -50,7 +50,7 @@ namespace ButcherManageClient throw new Exception("请输入用户名"); IniteRpcFacade(); ButcherAppContext.Context.UserConfig.PWD = pwd; - if (LoginRpcUtil.TestConnection()) + if (LoginRpcUtil.TestConnection(1000)) { await Task.Factory.StartNew(() => RpcFacade.Login(username, pwd)); LoginRpcUtil.FillUserEmpInfo(username, ButcherAppContext.Context.UserConfig); @@ -66,6 +66,7 @@ namespace ButcherManageClient ButcherAppContext.Context.UserConfig.Connection = false; } var form = AfterLoginUtil.CreateForm(ButcherAppContext.Context.UserConfig.Role); +// var form = AfterLoginUtil.CreateForm("定级员"); if (form == null) throw new Exception("权限不符"); form.FormClosing += delegate { SubFormClosing(); }; diff --git a/WeighAndGrading/GradeFrom.Designer.cs b/WeighAndGrading/GradeFrom.Designer.cs index 579cc6e..9b3275d 100644 --- a/WeighAndGrading/GradeFrom.Designer.cs +++ b/WeighAndGrading/GradeFrom.Designer.cs @@ -28,19 +28,19 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle40 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle41 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle43 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle42 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle44 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle45 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle47 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle46 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle48 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle49 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle52 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle50 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle51 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle27 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle28 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle30 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle29 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle31 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle32 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle34 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle33 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle35 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle36 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle39 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle37 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle38 = new System.Windows.Forms.DataGridViewCellStyle(); this.label1 = new System.Windows.Forms.Label(); this.syncBtn = new System.Windows.Forms.Button(); this.label2 = new System.Windows.Forms.Label(); @@ -217,17 +217,17 @@ this.tangGridView.AllowUserToDeleteRows = false; this.tangGridView.AllowUserToResizeColumns = false; this.tangGridView.AllowUserToResizeRows = false; - dataGridViewCellStyle40.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.tangGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle40; + dataGridViewCellStyle27.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.tangGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle27; this.tangGridView.BackgroundColor = System.Drawing.Color.White; - dataGridViewCellStyle41.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle41.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle41.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle41.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle41.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle41.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle41.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.tangGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle41; + dataGridViewCellStyle28.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle28.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle28.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle28.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle28.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle28.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle28.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.tangGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle28; this.tangGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.tangGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.T_OrderDetail_ID, @@ -241,11 +241,11 @@ this.tangGridView.Name = "tangGridView"; this.tangGridView.ReadOnly = true; this.tangGridView.RowHeadersVisible = false; - dataGridViewCellStyle43.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle43.ForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle43.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - dataGridViewCellStyle43.SelectionForeColor = System.Drawing.Color.Black; - this.tangGridView.RowsDefaultCellStyle = dataGridViewCellStyle43; + dataGridViewCellStyle30.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle30.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle30.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + dataGridViewCellStyle30.SelectionForeColor = System.Drawing.Color.Black; + this.tangGridView.RowsDefaultCellStyle = dataGridViewCellStyle30; this.tangGridView.RowTemplate.Height = 50; this.tangGridView.ScrollBars = System.Windows.Forms.ScrollBars.None; this.tangGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -295,9 +295,9 @@ // // T_FinishBtn // - dataGridViewCellStyle42.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle42.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); - this.T_FinishBtn.DefaultCellStyle = dataGridViewCellStyle42; + dataGridViewCellStyle29.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle29.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); + this.T_FinishBtn.DefaultCellStyle = dataGridViewCellStyle29; this.T_FinishBtn.HeaderText = "完毕"; this.T_FinishBtn.Name = "T_FinishBtn"; this.T_FinishBtn.ReadOnly = true; @@ -329,17 +329,17 @@ this.maoGridView.AllowUserToDeleteRows = false; this.maoGridView.AllowUserToResizeColumns = false; this.maoGridView.AllowUserToResizeRows = false; - dataGridViewCellStyle44.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.maoGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle44; + dataGridViewCellStyle31.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.maoGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle31; this.maoGridView.BackgroundColor = System.Drawing.Color.White; - dataGridViewCellStyle45.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle45.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle45.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle45.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle45.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle45.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle45.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.maoGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle45; + dataGridViewCellStyle32.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle32.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle32.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle32.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle32.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle32.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle32.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.maoGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle32; this.maoGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.maoGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.M_OrderDetail_ID, @@ -353,11 +353,11 @@ this.maoGridView.Name = "maoGridView"; this.maoGridView.ReadOnly = true; this.maoGridView.RowHeadersVisible = false; - dataGridViewCellStyle47.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle47.ForeColor = System.Drawing.Color.Black; - dataGridViewCellStyle47.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - dataGridViewCellStyle47.SelectionForeColor = System.Drawing.Color.Black; - this.maoGridView.RowsDefaultCellStyle = dataGridViewCellStyle47; + dataGridViewCellStyle34.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle34.ForeColor = System.Drawing.Color.Black; + dataGridViewCellStyle34.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + dataGridViewCellStyle34.SelectionForeColor = System.Drawing.Color.Black; + this.maoGridView.RowsDefaultCellStyle = dataGridViewCellStyle34; this.maoGridView.RowTemplate.Height = 50; this.maoGridView.ScrollBars = System.Windows.Forms.ScrollBars.Horizontal; this.maoGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -407,9 +407,9 @@ // // M_FinishBtn // - dataGridViewCellStyle46.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; - dataGridViewCellStyle46.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); - this.M_FinishBtn.DefaultCellStyle = dataGridViewCellStyle46; + dataGridViewCellStyle33.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; + dataGridViewCellStyle33.Padding = new System.Windows.Forms.Padding(5, 10, 5, 10); + this.M_FinishBtn.DefaultCellStyle = dataGridViewCellStyle33; this.M_FinishBtn.HeaderText = "完毕"; this.M_FinishBtn.Name = "M_FinishBtn"; this.M_FinishBtn.ReadOnly = true; @@ -455,10 +455,11 @@ this.lblHeJi.Size = new System.Drawing.Size(82, 24); this.lblHeJi.TabIndex = 53; this.lblHeJi.Text = "合计:"; + this.lblHeJi.Visible = false; // // vScrollBar2 // - this.vScrollBar2.Location = new System.Drawing.Point(425, 36); + this.vScrollBar2.Location = new System.Drawing.Point(426, 36); this.vScrollBar2.Name = "vScrollBar2"; this.vScrollBar2.Size = new System.Drawing.Size(40, 566); this.vScrollBar2.TabIndex = 52; @@ -479,17 +480,17 @@ this.historyGrid.AllowUserToDeleteRows = false; this.historyGrid.AllowUserToResizeColumns = false; this.historyGrid.AllowUserToResizeRows = false; - dataGridViewCellStyle48.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); - this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle48; + dataGridViewCellStyle35.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235))))); + this.historyGrid.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle35; this.historyGrid.BackgroundColor = System.Drawing.Color.White; - dataGridViewCellStyle49.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle49.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle49.Font = new System.Drawing.Font("宋体", 12F); - dataGridViewCellStyle49.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle49.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle49.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle49.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.historyGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle49; + dataGridViewCellStyle36.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle36.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle36.Font = new System.Drawing.Font("宋体", 12F); + dataGridViewCellStyle36.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle36.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle36.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle36.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.historyGrid.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle36; this.historyGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.historyGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.H_SID, @@ -501,14 +502,14 @@ this.H_Livestock_Name, this.H_Weight, this.H_Time}); - this.historyGrid.Location = new System.Drawing.Point(0, 36); + this.historyGrid.Location = new System.Drawing.Point(1, 36); this.historyGrid.MultiSelect = false; this.historyGrid.Name = "historyGrid"; this.historyGrid.ReadOnly = true; this.historyGrid.RowHeadersVisible = false; - dataGridViewCellStyle52.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle52.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); - this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle52; + dataGridViewCellStyle39.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle39.SelectionBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(66)))), ((int)(((byte)(163)))), ((int)(((byte)(218))))); + this.historyGrid.RowsDefaultCellStyle = dataGridViewCellStyle39; this.historyGrid.RowTemplate.Height = 40; this.historyGrid.ScrollBars = System.Windows.Forms.ScrollBars.None; this.historyGrid.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; @@ -574,8 +575,8 @@ // H_Weight // this.H_Weight.DataPropertyName = "Weight"; - dataGridViewCellStyle50.Format = "#0.######"; - this.H_Weight.DefaultCellStyle = dataGridViewCellStyle50; + dataGridViewCellStyle37.Format = "#0.######"; + this.H_Weight.DefaultCellStyle = dataGridViewCellStyle37; this.H_Weight.HeaderText = "重量"; this.H_Weight.Name = "H_Weight"; this.H_Weight.ReadOnly = true; @@ -584,9 +585,9 @@ // H_Time // this.H_Time.DataPropertyName = "Time"; - dataGridViewCellStyle51.Format = "HH:mm:ss"; - dataGridViewCellStyle51.NullValue = null; - this.H_Time.DefaultCellStyle = dataGridViewCellStyle51; + dataGridViewCellStyle38.Format = "HH:mm:ss"; + dataGridViewCellStyle38.NullValue = null; + this.H_Time.DefaultCellStyle = dataGridViewCellStyle38; this.H_Time.HeaderText = "时间"; this.H_Time.Name = "H_Time"; this.H_Time.ReadOnly = true; @@ -695,6 +696,7 @@ // // modifyPanel // + this.modifyPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.modifyPanel.Controls.Add(this.cancelBtn); this.modifyPanel.Controls.Add(this.stateLabel); this.modifyPanel.Location = new System.Drawing.Point(826, 112); @@ -773,7 +775,7 @@ this.btnAbnormalModify.Name = "btnAbnormalModify"; this.btnAbnormalModify.Size = new System.Drawing.Size(102, 54); this.btnAbnormalModify.TabIndex = 34; - this.btnAbnormalModify.Text = "异常"; + this.btnAbnormalModify.Text = "查询修改"; this.btnAbnormalModify.UseVisualStyleBackColor = true; this.btnAbnormalModify.Click += new System.EventHandler(this.btnAbnormalModify_Click); // diff --git a/WeighAndGrading/GradeFrom.cs b/WeighAndGrading/GradeFrom.cs index 013dbab..c1683c9 100644 --- a/WeighAndGrading/GradeFrom.cs +++ b/WeighAndGrading/GradeFrom.cs @@ -202,6 +202,8 @@ namespace WeighAndGrading btn.Click += (sender, e) => { +// btn.Enabled = false; +// Application.DoEvents(); JiBieButtonClick(btn); #region 改到方法JiBieButtonClick()里了 @@ -229,8 +231,8 @@ namespace WeighAndGrading #endregion - - +// btn.Enabled = true; +// Application.DoEvents(); //var name = livestock.Technics == 0 ? "带皮白条" : "去皮白条"; //Print(name, entity.Index); @@ -238,16 +240,10 @@ namespace WeighAndGrading }; if (item.Item3 == TANG_TECH) { -// btn.KeyDown += Btn_KeyDown; -// btn.KeyUp += Btn_KeyUp; - ttPanel.Controls.Add(btn); } else { -// btn.KeyDown += Btn_KeyDown; -// btn.KeyUp += Btn_KeyUp; - mbPanel.Controls.Add(btn); } } @@ -331,15 +327,38 @@ namespace WeighAndGrading { while (true) { - this.Invoke(new InvokeHandler(delegate () + var bc=new BackgroundWorker(); + bc.DoWork += Bc_DoWork; + bc.RunWorkerCompleted += Bc_RunWorkerCompleted; + if (!bc.IsBusy) { - BindTangGrid(); - BindMaoGrid(); - })); + bc.RunWorkerAsync(); + } +// this.Invoke(new InvokeHandler(delegate () +// { +// BindTangGrid(); +// BindMaoGrid(); +// })); Thread.Sleep(5000); } } + private void Bc_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) + { + this.BeginInvoke(new Action(() => + { + BindTangGrid(); + BindMaoGrid(); + })); + + } + + private void Bc_DoWork(object sender, DoWorkEventArgs e) + { + BindTangGridFortangList(); + BindMaoGridFromaoList(); + } + void FillQueue() { noWeightList = new ConcurrentQueue(); @@ -364,7 +383,8 @@ namespace WeighAndGrading } - void BindTangGrid() + + void BindTangGridFortangList() { VerifyConnection(); if (connection) @@ -380,6 +400,12 @@ namespace WeighAndGrading if (tangList == null) tangList = new List(); } + } + + + void BindTangGrid() + { + tangGridView.DataSource = tangList.OrderBy(x => x.Order).OrderBy(x => x.Finish).ToList(); if (tangEntity == null && tangGridView.CurrentRow != null) { @@ -412,10 +438,10 @@ namespace WeighAndGrading tangRoll = -1; } tangGridView.Refresh(); - lblTangTui.Text= "烫褪" + "("+tangList.Sum(x=>x.Number)+")"; +// lblTangTui.Text= "烫褪" + "("+tangList.Sum(x=>x.Number)+")"; } - void BindMaoGrid() + void BindMaoGridFromaoList() { VerifyConnection(); if (connection) @@ -431,6 +457,12 @@ namespace WeighAndGrading if (maoList == null) maoList = new List(); } + } + + + void BindMaoGrid() + { + maoGridView.DataSource = maoList.OrderBy(x => x.Order).OrderBy(x => x.Finish).ToList(); if (maoEntity == null && maoGridView.CurrentRow != null) { @@ -463,7 +495,7 @@ namespace WeighAndGrading maoRoll = -1; } maoGridView.Refresh(); - lblMaoBo.Text = "毛剥" + "(" + maoList.Sum(x=>x.Number) + ")"; +// lblMaoBo.Text = "毛剥" + "(" + maoList.Sum(x=>x.Number) + ")"; } void BindDetailGrid() @@ -494,7 +526,7 @@ namespace WeighAndGrading } historyGrid.Refresh(); // SetHistorBackColor(); - ReSetHistorySum(); +// ReSetHistorySum(); } void StartPrintEntity(string gongyijibie,int? index) @@ -952,7 +984,7 @@ namespace WeighAndGrading } //计算合计 - ReSetHistorySum(); +// ReSetHistorySum(); } } @@ -972,12 +1004,12 @@ namespace WeighAndGrading } - void ReSetHistorySum() - { - var tangtui=LocalGradeAndWeightBL.GetTangTuiSumNumber(butcherTimeInput.Date.Value); - var maobo=LocalGradeAndWeightBL.GetMaoBoSumNumber(butcherTimeInput.Date.Value); - lblHeJi.Text = "合计: 烫褪("+ tangtui + ") 毛剥("+maobo+")"; - } +// void ReSetHistorySum() +// { +// var tangtui=LocalGradeAndWeightBL.GetTangTuiSumNumber(butcherTimeInput.Date.Value); +// var maobo=LocalGradeAndWeightBL.GetMaoBoSumNumber(butcherTimeInput.Date.Value); +// lblHeJi.Text = "合计: 烫褪("+ tangtui + ") 毛剥("+maobo+")"; +// } void AddWeightDetail(decimal weight)