/// <summary> /// 获取详情 /// </summary> /// <param name="input"></param> /// <returns></returns> public SupplyBackMainDto Get(GetWorkFlowTaskCommentInput input) { var id = Guid.Parse(input.InstanceId); var ret = new SupplyBackMainDto(); var model = _supplyBackMainRepository.Get(id); if (model != null) { ret.Status = model.Status; var sub = from a in _supplyBackSubRepository.GetAll() join b in _supplyBaseRepository.GetAll() on a.SupplyId equals b.Id where a.MainId == id select new SupplyBackSubDto() { EndTime = a.CreationTime, Id = a.Id, MainId = a.MainId, StartTime = b.CreationTime, Status = a.Status, Code = b.Code, Money = b.Money, Name = b.Name, SupplyId = b.Id, Type = b.Type, UserId = a.CreatorUserId.Value, UserId_Name = "", Version = b.Version }; ret.SupplyBackSub = sub.ToList(); } return(ret); }
/// <summary> /// 获取我申请的退还记录 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <PagedResultDto <SupplyBackMainDto> > GetAll(GetListInput input) { var query = from a in _supplyBackMainRepository.GetAll() join b in _userRepository.GetAll() on a.CreatorUserId equals b.Id let openModel = (from c in _workFlowTaskRepository2.GetAll().Where(x => x.FlowID == input.FlowId && x.InstanceID == a.Id.ToString() && x.ReceiveID == AbpSession.UserId.Value) select c) //join sub in _supplyBackSubRepository.GetAll() on a.Id equals sub.MainId into subs where a.CreatorUserId == AbpSession.UserId.Value //SupplyApplyListDto select new { Id = a.Id, CreationTime = a.CreationTime, UserId = a.CreatorUserId.Value, Status = a.Status, // SupplyBackSub=subs, UserId_Name = b.Name, OpenModel = openModel.Count(y => y.Type != 6 && (y.Status == 1 || y.Status == 0)) > 0 ? 1 : 2 }; query = query.WhereIf(!input.Status.IsNullOrWhiteSpace(), r => input.Status.Contains(r.Status.ToString())); var count = await query.CountAsync(); var model = await query.OrderByDescending(ite => ite.CreationTime).OrderBy(ite => ite.OpenModel).PageBy(input).ToListAsync(); var ret = new List <SupplyBackMainDto>(); foreach (var r in model) { var item = new SupplyBackMainDto() { Id = r.Id, UserId_Name = r.UserId_Name, CreationTime = r.CreationTime, UserId = r.UserId, Status = r.Status, OpenModel = r.OpenModel, }; item.InstanceId = r.Id.ToString(); _workFlowBusinessTaskManager.SupplementWorkFlowBusinessList(input.FlowId, item as BusinessWorkFlowListOutput); var querysub = (from a in _supplyBackSubRepository.GetAll() join b in _supplyBaseRepository.GetAll() on a.SupplyId equals b.Id join u in _userRepository.GetAll() on a.CreatorUserId equals u.Id where a.MainId == r.Id select new SupplyBackSubDto() { Code = b.Code, EndTime = a.LastModificationTime, Id = a.Id, MainId = a.MainId, Money = b.Money, Name = b.Name, StartTime = b.CreationTime, Status = a.Status, SupplyId = a.SupplyId, Type = b.Type, TypeName = ((SupplyType)b.Type).ToString(), UserId = a.CreatorUserId.Value, UserId_Name = u.Name, Version = b.Version, StatusTitle = ((SupplyBackSubStatus)a.Status).ToString() }).ToList(); item.SupplyBackSub = querysub; ret.Add(item); } return(new PagedResultDto <SupplyBackMainDto>(count, ret)); }