public ActionResult StockBillList()
        {
            string searchKey = WebUtil.GetFormValue<string>("ProductName", string.Empty);
            string localName = WebUtil.GetFormValue<string>("LocalName", string.Empty);
            string localType = WebUtil.GetFormValue<string>("LocalType", string.Empty);
            int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0);
            int pageSize = WebUtil.GetFormValue<int>("pageSize", 0);
            string storageNum = this.DefaultStore;

            LocalProductProvider provider = new LocalProductProvider();
            LocalProductEntity entity = new LocalProductEntity();

            if (!localType.IsEmpty())
            {
                entity.Where("LocalType", ECondition.Eth, localType);
            }
            if (storageNum.IsNotNull())
            {
                entity.Where("StorageNum", ECondition.Eth, storageNum);
            }
            if (!localName.IsEmpty())
            {
                entity.Where("LocalName", ECondition.Like, "%" + localName + "%");
                entity.Or("LocalNum", ECondition.Like, "%" + localName + "%");
            }
            if (!searchKey.IsEmpty())
            {
                entity.Begin<LocalProductEntity>()
                 .Where<LocalProductEntity>("ProductName", ECondition.Like, "%" + searchKey + "%")
                 .Or<LocalProductEntity>("ProductNum", ECondition.Like, "%" + searchKey + "%")
                 .Or<LocalProductEntity>("BarCode", ECondition.Like, "%" + searchKey + "%")
                 .End<LocalProductEntity>();
            }
            PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize };
            List<LocalProductEntity> listResult = provider.GetList(entity, ref pageInfo);
            int allNum = provider.GetAllNum(localName, localType, searchKey, storageNum);
            double allTotalPrice = provider.GetAllTotalPrice(localName, localType, searchKey, storageNum);
            if (!listResult.IsNullOrEmpty())
            {
                listResult.ForEach(a =>
                {
                    a.TotalPrice = a.Num * a.AvgPrice;
                });
            }
            string json = ConvertJson.ListToJson<LocalProductEntity>(listResult, "List");
            this.ReturnJson.AddProperty("Data", new JsonObject(json));
            this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount);
            this.ReturnJson.AddProperty("AllNum", allNum);
            this.ReturnJson.AddProperty("AllTotalPrice", allTotalPrice);
            return Content(this.ReturnJson.ToString());
        }
        public ActionResult ToStockBilReportExcel()
        {
            string searchKey = WebUtil.GetFormValue<string>("ProductName", string.Empty);
            string localName = WebUtil.GetFormValue<string>("LocalName", string.Empty);
            string localType = WebUtil.GetFormValue<string>("LocalType", string.Empty);
            string storageNum = this.DefaultStore;

            LocalProductProvider provider = new LocalProductProvider();
            LocalProductEntity entity = new LocalProductEntity();
            if (!localType.IsEmpty())
            {
                entity.Where("LocalType", ECondition.Eth, localType);
            }
            if (storageNum.IsNotNull())
            {
                entity.Where("StorageNum", ECondition.Eth, storageNum);
            }
            if (!localName.IsEmpty())
            {
                entity.Where("LocalName", ECondition.Like, "%" + localName + "%");
            }
            if (!searchKey.IsEmpty())
            {
                entity.Begin<LocalProductEntity>()
                 .Where<LocalProductEntity>("ProductName", ECondition.Like, "%" + searchKey + "%")
                 .Or<LocalProductEntity>("ProductNum", ECondition.Like, "%" + searchKey + "%")
                 .Or<LocalProductEntity>("BarCode", ECondition.Like, "%" + searchKey + "%")
                 .End<LocalProductEntity>();
            }

            PageInfo pageInfo = new PageInfo() { PageIndex = 1, PageSize = Int32.MaxValue };
            List<LocalProductEntity> listResult = provider.GetList(entity, ref pageInfo);
            int allNum = provider.GetAllNum(localName, localType, searchKey, storageNum);
            double allTotalPrice = provider.GetAllTotalPrice(localName, localType, searchKey, storageNum);
            if (!listResult.IsNullOrEmpty())
            {
                listResult.ForEach(a =>
                {
                    a.TotalPrice = a.Num * a.AvgPrice;
                });
                DataTable dt = new DataTable();
                dt.Columns.Add(new DataColumn("序号 "));
                dt.Columns.Add(new DataColumn("库位 "));
                dt.Columns.Add(new DataColumn("库位类型"));
                dt.Columns.Add(new DataColumn("产品编号"));
                dt.Columns.Add(new DataColumn("产品条码"));
                dt.Columns.Add(new DataColumn("产品名称"));
                dt.Columns.Add(new DataColumn("类别名称"));
                dt.Columns.Add(new DataColumn("规格"));
                dt.Columns.Add(new DataColumn("预警值下限"));
                dt.Columns.Add(new DataColumn("预警值上限"));
                dt.Columns.Add(new DataColumn("库存数"));
                dt.Columns.Add(new DataColumn("价格"));
                dt.Columns.Add(new DataColumn("总价"));

                int count = 1;
                foreach (LocalProductEntity t in listResult)
                {
                    DataRow row = dt.NewRow();
                    row[0] = count;
                    row[1] = t.LocalName;
                    row[2] = EnumHelper.GetEnumDesc<ELocalType>(t.LocalType);
                    row[3] = t.ProductNum;
                    row[4] = t.BarCode;
                    row[5] = t.ProductName;
                    row[6] = t.CateName;
                    row[7] = t.Size;
                    row[8] = t.MinNum;
                    row[9] = t.MaxNum;
                    row[10] = t.Num;
                    row[11] = t.AvgPrice;
                    row[12] = t.TotalPrice;
                    dt.Rows.Add(row);
                    count++;
                }
                DataRow rowTemp = dt.NewRow();
                rowTemp[0] = count;
                rowTemp[1] = "";
                rowTemp[2] = "";
                rowTemp[3] = "";
                rowTemp[4] = "";
                rowTemp[5] = "";
                rowTemp[6] = "";
                rowTemp[7] = "";
                rowTemp[8] = "";
                rowTemp[9] = "总计";
                rowTemp[10] = allNum;
                rowTemp[11] = "";
                rowTemp[12] = allTotalPrice;
                dt.Rows.Add(rowTemp);
                string filePath = Server.MapPath("~/UploadFiles/");
                if (!System.IO.Directory.Exists(filePath))
                {
                    System.IO.Directory.CreateDirectory(filePath);
                }
                string filename = string.Format("库存清单报表{0}.xls", DateTime.Now.ToString("yyyyMMddHHmmss"));
                AsposeExcel excel = new AsposeExcel(System.IO.Path.Combine(filePath, filename), "");
                excel.DatatableToExcel(dt, "库存清单报表", "库存清单报表");
                this.ReturnJson.AddProperty("Path", ("/UploadFiles/" + filename).Escape());
                this.ReturnJson.AddProperty("Path", ("/UploadFiles/" + filename).Escape());
            }
            else
            {
                this.ReturnJson.AddProperty("d", "无数据导出!");
            }
            return Content(this.ReturnJson.ToString());
        }