예제 #1
0
        public PagedResultDto <BillInfoBusinessDto> GetPagedBusiness(SearchBillInfoInput input) //业务清单
        {
            var Has = PermissionChecker.IsGranted(PermissionNames.Pages_Staff_Merchandiser);    //判断是否业务员


            var HasI = PermissionChecker.IsGranted(PermissionNames.Pages_Inspection); //判断是有权限

            var task = _BillInfoRepository.GetAll().OrderByDescending(t => t.Id)
                       .Where(t => t.IsCandidate == false)
                       .WhereIf(input.BillNo.HasValue, t => t.BillNo == input.BillNo)
                       .WhereIf(!input.CompanyAbbreviation.IsNullOrEmpty(), t => t.CompanyAbbreviation.Contains(input.CompanyAbbreviation))
                       .WhereIf(!input.ReceivingCity.IsNullOrEmpty(), t => t.ReceivingCity == input.ReceivingCity)
                       .WhereIf(input.CreationTimeS.HasValue, t => t.CreationTime >= input.CreationTimeS)
                       .WhereIf(input.CreationTimeE.HasValue, t => t.CreationTime <= input.CreationTimeE)
                       .WhereIf(!input.ExpressNo.IsNullOrEmpty(), t => t.ExpressNo == input.ExpressNo)

                       .WhereIf(!HasI, t => t.BillStateID < 2)
                       .OrderByDescending(t => t.CreationTime)
                       .ToList();


            var taskcount = task.Count;                                                                     //数据总量

            var tasklist = task.Skip((input.PageIndex - 1) * input.PageSize).Take(input.PageSize).ToList(); //获取目标页数据

            var result = new PagedResultDto <BillInfoBusinessDto>(taskcount, tasklist.MapTo <List <BillInfoBusinessDto> >());

            return(result);
        }
예제 #2
0
        public PagedResultDto <SearchBIllInfoDto> GetPagedBillInfos(SearchBillInfoInput input)
        {
            bool Has;
            var  HasI = PermissionChecker.IsGranted(PermissionNames.Pages_Inspection); //判断是有权限

            if (!HasI)
            {
                Has = PermissionChecker.IsGranted(PermissionNames.Pages_Staff_Merchandiser); //判断是否业务员
            }
            else
            {
                Has = false;
            }
            // var UserID = AbpSession.GetUserId();
            List <BillInfo> task;                                                                 //按条件过滤

            if (input.BillNo.HasValue)
            {
                task = _BillInfoRepository.GetAll().OrderByDescending(t => t.Id)
                       .Where(t => t.IsCandidate == false)
                       .WhereIf(input.BillNo.HasValue, t => t.BillNo == input.BillNo)
                       .WhereIf(!input.CompanyAbbreviation.IsNullOrEmpty(), t => t.CompanyAbbreviation == input.CompanyAbbreviation)
                       .WhereIf(!input.ReceivingCity.IsNullOrEmpty(), t => t.ReceivingCity == input.ReceivingCity)
                       .WhereIf(input.CreationTimeS.HasValue, t => t.CreationTime >= input.CreationTimeS)
                       .WhereIf(input.CreationTimeE.HasValue, t => t.CreationTime <= input.CreationTimeE)
                       .WhereIf(Has, t => t.MerchandiserId == input.UserId)
                       .OrderByDescending(t => t.CreationTime)
                       .ToList();



                // task[0].BillStateID>=2
            }
            else
            {
                task = _BillInfoRepository.GetAll().OrderByDescending(t => t.Id)
                       .Where(t => t.IsCandidate == false)
                       .WhereIf(input.BillNo.HasValue, t => t.BillNo == input.BillNo)
                       .WhereIf(!input.CompanyAbbreviation.IsNullOrEmpty(), t => t.CompanyAbbreviation == input.CompanyAbbreviation)
                       .WhereIf(!input.ReceivingCity.IsNullOrEmpty(), t => t.ReceivingCity == input.ReceivingCity)
                       .WhereIf(input.CreationTimeS.HasValue, t => t.CreationTime >= input.CreationTimeS)
                       .WhereIf(input.CreationTimeE.HasValue, t => t.CreationTime <= input.CreationTimeE)
                       .WhereIf(Has, t => t.MerchandiserId == input.UserId)
                       .WhereIf(!HasI, t => t.BillStateID < 2)
                       //HasI 判断是有权限审核 已签收不显示


                       .OrderByDescending(t => t.CreationTime)
                       .ToList();
            }
            //var task = _BillInfoRepository.GetAll().OrderByDescending(t => t.Id)
            //    .Where(t => t.IsCandidate == false)
            //    .WhereIf(input.BillNo.HasValue, t => t.BillNo == input.BillNo)
            //    .WhereIf(!input.CompanyAbbreviation.IsNullOrEmpty(), t => t.CompanyAbbreviation == input.CompanyAbbreviation)
            //    .WhereIf(!input.ReceivingCity.IsNullOrEmpty(), t => t.ReceivingCity == input.ReceivingCity)
            //    .WhereIf(input.CreationTimeS.HasValue, t => t.CreationTime >= input.CreationTimeS)
            //    .WhereIf(input.CreationTimeE.HasValue, t => t.CreationTime <= input.CreationTimeE)

            //    //.WhereIf(!input.BillNo.IsNullOrEmpty(), t => t.ReceivingCity == input.ReceivingCity))
            //   // .WhereIf(Has,t=>t.CreatorUserId== UserID)
            //    .OrderByDescending(t => t.CreationTime)
            //    .ToList();

            var taskcount = task.Count;                                                                     //数据总量

            var tasklist = task.Skip((input.PageIndex - 1) * input.PageSize).Take(input.PageSize).ToList(); //获取目标页数据

            var result = new PagedResultDto <SearchBIllInfoDto>(taskcount, tasklist.MapTo <List <SearchBIllInfoDto> >());

            return(result);
        }