Esempio n. 1
0
        public string PageList(Bootstrap.BootstrapParams bootstrap)
        {
            int totalNumber = 0;

            if (bootstrap.offset != 0)
            {
                bootstrap.offset = bootstrap.offset / bootstrap.limit + 1;
            }
            var query = _client.Queryable <Wms_material, Sys_dict, Sys_dict, Wms_storagerack, Wms_reservoirarea, Wms_warehouse, Sys_user, Sys_user>
                            ((s, t, ut, r, k, w, c, u) => new object[] {
                JoinType.Left, s.MaterialType == t.DictId,
                JoinType.Left, s.Unit == ut.DictId,
                JoinType.Left, s.StoragerackId == r.StorageRackId,
                JoinType.Left, s.ReservoirAreaId == k.ReservoirAreaId,
                JoinType.Left, s.WarehouseId == w.WarehouseId,
                JoinType.Left, s.CreateBy == c.UserId,
                JoinType.Left, s.ModifiedBy == u.UserId,
            })
                        .Where((s, t, ut, r, k, w, c, u) => s.IsDel == 1 && t.IsDel == 1 && ut.IsDel == 1 && r.IsDel == 1 && k.IsDel == 1 && w.IsDel == 1)
                        .Select((s, t, ut, r, k, w, c, u) => new
            {
                MaterialId = s.MaterialId.ToString(),
                s.MaterialNo,
                s.MaterialName,
                r.StorageRackNo,
                r.StorageRackName,
                k.ReservoirAreaNo,
                k.ReservoirAreaName,
                w.WarehouseNo,
                w.WarehouseName,
                MaterialType = t.DictName,
                Unit         = ut.DictName,
                s.Qty,
                s.ExpiryDate,
                s.IsDel,
                s.Remark,
                CName = c.UserNickname,
                s.CreateDate,
                UName = u.UserNickname,
                s.ModifiedDate
            }).MergeTable();

            if (!bootstrap.search.IsEmpty())
            {
                query.Where((s) => s.MaterialNo.Contains(bootstrap.search) || s.MaterialName.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.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());
        }
Esempio n. 2
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());
        }
Esempio n. 3
0
        public string PageList(Bootstrap.BootstrapParams bootstrap)
        {
            var totalNumber = 0;

            if (bootstrap.offset != 0)
            {
                bootstrap.offset = bootstrap.offset / bootstrap.limit + 1;
            }
            //var order = ExpressionExt.InitO<Sys_user>(bootstrap.sort);

            var query = _client.Queryable <Sys_user, Sys_user, Sys_user, Sys_dept, Sys_role>
                            ((s, c, u, d, r) => new object[] {
                JoinType.Left, s.CreateBy == c.UserId,
                JoinType.Left, s.ModifiedBy == u.UserId,
                JoinType.Left, s.DeptId == d.DeptId,
                JoinType.Left, s.RoleId == r.RoleId
            }).Where((s, c, u, d, r) => s.IsDel == 1 && d.IsDel == 1 && r.IsDel == 1)
                        .Select((s, c, u, d, r) => new
            {
                UserId = s.UserId.ToString(),
                s.UserName,
                s.UserNickname,
                d.DeptName,
                r.RoleName,
                s.Tel,
                s.Email,
                s.Sex,
                s.IsEabled,
                s.Remark,
                CName = c.UserNickname,
                s.CreateDate,
                UName = u.UserNickname,
                s.ModifiedDate
            }).MergeTable();

            if (!bootstrap.search.IsEmpty())
            {
                query.Where((s) => s.UserName == bootstrap.search || s.UserNickname == bootstrap.search);
            }
            if (!bootstrap.datemin.IsEmpty() && !bootstrap.datemax.IsEmpty())
            {
                query.Where(s => s.CreateDate > bootstrap.datemin.ToDateTimeB() && s.CreateDate <= bootstrap.datemax.ToDateTimeE());
            }
            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);

            //var list = _client.Queryable("Sys_User", "s")
            //   .AddJoinInfo("Sys_User", "c", "s.CreateBy=c.UserId")
            //   .AddJoinInfo("Sys_User", "u", "s.ModifiedBy=u.UserId");
            //if (!bootstrap.search.IsEmpty())
            //{
            //    list.Where("s.IsDel=@id and s.UserName=@UserName or s.UserNickname=@UserName")
            //    .AddParameters(new { id = 1, UserName = bootstrap.search });
            //}
            //else
            //{
            //    list.Where("s.IsDel=@id ")
            //   .AddParameters(new { id = 1 });
            //}
            //if (bootstrap.offset != 0)
            //{
            //    bootstrap.offset = bootstrap.offset / bootstrap.limit + 1;
            //}
            //list.OrderBy($"s.{bootstrap.sort}")
            //.Select("s.*,c.UserNickname AS CNAME,u.UserNickname AS UNAME")
            //.ToPageList(bootstrap.offset, bootstrap.limit, ref totalNumber);
            return(Bootstrap.GridData(list, totalNumber).JilToJson());
        }
Esempio n. 4
0
        public string PageList(PubParams.InventoryBootstrapParams bootstrap)
        {
            int totalNumber = 0;

            if (bootstrap.offset != 0)
            {
                bootstrap.offset = bootstrap.offset / bootstrap.limit + 1;
            }
            var query = _client.Queryable <Wms_inventory, Wms_material, Wms_storagerack, Sys_user, Sys_user>
                            ((s, p, d, c, u) => new object[] {
                JoinType.Left, s.MaterialId == p.MaterialId,
                JoinType.Left, s.StoragerackId == d.StorageRackId,
                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
            {
                InventoryId = s.InventoryId.ToString(),
                s.Qty,
                MaterialId = p.MaterialId.ToString(),
                p.MaterialNo,
                p.MaterialName,
                SafeQty       = p.Qty,
                StorageRackId = d.StorageRackId.ToString(),
                d.StorageRackNo,
                d.StorageRackName,
                s.IsDel,
                s.Remark,
                CName = c.UserNickname,
                s.CreateDate,
                UName = u.UserNickname,
                s.ModifiedDate
            }).MergeTable();

            if (!bootstrap.search.IsEmpty())
            {
                query.Where((s) => s.MaterialNo.Contains(bootstrap.search) || s.MaterialName.Contains(bootstrap.search));
            }
            if (!bootstrap.StorageRackId.IsEmpty())
            {
                query.Where(s => s.StorageRackId == bootstrap.StorageRackId);
            }
            if (!bootstrap.MaterialId.IsEmpty())
            {
                query.Where(s => s.MaterialId == bootstrap.MaterialId);
            }
            if (!bootstrap.datemin.IsEmpty() && !bootstrap.datemax.IsEmpty())
            {
                query.Where(s => s.CreateDate > bootstrap.datemin.ToDateTimeB() && s.CreateDate <= bootstrap.datemax.ToDateTimeE());
            }
            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());
        }