Esempio n. 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;
            }
        }
Esempio n. 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;
     }
 }
Esempio n. 3
0
        void Sort()
        {
            try
            {
                progressBar1.Value = (progressBar1.Maximum / 2);
                OracleParameter[] sqlpara;
                sqlpara              = new OracleParameter[2];
                sqlpara[0]           = new OracleParameter("p_ErrCode", OracleType.VarChar, 30);
                sqlpara[1]           = new OracleParameter("p_ErrMsg", OracleType.VarChar, 100);
                sqlpara[0].Direction = ParameterDirection.Output;
                sqlpara[1].Direction = ParameterDirection.Output;

                Db.Open();
                Db.ExecuteNonQueryWithProc("P_PRODUCE_SCHEDULE_ALONE", sqlpara);//修改前的存储过程 P_PRODUCE_updatesortnum
                Db.Close();
                //MessageBox.Show(date);
                //MessageBox.Show(code[i]+"订单数据接收完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                String errcode = sqlpara[0].Value.ToString();
                String errmsg  = sqlpara[1].Value.ToString();
                if (errcode == "1")
                {
                    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);
                    writeLog.Write("分拣车组任务排序成功!" + "\r\n" + "所用时间:" + times + "秒");
                    updateControl(btnSort, true, true);
                    //
                    //  DgvBind(sql);//排程成功后刷新
                }
                else
                {
                    panel2.Visible = false;
                    TimerByTime.Stop();// 计时结束;
                    btnSort.Enabled = true;
                    MessageBox.Show(errmsg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    updateControl(btnSort, true, true);
                }
                updateControl(btnSort, true, true);
                //  panel2.Visible = false;
                updateControl(panel2, false, true);
                //  label2.Visible = false;
                updateControl(label2, false, true);
                //  progressBar1.Visible = false;
                updateControl(progressBar1, false, true);

                updateControl(lblTime, false, true);
            }
            catch (DataException dataex)
            {
                writeLog.Write(this.Text + "排程异常:" + dataex.Message);
            }
            catch (NullReferenceException nullex)
            {
                MessageBox.Show("排程OK:" + nullex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                writeLog.Write(this.Text + "排程异常:" + nullex.Message);
            }
            catch (IndexOutOfRangeException iore)
            {
                MessageBox.Show("排程OK:" + iore.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                writeLog.Write(this.Text + "排程异常索引越界:" + iore.Message);
            }
            catch (Exception e)
            {
                MessageBox.Show("排程OK:" + e.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                writeLog.Write(this.Text + "排程异常:" + e.Message);
            }
            finally
            {
                times = 1;
                seek();
                panel2.Visible = false;
                TimerByTime.Stop();   // 计时结束;
                btnSort.Enabled = true;
                handlesort(3, false); //告诉父窗体任务结束
                isSort = false;
            }
        }