Ejemplo n.º 1
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            try
            {
                ic_t_check_init init = new Model.ic_t_check_init()
                {
                    begin_date = Conv.ToDateTime(this.txtStartTime.Text),
                    end_date   = Conv.ToDateTime(this.txtEndTime.Text),
                };
                Thread th = new Thread(() =>
                {
                    Cursor.Current = Cursors.WaitCursor;
                    Helper.GlobalData.windows.ShowLoad(this);
                    try
                    {
                        IBLL.ICheckBLL bll = new BLL.CheckBLL();
                        DataTable tb       = bll.GetCheckInitSheets(init);

                        this.dgv.Invoke((MethodInvoker) delegate
                        {
                            this.dgv.DataSource = tb;
                        });
                    }
                    catch (Exception ex)
                    {
                        LogHelper.writeLog("btnSelect_Click", ex.ToString());
                        MsgForm.ShowFrom(ex);
                    }
                    Cursor.Current = Cursors.Default;
                    Helper.GlobalData.windows.CloseLoad(this);
                });
                th.Start();
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
        }
Ejemplo n.º 2
0
        void IOrder.ShowOrder(string sheet_no)
        {
            try
            {
                Thread th = new Thread(() =>
                {
                    Cursor.Current = Cursors.WaitCursor;
                    Helper.GlobalData.windows.ShowLoad(this);
                    try
                    {
                        IBLL.ICheckBLL bll         = new BLL.CheckBLL();
                        Model.ic_t_check_init init = bll.GetCheckInitSheet(new Model.ic_t_check_init()
                        {
                            sheet_no = sheet_no
                        });
                        this.Invoke((MethodInvoker) delegate
                        {
                            this.txtSheet_no.Text    = sheet_no;
                            this.txtapproveDate.Text = "";
                            this.txtApproveMan.Text  = Program.oper.oper_id + "/" + Program.oper.oper_name;
                            this.txtBranch.Text      = init.branch_no;
                            this.txtMemo.Text        = init.memo;
                            this.txtOper.Text        = init.oper_id;
                            this.txtStartTime.Text   = init.begin_date.ToString("yyyy-MM-dd HH:mm:ss");
                            this.txtStatus.Text      = init.check_status.Equals("0") ? "开始盘点" : "结束盘点";
                            if (init.approve_flag.Equals("1"))
                            {
                                this.txtapproveDate.Text = init.approve_date.ToString("yyyy-MM-dd HH:mm:ss");
                                this.txtApproveMan.Text  = init.approve_man;
                                this.txtEndTime.Text     = init.end_date.ToString("yyyy-MM-dd HH:mm:ss");
                            }
                        });

                        DataTable tb = bll.GetCheckFinish(new Model.ic_t_check_finish()
                        {
                            sheet_no = sheet_no
                        });
                        this.editGrid1.DataSource.Rows.Clear();

                        this.Invoke((MethodInvoker) delegate
                        {
                            foreach (DataRow dr in tb.Rows)
                            {
                                this.editGrid1.DataSource.ImportRow(dr);
                                var r       = this.editGrid1.DataSource.Rows[this.editGrid1.DataSource.Rows.Count - 1];
                                r["盈亏数"]    = Conv.ToDecimal(r["real_qty"]) - Conv.ToDecimal(r["stock_qty"]);
                                r["进价盈亏金额"] = Conv.ToDecimal(r["price"]) * Conv.ToDecimal(r["盈亏数"]);
                                r["售价盈亏金额"] = Conv.ToDecimal(r["sale_price"]) * Conv.ToDecimal(r["盈亏数"]);
                                r["售价盘点金额"] = Conv.ToDecimal(r["sale_price"]) * Conv.ToDecimal(r["real_qty"]);
                            }
                            this.editGrid1.Refresh();

                            Dictionary <string, object> dic = this.Tag as Dictionary <string, object>;
                            this.Tag = Helper.Conv.ControlsAdds(this, dic);
                        });
                    }
                    catch (Exception ex)
                    {
                        LogHelper.writeLog("ShowOrder", ex.ToString());
                        MsgForm.ShowFrom(ex);
                    }
                    Cursor.Current = Cursors.Default;
                    Helper.GlobalData.windows.CloseLoad(this);
                });
                th.Start();
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
        }