订单功能服务端新增 商品编辑功能优化等

This commit is contained in:
wule committed 2026-06-19 16:53:34 +08:00
1 parent 33eafd6781
commit f2534535f7
22 files changed
+911 -98

No files matched your search

@@ -0,0 +1,172 @@
using KJD_Web.Model.WxModel;
using KJD_Web.Utils;
using NaiBa.Util.Extension;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;
namespace KJD_Web.BLL.WXXD
{
public class WXOrderManage
{
public string WXGetErpOrderList(string inputData, bool isDetail = false)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = RegexUtils.GetStringQuery(ref inputData, "time").ParseToInt();
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
var erp_shop_id_in = RegexUtils.GetStringQuery(ref inputData, "erp_shop_id_in")?.Replace("'", "\\'");
if (erp_shop_id_in.IsNullOrEmpty())
{
return "{\"code\":500,\"msg\":\"未指定店铺\"}";
}
var query_status = RegexUtils.GetStringQuery(ref inputData, "query_status")?.Replace("'", "\\'");
var purchase_status = RegexUtils.GetStringQuery(ref inputData, "purchase_status")?.Replace("'", "\\'");
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(50);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "SELECT COUNT(id) FROM erp.oms_wei_order o WHERE 1=1 ";
string where = "";
if (!string.IsNullOrWhiteSpace(erp_shop_id_in))
where += " and o.shop_id in (" + erp_shop_id_in + ")";
if (!string.IsNullOrWhiteSpace(query_status))
where += " and o.status = " + query_status;
if (!string.IsNullOrWhiteSpace(purchase_status))
where += " and o.purchase_status = " + purchase_status;
sql += where;
var count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "SELECT o.* FROM" +
" erp.oms_wei_order o " +
" WHERE 1=1";
//where子句
sql += where;
if (sort_type == "asc")
//sql += " ORDER BY o.create_time ASC, o.id desc";
sql += " ORDER BY o.create_time ASC";
else
sql += " ORDER BY o.create_time 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_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"].ParseToString(),
audit_status = row["audit_status"].ParseToNullableInt(),
audit_time = row["audit_time"].ParseToString().ParseToDateTime(),
city_name = row["city_name"].ParseToString(),
colour_flag = row["colour_flag"].ParseToNullableInt(),
colour_flag_update_time = row["colour_flag_update_time"].ParseToString().ParseToDateTime(),
commission_amount = row["commission_amount"].ParseToNullableInt(),
county_name = row["county_name"].ParseToString(),
create_time = row["create_time"].ParseToInt(),
delivery_deadline = row["delivery_deadline"].ParseToNullableInt(),
delivery_product_info = row["delivery_product_info"].ParseToString(),
delivery_time = row["delivery_time"].ParseToNullableInt(),
detail_info = row["detail_info"].ParseToString(),
discounted_price = row["discounted_price"].ParseToNullableInt(),
erp_send_code = row["erp_send_code"].ParseToString(),
erp_send_company = row["erp_send_company"].ParseToString(),
erp_send_status = row["erp_send_status"].ParseToNullableInt(),
erp_send_time = row["erp_send_time"].ParseToString().ParseToDateTime(),
ewaybill_order_code = row["ewaybill_order_code"].ParseToString(),
external_gift = row["external_gift"].ParseToNullableInt(),
ext_info = row["ext_info"].ParseToString(),
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"].ParseToString(),
has_freight_insurance = row["has_freight_insurance"].ParseToNullableInt(),
house_number = row["house_number"].ParseToString(),
is_express_no_used = row["is_express_no_used"].ParseToNullableInt(),
is_shipment_optimized = row["is_shipment_optimized"].ParseToNullableInt(),
merchant_id = row["merchant_id"].ParseToString(),
openid = row["openid"].ParseToString(),
order_id = row["order_id"].ParseToString(),
order_price = row["order_price"].ParseToNullableInt(),
out_account = row["out_account"].ParseToString(),
out_after_sale_status = row["out_after_sale_status"].ParseToString(),
out_amount = row["out_amount"].ParseToNullableInt(),
out_express_company = row["out_express_company"].ParseToString(),
out_express_no = row["out_express_no"].ParseToString(),
out_order_no = row["out_order_no"].ParseToString(),
out_shipped = row["out_shipped"].ParseToNullableInt(),
pay_info = row["pay_info"].ParseToString(),
postal_code = row["postal_code"].ParseToString(),
predict_commission_fee = row["predict_commission_fee"].ParseToNullableInt(),
product_price = row["product_price"].ParseToNullableInt(),
province_name = row["province_name"].ParseToString(),
purchase_price = row["purchase_price"].ParseToNullableInt(),
purchase_status = row["purchase_status"].ParseToNullableInt(),
purchase_time = row["purchase_time"].ParseToNullableInt(),
settle_info = row["settle_info"].ParseToString(),
ship_done_time = row["ship_done_time"].ParseToNullableInt(),
shop_id = row["shop_id"].ParseToLong(),
shop_name = row["shop_name"].ParseToString(),
shop_remark = row["shop_remark"].ParseToString(),
soft_remark = row["soft_remark"].ParseToString(),
status = row["status"].ParseToNullableInt(),
supplier_remark_exception = row["supplier_remark_exception"].ParseToString(),
tel_number = row["tel_number"].ParseToString(),
tel_number_ext_info = row["tel_number_ext_info"].ParseToString(),
transfer_warehouse_status = row["transfer_warehouse_status"].ParseToNullableInt(),
unionid = row["unionid"].ParseToString(),
update_time = row["update_time"].ParseToInt(),
user_name = row["user_name"].ParseToString(),
use_tel_number = row["use_tel_number"].ParseToNullableInt(),
virtual_order_tel_number = row["virtual_order_tel_number"].ParseToString(),
};
orderList.Add(order);
}
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
var data = JsonUtils.SerializeObjectToString(orderList, jsonSetting);
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + "}";
}
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\":\"输入为空\"}";
}
}
}
@@ -39,6 +39,7 @@ namespace KJD_Web.BLL.WXXD
var operate_sub_sa_name = RegexUtils.GetStringQuery(ref inputData, "operate_sub_sa_name")?.Replace("'", "\\'");
var shop_ids = RegexUtils.GetStringQuery(ref inputData, "shop_ids")?.Replace("'", "");
var is_show_expire = RegexUtils.GetStringQuery(ref inputData, "is_show_expire")?.ParseToBool();
var is_get_erp_shop_id = RegexUtils.GetStringQuery(ref inputData, "is_get_erp_shop_id")?.ParseToBool();
if (!string.IsNullOrWhiteSpace(shop_ids))
{
@@ -144,7 +145,6 @@ namespace KJD_Web.BLL.WXXD
if (dt != null)
{
List<ShopParam> shopList = new List<ShopParam>();
List<ShopParam> allShopList = new List<ShopParam>();
foreach (DataRow row in dt.Rows)
{
ShopParam shop = new ShopParam
@@ -182,11 +182,38 @@ namespace KJD_Web.BLL.WXXD
shopList.Add(shop);
}
var valid_data = JsonUtils.SerializeObjectToString(shopList);
var all_data = JsonUtils.SerializeObjectToString(allShopList);
if (is_get_erp_shop_id == true)
{
conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
mySql = new MysqlUtils(conn);
sql = " SELECT app_key,id " +
" FROM erp.o_shop" +
" WHERE app_key in ('" + string.Join ("','", shopList.Select(s=>s.shop_id)) + "');";
dt = mySql.ExecuteDataTable(sql);
mySql.Close();
if (!string.IsNullOrEmpty(mySql.Message))
{
return "{\"code\":501,\"msg\":\"" + mySql.Message + "\",\"data\":null}";
}
if (dt != null)
{
foreach (DataRow row in dt.Rows)
{
var erpDbId = row["id"].ParseToNullableLong();
var appKey = row["app_key"].ParseToString();
var shop = shopList.FirstOrDefault(s => s.shop_id == appKey && !s.shop_id.IsNullOrEmpty());
if (shop != null)
shop.erp_shop_id = erpDbId;
}
}
}
var data = JsonUtils.SerializeObjectToString(shopList);
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
return "{\"code\":200,\"msg\":\"success\",\"data\":" + valid_data + ",\"count\":" + count + ",\"seconds\":" + seconds + "}";
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + ",\"seconds\":" + seconds + "}";
}
}
return "{\"code\":19999,\"msg\":\"未知错误\"}";
+5
View File
@@ -155,6 +155,11 @@ namespace KJD_Web
hPath = hPath.Replace("/wxxd_price/", "/WXPriceService.asmx/");
Context.RewritePath(hPath);
}
else if (!hPath.Contains(".asmx") && hPath.Contains("/wxxd_order/"))
{
hPath = hPath.Replace("/wxxd_order/", "/WXOrderService.asmx/");
Context.RewritePath(hPath);
}
}
protected void Application_AuthenticateRequest(object sender, EventArgs e)
@@ -75,6 +75,7 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Content Include="WXOrderService.asmx" />
<Content Include="Upload\Prod\WXProdHot.aspx" />
<Content Include="Upload\Prod\WXProd.aspx" />
<Content Include="WXProductService.asmx" />
@@ -115,6 +116,7 @@
<Compile Include="BLL\KJD\UpdateManage.cs" />
<Compile Include="BLL\KJD\UserManage.cs" />
<Compile Include="BLL\WXXD\WXExpressOptimizeManage.cs" />
<Compile Include="BLL\WXXD\WXOrderManage.cs" />
<Compile Include="BLL\WXXD\WXProductManage.cs" />
<Compile Include="BLL\WXXD\WXShopManage.cs" />
<Compile Include="BLL\WXXD\WXUserManage.cs" />
@@ -128,6 +130,7 @@
<Compile Include="Model\PddModel\PDDProductPropertyInfo.cs" />
<Compile Include="Model\ShopModel\JSTListProductSkuInfo.cs" />
<Compile Include="Model\WXAddressInfo.cs" />
<Compile Include="Model\WxModel\oms_wei_order.cs" />
<Compile Include="Model\WxModel\WXBuyUrlNotesInfo.cs" />
<Compile Include="Model\WxModel\WXClientProductInfoLite.cs" />
<Compile Include="Model\WxModel\WXGetEditProductInfoLite.cs" />
@@ -135,6 +138,10 @@
<Compile Include="Model\WxModel\WXOrderDecryptAddressInfo.cs" />
<Compile Include="Model\WxProdSecretSpuIdShopIdMapParam.cs" />
<Compile Include="Model\WXShopDefaultAddressInfo.cs" />
<Compile Include="WXOrderService.asmx.cs">
<DependentUpon>WXOrderService.asmx</DependentUpon>
<SubType>Component</SubType>
</Compile>
<Compile Include="Upload\Prod\BaseClass.cs" />
<Compile Include="Upload\Prod\BaseWxProd.cs" />
<Compile Include="Upload\Prod\WXProdHot.aspx.cs">
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<UseIISExpress>true</UseIISExpress>
@@ -8,7 +8,7 @@
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
<UseGlobalApplicationHostFile />
<LastActiveSolutionConfig>Release|Any CPU</LastActiveSolutionConfig>
<LastActiveSolutionConfig>Debug|Any CPU</LastActiveSolutionConfig>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
<ProjectExtensions>
@@ -71,6 +71,7 @@ namespace KJD_Web.Model.ShopModel
public DateTime add_time { get; set; }
//public DateTime mdy_time { get; set; }
public bool? is_point_shop_expire { get; set; } = false;
public long? erp_shop_id { get; internal set; }
}
public class AuthInfo
@@ -0,0 +1,241 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace KJD_Web.Model.WxModel
{
public class oms_wei_order
{
public long id { get; set; }
public long shop_id { get; set; }
public string shop_name { get; set; }
/// <summary>
/// 商户ID
/// </summary>
public string merchant_id { get; set; }
public string order_id { get; set; }
/// <summary>
/// 买家身份标识
/// </summary>
public string openid { get; set; }
public int create_time { get; set; }
public int update_time { get; set; }
public string unionid { get; set; }
/// <summary>
/// 状态10 待付款;20 待发货;21 部分发货;30 待收货;100 完成;200 全部商品售后之后,订单取消;250 未付款用户主动取消或超时未付款订单自动取消;
/// </summary>
public int? status { get; set; }
/// <summary>
/// 售后信息json
/// </summary>
public string aftersale_detail { get; set; }
/// <summary>
/// 支付信息
/// </summary>
public string pay_info { get; set; }
/// <summary>
/// 额外信息
/// </summary>
public string ext_info { get; set; }
/// <summary>
/// 商品总价
/// </summary>
public int? product_price { get; set; }
/// <summary>
/// 订单金额,单位为分,order_price=original_order_price-discounted_price-deduction_price-change_down_price
/// </summary>
public int? order_price { get; set; }
/// <summary>
/// 采购价,单位为分
/// </summary>
public int? purchase_price { get; set; }
/// <summary>
/// 采购时间
/// </summary>
public int? purchase_time { get; set; }
/// <summary>
/// 运费,单位为分
/// </summary>
public int? freight { get; set; }
/// <summary>
/// 平台服务费(微信小店:预计技术服务费),单位为分
/// </summary>
public int? predict_commission_fee { get; set; }
/// <summary>
/// 达人佣金(微信小店:分账金额),单位为分
/// </summary>
public int? commission_amount { get; set; }
/// <summary>
/// 优惠券优惠金额,单位为分
/// </summary>
public int? discounted_price { get; set; }
/// <summary>
/// 采购状态,默认值为:0未采购,推送仓库时修改为1采购
/// </summary>
public int? purchase_status { get; set; }
/// <summary>
/// 延迟发货时间(微信小店:商品发货时效,超时此时间未发货即为发货超时)
/// </summary>
public int? delivery_deadline { get; set; }
/// <summary>
/// 发货时间
/// </summary>
public int? delivery_time { get; set; }
/// <summary>
/// 收货人姓名
/// </summary>
public string user_name { get; set; }
/// <summary>
/// 邮编
/// </summary>
public string postal_code { get; set; }
public string province_name { get; set; }
public string city_name { get; set; }
/// <summary>
/// 区
/// </summary>
public string county_name { get; set; }
/// <summary>
/// 详细地址
/// </summary>
public string detail_info { get; set; }
public string tel_number { get; set; }
/// <summary>
/// 门牌号码
/// </summary>
public string house_number { get; set; }
/// <summary>
/// 虚拟发货订单联系方式(deliver_method=1时返回)
/// </summary>
public string virtual_order_tel_number { get; set; }
/// <summary>
/// 额外的联系方式信息(虚拟号码相关)
/// </summary>
public string tel_number_ext_info { get; set; }
/// <summary>
/// 0:不使用虚拟号码,1:使用虚拟号码
/// </summary>
public int? use_tel_number { get; set; }
/// <summary>
/// 标识当前店铺下一个唯一的用户收货地址
/// </summary>
public string hash_code { get; set; }
/// <summary>
/// 发货物流信息JSON
/// </summary>
public string delivery_product_info { get; set; }
/// <summary>
/// 发货完成时间,秒级时间戳
/// </summary>
public int? ship_done_time { get; set; }
/// <summary>
/// 电子面单代发时的订单密文
/// </summary>
public string ewaybill_order_code { get; set; }
/// <summary>
/// 结算信息json
/// </summary>
public string settle_info { get; set; }
/// <summary>
/// 订单审核状态(0待审核1已审核)
/// </summary>
public int? audit_status { get; set; }
/// <summary>
/// 订单审核时间
/// </summary>
public DateTime audit_time { get; set; }
/// <summary>
/// erp发货快递公司
/// </summary>
public string erp_send_company { get; set; }
/// <summary>
/// erp发货快递单号
/// </summary>
public string erp_send_code { get; set; }
/// <summary>
/// erp发货状态
/// </summary>
public int? erp_send_status { get; set; }
/// <summary>
/// erp发货时间
/// </summary>
public DateTime erp_send_time { get; set; }
/// <summary>
/// 旗帜颜色备注,1:灰旗,2:红旗,3:橙旗,4:绿旗,5:天蓝旗,6:紫旗
/// </summary>
public int? colour_flag { get; set; }
/// <summary>
/// 旗帜备注时间
/// </summary>
public DateTime colour_flag_update_time { get; set; }
/// <summary>
/// 供应商备注异常单
/// </summary>
public string supplier_remark_exception { get; set; }
/// <summary>
/// 礼物单状态,默认值0:不存在礼物单,1:礼物单已发货,2:礼物单信息已更正
/// </summary>
public int? gift_order_status { get; set; }
/// <summary>
/// 店铺备注:取微信ext_info.merchant_notes
/// </summary>
public string shop_remark { get; set; }
/// <summary>
/// 软件备注
/// </summary>
public string soft_remark { get; set; }
/// <summary>
/// 外采金额(单位:分,整数存储)
/// </summary>
public int? out_amount { get; set; }
/// <summary>
/// 外采账户
/// </summary>
public string out_account { get; set; }
/// <summary>
/// 外采订单号
/// </summary>
public string out_order_no { get; set; }
/// <summary>
/// 外采快递公司
/// </summary>
public string out_express_company { get; set; }
/// <summary>
/// 外采快递单号
/// </summary>
public string out_express_no { get; set; }
/// <summary>
/// 外采是否发货(0 未发货,1 已发货)
/// </summary>
public int? out_shipped { get; set; }
/// <summary>
/// 判断是否优化过发货0 未优化, 1已优化
/// </summary>
public int? is_shipment_optimized { get; set; }
/// <summary>
/// 判断是否优随机使用快递单号0 未使用, 1已使用
/// </summary>
public int? is_express_no_used { get; set; }
/// <summary>
/// 外采订单售后状态
/// </summary>
public string out_after_sale_status { get; set; }
/// <summary>
/// 是否支持运费险:0-不支持,1-支持
/// </summary>
public int? has_freight_insurance { get; set; }
/// <summary>
/// 运费险金额(单位:元)
/// </summary>
public decimal? freight_insurance_amount { get; set; }
/// <summary>
/// 是否外采礼物单:0-否,1-是(外采订单)
/// </summary>
public int? external_gift { get; set; }
/// <summary>
/// 中转仓的状态 0未使用,1已创建,2创建失败(购买失败),3已创建未有上游快递单号,4已创建有上游快递单号
/// </summary>
public decimal? transfer_warehouse_status { get; set; }
}
}
@@ -0,0 +1 @@
<%@ WebService Language="C#" CodeBehind="WXOrderService.asmx.cs" Class="KJD_Web.WXOrderService" %>
@@ -0,0 +1,64 @@
using KJD_Web.BLL;
using KJD_Web.BLL.WXXD;
using KJD_Web.Utils;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Services;
namespace KJD_Web
{
/// <summary>
/// OrderService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。
// [System.Web.Script.Services.ScriptService]
public class WXOrderService : System.Web.Services.WebService
{
private string GetRequestJsonString()
{
Context.Response.ContentType = "text/html;charset=utf-8";
Context.Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
using (Stream s = HttpContext.Current.Request.InputStream) // 获得json 字符流
{
// 还原数据流
byte[] b = new byte[s.Length];
s.Read(b, 0, (int)s.Length);
string jsonText = Encoding.UTF8.GetString(b); // JSON字符串
if (string.IsNullOrEmpty(jsonText))
{
var qs = HttpContext.Current.Request.QueryString;
if (qs != null && qs.Keys.Count > 0)
{
jsonText = "{";
foreach (var key in qs.Keys)
{
jsonText += "\"" + key + "\":" + "\"" + qs[key.ToString()] + "\";";
}
jsonText = jsonText.TrimEnd(';') + "}";
}
}
return jsonText;
}
}
[WebMethod]
public void get_order_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new WXOrderManage().WXGetErpOrderList(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
}
}