示例#1
0
        private void LoadData(string sup_id)
        {
            IBLL.IPriceBLL bll = new BLL.PriceBLL();
            tb = bll.GetSupPriceList(sup_id);

            this.dgv_main.DataSource = tb;
        }
示例#2
0
        DataTable IItem.GetLikeItem(string sup_id, int sup_type, string item_subno, string type)
        {
            DB.IDB db  = new DB.DBByAutoClose(Appsetting.conn);
            string sql = @"select   *,0.00 valid_price from bi_t_item_info where 1=1 ";

            if (!string.IsNullOrEmpty(item_subno))
            {
                sql += " and ( item_subno like '%" + item_subno + "%' or item_no like '%" + item_subno + "%'   or barcode like '%" + item_subno + "%' )";
            }

            DataTable tb = db.ExecuteToTable(sql, null);

            IBLL.IPriceBLL bll = new BLL.PriceBLL();

            foreach (DataRow dr in tb.Rows)
            {
                if (sup_type == 0)
                {
                    dr["valid_price"] = bll.GetCusItemPrice(sup_id, dr["item_no"].ToString(), type);
                }
                else if (sup_type == 1)
                {
                    dr["valid_price"] = bll.GetSupItemPrice(sup_id, dr["item_no"].ToString(), type);
                }
                else
                {
                    dr["valid_price"] = bll.GetLastInPrice(dr["item_no"].ToString());
                }
            }

            return(tb);
        }
