Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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();
     }
 }