diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 91d6f28..0775bda 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,7 +27,7 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 958; + public static int VersionCount = 959; //public static int VersionCount = 613; /// diff --git a/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.Designer.cs b/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.Designer.cs index 8ade5e1..decdd9a 100644 --- a/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.Designer.cs +++ b/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.Designer.cs @@ -32,13 +32,14 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms 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(); - 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.ucGroupBoxEx2 = new TemuKJD.UserComponent.UcGroupBoxEx(this.components); this.chkDownNoPrice = new TemuKJD.UserComponent.UcCheckBox(this.components); @@ -108,6 +109,11 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms this.chkUseExtCodePrice = new TemuKJD.UserComponent.UcCheckBox(this.components); this.pbLoading = new System.Windows.Forms.PictureBox(); this.dgvActProduct = new TemuKJD.UserComponent.DataGridViewEx(); + this.splitContainer4 = new System.Windows.Forms.SplitContainer(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); + this.btnClear = new DevComponents.DotNetBar.PanelEx(); + this.panelEx1 = new DevComponents.DotNetBar.PanelEx(); + this.panel1 = new System.Windows.Forms.Panel(); this.colCheck = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.colSupplierId = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSupplierName = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -124,11 +130,6 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms this.colUpdateTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.ColDelete = new System.Windows.Forms.DataGridViewLinkColumn(); this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.splitContainer4 = new System.Windows.Forms.SplitContainer(); - this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); - this.btnClear = new DevComponents.DotNetBar.PanelEx(); - this.panelEx1 = new DevComponents.DotNetBar.PanelEx(); - this.panel1 = new System.Windows.Forms.Panel(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -963,19 +964,19 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms // this.dgvShop.AllowUserToAddRows = false; this.dgvShop.AllowUserToDeleteRows = false; - dataGridViewCellStyle8.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle8; + dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvShop.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; 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))))); - dataGridViewCellStyle9.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle9.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle9.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle9.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle9.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle9.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle9.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvShop.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle9; + 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; this.dgvShop.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvShop.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colSelect, @@ -1192,19 +1193,19 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms // this.dgvActProduct.AllowUserToAddRows = false; this.dgvActProduct.AllowUserToDeleteRows = false; - dataGridViewCellStyle10.BackColor = System.Drawing.Color.WhiteSmoke; - this.dgvActProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10; + dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke; + this.dgvActProduct.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3; this.dgvActProduct.AutoRowNumber = true; this.dgvActProduct.BackgroundColor = System.Drawing.Color.White; this.dgvActProduct.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; - dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; - dataGridViewCellStyle11.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); - dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; - dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; - dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; - dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.False; - this.dgvActProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; + 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.dgvActProduct.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; this.dgvActProduct.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dgvActProduct.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { this.colCheck, @@ -1234,131 +1235,6 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms this.dgvActProduct.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvSelectProduct_CellContentClick); this.dgvActProduct.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dgvSelectProduct_Scroll); // - // colCheck - // - this.colCheck.Frozen = true; - 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.Frozen = true; - this.colSupplierId.HeaderText = "店铺Id"; - this.colSupplierId.Name = "colSupplierId"; - this.colSupplierId.ReadOnly = true; - // - // colSupplierName - // - dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle12; - this.colSupplierName.Frozen = true; - this.colSupplierName.HeaderText = "店铺名称"; - this.colSupplierName.Name = "colSupplierName"; - this.colSupplierName.ReadOnly = true; - // - // colLogin - // - this.colLogin.HeaderText = "登录"; - this.colLogin.Name = "colLogin"; - this.colLogin.ReadOnly = true; - this.colLogin.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colLogin.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colLogin.Width = 40; - // - // colInShop - // - this.colInShop.HeaderText = "进店"; - this.colInShop.Name = "colInShop"; - this.colInShop.ReadOnly = true; - this.colInShop.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colInShop.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - this.colInShop.Width = 40; - // - // colSpuId - // - this.colSpuId.HeaderText = "商品Id"; - this.colSpuId.Name = "colSpuId"; - this.colSpuId.ReadOnly = true; - this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; - // - // colGoodsSn - // - this.colGoodsSn.HeaderText = "商品货号"; - this.colGoodsSn.Name = "colGoodsSn"; - this.colGoodsSn.ReadOnly = true; - // - // colImgUrl - // - this.colImgUrl.HeaderText = "图片地址"; - this.colImgUrl.Name = "colImgUrl"; - this.colImgUrl.ReadOnly = true; - this.colImgUrl.Visible = false; - // - // colProductSkcPic - // - this.colProductSkcPic.HeaderText = "图片"; - this.colProductSkcPic.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; - this.colProductSkcPic.Name = "colProductSkcPic"; - this.colProductSkcPic.ReadOnly = true; - this.colProductSkcPic.Width = 60; - // - // colProductName - // - dataGridViewCellStyle13.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colProductName.DefaultCellStyle = dataGridViewCellStyle13; - this.colProductName.HeaderText = "商品标题"; - this.colProductName.Name = "colProductName"; - this.colProductName.ReadOnly = true; - this.colProductName.Width = 140; - // - // colProdPrice - // - this.colProdPrice.HeaderText = "价格"; - this.colProdPrice.Name = "colProdPrice"; - this.colProdPrice.ReadOnly = true; - this.colProdPrice.Width = 90; - // - // colStock - // - this.colStock.HeaderText = "库存"; - this.colStock.Name = "colStock"; - this.colStock.ReadOnly = true; - // - // colSaleCnt - // - this.colSaleCnt.HeaderText = "销量"; - this.colSaleCnt.Name = "colSaleCnt"; - this.colSaleCnt.ReadOnly = true; - // - // colUpdateTime - // - dataGridViewCellStyle14.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.colUpdateTime.DefaultCellStyle = dataGridViewCellStyle14; - this.colUpdateTime.FillWeight = 80F; - this.colUpdateTime.HeaderText = "上架时间"; - this.colUpdateTime.Name = "colUpdateTime"; - this.colUpdateTime.ReadOnly = true; - // - // ColDelete - // - this.ColDelete.HeaderText = "删除"; - this.ColDelete.Name = "ColDelete"; - this.ColDelete.ReadOnly = true; - this.ColDelete.Visible = false; - this.ColDelete.Width = 75; - // - // colOpResult - // - this.colOpResult.HeaderText = "操作结果"; - this.colOpResult.Name = "colOpResult"; - this.colOpResult.ReadOnly = true; - this.colOpResult.Width = 260; - // // splitContainer4 // this.splitContainer4.Dock = System.Windows.Forms.DockStyle.Fill; @@ -1450,6 +1326,133 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms this.panel1.TabIndex = 189; this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint); // + // colCheck + // + this.colCheck.Frozen = true; + 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.Frozen = true; + this.colSupplierId.HeaderText = "店铺Id"; + this.colSupplierId.Name = "colSupplierId"; + this.colSupplierId.ReadOnly = true; + // + // colSupplierName + // + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colSupplierName.DefaultCellStyle = dataGridViewCellStyle5; + this.colSupplierName.Frozen = true; + this.colSupplierName.HeaderText = "店铺名称"; + this.colSupplierName.Name = "colSupplierName"; + this.colSupplierName.ReadOnly = true; + // + // colLogin + // + this.colLogin.HeaderText = "登录"; + this.colLogin.Name = "colLogin"; + this.colLogin.ReadOnly = true; + this.colLogin.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colLogin.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colLogin.Width = 40; + // + // colInShop + // + this.colInShop.HeaderText = "进店"; + this.colInShop.Name = "colInShop"; + this.colInShop.ReadOnly = true; + this.colInShop.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colInShop.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + this.colInShop.Width = 40; + // + // colSpuId + // + this.colSpuId.HeaderText = "商品Id"; + this.colSpuId.Name = "colSpuId"; + this.colSpuId.ReadOnly = true; + this.colSpuId.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colSpuId.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; + // + // colGoodsSn + // + this.colGoodsSn.HeaderText = "商品货号"; + this.colGoodsSn.Name = "colGoodsSn"; + this.colGoodsSn.ReadOnly = true; + // + // colImgUrl + // + this.colImgUrl.HeaderText = "图片地址"; + this.colImgUrl.Name = "colImgUrl"; + this.colImgUrl.ReadOnly = true; + this.colImgUrl.Visible = false; + // + // colProductSkcPic + // + this.colProductSkcPic.HeaderText = "图片"; + this.colProductSkcPic.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; + this.colProductSkcPic.Name = "colProductSkcPic"; + this.colProductSkcPic.ReadOnly = true; + this.colProductSkcPic.Width = 60; + // + // colProductName + // + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colProductName.DefaultCellStyle = dataGridViewCellStyle6; + this.colProductName.HeaderText = "商品标题"; + this.colProductName.Name = "colProductName"; + this.colProductName.ReadOnly = true; + this.colProductName.Width = 140; + // + // colProdPrice + // + this.colProdPrice.HeaderText = "价格"; + this.colProdPrice.Name = "colProdPrice"; + this.colProdPrice.ReadOnly = true; + this.colProdPrice.Width = 90; + // + // colStock + // + this.colStock.HeaderText = "库存"; + this.colStock.Name = "colStock"; + this.colStock.ReadOnly = true; + // + // colSaleCnt + // + this.colSaleCnt.HeaderText = "销量"; + this.colSaleCnt.Name = "colSaleCnt"; + this.colSaleCnt.ReadOnly = true; + // + // colUpdateTime + // + dataGridViewCellStyle7.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colUpdateTime.DefaultCellStyle = dataGridViewCellStyle7; + this.colUpdateTime.FillWeight = 80F; + this.colUpdateTime.HeaderText = "上架时间"; + this.colUpdateTime.Name = "colUpdateTime"; + this.colUpdateTime.ReadOnly = true; + // + // ColDelete + // + this.ColDelete.HeaderText = "删除"; + this.ColDelete.Name = "ColDelete"; + this.ColDelete.ReadOnly = true; + this.ColDelete.Visible = false; + this.ColDelete.Width = 75; + // + // colOpResult + // + dataGridViewCellStyle8.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.colOpResult.DefaultCellStyle = dataGridViewCellStyle8; + this.colOpResult.HeaderText = "操作结果"; + this.colOpResult.Name = "colOpResult"; + this.colOpResult.ReadOnly = true; + this.colOpResult.Width = 260; + // // PDDAddActivityForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -1573,6 +1576,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms private UserComponent.UcCheckBox chkActivity; private System.Windows.Forms.Label label2; private System.Windows.Forms.DateTimePicker dtpStartDay; + private DevComponents.DotNetBar.PanelEx panelEx2; + private UserComponent.UcCheckBox chkDownNoPrice; private System.Windows.Forms.DataGridViewCheckBoxColumn colCheck; private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierId; private System.Windows.Forms.DataGridViewTextBoxColumn colSupplierName; @@ -1589,7 +1594,5 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms private System.Windows.Forms.DataGridViewTextBoxColumn colUpdateTime; private System.Windows.Forms.DataGridViewLinkColumn ColDelete; private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; - private DevComponents.DotNetBar.PanelEx panelEx2; - private UserComponent.UcCheckBox chkDownNoPrice; } } \ No newline at end of file diff --git a/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.cs b/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.cs index 443280b..dec9b8b 100644 --- a/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.cs +++ b/TEMUKJD/PDDForms/ProductForms/ActivityForms/PDDAddActivityForm.cs @@ -1663,6 +1663,11 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms { string activityErr = ""; var activityRst2 = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 21365, 27); + for (int i = 0; i < 5 && !activityRst2.Contains("\"success\":true"); i++) + { + Thread.Sleep(Randomx.GetId(200, 1000)); + activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 21365, 27); + } if (!activityRst2.Contains("\"success\":true")) { var error = BaseRegex.GetStringJson(ref activityRst2, "error_msg"); @@ -1693,6 +1698,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms { } var sku = prodParam.skus.FirstOrDefault(sk => string.Join(",", sk.spec.Select(s => s.spec_name)) == activitySkuInfo.spec_info_str); + if (sku != null && sku.multi_price == activitySkuInfo.require_price + 1) + sku.multi_price -= 1; if (sku == null || sku.multi_price > activitySkuInfo.require_price) { activityErr += "\r\n上传错误 365价格低于产品价 " + activitySkuInfo.require_price + " < " + sku.multi_price; @@ -1742,7 +1749,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms actSubmitParam.create_protocol_vo.need_create_cost_template = true; var addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 21365, 27); - if (addActivityRst.Contains("频繁")) + for (int i = 0; i < 3 && addActivityRst.Contains("频繁"); i++) { Thread.Sleep(Randomx.GetId(3000, 7000)); addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 21365, 27); @@ -1775,10 +1782,15 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms string activityErr = ""; Thread.Sleep(Randomx.GetId(500, 1500)); var activityRst1 = activity_goods_info(shop, prodParam.goods_id.ParseToString(), "20981"); - if (!activityRst1.Contains("\"success\":true")) + for (int i = 0; i < 5 && !activityRst1.Contains("\"success\":true"); i++) + { + Thread.Sleep(Randomx.GetId(200, 1000)); activityRst1 = activity_goods_info(shop, prodParam.goods_id.ParseToString(), "20981"); + } if (!activityRst1.Contains("\"success\":true")) { + PDDShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + var error = BaseRegex.GetStringJson(ref activityRst1, "error_msg"); if (string.IsNullOrEmpty(error)) error = activityRst1; @@ -1804,15 +1816,15 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms activityErr += "校验失败 981sku丢失 " + activitySku.sku_name; return activityErr; } - if (sku.multi_price > activitySku.suggest_price && sku.multi_price == activitySku.suggest_price + 1) - { - sku.multi_price = activitySku.suggest_price + 1; - } + //if (sku.multi_price > activitySku.suggest_price && sku.multi_price == activitySku.suggest_price + 1) + //{ + // sku.multi_price = activitySku.suggest_price + 1; + //} if (sku.multi_price > activitySku.suggest_price) { - // 此处临时用sku69_code记录一下需要改动库存的sku - if (sku.quantity_delta > 0) - sku.sku69_code = "yes"; + // 此处临时用sku69_code记录一下需要改动库存的sku,库存为0的也记录后面再处理 + //if (sku.quantity_delta > 0) + sku.sku69_code = "yes"; sku.multi_price = activitySku.suggest_price; } } @@ -1824,7 +1836,7 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms } catch (Exception ex) { - activityErr += "校验失败 981查询/新建失败 " + ex.Message; + activityErr += "校验失败 981查询/新建失败 解析错误 " + ex.Message; return activityErr; } activityErr = "981校验成功"; @@ -1836,6 +1848,11 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms string activityErr = ""; Thread.Sleep(Randomx.GetId(500, 1500)); var activityRst1 = activity_goods_info(shop, prodParam.goods_id.ParseToString(), "20981"); + for (int i = 0; i < 5 && !activityRst1.Contains("\"success\":true"); i++) + { + Thread.Sleep(Randomx.GetId(200, 1000)); + activityRst1 = activity_goods_info(shop, prodParam.goods_id.ParseToString(), "20981"); + } if (!activityRst1.Contains("\"success\":true")) { var error = BaseRegex.GetStringJson(ref activityRst1, "error_msg"); @@ -1865,6 +1882,8 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms { //var sku = prodParam.skus.FirstOrDefault(s => s.sku_id == activitySku.sku_id); var sku = prodParam.skus.FirstOrDefault(sk => string.Join(",", sk.spec.Select(s => s.spec_name)) == activitySku.sku_name); + if (sku != null && sku.multi_price == activitySku.suggest_price + 1) + sku.multi_price -= 1; if (sku == null || sku.multi_price > activitySku.suggest_price) { activityErr += "\r\n上传错误 981价格低于产品价 " + activitySku.suggest_price + " < " + sku.multi_price; @@ -1934,6 +1953,11 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 20981, 27); err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg"); } + for (int i = 0; i< 3 && (!addActivityRst.Contains("\"success\":true") || !string.IsNullOrEmpty(err_msg)); i++) + { + Thread.Sleep(Randomx.GetId(1000, 2500)); + addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 20981, 27); + } if (!addActivityRst.Contains("\"success\":true") || !string.IsNullOrEmpty(err_msg)) { var error = BaseRegex.GetStringJson(ref addActivityRst, "error_msg"); @@ -2067,6 +2091,11 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms Thread.Sleep(Randomx.GetId(500, 1500)); var activityRst2 = activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 22347, 27); if (!activityRst2.Contains("\"success\":true")) + { + Thread.Sleep(Randomx.GetId(200, 1000)); + activity_goods_price_rule(shop, prodParam.goods_id.ParseToString(), 22347, 27); + } + if (!activityRst2.Contains("\"success\":true")) { var error = BaseRegex.GetStringJson(ref activityRst2, "error_msg"); if (string.IsNullOrEmpty(error)) @@ -2161,6 +2190,11 @@ namespace TemuKJD.PDDForms.ProductForms.ActivityForms addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 22347, 27); err_msg = BaseRegex.GetStringJson(ref addActivityRst, "error_msg"); } + for (int i = 0; i < 3 && !addActivityRst.Contains("\"success\":true"); i++) + { + Thread.Sleep(Randomx.GetId(2000, 5000)); + addActivityRst = add_activity_goods(shop, actSubmitParam, prodParam.goods_id.ParseToString(), 22347, 27); + } if (!addActivityRst.Contains("\"success\":true") || !string.IsNullOrEmpty(err_msg)) { var error = BaseRegex.GetStringJson(ref addActivityRst, "error_msg"); @@ -3944,7 +3978,7 @@ Content-Type: image/jpeg Invoke(new Action(() => { - row.Cells["colOpResult"].Value = ""; + row.Cells["colOpResult"].Value = "正在报名活动"; })); try @@ -3999,6 +4033,7 @@ Content-Type: image/jpeg #endregion #region 获取数据库商品详情 + Thread.Sleep(Randomx.GetId(5000, 10000)); var dbProds = GetProductDetailByExtCode(actProd.lstPInfo.out_goods_sn); if (dbProds.Count == 0 || dbProds.Count > 1) { @@ -4272,16 +4307,43 @@ Content-Type: image/jpeg { row.Cells["colOpResult"].Value = checkActivityRst; })); + if (checkActivityRst.Contains("价格均低于产品价") && chkDownNoPrice.Checked) + { + // 处理下架 + var downProdRst = PDDProductUpDownForm.down_goods(shop, actProd.goods_id.ParseToString()); + for (int i = 0; i < 5 && !downProdRst.Contains("\"success\":true"); i++) + { + Thread.Sleep(Randomx.GetId(100, 1000)); + downProdRst = PDDProductUpDownForm.down_goods(shop, actProd.goods_id.ParseToString()); + } + if (!downProdRst.Contains("\"success\":true")) + { + Invoke(new Action(() => + { + var error = BaseRegex.GetStringJson(ref downProdRst, "errorMsg"); + if (string.IsNullOrEmpty(error)) + error = downProdRst; + row.Cells["colOpResult"].Value = checkActivityRst + " 尝试下架失败 " + error; + })); + } + else + { + Invoke(new Action(() => + { + row.Cells["colOpResult"].Value = checkActivityRst + "下架成功"; + })); + } + } continue; } - - if (prodParam.skus.Any(s => s.sku69_code == "yes")) + + if (prodParam.skus.Any(s => s.sku69_code == "yes" && s.quantity_delta > 0)) { PddEditProdStockQuantity prodQuantity = new PddEditProdStockQuantity(); prodQuantity.data = new List(); - foreach(var sku in prodParam.skus) + foreach (var sku in prodParam.skus) { - if (sku.sku69_code == "yes") + if (sku.sku69_code == "yes" && sku.quantity_delta > 0) { prodQuantity.data.Add(new quantityData() { @@ -4293,17 +4355,39 @@ Content-Type: image/jpeg } } var mdyQuantityRst = increase_prod_stock_quantity(shop, prodQuantity); + for (int i = 0; i < 5 && !mdyQuantityRst.Contains("\"success\":true"); i++) + { + Thread.Sleep(Randomx.GetId(100, 1000)); + mdyQuantityRst = increase_prod_stock_quantity(shop, prodQuantity); + } if (!mdyQuantityRst.Contains("\"success\":true")) { - //todo 处理修改失败的,修改成功拿去报活动; + var error = BaseRegex.GetStringJson(ref mdyQuantityRst, "error_msg"); + if (string.IsNullOrEmpty(error)) + error = mdyQuantityRst; + + Invoke(new Action(() => + { + row.Cells["colOpResult"].Value = "商品编辑失败 " + error; + })); + } + else + { + foreach (var sku in prodParam.skus) + { + if (sku.sku69_code == "yes" && sku.quantity_delta > 0) + { + sku.quantity_delta = 0; + } + } } } - //string activityErr = SignActivity(shop, prodParam, sign22347, sign20981, sign21365, sign15996); - //Invoke(new Action(() => - //{ - // row.Cells["colOpResult"].Value = activityErr; - //})); + string activityErr = SignActivity(shop, prodParam, sign22347, sign20981, sign21365, sign15996); + Invoke(new Action(() => + { + row.Cells["colOpResult"].Value = activityErr; + })); } catch (Exception ex) { diff --git a/TEMUKJD/PDDForms/ProductForms/PDDProductUpDownForm.cs b/TEMUKJD/PDDForms/ProductForms/PDDProductUpDownForm.cs index 31a90db..c71f298 100644 --- a/TEMUKJD/PDDForms/ProductForms/PDDProductUpDownForm.cs +++ b/TEMUKJD/PDDForms/ProductForms/PDDProductUpDownForm.cs @@ -493,7 +493,7 @@ namespace TemuKJD.PDDForms.ProductForms return result; } - public string down_goods(ShopLoginInfo shop, string prodIds) + public static string down_goods(ShopLoginInfo shop, string prodIds) { var anti = shop.AntiContents.LastOrDefault().ParseToString(); if (shop.AntiContents.Count > 0)