示例#3
0
        private void LoadData(string cust_id)
        {
            IBLL.IPriceBLL bll = new BLL.PriceBLL();
            tb = bll.GetCustPriceList(cust_id);

            this.dgv_main.DataSource = tb;
        }
        public void SelectRow(DataRow row, string condition = "")
        {
            frmSelect frm = new frmSelect();

            frm.dgv.AddColumn("选择", "选择", "", 40, 2, "{0:,1:√}");
            frm.dgv.AddColumn("item_subno", "货号", "", 110, 1, "");
            frm.dgv.AddColumn("barcode", "条码", "", 110, 1, "");
            frm.dgv.AddColumn("item_name", "商品名称", "", 160, 1, "");
            frm.dgv.AddColumn("item_subname", "拼音码", "", 90, 1, "");
            frm.dgv.AddColumn("unit_no", "单位", "", 60, 1, "");
            frm.dgv.AddColumn("item_size", "规格", "", 60, 1, "");
            frm.dgv.AddColumn("price", "价格", "", 100, 3, "0.00");
            frm.dgv.AddColumn("product_area", "产地", "", 150, 1, "");

            frm.Text      = "选择商品";
            frm.condition = condition;

            IBLL.IPriceBLL pricebll = new BLL.PriceBLL();
            var            sup_id   = this.txt_cust.Text.Trim().Split('/')[0];

            List <DataRow> lis = frm.SelectDataRow("货号:", "item_subno");

            int index = 0;

            for (int i = 0; i < this.editGrid1.DataSource.Rows.Count; i++)
            {
                if (this.editGrid1.DataSource.Rows[i] == row)
                {
                    index = i;
                }
            }
            if (lis.Count > 1)
            {
                for (int i = 0; i < lis.Count - 1; i++)
                {
                    this.editGrid1.DataSource.Rows.InsertAt(this.editGrid1.DataSource.NewRow(), index);
                }
            }

            foreach (DataRow dr in lis)
            {
                var dgv_tb = this.editGrid1.DataSource.Copy();
                dgv_tb.ImportRow(dr);
                var dgv_dr = dgv_tb.Rows[dgv_tb.Rows.Count - 1];

                dgv_dr["valid_price"] = pricebll.GetCustItemPrice(sup_id, dr["item_no"].ToString(), "0");
                dgv_dr["sub_amount"]  = Helper.Conv.ToDecimal(dgv_dr["in_qty"]) * Helper.Conv.ToDecimal(dgv_dr["valid_price"]);

                Conv.CopyDataRow(this.editGrid1.DataSource, index, dgv_dr);
                index++;
            }

            if (!string.IsNullOrEmpty(this.editGrid1.DataSource.Rows[this.editGrid1.DataSource.Rows.Count - 1]["item_subno"].ToString()))
            {
                this.editGrid1.DataSource.Rows.Add();
            }

            this.editGrid1.Editing = false;
            this.editGrid1.Refresh();
        }
        private void editGrid1_CellEndEdit(object sender, string column_name, DataRow row)
        {
            if (isSelect)
            {
                return;
            }
            if (column_name == "item_subno")
            {
                if (string.IsNullOrEmpty(row[column_name].ToString()))
                {
                    return;
                }

                IBLL.IPriceBLL pricebll = new BLL.PriceBLL();
                IBLL.IItem     itembll  = new BLL.ItemBLL();
                var            sup_id   = this.txt_cust.Text.Trim().Split('/')[0];
                DataTable      tb       = itembll.GetLikeItem(sup_id, 0, row["item_subno"].ToString(), "0");
                if (tb.Rows.Count > 1)
                {
                    SelectRow(row, row["item_subno"].ToString());
                }
                else
                {
                    foreach (DataRow dr in tb.Rows)
                    {
                        int index = 0;
                        for (int i = 0; i < this.editGrid1.DataSource.Rows.Count; i++)
                        {
                            if (this.editGrid1.DataSource.Rows[i] == row)
                            {
                                index = i;
                            }
                        }
                        var dgv_tb = this.editGrid1.DataSource.Copy();
                        dgv_tb.ImportRow(dr);
                        var dgv_dr = dgv_tb.Rows[dgv_tb.Rows.Count - 1];

                        dgv_dr["valid_price"] = pricebll.GetCustItemPrice(sup_id, row["item_no"].ToString(), "0");
                        dgv_dr["sub_amount"]  = Helper.Conv.ToDecimal(row["in_qty"]) * Helper.Conv.ToDecimal(row["valid_price"]);

                        Conv.CopyDataRow(this.editGrid1.DataSource, index, dgv_dr);
                        break;
                    }
                    if (tb.Rows.Count < 1)
                    {
                        row[column_name] = "";
                    }
                }
                if (!string.IsNullOrEmpty(this.editGrid1.DataSource.Rows[this.editGrid1.DataSource.Rows.Count - 1]["item_subno"].ToString()))
                {
                    this.editGrid1.DataSource.Rows.Add();
                }
            }
            else if (column_name == "in_qty" || column_name == "valid_price")
            {
                row["sub_amount"] = Helper.Conv.ToDecimal(row["in_qty"]) * Helper.Conv.ToDecimal(row["valid_price"]);
                editGrid1.Refresh();
            }
        }
        private void editGrid1_CellEndEdit(object sender, string column_name, DataRow row)
        {
            if (isSelect)
            {
                return;
            }
            if (column_name == "item_subno")
            {
                if (string.IsNullOrEmpty(row[column_name].ToString()))
                {
                    return;
                }

                IBLL.IPriceBLL pricebll = new BLL.PriceBLL();
                IBLL.IItem     itembll  = new BLL.ItemBLL();
                DataTable      tb       = itembll.GetLikeItem("", 3, row["item_subno"].ToString(), "0");
                if (tb.Rows.Count > 1)
                {
                    SelectRow(row, row["item_subno"].ToString());
                }
                else
                {
                    foreach (DataRow dr in tb.Rows)
                    {
                        int index = 0;
                        for (int i = 0; i < this.editGrid1.DataSource.Rows.Count; i++)
                        {
                            if (this.editGrid1.DataSource.Rows[i] == row)
                            {
                                index = i;
                            }
                        }
                        var dgv_tb = this.editGrid1.DataSource.Copy();
                        dgv_tb.ImportRow(dr);
                        var dgv_dr = dgv_tb.Rows[dgv_tb.Rows.Count - 1];

                        dgv_dr["old_price"]  = dr["base_price"];
                        dgv_dr["old_price2"] = dr["base_price2"];
                        dgv_dr["old_price3"] = dr["base_price3"];

                        Conv.CopyDataRow(this.editGrid1.DataSource, index, dgv_dr);
                        break;
                    }
                    if (tb.Rows.Count < 1)
                    {
                        row[column_name] = "";
                    }
                }
                if (!string.IsNullOrEmpty(this.editGrid1.DataSource.Rows[this.editGrid1.DataSource.Rows.Count - 1]["item_subno"].ToString()))
                {
                    this.editGrid1.DataSource.Rows.Add();
                }
            }
        }
