1优化商品核价相关功能 2店铺工作数据统计功能

This commit is contained in:
wule committed 2025-08-27 19:08:30 +08:00
1 parent c70b78aff3
commit 6b6d63dd41
11 files changed
+775 -313

No files matched your search

@@ -1,5 +1,5 @@
namespace TemuKJD.KJDForms.ShopForms
namespace TemuKJD.KJDForms.ShopForms.Statistics
{
partial class ShopOrderStatisticsForm
{
@@ -622,8 +622,8 @@ namespace TemuKJD.KJDForms.ShopForms
this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.Name = "ShopOrderStatisticsForm";
this.Text = "ShopStatisticsForm";
this.Load += new System.EventHandler(this.ShopStatisticsForm_Load);
this.VisibleChanged += new System.EventHandler(this.ShopStatisticsForm_VisibleChanged);
this.Load += new System.EventHandler(this.ShopOrderStatisticsForm_Load);
this.VisibleChanged += new System.EventHandler(this.ShopOrderStatisticsForm_VisibleChanged);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
@@ -15,7 +15,7 @@ using System.Windows.Forms;
using TemuKJD.Extension;
using TemuKJD.KJDForms.BaseForms;
namespace TemuKJD.KJDForms.ShopForms
namespace TemuKJD.KJDForms.ShopForms.Statistics
{
public partial class ShopOrderStatisticsForm : Form
{
@@ -28,12 +28,12 @@ namespace TemuKJD.KJDForms.ShopForms
InitializeComponent();
}
private void ShopStatisticsForm_Load(object sender, EventArgs e)
private void ShopOrderStatisticsForm_Load(object sender, EventArgs e)
{
this.dgvShop.AddSelectorColumn("colSelect");
}
private void ShopStatisticsForm_VisibleChanged(object sender, EventArgs e)
private void ShopOrderStatisticsForm_VisibleChanged(object sender, EventArgs e)
{
if (Visible == true)
RefreshShop();
@@ -38,14 +38,12 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics
this.btnGetSelect = new DevComponents.DotNetBar.PanelEx();
this.ucGroupBoxEx1 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components);
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.lblWithdrawCashAmount = new System.Windows.Forms.Label();
this.lblSuggestStockup = new System.Windows.Forms.Label();
this.lblWillShortInSize = new System.Windows.Forms.Label();
this.lblShortInSize = new System.Windows.Forms.Label();
this.lblOutOfStock = new System.Windows.Forms.Label();
this.lblShortSupply = new System.Windows.Forms.Label();
this.lblWaitSend = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.label7 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
@@ -66,11 +64,11 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics
this.colNotes = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colWaitCreat = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colWaitSend = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colShortSupply = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colOutOfStock = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colShortInSize = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colWillShortInSize = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSuggestStockup = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colLackNum = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colCompletelySoldOutSkcNum = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSaleOutSkcNum = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colSoonSaleOutSkcNum = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.colAdviceStockSkcNum = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
@@ -198,14 +196,12 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 10F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 10F));
this.tableLayoutPanel1.Controls.Add(this.lblWithdrawCashAmount, 3, 3);
this.tableLayoutPanel1.Controls.Add(this.lblSuggestStockup, 2, 3);
this.tableLayoutPanel1.Controls.Add(this.lblWillShortInSize, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.lblShortInSize, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.lblOutOfStock, 3, 1);
this.tableLayoutPanel1.Controls.Add(this.lblShortSupply, 2, 1);
this.tableLayoutPanel1.Controls.Add(this.lblWaitSend, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.label8, 3, 2);
this.tableLayoutPanel1.Controls.Add(this.label7, 2, 2);
this.tableLayoutPanel1.Controls.Add(this.label6, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.label5, 0, 2);
@@ -224,17 +220,6 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics
this.tableLayoutPanel1.Size = new System.Drawing.Size(1068, 115);
this.tableLayoutPanel1.TabIndex = 435;
//
// lblWithdrawCashAmount
//
this.lblWithdrawCashAmount.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.lblWithdrawCashAmount.AutoSize = true;
this.lblWithdrawCashAmount.Font = new System.Drawing.Font("微软雅黑", 11F);
this.lblWithdrawCashAmount.Location = new System.Drawing.Point(789, 87);
this.lblWithdrawCashAmount.Name = "lblWithdrawCashAmount";
this.lblWithdrawCashAmount.Size = new System.Drawing.Size(18, 20);
this.lblWithdrawCashAmount.TabIndex = 15;
this.lblWithdrawCashAmount.Text = "0";
//
// lblSuggestStockup
//
this.lblSuggestStockup.Anchor = System.Windows.Forms.AnchorStyles.Left;
@@ -301,17 +286,6 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics
this.lblWaitSend.TabIndex = 15;
this.lblWaitSend.Text = "0";
//
// label8
//
this.label8.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label8.AutoSize = true;
this.label8.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
this.label8.Location = new System.Drawing.Point(789, 62);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(11, 12);
this.label8.TabIndex = 13;
this.label8.Text = "-";
//
// label7
//
this.label7.Anchor = System.Windows.Forms.AnchorStyles.Left;
@@ -462,11 +436,11 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics
this.colNotes,
this.colWaitCreat,
this.colWaitSend,
this.colShortSupply,
this.colOutOfStock,
this.colShortInSize,
this.colWillShortInSize,
this.colSuggestStockup});
this.colLackNum,
this.colCompletelySoldOutSkcNum,
this.colSaleOutSkcNum,
this.colSoonSaleOutSkcNum,
this.colAdviceStockSkcNum});
this.dgvShop.Dock = System.Windows.Forms.DockStyle.Fill;
this.dgvShop.Location = new System.Drawing.Point(4, 0);
this.dgvShop.Name = "dgvShop";
@@ -541,44 +515,45 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics
this.colWaitSend.Name = "colWaitSend";
this.colWaitSend.ReadOnly = true;
//
// colShortSupply
// colLackNum
//
this.colShortSupply.HeaderText = "已缺货";
this.colShortSupply.Name = "colShortSupply";
this.colShortSupply.ReadOnly = true;
this.colLackNum.HeaderText = "已缺货";
this.colLackNum.Name = "colLackNum";
this.colLackNum.ReadOnly = true;
//
// colOutOfStock
// colCompletelySoldOutSkcNum
//
this.colOutOfStock.HeaderText = "已断货";
this.colOutOfStock.Name = "colOutOfStock";
this.colOutOfStock.ReadOnly = true;
this.colCompletelySoldOutSkcNum.HeaderText = "已断货";
this.colCompletelySoldOutSkcNum.Name = "colCompletelySoldOutSkcNum";
this.colCompletelySoldOutSkcNum.ReadOnly = true;
//
// colShortInSize
// colSaleOutSkcNum
//
this.colShortInSize.HeaderText = "已断码";
this.colShortInSize.Name = "colShortInSize";
this.colShortInSize.ReadOnly = true;
this.colSaleOutSkcNum.HeaderText = "已断码";
this.colSaleOutSkcNum.Name = "colSaleOutSkcNum";
this.colSaleOutSkcNum.ReadOnly = true;
//
// colWillShortInSize
// colSoonSaleOutSkcNum
//
this.colWillShortInSize.HeaderText = "即将断码";
this.colWillShortInSize.Name = "colWillShortInSize";
this.colWillShortInSize.ReadOnly = true;
this.colSoonSaleOutSkcNum.HeaderText = "即将断码";
this.colSoonSaleOutSkcNum.Name = "colSoonSaleOutSkcNum";
this.colSoonSaleOutSkcNum.ReadOnly = true;
//
// colSuggestStockup
// colAdviceStockSkcNum
//
this.colSuggestStockup.HeaderText = "建议备货";
this.colSuggestStockup.Name = "colSuggestStockup";
this.colSuggestStockup.ReadOnly = true;
this.colAdviceStockSkcNum.HeaderText = "建议备货";
this.colAdviceStockSkcNum.Name = "colAdviceStockSkcNum";
this.colAdviceStockSkcNum.ReadOnly = true;
//
// ShopWorkStatisticsForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(1253, 557);
this.Controls.Add(this.splitContainer1);
this.Name = "ShopWorkStatisticsForm";
this.Text = "ShopWorkStatistics";
this.Load += new System.EventHandler(this.ShopWorkStatisticsForm_Load);
this.VisibleChanged += new System.EventHandler(this.ShopWorkStatisticsForm_VisibleChanged);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
@@ -605,14 +580,12 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics
private DevComponents.DotNetBar.PanelEx btnGetSelect;
private UserComponent.UcGroupBoxEx ucGroupBoxEx1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label lblWithdrawCashAmount;
private System.Windows.Forms.Label lblSuggestStockup;
private System.Windows.Forms.Label lblWillShortInSize;
private System.Windows.Forms.Label lblShortInSize;
private System.Windows.Forms.Label lblOutOfStock;
private System.Windows.Forms.Label lblShortSupply;
private System.Windows.Forms.Label lblWaitSend;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label5;
@@ -633,10 +606,10 @@ namespace TemuKJD.KJDForms.ShopForms.Statistics
private System.Windows.Forms.DataGridViewTextBoxColumn colNotes;
private System.Windows.Forms.DataGridViewTextBoxColumn colWaitCreat;
private System.Windows.Forms.DataGridViewTextBoxColumn colWaitSend;
private System.Windows.Forms.DataGridViewTextBoxColumn colShortSupply;
private System.Windows.Forms.DataGridViewTextBoxColumn colOutOfStock;
private System.Windows.Forms.DataGridViewTextBoxColumn colShortInSize;
private System.Windows.Forms.DataGridViewTextBoxColumn colWillShortInSize;
private System.Windows.Forms.DataGridViewTextBoxColumn colSuggestStockup;
private System.Windows.Forms.DataGridViewTextBoxColumn colLackNum;
private System.Windows.Forms.DataGridViewTextBoxColumn colCompletelySoldOutSkcNum;
private System.Windows.Forms.DataGridViewTextBoxColumn colSaleOutSkcNum;
private System.Windows.Forms.DataGridViewTextBoxColumn colSoonSaleOutSkcNum;
private System.Windows.Forms.DataGridViewTextBoxColumn colAdviceStockSkcNum;
}
}
@@ -1,4 +1,9 @@
using System;
using AllBase;
using AllBase.Helper;
using AllBase.Model.Result;
using NaiBa.Util.Extension;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
@@ -7,14 +12,294 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using TemuKJD.Extension;
namespace TemuKJD.KJDForms.ShopForms.Statistics
{
public partial class ShopWorkStatisticsForm : Form
{
public List<ShopWorkStatisticsInfo> lstShopStatisticsInfo = new List<ShopWorkStatisticsInfo>();
public bool IsOperate = false;
public bool isFirstLoad = false;
public ShopWorkStatisticsForm()
{
InitializeComponent();
}
private void ShopWorkStatisticsForm_Load(object sender, EventArgs e)
{
this.dgvShop.AddSelectorColumn("colSelect");
}
private void ShopWorkStatisticsForm_VisibleChanged(object sender, EventArgs e)
{
if (Visible == true)
RefreshShop();
}
private void RefreshShop()
{
this.pbLoading.Visible = true;
// 店铺Id
var selectIds = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
=> row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList();
// 获取被删除的店铺
List<DataGridViewRow> dgvRowList = dgvShop.Rows.Cast<DataGridViewRow>().Where(row
=> !GlobalConfig.ShopLoginList.Any(s => s.ShopId == row.Cells["colShopId"]?.Value?.ToString())).ToList();
// 更新被删除的店铺列表
foreach (var row in dgvRowList)
{
dgvShop.Rows.Remove(row);
}
// 获取被删除的统计信息并删除
List<ShopWorkStatisticsInfo> statisticsDeleteLst = lstShopStatisticsInfo.Where(row
=> !GlobalConfig.ShopLoginList.Any(s => s.ShopId == row.shop_id.ToString())).ToList();
foreach (var s in statisticsDeleteLst)
{
lstShopStatisticsInfo.Remove(s);
}
// 绑定店铺(含新导入的店铺)
foreach (ShopLoginInfo shopEntity in GlobalConfig.ShopLoginList)
{
if (!string.IsNullOrEmpty(shopEntity.ShopId))
BindShop(shopEntity, selectIds);
}
GetShopStatistics(GlobalConfig.ShopLoginList.ToList(), selectIds);
}
private void GetShopStatistics(List<ShopLoginInfo> shops, List<string> selectIds)
{
Task.Run(() =>
{
foreach (ShopLoginInfo shopEntity in shops)
{
if (string.IsNullOrEmpty(shopEntity.ShopId))
continue;
bool canUse = shopEntity.LoginStatus == "登录成功" && shopEntity.LoginStatus2 == "国际版在线";
if (!canUse)
{
BindShop(shopEntity, selectIds);
continue;
}
ShopWorkStatisticsInfo statistics = lstShopStatisticsInfo.FirstOrDefault(s => s.shop_id.ToString() == shopEntity.ShopId);
if (statistics == null)
{
statistics = new ShopWorkStatisticsInfo()
{
notes = shopEntity.Notes,
shop_id = shopEntity.ShopId.ParseToLong(),
shop_account = shopEntity.ShopAccount,
};
lstShopStatisticsInfo.Add(statistics);
}
GetShopStatistics(shopEntity, statistics);
Invoke(new Action(() =>
{
this.lblWaitCreat.Text = this.lstShopStatisticsInfo.Sum(s => s.waitCreat).ToString();
this.lblWaitSend.Text = this.lstShopStatisticsInfo.Sum(s => s.waitSend).ToString();
this.lblShortSupply.Text = this.lstShopStatisticsInfo.Sum(s => s.lackNum).ToString();
this.lblOutOfStock.Text = this.lstShopStatisticsInfo.Sum(s => s.completelySoldOutSkcNum).ToString();
this.lblShortInSize.Text = this.lstShopStatisticsInfo.Sum(s => s.saleOutSkcNum).ToString();
this.lblWillShortInSize.Text = this.lstShopStatisticsInfo.Sum(s => s.soonSaleOutSkcNum).ToString();
this.lblSuggestStockup.Text = this.lstShopStatisticsInfo.Sum(s => s.adviceStockSkcNum).ToString();
BindShop(shopEntity, selectIds);
}));
}
Invoke(new Action(() =>
{
this.pbLoading.Visible = false;
}));
});
}
private void BindShop(ShopLoginInfo shopEntity, List<string> selectShopId = null)
{
if (shopEntity == null)
return;
if (selectShopId == null)
selectShopId = new List<string>();
ShopWorkStatisticsInfo statistics = lstShopStatisticsInfo.FirstOrDefault(s => s.shop_id.ToString() == shopEntity.ShopId);
if (statistics == null)
{
statistics = new ShopWorkStatisticsInfo()
{
notes = shopEntity.Notes,
shop_id = shopEntity.ShopId.ParseToLong(),
shop_account = shopEntity.ShopAccount,
};
lstShopStatisticsInfo.Add(statistics);
}
bool canUse = shopEntity.LoginStatus == "登录成功" && shopEntity.LoginStatus2 == "国际版在线";
var row = dgvShop.Rows.Cast<DataGridViewRow>().FirstOrDefault(
p => p.Cells.GetCellValueFromColumnName("colShopId").ParseToString() == shopEntity.ShopId);
if (row == null)
{
int rowId = this.dgvShop.Rows.Add(
false,
canUse ? "在线" : "掉线",
shopEntity.LoginName,
shopEntity.ShopId,
shopEntity.ShopAccount,
shopEntity.Notes,
statistics.waitCreat == null ? "-" : statistics.waitCreat.ToString(), //待创建
statistics.waitSend == null ? "-" : statistics.waitSend.ToString(), //待发货
statistics.lackNum == null ? "-" : statistics.lackNum.ToString(), //已缺货
statistics.completelySoldOutSkcNum == null ? "-" : statistics.completelySoldOutSkcNum.ToString(), //已断货
statistics.saleOutSkcNum == null ? "-" : statistics.saleOutSkcNum.ToString(), //已断码
statistics.soonSaleOutSkcNum == null ? "-" : statistics.soonSaleOutSkcNum.ToString(), //即将断码
statistics.adviceStockSkcNum == null ? "-" : statistics.adviceStockSkcNum.ToString() // 建议备货
);
row = dgvShop.Rows[rowId];
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Green : Color.Red;
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Green : Color.Red;
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightGreen : Color.OrangeRed;
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkGreen : Color.DarkRed;
row.Height = 32;
}
else
{
row.Cells["colSelect"].Value = selectShopId.Contains(shopEntity.ShopId) && canUse;
row.Cells["colLoginStatus"].Value = canUse ? "在线" : "掉线";
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).Style.ForeColor = canUse ? Color.Green : Color.Red;
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).LinkColor = canUse ? Color.Green : Color.Red;
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).ActiveLinkColor = canUse ? Color.LightGreen : Color.OrangeRed;
(row.Cells["colLoginStatus"] as DataGridViewLinkCell).VisitedLinkColor = canUse ? Color.DarkGreen : Color.DarkRed;
row.Cells["colShopLoginName"].Value = shopEntity.LoginName;
row.Cells["colShopAccount"].Value = shopEntity.ShopAccount;
row.Cells["colNotes"].Value = shopEntity.Notes;
row.Cells["colWaitCreat"].Value = statistics.waitCreat == null ? "0" : statistics.waitCreat.ToString(); //待创建
row.Cells["colWaitSend"].Value = statistics.waitSend == null ? "0" : statistics.waitSend.ToString(); //待发货
row.Cells["colLackNum"].Value = statistics.lackNum == null ? "0" : statistics.lackNum.ToString(); //已缺货
row.Cells["colCompletelySoldOutSkcNum"].Value = statistics.completelySoldOutSkcNum == null ? "0" : statistics.completelySoldOutSkcNum.ToString(); //已断货
row.Cells["colSaleOutSkcNum"].Value = statistics.saleOutSkcNum == null ? "0" : statistics.saleOutSkcNum.ToString(); //已断码
row.Cells["colSoonSaleOutSkcNum"].Value = statistics.soonSaleOutSkcNum == null ? "0" : statistics.soonSaleOutSkcNum.ToString(); //即将断码
row.Cells["colAdviceStockSkcNum"].Value = statistics.adviceStockSkcNum == null ? "0" : statistics.adviceStockSkcNum.ToString(); // 建议备货
}
}
private void GetShopStatistics(ShopLoginInfo shop, ShopWorkStatisticsInfo statistics, List<string> selectShopId = null)
{
if (statistics.is_search_1 != true)
{
try
{
string html = GetShopStockList(shop);
if (html.Contains("\"success\":true"))
{
JObject jObj = JObject.Parse(html);
string jStr = JsonHelper.SerializeObject(jObj["result"]["statusNumMap"]);
//"statusNumMap": {
// "0": 2, //待创建
// "1": 6, //待发货
// "2": 18, //已送货
// "3": 10, //已收货
// "5": 0, //抽检全部退回
// "6": 0, //已验收
// "7": 1452, //已入库
// "8": 149, //已作废
// "9": 0, //已超时?
// "10": 1990 //已取消
//},
statistics.waitCreat = BaseRegex.GetNullableIntJson(ref html, "0");
statistics.waitSend = BaseRegex.GetNullableIntJson(ref html, "1");
statistics.is_search_1 = true;
}
else
{
string errStr = BaseRegex.GetStringJson(ref html, "errorMsg");
if (string.IsNullOrEmpty(errStr))
errStr = errStr = BaseRegex.GetStringJson(ref html, "error_msg");
if (string.IsNullOrEmpty(errStr))
errStr = html;
if (errStr.Contains("Invalid Login State"))
{
ShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
}
System.Threading.Thread.Sleep(Randomx.GetId(100, 200));
statistics.err_msg = errStr;
return;
}
System.Threading.Thread.Sleep(Randomx.GetId(100, 200));
}
catch (Exception ex)
{
System.Threading.Thread.Sleep(Randomx.GetId(100, 200));
statistics.err_msg = ex.Message;
return;
}
}
if (statistics.is_search_2 != true)
{
try
{
string html = GetWarehouseList(shop);
if (html.Contains("\"success\":true"))
{
statistics.lackNum = BaseRegex.GetNullableIntJson(ref html, "lackNum");
statistics.completelySoldOutSkcNum = BaseRegex.GetNullableIntJson(ref html, "completelySoldOutSkcNum");
statistics.saleOutSkcNum = BaseRegex.GetNullableIntJson(ref html, "saleOutSkcNum");
statistics.soonSaleOutSkcNum = BaseRegex.GetNullableIntJson(ref html, "soonSaleOutSkcNum");
statistics.adviceStockSkcNum = BaseRegex.GetNullableIntJson(ref html, "adviceStockSkcNum");
statistics.adSkcNum = BaseRegex.GetNullableIntJson(ref html, "adSkcNum");
statistics.hotInventoryLackNum = BaseRegex.GetNullableIntJson(ref html, "hotInventoryLackNum");
statistics.is_search_2 = true;
}
else
{
string errStr = BaseRegex.GetStringJson(ref html, "errorMsg");
if (string.IsNullOrEmpty(errStr))
errStr = errStr = BaseRegex.GetStringJson(ref html, "error_msg");
if (string.IsNullOrEmpty(errStr))
errStr = html;
if (errStr.Contains("Invalid Login State"))
{
ShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false);
}
System.Threading.Thread.Sleep(Randomx.GetId(100, 200));
statistics.err_msg = errStr;
return;
}
System.Threading.Thread.Sleep(Randomx.GetId(100, 200));
}
catch (Exception ex)
{
System.Threading.Thread.Sleep(Randomx.GetId(100, 200));
statistics.err_msg = ex.Message;
return;
}
}
}
private string GetWarehouseList(ShopLoginInfo shop, int page = 1)
{
page = Math.Max(page, 1);
string url = "https://agentseller.temu.com/mms/venom/api/supplier/sales/management/listWarehouse";
string body = @"{""pageNo"":" + page + @",""pageSize"":10,""isLack"":0,""selectStatusList"":[12],""priceAdjustRecentDays"":7}";
string refere = "https://agentseller.temu.com/stock/fully-mgt/sale-manage/main";
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
}
private string GetShopStockList(ShopLoginInfo shop, int page = 1)
{
page = Math.Max(page, 1);
string url = "https://agentseller.temu.com/mms/venom/api/supplier/purchase/manager/querySubOrderList";
string body;
body = @"{""pageNo"":" + page + @",""pageSize"":20,""urgencyType"":0,""isCustomGoods"":false,""statusList"":[0],""oneDimensionSort"":{""firstOrderByParam"":""expectLatestDeliverTime"",""firstOrderByDesc"":0}}"; //待创建
string refere = "https://agentseller.temu.com/stock/fully-mgt/order-manage";
return KJDHttpResponse.PostResponse2(shop, url, body, refere);
}
}
}
@@ -141,19 +141,19 @@
<metadata name="colWaitSend.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colShortSupply.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colLackNum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colOutOfStock.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colCompletelySoldOutSkcNum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colShortInSize.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colSaleOutSkcNum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colWillShortInSize.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colSoonSaleOutSkcNum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="colSuggestStockup.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<metadata name="colAdviceStockSkcNum.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>