public ReVisitedListViewModel WorkOrderList(long buid) { var viewModel = new ReVisitedListViewModel(); bx_userinfo_renewal_info model = _userinfoRenewalInfoRepository.FindByBuid(buid); List <bx_consumer_review> list = _consumerReviewRepository.FindDetails(buid); if (!list.Any())//model == null && { viewModel.BusinessStatus = -10002; viewModel.StatusMessage = "获取信息失败"; return(viewModel); } viewModel.BusinessStatus = 1; if (model != null) { var info = new VisitedInfo { CustomerName = model.client_name, Phone = model.client_mobile }; viewModel.VisitedInfo = info; } if (list.Any()) { var visitedList = new List <VisitedDetail>(); var item = new VisitedDetail(); foreach (var obj in list) { item.Id = obj.id; item.RecallTime = obj.next_review_date.HasValue ? obj.next_review_date.Value.ToString() : ""; item.ResultStatus = obj.result_status; item.CreateTime = obj.create_time.HasValue ? obj.create_time.Value.ToString() : ""; item.Remark = obj.content; visitedList.Add(item); } viewModel.VisitedList = visitedList; } return(viewModel); }
public IList<Tuple<Unit, VisitedInfo>> AllPositions(Unit currentUnit) { if (!currentUnit.IsCorrect(map)) { return new Tuple<Unit, VisitedInfo>[0]; } var checker = new ForbiddenSequenceChecker(currentUnit); var visited = new Dictionary<Unit, VisitedInfo> { { currentUnit, new VisitedInfo { path = new List<MoveType>(), spelledWords = powerPhrasesSpelled } } }; var queue = new Queue<Unit>(new[] { currentUnit }); while (queue.Any()) { var unit = queue.Dequeue(); var currentInfo = visited[unit]; for (int wordIndex = 0; wordIndex < powerPhrases.Length; wordIndex++) { var powerPhrase = powerPhrases[wordIndex]; var next = unit; bool invalid = false; var moves = currentInfo.path.ToList(); foreach (var c in powerPhrase) { var move = MoveTypeExt.Convert(c).Value; if (!checker.CheckLastMove(moves, move)) { invalid = true; break; } next = next.Move(move); if (!next.IsCorrect(map) /*|| visited.ContainsKey(next)*/) { invalid = true; break; } moves.Add(move); } if (!invalid) { VisitedInfo prevInfo; var newScore = currentInfo.score; if (!currentInfo.spelledWords[wordIndex]) newScore += 300; newScore += 2 * powerPhrase.Length; if (!visited.TryGetValue(next, out prevInfo) || prevInfo.score < newScore) { queue.Enqueue(next); var newSpelledWords = new bool[currentInfo.spelledWords.Length]; Array.Copy(currentInfo.spelledWords, newSpelledWords, newSpelledWords.Length); newSpelledWords[wordIndex] = true; visited[next] = new VisitedInfo { path = moves, score = newScore, spelledWords = newSpelledWords }; } } } foreach (var move in allowedMoves.Where(m => checker.CheckLastMove(currentInfo.path, m))) { var next = unit.Move(move); if (!next.IsCorrect(map)) continue; VisitedInfo prevInfo; if (!visited.TryGetValue(next, out prevInfo) || prevInfo.score < currentInfo.score) { queue.Enqueue(next); visited[next] = new VisitedInfo { path = currentInfo.path.Concat(new[] { move }).ToList(), score = currentInfo.score, spelledWords = currentInfo.spelledWords }; } } } return visited.Keys.Select(u => Tuple.Create(u, visited[u])).ToList(); }