private void btnSelect_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(this.txt_sup.Text))
            {
                MsgForm.ShowFrom("请先选择供应商");
                return;
            }

            IBLL.IInOutBLL bll        = new BLL.InOutBLL();
            var            dt         = new DataTable();
            var            supcust_no = txt_sup.Text.Trim().Split('/')[0];

            dt = bll.GetSimpleInOutList(DateTime.Now.AddMonths(-2), DateTime.Now, supcust_no, "A");

            frmSelect frm = new frmSelect();

            frm.dgv.AddColumn("oper_date", "日期", "", 100, 1, "yyyy-MM-dd");
            frm.dgv.AddColumn("sheet_no", "单据号", "", 150, 1, "");
            frm.dgv.AddColumn("仓库", "仓库", "", 200, 1, "");
            frm.dgv.AddColumn("货商", "货商", "", 200, 1, "");
            frm.dgv.AddColumn("total_amount", "金额", "", 100, 3, "0.00");

            frm.Text         = "选择入库单";
            frm.tb           = dt;
            frm.is_show_left = false;

            this.txt_voucher_no.Text = frm.SelectData("单号:", "sheet_no");
        }
Beispiel #2
0
 private void tsbDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (!MyLove.PermissionsBalidation(this.Text, "02"))
         {
             return;
         }
         if (sheet_no != null && sheet_no != "")
         {
             if (YesNoForm.ShowFrom("确认删除单据[" + sheet_no + "]?") == System.Windows.Forms.DialogResult.Yes)
             {
                 IBLL.IInOutBLL bll = new BLL.InOutBLL();
                 bll.DeleteInOut(sheet_no, update_time);
                 IOrder ins = this;
                 ins.Add();
             }
         }
     }
     catch (Exception ex)
     {
         MsgForm.ShowFrom("删除单据异常[" + ex.Message + "]");
         Helper.LogHelper.writeLog("frmOtherInOutSheet->tsbDel_Click()", ex.ToString(), sheet_no);
     }
 }
Beispiel #3
0
 private void tsbDel_Click(object sender, EventArgs e)
 {
     try
     {
         if (!MyLove.PermissionsBalidation(this.Text, "02"))
         {
             return;
         }
         if (this.dataGrid1.CurrentRow() != null)
         {
             string sheet_no = this.dataGrid1.CurrentRow()["sheet_no"].ToString();
             if (YesNoForm.ShowFrom("确认删除单据" + sheet_no + "?") == DialogResult.Yes)
             {
                 IBLL.IInOutBLL bll = new BLL.InOutBLL();
                 bll.DeleteInOut(sheet_no, update_time);
                 var tb = this.dataGrid1.DataSource;
                 tb.Rows.Remove(this.dataGrid1.CurrentRow());
                 this.dataGrid2.DataSource = new DataTable();
                 this.dataGrid1.Refresh();
             }
         }
     }
     catch (Exception ex)
     {
         MsgForm.ShowFrom(ex);
         Helper.LogHelper.writeLog("frmIOMaster->tsbDel_Click()", ex.ToString());
     }
 }
Beispiel #4
0
 private void tsbCheck_Click(object sender, EventArgs e)
 {
     try
     {
         if (!MyLove.PermissionsBalidation(this.Text, "05"))
         {
             return;
         }
         if (this.dataGrid1.CurrentRow() != null)
         {
             string         sheet_no = this.dataGrid1.CurrentRow()["sheet_no"].ToString();
             IBLL.IInOutBLL bll      = new BLL.InOutBLL();
             bll.CheckInOut(sheet_no, Program.oper.oper_id, update_time);
             var row = this.dataGrid1.CurrentRow();
             row["approve_flag"] = "1";
             row["approve_man"]  = Program.oper.oper_id;
             row["approve_date"] = System.DateTime.Now;
             this.dataGrid1.Refresh();
         }
     }
     catch (Exception ex)
     {
         MsgForm.ShowFrom(ex);
         Helper.LogHelper.writeLog("frmIOMaster->tsbDel_Click()", ex.ToString());
     }
 }
        /// <summary>
        /// 收货称流水生成采购单
        /// </summary>
        /// <param name="dgv"></param>
        public void GenerateReceiveCG(DataGrid dgv)
        {
            try
            {
                if (dgv.DataSource.Rows.Count < 1)
                {
                    throw new Exception("表格中没有数据!");
                }
                DataTable tb = dgv.GetSelectData();
                if (tb.Rows.Count < 1)
                {
                    throw new Exception("请选择要生成采购单的数据!");
                }

                StringBuilder flow_id = new StringBuilder("''");

                foreach (DataRow dr in tb.Rows)
                {
                    flow_id.Append(",'" + dr["flow_id"].ToString() + "'");
                }

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

                bll.ReceiveGenCG(flow_id.ToString(), Program.oper.oper_id);

                MsgForm.ShowFrom("生成采购单成功");
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
        }
Beispiel #6
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());
                System.Threading.Thread th = new System.Threading.Thread(() =>
                {
                    Cursor.Current = Cursors.WaitCursor;
                    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("期间不正确");
                        }

                        DataTable tb = bll.GetInOutList(date1, date2, "", "G");

                        this.dataGrid1.Invoke((MethodInvoker) delegate
                        {
                            this.dataGrid1.DataSource = tb;
                        });
                    }
                    catch (Exception ex)
                    {
                        IvyBack.Helper.LogHelper.writeLog("refreshData", 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("frmIOMaster->refreshData()", ex.ToString());
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }
Beispiel #7
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();
        }
        private void LoadOrder()
        {
            string order_sheet_no = this.txt_voucher_no.Text.Trim();

            if (string.IsNullOrEmpty(order_sheet_no))
            {
                return;
            }

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

            DataTable tbmain;
            DataTable tbdetail;

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

            DataRow row = tbmain.Rows[0];

            txt_cust.GetValue("supcust_no", row["sup_no"].ToString());
            txtbranch.GetValue("branch_no", row["branch_no"].ToString());
            txt_sale_man.GetValue("oper_id", row["order_man"].ToString());
            txt_paid_amount.Text = row["paid_amount"].ToString();
            txtmemo.Text         = row["memo"].ToString();


            this.editGrid1.DataSource.ClearTable();
            foreach (DataRow dr in tbdetail.Rows)
            {
                DataRow r = this.editGrid1.DataSource.NewRow();
                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["sale_qnty"]  = dr["order_qnty"];
                r["real_price"] = dr["in_price"];
                r["sale_money"] = dr["sub_amount"];
                r["other5"]     = dr["other1"];

                this.editGrid1.DataSource.Rows.Add(r);
            }

            txt_cust.Enabled       = false;
            txtbranch.Enabled      = false;
            txt_voucher_no.Enabled = false;

            this.editGrid1.DataSource.Rows.Add();
            this.editGrid1.Refresh();
        }
