From c0e18662346436486d14ac24734d9f3f5289f213 Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Thu, 16 Nov 2017 21:52:24 +0800 Subject: [PATCH] . --- WeighAndGrading/GradeFrom.cs | 526 +++++++++++++++++------------------ 1 file changed, 263 insertions(+), 263 deletions(-) diff --git a/WeighAndGrading/GradeFrom.cs b/WeighAndGrading/GradeFrom.cs index 1d7c5f3..cc71b78 100644 --- a/WeighAndGrading/GradeFrom.cs +++ b/WeighAndGrading/GradeFrom.cs @@ -97,29 +97,29 @@ namespace WeighAndGrading GradeAndWeight_Detail modifyDetail; -// private void GradeFrom_KeyPress(object sender, KeyPressEventArgs e) -// { -// Char keyChar = e.KeyChar; -// var key = keyChar.ToString().ToLower(); -// foreach (Button btn in ttPanel.Controls) -// { -// var livestockTag = btn.Tag as CTuple; -// if (livestockTag.Item4.ToLower() == key) -// { -// JiBieButtonClick(btn); -// SetJiBieSelectBackColor(btn.Text); -// } -// } -// foreach (Button btn in mbPanel.Controls) -// { -// var livestockTag = btn.Tag as CTuple; -// if (livestockTag.Item4.ToLower() == key) -// { -// JiBieButtonClick(btn); -// SetJiBieSelectBackColor(btn.Text); -// } -// } -// } + // private void GradeFrom_KeyPress(object sender, KeyPressEventArgs e) + // { + // Char keyChar = e.KeyChar; + // var key = keyChar.ToString().ToLower(); + // foreach (Button btn in ttPanel.Controls) + // { + // var livestockTag = btn.Tag as CTuple; + // if (livestockTag.Item4.ToLower() == key) + // { + // JiBieButtonClick(btn); + // SetJiBieSelectBackColor(btn.Text); + // } + // } + // foreach (Button btn in mbPanel.Controls) + // { + // var livestockTag = btn.Tag as CTuple; + // if (livestockTag.Item4.ToLower() == key) + // { + // JiBieButtonClick(btn); + // SetJiBieSelectBackColor(btn.Text); + // } + // } + // } //点击 级别 void JiBieButtonClick(Button btn) @@ -131,14 +131,14 @@ namespace WeighAndGrading } SetlblSucessVisibleTrue(); - + var livestockTag = btn.Tag as CTuple; var tech = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥"; - + if (modifyDetail == null) { - StartPrintEntity(tech,null); + StartPrintEntity(tech, null); AddDetail(livestockTag); } else @@ -150,7 +150,7 @@ namespace WeighAndGrading modifyDetail.Technics = livestockTag.Item3; modifyDetail.Technics_Name = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥"; LocalGradeAndWeightBL.Update(modifyDetail, "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name"); - + noLivestockList = new ConcurrentQueue(); var stack = new Stack(); @@ -198,12 +198,12 @@ namespace WeighAndGrading livestocks = XmlUtil.DeserializeFromFile>>(fileName); foreach (var item in livestocks) { - var btn = new Button() { Name = "_" + item.Item1, Text = item.Item2 , Tag = item, Size = new Size(90, 75), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 15 }, Font = new Font("宋体", 18) }; + var btn = new Button() { Name = "_" + item.Item1, Text = item.Item2, Tag = item, Size = new Size(90, 75), TextAlign = ContentAlignment.MiddleCenter, Margin = new Padding { All = 15 }, Font = new Font("宋体", 18) }; btn.Click += (sender, e) => { -// btn.Enabled = false; -// Application.DoEvents(); + // btn.Enabled = false; + // Application.DoEvents(); JiBieButtonClick(btn); #region 改到方法JiBieButtonClick()里了 @@ -231,8 +231,8 @@ namespace WeighAndGrading #endregion -// btn.Enabled = true; -// Application.DoEvents(); + // btn.Enabled = true; + // Application.DoEvents(); //var name = livestock.Technics == 0 ? "带皮白条" : "去皮白条"; //Print(name, entity.Index); @@ -327,18 +327,18 @@ namespace WeighAndGrading { while (true) { - var bc=new BackgroundWorker(); + var bc = new BackgroundWorker(); bc.DoWork += Bc_DoWork; bc.RunWorkerCompleted += Bc_RunWorkerCompleted; if (!bc.IsBusy) { bc.RunWorkerAsync(); } -// this.Invoke(new InvokeHandler(delegate () -// { -// BindTangGrid(); -// BindMaoGrid(); -// })); + // this.Invoke(new InvokeHandler(delegate () + // { + // BindTangGrid(); + // BindMaoGrid(); + // })); Thread.Sleep(5000); } } @@ -366,7 +366,7 @@ namespace WeighAndGrading var stack = new Stack(); foreach (var item in details) { - if (item.Livestock_ID == 0 || item.Weight == null||string.IsNullOrWhiteSpace(item.Livestock_Name)) + if (item.Livestock_ID == 0 || item.Weight == null || string.IsNullOrWhiteSpace(item.Livestock_Name)) stack.Push(item); else break; @@ -380,7 +380,7 @@ namespace WeighAndGrading noLivestockList.Enqueue(bottom); } - + } @@ -438,7 +438,7 @@ namespace WeighAndGrading tangRoll = -1; } tangGridView.Refresh(); -// lblTangTui.Text= "烫褪" + "("+tangList.Sum(x=>x.Number)+")"; + // lblTangTui.Text= "烫褪" + "("+tangList.Sum(x=>x.Number)+")"; } void BindMaoGridFromaoList() @@ -452,7 +452,7 @@ namespace WeighAndGrading { maoList = GradeAndWeightRpc.GetGradeAndWeightList(butcherTimeInput.Date.Value, false); } - + } catch (TimeoutException) { } } @@ -466,7 +466,7 @@ namespace WeighAndGrading void BindMaoGrid() { - + maoGridView.DataSource = maoList.OrderBy(x => x.Order).OrderBy(x => x.Finish).ToList(); if (maoEntity == null && maoGridView.CurrentRow != null) { @@ -499,7 +499,7 @@ namespace WeighAndGrading maoRoll = -1; } maoGridView.Refresh(); -// lblMaoBo.Text = "毛剥" + "(" + maoList.Sum(x=>x.Number) + ")"; + // lblMaoBo.Text = "毛剥" + "(" + maoList.Sum(x=>x.Number) + ")"; } void BindDetailGrid() @@ -534,11 +534,11 @@ namespace WeighAndGrading rightRoll = -1; } historyGrid.Refresh(); -// SetHistorBackColor(); -// ReSetHistorySum(); + // SetHistorBackColor(); + // ReSetHistorySum(); } - void StartPrintEntity(string gongyijibie,int? index) + void StartPrintEntity(string gongyijibie, int? index) { if (!isPrintCheckBox.Checked) { @@ -552,7 +552,7 @@ namespace WeighAndGrading WeightGradePrint.Print(entity); } - PrintEntity CreatePrintEntity(string jibie,int? index) + PrintEntity CreatePrintEntity(string jibie, int? index) { string goodsName; if (jibie == "烫褪") @@ -563,7 +563,7 @@ namespace WeighAndGrading { goodsName = "去皮白条"; } - + var entity = new PrintEntity(); entity.AccountingUnit_Name = "青岛万福集团股份有限公司"; entity.Goods_Name = goodsName; @@ -585,9 +585,9 @@ namespace WeighAndGrading } string indexCode = maxindex.ToString("D6"); - + entity.BarCode = string.Format("WF{0}{1:00000}", DateTime.Today.ToString("yyyyMMdd"), indexCode); - entity._2DQRCode = string.Format("http://www.bwpsoft.com?code={0}&name={1}", entity.BarCode,goodsName); + entity._2DQRCode = string.Format("http://www.bwpsoft.com?code={0}&name={1}", entity.BarCode, goodsName); return entity; } @@ -603,14 +603,14 @@ namespace WeighAndGrading modifyPanel.Hide(); } -// void Print(object obj) -// { -// var entity = obj as PrintEntity; -// this.Invoke(new Action(() => -// { -// WeightGradePrint.Print(entity); -// })); -// } + // void Print(object obj) + // { + // var entity = obj as PrintEntity; + // this.Invoke(new Action(() => + // { + // WeightGradePrint.Print(entity); + // })); + // } @@ -713,7 +713,7 @@ namespace WeighAndGrading { if (string.IsNullOrEmpty(str)) str = "0"; - this.Invoke(new InvokeHandler(delegate () + this.Invoke(new InvokeHandler(delegate() { lblChengZhong.Text = string.Format(format, decimal.Parse(str)); if (str != "0") @@ -722,12 +722,12 @@ namespace WeighAndGrading var allowInterval = GradeContext.Config.AllowInterval; //如果间隔时间内多条的话不处理 -// var timeSpanTotalSeconds= (DateTime.Now - lastWeightDateTime).TotalSeconds; -// if (Convert.ToDecimal(timeSpanTotalSeconds) > allowInterval) -// { - AddWeightDetail(decimal.Parse(lblChengZhong.Text)); -// lastWeightDateTime = DateTime.Now; -// } + // var timeSpanTotalSeconds= (DateTime.Now - lastWeightDateTime).TotalSeconds; + // if (Convert.ToDecimal(timeSpanTotalSeconds) > allowInterval) + // { + AddWeightDetail(decimal.Parse(lblChengZhong.Text)); + // lastWeightDateTime = DateTime.Now; + // } } })); @@ -738,7 +738,7 @@ namespace WeighAndGrading decimal num = 0; if (decimal.TryParse(str, out num)) { - this.Invoke(new InvokeHandler(delegate () + this.Invoke(new InvokeHandler(delegate() { lblChengZhong.Text = string.Format(format, num); })); @@ -747,7 +747,7 @@ namespace WeighAndGrading } if (WeighAvgControl.TryGetValue(out num)) { - this.Invoke(new InvokeHandler(delegate () + this.Invoke(new InvokeHandler(delegate() { //lblChengZhong.Text = string.Format(format, num); if (str != "0") @@ -870,80 +870,80 @@ namespace WeighAndGrading static object _obj = new object(); -// void AddDetail(CTuple livestock) -// { -// lock (_obj) -// { -// var currentRow = livestock.Item3 == 0 ? tangEntity : maoEntity; -// var tech = livestock.Item3 == TANG_TECH ? "烫褪" : "毛剥"; -// -// GradeAndWeight_Detail first; -// if (noLivestockList.TryPeek(out first) && first.Livestock_ID == null) -// { -// noLivestockList.TryDequeue(out first); -// if (currentRow != null) -// first.OrderDetail_ID = currentRow.OrderDetail_ID; -// first.Date = butcherTimeInput.Date.Value; -// first.Livestock_ID = livestock.Item1; -// first.Livestock_Name = livestock.Item2; -// first.Technics = livestock.Item3; -// first.Technics_Name = tech; -// if (disBtn != null) -// { -// first.Weight = (first.Weight ?? 0) - Convert.ToDecimal(disBtn.Tag); -// SetBtnUnCheck(disBtn); -// disBtn = null; -// } -// LocalGradeAndWeightBL.Update(first, "OrderDetail_ID", "Date", "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name", "Weight"); -// historyGrid.Refresh(); -// } -// else//add -// { -// maxIndex++; -// var entity = new GradeAndWeight_Detail(); -// entity.Index = maxIndex; -// if (currentRow != null) -// entity.OrderDetail_ID = currentRow.OrderDetail_ID; -// entity.Date = butcherTimeInput.Date.Value; -// entity.Livestock_ID = livestock.Item1; -// entity.Livestock_Name = livestock.Item2; -// entity.Technics = livestock.Item3; -// entity.Technics_Name = tech; -// entity.Time = DateTime.Now; -// entity.Date = butcherTimeInput.Date.Value; -// if (disBtn != null) -// { -// entity.Weight = -Convert.ToDecimal(disBtn.Tag); -// SetBtnUnCheck(disBtn); -// disBtn = null; -// } -// if (details.Count == 50) -// details.RemoveAt(49); -// details.Insert(0, entity); -// LocalGradeAndWeightBL.Insert(entity); -// noWeightList.Enqueue(entity); -// BindDetailGrid(); -// } -// if (currentRow != null) -// { -// currentRow.Already = currentRow.Already + 1; -// orderLabel.Text = currentRow.Order.ToString(); -// alreadyLabel.Text = currentRow.Already.ToString(); -// tangGridView.Refresh(); -// } -// else -// { -// orderLabel.Text = string.Empty; -// alreadyLabel.Text = string.Empty; -// } -// -// //计算合计 -// ReSetHistorySum(); -// } -// } - - - void AddDetail(CTuple livestock) + // void AddDetail(CTuple livestock) + // { + // lock (_obj) + // { + // var currentRow = livestock.Item3 == 0 ? tangEntity : maoEntity; + // var tech = livestock.Item3 == TANG_TECH ? "烫褪" : "毛剥"; + // + // GradeAndWeight_Detail first; + // if (noLivestockList.TryPeek(out first) && first.Livestock_ID == null) + // { + // noLivestockList.TryDequeue(out first); + // if (currentRow != null) + // first.OrderDetail_ID = currentRow.OrderDetail_ID; + // first.Date = butcherTimeInput.Date.Value; + // first.Livestock_ID = livestock.Item1; + // first.Livestock_Name = livestock.Item2; + // first.Technics = livestock.Item3; + // first.Technics_Name = tech; + // if (disBtn != null) + // { + // first.Weight = (first.Weight ?? 0) - Convert.ToDecimal(disBtn.Tag); + // SetBtnUnCheck(disBtn); + // disBtn = null; + // } + // LocalGradeAndWeightBL.Update(first, "OrderDetail_ID", "Date", "Livestock_ID", "Livestock_Name", "Technics", "Technics_Name", "Weight"); + // historyGrid.Refresh(); + // } + // else//add + // { + // maxIndex++; + // var entity = new GradeAndWeight_Detail(); + // entity.Index = maxIndex; + // if (currentRow != null) + // entity.OrderDetail_ID = currentRow.OrderDetail_ID; + // entity.Date = butcherTimeInput.Date.Value; + // entity.Livestock_ID = livestock.Item1; + // entity.Livestock_Name = livestock.Item2; + // entity.Technics = livestock.Item3; + // entity.Technics_Name = tech; + // entity.Time = DateTime.Now; + // entity.Date = butcherTimeInput.Date.Value; + // if (disBtn != null) + // { + // entity.Weight = -Convert.ToDecimal(disBtn.Tag); + // SetBtnUnCheck(disBtn); + // disBtn = null; + // } + // if (details.Count == 50) + // details.RemoveAt(49); + // details.Insert(0, entity); + // LocalGradeAndWeightBL.Insert(entity); + // noWeightList.Enqueue(entity); + // BindDetailGrid(); + // } + // if (currentRow != null) + // { + // currentRow.Already = currentRow.Already + 1; + // orderLabel.Text = currentRow.Order.ToString(); + // alreadyLabel.Text = currentRow.Already.ToString(); + // tangGridView.Refresh(); + // } + // else + // { + // orderLabel.Text = string.Empty; + // alreadyLabel.Text = string.Empty; + // } + // + // //计算合计 + // ReSetHistorySum(); + // } + // } + + //点级别 + void AddDetail(CTuple livestock) { lock (_obj) { @@ -951,9 +951,10 @@ namespace WeighAndGrading var tech = livestock.Item3 == TANG_TECH ? "烫褪" : "毛剥"; GradeAndWeight_Detail first; - if (noLivestockList.TryPeek(out first) && string.IsNullOrWhiteSpace(first.Livestock_Name)) + //TryPeek 尝试返回 ConcurrentQueue 开头处的对象但不将其移除 + //TryDequeue 尝试移除并返回并发队列开头处的对象。 + if (noLivestockList.TryDequeue(out first)) { - noLivestockList.TryDequeue(out first); if (currentRow != null) first.OrderDetail_ID = currentRow.OrderDetail_ID; first.Date = butcherTimeInput.Date.Value; @@ -998,9 +999,9 @@ namespace WeighAndGrading details.RemoveAt(49); details.Insert(0, entity); LocalGradeAndWeightBL.Insert(entity); -// noWeightList.Enqueue(entity); // 添加的掉猪明细不加入到没有称重队列 + // noWeightList.Enqueue(entity); // 添加的掉猪明细不加入到没有称重队列 BindDetailGrid(); - + } if (currentRow != null) { @@ -1019,32 +1020,35 @@ namespace WeighAndGrading } //计算合计 -// ReSetHistorySum(); + // ReSetHistorySum(); } } void SetlblSucessVisibleFalse() { - - this.Invoke(new Action(() => + this.Invoke(new InvokeHandler(delegate { Thread.Sleep(1000); lblSucessed.Visible = false; })); } + void SetlblSucessVisibleTrue() { - lblSucessed.Visible = true; - Application.DoEvents(); + this.Invoke(new InvokeHandler(delegate + { + lblSucessed.Visible = true; + Application.DoEvents(); + })); } -// 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) @@ -1052,36 +1056,36 @@ namespace WeighAndGrading lock (_obj) { weight -= (GradeContext.Config.Discont ?? 0); -// GradeAndWeight_Detail first; -// if (noWeightList.TryPeek(out first)) -// { -// noWeightList.TryDequeue(out first); -// if (first.Weight < 0) -// first.Weight = (first.Weight ?? 0) + weight; -// else -// first.Weight = weight; -// LocalGradeAndWeightBL.Update(first, "Weight"); -// historyGrid.Refresh(); -// } -// else//add + // GradeAndWeight_Detail first; + // if (noWeightList.TryPeek(out first)) + // { + // noWeightList.TryDequeue(out first); + // if (first.Weight < 0) + // first.Weight = (first.Weight ?? 0) + weight; + // else + // first.Weight = weight; + // LocalGradeAndWeightBL.Update(first, "Weight"); + // historyGrid.Refresh(); + // } + // else//add { - - - maxIndex++; - var entity = new GradeAndWeight_Detail(); - entity.Index = maxIndex; - entity.Weight = (entity.Weight ?? 0) + weight; - entity.Time = DateTime.Now; - entity.Date = butcherTimeInput.Date.Value; - if (details.Count == 50) - details.RemoveAt(49); - details.Insert(0, entity); - LocalGradeAndWeightBL.Insert(entity); - noLivestockList.Enqueue(entity); - BindDetailGrid(); - -// SetlblSucessVisibleTrue(); -// SetlblSucessVisibleFalse(); + + + maxIndex++; + var entity = new GradeAndWeight_Detail(); + entity.Index = maxIndex; + entity.Weight = (entity.Weight ?? 0) + weight; + entity.Time = DateTime.Now; + entity.Date = butcherTimeInput.Date.Value; + if (details.Count == 50) + details.RemoveAt(49); + details.Insert(0, entity); + LocalGradeAndWeightBL.Insert(entity); + noLivestockList.Enqueue(entity); + BindDetailGrid(); + + // SetlblSucessVisibleTrue(); + // SetlblSucessVisibleFalse(); } } @@ -1178,10 +1182,10 @@ namespace WeighAndGrading noWeightList = new ConcurrentQueue(); var stackNoWeight = new Stack(); - - + + //把没有重量的记录加进去 - var noWeightDetails = details.Where(x => x.Weight==null); + var noWeightDetails = details.Where(x => x.Weight == null); foreach (var item in noWeightDetails) { if (item.SID > suodingmaxsid) @@ -1221,21 +1225,21 @@ namespace WeighAndGrading // LocalGradeAndWeightBL.ClearWeightBySID(fuhemaxsid); -// historyGrid.Refresh(); -// -// noWeightList = new ConcurrentQueue(); -// var stack = new Stack(); -// foreach (var item in details) -// { -// if (item.SID > fd.SID) -// { -// stack.Push(item); -// } -// } -// while (stack.Count > 0) -// { -// noWeightList.Enqueue(stack.Pop()); -// } + // historyGrid.Refresh(); + // + // noWeightList = new ConcurrentQueue(); + // var stack = new Stack(); + // foreach (var item in details) + // { + // if (item.SID > fd.SID) + // { + // stack.Push(item); + // } + // } + // while (stack.Count > 0) + // { + // noWeightList.Enqueue(stack.Pop()); + // } #endregion if (details.Count == 0) @@ -1279,7 +1283,7 @@ namespace WeighAndGrading var lostweightlist = details.Where(x => x.IsLostWeight).ToList(); if (lostweightlist.Count > 0) { - suodingmaxsid = lostweightlist.Max(x => x.SID); + suodingmaxsid = lostweightlist.Max(x => x.SID); } //把没有级别的记录加进去 var livestockNoNameList = details.Where(x => string.IsNullOrWhiteSpace(x.Livestock_Name)); @@ -1312,13 +1316,13 @@ namespace WeighAndGrading { maxLockID = lostList.Max(x => x.SID); } - + //赋最大值 if (mCurrentSlectItem.SID > maxLockID) { maxLockID = mCurrentSlectItem.SID; UpdateItemLosted(mCurrentSlectItem.SID); - + if (modifyPanel.Visible) modifyPanel.Hide(); historyGrid.Refresh(); @@ -1338,19 +1342,19 @@ namespace WeighAndGrading } } -// SetHistorBackColor(); + // SetHistorBackColor(); } -// void SetHistorBackColor() -// { -// foreach (DataGridViewRow row in historyGrid.Rows) -// { -// if ((bool)row.Cells["IsLostWeight"].Value) -// row.DefaultCellStyle.ForeColor = Color.Red; -// } -// } + // void SetHistorBackColor() + // { + // foreach (DataGridViewRow row in historyGrid.Rows) + // { + // if ((bool)row.Cells["IsLostWeight"].Value) + // row.DefaultCellStyle.ForeColor = Color.Red; + // } + // } private void UpdateItemLosted(long sid) { @@ -1375,41 +1379,41 @@ namespace WeighAndGrading mCurrentSlectItem = currentRow; - if (e.ColumnIndex == 4) - { - if (lastCheckItem != null && lastCheckItem.SID != currentRow.SID) - lastCheckItem.ReadWeight = false; - lastCheckItem = currentRow; - lastCheckItem.ReadWeight = !lastCheckItem.ReadWeight; - // - modifyDetail = null; - if (modifyPanel.Visible) - modifyPanel.Hide(); - historyGrid.Refresh(); - // if (lastCheckItem.ReadWeight) - // { - // noWeightList = new ConcurrentQueue(); - // var stack = new Stack(); - // foreach (var item in details) - // { - // if (item.SID > lastCheckItem.SID) - // { - // stack.Push(item); - // } - //// stack.Push(item); - //// if (item.SID == lastCheckItem.SID) - //// break; - // } - // while (stack.Count > 0) - // noWeightList.Enqueue(stack.Pop()); - // } - // else - // { - // FillQueue(); - // lastCheckItem = null; - // } - return; - } + if (e.ColumnIndex == 4) + { + if (lastCheckItem != null && lastCheckItem.SID != currentRow.SID) + lastCheckItem.ReadWeight = false; + lastCheckItem = currentRow; + lastCheckItem.ReadWeight = !lastCheckItem.ReadWeight; + // + modifyDetail = null; + if (modifyPanel.Visible) + modifyPanel.Hide(); + historyGrid.Refresh(); + // if (lastCheckItem.ReadWeight) + // { + // noWeightList = new ConcurrentQueue(); + // var stack = new Stack(); + // foreach (var item in details) + // { + // if (item.SID > lastCheckItem.SID) + // { + // stack.Push(item); + // } + //// stack.Push(item); + //// if (item.SID == lastCheckItem.SID) + //// break; + // } + // while (stack.Count > 0) + // noWeightList.Enqueue(stack.Pop()); + // } + // else + // { + // FillQueue(); + // lastCheckItem = null; + // } + return; + } modifyDetail = currentRow; stateLabel.Text = string.Format("您正在修改序号为 {0} 的信息", modifyDetail.Index); modifyPanel.Show(); @@ -1547,12 +1551,12 @@ namespace WeighAndGrading { if (modifyDetail == null) { -// if (disBtn != null) -// SetBtnUnCheck(disBtn); + // if (disBtn != null) + // SetBtnUnCheck(disBtn); if (disBtn != btn) { disBtn = btn; -// SetBtnChecked(disBtn); + // SetBtnChecked(disBtn); } else disBtn = null; @@ -1621,7 +1625,7 @@ namespace WeighAndGrading vScrollBar2.Minimum = 0; vScrollBar2.SmallChange = historyGrid.RowTemplate.Height; vScrollBar2.LargeChange = historyGrid.RowTemplate.Height * 30; - + this.vScrollBar2.Scroll += (sender, e) => { rightRoll = e.NewValue / historyGrid.RowTemplate.Height; @@ -1691,7 +1695,7 @@ namespace WeighAndGrading statePic.Image = Image.FromStream(s); statePic.Refresh(); } - + last = connection; } @@ -1702,25 +1706,21 @@ namespace WeighAndGrading MessageBox.Show("请在上一个界面选择宰杀日期"); return; } - var f=new AbnormalModifyForm(butcherTimeInput.Date.Value); + var f = new AbnormalModifyForm(butcherTimeInput.Date.Value); f.ShowDialog(); } - - private void GradeFrom_Load(object sender, EventArgs e) { syncToServer = new Thread(ToServerTask); syncToServer.Start(); } - - void ToServerTask() { while (true) { -// this.Invoke(new InvokeHandler(delegate () + // this.Invoke(new InvokeHandler(delegate () { VerifyConnection(); if (connection) @@ -1738,7 +1738,7 @@ namespace WeighAndGrading } } } -// )); + // )); Thread.Sleep(2000); } }