public List <OrderListPriceInfo> GetBasePriceListAsync(OrderListWithBaseCostRequest input, string requestTracked) { List <OrderListPriceInfo> currentList = new List <OrderListPriceInfo>(); foreach (var item in input.OrderItemIdList) { currentList.Add(new OrderListPriceInfo(item, item + 10000.321m )); } return(currentList); }
/// <summary> /// 实际请求 调用采购 提供的接口【分页】 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task <Dictionary <int, decimal> > GetBasePriceDictAsync(List <int> list, int orderNo, int pageSize, string requestTracked = null) { Dictionary <int, decimal> dict = new Dictionary <int, decimal>(); List <OrderListPriceInfo> resultList = new List <OrderListPriceInfo>(); var pageIndex = 1; OrderListWithBaseCostRequest input = new OrderListWithBaseCostRequest(); do { input.OrderNo = orderNo; input.OrderItemIdList = list.Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList(); //var pageTousus = await QueryTousuByTousuIdsAsync(tousuIds, pageIndex, pageSize); if (input.OrderItemIdList.Any()) { var currentList = GetBasePriceListAsync(input, requestTracked); if (currentList.Any()) { Console.WriteLine($"AddRange currentList ! {JsonConvert.SerializeObject(currentList)}"); resultList.AddRange(currentList); } pageIndex++; } else { Console.WriteLine($"【Any-Empty】 ! {JsonConvert.SerializeObject(input.OrderItemIdList)}"); break; } }while (pageIndex < 1000); Console.WriteLine($"resultList ! {JsonConvert.SerializeObject(resultList)}"); resultList = resultList.Where((x, i) => resultList.FindIndex(z => z.POId == x.POId) == i).ToList(); Console.WriteLine($"resultList ! {JsonConvert.SerializeObject(resultList)}"); dict = resultList.ToDictionary(x => x.POId, x => x.BaseCost); return(dict); }