diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index aa60cd3..83752a9 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 1189; + public static int VersionCount = 1190; public static string MainPath = "29wx"; //public static string MainPath = "29wx"; //public static string MainPath = "29pdd"; diff --git a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs index 5e9963f..26acc9e 100644 --- a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs +++ b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs @@ -69,11 +69,6 @@ namespace KJD_Web.BLL.BXX return "{\"code\":666,\"msg\":\"当前版本已失效,请更新软件\"}"; } - if (add_user_name != null && add_user_name != "admin") - { - Thread.Sleep(1000); - } - if (string.IsNullOrEmpty(product_get_type)) { product_get_type = "母店采集"; @@ -83,11 +78,26 @@ namespace KJD_Web.BLL.BXX { return "{\"code\":500,\"msg\":\"没有用户名\"}"; } + if (add_user_name != null && add_user_name != "admin") + { + Thread.Sleep(2000); + } string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; MysqlUtils mySql = new MysqlUtils(conn); string sql = ""; + if (add_user_name != null && add_user_name != "admin") + { + sql = "select count(*) from bxx.product where is_del=0 and add_user_name='" + add_user_name + "'"; + var count = mySql.ExecuteRowCount(sql); + if (!string.IsNullOrEmpty(mySql.Message) || count > 100000) + { + mySql.Close(); + return "{\"code\":500,\"msg\":\"产品数据库已达上限10万,请删除旧数据后重新添加新商品\"}"; + } + } + int ban_wx = 0; int ban_pdd = 0; if (product_get_type == "厂商直采") diff --git a/KJDService/KJD_WebService/BLL/WXXD/WXOrderManage.cs b/KJDService/KJD_WebService/BLL/WXXD/WXOrderManage.cs index ba3818a..d09795c 100644 --- a/KJDService/KJD_WebService/BLL/WXXD/WXOrderManage.cs +++ b/KJDService/KJD_WebService/BLL/WXXD/WXOrderManage.cs @@ -30,6 +30,9 @@ namespace KJD_Web.BLL.WXXD 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("'", "\\'"); + var start_time = RegexUtils.GetStringQuery(ref inputData, "start_time").ParseToInt(); + var end_time = RegexUtils.GetStringQuery(ref inputData, "end_time").ParseToInt(); + 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(50); @@ -46,12 +49,18 @@ namespace KJD_Web.BLL.WXXD where += " and o.status = " + query_status; if (!string.IsNullOrWhiteSpace(purchase_status)) where += " and o.purchase_status = " + purchase_status; + if (start_time > 0) + where += " and o.create_time >= " + start_time; + if (end_time > 0) + where += " and o.create_time <= " + end_time; sql += where; - var count = mySql.ExecuteRowCount(sql); + var count = 0; + if (!is_not_count) + count = mySql.ExecuteRowCount(sql); DataTable dt; - if (count == 0) + if (count == 0 && !is_not_count) { dt = new DataTable(); } @@ -113,7 +122,7 @@ namespace KJD_Web.BLL.WXXD 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(), + merchant_id = row["merchant_id"].ParseToLong(), openid = row["openid"].ParseToString(), order_id = row["order_id"].ParseToString(), order_price = row["order_price"].ParseToNullableInt(), @@ -168,5 +177,131 @@ namespace KJD_Web.BLL.WXXD return "{\"code\":19999,\"msg\":\"输入为空\"}"; } + + public string WXGetErpOrderItemList(string inputData, bool isDetail = false) + { + 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\":\"校验失败\"}"; + + 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") != "false"; + + 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.oms_wei_order_item o WHERE 1=1 "; + + string where = ""; + if (!string.IsNullOrWhiteSpace(erp_order_id_in)) + where += " and o.order_id 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.oms_wei_order_item o " + + " WHERE 1=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_order_item order = new oms_wei_order_item + { + id = row["id"].ParseToLong(), + commission_amount = row["commission_amount"].ParseToNullableInt(), + freight = row["freight"].ParseToNullableInt(), + merchant_id = row["merchant_id"].ParseToLong(), + order_id = row["order_id"].ParseToString(), + predict_commission_fee = row["predict_commission_fee"].ParseToNullableInt(), + purchase_price = row["purchase_price"].ParseToNullableInt(), + shop_id = row["shop_id"].ParseToLong(), + cash_coupon_discounted_price = row["cash_coupon_discounted_price"].ParseToNullableInt(), + change_price = row["change_price"].ParseToNullableInt(), + deduction_price = row["deduction_price"].ParseToNullableInt(), + erp_goods_id = row["erp_goods_id"].ParseToNullableLong(), + erp_goods_sku_id = row["erp_goods_sku_id"].ParseToNullableLong(), + estimate_price = row["estimate_price"].ParseToNullableInt(), + extra_service = row["extra_service"].ParseToString(), + finish_aftersale_sku_cnt = row["finish_aftersale_sku_cnt"].ParseToNullableInt(), + is_change_price = row["is_change_price"].ParseToString(), + is_discounted = row["is_discounted"].ParseToString(), + market_price = row["market_price"].ParseToNullableInt(), + on_aftersale_sku_cnt = row["on_aftersale_sku_cnt"].ParseToNullableInt(), + order_product_coupon_info_list = row["order_product_coupon_info_list"].ParseToString(), + out_product_id = row["out_product_id"].ParseToString(), + out_sku_id = row["out_sku_id"].ParseToString(), + out_warehouse_id = row["out_warehouse_id"].ParseToString(), + product_id = row["product_id"].ParseToString(), + real_price = row["real_price"].ParseToNullableInt(), + refund_status = row["refund_status"].ParseToNullableInt(), + return_address = row["return_address"].ParseToString(), + sale_price = row["sale_price"].ParseToNullableInt(), + sku_attrs = row["sale_price"].ParseToString(), + sku_cnt = row["sku_cnt"].ParseToNullableInt(), + sku_code = row["sku_code"].ParseToString(), + sku_deliver_info = row["sku_deliver_info"].ParseToString(), + sku_id = row["sku_id"].ParseToString(), + thumb_img = row["thumb_img"].ParseToString(), + title = row["title"].ParseToString(), + use_deduction = row["use_deduction"].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\":" + 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\":\"输入为空\"}"; + } } } \ No newline at end of file diff --git a/KJDService/KJD_WebService/KJD_WebService.csproj b/KJDService/KJD_WebService/KJD_WebService.csproj index 0fcc610..76d3c78 100644 --- a/KJDService/KJD_WebService/KJD_WebService.csproj +++ b/KJDService/KJD_WebService/KJD_WebService.csproj @@ -131,6 +131,7 @@ + diff --git a/KJDService/KJD_WebService/Model/WxModel/oms_wei_order.cs b/KJDService/KJD_WebService/Model/WxModel/oms_wei_order.cs index e011ae2..8eefb0f 100644 --- a/KJDService/KJD_WebService/Model/WxModel/oms_wei_order.cs +++ b/KJDService/KJD_WebService/Model/WxModel/oms_wei_order.cs @@ -13,7 +13,7 @@ namespace KJD_Web.Model.WxModel /// /// 商户ID /// - public string merchant_id { get; set; } + public long merchant_id { get; set; } public string order_id { get; set; } /// /// 买家身份标识 diff --git a/KJDService/KJD_WebService/Model/WxModel/oms_wei_order_item.cs b/KJDService/KJD_WebService/Model/WxModel/oms_wei_order_item.cs new file mode 100644 index 0000000..bd16bd7 --- /dev/null +++ b/KJDService/KJD_WebService/Model/WxModel/oms_wei_order_item.cs @@ -0,0 +1,153 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace KJD_Web.Model.WxModel +{ + public class oms_wei_order_item + { + /// + /// 订单商品表数据库id + /// + public long id { get; set; } + public long shop_id { get; set; } + /// + /// 商户ID + /// + public long merchant_id { get; set; } + /// + /// 订单id(平台订单id) + /// + public string order_id { get; set; } + /// + /// 商品spuid + /// + public string product_id { get; set; } + public string sku_id { get; set; } + /// + /// sku小图 + /// + public string thumb_img { get; set; } + /// + /// sku数量 + /// + public int? sku_cnt { get; set; } + /// + /// 售卖单价(单位:分) + /// + public int? sale_price { get; set; } + /// + /// 商品名称 + /// + public string title { get; set; } + /// + /// 正在售后/退款流程中的 sku 数量 + /// + public int? on_aftersale_sku_cnt { get; set; } + /// + /// 完成售后/退款的 sku 数量 + /// + public int? finish_aftersale_sku_cnt { get; set; } + /// + /// 商品编码 + /// + public string sku_code { get; set; } + /// + /// 市场单价(单位:分) + /// + public int? market_price { get; set; } + /// + /// sku属性JSON + /// + public string sku_attrs { get; set; } + /// + /// sku实付总价,取estimate_price和change_price中较小值 + /// + public int? real_price { get; set; } + /// + /// 商品外部spuid + /// + public string out_product_id { get; set; } + /// + /// 采购价 + /// + public int? purchase_price { get; set; } + /// + /// 运费 + /// + public int? freight { get; set; } + /// + /// 商品外部skuid + /// + public string out_sku_id { get; set; } + /// + /// 是否有优惠金额,非必填,默认为false + /// + public string is_discounted { get; set; } + /// + /// 优惠后sku总价,非必填,is_discounted为true时有值 + /// + public int? estimate_price { get; set; } + /// + /// 是否修改过价格,非必填,默认为false + /// + public string is_change_price { get; set; } + /// + /// 改价后sku总价,非必填,is_change_price为true时有值 + /// + public int? change_price { get; set; } + /// + /// 订单内商品维度平台券优惠金额(利润需要计算这个金额在内) + /// + public int? cash_coupon_discounted_price { get; set; } + /// + /// 区域库存id + /// + public string out_warehouse_id { get; set; } + /// + /// 退货地址 + /// + public string return_address { get; set; } + /// + /// 商品发货信息JSON + /// + public string sku_deliver_info { get; set; } + /// + /// 商品额外服务信息JSON + /// + public string extra_service { get; set; } + /// + /// 是否使用了会员积分抵扣 + /// + public string use_deduction { get; set; } + /// + /// 会员积分抵扣金额,单位为分 + /// + public int? deduction_price { get; set; } + /// + /// 达人佣金(微信小店:分账金额),单位为分 + /// + public int? predict_commission_fee { get; set; } + /// + /// 达人佣金(微信小店:分账金额),单位为分 + /// + public int? commission_amount { get; set; } + /// + /// 商品优惠券信息,逐步替换 order.order_detail.coupon_info + /// + public string order_product_coupon_info_list { get; set; } + /// + /// 商品id(o_goods外键) + /// + public long? erp_goods_id { get; set; } + /// + /// 商品skuid(o_goods_sku外键) + /// + public long? erp_goods_sku_id { get; set; } + /// + /// 售后状态 1:无售后或售后关闭,2:售后处理中,3:退款中,4: 退款成功 11 已取消 + /// + public int? refund_status { get; set; } + } +} \ No newline at end of file diff --git a/KJDService/KJD_WebService/WXOrderService.asmx.cs b/KJDService/KJD_WebService/WXOrderService.asmx.cs index dde6aac..b131845 100644 --- a/KJDService/KJD_WebService/WXOrderService.asmx.cs +++ b/KJDService/KJD_WebService/WXOrderService.asmx.cs @@ -60,5 +60,19 @@ namespace KJD_Web Context.Response.Write(result); Context.Response.End(); } + + + + [WebMethod] + public void get_order_item_list() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new WXOrderManage().WXGetErpOrderItemList(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } } }