예제 #1
0
        private void LoadOrder()
        {
            string order_sheet_no = this.txt_voucher_no.Text.Trim();

            if (string.IsNullOrEmpty(order_sheet_no))
            {
                return;
            }
            this.editGrid1.DataSource.Clear();

            IBLL.IInOutBLL bll3 = new BLL.InOutBLL();

            DataTable tbmain;
            DataTable tbdetail;

            bll3.GetCGOrder(order_sheet_no, out tbmain, out tbdetail);

            DataRow row = tbmain.Rows[0];

            txt_sup.GetValue("supcust_no", row["sup_no"].ToString());
            txtbranch.GetValue("branch_no", row["branch_no"].ToString());
            txt_deal_man.GetValue("oper_id", row["order_man"].ToString());
            txt_other1.Text = row["memo"].ToString();

            this.editGrid1.DataSource.ClearTable();
            foreach (DataRow dr in tbdetail.Rows)
            {
                this.editGrid1.DataSource.ImportRow(dr);

                DataRow r = this.editGrid1.DataSource.Rows[this.editGrid1.DataSource.Rows.Count - 1];
                r["item_no"]     = dr["item_no"];
                r["item_subno"]  = dr["item_subno"];
                r["barcode"]     = dr["barcode"];
                r["item_name"]   = dr["item_name"];
                r["unit_no"]     = dr["unit_no"];
                r["in_qty"]      = dr["order_qnty"];
                r["valid_price"] = dr["in_price"];
                r["sub_amount"]  = dr["sub_amount"];
                r["other1"]      = dr["other1"];
                r["discount"]    = dr["discount"];
                r["valid_date"]  = row["valid_date"].ToDateTime();
            }

            txt_sup.Enabled        = false;
            txtbranch.Enabled      = false;
            txt_voucher_no.Enabled = false;

            this.editGrid1.DataSource.Rows.Add();
            this.editGrid1.Refresh();
        }
예제 #2
0
        public void GetPrintTb()
        {
            if (string.IsNullOrEmpty(this.txtsheet_no.Text))
            {
                throw new Exception("请选择单据!");
            }

            IBLL.IInOutBLL bll = new BLL.InOutBLL();
            DataTable      tb1;
            DataTable      tb2;

            bll.GetCGOrder(this.txtsheet_no.Text, out tb1, out tb2);

            PrintForm.PrintHelper.tb_main   = tb1;
            PrintForm.PrintHelper.tb_detail = tb2;
        }
예제 #3
0
        private void dataGrid1_CurrentCellChange(object sender, string column_name, DataRow row)
        {
            try
            {
                if (sheet_no != row["sheet_no"].ToString())
                {
                    Thread th = new Thread(() =>
                    {
                        Cursor.Current = Cursors.WaitCursor;
                        Helper.GlobalData.windows.ShowLoad(this);
                        try
                        {
                            sheet_no = row["sheet_no"].ToString();
                            trans_no = row["trans_no"].ToString();

                            IBLL.IInOutBLL bll = new BLL.InOutBLL();
                            System.Data.DataTable tb1;
                            System.Data.DataTable tb2;
                            bll.GetCGOrder(sheet_no, out tb1, out tb2);

                            this.dataGrid2.Invoke((MethodInvoker) delegate
                            {
                                this.dataGrid2.DataSource = tb2;
                            });
                            update_time = Helper.Conv.ToDateTime(tb1.Rows[0]["update_time"]);
                        }
                        catch (Exception ex)
                        {
                            LogHelper.writeLog("dataGrid1_CurrentCellChange", ex.ToString());
                            MsgForm.ShowFrom(ex);
                        }
                        Cursor.Current = Cursors.Default;
                        Helper.GlobalData.windows.CloseLoad(this);
                    });
                    th.Start();
                }
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
                Helper.LogHelper.writeLog("frmCGInSheetList->dataGrid1_CurrentCellChange()", ex.ToString());
            }
        }
