コード例 #1
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                String txt_batchcode = this.txt_batchcode.Text.Trim();
                String txt_starttime = this.starttime.Text;
                if (string.IsNullOrWhiteSpace(txt_batchcode) || string.IsNullOrWhiteSpace(txt_starttime))
                {
                    MessageBox.Show("请填写批次编号!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    response = bc.OperationBatch();//关闭最近一个创建的批次
                    if (response.IsSuccess)
                    {
                        response = bc.OperationBatch(txt_batchcode, 1);//创建一个新的批次
                        if (response.IsSuccess)
                        {
                            this.panel1.Visible    = true;
                            this.lab_showinfo.Text = "正在处理历史订单和任务,请稍候......";
                            //response = tc.RemoveTask();//移除分拣数据到历史表中
                            //20190628  改成调用存储过程.
                            response = sc.RemoveHistoryData();

                            if (response.IsSuccess)
                            {
                                this.lab_showinfo.Text = "处理完成";
                                this.panel1.Visible    = false;
                            }
                            MessageBox.Show(response.MessageText, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                        else
                        {
                            MessageBox.Show(response.MessageText, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                    else
                    {
                        MessageBox.Show(response.MessageText, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                Close();
            }
        }