Beispiel #9
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.GetOtherInOut(this.txtsheet_no.Text, out tb1, out tb2);

            PrintForm.PrintHelper.tb_main   = tb1;
            PrintForm.PrintHelper.tb_detail = tb2;
        }
        void IOrder.Add()
        {
            try
            {
                RunType = 1;

                foreach (Control c in this.panel1.Controls)
                {
                    c.Enabled = true;
                }

                IBLL.IInOutBLL bll3  = new BLL.InOutBLL();
                var            order = bll3.GetImportSSSheet();
                this.txt_voucher_no.Invoke((MethodInvoker) delegate
                {
                    this.txt_voucher_no.Bind(order, 350, 200, "sheet_no", "sheet_no:单据号:110,supcust:客户:100,branch:仓库:100,oper_date:日期:150", "sheet_no->Text");
                });

                this.txt_cust.Text = "";
                this.txtbranch.GetDefaultValue();
                this.txtsheet_no.Text     = "";
                this.txt_voucher_no.Text  = "";
                this.txtoper_date.Text    = System.DateTime.Now.ToString("yyyy-MM-dd");
                this.txt_pay_date.Text    = System.DateTime.Now.ToString("yyyy-MM-dd");
                this.txt_sale_man.Text    = "";
                this.txtapprove_man.Text  = "";
                this.txtoper_man.Text     = Program.oper.oper_id + "/" + Program.oper.oper_name;
                this.txtmemo.Text         = "";
                this.txtapprove_date.Text = "";

                //
                var tb = editGrid1.DataSource;
                tb.Clear();
                for (int i = 0; i < 1; i++)
                {
                    tb.Rows.Add(tb.NewRow());
                }
                editGrid1.Refresh();

                Dictionary <string, object> dic = this.Tag as Dictionary <string, object>;
                this.Tag = Helper.Conv.ControlsAdds(this, dic);
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
        }
        private void txt_voucher_no_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (string.IsNullOrEmpty(this.txt_voucher_no.Text))
                {
                    return;
                }
                IBLL.IInOutBLL bll = new BLL.InOutBLL();
                bll.GetInOut(this.txt_voucher_no.Text, "A", out in_master, out in_detail);

                if (in_detail.Rows.Count > 0)
                {
                    var tb = editGrid1.DataSource;
                    if (tb.Rows.Count > 0)
                    {
                        if (YesNoForm.ShowFrom("检测到表格中有数据,是否加载?(将覆盖数据)") == DialogResult.Yes)
                        {
                            tb.Clear();
                        }
                    }

                    foreach (DataRow dr in in_detail.Rows)
                    {
                        DataRow r = tb.NewRow();
                        r["item_no"]     = dr["item_no"];
                        r["item_subno"]  = dr["item_subno"];
                        r["item_name"]   = dr["item_name"];
                        r["unit_no"]     = dr["unit_no"];
                        r["item_size"]   = dr["item_size"];
                        r["in_qty"]      = dr["in_qty"];
                        r["valid_price"] = dr["valid_price"];
                        r["sub_amount"]  = dr["sub_amount"];
                        r["other1"]      = dr["other1"];
                        r["price"]       = dr["price"];
                        tb.Rows.Add(r);
                    }
                    editGrid1.Refresh();
                }
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
        }
Beispiel #12
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());
            }
        }
        private void txt_voucher_no_TextChanged(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txt_voucher_no.Text))
            {
                return;
            }


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

            bll.GetSaleSheet(txt_voucher_no.Text, out tb1, out tb2);

            if (tb2.Rows.Count > 0)
            {
                var tb = editGrid1.DataSource;
                if (tb.Rows.Count > 0)
                {
                    if (YesNoForm.ShowFrom("检测到表格中有数据,是否加载?(将覆盖数据)") == DialogResult.Yes)
                    {
                        tb.Clear();
                    }
                }

                foreach (DataRow dr in tb2.Rows)
                {
                    DataRow r = tb.NewRow();
                    r["item_no"]     = dr["item_no"];
                    r["item_subno"]  = dr["item_subno"];
                    r["item_name"]   = dr["item_name"];
                    r["unit_no"]     = dr["unit_no"];
                    r["item_size"]   = dr["item_size"];
                    r["in_qty"]      = dr["sale_qnty"];
                    r["valid_price"] = dr["real_price"];
                    r["sub_amount"]  = dr["sale_money"];
                    r["other1"]      = dr["other1"];
                    r["price"]       = dr["sale_price"];
                    tb.Rows.Add(r);
                }
                editGrid1.Refresh();
            }
        }
Beispiel #14
0
 private void tsbCheck_Click(object sender, EventArgs e)
 {
     try
     {
         if (!MyLove.PermissionsBalidation(this.Text, "05"))
         {
             return;
         }
         if (sheet_no != null && sheet_no != "")
         {
             IBLL.IInOutBLL bll = new BLL.InOutBLL();
             bll.CheckCGOrder(sheet_no, Program.oper.oper_id, update_time);
             IOrder ins = this;
             ins.ShowOrder(sheet_no);
         }
     }
     catch (Exception ex)
     {
         MsgForm.ShowFrom("审核单据异常[" + ex.Message + "]");
         Helper.LogHelper.writeLog("frmCGOrder->tsbCheck_Click()", ex.ToString(), sheet_no);
     }
 }
Beispiel #15
0
 private void dataGrid1_CurrentCellChange(object sender, string column_name, DataRow row)
 {
     try
     {
         if (sheet_no != row["sheet_no"].ToString())
         {
             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.GetInOut(sheet_no, trans_no, out tb1, out tb2);
             this.dataGrid2.DataSource = tb2;
             update_time = Helper.Conv.ToDateTime(tb1.Rows[0]["update_time"]);
         }
     }
     catch (Exception ex)
     {
         MsgForm.ShowFrom(ex);
         Helper.LogHelper.writeLog("frmIOMaster->dataGrid1_CurrentCellChange()", ex.ToString());
     }
 }
        private void btnSelect_Click(object sender, EventArgs e)
        {
            IBLL.IInOutBLL bll        = new BLL.InOutBLL();
            var            dt         = new DataTable();
            var            supcust_no = txt_cust.Text.Trim().Split('/')[0];

            if (supcust_no != "")
            {
                dt = bll.GetSimpleSaleSheetList(DateTime.Now.AddMonths(-2), DateTime.Now, supcust_no);
            }
            frmSelect frm = new frmSelect();

            frm.dgv.AddColumn("oper_date", "操作时间", "", 100, 1, "yyyy-MM-dd");
            frm.dgv.AddColumn("sheet_no", "单号", "", 150, 1, "");
            frm.dgv.AddColumn("仓库", "仓库", "", 200, 1, "");
            frm.dgv.AddColumn("客户", "客户", "", 200, 1, "");
            frm.dgv.AddColumn("total_amount", "金额", "", 100, 3, "0.00");

            frm.Text         = "选择销售单";
            frm.tb           = dt;
            frm.is_show_left = false;

            this.txt_voucher_no.Text = frm.SelectData("单号:", "sheet_no");
        }
