This commit is contained in:
chfei committed 2026-09-18 21:17:30 +08:00
commit 4dbcd6542e
2 files changed
+111 -8

No files matched your search

+101 -8
View File
@@ -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<oms_wei_ewaybill_path> orderItemList = new List<oms_wei_ewaybill_path>();
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(),
@@ -316,5 +316,15 @@ namespace KJD_Web.Controllers.WX
return JsonString(result);
}
public IHttpActionResult wx_get_erp_ewaybill_path_latest_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new WXOrderManage().WXGetErpEWaybillPathLatestList(jsontext);
return JsonString(result);
}
}
}