Beispiel #1
0
        public void AssAddCG(WebHelper w, Dictionary <string, object> kv)
        {
            Model.ic_t_inout_store_master ord = w.GetObject <Model.ic_t_inout_store_master>();
            ord.approve_flag = "0";
            ord.display_flag = "1";
            ord.old_no       = "";
            ord.approve_date = DateTime.MinValue;
            ord.max_change   = 0m; //不确定
            ord.lock_man     = "";
            ord.lock_date    = DateTime.MinValue;

            List <Model.ic_t_inout_store_detail> lines = w.GetList <Model.ic_t_inout_store_detail>("lines");

            foreach (var item in lines)
            {
                item.cost_notax  = 0m; //不确定
                item.branch_no_d = "";
                item.ly_sup_no   = "";
                item.ly_rate     = 0m;
            }
            string sheet_no = "";

            bll.AssAddCG(ord, lines, out sheet_no);

            w.Write("sheet_no", sheet_no);
        }
Beispiel #2
0
        void IInOutBLL.ChangeInOut(Model.ic_t_inout_store_master ord, List <Model.ic_t_inout_store_detail> lines)
        {
            var db = new DB.DBByHandClose(Appsetting.conn);

            DB.IDB d = db;
            try
            {
                db.Open();
                db.BeginTran();
                //
                string sql = "select approve_flag,update_time from ic_t_inout_store_master where sheet_no='" + ord.sheet_no + "'";
                var    tb  = d.ExecuteToTable(sql, null);
                if (tb.Rows.Count == 0)
                {
                    throw new Exception("单据不存在[" + ord.sheet_no + "]");
                }
                else
                {
                    var row = tb.Rows[0];
                    if (row["approve_flag"].ToString() == "1")
                    {
                        throw new Exception("单据已审核[" + ord.sheet_no + "]");
                    }
                    if (Helper.Conv.ToDateTime(row["update_time"]).ToString("yyyy-MM-dd HH:mm:ss") != ord.update_time.ToString("yyyy-MM-dd HH:mm:ss"))
                    {
                        throw new Exception("单据已被他人修改[" + ord.sheet_no + "]");
                    }
                }
                sql = "delete from ic_t_inout_store_detail where sheet_no='" + ord.sheet_no + "'";
                d.ExecuteScalar(sql, null);
                sql = "delete from ic_t_inout_store_master where sheet_no='" + ord.sheet_no + "'";
                d.ExecuteScalar(sql, null);
                //
                ord.update_time = DateTime.Now;
                d.Insert(ord);
                foreach (Model.ic_t_inout_store_detail line in lines)
                {
                    sql          = "select isnull(max(flow_id),0) + 1 as flow_id from ic_t_inout_store_detail ";
                    line.flow_id = Helper.Conv.ToInt64(d.ExecuteScalar(sql, null));
                    d.Insert(line);
                }
                //
                db.CommitTran();
            }
            catch (Exception ex)
            {
                LogHelper.writeLog("InOutBLL.ChangeInOut()", ex.ToString(), ord.sheet_no);
                db.RollBackTran();
                throw ex;
            }
            finally
            {
                db.Close();
            }
        }
        private void insertTHRK(string pay_way, decimal pay_amt)
        {
            var gd = new Model.bi_t_item_info();

            decimal amt = 0; //单据总金额

            IBLL.ICGRK bll        = new BLL.CGRK();
            var        lines_cgrk = new List <Model.ic_t_inout_store_detail>();
            int        index      = 0;

            foreach (var item in this.lines)
            {
                if (goodsDic.TryGetValue(item.item_no, out gd) == false)
                {
                    new MsgForm("商品读取错误").ShowDialog();
                    return;
                }
                ++index;
                var line_cgrk = new Model.ic_t_inout_store_detail();
                line_cgrk.sheet_no    = lblsheet_no.Text.Trim();
                line_cgrk.item_no     = item.item_no;
                line_cgrk.item_subno  = item.item_subno;
                line_cgrk.item_name   = item.item_name;
                line_cgrk.unit_no     = gd.unit_no;
                line_cgrk.in_qty      = item.qty;
                line_cgrk.orgi_price  = item.source_price;
                line_cgrk.valid_price = item.price;
                line_cgrk.cost_price  = item.price;
                line_cgrk.valid_date  = DateTime.Now;
                line_cgrk.barcode     = gd.barcode;
                line_cgrk.sheet_sort  = index;
                line_cgrk.other3      = item.is_give;
                amt += line_cgrk.valid_price * line_cgrk.in_qty;
                lines_cgrk.Add(line_cgrk);
            }

            var ord = new Model.ic_t_inout_store_master();

            ord.sheet_no     = lblsheet_no.Text.Trim();
            ord.trans_no     = "D";
            ord.branch_no    = Program.branch_no;
            ord.supcust_no   = supcus_no;
            ord.total_amount = amt;
            ord.inout_amount = pay_amt;
            ord.approve_flag = "0";
            ord.oper_date    = DateTime.Now;
            ord.oper_id      = Program.oper_id;
            ord.pay_way      = pay_way;
            //新建
            bll.InsertOrder(ord, lines_cgrk);
        }
