diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 69d2a02..ed75c5f 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 838; + public static int VersionCount = 851; //public static int VersionCount = 613; /// diff --git a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs index 318cce8..a91ec0d 100644 --- a/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs +++ b/KJDService/KJD_WebService/BLL/BXX/BXXProductManage.cs @@ -703,6 +703,7 @@ namespace KJD_Web.BLL.BXX var special_prod_type = RegexUtils.GetStringQuery(ref inputData, "special_prod_type")?.Replace("'", "\\'"); var is_supplier_prod_ok = RegexUtils.GetStringQuery(ref inputData, "is_supplier_prod_ok")?.Replace("'", "\\'"); var is_not_count = (RegexUtils.GetStringQuery(ref inputData, "is_not_count")?.Replace("'", "\\'")).ParseToBool(); + var prod_count = (RegexUtils.GetStringQuery(ref inputData, "prod_count")?.Replace("'", "\\'")).ParseToInt(); int page = RegexUtils.GetStringQuery(ref inputData, "page").ParseToInt(); int page_size = RegexUtils.GetStringQuery(ref inputData, "page_size").ParseToInt(50); @@ -766,7 +767,7 @@ namespace KJD_Web.BLL.BXX } sql += where; - int count = 0; + int count = prod_count; if (!is_not_count) count = mySql.ExecuteRowCount(sql); @@ -777,24 +778,36 @@ namespace KJD_Web.BLL.BXX } else { - //sql = "select p.id" + - // " from bxx.product p where p.is_del=0"; - //sql += where; - //sql += " ORDER BY RAND()"; - //sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size; - //dt = mySql.ExecuteDataTable(sql); - - sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code," + - " p.product_name,p.main_img,p.group,p.notes,p.add_time,p.mdy_time,p.select_total_count,p.product_get_type,p.sale_count,p.sale_count_text," + - " p.fission_words,p.head_words,p.end_words,p.wx_safe_status,p.special_prod_type,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," + - " p.wx_cat_leaf" + + sql = "select p.id" + " from bxx.product p where p.is_del=0"; - //where子句 sql += where; sql += " ORDER BY RAND()"; sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size; + + //var limit = RandomUtils.GetId(count - page_size); + //sql += " limit " + limit + "," + page_size; + + dt = mySql.ExecuteDataTable(sql); + if (!string.IsNullOrEmpty(mySql.Message) || dt == null) + { + mySql.Close(); + return "{\"code\":500,\"msg\":\"" + mySql.Message + "\",\"data\":[],\"count\":" + 0 + "}"; + } + + var db_ids = string.Join(",", dt.Rows.Cast().Select(r => r["id"].ParseToInt())); + sql = "select p.id,p.from_shop_id,p.spu_id,p.skc_id,p.main_cat_id,p.main_cat_name,p.cat_id,p.cat_name,p.price_text,p.ext_code," + + " p.product_name,p.main_img,p.group,p.notes,p.add_time,p.mdy_time,p.select_total_count,p.product_get_type,p.sale_count,p.sale_count_text," + + " p.fission_words,p.head_words,p.end_words,p.wx_safe_status,p.special_prod_type,p.wx_cat_1,p.wx_cat_2,p.wx_cat_3," + + " p.wx_cat_leaf" + + " from bxx.product p where p.is_del=0"; + //where子句 + //sql += where; + sql += " and id in (" + db_ids + ")"; + + //sql += " ORDER BY RAND()"; + //sql += " limit " + Math.Max(page - 1, 0) * page_size + "," + page_size; dt = mySql.ExecuteDataTable(sql); } @@ -1917,6 +1930,8 @@ namespace KJD_Web.BLL.BXX string img_url = RegexUtils.GetStringQuery(ref inputData, "img_url")?.Replace("'", "\\'"); bool is_keep_file = RegexUtils.GetStringQuery(ref inputData, "is_keep_file").ParseToBool(); + is_keep_file = System.Configuration.ConfigurationManager.ConnectionStrings["IsKeepBase64UploadImgFile"]?.ConnectionString == "1"; + try { byte[] imageBytes = Convert.FromBase64String(imgBase64); diff --git a/KJDService/KJD_WebService/Utils/Extension/Extension.Convert.cs b/KJDService/KJD_WebService/Utils/Extension/Extension.Convert.cs index aa72517..0d7a9cb 100644 --- a/KJDService/KJD_WebService/Utils/Extension/Extension.Convert.cs +++ b/KJDService/KJD_WebService/Utils/Extension/Extension.Convert.cs @@ -252,6 +252,8 @@ namespace NaiBa.Util.Extension { try { + if (str is null) + return false; return bool.Parse(str.ToString()); } catch diff --git a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditDetailForm.cs b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditDetailForm.cs index 2cfaac1..5856eda 100644 --- a/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditDetailForm.cs +++ b/TEMUKJD/PDDForms/ProductSelectForms/PDDDBProdEditDetailForm.cs @@ -87,7 +87,18 @@ namespace TemuKJD.PDDForms.ProductSelectForms { defaultSkuEditItem = lstSkuEditItem.FirstOrDefault(); if (defaultSkuEditItem == null) + { defaultSkuEditItem = new sku_edit_item(); + lstSkuEditItem.Add(defaultSkuEditItem); + } + if (defaultSkuEditItem.spec == null) + { + defaultSkuEditItem.spec = new List(); + } + if (defaultSkuEditItem.spec.Count == 0) + { + defaultSkuEditItem.spec.Add(new spec_item() { parent_name = "颜色", spec_name = "默认" }); + } if (lstSkuEditItem.All(s => s.spec.Count < 2)) { @@ -99,10 +110,10 @@ namespace TemuKJD.PDDForms.ProductSelectForms flowLayoutPanel2.Tag = lstSkuEditItem.FirstOrDefault()?.spec?.LastOrDefault(); if (flowLayoutPanel2.Tag == flowLayoutPanel1.Tag) flowLayoutPanel2.Tag = null; - this.cmbSpec1.Text = "全部" + lstSkuEditItem.FirstOrDefault()?.spec?.FirstOrDefault().parent_name; - this.cmbSpec1.DefaultText = "全部" + lstSkuEditItem.FirstOrDefault()?.spec?.FirstOrDefault().parent_name; - this.cmbSpec2.Text = "全部" + lstSkuEditItem.FirstOrDefault()?.spec?.LastOrDefault().parent_name; - this.cmbSpec2.DefaultText = "全部" + lstSkuEditItem.FirstOrDefault()?.spec?.LastOrDefault().parent_name; + this.cmbSpec1.Text = "全部" + lstSkuEditItem.FirstOrDefault()?.spec?.FirstOrDefault()?.parent_name; + this.cmbSpec1.DefaultText = "全部" + lstSkuEditItem.FirstOrDefault()?.spec?.FirstOrDefault()?.parent_name; + this.cmbSpec2.Text = "全部" + lstSkuEditItem.FirstOrDefault()?.spec?.LastOrDefault()?.parent_name; + this.cmbSpec2.DefaultText = "全部" + lstSkuEditItem.FirstOrDefault()?.spec?.LastOrDefault()?.parent_name; if (cmbSpec2.Text == cmbSpec1.Text) { this.cmbSpec2.Text = ""; @@ -722,8 +733,13 @@ namespace TemuKJD.PDDForms.ProductSelectForms } if (this.lstSkuEditItem.Any(s => s.thumb_url.IsNullOrEmpty() && s.thumb_md5.IsNullOrEmpty())) { - BaseMsgForm.ShowError("sku图片不能为空"); - return; + if (BaseMsgForm.ShowConfirm("sku图片不能为空,使用主图代替?").DialogResult != DialogResult.OK) + return; + + foreach (var skuItem in this.lstSkuEditItem.Where(s => s.thumb_url.IsNullOrEmpty() && s.thumb_md5.IsNullOrEmpty())) + { + skuItem.thumb_url = DbProd.main_img; + } } var url = BaseClass.BuildObjString("product/mdy_db_product"); diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs index 37097be..4554e62 100644 --- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs +++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.Designer.cs @@ -32,12 +32,12 @@ namespace TemuKJD.WXForms.ProductForms private void InitializeComponent() { this.components = new System.ComponentModel.Container(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); this.chkImgRandomBlock = new TemuKJD.UserComponent.UcCheckBox(this.components); @@ -78,6 +78,7 @@ namespace TemuKJD.WXForms.ProductForms this.label9 = new System.Windows.Forms.Label(); this.chkStepAddPrice = new TemuKJD.UserComponent.UcCheckBox(this.components); this.ucGroupBoxEx4 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); + this.pbSelectProd = new System.Windows.Forms.PictureBox(); this.btnFilterBound = new DevComponents.DotNetBar.PanelEx(); this.label12 = new System.Windows.Forms.Label(); this.txtFilterBound = new System.Windows.Forms.TextBox(); @@ -105,7 +106,7 @@ namespace TemuKJD.WXForms.ProductForms this.label2 = new System.Windows.Forms.Label(); this.lblWaitToUp = new System.Windows.Forms.Label(); this.txtAddCount = new System.Windows.Forms.TextBox(); - this.panelEx2 = new DevComponents.DotNetBar.PanelEx(); + this.btnRandomAdd = new DevComponents.DotNetBar.PanelEx(); this.ucGroupBoxEx1 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); this.btnRefreshAuthor = new DevComponents.DotNetBar.PanelEx(); this.btnSelectOffline = new DevComponents.DotNetBar.PanelEx(); @@ -180,6 +181,7 @@ namespace TemuKJD.WXForms.ProductForms this.panel3.SuspendLayout(); this.fPnlPriceRule.SuspendLayout(); this.ucGroupBoxEx4.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pbSelectProd)).BeginInit(); this.ucGroupBoxEx1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer3)).BeginInit(); this.splitContainer3.Panel1.SuspendLayout(); @@ -784,6 +786,7 @@ namespace TemuKJD.WXForms.ProductForms | System.Windows.Forms.AnchorStyles.Left))); this.ucGroupBoxEx4.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.ucGroupBoxEx4.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND; + this.ucGroupBoxEx4.Controls.Add(this.pbSelectProd); this.ucGroupBoxEx4.Controls.Add(this.btnFilterBound); this.ucGroupBoxEx4.Controls.Add(this.label12); this.ucGroupBoxEx4.Controls.Add(this.txtFilterBound); @@ -811,7 +814,7 @@ namespace TemuKJD.WXForms.ProductForms this.ucGroupBoxEx4.Controls.Add(this.label2); this.ucGroupBoxEx4.Controls.Add(this.lblWaitToUp); this.ucGroupBoxEx4.Controls.Add(this.txtAddCount); - this.ucGroupBoxEx4.Controls.Add(this.panelEx2); + this.ucGroupBoxEx4.Controls.Add(this.btnRandomAdd); this.ucGroupBoxEx4.Location = new System.Drawing.Point(162, 2); this.ucGroupBoxEx4.Name = "ucGroupBoxEx4"; this.ucGroupBoxEx4.Size = new System.Drawing.Size(410, 165); @@ -819,6 +822,17 @@ namespace TemuKJD.WXForms.ProductForms this.ucGroupBoxEx4.TabStop = false; this.ucGroupBoxEx4.Text = "待传商品"; // + // pbSelectProd + // + this.pbSelectProd.Image = global::TemuKJD.Properties.Resources.loading_blue; + this.pbSelectProd.Location = new System.Drawing.Point(116, 128); + this.pbSelectProd.Name = "pbSelectProd"; + this.pbSelectProd.Size = new System.Drawing.Size(25, 25); + this.pbSelectProd.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pbSelectProd.TabIndex = 781; + this.pbSelectProd.TabStop = false; + this.pbSelectProd.Visible = false; + // // btnFilterBound // this.btnFilterBound.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; @@ -1139,7 +1153,7 @@ namespace TemuKJD.WXForms.ProductForms this.lblWaitToUp.Cursor = System.Windows.Forms.Cursors.Hand; this.lblWaitToUp.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.lblWaitToUp.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.lblWaitToUp.Location = new System.Drawing.Point(120, 132); + this.lblWaitToUp.Location = new System.Drawing.Point(140, 132); this.lblWaitToUp.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); this.lblWaitToUp.Name = "lblWaitToUp"; this.lblWaitToUp.Size = new System.Drawing.Size(71, 17); @@ -1157,29 +1171,29 @@ namespace TemuKJD.WXForms.ProductForms this.txtAddCount.TabIndex = 536; this.txtAddCount.Text = "500"; // - // panelEx2 + // btnRandomAdd // - this.panelEx2.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; - this.panelEx2.Cursor = System.Windows.Forms.Cursors.Hand; - this.panelEx2.DisabledBackColor = System.Drawing.Color.Empty; - this.panelEx2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.panelEx2.Location = new System.Drawing.Point(283, 128); - this.panelEx2.Name = "panelEx2"; - this.panelEx2.Size = new System.Drawing.Size(58, 25); - this.panelEx2.Style.Alignment = System.Drawing.StringAlignment.Center; - this.panelEx2.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.panelEx2.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.panelEx2.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; - this.panelEx2.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; - this.panelEx2.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; - this.panelEx2.Style.ForeColor.Color = System.Drawing.Color.White; - this.panelEx2.Style.GradientAngle = 90; - this.panelEx2.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.panelEx2.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.panelEx2.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); - this.panelEx2.TabIndex = 431; - this.panelEx2.Text = "随机添加"; - this.panelEx2.Click += new System.EventHandler(this.btnRandomAdd_Click); + this.btnRandomAdd.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnRandomAdd.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnRandomAdd.DisabledBackColor = System.Drawing.Color.Empty; + this.btnRandomAdd.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnRandomAdd.Location = new System.Drawing.Point(283, 128); + this.btnRandomAdd.Name = "btnRandomAdd"; + this.btnRandomAdd.Size = new System.Drawing.Size(58, 25); + this.btnRandomAdd.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnRandomAdd.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRandomAdd.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnRandomAdd.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnRandomAdd.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnRandomAdd.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnRandomAdd.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnRandomAdd.Style.GradientAngle = 90; + this.btnRandomAdd.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnRandomAdd.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnRandomAdd.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnRandomAdd.TabIndex = 431; + this.btnRandomAdd.Text = "随机添加"; + this.btnRandomAdd.Click += new System.EventHandler(this.btnRandomAdd_Click); // // ucGroupBoxEx1 // @@ -1554,19 +1568,19 @@ namespace TemuKJD.WXForms.ProductForms // this.dgvShop.AllowUserToAddRows = false; this.dgvShop.AllowUserToDeleteRows = false; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle7.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle7; this.dgvShop.AutoRowNumber = true; this.dgvShop.BackgroundColor = System.Drawing.Color.White; this.dgvShop.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle8.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle8.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle8.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle8.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle8.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle8; this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colSelect, @@ -1774,19 +1788,19 @@ namespace TemuKJD.WXForms.ProductForms // this.dgvSelectProduct.AllowUserToAddRows = false; this.dgvSelectProduct.AllowUserToDeleteRows = false; - dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; + dataGridViewCellStyle9.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvSelectProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9; this.dgvSelectProduct.AutoRowNumber = true; this.dgvSelectProduct.BackgroundColor = System.Drawing.Color.White; this.dgvSelectProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; + dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; + dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control; + dataGridViewCellStyle10.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText; + dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Highlight; + dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.HighlightText; + dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.False; + this.dgvSelectProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10; this.dgvSelectProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvSelectProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colCheck, @@ -1846,8 +1860,8 @@ namespace TemuKJD.WXForms.ProductForms // // colSupplierName // - dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle5; + dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle11; this.colSupplierName.Frozen = true; this.colSupplierName.HeaderText = "店铺名称"; this.colSupplierName.Name = "colSupplierName"; @@ -1925,8 +1939,8 @@ namespace TemuKJD.WXForms.ProductForms // // colProductName // - dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colProductName.DefaultCellStyle = dataGridViewCellStyle6; + dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colProductName.DefaultCellStyle = dataGridViewCellStyle12; this.colProductName.HeaderText = "商品标题"; this.colProductName.Name = "colProductName"; this.colProductName.ReadOnly = true; @@ -2113,6 +2127,7 @@ namespace TemuKJD.WXForms.ProductForms this.fPnlPriceRule.PerformLayout(); this.ucGroupBoxEx4.ResumeLayout(false); this.ucGroupBoxEx4.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pbSelectProd)).EndInit(); this.ucGroupBoxEx1.ResumeLayout(false); this.ucGroupBoxEx1.PerformLayout(); this.splitContainer3.Panel1.ResumeLayout(false); @@ -2157,7 +2172,7 @@ namespace TemuKJD.WXForms.ProductForms private System.Windows.Forms.TextBox txtStockNum; private System.Windows.Forms.Label label4; private DevComponents.DotNetBar.PanelEx btnStop; - private DevComponents.DotNetBar.PanelEx panelEx2; + private DevComponents.DotNetBar.PanelEx btnRandomAdd; private System.Windows.Forms.TextBox txtAddCount; private System.Windows.Forms.Label lblGoodsCount; private DevComponents.DotNetBar.PanelEx btnClearUpload; @@ -2271,5 +2286,6 @@ namespace TemuKJD.WXForms.ProductForms private System.Windows.Forms.DataGridViewTextBoxColumn colOnSaleNum; private System.Windows.Forms.DataGridViewTextBoxColumn colRemaining; private System.Windows.Forms.DataGridViewTextBoxColumn colMessage; + private System.Windows.Forms.PictureBox pbSelectProd; } } \ No newline at end of file diff --git a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs index 3a8ea98..56e6601 100644 --- a/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs +++ b/TEMUKJD/WXForms/ProductForms/WXDBProdUploadForm.cs @@ -1766,6 +1766,26 @@ namespace TemuKJD.WXForms.ProductForms } #endregion + #region 保存缓存盗链图片 + if (isChangeImgDic) + { + var url = BaseClass.BuildObjString("product/mdy_pdd_product"); + var data = ""; + Invoke(new Action(() => + { + data = UserLogin.GetSignaturex(); + data += "&spu_id=" + dbProd.spu_id; + data += "&wx_img_map_json=" + JsonHelper.SerializeObject(wxImgMapDic); + })); + var html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + isChangeImgDic = false; + } + #endregion + #region 识别类目 if (cell != null) { @@ -2326,6 +2346,26 @@ namespace TemuKJD.WXForms.ProductForms } #endregion + #region 保存缓存盗链图片 + if (isChangeImgDic) + { + var url = BaseClass.BuildObjString("product/mdy_pdd_product"); + var data = ""; + Invoke(new Action(() => + { + data = UserLogin.GetSignaturex(); + data += "&spu_id=" + dbProd.spu_id; + data += "&wx_img_map_json=" + JsonHelper.SerializeObject(wxImgMapDic); + })); + var html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + isChangeImgDic = false; + } + #endregion + #region 匹配产品属性 //真丝、蚕丝、香云纱、羊绒、羊毛、羊羔毛、羽绒、皮草 upProdParam.product.info.param = new List(); // 商品属性值 @@ -2714,6 +2754,26 @@ namespace TemuKJD.WXForms.ProductForms } #endregion + #region 保存缓存盗链图片 + if (isChangeImgDic) + { + var url = BaseClass.BuildObjString("product/mdy_pdd_product"); + var data = ""; + Invoke(new Action(() => + { + data = UserLogin.GetSignaturex(); + data += "&spu_id=" + dbProd.spu_id; + data += "&wx_img_map_json=" + JsonHelper.SerializeObject(wxImgMapDic); + })); + var html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) + html = GetHtml.PostUtf8(url, data); + isChangeImgDic = false; + } + #endregion + #region sku信息 upProdParam.product.productSkus = new List(); int skuIndex = 0; @@ -2941,7 +3001,7 @@ namespace TemuKJD.WXForms.ProductForms })); } - #region 草稿保存成功,保存缓存盗链图片 + #region 保存缓存盗链图片 if (isChangeImgDic) { var url = BaseClass.BuildObjString("product/mdy_pdd_product"); @@ -2957,6 +3017,7 @@ namespace TemuKJD.WXForms.ProductForms html = GetHtml.PostUtf8(url, data); if (string.IsNullOrEmpty(html) || !html.Contains("\"code\":200")) html = GetHtml.PostUtf8(url, data); + isChangeImgDic = false; } #endregion @@ -3286,17 +3347,36 @@ namespace TemuKJD.WXForms.ProductForms private void btnRandomAdd_Click(object sender, EventArgs e) { + btnRandomAdd.Enabled = false; + pbSelectProd.Visible = true; + Task.Run(() => + { + Thread.Sleep(5000); + Invoke(new Action(() => + { + btnRandomAdd.Enabled = true; + })); + }); int addCount = txtAddCount.Text.Trim().ParseToInt(); Task.Run(() => { List prodLst = new List(); + int index = 0; while (addCount > 0) { + index++; int prodCount = 0; // 如果产品数量在0到50之间,说明数据库商品数量不足,无需再重复筛选,直接随机打乱 if (prodLst.Count == 0 || prodLst.Count == Math.Min(50, addCount)) { - prodLst = GetRandomProductList(out prodCount, 1, Math.Min(50, addCount)); + if (index > 1 && prodCount > 0) + { + prodLst = GetRandomProductList(out prodCount, 1, Math.Min(50, addCount), true, prodCount); + } + else + { + prodLst = GetRandomProductList(out prodCount, 1, Math.Min(50, addCount)); + } Thread.Sleep(Randomx.GetId(50, 100)); } else @@ -3329,10 +3409,15 @@ namespace TemuKJD.WXForms.ProductForms } NaiBa.Util.Helper.ConfigHelper.SaveConfig("wx_db_prod_upload_list", this.lstTemuDBProductSelect); } + + Invoke(new Action(() => + { + pbSelectProd.Visible = false; + })); }); } - public List GetRandomProductList(out int totalCount, int page = 1, int pageSize = 50) + public List GetRandomProductList(out int totalCount, int page = 1, int pageSize = 50, bool isNotCount = false, int totalProdCount = 0) { var lstShopId = dgvShop.Rows.Cast().Where(row => row.Cells["colSelect"]?.Value.ParseToBool() == true).Select(r => r.Cells["colShopId"]?.Value.ToString()).ToList(); @@ -3348,6 +3433,11 @@ namespace TemuKJD.WXForms.ProductForms data = UserLogin.GetSignaturex() + "&page=" + 1 + "&page_size=" + pageSize; + if (isNotCount) + { + data += "&is_not_count=" + true; + data += "&prod_count=" + totalProdCount; + } data += "&in_ext_codes=" + txtExtCodeFilter.Text; data += "&in_spu_ids=" + txtIdFilter.Text; data += "&in_groups=" + cmbGroupFilter.Text; diff --git a/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.Designer.cs b/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.Designer.cs index e9c47c9..5fc76a5 100644 --- a/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.Designer.cs +++ b/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.Designer.cs @@ -40,6 +40,10 @@ namespace TemuKJD.WXForms.ProductForms System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.ucGroupBoxEx3 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); + this.panelEx3 = new DevComponents.DotNetBar.PanelEx(); + this.panelEx4 = new DevComponents.DotNetBar.PanelEx(); + this.btnDown = new DevComponents.DotNetBar.PanelEx(); this.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); this.chkFailDownProd = new TemuKJD.UserComponent.UcCheckBox(this.components); this.chkNoPreSale = new TemuKJD.UserComponent.UcCheckBox(this.components); @@ -131,6 +135,7 @@ namespace TemuKJD.WXForms.ProductForms this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); + this.ucGroupBoxEx3.SuspendLayout(); this.ucGroupBoxEx2.SuspendLayout(); this.ucGroupBoxEx4.SuspendLayout(); this.ucGroupBoxEx1.SuspendLayout(); @@ -162,6 +167,7 @@ namespace TemuKJD.WXForms.ProductForms // // splitContainer1.Panel1 // + this.splitContainer1.Panel1.Controls.Add(this.ucGroupBoxEx3); this.splitContainer1.Panel1.Controls.Add(this.ucGroupBoxEx2); this.splitContainer1.Panel1.Controls.Add(this.ucGroupBoxEx4); this.splitContainer1.Panel1.Controls.Add(this.ucGroupBoxEx1); @@ -169,10 +175,104 @@ namespace TemuKJD.WXForms.ProductForms // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.splitContainer3); - this.splitContainer1.Size = new System.Drawing.Size(1583, 641); + this.splitContainer1.Size = new System.Drawing.Size(1346, 641); this.splitContainer1.SplitterDistance = 165; this.splitContainer1.TabIndex = 11; // + // ucGroupBoxEx3 + // + this.ucGroupBoxEx3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.ucGroupBoxEx3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.ucGroupBoxEx3.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.ucGroupBoxEx3.BorderStyle = TemuKJD.UserComponent.UcGroupBoxEx.GroupBoxBorderStyle.ROUND; + this.ucGroupBoxEx3.Controls.Add(this.panelEx3); + this.ucGroupBoxEx3.Controls.Add(this.panelEx4); + this.ucGroupBoxEx3.Controls.Add(this.btnDown); + this.ucGroupBoxEx3.Location = new System.Drawing.Point(1030, 2); + this.ucGroupBoxEx3.Name = "ucGroupBoxEx3"; + this.ucGroupBoxEx3.Size = new System.Drawing.Size(314, 165); + this.ucGroupBoxEx3.TabIndex = 668; + this.ucGroupBoxEx3.TabStop = false; + this.ucGroupBoxEx3.Text = "商品下架"; + // + // panelEx3 + // + this.panelEx3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.panelEx3.CanvasColor = System.Drawing.SystemColors.Control; + this.panelEx3.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.panelEx3.DisabledBackColor = System.Drawing.Color.Empty; + this.panelEx3.Location = new System.Drawing.Point(208, 62); + this.panelEx3.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2); + this.panelEx3.Name = "panelEx3"; + this.panelEx3.Size = new System.Drawing.Size(84, 23); + this.panelEx3.Style.Alignment = System.Drawing.StringAlignment.Center; + this.panelEx3.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.panelEx3.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.panelEx3.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.panelEx3.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.panelEx3.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.panelEx3.Style.GradientAngle = 90; + this.panelEx3.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; + this.panelEx3.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.panelEx3.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.panelEx3.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.panelEx3.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; + this.panelEx3.TabIndex = 546; + this.panelEx3.Text = "停止下架"; + this.panelEx3.Click += new System.EventHandler(this.btnStop_Click); + // + // panelEx4 + // + this.panelEx4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.panelEx4.CanvasColor = System.Drawing.SystemColors.Control; + this.panelEx4.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.panelEx4.DisabledBackColor = System.Drawing.Color.Empty; + this.panelEx4.Location = new System.Drawing.Point(208, 93); + this.panelEx4.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2); + this.panelEx4.Name = "panelEx4"; + this.panelEx4.Size = new System.Drawing.Size(84, 23); + this.panelEx4.Style.Alignment = System.Drawing.StringAlignment.Center; + this.panelEx4.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.panelEx4.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); + this.panelEx4.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; + this.panelEx4.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.panelEx4.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; + this.panelEx4.Style.GradientAngle = 90; + this.panelEx4.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; + this.panelEx4.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.panelEx4.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.panelEx4.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.panelEx4.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; + this.panelEx4.TabIndex = 612; + this.panelEx4.Text = "清空列表选中"; + this.panelEx4.Click += new System.EventHandler(this.btnClearDgv_Click); + // + // btnDown + // + this.btnDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnDown.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; + this.btnDown.Cursor = System.Windows.Forms.Cursors.Hand; + this.btnDown.DisabledBackColor = System.Drawing.Color.Empty; + this.btnDown.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); + this.btnDown.Location = new System.Drawing.Point(208, 31); + this.btnDown.Name = "btnDown"; + this.btnDown.Size = new System.Drawing.Size(84, 23); + this.btnDown.Style.Alignment = System.Drawing.StringAlignment.Center; + this.btnDown.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnDown.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnDown.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelBorder; + this.btnDown.Style.BorderDashStyle = System.Drawing.Drawing2D.DashStyle.Dash; + this.btnDown.Style.BorderSide = DevComponents.DotNetBar.eBorderSide.None; + this.btnDown.Style.ForeColor.Color = System.Drawing.Color.White; + this.btnDown.Style.GradientAngle = 90; + this.btnDown.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; + this.btnDown.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnDown.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(25)))), ((int)(((byte)(102)))), ((int)(((byte)(255))))); + this.btnDown.TabIndex = 517; + this.btnDown.Text = "批量下架"; + this.btnDown.Click += new System.EventHandler(this.btnDown_Click); + // // ucGroupBoxEx2 // this.ucGroupBoxEx2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) @@ -191,7 +291,7 @@ namespace TemuKJD.WXForms.ProductForms this.ucGroupBoxEx2.Controls.Add(this.btnSetPreSale); this.ucGroupBoxEx2.Location = new System.Drawing.Point(571, 2); this.ucGroupBoxEx2.Name = "ucGroupBoxEx2"; - this.ucGroupBoxEx2.Size = new System.Drawing.Size(1010, 165); + this.ucGroupBoxEx2.Size = new System.Drawing.Size(460, 165); this.ucGroupBoxEx2.TabIndex = 667; this.ucGroupBoxEx2.TabStop = false; this.ucGroupBoxEx2.Text = "设置预售"; @@ -256,7 +356,7 @@ namespace TemuKJD.WXForms.ProductForms this.btnStop.CanvasColor = System.Drawing.SystemColors.Control; this.btnStop.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.btnStop.DisabledBackColor = System.Drawing.Color.Empty; - this.btnStop.Location = new System.Drawing.Point(904, 62); + this.btnStop.Location = new System.Drawing.Point(354, 62); this.btnStop.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2); this.btnStop.Name = "btnStop"; this.btnStop.Size = new System.Drawing.Size(84, 23); @@ -282,7 +382,7 @@ namespace TemuKJD.WXForms.ProductForms this.btnClearDgv.CanvasColor = System.Drawing.SystemColors.Control; this.btnClearDgv.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.btnClearDgv.DisabledBackColor = System.Drawing.Color.Empty; - this.btnClearDgv.Location = new System.Drawing.Point(904, 93); + this.btnClearDgv.Location = new System.Drawing.Point(354, 93); this.btnClearDgv.Margin = new System.Windows.Forms.Padding(4, 2, 2, 2); this.btnClearDgv.Name = "btnClearDgv"; this.btnClearDgv.Size = new System.Drawing.Size(84, 23); @@ -309,7 +409,7 @@ namespace TemuKJD.WXForms.ProductForms this.btnSetPreSale.Cursor = System.Windows.Forms.Cursors.Hand; this.btnSetPreSale.DisabledBackColor = System.Drawing.Color.Empty; this.btnSetPreSale.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - this.btnSetPreSale.Location = new System.Drawing.Point(904, 31); + this.btnSetPreSale.Location = new System.Drawing.Point(354, 31); this.btnSetPreSale.Name = "btnSetPreSale"; this.btnSetPreSale.Size = new System.Drawing.Size(84, 23); this.btnSetPreSale.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -838,7 +938,7 @@ namespace TemuKJD.WXForms.ProductForms // splitContainer3.Panel2 // this.splitContainer3.Panel2.Controls.Add(this.splitContainer4); - this.splitContainer3.Size = new System.Drawing.Size(1583, 472); + this.splitContainer3.Size = new System.Drawing.Size(1346, 472); this.splitContainer3.SplitterDistance = 442; this.splitContainer3.TabIndex = 1; // @@ -864,7 +964,7 @@ namespace TemuKJD.WXForms.ProductForms this.splitContainer2.Panel2.Controls.Add(this.chkTestNoAuditUpload); this.splitContainer2.Panel2.Controls.Add(this.dgvSelectProduct); this.splitContainer2.Panel2.Padding = new System.Windows.Forms.Padding(0, 0, 4, 0); - this.splitContainer2.Size = new System.Drawing.Size(1583, 442); + this.splitContainer2.Size = new System.Drawing.Size(1346, 442); this.splitContainer2.SplitterDistance = 350; this.splitContainer2.TabIndex = 0; // @@ -1068,7 +1168,7 @@ namespace TemuKJD.WXForms.ProductForms // this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None; this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue; - this.pbLoading.Location = new System.Drawing.Point(589, 196); + this.pbLoading.Location = new System.Drawing.Point(471, 196); this.pbLoading.Name = "pbLoading"; this.pbLoading.Size = new System.Drawing.Size(50, 50); this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -1134,7 +1234,7 @@ namespace TemuKJD.WXForms.ProductForms this.dgvSelectProduct.Name = "dgvSelectProduct"; this.dgvSelectProduct.ReadOnly = true; this.dgvSelectProduct.RowTemplate.Height = 23; - this.dgvSelectProduct.Size = new System.Drawing.Size(1225, 442); + this.dgvSelectProduct.Size = new System.Drawing.Size(988, 442); this.dgvSelectProduct.TabIndex = 187; this.dgvSelectProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSelectProduct_CellContentClick); // @@ -1341,8 +1441,8 @@ namespace TemuKJD.WXForms.ProductForms // this.splitContainer4.Panel2.Controls.Add(this.btnClear); this.splitContainer4.Panel2.Controls.Add(this.panelEx1); - this.splitContainer4.Size = new System.Drawing.Size(1583, 26); - this.splitContainer4.SplitterDistance = 892; + this.splitContainer4.Size = new System.Drawing.Size(1346, 26); + this.splitContainer4.SplitterDistance = 655; this.splitContainer4.TabIndex = 3; // // statusBar @@ -1353,7 +1453,7 @@ namespace TemuKJD.WXForms.ProductForms 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(892, 26); + this.statusBar.Size = new System.Drawing.Size(655, 26); this.statusBar.TabIndex = 2; // // btnClear @@ -1410,7 +1510,7 @@ namespace TemuKJD.WXForms.ProductForms // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.BackColor = System.Drawing.Color.White; - this.ClientSize = new System.Drawing.Size(1583, 641); + this.ClientSize = new System.Drawing.Size(1346, 641); this.Controls.Add(this.splitContainer1); this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.Name = "WXProdPreSaleForm"; @@ -1421,6 +1521,7 @@ namespace TemuKJD.WXForms.ProductForms this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); + this.ucGroupBoxEx3.ResumeLayout(false); this.ucGroupBoxEx2.ResumeLayout(false); this.ucGroupBoxEx2.PerformLayout(); this.ucGroupBoxEx4.ResumeLayout(false); @@ -1539,5 +1640,9 @@ namespace TemuKJD.WXForms.ProductForms private System.Windows.Forms.DataGridViewTextBoxColumn colAddTime; private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; private UserComponent.UcCheckBox chkFailDownProd; + private UserComponent.UcGroupBoxEx ucGroupBoxEx3; + private DevComponents.DotNetBar.PanelEx panelEx3; + private DevComponents.DotNetBar.PanelEx panelEx4; + private DevComponents.DotNetBar.PanelEx btnDown; } } \ No newline at end of file diff --git a/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.cs b/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.cs index dac42e8..2840f99 100644 --- a/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.cs +++ b/TEMUKJD/WXForms/ProductForms/WXProdPreSaleForm.cs @@ -1081,6 +1081,109 @@ namespace TemuKJD.WXForms.ProductForms { PreType = cmbPreType.Text.Trim(); } + + private void btnDown_Click(object sender, EventArgs e) + { + var rowLst = dgvSelectProduct.Rows.Cast().Where(r => r.Cells["colCheck"].Value.ParseToBool() == true).ToList(); + if (rowLst.Count <= 0) + { + BaseMsgForm.ShowError("请勾选需要操作的商品!"); + return; + } + + this.pbLoading.Visible = true; + this.btnSetPreSale.Enabled = false; + cancellationTokenSource = new CancellationTokenSource(); + Task.Run(() => + { + SetProdDown(rowLst); + Invoke(new Action(() => + { + this.statusBar.lblTaskStatus.Text = "商品下架完毕"; + BaseMsgForm.ShowInfo("商品下架完毕"); + this.pbLoading.Visible = false; + this.btnSetPreSale.Enabled = true; + })); + }, cancellationTokenSource.Token); + + } + + void SetProdDown(List rowLst) + { + Invoke(new Action(() => + { + this.pbLoading.Visible = true; + this.statusBar.lblTaskStatus.Text = "正在下架" + "...".Substring(0, DateTime.Now.Second % 4); + this.statusBar.pgbTaskProgress.Maximum = dgvSelectProduct.Rows.Count; + this.statusBar.UpdateProgressBar(0); + })); + + foreach (var row in rowLst) + { + Invoke(new Action(() => + { + row.Cells["colOpResult"].Value = ""; + })); + + if (cancellationTokenSource.IsCancellationRequested) + break; + + var prodId = row.Cells["colDraftId"].Value.ParseToString(); + var shopId = row.Cells["colSupplierId"].Value.ParseToString(); + var shop = GlobalConfig.ShopLoginList.FirstOrDefault(s => s.ShopId == shopId); + if (shop == null) + { + Invoke(new Action(() => + { + row.Cells["colOpResult"].Value = "店铺不存在"; + })); + continue; + } + if (shop.LoginStatus != "登录成功") + { + Invoke(new Action(() => + { + row.Cells["colOpResult"].Value = "店铺掉线"; + })); + continue; + } + + var downProdRst = WXPreSale.DownProd(shop, prodId.ParseToLong()); + System.Threading.Thread.Sleep(Randomx.GetId(100, 200)); + if (!downProdRst.Contains("\"code\":0")) + { + if (downProdRst.Contains("biz magic invalid")) + { + WXShopListForm.Instance.CheckShopLogin(new ShopLoginInfo[] { shop }, false); + if (shop.LoginStatus != "登录成功") + { + Invoke(new Action(() => + { + row.Cells["colOpResult"].Value = "店铺掉线"; + })); + continue; + } + } + + var errmsg = BaseRegex.GetStringJson(ref downProdRst, "msg"); + if (string.IsNullOrWhiteSpace(errmsg)) + errmsg = downProdRst; + + Invoke(new Action(() => + { + row.Cells["colOpResult"].Value = errmsg; + })); + } + + if (downProdRst.Contains("\"code\":0")) + { + Invoke(new Action(() => + { + row.Cells["colOpResult"].Value = "下架成功"; + })); + } + } + } } public class WXPreSale diff --git a/TEMUKJD/WXForms/ProductForms/WXProductForm.Designer.cs b/TEMUKJD/WXForms/ProductForms/WXProductForm.Designer.cs index 2f239f7..a8f4885 100644 --- a/TEMUKJD/WXForms/ProductForms/WXProductForm.Designer.cs +++ b/TEMUKJD/WXForms/ProductForms/WXProductForm.Designer.cs @@ -29,7 +29,7 @@ private void InitializeComponent() { System.Windows.Forms.TreeNode treeNode1 = new System.Windows.Forms.TreeNode("选品上传"); - System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("商品预售"); + System.Windows.Forms.TreeNode treeNode2 = new System.Windows.Forms.TreeNode("商品预售/下架"); System.Windows.Forms.TreeNode treeNode3 = new System.Windows.Forms.TreeNode("营销工具"); System.Windows.Forms.TreeNode treeNode4 = new System.Windows.Forms.TreeNode("商品管理", new System.Windows.Forms.TreeNode[] { treeNode1, @@ -127,8 +127,8 @@ this.tv.Name = "tv"; treeNode1.Name = "选品上传"; treeNode1.Text = "选品上传"; - treeNode2.Name = "商品预售"; - treeNode2.Text = "商品预售"; + treeNode2.Name = "商品预售/下架"; + treeNode2.Text = "商品预售/下架"; treeNode3.Name = "营销工具"; treeNode3.Text = "营销工具"; treeNode4.Name = "商品管理"; diff --git a/TEMUKJD/WXForms/ProductForms/WXProductForm.cs b/TEMUKJD/WXForms/ProductForms/WXProductForm.cs index d38ef19..c2958a0 100644 --- a/TEMUKJD/WXForms/ProductForms/WXProductForm.cs +++ b/TEMUKJD/WXForms/ProductForms/WXProductForm.cs @@ -70,7 +70,7 @@ namespace TemuKJD.WXForms.ProductForms case "选品上传": SetForm(userSelectDbProductForm.Value); break; - case "商品预售": + case "商品预售/下架": SetForm(wxProdPreSaleForm.Value); break; //case "营销工具":