예제 #1
0
        void Sort()
        {
            try
            {
                TransactionOptions transactionOption = new TransactionOptions();
                transactionOption.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
                using (TransactionScope tran = new TransactionScope(TransactionScopeOption.Required, transactionOption))
                {
                    progressBar1.Value = (progressBar1.Maximum / 2);
                    var re = sc.SchedulePoke();
                    //排程结束后,对排程数据进行验证
                    ValidationClass vc       = new ValidationClass();
                    Response        response = vc.ValidationSchedule("2");
                    if (response.IsSuccess)
                    {
                        if (re.IsSuccess)
                        {
                            List <MixedInfo> list = MixedClass.GetUnPokeData();
                            MixedClass.InsertPokeMixed(list);
                            tran.Complete();
                            btnPokeSeq.Enabled = true;
                            progressBar1.Value = progressBar1.Maximum;
                            //TimerByTime.Stop();// 计时结束;
                            btnSort.Enabled = true;
                            lblInFO.Text    = "分拣车组任务排程成功!" + "\r\n" + "所用时间:" + times + "秒";
                            MessageBox.Show("分拣车组任务排程成功!" + "\r\n" + "所用时间:" + times + "秒", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            panel2.Visible = false;
                            TimerByTime.Stop();// 计时结束;
                            btnSort.Enabled = true;
                            MessageBox.Show(re.MessageText, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        //回滚排程操作
                        MessageBox.Show(response.MessageText, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("排程异常:" + e.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            finally
            {
                //dgvSortInfo.Rows.Clear();
                //List<TaskInfo> list = new List<TaskInfo>();
                //dgvSortInfo.DataSource = list;

                Bind();
                panel2.Visible = false;
                TimerByTime.Stop();// 计时结束;
                btnSort.Enabled = true;
            }
        }
예제 #2
0
 void Sort()
 {
     try
     {
         progressBar1.Value = (progressBar1.Maximum / 2);
         var re = sc.SchedulePoke();
         //排程结束后,对排程数据进行验证
         ValidationClass vc       = new ValidationClass();
         Response        response = vc.ValidationSchedule("2");
         if (response.IsSuccess)
         {
             if (re.IsSuccess)
             {
                 btnPokeSeq.Enabled = true;
                 progressBar1.Value = progressBar1.Maximum;
                 TimerByTime.Stop();// 计时结束;
                 btnSort.Enabled = true;
                 lblInFO.Text    = "分拣车组任务排程成功!" + "\r\n" + "所用时间:" + times + "秒";
                 MessageBox.Show("分拣车组任务排程成功!" + "\r\n" + "所用时间:" + times + "秒", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
             else
             {
                 panel2.Visible = false;
                 TimerByTime.Stop();// 计时结束;
                 btnSort.Enabled = true;
                 MessageBox.Show(re.MessageText, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
             }
         }
         else
         {
             //回滚排程操作
             MessageBox.Show(response.MessageText, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception e)
     {
         MessageBox.Show("排程异常:" + e.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     finally
     {
         //times = 1;
         //Bind();
         //List<TaskInfo> list = new List<TaskInfo>();
         dgvSortInfo.DataSource = new { synseq, regioncode, count, qty };
         panel2.Visible         = false;
         TimerByTime.Stop();// 计时结束;
         btnSort.Enabled = true;
     }
 }