Ejemplo n.º 1
0
        /// <summary>
        /// 获取数据列表(分页)
        /// </summary>
        public PageModel GetDataListForPage(StockTakingRequest request)
        {
            #region 模糊搜索条件

            var where = new Where <TbStockTaking>();
            if (request.TakDayS.HasValue)
            {
                where.And(p => p.TakDay >= request.TakDayS);
            }
            if (request.TakDayE.HasValue)
            {
                where.And(p => p.TakDay <= request.TakDayE);
            }
            if (!string.IsNullOrWhiteSpace(request.WarehouseType))
            {
                where.And(p => p.WarehouseType == request.WarehouseType);
            }
            if (!string.IsNullOrWhiteSpace(request.TakNum))
            {
                where.And(p => p.TakNum.Like(request.TakNum));
            }
            if (!string.IsNullOrWhiteSpace(request.ProcessFactoryCode))
            {
                where.And(p => p.ProcessFactoryCode == request.ProcessFactoryCode);
            }
            #endregion

            try
            {
                var data = Db.Context.From <TbStockTaking>()
                           .Select(
                    TbStockTaking._.ID
                    , TbStockTaking._.TakNum
                    , TbStockTaking._.TakDay
                    , TbStockTaking._.TotalInventory
                    , TbStockTaking._.TotalTak
                    , TbStockTaking._.TotalEarnOrLos
                    , TbStockTaking._.EarnOrLos
                    , TbStockTaking._.Remarks
                    , TbStockTaking._.InsertUserCode
                    , TbStockTaking._.InsertTime
                    , TbUser._.UserName
                    , TbCompany._.CompanyFullName.As("FactoryName")
                    , TbSysDictionaryData._.DictionaryText.As("WarehouseTypeName"))
                           .LeftJoin <TbUser>((a, c) => a.InsertUserCode == c.UserCode)
                           .LeftJoin <TbSysDictionaryData>((a, c) => a.WarehouseType == c.DictionaryCode)
                           .LeftJoin <TbCompany>((a, c) => a.ProcessFactoryCode == c.CompanyCode)
                           .Where(where)
                           .OrderByDescending(p => p.ID)
                           .ToPageList(request.rows, request.page);
                return(data);
            }
            catch (Exception)
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取分页列表数据
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public ActionResult GetGridJson(StockTakingRequest request)
        {
            var data = _StockTaking.GetDataListForPage(request);

            return(Content(data.ToJson()));
        }