Beispiel #17
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.GetOtherInOut(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["deal_man"].ToString() == "")
                {
                    txt_deal_man.Text = "";
                }
                else
                {
                    txt_deal_man.Text = r1["deal_man"].ToString() + "/" + r1["deal_man_name"].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");
                var trans_name = "";
                var trans_no   = r1["trans_no"].ToString();
                if (trans_no == "01")
                {
                    trans_name = "其它入库";
                }
                else if (trans_no == "02")
                {
                    trans_name = "归还";
                }
                else if (trans_no == "03")
                {
                    trans_name = "其它出库";
                }
                else if (trans_no == "04")
                {
                    trans_name = "领用出库";
                }
                else if (trans_no == "05")
                {
                    trans_name = "报损出库";
                }
                else if (trans_no == "06")
                {
                    trans_name = "借出";
                }
                else if (trans_no == "07")
                {
                    trans_name = "报溢入库";
                }
                else if (trans_no == "09")
                {
                    trans_name = "库存调整";
                }
                txt_trans_no.Text = trans_no + "/" + trans_name;
                txt_other3.Text   = r1["other3"].ToString();
                txt_old_no.Text   = r1["old_no"].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("frmOtherInOutSheet->ShowOrder()", ex.ToString(), sheet_no);
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }
Beispiel #18
0
        void IOrder.Save()
        {
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                //
                if (txt_trans_no.Text.Trim().Contains("/") == false)
                {
                    MsgForm.ShowFrom("业务类型必填!");
                    return;
                }
                if (txtbranch.Text.Trim().Contains("/") == false)
                {
                    MsgForm.ShowFrom("机构必填!");
                    return;
                }
                if (txtoper_date.Text.Trim() == "")
                {
                    MsgForm.ShowFrom("单据日期必填!");
                    return;
                }

                ic_t_inout_store_master        ord   = new ic_t_inout_store_master();
                List <ic_t_inout_store_detail> lines = new List <ic_t_inout_store_detail>();
                ord.sheet_no     = txtsheet_no.Text.Trim();
                ord.trans_no     = txt_trans_no.Text.Trim().Split('/')[0];
                ord.branch_no    = txtbranch.Text.Trim().Split('/')[0];
                ord.voucher_no   = "";
                ord.supcust_no   = "";
                ord.pay_way      = "";
                ord.discount     = 1;
                ord.coin_no      = "RMB";
                ord.tax_amount   = 0;
                ord.oper_date    = Helper.Conv.ToDateTime(txtoper_date.Text.Trim());
                ord.oper_id      = txtoper_man.Text.Split('/')[0];
                ord.deal_man     = txt_deal_man.Text.Split('/')[0];
                ord.cm_branch    = "00";
                ord.other1       = txt_other3.Text.Trim();
                ord.other2       = "";
                ord.other3       = txt_other3.Text.Trim();
                ord.old_no       = txt_old_no.Text;
                ord.num1         = 0;
                ord.num2         = 0;
                ord.num3         = 0;
                ord.sale_no      = "";
                ord.approve_flag = "0";
                ord.approve_man  = txtapprove_man.Text.Split('/')[0];
                ord.approve_date = System.DateTime.MinValue;
                ord.pay_date     = System.DateTime.MinValue;
                ord.update_time  = update_time;

                int     flag      = 0;
                int     index     = 0;
                decimal total_amt = 0;
                foreach (DataRow row in editGrid1.DataSource.Rows)
                {
                    ++index;
                    if (row["item_no"].ToString() != "")
                    {
                        ic_t_inout_store_detail line = new ic_t_inout_store_detail();
                        lines.Add(line);
                        line.sheet_no    = ord.sheet_no;
                        line.item_no     = row["item_no"].ToString();
                        line.item_name   = row["item_name"].ToString();
                        line.unit_no     = row["unit_no"].ToString();
                        line.barcode     = row["barcode"].ToString();
                        line.unit_factor = 1;
                        line.in_qty      = Helper.Conv.ToDecimal(row["in_qty"].ToString());
                        line.orgi_price  = 0;
                        line.valid_price = Helper.Conv.ToDecimal(row["valid_price"].ToString());
                        line.cost_price  = 0;
                        line.sub_amount  = Helper.Conv.ToDecimal(row["sub_amount"].ToString());
                        line.discount    = 1;
                        line.tax         = 0;
                        line.is_tax      = "0";
                        line.valid_date  = DateTime.MinValue;
                        line.other1      = row["other1"].ToString();
                        line.other2      = "";
                        line.other3      = "";
                        line.voucher_no  = "";
                        line.sheet_sort  = index;
                        line.ret_qnty    = 0;
                        line.num1        = 0;
                        line.num2        = 0;
                        line.num3        = 0;
                        line.num4        = 0;
                        line.num5        = 0;
                        line.num6        = 0;
                        line.cost_notax  = 0;
                        line.packqty     = 0;
                        line.sgqty       = 0;
                        flag             = 1;
                        total_amt       += line.in_qty * line.valid_price;
                    }
                }
                if (flag == 0)
                {
                    MsgForm.ShowFrom("请输入表单明细");
                    return;
                }
                ord.inout_amount = total_amt;
                ord.total_amount = total_amt;
                IBLL.IInOutBLL bll = new BLL.InOutBLL();
                if (runType == 1)
                {
                    var sheet_no = "";
                    bll.AddInOut(ord, lines, out sheet_no);
                    IOrder ins = this;
                    ins.ShowOrder(sheet_no);
                }
                else if (runType == 2)
                {
                    bll.ChangeInOut(ord, lines);
                    IOrder ins = this;
                    ins.ShowOrder(ord.sheet_no);
                }

                Dictionary <string, object> dic = this.Tag as Dictionary <string, object>;
                this.Tag = Helper.Conv.ControlsAdds(this, dic);

                IBLL.ISys sys       = new BLL.SysBLL();
                string    isApprove = sys.Read("approve_at_ones");
                if ("1".Equals(isApprove))
                {
                    if (YesNoForm.ShowFrom("保存成功!是否立即审核") == DialogResult.Yes)
                    {
                        tsbCheck_Click(new object(), new EventArgs());
                    }
                }
            }
            catch (Exception ex)
            {
                Helper.LogHelper.writeLog("frmOtherInOutSheet->Save()", ex.ToString(), txtsheet_no.Text);
                MsgForm.ShowFrom("其它出入单保存异常[" + ex.Message + "]");
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }
Beispiel #19
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.GetInOut(sheet_no, "A", 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["deal_man"].ToString() == "")
                {
                    txt_deal_man.Text = "";
                }
                else
                {
                    txt_deal_man.Text = r1["deal_man"].ToString() + "/" + r1["deal_man_name"].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_pay_date.Text    = Helper.Conv.ToDateTime(r1["pay_date"]).ToString("yyyy-MM-dd");
                txt_voucher_no.Text  = r1["voucher_no"].ToString();
                txt_sup.Text         = r1["supcust_no"].ToString() + "/" + r1["sup_name"].ToString();
                var sale_name = "";
                var sale_no   = r1["sale_no"].ToString();
                if (sale_no == "A")
                {
                    sale_name = "购销";
                }
                else if (sale_no == "B")
                {
                    sale_name = "代销";
                }
                else if (sale_no == "C")
                {
                    sale_name = "联营";
                }
                else if (sale_no == "E")
                {
                    sale_name = "联营进货";
                }
                else if (sale_no == "Z")
                {
                    sale_name = "租赁";
                }
                txt_sale_no.Text = sale_no + "/" + sale_name;

                txt_other1.Text = r1["other1"].ToString();
                txt_other3.Text = r1["other3"].ToString();
                txt_old_no.Text = r1["old_no"].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("frmCGInSheet->ShowOrder()", ex.ToString(), sheet_no);
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }
Beispiel #20
0
        private void SaveSheet()
        {
            if (curr_cust == null || string.IsNullOrEmpty(curr_cust.supcust_no))
            {
                MsgForm.ShowFrom("请选择客户!");
                return;
            }
            if (sale_detail.Rows.Count < 1)
            {
                MsgForm.ShowFrom("请输入明细!");
                return;
            }

            sm_t_salesheet ord = new sm_t_salesheet();
            List <sm_t_salesheet_detail> lines = new List <sm_t_salesheet_detail>();

            ord.sheet_no     = "";
            ord.branch_no    = sale_master.branch_no;
            ord.voucher_no   = "";
            ord.cust_no      = sale_master.cust_no;
            ord.pay_way      = "";
            ord.discount     = 1;
            ord.coin_no      = "RMB";
            ord.paid_amount  = 0;
            ord.oper_date    = sale_master.oper_date;
            ord.oper_id      = Program.oper.oper_id;
            ord.sale_man     = "00";
            ord.approve_flag = "0";
            ord.other1       = sale_master.other1;
            ord.other2       = "0";
            ord.other3       = "";
            ord.other4       = "";
            ord.old_no       = "";
            ord.cm_branch    = "00";
            ord.psheet_no    = "";
            ord.pay_nowmark  = "";
            ord.payfee_memo  = "";
            ord.if_back      = "0";
            ord.approve_man  = "";
            ord.approve_date = System.DateTime.MinValue;
            ord.num1         = 0;
            ord.num2         = 0;
            ord.num3         = 0;
            ord.pay_date     = sale_master.oper_date.AddMonths(1);

            int     index     = 0;
            decimal total_amt = 0;

            foreach (DataRow row in sale_detail.Rows)
            {
                ++index;
                if (row["item_no"].ToString() != "")
                {
                    sm_t_salesheet_detail line = new sm_t_salesheet_detail();
                    lines.Add(line);
                    line.sheet_no    = ord.sheet_no;
                    line.item_no     = row["item_no"].ToString();
                    line.item_name   = row["item_name"].ToString();
                    line.unit_no     = row["unit_no"].ToString();
                    line.barcode     = row["barcode"].ToString();
                    line.unit_factor = 1;
                    line.sale_qnty   = Helper.Conv.ToDecimal(row["sale_qnty"].ToString());
                    line.sale_price  = Helper.Conv.ToDecimal(row["real_price"].ToString());
                    line.real_price  = Helper.Conv.ToDecimal(row["real_price"].ToString());
                    line.cost_price  = 0;
                    line.sale_money  = Helper.Conv.ToDecimal(row["sale_money"].ToString());
                    line.discount    = 1;
                    line.sale_tax    = 0;
                    line.is_tax      = "0";
                    line.other1      = row["other1"].ToString();
                    line.other2      = "";
                    line.other3      = "0";
                    line.other4      = "";
                    line.voucher_no  = "";
                    line.sheet_sort  = index;
                    line.ret_qnty    = 0;
                    line.num1        = 0;
                    line.num2        = 0;
                    line.num3        = 0;
                    line.num4        = 0;
                    line.num5        = 0;
                    line.num6        = 0;
                    line.num7        = 0;
                    line.num8        = 0;
                    line.cost_notax  = 0;
                    line.packqty     = 0;
                    line.sgqty       = 0;

                    total_amt += line.sale_qnty * line.real_price;
                }
            }
            ord.real_amount  = total_amt;
            ord.total_amount = total_amt;

            IBLL.IInOutBLL bll = new BLL.InOutBLL();
            bll.AddSaleSheet(ord, lines, out string sheet_no);

            NewSheet();
        }
        void IOrder.Save()
        {
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                //
                if (txt_sup.Text.Trim().Contains("/") == false)
                {
                    MsgForm.ShowFrom("客户编码必填!");
                    return;
                }
                if (txtbranch.Text.Trim().Contains("/") == false)
                {
                    MsgForm.ShowFrom("机构必填!");
                    return;
                }
                if (txtoper_date.Text.Trim() == "")
                {
                    MsgForm.ShowFrom("单据日期必填!");
                    return;
                }

                co_t_order_main         ord   = new co_t_order_main();
                List <co_t_order_child> lines = new List <co_t_order_child>();
                ord.sheet_no     = txtsheet_no.Text.Trim();
                ord.branch_no    = txtbranch.Text.Trim().Split('/')[0];
                ord.sup_no       = txt_sup.Text.Trim().Split('/')[0];
                ord.coin_code    = lbl_coin_no.Text.Trim();
                ord.paid_amount  = Helper.Conv.ToDecimal(txt_paid_amount.Text);
                ord.oper_date    = Helper.Conv.ToDateTime(txtoper_date.Text.Trim());
                ord.oper_id      = txtoper_man.Text.Split('/')[0];
                ord.order_man    = txt_order_man.Text.Split('/')[0];
                ord.trans_no     = "S";
                ord.order_status = "0";
                ord.sale_way     = "A";
                ord.p_sheet_no   = "";
                ord.approve_flag = "0";
                ord.other1       = "";
                ord.cm_branch    = "00";
                ord.approve_man  = txtapprove_man.Text.Split('/')[0];
                ord.approve_date = System.DateTime.MinValue;
                ord.num1         = 0;
                ord.num2         = 0;
                ord.num3         = 0;
                ord.valid_date   = dtvalid_date.Text.ToDateTime();
                ord.memo         = txtmemo1.Text;
                ord.other2       = txtmemo2.Text;

                int     flag      = 0;
                int     index     = 0;
                decimal total_amt = 0;
                foreach (DataRow row in editGrid1.DataSource.Rows)
                {
                    ++index;
                    if (row["item_no"].ToString() != "")
                    {
                        co_t_order_child line = new co_t_order_child();
                        lines.Add(line);
                        line.sheet_no    = ord.sheet_no;
                        line.item_no     = row["item_no"].ToString();
                        line.unit_no     = row["unit_no"].ToString();
                        line.barcode     = row["barcode"].ToString();
                        line.unit_factor = 1;
                        line.discount    = row["discount"].ToDecimal();
                        line.in_price    = Helper.Conv.ToDecimal(row["in_price"].ToString());
                        line.order_qnty  = Helper.Conv.ToDecimal(row["order_qnty"].ToString());
                        line.sub_amount  = Helper.Conv.ToDecimal(row["sub_amount"].ToString());
                        line.discount    = 1;
                        line.other1      = row["other1"].ToString();
                        line.other2      = "";
                        line.voucher_no  = "";
                        line.sheet_sort  = index;
                        line.num1        = 0;
                        line.num2        = 0;
                        line.num3        = 0;
                        line.packqty     = 0;
                        line.sgqty       = 0;
                        flag             = 1;
                        total_amt       += line.order_qnty * line.in_price;
                    }
                }
                if (flag == 0)
                {
                    MsgForm.ShowFrom("请输入表单明细");
                    return;
                }
                ord.total_amount = total_amt;

                if (runType == 1)
                {
                    IBLL.IInOutBLL bll      = new BLL.InOutBLL();
                    var            sheet_no = "";
                    bll.AddSaleSSSheet(ord, lines, out sheet_no);
                    IOrder ins = this;
                    ins.ShowOrder(sheet_no);
                }
                else if (runType == 2)
                {
                    IBLL.IInOutBLL bll = new BLL.InOutBLL();
                    bll.ChangeSaleSSSheet(ord, lines);
                    IOrder ins = this;
                    ins.ShowOrder(ord.sheet_no);
                }

                Dictionary <string, object> dic = this.Tag as Dictionary <string, object>;
                this.Tag = Helper.Conv.ControlsAdds(this, dic);

                IBLL.ISys sys       = new BLL.SysBLL();
                string    isApprove = sys.Read("approve_at_ones");
                if ("1".Equals(isApprove))
                {
                    if (YesNoForm.ShowFrom("保存成功!是否立即审核") == DialogResult.Yes)
                    {
                        tsbCheck_Click(new object(), new EventArgs());
                    }
                }
            }
            catch (Exception ex)
            {
                Helper.LogHelper.writeLog("frmSaleSheet->Save()", ex.ToString(), txtsheet_no.Text);
                MsgForm.ShowFrom("销售订单保存异常[" + ex.Message + "]");
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }
        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.GetSaleSheet(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["sale_man"].ToString() == "")
                {
                    txt_sale_man.Text = "";
                }
                else
                {
                    txt_sale_man.Text = r1["sale_man"].ToString() + "/" + r1["sale_man_name"].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"];
                }
                txtmemo.Text         = r1["payfee_memo"].ToString();
                txtapprove_date.Text = Helper.Conv.ToDateTime(r1["approve_date"]).ToString("yyyy-MM-dd");
                txt_pay_date.Text    = Helper.Conv.ToDateTime(r1["pay_date"]).ToString("yyyy-MM-dd");
                txt_voucher_no.Text  = r1["voucher_no"].ToString();
                txt_cust.Text        = r1["cust_no"].ToString() + "/" + r1["sup_name"].ToString();
                txt_discount.Text    = Helper.Conv.ToDecimal(r1["discount"]).ToString("F2");
                txt_paid_amount.Text = Helper.Conv.ToDecimal(r1["paid_amount"]).ToString("F2");
                txt_other2.Text      = (r1["other2"].ToString() == "1" ? "是" : "否");
                //
                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("frmSaleSheet->ShowOrder()", ex.ToString(), sheet_no);
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }
        public frmSaleSheet()
        {
            InitializeComponent();
            //
            Helper.GlobalData.InitForm(this);
            //
            var tb = new DataTable();

            tb.Columns.Add("item_no");
            tb.Columns.Add("item_subno");
            tb.Columns.Add("barcode");
            tb.Columns.Add("item_name");
            tb.Columns.Add("unit_no");
            tb.Columns.Add("other3");
            tb.Columns.Add("sale_qnty", typeof(decimal));
            tb.Columns.Add("real_price", typeof(decimal));
            tb.Columns.Add("sale_money", typeof(decimal));
            tb.Columns.Add("other5");

            editGrid1.AddColumn("item_subno", "货号", "", 120, 1, "", true);
            editGrid1.AddColumn("item_name", "商品名称", "", 150, 1, "", false);
            editGrid1.AddColumn("other3", "赠送", "", 60, 2, "", false);
            editGrid1.AddColumn("unit_no", "单位", "", 60, 2, "", false);
            editGrid1.AddColumn("sale_qnty", "数量", "", 100, 3, "0.00", true);
            editGrid1.AddColumn("real_price", "实际价", "", 100, 3, "0.00", true);
            editGrid1.AddColumn("sale_money", "实际金额", "", 100, 3, "0.00", false);
            editGrid1.AddColumn("other5", "备注明细", "", 150, 1, "", true);

            editGrid1.SetTotalColumn("sale_qnty,sale_money");//合计项
            editGrid1.DataSource = tb;
            editGrid1.BindCheck("other3");
            //
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                //

                System.Threading.Thread th = new System.Threading.Thread(() =>
                {
                    Cursor.Current = Cursors.WaitCursor;
                    Helper.GlobalData.windows.ShowLoad(this);
                    try
                    {
                        IBLL.ICommonBLL bll2 = new BLL.CommonBLL();

                        var branch = bll2.GetBranchList();
                        this.txtbranch.Invoke((MethodInvoker) delegate
                        {
                            txtbranch.Bind(branch, 300, 200, "branch_no", "branch_no:机构号:80,branch_name:机构名:140", "branch_no/branch_name->Text");
                        });

                        var sale = bll2.GetPeopleList();
                        this.txt_sale_man.Invoke((MethodInvoker) delegate
                        {
                            txt_sale_man.Bind(sale, 250, 200, "oper_id", "oper_id:职员编号:80,oper_name:姓名:80", "oper_id/oper_name->Text");
                        });

                        var cust = bll2.GetAllCustList();
                        this.txt_cust.Invoke((MethodInvoker) delegate
                        {
                            txt_cust.Bind(cust, 350, 200, "supcust_no", "supcust_no:编号:80,sup_name:名称:200", "supcust_no/sup_name->Text");
                        });

                        IBLL.IInOutBLL bll3 = new BLL.InOutBLL();
                        var order           = bll3.GetImportSSSheet();
                        this.txt_voucher_no.Invoke((MethodInvoker) delegate
                        {
                            this.txt_voucher_no.Bind(order, 350, 200, "sheet_no", "sheet_no:单据号:110,supcust:客户:100,branch:仓库:100,oper_date:日期:150", "sheet_no->Text");
                        });

                        this.Invoke((MethodInvoker) delegate
                        {
                            IOrder ins = this;
                            ins.Add();
                        });
                    }
                    catch (Exception ex)
                    {
                        IvyBack.Helper.LogHelper.writeLog("frmSaleSheet", 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("frmSaleSheet()", ex.ToString());
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }
Beispiel #24
0
        void IServiceBase.Request(string t, string pars, out string res)
        {
            try
            {
                ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars);
                var            kv  = r.ToDictionary();
                IBLL.IInOutBLL bll = new BLL.InOutBLL();
                if (t == "get_salesheet_list")
                {
                    string date1    = r.Read("date1");
                    string date2    = r.Read("date2");
                    string cust_id  = r.Read("cust_id");
                    string sale_man = r.Read("sale_man");

                    var tb = bll.GetSaleSheetList(date1, date2, cust_id, sale_man);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("data", tb);

                    res = w.ToString();
                }
                else if (t == "get_simple_salesheet_list")
                {
                    string date1   = r.Read("date1");
                    string date2   = r.Read("date2");
                    string cust_id = r.Read("cust_id");

                    var tb = bll.GetSimpleSaleSheetList(date1, date2, cust_id);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("data", tb);

                    res = w.ToString();
                }
                else if (t == "get_salesheet")
                {
                    string sheet_no = r.Read("sheet_no");
                    System.Data.DataTable tb1;
                    System.Data.DataTable tb2;
                    bll.GetSaleSheet(sheet_no, out tb1, out tb2);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("tb1", tb1);
                    w.Append("tb2", tb2);
                    res = w.ToString();
                }
                else if (t == "add_salesheet")
                {
                    var ord = new Model.sm_t_salesheet();

                    ord.sheet_no = r.Read("sheet_no");

                    ord.voucher_no   = r.Read("voucher_no");
                    ord.branch_no    = r.Read("branch_no");
                    ord.cust_no      = r.Read("cust_no");
                    ord.pay_way      = r.Read("pay_way");
                    ord.discount     = Helper.Conv.ToDecimal(r.Read("discount"));
                    ord.coin_no      = r.Read("coin_no");
                    ord.real_amount  = Helper.Conv.ToDecimal(r.Read("real_amount"));
                    ord.total_amount = Helper.Conv.ToDecimal(r.Read("total_amount"));
                    ord.paid_amount  = Helper.Conv.ToDecimal(r.Read("paid_amount"));
                    ord.approve_flag = "0";
                    ord.source_flag  = "";
                    ord.oper_id      = r.Read("oper_id");
                    ord.sale_man     = r.Read("sale_man");
                    ord.oper_date    = Helper.Conv.ToDateTime(r.Read("oper_date"));
                    ord.pay_date     = Helper.Conv.ToDateTime(r.Read("pay_date"));
                    ord.other1       = r.Read("other1");
                    ord.other2       = r.Read("other2");
                    ord.other3       = r.Read("other3");
                    ord.cm_branch    = r.Read("cm_branch");
                    ord.approve_man  = "";
                    ord.approve_date = DateTime.MinValue;
                    ord.num1         = Helper.Conv.ToDecimal(r.Read("num1"));
                    ord.num2         = Helper.Conv.ToDecimal(r.Read("num2"));
                    ord.num3         = Helper.Conv.ToDecimal(r.Read("num3"));
                    ord.payfee_memo  = r.Read("payfee_memo");
                    ord.old_no       = "";
                    ord.psheet_no    = r.Read("psheet_no");
                    ord.pay_nowmark  = r.Read("pay_nowmark");
                    ord.if_back      = r.Read("if_back");
                    ord.cust_cls     = "";
                    ord.other4       = r.Read("other4");

                    List <Model.sm_t_salesheet_detail> lines = new List <Model.sm_t_salesheet_detail>();
                    foreach (ReadWriteContext.IReadContext r2 in r.ReadList("lines"))
                    {
                        var item = new Model.sm_t_salesheet_detail();
                        item.sheet_no    = r2.Read("sheet_no");
                        item.item_no     = r2.Read("item_no");
                        item.item_name   = r2.Read("item_name");
                        item.unit_no     = r2.Read("unit_no");
                        item.unit_factor = Helper.Conv.ToDecimal(r2.Read("unit_factor"));
                        item.sale_qnty   = Helper.Conv.ToDecimal(r2.Read("sale_qnty"));
                        item.sale_price  = Helper.Conv.ToDecimal(r2.Read("sale_price"));
                        item.real_price  = Helper.Conv.ToDecimal(r2.Read("real_price"));
                        item.cost_price  = Helper.Conv.ToDecimal(r2.Read("cost_price"));
                        item.sale_money  = Helper.Conv.ToDecimal(r2.Read("sale_money"));
                        item.sale_tax    = Helper.Conv.ToDecimal(r2.Read("sale_tax"));
                        item.is_tax      = r2.Read("is_tax");
                        item.other1      = r2.Read("other1");
                        item.other2      = r2.Read("other2");
                        item.other3      = r2.Read("other3");
                        item.other4      = r2.Read("other4");
                        item.num1        = Helper.Conv.ToDecimal(r2.Read("num1"));
                        item.num2        = Helper.Conv.ToDecimal(r2.Read("num2"));
                        item.num3        = Helper.Conv.ToDecimal(r2.Read("num3"));
                        item.num4        = Helper.Conv.ToDecimal(r2.Read("num4"));
                        item.num5        = Helper.Conv.ToDecimal(r2.Read("num5"));
                        item.num6        = Helper.Conv.ToDecimal(r2.Read("num6"));
                        item.barcode     = r2.Read("barcode");
                        item.sheet_sort  = Helper.Conv.ToInt(r2.Read("sheet_sort"));
                        item.ret_qnty    = Helper.Conv.ToDecimal(r2.Read("ret_qnty"));
                        item.discount    = Helper.Conv.ToDecimal(r2.Read("discount"));
                        item.voucher_no  = r2.Read("voucher_no");
                        item.cost_notax  = Helper.Conv.ToDecimal(r2.Read("cost_notax"));
                        item.packqty     = Helper.Conv.ToInt(r2.Read("packqty"));
                        item.sgqty       = Helper.Conv.ToDecimal(r2.Read("sgqty"));
                        item.branch_no_d = "";
                        item.ly_sup_no   = "";
                        item.ly_rate     = 0M;
                        item.num7        = Helper.Conv.ToDecimal(r2.Read("num7"));
                        item.other5      = r2.Read("other5");
                        item.num8        = Helper.Conv.ToDecimal(r2.Read("num8"));
                        item.produce_day = DateTime.MinValue;
                        lines.Add(item);
                    }
                    string sheet_no = "";
                    bll.AddSaleSheet(ord, lines, out sheet_no);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("sheet_no", sheet_no);
                    res = w.ToString();
                }
                else if (t == "change_salesheet")
                {
                    var ord = new Model.sm_t_salesheet();
                    ord.sheet_no     = r.Read("sheet_no");
                    ord.voucher_no   = r.Read("voucher_no");
                    ord.branch_no    = r.Read("branch_no");
                    ord.cust_no      = r.Read("cust_no");
                    ord.pay_way      = r.Read("pay_way");
                    ord.discount     = Helper.Conv.ToDecimal(r.Read("discount"));
                    ord.coin_no      = r.Read("coin_no");
                    ord.real_amount  = Helper.Conv.ToDecimal(r.Read("real_amount"));
                    ord.total_amount = Helper.Conv.ToDecimal(r.Read("total_amount"));
                    ord.paid_amount  = Helper.Conv.ToDecimal(r.Read("paid_amount"));
                    ord.approve_flag = "0";
                    ord.source_flag  = "";
                    ord.oper_id      = r.Read("oper_id");
                    ord.sale_man     = r.Read("sale_man");
                    ord.oper_date    = Helper.Conv.ToDateTime(r.Read("oper_date"));
                    ord.pay_date     = DateTime.MinValue;
                    ord.other1       = r.Read("other1");
                    ord.other2       = r.Read("other2");
                    ord.other3       = r.Read("other3");
                    ord.cm_branch    = r.Read("cm_branch");
                    ord.approve_man  = "";
                    ord.approve_date = DateTime.MinValue;
                    ord.num1         = Helper.Conv.ToDecimal(r.Read("num1"));
                    ord.num2         = Helper.Conv.ToDecimal(r.Read("num2"));
                    ord.num3         = Helper.Conv.ToDecimal(r.Read("num3"));
                    ord.payfee_memo  = r.Read("payfee_memo");
                    ord.old_no       = "";
                    ord.psheet_no    = r.Read("psheet_no");
                    ord.pay_nowmark  = r.Read("pay_nowmark");
                    ord.if_back      = r.Read("if_back");
                    ord.cust_cls     = "";
                    ord.other4       = r.Read("other4");
                    ord.update_time  = Helper.Conv.ToDateTime(r.Read("update_time"));

                    List <Model.sm_t_salesheet_detail> lines = new List <Model.sm_t_salesheet_detail>();
                    foreach (ReadWriteContext.IReadContext r2 in r.ReadList("lines"))
                    {
                        var item = new Model.sm_t_salesheet_detail();
                        item.sheet_no    = r2.Read("sheet_no");
                        item.item_no     = r2.Read("item_no");
                        item.item_name   = r2.Read("item_name");
                        item.unit_no     = r2.Read("unit_no");
                        item.unit_factor = Helper.Conv.ToDecimal(r2.Read("unit_factor"));
                        item.sale_qnty   = Helper.Conv.ToDecimal(r2.Read("sale_qnty"));
                        item.sale_price  = Helper.Conv.ToDecimal(r2.Read("sale_price"));
                        item.real_price  = Helper.Conv.ToDecimal(r2.Read("real_price"));
                        item.cost_price  = Helper.Conv.ToDecimal(r2.Read("cost_price"));
                        item.sale_money  = Helper.Conv.ToDecimal(r2.Read("sale_money"));
                        item.sale_tax    = Helper.Conv.ToDecimal(r2.Read("sale_tax"));
                        item.is_tax      = r2.Read("is_tax");
                        item.other1      = r2.Read("other1");
                        item.other2      = r2.Read("other2");
                        item.other3      = r2.Read("other3");
                        item.other4      = r2.Read("other4");
                        item.num1        = Helper.Conv.ToDecimal(r2.Read("num1"));
                        item.num2        = Helper.Conv.ToDecimal(r2.Read("num2"));
                        item.num3        = Helper.Conv.ToDecimal(r2.Read("num3"));
                        item.num4        = Helper.Conv.ToDecimal(r2.Read("num4"));
                        item.num5        = Helper.Conv.ToDecimal(r2.Read("num5"));
                        item.num6        = Helper.Conv.ToDecimal(r2.Read("num6"));
                        item.barcode     = r2.Read("barcode");
                        item.sheet_sort  = Helper.Conv.ToInt(r2.Read("sheet_sort"));
                        item.ret_qnty    = Helper.Conv.ToDecimal(r2.Read("ret_qnty"));
                        item.discount    = Helper.Conv.ToDecimal(r2.Read("discount"));
                        item.voucher_no  = r2.Read("voucher_no");
                        item.cost_notax  = Helper.Conv.ToDecimal(r2.Read("cost_notax"));
                        item.packqty     = Helper.Conv.ToInt(r2.Read("packqty"));
                        item.sgqty       = Helper.Conv.ToDecimal(r2.Read("sgqty"));
                        item.branch_no_d = "";
                        item.ly_sup_no   = "";
                        item.ly_rate     = 0M;
                        item.num7        = Helper.Conv.ToDecimal(r2.Read("num7"));
                        item.other5      = r2.Read("other5");
                        item.num8        = Helper.Conv.ToDecimal(r2.Read("num8"));
                        item.produce_day = DateTime.MinValue;
                        lines.Add(item);
                    }
                    bll.ChangeSaleSheet(ord, lines);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "delete_salesheet")
                {
                    string sheet_no    = r.Read("sheet_no");
                    var    update_time = Helper.Conv.ToDateTime(r.Read("update_time"));
                    bll.DeleteSaleSheet(sheet_no, update_time);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "check_salesheet")
                {
                    string sheet_no    = r.Read("sheet_no");
                    string approve_man = r.Read("approve_man");
                    var    update_time = Helper.Conv.ToDateTime(r.Read("update_time"));
                    bll.CheckSaleSheet(sheet_no, approve_man, update_time);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "get_inout_list")
                {
                    string date1      = r.Read("date1");
                    string date2      = r.Read("date2");
                    string supcust_no = r.Read("supcust_no");
                    string trans_no   = r.Read("trans_no");

                    var tb = bll.GetInOutList(date1, date2, supcust_no, trans_no);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("data", tb);

                    res = w.ToString();
                }
                else if (t == "get_simple_inout_list")
                {
                    string date1      = r.Read("date1");
                    string date2      = r.Read("date2");
                    string supcust_no = r.Read("supcust_no");
                    string trans_no   = r.Read("trans_no");

                    var tb = bll.GetSimpleInOutList(date1, date2, supcust_no, trans_no);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("data", tb);

                    res = w.ToString();
                }
                else if (t == "get_other_inout_list")
                {
                    string date1    = r.Read("date1");
                    string date2    = r.Read("date2");
                    string trans_no = r.Read("trans_no");

                    var tb = bll.GetOtherInOutList(date1, date2, trans_no);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("data", tb);

                    res = w.ToString();
                }
                else if (t == "get_inout")
                {
                    string sheet_no = r.Read("sheet_no");
                    string trans_no = r.Read("trans_no");
                    System.Data.DataTable tb1;
                    System.Data.DataTable tb2;
                    bll.GetInOut(sheet_no, trans_no, out tb1, out tb2);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("tb1", tb1);
                    w.Append("tb2", tb2);
                    res = w.ToString();
                }
                else if (t == "get_other_inout")
                {
                    string sheet_no = r.Read("sheet_no");
                    System.Data.DataTable tb1;
                    System.Data.DataTable tb2;
                    bll.GetInOut(sheet_no, out tb1, out tb2);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("tb1", tb1);
                    w.Append("tb2", tb2);
                    res = w.ToString();
                }
                else if (t == "add_inout")
                {
                    var ord = new Model.ic_t_inout_store_master();
                    ord.sheet_no     = r.Read("sheet_no");
                    ord.trans_no     = r.Read("trans_no");
                    ord.branch_no    = r.Read("branch_no");
                    ord.d_branch_no  = r.Read("d_branch_no");
                    ord.voucher_no   = r.Read("voucher_no");
                    ord.supcust_no   = r.Read("supcust_no");
                    ord.total_amount = Helper.Conv.ToDecimal(r.Read("total_amount"));
                    ord.inout_amount = Helper.Conv.ToDecimal(r.Read("inout_amount"));
                    ord.coin_no      = r.Read("coin_no");
                    ord.pay_way      = r.Read("pay_way");
                    ord.tax_amount   = Helper.Conv.ToDecimal(r.Read("tax_amount"));
                    ord.discount     = Helper.Conv.ToDecimal(r.Read("discount"));
                    ord.pay_date     = Helper.Conv.ToDateTime(r.Read("pay_date"));
                    ord.approve_flag = "0";
                    ord.oper_date    = Helper.Conv.ToDateTime(r.Read("oper_date"));
                    ord.oper_id      = r.Read("oper_id");
                    ord.display_flag = "1";
                    ord.other1       = r.Read("other1");
                    ord.other2       = r.Read("other2");
                    ord.other3       = r.Read("other3");
                    ord.cm_branch    = r.Read("cm_branch"); //不确定
                    ord.deal_man     = r.Read("deal_man");
                    ord.old_no       = "";
                    ord.approve_man  = r.Read("approve_man");
                    ord.approve_date = DateTime.MinValue;
                    ord.num1         = Helper.Conv.ToDecimal(r.Read("num1"));
                    ord.num2         = Helper.Conv.ToDecimal(r.Read("num2"));
                    ord.num3         = Helper.Conv.ToDecimal(r.Read("num3"));
                    ord.max_change   = 0m; //不确定
                    ord.sale_no      = r.Read("sale_no");
                    ord.lock_man     = "";
                    ord.lock_date    = DateTime.MinValue;

                    List <Model.ic_t_inout_store_detail> lines = new List <Model.ic_t_inout_store_detail>();
                    foreach (ReadWriteContext.IReadContext r2 in r.ReadList("lines"))
                    {
                        var item = new Model.ic_t_inout_store_detail();
                        item.sheet_no    = r2.Read("sheet_no");
                        item.item_no     = r2.Read("item_no");
                        item.item_name   = r2.Read("item_name");
                        item.unit_no     = r2.Read("unit_no");
                        item.unit_factor = Helper.Conv.ToDecimal(r2.Read("unit_factor"));
                        item.in_qty      = Helper.Conv.ToDecimal(r2.Read("in_qty"));
                        item.orgi_price  = Helper.Conv.ToDecimal(r2.Read("orgi_price"));
                        item.valid_price = Helper.Conv.ToDecimal(r2.Read("valid_price"));
                        item.cost_price  = Helper.Conv.ToDecimal(r2.Read("cost_price"));
                        item.sub_amount  = Helper.Conv.ToDecimal(r2.Read("sub_amount"));
                        item.tax         = Helper.Conv.ToDecimal(r2.Read("tax"));
                        item.is_tax      = r2.Read("is_tax");
                        item.valid_date  = Helper.Conv.ToDateTime(r2.Read("valid_date"));
                        item.other1      = r2.Read("other1");
                        item.other2      = r2.Read("other2");
                        item.other3      = r2.Read("other3");
                        item.num1        = Helper.Conv.ToDecimal(r2.Read("num1"));
                        item.num2        = Helper.Conv.ToDecimal(r2.Read("num2"));
                        item.num3        = Helper.Conv.ToDecimal(r2.Read("num3"));
                        item.num4        = Helper.Conv.ToDecimal(r2.Read("num4"));
                        item.num5        = Helper.Conv.ToDecimal(r2.Read("num5"));
                        item.num6        = Helper.Conv.ToDecimal(r2.Read("num6"));
                        item.barcode     = r2.Read("barcode");
                        item.sheet_sort  = Helper.Conv.ToInt(r2.Read("sheet_sort"));
                        item.ret_qnty    = Helper.Conv.ToDecimal(r2.Read("ret_qnty"));
                        item.discount    = Helper.Conv.ToDecimal(r2.Read("discount"));
                        item.voucher_no  = r2.Read("voucher_no");
                        item.cost_notax  = 0m; //不确定
                        item.packqty     = Helper.Conv.ToInt(r2.Read("packqty"));
                        item.sgqty       = Helper.Conv.ToDecimal(r2.Read("sgqty"));
                        item.branch_no_d = "";
                        item.ly_sup_no   = "";
                        item.ly_rate     = 0m;
                        lines.Add(item);
                    }
                    string sheet_no = "";
                    bll.AddInOut(ord, lines, out sheet_no);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("sheet_no", sheet_no);
                    res = w.ToString();
                }
                else if (t == "change_inout")
                {
                    var ord = new Model.ic_t_inout_store_master();
                    ord.sheet_no     = r.Read("sheet_no");
                    ord.trans_no     = r.Read("trans_no");
                    ord.branch_no    = r.Read("branch_no");
                    ord.d_branch_no  = "";
                    ord.db_no        = r.Read("db_no");
                    ord.voucher_no   = r.Read("voucher_no");
                    ord.supcust_no   = r.Read("supcust_no");
                    ord.total_amount = Helper.Conv.ToDecimal(r.Read("total_amount"));
                    ord.inout_amount = Helper.Conv.ToDecimal(r.Read("inout_amount"));
                    ord.coin_no      = "RMB";
                    ord.pay_way      = r.Read("pay_way");
                    ord.tax_amount   = Helper.Conv.ToDecimal(r.Read("tax_amount"));
                    ord.discount     = Helper.Conv.ToDecimal(r.Read("discount"));
                    ord.pay_date     = Helper.Conv.ToDateTime(r.Read("pay_date"));
                    ord.approve_flag = "0";
                    ord.oper_date    = Helper.Conv.ToDateTime(r.Read("oper_date"));
                    ord.oper_id      = r.Read("oper_id");
                    ord.display_flag = "1";
                    ord.other1       = r.Read("other1");
                    ord.other2       = r.Read("other2");
                    ord.other3       = r.Read("other3");
                    ord.cm_branch    = r.Read("cm_branch"); //不确定
                    ord.deal_man     = r.Read("deal_man");
                    ord.old_no       = "";
                    ord.approve_man  = r.Read("approve_man");
                    ord.approve_date = DateTime.MinValue;
                    ord.num1         = Helper.Conv.ToDecimal(r.Read("num1"));
                    ord.num2         = Helper.Conv.ToDecimal(r.Read("num2"));
                    ord.num3         = Helper.Conv.ToDecimal(r.Read("num3"));
                    ord.max_change   = 0m; //不确定
                    ord.sale_no      = r.Read("sale_no");
                    ord.lock_man     = "";
                    ord.lock_date    = DateTime.MinValue;
                    ord.update_time  = Helper.Conv.ToDateTime(r.Read("update_time"));

                    List <Model.ic_t_inout_store_detail> lines = new List <Model.ic_t_inout_store_detail>();
                    foreach (ReadWriteContext.IReadContext r2 in r.ReadList("lines"))
                    {
                        var item = new Model.ic_t_inout_store_detail();
                        item.sheet_no    = r2.Read("sheet_no");
                        item.item_no     = r2.Read("item_no");
                        item.item_name   = r2.Read("item_name");
                        item.unit_no     = r2.Read("unit_no");
                        item.unit_factor = Helper.Conv.ToDecimal(r2.Read("unit_factor"));
                        item.in_qty      = Helper.Conv.ToDecimal(r2.Read("in_qty"));
                        item.orgi_price  = Helper.Conv.ToDecimal(r2.Read("orgi_price"));
                        item.valid_price = Helper.Conv.ToDecimal(r2.Read("valid_price"));
                        item.cost_price  = Helper.Conv.ToDecimal(r2.Read("cost_price"));
                        item.sub_amount  = Helper.Conv.ToDecimal(r2.Read("sub_amount"));
                        item.tax         = Helper.Conv.ToDecimal(r2.Read("tax"));
                        item.is_tax      = r2.Read("is_tax");
                        item.valid_date  = Helper.Conv.ToDateTime(r2.Read("valid_date"));
                        item.other1      = r2.Read("other1");
                        item.other2      = r2.Read("other2");
                        item.other3      = r2.Read("other3");
                        item.num1        = Helper.Conv.ToDecimal(r2.Read("num1"));
                        item.num2        = Helper.Conv.ToDecimal(r2.Read("num2"));
                        item.num3        = Helper.Conv.ToDecimal(r2.Read("num3"));
                        item.num4        = Helper.Conv.ToDecimal(r2.Read("num4"));
                        item.num5        = Helper.Conv.ToDecimal(r2.Read("num5"));
                        item.num6        = Helper.Conv.ToDecimal(r2.Read("num6"));
                        item.barcode     = r2.Read("barcode");
                        item.sheet_sort  = Helper.Conv.ToInt(r2.Read("sheet_sort"));
                        item.ret_qnty    = Helper.Conv.ToDecimal(r2.Read("ret_qnty"));
                        item.discount    = Helper.Conv.ToDecimal(r2.Read("discount"));
                        item.voucher_no  = r2.Read("voucher_no");
                        item.cost_notax  = 0m; //不确定
                        item.packqty     = Helper.Conv.ToInt(r2.Read("packqty"));
                        item.sgqty       = Helper.Conv.ToDecimal(r2.Read("sgqty"));
                        item.branch_no_d = "";
                        item.ly_sup_no   = "";
                        item.ly_rate     = 0m;
                        lines.Add(item);
                    }
                    bll.ChangeInOut(ord, lines);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "delete_inout")
                {
                    string sheet_no    = r.Read("sheet_no");
                    var    update_time = Helper.Conv.ToDateTime(r.Read("update_time"));
                    bll.DeleteInOut(sheet_no, update_time);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "check_inout")
                {
                    string sheet_no    = r.Read("sheet_no");
                    string approve_man = r.Read("approve_man");
                    var    update_time = Helper.Conv.ToDateTime(r.Read("update_time"));
                    bll.CheckInOut(sheet_no, approve_man, update_time);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else
                {
                    throw new Exception("未找到方法[" + t + "]");
                }
            }
            catch (Exception ex)
            {
                ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                w.Append("errId", "-1");
                w.Append("errMsg", ex.Message);
                LogHelper.writeLog("inout()", ex.ToString(), t, pars);
                res = w.ToString();
            }
        }
Beispiel #25
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;
            }
        }
Beispiel #26
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;
            }
        }
