聚水潭sku入库

This commit is contained in:
wule committed 2026-03-10 13:52:42 +08:00
1 parent 2d35f4b861
commit ccde645d98
17 files changed
+3090 -209

No files matched your search

+1
View File
@@ -198,6 +198,7 @@
<Compile Include="Model\Param\WXParam\WXCateAuthParam.cs" />
<Compile Include="Model\Param\WXParam\WXCoupon.cs" />
<Compile Include="Model\Result\JST\JSTOrderInfo.cs" />
<Compile Include="Model\Result\JST\JSTListProductSkuInfo.cs" />
<Compile Include="Model\Result\WXResult\WXGetEditProductInfoLite.cs" />
<Compile Include="Model\Param\WXParam\WXGetShortTitleParam.cs" />
<Compile Include="Model\Param\WXParam\WXUploadProductInitParam.cs" />
+1 -1
View File
@@ -27,7 +27,7 @@ namespace AllBase
/// <summary>
/// 版本ID
/// </summary>
public static int VersionCount = 896;
public static int VersionCount = 900;
//public static int VersionCount = 613;
/// <summary>
@@ -0,0 +1,48 @@
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AllBase.Model.Result.JST
{
public class JSTListProductSkuInfo
{
public string skuId { get; set; } // "F51114C9251A4AC1A03D91256FB48EF5",
public string itemSpuId { get; set; } // "16306F9EA78643A6B8389036BFC6131B",
public string pic { get; set; } // "https://images.sursung.com/prod/item/11625838/20260213/7D4666188669485C95B31A53CE621EAB_s392918_h800_w800.jpg",
public string itemName { get; set; } // "汉服发带唐风发饰古风国风头饰女马面裙配饰",
/// <summary>
/// spu货号
/// </summary>
public string styleCode { get; set; } // "633881130581",
/// <summary>
/// sku货号
/// </summary>
public string itemCode { get; set; } // "sp01351C",
public string color { get; set; } // "葡萄花鸟复原蓝",
public string spec { get; set; } // "无规格",
public decimal? salePrice { get; set; } // 7,
//public object weight { get; set; } // null,
//public object stockLastTime { get; set; } // null,
//public object regulatePriceMin { get; set; } // null,
//public object regulatePriceMax { get; set; } // null
public decimal? supplyPrice { get; set; }
public int? stock { get; set; }
public decimal? weight { get; set; }
public DateTime stockTime { get; set; }
public string coid { get; set; }
public string supplierId { get; set; }
public string supplierName { get; set; }
public string status { get; set; }
public int? skuPrice { get { if (supplyPrice == null) return null; return (supplyPrice * 100).ParseToInt(); } private set { supplyPrice = value * 0.01m; } }
public string Msg { get; set; }
}
}
@@ -369,6 +369,8 @@ namespace KJD_Web.BLL.BXX
var real_coid = RegexUtils.GetStringQuery(ref inputData, "real_coid")?.Replace("'", "\\'");
var has_wx_format = RegexUtils.GetStringQuery(ref inputData, "has_wx_format")?.Replace("'", "\\'");
var standby3 = RegexUtils.GetStringQuery(ref inputData, "standby3")?.Replace("'", "\\'");
var start_time = RegexUtils.GetStringQuery(ref inputData, "start_time")?.Replace("'", "\\'");
var end_time = RegexUtils.GetStringQuery(ref inputData, "end_time")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size= RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
@@ -471,9 +473,13 @@ namespace KJD_Web.BLL.BXX
if (!string.IsNullOrEmpty(standby3))
{
if (standby3.ToLower().Contains("is null"))
where += " and standby3 " + standby3;
where += " and p.standby3 " + standby3;
else
where += " and standby3='" + standby3 + "'";
where += " and p.standby3='" + standby3 + "'";
}
if (start_time != null && end_time != null)
{
where += " and p.mdy_time between '" + start_time + "' and '" + end_time + "'";
}
sql += where;
@@ -2466,6 +2472,298 @@ namespace KJD_Web.BLL.BXX
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string AddJSTSku(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
return "{\"code\":50000,\"msg\":\"用户不存在\"}";
string coid = RegexUtils.GetStringQuery(ref inputData, "coid")?.Replace("'", "\\'");
string supplierId = RegexUtils.GetStringQuery(ref inputData, "supplierId")?.Replace("'", "\\'");
string supplierName = RegexUtils.GetStringQuery(ref inputData, "supplierName");
string skuId = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "skuId"))?.Replace("'", "\\'");
string itemSpuId = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "itemSpuId"))?.Replace("'", "\\'");
string pic = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "pic"))?.Replace("'", "\\'");
string itemName = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "itemName"));
string styleCode = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "styleCode"));
string itemCode = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "itemCode"))?.Replace("'", "\\'");
string color = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "color"))?.Replace("'", "\\'");
string spec = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "spec"))?.Replace("'", "\\'");
string salePrice = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "salePrice"))?.Replace("'", "\\'");
string supplyPrice = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "supplyPrice"))?.Replace("'", "\\'");
string stock = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "stock"))?.Replace("'", "\\'");
string stockTime = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "stockTime"))?.Replace("'", "\\'");
string weight = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "weight"))?.Replace("'", "\\'");
string status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "status"))?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "insert into ";
sql += "bxx.product_sku_restore ";
sql += "(coid,supplierId,supplierName,skuId,itemSpuId,pic,itemName,styleCode,itemCode,color,spec,stockTime," +
"salePrice,supplyPrice,stock,weight) " +
"values ('" + coid + "','" + supplierId + "','" + supplierName + "','" + skuId + "','" + itemSpuId + "','" +
pic + "','" + itemName + "','" + styleCode + "','" + itemCode + "','" + color + "','" + spec + "','" + stockTime + "'," +
(salePrice.IsNullOrEmpty() ? "null" : salePrice) + "," + supplyPrice + "," + stock + "," + weight + ");";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
//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, });
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string MdyJSTSku(string inputData)
{
if (!string.IsNullOrEmpty(inputData))
{
var time = 0;
int.TryParse(RegexUtils.GetStringQuery(ref inputData, "time"), out time);
string time1 = RegexUtils.GetStringQuery(ref inputData, "code");
if (time1 != EncrypUtil.Encryption(time))
return "{\"code\":50000,\"msg\":\"校验失败\"}";
string user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
return "{\"code\":50000,\"msg\":\"用户不存在\"}";
string coid = RegexUtils.GetStringQuery(ref inputData, "coid")?.Replace("'", "\\'");
string supplierId = RegexUtils.GetStringQuery(ref inputData, "supplierId")?.Replace("'", "\\'");
string supplierName = RegexUtils.GetStringQuery(ref inputData, "supplierName");
string skuId = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "skuId"))?.Replace("'", "\\'");
string itemSpuId = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "itemSpuId"))?.Replace("'", "\\'");
string pic = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "pic"))?.Replace("'", "\\'");
string itemName = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "itemName"));
string styleCode = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "styleCode"));
string itemCode = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "itemCode"))?.Replace("'", "\\'");
string color = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "color"))?.Replace("'", "\\'");
string spec = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "spec"))?.Replace("'", "\\'");
string salePrice = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "salePrice"))?.Replace("'", "\\'");
string supplyPrice = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "supplyPrice"))?.Replace("'", "\\'");
string stock = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "stock"))?.Replace("'", "\\'");
string stockTime = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "stockTime"))?.Replace("'", "\\'");
string weight = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "weight"))?.Replace("'", "\\'");
string status = HtmlUtils.UrlDecodeUtf8(RegexUtils.GetStringQuery(ref inputData, "status"))?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
{
return "{\"code\":500,\"msg\":\"没有用户名\"}";
}
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "";
sql = "update ";
sql += "bxx.product_sku_restore p set ";
if (coid != null)
sql += " p.coid='" + coid + "',";
if (supplierId != null)
sql += " p.supplierId='" + supplierId + "',";
if (supplierName != null)
sql += " p.supplierName='" + supplierName + "',";
if (pic != null)
sql += " p.pic='" + pic + "',";
if (itemName != null)
sql += " p.itemName='" + itemName + "',";
if (styleCode != null)
sql += " p.styleCode='" + styleCode + "',";
if (itemCode != null)
sql += " p.itemCode='" + itemCode + "',";
if (color != null)
sql += " p.color='" + color + "',";
if (spec != null)
sql += " p.spec='" + spec + "',";
if (salePrice != null)
sql += " p.salePrice=" + salePrice + ",";
if (supplyPrice != null)
sql += " p.supplyPrice=" + supplyPrice + ",";
if (stock != null)
sql += " p.stock=" + stock + ",";
if (stockTime != null)
sql += " p.stockTime='" + stockTime + "',";
if (salePrice != null)
sql += " p.salePrice=" + salePrice + ",";
if (weight != null)
sql += " p.weight='" + weight + "',";
sql = sql.TrimEnd(',');
sql += " where skuId='" + skuId + "' and itemSpuId='" + itemSpuId + "';";
List<MySqlParameter> paramLst = new List<MySqlParameter>();
//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, });
var rst = mySql.ExecuteNonQuery(sql, paramLst.ToArray());
mySql.Close();
if (rst)
{
return "{\"code\":200,\"msg\":\"success\"}";
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\"}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
public string GetJSTSkuList(string inputData)
{
var timeCalc = DateTime.Now;
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 version = RegexUtils.GetStringQuery(ref inputData, "version").ParseToInt();
if (version < (System.Configuration.ConfigurationManager.ConnectionStrings["LimitVersion"]?.ConnectionString).ParseToInt())
return "{\"code\":1,\"msg\":\"当前版本过于陈旧,请立即升级新版\"}";
var user_name = RegexUtils.GetStringQuery(ref inputData, "user_name")?.Replace("'", "\\'");
if (string.IsNullOrEmpty(user_name))
return "{\"code\":50000,\"msg\":\"用户不存在\"}";
var search_coid = RegexUtils.GetStringQuery(ref inputData, "search_coid")?.Replace("'", "\\'");
var search_supplierId = RegexUtils.GetStringQuery(ref inputData, "search_supplierId")?.Replace("'", "\\'");
var search_supplierName = RegexUtils.GetStringQuery(ref inputData, "search_supplierName")?.Replace("'", "\\'");
var search_skuId = RegexUtils.GetStringQuery(ref inputData, "search_skuId")?.Replace("'", "\\'");
var search_itemSpuId = RegexUtils.GetStringQuery(ref inputData, "search_itemSpuId")?.Replace("'", "\\'");
var search_itemName = RegexUtils.GetStringQuery(ref inputData, "search_itemName")?.Replace("'", "\\'");
var search_styleCode = RegexUtils.GetStringQuery(ref inputData, "search_styleCode")?.Replace("'", "\\'");
var search_itemCode = RegexUtils.GetStringQuery(ref inputData, "search_itemCode")?.Replace("'", "\\'");
var search_color = RegexUtils.GetStringQuery(ref inputData, "search_color")?.Replace("'", "\\'");
var search_spec = RegexUtils.GetStringQuery(ref inputData, "search_spec")?.Replace("'", "\\'");
var search_status = RegexUtils.GetStringQuery(ref inputData, "search_status")?.Replace("'", "\\'");
int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt();
int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50);
string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString;
MysqlUtils mySql = new MysqlUtils(conn);
string sql = "select count(*) from bxx.product_sku_restore p where 1=1";
string where = "";
if (!string.IsNullOrEmpty(search_coid))
where += " and p.coid ='" + search_coid + "'";
if (!string.IsNullOrEmpty(search_supplierId))
where += " and p.supplierId ='" + search_supplierId + "'";
if (!string.IsNullOrEmpty(search_supplierName))
where += " and p.supplierName ='" + search_supplierName + "'";
if (!string.IsNullOrEmpty(search_skuId))
where += " and p.skuId ='" + search_skuId + "'";
if (!string.IsNullOrEmpty(search_itemSpuId))
where += " and p.itemSpuId ='" + search_itemSpuId + "'";
if (!string.IsNullOrEmpty(search_itemName))
where += " and p.itemName like '%" + search_itemName + "%'";
if (!string.IsNullOrEmpty(search_styleCode))
where += " and p.styleCode ='" + search_styleCode + "'";
if (!string.IsNullOrEmpty(search_itemCode))
where += " and p.itemCode ='" + search_itemCode + "'";
if (!string.IsNullOrEmpty(search_color))
where += " and p.color ='" + search_color + "'";
if (!string.IsNullOrEmpty(search_spec))
where += " and p.spec ='" + search_spec + "'";
if (!string.IsNullOrEmpty(search_status))
where += " and p.status ='" + search_status + "'";
sql += where;
var count = 0;
count = mySql.ExecuteRowCount(sql);
DataTable dt;
if (count == 0)
{
dt = new DataTable();
}
else
{
sql = "select p.* from bxx.product_sku_restore p" +
" where 1=1";
//where子句
sql += where;
sql += " order by p.id desc";
sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size;
dt = mySql.ExecuteDataTable(sql);
}
mySql.Close();
if (dt != null)
{
try
{
List<JSTListProductSkuInfo> productLst = new List<JSTListProductSkuInfo>();
foreach (DataRow row in dt.Rows)
{
JSTListProductSkuInfo prod = new JSTListProductSkuInfo
{
id = Convert.ToInt32(row["id"]),
coid = row["coid"].ToString(),
color = row["color"].ToString(),
itemCode = row["itemCode"].ToString(),
itemName = row["itemName"].ToString(),
itemSpuId = row["itemSpuId"].ToString(),
pic = row["pic"].ToString(),
salePrice = row["salePrice"].ParseToDecimal(),
skuId = row["skuId"].ToString(),
spec = row["spec"].ToString(),
status = row["status"].ToString(),
stock = row["stock"].ParseToInt(),
styleCode = row["styleCode"].ParseToString(),
supplierId = row["supplierId"].ToString(),
supplierName = row["supplierName"].ToString(),
supplyPrice = row["supplyPrice"].ParseToDecimal(),
add_time = Convert.ToDateTime(row["add_time"]),
mdy_time = Convert.ToDateTime(row["mdy_time"]),
stockTime = row["stockTime"].ParseToString().ParseToDateTime(),
weight = row["weight"].ParseToDecimal(),
};
productLst.Add(prod);
}
JsonSerializerSettings jsonSetting = new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore };
var data = JsonUtils.SerializerObjectToString(productLst, jsonSetting);
var seconds = (DateTime.Now - timeCalc).TotalSeconds.ToString("0.000");
return "{\"code\":200,\"msg\":\"success\",\"data\":" + data + ",\"count\":" + count + ",\"seconds\":" + seconds + "}";
}
catch (Exception ex)
{
return "{\"code\":500,\"msg\":\"" + ex.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
else
{
return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}";
}
}
return "{\"code\":19999,\"msg\":\"输入为空\"}";
}
}
}
@@ -458,5 +458,40 @@ namespace KJD_Web
Context.Response.Write(result);
Context.Response.End();
}
//AddJSTSku
[WebMethod]
public void add_jst_sku()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().AddJSTSku(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void mdy_jst_sku()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().MdyJSTSku(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
[WebMethod]
public void get_jst_sku_list()
{
string jsontext = GetRequestJsonString();
var result = jsontext;
result = new BXXProductManage().GetJSTSkuList(jsontext);
Context.Response.Write(result);
Context.Response.End();
}
}
}
@@ -116,6 +116,7 @@
<Compile Include="BLL\WXXD\WXShopManage.cs" />
<Compile Include="BLL\WXXD\WXUserManage.cs" />
<Compile Include="Model\JSTDownProdSkuInfo.cs" />
<Compile Include="Model\ShopModel\JSTListProductSkuInfo.cs" />
<Compile Include="Model\WxProdSecretSpuIdShopIdMapParam.cs" />
<Compile Include="Utils\HttpUtils.cs" />
<Compile Include="Utils\RandomUtils.cs" />
@@ -0,0 +1,47 @@
using NaiBa.Util.Extension;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace KJD_Web.Model.ShopModel
{
public class JSTListProductSkuInfo
{
public long id { get; set; }
public string skuId { get; set; } // "F51114C9251A4AC1A03D91256FB48EF5",
public string itemSpuId { get; set; } // "16306F9EA78643A6B8389036BFC6131B",
public string pic { get; set; } // "https://images.sursung.com/prod/item/11625838/20260213/7D4666188669485C95B31A53CE621EAB_s392918_h800_w800.jpg",
public string itemName { get; set; } // "汉服发带唐风发饰古风国风头饰女马面裙配饰",
/// <summary>
/// spu货号
/// </summary>
public string styleCode { get; set; } // "633881130581",
/// <summary>
/// sku货号
/// </summary>
public string itemCode { get; set; } // "sp01351C",
public string color { get; set; } // "葡萄花鸟复原蓝",
public string spec { get; set; } // "无规格",
public decimal? salePrice { get; set; } // 7,
//public object weight { get; set; } // null,
//public object stockLastTime { get; set; } // null,
//public object regulatePriceMin { get; set; } // null,
//public object regulatePriceMax { get; set; } // null
public decimal? supplyPrice { get; set; }
public int? stock { get; set; }
public decimal? weight { get; set; }
public DateTime stockTime { get; set; }
public string coid { get; set; }
public string supplierId { get; set; }
public string supplierName { get; set; }
public string status { get; set; }
public DateTime add_time { get; set; }
public DateTime mdy_time { get; set; }
}
}
+4 -1
View File
@@ -668,13 +668,16 @@ namespace TemuKJD.BLL
});
}
var itemNo = jSku["itemNo"].ParseToString();
var baseSkuId = jSku["baseSkuId"].ParseToString();
var skuId = jstSecretCodeLst["skus"].FirstOrDefault(s => s["skuCode"].ParseToString() == itemNo)?["skuId"].ParseToString();
skuInfo.out_sku_sn = skuId;
// skuCode可能不唯一
skuId = jstSecretCodeLst["skus"].FirstOrDefault(s => s["warehouseSkuId"].ParseToString() == baseSkuId)?["skuId"].ParseToString();
if (skuId.IsNullOrEmpty())
{
convertRst = "SKU货号不存在";
return null;
}
skuInfo.out_sku_sn = skuId;
prodInfo.detail.sku.Add(skuInfo);
}
prodInfo.detail.sku_type = null;
+9
View File
@@ -149,6 +149,12 @@
<Compile Include="ToolForms\GetJuShuitanAuthForm.Designer.cs">
<DependentUpon>GetJuShuitanAuthForm.cs</DependentUpon>
</Compile>
<Compile Include="ToolForms\GetJuShuitanProductSKUListForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ToolForms\GetJuShuitanProductSKUListForm.Designer.cs">
<DependentUpon>GetJuShuitanProductSKUListForm.cs</DependentUpon>
</Compile>
<Compile Include="ToolForms\GetJuShuitanProdForm.cs">
<SubType>Form</SubType>
</Compile>
@@ -1096,6 +1102,9 @@
<EmbeddedResource Include="ToolForms\GetJuShuitanAuthForm.resx">
<DependentUpon>GetJuShuitanAuthForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ToolForms\GetJuShuitanProductSKUListForm.resx">
<DependentUpon>GetJuShuitanProductSKUListForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ToolForms\GetJuShuitanProdForm.resx">
<DependentUpon>GetJuShuitanProdForm.cs</DependentUpon>
</EmbeddedResource>
@@ -49,6 +49,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PDDDBProdListForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.dtpEnd = new System.Windows.Forms.DateTimePicker();
this.dtpStart = new System.Windows.Forms.DateTimePicker();
this.ucCheckBox1 = new TemuKJD.UserComponent.UcCheckBox(this.components);
this.btnUpdateReturnServerData = new DevComponents.DotNetBar.PanelEx();
this.btnReturnSecretData = new DevComponents.DotNetBar.PanelEx();
this.btnStopStop = new DevComponents.DotNetBar.PanelEx();
@@ -184,6 +187,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.dtpEnd);
this.splitContainer1.Panel1.Controls.Add(this.dtpStart);
this.splitContainer1.Panel1.Controls.Add(this.ucCheckBox1);
this.splitContainer1.Panel1.Controls.Add(this.btnUpdateReturnServerData);
this.splitContainer1.Panel1.Controls.Add(this.btnReturnSecretData);
this.splitContainer1.Panel1.Controls.Add(this.btnStopStop);
@@ -214,6 +220,36 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.splitContainer1.SplitterDistance = 110;
this.splitContainer1.TabIndex = 1;
//
// dtpEnd
//
this.dtpEnd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.dtpEnd.Location = new System.Drawing.Point(1042, 80);
this.dtpEnd.Name = "dtpEnd";
this.dtpEnd.Size = new System.Drawing.Size(110, 23);
this.dtpEnd.TabIndex = 979;
this.dtpEnd.Visible = false;
//
// dtpStart
//
this.dtpStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.dtpStart.Location = new System.Drawing.Point(926, 80);
this.dtpStart.Name = "dtpStart";
this.dtpStart.Size = new System.Drawing.Size(110, 23);
this.dtpStart.TabIndex = 978;
this.dtpStart.Visible = false;
//
// ucCheckBox1
//
this.ucCheckBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ucCheckBox1.AutoSize = true;
this.ucCheckBox1.Location = new System.Drawing.Point(856, 82);
this.ucCheckBox1.Name = "ucCheckBox1";
this.ucCheckBox1.Size = new System.Drawing.Size(75, 21);
this.ucCheckBox1.TabIndex = 977;
this.ucCheckBox1.Text = "时间范围";
this.ucCheckBox1.UseVisualStyleBackColor = true;
this.ucCheckBox1.Visible = false;
//
// btnUpdateReturnServerData
//
this.btnUpdateReturnServerData.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -237,6 +273,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnUpdateReturnServerData.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnUpdateReturnServerData.TabIndex = 943;
this.btnUpdateReturnServerData.Text = "数据拉回";
this.btnUpdateReturnServerData.Visible = false;
this.btnUpdateReturnServerData.Click += new System.EventHandler(this.updateReturnServerData_Click);
//
// btnReturnSecretData
@@ -262,6 +299,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnReturnSecretData.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnReturnSecretData.TabIndex = 909;
this.btnReturnSecretData.Text = "加密数据回传";
this.btnReturnSecretData.Visible = false;
this.btnReturnSecretData.Click += new System.EventHandler(this.btnReturnSecretData_Click);
//
// btnStopStop
@@ -373,7 +411,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
"安全商品",
"违规商品",
"未校验"});
this.cmbSetWxSafe.Location = new System.Drawing.Point(865, 57);
this.cmbSetWxSafe.Location = new System.Drawing.Point(865, 41);
this.cmbSetWxSafe.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.cmbSetWxSafe.Name = "cmbSetWxSafe";
this.cmbSetWxSafe.Size = new System.Drawing.Size(85, 25);
@@ -386,7 +424,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnSetWxSafe.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSetWxSafe.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSetWxSafe.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSetWxSafe.Location = new System.Drawing.Point(952, 57);
this.btnSetWxSafe.Location = new System.Drawing.Point(952, 41);
this.btnSetWxSafe.Name = "btnSetWxSafe";
this.btnSetWxSafe.Size = new System.Drawing.Size(84, 25);
this.btnSetWxSafe.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -411,7 +449,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnImport.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnImport.DisabledBackColor = System.Drawing.Color.Empty;
this.btnImport.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnImport.Location = new System.Drawing.Point(1058, 57);
this.btnImport.Location = new System.Drawing.Point(1058, 41);
this.btnImport.Name = "btnImport";
this.btnImport.Size = new System.Drawing.Size(84, 25);
this.btnImport.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -1042,7 +1080,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnDelSelect.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnDelSelect.DisabledBackColor = System.Drawing.Color.Empty;
this.btnDelSelect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDelSelect.Location = new System.Drawing.Point(1058, 23);
this.btnDelSelect.Location = new System.Drawing.Point(1058, 7);
this.btnDelSelect.Name = "btnDelSelect";
this.btnDelSelect.Size = new System.Drawing.Size(84, 25);
this.btnDelSelect.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -1064,7 +1102,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//
this.cmbGroup.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.cmbGroup.FormattingEnabled = true;
this.cmbGroup.Location = new System.Drawing.Point(865, 23);
this.cmbGroup.Location = new System.Drawing.Point(865, 7);
this.cmbGroup.Name = "cmbGroup";
this.cmbGroup.Size = new System.Drawing.Size(85, 25);
this.cmbGroup.TabIndex = 640;
@@ -1076,7 +1114,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.btnSetGroup.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnSetGroup.DisabledBackColor = System.Drawing.Color.Empty;
this.btnSetGroup.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSetGroup.Location = new System.Drawing.Point(952, 23);
this.btnSetGroup.Location = new System.Drawing.Point(952, 7);
this.btnSetGroup.Name = "btnSetGroup";
this.btnSetGroup.Size = new System.Drawing.Size(84, 25);
this.btnSetGroup.Style.Alignment = System.Drawing.StringAlignment.Center;
@@ -1851,5 +1889,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
private System.Windows.Forms.ComboBox cmbHasReturn;
private System.Windows.Forms.Label label18;
private DevComponents.DotNetBar.PanelEx btnUpdateReturnServerData;
private UserComponent.UcCheckBox ucCheckBox1;
private System.Windows.Forms.DateTimePicker dtpEnd;
private System.Windows.Forms.DateTimePicker dtpStart;
}
}
@@ -1,5 +1,6 @@
using AllBase;
using AllBase.Helper;
using AllBase.Model.Param;
using AllBase.Model.Result;
using AllBase.Model.Result.PDDResult;
using AllBase.Model.Result.WXResult;
@@ -96,6 +97,8 @@ namespace TemuKJD.PDDForms.ProductSelectForms
if (BaseClass.MainPath != "binxixi")
{
//this.dgvDbProduct.Columns["col_edit"].Visible = false;
this.dgvDbProduct.Columns["colExtCodePrice"].Visible = false;
this.dgvDbProduct.Columns["colEdit"].Visible = false;
}
btnSelect.Visible = false;
@@ -116,6 +119,9 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.dgvDbProduct.AddMergeColumnHeader(new List<string>() { "colExtCodePrice", "colEdit" }, "货号价格");
this.dgvDbProduct.AddMergeColumn(new List<string>() { "colExtCodePrice", "colEdit" });
this.dtpStart.Value = new DateTime(2026, 3, 6, 16, 0, 0);
this.dtpEnd.Value = new DateTime(2026, 3, 7, 18, 0, 0);
}
private void btnSearch_Click(object sender, EventArgs e)
@@ -323,6 +329,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms
"&wx_safe_status=" + cmbWxSafe.Text.Trim().Replace("安全+未校验", "安全商品,未校验") +
"&special_prod_type=" + cmbSpProdType.Text.Trim();
if (ucCheckBox1.Checked)
{
data += "&start_time=" + dtpStart.Value.ToString("yyyy-MM-dd HH:mm:ss");
data += "&end_time=" + dtpEnd.Value.ToString("yyyy-MM-dd HH:mm:ss");
}
if (cmbSourceType.Text != "厂商直采")
{
data += "&search_cat1=" + cmbCat1.Text.Trim();
@@ -1558,11 +1570,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
{
}
//Thread.Sleep(500);
// 查询微信接口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, "");
}
}
@@ -1607,26 +1614,37 @@ namespace TemuKJD.PDDForms.ProductSelectForms
dbProdTmpLst.AddRange(dbProdLst);
while (dbProdTmpLst.Count > 0)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
var takeCount = 20;
List<KJDDBProduct> 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));
var spu_id = string.Join("\",\"", dbProdTmp20Lst.Select(p => p.spu_id));
// 原批量拉取,已废弃 "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?" + Randomx.GetId(100, 999);
string body = "{\"spuCodes\":[\"" + spuCodes + "\"]}";
//string body = "{\"warehouseGoodsIds\":[\"" + spu_id + "\"]}";
// 使用新的批量拉取
body = "{\"goodsApiNewItems\":[";
url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/getNew";
foreach (var dbProd in dbProdTmp20Lst)
{
body += "{\"warehouseGoodsId\":\"" + dbProd.spu_id + "\",\"spuCode\":\"" + dbProd.ext_code + "\"},";
}
body = body.TrimEnd(',');
body += "]}";
var getRst = WXHttpResponseBLL.e57PostResponse(url, body, "");
Thread.Sleep(500);
if (getRst.Contains("\"code\":0"))
@@ -1676,71 +1694,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
}
}
//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=阿杰账户";
@@ -1751,6 +1704,7 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//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, "");
@@ -1967,60 +1921,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
}
}
Thread.Sleep(100);
//// 导出成功,回写数据
//if (exportRst.Contains("\"code\":200"))
//{
// if (chkPullAfterPush.Checked)
// {
// url = "https://po.e57.cn/prod-api/api/oms-api/updateGoodsId";
// string body = dbProd.sku_secret_json.TrimStart('[').TrimEnd(']');
// var getRst = WXHttpResponseBLL.e57PostResponse(url, body, "");
// if (getRst.Contains("\"code\":0") || getRst.Contains("<code>200</code>"))
// {
// try
// {
// {
// //url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get";
// //string bodyx = "{\"spuCodes\":[\"" + dbProd.ext_code + "\"]}";
// //string bodyx = "{\"warehouseGoodsIds\":[\"" + dbProd.spu_id + "\"]}";
// //var getRstx = WXHttpResponseBLL.e57PostResponse(url, bodyx, "");
// }
// var url3 = BaseClass.BuildPDDObjString("product/mdy_product");
// var data3 = Work.UserLogin.GetSignaturex() +
// "&spu_id=" + dbProd.spu_id +
// "&standby3=" + 1;
// 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.standby3 = "1";
// dbProd.standby3 = "1";
// }
// }
// catch
// {
// }
// }
// else
// {
// }
// }
//}
//else
//{
//}
Thread.Sleep(100);
// 查询微信接口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, "");
}
}
@@ -2072,6 +1972,11 @@ namespace TemuKJD.PDDForms.ProductSelectForms
this.statusBar.lblTaskStatus.Text = "正在拉回回传 " + this.statusBar.pgbTaskProgress.Value + "/" + dbProdLst.Count + " 成功:" + dbProdLst.Where(p => p.standby3 == "1").Count();
}));
var dbProd = PDDDBProdEditForm.GetPddProductDetail(prod.id.ParseToString());
var rst = new WxProdFormConverter().JstPddConvertToWxOutServer(dbProd);
if (!rst.Contains("\"success\":true"))
{
continue;
}
// 如果加密数据为空数据就跳过
if (string.IsNullOrEmpty(dbProd?.sku_secret_json) && dbProd.sku_secret_json.Length > 10)
@@ -2084,7 +1989,16 @@ namespace TemuKJD.PDDForms.ProductSelectForms
//continue;
}
var rst = new WxProdFormConverter().JstPddConvertToWxOutServer(dbProd);
var outServerGoodsParamStr = new WxProdFormConverter().JstPddConvertToWxOutServer(dbProd);
OutServerGoodsParam outServerGoodsParam = null;
try
{
outServerGoodsParam = JsonHelper.DeserializeJsonToObject<OutServerGoodsParam>(JsonHelper.JObjectParse(outServerGoodsParamStr)["data"].ParseToString());
}
catch
{
continue;
}
if (!rst.Contains("\"success\":true"))
{
continue;
@@ -2118,10 +2032,13 @@ namespace TemuKJD.PDDForms.ProductSelectForms
try
{
{
url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get";
string bodyx = "{\"spuCodes\":[\"" + dbProd.ext_code + "\"]}";
//string bodyx = "{\"warehouseGoodsIds\":[\"" + dbProd.spu_id + "\"]}";
var getRstx = WXHttpResponseBLL.e57PostResponse(url, bodyx, "");
//url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/get";
//string dataX = "{\"spuCodes\":[\"" + dbProd.ext_code + "\"]}";
//string dataX = "{\"warehouseGoodsIds\":[\"" + dbProd.spu_id + "\"]}";
url = "https://po.e57.cn/prod-api/api/sys-api/system/open/api/goods/list/getNew";
string dataX = "{\"goodsApiNewItems\":[{\"warehouseGoodsId\":\"" + dbProd.spu_id + "\",\"spuCode\":\"" + dbProd.ext_code + "\"}]}";
var getRstx = WXHttpResponseBLL.e57PostResponse(url, dataX, "");
if (!getRstx.Contains("\"code\":0"))
continue;
@@ -2142,16 +2059,48 @@ namespace TemuKJD.PDDForms.ProductSelectForms
if (bodyObj["warehouseGoodsId"].ParseToString() != bodyRstObj["warehouseGoodsId"].ParseToString() &&
bodyObj["spuCode"].ParseToString() != bodyRstObj["spuCode"].ParseToString())
success = false;
if (bodyObj["skus"].Any(b => !bodyRstObj["skus"].Any(br => br.ParseToString() == b.ParseToString())))
// 从商品采集数据里获取warehouseSkuId不为空的商品,作为比对数据
//var warehouseSkuIdTmpList = outServerGoodsParam.skus.Select(s => s.warehouseSkuId).ToList();
var warehouseSkuIdList = outServerGoodsParam.skus.Select(s => s.warehouseSkuId).Where(s => !s.IsNullOrEmpty()).Distinct().ToList();
var realSkus = bodyObj["skus"].Where(b => outServerGoodsParam.skus.Any(s => s.warehouseSkuId == b["warehouseSkuId"].ParseToString()));
var realSkuLst = realSkus.ToList();
if (realSkuLst.Any(rs => !warehouseSkuIdList.Any(s => s == rs["warehouseSkuId"].ParseToString()))) // 如果sku有对应不上的也要跳过
success = false;
var bodyRstLst = bodyRstObj["skus"].ToList();
var missCount = realSkuLst.Where(b => !bodyRstLst.Any(br => br.ParseToString() == b.ParseToString())).Count();
if (missCount > 0)
success = false;
//var missCount = bodyObj["skus"].Where(b => !bodyRstObj["skus"].Any(br => br.ParseToString() == b.ParseToString())).Count();
//var skuCount = bodyObj["skus"].Count();
//if (missCount > 0)
//{
// success = false;
// if ((missCount == 1 || missCount == 2) && skuCount - missCount > 3 && !bodyRstObj["skus"].Any(br => br["skuId"].ParseToString().StartsWith("2030")))
// {
// var urlFail = BaseClass.BuildPDDObjString("product/mdy_product");
// var dataFail = Work.UserLogin.GetSignaturex() +
// "&spu_id=" + dbProd.spu_id +
// "&standby3=" + 3;
// var htmlFail = GetHtml.PostUtf8(urlFail, dataFail);
// prod.standby3 = "1";
// dbProd.standby3 = "1";
// continue;
// }
//}
if (!success)
{
continue;
//continue;
var urlFail = BaseClass.BuildPDDObjString("product/mdy_product");
var dataFail = Work.UserLogin.GetSignaturex() +
"&spu_id=" + dbProd.spu_id +
"&standby3=" + 3;
"&standby3=" + 5;
var htmlFail = GetHtml.PostUtf8(urlFail, dataFail);
continue;
}
@@ -2160,8 +2109,12 @@ namespace TemuKJD.PDDForms.ProductSelectForms
var url3 = BaseClass.BuildPDDObjString("product/mdy_product");
var data3 = Work.UserLogin.GetSignaturex() +
"&spu_id=" + dbProd.spu_id +
"&standby3=" + 1;
"&spu_id=" + dbProd.spu_id;
//if (dbProd.standby3 == "5" || dbProd.standby3 == "6")
// data3 += "&standby3=" + 6;
//else
// data3 += "&standby3=" + 1;
data3 += "&standby3=" + 6;
var html = GetHtml.PostUtf8(url3, data3);
if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200"))
html = GetHtml.PostUtf8(url3, data3);
@@ -2186,11 +2139,6 @@ namespace TemuKJD.PDDForms.ProductSelectForms
{
}
Thread.Sleep(100);
// 查询微信接口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, "");
}
}
}
+47 -47
View File
@@ -98,6 +98,7 @@ namespace TemuKJD.ToolForms
this.cmbMultiCookieName = new DevComponents.DotNetBar.Controls.ComboBoxEx();
this.btnMultiLogin = new DevComponents.DotNetBar.PanelEx();
this.btnDel = new DevComponents.DotNetBar.PanelEx();
this.btnExportCookie = new DevComponents.DotNetBar.PanelEx();
this.label7 = new System.Windows.Forms.Label();
this.txtWaitSeconds = new System.Windows.Forms.TextBox();
this.label8 = new System.Windows.Forms.Label();
@@ -119,7 +120,6 @@ namespace TemuKJD.ToolForms
this.txtPageStart = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.btnCollectSupplier = new DevComponents.DotNetBar.PanelEx();
this.line1 = new DevComponents.DotNetBar.Controls.Line();
this.txtSupplierName = new System.Windows.Forms.TextBox();
this.txtFilterSaleCount = new System.Windows.Forms.TextBox();
this.btnRefreshCookie = new DevComponents.DotNetBar.PanelEx();
@@ -127,7 +127,7 @@ namespace TemuKJD.ToolForms
this.btnSaveCookie = new DevComponents.DotNetBar.PanelEx();
this.btnImportCookie = new DevComponents.DotNetBar.PanelEx();
this.label2 = new System.Windows.Forms.Label();
this.btnExportCookie = new DevComponents.DotNetBar.PanelEx();
this.line1 = new DevComponents.DotNetBar.Controls.Line();
((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).BeginInit();
this.splitContainer2.Panel1.SuspendLayout();
this.splitContainer2.SuspendLayout();
@@ -164,7 +164,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(1390, 435);
this.splitContainer2.Size = new System.Drawing.Size(1390, 437);
this.splitContainer2.SplitterDistance = 26;
this.splitContainer2.TabIndex = 6;
//
@@ -203,7 +203,7 @@ namespace TemuKJD.ToolForms
//
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, 194);
this.pbLoading.Location = new System.Drawing.Point(673, 195);
this.pbLoading.Name = "pbLoading";
this.pbLoading.Size = new System.Drawing.Size(50, 50);
this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -249,7 +249,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, 434);
this.dgvProduct.Size = new System.Drawing.Size(1390, 436);
this.dgvProduct.TabIndex = 7;
this.dgvProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvProduct_CellContentClick);
//
@@ -406,7 +406,7 @@ namespace TemuKJD.ToolForms
this.splitContainer1.Panel2.Controls.Add(this.label2);
this.splitContainer1.Panel2.Controls.Add(this.line1);
this.splitContainer1.Size = new System.Drawing.Size(1404, 561);
this.splitContainer1.SplitterDistance = 471;
this.splitContainer1.SplitterDistance = 473;
this.splitContainer1.SplitterWidth = 3;
this.splitContainer1.TabIndex = 4;
//
@@ -422,7 +422,7 @@ namespace TemuKJD.ToolForms
this.ucTabControlMetro1.Name = "ucTabControlMetro1";
this.ucTabControlMetro1.SelectedIndex = 0;
this.ucTabControlMetro1.ShowCloseButton = false;
this.ucTabControlMetro1.Size = new System.Drawing.Size(1404, 471);
this.ucTabControlMetro1.Size = new System.Drawing.Size(1404, 473);
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;
@@ -434,7 +434,7 @@ namespace TemuKJD.ToolForms
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, 441);
this.tabPage1.Size = new System.Drawing.Size(1396, 443);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "商品页面";
this.tabPage1.UseVisualStyleBackColor = true;
@@ -446,7 +446,7 @@ namespace TemuKJD.ToolForms
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, 440);
this.tabPage2.Size = new System.Drawing.Size(1396, 442);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "采集列表";
this.tabPage2.UseVisualStyleBackColor = true;
@@ -456,7 +456,7 @@ namespace TemuKJD.ToolForms
this.tabPage3.Controls.Add(this.splitContainer3);
this.tabPage3.Location = new System.Drawing.Point(4, 26);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Size = new System.Drawing.Size(1396, 440);
this.tabPage3.Size = new System.Drawing.Size(1396, 443);
this.tabPage3.TabIndex = 2;
this.tabPage3.Text = "下架SKU查询";
this.tabPage3.UseVisualStyleBackColor = true;
@@ -488,7 +488,7 @@ namespace TemuKJD.ToolForms
//
this.splitContainer3.Panel2.Controls.Add(this.pictureBox1);
this.splitContainer3.Panel2.Controls.Add(this.dgvDownSku);
this.splitContainer3.Size = new System.Drawing.Size(1396, 440);
this.splitContainer3.Size = new System.Drawing.Size(1396, 443);
this.splitContainer3.SplitterDistance = 82;
this.splitContainer3.TabIndex = 0;
//
@@ -646,7 +646,7 @@ namespace TemuKJD.ToolForms
//
this.pictureBox1.Anchor = System.Windows.Forms.AnchorStyles.None;
this.pictureBox1.Image = global::TemuKJD.Properties.Resources.loading_blue;
this.pictureBox1.Location = new System.Drawing.Point(673, 152);
this.pictureBox1.Location = new System.Drawing.Point(673, 153);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(50, 50);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
@@ -694,7 +694,7 @@ namespace TemuKJD.ToolForms
this.dgvDownSku.Name = "dgvDownSku";
this.dgvDownSku.ReadOnly = true;
this.dgvDownSku.RowTemplate.Height = 23;
this.dgvDownSku.Size = new System.Drawing.Size(1396, 354);
this.dgvDownSku.Size = new System.Drawing.Size(1396, 357);
this.dgvDownSku.TabIndex = 8;
//
// colDownSelect
@@ -885,6 +885,31 @@ namespace TemuKJD.ToolForms
this.btnDel.TabIndex = 409;
this.btnDel.Text = "删";
//
// btnExportCookie
//
this.btnExportCookie.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnExportCookie.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnExportCookie.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExportCookie.DisabledBackColor = System.Drawing.Color.Empty;
this.btnExportCookie.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExportCookie.Location = new System.Drawing.Point(227, 57);
this.btnExportCookie.Name = "btnExportCookie";
this.btnExportCookie.Size = new System.Drawing.Size(72, 25);
this.btnExportCookie.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnExportCookie.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnExportCookie.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnExportCookie.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnExportCookie.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnExportCookie.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnExportCookie.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnExportCookie.Style.GradientAngle = 90;
this.btnExportCookie.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnExportCookie.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnExportCookie.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnExportCookie.TabIndex = 1063;
this.btnExportCookie.Text = "导出cookie";
this.btnExportCookie.Click += new System.EventHandler(this.btnExportCookie_Click);
//
// label7
//
this.label7.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -1219,17 +1244,6 @@ namespace TemuKJD.ToolForms
this.btnCollectSupplier.Text = "采集供应商";
this.btnCollectSupplier.Click += new System.EventHandler(this.btnCollectSupplier_Click);
//
// line1
//
this.line1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.line1.ForeColor = System.Drawing.SystemColors.AppWorkspace;
this.line1.Location = new System.Drawing.Point(298, 7);
this.line1.Name = "line1";
this.line1.Size = new System.Drawing.Size(20, 74);
this.line1.TabIndex = 790;
this.line1.Text = "line1";
this.line1.VerticalLine = true;
//
// txtSupplierName
//
this.txtSupplierName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -1346,30 +1360,16 @@ namespace TemuKJD.ToolForms
this.label2.TabIndex = 789;
this.label2.Text = "供应商";
//
// btnExportCookie
// line1
//
this.btnExportCookie.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnExportCookie.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
this.btnExportCookie.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnExportCookie.DisabledBackColor = System.Drawing.Color.Empty;
this.btnExportCookie.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnExportCookie.Location = new System.Drawing.Point(227, 57);
this.btnExportCookie.Name = "btnExportCookie";
this.btnExportCookie.Size = new System.Drawing.Size(72, 25);
this.btnExportCookie.Style.Alignment = System.Drawing.StringAlignment.Center;
this.btnExportCookie.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnExportCookie.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnExportCookie.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder;
this.btnExportCookie.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash;
this.btnExportCookie.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None;
this.btnExportCookie.Style.ForeColor.Color = System.Drawing.Color.White;
this.btnExportCookie.Style.GradientAngle = 90;
this.btnExportCookie.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center;
this.btnExportCookie.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnExportCookie.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255)))));
this.btnExportCookie.TabIndex = 1063;
this.btnExportCookie.Text = "导出cookie";
this.btnExportCookie.Click += new System.EventHandler(this.btnExportCookie_Click);
this.line1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.line1.ForeColor = System.Drawing.SystemColors.AppWorkspace;
this.line1.Location = new System.Drawing.Point(298, 7);
this.line1.Name = "line1";
this.line1.Size = new System.Drawing.Size(20, 74);
this.line1.TabIndex = 790;
this.line1.Text = "line1";
this.line1.VerticalLine = true;
//
// GetJuShuitanProdForm
//
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,892 @@
using AllBase;
using AllBase.Model.Result;
using AllBase.Model.Result.JST;
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;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.BaseForms;
using TemuKJD.BLL;
using TemuKJD.Extension;
using TemuKJD.Helper;
using TemuKJD.PDDForms.ProductSelectForms;
using TemuKJD.WXForms.ProductForms;
using Work;
namespace TemuKJD.ToolForms
{
public partial class GetJuShuitanProductSKUListForm : BaseForms.BaseForm
{
Dictionary<string, string> dicAfterSale = new Dictionary<string, string>();
public CancellationTokenSource cancellationTokenSource { get; set; } = null;
public CancellationTokenSource CancelReturn { get; set; } = null;
string InitUrl = "https://sc.scm121.com/suppliersManage/suppliersList/onlineSuppliers";
public ChromiumWebBrowser cefWebBrowser = null;
private string currentUrl = "";
private string currentGetSupplierListParamData = "";
private string currentSupplierName = "";
private string appVersion = "";
private string currentSupplierId = "";
int getDetailWait = 1;
int pageStart = 1;
int pageEnd = 9999;
int filterSaleCountDays = 7;
int filterSaleCount = 100;
string platformType = "Pinduoduo";
string jstPddShopId = "";
ConcurrentList<JSTListProductSkuInfo> lstJSTListProductSkuInfo = new ConcurrentList<JSTListProductSkuInfo>();
public GetJuShuitanProductSKUListForm()
{
InitializeComponent();
}
private void GetJuShuitanProdForm_Load(object sender, EventArgs e)
{
//this.ucTabControlMetro1.TabPages.Remove(tabPage3);
this.splitContainer1.SplitterDistance = 472;
this.dgvProduct.AddSelectorColumn("colCheck");
this.dgvProduct.AddImgColumn("colImg", "colImgUrl");
lstJSTListProductSkuInfo = NaiBa.Util.Helper.ConfigHelper.LoadConfig<ConcurrentList<JSTListProductSkuInfo>>("supplier_product_sku_list_" + MainForm.ProcessCount);
if (lstJSTListProductSkuInfo == null)
lstJSTListProductSkuInfo = new ConcurrentList<JSTListProductSkuInfo>();
pbLoading.Visible = true;
Task.Run(() =>
{
int id = 0;
foreach (var prod in lstJSTListProductSkuInfo)
{
id++;
if (id % 50 == 0)
Thread.Sleep(1);
Invoke(new Action(() =>
{
var rowId = this.dgvProduct.Rows.Add(
true,
prod.coid,
prod.supplierName,
prod.itemSpuId,
prod.itemName,
prod.pic.ParseToString().Replace("https://", "http://"),
DataGridViewExtension.defaultBitmap,
prod.skuId,
prod.color + ";" + prod.spec,
prod.supplyPrice,
prod.stock,
"删除",
prod.Msg
);
dgvProduct.Rows[rowId].Height = 60;
//if (chanceProductResult.dbProduct != null)
//{
// var dbProd = chanceProductResult.dbProduct;
// var row = dgvChanceProduct.Rows[rowId];
// row.Cells["colGoodsName"].Value = dbProd.product_name;
// row.Cells["colCate"].Value = dbProd.cat_name;
// row.Cells["colPrice"].Value = dbProd.price_text;
//}
}));
}
Invoke(new Action(() =>
{
pbLoading.Visible = false;
}));
});
InitCef();
}
void InitCef()
{
if (cefWebBrowser == null)
{
cefWebBrowser = CEFBrowser.CreateChromiumWebBrowser(InitUrl, false);
CustomResourceRequestHandlerLocal resourceRequestHandler = new CustomResourceRequestHandlerLocal();
resourceRequestHandler.ResourceLoadCompleteEvent += RequestHandler_ResourceLoadComplete;
resourceRequestHandler.BeforeResourceLoadEvent += RequestHandler_BeforeResourceLoad;
cefWebBrowser.RequestHandler = new CustomRequestHandler(resourceRequestHandler);
var lifeSapnHandler = new LifeSpanHandlerLocal(PopWindowType.SelfWindow);
cefWebBrowser.LifeSpanHandler = lifeSapnHandler;
cefWebBrowser.KeyboardHandler = new KeyboardHandler();
cefWebBrowser.FrameLoadEnd += CefWebBrowser_FrameLoadEnd;
cefWebBrowser.AddressChanged += CefWebBrowser_AddressChanged;
cefWebBrowser.LoadError += CefWebBrowser_LoadError;
cefWebBrowser.Dock = DockStyle.Fill;
Invoke(new Action(() =>
{
splitContainer2.Panel2.Controls.Add(cefWebBrowser);
//cefWebBrowser.Load(shopMainUrl);
}));
}
Task.Run(() =>
{
string serverCookie = "";
var url = BaseClass.BuildPDDObjString("user/get_scm121_cookie");
var data = UserLogin.GetSignaturex();
var result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(url, data);
List<Cookie> cookieLst = new List<Cookie>();
try
{
serverCookie = JsonHelper.SerializeObject(JsonHelper.JObjectParse(result)["cookie"]);
cookieLst = JsonHelper.DeserializeJsonToList<CefSharp.Cookie>(serverCookie);
if (cookieLst == null)
cookieLst = new List<Cookie>();
}
catch
{
}
// cef138必须init后方可设置或删除cookie
while (!cefWebBrowser.IsBrowserInitialized || !cefWebBrowser.GetBrowser().MainFrame.IsValid)
Thread.Sleep(20);
CEFBrowser.DeleteCookie(cefWebBrowser.GetCookieManager(null));
//cef 138 如果没有设置RequestContext 可能为空,直接getCookieManager
//if (this.openType != EnumOpenType.login)
{
//var t = CEFBrowser.SetCookieAsync(JsonHelper.SerializeObject(cookieLst), cefWebBrowser.GetCookieManager(null));
foreach (var cook in cookieLst)
{
var t = CEFBrowser.SetCookieAsync(cook.Domain.Trim('.'), cook.Name + "=" + cook.Value + ";", cefWebBrowser.GetCookieManager(null));
t.Wait(5000);
}
}
cefWebBrowser.Load(InitUrl);
});
}
private void CefWebBrowser_FrameLoadEnd(object sender, CefSharp.FrameLoadEndEventArgs e)
{
}
private void RequestHandler_ResourceLoadComplete(object sender, string url, string postData, string responseData, IRequest request)
{
if (url.Contains("api/goods/buyer/supplier/goods/list"))
{
if (request.Headers.AllKeys.Contains("App-Version"))
appVersion = request.Headers["App-Version"];
Task.Run(() => { GetCurrentSupplierSearchData(postData, responseData, request); });
}
if (url.Contains("https://sc.scm121.com/api/goods/buyer/supplier/goods/skuList"))
{
if (request.Headers.AllKeys.Contains("App-Version"))
appVersion = request.Headers["App-Version"];
Task.Run(() => { GetCurrentSupplierSearchSkuData(postData, responseData, request); });
}
}
void GetCurrentSupplierSearchData(string postData, string responseData, IRequest request)
{
currentSupplierId = BaseRegex.GetStringJson(ref postData, "supplierId");
currentSupplierName = BaseRegex.GetStringJson(ref responseData, "supplierName");
Invoke(new Action(() =>
{
txtSupplierName.Text = currentSupplierName;
}));
}
void GetCurrentSupplierSearchSkuData(string postData, string responseData, IRequest request)
{
currentGetSupplierListParamData = postData;
//currentSupplierId = BaseRegex.GetStringJson(ref postData, "supplierId");
//currentSupplierName = BaseRegex.GetStringJson(ref responseData, "supplierName");
Invoke(new Action(() =>
{
//txtSupplierName.Text = currentSupplierName;
}));
}
private bool RequestHandler_BeforeResourceLoad(object sender, string url, string postData, IRequest request)
{
return false;
}
private void CefWebBrowser_AddressChanged(object sender, CefSharp.AddressChangedEventArgs e)
{
if (this.Created && !this.Disposing && !this.IsDisposed)
{
Task.Run(() =>
{
Invoke(new Action(() =>
{
currentUrl = e.Address;
txtAddress.Text = e.Address;
}));
});
}
}
private void CefWebBrowser_LoadError(object sender, CefSharp.LoadErrorEventArgs e)
{
}
private void btnImportCookie_Click(object sender, EventArgs e)
{
if (!txtCookie.Text.Contains("DISTRYBUTION_TOKEN"))
{
BaseMsgForm.ShowError("导入的cookie无效,请重新输入");
return;
}
Task.Run(() =>
{
var t = CEFBrowser.SetCookieAsync("scm121.com", txtCookie.Text, cefWebBrowser.GetCookieManager(null));
t.Wait(5000);
cefWebBrowser.Load(InitUrl);
});
}
private void btnSaveCookie_Click(object sender, EventArgs e)
{
List<Cookie> cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null));
var url = BaseClass.BuildPDDObjString("user/update_scm121_cookie");
var data = UserLogin.GetSignaturex();
data += "&cookie=" + GetHtml.UrlEncodeUtf8(JsonHelper.SerializeObject(cookieList));
var result = GetHtml.PostUtf8(url, data);
if (!result.Contains("\"code\":200"))
result = GetHtml.PostUtf8(url, data);
if (result.Contains("\"code\":200"))
BaseMsgForm.ShowInfo("保存成功");
else
BaseMsgForm.ShowInfo("保存失败,请重试");
}
private void btnRefreshCookie_Click(object sender, EventArgs e)
{
//var result = GetHtml.PostUtf8("https://api.weixin.qq.com/shop/ec/basics/img/upload?access_token=100_Kn3u6mev0uip-WUPSgxXWHrHldjOP0Ewjw8n18LmGcq2pWbjn4BJukPkGZt0gzgJ1Hd6bRM2TXUDTEhwM7VULSl_P-pVHSVPHlE6ZvdXfD6djB1f2WEibY7jWaZLaD24cBUxLM-mSGxjR7i7IBBeAHDOHH&upload_type=http://img.alicdn.com/imgextra/i2/2215107627344/O1CN01eM6hZu247bV94MWKH_!!2215107627344.jpg&resp_type=1", "");
InitCef();
}
private void btnPrev_Click(object sender, EventArgs e)
{
cefWebBrowser.Back();
}
private void btnNext_Click(object sender, EventArgs e)
{
cefWebBrowser.Forward();
}
private void txtAddress_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (cefWebBrowser != null)
{
cefWebBrowser.Load(txtAddress.Text);
}
}
}
private void dgvProduct_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex < 0 || e.RowIndex < 0)
return;
string headerText = dgvProduct.Columns[e.ColumnIndex].HeaderText;
var skuId = dgvProduct.Rows[e.RowIndex].Cells["colSkuId"].Value.ParseToString();
var prodSku = lstJSTListProductSkuInfo.FirstOrDefault(p => p.skuId == skuId);
var row = dgvProduct.Rows[e.RowIndex];
switch (headerText)
{
case "删除":
//if (BaseMsgForm.ShowConfirm("确定删除商品吗?删除后不可恢复!").DialogResult == DialogResult.Cancel)
// return;
//DeleteProduct(dbId);
dgvProduct.Rows.Remove(row);
lstJSTListProductSkuInfo.Remove(prodSku);
NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_sku_list_" + MainForm.ProcessCount, lstJSTListProductSkuInfo);
break;
case "图片":
var imgUrl = dgvProduct.Rows[e.RowIndex].Cells["colImgUrl"].Value.ParseToString().Replace("?imageView2/2/w/90/h/90", "");
Dictionary<string, string> dic = new Dictionary<string, string>();
dic[imgUrl] = imgUrl;
ShowImgForm imgFrom = new ShowImgForm(imgUrl, dic);
imgFrom.ShowDialog();
break;
case "":
dgvProduct.Rows[e.RowIndex].Cells["colCheck"].Value = !(bool)dgvProduct.Rows[e.RowIndex].Cells["colCheck"].Value;
break;
default:
break;
}
}
private void btnCollectSupplier_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(currentGetSupplierListParamData))
{
BaseMsgForm.ShowError("请在网页上选择要搜索的供应商商品列表页面");
return;
}
if (dgvProduct.Rows.Count > 0)
{
if (BaseMsgForm.ShowConfirm("当前列表已有采集数据,是否重新采集?").DialogResult == DialogResult.Cancel)
{
return;
}
}
this.pbLoading.Visible = true;
dgvProduct.Rows.Clear();
lstJSTListProductSkuInfo.Clear();
if (cancellationTokenSource != null && cancellationTokenSource.IsCancellationRequested)
cancellationTokenSource.Cancel();
cancellationTokenSource = new CancellationTokenSource();
Task.Run(() =>
{
try
{
GetSupplierGoodsSkuList();
}
catch (Exception ex)
{
BaseMsgForm.ShowError(ex.Message);
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
//this.statusBar.lblTaskStatus.Text = "正在删除...";
}));
}, cancellationTokenSource.Token);
}
void GetSupplierGoodsSkuList()
{
List<Cookie> cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null));
var shop = new ShopLoginInfo();
shop.Cookies = JsonHelper.SerializeObject(cookieList);
var Jobj = JsonHelper.JObjectParse(currentGetSupplierListParamData);
Jobj["pageSize"] = 300;
int page = pageStart;
while (page <= pageEnd)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
if (page % 20 == 19)
NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_sku_list_" + MainForm.ProcessCount, lstJSTListProductSkuInfo);
Jobj["pageNum"] = page;
Jobj["searchType"] = 1;
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "正在采集第 " + page + " 页";
}));
Thread.Sleep(Randomx.GetId(1000, 2000));
page++;
var lstRst = GetSkuLst(shop, Jobj, currentSupplierId);
if (!lstRst.Contains("\"success\":true"))
{
var errMsg = BaseRegex.GetStringJson(ref lstRst, "message");
if (string.IsNullOrEmpty(errMsg))
errMsg = lstRst;
BaseMsgForm.ShowError("查询错误:" + errMsg);
return;
}
List<JSTListProductSkuInfo> jstLst = new List<JSTListProductSkuInfo>();
try
{
foreach (var jItem in JsonHelper.JObjectParse(lstRst)["data"])
{
JSTListProductSkuInfo jstProd = JsonHelper.DeserializeJsonToObject<JSTListProductSkuInfo>(JsonHelper.SerializeObject(jItem));
jstLst.Add(jstProd);
}
if (jstLst.Count <= 0)
break;
lstJSTListProductSkuInfo.AddRange(jstLst);
}
catch (Exception ex)
{
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "发生错误 " + ex.Message;
}));
Thread.Sleep(2000);
}
JObject JObjGetSupplierPrice = new JObject();
JObjGetSupplierPrice["supplierCoId"] = Jobj["supplierCoId"].ParseToString();
JObjGetSupplierPrice["idAndItemCodeVos"] = new JArray();
foreach (var prodSku in jstLst)
{
var JObjSku = new JObject();
JObjSku["itemCode"] = prodSku.itemCode;
JObjSku["skuId"] = prodSku.skuId;
(JObjGetSupplierPrice["idAndItemCodeVos"] as JArray).Add(JObjSku);
}
var lstRst2 = GetSkuPriceLst(shop, JObjGetSupplierPrice, currentSupplierId);
if (!lstRst2.Contains("\"success\":true"))
{
var errMsg = BaseRegex.GetStringJson(ref lstRst2, "message");
if (string.IsNullOrEmpty(errMsg))
errMsg = lstRst2;
BaseMsgForm.ShowError("查询错误:" + errMsg);
return;
}
try
{
JArray skuArr = JsonHelper.JObjectParse(lstRst2)["data"] as JArray;
foreach (var skuObj in skuArr)
{
var sku = jstLst.FirstOrDefault(s => s.skuId == skuObj["skuId"].ParseToString());
if (sku != null)
{
sku.supplyPrice = skuObj["supplyPrice"].ParseToDecimal();
sku.stock = skuObj["stock"].ParseToInt();
sku.weight = skuObj["weight"].ParseToDecimal();
sku.stockTime = skuObj["stockTime"].ParseToString().ParseToDateTime();
}
}
}
catch (Exception ex)
{
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "发生错误 " + ex.Message;
}));
Thread.Sleep(2000);
}
Invoke(new Action(() =>
{
foreach (var prodSku in jstLst)
{
prodSku.coid = Jobj["supplierCoId"].ParseToString();
prodSku.supplierName = currentSupplierName;
prodSku.supplierId = currentSupplierId;
var id = dgvProduct.Rows.Add(
true,
prodSku.coid,
prodSku.supplierName,
prodSku.itemSpuId,
prodSku.itemName,
prodSku.pic.ParseToString().Replace("https://", "http://"),
DataGridViewExtension.defaultBitmap,
prodSku.skuId,
prodSku.color + ";" + prodSku.spec,
prodSku.supplyPrice,
prodSku.stock,
"删除",
prodSku.Msg
);
dgvProduct.Rows[id].Height = 60;
}
}));
}
NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_sku_list_" + MainForm.ProcessCount, lstJSTListProductSkuInfo);
Invoke(new Action(() =>
{
BaseMsgForm.ShowInfo("采集完成");
}));
}
private void txtPageStart_TextChanged(object sender, EventArgs e)
{
pageStart = txtPageStart.Text.Trim().ParseToInt();
}
private void txtPageEnd_TextChanged(object sender, EventArgs e)
{
pageEnd = txtPageEnd.Text.Trim().ParseToInt();
}
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;
}));
});
}
private void btnSaveDb_Click(object sender, EventArgs e)
{
//"&product_get_type=" + HttpUtility.UrlEncode("厂商直采", Encoding.UTF8);
List<Cookie> cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null));
var shop = new ShopLoginInfo();
shop.Cookies = JsonHelper.SerializeObject(cookieList);
List<DataGridViewRow> rowLst = new List<DataGridViewRow>();
rowLst.AddRange(dgvProduct.Rows.Cast<DataGridViewRow>().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true));
if (cancellationTokenSource != null && cancellationTokenSource.IsCancellationRequested)
cancellationTokenSource.Cancel();
cancellationTokenSource = new CancellationTokenSource();
this.pbLoading.Visible = true;
var t = Task.Run(() =>
{
int success = 0;
int total = rowLst.Count;
foreach (var row in rowLst)
{
if (cancellationTokenSource.IsCancellationRequested)
break;
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = "";
}));
Invoke(new Action(() =>
{
this.statusBar.lblTaskStatus.Text = "正在入库表格第 " + (row.Index + 1) + " 行数据 成功 " + success + " 条";
}));
var skuId = row.Cells["colSkuId"].Value.ParseToString();
var prodSku = lstJSTListProductSkuInfo.FirstOrDefault(c => c.skuId == skuId);
if (prodSku == null)
continue;
if (!chkOverride.Checked && !prodSku.Msg.IsNullOrEmpty())
{
if (prodSku.Msg.Contains("已存在相同SkuId,跳过") || prodSku.Msg.Contains("商品Sku覆盖成功") || prodSku.Msg.Contains("商品Sku入库成功"))
{
//已存在相同SkuId,跳过
//商品Sku覆盖成功!
//商品Sku入库成功!
prodSku.Msg = "已存在相同SkuId,跳过";
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = prodSku.Msg;
}));
success++;
continue;
}
}
Thread.Sleep(25);
if (row.Index % 20 == 0)
NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_sku_list_" + MainForm.ProcessCount, lstJSTListProductSkuInfo);
bool isExist = false;
var existUrl = BaseClass.BuildPDDObjString("product/get_jst_sku_list");
string existData = UserLogin.GetSignaturex() + "&search_skuId=" + prodSku.skuId;
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"))
{
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = "入库失败,产品数据库连接失败";
}));
continue;
}
else
{
if (html.Contains("\"data\":[") && !html.Contains("\"data\":[]"))
isExist = true;
}
//var SetPartnerSpuRst = "";
var url = BaseClass.BuildPDDObjString("product/add_jst_sku");
if (isExist)
{
if (chkOverride.Checked)
{
url = BaseClass.BuildPDDObjString("product/mdy_jst_sku");
}
else
{
//入库成功 已存在相同id商品
prodSku.Msg = "已存在相同SkuId,跳过";
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = prodSku.Msg;
}));
success++;
continue;
}
}
var data = Work.UserLogin.GetSignaturex() +
"&coid=" + prodSku.coid +
"&supplierId=" + prodSku.supplierId +
"&supplierName=" + prodSku.supplierName +
"&skuId=" + prodSku.skuId +
"&itemSpuId=" + prodSku.itemSpuId +
"&pic=" + prodSku.pic +
"&itemName=" + HttpUtility.UrlEncode(prodSku.itemName, Encoding.UTF8) +
"&styleCode=" + prodSku.styleCode +
"&itemCode=" + prodSku.itemCode +
"&color=" + HttpUtility.UrlEncode(prodSku.color, Encoding.UTF8) +
"&spec=" + HttpUtility.UrlEncode(prodSku.spec, Encoding.UTF8) +
"&salePrice=" + prodSku.salePrice +
"&supplyPrice=" + prodSku.supplyPrice +
"&stock=" + prodSku.stock +
"&stockTime=" + prodSku.stockTime.ToString("yyyy-MM-dd HH:mm:ss") +
"&weight=" + prodSku.weight;
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"))
{
string msg = "商品Sku入库失败!请检查网络连接:" + BaseRegex.GetStringJson(ref html, "msg");
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = msg;
}));
}
else
{
success++;
prodSku.Msg = "商品Sku入库成功!";
if (url == BaseClass.BuildPDDObjString("product/mdy_jst_sku"))
prodSku.Msg = "商品Sku覆盖成功!";
Invoke(new Action(() =>
{
row.Cells["colMsg"].Value = prodSku.Msg;
}));
}
}
NaiBa.Util.Helper.ConfigHelper.SaveConfig("supplier_product_sku_list_" + MainForm.ProcessCount, lstJSTListProductSkuInfo);
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
BaseMsgForm.ShowInfo("商品入库完毕!");
}));
}, 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 GetSkuLst(ShopLoginInfo shop, JObject searchDataObj, string supplierId)
{
string url = "https://sc.scm121.com/api/goods/buyer/supplier/goods/skuList";
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + 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 GetSkuPriceLst(ShopLoginInfo shop, JObject searchDataObj, string supplierId)
{
string url = "https://sc.scm121.com/api/goods/buyer/supplier/asyncQuerySkuAdditional";
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/detail/" + 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 GetHotLst(ShopLoginInfo shop, JObject searchDataObj)
{
string url = "https://sc.ttdahuo.com/api/goods/freshman/mall/goods/list";
string referer = "https://sc.ttdahuo.com/findCooperation/newlywedZone";
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 GetGoodsDetail(ShopLoginInfo shop, JSTListProductInfo jstLstProd)
{
string url = "https://sc.scm121.com/api/goods/goods/queryGoodsDetail";
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/goodsDetail/" + jstLstProd.itemSpuId + "?itemCoId=" + jstLstProd.itemCoId + "&noBack=true";
//data = @"{""itemSpuId"":""0A3A5CC4F524430A9F3D7640BD0D3029"",""itemCoId"":""11596521""}";
string data = @"{""itemSpuId"":""" + jstLstProd.itemSpuId + @""",""itemCoId"":""" + jstLstProd.itemCoId + @"""}";
var detailRst = "";
for (int i = 0; i < 3 && !detailRst.Contains("\"success\":true"); i++)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
detailRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, data, referer, appVersion);
}
return detailRst;
}
public string GetItemSpuInfo(ShopLoginInfo shop, JSTListProductInfo jstLstProd)
{
string url = "https://sc.scm121.com/api/goods/shelves/itemSpuShelves/getItemSpuInfo";
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/goodsDetail/" + jstLstProd.itemSpuId + "?itemCoId=" + jstLstProd.itemCoId + "&noBack=true";
string data = @"{""itemSpuId"":""" + jstLstProd.itemSpuId + @""",""itemCoId"":""" + jstLstProd.itemCoId + @"""}";
data = @"{""id"":""" + jstLstProd.itemSpuId + @""",""platformType"":""Pinduoduo"",""shelvesType"":""DISTRIBUTION"",""companyType"":""SUPPLIER"",""itemCoId"":""" +
jstLstProd.itemCoId + @"""}";
var detailRst = "";
for (int i = 0; i < 3 && !detailRst.Contains("\"success\":true"); i++)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
detailRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, data, referer, appVersion);
}
return detailRst;
}
public string categoryForecastWithPlatform(ShopLoginInfo shop, JSTListProductInfo jstLstProd, string shopId)
{
string url = "https://sc.scm121.com/api/goods/platform/category/categoryForecastWithPlatform";
string referer = "https://sc.scm121.com/manage/goods/qualitySupplier/goodsDetail/" + jstLstProd.itemSpuId + "?itemCoId=" + jstLstProd.itemCoId + "&noBack=true";
string data = @"{""itemCoId"":""" + jstLstProd.coId + @""",""itemSpuId"":""" + jstLstProd.itemSpuId +
@""",""shopId"":""" + shopId + @""",""shopType"":""Pinduoduo"",""itemName"":""" + jstLstProd.itemName + @"""}";
var detailRst = "";
for (int i = 0; i < 3 && !detailRst.Contains("\"success\":true"); i++)
{
Thread.Sleep(Randomx.GetId(1000, 2000));
detailRst = JSTHttpResponseBLL.JSTPostResponse(shop, url, data, referer, appVersion);
}
return detailRst;
}
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;
}));
});
}
private void btnCancelSelect_Click(object sender, EventArgs e)
{
Task.Run(() => {
foreach(DataGridViewRow row in dgvProduct.Rows)
{
if (row.Cells["colMsg"].Value.ParseToString().Contains("入库成功") || row.Cells["colMsg"].Value.ParseToString().Contains("已存在相同id商品"))
{
Invoke(new Action(() =>
{
row.Cells["colcheck"].Value = false;
}));
}
}
});
}
private void txtWaitSeconds_TextChanged(object sender, EventArgs e)
{
getDetailWait = txtWaitSeconds.Text.ParseToInt();
}
private void btnExportCookie_Click(object sender, EventArgs e)
{
List<Cookie> cookieList = CEFBrowser.GetCookieList(".scm121.com", cefWebBrowser.GetCookieManager(null));
var shop = new ShopLoginInfo();
shop.Cookies = JsonHelper.SerializeObject(cookieList);
List<CefSharp.Cookie> cooks = null;
try { cooks = JsonHelper.DeserializeJsonToList<CefSharp.Cookie>(shop.Cookies); } catch (Exception ex) { }
if (cooks == null)
cooks = new List<CefSharp.Cookie>();
string cookJs = "";
var keys = new string[] { "acw_tc", "DISTRYBUTION_TOKEN" };
foreach (var shopCook in cooks)
{
var cookie = shopCook.Name + "=" + shopCook.Value;
if (!keys.Any(k => cookie.StartsWith(k)))
continue;
cookJs += "\r\ndocument.cookie='" + cookie.Substring(0, Math.Max(0, cookie.IndexOf("="))) + "=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;';";
}
foreach (var shopCook in cooks)
{
var cookie = shopCook.Name + "=" + shopCook.Value;
if (!keys.Any(k => cookie.StartsWith(k)))
continue;
cookJs += "\r\ndocument.cookie='" + cookie + "; domain=.scm121.com; expires=" +
DateTime.Now.AddMonths(1).ToUniversalTime().ToString("ddd, dd MMM yyyy HH:mm:ss 'UTC'", new DateTimeFormatInfo()) + "; path=/';";
}
cookJs += "\r\nsetTimeout(() => { window.location.href='https://sc.scm121.com/suppliersManage/suppliersList/onlineSuppliers'; }, 200)";
Clipboard.SetDataObject(cookJs);
BaseMsgForm.ShowInfo("复制成功");
}
private void btnStop_Click(object sender, EventArgs e)
{
if (CancelReturn != null)
CancelReturn.Cancel();
}
}
}
@@ -0,0 +1,204 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="colCheck.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colCoId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSupplierName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colProductId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colGoodsName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colImgUrl.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colImg.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSkuId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSkuName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colPrice.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colStock.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDel.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colMsg.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDownSelect.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDownSpuId.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDownStyleCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDownImgUrl.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDownImg.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDownItemName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="skuDownItemCode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDownColourSpec.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDownSupplierName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDownSupplyPrice.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDownShelvesTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDownLastOperator.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colDownDrpItemStatus.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewLinkColumn1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="dataGridViewTextBoxColumn8.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>
+12 -8
View File
@@ -32,13 +32,15 @@
System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("超级用户管理");
System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("PDD产品库");
System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("厂家商品采集");
System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("图片工具");
System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("超级权限管理", new System.Windows.Forms.TreeNode[] {
System.Windows.Forms.TreeNode treeNode5 = new System.Windows.Forms.TreeNode("Sku采集回传");
System.Windows.Forms.TreeNode treeNode6 = new System.Windows.Forms.TreeNode("图片工具");
System.Windows.Forms.TreeNode treeNode7 = new System.Windows.Forms.TreeNode("超级权限管理", new System.Windows.Forms.TreeNode[] {
treeNode1,
treeNode2,
treeNode3,
treeNode4,
treeNode5});
treeNode5,
treeNode6});
this.panel1 = new System.Windows.Forms.Panel();
this.panel3 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
@@ -137,12 +139,14 @@
treeNode3.Text = "PDD产品库";
treeNode4.Name = "厂家商品采集";
treeNode4.Text = "厂家商品采集";
treeNode5.Name = "图片工具";
treeNode5.Text = "图片工具";
treeNode6.Name = "超级权限管理";
treeNode6.Text = "超级权限管理";
treeNode5.Name = "Sku采集回传";
treeNode5.Text = "Sku采集回传";
treeNode6.Name = "图片工具";
treeNode6.Text = "图片工具";
treeNode7.Name = "超级权限管理";
treeNode7.Text = "超级权限管理";
this.tv.Nodes.AddRange(new System.Windows.Forms.TreeNode[] {
treeNode6});
treeNode7});
this.tv.OverForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(235)))), ((int)(((byte)(235)))), ((int)(((byte)(235)))));
this.tv.Size = new System.Drawing.Size(140, 446);
this.tv.TabIndex = 1;
+5 -1
View File
@@ -21,6 +21,7 @@ namespace TemuKJD.WXForms.AdminForms
public Lazy<WXAdminShopListForm> adminShopForm = new Lazy<WXAdminShopListForm>();
public Lazy<PDDDBProdListForm> pddDbProdListForm = new Lazy<PDDDBProdListForm>();
public Lazy<GetJuShuitanProdForm> getJuShuitanProdForm = new Lazy<GetJuShuitanProdForm>();
public Lazy<GetJuShuitanProductSKUListForm> getJuShuitanProductSKUListForm = new Lazy<GetJuShuitanProductSKUListForm>();
public Lazy<ImgToolForm> imgToolForm = new Lazy<ImgToolForm>();
public WXAdminForm()
@@ -32,7 +33,7 @@ namespace TemuKJD.WXForms.AdminForms
tv.SelectedNode = tv.Nodes[0].Nodes[0];
tv.ExpandGroup(tv.Nodes[0].Name);
List<string> hideName = new List<string>() { "图片工具1", "超级用户管理", "超级店铺管理", "PDD产品库", "SKU替换图", "选品加价管理", "认领待上传", "库存上传", "商品核价" };
List<string> hideName = new List<string>() { "图片工具", "Sku采集回传1", "超级用户管理", "超级店铺管理", "PDD产品库", "SKU替换图", "选品加价管理", "认领待上传", "库存上传", "商品核价" };
if (BaseClass.GroupId == 3)
{
@@ -85,6 +86,9 @@ namespace TemuKJD.WXForms.AdminForms
case "厂家商品采集":
SetForm(getJuShuitanProdForm.Value);
break;
case "Sku采集回传":
SetForm(getJuShuitanProductSKUListForm.Value);
break;
case "图片工具":
SetForm(imgToolForm.Value);
break;