예제 #4
0
        void IOrder.ShowOrder(string sheet_no)
        {
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                //
                RunType = 2;

                IBLL.IInOutBLL bll = new BLL.InOutBLL();
                DataTable      tb1;
                DataTable      tb2;
                bll.GetCGOrder(sheet_no, out tb1, out tb2);
                //

                //
                var r1 = tb1.Rows[0];
                update_time   = Helper.Conv.ToDateTime(r1["update_time"]);
                this.sheet_no = sheet_no;
                if (r1["branch_no"].ToString() == "")
                {
                    txtbranch.Text = "";
                }
                else
                {
                    txtbranch.Text = r1["branch_no"].ToString() + "/" + r1["branch_name"].ToString();
                }
                txtsheet_no.Text  = r1["sheet_no"].ToString();
                txtoper_date.Text = Helper.Conv.ToDateTime(r1["oper_date"].ToString()).ToString("yyyy-MM-dd");
                if (r1["order_man"].ToString() == "")
                {
                    txt_order_man.Text = "";
                }
                else
                {
                    txt_order_man.GetValue("oper_id", r1["order_man"].ToString());
                }
                if (r1["approve_man"].ToString() == "")
                {
                    txtapprove_man.Text = "";
                }
                else
                {
                    txtapprove_man.Text = r1["approve_man"].ToString() + "/" + r1["approve_man_name"].ToString();
                }
                if (r1["oper_id"].ToString() == "")
                {
                    txtoper_man.Text = "";
                }
                else
                {
                    txtoper_man.Text = r1["oper_id"] + "/" + r1["oper_name"];
                }
                txtapprove_date.Text = Helper.Conv.ToDateTime(r1["approve_date"]).ToString("yyyy-MM-dd");
                txt_valid_date.Text  = Helper.Conv.ToDateTime(r1["valid_date"]).ToString("yyyy-MM-dd");
                txt_sup.Text         = r1["sup_no"].ToString() + "/" + r1["sup_name"].ToString();
                txt_memo.Text        = r1["memo"].ToString();
                //
                editGrid1.DataSource = tb2;

                Dictionary <string, object> dic = this.Tag as Dictionary <string, object>;
                this.Tag = Helper.Conv.ControlsAdds(this, dic);
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom("加载采购订单异常[" + ex.Message + "]");
                Helper.LogHelper.writeLog("frmCGOrder->ShowOrder()", ex.ToString(), sheet_no);
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }
예제 #5
0
        private void refreshData()
        {
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                //
                DateTime date1   = Helper.Conv.ToDateTime(dateTextBox1.Text.Trim());
                DateTime date2   = Helper.Conv.ToDateTime(dateTextBox2.Text.Trim());
                string   txt_sup = txt_sup_id.Text.Split('/')[0].Trim();
                Thread   th      = new Thread(() =>
                {
                    Helper.GlobalData.windows.ShowLoad(this);
                    try
                    {
                        IBLL.IInOutBLL bll = new BLL.InOutBLL();
                        if (date1 == DateTime.MinValue)
                        {
                            throw new Exception("期间不正确");
                        }
                        if (date2 == DateTime.MinValue)
                        {
                            throw new Exception("期间不正确");
                        }
                        var tb = bll.GetCGOrderList(date1, date2, txt_sup, "");

                        this.dataGrid1.Invoke((MethodInvoker) delegate
                        {
                            this.dataGrid1.DataSource = tb;
                            if (tb.Rows.Count > 0)
                            {
                                sheet_no = tb.Rows[0]["sheet_no"].ToString();
                                trans_no = tb.Rows[0]["trans_no"].ToString();

                                System.Data.DataTable tb1;
                                System.Data.DataTable tb2;
                                bll.GetCGOrder(sheet_no, out tb1, out tb2);


                                this.dataGrid2.DataSource = tb2;

                                update_time = Helper.Conv.ToDateTime(tb1.Rows[0]["update_time"]);
                            }
                        });
                    }
                    catch (Exception ex)
                    {
                        LogHelper.writeLog("refreshData", ex.ToString());
                        MsgForm.ShowFrom(ex);
                    }
                    Helper.GlobalData.windows.CloseLoad(this);
                });
                th.Start();
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
                Helper.LogHelper.writeLog("frmCGInSheetList->refreshData()", ex.ToString());
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }