From 8445ec1828c8acc12febed2848ee19e28cbaf109 Mon Sep 17 00:00:00 2001 From: wule Date: Mon, 18 Aug 2025 19:19:42 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=A4=87=E8=B4=A7=E9=80=BB?= =?UTF-8?q?=E8=BE=91=E4=B8=8D=E5=85=81=E8=AE=B8=E5=93=81=E8=B4=A8=E5=88=86?= =?UTF-8?q?=E8=BF=87=E4=BD=8E=E7=9A=84=E5=95=86=E5=93=81=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=A4=87=E8=B4=A7=EF=BC=88=E5=AE=8C=E6=88=90=E4=BD=86=E5=B0=9A?= =?UTF-8?q?=E6=9C=AA=E6=B5=8B=E8=AF=95=EF=BC=89=20=E6=B3=A8=E9=87=8A?= =?UTF-8?q?=E6=97=A0=E7=94=A8=E7=9A=84=E7=9B=B8=E5=85=B3=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=88=E5=8E=9F=E5=B0=8F=E5=A5=B6=E7=8B=97=EF=BC=8C=E5=B0=8F?= =?UTF-8?q?=E5=A5=B6=E5=85=94=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AllBase/AllBase.csproj | 1 + AllBase/Model/Result/TemuGoodsQualityInfo.cs | 51 +++ AllBase/Model/Result/TemuStockInfo.cs | 2 + .../KJD_WebService/BLL/ProductManage.cs | 4 +- .../KJD_WebService/BLL/ProductThirdManage.cs | 4 +- KJDService/KJD_WebService/BLL/ShopManage.cs | 41 +- TEMUKJD/InitForm.cs | 8 +- .../ProductForms/PriceManageForm.Designer.cs | 196 +++++----- .../KJDForms/ProductForms/PriceManageForm.cs | 78 +++- .../ProductForms/PriceManageForm.resx | 3 + .../ProductForms/SaleStockUpForm.Designer.cs | 370 +++++++++--------- .../KJDForms/ProductForms/SaleStockUpForm.cs | 235 ++++++++--- .../ProductForms/SaleStockUpForm.resx | 6 + Work/Api/FromTitleToCat.cs | 16 +- Work/Api/UploadPinduoduoProperties.cs | 72 ++-- Work/CollectClass/LoadCloudData.cs | 102 ++--- Work/CollectClass/PinduoduoProductCollect.cs | 24 +- Work/Initialization.cs | 125 +++--- Work/ManageClass/AddressSetIni.cs | 67 ++-- 19 files changed, 865 insertions(+), 540 deletions(-) create mode 100644 AllBase/Model/Result/TemuGoodsQualityInfo.cs diff --git a/AllBase/AllBase.csproj b/AllBase/AllBase.csproj index c1440ce..787b229 100644 --- a/AllBase/AllBase.csproj +++ b/AllBase/AllBase.csproj @@ -196,6 +196,7 @@ + diff --git a/AllBase/Model/Result/TemuGoodsQualityInfo.cs b/AllBase/Model/Result/TemuGoodsQualityInfo.cs new file mode 100644 index 0000000..bd88dd6 --- /dev/null +++ b/AllBase/Model/Result/TemuGoodsQualityInfo.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AllBase.Model.Result +{ + public class TemuGoodsQualityInfo + { + /// + /// spuid + /// + public long? productId { get; set; } + + public long? goodsId { get; set; } + public string productName { get; set; } + public string carouselImageUrl { get; set; } + public long? cateId { get; set; } + public string categoryName { get; set; } + public decimal? goodsAfsScore { get; set; } + public decimal? qltyAfsOrdrRate { get; set; } + public int? qltyAfsOrdCnt { get; set; } + public decimal? sizeAfsOrdrRate { get; set; } + public decimal? largeSizeAfsOrdrRate { get; set; } + public decimal? smallSizeAfsOrdrRate { get; set; } + public decimal? sizeAfsOrdrCnt { get; set; } + public List problAfsItemList { get; set; } + public decimal? revCnt { get; set; } + public decimal? avgRevScr { get; set; } + public decimal? trueRevRate { get; set; } + public decimal? largeRevRate { get; set; } + public decimal? smallRevRate { get; set; } + public List problRevItemList { get; set; } + public List badKeywordsList { get; set; } + public object goodsOptimizeTask { get; set; } + } + + public class problAfsItem + { + public string problemName { get; set; } + public object matchHighlight { get; set; } + public int? quantity { get; set; } + } + public class problRevItem + { + public string problemName { get; set; } + public object matchHighlight { get; set; } + public int? quantity { get; set; } + } +} diff --git a/AllBase/Model/Result/TemuStockInfo.cs b/AllBase/Model/Result/TemuStockInfo.cs index 39b230d..a0c9a26 100644 --- a/AllBase/Model/Result/TemuStockInfo.cs +++ b/AllBase/Model/Result/TemuStockInfo.cs @@ -105,6 +105,8 @@ namespace AllBase.Model.Result /// 临时存储已创建备货单信息 /// public bool isStockUp { get; set; } = false; + + public decimal? goodsAfsScore { get; set; } = null; } /// diff --git a/KJDService/KJD_WebService/BLL/ProductManage.cs b/KJDService/KJD_WebService/BLL/ProductManage.cs index c4d33e4..98472ea 100644 --- a/KJDService/KJD_WebService/BLL/ProductManage.cs +++ b/KJDService/KJD_WebService/BLL/ProductManage.cs @@ -366,8 +366,8 @@ namespace KJD_Web.BLL sql += "update kjd.shop set add_product_remaining=" + add_product_remaining + " where shop_id=" + shop_id + ";"; sql += "update kjd.product set select_total_count=select_total_count+1 where id=" + out_product_Id + ";"; //sql += "update kjd.shop_add_prod_count set add_product_remaining=" + add_product_remaining + " where shop_id=" + shop_id + ";"; - //sql += "INSERT INTO kjd.shop_add_prod_count(shop_id, add_product_remaining) VALUES('" + shop_id + "'," + add_product_remaining + ")" + - // "ON DUPLICATE KEY UPDATE add_product_remaining=VALUES(add_product_remaining)"; + sql += "INSERT INTO kjd.shop_add_prod_count(shop_id, add_product_remaining) VALUES('" + shop_id + "'," + add_product_remaining + ")" + + "ON DUPLICATE KEY UPDATE add_product_remaining=VALUES(add_product_remaining)"; } var rst = mySql.ExecuteNonQuery(sql); mySql.Close(); diff --git a/KJDService/KJD_WebService/BLL/ProductThirdManage.cs b/KJDService/KJD_WebService/BLL/ProductThirdManage.cs index 2eb34c6..5bced21 100644 --- a/KJDService/KJD_WebService/BLL/ProductThirdManage.cs +++ b/KJDService/KJD_WebService/BLL/ProductThirdManage.cs @@ -317,8 +317,8 @@ namespace KJD_Web.BLL sql += "\r\n"; sql += "update kjd.shop set add_product_remaining=" + add_product_remaining + " where shop_id=" + shop_id + ";"; //sql += "update kjd.shop_add_prod_count set add_product_remaining=" + add_product_remaining + " where shop_id=" + shop_id + ";"; - //sql += "INSERT INTO kjd.shop_add_prod_count(shop_id, add_product_remaining) VALUES('" + shop_id + "'," + add_product_remaining + ")" + - // "ON DUPLICATE KEY UPDATE add_product_remaining=VALUES(add_product_remaining)"; + sql += "INSERT INTO kjd.shop_add_prod_count(shop_id, add_product_remaining) VALUES('" + shop_id + "'," + add_product_remaining + ")" + + "ON DUPLICATE KEY UPDATE add_product_remaining=VALUES(add_product_remaining)"; } var rst = mySql.ExecuteNonQuery(sql); mySql.Close(); diff --git a/KJDService/KJD_WebService/BLL/ShopManage.cs b/KJDService/KJD_WebService/BLL/ShopManage.cs index 3a7ed82..47939a7 100644 --- a/KJDService/KJD_WebService/BLL/ShopManage.cs +++ b/KJDService/KJD_WebService/BLL/ShopManage.cs @@ -76,12 +76,11 @@ namespace KJD_Web.BLL } else { - // LEFT JOIN kjd.product_select s ON p.id=s.out_product_id sql = "SELECT s.id,s.login_name,s.login_pass,s.cookie,s.cookie2,s.shop_id,s.shop_account,s.sub_user_name,s.user_name," + - "s.company_name,s.notes,s.login_status,s.login_status2,s.add_product_remaining,s.add_product_month,s.add_time,s.mdy_time," + + "s.company_name,s.notes,s.login_status,s.login_status2,c.add_product_remaining,c.add_product_month,s.add_time,s.mdy_time," + "s.add_sub_sa_time,s.operate_sub_sa_name"; - sql += " FROM kjd.shop s WHERE 1=1"; - //sql += " FROM kjd.shop s LEFT JOIN kjd.shop_add_prod_count c ON s.shop_id=c.shop_id WHERE 1=1"; + //sql += " FROM kjd.shop s WHERE 1=1"; + sql += " FROM kjd.shop s LEFT JOIN kjd.shop_add_prod_count c ON s.shop_id=c.shop_id WHERE 1=1"; sql += where; // where 子句 @@ -118,6 +117,20 @@ namespace KJD_Web.BLL }; shopList.Add(shop); } + + //sql = "\r\nINSERT INTO kjd.shop_add_prod_count(shop_id,shop_account,add_product_remaining,add_product_month) VALUES "; + //foreach (var shop in shopList) + //{ + // sql += "\r\n('" + shop.shop_id + "','" + shop.shop_account + "'," + shop.add_product_remaining + "," + shop.add_product_month + "),"; + //} + //sql = sql.TrimEnd(',') + " \r\n"; + //sql += "ON DUPLICATE KEY UPDATE " + + // "shop_account=VALUES(shop_account)," + + // "add_product_remaining=VALUES(add_product_remaining)," + + // "add_product_month=VALUES(add_product_month);"; + //var result = mySql.ExecuteNonQuery(sql); + //mySql.Close(); + int month = DateTime.Now.Month; var shopMonthList = shopList.Where(s => s.add_product_month != month); if (shopMonthList.Count() > 0) @@ -130,16 +143,16 @@ namespace KJD_Web.BLL sql += "update kjd.shop set add_product_remaining=" + remainCount + ", add_product_month=" + month + " where 1=1 and id in (" + ids + ");"; - //sql += "\r\nINSERT INTO kjd.shop_add_prod_count(shop_id,shop_account,add_product_remaining,add_product_month) VALUES "; - //foreach (var shop in shopList) - //{ - //sql+= "\r\n('" + shop.shop_id + "','" + shop.shop_account + "'," + remainCount + "," + month + "),"; - //} - //sql = sql.TrimEnd(',') + " \r\n"; - //sql += "ON DUPLICATE KEY UPDATE " + - //"shop_account=VALUES(shop_account)," + - //"add_product_remaining=VALUES(add_product_remaining)," + - //"add_product_month=VALUES(add_product_month);"; + sql += "\r\nINSERT INTO kjd.shop_add_prod_count(shop_id,shop_account,add_product_remaining,add_product_month) VALUES "; + foreach (var shop in shopMonthList) + { + sql+= "\r\n('" + shop.shop_id + "','" + shop.shop_account + "'," + remainCount + "," + month + "),"; + } + sql = sql.TrimEnd(',') + " \r\n"; + sql += "ON DUPLICATE KEY UPDATE " + + "shop_account=VALUES(shop_account)," + + "add_product_remaining=VALUES(add_product_remaining)," + + "add_product_month=VALUES(add_product_month);"; var rst = mySql.ExecuteNonQuery(sql); mySql.Close(); diff --git a/TEMUKJD/InitForm.cs b/TEMUKJD/InitForm.cs index c9b2565..2383a5f 100644 --- a/TEMUKJD/InitForm.cs +++ b/TEMUKJD/InitForm.cs @@ -26,15 +26,17 @@ namespace TemuKJD { Task.Run(() => { - while (!Work.Initialization.IsCheckFilesFinish || !Program.IsInit) + while (!Work.Initialization.IsCheckFilesFinish || !Program.IsInit || this.progressBarX1.Value < 50) { - Thread.Sleep(10); + Thread.Sleep(new Random().Next(10, 50)); Invoke(new Action(() => { - this.progressBarX1.Value = Work.Initialization.InitPercent; + this.progressBarX1.Value = Work.Initialization.InitPercent++; this.progressBarX1.Maximum = 50; })); + if (this.progressBarX1.Value >= 50) + Thread.Sleep(300); } Invoke(new Action(() => { diff --git a/TEMUKJD/KJDForms/ProductForms/PriceManageForm.Designer.cs b/TEMUKJD/KJDForms/ProductForms/PriceManageForm.Designer.cs index 36c496b..df11bae 100644 --- a/TEMUKJD/KJDForms/ProductForms/PriceManageForm.Designer.cs +++ b/TEMUKJD/KJDForms/ProductForms/PriceManageForm.Designer.cs @@ -56,10 +56,15 @@ namespace TemuKJD.KJDForms.ProductForms this.colCanUse = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.colMessage = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.dgvAdjust = new TemuKJD.UserComponent.DataGridViewEx(); + this.splitContainer4 = new System.Windows.Forms.SplitContainer(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); + this.panelEx1 = new DevComponents.DotNetBar.PanelEx(); + this.btnClear = new DevComponents.DotNetBar.PanelEx(); this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colPriceOrderSn = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colProductSkcPic = new System.Windows.Forms.DataGridViewImageColumn(); this.colProductId = new System.Windows.Forms.DataGridViewLinkColumn(); this.colProdSkc = new System.Windows.Forms.DataGridViewLinkColumn(); @@ -72,10 +77,6 @@ namespace TemuKJD.KJDForms.ProductForms this.colChangeType = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colChangeReason = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colMsg = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.splitContainer4 = new System.Windows.Forms.SplitContainer(); - this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); - this.panelEx1 = new DevComponents.DotNetBar.PanelEx(); - this.btnClear = new DevComponents.DotNetBar.PanelEx(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -427,6 +428,7 @@ namespace TemuKJD.KJDForms.ProductForms this.colSupplierId, this.colSupplierName, this.colPriceOrderSn, + this.colImgUrl, this.colProductSkcPic, this.colProductId, this.colProdSkc, @@ -447,6 +449,87 @@ namespace TemuKJD.KJDForms.ProductForms this.dgvAdjust.Size = new System.Drawing.Size(822, 443); this.dgvAdjust.TabIndex = 187; this.dgvAdjust.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvStock_CellContentClick); + this.dgvAdjust.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dgvAdjust_Scroll); + // + // splitContainer4 + // + this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer4.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; + this.splitContainer4.Location = new System.Drawing.Point(0, 0); + this.splitContainer4.Name = "splitContainer4"; + // + // splitContainer4.Panel1 + // + this.splitContainer4.Panel1.Controls.Add(this.statusBar); + // + // splitContainer4.Panel2 + // + this.splitContainer4.Panel2.Controls.Add(this.panelEx1); + this.splitContainer4.Panel2.Controls.Add(this.btnClear); + this.splitContainer4.Size = new System.Drawing.Size(1110, 26); + this.splitContainer4.SplitterDistance = 832; + this.splitContainer4.TabIndex = 3; + // + // statusBar + // + this.statusBar.BackColor = System.Drawing.Color.White; + this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill; + this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.statusBar.Location = new System.Drawing.Point(0, 0); + this.statusBar.Margin = new System.Windows.Forms.Padding(0); + this.statusBar.Name = "statusBar"; + this.statusBar.Size = new System.Drawing.Size(832, 26); + this.statusBar.TabIndex = 2; + // + // panelEx1 + // + this.panelEx1.CanvasColor = System.Drawing.SystemColors.Control; + this.panelEx1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.panelEx1.DisabledBackColor = System.Drawing.Color.Empty; + this.panelEx1.Location = new System.Drawing.Point(155, 0); + this.panelEx1.Name = "panelEx1"; + this.panelEx1.Size = new System.Drawing.Size(115, 21); + this.panelEx1.Style.Alignment = System.Drawing.StringAlignment.Center; + this.panelEx1.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.panelEx1.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.panelEx1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.panelEx1.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.panelEx1.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.panelEx1.Style.GradientAngle = 90; + this.panelEx1.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; + this.panelEx1.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.panelEx1.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.panelEx1.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.panelEx1.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; + this.panelEx1.TabIndex = 668; + this.panelEx1.Text = "停止当前操作"; + this.panelEx1.Click += new System.EventHandler(this.panelEx1_Click); + // + // btnClear + // + this.btnClear.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.btnClear.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnClear.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnClear.DisabledBackColor = System.Drawing.Color.Empty; + this.btnClear.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnClear.Location = new System.Drawing.Point(47, 0); + this.btnClear.Name = "btnClear"; + this.btnClear.Size = new System.Drawing.Size(90, 21); + this.btnClear.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnClear.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnClear.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnClear.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnClear.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnClear.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnClear.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnClear.Style.GradientAngle = 90; + this.btnClear.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnClear.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnClear.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnClear.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; + this.btnClear.TabIndex = 440; + this.btnClear.Text = "清空结果"; + this.btnClear.Visible = false; // // colCheck // @@ -479,13 +562,19 @@ namespace TemuKJD.KJDForms.ProductForms this.colPriceOrderSn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; this.colPriceOrderSn.Width = 125; // + // colImgUrl + // + this.colImgUrl.HeaderText = "图片路径"; + this.colImgUrl.Name = "colImgUrl"; + this.colImgUrl.ReadOnly = true; + this.colImgUrl.Visible = false; + // // colProductSkcPic // this.colProductSkcPic.HeaderText = "Skc图片"; this.colProductSkcPic.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; this.colProductSkcPic.Name = "colProductSkcPic"; this.colProductSkcPic.ReadOnly = true; - this.colProductSkcPic.Visible = false; this.colProductSkcPic.Width = 60; // // colProductId @@ -570,86 +659,6 @@ namespace TemuKJD.KJDForms.ProductForms this.colMsg.ReadOnly = true; this.colMsg.Width = 400; // - // splitContainer4 - // - this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer4.FixedPanel = System.Windows.Forms.FixedPanel.Panel2; - this.splitContainer4.Location = new System.Drawing.Point(0, 0); - this.splitContainer4.Name = "splitContainer4"; - // - // splitContainer4.Panel1 - // - this.splitContainer4.Panel1.Controls.Add(this.statusBar); - // - // splitContainer4.Panel2 - // - this.splitContainer4.Panel2.Controls.Add(this.panelEx1); - this.splitContainer4.Panel2.Controls.Add(this.btnClear); - this.splitContainer4.Size = new System.Drawing.Size(1110, 26); - this.splitContainer4.SplitterDistance = 832; - this.splitContainer4.TabIndex = 3; - // - // statusBar - // - this.statusBar.BackColor = System.Drawing.Color.White; - this.statusBar.Dock = System.Windows.Forms.DockStyle.Fill; - this.statusBar.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.statusBar.Location = new System.Drawing.Point(0, 0); - this.statusBar.Margin = new System.Windows.Forms.Padding(0); - this.statusBar.Name = "statusBar"; - this.statusBar.Size = new System.Drawing.Size(832, 26); - this.statusBar.TabIndex = 2; - // - // panelEx1 - // - this.panelEx1.CanvasColor = System.Drawing.SystemColors.Control; - this.panelEx1.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.panelEx1.DisabledBackColor = System.Drawing.Color.Empty; - this.panelEx1.Location = new System.Drawing.Point(155, 0); - this.panelEx1.Name = "panelEx1"; - this.panelEx1.Size = new System.Drawing.Size(115, 21); - this.panelEx1.Style.Alignment = System.Drawing.StringAlignment.Center; - this.panelEx1.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); - this.panelEx1.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); - this.panelEx1.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.panelEx1.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.panelEx1.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.panelEx1.Style.GradientAngle = 90; - this.panelEx1.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; - this.panelEx1.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.panelEx1.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.panelEx1.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.panelEx1.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; - this.panelEx1.TabIndex = 668; - this.panelEx1.Text = "停止当前操作"; - this.panelEx1.Click += new System.EventHandler(this.panelEx1_Click); - // - // btnClear - // - this.btnClear.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.btnClear.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.btnClear.Cursor = System.Windows.Forms.Cursors.Hand; - this.btnClear.DisabledBackColor = System.Drawing.Color.Empty; - this.btnClear.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnClear.Location = new System.Drawing.Point(47, 0); - this.btnClear.Name = "btnClear"; - this.btnClear.Size = new System.Drawing.Size(90, 21); - this.btnClear.Style.Alignment = System.Drawing.StringAlignment.Center; - this.btnClear.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnClear.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnClear.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.btnClear.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; - this.btnClear.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; - this.btnClear.Style.ForeColor.Color = System.Drawing.Color.White; - this.btnClear.Style.GradientAngle = 90; - this.btnClear.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.btnClear.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnClear.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.btnClear.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; - this.btnClear.TabIndex = 440; - this.btnClear.Text = "清空结果"; - this.btnClear.Visible = false; - // // PriceManageForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -708,10 +717,19 @@ namespace TemuKJD.KJDForms.ProductForms private System.Windows.Forms.TextBox txtScale1; private System.Windows.Forms.Label label10; private System.Windows.Forms.CheckBox chkHasSuccess; + private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect; + private System.Windows.Forms.DataGridViewTextBoxColumn colShopLoginName; + private System.Windows.Forms.DataGridViewTextBoxColumn colShopId; + private System.Windows.Forms.DataGridViewTextBoxColumn colShopName; + private System.Windows.Forms.DataGridViewTextBoxColumn colShopNotes; + private System.Windows.Forms.DataGridViewTextBoxColumn colLoginStatus; + private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse; + private System.Windows.Forms.DataGridViewTextBoxColumn colMessage; private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck; private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName; private System.Windows.Forms.DataGridViewLinkColumn colPriceOrderSn; + private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl; private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic; private System.Windows.Forms.DataGridViewLinkColumn colProductId; private System.Windows.Forms.DataGridViewLinkColumn colProdSkc; @@ -724,13 +742,5 @@ namespace TemuKJD.KJDForms.ProductForms private System.Windows.Forms.DataGridViewTextBoxColumn colChangeType; private System.Windows.Forms.DataGridViewTextBoxColumn colChangeReason; private System.Windows.Forms.DataGridViewTextBoxColumn colMsg; - private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect; - private System.Windows.Forms.DataGridViewTextBoxColumn colShopLoginName; - private System.Windows.Forms.DataGridViewTextBoxColumn colShopId; - private System.Windows.Forms.DataGridViewTextBoxColumn colShopName; - private System.Windows.Forms.DataGridViewTextBoxColumn colShopNotes; - private System.Windows.Forms.DataGridViewTextBoxColumn colLoginStatus; - private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse; - private System.Windows.Forms.DataGridViewTextBoxColumn colMessage; } } \ No newline at end of file diff --git a/TEMUKJD/KJDForms/ProductForms/PriceManageForm.cs b/TEMUKJD/KJDForms/ProductForms/PriceManageForm.cs index 8e59243..f49fe8f 100644 --- a/TEMUKJD/KJDForms/ProductForms/PriceManageForm.cs +++ b/TEMUKJD/KJDForms/ProductForms/PriceManageForm.cs @@ -291,6 +291,7 @@ namespace TemuKJD.KJDForms.ProductForms if (jsonStr.Contains("当前操作人数太多,请稍后重试") && tryCount < 5) { tryCount++; + Thread.Sleep(Randomx.GetId(500,1000)); goto tryAgain; } if (jsonStr.Contains("当前操作人数太多,请稍后重试")) @@ -306,6 +307,7 @@ namespace TemuKJD.KJDForms.ProductForms continue; } + string snTag = BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now).ToString(); if (jsonStr.Contains("\"success\":true")) { var jArr = new JArray(); @@ -323,6 +325,7 @@ namespace TemuKJD.KJDForms.ProductForms TemuPriceAdjustInfo pInfo = JsonHelper.DeserializeJsonToObject(sItem); // 反序列化得到类 if (pInfo != null && !lstPriceAdjustInfo.Any(a=>a.priceOrderSn == pInfo.priceOrderSn)) { + pInfo.snTag = snTag; lstPriceAdjustInfo.Add(pInfo); //string url = pInfo.image.Replace("https", "http"); @@ -335,7 +338,8 @@ namespace TemuKJD.KJDForms.ProductForms pInfo.supplierId, shop.ShopAccount, // pInfo.supplierName, // 列表里取不到,这里取shop里的 pInfo.priceOrderSn, - null,//image, // skc图片 + pInfo.image.Replace("https", "http"), + defaultBitmap,//image, // skc图片 pInfo.productId, pInfo.skcId, pInfo.productName + "\r\n" + pInfo.skuSpecs, // 商品标题+sku名称 @@ -353,6 +357,10 @@ namespace TemuKJD.KJDForms.ProductForms })); } } + Invoke(new Action(() => + { + ShowDgvImg(); + })); int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt(); totalPage = Math.Ceiling(total / 10.0).ParseToInt(); @@ -513,8 +521,13 @@ namespace TemuKJD.KJDForms.ProductForms Thread.Sleep(200 + Randomx.GetId(100)); //var adjustLst = lstPriceAdjustInfo.Where(a => a.skuIds == priceAdjust.skuIds && a.isRefuseAdjust == false).ToList(); - var adjustLst = lstPriceAdjustInfo.Where(a => - priceAdjust.skuInfoItemList.Any(sku => a.skuIds.Contains(sku.productSkuId.ToString())) && a.isRefuseAdjust == false).ToList(); + //var adjustLst = lstPriceAdjustInfo.Where(a => + // priceAdjust.skuInfoItemList.Any(sku => a.skuIds.Contains(sku.productSkuId.ToString())) && a.isRefuseAdjust == false).ToList(); + // 同一页的一起提交 + var adjustLst = lstPriceAdjustInfo.Where(a => + a.snTag == priceAdjust.snTag && // 选中商品的同页商品 + lstPriceAdjust.Any(s => s.skcId == a.skcId) && // 该商品也需要有同skc商品被选中 + a.isRefuseAdjust == false).ToList(); // 没有被取消调价过 var adjustStrLst = adjustLst.Select(s => s.id.ParseToString()).ToList(); @@ -526,6 +539,13 @@ namespace TemuKJD.KJDForms.ProductForms foreach(var adj in adjustLst) { adj.isRefuseAdjust = true; + var rs = this.dgvAdjust.Rows.Cast().Where(r => + r.Cells["colPriceOrderSn"].Value.ToString() == adj.priceOrderSn.ParseToString()); + Invoke(new Action(() => + { + foreach(var r in rs) + r.Cells["colMsg"].Value = "已拒绝跟价"; + })); } } @@ -598,5 +618,57 @@ namespace TemuKJD.KJDForms.ProductForms break; } } + + Bitmap defaultBitmap = new Bitmap(80, 80); + void ShowDgvImg() + { + Task.Run(() => + { + foreach (DataGridViewRow row in this.dgvAdjust.Rows) + { + if (row.Index > 0 && row.Cells["colProductSkcPic"].Displayed == false) + { + try + { + Invoke(new Action(() => + { + row.Cells["colProductSkcPic"].Value = defaultBitmap; + })); + } + catch + { + } + continue; + } + + if (row.Cells["colProductSkcPic"].Value != null && row.Cells["colProductSkcPic"].Value != defaultBitmap) + continue; + + Image image = null; + string imgUrl = row.Cells["colImgUrl"]?.Value.ParseToString(); + string getImgError = ""; + if (!string.IsNullOrWhiteSpace(imgUrl)) + image = GetHtml.GetUrlImg(imgUrl, out getImgError); + if (!string.IsNullOrEmpty(getImgError)) + BaseMsgForm.ShowError(getImgError); + + try + { + Invoke(new Action(() => + { + row.Cells["colProductSkcPic"].Value = image; + })); + } + catch + { + } + } + }); + } + + private void dgvAdjust_Scroll(object sender, ScrollEventArgs e) + { + ShowDgvImg(); + } } } diff --git a/TEMUKJD/KJDForms/ProductForms/PriceManageForm.resx b/TEMUKJD/KJDForms/ProductForms/PriceManageForm.resx index 3bf412f..e2dd73d 100644 --- a/TEMUKJD/KJDForms/ProductForms/PriceManageForm.resx +++ b/TEMUKJD/KJDForms/ProductForms/PriceManageForm.resx @@ -150,6 +150,9 @@ True + + True + True diff --git a/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.Designer.cs b/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.Designer.cs index ae7498f..d58396c 100644 --- a/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.Designer.cs +++ b/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.Designer.cs @@ -117,12 +117,17 @@ namespace TemuKJD.KJDForms.ProductForms this.btnStopAdd = new DevComponents.DotNetBar.PanelEx(); this.chkLimited = new System.Windows.Forms.CheckBox(); this.dgvStock = new TemuKJD.UserComponent.DataGridViewEx(); + this.splitContainer4 = new System.Windows.Forms.SplitContainer(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); + this.panelEx1 = new DevComponents.DotNetBar.PanelEx(); + this.btnClear = new DevComponents.DotNetBar.PanelEx(); this.colUpId = new System.Windows.Forms.DataGridViewLinkColumn(); this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colStockId = new System.Windows.Forms.DataGridViewLinkColumn(); this.colParentStockId = new System.Windows.Forms.DataGridViewLinkColumn(); + this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colProductSkcPic = new System.Windows.Forms.DataGridViewImageColumn(); this.colProductId = new System.Windows.Forms.DataGridViewLinkColumn(); this.colProdSkc = new System.Windows.Forms.DataGridViewLinkColumn(); @@ -134,12 +139,9 @@ namespace TemuKJD.KJDForms.ProductForms this.colTodaySaleVolume = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSalesInventoryNum = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colWaitReceiveNum = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colQualityScore = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colNeedStockUp = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colMsg = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.splitContainer4 = new System.Windows.Forms.SplitContainer(); - this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); - this.panelEx1 = new DevComponents.DotNetBar.PanelEx(); - this.btnClear = new DevComponents.DotNetBar.PanelEx(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -1334,6 +1336,7 @@ namespace TemuKJD.KJDForms.ProductForms this.colSupplierName, this.colStockId, this.colParentStockId, + this.colImgUrl, this.colProductSkcPic, this.colProductId, this.colProdSkc, @@ -1345,6 +1348,7 @@ namespace TemuKJD.KJDForms.ProductForms this.colTodaySaleVolume, this.colSalesInventoryNum, this.colWaitReceiveNum, + this.colQualityScore, this.colNeedStockUp, this.colMsg}); this.dgvStock.Dock = System.Windows.Forms.DockStyle.Fill; @@ -1355,159 +1359,7 @@ namespace TemuKJD.KJDForms.ProductForms this.dgvStock.Size = new System.Drawing.Size(860, 435); this.dgvStock.TabIndex = 187; this.dgvStock.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvStock_CellContentClick); - // - // colUpId - // - this.colUpId.HeaderText = "上家Id"; - this.colUpId.Name = "colUpId"; - this.colUpId.ReadOnly = true; - this.colUpId.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colUpId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colUpId.Visible = false; - this.colUpId.Width = 95; - // - // colCheck - // - this.colCheck.HeaderText = "选择"; - this.colCheck.Name = "colCheck"; - this.colCheck.ReadOnly = true; - this.colCheck.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colCheck.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colCheck.Width = 30; - // - // colSupplierId - // - this.colSupplierId.HeaderText = "店铺Id"; - this.colSupplierId.Name = "colSupplierId"; - this.colSupplierId.ReadOnly = true; - // - // colSupplierName - // - this.colSupplierName.HeaderText = "店铺名称"; - this.colSupplierName.Name = "colSupplierName"; - this.colSupplierName.ReadOnly = true; - this.colSupplierName.Width = 110; - // - // colStockId - // - this.colStockId.HeaderText = "备货单号"; - this.colStockId.Name = "colStockId"; - this.colStockId.ReadOnly = true; - this.colStockId.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colStockId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colStockId.Width = 120; - // - // colParentStockId - // - this.colParentStockId.HeaderText = "备货母单号"; - this.colParentStockId.Name = "colParentStockId"; - this.colParentStockId.ReadOnly = true; - this.colParentStockId.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colParentStockId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colParentStockId.Width = 120; - // - // colProductSkcPic - // - this.colProductSkcPic.HeaderText = "Skc图片"; - this.colProductSkcPic.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; - this.colProductSkcPic.Name = "colProductSkcPic"; - this.colProductSkcPic.ReadOnly = true; - this.colProductSkcPic.Visible = false; - this.colProductSkcPic.Width = 60; - // - // colProductId - // - this.colProductId.HeaderText = "商品Id"; - this.colProductId.Name = "colProductId"; - this.colProductId.ReadOnly = true; - this.colProductId.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colProductId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colProductId.Visible = false; - // - // colProdSkc - // - this.colProdSkc.FillWeight = 150F; - this.colProdSkc.HeaderText = "商品SKC"; - this.colProdSkc.Name = "colProdSkc"; - this.colProdSkc.ReadOnly = true; - this.colProdSkc.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colProdSkc.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colProdSkc.Width = 90; - // - // colProdName - // - this.colProdName.HeaderText = "标题"; - this.colProdName.Name = "colProdName"; - this.colProdName.ReadOnly = true; - this.colProdName.Width = 200; - // - // colPrcie - // - this.colPrcie.HeaderText = "价格"; - this.colPrcie.Name = "colPrcie"; - this.colPrcie.ReadOnly = true; - this.colPrcie.Visible = false; - // - // colFrom - // - this.colFrom.HeaderText = "来源"; - this.colFrom.Name = "colFrom"; - this.colFrom.ReadOnly = true; - this.colFrom.Visible = false; - // - // colFromFake - // - this.colFromFake.HeaderText = "来源"; - this.colFromFake.Name = "colFromFake"; - this.colFromFake.ReadOnly = true; - this.colFromFake.Visible = false; - // - // colInCartNumber7d - // - this.colInCartNumber7d.HeaderText = "近七日加购"; - this.colInCartNumber7d.Name = "colInCartNumber7d"; - this.colInCartNumber7d.ReadOnly = true; - this.colInCartNumber7d.Visible = false; - this.colInCartNumber7d.Width = 75; - // - // colTodaySaleVolume - // - this.colTodaySaleVolume.HeaderText = "今日销量"; - this.colTodaySaleVolume.Name = "colTodaySaleVolume"; - this.colTodaySaleVolume.ReadOnly = true; - this.colTodaySaleVolume.Visible = false; - this.colTodaySaleVolume.Width = 70; - // - // colSalesInventoryNum - // - this.colSalesInventoryNum.HeaderText = "仓库可用库存"; - this.colSalesInventoryNum.Name = "colSalesInventoryNum"; - this.colSalesInventoryNum.ReadOnly = true; - this.colSalesInventoryNum.Visible = false; - this.colSalesInventoryNum.Width = 90; - // - // colWaitReceiveNum - // - this.colWaitReceiveNum.HeaderText = "已发货库存"; - this.colWaitReceiveNum.Name = "colWaitReceiveNum"; - this.colWaitReceiveNum.ReadOnly = true; - this.colWaitReceiveNum.Visible = false; - this.colWaitReceiveNum.Width = 75; - // - // colNeedStockUp - // - this.colNeedStockUp.HeaderText = "是否需备货"; - this.colNeedStockUp.Name = "colNeedStockUp"; - this.colNeedStockUp.ReadOnly = true; - this.colNeedStockUp.Visible = false; - this.colNeedStockUp.Width = 75; - // - // colMsg - // - this.colMsg.HeaderText = "状态"; - this.colMsg.Name = "colMsg"; - this.colMsg.ReadOnly = true; - this.colMsg.Width = 400; + this.dgvStock.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dgvStock_Scroll); // // splitContainer4 // @@ -1589,6 +1441,170 @@ namespace TemuKJD.KJDForms.ProductForms this.btnClear.Text = "清空结果"; this.btnClear.Visible = false; // + // colUpId + // + this.colUpId.HeaderText = "上家Id"; + this.colUpId.Name = "colUpId"; + this.colUpId.ReadOnly = true; + this.colUpId.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colUpId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colUpId.Visible = false; + this.colUpId.Width = 95; + // + // colCheck + // + this.colCheck.HeaderText = "选择"; + this.colCheck.Name = "colCheck"; + this.colCheck.ReadOnly = true; + this.colCheck.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colCheck.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colCheck.Width = 30; + // + // colSupplierId + // + this.colSupplierId.HeaderText = "店铺Id"; + this.colSupplierId.Name = "colSupplierId"; + this.colSupplierId.ReadOnly = true; + // + // colSupplierName + // + this.colSupplierName.HeaderText = "店铺名称"; + this.colSupplierName.Name = "colSupplierName"; + this.colSupplierName.ReadOnly = true; + this.colSupplierName.Width = 110; + // + // colStockId + // + this.colStockId.HeaderText = "备货单号"; + this.colStockId.Name = "colStockId"; + this.colStockId.ReadOnly = true; + this.colStockId.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colStockId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colStockId.Width = 120; + // + // colParentStockId + // + this.colParentStockId.HeaderText = "备货母单号"; + this.colParentStockId.Name = "colParentStockId"; + this.colParentStockId.ReadOnly = true; + this.colParentStockId.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colParentStockId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colParentStockId.Width = 120; + // + // colImgUrl + // + this.colImgUrl.HeaderText = "图片路径"; + this.colImgUrl.Name = "colImgUrl"; + this.colImgUrl.ReadOnly = true; + this.colImgUrl.Visible = false; + // + // colProductSkcPic + // + this.colProductSkcPic.HeaderText = "Skc图片"; + this.colProductSkcPic.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; + this.colProductSkcPic.Name = "colProductSkcPic"; + this.colProductSkcPic.ReadOnly = true; + this.colProductSkcPic.Width = 60; + // + // colProductId + // + this.colProductId.HeaderText = "商品Id"; + this.colProductId.Name = "colProductId"; + this.colProductId.ReadOnly = true; + this.colProductId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + // + // colProdSkc + // + this.colProdSkc.FillWeight = 150F; + this.colProdSkc.HeaderText = "商品SKC"; + this.colProdSkc.Name = "colProdSkc"; + this.colProdSkc.ReadOnly = true; + this.colProdSkc.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colProdSkc.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colProdSkc.Width = 90; + // + // colProdName + // + this.colProdName.HeaderText = "标题"; + this.colProdName.Name = "colProdName"; + this.colProdName.ReadOnly = true; + this.colProdName.Width = 200; + // + // colPrcie + // + this.colPrcie.HeaderText = "价格"; + this.colPrcie.Name = "colPrcie"; + this.colPrcie.ReadOnly = true; + this.colPrcie.Visible = false; + // + // colFrom + // + this.colFrom.HeaderText = "来源"; + this.colFrom.Name = "colFrom"; + this.colFrom.ReadOnly = true; + this.colFrom.Visible = false; + // + // colFromFake + // + this.colFromFake.HeaderText = "来源"; + this.colFromFake.Name = "colFromFake"; + this.colFromFake.ReadOnly = true; + this.colFromFake.Visible = false; + // + // colInCartNumber7d + // + this.colInCartNumber7d.HeaderText = "近七日加购"; + this.colInCartNumber7d.Name = "colInCartNumber7d"; + this.colInCartNumber7d.ReadOnly = true; + this.colInCartNumber7d.Visible = false; + this.colInCartNumber7d.Width = 75; + // + // colTodaySaleVolume + // + this.colTodaySaleVolume.HeaderText = "今日销量"; + this.colTodaySaleVolume.Name = "colTodaySaleVolume"; + this.colTodaySaleVolume.ReadOnly = true; + this.colTodaySaleVolume.Visible = false; + this.colTodaySaleVolume.Width = 70; + // + // colSalesInventoryNum + // + this.colSalesInventoryNum.HeaderText = "仓库可用库存"; + this.colSalesInventoryNum.Name = "colSalesInventoryNum"; + this.colSalesInventoryNum.ReadOnly = true; + this.colSalesInventoryNum.Visible = false; + this.colSalesInventoryNum.Width = 90; + // + // colWaitReceiveNum + // + this.colWaitReceiveNum.HeaderText = "已发货库存"; + this.colWaitReceiveNum.Name = "colWaitReceiveNum"; + this.colWaitReceiveNum.ReadOnly = true; + this.colWaitReceiveNum.Visible = false; + this.colWaitReceiveNum.Width = 75; + // + // colQualityScore + // + this.colQualityScore.HeaderText = "品质分"; + this.colQualityScore.Name = "colQualityScore"; + this.colQualityScore.ReadOnly = true; + this.colQualityScore.Width = 60; + // + // colNeedStockUp + // + this.colNeedStockUp.HeaderText = "是否需备货"; + this.colNeedStockUp.Name = "colNeedStockUp"; + this.colNeedStockUp.ReadOnly = true; + this.colNeedStockUp.Visible = false; + this.colNeedStockUp.Width = 75; + // + // colMsg + // + this.colMsg.HeaderText = "状态"; + this.colMsg.Name = "colMsg"; + this.colMsg.ReadOnly = true; + this.colMsg.Width = 400; + // // SaleStockUpForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -1716,25 +1732,6 @@ namespace TemuKJD.KJDForms.ProductForms private System.Windows.Forms.TextBox txtScale2; private System.Windows.Forms.Label label14; private DevComponents.DotNetBar.PanelEx panelEx1; - private System.Windows.Forms.DataGridViewLinkColumn colUpId; - private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck; - private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; - private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName; - private System.Windows.Forms.DataGridViewLinkColumn colStockId; - private System.Windows.Forms.DataGridViewLinkColumn colParentStockId; - private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic; - private System.Windows.Forms.DataGridViewLinkColumn colProductId; - private System.Windows.Forms.DataGridViewLinkColumn colProdSkc; - private System.Windows.Forms.DataGridViewTextBoxColumn colProdName; - private System.Windows.Forms.DataGridViewTextBoxColumn colPrcie; - private System.Windows.Forms.DataGridViewTextBoxColumn colFrom; - private System.Windows.Forms.DataGridViewTextBoxColumn colFromFake; - private System.Windows.Forms.DataGridViewTextBoxColumn colInCartNumber7d; - private System.Windows.Forms.DataGridViewTextBoxColumn colTodaySaleVolume; - private System.Windows.Forms.DataGridViewTextBoxColumn colSalesInventoryNum; - private System.Windows.Forms.DataGridViewTextBoxColumn colWaitReceiveNum; - private System.Windows.Forms.DataGridViewTextBoxColumn colNeedStockUp; - private System.Windows.Forms.DataGridViewTextBoxColumn colMsg; private System.Windows.Forms.TextBox txtMinBound; private System.Windows.Forms.Label label15; private System.Windows.Forms.Label lblMinBound; @@ -1752,5 +1749,26 @@ namespace TemuKJD.KJDForms.ProductForms private System.Windows.Forms.DataGridViewTextBoxColumn colLoginStatus; private System.Windows.Forms.DataGridViewCheckBoxColumn colCanUse; private System.Windows.Forms.DataGridViewTextBoxColumn colMessage; + private System.Windows.Forms.DataGridViewLinkColumn colUpId; + private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck; + private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; + private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName; + private System.Windows.Forms.DataGridViewLinkColumn colStockId; + private System.Windows.Forms.DataGridViewLinkColumn colParentStockId; + private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl; + private System.Windows.Forms.DataGridViewImageColumn colProductSkcPic; + private System.Windows.Forms.DataGridViewLinkColumn colProductId; + private System.Windows.Forms.DataGridViewLinkColumn colProdSkc; + private System.Windows.Forms.DataGridViewTextBoxColumn colProdName; + private System.Windows.Forms.DataGridViewTextBoxColumn colPrcie; + private System.Windows.Forms.DataGridViewTextBoxColumn colFrom; + private System.Windows.Forms.DataGridViewTextBoxColumn colFromFake; + private System.Windows.Forms.DataGridViewTextBoxColumn colInCartNumber7d; + private System.Windows.Forms.DataGridViewTextBoxColumn colTodaySaleVolume; + private System.Windows.Forms.DataGridViewTextBoxColumn colSalesInventoryNum; + private System.Windows.Forms.DataGridViewTextBoxColumn colWaitReceiveNum; + private System.Windows.Forms.DataGridViewTextBoxColumn colQualityScore; + private System.Windows.Forms.DataGridViewTextBoxColumn colNeedStockUp; + private System.Windows.Forms.DataGridViewTextBoxColumn colMsg; } } \ No newline at end of file diff --git a/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.cs b/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.cs index 5df9a3e..fb1eec9 100644 --- a/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.cs +++ b/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.cs @@ -165,7 +165,7 @@ namespace TemuKJD.KJDForms.ProductForms col.Visible = true; } if (col.Name == "colTodaySaleVolume" || col.Name == "colInCartNumber7d" || col.Name == "colSalesInventoryNum" - || col.Name == "colWaitReceiveNum" || col.Name == "colNeedStockUp") + || col.Name == "colWaitReceiveNum" || col.Name == "colNeedStockUp" || col.Name == "colQualityScore") { col.Visible = false; } @@ -296,6 +296,7 @@ namespace TemuKJD.KJDForms.ProductForms sInfo.supplierName, sInfo.subPurchaseOrderSn, sInfo.originalPurchaseOrderSn, + sInfo.productSkcPicture.Replace("https", "http"), null,//image, sInfo.productId, sInfo.productSkcId, @@ -306,6 +307,7 @@ namespace TemuKJD.KJDForms.ProductForms "", "", "", + 0.0, "", "" ); @@ -314,6 +316,10 @@ namespace TemuKJD.KJDForms.ProductForms })); } } + Invoke(new Action(() => + { + ShowDgvImg(); + })); int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt(); totalPage = Math.Ceiling(total / 20.0).ParseToInt(); @@ -435,7 +441,7 @@ namespace TemuKJD.KJDForms.ProductForms page = Math.Max(page, 1); string url = "https://seller.kuajingmaihuo.com/marvel-mms/cn/api/kiana/venom/sales/management/listWarehouse"; - string body = @"{""pageNo"":" + page + @",""pageSize"":10,""isLack"":0,""selectStatusList"":[12],""priceAdjustRecentDays"":7}"; + string body = @"{""pageNo"":" + page + @",""pageSize"":40,""isLack"":0,""selectStatusList"":[12],""priceAdjustRecentDays"":7}"; string refere = "https://seller.kuajingmaihuo.com/main/sale-manage/main"; return KJDHttpResponse.PostResponse(shop, url, body, refere); @@ -520,6 +526,47 @@ namespace TemuKJD.KJDForms.ProductForms return KJDHttpResponse.PostResponse2(shop, url, body, refere); } + /// + /// 小于60分商品 + /// + private string GetQualityInfo1_2(ShopLoginInfo shop, string productIds) + { + string url = "https://agentseller.temu.com/bg-luna-agent-seller/goods/quality/supplyChain/qualityMetrics/pageQuery"; + string body = @"{""page"":1,""pageSize"":40,""qualityScoreEnum"":1,""productIds"":[" + productIds + "]}"; + string refere = "https://agentseller.temu.com/main/quality/dashboard"; + return KJDHttpResponse.PostResponse2(shop, url, body, refere); + } + /// + /// 60分到70分商品 + /// + private string GetQualityInfo2_2(ShopLoginInfo shop, string productIds) + { + string url = "https://agentseller.temu.com/bg-luna-agent-seller/goods/quality/supplyChain/qualityMetrics/pageQuery"; + string body = @"{""page"":1,""pageSize"":40,""qualityScoreEnum"":2,""productIds"":[" + productIds + "]}"; + string refere = "https://agentseller.temu.com/main/quality/dashboard"; + return KJDHttpResponse.PostResponse2(shop, url, body, refere); + } + /// + /// 70分到90分商品 + /// + private string GetQualityInfo3_2(ShopLoginInfo shop, string productIds) + { + string url = "https://agentseller.temu.com/bg-luna-agent-seller/goods/quality/supplyChain/qualityMetrics/pageQuery"; + string body = @"{""page"":1,""pageSize"":40,""qualityScoreEnum"":3,""productIds"":[" + productIds + "]}"; + string refere = "https://agentseller.temu.com/main/quality/dashboard"; + return KJDHttpResponse.PostResponse2(shop, url, body, refere); + } + /// + /// 90分以上 + /// + private string GetQualityInfo4_2(ShopLoginInfo shop, string productIds, int qualityScoreEnum = 4) + { + string url = "https://agentseller.temu.com/bg-luna-agent-seller/goods/quality/supplyChain/qualityMetrics/pageQuery"; + string body = @"{""page"":1,""pageSize"":40,""qualityScoreEnum"":" + qualityScoreEnum + @",""productIds"":[" + productIds + "]}"; + string refere = "https://agentseller.temu.com/main/quality/dashboard"; + return KJDHttpResponse.PostResponse2(shop, url, body, refere); + } + private void dgvShop_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 || e.RowIndex < 0) @@ -730,7 +777,7 @@ namespace TemuKJD.KJDForms.ProductForms col.Visible = false; } if (col.Name == "colTodaySaleVolume" || col.Name == "colInCartNumber7d" || col.Name == "colSalesInventoryNum" - || col.Name == "colWaitReceiveNum" || col.Name == "colNeedStockUp") + || col.Name == "colWaitReceiveNum" || col.Name == "colNeedStockUp" || col.Name == "colQualityScore") { col.Visible = true; } @@ -832,6 +879,8 @@ namespace TemuKJD.KJDForms.ProductForms { BaseMsgForm.ShowError(ex.Message); } + + List subOrderInfoLstTmp = new List(); foreach (var item in jArr) { string sItem = item.ToString(); @@ -862,50 +911,83 @@ namespace TemuKJD.KJDForms.ProductForms sInfo.needStockUp = true; else sInfo.needStockUp = false; - lstSubOrderInfo.Add(sInfo); - - //string url = sInfo.productSkcPicture.Replace("https", "http"); - //// var stream = WebRequest.Create(url).GetResponse().GetResponseStream(); - //Image image = null; - //using (Stream stream = WebRequest.Create(url).GetResponse().GetResponseStream()) - //{ - // try { - // image = Image.FromStream(stream); - // } - // catch (Exception ex) - // { - // } - //} - - Invoke(new Action(() => - { - var rowId = this.dgvStock.Rows.Add( - "", - true, - sInfo.supplierId, - sInfo.supplierName, - "",//sInfo.subPurchaseOrderSn, - "",//sInfo.originalPurchaseOrderSn, - null,//image, - sInfo.productId, - sInfo.productSkcId, - sInfo.productName, - "", - "", - "", - sInfo.skuQuantityTotalInfo.inCartNumber7d, - sInfo.skuQuantityTotalInfo.todaySaleVolume, - sInfo.skuQuantityTotalInfo.inventoryNumInfo.warehouseInventoryNum, - sInfo.skuQuantityTotalInfo.inventoryNumInfo.waitReceiveNum, - sInfo.needStockUp == false ? "无需备货" : "可备货", - "" - ); - if (rowId >= 0) - dgvStock.Rows[rowId].Height = 60; - //dgvStock.Rows.Cast[dgvStock.Rows].Height=60; - })); + subOrderInfoLstTmp.Add(sInfo); } } + //获取品质信息------------------------------------------------------------------------ + List qualityInfoLst = new List(); + string productIds = string.Join(",", subOrderInfoLstTmp.Select(o=>o.productId)); + string qualityErr = ""; + try + { + for (int j = 1; j <= 4; j++) + { + var qualityRst1 = this.GetQualityInfo4_2(shop, productIds, j); + if (qualityRst1.Contains("\"success\":true")) + { + var jObj = JObject.Parse(qualityRst1); + string jStr = JsonHelper.SerializeObject(jObj["result"]["pageItems"]); + qualityInfoLst.AddRange(JsonHelper.DeserializeJsonToList(jStr)); + } + else + { + qualityErr = BaseRegex.GetStringJson(ref qualityRst1, "errorMsg"); + if (string.IsNullOrWhiteSpace(qualityErr)) + qualityErr += BaseRegex.GetStringJson(ref qualityRst1, "error_msg"); + } + Thread.Sleep(Randomx.GetId(100, 200)); + } + } + catch (Exception ex) { qualityErr += "\r\n" + ex.Message; }; + if (qualityErr != "") + { + BaseMsgForm.ShowError("获取商品品质信息失败!" + qualityErr); + } + foreach (var qualityInfo in qualityInfoLst) + { + var order = subOrderInfoLstTmp.FirstOrDefault(o => o.productId == qualityInfo.productId); + if (order != null) + order.goodsAfsScore = qualityInfo.goodsAfsScore; + } + //--------------------------------------------------------------------------------------- + lstSubOrderInfo.AddRange(subOrderInfoLstTmp); + foreach (var sInfo in subOrderInfoLstTmp) + { + Invoke(new Action(() => + { + var rowId = this.dgvStock.Rows.Add( + "", + true, + sInfo.supplierId, + sInfo.supplierName, + "",//sInfo.subPurchaseOrderSn, + "",//sInfo.originalPurchaseOrderSn, + sInfo.productSkcPicture.Replace("https", "http"), + defaultBitmap,//image, + sInfo.productId, + sInfo.productSkcId, + sInfo.productName, + "", + "", + "", + sInfo.skuQuantityTotalInfo.inCartNumber7d, + sInfo.skuQuantityTotalInfo.todaySaleVolume, + sInfo.skuQuantityTotalInfo.inventoryNumInfo.warehouseInventoryNum, + sInfo.skuQuantityTotalInfo.inventoryNumInfo.waitReceiveNum, + sInfo.goodsAfsScore == null ? "-" : (Math.Round(sInfo.goodsAfsScore.Value * 10) / 10).ToString(), + sInfo.needStockUp == false ? "无需备货" : "可备货", + "" + ); + if (rowId >= 0) + dgvStock.Rows[rowId].Height = 60; + })); + } + + + Invoke(new Action(() => + { + ShowDgvImg(); + })); int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt(); totalPage = Math.Ceiling(total / 10.0).ParseToInt(); @@ -995,6 +1077,17 @@ namespace TemuKJD.KJDForms.ProductForms })); continue; } + if (stockUp.goodsAfsScore != null && stockUp.goodsAfsScore < 75) + { + Invoke(new Action(() => + { + foreach (var row in rows) + { + row.Cells["colMsg"].Value = "商品品质得分过低,请去网页手动备货"; + } + })); + continue; + } var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == stockUp.supplierId.ToString()); if (shop == null || shop.LoginStatus != "登录成功") @@ -1134,5 +1227,57 @@ namespace TemuKJD.KJDForms.ProductForms { this.isNewService = ucCheckBox1.Checked; } + + Bitmap defaultBitmap = new Bitmap(80, 80); + void ShowDgvImg() + { + Task.Run(() => + { + foreach (DataGridViewRow row in this.dgvStock.Rows) + { + if (row.Index > 0 && row.Cells["colProductSkcPic"].Displayed == false) + { + try + { + Invoke(new Action(() => + { + row.Cells["colProductSkcPic"].Value = defaultBitmap; + })); + } + catch + { + } + continue; + } + + if (row.Cells["colProductSkcPic"].Value != null && row.Cells["colProductSkcPic"].Value != defaultBitmap) + continue; + + Image image = null; + string imgUrl = row.Cells["colImgUrl"]?.Value.ParseToString(); + string getImgError = ""; + if (!string.IsNullOrWhiteSpace(imgUrl)) + image = GetHtml.GetUrlImg(imgUrl, out getImgError); + if (!string.IsNullOrEmpty(getImgError)) + BaseMsgForm.ShowError(getImgError); + + try + { + Invoke(new Action(() => + { + row.Cells["colProductSkcPic"].Value = image; + })); + } + catch + { + } + } + }); + } + + private void dgvStock_Scroll(object sender, ScrollEventArgs e) + { + ShowDgvImg(); + } } } diff --git a/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.resx b/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.resx index 5811ce4..10311c1 100644 --- a/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.resx +++ b/TEMUKJD/KJDForms/ProductForms/SaleStockUpForm.resx @@ -156,6 +156,9 @@ True + + True + True @@ -186,6 +189,9 @@ True + + True + True diff --git a/Work/Api/FromTitleToCat.cs b/Work/Api/FromTitleToCat.cs index 3a539ba..d8fc665 100644 --- a/Work/Api/FromTitleToCat.cs +++ b/Work/Api/FromTitleToCat.cs @@ -757,14 +757,14 @@ namespace Work.Api public static void Ini() { - string[] l = FileBase.ReadAllLines("taobao_cat.ico"); - for (int i = 0; l != null && i < l.Length; i++) - { - if (!l[i].Contains("\t")) - continue; - string[] s = l[i].Split('\t'); - TaobaoCat.Add(int.Parse(s[0]), s[1]); - } + //string[] l = FileBase.ReadAllLines("taobao_cat.ico"); + //for (int i = 0; l != null && i < l.Length; i++) + //{ + // if (!l[i].Contains("\t")) + // continue; + // string[] s = l[i].Split('\t'); + // TaobaoCat.Add(int.Parse(s[0]), s[1]); + //} } } } diff --git a/Work/Api/UploadPinduoduoProperties.cs b/Work/Api/UploadPinduoduoProperties.cs index bb9c1a9..9802abe 100644 --- a/Work/Api/UploadPinduoduoProperties.cs +++ b/Work/Api/UploadPinduoduoProperties.cs @@ -15,44 +15,44 @@ namespace Work.Api public static void Ini() { - if (DefaultProperties.Count == 0) - { - GetDefaultProperties(); - } - //string file = FileBase.ReadAllText("mobelx.dll"); - //if (string.IsNullOrEmpty(file)) - // return; - //CatTemplate = JsonHelper.DeserializeJsonToObject>(file); - //if (CatTemplate == null) - // CatTemplate = new Dictionary(); - //for (int i = 0; i < Properties.Count; i++) + //if (DefaultProperties.Count == 0) //{ - // Properties[i].value_unit = ""; - // for (int j = 0; j < Properties[i].Values.Count; j++) - // { - // if (string.IsNullOrEmpty(Properties[i].Values[j].p_unit)) - // Properties[i].Values[j].p_unit = ""; - // } - // if (Properties[i].pid == 93) - // { - // for (int j = 0; j < Properties[i].cats.Count; j++) - // { - // if (Properties.Exists(p => p.pid == 59 && p.cats.Contains(Properties[i].cats[j]))) - // continue; - // var m = new ModelBase(); - // m.name = "中国国家强制性产品认证证书"; - // m.name_all = "中国国家强制性产品认证证书"; - // m.must = true; - // m.show_type = 1; - // m.template_pid = 33178; - // m.template_module_id = 7207; - // m.pid = 59; - // m.cats = Properties[i].cats; - // m.value_unit = ""; - // Properties.Add(m); - // } - // } + // GetDefaultProperties(); //} + ////string file = FileBase.ReadAllText("mobelx.dll"); + ////if (string.IsNullOrEmpty(file)) + //// return; + ////CatTemplate = JsonHelper.DeserializeJsonToObject>(file); + ////if (CatTemplate == null) + //// CatTemplate = new Dictionary(); + ////for (int i = 0; i < Properties.Count; i++) + ////{ + //// Properties[i].value_unit = ""; + //// for (int j = 0; j < Properties[i].Values.Count; j++) + //// { + //// if (string.IsNullOrEmpty(Properties[i].Values[j].p_unit)) + //// Properties[i].Values[j].p_unit = ""; + //// } + //// if (Properties[i].pid == 93) + //// { + //// for (int j = 0; j < Properties[i].cats.Count; j++) + //// { + //// if (Properties.Exists(p => p.pid == 59 && p.cats.Contains(Properties[i].cats[j]))) + //// continue; + //// var m = new ModelBase(); + //// m.name = "中国国家强制性产品认证证书"; + //// m.name_all = "中国国家强制性产品认证证书"; + //// m.must = true; + //// m.show_type = 1; + //// m.template_pid = 33178; + //// m.template_module_id = 7207; + //// m.pid = 59; + //// m.cats = Properties[i].cats; + //// m.value_unit = ""; + //// Properties.Add(m); + //// } + //// } + ////} } /// /// 获取必填项 diff --git a/Work/CollectClass/LoadCloudData.cs b/Work/CollectClass/LoadCloudData.cs index c5f9f34..643184a 100644 --- a/Work/CollectClass/LoadCloudData.cs +++ b/Work/CollectClass/LoadCloudData.cs @@ -22,58 +22,58 @@ namespace Work.CollectClass /// public void Get() { - string url = BaseClass.LoginApiUrl + "taobao/筛选词.txt"; - string path = "temp/notitleword.tjm"; - string html; - if (FileBase.Exists(path)) - html = FileBase.ReadAllText(path, Encoding.Default); - else - { - html = GetHtml.Utf8(url); - FileBase.WriteAllText(path, html, Encoding.Default); - } - if (string.IsNullOrEmpty(html)) - { - LogSave.Add("链接云数据库失败"); - return; - } - string[] l = html.Split('\n'); - for (int i = 0; i < l.Length; i++) - { - string s = l[i].Trim(); - if (string.IsNullOrEmpty(s) || s.Length < 2) - continue; - string num = BaseRegex.GetMatchRegexString(ref s, @"([\d]+)"); - if (!string.IsNullOrEmpty(num) && num.Length == s.Length) - continue; - NoTitleWord.Add(s); - } + //string url = BaseClass.LoginApiUrl + "taobao/筛选词.txt"; + //string path = "temp/notitleword.tjm"; + //string html; + //if (FileBase.Exists(path)) + // html = FileBase.ReadAllText(path, Encoding.Default); + //else + //{ + // html = GetHtml.Utf8(url); + // FileBase.WriteAllText(path, html, Encoding.Default); + //} + //if (string.IsNullOrEmpty(html)) + //{ + // LogSave.Add("链接云数据库失败"); + // return; + //} + //string[] l = html.Split('\n'); + //for (int i = 0; i < l.Length; i++) + //{ + // string s = l[i].Trim(); + // if (string.IsNullOrEmpty(s) || s.Length < 2) + // continue; + // string num = BaseRegex.GetMatchRegexString(ref s, @"([\d]+)"); + // if (!string.IsNullOrEmpty(num) && num.Length == s.Length) + // continue; + // NoTitleWord.Add(s); + //} - url = BaseClass.LoginApiUrl + "taobao/品牌词.txt"; - path = "temp/nobrand.tjm"; - if (FileBase.Exists(path)) - html = FileBase.ReadAllText(path, Encoding.Default); - else - { - html = GetHtml.Utf8(url); - FileBase.WriteAllText(path, html, Encoding.Default); - } - if (string.IsNullOrEmpty(html)) - { - LogSave.Add("链接云数据库失败"); - return; - } - l = html.Split('\n'); - for (int i = 0; i < l.Length; i++) - { - string s = l[i].Trim(); - if (string.IsNullOrEmpty(s) || s.Length < 2) - continue; - string num = BaseRegex.GetMatchRegexString(ref s, @"([\d]+)"); - if (!string.IsNullOrEmpty(num) && num.Length == s.Length) - continue; - NoBrand.Add(s); - } + //url = BaseClass.LoginApiUrl + "taobao/品牌词.txt"; + //path = "temp/nobrand.tjm"; + //if (FileBase.Exists(path)) + // html = FileBase.ReadAllText(path, Encoding.Default); + //else + //{ + // html = GetHtml.Utf8(url); + // FileBase.WriteAllText(path, html, Encoding.Default); + //} + //if (string.IsNullOrEmpty(html)) + //{ + // LogSave.Add("链接云数据库失败"); + // return; + //} + //l = html.Split('\n'); + //for (int i = 0; i < l.Length; i++) + //{ + // string s = l[i].Trim(); + // if (string.IsNullOrEmpty(s) || s.Length < 2) + // continue; + // string num = BaseRegex.GetMatchRegexString(ref s, @"([\d]+)"); + // if (!string.IsNullOrEmpty(num) && num.Length == s.Length) + // continue; + // NoBrand.Add(s); + //} } } diff --git a/Work/CollectClass/PinduoduoProductCollect.cs b/Work/CollectClass/PinduoduoProductCollect.cs index b316fe5..e1fd437 100644 --- a/Work/CollectClass/PinduoduoProductCollect.cs +++ b/Work/CollectClass/PinduoduoProductCollect.cs @@ -2112,18 +2112,18 @@ namespace Work.CollectClass public static void GetServerCookies() { - string url = BaseClass.LoginApiUrl + "?obj=upshopid/user_cookies"; - string html = GetHtml.PostUtf8(url, "act=get_rand"); - if (string.IsNullOrEmpty(html)) - html = GetHtml.PostUtf8(url, "act=get_rand"); - var m = BaseRegex.GetMatchRegex(ref html, "]+?>)"); - for (int i = 0; m != null && i < m.Count; i++) - { - string list = m[i].Groups[0].Value; - string mobile = BaseRegex.GetStringJson(ref list, "mobile"); - string cookies = BaseRegex.GetStringJson(ref list, "cookies"); - Mobiles.Add(new KeyValueBase(mobile, cookies)); - } + //string url = BaseClass.LoginApiUrl + "?obj=upshopid/user_cookies"; + //string html = GetHtml.PostUtf8(url, "act=get_rand"); + //if (string.IsNullOrEmpty(html)) + // html = GetHtml.PostUtf8(url, "act=get_rand"); + //var m = BaseRegex.GetMatchRegex(ref html, "]+?>)"); + //for (int i = 0; m != null && i < m.Count; i++) + //{ + // string list = m[i].Groups[0].Value; + // string mobile = BaseRegex.GetStringJson(ref list, "mobile"); + // string cookies = BaseRegex.GetStringJson(ref list, "cookies"); + // Mobiles.Add(new KeyValueBase(mobile, cookies)); + //} } public static string GetRandomPDDAccessToken(Func predicateToken) diff --git a/Work/Initialization.cs b/Work/Initialization.cs index 06b1550..e89c39e 100644 --- a/Work/Initialization.cs +++ b/Work/Initialization.cs @@ -32,6 +32,7 @@ namespace Work public static void InitProgress(int i) { + Thread.Sleep(Randomx.GetId(10, 100)); InitPercent += i; if (InitPercent > 100) InitPercent = 100; @@ -91,22 +92,22 @@ offCountPara,false;offProductPara,100;IrregularitiesPara,true;noNeerPara,true;no Directory.Delete(System.Environment.CurrentDirectory + "\\data1", true); }); //Task.Run(() => { Update(); InitProgress(1); }); - Task.Run(() => { CheckUpdate(); InitProgress(1); }); + Task.Run(() => { CheckUpdate(); InitProgress(2); }); Task.Run(() => { GetAuthConfig(); InitProgress(1); }); - Task.Run(() => { CheckFiles(); IsCheckFilesFinish = true; InitProgress(1); }); + Task.Run(() => { CheckFiles(); IsCheckFilesFinish = true; InitProgress(2); }); //Task.Run(() => { CheckUpdataFile(); }); Task.Run(() => { new Segment().GetWord(); InitProgress(1); }); //Task.Run(() => { new PinduoduoCatList().Get(); InitProgress(1); }); // pdd cat Task.Run(() => { GetMacCode(); InitProgress(1); }); #if DEBUG if (!File.Exists(System.Environment.CurrentDirectory + "\\TemuKJD.exe.choice.debug.tools")) - Task.Run(() => { new CheckHecker().Check(); InitProgress(1); }); // 防止破解 + Task.Run(() => { new CheckHecker().Check(); InitProgress(2); }); // 防止破解 #else - Task.Run(() => { new CheckHecker().Check(); InitProgress(1); }); // 防止破解 + Task.Run(() => { new CheckHecker().Check(); InitProgress(2); }); // 防止破解 #endif - Task.Run(() => { PinduoduoProductCollect.GetServerCookies(); InitProgress(1); }); - Task.Run(() => { new LoadCloudData().Get(); InitProgress(1); }); // 加载云数据 - Task.Run(() => { new BigDataBuild("").Ini(); InitProgress(1); }); // 加载云数据 + Task.Run(() => { PinduoduoProductCollect.GetServerCookies(); InitProgress(2); }); + Task.Run(() => { new LoadCloudData().Get(); InitProgress(2); }); // 加载云数据 + Task.Run(() => { new BigDataBuild("").Ini(); InitProgress(2); }); // 加载云数据 new FromTitleToCat(); InitProgress(1); @@ -288,26 +289,26 @@ offCountPara,false;offProductPara,100;IrregularitiesPara,true;noNeerPara,true;no /// private void Update() { - string upfilepath = Application.StartupPath + "\\Updatex.exe"; - File.WriteAllText(Application.StartupPath + "\\updateconfig.ini", BaseClass.VersionCount - + "\r\nhttps://update.qixiaoke.com/littlerabbit_update/uploader.php"); - if (File.Exists(upfilepath)) - { - string fc = GetMD5(upfilepath); - if (fc != "001EC5642914325F1DCF6E69BBA90738") - { - GetHtml.DownloadFile("http://dl.qixiaoke.com/Update3.1.exe", upfilepath); - } - } - else//如果自动更新文件不存在,则强制更新主文件 - GetHtml.DownloadFile("http://dl.qixiaoke.com/Update3.1.exe", upfilepath); - try - { - Process.Start(upfilepath); - } - catch - { - } + //string upfilepath = Application.StartupPath + "\\Updatex.exe"; + //File.WriteAllText(Application.StartupPath + "\\updateconfig.ini", BaseClass.VersionCount + //+ "\r\nhttps://update.qixiaoke.com/littlerabbit_update/uploader.php"); + //if (File.Exists(upfilepath)) + //{ + // string fc = GetMD5(upfilepath); + // if (fc != "001EC5642914325F1DCF6E69BBA90738") + // { + // GetHtml.DownloadFile("http://dl.qixiaoke.com/Update3.1.exe", upfilepath); + // } + //} + //else//如果自动更新文件不存在,则强制更新主文件 + // GetHtml.DownloadFile("http://dl.qixiaoke.com/Update3.1.exe", upfilepath); + //try + //{ + // Process.Start(upfilepath); + //} + //catch + //{ + //} InitProgress(1); } @@ -679,12 +680,14 @@ offCountPara,false;offProductPara,100;IrregularitiesPara,true;noNeerPara,true;no Directory.CreateDirectory("x64"); if (!Directory.Exists("x86")) Directory.CreateDirectory("x86"); - if (!Directory.Exists("ru-ru")) - Directory.CreateDirectory("ru-ru"); + //if (!Directory.Exists("ru-ru")) + // Directory.CreateDirectory("ru-ru"); if (!Directory.Exists("temp")) Directory.CreateDirectory("temp"); - if (!Directory.Exists("temp/image")) - Directory.CreateDirectory("temp/image"); + //if (!Directory.Exists("temp/image")) + // Directory.CreateDirectory("temp/image"); + + /* List files = new List(); files.Add(new KeyValueBase("标题包含过滤_new.txt", "config/标题包含过滤x.ini")); files.Add(new KeyValueBase("标题过滤词_new.txt", "config/标题过滤词x.ini")); @@ -804,7 +807,7 @@ offCountPara,false;offProductPara,100;IrregularitiesPara,true;noNeerPara,true;no else { InitProgress(20); - } + }*/ Task.Run(() => { new AddressSetIni().Ini(); InitProgress(1); }); Task.Run(() => { new AddressSetIni().getAddress1688(); InitProgress(1); }); Task.Run(() => { FromTitleToCat.Ini(); InitProgress(1); }); @@ -815,32 +818,32 @@ offCountPara,false;offProductPara,100;IrregularitiesPara,true;noNeerPara,true;no try { - //加载违规商品Id - string idslines = File.ReadAllText("temp/ids.dll", Encoding.Default); - if (!string.IsNullOrEmpty(idslines)) - { - foreach (string s in idslines.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) - { - if (string.IsNullOrEmpty(s) || s == "0" || s.Contains("?") || s.Contains("@")) - continue; - if (s.Trim().Length < 2) - continue; - UploadPinduoduoMain.RuleIds.Add(s); - } - } - //加载违规商品标题 - string tidslines = File.ReadAllText("temp/tids.dll", Encoding.Default); - if (!string.IsNullOrEmpty(tidslines)) - { - foreach (string s in tidslines.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) - { - if (string.IsNullOrEmpty(s) || s == "0") - continue; - if (s.Trim().Length < 2) - continue; - UploadPinduoduoMain.RuleTitles.Add(s); - } - } + ////加载违规商品Id + //string idslines = File.ReadAllText("temp/ids.dll", Encoding.Default); + //if (!string.IsNullOrEmpty(idslines)) + //{ + // foreach (string s in idslines.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) + // { + // if (string.IsNullOrEmpty(s) || s == "0" || s.Contains("?") || s.Contains("@")) + // continue; + // if (s.Trim().Length < 2) + // continue; + // UploadPinduoduoMain.RuleIds.Add(s); + // } + //} + ////加载违规商品标题 + //string tidslines = File.ReadAllText("temp/tids.dll", Encoding.Default); + //if (!string.IsNullOrEmpty(tidslines)) + //{ + // foreach (string s in tidslines.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries)) + // { + // if (string.IsNullOrEmpty(s) || s == "0") + // continue; + // if (s.Trim().Length < 2) + // continue; + // UploadPinduoduoMain.RuleTitles.Add(s); + // } + //} InitProgress(1); } @@ -865,7 +868,7 @@ offCountPara,false;offProductPara,100;IrregularitiesPara,true;noNeerPara,true;no // AlibabaShop.NoTitleWords.Add(s.Trim()); // } // - // InitProgress(1); + InitProgress(1); //} //lines = File.ReadAllText("config/属性过滤词x.ini", Encoding.Default); @@ -882,7 +885,7 @@ offCountPara,false;offProductPara,100;IrregularitiesPara,true;noNeerPara,true;no //AlibabaShop.NoPropWords.Add(s.Trim()); //} - //InitProgress(1); + InitProgress(1); //} //lines = File.ReadAllText("config/品牌属性过滤x.ini", Encoding.Default); //if (!string.IsNullOrEmpty(lines)) @@ -898,7 +901,7 @@ offCountPara,false;offProductPara,100;IrregularitiesPara,true;noNeerPara,true;no //AlibabaShop.NoBrandName.Add(s.Trim()); //} - //InitProgress(1); + InitProgress(1); //} //lines = File.ReadAllText("config/标题包含过滤x.ini", Encoding.Default); //if (!string.IsNullOrEmpty(lines)) diff --git a/Work/ManageClass/AddressSetIni.cs b/Work/ManageClass/AddressSetIni.cs index f5fa564..2bf8e84 100644 --- a/Work/ManageClass/AddressSetIni.cs +++ b/Work/ManageClass/AddressSetIni.cs @@ -40,42 +40,41 @@ namespace Work.ManageClass } public void getAddress1688() { - string strContent = FileBase.ReadAllText("1688_address.tjm"); - strContent = GetHtml.UrlDecode(strContent); - var m = BaseRegex.GetMatchRegex(ref strContent, @"{[^}]+?}"); - for (int i = 0; m != null && i < m.Count; i++) - { + //string strContent = FileBase.ReadAllText("1688_address.tjm"); + //strContent = GetHtml.UrlDecode(strContent); + //var m = BaseRegex.GetMatchRegex(ref strContent, @"{[^}]+?}"); + //for (int i = 0; m != null && i < m.Count; i++) + //{ - string addressContent = m[i].Groups[0].Value; - AddressBase a = new AddressBase(); - string[] addressArray = addressContent.Split(','); - for (int j = 0; j < addressArray.Length; j++) - { - var itemMatch = BaseRegex.GetMatchRegex(ref addressArray[j], @"([\w\W]+?):([\w\W]+)"); - string itemname = itemMatch[0].Groups[1].Value.Replace("{", ""); - string itemvalue = itemMatch[0].Groups[2].Value.Replace("\"", "").Replace("}", ""); - if (itemname == "a") - { - a.Id = int.Parse(itemvalue); - } - if (itemname == "n") - { - a.Name = itemvalue; - } - if (itemname == "p") - { - a.UpId = int.Parse(itemvalue); - } - } - AddressAllList.Add(a); - if (!Addressdic.ContainsKey(a.Id)) - Addressdic.Add(a.Id, new List()); - if (!Addressdic.ContainsKey(a.UpId)) - Addressdic.Add(a.UpId, new List()); - Addressdic[a.UpId].Add(a); - } + // string addressContent = m[i].Groups[0].Value; + // AddressBase a = new AddressBase(); + // string[] addressArray = addressContent.Split(','); + // for (int j = 0; j < addressArray.Length; j++) + // { + // var itemMatch = BaseRegex.GetMatchRegex(ref addressArray[j], @"([\w\W]+?):([\w\W]+)"); + // string itemname = itemMatch[0].Groups[1].Value.Replace("{", ""); + // string itemvalue = itemMatch[0].Groups[2].Value.Replace("\"", "").Replace("}", ""); + // if (itemname == "a") + // { + // a.Id = int.Parse(itemvalue); + // } + // if (itemname == "n") + // { + // a.Name = itemvalue; + // } + // if (itemname == "p") + // { + // a.UpId = int.Parse(itemvalue); + // } + // } + // AddressAllList.Add(a); + // if (!Addressdic.ContainsKey(a.Id)) + // Addressdic.Add(a.Id, new List()); + // if (!Addressdic.ContainsKey(a.UpId)) + // Addressdic.Add(a.UpId, new List()); + // Addressdic[a.UpId].Add(a); + //} } - } public class AddressBase