using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SysCore.Control;

public partial class Component_FastSearch_FastSearch_Inventory : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        FastSearh fs = new FastSearh();
        InventoryDAL dal = new InventoryDAL();
        string keyword = Request.QueryString["searchTerm"];
        string where = "";
        //只显示销售属性的存货
        if (Request["is_sale"].Equals("1"))
        {
            where += " and isnull(is_sale,0)=1";
        }
        //只显示采购属性的存货
        if (Request["is_purchase"].Equals("1"))
        {
            where += " and isnull(is_purchase,0)=1";
        }
        if (Request["order_can_see_cus_inv_sale"].Equals("1"))
        {
            //只显示客户指定产品的存货时
            if (!Request["flag_cus_id"].Equals("") && !Request["flag_cus_id"].Equals("0"))
            {
                where += " and i.i_id in (select i_id from Base_CusInv where cus_id=" + Request["flag_cus_id"] + ")";
            }
        }
        String s = fs.CreateSearchJSON(dal.GetList_FastSearch(keyword, where));
        Response.Write(s);
    }
}