/// <summary> /// 获取待收档案 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <PagedResultDto <DocmentListDto> > GetAllForWait(DocmentSearchInput input) { var query = from a in _docmentRepository.GetAll() join b in _abpDictionaryRepository.GetAll() on a.Type equals b.Id //join c in _userRepository.GetAll() on a.UserId equals c.Id let openModel = (from c in _workFlowTaskRepository.GetAll().Where(x => x.FlowID == input.FlowId && x.InstanceID == a.Id.ToString() && x.ReceiveID == AbpSession.UserId.Value) select c) select new DocmentListDto() { CreationTime = a.CreationTime, Attr = a.Attr, Attr_Name = a.Attr.ToString(), Id = a.Id, QrCodeId = a.QrCodeId, Location = a.Location, Name = a.Name, No = a.No, FlowId = a.FlowId, IsOld = a.IsOld, IsOut = a.IsOut, Type = a.Type, Type_Name = b.Title, UserId = a.UserId, Des = a.Des, Status = (int)a.Status, NeedBack = a.NeedBack, StatusTitle = ((DocmentStatus)a.Status).ToString(), OpenModel = openModel.Count(y => y.Type != 6 && (y.Status == 1 || y.Status == 0)) > 0 ? 1 : 2 }; query = query.Where(ite => ite.Status == 1); if (string.IsNullOrWhiteSpace(input.SearchKey) == false) { query = query.Where(ite => ite.Name.Contains(input.SearchKey)); } if (input.Type.HasValue) { query = query.Where(ite => ite.Type == input.Type); } if (input.Attr.HasValue) { query = query.Where(ite => ite.Attr == input.Attr); } //query = query.Where(ite => ite.Status == (int)input.Status); var count = query.Count(); var ret = (await query.OrderByDescending(r => r.CreationTime).PageBy(input).ToListAsync()).MapTo <List <DocmentListDto> >(); foreach (var r in ret) { r.InstanceId = r.Id.ToString(); _workFlowBusinessTaskManager.SupplementWorkFlowBusinessList(input.FlowId, r as BusinessWorkFlowListOutput); if (r.UserId.HasValue && r.UserId != 0) { var u = _userRepository.Get(r.UserId.Value); r.UserId_Name = u.Name; } r.FileList = _abpFileRelationAppService.GetList(new GetAbpFilesInput() { BusinessId = r.Id.ToString(), BusinessType = (int)AbpFileBusinessType.档案附件 }); } return(new PagedResultDto <DocmentListDto>(count, ret)); }
/// <summary> /// 获取档案袋列表、资料清单(状态为-10) /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <PagedResultDto <DocmentListDto> > GetAllForWorkflow(DocmentSearchInput input) { var query = from a in _docmentRepository.GetAll() join b in _abpDictionaryRepository.GetAll() on a.Type equals b.Id join c in _qrcoderepository.GetAll() on a.QrCodeId equals c.Id into e from d in e.DefaultIfEmpty() let openModel = (from c in _workFlowTaskRepository.GetAll().Where(x => x.FlowID == input.FlowId && x.InstanceID == a.Id.ToString() && x.ReceiveID == AbpSession.UserId.Value) select c) select new DocmentListDto() { QrCodeType = d == null? QrCodeType.档案 : d.Type, CreationTime = a.CreationTime, CreatorUserId = a.CreatorUserId, Attr = a.Attr, Attr_Name = a.Attr.ToString(), Id = a.Id, QrCodeId = a.QrCodeId, Location = a.Location, Name = a.Name, No = a.No, FlowId = a.FlowId, Type = a.Type, Type_Name = b.Title, UserId = a.UserId, Des = a.Des, Status = (int)a.Status, IsOut = a.IsOut, IsOld = a.IsOld, NeedBack = a.NeedBack, OpenModel = openModel.Count(y => y.Type != 6 && (y.Status == 1 || y.Status == 0)) > 0 ? 1 : 2 }; if (string.IsNullOrWhiteSpace(input.SearchKey) == false) { query = query.Where(ite => ite.Name.Contains(input.SearchKey)); } if (input.GetOutorIn.HasValue) { query = query.Where(ite => ite.IsOut == input.GetOutorIn.Value); } if (input.Type.HasValue) { query = query.Where(ite => ite.Type == input.Type); } if (input.GetMy) { var isorgleader = _orgRepository.GetAll().Where(ite => ite.Leader.Contains("u_" + AbpSession.UserId.Value)).Select(ite => ite.Id).ToList(); if (isorgleader == null || isorgleader.Count == 0) { query = query.Where(ite => ite.UserId == AbpSession.UserId); } else { var userids = _userOrganizationUnitsRepository.GetAll().Where(ite => isorgleader.Contains(ite.OrganizationUnitId)).Select(ite => ite.UserId).Distinct().ToList(); query = query.Where(ite => userids.Contains(ite.UserId.Value)); } } if (input.Attr.HasValue) { query = query.Where(ite => ite.Attr == input.Attr); } if (input.GetCanDocmentIn) { query = query.Where(ite => ite.QrCodeType == QrCodeType.档案); } if (input.Status != null && input.Status.Count > 0) { query = query.Where(ite => input.Status.Contains((DocmentStatus)ite.Status)); } var count = query.Count(); var ret = (await query.OrderByDescending(r => r.CreationTime).PageBy(input).ToListAsync()).MapTo <List <DocmentListDto> >(); foreach (var r in ret) { r.InstanceId = r.Id.ToString(); _workFlowBusinessTaskManager.SupplementWorkFlowBusinessList(input.FlowId, r as BusinessWorkFlowListOutput); r.StatusTitle = ((DocmentStatus)r.Status).ToString(); if (r.UserId.HasValue && r.UserId != 0) { var u = _userRepository.Get(r.UserId.Value); r.UserId_Name = u.Name; } r.FileList = _abpFileRelationAppService.GetList(new GetAbpFilesInput() { BusinessId = r.Id.ToString(), BusinessType = (int)AbpFileBusinessType.档案附件 }); } return(new PagedResultDto <DocmentListDto>(count, ret)); }
/// <summary> /// 档案列表(排除-10的) /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <PagedResultDto <DocmentListDto> > GetAll(DocmentSearchInput input) { var query = from a in _docmentRepository.GetAll() join b in _abpDictionaryRepository.GetAll() on a.Type equals b.Id //join c in _userRepository.GetAll() on a.UserId equals c.Id where a.Status != -10 //不显示档案袋的 select new DocmentListDto() { CreationTime = a.CreationTime, Attr = a.Attr, Attr_Name = a.Attr.ToString(), Id = a.Id, QrCodeId = a.QrCodeId, Location = a.Location, Name = a.Name, No = a.No, Type = a.Type, IsOld = a.IsOld, IsOut = a.IsOut, IsProject = a.IsProject, ArchiveId = a.ArchiveId, Type_Name = b.Title, UserId = a.UserId, Des = a.Des, FlowId = a.FlowId, Status = (int)a.Status, NeedBack = a.NeedBack, StatusTitle = ((DocmentStatus)a.Status).ToString() }; if (string.IsNullOrWhiteSpace(input.SearchKey) == false) { query = query.Where(ite => ite.Name.Contains(input.SearchKey) || ite.No.Contains(input.SearchKey) || ite.Location.Contains(input.SearchKey)); } if (input.Type.HasValue) { query = query.Where(ite => ite.Type == input.Type); } if (input.Attr.HasValue) { query = query.Where(ite => ite.Attr == input.Attr); } if (input.Status != null && input.Status.Count > 0) { query = query.Where(ite => input.Status.Contains((DocmentStatus)ite.Status)); if (input.Status.Contains(DocmentStatus.在档)) //排除老档案 { query = query.Where(ite => ite.QrCodeId.HasValue); } } var count = query.Count(); var ret = (await query.OrderByDescending(r => r.CreationTime).PageBy(input).ToListAsync()).MapTo <List <DocmentListDto> >(); foreach (var r in ret) { if (r.UserId.HasValue && r.UserId != 0) { var u = _userRepository.Get(r.UserId.Value); r.UserId_Name = u.Name; } r.FileList = _abpFileRelationAppService.GetList(new GetAbpFilesInput() { BusinessId = r.Id.ToString(), BusinessType = (int)AbpFileBusinessType.档案附件 }); } return(new PagedResultDto <DocmentListDto>(count, ret)); }