Beispiel #4
0
        void IInOutBLL.AddInOut(Model.ic_t_inout_store_master ord, List <Model.ic_t_inout_store_detail> lines, out string sheet_no)
        {
            sheet_no = "";
            var db = new DB.DBByHandClose(Appsetting.conn);

            DB.IDB d = db;
            try
            {
                db.Open();
                db.BeginTran();
                if (ord.trans_no == "A")
                {
                    sheet_no  = MaxCode(d, "PI");
                    ord.db_no = "+";
                }
                else if (ord.trans_no == "D")
                {
                    sheet_no  = MaxCode(d, "RI");
                    ord.db_no = "+";
                }
                else if (ord.trans_no == "F")
                {
                    sheet_no  = MaxCode(d, "RO");
                    ord.db_no = "-";
                }
                else if (ord.trans_no == "G")
                {
                    sheet_no  = MaxCode(d, "IO");
                    ord.db_no = "";
                }
                else if (ord.trans_no == "01")
                {
                    sheet_no  = MaxCode(d, "OO");
                    ord.db_no = "+";
                }
                else if (ord.trans_no == "03")
                {
                    sheet_no  = MaxCode(d, "OO");
                    ord.db_no = "-";
                }
                else
                {
                    sheet_no  = MaxCode(d, "OO");
                    ord.db_no = "";
                }

                ord.sheet_no    = sheet_no;
                ord.create_time = DateTime.Now;
                ord.update_time = ord.create_time;
                //
                d.Insert(ord);

                foreach (Model.ic_t_inout_store_detail line in lines)
                {
                    string sql = "select isnull(max(flow_id),0) + 1 as flow_id from ic_t_inout_store_detail ";
                    line.flow_id  = Helper.Conv.ToInt64(d.ExecuteScalar(sql, null));
                    line.sheet_no = sheet_no;
                    d.Insert(line);
                }
                //
                db.CommitTran();
            }
            catch (Exception ex)
            {
                LogHelper.writeLog("InOutBLL.AddInOut()", ex.ToString(), ord.sheet_no);
                db.RollBackTran();
                throw ex;
            }
            finally
            {
                db.Close();
            }
        }
Beispiel #5
0
        void IBLL.IInOutBLL.ChangeInOut(Model.ic_t_inout_store_master ord, List <Model.ic_t_inout_store_detail> lines)
        {
            ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
            w.Append("sheet_no", ord.sheet_no);
            w.Append("trans_no", ord.trans_no);
            w.Append("branch_no", ord.branch_no);
            w.Append("voucher_no", ord.voucher_no);
            w.Append("supcust_no", ord.supcust_no);
            w.Append("pay_way", ord.pay_way);
            w.Append("db_no", ord.db_no);
            w.Append("discount", ord.discount.ToString());
            w.Append("coin_no", ord.coin_no);
            w.Append("total_amount", ord.total_amount.ToString());
            w.Append("inout_amount", ord.inout_amount.ToString());
            w.Append("tax_amount", ord.tax_amount.ToString());
            w.Append("oper_id", ord.oper_id);
            w.Append("deal_man", ord.deal_man);
            w.Append("cm_branch", ord.cm_branch);
            w.Append("oper_date", ord.oper_date.ToString("yyyy-MM-dd HH:mm:ss"));
            w.Append("other1", ord.other1);
            w.Append("other2", ord.other2);
            w.Append("other3", ord.other3);
            w.Append("old_no", ord.old_no);
            w.Append("num1", ord.num1.ToString());
            w.Append("num2", ord.num2.ToString());
            w.Append("num3", ord.num3.ToString());
            w.Append("sale_no", ord.sale_no);
            w.Append("update_time", ord.update_time.ToString("yyyy-MM-dd HH:mm:ss"));

            var tb = new DataTable();

            tb.Columns.Add("sheet_no");
            tb.Columns.Add("item_no");
            tb.Columns.Add("item_name");
            tb.Columns.Add("unit_no");
            tb.Columns.Add("unit_factor", typeof(decimal));
            tb.Columns.Add("in_qty", typeof(decimal));
            tb.Columns.Add("orgi_price", typeof(decimal));
            tb.Columns.Add("valid_price", typeof(decimal));
            tb.Columns.Add("cost_price", typeof(decimal));
            tb.Columns.Add("sub_amount", typeof(decimal));
            tb.Columns.Add("tax", typeof(decimal));
            tb.Columns.Add("is_tax");
            tb.Columns.Add("valid_date", typeof(DateTime));
            tb.Columns.Add("other1");
            tb.Columns.Add("other2");
            tb.Columns.Add("other3");
            tb.Columns.Add("num1", typeof(decimal));
            tb.Columns.Add("num2", typeof(decimal));
            tb.Columns.Add("num3", typeof(decimal));
            tb.Columns.Add("num4", typeof(decimal));
            tb.Columns.Add("num5", typeof(decimal));
            tb.Columns.Add("num6", typeof(decimal));
            tb.Columns.Add("barcode");
            tb.Columns.Add("voucher_no");
            tb.Columns.Add("sheet_sort", typeof(int));
            tb.Columns.Add("ret_qnty", typeof(decimal));
            tb.Columns.Add("discount", typeof(decimal));
            tb.Columns.Add("packqty", typeof(int));
            tb.Columns.Add("sgqty", typeof(decimal));

            foreach (Model.ic_t_inout_store_detail line in lines)
            {
                tb.Rows.Add(line.sheet_no, line.item_no, line.item_name, line.unit_no, line.unit_factor, line.in_qty, line.orgi_price,
                            line.valid_price, line.cost_price, line.sub_amount, line.tax, line.is_tax, line.valid_date, line.other1, line.other2,
                            line.other3, line.num1, line.num2, line.num3, line.num4, line.num5, line.num6,
                            line.barcode, line.voucher_no, line.sheet_sort, line.ret_qnty, line.discount, line.packqty, line.sgqty);
            }
            w.Append("lines", tb);
            Helper.IRequest req  = new Helper.Request();
            var             json = req.request("/inout?t=change_inout", w.ToString());

            ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(json);
            if (r.Read("errId") != "0")
            {
                throw new Exception(r.Read("errMsg"));
            }
        }