From 0cb0b0db71179675ff2466910938fe0045c01701 Mon Sep 17 00:00:00 2001 From: wule Date: Fri, 18 Sep 2026 11:17:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E6=9C=AA=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E5=8F=98=E9=87=8F=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- KJD_WebService/BLL/WXXD/WXOrderManage.cs | 109 +++++++++++++++++++++-- 1 file changed, 101 insertions(+), 8 deletions(-) diff --git a/KJD_WebService/BLL/WXXD/WXOrderManage.cs b/KJD_WebService/BLL/WXXD/WXOrderManage.cs index 9599210..c9adcda 100644 --- a/KJD_WebService/BLL/WXXD/WXOrderManage.cs +++ b/KJD_WebService/BLL/WXXD/WXOrderManage.cs @@ -1290,9 +1290,9 @@ namespace KJD_Web.BLL.WXXD string order_status_prompt = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "order_status_prompt"))?.Replace("'", "\\'"); string after_sales_status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "after_sales_status"))?.Replace("'", "\\'"); string order_detail = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "order_detail"))?.Replace("'", "\\'"); - string wx_order_send_type = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "wx_order_send_type"))?.Replace("'", "\\'"); - if (string.IsNullOrEmpty(wx_order_send_type)) - wx_order_send_type = "1"; + //string wx_order_send_type = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "wx_order_send_type"))?.Replace("'", "\\'"); + //if (string.IsNullOrEmpty(wx_order_send_type)) + // wx_order_send_type = "1"; if (string.IsNullOrEmpty(wx_order_id) || string.IsNullOrEmpty(pdd_order_sn)) return "{\"code\":500,\"msg\":\"订单ID不能为空\"}"; @@ -2666,11 +2666,8 @@ namespace KJD_Web.BLL.WXXD if (!string.IsNullOrEmpty(inputData)) { var timeCalc = DateTime.Now; - - var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt(); - string time1 = RegexUtils.GetStringQuery(ref inputData, "code"); - if (time1 != EncrypUtil.Encryption(time)) - return "{\"code\":50000,\"msg\":\"校验失败\"}"; + if (!WXUserManage.GetSign(inputData)) + return "{\"code\":999,\"msg\":\"签名校验失败\"}"; var erp_order_id_in = RegexUtils.GetStringQuery(ref inputData, "erp_order_id_in")?.Replace("'", "\\'"); var ewaybill_order_id_in = RegexUtils.GetStringQuery(ref inputData, "ewaybill_order_id_in")?.Replace("'", "\\'"); @@ -2763,6 +2760,102 @@ namespace KJD_Web.BLL.WXXD return "{\"code\":19999,\"msg\":\"输入为空\"}"; } + public string WXGetErpEWaybillPathLatestList(string inputData) + { + if (!string.IsNullOrEmpty(inputData)) + { + var timeCalc = DateTime.Now; + if (!WXUserManage.GetSign(inputData)) + return "{\"code\":999,\"msg\":\"签名校验失败\"}"; + + var erp_order_id_in = RegexUtils.GetStringQuery(ref inputData, "erp_order_id_in")?.Replace("'", "\\'"); + var ewaybill_order_id_in = RegexUtils.GetStringQuery(ref inputData, "ewaybill_order_id_in")?.Replace("'", "\\'"); + var waybill_id_in = RegexUtils.GetStringQuery(ref inputData, "waybill_id_in")?.Replace("'", "\\'"); + if (erp_order_id_in.IsNullOrEmpty() && ewaybill_order_id_in.IsNullOrEmpty() && waybill_id_in.IsNullOrEmpty()) + { + return "{\"code\":500,\"msg\":\"未指定要查询的物流轨迹\"}"; + } + //var sort_type = RegexUtils.GetStringQuery(ref inputData, "sort_type")?.Replace("'", "\\'"); + + int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt(); + int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(1000); + + string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; + MysqlUtils mySql = new MysqlUtils(conn); + + string sql = ""; + string where = ""; + if (!string.IsNullOrWhiteSpace(erp_order_id_in)) + where += " and w.order_id in ('" + erp_order_id_in.Replace(",", "','") + "')"; + if (!string.IsNullOrWhiteSpace(ewaybill_order_id_in)) + where += " and w.ewaybill_order_id in ('" + ewaybill_order_id_in.Replace(",", "','") + "')"; + if (!string.IsNullOrWhiteSpace(waybill_id_in)) + where += " and w.waybill_id in ('" + waybill_id_in.Replace(",", "','") + "')"; + sql += where; + + DataTable dt; + { + sql = @" +SELECT * +FROM ( + SELECT *,ROW_NUMBER() OVER (PARTITION BY waybill_id ORDER BY update_time DESC) as rn + FROM `erp`.`oms_wei_ewaybill_path` w"; + sql += " WHERE 1=1 "; + sql += where + @" +) wp +WHERE wp.rn = 1"; + + //where子句 + //sql += where; + + //if (sort_type == "asc") + // sql += " ORDER BY o.id ASC"; + //else + // sql += " ORDER BY o.id DESC"; + sql += " LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size; + dt = mySql.ExecuteDataTable(sql); + } + + mySql.Close(); + if (dt != null) + { + try + { + List orderItemList = new List(); + foreach (DataRow row in dt.Rows) + { + oms_wei_ewaybill_path order = new oms_wei_ewaybill_path + { + id = row["id"].ParseToLong(), + order_id = row["order_id"].ParseToNullableLong(), + create_time = row["create_time"].ParseToString().ParseToDateTime(), + ewaybill_order_id = row["ewaybill_order_id"].ParseToString(), + node_desc = row["node_desc"].ParseToString(), + shop_id = row["shop_id"].ParseToNullableLong(), + status = row["status"].ParseToInt(), + update_time = row["update_time"].ParseToLong(), + waybill_id = row["waybill_id"].ParseToString(), + }; + orderItemList.Add(order); + } + JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore }; + var data = JsonUtils.SerializeObjectToString(orderItemList, jsonSetting); + var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000"); + return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + orderItemList.Count + ",\"seconds\":" + seconds + "}"; + } + catch (Exception ex) + { + return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}"; + } + } + else + { + return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}"; + } + } + return "{\"code\":19999,\"msg\":\"输入为空\"}"; + } + private JsonSerializerSettings JsonSerializer = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver(),