/// <summary> /// 调货单列表 /// </summary> /// <param name="filter">查询参数</param> /// <param name="pageIndex">页码</param> /// <param name="pageSize">页大小</param> /// <param name="userSysno">操作人</param> /// <param name="hasAllWarehouse">仓库权限</param> /// <returns>列表</returns> /// <remarks>2016-04-05 杨浩 创建</remarks> public PagedList <CBTransferCargo> SearchTransferCargo(ParaTransferCargoFilter filter, int pageIndex, int pageSize, int userSysno, bool hasAllWarehouse) { if (filter == null) { return(null); } var model = new PagedList <CBTransferCargo>(); var result = ITransferCargoDao.Instance.SearchTransferCargo(filter, pageIndex, pageSize, userSysno, hasAllWarehouse); model.TData = result.Rows; model.PageSize = pageSize; model.TotalItemCount = result.TotalRows; model.CurrentPageIndex = pageIndex; return(model); }
/// <summary> /// 调货单列表 /// </summary> /// <param name="filter">查询参数</param> /// <param name="pageIndex">页码</param> /// <param name="pageSize">页大小</param> /// <param name="userSysNo">用户编号</param> /// <param name="isHasAllWarehouse">是否拥有所有仓库的权限</param> /// <returns></returns> /// <remarks>2016-04-05 杨浩 创建</remarks> public override Pager <CBTransferCargo> SearchTransferCargo(ParaTransferCargoFilter filter, int pageIndex, int pageSize, int userSysNo, bool isHasAllWarehouse) { var pager = new Pager <CBTransferCargo>(); using (IDbContext context = Context.UseSharedConnection(true)) { string select = @"a.sysno,a.ordersysno,a.stockoutsysno,wh.warehousename as applywarehouse,wh.StreetAddress,wh.Contact,wh.Phone,sy.username as CreatedName,a.createddate,wwh.warehousename as deliverywarehouse,sys.username as LastName,a.lastupdatedate,a.status,a.remarks,a.applywarehousesysno,a.deliverywarehousesysno"; string table = @"transfercargo a left join whwarehouse wh on a.applywarehousesysno=wh.sysno left join syuser sy on sy.sysno=a.createdby left join whwarehouse wwh on a.deliverywarehousesysno=wwh.sysno left join syuser sys on sys.sysno=a.lastupdateby"; string where = " 1=1 "; var list = new List <object>(); if (filter.SysNo.HasValue && filter.SysNo > 0) { list.Add(filter.SysNo); where += "and a.stockoutsysno = @" + (list.Count - 1); } if (filter.Status.HasValue) { list.Add(filter.Status); where += "and a.Status = @" + (list.Count - 1); } if (filter.WarehouseSysNo.HasValue && filter.WarehouseSysNo > 0) { list.Add(filter.WarehouseSysNo); where += "and a.applywarehousesysno = @" + (list.Count - 1); } if (filter.DeliveryWarehouseSysNo.HasValue && filter.DeliveryWarehouseSysNo > 0) { list.Add(filter.DeliveryWarehouseSysNo); where += "and a.deliverywarehousesysno = @" + (list.Count - 1); } var parms = list.ToArray(); if (!isHasAllWarehouse) { where += string.Format(" and exists (select 1 from SyUserWarehouse f where (f.WarehouseSysNo = a.deliverywarehousesysno or f.WarehouseSysNo = a.applywarehousesysno) and f.UserSysNo = {0})", userSysNo); } pager.TotalRows = context.Sql(@" select count(1) from TransferCargo a where " + where) .Parameters(parms) .QuerySingle <int>(); pager.Rows = context.Select <CBTransferCargo>(select) .From(table) .AndWhere(where) .Parameters(parms) .OrderBy("a.SysNo desc") .Paging(pageIndex, pageSize) .QueryMany(); } return(pager); }
/// <summary> /// 调货单分页列表 /// </summary> /// <param name="filter">查询参数</param> /// <param name="pageIndex">页码</param> /// <param name="pageSize">页大小</param> /// <param name="userSysNo">用户编号</param> /// <param name="isHasAllWarehouse">是否拥有所有仓库的权限</param> /// <returns>分页列表</returns> /// <remarks>2016-04-05 杨浩 创建</remarks> public abstract Pager <CBTransferCargo> SearchTransferCargo(ParaTransferCargoFilter filter, int pageIndex, int pageSize, int userSysNo, bool isHasAllWarehouse);