示例#7
0
        private void editGrid1_CellEndEdit(object sender, string column_name, DataRow row)
        {
            if (isSelect)
            {
                return;
            }

            if (column_name == "item_subno")
            {
                if (string.IsNullOrEmpty(row[column_name].ToString()))
                {
                    return;
                }

                IBLL.IPriceBLL pricebll = new BLL.PriceBLL();
                IBLL.IItem     itembll  = new BLL.ItemBLL();
                var            sup_id   = txt_sup.Text.Trim().Split('/')[0];
                DataTable      tb       = itembll.GetLikeItem(sup_id, 1, row["item_subno"].ToString(), "0");

                if (tb.Rows.Count > 1)
                {
                    SelectRow(row, row["item_subno"].ToString());
                }
                else
                {
                    foreach (DataRow dr in tb.Rows)
                    {
                        Conv.CopyDataRow(row, dr);
                        row["discount"]   = "1";
                        row["in_price"]   = pricebll.GetSupItemPrice(sup_id, dr["item_no"].ToString(), "0");
                        row["sub_amount"] = Helper.Conv.ToDecimal(row["order_qnty"]) * Helper.Conv.ToDecimal(row["in_price"]) * Helper.Conv.ToDecimal(row["discount"]);
                        break;
                    }
                    if (tb.Rows.Count < 1)
                    {
                        row[column_name] = "";
                    }
                }

                if (!string.IsNullOrEmpty(this.editGrid1.DataSource.Rows[this.editGrid1.DataSource.Rows.Count - 1]["item_subno"].ToString()))
                {
                    this.editGrid1.DataSource.Rows.Add();
                }
            }
            else if (column_name == "in_price" || column_name == "order_qnty" || column_name == "discount")
            {
                row["sub_amount"] = Helper.Conv.ToDecimal(row["order_qnty"]) * Helper.Conv.ToDecimal(row["in_price"]) * Helper.Conv.ToDecimal(row["discount"]);
                editGrid1.Refresh();
            }
        }
示例#8
0
 void IServiceBase.Request(string t, string pars, out string res)
 {
     try
     {
         ReadWriteContext.IReadContext r = new ReadWriteContext.ReadContextByJson(pars);
         var            kv  = r.ToDictionary();
         IBLL.IPriceBLL bll = new BLL.PriceBLL();
         if (t == "get_cust_price_list")
         {
             string cust_id = r.Read("cust_id");
             var    tb      = bll.GetCustPriceList(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_sup_price_list")
         {
             string sup_id = r.Read("sup_id");
             var    tb     = bll.GetSupPriceList(sup_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_cust_item_price")
         {
             string  cust_id = r.Read("cust_id");
             string  item_no = r.Read("item_no");
             string  type    = r.Read("type");
             decimal price   = bll.GetCusItemPrice(cust_id, item_no, type);
             ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
             w.Append("errId", "0");
             w.Append("errMsg", "");
             w.Append("price", price.ToString());
             res = w.ToString();
         }
         else if (t == "get_sup_item_price")
         {
             string  sup_id  = r.Read("sup_id");
             string  item_no = r.Read("item_no");
             string  type    = r.Read("type");
             decimal price   = bll.GetSupItemPrice(sup_id, item_no, type);
             ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
             w.Append("errId", "0");
             w.Append("errMsg", "");
             w.Append("price", price.ToString());
             res = w.ToString();
         }
         else if (t == "get_last_in_price")
         {
             string  item_no = r.Read("item_no");
             decimal price   = bll.GetLastInPrice(item_no);
             ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
             w.Append("errId", "0");
             w.Append("errMsg", "");
             w.Append("price", price.ToString());
             res = w.ToString();
         }
         else
         {
             throw new Exception("接口不存在[" + t + "]");
         }
     }
     catch (Exception ex)
     {
         LogHelper.writeLog("price()", ex.ToString(), t, pars);
         ReadWriteContext.IWriteContext w = new ReadWriteContext.WriteContextByJson();
         w.Append("errId", "-1");
         w.Append("errMsg", ex.Message);
         res = w.ToString();
     }
 }