From c7160a30a6bf50bf39e391509b57d31f150c7a4e Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Tue, 28 Nov 2017 12:01:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WeighAndGrading/GradeFrom.cs | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/WeighAndGrading/GradeFrom.cs b/WeighAndGrading/GradeFrom.cs index 82af2f3..15b12c9 100644 --- a/WeighAndGrading/GradeFrom.cs +++ b/WeighAndGrading/GradeFrom.cs @@ -105,24 +105,32 @@ namespace WeighAndGrading MessageBox.Show("请先同步数据"); return; } - btn.Enabled = false; + try + { + btn.Enabled = false; + Application.DoEvents(); - var livestockTag = btn.Tag as CTuple; - var tech = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥"; + var livestockTag = btn.Tag as CTuple; + var tech = livestockTag.Item3 == TANG_TECH ? "烫褪" : "毛剥"; - if (modifyDetail == null) - { - StartPrintEntity(tech, null); - AddDetail(livestockTag); + if (modifyDetail == null) + { + StartPrintEntity(tech, null); + AddDetail(livestockTag); + } + else + { + UpdateDetial(modifyDetail, livestockTag); + cancelBtn_Click(btn, EventArgs.Empty); + } + SetlblSucessVisibleTrue(); + SetlblSucessVisibleFalse(); } - else + catch { throw; } + finally { - UpdateDetial(modifyDetail, livestockTag); - cancelBtn_Click(btn, EventArgs.Empty); + btn.Enabled = true; } - SetlblSucessVisibleTrue(); - SetlblSucessVisibleFalse(); - btn.Enabled = true; } void UpdateDetial(GradeAndWeight_Detail detail, CTuple btnTag)