Beispiel #27
0
        private void SaveSheet()
        {
            if (curr_cust == null || string.IsNullOrEmpty(curr_cust.supcust_no))
            {
                MsgForm.ShowFrom("请选择客户!");
                return;
            }
            if (sale_detail.Rows.Count < 1)
            {
                MsgForm.ShowFrom("请输入明细!");
                return;
            }

            co_t_order_main         ord   = new co_t_order_main();
            List <co_t_order_child> lines = new List <co_t_order_child>();

            ord.sheet_no     = "";
            ord.trans_no     = "S";
            ord.order_status = "0";
            ord.sale_way     = "A";
            ord.coin_code    = "RMB";
            ord.branch_no    = sale_master.branch_no;
            ord.p_sheet_no   = "";
            ord.sup_no       = sale_master.sup_no;
            ord.paid_amount  = 0;
            ord.oper_date    = sale_master.oper_date;
            ord.oper_id      = Program.oper.oper_id;
            ord.order_man    = "00";
            ord.approve_flag = "0";
            ord.other1       = "";
            ord.other2       = "";
            ord.cm_branch    = "00";
            ord.approve_man  = "";
            ord.approve_date = System.DateTime.MinValue;
            ord.num1         = 0;
            ord.num2         = 0;
            ord.num3         = 0;
            ord.valid_date   = sale_master.oper_date.AddMonths(1);
            ord.memo         = sale_master.memo;

            int     index     = 0;
            decimal total_amt = 0;

            foreach (DataRow row in sale_detail.Rows)
            {
                ++index;
                if (row["item_no"].ToString() != "")
                {
                    co_t_order_child line = new co_t_order_child();
                    lines.Add(line);
                    line.sheet_no    = ord.sheet_no;
                    line.item_no     = row["item_no"].ToString();
                    line.unit_no     = row["unit_no"].ToString();
                    line.barcode     = row["barcode"].ToString();
                    line.unit_factor = 1;
                    line.order_qnty  = Helper.Conv.ToDecimal(row["order_qnty"].ToString());
                    line.in_price    = Helper.Conv.ToDecimal(row["in_price"].ToString());
                    line.real_qty    = 0;
                    line.sub_amount  = Helper.Conv.ToDecimal(row["sub_amount"].ToString());
                    line.sheet_sort  = index;
                    line.discount    = 1;
                    line.other1      = row["other1"].ToString();
                    line.other2      = "";
                    line.other3      = "0";
                    line.voucher_no  = "";
                    line.sheet_sort  = index;
                    line.num1        = 0;
                    line.num2        = 0;
                    line.num3        = 0;
                    line.packqty     = 0;
                    line.sgqty       = 0;

                    total_amt += line.in_price * line.order_qnty;
                }
            }
            ord.total_amount = total_amt;
            ord.paid_amount  = 0;

            string sheet_no;

            IBLL.IInOutBLL bll = new BLL.InOutBLL();
            bll.AddSaleSSSheet(ord, lines, out sheet_no);

            NewSheet();
        }
