示例#1
0
        public string SearchInventory(PubParams.InventoryBootstrapParams bootstrap)
        {
            int totalNumber = 0;

            if (bootstrap.offset != 0)
            {
                bootstrap.offset = bootstrap.offset / bootstrap.limit + 1;
            }
            var query = _client.Queryable <Wms_inventory, Wms_inventorybox, Wms_material, Wms_storagerack, Sys_user, Sys_user>
                            ((s, sb, p, d, c, u) => new object[] {
                JoinType.Left, s.MaterialId == p.MaterialId,
                JoinType.Left, s.InventoryBoxId == sb.InventoryBoxId,
                JoinType.Left, sb.StorageRackId == d.StorageRackId,
                JoinType.Left, s.CreateBy == c.UserId,
                JoinType.Left, s.ModifiedBy == u.UserId,
            })
                        .Where((s, sb, p, d, c, u) => s.IsDel == 1 && sb.IsDel == 1 && d.IsDel == 1 && c.IsDel == 1)
                        .Select((s, sb, p, d, c, u) => new
            {
                InventoryId    = s.InventoryId.ToString(),
                InventoryBoxId = s.InventoryBoxId.ToString(),
                s.Qty,
                MaterialId = p.MaterialId.ToString(),
                p.MaterialNo,
                p.MaterialName,
                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.MaterialId == bootstrap.search);
            }
            if (!bootstrap.StorageRackId.IsEmpty())
            {
                query.Where((s) => s.StorageRackId == bootstrap.StorageRackId);
            }
            if (!bootstrap.InventoryBoxId.IsEmpty())
            {
                query.Where((s) => s.InventoryBoxId == bootstrap.InventoryBoxId);
            }
            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());
        }
        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_inventoryrecord, Wms_stockindetail, Wms_material, Sys_user, Sys_user, Wms_stockin, Wms_storagerack>
                            ((s, p, d, c, u, i, w) => new object[] {
                JoinType.Left, s.StockInDetailId == p.StockInDetailId,
                JoinType.Left, p.MaterialId == d.MaterialId,
                JoinType.Left, s.CreateBy == c.UserId,
                JoinType.Left, s.ModifiedBy == u.UserId,
                JoinType.Left, p.StockInId == i.StockInId,
                JoinType.Left, w.StorageRackId == p.StoragerackId
            })
                        .Where((s, p, d, c, u, i, w) => s.IsDel == 1 && d.IsDel == 1 && c.IsDel == 1 && i.IsDel == 1 && w.IsDel == 1)
                        .Select((s, p, d, c, u, i, w) => new
            {
                InventoryrecordId = s.InventoryrecordId.ToString(),
                i.StockInNo,
                s.Qty,
                d.MaterialNo,
                d.MaterialName,
                w.StorageRackNo,
                w.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) || s.StockInNo.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());
        }
示例#3
0
        public IActionResult SearchInventory(string id, string storagerackId)
        {
            var bootstrap = new PubParams.InventoryBootstrapParams
            {
                limit         = 100,
                offset        = 0,
                sort          = "CreateDate",
                search        = id,
                order         = "desc",
                StorageRackId = storagerackId,
            };
            var json = _inventoryServices.SearchInventory(bootstrap);

            return(Content(json));
        }
        public async Task <PageGridData> List([FromForm] PubParams.InventoryBootstrapParams bootstrap)
        {
            //var sd = _inventoryrecordServices.PageList(bootstrap);
            //return Content(sd);

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

            if (!result.IsSccuess)
            {
                return(new PageGridData());
            }
            return(result.ToGridData());
        }
示例#5
0
        public async Task <string> List([FromForm] PubParams.InventoryBootstrapParams bootstrap)
        {
            try
            {
                //var sd = _inventoryServices.PageList(bootstrap);
                //return Content(sd);
                long?materialId = string.IsNullOrWhiteSpace(bootstrap.MaterialId) ? (long?)null : long.Parse(bootstrap.MaterialId);

                IWMSBaseApiAccessor wmsAccessor          = WMSApiManager.GetBaseApiAccessor(bootstrap.storeId.ToString(), _client);
                RouteData <OutsideInventoryDto[]> result = (await wmsAccessor.QueryInventory(
                                                                null, null, null, materialId, 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());
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }
示例#6
0
        public ContentResult List([FromForm] PubParams.InventoryBootstrapParams bootstrap)
        {
            var sd = _inventoryServices.PageList(bootstrap);

            return(Content(sd));
        }
示例#7
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_inventorybox, Wms_material, Wms_storagerack, Sys_user, Sys_user>
                            ((s, sb, m, sr, scu, smu) => new object[] {
                JoinType.Left, s.InventoryBoxId == sb.InventoryBoxId,
                JoinType.Left, s.MaterialId == m.MaterialId,
                JoinType.Left, sb.StorageRackId == sr.StorageRackId,
                JoinType.Left, s.CreateBy == scu.UserId,
                JoinType.Left, s.ModifiedBy == smu.UserId,
            })
                        .Where((s, sb, m, sr, scu, smu) => sb.WarehouseId == bootstrap.storeId && s.IsDel == 1 && sb.IsDel == 1 && sr.IsDel == 1 && scu.IsDel == 1)
                        .Select((s, sb, m, sr, scu, smu) => new
            {
                InventoryId    = s.InventoryId.ToString(),
                InventoryBoxId = sb.InventoryBoxId.ToString(),
                s.Qty,
                s.IsLocked,
                MaterialId = m.MaterialId.ToString(),
                m.MaterialNo,
                m.MaterialName,
                StorageRackId = sr.StorageRackId.ToString(),
                sr.StorageRackNo,
                sr.StorageRackName,
                sb.InventoryBoxNo,
                sb.InventoryBoxName,
                s.IsDel,
                s.Remark,
                CName = scu.UserNickname,
                s.CreateDate,
                UName = smu.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.InventoryBoxId.IsEmpty())
            {
                query.Where(s => s.InventoryBoxId == bootstrap.InventoryBoxId);
            }
            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());
        }