1.新增供应商一个 云仓退货相关服务逻辑

This commit is contained in:
wule committed 2026-08-17 01:41:32 +08:00
1 parent 917eb94971
commit 456b0534e3
3 files changed
+214

No files matched your search

@@ -2040,5 +2040,117 @@ namespace KJD_Web.BLL.WXXD
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string WXGetErpReturnOrderList(string inputData, bool isDetail = false)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserManage.GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var timeCalc = DateTime.Now;
var erp_order_id_in = RegexUtils.GetStringQuery(ref inputData, "erp_order_id_in")?.Replace("'", "\\'");
if (erp_order_id_in.IsNullOrEmpty())
{
return "{\"code\":500,\"msg\":\"未指定订单\"}";
}
var sort_type = RegexUtils.GetStringQuery(ref inputData, "sort_type")?.Replace("'", "\\'");
var is_not_count = RegexUtils.GetStringQuery(ref inputData, "is_not_count") == "true";
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(500);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT COUNT(id) FROM erp.distrib_return_order o WHERE 1=1 ";
string where = "";
if (!string.IsNullOrWhiteSpace(erp_order_id_in))
where += " and o.order_code_source in ('" + erp_order_id_in.Replace(",", "','") + "')";
sql += where;
var count = 0;
if (!is_not_count)
count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0 && !is_not_count)
{
dt = new DataTable();
}
else
{
sql = "SELECT o.* FROM erp.distrib_return_order o WHERE 1=1";
//where子句
sql += where;
if (sort_type == "asc")
sql += " ORDER BY o.created_at ASC";
else
sql += " ORDER BY o.created_at DESC";
sql += " LIMIT " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<distrib_return_order_info> orderList = new List<distrib_return_order_info>();
foreach (DataRow row in dt.Rows)
{
distrib_return_order_info order = new distrib_return_order_info
{
id = row["id"].ParseToLong(),
additional_weight_fee = row["additional_weight_fee"].ParseToNullableInt(),
after_sale_no = row["after_sale_no"].ParseToNullableString(),
created_at = row["created_at"].ParseToString().ParseToDateTime(),
ext_field1 = row["ext_field1"].ParseToNullableString(),
ext_field2 = row["ext_field2"].ParseToNullableString(),
first_weight_fee = row["first_weight_fee"].ParseToNullableInt(),
logistics_code = row["logistics_code"].ParseToNullableString(),
logistics_express_no = row["logistics_express_no"].ParseToNullableString(),
order_code = row["order_code"].ParseToNullableString(),
order_code_source = row["order_code_source"].ParseToNullableString(),
order_void_status = row["order_void_status"].ParseToNullableInt(),
platform = row["platform"].ParseToNullableString(),
platform_code = row["platform_code"].ParseToNullableString(),
platform_order_no = row["platform_order_no"].ParseToNullableString(),
postage = row["postage"].ParseToNullableInt(),
real_logistics_code = row["real_logistics_code"].ParseToNullableString(),
real_logistics_express_code = row["real_logistics_express_code"].ParseToNullableString(),
receiver_address = row["receiver_address"].ParseToNullableString(),
receiver_area = row["receiver_area"].ParseToNullableString(),
receiver_city = row["receiver_city"].ParseToNullableString(),
receiver_name= row["receiver_name"].ParseToNullableString(),
receiver_phone = row["receiver_phone"].ParseToNullableString(),
receiver_province = row["receiver_province"].ParseToNullableString(),
response_msg = row["response_msg"].ParseToNullableString(),
return_order_status = row["return_order_status"].ParseToNullableInt(),
sender_info = row["sender_info"].ParseToNullableString(),
sender_name = row["sender_name"].ParseToNullableString(),
};
orderList.Add(order);
}
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
var data = JsonUtils.SerializeObjectToString(orderList, jsonSetting);
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + 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\":\"输入为空\"}";
}
}
}
@@ -135,6 +135,7 @@
<Compile Include="Model\Result.cs" />
<Compile Include="Model\ShopModel\JSTListProductSkuInfo.cs" />
<Compile Include="Model\WXAddressInfo.cs" />
<Compile Include="Model\WxModel\distrib_return_order_info.cs" />
<Compile Include="Model\WxModel\oem.cs" />
<Compile Include="Model\WxModel\oms_wei_external_procurement_after_sale_info.cs" />
<Compile Include="Model\WxModel\oms_wei_external_procurement_log.cs" />
@@ -1,6 +1,7 @@
using KJD_Web.BLL;
using KJD_Web.BLL.WXXD;
using KJD_Web.Utils;
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.IO;
@@ -49,6 +50,93 @@ namespace KJD_Web
}
}
[WebMethod]
public void repair_miss_direct_order()
{
return;
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
//var s = "SELECT order_id,out_order_id FROM `wxxd`.`order_item_ext` WHERE add_time > '2026-08-15 15:30' AND buy_type = '直发'";
//var s = "SELECT order_id,out_order_id FROM `wxxd`.`order_item_ext` WHERE add_time > '2026-08-10 15:30' AND add_time < '2026-08-15 15:30' buy_type = '直发'";
var s = "SELECT order_id,out_order_id FROM `wxxd`.`order_item_ext` WHERE order_id in ('3738460213351447040') AND buy_type = '直发'";
var dt1 = mySql.ExecuteDataTable(s);
s = "Select order_id FROM erp.oms_wei_order WHERE order_id in ('" + string.Join("','", dt1.Rows.Cast<System.Data.DataRow>().Select(r => r["order_id"].ParseToLong()))+ "') and out_order_no is null";
dt1 = mySql.ExecuteDataTable(s);
mySql.Close();
conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
mySql = new MysqlUtils(conn);
string sql = "Select * FROM wxxd.order_pdd_buyer_order WHERE wx_order_id in ('" + string.Join("','", dt1.Rows.Cast<System.Data.DataRow>().Select(r => r["order_id"].ParseToLong())) + "')";
var dt = mySql.ExecuteDataTable(sql);
List<Model.WxModel.order_pdd_buyer_order> buyerOrderList = new List<Model.WxModel.order_pdd_buyer_order>();
mySql.Close();
if (dt != null)
{
try
{
foreach (System.Data.DataRow row in dt.Rows)
{
Model.WxModel.order_pdd_buyer_order order = new Model.WxModel.order_pdd_buyer_order
{
id = row["id"].ParseToLong(),
add_time = row["add_time"].ParseToString().ParseToDateTime(),
after_sales_status = row["after_sales_status"].ParseToNullableInt(),
buyerId = row["buyerId"].ParseToString(),
buyerName = row["buyerName"].ParseToString(),
mdy_time = row["mdy_time"].ParseToString().ParseToDateTime(),
order_amount = row["order_amount"].ParseToNullableInt(),
order_detail = row["order_detail"].ParseToString(),
order_sn = row["order_sn"].ParseToString(),
order_status_prompt = row["order_status_prompt"].ParseToString(),
order_time = row["order_time"].ParseToNullableLong(),
outExpressCompanyCode = row["outExpressCompanyCode"].ParseToString(),
pre_allocated_order_no = row["pre_allocated_order_no"].ParseToNullableInt(),
tracking_number = row["tracking_number"].ParseToString(),
TransitCreateTime = row["TransitCreateTime"].ParseToString().ParseToDateTime(),
wx_order_id = row["wx_order_id"].ParseToString(),
wx_sku_id = row["wx_sku_id"].ParseToString(),
wx_send_type = row["wx_send_type"].ParseToInt(),
};
buyerOrderList.Add(order);
}
}
catch (Exception ex)
{
}
}
string err = "";
buyerOrderList = buyerOrderList.OrderBy(b => b.add_time).ToList();
//46
foreach (var pddOrder in buyerOrderList)
{
Newtonsoft.Json.Linq.JObject obj = new Newtonsoft.Json.Linq.JObject();
obj["platform"] = "WEISHOP";
obj["outAmount"] = (pddOrder.order_amount.ParseToDecimal()).ParseToInt() + "";
obj["outAccount"] = pddOrder.buyerName;
obj["orderId"] = pddOrder.wx_order_id;
obj["outOrderNo"] = pddOrder.order_sn;
//if (!order.outExpressCompanyCode.IsNullOrEmpty() && !order.tracking_number.IsNullOrEmpty())
//{
// obj["outExpressCompany"] = order.outExpressCompanyCode;
// obj["outExpressNo"] = order.tracking_number;
//}
var dataStr = JsonUtils.SerializeObject(obj);
var url = "https://po.e57.cn/prod-api/api/oms-api/external_procurement/bind/v2";
//成功 "<ResultVo><code>0</code><msg>SUCCESS</msg><data/><totalRecords/></ResultVo>"
//<AjaxResult><msg>更新微信外采订单状态成功</msg><code>1</code></AjaxResult>
//失败 已存在 <ResultVo><code>1505</code><msg>调用微信接口更新物流信息失败: 非法参数, 同运单号拦截 rid: 69d8ab9c-22baa3b1-67de0d95</msg><data/><totalRecords/></ResultVo>
var exportRst = HttpUtils.e57PostResponse(url, dataStr, "");
if (!exportRst.Contains("<code>1</code>") && !exportRst.Contains("<code>0</code>"))
{
err += "\r\n" + pddOrder.order_sn + " " + exportRst;
}
}
}
[WebMethod]
public void get_erp_order_list()
{
@@ -345,5 +433,18 @@ namespace KJD_Web
Context.Response.Write(result);
Context.Response.End();
}
//WXGetErpReturnOrderList
[WebMethod]
public void wx_get_erp_return_order_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new WXOrderManage().WXGetErpReturnOrderList(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
}
}