diff --git a/AllBase/AllBase.csproj b/AllBase/AllBase.csproj index 8511dd9..af4fc13 100644 --- a/AllBase/AllBase.csproj +++ b/AllBase/AllBase.csproj @@ -215,6 +215,7 @@ + diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 29eaaea..b0cc175 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 807; + public static int VersionCount = 811; //public static int VersionCount = 613; /// diff --git a/AllBase/Model/Param/OutServerGoodsParam.cs b/AllBase/Model/Param/OutServerGoodsParam.cs index fe4ca32..e057fa7 100644 --- a/AllBase/Model/Param/OutServerGoodsParam.cs +++ b/AllBase/Model/Param/OutServerGoodsParam.cs @@ -12,15 +12,15 @@ namespace AllBase.Model.Param public class OutServerGoodsParam { /// - /// 仓库商品ID + /// 仓库商品ID 对应聚水潭 Id /// public string warehouseGoodsId { get; set; } // "46251545HSISG656DF89D", /// - /// 仓库资料编码 + /// 仓库资料编码 对应聚水潭商品 styleCode // 相当于货号 ///      public string spuCode { get; set; } // "85295413687", /// - /// 商品标题 + /// 商品标题 对应聚水潭 itemName ///      public string title { get; set; } // "帆布包女大容量通勤手提拉链袋可折叠购物袋帆布袋文艺百搭", /// @@ -32,7 +32,7 @@ namespace AllBase.Model.Param ///      public string headImg { get; set; } // "https://images-1259706103.cos.ap-nanjing.myqcloud.com/20251019/068bb3c355a583c33c0bb41f7d1ae740.jpg", /// - /// 商品主图列表 + /// 商品主图列表 对应聚水潭 itemMainImage ///      public string headImgs { get; set; } // "[\"https://images-1259706103.cos.ap-nanjing.myqcloud.com/20251019/068bb3c355a583c33c0bb41f7d1ae740.jpg\",\"https://images-1259706103.cos.ap-nanjing.myqcloud.com/20251019/0d1f5a11791e3c5903b708677b307624.jpeg\",\"https://images-1259706103.cos.ap-nanjing.myqcloud.com/20251019/624299b9363b393f1febc89f8219991f.jpg\",\"https://images-1259706103.cos.ap-nanjing.myqcloud.com/20251019/8d18cfc34b68f3b8183f1825c1249e1d.jpg\",\"https://images-1259706103.cos.ap-nanjing.myqcloud.com/20251019/7795ba1aedcee0a1b88ec4c622e5d3ad.jpg\"]",      /// @@ -56,21 +56,17 @@ namespace AllBase.Model.Param ///      public int? status { get; set; } = 1; /// - /// 扩展状态:0-待完善,1-其他(有ext数据填写1) - /// - public int? ext_status { get; set; } = 0; - /// - /// 供应商 + /// 供应商 对应聚水潭 supplierName /// public string supplier { get; set; } // "广如供应链", /// - /// 供应商ID + /// 供应商ID 暂时不填 /// -     public string supplierId { get; set; } // "110", +     public long? supplierId { get; set; } // 110, /// /// 创建人 /// -     public string createBy { get; set; } // "", +     public string createBy { get; set; } = "";      public string createTime { get; set; } // "2025-10-19 22:35:28",      public string updateBy { get; set; } // null,      public string updateTime { get; set; } // null, @@ -83,13 +79,99 @@ namespace AllBase.Model.Param /// public int? shipType { get; set; } = 20; /// - /// 仓库编号 + /// 仓库编号 对应聚水潭 coid ///      public string warehouseNum { get; set; } // "11625838", /// - /// 商户ID + /// 商户ID 可以不传 ///      public string merchantId { get; set; } // "10", -     public string platformCode { get; set; } // "WEISHOP", +     public string platformCode { get; set; } = "WEISHOP"; + public object selectionQuareGoodsSkus { get; set; } // null, + public object selectionQuareGoodsExtList { get; set; } // null, + public object goodsIds { get; set; } // null, + public object freightPrice { get; set; } // null, + public object warehouseDisablePlatformList { get; set; } // null, + /// + /// 扩展状态:0-待完善,1-其他(有ext数据填写1) 商品附属信息,可以默认填1 + /// + public int? extStatus { get; set; } = 1; + public object groupKey { get; set; } // null, + public string platform { get; set; } = "WEISHOP"; + public long? catId { get; set; } // "1441", + public List headImgList { get; set; } // ["https://images-1259706103.cos.ap-nanjing.myqcloud.com/20251019/068bb3c355a583c33c0bb41f7d1ae740.jpg" ... ], + public List detailImgList { get; set; } // ["https://images-1259706103.cos.ap-nanjing.myqcloud.com/20251019/859603a9a322fa61dcaef33076089e16.png" ... ], + public List skus { get; set; } + public List productAttrs { get; set; } + } + + public class osProductAttrParam + { + /// + /// 必填属性 key + /// + public string attrKey { get; set; } // "国产/进口", + /// + /// 必填属性 Value + /// + public string attrValue { get; set; } // "国产" + } + + public class osSkuParam + { + public long? supplierId { get; set; } // 110, + /// + /// 仓库 skuid 编号 对应baseSkuId + /// + public string warehouseSkuId { get; set; } // "7DFD0D35C91F4D01B8BFF2E9B064AA15", + /// + /// sku 标题 + /// + public string title { get; set; } // "黑色", + /// + /// sku 小图 + /// + public string thumbImg { get; set; } // "https://images-1259706103.cos.ap-nanjing.myqcloud.com/20251019/1c0309944d046ff0ffaf31a699d0a55f.jpeg", + /// + /// 售卖价格(单位:分) 对应supplyPrice + /// + public int? salePrice { get; set; } // 729, + /// + /// 库存 + /// + public int? stockNum { get; set; } // 4529, + /// + /// 规格编码 对应itemNo // realItemNo // 相当于货号 + /// + public string skuCode { get; set; } // "snb00620A", + /// + /// sku 图片多个英文逗号分隔 + /// + public object skuImags { get; set; } // null, + /// + /// 状态:1 售卖中 + /// + public int? status { get; set; } = 1; + /// + /// sku 重量,单位为 g + /// + public int? skuWeight { get; set; } // 0, + /// + /// sku 备注 + /// + public string remark { get; set; } = ""; + public string latestPrice { get; set; } // "732.00", + public string latestPriceTime { get; set; } // "2025-10-29 10:13:43", + public string latestUpdateTime { get; set; } // null, + public string platform { get; set; } // null, + public string skuId { get; set; } // null, + public List skuAttrs { get; set; } + public object platformSkuId { get; set; } // null + } + + public class skuAttrParam + { + public string attrKey { get; set; } // "颜色分类" + public string attrValue { get; set; } // "蓝色" } } diff --git a/AllBase/Model/Result/KJDDBProduct.cs b/AllBase/Model/Result/KJDDBProduct.cs index b70e240..9185d98 100644 --- a/AllBase/Model/Result/KJDDBProduct.cs +++ b/AllBase/Model/Result/KJDDBProduct.cs @@ -17,6 +17,9 @@ namespace AllBase.Model.Result public string offline_supplier_id { get; set; } public string offline_supplier_name { get; set; } public string spu_id { get; set; } + /// + /// skcId,聚水潭为商家coid + /// public string skc_id { get; set; } public string main_cat_id { get; set; } public string cat_id { get; set; } @@ -42,6 +45,7 @@ namespace AllBase.Model.Result /// sku编辑后存储列表 /// public string sku_edit_json { get; set; } + public string sku_secret_json { get; set; } public int sku_img_replace_id { get; set; } public string sku_img_replace_base64 { get; set; } public string sku_img_replace_url { get; set; } @@ -77,5 +81,7 @@ namespace AllBase.Model.Result public string sale_count_text { get; set; } public string wx_safe_status { get; set; } public string special_prod_type { get; set; } + public int? distribution_set { get; set; } + public int? send_to_out_server { get; set; } } } diff --git a/AllBase/Model/Result/PDDResult/PDDProductDetailInfo.cs b/AllBase/Model/Result/PDDResult/PDDProductDetailInfo.cs index c597e9c..13d0971 100644 --- a/AllBase/Model/Result/PDDResult/PDDProductDetailInfo.cs +++ b/AllBase/Model/Result/PDDResult/PDDProductDetailInfo.cs @@ -213,6 +213,7 @@ namespace AllBase.Model.Result.PDDResult public string url { get; set; } public int? width { get; set; } public int? height { get; set; } + // 图片类型 1 主图 2 详情图 3视频 public int? type { get; set; } public object source { get; set; } public object status { get; set; } @@ -254,6 +255,7 @@ namespace AllBase.Model.Result.PDDResult public object thumb_url_is_deleted { get; set; } public int? quantity_delta { get; set; } public List spec { get; set; } + // 货号 public string out_sku_sn { get; set; } public object batch_id { get; set; } public int? priority { get; set; } diff --git a/AllBase/Model/Result/PDDResult/PDDPropRefPidNameMap.cs b/AllBase/Model/Result/PDDResult/PDDPropRefPidNameMap.cs new file mode 100644 index 0000000..7e24c70 --- /dev/null +++ b/AllBase/Model/Result/PDDResult/PDDPropRefPidNameMap.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AllBase.Model.Result.PDDResult +{ + public class PDDPropRefPidNameMap + { + public string name_alias { get; set; } + public long? ref_pid { get; set; } + public string name { get; set; } + public long? id { get; set; } + } +} diff --git a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs index 1242929..a5d0da4 100644 --- a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs +++ b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs @@ -135,6 +135,9 @@ namespace KJD_Web.BLL.BXX string delivery_fee_set = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "delivery_fee_set"))?.Replace("'", "\\'"); string after_sale_set = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "after_sale_set"))?.Replace("'", "\\'"); string distribution_set = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "distribution_set"))?.Replace("'", "\\'"); + string send_to_out_server = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "send_to_out_server"))?.Replace("'", "\\'"); + string sku_edit_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sku_edit_json"))?.Replace("'", "\\'"); + string sku_secret_json = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "sku_secret_json"))?.Replace("'", "\\'"); if (string.IsNullOrEmpty(user_name)) { @@ -195,11 +198,17 @@ namespace KJD_Web.BLL.BXX if (wx_cat_leaf != null) sql += " p.wx_cat_leaf=" + wx_cat_leaf + ","; if (delivery_fee_set != null) - sql += " p.delivery_fee_set='" + delivery_fee_set + "',"; + sql += " p.delivery_fee_set=" + delivery_fee_set + ","; if (after_sale_set != null) - sql += " p.after_sale_set='" + after_sale_set + "',"; + sql += " p.after_sale_set=" + after_sale_set + ","; if (distribution_set != null) - sql += " p.distribution_set='" + distribution_set + "',"; + sql += " p.distribution_set=" + distribution_set + ","; + if (send_to_out_server != null) + sql += " p.send_to_out_server=" + send_to_out_server + ","; + if (sku_edit_json != null) + sql += " p.sku_edit_json='" + sku_edit_json + "',"; + if (sku_secret_json != null) + sql += " p.sku_secret_json=@sku_secret_json,"; sql += " p.mdy_time='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',"; sql = sql.TrimEnd(','); sql += " where spu_id='" + spu_id + "';"; @@ -207,6 +216,7 @@ namespace KJD_Web.BLL.BXX List paramLst = new List(); paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "product_json", Value = product_json, }); paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "size_json", Value = size_json, }); + paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "sku_secret_json", Value = sku_secret_json, }); var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray()); mySql.Close(); @@ -236,6 +246,7 @@ namespace KJD_Web.BLL.BXX var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'"); var search_spu = RegexUtils.GetStringQuery(ref inputData, "search_spu")?.Replace("'", "\\'"); var search_skc = RegexUtils.GetStringQuery(ref inputData, "search_skc")?.Replace("'", "\\'"); + var search_cat1 = RegexUtils.GetStringQuery(ref inputData, "search_cat1")?.Replace("'", "\\'"); var search_cat = RegexUtils.GetStringQuery(ref inputData, "search_cat")?.Replace("'", "\\'"); var search_ext_code = RegexUtils.GetStringQuery(ref inputData, "search_ext_code")?.Replace("'", "\\'"); var search_prod_name = RegexUtils.GetStringQuery(ref inputData, "search_prod_name")?.Replace("'", "\\'"); @@ -252,6 +263,8 @@ namespace KJD_Web.BLL.BXX var special_prod_type = RegexUtils.GetStringQuery(ref inputData, "special_prod_type")?.Replace("'", "\\'"); var is_supplier_prod_ok = RegexUtils.GetStringQuery(ref inputData, "is_supplier_prod_ok")?.Replace("'", "\\'"); var has_wx_cat = RegexUtils.GetStringQuery(ref inputData, "has_wx_cat")?.Replace("'", "\\'"); + var send_to_out_server = RegexUtils.GetStringQuery(ref inputData, "send_to_out_server")?.Replace("'", "\\'"); + var has_send_to_out_server = RegexUtils.GetStringQuery(ref inputData, "has_send_to_out_server")?.Replace("'", "\\'"); int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt(); int page_size= RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50); @@ -281,6 +294,8 @@ namespace KJD_Web.BLL.BXX where += " and p.skc_id like '%" + search_skc + "%'"; if (!string.IsNullOrWhiteSpace(search_cat)) where += " and p.cat_name like '%" + search_cat + "%'"; + if (!string.IsNullOrWhiteSpace(search_cat1)) + where += " and p.main_cat_name like '%" + search_cat1 + "%'"; if (!string.IsNullOrWhiteSpace(search_ext_code)) where += " and p.ext_code like '%" + search_ext_code + "%'"; if (!string.IsNullOrWhiteSpace(search_prod_name)) @@ -291,18 +306,31 @@ namespace KJD_Web.BLL.BXX where += " and p.notes like '%" + search_notes + "%'"; if (!string.IsNullOrEmpty(has_wx_cat)) { - if (has_wx_cat == "true") + if (has_wx_cat.ToLower() == "true") where += " and wx_cat_leaf is NOT NULL"; else where += " and wx_cat_leaf is NULL"; } + if (!string.IsNullOrEmpty(send_to_out_server)) + where += " and send_to_out_server=" + send_to_out_server; + else if (!string.IsNullOrEmpty(has_send_to_out_server)) + { + if (has_send_to_out_server.ToLower() == "true") + where += " and send_to_out_server=1"; + else + where += " and send_to_out_server!=1"; + } // 供应商货源是否已完成初始设置 if (!string.IsNullOrEmpty(is_supplier_prod_ok)) { + //if (is_supplier_prod_ok == "1" || is_supplier_prod_ok == "已设置") + // where += " and wx_cat_leaf IS NOT NULL and send_to_out_server=1 and delivery_fee_set=1 and after_sale_set=1 and distribution_set=1"; + //else + // where += " and (wx_cat_leaf IS NULL or send_to_out_server=0 or delivery_fee_set=0 or after_sale_set=0 or distribution_set=0)"; if (is_supplier_prod_ok == "1" || is_supplier_prod_ok == "已设置") - where += " and wx_cat_leaf IS NOT NULL and send_to_out_server=1 and delivery_fee_set=1 and after_sale_set=1 and distribution_set=1"; + where += " and wx_cat_leaf IS NOT NULL and send_to_out_server=1 and distribution_set=1"; else - where += " and (wx_cat_leaf IS NULL or send_to_out_server=0 or delivery_fee_set=0 or after_sale_set=0 or distribution_set=0)"; + where += " and (wx_cat_leaf IS NULL or send_to_out_server!=1 or distribution_set=0)"; } sql += where; @@ -324,7 +352,7 @@ namespace KJD_Web.BLL.BXX sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name," + " p.main_img,p.notes,p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group," + " p.product_get_type,p.wx_safe_status,p.sale_count,p.sale_count_text,p.special_prod_type,p.from_shop_name,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," + - " p.wx_cat_leaf," + + " p.wx_cat_leaf,p.send_to_out_server," + " s.img_url,e.ext_code_price" + " FROM bxx.product p " + " left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id" + @@ -334,7 +362,7 @@ namespace KJD_Web.BLL.BXX sql = "SELECT p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code,p.product_name," + " p.main_img,p.notes,p.add_time,p.mdy_time,p.select_total_count,p.fission_words,p.head_words,p.end_words,p.sku_img_replace_id,p.group," + " p.product_get_type,p.wx_safe_status,p.sale_count,p.sale_count_text,p.special_prod_type,p.from_shop_name,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," + - " p.wx_cat_leaf" + + " p.wx_cat_leaf,p.send_to_out_server," + " s.img_url,COUNT(se.id) AS select_count,e.ext_code_price" + " FROM bxx.product p left join bxx.sku_img_replace s ON p.sku_img_replace_id=s.id LEFT JOIN bxx.product_select se ON p.id=se.out_product_id AND se.shop_id='" + select_shop_id + "' " + " LEFT JOIN bxx.ext_code_price e ON p.ext_code=e.ext_code" + @@ -398,12 +426,16 @@ namespace KJD_Web.BLL.BXX sale_count_text = row["sale_count_text"].ToString(), wx_safe_status = row["wx_safe_status"].ToString(), special_prod_type = row["special_prod_type"].ToString(), + main_cat_id = row["main_cat_id"].ToString(), + main_cat_name = row["main_cat_name"].ToString(), + send_to_out_server = row["send_to_out_server"].ParseToInt(), }; if (isDetail) { prod.product_json = row["product_json"].ToString(); prod.size_json = row["size_json"].ToString(); prod.sku_edit_json = row["sku_edit_json"].ToString(); + prod.sku_secret_json = row["sku_secret_json"].ToString(); prod.sku_img_replace_base64 = row["img_base64"].ToString(); //prod.sku_img_replace_url = row["img_url"].ToString(); } @@ -648,6 +680,7 @@ namespace KJD_Web.BLL.BXX var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'"); var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'"); var in_ext_codes = RegexUtils.GetStringQuery(ref inputData, "in_ext_codes")?.Replace("'", "\\'"); + var in_spu_ids = RegexUtils.GetStringQuery(ref inputData, "in_spu_ids")?.Replace("'", "\\'"); var in_skc_ids = RegexUtils.GetStringQuery(ref inputData, "in_skc_ids")?.Replace("'", "\\'"); var in_groups = RegexUtils.GetStringQuery(ref inputData, "in_groups")?.Replace("'", "\\'"); var in_cates = RegexUtils.GetStringQuery(ref inputData, "in_cates")?.Replace("'", "\\'"); @@ -675,6 +708,11 @@ namespace KJD_Web.BLL.BXX in_skc_ids = "'" + string.Join("','", in_skc_ids.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'"; where += " and p.skc_id in (" + in_skc_ids + ")"; } + if (!string.IsNullOrEmpty(in_spu_ids)) + { + in_spu_ids = "'" + string.Join("','", in_spu_ids.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'"; + where += " and p.spu_id in (" + in_spu_ids + ")"; + } if (!string.IsNullOrEmpty(in_groups)) { in_groups = "'" + string.Join("','", in_groups.Split(new string[] { ",", ",", " " }, StringSplitOptions.RemoveEmptyEntries)) + "'"; @@ -695,9 +733,9 @@ namespace KJD_Web.BLL.BXX if (!string.IsNullOrEmpty(is_supplier_prod_ok)) { if (is_supplier_prod_ok == "1" || is_supplier_prod_ok == "已设置") - where += " and wx_cat_leaf IS NOT NULL and send_to_out_server=1 and delivery_fee_set=1 and after_sale_set=1 and distribution_set=1"; + where += " and wx_cat_leaf IS NOT NULL and send_to_out_server=1 and distribution_set=1"; else - where += " and (wx_cat_leaf IS NULL or send_to_out_server=0 or delivery_fee_set=0 or after_sale_set=0 or distribution_set=0)"; + where += " and (wx_cat_leaf IS NULL or send_to_out_server!=1 or distribution_set=0)"; } sql += where; @@ -1377,6 +1415,7 @@ namespace KJD_Web.BLL.BXX var search_shop_account = RegexUtils.GetStringQuery(ref inputData, "search_shop_account")?.Replace("'", "\\'"); var search_spu = RegexUtils.GetStringQuery(ref inputData, "search_spu")?.Replace("'", "\\'"); var search_skc = RegexUtils.GetStringQuery(ref inputData, "search_skc")?.Replace("'", "\\'"); + var search_cat1 = RegexUtils.GetStringQuery(ref inputData, "search_cat1")?.Replace("'", "\\'"); var search_cat = RegexUtils.GetStringQuery(ref inputData, "search_cat")?.Replace("'", "\\'"); var search_ext_code = RegexUtils.GetStringQuery(ref inputData, "search_ext_code")?.Replace("'", "\\'"); var search_prod_name = RegexUtils.GetStringQuery(ref inputData, "search_prod_name")?.Replace("'", "\\'"); @@ -1441,6 +1480,8 @@ namespace KJD_Web.BLL.BXX where += " and p.spu_id like '%" + search_spu + "%'"; if (!string.IsNullOrWhiteSpace(search_skc)) where += " and p.skc_id like '%" + search_skc + "%'"; + if (!string.IsNullOrWhiteSpace(search_cat1)) + where += " and p.main_cat_name like '%" + search_cat1 + "%'"; if (!string.IsNullOrWhiteSpace(search_cat)) where += " and p.cat_name like '%" + search_cat + "%'"; if (!string.IsNullOrWhiteSpace(search_ext_code)) @@ -1687,6 +1728,22 @@ namespace KJD_Web.BLL.BXX return "{\"code\":19999,\"msg\":\"输入为空\"}"; } + public string GetAfterSale(string inputData) + { + 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\":\"校验失败\"}"; + + string url = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "get_url")); + string rst = HttpUtils.e57GetResponse(url, ""); + return rst; + } + return "{\"code\":19999,\"msg\":\"输入为空\"}"; + } + public string GetWxTokens(string inputData) { if (!string.IsNullOrEmpty(inputData)) @@ -1750,8 +1807,8 @@ namespace KJD_Web.BLL.BXX } return "{\"code\":19999,\"msg\":\"输入为空\"}"; } - - public string GetWxAllCate(string inputData) + + public string WxApiGetWxAllCate(string inputData) { if (!string.IsNullOrEmpty(inputData)) { diff --git a/KJDService/KJD_WebService/BLL/WXXD/WXProductManage.cs b/KJDService/KJD_WebService/BLL/WXXD/WXProductManage.cs index 31b57b1..80d5f85 100644 --- a/KJDService/KJD_WebService/BLL/WXXD/WXProductManage.cs +++ b/KJDService/KJD_WebService/BLL/WXXD/WXProductManage.cs @@ -2,6 +2,7 @@ using KJD_Web.Model.ShopModel; using KJD_Web.Utils; using MySql.Data.MySqlClient; +using Mysqlx.Crud; using NaiBa.Util.Extension; using System; using System.Collections.Generic; @@ -417,5 +418,131 @@ namespace KJD_Web.BLL.WXXD return new BXX.BXXProductManage().MdyProduct(inputData); } + + public string WXAddMdyAfterSale(string inputData) + { + 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 user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'"); + if (string.IsNullOrEmpty(user_name)) + { + return "{\"code\":50001,\"msg\":\"没有用户名\"}"; + } + + //int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt(); + //int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50); + string coid = RegexUtils.GetStringQuery(ref inputData, "coid")?.Replace("'", "\\'"); + string after_sale_json = RegexUtils.GetStringQuery(ref inputData, "after_sale_json")?.Replace("'", "\\'"); + if (string.IsNullOrEmpty("coid")) + return "{\"code\":50001,\"msg\":\"没有售后编号\"}"; + if (string.IsNullOrEmpty("after_sale_json")) + return "{\"code\":50001,\"msg\":\"没有售后信息\"}"; + + string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; + MysqlUtils mySql = new MysqlUtils(conn); + + string sql = "SELECT * FROM `wxxd`.`after_sale` where coid='" + coid + "'"; + + string where = ""; + sql += where; + + var dt = mySql.ExecuteDataTable(sql); + mySql.Close(); + + if (dt != null) + { + conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; + mySql = new MysqlUtils(conn); + if (dt.Rows.Count == 0) + { + sql = "INSERT INTO `wxxd`.`after_sale` (coid,after_sale_json) VALUES (@coid,@after_sale_json);"; + } + else + { + sql = "UPDATE `wxxd`.`after_sale` SET after_sale_json=@after_sale_json WHERE coid=@coid;"; + } + + List paramLst = new List(); + paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "coid", Value = coid, }); + paramLst.Add(new MySqlParameter() { DbType = DbType.String, ParameterName = "after_sale_json", Value = after_sale_json, }); + mySql.ExecuteNonQuery(sql, paramLst.ToArray()); + mySql.Close(); + if (string.IsNullOrEmpty(mySql.Message)) + { + return "{\"code\":200,\"msg\":\"success\",\"data\":\"\"}"; + } + else + { + return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}"; + } + } + else + { + return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}"; + } + } + return "{\"code\":19999,\"msg\":\"输入为空\"}"; + } + + public string WXGetAfterSale(string inputData) + { + 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 user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'"); + if (string.IsNullOrEmpty(user_name)) + { + return "{\"code\":50001,\"msg\":\"没有用户名\"}"; + } + + //int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt(); + //int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50); + string coid = RegexUtils.GetStringQuery(ref inputData, "coid")?.Replace("'", "\\'"); + + string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; + MysqlUtils mySql = new MysqlUtils(conn); + + string sql = "SELECT * FROM `wxxd`.`after_sale` where coid='" + coid + "'"; + + string where = ""; + sql += where; + + var dt = mySql.ExecuteDataTable(sql); + mySql.Close(); + + if (dt != null) + { + try + { + string group_data = ""; + foreach (DataRow row in dt.Rows) + { + group_data += row["after_sale_json"].ToString(); + break; + } + var data = group_data.Trim(','); + return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + "}"; + } + catch (Exception ex) + { + return "{\"code\":50002,\"msg\":\"" + ex.Message + "\",\"data\":\"\"}"; + } + } + else + { + return "{\"code\":50003,\"msg\":\"" + mySql.Message + "\",\"data\":\"\"}"; + } + } + return "{\"code\":19999,\"msg\":\"输入为空\"}"; + } } } \ No newline at end of file diff --git a/KJDService/KJD_WebService/BXXProductService.asmx.cs b/KJDService/KJD_WebService/BXXProductService.asmx.cs index f655edb..69e3890 100644 --- a/KJDService/KJD_WebService/BXXProductService.asmx.cs +++ b/KJDService/KJD_WebService/BXXProductService.asmx.cs @@ -349,18 +349,6 @@ namespace KJD_Web Context.Response.End(); } - [WebMethod] - public void get_wx_all_cate() - { - string jsontext = GetRequestJsonString(); - - var result = jsontext; - result = new BXXProductManage().GetWxAllCate(jsontext); - - Context.Response.Write(result); - Context.Response.End(); - } - [WebMethod] public void get_wx_tokens() { @@ -373,6 +361,18 @@ namespace KJD_Web Context.Response.End(); } + [WebMethod] + public void get_wx_all_cate() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new BXXProductManage().WxApiGetWxAllCate(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + [WebMethod] public void wx_api_category_classify() { diff --git a/KJDService/KJD_WebService/Model/DBProductResultParam.cs b/KJDService/KJD_WebService/Model/DBProductResultParam.cs index 30c3acf..7ebb448 100644 --- a/KJDService/KJD_WebService/Model/DBProductResultParam.cs +++ b/KJDService/KJD_WebService/Model/DBProductResultParam.cs @@ -58,6 +58,10 @@ namespace KJD_Web.Model public string product_json { get; set; } public string size_json { get; set; } public string sku_edit_json { get; set; } + /// + /// 微信推单商品和sku加密code信息 + /// + public string sku_secret_json { get; set; } public int sku_img_replace_id { get; set; } public string sku_img_replace_base64 { get; set; } public string sku_img_replace_url { get; set; } @@ -84,5 +88,6 @@ namespace KJD_Web.Model public string sale_count_text { get; set; } public string wx_safe_status { get; set; } public string special_prod_type { get; set; } + public int send_to_out_server { get; set; } } } \ No newline at end of file diff --git a/KJDService/KJD_WebService/Utils/HttpUtils.cs b/KJDService/KJD_WebService/Utils/HttpUtils.cs index aa968b6..b2cea6e 100644 --- a/KJDService/KJD_WebService/Utils/HttpUtils.cs +++ b/KJDService/KJD_WebService/Utils/HttpUtils.cs @@ -99,6 +99,66 @@ namespace KJD_Web.Utils return result; } + + public static string e57PostResponse(string _url, string _data, string referer) + { + HttpWebResponse response = null; + string result; + try + { + string url = _url; + HttpWebRequest request; + if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase)) + { + ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true; + ServicePointManager.SecurityProtocol = + ServicePointManager.SecurityProtocol | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; + request = WebRequest.Create(url) as HttpWebRequest; + request.ProtocolVersion = HttpVersion.Version10; + } + else + request = (HttpWebRequest)WebRequest.Create(url); + + request.KeepAlive = true; + request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0"); + request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"; + request.ContentType = "application/json"; + request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"; //request.Accept = "*/*"; + request.Referer = referer; + request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate"); + request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9"); + + request.Method = "POST"; + request.ServicePoint.Expect100Continue = false; + + string body = _data; + byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(body); + request.ContentLength = postBytes.Length; + Stream stream = request.GetRequestStream(); + stream.Write(postBytes, 0, postBytes.Length); + stream.Close(); + + response = (HttpWebResponse)request.GetResponse(); + } + catch (WebException ex) + { + if (ex.Status == WebExceptionStatus.ProtocolError) + { + response = (HttpWebResponse)ex.Response; + result = ReadResponse(response); + return result; + } + else return ex.Message; + } + catch (Exception e) + { + if (response != null) response.Close(); + return e.Message; + } + result = ReadResponse(response); + return result; + } + public static string e57GetResponse(string _url, string referer) { HttpWebResponse response = null; diff --git a/KJDService/KJD_WebService/WXProductService.asmx.cs b/KJDService/KJD_WebService/WXProductService.asmx.cs index 75b0a7e..d9364a3 100644 --- a/KJDService/KJD_WebService/WXProductService.asmx.cs +++ b/KJDService/KJD_WebService/WXProductService.asmx.cs @@ -121,5 +121,29 @@ namespace KJD_Web Context.Response.Write(result); Context.Response.End(); } + + //WXAddMdyAfterSale + [WebMethod] + public void wx_add_mdy_after_sale() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new WXProductManage().WXAddMdyAfterSale(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + [WebMethod] + public void wx_get_after_sale() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new WXProductManage().WXGetAfterSale(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } } } diff --git a/TEMUKJD/BLL/PDDProdFormConverter.cs b/TEMUKJD/BLL/PDDProdFormConverter.cs index c76ba27..b0d1037 100644 --- a/TEMUKJD/BLL/PDDProdFormConverter.cs +++ b/TEMUKJD/BLL/PDDProdFormConverter.cs @@ -2,6 +2,7 @@ using AllBase.Model.Result; using AllBase.Model.Result.PDDResult; using NaiBa.Util.Extension; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.Linq; @@ -13,7 +14,14 @@ namespace TemuKJD.BLL { public class PDDProdFormConverter { - public string PddConvert(string outProdJson, bool UpdateOldData = true, string specialProdType = null) + /// + /// 拼多多前端采集转拼多多后台采集数据 + /// + /// + /// + /// + /// + public string PddFrontToPddBackConvert(string outProdJson, bool UpdateOldData = true, string specialProdType = null) { PDDFrontProductInfo frontProdInfo = null; try @@ -377,5 +385,443 @@ namespace TemuKJD.BLL } return ""; } + + public PDDProductInfo JstPddProdToPddConvert(out string convertRst, KJDDBProduct dbProd) + { + convertRst = ""; + try + { + var prodObj = JsonHelper.JObjectParse(dbProd.product_json); + if (prodObj["pddData"].IsJTokenNullOrEmpty()) + { + convertRst = "缺少指定的数据格式"; + return null; + } + var jstGoodsObj = prodObj["pddData"]; + var jstPddPropMapLst = JsonHelper.DeserializeJsonToList(JsonHelper.SerializeObject(prodObj["pddPropMap"])); + //{"goodsId":"2016474712785620994","warehouseGoodsId":"C7108311198A4217B022DCA87B6A5863","spuCode":"3783056947394249077","skus":[{"skuId":"2016692758292738050","warehouseSkuId":"C742B3FCB0364448AF92332F8F6005A6","skuCode":"ZH-XP-YWQYW-010"},{"skuId":"2016692758317903874","warehouseSkuId":"703E87F1B7774C14923821A57EEE6EFA","skuCode":"ZH-XP-YWQYW-010-111"},{"skuId":"2016692758338875394","warehouseSkuId":"895EDCDF6ECC4FAE8AD4DB9503719002","skuCode":"ZH-XP-YWQYW-010-222"}]} + var jstSecretCodeLst = JsonHelper.JObjectParse(dbProd.sku_secret_json); + + PDDProductInfo prodInfo = new PDDProductInfo() + { + sale_count = dbProd.sale_count.ParseToString(), + sale_count_text = dbProd.sale_count_text, + }; + prodInfo.chance_id = null; + prodInfo.chance_refere = null; + prodInfo.chance_tab = null; + prodInfo.decoration = null; + + // 商品详情 + prodInfo.detail = new PDDProductDetailInfo(); + prodInfo.detail.allergy_refund = 0; + prodInfo.detail.allowed_region = new List(); + //prodInfo.detail.appeal_status = null; + //prodInfo.detail.app_id = null; + //prodInfo.detail.app_name = null; + //prodInfo.detail.bad_claim_text = null; + prodInfo.detail.bad_fruit_claim = 0; + //prodInfo.detail.business_source_type = null; + prodInfo.detail.can_appeal = null; + prodInfo.detail.card_verification_list = null; + prodInfo.detail.cats = new List(); + prodInfo.detail.cat_id = jstGoodsObj["catId"].ParseToInt(); + prodInfo.detail.cat_ids = new List(); + var catLst = (jstGoodsObj["categoryData"] as JArray).Select(a => a.ParseToInt()).ToList(); + foreach (var cId in catLst) + { + prodInfo.detail.cat_ids.Add(cId); + } + prodInfo.detail.check_status = 9; + //prodInfo.detail.check_type = null; + //prodInfo.detail.client_id = null; + prodInfo.detail.commit_deleted = 0; + //prodInfo.detail.commit_extension = null; + //prodInfo.detail.community_group_buying = null; + prodInfo.detail.cost_template_id = 0; + //prodInfo.detail.country = null; + prodInfo.detail.country_id = 0; + //prodInfo.detail.created_at = null; + //prodInfo.detail.creator_name = null; + prodInfo.detail.customizable = 0; + prodInfo.detail.customs = ""; + prodInfo.detail.damage_claim = 0; + prodInfo.detail.delivery_one_day = 0; + //prodInfo.detail.delivery_type = null; + //prodInfo.detail.elec_goods_attributes = null; + prodInfo.detail.estimate_quantity = 0; + prodInfo.detail.event_type = 0; + prodInfo.detail.extend_warranty_dto = new extend_warranty_dto_item() { extend_warranty = 0 }; + //prodInfo.detail.fabric = null; + //prodInfo.detail.fabric_content = null; + prodInfo.detail.galleries = new List(); + foreach (var imgObj in jstGoodsObj["carouselGallery"]) + { + prodInfo.detail.galleries.Add(new gallery_item() + { + url = imgObj.ParseToString(), + type = 1, + }); + } + foreach (var imgObj in jstGoodsObj["detailGallery"]) + { + prodInfo.detail.galleries.Add(new gallery_item() + { + url = imgObj.ParseToString(), + type = 2, + }); + } + prodInfo.detail.gold_price_template_id = null; + prodInfo.detail.gold_price_type = null; + prodInfo.detail.goods_certificate = null; + prodInfo.detail.goods_commit_check = new List(); + prodInfo.detail.goods_desc = jstGoodsObj["goodsDesc"].ParseToString(); + // 聚水潭为string,散列取数值 + prodInfo.detail.goods_id = jstGoodsObj["itemSpuId"].ParseToString().GetHashCode(); + prodInfo.detail.goods_name = jstGoodsObj["itemName"].ParseToString(); + prodInfo.detail.goods_name_prefix = ""; + prodInfo.detail.goods_pattern = 8; + prodInfo.detail.goods_property_list = null; + prodInfo.detail.goods_sn = null; + prodInfo.detail.goods_srv_templates = new List(); + prodInfo.detail.goods_trade_attr = null; + prodInfo.detail.goods_travel_attr = null; + prodInfo.detail.goods_type = 1; + prodInfo.detail.groups = new group_item() { single_price = 0, group_price = 0, customer_num = 2, buy_limit = 999999, order_limit = 999999 }; + // 复用前面已经填写过的 + prodInfo.detail.hd_thumb_url = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1)?.url; + // 编辑id,随意填写 + prodInfo.detail.id = 0; + // 复用前面已经填写过的 + prodInfo.detail.image_url = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1)?.url; + prodInfo.detail.instruction_vo = new instruction_vo_item() { template_status = -1 }; + prodInfo.detail.invoice_mode = null; + prodInfo.detail.invoice_mode_sub_type = null; + prodInfo.detail.invoice_status = 0; + prodInfo.detail.is_all_weight_same = true; + prodInfo.detail.is_app = 0; + prodInfo.detail.is_bangdan = 0; + prodInfo.detail.is_card_secret = false; + prodInfo.detail.is_certificate_provide = 0; + prodInfo.detail.is_customized = 0; + prodInfo.detail.is_customs = 0; + prodInfo.detail.is_deposit = false; + prodInfo.detail.is_draft = false; + prodInfo.detail.is_folt = 0; + prodInfo.detail.is_general_trade = 0; + prodInfo.detail.is_gold_price_matched = null; + prodInfo.detail.is_goods_copy = null; + prodInfo.detail.is_goods_decoration = 1; + prodInfo.detail.is_group_pre_sale = 0; + prodInfo.detail.is_only_for_remote_area = false; + prodInfo.detail.is_pre_sale = 0; + prodInfo.detail.is_refundable = 1; + prodInfo.detail.is_refundable_fifteen_day = 0; + prodInfo.detail.is_shop = 1; + prodInfo.detail.is_size_change_casually = 0; + prodInfo.detail.is_sku_pre_sale = 0; + prodInfo.detail.is_sku_shipment = 0; + prodInfo.detail.is_small_group = null; + prodInfo.detail.is_spring_festival_open_tag = false; + prodInfo.detail.is_two_num_group = false; + prodInfo.detail.is_warranty_one_year = 0; + prodInfo.detail.is_wms = 0; + prodInfo.detail.is_wp_service = 0; + prodInfo.detail.lack_of_weight_claim = 0; + prodInfo.detail.last_commit_check_status = 2; + prodInfo.detail.list_desc = new List(); + prodInfo.detail.local_service_id_list = null; + prodInfo.detail.mai_jia_zi_ti = null; + // 聚水潭没有 + prodInfo.detail.mall_id = 0; + // 聚水潭没有 + prodInfo.detail.mall_info = new mall_info_item(); + // 聚水潭没有此处随意填 + prodInfo.detail.market_price = 0; + // 聚水潭没有此处随意填 + prodInfo.detail.max_group_price = 0; + // 聚水潭没有此处随意填 + prodInfo.detail.min_group_price = 0; + prodInfo.detail.must_check_type = 0; + prodInfo.detail.name_prefix = ""; + prodInfo.detail.origin_country_id = 0; + prodInfo.detail.origin_country_name = ""; + // 货号 + prodInfo.detail.out_goods_sn = jstSecretCodeLst["goodsId"].ParseToString(); + // 货号直接替换成加密的,注意千万不要入库 + dbProd.ext_code = prodInfo.detail.out_goods_sn; + if (prodInfo.detail.out_goods_sn.IsNullOrEmpty()) + { + convertRst = "货号不存在"; + return null; + } + prodInfo.detail.out_source_goods_id = null; + prodInfo.detail.out_source_type = null; + prodInfo.detail.oversea_goods = null; + prodInfo.detail.oversea_type = 0; + prodInfo.detail.owner = "主账号"; + prodInfo.detail.owner_name = ""; + prodInfo.detail.paper_length = null; + prodInfo.detail.paper_net_weight = null; + prodInfo.detail.paper_plies_num = null; + prodInfo.detail.paper_width = null; + prodInfo.detail.pre_sale_time = 0; + prodInfo.detail.privacy_delivery = 0; + prodInfo.detail.processing_charges = null; + prodInfo.detail.processing_charges_type = null; + prodInfo.detail.promised_delivery_seconds = null; + prodInfo.detail.purchase_info_supply = 0; + prodInfo.detail.qualification_id_list = new List(); + prodInfo.detail.quan_guo_lian_bao = 0; + prodInfo.detail.quick_refund = 0; + prodInfo.detail.reason = null; + prodInfo.detail.region_limit = 1; + prodInfo.detail.reject_reason = null; + prodInfo.detail.reject_status = null; + prodInfo.detail.same_city_template_id = 0; + prodInfo.detail.schedule_sale = new schedule_sale_item() { sale_type = 0 }; + prodInfo.detail.second_hand = 0; + prodInfo.detail.sf_markup_template_sn = null; + prodInfo.detail.shang_men_an_zhuang = null; + // 聚水潭没有 + prodInfo.detail.share_desc = ""; + prodInfo.detail.shipment_limit_second = 172800; + prodInfo.detail.shoes_template_id = null; + prodInfo.detail.shop_group_id = null; + prodInfo.detail.shop_group_name = null; + prodInfo.detail.show_activity_price = false; + prodInfo.detail.size_parent_spec_id = null; + prodInfo.detail.size_spec_id = null; + + if (jstGoodsObj["skuInfo"].IsJTokenNullOrEmpty() || jstGoodsObj["skuInfo"]["goodsSkuDetail"].IsJTokenNullOrEmpty()) + { + convertRst = "缺少sku信息"; + return null; + } + prodInfo.detail.sku = new List(); + foreach (JObject jSku in jstGoodsObj["skuInfo"]["goodsSkuDetail"]) + { + sku_item skuInfo = new sku_item() + { + id = 0, + // 聚水潭为string,散列取数值 + sku_id = jSku["baseSkuId"].ParseToString().GetHashCode(), + sku_sn = null, + carnival_price = 0, + init_quantity = 0, + is_onsale = 1, + limit_quantity = 999999, + multi_price = (int)(jSku["supplyPrice"].ParseToDecimal() * 100), + multi_price_in_yuan = null, + price = (int)(jSku["supplyPrice"].ParseToDecimal() * 100 + 100), + price_in_yuan = null, + quantity = 0, + reserve_quantity = 0, + weight = (int)(jSku["weight"].ParseToDecimal() * 1000), + thumb_url = jSku["pic"].ParseToString(), + thumb_url_file_id = null, + thumb_url_status = null, + thumb_url_is_deleted = null, + quantity_delta = 0, + spec = new List(), + // sku货号 + out_sku_sn = "", + batch_id = null, + priority = 1, + ware_id = 0, + ware_biz_type = null, + advice_price = null, + length = null, + oversea_sku = null, + cspu_id = null, + child_skus = null, + ref_sku_commit_id = 0, + start_time = null, + end_time = null, + sku_srv_templates = null, + calendar_rule_id = null, + hot_live_group = null, + pre_sale_time = 0, + out_source_sku_id = null, + dd_grocery_sku_params = null, + sku_extended_attribute_dtos = null, + sku_basic_property_dtos = null, + spec_note_map = null, + delivery_schedule_dtos = null, + shipment_limit_second_list = null, + sku69_code = "", + }; + foreach (JObject jSpec in jSku["skus"]) + { + skuInfo.spec.Add(new spec_item() + { + parent_id = jSpec["kid"].ParseToLong(), + parent_name = jSpec["k"].ParseToString(), + spec_id = jSpec["vid"].ParseToLong(), + spec_name = jSpec["v"].ParseToString(), + }); + } + var itemNo = jSku["itemNo"].ParseToString(); + var skuId = jstSecretCodeLst["skus"].FirstOrDefault(s => s["skuCode"].ParseToString() == itemNo)?["skuId"].ParseToString(); + skuInfo.out_sku_sn = skuId; + if (skuId.IsNullOrEmpty()) + { + convertRst = "SKU货号不存在"; + return null; + } + prodInfo.detail.sku.Add(skuInfo); + } + prodInfo.detail.sku_type = null; + prodInfo.detail.song_huo_an_zhuang = null; + prodInfo.detail.song_huo_ru_hu = null; + prodInfo.detail.source = 0; + prodInfo.detail.spu_id = null; + prodInfo.detail.spu_version = null; + prodInfo.detail.submit_time = 0; + prodInfo.detail.thawed_refund = 0; + prodInfo.detail.third_type = 0; + // 复用前面填过的主图 + prodInfo.detail.thumb_url = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1)?.url; + prodInfo.detail.tiny_name = ""; + prodInfo.detail.transport_type_list = null; + prodInfo.detail.two_pieces_discount = 99; + prodInfo.detail.user_source = 1; + prodInfo.detail.warehouse = ""; + prodInfo.detail.warm_tips = ""; + prodInfo.detail.zhi_huan_bu_xiu = 0; + + prodInfo.size = null; + prodInfo.material1 = null; + prodInfo.material3 = null; + prodInfo.property = new PDDProductPropertyInfo(); + prodInfo.property.sku_properties = new object(); + prodInfo.property.goods_properties = new List(); + + if (!jstGoodsObj["goodsProperties"].IsJTokenNullOrEmpty()) + { + foreach (JObject jProp in jstGoodsObj["goodsProperties"]) + { + string name = ""; + if (!jProp["propName"].IsJTokenNullOrEmpty()) + name = jProp["propName"].ParseToString(); + else + { + try + { + if (jstPddPropMapLst != null) + name = jstPddPropMapLst.FirstOrDefault(p => p.ref_pid.ParseToString() == jProp["refPid"].ParseToString())?.name; + if (string.IsNullOrEmpty(name)) + name = jProp["refPid"].ParseToString(); + } + catch + { + } + } + goods_propertie_item propInfo = new goods_propertie_item(); + propInfo.name = name; + propInfo.ref_pid = jProp["refPid"].ParseToInt(); + string propStr = JsonHelper.SerializeObject(jProp); + propInfo.values = new List(); + if (propStr.Contains("multipleValue")) + { + foreach (var propValueObj in jProp["multipleValue"]) + { + propInfo.values.Add(new value_item() + { + value = propValueObj["label"].ParseToString(), + raw_value = propValueObj["label"].ParseToString(), + vid = propValueObj["value"].ParseToLong(), + unit = "" + }); + } + } + else + { + var label = BaseRegex.GetStringJson(ref propStr, "label"); + var valueId = BaseRegex.GetStringJson(ref propStr, "value").ParseToLong(); + propInfo.values.Add(new value_item() + { + value = label, + raw_value = label, + vid = valueId, + unit = "" + }); + } + } + } + else + { + //outGoodsParam.productAttrs.Add(new osProductAttrParam { attrKey = "品牌", attrValue = "无品牌" }); + } + // 主图 + dbProd.main_img = prodInfo.detail.galleries.FirstOrDefault(g => g.type == 1).url; + dbProd.product_json = JsonHelper.SerializeObject(prodInfo); + + return prodInfo; + + //bool isExist = false; + //var existUrl = BaseClass.BuildPDDObjString("product/get_product_list"); + //string existData = UserLogin.GetSignaturex() + "&search_spu=" + prodInfo.detail.goods_id; + //string html = GetHtml.PostUtf8(existUrl, existData); + //if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + // html = GetHtml.PostUtf8(existUrl, existData); + //if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + // html = GetHtml.PostUtf8(existUrl, existData); + //if (!string.IsNullOrEmpty(html) && html.Contains("\"code\":200")) + //{ + // if (html.Contains("\"data\":[") && !html.Contains("\"data\":[]")) + // isExist = true; + //} + //else + //{ + // return "入库失败,产品数据库已存在商品查询失败"; + //} + + //var url = BaseClass.BuildPDDObjString("product/add_product"); + //if (isExist) + //{ + // if (UpdateOldData) + // { + // url = BaseClass.BuildPDDObjString("product/mdy_product"); + // } + // else + // { + // return "已存在相同id商品,跳过"; + // } + //} + + //var data = Work.UserLogin.GetSignaturex() + + // "&from_shop_id=" + frontProdInfo.mall?.mall_id + + // "&spu_id=" + prodInfo.detail.goods_id.ParseToString() + + // "&skc_id=" + prodInfo.detail.goods_id.ParseToString() + + // "&price_text=" + prodInfo.detail.sku.Min(s => s.multi_price).ParseToInt() * 0.01m + "-" + prodInfo.detail.sku.Max(s => s.multi_price).ParseToInt() * 0.01m + + // "&main_cat_id=" + (prodInfo.detail.cat_ids?.FirstOrDefault(c => c != null)).ParseToString() + + // "&main_cat_name=" + HttpUtility.UrlEncode((prodInfo.detail.cat_ids?.FirstOrDefault(c => c != null)).ParseToString(), Encoding.UTF8) + // 取不到catname直接用catid,上货时候再取 + // "&cat_id=" + prodInfo.detail.cat_id.ParseToString() + + // "&cat_name=" + HttpUtility.UrlEncode(prodInfo.detail.cat_id.ParseToString(), Encoding.UTF8) + // 取不到catname直接用catid,上货时候再取 + // "&ext_code=" + HttpUtility.UrlEncode(prodInfo.detail.out_goods_sn, Encoding.UTF8) + + // "&product_name=" + HttpUtility.UrlEncode(prodInfo.detail.goods_name, Encoding.UTF8) + + // "&product_json=" + HttpUtility.UrlEncode(dbProd.product_json, Encoding.UTF8) + + // "&size_json=" + HttpUtility.UrlEncode(dbProd.size_json, Encoding.UTF8) + + // "&main_img=" + HttpUtility.UrlEncode(dbProd.main_img, Encoding.UTF8) + + // "&sale_count=" + HttpUtility.UrlEncode(prodInfo.sale_count, Encoding.UTF8) + + // "&sale_count_text=" + HttpUtility.UrlEncode(prodInfo.sale_count_text, Encoding.UTF8) + + // "&product_get_type=" + HttpUtility.UrlEncode("外部数据", Encoding.UTF8); + + //html = GetHtml.PostUtf8(url, data); + //if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + // html = GetHtml.PostUtf8(url, data); + //if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + //{ + // return "商品采集保存失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg"); + //} + //return ""; + } + catch (Exception ex) + { + convertRst = "转换错误 " + ex.Message; + return null; + } + } } } diff --git a/TEMUKJD/BLL/WXHttpResponseBLL.cs b/TEMUKJD/BLL/WXHttpResponseBLL.cs index f841239..fc6ca03 100644 --- a/TEMUKJD/BLL/WXHttpResponseBLL.cs +++ b/TEMUKJD/BLL/WXHttpResponseBLL.cs @@ -328,5 +328,131 @@ namespace TemuKJD.BLL result = GetProxyHtml.ReadResponse(response); return result; } + + public static string e57PostResponse(string _url, string _data, string referer) + { + HttpWebResponse response = null; + string result; + try + { + string url = _url; + HttpWebRequest request; + if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase)) + { + ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true; + ServicePointManager.SecurityProtocol = + ServicePointManager.SecurityProtocol | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; + request = WebRequest.Create(url) as HttpWebRequest; + request.ProtocolVersion = HttpVersion.Version10; + } + else + request = (HttpWebRequest)WebRequest.Create(url); + + request.KeepAlive = true; + //request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0"); + //request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"; + request.ContentType = "application/json"; + //request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"; //request.Accept = "*/*"; + //request.Referer = referer; + //request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate"); + //request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9"); + request.Headers.Add("sec-ch-ua", @"""Not(A:Brand"";v=""8"", ""Chromium"";v=""144"", ""Google Chrome"";v=""144"""); + request.Headers.Add("sec-ch-ua-mobile", @"?0"); + request.Headers.Add("sec-ch-ua-platform", @"""Windows"""); + request.Headers.Add("Upgrade-Insecure-Requests", @"1"); + request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36"; + request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"; + request.Headers.Add("Sec-Fetch-Site", @"none"); + request.Headers.Add("Sec-Fetch-Mode", @"navigate"); + request.Headers.Add("Sec-Fetch-User", @"?1"); + request.Headers.Add("Sec-Fetch-Dest", @"document"); + request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate"); + request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9"); + + request.Method = "POST"; + request.ServicePoint.Expect100Continue = false; + + string body = _data; + byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(body); + request.ContentLength = postBytes.Length; + Stream stream = request.GetRequestStream(); + stream.Write(postBytes, 0, postBytes.Length); + stream.Close(); + + response = (HttpWebResponse)request.GetResponse(); + } + catch (WebException ex) + { + if (ex.Status == WebExceptionStatus.ProtocolError) + { + response = (HttpWebResponse)ex.Response; + result = GetProxyHtml.ReadResponse(response); + return result; + } + else return ex.Message; + } + catch (Exception e) + { + if (response != null) response.Close(); + return e.Message; + } + result = GetProxyHtml.ReadResponse(response); + return result; + } + + public static string e57GetResponse(string _url, string referer) + { + HttpWebResponse response = null; + string result; + try + { + string url = _url; + + HttpWebRequest request; + if (url.StartsWith("https", StringComparison.OrdinalIgnoreCase)) + { + ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true; + ServicePointManager.SecurityProtocol = + ServicePointManager.SecurityProtocol | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; + request = WebRequest.Create(url) as HttpWebRequest; + request.ProtocolVersion = HttpVersion.Version10; + } + else + request = (HttpWebRequest)WebRequest.Create(url); + + request.KeepAlive = true; + request.Headers.Add("sec-ch-ua", @"""Not(A:Brand"";v=""8"", ""Chromium"";v=""144"", ""Google Chrome"";v=""144"""); + request.Headers.Add("sec-ch-ua-mobile", @"?0"); + request.Headers.Add("sec-ch-ua-platform", @"""Windows"""); + request.Headers.Add("Upgrade-Insecure-Requests", @"1"); + request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36"; + request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7"; + request.Headers.Add("Sec-Fetch-Site", @"none"); + request.Headers.Add("Sec-Fetch-Mode", @"navigate"); + request.Headers.Add("Sec-Fetch-User", @"?1"); + request.Headers.Add("Sec-Fetch-Dest", @"document"); + request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate"); + request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9"); + + response = (HttpWebResponse)request.GetResponse(); + } + catch (WebException ex) + { + if (ex.Status == WebExceptionStatus.ProtocolError) + { + response = (HttpWebResponse)ex.Response; + result = GetProxyHtml.ReadResponse(response); + return result; + } + else return ex.Message; + } + catch (Exception e) + { + if (response != null) response.Close(); + return e.Message; + } + result = GetProxyHtml.ReadResponse(response); + return result; + } } } diff --git a/TEMUKJD/BLL/WxProdFormConverter.cs b/TEMUKJD/BLL/WxProdFormConverter.cs new file mode 100644 index 0000000..d019738 --- /dev/null +++ b/TEMUKJD/BLL/WxProdFormConverter.cs @@ -0,0 +1,140 @@ +using AllBase; +using AllBase.Model.Param; +using AllBase.Model.Result; +using AllBase.Model.Result.PDDResult; +using NaiBa.Util.Extension; +using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace TemuKJD.BLL +{ + public class WxProdFormConverter + { + /// + /// 聚水潭拼多多数据格式转换成外部服务器格式 + /// + /// + public string JstPddConvertToWxOutServer(KJDDBProduct dbProd) + { + OutServerGoodsParam outGoodsParam = new OutServerGoodsParam(); + try + { + var prodObj = JsonHelper.JObjectParse(dbProd.product_json); + var jstGoodsObj = prodObj["pddData"]; + var jstPddPropMapLst = JsonHelper.DeserializeJsonToList(JsonHelper.SerializeObject(prodObj["pddPropMap"])); + outGoodsParam.categoryId = dbProd.wx_cat_leaf.ParseToString(); + outGoodsParam.catId = dbProd.wx_cat_leaf; + outGoodsParam.createBy = ""; + outGoodsParam.createTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); + outGoodsParam.descImgs = JsonHelper.SerializeObject(jstGoodsObj["detailGallery"]); + outGoodsParam.descText = jstGoodsObj["goodsDesc"].ParseToString(); + outGoodsParam.detailImgList = JsonHelper.DeserializeJsonToList(outGoodsParam.descImgs); + outGoodsParam.extStatus = 1; + outGoodsParam.freightPrice = null; + outGoodsParam.goodsIds = null; + outGoodsParam.groupKey = null; + outGoodsParam.headImgs = JsonHelper.SerializeObject(jstGoodsObj["carouselGallery"]); + outGoodsParam.headImgList = JsonHelper.DeserializeJsonToList(outGoodsParam.headImgs); + outGoodsParam.headImg = outGoodsParam.headImgList.FirstOrDefault(); + outGoodsParam.isDelete = 0; + outGoodsParam.merchantId = null; // dbProd.skc_id; + outGoodsParam.platform = "WEISHOP"; + outGoodsParam.platformCode = "WEISHOP"; + outGoodsParam.productAttrs = new List(); + if (!jstGoodsObj["goodsProperties"].IsJTokenNullOrEmpty()) + { + foreach (JObject jProp in jstGoodsObj["goodsProperties"]) + { + string name = ""; + string value = ""; + if (!jProp["propName"].IsJTokenNullOrEmpty()) + name = jProp["propName"].ParseToString(); + else + { + try + { + if (jstPddPropMapLst != null) + name = jstPddPropMapLst.FirstOrDefault(p => p.ref_pid.ParseToString() == jProp["refPid"].ParseToString())?.name; + if (string.IsNullOrEmpty(name)) + name = jProp["refPid"].ParseToString(); + } + catch + { + } + } + string propStr = JsonHelper.SerializeObject(jProp); + value = BaseRegex.GetStringJson(ref propStr, "label"); + outGoodsParam.productAttrs.Add(new osProductAttrParam() { attrKey = name, attrValue = value }); + } + } + else + { + outGoodsParam.productAttrs.Add(new osProductAttrParam { attrKey = "品牌", attrValue = "无品牌" }); + } + outGoodsParam.remark = ""; + outGoodsParam.selectionQuareGoodsExtList = null; + outGoodsParam.selectionQuareGoodsSkus = null; + outGoodsParam.shipType = 20; + outGoodsParam.skus = new List(); + if (!jstGoodsObj["skuInfo"].IsJTokenNullOrEmpty() && !jstGoodsObj["skuInfo"]["goodsSkuDetail"].IsJTokenNullOrEmpty()) + { + foreach (JObject jSku in jstGoodsObj["skuInfo"]["goodsSkuDetail"]) + { + osSkuParam skuParam = new osSkuParam() + { + latestPrice = jSku["supplyPrice"].ParseToString(), + latestPriceTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), + latestUpdateTime = null, + platform = null, + platformSkuId = null, + remark = "", + salePrice = (jSku["supplyPrice"].ParseToDecimal() * 100).ParseToInt(), + skuAttrs = new List(), + skuCode = jSku["itemNo"].ParseToString(), //jSku["realItemNo"].ParseToString(), // realItemNo有的商品没有 + skuId = null, + skuImags = null, + skuWeight = (jSku["weight"].ParseToDecimal() * 1000).ParseToInt(), + status = 1, + stockNum = jSku["quantity"].ParseToInt(), + supplierId = dbProd.skc_id.ParseToLong(), // null + thumbImg = jSku["pic"].ParseToString(), + title = "", + warehouseSkuId = jSku["baseSkuId"].ParseToString(), + }; + foreach (JObject jSpec in jSku["skus"]) + { + skuParam.skuAttrs.Add(new skuAttrParam() + { + attrKey = jSpec["k"].ParseToString(), + attrValue = jSpec["v"].ParseToString(), + }); + } + skuParam.title = string.Join(";", skuParam.skuAttrs.Select(s => s.attrValue)); + outGoodsParam.skus.Add(skuParam); + } + } + outGoodsParam.spuCode = jstGoodsObj["styleCode"].ParseToString(); + outGoodsParam.status = 1; + outGoodsParam.subTitle = jstGoodsObj["goodsName"].ParseToString(); + outGoodsParam.supplier = dbProd.from_shop_name; + outGoodsParam.supplierId = dbProd.skc_id.ParseToLong(); // dbProd.from_shop_id + outGoodsParam.title = jstGoodsObj["goodsName"].ParseToString(); + outGoodsParam.updateBy = null; + outGoodsParam.updateTime = null; + outGoodsParam.warehouseDisablePlatformList = null; + outGoodsParam.warehouseGoodsId = dbProd.spu_id; + outGoodsParam.warehouseNum = dbProd.skc_id; + + return "{\"success\":true,\"msg\":\"\",\"data\":" + JsonHelper.SerializeObject(outGoodsParam) + "}"; + } + catch (Exception ex) + { + return "{\"success\":false,\"msg\":\"" + ex.Message + "\"}"; + } + } + } +} diff --git a/TEMUKJD/Extension/DataGridViewExtension.cs b/TEMUKJD/Extension/DataGridViewExtension.cs index 3fbebf5..c41d014 100644 --- a/TEMUKJD/Extension/DataGridViewExtension.cs +++ b/TEMUKJD/Extension/DataGridViewExtension.cs @@ -9,6 +9,7 @@ using System.Data; using System.Drawing; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; @@ -68,7 +69,7 @@ namespace TemuKJD.Extension checkBox.Enabled = true; // Reset properties - checkBox.Padding = new Padding(6,2,0,0); + checkBox.Padding = new Padding(6, 2, 0, 0); checkBox.Margin = new Padding(0); checkBox.Text = ""; @@ -258,11 +259,11 @@ namespace TemuKJD.Extension bool isResize = false; // 是否已调整过表头 //合并列中某一列的列宽变化时,强制重绘表头 - dgv.ColumnWidthChanged += (s, e) => + dgv.ColumnWidthChanged += (s, e) => { if (colNameCollection.Contains(e.Column.Name)) { - foreach(var columnName in colNameCollection) + foreach (var columnName in colNameCollection) { if (dgv.Columns.Contains(columnName)) dgv.InvalidateCell(dgv.Columns[columnName].HeaderCell); // 标记单元格为需要重绘 @@ -298,7 +299,7 @@ namespace TemuKJD.Extension //处理重绘事件,绘制合并表头和二级表头 dgv.CellPainting += (s, e) => { - if (e.RowIndex == -1 && e.ColumnIndex >=0) // 重绘表头单元格及标题 + if (e.RowIndex == -1 && e.ColumnIndex >= 0) // 重绘表头单元格及标题 { string name = dgv.Columns[e.ColumnIndex].Name; // 调整为复合表头 @@ -465,7 +466,7 @@ namespace TemuKJD.Extension //处理重绘事件 dgv.CellPainting += (s, e) => { - if (e.RowIndex >=0 && e.ColumnIndex >= 0) // 重绘单元格 + if (e.RowIndex >= 0 && e.ColumnIndex >= 0) // 重绘单元格 { string name = dgv.Columns[e.ColumnIndex].Name; if (colNameCollection.Contains(name)) @@ -604,7 +605,7 @@ namespace TemuKJD.Extension { if (e.RowIndex >= 0 && e.ColumnIndex >= 0) // 重绘单元格 { - foreach(DataGridViewCell cell in cellLst) + foreach (DataGridViewCell cell in cellLst) { if (cell.RowIndex == e.RowIndex && cell.ColumnIndex == e.ColumnIndex) { @@ -644,7 +645,7 @@ namespace TemuKJD.Extension //VerGridColorSelect = Color.FromArgb(129, 129, 129); selectColor = dgv.DefaultCellStyle.SelectionBackColor; //if ((dgv.Rows[e.RowIndex].Cells[e.ColumnIndex]).Selected) - if (cellLst.Any(c =>c.Selected)) + if (cellLst.Any(c => c.Selected)) { //using (pen = new Pen(selectColor.Value)) //{ @@ -735,29 +736,55 @@ namespace TemuKJD.Extension public static void AddImgColumn(this DataGridView dgv, string imgColumn, string imgPathColumn, bool isSetHttpsHttp = true) { + bool isScroll = false; + dgv.Scroll += (s, e) => { - ShowDgvImg(dgv, null, imgColumn, imgPathColumn, isSetHttpsHttp); - }; - dgv.Resize += (s, e) => - { - ShowDgvImg(dgv, null, imgColumn, imgPathColumn, isSetHttpsHttp); + Task.Run(() => + { + while (isScroll && 1 == 1) + Thread.Sleep(1); + isScroll = true; + ShowDgvImg(dgv, dgv.Rows.Cast().ToList(), imgColumn, imgPathColumn, isSetHttpsHttp); + isScroll = false; + }); }; + //dgv.Resize += (s, e) => + //{ + // ShowDgvImg(dgv, null, imgColumn, imgPathColumn, isSetHttpsHttp); + //}; dgv.Sorted += (s, e) => { - ShowDgvImg(dgv, null, imgColumn, imgPathColumn, isSetHttpsHttp); - }; - dgv.RowsRemoved += (s, e) => - { - ShowDgvImg(dgv, null, imgColumn, imgPathColumn, isSetHttpsHttp); - }; - dgv.RowsAdded += (s, e) => - { - ShowDgvImg(dgv, new ConcurrentList { dgv.Rows[e.RowIndex] }, imgColumn, imgPathColumn, isSetHttpsHttp); + Task.Run(() => + { + while (isScroll && 1 == 1) + Thread.Sleep(1); + isScroll = true; + ShowDgvImg(dgv, dgv.Rows.Cast().ToList(), imgColumn, imgPathColumn, isSetHttpsHttp); + isScroll = false; + }); }; + //dgv.RowsRemoved += (s, e) => + //{ + // ShowDgvImg(dgv, null, imgColumn, imgPathColumn, isSetHttpsHttp); + //}; + //dgv.RowsAdded += (s, e) => + //{ + // ShowDgvImg(dgv, new List { dgv.Rows[e.RowIndex] }, imgColumn, imgPathColumn, isSetHttpsHttp); + //}; dgv.RowPostPaint += (s, e) => { - ShowDgvImg(dgv, new ConcurrentList { dgv.Rows[e.RowIndex] }, imgColumn, imgPathColumn, isSetHttpsHttp); + if (e.RowIndex >= 0 && e.RowIndex < 25) + { + Task.Run(() => + { + while (isScroll && 1 == 1) + Thread.Sleep(1); + isScroll = true; + ShowDgvImg(dgv, new List { dgv.Rows[e.RowIndex] }, imgColumn, imgPathColumn, isSetHttpsHttp); + isScroll = false; + }); + } }; dgv.CellValueChanged += (s, e) => { @@ -767,79 +794,85 @@ namespace TemuKJD.Extension if (row.Cells[imgColumn].Value != null && row.Cells[imgColumn].Value != defaultBitmap) { row.Cells[imgColumn].Value = defaultBitmap; - ShowDgvImg(dgv, new ConcurrentList { row }, imgColumn, imgPathColumn, isSetHttpsHttp); + Task.Run(() => + { + while (isScroll && 1 == 1) + Thread.Sleep(1); + isScroll = true; + ShowDgvImg(dgv, new List { row }, imgColumn, imgPathColumn, isSetHttpsHttp); + isScroll = false; + }); } } }; } - public static Bitmap defaultBitmap = new Bitmap(1,1); - static void ShowDgvImg(DataGridView dgv, ConcurrentList rowLst, string imgColumn, string imgPathColumn, bool isSetHttpsHttp = true) + + public static Bitmap defaultBitmap = new Bitmap(1, 1); + static void ShowDgvImg(DataGridView dgv, List rowLst, string imgColumn, string imgPathColumn, bool isSetHttpsHttp = true) { - Task.Run(() => + if (rowLst == null) { - if (rowLst == null) - { - rowLst = new ConcurrentList(); - rowLst.AddRange(dgv.Rows.Cast()); - } - foreach (DataGridViewRow row in rowLst) + rowLst = new List(); + rowLst.AddRange(dgv.Rows.Cast()); + } + foreach (DataGridViewRow row in rowLst) + { + //if (row.Index <= 1) + // continue; + if (row.Displayed == false) { dgv.Invoke(new Action(() => { - if (row.Index > 1 && row.Cells[imgColumn].Displayed == false) - { - //dgv.Invoke(new Action(() => - //{ - try - { - if (row.Index > 0) - row.Cells[imgColumn].Value = defaultBitmap; - } - catch - { - } - //})); - return; - } - - if (row.Index < 0) - return; - if (row.Index >= 0 && row.Cells[imgColumn]?.Value != null && row.Cells[imgColumn]?.Value != defaultBitmap) - return; - - Image image = defaultBitmap; - if (row.Index >= 0) - { - string imgUrl = row.Cells[imgPathColumn]?.Value.ParseToString(); - if (isSetHttpsHttp == true) - imgUrl = imgUrl.Replace("https://", "http://"); - string getImgError = ""; - if (!string.IsNullOrWhiteSpace(imgUrl)) - { - image = GetHtml.GetUrlImg(imgUrl, out getImgError); - if (!string.IsNullOrEmpty(getImgError)) - //BaseMsgForm.ShowError("图片加载失败 " + getImgError); - image = TemuKJD.Properties.Resources.errpic; - } - } - try { - //dgv.Invoke(new Action(() => - //{ - if (row.Index >= 0) - { - row.Cells[imgColumn].Value = image; - } - //})); + if (row.Index >= 0 && row.Cells[imgColumn]?.Value != defaultBitmap) + row.Cells[imgColumn].Value = defaultBitmap; } catch { } })); + continue; } - }); - } + else + { + try + { + if (row.Cells[imgColumn]?.Value == defaultBitmap || row.Cells[imgColumn]?.Value == null) + { + Image image = defaultBitmap; + string imgUrl = row.Cells[imgPathColumn]?.Value.ParseToString(); + if (!string.IsNullOrWhiteSpace(imgUrl)) + { + if (isSetHttpsHttp == true) + imgUrl = imgUrl.Replace("https://", "http://"); + string getImgError = ""; + image = GetHtml.GetUrlImg(imgUrl, out getImgError); + if (!string.IsNullOrEmpty(getImgError)) + //BaseMsgForm.ShowError("图片加载失败 " + getImgError); + image = TemuKJD.Properties.Resources.errpic; + } + dgv.Invoke(new Action(() => + { + try + { + if (row.Index >= 0) + { + row.Cells[imgColumn].Value = image; + } + } + catch + { + } + })); + } + } + catch + { + } + } + } + } } } diff --git a/TEMUKJD/KJD.csproj b/TEMUKJD/KJD.csproj index 0317579..911581d 100644 --- a/TEMUKJD/KJD.csproj +++ b/TEMUKJD/KJD.csproj @@ -127,6 +127,7 @@ + Form diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs index b6bfae6..f5484b9 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.Designer.cs @@ -38,10 +38,13 @@ namespace TemuKJD.PDDForms.ProductSelectForms System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PDDDBProdListForm)); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.cmbWxCat = new System.Windows.Forms.ComboBox(); - this.label12 = new System.Windows.Forms.Label(); + this.btnStopStop = new DevComponents.DotNetBar.PanelEx(); + this.btnPull = new DevComponents.DotNetBar.PanelEx(); + this.btnPushToOutServer = new DevComponents.DotNetBar.PanelEx(); this.btnGetProdWxCate = new DevComponents.DotNetBar.PanelEx(); this.cmbSetWxSafe = new System.Windows.Forms.ComboBox(); this.btnSetWxSafe = new DevComponents.DotNetBar.PanelEx(); @@ -53,34 +56,40 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.label8 = new System.Windows.Forms.Label(); this.txtReplaceText = new System.Windows.Forms.TextBox(); this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.cmbSpProdType = new System.Windows.Forms.ComboBox(); - this.label11 = new System.Windows.Forms.Label(); + this.cmbCat1 = new System.Windows.Forms.ComboBox(); + this.cmbCat2 = new System.Windows.Forms.ComboBox(); + this.label14 = new System.Windows.Forms.Label(); + this.label13 = new System.Windows.Forms.Label(); this.cmbSourceType = new System.Windows.Forms.ComboBox(); this.label10 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.txtSPU = new System.Windows.Forms.TextBox(); + this.cmbWxCat = new System.Windows.Forms.ComboBox(); this.label2 = new System.Windows.Forms.Label(); - this.txtCat = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.txtProdName = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.txtExtCode = new System.Windows.Forms.TextBox(); - this.label6 = new System.Windows.Forms.Label(); this.cmbSort = new System.Windows.Forms.ComboBox(); + this.label6 = new System.Windows.Forms.Label(); + this.label4 = new System.Windows.Forms.Label(); + this.label12 = new System.Windows.Forms.Label(); + this.txtExtCode = new System.Windows.Forms.TextBox(); this.btnSearch = new DevComponents.DotNetBar.PanelEx(); this.lblNotes = new System.Windows.Forms.Label(); this.txtNotes = new System.Windows.Forms.TextBox(); this.lblGroup = new System.Windows.Forms.Label(); this.cmbGroupFilter = new System.Windows.Forms.ComboBox(); + this.pnlEmpty = new DevComponents.DotNetBar.PanelEx(); + this.cmbExportToOutServer = new System.Windows.Forms.ComboBox(); + this.label3 = new System.Windows.Forms.Label(); + this.txtProdName = new System.Windows.Forms.TextBox(); this.cmbWxSafe = new System.Windows.Forms.ComboBox(); this.lblWxSafe = new System.Windows.Forms.Label(); - this.pnlEmpty = new DevComponents.DotNetBar.PanelEx(); this.btnExportTxt = new DevComponents.DotNetBar.PanelEx(); this.btnDelSelect = new DevComponents.DotNetBar.PanelEx(); this.cmbGroup = new System.Windows.Forms.ComboBox(); this.btnSetGroup = new DevComponents.DotNetBar.PanelEx(); this.label7 = new System.Windows.Forms.Label(); + this.chkPullAfterPush = new TemuKJD.UserComponent.UcCheckBox(this.components); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); + this.cmbSpProdType = new System.Windows.Forms.ComboBox(); this.btnGetAllCate = new DevComponents.DotNetBar.PanelEx(); this.pnlEditExtCodePrice = new System.Windows.Forms.Panel(); this.lblExtCode = new System.Windows.Forms.Label(); @@ -93,6 +102,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.txtSKC = new System.Windows.Forms.TextBox(); this.label1 = new System.Windows.Forms.Label(); this.btnSelect = new DevComponents.DotNetBar.PanelEx(); + this.label11 = new System.Windows.Forms.Label(); this.dgvDbProduct = new TemuKJD.UserComponent.DataGridViewEx(); this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.col_db_id = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -104,6 +114,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.colSkuReplaceImg = new System.Windows.Forms.DataGridViewImageColumn(); this.col_spu_id = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.col_skc_id = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colMainCate = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.col_cat_name = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.col_ext_code = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colGroup = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -153,8 +164,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // splitContainer1.Panel1 // - this.splitContainer1.Panel1.Controls.Add(this.cmbWxCat); - this.splitContainer1.Panel1.Controls.Add(this.label12); + this.splitContainer1.Panel1.Controls.Add(this.btnStopStop); + this.splitContainer1.Panel1.Controls.Add(this.btnPull); + this.splitContainer1.Panel1.Controls.Add(this.btnPushToOutServer); this.splitContainer1.Panel1.Controls.Add(this.btnGetProdWxCate); this.splitContainer1.Panel1.Controls.Add(this.cmbSetWxSafe); this.splitContainer1.Panel1.Controls.Add(this.btnSetWxSafe); @@ -171,6 +183,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.splitContainer1.Panel1.Controls.Add(this.cmbGroup); this.splitContainer1.Panel1.Controls.Add(this.btnSetGroup); this.splitContainer1.Panel1.Controls.Add(this.label7); + this.splitContainer1.Panel1.Controls.Add(this.chkPullAfterPush); // // splitContainer1.Panel2 // @@ -179,31 +192,80 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.splitContainer1.SplitterDistance = 76; this.splitContainer1.TabIndex = 1; // - // cmbWxCat + // btnStopStop // - this.cmbWxCat.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.cmbWxCat.FormattingEnabled = true; - this.cmbWxCat.Items.AddRange(new object[] { - "", - "有", - "无"}); - this.cmbWxCat.Location = new System.Drawing.Point(676, 9); - this.cmbWxCat.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); - this.cmbWxCat.Name = "cmbWxCat"; - this.cmbWxCat.Size = new System.Drawing.Size(49, 25); - this.cmbWxCat.TabIndex = 802; - this.cmbWxCat.Text = "无"; + this.btnStopStop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnStopStop.CanvasColor = System.Drawing.SystemColors.Control; + this.btnStopStop.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnStopStop.DisabledBackColor = System.Drawing.Color.Empty; + this.btnStopStop.Location = new System.Drawing.Point(668, 9); + this.btnStopStop.Name = "btnStopStop"; + this.btnStopStop.Size = new System.Drawing.Size(76, 25); + this.btnStopStop.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnStopStop.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.btnStopStop.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.btnStopStop.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.btnStopStop.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnStopStop.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.btnStopStop.Style.GradientAngle = 90; + this.btnStopStop.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; + this.btnStopStop.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnStopStop.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnStopStop.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnStopStop.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; + this.btnStopStop.TabIndex = 878; + this.btnStopStop.Text = "停止查询"; + this.btnStopStop.Click += new System.EventHandler(this.btnStopStop_Click); // - // label12 + // btnPull // - this.label12.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(619, 13); - this.label12.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(68, 17); - this.label12.TabIndex = 801; - this.label12.Text = "微信类目:"; + this.btnPull.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnPull.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnPull.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnPull.DisabledBackColor = System.Drawing.Color.Empty; + this.btnPull.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnPull.Location = new System.Drawing.Point(806, 43); + this.btnPull.Name = "btnPull"; + this.btnPull.Size = new System.Drawing.Size(34, 25); + this.btnPull.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnPull.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnPull.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnPull.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnPull.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnPull.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnPull.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnPull.Style.GradientAngle = 90; + this.btnPull.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnPull.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnPull.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnPull.TabIndex = 849; + this.btnPull.Text = "拉回"; + this.btnPull.Click += new System.EventHandler(this.btnPull_Click); + // + // btnPushToOutServer + // + this.btnPushToOutServer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnPushToOutServer.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnPushToOutServer.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnPushToOutServer.DisabledBackColor = System.Drawing.Color.Empty; + this.btnPushToOutServer.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnPushToOutServer.Location = new System.Drawing.Point(746, 43); + this.btnPushToOutServer.Name = "btnPushToOutServer"; + this.btnPushToOutServer.Size = new System.Drawing.Size(58, 25); + this.btnPushToOutServer.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnPushToOutServer.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnPushToOutServer.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnPushToOutServer.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnPushToOutServer.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnPushToOutServer.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnPushToOutServer.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnPushToOutServer.Style.GradientAngle = 90; + this.btnPushToOutServer.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnPushToOutServer.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnPushToOutServer.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnPushToOutServer.TabIndex = 824; + this.btnPushToOutServer.Text = "导出入库"; + this.btnPushToOutServer.Click += new System.EventHandler(this.btnPushToOutServer_Click); // // btnGetProdWxCate // @@ -212,9 +274,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.btnGetProdWxCate.Cursor = System.Windows.Forms.Cursors.Hand; this.btnGetProdWxCate.DisabledBackColor = System.Drawing.Color.Empty; this.btnGetProdWxCate.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnGetProdWxCate.Location = new System.Drawing.Point(731, 9); + this.btnGetProdWxCate.Location = new System.Drawing.Point(746, 9); this.btnGetProdWxCate.Name = "btnGetProdWxCate"; - this.btnGetProdWxCate.Size = new System.Drawing.Size(84, 25); + this.btnGetProdWxCate.Size = new System.Drawing.Size(94, 25); this.btnGetProdWxCate.Style.Alignment = System.Drawing.StringAlignment.Center; this.btnGetProdWxCate.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.btnGetProdWxCate.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); @@ -367,75 +429,96 @@ namespace TemuKJD.PDDForms.ProductSelectForms // this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.tableLayoutPanel1.ColumnCount = 12; + this.tableLayoutPanel1.ColumnCount = 14; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.0012F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66767F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.0012F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66767F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.0012F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66767F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20.0012F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66767F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 19.9952F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66267F)); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 16.66666F)); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.Controls.Add(this.cmbSpProdType, 7, 1); - this.tableLayoutPanel1.Controls.Add(this.label11, 6, 1); + this.tableLayoutPanel1.Controls.Add(this.cmbCat1, 3, 0); + this.tableLayoutPanel1.Controls.Add(this.cmbCat2, 5, 0); + this.tableLayoutPanel1.Controls.Add(this.label14, 4, 0); + this.tableLayoutPanel1.Controls.Add(this.label13, 10, 1); this.tableLayoutPanel1.Controls.Add(this.cmbSourceType, 5, 1); this.tableLayoutPanel1.Controls.Add(this.label10, 4, 1); this.tableLayoutPanel1.Controls.Add(this.label5, 0, 0); this.tableLayoutPanel1.Controls.Add(this.txtSPU, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.cmbWxCat, 11, 0); this.tableLayoutPanel1.Controls.Add(this.label2, 2, 0); - this.tableLayoutPanel1.Controls.Add(this.txtCat, 3, 0); - this.tableLayoutPanel1.Controls.Add(this.label3, 4, 0); - this.tableLayoutPanel1.Controls.Add(this.txtProdName, 5, 0); + this.tableLayoutPanel1.Controls.Add(this.cmbSort, 7, 1); + this.tableLayoutPanel1.Controls.Add(this.label6, 6, 1); this.tableLayoutPanel1.Controls.Add(this.label4, 6, 0); + this.tableLayoutPanel1.Controls.Add(this.label12, 10, 0); this.tableLayoutPanel1.Controls.Add(this.txtExtCode, 7, 0); - this.tableLayoutPanel1.Controls.Add(this.label6, 8, 0); - this.tableLayoutPanel1.Controls.Add(this.cmbSort, 9, 0); - this.tableLayoutPanel1.Controls.Add(this.btnSearch, 10, 0); + this.tableLayoutPanel1.Controls.Add(this.btnSearch, 12, 0); this.tableLayoutPanel1.Controls.Add(this.lblNotes, 0, 1); this.tableLayoutPanel1.Controls.Add(this.txtNotes, 1, 1); this.tableLayoutPanel1.Controls.Add(this.lblGroup, 2, 1); this.tableLayoutPanel1.Controls.Add(this.cmbGroupFilter, 3, 1); + this.tableLayoutPanel1.Controls.Add(this.pnlEmpty, 12, 1); + this.tableLayoutPanel1.Controls.Add(this.cmbExportToOutServer, 11, 1); + this.tableLayoutPanel1.Controls.Add(this.label3, 8, 0); + this.tableLayoutPanel1.Controls.Add(this.txtProdName, 9, 0); this.tableLayoutPanel1.Controls.Add(this.cmbWxSafe, 9, 1); this.tableLayoutPanel1.Controls.Add(this.lblWxSafe, 8, 1); - this.tableLayoutPanel1.Controls.Add(this.pnlEmpty, 10, 1); this.tableLayoutPanel1.Location = new System.Drawing.Point(4, 4); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 2; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(609, 71); + this.tableLayoutPanel1.Size = new System.Drawing.Size(650, 71); this.tableLayoutPanel1.TabIndex = 679; // - // cmbSpProdType + // cmbCat1 // - this.cmbSpProdType.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.cmbSpProdType.FormattingEnabled = true; - this.cmbSpProdType.Items.AddRange(new object[] { - "", - "普通商品", - "书籍"}); - this.cmbSpProdType.Location = new System.Drawing.Point(381, 43); - this.cmbSpProdType.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); - this.cmbSpProdType.Name = "cmbSpProdType"; - this.cmbSpProdType.Size = new System.Drawing.Size(49, 25); - this.cmbSpProdType.TabIndex = 677; + this.cmbCat1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.cmbCat1.FormattingEnabled = true; + this.cmbCat1.Location = new System.Drawing.Point(154, 7); + this.cmbCat1.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); + this.cmbCat1.Name = "cmbCat1"; + this.cmbCat1.Size = new System.Drawing.Size(37, 25); + this.cmbCat1.TabIndex = 805; // - // label11 + // cmbCat2 // - this.label11.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.label11.AutoSize = true; - this.label11.Location = new System.Drawing.Point(313, 44); - this.label11.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(68, 17); - this.label11.TabIndex = 651; - this.label11.Text = "商品类型:"; + this.cmbCat2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.cmbCat2.FormattingEnabled = true; + this.cmbCat2.Location = new System.Drawing.Point(248, 7); + this.cmbCat2.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); + this.cmbCat2.Name = "cmbCat2"; + this.cmbCat2.Size = new System.Drawing.Size(37, 25); + this.cmbCat2.TabIndex = 804; + // + // label14 + // + this.label14.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label14.AutoSize = true; + this.label14.Location = new System.Drawing.Point(197, 9); + this.label14.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.label14.Name = "label14"; + this.label14.Size = new System.Drawing.Size(51, 17); + this.label14.TabIndex = 784; + this.label14.Text = "类目2:"; + // + // label13 + // + this.label13.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.label13.AutoSize = true; + this.label13.Location = new System.Drawing.Point(489, 44); + this.label13.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.label13.Name = "label13"; + this.label13.Size = new System.Drawing.Size(68, 17); + this.label13.TabIndex = 802; + this.label13.Text = "导出入库:"; // // cmbSourceType // @@ -447,17 +530,17 @@ namespace TemuKJD.PDDForms.ProductSelectForms "厂商直采", "机会商品", "外部数据"}); - this.cmbSourceType.Location = new System.Drawing.Point(258, 43); + this.cmbSourceType.Location = new System.Drawing.Point(248, 43); this.cmbSourceType.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbSourceType.Name = "cmbSourceType"; - this.cmbSourceType.Size = new System.Drawing.Size(49, 25); + this.cmbSourceType.Size = new System.Drawing.Size(37, 25); this.cmbSourceType.TabIndex = 654; // // label10 // this.label10.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label10.AutoSize = true; - this.label10.Location = new System.Drawing.Point(214, 44); + this.label10.Location = new System.Drawing.Point(197, 44); this.label10.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); this.label10.Name = "label10"; this.label10.Size = new System.Drawing.Size(44, 17); @@ -481,79 +564,33 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.txtSPU.Location = new System.Drawing.Point(60, 6); this.txtSPU.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.txtSPU.Name = "txtSPU"; - this.txtSPU.Size = new System.Drawing.Size(49, 23); + this.txtSPU.Size = new System.Drawing.Size(37, 23); this.txtSPU.TabIndex = 434; // + // cmbWxCat + // + this.cmbWxCat.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.cmbWxCat.FormattingEnabled = true; + this.cmbWxCat.Items.AddRange(new object[] { + "", + "是", + "否"}); + this.cmbWxCat.Location = new System.Drawing.Point(557, 7); + this.cmbWxCat.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); + this.cmbWxCat.Name = "cmbWxCat"; + this.cmbWxCat.Size = new System.Drawing.Size(37, 25); + this.cmbWxCat.TabIndex = 802; + // // label2 // this.label2.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(115, 9); + this.label2.Location = new System.Drawing.Point(103, 9); this.label2.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(44, 17); + this.label2.Size = new System.Drawing.Size(51, 17); this.label2.TabIndex = 426; - this.label2.Text = "类目:"; - // - // txtCat - // - this.txtCat.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.txtCat.Location = new System.Drawing.Point(159, 6); - this.txtCat.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); - this.txtCat.Name = "txtCat"; - this.txtCat.Size = new System.Drawing.Size(49, 23); - this.txtCat.TabIndex = 425; - // - // label3 - // - this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(214, 9); - this.label3.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(44, 17); - this.label3.TabIndex = 428; - this.label3.Text = "标题:"; - // - // txtProdName - // - this.txtProdName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.txtProdName.Location = new System.Drawing.Point(258, 6); - this.txtProdName.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); - this.txtProdName.Name = "txtProdName"; - this.txtProdName.Size = new System.Drawing.Size(49, 23); - this.txtProdName.TabIndex = 427; - // - // label4 - // - this.label4.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(337, 9); - this.label4.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(44, 17); - this.label4.TabIndex = 430; - this.label4.Text = "货号:"; - // - // txtExtCode - // - this.txtExtCode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.txtExtCode.Location = new System.Drawing.Point(381, 6); - this.txtExtCode.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); - this.txtExtCode.Name = "txtExtCode"; - this.txtExtCode.Size = new System.Drawing.Size(49, 23); - this.txtExtCode.TabIndex = 429; - // - // label6 - // - this.label6.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(460, 9); - this.label6.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(44, 17); - this.label6.TabIndex = 449; - this.label6.Text = "排序:"; + this.label2.Text = "类目1:"; // // cmbSort // @@ -562,12 +599,55 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.cmbSort.Items.AddRange(new object[] { "入库时间", "认领总数"}); - this.cmbSort.Location = new System.Drawing.Point(507, 7); + this.cmbSort.Location = new System.Drawing.Point(335, 43); + this.cmbSort.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbSort.Name = "cmbSort"; - this.cmbSort.Size = new System.Drawing.Size(46, 25); + this.cmbSort.Size = new System.Drawing.Size(37, 25); this.cmbSort.TabIndex = 448; this.cmbSort.Text = "入库时间"; // + // label6 + // + this.label6.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(291, 44); + this.label6.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(44, 17); + this.label6.TabIndex = 449; + this.label6.Text = "排序:"; + // + // label4 + // + this.label4.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(291, 9); + this.label4.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(44, 17); + this.label4.TabIndex = 430; + this.label4.Text = "货号:"; + // + // label12 + // + this.label12.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.label12.AutoSize = true; + this.label12.Location = new System.Drawing.Point(489, 9); + this.label12.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(68, 17); + this.label12.TabIndex = 801; + this.label12.Text = "类目识别:"; + // + // txtExtCode + // + this.txtExtCode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.txtExtCode.Location = new System.Drawing.Point(335, 6); + this.txtExtCode.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); + this.txtExtCode.Name = "txtExtCode"; + this.txtExtCode.Size = new System.Drawing.Size(37, 23); + this.txtExtCode.TabIndex = 429; + // // btnSearch // this.btnSearch.Anchor = System.Windows.Forms.AnchorStyles.Left; @@ -575,7 +655,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.btnSearch.Cursor = System.Windows.Forms.Cursors.Hand; this.btnSearch.DisabledBackColor = System.Drawing.Color.Empty; this.btnSearch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnSearch.Location = new System.Drawing.Point(559, 5); + this.btnSearch.Location = new System.Drawing.Point(600, 5); this.btnSearch.Name = "btnSearch"; this.btnSearch.Size = new System.Drawing.Size(46, 25); this.btnSearch.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -595,9 +675,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // lblNotes // - this.lblNotes.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblNotes.Anchor = System.Windows.Forms.AnchorStyles.Right; this.lblNotes.AutoSize = true; - this.lblNotes.Location = new System.Drawing.Point(3, 44); + this.lblNotes.Location = new System.Drawing.Point(16, 44); this.lblNotes.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); this.lblNotes.Name = "lblNotes"; this.lblNotes.Size = new System.Drawing.Size(44, 17); @@ -610,14 +690,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.txtNotes.Location = new System.Drawing.Point(60, 41); this.txtNotes.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.txtNotes.Name = "txtNotes"; - this.txtNotes.Size = new System.Drawing.Size(49, 23); + this.txtNotes.Size = new System.Drawing.Size(37, 23); this.txtNotes.TabIndex = 439; // // lblGroup // - this.lblGroup.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblGroup.Anchor = System.Windows.Forms.AnchorStyles.Right; this.lblGroup.AutoSize = true; - this.lblGroup.Location = new System.Drawing.Point(115, 44); + this.lblGroup.Location = new System.Drawing.Point(110, 44); this.lblGroup.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); this.lblGroup.Name = "lblGroup"; this.lblGroup.Size = new System.Drawing.Size(44, 17); @@ -628,45 +708,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms // this.cmbGroupFilter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.cmbGroupFilter.FormattingEnabled = true; - this.cmbGroupFilter.Location = new System.Drawing.Point(159, 43); + this.cmbGroupFilter.Location = new System.Drawing.Point(154, 43); this.cmbGroupFilter.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); this.cmbGroupFilter.Name = "cmbGroupFilter"; - this.cmbGroupFilter.Size = new System.Drawing.Size(49, 25); + this.cmbGroupFilter.Size = new System.Drawing.Size(37, 25); this.cmbGroupFilter.TabIndex = 653; // - // cmbWxSafe - // - this.cmbWxSafe.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.cmbWxSafe.FormattingEnabled = true; - this.cmbWxSafe.Items.AddRange(new object[] { - "", - "安全商品", - "违规商品", - "未校验"}); - this.cmbWxSafe.Location = new System.Drawing.Point(504, 43); - this.cmbWxSafe.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); - this.cmbWxSafe.Name = "cmbWxSafe"; - this.cmbWxSafe.Size = new System.Drawing.Size(49, 25); - this.cmbWxSafe.TabIndex = 676; - // - // lblWxSafe - // - this.lblWxSafe.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.lblWxSafe.AutoSize = true; - this.lblWxSafe.Location = new System.Drawing.Point(436, 44); - this.lblWxSafe.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); - this.lblWxSafe.Name = "lblWxSafe"; - this.lblWxSafe.Size = new System.Drawing.Size(68, 17); - this.lblWxSafe.TabIndex = 651; - this.lblWxSafe.Text = "微信安检:"; - // // pnlEmpty // this.pnlEmpty.Anchor = System.Windows.Forms.AnchorStyles.Left; this.pnlEmpty.CanvasColor = System.Drawing.SystemColors.Control; this.pnlEmpty.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.pnlEmpty.DisabledBackColor = System.Drawing.Color.Empty; - this.pnlEmpty.Location = new System.Drawing.Point(559, 40); + this.pnlEmpty.Location = new System.Drawing.Point(600, 40); this.pnlEmpty.Name = "pnlEmpty"; this.pnlEmpty.Size = new System.Drawing.Size(46, 25); this.pnlEmpty.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -685,6 +739,67 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.pnlEmpty.Text = "清空"; this.pnlEmpty.Click += new System.EventHandler(this.pnlEmpty_Click); // + // cmbExportToOutServer + // + this.cmbExportToOutServer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.cmbExportToOutServer.FormattingEnabled = true; + this.cmbExportToOutServer.Items.AddRange(new object[] { + "", + "是", + "否", + "导出未拉回"}); + this.cmbExportToOutServer.Location = new System.Drawing.Point(557, 43); + this.cmbExportToOutServer.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); + this.cmbExportToOutServer.Name = "cmbExportToOutServer"; + this.cmbExportToOutServer.Size = new System.Drawing.Size(37, 25); + this.cmbExportToOutServer.TabIndex = 803; + // + // label3 + // + this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(378, 9); + this.label3.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(68, 17); + this.label3.TabIndex = 428; + this.label3.Text = "商品标题:"; + // + // txtProdName + // + this.txtProdName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.txtProdName.Location = new System.Drawing.Point(446, 6); + this.txtProdName.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); + this.txtProdName.Name = "txtProdName"; + this.txtProdName.Size = new System.Drawing.Size(37, 23); + this.txtProdName.TabIndex = 427; + // + // cmbWxSafe + // + this.cmbWxSafe.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.cmbWxSafe.FormattingEnabled = true; + this.cmbWxSafe.Items.AddRange(new object[] { + "", + "安全商品", + "违规商品", + "未校验"}); + this.cmbWxSafe.Location = new System.Drawing.Point(446, 43); + this.cmbWxSafe.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); + this.cmbWxSafe.Name = "cmbWxSafe"; + this.cmbWxSafe.Size = new System.Drawing.Size(37, 25); + this.cmbWxSafe.TabIndex = 676; + // + // lblWxSafe + // + this.lblWxSafe.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.lblWxSafe.AutoSize = true; + this.lblWxSafe.Location = new System.Drawing.Point(378, 44); + this.lblWxSafe.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.lblWxSafe.Name = "lblWxSafe"; + this.lblWxSafe.Size = new System.Drawing.Size(68, 17); + this.lblWxSafe.TabIndex = 651; + this.lblWxSafe.Text = "微信安检:"; + // // btnExportTxt // this.btnExportTxt.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -780,6 +895,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.label7.TabIndex = 705; this.label7.Text = "导出时移除词语:"; // + // chkPullAfterPush + // + this.chkPullAfterPush.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.chkPullAfterPush.AutoSize = true; + this.chkPullAfterPush.Checked = true; + this.chkPullAfterPush.CheckState = System.Windows.Forms.CheckState.Checked; + this.chkPullAfterPush.Location = new System.Drawing.Point(668, 45); + this.chkPullAfterPush.Name = "chkPullAfterPush"; + this.chkPullAfterPush.Size = new System.Drawing.Size(87, 21); + this.chkPullAfterPush.TabIndex = 874; + this.chkPullAfterPush.Text = "导出时拉回"; + this.chkPullAfterPush.UseVisualStyleBackColor = true; + // // splitContainer2 // this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; @@ -790,12 +918,14 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // splitContainer2.Panel1 // + this.splitContainer2.Panel1.Controls.Add(this.cmbSpProdType); this.splitContainer2.Panel1.Controls.Add(this.btnGetAllCate); this.splitContainer2.Panel1.Controls.Add(this.pnlEditExtCodePrice); this.splitContainer2.Panel1.Controls.Add(this.pbLoading); this.splitContainer2.Panel1.Controls.Add(this.txtSKC); this.splitContainer2.Panel1.Controls.Add(this.label1); this.splitContainer2.Panel1.Controls.Add(this.btnSelect); + this.splitContainer2.Panel1.Controls.Add(this.label11); this.splitContainer2.Panel1.Controls.Add(this.dgvDbProduct); this.splitContainer2.Panel1.Padding = new System.Windows.Forms.Padding(4, 0, 4, 0); // @@ -807,6 +937,21 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.splitContainer2.SplitterDistance = 577; this.splitContainer2.TabIndex = 0; // + // cmbSpProdType + // + this.cmbSpProdType.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.cmbSpProdType.FormattingEnabled = true; + this.cmbSpProdType.Items.AddRange(new object[] { + "", + "普通商品", + "书籍"}); + this.cmbSpProdType.Location = new System.Drawing.Point(87, 134); + this.cmbSpProdType.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3); + this.cmbSpProdType.Name = "cmbSpProdType"; + this.cmbSpProdType.Size = new System.Drawing.Size(27, 25); + this.cmbSpProdType.TabIndex = 677; + this.cmbSpProdType.Visible = false; + // // btnGetAllCate // this.btnGetAllCate.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; @@ -983,6 +1128,18 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.btnSelect.Text = "认领选中商品"; this.btnSelect.Click += new System.EventHandler(this.btnSelect_Click); // + // label11 + // + this.label11.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.label11.AutoSize = true; + this.label11.Location = new System.Drawing.Point(26, 138); + this.label11.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(68, 17); + this.label11.TabIndex = 651; + this.label11.Text = "商品类型:"; + this.label11.Visible = false; + // // dgvDbProduct // this.dgvDbProduct.AllowUserToAddRows = false; @@ -1013,6 +1170,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.colSkuReplaceImg, this.col_spu_id, this.col_skc_id, + this.colMainCate, this.col_cat_name, this.col_ext_code, this.colGroup, @@ -1125,10 +1283,20 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.col_skc_id.ReadOnly = true; this.col_skc_id.Visible = false; // - // col_cat_name + // colMainCate // dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.col_cat_name.DefaultCellStyle = dataGridViewCellStyle4; + this.colMainCate.DefaultCellStyle = dataGridViewCellStyle4; + this.colMainCate.FillWeight = 50F; + this.colMainCate.HeaderText = "主类目"; + this.colMainCate.Name = "colMainCate"; + this.colMainCate.ReadOnly = true; + // + // col_cat_name + // + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.col_cat_name.DefaultCellStyle = dataGridViewCellStyle5; + this.col_cat_name.FillWeight = 70F; this.col_cat_name.HeaderText = "类目"; this.col_cat_name.Name = "col_cat_name"; this.col_cat_name.ReadOnly = true; @@ -1193,16 +1361,16 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // col_notes // - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.col_notes.DefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.col_notes.DefaultCellStyle = dataGridViewCellStyle6; this.col_notes.HeaderText = "备注"; this.col_notes.Name = "col_notes"; this.col_notes.ReadOnly = true; // // colHeadWords // - dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colHeadWords.DefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colHeadWords.DefaultCellStyle = dataGridViewCellStyle7; this.colHeadWords.HeaderText = "标题前缀"; this.colHeadWords.Name = "colHeadWords"; this.colHeadWords.ReadOnly = true; @@ -1210,8 +1378,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // colEndWords // - dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colEndWords.DefaultCellStyle = dataGridViewCellStyle7; + dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colEndWords.DefaultCellStyle = dataGridViewCellStyle8; this.colEndWords.HeaderText = "标题后缀"; this.colEndWords.Name = "colEndWords"; this.colEndWords.ReadOnly = true; @@ -1219,8 +1387,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // colFissionWords // - dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colFissionWords.DefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colFissionWords.DefaultCellStyle = dataGridViewCellStyle9; this.colFissionWords.HeaderText = "裂变词"; this.colFissionWords.Name = "colFissionWords"; this.colFissionWords.ReadOnly = true; @@ -1228,6 +1396,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms // // colGetType // + dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colGetType.DefaultCellStyle = dataGridViewCellStyle10; this.colGetType.FillWeight = 70F; this.colGetType.HeaderText = "采集来源"; this.colGetType.Name = "colGetType"; @@ -1361,7 +1531,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms private System.Windows.Forms.Label label4; private System.Windows.Forms.TextBox txtProdName; private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox txtCat; private System.Windows.Forms.Label label2; private UserComponent.DataGridViewEx dgvDbProduct; private System.Windows.Forms.PictureBox pbLoading; @@ -1403,6 +1572,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms private System.Windows.Forms.Label label11; private DevComponents.DotNetBar.PanelEx btnGetAllCate; private DevComponents.DotNetBar.PanelEx btnGetProdWxCate; + private System.Windows.Forms.ComboBox cmbWxCat; + private System.Windows.Forms.Label label12; + private DevComponents.DotNetBar.PanelEx btnPushToOutServer; private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect; private System.Windows.Forms.DataGridViewTextBoxColumn col_db_id; private System.Windows.Forms.DataGridViewTextBoxColumn colFromShopId; @@ -1413,6 +1585,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms private System.Windows.Forms.DataGridViewImageColumn colSkuReplaceImg; private System.Windows.Forms.DataGridViewTextBoxColumn col_spu_id; private System.Windows.Forms.DataGridViewTextBoxColumn col_skc_id; + private System.Windows.Forms.DataGridViewTextBoxColumn colMainCate; private System.Windows.Forms.DataGridViewTextBoxColumn col_cat_name; private System.Windows.Forms.DataGridViewTextBoxColumn col_ext_code; private System.Windows.Forms.DataGridViewTextBoxColumn colGroup; @@ -1434,7 +1607,13 @@ namespace TemuKJD.PDDForms.ProductSelectForms private System.Windows.Forms.DataGridViewLinkColumn col_edit; private System.Windows.Forms.DataGridViewLinkColumn col_delete; private System.Windows.Forms.DataGridViewLinkColumn col_select_product; - private System.Windows.Forms.ComboBox cmbWxCat; - private System.Windows.Forms.Label label12; + private System.Windows.Forms.ComboBox cmbExportToOutServer; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.ComboBox cmbCat2; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.ComboBox cmbCat1; + private DevComponents.DotNetBar.PanelEx btnPull; + private UserComponent.UcCheckBox chkPullAfterPush; + private DevComponents.DotNetBar.PanelEx btnStopStop; } } \ No newline at end of file diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs index 2a801f6..1c7f7ed 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.cs @@ -30,6 +30,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms public partial class PDDDBProdListForm : BaseGeneralForm { ShopLoginInfo shop = null; + public CancellationTokenSource cancellationTokenSource { get; set; } = new CancellationTokenSource(); ConcurrentList lstTemuDbProduct = new ConcurrentList(); ConcurrentList lstTitleReplaceText = new ConcurrentList(); @@ -157,7 +158,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms } foreach (var prod in lstTemuDbProduct) { - string catName = prod.cat_name; + string catName = prod.cat_name ?? prod.cat_id; if (prod.wx_cat_leaf != null) { var catN = GlobalConfig.WxCatList.FirstOrDefault(c => c.cat_id == prod.wx_cat_leaf.ParseToString())?.name; @@ -203,6 +204,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms DataGridViewExtension.defaultBitmap, prod.spu_id, prod.skc_id, + prod.main_cat_name ?? prod.main_cat_id, catName, prod.ext_code, prod.group, @@ -216,7 +218,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms prod.head_words, prod.end_words, prod.fission_words, - prod.product_get_type_text, + prod.product_get_type_text == "厂商直采" ? prod.product_get_type_text + " " + prod.skc_id : prod.product_get_type_text, prod.special_prod_type, prod.wx_safe_status, prod.add_time.ToString("yy-MM-dd HH:mm"), @@ -250,16 +252,16 @@ namespace TemuKJD.PDDForms.ProductSelectForms { if (row.Index > 0 && row.Cells["colMainImg"].Displayed == false) { - try + Invoke(new Action(() => { - Invoke(new Action(() => + try { row.Cells["colMainImg"].Value = defaultBitmap; - })); - } - catch - { - } + } + catch + { + } + })); continue; } @@ -308,15 +310,26 @@ namespace TemuKJD.PDDForms.ProductSelectForms "&search_spu=" + txtSPU.Text.Trim() + "&search_skc=" + txtSKC.Text.Trim() + "&search_notes=" + txtNotes.Text.Trim() + - "&search_cat=" + txtCat.Text.Trim() + + "&search_cat1=" + cmbCat1.Text.Trim() + + "&search_cat=" + cmbCat2.Text.Trim() + "&search_ext_code=" + txtExtCode.Text.Trim() + "&search_group=" + cmbGroupFilter.Text.Trim() + "&search_prod_name=" + txtProdName.Text.Trim() + "&wx_safe_status=" + cmbWxSafe.Text.Trim() + "&special_prod_type=" + cmbSpProdType.Text.Trim(); - if(!string.IsNullOrEmpty(cmbWxCat.Text)) + if (!string.IsNullOrEmpty(cmbWxCat.Text)) { - data += "&has_wx_cat=" + (cmbWxCat.Text.Trim() == "有").ParseToString().ToLower(); + data += "&has_wx_cat=" + (cmbWxCat.Text.Trim() == "是").ParseToString().ToLower(); + } + if (!string.IsNullOrEmpty(cmbExportToOutServer.Text)) + { + //data += "&has_send_to_out_server=" + (cmbExportToOutServer.Text.Trim() == "是").ParseToString().ToLower(); + if (cmbExportToOutServer.Text.Trim() == "是") + data += "&send_to_out_server=1"; + else if (cmbExportToOutServer.Text.Trim() == "否") + data += "&send_to_out_server=0"; + else if (cmbExportToOutServer.Text.Trim() == "导出未拉回") + data += "&send_to_out_server=2"; } if (cmbSourceType.Text.Trim() != "全部") @@ -385,7 +398,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms private void pnlEmpty_Click(object sender, EventArgs e) { - this.txtCat.Text = ""; + this.cmbCat1.Text = ""; + this.cmbCat2.Text = ""; this.txtExtCode.Text = ""; this.txtProdName.Text = ""; this.txtSKC.Text = ""; @@ -396,6 +410,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms this.cmbSourceType.Text = ""; this.cmbWxSafe.Text = ""; this.cmbSpProdType.Text = ""; + this.cmbWxCat.Text = ""; + this.cmbExportToOutServer.Text = ""; } private void dgvDbProduct_CellContentClick(object sender, DataGridViewCellEventArgs e) @@ -505,11 +521,19 @@ namespace TemuKJD.PDDForms.ProductSelectForms if (BaseMsgForm.ShowConfirm("确定删除商品吗?删除后不可恢复!").DialogResult == DialogResult.Cancel) return; this.pbLoading.Visible = true; + this.statusBar.pgbTaskProgress.Maximum = lstProdId.Count; + this.statusBar.UpdateProgressBar(0); Task.Run(() => { foreach (var prod in prodList) { DeleteProduct(prod.id.ToString(), false); + + Invoke(new Action(() => + { + this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1); + this.statusBar.lblTaskStatus.Text = "正在删除 " + this.statusBar.pgbTaskProgress.Value + "/" + lstProdId.Count; + })); } SearchDbProd(this.ucSplitPage1.CurrentPage); Invoke(new Action(() => @@ -886,7 +910,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms } - rst = new PDDProdFormConverter().PddConvert(content); + rst = new PDDProdFormConverter().PddFrontToPddBackConvert(content); } catch (Exception ex) { @@ -987,12 +1011,16 @@ namespace TemuKJD.PDDForms.ProductSelectForms { var lstProdId = dgvDbProduct.Rows.Cast().Where(row => row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["col_spu_id"]?.Value.ToString()).ToList(); - var prodList = this.lstTemuDbProduct.Where(p => lstProdId.Contains(p.spu_id)).ToArray(); - if (prodList.Length == 0) + var prodList = this.lstTemuDbProduct.Where(p => lstProdId.Contains(p.spu_id)).ToList(); + if (prodList.Count == 0) return; - this.statusBar.pgbTaskProgress.Maximum = prodList.Length; + this.statusBar.pgbTaskProgress.Maximum = prodList.Count; this.statusBar.UpdateProgressBar(0); + if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested) + { + cancellationTokenSource = new CancellationTokenSource(); + } this.pbLoading.Visible = true; Task.Run(() => { @@ -1009,15 +1037,23 @@ namespace TemuKJD.PDDForms.ProductSelectForms Invoke(new Action(() => { pbLoading.Visible = false; - BaseMsgForm.ShowInfo("操作完成!"); + BaseMsgForm.ShowInfo("识别微信类目完成!"); })); - }); + }, cancellationTokenSource.Token); } - void GetProdWxCat(KJDDBProduct[] prodList) + void GetProdWxCat(List dbProdLst) { - foreach (var prod in prodList) + foreach (var prod in dbProdLst) { + if (cancellationTokenSource.IsCancellationRequested) + break; + + Invoke(new Action(() => + { + this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1); + this.statusBar.lblTaskStatus.Text = "正在识别微信类目 " + this.statusBar.pgbTaskProgress.Value + "/" + dbProdLst.Count; + })); // 获取微信accessToken var token = new WxApiBLL().GetWxToken(); try @@ -1029,7 +1065,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms var dbProd = PDDDBProdEditForm.GetPddProductDetail(prod.id.ParseToString()); var prodObj = JsonHelper.JObjectParse(dbProd.product_json); List mainImgLst = new List(); - if (!prodObj["jstProd"].IsNullOrEmpty()) + if (!prodObj["jstProd"].IsJTokenNullOrEmpty()) { var jstProd = JsonHelper.DeserializeJsonToObject(JsonHelper.SerializeObject(prodObj["jstProd"])); mainImgLst = jstProd.itemMainImage.Take(3).ToList(); @@ -1098,8 +1134,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms "&wx_cat_1=" + dbProd.wx_cat_1 + "&wx_cat_2=" + dbProd.wx_cat_2 + "&wx_cat_3=" + dbProd.wx_cat_3 + - "&wx_cat_leaf=" + dbProd.wx_cat_leaf + - "&cat_id=" + dbProd.cat_id + + "&wx_cat_leaf=" + dbProd.wx_cat_leaf; + // 上面限制了必须是聚水潭商品才转类目,此处可以一起把主类目等一起改成微信类目 + data += "&cat_id=" + dbProd.cat_id + "&cat_name=" + HttpUtility.UrlEncode(dbProd.cat_name, Encoding.UTF8) + "&main_cat_id=" + dbProd.main_cat_id + "&main_cat_name=" + HttpUtility.UrlEncode(dbProd.main_cat_name, Encoding.UTF8); @@ -1162,12 +1199,355 @@ namespace TemuKJD.PDDForms.ProductSelectForms catch (Exception ex) { } + } + } + + private void btnPushToOutServer_Click(object sender, EventArgs e) + { + var lstProdId = dgvDbProduct.Rows.Cast().Where(row + => row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["col_spu_id"]?.Value.ToString()).ToList(); + var prodList = this.lstTemuDbProduct.Where(p => lstProdId.Contains(p.spu_id)).ToList(); + if (prodList.Count == 0) + return; + + this.statusBar.pgbTaskProgress.Maximum = prodList.Count; + this.statusBar.UpdateProgressBar(0); + this.pbLoading.Visible = true; + if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested) + { + cancellationTokenSource = new CancellationTokenSource(); + } + Task.Run(() => + { + try + { + ExportToServer(prodList); + } + catch (Exception ex) + { + BaseMsgForm.ShowError(ex.Message); + } + // 刷新结果 + SearchDbProd(this.ucSplitPage1.CurrentPage); + Invoke(new Action(() => + { + pbLoading.Visible = false; + if (chkPullAfterPush.Checked) + BaseMsgForm.ShowInfo("操作完成!处理导出到外部服务器 " + prodList.Count() + " 条数据,成功 " + prodList.Where(p => p.send_to_out_server == 1).Count() + " 条"); + else + BaseMsgForm.ShowInfo("操作完成!处理导出到外部服务器 " + prodList.Count() + " 条数据,成功 " + prodList.Where(p => p.send_to_out_server >= 1).Count() + " 条"); + + })); + }, cancellationTokenSource.Token); + } + + public void ExportToServer(List dbProdLst) + { + foreach (var prod in dbProdLst) + { + if (cancellationTokenSource.IsCancellationRequested) + break; Invoke(new Action(() => { this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1); + this.statusBar.lblTaskStatus.Text = "正在导出 " + this.statusBar.pgbTaskProgress.Value + "/" + dbProdLst.Count; })); + var dbProd = PDDDBProdEditForm.GetPddProductDetail(prod.id.ParseToString()); + var rst = new WxProdFormConverter().JstPddConvertToWxOutServer(dbProd); + if (!rst.Contains("\"success\":true")) + { + continue; + } + var prodDataStr = JsonHelper.SerializeObject(JsonHelper.JObjectParse(rst)["data"]); + string url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/addGoods"; + var exportRst = WXHttpResponseBLL.e57PostResponse(url, prodDataStr, ""); + Thread.Sleep(500); + // 导出成功,拉回然后提交导本地服务端标记导出成功 + if (exportRst.Contains("\"code\":200")) + { + prod.send_to_out_server = 2; + if (chkPullAfterPush.Checked) + { + // 原批量拉取,已废弃 "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get?page_size=10"; + // 按spuCode(ext_code)拉取 + url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get"; + string body = "{\"spuCodes\":[\"" + dbProd.ext_code + "\"]}"; + var getRst = WXHttpResponseBLL.e57PostResponse(url, body, ""); + if (getRst.Contains("\"code\":0")) + { + try + { + var url3 = BaseClass.BuildPDDObjString("product/mdy_product"); + string skuSecretJson = JsonHelper.SerializeObject(JsonHelper.JObjectParse(getRst)["data"]); + if (skuSecretJson.Contains("warehouseGoodsId") && skuSecretJson.Contains("goodsId") && + skuSecretJson.Contains("warehouseSkuId") && skuSecretJson.Contains("skuId")) + { + var data3 = Work.UserLogin.GetSignaturex() + + "&spu_id=" + dbProd.spu_id + + "&send_to_out_server=" + 1 + + "&sku_secret_json=" + GetHtml.UrlEncodeUtf8(skuSecretJson); + var html = GetHtml.PostUtf8(url3, data3); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url3, data3); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + { + } + else + { + prod.send_to_out_server = 1; + } + } + else + { + } + } + catch + { + } + } + else + { + } + } + //如果外部服务端提示入库成功又没有实际加成功,则记录未回拉 + if (prod.send_to_out_server == 2) + { + var url2 = BaseClass.BuildPDDObjString("product/mdy_product"); + var data2 = Work.UserLogin.GetSignaturex() + + "&spu_id=" + dbProd.spu_id + + "&send_to_out_server=" + 2; + var html = GetHtml.PostUtf8(url2, data2); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url2, data2); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + { + } + } + } + else + { + } + //Thread.Sleep(500); + + // 获取售后地址 + //https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=10361546&shopId=46568955 + //var url2 = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=" + dbProd.skc_id; //+ "&userName=阿杰账户"; + //var exportRst2 = WXHttpResponseBLL.e57GetResponse(url2, ""); + // 获取运费模板 + //"https://po.e57.cn/prod-api/api/sys-api/system/open/api/freightTemplate/list?warehouseNum=10361546"; + //var url3 = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/freightTemplate/list?warehouseNum=" + dbProd.skc_id; + //var exportRst3 = WXHttpResponseBLL.e57GetResponse(url3, ""); + + // 查询微信接口token + //url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=阿杰账户"; + //exportRst = WXHttpResponseBLL.e57PostResponse(url, "&warehouseNum=123456&shopId=46568955", ""); + //exportRst = WXHttpResponseBLL.e57GetResponse(url, ""); } } + + private void btnPull_Click(object sender, EventArgs e) + { + var lstProdId = dgvDbProduct.Rows.Cast().Where(row + => row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["col_spu_id"]?.Value.ToString()).ToList(); + var prodList = this.lstTemuDbProduct.Where(p => lstProdId.Contains(p.spu_id)).ToList(); + if (prodList.Count == 0) + return; + + this.statusBar.pgbTaskProgress.Maximum = prodList.Count; + this.statusBar.UpdateProgressBar(0); + this.pbLoading.Visible = true; + if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested) + { + cancellationTokenSource = new CancellationTokenSource(); + } + Task.Run(() => + { + try + { + PullFromServer(prodList); + } + catch (Exception ex) + { + BaseMsgForm.ShowError(ex.Message); + } + // 刷新结果 + SearchDbProd(this.ucSplitPage1.CurrentPage); + Invoke(new Action(() => + { + pbLoading.Visible = false; + BaseMsgForm.ShowInfo("操作完成!共处理拉回 " + prodList.Count() + " 条数据,成功 " + prodList.Where(p => p.send_to_out_server == 1).Count() + " 条"); + })); + }, cancellationTokenSource.Token); + } + + public void PullFromServer(List dbProdLst) + { + List dbProdTmpLst = new List(); + dbProdTmpLst.AddRange(dbProdLst); + while (dbProdTmpLst.Count > 0) + { + var takeCount = 20; + List dbProdTmp20Lst = dbProdTmpLst.Take(takeCount).ToList(); + dbProdTmpLst.RemoveRange(0, dbProdTmp20Lst.Count); + + if (cancellationTokenSource.IsCancellationRequested) + break; + + Invoke(new Action(() => + { + this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + dbProdTmp20Lst.Count); + this.statusBar.lblTaskStatus.Text = "正在拉回 " + this.statusBar.pgbTaskProgress.Value + "/" + dbProdLst.Count; + })); + + var spuCodes = string.Join("\",\"", dbProdTmp20Lst.Select(p => p.ext_code)); + // 原批量拉取,已废弃 "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get?page_size=10"; + // 按spuCode(ext_code)拉取 + string url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get"; + string body = "{\"spuCodes\":[\"" + spuCodes + "\"]}"; + var getRst = WXHttpResponseBLL.e57PostResponse(url, body, ""); + Thread.Sleep(500); + if (getRst.Contains("\"code\":0")) + { + try + { + var secretArr = JsonHelper.JObjectParse(getRst)["data"] as JArray; + foreach (var secretObj in secretArr) + { + var skuSecretJson = JsonHelper.SerializeObject(secretObj); + var warehouseGoodsId = BaseRegex.GetStringJson(ref skuSecretJson, "warehouseGoodsId"); + var prod = dbProdTmp20Lst.FirstOrDefault(p => p.spu_id == warehouseGoodsId); + if (prod != null) + { + var url2 = BaseClass.BuildPDDObjString("product/mdy_product"); + if (skuSecretJson.Contains("warehouseGoodsId") && skuSecretJson.Contains("goodsId") && + skuSecretJson.Contains("warehouseSkuId") && skuSecretJson.Contains("skuId")) + { + var data2 = Work.UserLogin.GetSignaturex() + + "&spu_id=" + prod.spu_id + + "&send_to_out_server=" + 1 + + "&sku_secret_json=" + GetHtml.UrlEncodeUtf8(skuSecretJson); + var html = GetHtml.PostUtf8(url2, data2); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url2, data2); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + { + + } + else + { + prod.send_to_out_server = 1; + } + } + else + { + } + } + else + { + } + } + } + catch (Exception ex) + { + } + } + } + + + + + //foreach (var prod in dbProdLst) + //{ + + // spuCodes + // if (dbProd.sku_secret_json.IsNullOrEmpty() || dbProd.sku_secret_json.Length < 10) + // { + + // } + //} + + + //var dbProd = prod; + + // // 导出成功,拉回然后提交导本地服务端标记导出成功 + // if (dbProd.sku_secret_json.IsNullOrEmpty() || dbProd.sku_secret_json.Length < 10) + // { + // // 原批量拉取,已废弃 "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get?page_size=10"; + // // 按spuCode(ext_code)拉取 + // string url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get"; + // string body = "{\"spuCodes\":[\"" + dbProd.ext_code + "\"]}"; + // var getRst = WXHttpResponseBLL.e57PostResponse(url, body, ""); + // Thread.Sleep(500); + // string skuSecretJson = JsonHelper.SerializeObject(JsonHelper.JObjectParse(getRst)["data"]); + // if (getRst.Contains("\"code\":0")) + // { + // try + // { + // var url2 = BaseClass.BuildPDDObjString("product/mdy_product"); + // string skuSecretJson = JsonHelper.SerializeObject(JsonHelper.JObjectParse(getRst)["data"]); + // if (skuSecretJson.Contains("warehouseGoodsId") && skuSecretJson.Contains("goodsId") && + // skuSecretJson.Contains("warehouseSkuId") && skuSecretJson.Contains("skuId")) + // { + // var data = Work.UserLogin.GetSignaturex() + + // "&spu_id=" + dbProd.spu_id + + // "&send_to_out_server=" + 1 + + // "&sku_secret_json=" + GetHtml.UrlEncodeUtf8(skuSecretJson); + // var html = GetHtml.PostUtf8(url2, data); + // if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + // html = GetHtml.PostUtf8(url2, data); + // if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + // { + + // } + // else + // { + // prod.send_to_out_server = 1; + // } + // } + // else + // { + // } + // } + // catch + // { + // } + // } + // else + // { + // } + // } + //Thread.Sleep(500); + + // 获取售后地址 + //https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=10361546&shopId=46568955 + //var url2 = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=" + dbProd.skc_id; //+ "&userName=阿杰账户"; + //var exportRst2 = WXHttpResponseBLL.e57GetResponse(url2, ""); + + // 获取运费模板 + //"https://po.e57.cn/prod-api/api/sys-api/system/open/api/freightTemplate/list?warehouseNum=10361546"; + //var url3 = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/freightTemplate/list?warehouseNum=" + dbProd.skc_id; + //var exportRst3 = WXHttpResponseBLL.e57GetResponse(url3, ""); + + //url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/shop/list?userName=阿杰账户"; + //exportRst = WXHttpResponseBLL.e57PostResponse(url, "&warehouseNum=123456&shopId=46568955", ""); + //exportRst = WXHttpResponseBLL.e57GetResponse(url, ""); + + } + + private void btnStopStop_Click(object sender, EventArgs e) + { + if (cancellationTokenSource != null) + cancellationTokenSource.Cancel(); + Task.Run(() => + { + Thread.Sleep(3000); + Invoke(new Action(() => + { + if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested) + pbLoading.Visible = false; + })); + }); + } } } diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.resx b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.resx index 18c65e0..dbc7e9f 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.resx +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdListForm.resx @@ -147,6 +147,9 @@ True + + True + True diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectCacheForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectCacheForm.cs index df21346..aced236 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectCacheForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectCacheForm.cs @@ -40,7 +40,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms prodSelect.id, prodSelect.spu_id, prodSelect.main_img, - null, + null, //DataGridViewExtension.defaultBitmap, prodSelect.product_name, // 商品名称 prodSelect.cat_name, prodSelect.ext_code, diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs index 4a3f5e2..cbecba2 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdUserSelectForm.cs @@ -5725,7 +5725,7 @@ Content-Type: image/jpeg "&page=" + 1 + "&page_size=" + pageSize; data += "&in_ext_codes=" + txtExtCodeFilter.Text; - data += "&in_skc_ids=" + txtIdFilter.Text; + data += "&in_spu_ids=" + txtIdFilter.Text; data += "&in_groups=" + cmbGroupFilter.Text; data += "&in_cates=" + cmbCateFilter.Text; data += "&product_get_type=" + cmbSourceType.Text.Trim(); diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDGetChanceProdForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDGetChanceProdForm.cs index dd7b87d..8a0ba8a 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDGetChanceProdForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDGetChanceProdForm.cs @@ -460,7 +460,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms Invoke(new Action(() => { cat1 = lstChanceCateInfo.FirstOrDefault(c => c.cate_lvl == 1 && c.cate_name == cmbCat1.Text)?.cate_id; - cat2 = lstChanceCateInfo.FirstOrDefault(c => cat1 != null && c.cate_lvl == 2 && c.cate_name == cmbCat2.Text)?.cate_id; + cat2 = lstChanceCateInfo.FirstOrDefault(c => c.parent_id == cat1 && c.cate_lvl == 2 && c.cate_name == cmbCat2.Text)?.cate_id; price1 = txtSearchMinPrice.Text.Trim().ParseToDecimal(); price2 = txtSearchMaxPrice.Text.Trim().ParseToDecimal(); if (price1 == 0 || price2 == 0) @@ -610,17 +610,28 @@ namespace TemuKJD.PDDForms.ProductSelectForms return; } + ConcurrentList rowLst = new ConcurrentList(); + rowLst.AddRange(dgvChanceProduct.Rows.Cast().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true)); + this.statusBar.pgbTaskProgress.Maximum = rowLst.Count; + this.statusBar.UpdateProgressBar(0); this.pbLoading.Visible = true; + if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested) cancellationTokenSource = new CancellationTokenSource(); - Dictionary dicGetId = new Dictionary(); + Task.Run(() => { - ConcurrentList rowLst = new ConcurrentList(); - rowLst.AddRange(dgvChanceProduct.Rows.Cast()); + + ShopLoginInfo shop = null; int getId = 0; foreach (DataGridViewRow row in rowLst) { + Invoke(new Action(() => + { + this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1); + this.statusBar.lblTaskStatus.Text = "正在获取详情 " + this.statusBar.pgbTaskProgress.Value + "/" + rowLst.Count; + })); + if (row.Cells["colCheck"].Value.ParseToBool() != true) continue; @@ -747,9 +758,13 @@ namespace TemuKJD.PDDForms.ProductSelectForms if (cancellationTokenSource?.IsCancellationRequested == true) { BaseMsgForm.ShowInfo("机会商品详情获取停止!"); + this.statusBar.lblTaskStatus.Text = "机会商品详情获取停止!计数 " + this.statusBar.pgbTaskProgress.Value; } else + { BaseMsgForm.ShowInfo("机会商品详情获取完毕!"); + this.statusBar.lblTaskStatus.Text = "机会商品详情获取完毕!计数 " + this.statusBar.pgbTaskProgress.Value; + } })); }); } @@ -781,12 +796,26 @@ namespace TemuKJD.PDDForms.ProductSelectForms { ConcurrentList rowLst = new ConcurrentList(); rowLst.AddRange(dgvChanceProduct.Rows.Cast().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true)); - + this.statusBar.pgbTaskProgress.Maximum = rowLst.Count; + this.statusBar.UpdateProgressBar(0); this.pbLoading.Visible = true; + + if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested) + cancellationTokenSource = new CancellationTokenSource(); + Task.Run(() => { foreach (var row in rowLst) { + Invoke(new Action(() => + { + this.statusBar.UpdateProgressBar(this.statusBar.pgbTaskProgress.Value + 1); + this.statusBar.lblTaskStatus.Text = "正在入库 " + this.statusBar.pgbTaskProgress.Value + "/" + rowLst.Count; + })); + + if (cancellationTokenSource.IsCancellationRequested) + break; + var chanceId = row.Cells["colChanceId"].Value.ParseToString(); var chanceProd = lstChanceProductResult.FirstOrDefault(c => c.chance_id == chanceId); if (chanceProd == null || chanceProd.dbProduct == null) @@ -939,7 +968,16 @@ namespace TemuKJD.PDDForms.ProductSelectForms Invoke(new Action(() => { this.pbLoading.Visible = false; - BaseMsgForm.ShowInfo("商品入库完毕!"); + if (cancellationTokenSource?.IsCancellationRequested == true) + { + BaseMsgForm.ShowInfo("商品入库停止!"); + this.statusBar.lblTaskStatus.Text = "商品入库停止!计数 " + this.statusBar.pgbTaskProgress.Value; + } + else + { + BaseMsgForm.ShowInfo("商品入库完毕!"); + this.statusBar.lblTaskStatus.Text = "商品入库完毕!计数 " + this.statusBar.pgbTaskProgress.Value; + } })); }); } diff --git a/TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs b/TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs index b5cb7bb..b7da879 100644 --- a/TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs +++ b/TEMUKJD/ToolForms/GetJuShuitanProdForm.Designer.cs @@ -35,13 +35,10 @@ namespace TemuKJD.ToolForms System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); - this.tabControl1 = new System.Windows.Forms.TabControl(); - this.tabPage1 = new System.Windows.Forms.TabPage(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.btnNext = new System.Windows.Forms.Button(); this.btnPrev = new System.Windows.Forms.Button(); this.txtAddress = new System.Windows.Forms.TextBox(); - this.tabPage2 = new System.Windows.Forms.TabPage(); this.pbLoading = new System.Windows.Forms.PictureBox(); this.dgvProduct = new TemuKJD.UserComponent.DataGridViewEx(); this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn(); @@ -56,10 +53,15 @@ namespace TemuKJD.ToolForms this.colDel = new System.Windows.Forms.DataGridViewLinkColumn(); this.colMsg = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.ucTabControlMetro1 = new PinBaoBao.UserControls.UcTabControlMetro(); + this.tabPage1 = new System.Windows.Forms.TabPage(); + this.tabPage2 = new System.Windows.Forms.TabPage(); this.pnlMultiLogin = new System.Windows.Forms.Panel(); this.cmbMultiCookieName = new DevComponents.DotNetBar.Controls.ComboBoxEx(); this.btnMultiLogin = new DevComponents.DotNetBar.PanelEx(); this.btnDel = new DevComponents.DotNetBar.PanelEx(); + this.txtTitle = new System.Windows.Forms.TextBox(); + this.btnSearchTitle = new DevComponents.DotNetBar.PanelEx(); this.chkSkip = new TemuKJD.UserComponent.UcCheckBox(this.components); this.chkOverride = new TemuKJD.UserComponent.UcCheckBox(this.components); this.label1 = new System.Windows.Forms.Label(); @@ -82,46 +84,21 @@ namespace TemuKJD.ToolForms this.btnSaveCookie = new DevComponents.DotNetBar.PanelEx(); this.btnImportCookie = new DevComponents.DotNetBar.PanelEx(); this.label2 = new System.Windows.Forms.Label(); - this.tabControl1.SuspendLayout(); - this.tabPage1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit(); this.splitContainer2.Panel1.SuspendLayout(); this.splitContainer2.SuspendLayout(); - this.tabPage2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvProduct)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); + this.ucTabControlMetro1.SuspendLayout(); + this.tabPage1.SuspendLayout(); + this.tabPage2.SuspendLayout(); this.pnlMultiLogin.SuspendLayout(); this.SuspendLayout(); // - // tabControl1 - // - this.tabControl1.Controls.Add(this.tabPage1); - this.tabControl1.Controls.Add(this.tabPage2); - this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill; - this.tabControl1.ItemSize = new System.Drawing.Size(80, 24); - this.tabControl1.Location = new System.Drawing.Point(0, 0); - this.tabControl1.Multiline = true; - this.tabControl1.Name = "tabControl1"; - this.tabControl1.SelectedIndex = 0; - this.tabControl1.Size = new System.Drawing.Size(1404, 471); - this.tabControl1.TabIndex = 0; - // - // tabPage1 - // - this.tabPage1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.tabPage1.Controls.Add(this.splitContainer2); - this.tabPage1.Location = new System.Drawing.Point(4, 28); - this.tabPage1.Name = "tabPage1"; - this.tabPage1.Padding = new System.Windows.Forms.Padding(3); - this.tabPage1.Size = new System.Drawing.Size(1396, 439); - this.tabPage1.TabIndex = 0; - this.tabPage1.Text = " 商品页面 "; - this.tabPage1.UseVisualStyleBackColor = true; - // // splitContainer2 // this.splitContainer2.BackColor = System.Drawing.Color.White; @@ -136,7 +113,7 @@ namespace TemuKJD.ToolForms this.splitContainer2.Panel1.Controls.Add(this.btnNext); this.splitContainer2.Panel1.Controls.Add(this.btnPrev); this.splitContainer2.Panel1.Controls.Add(this.txtAddress); - this.splitContainer2.Size = new System.Drawing.Size(1388, 431); + this.splitContainer2.Size = new System.Drawing.Size(1390, 438); this.splitContainer2.SplitterDistance = 26; this.splitContainer2.TabIndex = 6; // @@ -167,27 +144,15 @@ namespace TemuKJD.ToolForms this.txtAddress.Location = new System.Drawing.Point(64, 3); this.txtAddress.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); this.txtAddress.Name = "txtAddress"; - this.txtAddress.Size = new System.Drawing.Size(1324, 23); + this.txtAddress.Size = new System.Drawing.Size(1326, 23); this.txtAddress.TabIndex = 7; this.txtAddress.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtAddress_KeyDown); // - // tabPage2 - // - this.tabPage2.Controls.Add(this.pbLoading); - this.tabPage2.Controls.Add(this.dgvProduct); - this.tabPage2.Location = new System.Drawing.Point(4, 28); - this.tabPage2.Name = "tabPage2"; - this.tabPage2.Padding = new System.Windows.Forms.Padding(3); - this.tabPage2.Size = new System.Drawing.Size(1396, 439); - this.tabPage2.TabIndex = 1; - this.tabPage2.Text = " 商品列表 "; - this.tabPage2.UseVisualStyleBackColor = true; - // // pbLoading // this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None; this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue; - this.pbLoading.Location = new System.Drawing.Point(673, 197); + this.pbLoading.Location = new System.Drawing.Point(673, 196); this.pbLoading.Name = "pbLoading"; this.pbLoading.Size = new System.Drawing.Size(50, 50); this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -231,7 +196,7 @@ namespace TemuKJD.ToolForms this.dgvProduct.Name = "dgvProduct"; this.dgvProduct.ReadOnly = true; this.dgvProduct.RowTemplate.Height = 23; - this.dgvProduct.Size = new System.Drawing.Size(1390, 433); + this.dgvProduct.Size = new System.Drawing.Size(1390, 437); this.dgvProduct.TabIndex = 7; this.dgvProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvProduct_CellContentClick); // @@ -335,12 +300,14 @@ namespace TemuKJD.ToolForms // // splitContainer1.Panel1 // + this.splitContainer1.Panel1.Controls.Add(this.ucTabControlMetro1); this.splitContainer1.Panel1.Controls.Add(this.pnlMultiLogin); - this.splitContainer1.Panel1.Controls.Add(this.tabControl1); // // splitContainer1.Panel2 // this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White; + this.splitContainer1.Panel2.Controls.Add(this.txtTitle); + this.splitContainer1.Panel2.Controls.Add(this.btnSearchTitle); this.splitContainer1.Panel2.Controls.Add(this.chkSkip); this.splitContainer1.Panel2.Controls.Add(this.chkOverride); this.splitContainer1.Panel2.Controls.Add(this.label1); @@ -364,10 +331,50 @@ namespace TemuKJD.ToolForms this.splitContainer1.Panel2.Controls.Add(this.btnImportCookie); this.splitContainer1.Panel2.Controls.Add(this.label2); this.splitContainer1.Size = new System.Drawing.Size(1404, 561); - this.splitContainer1.SplitterDistance = 471; + this.splitContainer1.SplitterDistance = 474; this.splitContainer1.SplitterWidth = 3; this.splitContainer1.TabIndex = 4; // + // ucTabControlMetro1 + // + this.ucTabControlMetro1.BackgroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(251)))), ((int)(((byte)(251)))), ((int)(((byte)(251))))); + this.ucTabControlMetro1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(174)))), ((int)(((byte)(157))))); + this.ucTabControlMetro1.Controls.Add(this.tabPage1); + this.ucTabControlMetro1.Controls.Add(this.tabPage2); + this.ucTabControlMetro1.Dock = System.Windows.Forms.DockStyle.Fill; + this.ucTabControlMetro1.Location = new System.Drawing.Point(0, 0); + this.ucTabControlMetro1.Name = "ucTabControlMetro1"; + this.ucTabControlMetro1.SelectedIndex = 0; + this.ucTabControlMetro1.ShowCloseButton = false; + this.ucTabControlMetro1.Size = new System.Drawing.Size(1404, 474); + this.ucTabControlMetro1.TabIndex = 462; + this.ucTabControlMetro1.TabSelectColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.ucTabControlMetro1.TabSelectTextColor = System.Drawing.Color.Gray; + this.ucTabControlMetro1.TabUnSelectTextColor = System.Drawing.Color.White; + // + // tabPage1 + // + this.tabPage1.Controls.Add(this.splitContainer2); + this.tabPage1.Location = new System.Drawing.Point(4, 26); + this.tabPage1.Name = "tabPage1"; + this.tabPage1.Padding = new System.Windows.Forms.Padding(3); + this.tabPage1.Size = new System.Drawing.Size(1396, 444); + this.tabPage1.TabIndex = 0; + this.tabPage1.Text = "商品页面"; + this.tabPage1.UseVisualStyleBackColor = true; + // + // tabPage2 + // + this.tabPage2.Controls.Add(this.pbLoading); + this.tabPage2.Controls.Add(this.dgvProduct); + this.tabPage2.Location = new System.Drawing.Point(4, 26); + this.tabPage2.Name = "tabPage2"; + this.tabPage2.Padding = new System.Windows.Forms.Padding(3); + this.tabPage2.Size = new System.Drawing.Size(1396, 443); + this.tabPage2.TabIndex = 1; + this.tabPage2.Text = "采集列表"; + this.tabPage2.UseVisualStyleBackColor = true; + // // pnlMultiLogin // this.pnlMultiLogin.Controls.Add(this.cmbMultiCookieName); @@ -440,6 +447,39 @@ namespace TemuKJD.ToolForms this.btnDel.TabIndex = 409; this.btnDel.Text = "删"; // + // txtTitle + // + this.txtTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.txtTitle.Location = new System.Drawing.Point(319, 33); + this.txtTitle.Name = "txtTitle"; + this.txtTitle.Size = new System.Drawing.Size(202, 23); + this.txtTitle.TabIndex = 968; + // + // btnSearchTitle + // + this.btnSearchTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnSearchTitle.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnSearchTitle.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnSearchTitle.DisabledBackColor = System.Drawing.Color.Empty; + this.btnSearchTitle.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnSearchTitle.Location = new System.Drawing.Point(523, 33); + this.btnSearchTitle.Name = "btnSearchTitle"; + this.btnSearchTitle.Size = new System.Drawing.Size(56, 23); + this.btnSearchTitle.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnSearchTitle.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSearchTitle.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnSearchTitle.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnSearchTitle.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnSearchTitle.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnSearchTitle.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnSearchTitle.Style.GradientAngle = 90; + this.btnSearchTitle.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnSearchTitle.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSearchTitle.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnSearchTitle.TabIndex = 967; + this.btnSearchTitle.Text = "搜索标题"; + this.btnSearchTitle.Click += new System.EventHandler(this.btnSearchTitle_Click); + // // chkSkip // this.chkSkip.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); @@ -792,13 +832,10 @@ namespace TemuKJD.ToolForms this.Name = "GetJuShuitanProdForm"; this.Text = "获取厂商产品"; this.Load += new System.EventHandler(this.GetJuShuitanProdForm_Load); - this.tabControl1.ResumeLayout(false); - this.tabPage1.ResumeLayout(false); this.splitContainer2.Panel1.ResumeLayout(false); this.splitContainer2.Panel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); this.splitContainer2.ResumeLayout(false); - this.tabPage2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvProduct)).EndInit(); this.splitContainer1.Panel1.ResumeLayout(false); @@ -806,16 +843,15 @@ namespace TemuKJD.ToolForms this.splitContainer1.Panel2.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); + this.ucTabControlMetro1.ResumeLayout(false); + this.tabPage1.ResumeLayout(false); + this.tabPage2.ResumeLayout(false); this.pnlMultiLogin.ResumeLayout(false); this.ResumeLayout(false); } #endregion - - private System.Windows.Forms.TabControl tabControl1; - private System.Windows.Forms.TabPage tabPage1; - private System.Windows.Forms.TabPage tabPage2; private System.Windows.Forms.SplitContainer splitContainer2; private System.Windows.Forms.Button btnNext; private System.Windows.Forms.Button btnPrev; @@ -860,5 +896,10 @@ namespace TemuKJD.ToolForms private System.Windows.Forms.ComboBox cmbPlatformType; private UserComponent.UcCheckBox chkOverride; private UserComponent.UcCheckBox chkSkip; + private PinBaoBao.UserControls.UcTabControlMetro ucTabControlMetro1; + private System.Windows.Forms.TabPage tabPage1; + private System.Windows.Forms.TabPage tabPage2; + private System.Windows.Forms.TextBox txtTitle; + private DevComponents.DotNetBar.PanelEx btnSearchTitle; } } \ No newline at end of file diff --git a/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs b/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs index 31f9d9d..f0cb291 100644 --- a/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs +++ b/TEMUKJD/ToolForms/GetJuShuitanProdForm.cs @@ -1,11 +1,13 @@ using AllBase; using AllBase.Model.Result; +using AllBase.Model.Result.PDDResult; using CefSharp; using CefSharp.WinForms; using NaiBa.CefHelper; using NaiBa.CefHelper.Handler; using NaiBa.Util; using NaiBa.Util.Extension; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.ComponentModel; @@ -39,6 +41,7 @@ namespace TemuKJD.ToolForms int filterSaleCountDays = 7; int filterSaleCount = 100; string platformType = "Pinduoduo"; + string jstPddShopId = ""; ConcurrentList lstJSTListProductInfo = new ConcurrentList(); public GetJuShuitanProdForm() @@ -199,11 +202,16 @@ namespace TemuKJD.ToolForms private void CefWebBrowser_AddressChanged(object sender, CefSharp.AddressChangedEventArgs e) { if (this.Created && !this.Disposing && !this.IsDisposed) - Invoke(new Action(() => + { + Task.Run(() => { - currentUrl = e.Address; - txtAddress.Text = e.Address; - })); + Invoke(new Action(() => + { + currentUrl = e.Address; + txtAddress.Text = e.Address; + })); + }); + } } private void CefWebBrowser_LoadError(object sender, CefSharp.LoadErrorEventArgs e) { @@ -308,12 +316,19 @@ namespace TemuKJD.ToolForms BaseMsgForm.ShowError("请在网页上选择要搜索的供应商商品列表页面"); return; } + if (dgvProduct.Rows.Count > 0) + { + if (BaseMsgForm.ShowConfirm("当前列表已有采集数据,是否重新采集?").DialogResult == DialogResult.Cancel) + { + return; + } + } this.pbLoading.Visible = true; dgvProduct.Rows.Clear(); - lstJSTListProductInfo.Clear(); - if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested) - cancellationTokenSource = new CancellationTokenSource(); + lstJSTListProductInfo.Clear(); + //if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested) + cancellationTokenSource = new CancellationTokenSource(); Task.Run(() => { try @@ -356,14 +371,7 @@ namespace TemuKJD.ToolForms Thread.Sleep(Randomx.GetId(1000, 2000)); page++; - string url = "https://sc.scm121.com/api/goods/buyer/supplier/goods/list"; - string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + Jobj["supplierId"] + "?showErpList=1"; - var lstRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, JsonHelper.SerializeObject(Jobj), referer, appVersion); - for (int i = 0; i < 3 && !lstRst.Contains("\"success\":true"); i++) - { - Thread.Sleep(Randomx.GetId(1000, 2000)); - lstRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, JsonHelper.SerializeObject(Jobj), referer, appVersion); - } + var lstRst = GetGoodsLst(shop, Jobj); if (!lstRst.Contains("\"success\":true")) { var errMsg = BaseRegex.GetStringJson(ref lstRst, "message"); @@ -415,25 +423,30 @@ namespace TemuKJD.ToolForms jstLst = jstLst.Where(p => !lstJSTListProductInfo.Any(p1 => p1.id == p.id)).ToList(); lstJSTListProductInfo.AddRange(jstLst); - foreach (var prod in jstLst) - { + //var t = Task.Run(() => + //{ Invoke(new Action(() => { - var id = dgvProduct.Rows.Add( - true, - prod.id, - (prod.itemMainImage?.FirstOrDefault()).ParseToString().Replace("https://", "http://"), - DataGridViewExtension.defaultBitmap, - prod.itemName, - prod.saleSeven, - prod.saleThirty, - prod.categoryName, - "预估:" + prod.minSalesPrice + " 采集详情后显示实际值", - "删除" - ); - dgvProduct.Rows[id].Height = 60; + foreach (var prod in jstLst) + { + var id = dgvProduct.Rows.Add( + true, + prod.id, + (prod.itemMainImage?.FirstOrDefault()).ParseToString().Replace("https://", "http://"), + DataGridViewExtension.defaultBitmap, + prod.itemName, + prod.saleSeven, + prod.saleThirty, + prod.categoryName, + "预估:" + prod.minSalesPrice + " 采集详情后显示实际值", + "删除" + ); + dgvProduct.Rows[id].Height = 60; + + } })); - } + //}); + //t.Wait(5000); } catch (Exception ex) { @@ -490,27 +503,31 @@ namespace TemuKJD.ToolForms private void btnSaveDb_Click(object sender, EventArgs e) { - Task.Run(() => { }); //"&product_get_type=" + HttpUtility.UrlEncode("厂商直采", Encoding.UTF8); + List cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null)); + var shop = new ShopLoginInfo(); + shop.Cookies = JsonHelper.SerializeObject(cookieList); List rowLst = new List(); rowLst.AddRange(dgvProduct.Rows.Cast().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true)); - if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested) - cancellationTokenSource = new CancellationTokenSource(); + //if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested) + cancellationTokenSource = new CancellationTokenSource(); this.pbLoading.Visible = true; var t = Task.Run(() => { - List cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null)); - var shop = new ShopLoginInfo(); - shop.Cookies = JsonHelper.SerializeObject(cookieList); foreach (var row in rowLst) { if (cancellationTokenSource.IsCancellationRequested) break; + Invoke(new Action(() => + { + this.statusBar.lblTaskStatus.Text = "正在入库表格第 " + (row.Index + 1) + " 行数据"; + })); + var prodId = row.Cells["colProductId"].Value.ParseToString(); var prod = lstJSTListProductInfo.FirstOrDefault(c => c.id == prodId); if (prod == null || prod.dbProduct == null || prod.dbProduct.product_json.Length < 10) @@ -537,7 +554,7 @@ namespace TemuKJD.ToolForms isExist = true; } - var SetPartnerSpuRst = ""; + //var SetPartnerSpuRst = ""; var url = BaseClass.BuildObjString("product/add_product"); if (isExist) { @@ -554,10 +571,24 @@ namespace TemuKJD.ToolForms continue; } } - else + //else { - SetPartnerSpuRst = SetPartnerSpu(shop, prod); - //{"success":true,"total":null,"data":{"message":"成功添加1款分销商品,系统会自动按商品拆分订单并推送给对应供应商","count":1,"shelvesType":"DISTRIBUTION"},"message":null,"code":"0000","hasNext":false,"now":1769330182209,"extra":{}} + ////设置分销 + //SetPartnerSpuRst = SetPartnerSpu(shop, prod); + //for (int i = 0; i < 3 && !SetPartnerSpuRst.Contains("\"success\":true"); i++) + //{ + // Thread.Sleep(Randomx.GetId(2000, 4000)); + // SetPartnerSpuRst = SetPartnerSpu(shop, prod); + //} + //if (!SetPartnerSpuRst.Contains("\"success\":true")) + //{ + // Invoke(new Action(() => + // { + // row.Cells["colMsg"].Value = "分销设置失败,请下次重试,暂时跳过入库"; + // })); + // continue; + //} + ////{"success":true,"total":null,"data":{"message":"成功添加1款分销商品,系统会自动按商品拆分订单并推送给对应供应商","count":1,"shelvesType":"DISTRIBUTION"},"message":null,"code":"0000","hasNext":false,"now":1769330182209,"extra":{}} } var data = Work.UserLogin.GetSignaturex() + @@ -568,10 +599,6 @@ namespace TemuKJD.ToolForms "&spu_id=" + prod.dbProduct.spu_id.ParseToString() + "&skc_id=" + prod.dbProduct.skc_id.ParseToString() + "&price_text=" + prod.dbProduct.price_text + - "&main_cat_id=" + prod.dbProduct.main_cat_id + - "&main_cat_name=" + HttpUtility.UrlEncode(prod.dbProduct.main_cat_name.ParseToString(), Encoding.UTF8) + - "&cat_id=" + prod.dbProduct.cat_id + - "&cat_name=" + HttpUtility.UrlEncode((prod.dbProduct.cat_name ?? prod.categoryName).ParseToString(), Encoding.UTF8) + "&ext_code=" + HttpUtility.UrlEncode(prod.dbProduct.ext_code, Encoding.UTF8) + "&product_name=" + HttpUtility.UrlEncode(prod.dbProduct.product_name, Encoding.UTF8) + "&product_json=" + HttpUtility.UrlEncode(dbProd.product_json, Encoding.UTF8) + @@ -580,7 +607,18 @@ namespace TemuKJD.ToolForms "&sale_count_text=" + HttpUtility.UrlEncode(dbProd.sale_count_text, Encoding.UTF8) + "&main_img=" + HttpUtility.UrlEncode(dbProd.main_img, Encoding.UTF8) + "&product_get_type=" + HttpUtility.UrlEncode("厂商直采", Encoding.UTF8); - if (SetPartnerSpuRst.Contains("\"success\":true")) + if (!isExist) + { + data += "&main_cat_id=" + prod.dbProduct.main_cat_id + + "&main_cat_name=" + HttpUtility.UrlEncode(prod.dbProduct.main_cat_name.ParseToString(), Encoding.UTF8) + + "&cat_id=" + prod.dbProduct.cat_id + + "&cat_name=" + HttpUtility.UrlEncode((prod.dbProduct.cat_name ?? prod.categoryName).ParseToString(), Encoding.UTF8); + } + //if (SetPartnerSpuRst.Contains("\"success\":true")) + //{ + // data += "&distribution_set=1"; + //} + if (prod.dbProduct.distribution_set > 0) { data += "&distribution_set=1"; } @@ -658,35 +696,38 @@ namespace TemuKJD.ToolForms //https://sc.scm121.com/manage/goods/qualitySupplier/detail/93D12D2BD21649DC8240E2265BE37E2A?showErpList=1 this.pbLoading.Visible = true; - if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested) - cancellationTokenSource = new CancellationTokenSource(); + List cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null)); + var shop = new ShopLoginInfo(); + shop.Cookies = JsonHelper.SerializeObject(cookieList); + List rowLst = new List(); + rowLst.AddRange(dgvProduct.Rows.Cast().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true)); + + //if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested) + cancellationTokenSource = new CancellationTokenSource(); Task.Run(() => { - List cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null)); - var shop = new ShopLoginInfo(); - shop.Cookies = JsonHelper.SerializeObject(cookieList); - - List pIds = new List(); - pIds.AddRange(dgvProduct.Rows.Cast().Select(r => r.Cells["colProductId"].Value.ParseToString()).ToList()); - foreach (var prodId in pIds) + foreach (var row in rowLst) { if (cancellationTokenSource.IsCancellationRequested) break; - var row = dgvProduct.Rows.Cast().FirstOrDefault(r => r.Cells["colProductId"].Value.ParseToString() == prodId); - - if (row == null || row.Index < 0 || row.Cells["colCheck"].Value.ParseToBool() != true) - continue; + Invoke(new Action(() => + { + this.statusBar.lblTaskStatus.Text = "正在采集表格第 " + (row.Index + 1) + " 行详情数据"; + })); + var prodId = row.Cells["colProductId"].Value.ParseToString(); var prod = lstJSTListProductInfo.FirstOrDefault(c => c.id == prodId); // 不存在或已经采集过 if (prod == null || prod?.dbProduct?.product_json?.ParseToString().Length > 10) continue; - Thread.Sleep(Randomx.GetId(500, 1500)); if (chkSkip.Checked) { + if (prod.getProductMsg == "商品已存在,跳过详情采集") + continue; + bool isExist = false; var existUrl = BaseClass.BuildObjString("product/get_product_list"); string existData = UserLogin.GetSignaturex() + "&search_spu=" + prod.spuId; @@ -713,12 +754,33 @@ namespace TemuKJD.ToolForms continue; } } + Thread.Sleep(Randomx.GetId(500, 1500)); - string url = "https://sc.scm121.com/api/goods/goods/goGoodsPdd/queryBaseData?itemSpuId=" + prod.itemSpuId + "&shelvesType=DISTRIBUTION&originator=SUPPLIER&itemCoId=" + prod.itemCoId; - string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + prod.supplierId + "?showErpList=1"; - var getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion); - if (!getDetailRst.Contains("\"success\":true")) - getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion); + + //设置分销 + var SetPartnerSpuRst = SetPartnerSpu(shop, prod); + for (int i = 0; i < 3 && !SetPartnerSpuRst.Contains("\"success\":true"); i++) + { + Thread.Sleep(Randomx.GetId(2000, 4000)); + SetPartnerSpuRst = SetPartnerSpu(shop, prod); + } + if (!SetPartnerSpuRst.Contains("\"success\":true")) + { + Invoke(new Action(() => + { + row.Cells["colMsg"].Value = "分销设置失败,请下次重试,暂时跳过入库"; + })); + continue; + } + else + { + prod.dbProduct.distribution_set = 1; + } + //{"success":true,"total":null,"data":{"message":"成功添加1款分销商品,系统会自动按商品拆分订单并推送给对应供应商","count":1,"shelvesType":"DISTRIBUTION"},"message":null,"code":"0000","hasNext":false,"now":1769330182209,"extra":{}} + + + // 采集商品详情 + var getDetailRst = GetPddBaseData(shop, prod); if (!getDetailRst.Contains("\"success\":true")) { var errMsg = BaseRegex.GetStringJson(ref getDetailRst, "message"); @@ -736,9 +798,46 @@ namespace TemuKJD.ToolForms { var jObj = JsonHelper.JObjectParse(getDetailRst)["data"]; prod.dbProduct.cat_id = jObj["catId"].ParseToString(); + + if (string.IsNullOrEmpty(jstPddShopId)) + { + var getShopIdRst = GetPddShopId(shop, prod); + //{"success":true,"total":1,"data":[{"shopId":"20115638","supplierId":"14791477","shopName":"阿杰小铺浦哈哈","shopType":"拼多多","shopTypeKey":"拼多多","shopTypeValue":"拼多多","itemSpuId":null,"shopItemSpuId":null,"shopAuthorizationDate":"2027-01-23 11:17:00","userName":null,"shelvesStatus":false,"updated":null,"sessionStatus":2,"sessionUid":null,"created":null,"hasPermission":true,"enabled":true,"mainSpuId":null,"shelved":false,"appCid":0,"riskVerifyUrl":null,"storeType":"COMMON"}],"message":null,"code":"0000","hasNext":false,"now":1769588598917,"extra":{}} + jstPddShopId = BaseRegex.GetStringJson(ref getShopIdRst, "shopId"); + } + + var getPropRst = GetPddProp(shop, prod, prod.dbProduct.cat_id, jstPddShopId); + if (!getPropRst.Contains("\"success\":true")) + { + var errMsg = BaseRegex.GetStringJson(ref getPropRst, "message"); + if (string.IsNullOrEmpty(errMsg)) + errMsg = getPropRst; + prod.getProductMsg = "采集失败 " + errMsg; + Invoke(new Action(() => + { + try { row.Cells["colMsg"].Value = prod.getProductMsg; } catch { } + })); + continue; + } + List pddPropMap = new List(); + var pddPropObj = JsonHelper.JObjectParse(getPropRst)["data"]; + foreach (JObject pObj in pddPropObj["properties"]) + { + pddPropMap.Add(new PDDPropRefPidNameMap() + { + id = pObj["id"].IsJTokenNullOrEmpty() ? new long?() : pObj["id"].ParseToLong(), + ref_pid = pObj["ref_pid"].IsJTokenNullOrEmpty() ? new long?() : pObj["ref_pid"].ParseToLong(), + name = pObj["name"].IsJTokenNullOrEmpty() ? null : pObj["name"].ParseToString(), + name_alias = pObj["name_alias"].IsJTokenNullOrEmpty() ? null : pObj["name_alias"].ParseToString(), + }); + } + // 不进行类目属性预测 + //var getPropRstV2 = GetPddPropForecastV2(shop, prod, prod.dbProduct.cat_id); + prod.dbProduct.main_cat_id = jObj["categoryData"].FirstOrDefault().ParseToString(); var prodDataJson = JsonHelper.SerializeObject(jObj); - prod.dbProduct.product_json = "{\"pddData\":" + prodDataJson + ",\"jstProd\":" + prod.jstProductJson + "}"; + var propMapJson = JsonHelper.SerializeObject(pddPropMap); + prod.dbProduct.product_json = "{\"pddData\":" + prodDataJson + ",\"pddPropMap\":" + propMapJson + ",\"jstProd\":" + prod.jstProductJson + "}"; var priceMin = jObj["skuInfo"]["goodsSkuDetail"].Min(s => s["supplyPrice"].ParseToDecimal()); var priceMax = jObj["skuInfo"]["goodsSkuDetail"].Max(s => s["supplyPrice"].ParseToDecimal()); prod.dbProduct.price_text = priceMin + "-" + priceMax; @@ -760,7 +859,7 @@ namespace TemuKJD.ToolForms })); } - if (pIds.IndexOf(prodId) % 20 == 0 ) + if (row.Index % 20 == 0 ) NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_list_" + MainForm.ProcessCount, lstJSTListProductInfo); } NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_list_" + MainForm.ProcessCount, lstJSTListProductInfo); @@ -775,8 +874,8 @@ namespace TemuKJD.ToolForms private void GetDyProd() { this.pbLoading.Visible = true; - if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested) - cancellationTokenSource = new CancellationTokenSource(); + //if (cancellationTokenSource == null || cancellationTokenSource.IsCancellationRequested) + cancellationTokenSource = new CancellationTokenSource(); Task.Run(() => { @@ -811,11 +910,11 @@ namespace TemuKJD.ToolForms html = GetHtml.PostUtf8(existUrl, existData); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) { - //Invoke(new Action(() => - //{ - // row.Cells["colMsg"].Value = "采集详情失败,产品数据库连接失败"; - //})); - //continue; + Invoke(new Action(() => + { + row.Cells["colMsg"].Value = "采集详情失败,产品数据库连接失败"; + })); + continue; } else { @@ -830,11 +929,7 @@ namespace TemuKJD.ToolForms } } - string url = "https://sc.scm121.com/api/goods/goods/goGoodsDouyin/queryBaseData?itemSpuId=" + prod.itemSpuId + "&shelvesType=DISTRIBUTION&originator=SUPPLIER&itemCoId=" + prod.itemCoId; - string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + prod.supplierId + "?showErpList=1"; - var getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion); - if (!getDetailRst.Contains("\"success\":true")) - getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer); + var getDetailRst = GetPddBaseData(shop, prod); if (!getDetailRst.Contains("\"success\":true")) { var errMsg = BaseRegex.GetStringJson(ref getDetailRst, "message"); @@ -886,6 +981,62 @@ namespace TemuKJD.ToolForms }, cancellationTokenSource.Token); } + public string GetGoodsLst(ShopLoginInfo shop, JObject searchDataObj) + { + string url = "https://sc.scm121.com/api/goods/buyer/supplier/goods/list"; + string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + searchDataObj["supplierId"] + "?showErpList=1"; + var lstRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, JsonHelper.SerializeObject(searchDataObj), referer, appVersion); + for (int i = 0; i < 3 && !lstRst.Contains("\"success\":true"); i++) + { + Thread.Sleep(Randomx.GetId(1000, 2000)); + lstRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, JsonHelper.SerializeObject(searchDataObj), referer, appVersion); + } + return lstRst; + } + + public string GetPddBaseData(ShopLoginInfo shop, JSTListProductInfo jstLstProd) + { + string url = "https://sc.scm121.com/api/goods/goods/goGoodsPdd/queryBaseData?itemSpuId=" + jstLstProd.itemSpuId + "&shelvesType=DISTRIBUTION&originator=SUPPLIER&itemCoId=" + jstLstProd.itemCoId; + string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + jstLstProd.supplierId + "?showErpList=1"; + var getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion); + for (int i = 0; i< 3 && !getDetailRst.Contains("\"success\":true"); i++) + { + Thread.Sleep(Randomx.GetId(1000, 2000)); + getDetailRst = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion); + } + return getDetailRst; + } + + public string GetPddShopId(ShopLoginInfo shop, JSTListProductInfo jstLstProd) + { + string url = "https://sc.scm121.com/api/goods/shelves/mxStoresInformation/selectStoresInfo?shopTypeKey=%E6%8B%BC%E5%A4%9A%E5%A4%9A&spuId=" + + jstLstProd.spuId + "&itemCoId=" + jstLstProd.itemCoId + "&isUpdate=false&pageNum=1&pageSize=20"; + string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + jstLstProd.supplierId + "?showErpList=1"; + var response = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion); + return response; + } + + public string GetPddProp(ShopLoginInfo shop, JSTListProductInfo jstLstProd, string catId, string shopId = "20115638") + { + string url = "https://sc.scm121.com/api/goods/shelves/pddShelves/queryGoodsTemplate?catId=" + catId + "&shopId=" + shopId; + string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + jstLstProd.supplierId + "?itemCoId=" + jstLstProd.itemCoId + "&noBack=true"; + var response = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion); + return response; + } + + /// + /// 没有商品属性的,类目属性预测 + /// + public string GetPddPropForecastV2(ShopLoginInfo shop, JSTListProductInfo jstProd, string catId, string shopId = "20115638") + { + //string url = "https://sc.scm121.com/api/goods/platform/category/categoryPropForecastV2?shopId=20115638&itemSpuId=DD0FCC6A42C94EAC9D2A0BFEBA33A683&itemCoId=10361546&shopType=Pinduoduo&categoryId=10799"; + string url = "https://sc.scm121.com/api/goods/platform/category/categoryPropForecastV2?shopId=" + shopId + + "&itemSpuId=" + jstProd.itemSpuId + "&itemCoId=" + jstProd.itemCoId + "&shopType=Pinduoduo&categoryId=" + catId; + string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + jstProd.supplierId + "?showErpList=1"; + var response = JSTHttpResponseBLL.JSTGetResponse(shop, url, referer, appVersion); + return response; + } + public string SetPartnerSpu(ShopLoginInfo shop, JSTListProductInfo jstProd) { string url = "https://sc.scm121.com/api/goods/buyer/partnerSpu/add"; @@ -894,5 +1045,28 @@ namespace TemuKJD.ToolForms var response = JSTHttpResponseBLL.JSTPostResponse(shop, url, data, referer, appVersion); return response; } + + private void btnSearchTitle_Click(object sender, EventArgs e) + { + pbLoading.Visible = true; + Task.Run(() => + { + foreach (DataGridViewRow row in dgvProduct.Rows) + { + Invoke(new Action(() => + { + + row.Visible = (row.Cells["colGoodsName"].Value.ParseToString().Contains(txtTitle.Text.Trim()) || txtTitle.Text.Trim() == ""); + if (row.Visible == false) + row.Cells["colCheck"].Value = false; + + })); + } + Invoke(new Action(() => + { + pbLoading.Visible = false; + })); + }); + } } } diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs index 1842cea..902c348 100644 --- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs +++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs @@ -972,6 +972,11 @@ namespace TemuKJD.WXForms.ProductForms if (chkSkipUploaded.Checked) { var searchExtCode = "EC1" + dbProd.spu_id + "A"; + if (dbProd.sku_secret_json != null && dbProd.sku_secret_json.Contains("goodsId")) + { + var sku_secret_json = dbProd.sku_secret_json; + searchExtCode = BaseRegex.GetStringJson(ref sku_secret_json, "goodsId"); + } var searchRst = WXUpload.searchProduct(shop, searchExtCode); if (!searchRst.Contains("\"code\":0") && !searchRst.Contains("\"success\":true")) { @@ -994,6 +999,15 @@ namespace TemuKJD.WXForms.ProductForms } } + // 加密数据将聚水潭产品数据格式进行转换 + if (dbProd.sku_secret_json != null && dbProd.sku_secret_json.Contains("goodsId")) + { + string convertRst = ""; + var ob = new PDDProdFormConverter().JstPddProdToPddConvert(out convertRst, dbProd); + if (!string.IsNullOrEmpty(convertRst)) + return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"商品查询错误 " + convertRst + "\"}"; + } + #region 将产品数据初始化成微信小店支持的参数 JObject prodJObj = new JObject(); try @@ -1436,7 +1450,71 @@ namespace TemuKJD.WXForms.ProductForms #endregion #region 售后信息 - var addressRst = WXUpload.getAddress(shop); + + var afterSaleAddress = ""; + var afterSaleDetail = ""; + if (dbProd.wx_cat_leaf != null) + { + + var urlAfterSale = BaseClass.BuildObjString("product/wx_get_after_sale"); + var dataAfterSale = Work.UserLogin.GetSignaturex() + + "&coid=" + dbProd.skc_id; + var htmlAfterSale = GetHtml.PostUtf8(urlAfterSale, dataAfterSale); + if (string.IsNullOrEmpty(htmlAfterSale) || !htmlAfterSale.Contains("\"code\":200")) + htmlAfterSale = GetHtml.PostUtf8(urlAfterSale, dataAfterSale); + if (string.IsNullOrEmpty(htmlAfterSale) || !htmlAfterSale.Contains("\"code\":200")) + { + + } + else + { + if (htmlAfterSale.Contains("\"data\":\"\"")) + { + } + else + { + try + { + afterSaleAddress = JsonHelper.SerializeObject(JsonHelper.JObjectParse(htmlAfterSale)["data"]); + } + catch + { + + } + } + } + + if (string.IsNullOrEmpty(afterSaleAddress)) + { + // 获取推单售后地址 + //https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=10361546&shopId=46568955 + var urlAfter = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/afterSale/info?warehouseNum=" + dbProd.skc_id; //+ "&userName=阿杰账户"; + var afterRst = WXHttpResponseBLL.e57GetResponse(urlAfter, ""); + try + { + afterSaleAddress = JsonHelper.SerializeObject(JsonHelper.JObjectParse(afterRst)["data"]); + if(afterRst.Contains("\"code\":0") && !string.IsNullOrEmpty(afterSaleAddress)) + { + urlAfterSale = BaseClass.BuildObjString("product/wx_add_mdy_after_sale"); + dataAfterSale = Work.UserLogin.GetSignaturex() + + "&coid=" + dbProd.skc_id + "&after_sale_json=" + afterSaleAddress; + htmlAfterSale = GetHtml.PostUtf8(urlAfterSale, dataAfterSale); + if (string.IsNullOrEmpty(htmlAfterSale) || !htmlAfterSale.Contains("\"code\":200")) + htmlAfterSale = GetHtml.PostUtf8(urlAfterSale, dataAfterSale); + } + } + catch (Exception ex) + { + } + } + } + + if (!string.IsNullOrEmpty (afterSaleAddress)) + { + afterSaleDetail = BaseRegex.GetStringJson(ref afterSaleAddress, "detail_info"); + } + + var addressRst = WXUpload.getAddress(shop, afterSaleDetail); if (!addressRst.Contains("\"code\":0") && !addressRst.Contains("\"success\":true")) { var error = BaseRegex.GetStringJson(ref addressRst, "msg"); @@ -1444,6 +1522,33 @@ namespace TemuKJD.WXForms.ProductForms error = addressRst; return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"售后地址获取失败 " + error + "\"}"; } + if (addressRst.Contains("\"totalNum\":0") && !string.IsNullOrEmpty(afterSaleDetail)) + { + string provinceName = BaseRegex.GetStringJson(ref afterSaleAddress, "province_name"); + string cityName = BaseRegex.GetStringJson(ref afterSaleAddress, "city_name"); + string countyName = BaseRegex.GetStringJson(ref afterSaleAddress, "county_name"); + string detailInfo = afterSaleDetail; + string userName = BaseRegex.GetStringJson(ref afterSaleAddress, "user_name"); + string telNumber = BaseRegex.GetStringJson(ref afterSaleAddress, "tel_number"); + var addAddRst = WXUpload.addAddress(shop, provinceName, cityName, countyName, detailInfo, userName, telNumber); + + Thread.Sleep(Randomx.GetId(500, 1500)); + + addressRst = WXUpload.getAddress(shop, afterSaleDetail); + if (!addressRst.Contains("\"code\":0") && !addressRst.Contains("\"success\":true")) + { + var error = BaseRegex.GetStringJson(ref addressRst, "msg"); + if (string.IsNullOrEmpty(error)) + error = addressRst; + return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"售后地址获取失败 " + error + "\"}"; + } + } + + if (addressRst.Contains("\"totalNum\":0")) + { + return "{\"success\":false,\"draftId\":0,\"status\":\"未上传\",\"errMsg\":\"售后地址获取失败\"}"; + } + upProdParam.product.info.afterSaleInfo = new afterSaleInfoParam(); upProdParam.product.info.afterSaleInfo.afterSaleAddressId = BaseRegex.GetStringJson(ref addressRst, "addressId"); #endregion @@ -1632,10 +1737,24 @@ namespace TemuKJD.WXForms.ProductForms attrValue = "常规"; else if (attrValueLst.Contains("通用")) attrValue = "通用"; + else if (attrValueLst.Contains("国产")) + attrValue = "国产"; else if (attr.value.Contains("绒丝;羽毛;白鸭绒;白鹅绒;灰鸭绒;灰鹅绒;鸭毛片;鹅毛片")) { attrValue = "绒丝"; } + else if (attr.name == "是否进口") + { + attrValue = "非进口"; + } + else if (attr.name == "商品产地") + { + attrValue = "中国大陆"; + } + else if (attr.name == "产地") + { + attrValue = "中国大陆"; + } else if (attrValueLst.Any(v => v.Contains("%"))) { attrValue = attrValueLst.FirstOrDefault(); @@ -1819,6 +1938,7 @@ namespace TemuKJD.WXForms.ProductForms } // sku图 skuParam.productSkuInfo.thumbImg = upProdParam.product.info.productSaleAttrs[0].items.FirstOrDefault(a => a.value == skuInfo.spec[0].spec_name)?.imgUrl; + skuParam.productSkuInfo.skuCode = skuInfo.out_sku_sn; // 库存 skuParam.productSkuInfo.stockInfo = new stockInfoParam() { stockNum = defaultAddPriceRule.StockNum }; skuParam.productSkuInfo.saleParam = new List(); @@ -2326,7 +2446,7 @@ namespace TemuKJD.WXForms.ProductForms "&page=" + 1 + "&page_size=" + pageSize; data += "&in_ext_codes=" + txtExtCodeFilter.Text; - data += "&in_skc_ids=" + txtIdFilter.Text; + data += "&in_spu_ids=" + txtIdFilter.Text; data += "&in_groups=" + cmbGroupFilter.Text; data += "&in_cates=" + cmbCateFilter.Text; data += "&product_get_type=" + cmbSourceType.Text.Trim(); @@ -2648,10 +2768,12 @@ namespace TemuKJD.WXForms.ProductForms public class WXUpload { - public static string searchProduct(ShopLoginInfo shop, string extCode) + public static string searchProduct(ShopLoginInfo shop, string extCode, string extCode2 = "") { string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeproductcore/cgi/goods/searchProduct?" + "token=&lang=zh_CN&pageSize=20&productStatus[]=-1&productSource=[1,16,32]&searchSource=1&useNew=true&pageNum=1&status[]=5&spuCode=" + extCode; + if (!string.IsNullOrEmpty(extCode2)) + url += "," + extCode2; string refere = "https://store.weixin.qq.com/shop/goods/list?currentTab=PRODUCT_STATUS_ON"; var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, refere); return result; @@ -2759,16 +2881,16 @@ Content-Type: image/jpeg /// /// /// - public static string getAddress(ShopLoginInfo shop) + public static string getAddress(ShopLoginInfo shop, string searchText="") { string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeexpress/cgi/getAddress?token=&lang=zh_CN"; + if (!string.IsNullOrEmpty(searchText)) + url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeexpress/cgi/getAddress?searchStr=" + GetHtml.UrlEncodeUtf8(searchText) + "&token=&lang=zh_CN"; string referer = "https://store.weixin.qq.com/shop/goods/entry"; var result = WXHttpResponseBLL.WeiXinGetResponse(shop, url, referer); return result; } - - public static string uploadProductDraft(ShopLoginInfo shop, WXUploadProductParam prodParam) { string url = "https://store.weixin.qq.com/shop-faas/mmecnodeproductupload/common/cgi/goods/uploadProductDraft?token=&lang=zh_CN"; @@ -2809,11 +2931,11 @@ Content-Type: image/jpeg return result; } - /// - /// 取售后地址 + /// 尝试免审 失败 /// /// + /// /// public static string getEditProductV2(ShopLoginInfo shop, string productId) { @@ -2938,6 +3060,26 @@ Content-Type: application/octet-stream var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer); return result; } + + /// + /// 添加售后地址 + /// + public static string addAddress(ShopLoginInfo shop, string provinceName, string cityName, string countyName, + string detailInfo, string userName, string telNumber) + { + string url = "https://store.weixin.qq.com/shop-faas/mmchannelstradeexpress/address/addAddress?token=&lang=zh_CN"; + string referer = "https://store.weixin.qq.com/shop/address/expressAddressMgmt"; + string address = "{\"addressInfo\":{\"provinceName\":\"" + provinceName + + "\",\"cityName\":\"" + cityName + "\",\"countyName\":\"" + countyName + + "\",\"detailInfo\":\"" + detailInfo + "\",\"userName\":\"" + userName + + "\",\"telNumber\":\"" + telNumber + "\",\"location\":{}},\"defaultSend\":0,\"defaultRecv\":0}"; + + JObject obj = new JObject(); + obj["data"] = address; + string body = JsonHelper.SerializeObject(obj); + var result = WXHttpResponseBLL.WeiXinPostResponse(shop, url, body, referer); + return result; + } } public class AddPriceRule