增加获取订单任务列表

This commit is contained in:
chfei committed 2026-08-19 15:32:22 +08:00
1 parent a9f7b1f831
commit 3a50a6783b
4 files changed
+459 -271

No files matched your search

@@ -1,15 +1,20 @@
using KJD_Web.Model.WxModel;
using KJD_Web.Model;
using KJD_Web.Model.WxModel;
using KJD_Web.Utils;
using MySql.Data.MySqlClient;
using MySqlX.XDevAPI;
using NaiBa.Util.Extension;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Drawing.Printing;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI.WebControls;
@@ -92,85 +97,85 @@ namespace KJD_Web.BLL.WXXD
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<oms_wei_order> orderList = new List<oms_wei_order>();
foreach (DataRow row in dt.Rows)
{
oms_wei_order order = new oms_wei_order
{
id = row["id"].ParseToLong(),
aftersale_detail = row["aftersale_detail"].ParseToNullableString(),
audit_status = row["audit_status"].ParseToNullableInt(),
//audit_time = row["audit_time"].ParseToNullableString().ParseToDateTime(),
city_name = row["city_name"].ParseToNullableString(),
colour_flag = row["colour_flag"].ParseToNullableInt(),
colour_flag_update_time = row["colour_flag_update_time"].ParseToNullableString().ParseToDateTime(),
commission_amount = row["commission_amount"].ParseToNullableInt(),
county_name = row["county_name"].ParseToNullableString(),
create_time = row["create_time"].ParseToInt(),
delivery_deadline = row["delivery_deadline"].ParseToNullableInt(),
//delivery_product_info = row["delivery_product_info"].ParseToNullableString(),
delivery_time = row["delivery_time"].ParseToNullableInt(),
detail_info = row["detail_info"].ParseToNullableString(),
discounted_price = row["discounted_price"].ParseToNullableInt(),
erp_send_code = row["erp_send_code"].ParseToNullableString(),
erp_send_company = row["erp_send_company"].ParseToNullableString(),
erp_send_status = row["erp_send_status"].ParseToNullableInt(),
erp_send_time = row["erp_send_time"].ParseToNullableString().ParseToDateTime(),
//ewaybill_order_code = row["ewaybill_order_code"].ParseToNullableString(),
external_gift = row["external_gift"].ParseToNullableInt(),
//ext_info = row["ext_info"].ParseToNullableString(),
freight = row["freight"].ParseToNullableInt(),
freight_insurance_amount = row["freight_insurance_amount"].ParseToNullableInt(),
gift_order_status = row["gift_order_status"].ParseToNullableInt(),
hash_code = row["hash_code"].ParseToNullableString(),
has_freight_insurance = row["has_freight_insurance"].ParseToNullableInt(),
house_number = row["house_number"].ParseToNullableString(),
is_express_no_used = row["is_express_no_used"].ParseToNullableInt(),
is_shipment_optimized = row["is_shipment_optimized"].ParseToNullableInt(),
merchant_id = row["merchant_id"].ParseToLong(),
openid = row["openid"].ParseToNullableString(),
order_id = row["order_id"].ParseToNullableString(),
order_price = row["order_price"].ParseToNullableInt(),
out_account = row["out_account"].ParseToNullableString(),
out_after_sale_status = row["out_after_sale_status"].ParseToNullableString(),
out_amount = row["out_amount"].ParseToNullableInt(),
out_express_company = row["out_express_company"].ParseToNullableString(),
out_express_no = row["out_express_no"].ParseToNullableString(),
out_order_no = row["out_order_no"].ParseToNullableString(),
out_shipped = row["out_shipped_int"].ParseToNullableInt(),
//pay_info = row["pay_info"].ParseToNullableString(),
postal_code = row["postal_code"].ParseToNullableString(),
predict_commission_fee = row["predict_commission_fee"].ParseToNullableInt(),
product_price = row["product_price"].ParseToNullableInt(),
profit = row["profit"].ParseToNullableInt(),
province_name = row["province_name"].ParseToNullableString(),
purchase_price = row["purchase_price"].ParseToNullableInt(),
purchase_status = row["purchase_status"].ParseToNullableInt(),
purchase_time = row["purchase_time"].ParseToNullableInt(),
settle_info = row["settle_info"].ParseToNullableString(),
ship_done_time = row["ship_done_time"].ParseToNullableInt(),
shop_id = row["shop_id"].ParseToLong(),
shop_name = row["shop_name"].ParseToNullableString(),
shop_remark = row["shop_remark"].ParseToNullableString(),
soft_remark = row["soft_remark"].ParseToNullableString(),
status = row["status"].ParseToNullableInt(),
supplier_remark_exception = row["supplier_remark_exception"].ParseToNullableString(),
tel_number = row["tel_number"].ParseToNullableString(),
tel_number_ext_info = row["tel_number_ext_info"].ParseToNullableString(),
transfer_warehouse_status = row["transfer_warehouse_status"].ParseToNullableInt(),
unionid = row["unionid"].ParseToNullableString(),
update_time = row["update_time"].ParseToInt(),
user_name = row["user_name"].ParseToNullableString(),
use_tel_number = row["use_tel_number"].ParseToNullableInt(),
virtual_order_tel_number = row["virtual_order_tel_number"].ParseToNullableString(),
};
if (order.order_id == "3737914129536416512")
{
mySql.Close();
if (dt != null)
{
try
{
List<oms_wei_order> orderList = new List<oms_wei_order>();
foreach (DataRow row in dt.Rows)
{
oms_wei_order order = new oms_wei_order
{
id = row["id"].ParseToLong(),
aftersale_detail = row["aftersale_detail"].ParseToNullableString(),
audit_status = row["audit_status"].ParseToNullableInt(),
//audit_time = row["audit_time"].ParseToNullableString().ParseToDateTime(),
city_name = row["city_name"].ParseToNullableString(),
colour_flag = row["colour_flag"].ParseToNullableInt(),
colour_flag_update_time = row["colour_flag_update_time"].ParseToNullableString().ParseToDateTime(),
commission_amount = row["commission_amount"].ParseToNullableInt(),
county_name = row["county_name"].ParseToNullableString(),
create_time = row["create_time"].ParseToInt(),
delivery_deadline = row["delivery_deadline"].ParseToNullableInt(),
//delivery_product_info = row["delivery_product_info"].ParseToNullableString(),
delivery_time = row["delivery_time"].ParseToNullableInt(),
detail_info = row["detail_info"].ParseToNullableString(),
discounted_price = row["discounted_price"].ParseToNullableInt(),
erp_send_code = row["erp_send_code"].ParseToNullableString(),
erp_send_company = row["erp_send_company"].ParseToNullableString(),
erp_send_status = row["erp_send_status"].ParseToNullableInt(),
erp_send_time = row["erp_send_time"].ParseToNullableString().ParseToDateTime(),
//ewaybill_order_code = row["ewaybill_order_code"].ParseToNullableString(),
external_gift = row["external_gift"].ParseToNullableInt(),
//ext_info = row["ext_info"].ParseToNullableString(),
freight = row["freight"].ParseToNullableInt(),
freight_insurance_amount = row["freight_insurance_amount"].ParseToNullableInt(),
gift_order_status = row["gift_order_status"].ParseToNullableInt(),
hash_code = row["hash_code"].ParseToNullableString(),
has_freight_insurance = row["has_freight_insurance"].ParseToNullableInt(),
house_number = row["house_number"].ParseToNullableString(),
is_express_no_used = row["is_express_no_used"].ParseToNullableInt(),
is_shipment_optimized = row["is_shipment_optimized"].ParseToNullableInt(),
merchant_id = row["merchant_id"].ParseToLong(),
openid = row["openid"].ParseToNullableString(),
order_id = row["order_id"].ParseToNullableString(),
order_price = row["order_price"].ParseToNullableInt(),
out_account = row["out_account"].ParseToNullableString(),
out_after_sale_status = row["out_after_sale_status"].ParseToNullableString(),
out_amount = row["out_amount"].ParseToNullableInt(),
out_express_company = row["out_express_company"].ParseToNullableString(),
out_express_no = row["out_express_no"].ParseToNullableString(),
out_order_no = row["out_order_no"].ParseToNullableString(),
out_shipped = row["out_shipped_int"].ParseToNullableInt(),
//pay_info = row["pay_info"].ParseToNullableString(),
postal_code = row["postal_code"].ParseToNullableString(),
predict_commission_fee = row["predict_commission_fee"].ParseToNullableInt(),
product_price = row["product_price"].ParseToNullableInt(),
profit = row["profit"].ParseToNullableInt(),
province_name = row["province_name"].ParseToNullableString(),
purchase_price = row["purchase_price"].ParseToNullableInt(),
purchase_status = row["purchase_status"].ParseToNullableInt(),
purchase_time = row["purchase_time"].ParseToNullableInt(),
settle_info = row["settle_info"].ParseToNullableString(),
ship_done_time = row["ship_done_time"].ParseToNullableInt(),
shop_id = row["shop_id"].ParseToLong(),
shop_name = row["shop_name"].ParseToNullableString(),
shop_remark = row["shop_remark"].ParseToNullableString(),
soft_remark = row["soft_remark"].ParseToNullableString(),
status = row["status"].ParseToNullableInt(),
supplier_remark_exception = row["supplier_remark_exception"].ParseToNullableString(),
tel_number = row["tel_number"].ParseToNullableString(),
tel_number_ext_info = row["tel_number_ext_info"].ParseToNullableString(),
transfer_warehouse_status = row["transfer_warehouse_status"].ParseToNullableInt(),
unionid = row["unionid"].ParseToNullableString(),
update_time = row["update_time"].ParseToInt(),
user_name = row["user_name"].ParseToNullableString(),
use_tel_number = row["use_tel_number"].ParseToNullableInt(),
virtual_order_tel_number = row["virtual_order_tel_number"].ParseToNullableString(),
};
if (order.order_id == "3737914129536416512")
{
}
orderList.Add(order);
@@ -1124,71 +1129,71 @@ namespace KJD_Web.BLL.WXXD
// "order_time=VALUES(@order_time),outExpressCompanyCode=VALUES(@outExpressCompanyCode),tracking_number=VALUES(@tracking_number),order_status_prompt=VALUES(@order_status_prompt)," +
// "after_sales_status=VALUES(@after_sales_status),order_detail=VALUES(@order_detail)";
if (id == 0)
{
sql = "INSERT INTO wxxd.order_pdd_buyer_order (wx_order_id,wx_sku_id,wx_send_type,TransitCreateTime,pre_allocated_order_no,buyerId,buyerName,order_sn,order_amount,order_time," +
"outExpressCompanyCode,tracking_number,order_status_prompt,after_sales_status,order_detail)";
sql += "VALUES(@wx_order_id,@wx_sku_id,@wx_send_type,@TransitCreateTime,@pre_allocated_order_no,@buyerId,@buyerName,@pdd_order_sn,@order_amount,@order_time," +
"@outExpressCompanyCode,@tracking_number,@order_status_prompt,@after_sales_status,@order_detail);";
}
else
{
sql = "UPDATE wxxd.order_pdd_buyer_order SET ";
if (!string.IsNullOrEmpty(wx_order_id))
sql += " wx_order_id=@wx_order_id,";
if (!string.IsNullOrEmpty(wx_sku_id))
sql += " wx_sku_id=@wx_sku_id,";
if (!string.IsNullOrEmpty(wx_send_type))
sql += " wx_send_type=@wx_send_type,";
if (!string.IsNullOrEmpty(TransitCreateTime))
sql += " TransitCreateTime=@TransitCreateTime,";
if (!string.IsNullOrEmpty(pre_allocated_order_no))
sql += " pre_allocated_order_no=@pre_allocated_order_no,";
if (!string.IsNullOrEmpty(buyerId))
sql += " buyerId=@buyerId,";
if (!string.IsNullOrEmpty(buyerName))
sql += " buyerName=@buyerName,";
if (!string.IsNullOrEmpty(order_amount))
sql += " order_amount=@order_amount,";
if (!string.IsNullOrEmpty(order_time))
sql += " order_time=@order_time,";
if (!string.IsNullOrEmpty(outExpressCompanyCode))
sql += " outExpressCompanyCode=@outExpressCompanyCode,";
if (!string.IsNullOrEmpty(tracking_number))
sql += " tracking_number=@tracking_number,";
if (!string.IsNullOrEmpty(order_status_prompt))
sql += " order_status_prompt=@order_status_prompt,";
if (!string.IsNullOrEmpty(after_sales_status))
sql += " after_sales_status=@after_sales_status,";
if (!string.IsNullOrEmpty(order_detail))
sql += " order_detail=@order_detail,";
sql = sql.TrimEnd(',');
sql += " where order_sn=@pdd_order_sn";
}
//260705-105706954352823
if (id == 0)
{
sql = "INSERT INTO wxxd.order_pdd_buyer_order (wx_order_id,wx_sku_id,wx_send_type,TransitCreateTime,pre_allocated_order_no,buyerId,buyerName,order_sn,order_amount,order_time," +
"outExpressCompanyCode,tracking_number,order_status_prompt,after_sales_status,order_detail)";
sql += "VALUES(@wx_order_id,@wx_sku_id,@wx_send_type,@TransitCreateTime,@pre_allocated_order_no,@buyerId,@buyerName,@pdd_order_sn,@order_amount,@order_time," +
"@outExpressCompanyCode,@tracking_number,@order_status_prompt,@after_sales_status,@order_detail);";
}
else
{
sql = "UPDATE wxxd.order_pdd_buyer_order SET ";
if (!string.IsNullOrEmpty(wx_order_id))
sql += " wx_order_id=@wx_order_id,";
if (!string.IsNullOrEmpty(wx_sku_id))
sql += " wx_sku_id=@wx_sku_id,";
if (!string.IsNullOrEmpty(wx_send_type))
sql += " wx_send_type=@wx_send_type,";
if (!string.IsNullOrEmpty(TransitCreateTime))
sql += " TransitCreateTime=@TransitCreateTime,";
if (!string.IsNullOrEmpty(pre_allocated_order_no))
sql += " pre_allocated_order_no=@pre_allocated_order_no,";
if (!string.IsNullOrEmpty(buyerId))
sql += " buyerId=@buyerId,";
if (!string.IsNullOrEmpty(buyerName))
sql += " buyerName=@buyerName,";
if (!string.IsNullOrEmpty(order_amount))
sql += " order_amount=@order_amount,";
if (!string.IsNullOrEmpty(order_time))
sql += " order_time=@order_time,";
if (!string.IsNullOrEmpty(outExpressCompanyCode))
sql += " outExpressCompanyCode=@outExpressCompanyCode,";
if (!string.IsNullOrEmpty(tracking_number))
sql += " tracking_number=@tracking_number,";
if (!string.IsNullOrEmpty(order_status_prompt))
sql += " order_status_prompt=@order_status_prompt,";
if (!string.IsNullOrEmpty(after_sales_status))
sql += " after_sales_status=@after_sales_status,";
if (!string.IsNullOrEmpty(order_detail))
sql += " order_detail=@order_detail,";
sql = sql.TrimEnd(',');
sql += " where order_sn=@pdd_order_sn";
}
//260705-105706954352823
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "wx_order_id", Value = wx_order_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "wx_sku_id", Value = wx_sku_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "wx_send_type", Value = wx_send_type.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.DateTime, ParameterName = "TransitCreateTime", Value = TransitCreateTime.ParseToDateTime(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "pre_allocated_order_no", Value = pre_allocated_order_no.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "buyerId", Value = buyerId, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "buyerName", Value = buyerName, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "pdd_order_sn", Value = pdd_order_sn, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "order_amount", Value = order_amount.ParseToNullableInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int64, ParameterName = "order_time", Value = order_time.ParseToLong(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "outExpressCompanyCode", Value = outExpressCompanyCode, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "tracking_number", Value = tracking_number, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "order_status_prompt", Value = order_status_prompt, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "after_sales_status", Value = after_sales_status.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "order_detail", Value = order_detail, });
//sql = " update `wxxd`.`order_pdd_buyer_order` set ";
//if (!string.IsNullOrEmpty(soft_remark))
// sql += " soft_remark=" + soft_remark + ",";
//sql = sql.TrimEnd(',');
//sql += " where order_id = '" + wx_order_id + "';";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "wx_order_id", Value = wx_order_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "wx_sku_id", Value = wx_sku_id, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "wx_send_type", Value = wx_send_type.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.DateTime, ParameterName = "TransitCreateTime", Value = TransitCreateTime.ParseToDateTime(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "pre_allocated_order_no", Value = pre_allocated_order_no.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "buyerId", Value = buyerId, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "buyerName", Value = buyerName, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "pdd_order_sn", Value = pdd_order_sn, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "order_amount", Value = order_amount.ParseToNullableInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int64, ParameterName = "order_time", Value = order_time.ParseToLong(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "outExpressCompanyCode", Value = outExpressCompanyCode, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "tracking_number", Value = tracking_number, });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "order_status_prompt", Value = order_status_prompt, });
paramLst.Add(new MySqlParameter() { DbType = DbType.Int32, ParameterName = "after_sales_status", Value = after_sales_status.ParseToInt(), });
paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "order_detail", Value = order_detail, });
//sql = " update `wxxd`.`order_pdd_buyer_order` set ";
//if (!string.IsNullOrEmpty(soft_remark))
// sql += " soft_remark=" + soft_remark + ",";
//sql = sql.TrimEnd(',');
//sql += " where order_id = '" + wx_order_id + "';";
count = mySql.ExecuteAffectedRows(sql, paramLst.ToArray());
mySql.Close();
@@ -1260,54 +1265,54 @@ namespace KJD_Web.BLL.WXXD
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<order_pdd_buyer_order> buyerOrderList = new List<order_pdd_buyer_order>();
foreach (DataRow row in dt.Rows)
{
order_pdd_buyer_order order = new 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);
}
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
var data = JsonUtils.SerializeObjectToString(buyerOrderList, 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\":\"输入为空\"}";
}
mySql.Close();
if (dt != null)
{
try
{
List<order_pdd_buyer_order> buyerOrderList = new List<order_pdd_buyer_order>();
foreach (DataRow row in dt.Rows)
{
order_pdd_buyer_order order = new 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);
}
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
var data = JsonUtils.SerializeObjectToString(buyerOrderList, 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\":\"输入为空\"}";
}
public string WXAddMdyBuyerAfterSale(string inputData)
@@ -1734,67 +1739,67 @@ namespace KJD_Web.BLL.WXXD
}
/// <summary>
/// 订单拒收状态维护
/// </summary>
/// <param name="inputData"></param>
/// <returns></returns>
public string WXUpdateTransitOrderRejectStatus(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserManage.GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
/// <summary>
/// 订单拒收状态维护
/// </summary>
/// <param name="inputData"></param>
/// <returns></returns>
public string WXUpdateTransitOrderRejectStatus(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserManage.GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var order_no = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "order_no"))?.Replace("'", "\\'");
var order_sku_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "order_sku_id"))?.Replace("'", "\\'");
var order_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "order_code"))?.Replace("'", "\\'");
var has_reject = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "has_reject"))?.Replace("'", "\\'");
if (order_code.IsNullOrEmpty() && (order_no.IsNullOrEmpty() || order_sku_id.IsNullOrEmpty()))
{
return "{\"code\":500,\"msg\":\"拒收信息不完整\",\"affected_rows\":" + 0 + "}";
}
var order_no = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "order_no"))?.Replace("'", "\\'");
var order_sku_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "order_sku_id"))?.Replace("'", "\\'");
var order_code = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "order_code"))?.Replace("'", "\\'");
var has_reject = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "has_reject"))?.Replace("'", "\\'");
if (order_code.IsNullOrEmpty() && (order_no.IsNullOrEmpty() || order_sku_id.IsNullOrEmpty()))
{
return "{\"code\":500,\"msg\":\"拒收信息不完整\",\"affected_rows\":" + 0 + "}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn, true);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn, true);
string sql;
string sql;
sql = "UPDATE erp.oms_wei_external_procurement_log SET ";
sql += " has_reject=" + has_reject + ",";
sql = sql.TrimEnd(',');
if (!order_code.IsNullOrEmpty())
sql += " WHERE order_code='" + order_code + "' AND order_no='" + order_code + "';";
else
sql += " WHERE order_no='" + order_no + "' AND order_sku_id='" + order_sku_id + "';";
var rows = mySql.ExecuteAffectedRows(sql);
if (!mySql.Message.IsNullOrEmpty())
{
mySql.RollBack();
mySql.Close();
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"affected_rows\":" + rows + "}";
}
if (rows == 0)
{
mySql.RollBack();
mySql.Close();
return "{\"code\":500,\"msg\":\"更新拒收状态失败,未找到记录\",\"affected_rows\":" + rows + "}";
}
mySql.Commit();
mySql.Close();
return "{\"code\":200,\"msg\":\"success\",\"affected_rows\":" + rows + "}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
sql = "UPDATE erp.oms_wei_external_procurement_log SET ";
sql += " has_reject=" + has_reject + ",";
sql = sql.TrimEnd(',');
if (!order_code.IsNullOrEmpty())
sql += " WHERE order_code='" + order_code + "' AND order_no='" + order_code + "';";
else
sql += " WHERE order_no='" + order_no + "' AND order_sku_id='" + order_sku_id + "';";
var rows = mySql.ExecuteAffectedRows(sql);
if (!mySql.Message.IsNullOrEmpty())
{
mySql.RollBack();
mySql.Close();
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"affected_rows\":" + rows + "}";
}
if (rows == 0)
{
mySql.RollBack();
mySql.Close();
return "{\"code\":500,\"msg\":\"更新拒收状态失败,未找到记录\",\"affected_rows\":" + rows + "}";
}
mySql.Commit();
mySql.Close();
return "{\"code\":200,\"msg\":\"success\",\"affected_rows\":" + rows + "}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string WXAddOrderItemExtInfo(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserManage.GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var timeCalc = DateTime.Now;
public string WXAddOrderItemExtInfo(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
if (!WXUserManage.GetSign(inputData))
return "{\"code\":999,\"msg\":\"校验失败\"}";
var timeCalc = DateTime.Now;
string order_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "wx_order_id"))?.Replace("'", "\\'");
string sku_id = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "wx_sku_id"))?.Replace("'", "\\'");
@@ -2107,31 +2112,31 @@ namespace KJD_Web.BLL.WXXD
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(),
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(),
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);
}
@@ -2152,5 +2157,101 @@ namespace KJD_Web.BLL.WXXD
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
/// <summary>
/// 获取wx订单状态
/// <returns></returns>
public string GetWxTaskStatus(string inputData, bool isDetail = false)
{
if (string.IsNullOrEmpty(inputData))
return "{\"code\":19999,\"msg\":\"参数为空\"}";
if (!WXUserManage.GetSign(inputData))
return "{\"code\":999,\"msg\":\"签名校验失败\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name");
var timeCalc = DateTime.Now;
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
// ---------- 1. 查主任务 ----------
string taskSql = $"SELECT A.id, A.task_type, A.task_describe, A.shop_ids, B.`name` as shop_name, A.object_ids, A.sub_task_num, A.success_task_num, A.fail_task_num, A.`status`, A.create_by, A.update_by, A.remark, A.task_fail_reason, A.create_time, A.update_time FROM erp.o_user_operate_task AS A INNER JOIN erp.o_shop AS B ON A.shop_ids = B.id WHERE task_type in(25,31) AND A.create_by = '{user_name}' ORDER BY create_time DESC, id DESC; ";
DataTable taskDt = null;
try
{
taskDt = mySql.ExecuteDataTable(taskSql);
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
if (taskDt != null)
{
List<user_operate_task_info> orderList = new List<user_operate_task_info>();
foreach (DataRow row in taskDt.Rows)
{
var g = new user_operate_task_info
{
id = row["id"].ParseToLong(),
task_type = row["task_type"].ParseToNullableInt(),
task_describe = row["task_describe"].ParseToNullableString(),
shop_ids = row["shop_ids"].ParseToNullableString(),
shop_name = row["shop_name"].ParseToNullableString(),
object_ids = row["object_ids"].ParseToNullableString(),
sub_task_num = row["sub_task_num"].ParseToNullableInt(),
success_task_num = row["success_task_num"].ParseToNullableInt(),
fail_task_num = row["fail_task_num"].ParseToNullableInt(),
status = row["status"].ParseToInt(),
create_by = row["create_by"].ParseToNullableString(),
update_by = row["update_by"].ParseToNullableString(),
remark = row["remark"].ParseToNullableString(),
task_fail_reason = row["task_fail_reason"].ParseToNullableString(),
create_time = row["create_time"].ParseToString().ParseToDateTimeNullable(),
update_time = row["update_time"].ParseToString().ParseToDateTimeNullable(),
};
orderList.Add(g);
}
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
var data = JsonUtils.SerializeObjectToString(orderList.Select(a => new {
id = a.id,
taskType = a.task_type,
taskDescribe = a.task_describe,
ShopId = a.shop_ids,
shopName = a.shop_name,
ObjectIds = a.object_ids,
subTaskNum = a.sub_task_num,
successTaskNum = a.success_task_num,
failTaskNum = a.fail_task_num,
status = a.status,
createBy = a.create_by,
updateBy = a.update_by,
remark = a.remark,
taskFailReason = a.task_fail_reason,
createTime = a.create_time,
updateTime = a.update_time
}), jsonSetting);
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + "}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
private JsonSerializerSettings JsonSerializer = new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver(),
NullValueHandling = NullValueHandling.Ignore
};
}
}
@@ -145,6 +145,7 @@
<Compile Include="Model\WxModel\order_item_ext.cs" />
<Compile Include="Model\WxModel\order_pdd_buyer_after_sale.cs" />
<Compile Include="Model\WxModel\order_pdd_buyer_order.cs" />
<Compile Include="Model\WxModel\user_operate_task_status_info.cs" />
<Compile Include="Model\WxModel\user_payment_record_info.cs" />
<Compile Include="Model\WxModel\user_points_record_info.cs" />
<Compile Include="Model\WxModel\WXBuyUrlNotesInfo.cs" />
@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace KJD_Web.Model.WxModel
{
/// <summary>
/// 用户操作任务状态(主任务,对应 o_user_operate_task)
/// </summary>
public class user_operate_task_info
{
/// <summary>主键id</summary>
public long id;
/// <summary>任务类型,25:微信订单拉取任务</summary>
public int? task_type;
/// <summary>任务描述,描述任务设置的相关规则</summary>
public string task_describe;
/// <summary>平台编码</summary>
public string task_platform_code;
/// <summary>售价加价比例</summary>
public int? sale_markup_rate;
/// <summary>售价固定加价金额,单位为(分)</summary>
public int? sale_markup_fixed;
/// <summary>运费加价比例</summary>
public int? freight_markup_rate;
/// <summary>门店id列表</summary>
public string shop_ids;
public string shop_name;
/// <summary>任务对象id列表,多个,分割</summary>
public string object_ids;
/// <summary>子任务总数</summary>
public int? sub_task_num;
/// <summary>成功子任务数</summary>
public int? success_task_num;
/// <summary>失败子任务数</summary>
public int? fail_task_num;
/// <summary>sku最低价阈值(单位为分)</summary>
public int? sku_low_price_threshold;
/// <summary>任务状态:1:执行中,2:已完成,3:已人为中断</summary>
public int status;
/// <summary>创建人</summary>
public string create_by;
/// <summary>更新人</summary>
public string update_by;
/// <summary>备注</summary>
public string remark;
/// <summary>任务失败原因</summary>
public string task_fail_reason;
/// <summary>创建时间</summary>
public DateTime? create_time;
/// <summary>更新时间</summary>
public DateTime? update_time;
}
}
@@ -480,5 +480,18 @@ namespace KJD_Web
Context.Response.Write(result);
Context.Response.End();
}
}
[WebMethod]
public void wx_get_task_status_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new WXOrderManage().GetWxTaskStatus(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
}
}