Beispiel #1
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.ISupSettle bll      = new BLL.SupSettle();
             bll.Check(sheet_no, Program.oper.oper_id);
             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);
     }
 }
        private void tsbCheck_Click(object sender, EventArgs e)
        {
            try
            {
                if (!MyLove.PermissionsBalidation(this.Text, "05"))
                {
                    return;
                }

                if (txtsheet_no.Text.Trim() != "")
                {
                    string          sheet_no = txtsheet_no.Text.Trim();
                    IBLL.ISupSettle bll      = new BLL.SupSettle();
                    bll.Check(sheet_no, Program.oper.oper_id);
                    IOrder ins = this;
                    ins.ShowOrder(sheet_no);
                }
            }
            catch (Exception ex)
            {
                MsgForm.ShowFrom(ex);
            }
        }
        void IServiceBase.Request(string t, string pars, out string res)
        {
            try
            {
                ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars);
                var             kv  = r.ToDictionary();
                IBLL.ISupSettle bll = new BLL.SupSettle();
                if (t == "get_list")
                {
                    DateTime date1  = Helper.Conv.ToDateTime(r.Read("date1"));
                    DateTime date2  = Helper.Conv.ToDateTime(r.Read("date2"));
                    string   sup_no = r.Read("sup_no");
                    var      tb     = bll.GetList(date1, date2, sup_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_order")
                {
                    string sheet_no = r.Read("sheet_no");
                    System.Data.DataTable tb1;
                    System.Data.DataTable tb2;
                    bll.GetOrder(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 == "max_code")
                {
                    string code = bll.MaxCode();
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");
                    w.Append("code", code);
                    res = w.ToString();
                }
                else if (t == "add")
                {
                    Model.rp_t_recpay_record_info ord = new Model.rp_t_recpay_record_info();
                    ord.sheet_no     = r.Read("sheet_no");
                    ord.supcust_no   = r.Read("supcust_no");
                    ord.supcust_flag = "S";
                    ord.flag_post    = "1";
                    ord.total_amount = Helper.Conv.ToDecimal(r.Read("total_amount"));
                    ord.free_money   = Helper.Conv.ToDecimal(r.Read("free_money"));
                    ord.coin_no      = "RMB";
                    ord.coin_rate    = 1;
                    ord.pay_way      = r.Read("pay_way");
                    ord.approve_flag = "0";
                    ord.oper_id      = r.Read("oper_id");
                    ord.oper_date    = Helper.Conv.ToDateTime(r.Read("oper_date"));
                    ord.deal_man     = r.Read("deal_man");
                    ord.approve_man  = "";
                    ord.approve_date = System.DateTime.MinValue;
                    ord.other1       = r.Read("other1");
                    ord.other2       = r.Read("other2");
                    ord.other3       = r.Read("other3");
                    ord.visa_id      = r.Read("visa_id");
                    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.cm_branch    = "00";
                    ord.branch_no    = r.Read("branch_no");
                    ord.from_date    = System.DateTime.MinValue;
                    ord.to_date      = System.DateTime.MinValue;
                    ord.rc_sheet_no  = r.Read("rc_sheet_no");

                    List <Model.rp_t_recpay_record_detail> lines = new List <Model.rp_t_recpay_record_detail>();
                    foreach (ReadWriteContext.IReadContext r2 in r.ReadList("lines"))
                    {
                        Model.rp_t_recpay_record_detail line = new Model.rp_t_recpay_record_detail();
                        lines.Add(line);
                        line.sheet_no       = ord.sheet_no;
                        line.voucher_no     = r2.Read("voucher_no");
                        line.sheet_amount   = Helper.Conv.ToDecimal(r2.Read("sheet_amount"));
                        line.paid_amount    = Helper.Conv.ToDecimal(r2.Read("paid_amount"));
                        line.paid_free      = Helper.Conv.ToDecimal(r2.Read("paid_free"));
                        line.pay_amount     = Helper.Conv.ToDecimal(r2.Read("pay_amount"));
                        line.pay_free       = Helper.Conv.ToDecimal(r2.Read("pay_free"));
                        line.memo           = r2.Read("memo");
                        line.other1         = r2.Read("other1");
                        line.other2         = r2.Read("other2");
                        line.other3         = r2.Read("other3");
                        line.num1           = Helper.Conv.ToDecimal(r2.Read("num1"));
                        line.num2           = Helper.Conv.ToDecimal(r2.Read("num2"));
                        line.num3           = Helper.Conv.ToDecimal(r2.Read("num3"));
                        line.pay_date       = Helper.Conv.ToDateTime(r2.Read("pay_date"));
                        line.item_no        = r2.Read("item_no");
                        line.path           = r2.Read("path");
                        line.select_flag    = r2.Read("select_flag");
                        line.voucher_type   = r2.Read("voucher_type");
                        line.oper_date      = Helper.Conv.ToDateTime(r2.Read("oper_date"));
                        line.voucher_other1 = r2.Read("voucher_other1");
                        line.voucher_other2 = r2.Read("voucher_other2");
                        line.order_no       = r2.Read("order_no");
                    }
                    string sheet_no = "";
                    bll.Add(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")
                {
                    Model.rp_t_recpay_record_info ord = new Model.rp_t_recpay_record_info();
                    ord.sheet_no     = r.Read("sheet_no");
                    ord.supcust_no   = r.Read("supcust_no");
                    ord.supcust_flag = "S";
                    ord.flag_post    = "1";
                    ord.total_amount = Helper.Conv.ToDecimal(r.Read("total_amount"));
                    ord.free_money   = Helper.Conv.ToDecimal(r.Read("free_money"));
                    ord.coin_no      = "RMB";
                    ord.coin_rate    = 1;
                    ord.pay_way      = r.Read("pay_way");
                    ord.approve_flag = "0";
                    ord.oper_id      = r.Read("oper_id");
                    ord.oper_date    = Helper.Conv.ToDateTime(r.Read("oper_date"));
                    ord.deal_man     = r.Read("deal_man");
                    ord.approve_man  = "";
                    ord.approve_date = System.DateTime.MinValue;
                    ord.other1       = r.Read("other1");
                    ord.other2       = r.Read("other2");
                    ord.other3       = r.Read("other3");
                    ord.visa_id      = r.Read("visa_id");
                    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.cm_branch    = "00";
                    ord.branch_no    = r.Read("branch_no");
                    ord.from_date    = System.DateTime.MinValue;
                    ord.to_date      = System.DateTime.MinValue;
                    ord.rc_sheet_no  = r.Read("rc_sheet_no");

                    List <Model.rp_t_recpay_record_detail> lines = new List <Model.rp_t_recpay_record_detail>();
                    foreach (ReadWriteContext.IReadContext r2 in r.ReadList("lines"))
                    {
                        Model.rp_t_recpay_record_detail line = new Model.rp_t_recpay_record_detail();
                        lines.Add(line);
                        line.sheet_no       = ord.sheet_no;
                        line.voucher_no     = r2.Read("voucher_no");
                        line.sheet_amount   = Helper.Conv.ToDecimal(r2.Read("sheet_amount"));
                        line.paid_amount    = Helper.Conv.ToDecimal(r2.Read("paid_amount"));
                        line.paid_free      = Helper.Conv.ToDecimal(r2.Read("paid_free"));
                        line.pay_amount     = Helper.Conv.ToDecimal(r2.Read("pay_amount"));
                        line.pay_free       = Helper.Conv.ToDecimal(r2.Read("pay_free"));
                        line.memo           = r2.Read("memo");
                        line.other1         = r2.Read("other1");
                        line.other2         = r2.Read("other2");
                        line.other3         = r2.Read("other3");
                        line.num1           = Helper.Conv.ToDecimal(r2.Read("num1"));
                        line.num2           = Helper.Conv.ToDecimal(r2.Read("num2"));
                        line.num3           = Helper.Conv.ToDecimal(r2.Read("num3"));
                        line.pay_date       = Helper.Conv.ToDateTime(r2.Read("pay_date"));
                        line.item_no        = r2.Read("item_no");
                        line.path           = r2.Read("path");
                        line.select_flag    = r2.Read("select_flag");
                        line.voucher_type   = r2.Read("voucher_type");
                        line.oper_date      = Helper.Conv.ToDateTime(r2.Read("oper_date"));
                        line.voucher_other1 = r2.Read("voucher_other1");
                        line.voucher_other2 = r2.Read("voucher_other2");
                        line.order_no       = r2.Read("order_no");
                    }
                    bll.Change(ord, lines);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "delete")
                {
                    string sheet_no = r.Read("sheet_no");
                    bll.Delete(sheet_no);
                    ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
                    w.Append("errId", "0");
                    w.Append("errMsg", "");

                    res = w.ToString();
                }
                else if (t == "check")
                {
                    string sheet_no    = r.Read("sheet_no");
                    string approve_man = r.Read("approve_man");
                    bll.Check(sheet_no, approve_man);
                    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("", ex.ToString());
                res = w.ToString();
            }
        }