using _29WxOrderWpf.BaseWindows; using AllBase; using AllBase.Helper; using AllBase.Model.DBModel; using NaiBa.Util.Extension; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading; using System.Threading.Tasks; using Work; namespace _29WxOrderWpf.Ctrls.OrderCtrls; public class OrderGetOrderListHelper { /// /// 读取订单详情信息 /// /// /// static async Task> GetOrderInfoBase(string orderIds, string shopIds = null, DateTime? beginUpdateTime = null, DateTime? endUpdateTime = null) { if (string.IsNullOrEmpty(orderIds)) return new List(); Thread.Sleep(100); try { var url = BaseClass.Build29WxObjString("order/get_erp_order_list"); var data = UserLogin.GetSignaturex(); data += "&erp_order_id_in=" + orderIds; data += "&page_size=" + 100; if (!string.IsNullOrWhiteSpace(shopIds)) data += "&erp_shop_id_in=" + shopIds; if (beginUpdateTime != null && beginUpdateTime != DateTime.MinValue) { var startTime = BaseClass.DateTimeToTimestampSeconds(beginUpdateTime.Value); data += "&start_time=" + startTime; } if (endUpdateTime != null && endUpdateTime != DateTime.MinValue) { var endTime = BaseClass.DateTimeToTimestampSeconds(endUpdateTime.Value); data += "&end_time=" + endTime; } var html = GetHtml.PostUtf8(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) html = GetHtml.PostUtf8(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) { throw new Exception("订单读取失败 " + BaseRegex.GetStringJson(ref html, "msg")); } List orders = new List(); orders = JsonHelper.DeserializeJsonToList(JObject.Parse(html)["data"].ParseToString()); if (orders == null) orders = new List(); var orderItems = await OrderListCtrl.GetOrderItemInfo(orderIds); foreach (var orderItem in orderItems) { var order = orders.FirstOrDefault(o => o.order_id == orderItem.order_id); orderItem.ItemOrder = order; order.orderItems.Add(orderItem); } return orders; } catch (Exception ex) { BaseMsgWindow.ShowAnimateMessage(ex.Message, "Error", 6); return new List(); } } public static async Task> GetOrderInfo(string order_ids) { return await GetOrderInfoBase(order_ids, null, null); } public static async Task> GetWxOrder‌IncrementAsync() { return new List(); } }