Beispiel #28
0
        public frmCGInSheet()
        {
            InitializeComponent();
            //
            Helper.GlobalData.InitForm(this);
            //
            var tb = new DataTable();

            tb.Columns.Add("item_no");
            tb.Columns.Add("item_subno");
            tb.Columns.Add("barcode");
            tb.Columns.Add("item_name");
            tb.Columns.Add("unit_no");
            tb.Columns.Add("item_size");
            tb.Columns.Add("other3");
            tb.Columns.Add("in_qty", typeof(decimal));
            tb.Columns.Add("valid_price", typeof(decimal));
            tb.Columns.Add("discount", typeof(decimal));
            tb.Columns.Add("sub_amount", typeof(decimal));
            tb.Columns.Add("other1");
            tb.Columns.Add("valid_date", typeof(DateTime));
            tb.Columns.Add("price", typeof(decimal));//参考进价

            editGrid1.AddColumn("item_subno", "货号", "", 100, 1, "", true);
            editGrid1.AddColumn("item_name", "商品名称", "", 150, 1, "", false);
            editGrid1.AddColumn("unit_no", "单位", "", 60, 2, "", false);
            editGrid1.AddColumn("item_size", "规格", "", 80, 1, "", false);
            editGrid1.AddColumn("in_qty", "数量", "", 100, 3, "0.00", true);
            editGrid1.AddColumn("valid_price", "单价", "", 100, 3, "0.00", true);
            editGrid1.AddColumn("discount", "折扣", "", 100, 3, "0.00", true);
            editGrid1.AddColumn("sub_amount", "金额", "", 100, 3, "0.00", false);
            editGrid1.AddColumn("other1", "备注", "", 150, 1, "", true);
            editGrid1.AddColumn("valid_date", "有效期", "", 100, 1, "yyyy-MM-dd", true);
            editGrid1.AddColumn("price", "参考进价", "", 100, 3, "0.00", false);
            editGrid1.SetTotalColumn("in_qty,sub_amount");//合计项
            editGrid1.DataSource = tb;
            editGrid1.IsShowIco  = true;
            //
            try
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                //

                Thread th = new Thread(() =>
                {
                    Helper.GlobalData.windows.ShowLoad(this);
                    try
                    {
                        IBLL.ICommonBLL bll2 = new BLL.CommonBLL();
                        var branch_tb        = bll2.GetBranchList();
                        this.txtbranch.Invoke((MethodInvoker) delegate
                        {
                            txtbranch.Bind(branch_tb, 300, 200, "branch_no", "branch_no:编号:80,branch_name:名称:140", "branch_no/branch_name->Text");
                        });
                        DataTable dt2 = new DataTable();
                        dt2.Columns.Add("sale_no");
                        dt2.Columns.Add("sale_name");
                        dt2.Rows.Add("A", "购销");
                        dt2.Rows.Add("B", "代销");
                        dt2.Rows.Add("C", "联营");
                        dt2.Rows.Add("E", "联营进货");
                        dt2.Rows.Add("Z", "租赁");

                        this.txt_sale_no.Invoke((MethodInvoker) delegate
                        {
                            txt_sale_no.Bind(dt2, 250, 200, "sale_no", "sale_no:编码:80,sale_name:代销方式:100", "sale_no/sale_name->Text");
                        });
                        var sup_tb = bll2.GetAllSupList();
                        this.txt_sup.Invoke((MethodInvoker) delegate
                        {
                            txt_sup.Bind(sup_tb, 350, 200, "supcust_no", "supcust_no:编号:80,sup_name:名称:200", "supcust_no/sup_name->Text");
                        });
                        var deal_tb = bll2.GetPeopleList();
                        this.txt_deal_man.Invoke((MethodInvoker) delegate
                        {
                            txt_deal_man.Bind(deal_tb, 250, 200, "oper_id", "oper_id:编号:80,oper_name:姓名:100", "oper_id/oper_name->Text");
                        });

                        IBLL.IInOutBLL bll3 = new BLL.InOutBLL();
                        var order           = bll3.GetImportCGOrder();
                        this.txt_voucher_no.Invoke((MethodInvoker) delegate
                        {
                            this.txt_voucher_no.Bind(order, 350, 200, "sheet_no", "sheet_no:单据号:110,supcust:供应商:100,branch:仓库:100,oper_date:日期:150", "sheet_no->Text");
                        });

                        this.Invoke((MethodInvoker) delegate
                        {
                            IOrder ins = this;
                            ins.Add();
                        });
                    }
                    catch (Exception ex)
                    {
                        LogHelper.writeLog("frmCGInSheet", ex.ToString());
                        MsgForm.ShowFrom(ex);
                    }
                    Helper.GlobalData.windows.CloseLoad(this);
                });
                th.Start();
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
                Helper.LogHelper.writeLog("frmCGInSheet()", ex.ToString());
            }
            finally
            {
                System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
            }
        }