예제 #1
0
        public async Task <string> List([FromForm] PubParams.StockInBootstrapParams bootstrap)
        {
            //var sd = _stockinServices.PageList(bootstrap);
            //return Content(sd);

            IWMSBaseApiAccessor wmsAccessor = WMSApiManager.GetBaseApiAccessor(bootstrap.storeId.ToString(), _client);
            RouteData <OutsideStockInQueryResult[]> result = await wmsAccessor.QueryStockInList(
                null, null, bootstrap.pageIndex, bootstrap.limit, bootstrap.search,
                new string[] { bootstrap.sort + " " + bootstrap.order },
                bootstrap.datemin, bootstrap.datemax);

            if (!result.IsSccuess)
            {
                return(new PageGridData().JilToJson());
            }
            return(result.ToGridJson());
        }
예제 #2
0
        public ContentResult List([FromForm] PubParams.StockInBootstrapParams bootstrap)
        {
            var sd = _stockinServices.PageList(bootstrap);

            return(Content(sd));
        }
예제 #3
0
        public string PageList(PubParams.StockInBootstrapParams bootstrap)
        {
            int totalNumber = 0;

            if (bootstrap.offset != 0)
            {
                bootstrap.offset = bootstrap.offset / bootstrap.limit + 1;
            }
            var query = _client.Queryable <Wms_stockin, Wms_supplier, Sys_dict, Sys_user, Sys_user>
                            ((s, p, d, c, u) => new object[] {
                JoinType.Left, s.SupplierId == p.SupplierId,
                JoinType.Left, s.StockInType == d.DictId,
                JoinType.Left, s.CreateBy == c.UserId,
                JoinType.Left, s.ModifiedBy == u.UserId,
            })
                        .Where((s, p, d, c, u) => s.IsDel == 1 && d.IsDel == 1 && c.IsDel == 1)
                        .Select((s, p, d, c, u) => new
            {
                StockInId     = s.StockInId.ToString(),
                StockInType   = d.DictName,
                StockInTypeId = s.StockInType.ToString(),
                s.StockInStatus,
                s.StockInNo,
                s.OrderNo,
                s.SupplierId,
                p.SupplierNo,
                p.SupplierName,
                s.IsDel,
                s.Remark,
                CName = c.UserNickname,
                s.CreateDate,
                UName = u.UserNickname,
                s.ModifiedDate
            }).MergeTable();

            if (!bootstrap.search.IsEmpty())
            {
                query.Where((s) => s.StockInNo.Contains(bootstrap.search) || s.OrderNo.Contains(bootstrap.search));
            }
            if (!bootstrap.datemin.IsEmpty() && !bootstrap.datemax.IsEmpty())
            {
                query.Where(s => s.CreateDate > bootstrap.datemin.ToDateTimeB() && s.CreateDate <= bootstrap.datemax.ToDateTimeE());
            }
            if (!bootstrap.StockInType.IsEmpty())
            {
                query.Where((s) => s.StockInTypeId.Contains(bootstrap.StockInType));
            }
            if (!bootstrap.StockInStatus.IsEmpty())
            {
                query.Where((s) => s.StockInStatus == bootstrap.StockInStatus.ToByte());
            }
            if (bootstrap.order.Equals("desc", StringComparison.OrdinalIgnoreCase))
            {
                query.OrderBy($"MergeTable.{bootstrap.sort} desc");
            }
            else
            {
                query.OrderBy($"MergeTable.{bootstrap.sort} asc");
            }
            var list = query.ToPageList(bootstrap.offset, bootstrap.limit, ref totalNumber);

            return(Bootstrap.GridData(list, totalNumber).JilToJson());
        }