pxx上货功能 temu备货管理可以查询商品售后率并根据售后率处理备货

This commit is contained in:
wule committed 2025-09-19 09:31:34 +08:00
1 parent f4fedf1e2f
commit 0e6a034d5f
34 files changed
+3568 -893

No files matched your search

@@ -32,7 +32,8 @@ namespace TemuKJD.PDDForms.ShopForms
BaseMsgForm.ShowError("商品Id不存在!");
return "failed";
}
var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == supplierId.ParseToString());
//var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == supplierId.ParseToString());
var shop = PDDAdminShopListForm.lstAdminShopInfo.FirstOrDefault(s => s.ShopId == supplierId.ParseToString());
if (string.IsNullOrEmpty(supplierId) || shop == null)
{
BaseMsgForm.ShowError("店铺不存在!");
@@ -77,7 +78,48 @@ namespace TemuKJD.PDDForms.ShopForms
return;
}
}
catch (Exception ex) { }
catch (Exception ex)
{
OnInfoReceived("商品获取失败!商品数据格式获取失败!" + ex.Message);
return;
}
var size_json = "{}";
if (product.size_spec_id.ParseToLong() != 0)
{
try
{
var prod_size_rst = GetPddProdSizeSpec(sourceShop, sourceProdId.ToString(), commitId, product.size_spec_id.ParseToString());
prod_size_rst = GetHtml.Unicode2String(prod_size_rst);
JObject prod_size_obj = JObject.Parse(prod_size_rst);
size_json = JsonHelper.SerializeObject(prod_size_obj["result"]);
var size = JsonHelper.DeserializeJsonToObject<PDDSizeSpecInfo>(size_json);
if (size == null)
{
OnInfoReceived("尺码表获取失败!尺码数据格式获取失败!");
return;
}
}
catch (Exception ex)
{
OnInfoReceived("尺码表获取失败!尺码数据格式获取失败!" + ex.Message);
return;
}
}
//temu尺码表暂时注释
//if (product.sizeTemplateId > 0)
//{
// html = SizeSpecQuery(shop1, prodId1.ToString(), product.sizeTemplateId.ToString());
// if(!html.Contains("\"success\":true"))
// {
// success_err_msg += " 尺码表获取失败!" + BaseRegex.GetStringJson(ref html, "errorMsg");
// }
// else
// {
// obj = JObject.Parse(html);
// sizeRst = JsonHelper.SerializeObject(obj["result"]);
// }
//}
var property_json = "{}";
PDDProductPropertyInfo property = null;
@@ -142,22 +184,6 @@ namespace TemuKJD.PDDForms.ShopForms
// return;
//}
var sizeRst = "";
//尺码表暂时注释
//if (product.sizeTemplateId > 0)
//{
// html = SizeSpecQuery(shop1, prodId1.ToString(), product.sizeTemplateId.ToString());
// if(!html.Contains("\"success\":true"))
// {
// success_err_msg += " 尺码表获取失败!" + BaseRegex.GetStringJson(ref html, "errorMsg");
// }
// else
// {
// obj = JObject.Parse(html);
// sizeRst = JsonHelper.SerializeObject(obj["result"]);
// }
//}
bool isExist = false;
var existUrl = BaseClass.BuildObjString("product/get_product_list");
string existData = UserLogin.GetSignaturex() + "&search_spu=" + product.goods_id;
@@ -172,7 +198,8 @@ namespace TemuKJD.PDDForms.ShopForms
isExist = true;
}
string product_json = "{\"detail\":" + detail_json + ",\"decoration\":" + decoration_json + ",\"property\":" + property_json + "}";
string product_json = "{\"detail\":" + detail_json + ",\"size\":" + size_json + ",\"decoration\":" + decoration_json + ",\"property\":" + property_json + "}";
string main_img = product.image_url;
if (string.IsNullOrEmpty(main_img))
main_img = product.hd_thumb_url;
@@ -200,12 +227,15 @@ namespace TemuKJD.PDDForms.ShopForms
"&from_shop_id=" + shop.ShopId +
"&spu_id=" + product.goods_id.ParseToString() +
"&skc_id=" + product.goods_id.ParseToString() +
"&price_text=" + product.sku.Min(s => s.multi_price).ParseToInt() * 0.01m + "-" + product.sku.Max(s => s.multi_price).ParseToInt() * 0.01m +
"&main_cat_id=" + (product.cat_ids?.FirstOrDefault(c => c != null)).ParseToString() +
"&main_cat_name=" + HttpUtility.UrlEncode((product.cats?.FirstOrDefault(c => !string.IsNullOrEmpty(c))).ParseToString(), Encoding.UTF8) +
"&cat_id=" + (product.cat_id).ParseToString() +
"&cat_name=" + HttpUtility.UrlEncode((product.cats?.LastOrDefault(c => !string.IsNullOrEmpty(c))).ParseToString(), Encoding.UTF8) +
"&ext_code=" + HttpUtility.UrlEncode(product.out_goods_sn, Encoding.UTF8) +
"&product_name=" + HttpUtility.UrlEncode(product.goods_name, Encoding.UTF8) +
"&product_json=" + HttpUtility.UrlEncode(product_json, Encoding.UTF8) +
"&size_json=" + HttpUtility.UrlEncode(sizeRst, Encoding.UTF8) +
"&size_json=" + HttpUtility.UrlEncode(size_json, Encoding.UTF8) +
"&main_img=" + HttpUtility.UrlEncode(main_img, Encoding.UTF8);
html = GetHtml.PostUtf8(url, data);
@@ -496,6 +526,29 @@ namespace TemuKJD.PDDForms.ShopForms
}
return result;
}
private string GetPddProdSizeSpec(ShopLoginInfo shop, string prodId, string commitId, string sizeSpecId)
{
var anti = shop.AntiContents.LastOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
string url = "https://mms.pinduoduo.com/cabernet/mms/sizespec/query/draft";
//string body = @"{""goods_id"":" + prodId + "}";
string body = @"{""id"":" + sizeSpecId + @"}";
string refere = "https://mms.pinduoduo.com/goods/goods_add/index?id=" + commitId + "&goods_id=" + prodId + "&type=edit";
var result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
for (int i = 0; i < 5 && result.Contains("网络繁忙,请不要频繁操作"); i++)
{
shop.AntiContents.Remove(anti);
anti = shop.AntiContents.FirstOrDefault().ParseToString();
if (shop.AntiContents.Count > 0)
{
Thread.Sleep(Randomx.GetId(300, 500));
anti = shop.AntiContents[Randomx.GetId(shop.AntiContents.Count)];
result = HttpResponseBLL.PDDPostResponse(shop, url, body, refere, anti);
}
}
return result;
}
private string GetPddProdProperty(ShopLoginInfo shop, string prodId, string commitId)
{
var anti = shop.AntiContents.LastOrDefault().ParseToString();
+23 -22
View File
@@ -30,6 +30,7 @@
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PDDShopLoginForm));
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.btnReturnPackage = new TemuKJD.UserControls.ButtonEx();
this.btnLoginAgain = new TemuKJD.UserControls.ButtonEx();
this.pnlMultiLogin = new System.Windows.Forms.Panel();
this.cmbMultiCookieName = new DevComponents.DotNetBar.Controls.ComboBoxEx();
@@ -46,7 +47,6 @@
this.chkCloseAfterLogin = new DevComponents.DotNetBar.Controls.CheckBoxX();
this.splitContainer2 = new System.Windows.Forms.SplitContainer();
this.txtAddress = new System.Windows.Forms.TextBox();
this.btnReturnPackage = new TemuKJD.UserControls.ButtonEx();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
@@ -82,11 +82,29 @@
this.splitContainer1.Panel2.Controls.Add(this.btnStop);
this.splitContainer1.Panel2.Controls.Add(this.btnReload);
this.splitContainer1.Panel2.Controls.Add(this.chkCloseAfterLogin);
this.splitContainer1.Size = new System.Drawing.Size(1438, 736);
this.splitContainer1.SplitterDistance = 675;
this.splitContainer1.Size = new System.Drawing.Size(1438, 755);
this.splitContainer1.SplitterDistance = 690;
this.splitContainer1.SplitterWidth = 3;
this.splitContainer1.TabIndex = 4;
//
// btnReturnPackage
//
this.btnReturnPackage.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnReturnPackage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnReturnPackage.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnReturnPackage.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnReturnPackage.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReturnPackage.ForeColor = System.Drawing.Color.White;
this.btnReturnPackage.Location = new System.Drawing.Point(674, 30);
this.btnReturnPackage.Margin = new System.Windows.Forms.Padding(2);
this.btnReturnPackage.Name = "btnReturnPackage";
this.btnReturnPackage.Size = new System.Drawing.Size(136, 25);
this.btnReturnPackage.TabIndex = 464;
this.btnReturnPackage.Text = "提交退货到库存管理";
this.btnReturnPackage.UseVisualStyleBackColor = false;
this.btnReturnPackage.Visible = false;
this.btnReturnPackage.Click += new System.EventHandler(this.btnReturnPackage_Click);
//
// btnLoginAgain
//
this.btnLoginAgain.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
@@ -304,7 +322,7 @@
this.splitContainer2.BackColor = System.Drawing.Color.White;
this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer2.Location = new System.Drawing.Point(1, 33);
this.splitContainer2.Location = new System.Drawing.Point(1, 14);
this.splitContainer2.Name = "splitContainer2";
this.splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
//
@@ -315,7 +333,7 @@
// splitContainer2.Panel2
//
this.splitContainer2.Panel2.Controls.Add(this.splitContainer1);
this.splitContainer2.Size = new System.Drawing.Size(1438, 766);
this.splitContainer2.Size = new System.Drawing.Size(1438, 785);
this.splitContainer2.SplitterDistance = 26;
this.splitContainer2.TabIndex = 5;
//
@@ -330,23 +348,6 @@
this.txtAddress.TabIndex = 7;
this.txtAddress.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtAddress_KeyDown);
//
// btnReturnPackage
//
this.btnReturnPackage.Anchor = System.Windows.Forms.AnchorStyles.Top;
this.btnReturnPackage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255)))));
this.btnReturnPackage.Cursor = System.Windows.Forms.Cursors.Hand;
this.btnReturnPackage.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnReturnPackage.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReturnPackage.ForeColor = System.Drawing.Color.White;
this.btnReturnPackage.Location = new System.Drawing.Point(674, 30);
this.btnReturnPackage.Margin = new System.Windows.Forms.Padding(2);
this.btnReturnPackage.Name = "btnReturnPackage";
this.btnReturnPackage.Size = new System.Drawing.Size(136, 25);
this.btnReturnPackage.TabIndex = 464;
this.btnReturnPackage.Text = "提交退货到库存管理";
this.btnReturnPackage.UseVisualStyleBackColor = false;
this.btnReturnPackage.Visible = false;
//
// PDDShopLoginForm
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+14 -1
View File
@@ -68,7 +68,7 @@ namespace TemuKJD.PDDForms.ShopForms
private void ShopLoginForm_Load(object sender, EventArgs e)
{
//this.splitContainer1.SplitterDistance = 674;
this.splitContainer1.SplitterDistance = this.splitContainer1.Height - 62;
if (isMultiLogin && shop != null)
{
@@ -906,6 +906,13 @@ function fireKeyEvent(el, evtType, keyCode) {
private void ShopLoginForm_FormClosed(object sender, FormClosedEventArgs e)
{
//OnSaveComplete(shop);
Task.Run(() => {
Thread.Sleep(500);
if (!this.IsDisposed)
{
MainForm.instance.Invoke(new Action(() => { this.Dispose(); }));
}
});
}
private void txtAddress_KeyDown(object sender, KeyEventArgs e)
@@ -1007,5 +1014,11 @@ function getElementWithText(sText)
InputUserNameAndPassword(cefWebBrowser, shop.LoginName, DataOpenSSL.DecryptString(shop.Password));
});
}
private void btnReturnPackage_Click(object sender, EventArgs e)
{
//ReturnPackageDetailForm form = new ReturnPackageDetailForm(this.shop);
//form.ShowDialog();
}
}
}