From 54ee83df62ed69d2f0c761966a795afb30eb02a3 Mon Sep 17 00:00:00 2001 From: wule_5900x Date: Sun, 10 Aug 2025 08:58:18 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AF=BB=E5=8F=96=E9=80=80=E8=B4=A7=E5=8C=85?= =?UTF-8?q?=E8=A3=B9=E8=AF=A6=E6=83=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AllBase/BaseClass.cs | 4 +- .../Result/TemuReturnPackageDetailInfo.cs | 21 + .../AdminForms/AdminShopLoginForm.Designer.cs | 5 +- .../ProductThirdSelectListManageForm.cs | 3 +- .../ReturnPackageDetailForm.Designer.cs | 188 ++++---- .../ShopForms/ReturnPackageDetailForm.cs | 452 +++++++++++++++++- .../ShopForms/ReturnPackageDetailForm.resx | 8 +- 7 files changed, 589 insertions(+), 92 deletions(-) diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 7ccf6a9..190db74 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,8 +27,8 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 512; - //public static int VersionCount = 512; + public static int VersionCount = 513; + //public static int VersionCount = 513; /// /// 版本号 diff --git a/AllBase/Model/Result/TemuReturnPackageDetailInfo.cs b/AllBase/Model/Result/TemuReturnPackageDetailInfo.cs index c26b11e..6b9333b 100644 --- a/AllBase/Model/Result/TemuReturnPackageDetailInfo.cs +++ b/AllBase/Model/Result/TemuReturnPackageDetailInfo.cs @@ -40,5 +40,26 @@ namespace AllBase.Model.Result /// public List reasonDesc { get; set; } public string remark { get; set; } + public string extCode { get; set; } + } + + public class TemuReturnPackageDetailParam + { + public string returnPackageNo { get; set; } + public string mallId { get; set; } + public string productSkcId { get; set; } + public string productSkuId { get; set; } + public int productCount { get; set; } + public string productSize { get; set; } + public string productColor { get; set; } + public string returnReason { get; set; } + /// + /// 货号 + /// + public string itemNo { get; set; } + /// + /// /9j/开头的base64图片 + /// + public string productSkcPicture { get; set; } } } diff --git a/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.Designer.cs b/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.Designer.cs index 10bea26..1479a40 100644 --- a/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.Designer.cs +++ b/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.Designer.cs @@ -83,7 +83,7 @@ this.splitContainer1.Panel2.Controls.Add(this.btnReload); this.splitContainer1.Panel2.Controls.Add(this.chkCloseAfterLogin); this.splitContainer1.Size = new System.Drawing.Size(1438, 736); - this.splitContainer1.SplitterDistance = 676; + this.splitContainer1.SplitterDistance = 672; this.splitContainer1.SplitterWidth = 3; this.splitContainer1.TabIndex = 4; // @@ -95,14 +95,13 @@ this.btnReturnPackage.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnReturnPackage.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnReturnPackage.ForeColor = System.Drawing.Color.White; - this.btnReturnPackage.Location = new System.Drawing.Point(674, 17); + this.btnReturnPackage.Location = new System.Drawing.Point(674, 31); this.btnReturnPackage.Margin = new System.Windows.Forms.Padding(2); this.btnReturnPackage.Name = "btnReturnPackage"; this.btnReturnPackage.Size = new System.Drawing.Size(136, 25); this.btnReturnPackage.TabIndex = 463; this.btnReturnPackage.Text = "提交退货到库存管理"; this.btnReturnPackage.UseVisualStyleBackColor = false; - this.btnReturnPackage.Visible = false; this.btnReturnPackage.Click += new System.EventHandler(this.btnReturnPackage_Click); // // btnLoginAgain diff --git a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs index 457ca44..7debafe 100644 --- a/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs +++ b/TEMUKJD/KJDForms/ProductThirdSelectForms/ProductThirdSelectListManageForm.cs @@ -607,8 +607,9 @@ namespace TemuKJD.KJDForms.ProductThirdSelectForms var prodDetailJsonReplace = Regex.Replace(prodDetailJson, pattern, "$1\\$2"); string pattern2 = @"([^\\,:""{\[])(""[^,:""}\]])";//希伯来文中的引号转义在数据库中有时候会丢失,回来发现了给配上\符号 var prodDetailJsonReplace2 = Regex.Replace(prodDetailJsonReplace, pattern2, "$1\\$2"); - var productDetail = JsonHelper.DeserializeJsonToObject(prodDetailJsonReplace2); + //var productDetail = JsonHelper.DeserializeJsonToObject(prodDetailJsonReplace2); //result = UploadProduct(shop, productDetail, temuDBProd.size_json); //将商品上传至草稿箱 + temuDBProd.product_json = prodDetailJsonReplace2; result = UploadProduct(shop, temuDBProd, prod, row.Cells["colOpResult"]); //将商品上传至草稿箱 if (result.Contains("登录过期")) diff --git a/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.Designer.cs b/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.Designer.cs index 6dd90a8..8b66c7b 100644 --- a/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.Designer.cs +++ b/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.Designer.cs @@ -65,20 +65,22 @@ namespace TemuKJD.KJDForms.ShopForms this.cmbStatus = new System.Windows.Forms.ComboBox(); this.pbLoading = new System.Windows.Forms.PictureBox(); this.dgvSelectProduct = new TemuKJD.UserComponent.DataGridViewEx(); + this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); + this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); this.colSelect = new System.Windows.Forms.DataGridViewCheckBoxColumn(); this.colSpu = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSku = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.colPic = new System.Windows.Forms.DataGridViewImageColumn(); + this.colImgUrl = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colImg = new System.Windows.Forms.DataGridViewImageColumn(); this.colSkc = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSkuName = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colExtCode = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colPurchaseSubOrderSn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colReason = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colPackageSn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colSkuNumber = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colOutboundTime = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colOpResult = new System.Windows.Forms.DataGridViewTextBoxColumn(); - this.ucSplitPage1 = new TemuKJD.UserControls.UcSplitPage(); - this.statusBar = new TemuKJD.UserControls.StatusBarUserControl(); this.panel2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); @@ -100,7 +102,7 @@ namespace TemuKJD.KJDForms.ShopForms this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; this.panel2.Location = new System.Drawing.Point(1, 33); this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(1197, 403); + this.panel2.Size = new System.Drawing.Size(1278, 466); this.panel2.TabIndex = 1; // // splitContainer1 @@ -123,7 +125,7 @@ namespace TemuKJD.KJDForms.ShopForms // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); - this.splitContainer1.Size = new System.Drawing.Size(1197, 403); + this.splitContainer1.Size = new System.Drawing.Size(1278, 466); this.splitContainer1.SplitterDistance = 66; this.splitContainer1.TabIndex = 3; // @@ -171,7 +173,7 @@ namespace TemuKJD.KJDForms.ShopForms this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnAdd.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnAdd.ForeColor = System.Drawing.Color.White; - this.btnAdd.Location = new System.Drawing.Point(1019, 19); + this.btnAdd.Location = new System.Drawing.Point(1100, 19); this.btnAdd.Margin = new System.Windows.Forms.Padding(2); this.btnAdd.Name = "btnAdd"; this.btnAdd.Size = new System.Drawing.Size(171, 26); @@ -199,8 +201,8 @@ namespace TemuKJD.KJDForms.ShopForms // this.splitContainer2.Panel2.Controls.Add(this.ucSplitPage1); this.splitContainer2.Panel2.Controls.Add(this.statusBar); - this.splitContainer2.Size = new System.Drawing.Size(1197, 333); - this.splitContainer2.SplitterDistance = 304; + this.splitContainer2.Size = new System.Drawing.Size(1278, 396); + this.splitContainer2.SplitterDistance = 367; this.splitContainer2.TabIndex = 0; // // tableLayoutPanel1 @@ -248,11 +250,11 @@ namespace TemuKJD.KJDForms.ShopForms this.tableLayoutPanel1.Controls.Add(this.label4, 12, 0); this.tableLayoutPanel1.Controls.Add(this.txtProdName, 11, 0); this.tableLayoutPanel1.Controls.Add(this.cmbStatus, 15, 0); - this.tableLayoutPanel1.Location = new System.Drawing.Point(7, 250); + this.tableLayoutPanel1.Location = new System.Drawing.Point(7, 313); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 1; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(879, 32); + this.tableLayoutPanel1.Size = new System.Drawing.Size(960, 32); this.tableLayoutPanel1.TabIndex = 469; this.tableLayoutPanel1.Visible = false; // @@ -271,9 +273,9 @@ namespace TemuKJD.KJDForms.ShopForms // this.chkShowDel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.chkShowDel.AutoSize = true; - this.chkShowDel.Location = new System.Drawing.Point(797, 8); + this.chkShowDel.Location = new System.Drawing.Point(885, 8); this.chkShowDel.Name = "chkShowDel"; - this.chkShowDel.Size = new System.Drawing.Size(79, 16); + this.chkShowDel.Size = new System.Drawing.Size(72, 16); this.chkShowDel.TabIndex = 471; this.chkShowDel.Text = "显示删除"; this.chkShowDel.UseVisualStyleBackColor = true; @@ -284,14 +286,14 @@ namespace TemuKJD.KJDForms.ShopForms this.txtShopId.Location = new System.Drawing.Point(44, 5); this.txtShopId.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); this.txtShopId.Name = "txtShopId"; - this.txtShopId.Size = new System.Drawing.Size(31, 21); + this.txtShopId.Size = new System.Drawing.Size(42, 21); this.txtShopId.TabIndex = 448; // // chkNoSubSa // this.chkNoSubSa.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); this.chkNoSubSa.AutoSize = true; - this.chkNoSubSa.Location = new System.Drawing.Point(707, 8); + this.chkNoSubSa.Location = new System.Drawing.Point(795, 8); this.chkNoSubSa.Margin = new System.Windows.Forms.Padding(8, 3, 3, 3); this.chkNoSubSa.Name = "chkNoSubSa"; this.chkNoSubSa.Size = new System.Drawing.Size(84, 16); @@ -305,7 +307,7 @@ namespace TemuKJD.KJDForms.ShopForms this.pnlEmpty.CanvasColor = System.Drawing.SystemColors.Control; this.pnlEmpty.ColorSchemeStyle = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled; this.pnlEmpty.DisabledBackColor = System.Drawing.Color.Empty; - this.pnlEmpty.Location = new System.Drawing.Point(640, 5); + this.pnlEmpty.Location = new System.Drawing.Point(728, 5); this.pnlEmpty.Name = "pnlEmpty"; this.pnlEmpty.Size = new System.Drawing.Size(56, 22); this.pnlEmpty.Style.Alignment = System.Drawing.StringAlignment.Center; @@ -327,7 +329,7 @@ namespace TemuKJD.KJDForms.ShopForms // this.label7.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(81, 10); + this.label7.Location = new System.Drawing.Point(92, 10); this.label7.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); this.label7.Name = "label7"; this.label7.Size = new System.Drawing.Size(53, 12); @@ -338,7 +340,7 @@ namespace TemuKJD.KJDForms.ShopForms // this.label8.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(489, 10); + this.label8.Location = new System.Drawing.Point(566, 10); this.label8.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); this.label8.Name = "label8"; this.label8.Size = new System.Drawing.Size(53, 12); @@ -348,17 +350,17 @@ namespace TemuKJD.KJDForms.ShopForms // txtShopName // this.txtShopName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.txtShopName.Location = new System.Drawing.Point(134, 5); + this.txtShopName.Location = new System.Drawing.Point(145, 5); this.txtShopName.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); this.txtShopName.Name = "txtShopName"; - this.txtShopName.Size = new System.Drawing.Size(31, 21); + this.txtShopName.Size = new System.Drawing.Size(42, 21); this.txtShopName.TabIndex = 451; // // label5 // this.label5.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(171, 10); + this.label5.Location = new System.Drawing.Point(193, 10); this.label5.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(23, 12); @@ -373,7 +375,7 @@ namespace TemuKJD.KJDForms.ShopForms this.btnSearch.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.btnSearch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnSearch.ForeColor = System.Drawing.Color.White; - this.btnSearch.Location = new System.Drawing.Point(579, 4); + this.btnSearch.Location = new System.Drawing.Point(667, 4); this.btnSearch.Margin = new System.Windows.Forms.Padding(6, 2, 2, 2); this.btnSearch.Name = "btnSearch"; this.btnSearch.Size = new System.Drawing.Size(56, 24); @@ -384,26 +386,26 @@ namespace TemuKJD.KJDForms.ShopForms // txtSKC // this.txtSKC.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.txtSKC.Location = new System.Drawing.Point(254, 5); + this.txtSKC.Location = new System.Drawing.Point(287, 5); this.txtSKC.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); this.txtSKC.Name = "txtSKC"; - this.txtSKC.Size = new System.Drawing.Size(31, 21); + this.txtSKC.Size = new System.Drawing.Size(42, 21); this.txtSKC.TabIndex = 432; // // txtSPU // this.txtSPU.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.txtSPU.Location = new System.Drawing.Point(194, 5); + this.txtSPU.Location = new System.Drawing.Point(216, 5); this.txtSPU.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); this.txtSPU.Name = "txtSPU"; - this.txtSPU.Size = new System.Drawing.Size(31, 21); + this.txtSPU.Size = new System.Drawing.Size(42, 21); this.txtSPU.TabIndex = 434; // // label1 // this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(231, 10); + this.label1.Location = new System.Drawing.Point(264, 10); this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(23, 12); @@ -414,7 +416,7 @@ namespace TemuKJD.KJDForms.ShopForms // this.label2.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(291, 10); + this.label2.Location = new System.Drawing.Point(335, 10); this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(29, 12); @@ -424,26 +426,26 @@ namespace TemuKJD.KJDForms.ShopForms // txtCat // this.txtCat.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.txtCat.Location = new System.Drawing.Point(320, 5); + this.txtCat.Location = new System.Drawing.Point(364, 5); this.txtCat.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); this.txtCat.Name = "txtCat"; - this.txtCat.Size = new System.Drawing.Size(31, 21); + this.txtCat.Size = new System.Drawing.Size(42, 21); this.txtCat.TabIndex = 425; // // txtExtCode // this.txtExtCode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.txtExtCode.Location = new System.Drawing.Point(452, 5); + this.txtExtCode.Location = new System.Drawing.Point(518, 5); this.txtExtCode.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); this.txtExtCode.Name = "txtExtCode"; - this.txtExtCode.Size = new System.Drawing.Size(31, 21); + this.txtExtCode.Size = new System.Drawing.Size(42, 21); this.txtExtCode.TabIndex = 429; // // label3 // this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(357, 10); + this.label3.Location = new System.Drawing.Point(412, 10); this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(29, 12); @@ -454,7 +456,7 @@ namespace TemuKJD.KJDForms.ShopForms // this.label4.Anchor = System.Windows.Forms.AnchorStyles.Left; this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(423, 10); + this.label4.Location = new System.Drawing.Point(489, 10); this.label4.Margin = new System.Windows.Forms.Padding(6, 0, 0, 0); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(29, 12); @@ -464,10 +466,10 @@ namespace TemuKJD.KJDForms.ShopForms // txtProdName // this.txtProdName.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.txtProdName.Location = new System.Drawing.Point(386, 5); + this.txtProdName.Location = new System.Drawing.Point(441, 5); this.txtProdName.Margin = new System.Windows.Forms.Padding(0, 2, 0, 2); this.txtProdName.Name = "txtProdName"; - this.txtProdName.Size = new System.Drawing.Size(31, 21); + this.txtProdName.Size = new System.Drawing.Size(42, 21); this.txtProdName.TabIndex = 427; // // cmbStatus @@ -478,10 +480,10 @@ namespace TemuKJD.KJDForms.ShopForms "待上传", "已上传", "全部"}); - this.cmbStatus.Location = new System.Drawing.Point(542, 6); + this.cmbStatus.Location = new System.Drawing.Point(619, 6); this.cmbStatus.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3); this.cmbStatus.Name = "cmbStatus"; - this.cmbStatus.Size = new System.Drawing.Size(31, 20); + this.cmbStatus.Size = new System.Drawing.Size(42, 20); this.cmbStatus.TabIndex = 459; this.cmbStatus.Text = "待上传"; // @@ -489,7 +491,7 @@ namespace TemuKJD.KJDForms.ShopForms // this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None; this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue; - this.pbLoading.Location = new System.Drawing.Point(573, 111); + this.pbLoading.Location = new System.Drawing.Point(614, 142); this.pbLoading.Name = "pbLoading"; this.pbLoading.Size = new System.Drawing.Size(50, 50); this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -517,9 +519,11 @@ namespace TemuKJD.KJDForms.ShopForms this.colSelect, this.colSpu, this.colSku, - this.colPic, + this.colImgUrl, + this.colImg, this.colSkc, this.colSkuName, + this.colExtCode, this.colPurchaseSubOrderSn, this.colReason, this.colPackageSn, @@ -532,8 +536,33 @@ namespace TemuKJD.KJDForms.ShopForms this.dgvSelectProduct.ReadOnly = true; this.dgvSelectProduct.RowHeadersWidth = 51; this.dgvSelectProduct.RowTemplate.Height = 23; - this.dgvSelectProduct.Size = new System.Drawing.Size(1189, 304); + this.dgvSelectProduct.Size = new System.Drawing.Size(1270, 367); this.dgvSelectProduct.TabIndex = 190; + this.dgvSelectProduct.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dgvSelectProduct_Scroll); + // + // ucSplitPage1 + // + this.ucSplitPage1.CurrentPage = 1; + this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right; + this.ucSplitPage1.Location = new System.Drawing.Point(916, 0); + this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0); + this.ucSplitPage1.Name = "ucSplitPage1"; + this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); + this.ucSplitPage1.Size = new System.Drawing.Size(362, 25); + this.ucSplitPage1.TabIndex = 6; + this.ucSplitPage1.TotalPage = 1; + this.ucSplitPage1.Visible = false; + // + // 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(1278, 25); + this.statusBar.TabIndex = 5; // // colSelect // @@ -550,22 +579,27 @@ namespace TemuKJD.KJDForms.ShopForms this.colSpu.HeaderText = "SPU"; this.colSpu.Name = "colSpu"; this.colSpu.ReadOnly = true; - this.colSpu.Width = 125; // // colSku // this.colSku.HeaderText = "SKU"; this.colSku.Name = "colSku"; this.colSku.ReadOnly = true; - this.colSku.Width = 120; // - // colPic + // colImgUrl // - this.colPic.HeaderText = "图片"; - this.colPic.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; - this.colPic.Name = "colPic"; - this.colPic.ReadOnly = true; - this.colPic.Width = 60; + this.colImgUrl.HeaderText = "图片地址"; + this.colImgUrl.Name = "colImgUrl"; + this.colImgUrl.ReadOnly = true; + this.colImgUrl.Visible = false; + // + // colImg + // + this.colImg.HeaderText = "图片"; + this.colImg.ImageLayout = System.Windows.Forms.DataGridViewImageCellLayout.Zoom; + this.colImg.Name = "colImg"; + this.colImg.ReadOnly = true; + this.colImg.Width = 60; // // colSkc // @@ -573,6 +607,7 @@ namespace TemuKJD.KJDForms.ShopForms this.colSkc.Name = "colSkc"; this.colSkc.ReadOnly = true; this.colSkc.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colSkc.Width = 90; // // colSkuName // @@ -582,6 +617,12 @@ namespace TemuKJD.KJDForms.ShopForms this.colSkuName.Resizable = System.Windows.Forms.DataGridViewTriState.True; this.colSkuName.Width = 140; // + // colExtCode + // + this.colExtCode.HeaderText = "货号"; + this.colExtCode.Name = "colExtCode"; + this.colExtCode.ReadOnly = true; + // // colPurchaseSubOrderSn // this.colPurchaseSubOrderSn.HeaderText = "备货单号"; @@ -631,33 +672,10 @@ namespace TemuKJD.KJDForms.ShopForms this.colOpResult.ReadOnly = true; this.colOpResult.Width = 150; // - // ucSplitPage1 - // - this.ucSplitPage1.CurrentPage = 1; - this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right; - this.ucSplitPage1.Location = new System.Drawing.Point(835, 0); - this.ucSplitPage1.Margin = new System.Windows.Forms.Padding(0); - this.ucSplitPage1.Name = "ucSplitPage1"; - this.ucSplitPage1.Padding = new System.Windows.Forms.Padding(0, 0, 1, 0); - this.ucSplitPage1.Size = new System.Drawing.Size(362, 25); - this.ucSplitPage1.TabIndex = 6; - this.ucSplitPage1.TotalPage = 1; - // - // 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(1197, 25); - this.statusBar.TabIndex = 5; - // // ReturnPackageDetailForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - this.ClientSize = new System.Drawing.Size(1199, 437); + this.ClientSize = new System.Drawing.Size(1280, 500); this.Controls.Add(this.panel2); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "ReturnPackageDetailForm"; @@ -712,23 +730,25 @@ namespace TemuKJD.KJDForms.ShopForms private System.Windows.Forms.SplitContainer splitContainer2; private System.Windows.Forms.PictureBox pbLoading; private UserComponent.DataGridViewEx dgvSelectProduct; - private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect; - private System.Windows.Forms.DataGridViewTextBoxColumn colSpu; - private System.Windows.Forms.DataGridViewTextBoxColumn colSku; - private System.Windows.Forms.DataGridViewImageColumn colPic; - private System.Windows.Forms.DataGridViewTextBoxColumn colSkc; - private System.Windows.Forms.DataGridViewTextBoxColumn colSkuName; - private System.Windows.Forms.DataGridViewTextBoxColumn colPurchaseSubOrderSn; - private System.Windows.Forms.DataGridViewTextBoxColumn colReason; - private System.Windows.Forms.DataGridViewTextBoxColumn colPackageSn; - private System.Windows.Forms.DataGridViewTextBoxColumn colSkuNumber; - private System.Windows.Forms.DataGridViewTextBoxColumn colOutboundTime; - private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; private UserControls.UcSplitPage ucSplitPage1; private UserControls.StatusBarUserControl statusBar; private System.Windows.Forms.DateTimePicker dtpEndDate; private System.Windows.Forms.Label label10; private System.Windows.Forms.Label label9; private System.Windows.Forms.DateTimePicker dtpStartDate; + private System.Windows.Forms.DataGridViewCheckBoxColumn colSelect; + private System.Windows.Forms.DataGridViewTextBoxColumn colSpu; + private System.Windows.Forms.DataGridViewTextBoxColumn colSku; + private System.Windows.Forms.DataGridViewTextBoxColumn colImgUrl; + private System.Windows.Forms.DataGridViewImageColumn colImg; + private System.Windows.Forms.DataGridViewTextBoxColumn colSkc; + private System.Windows.Forms.DataGridViewTextBoxColumn colSkuName; + private System.Windows.Forms.DataGridViewTextBoxColumn colExtCode; + private System.Windows.Forms.DataGridViewTextBoxColumn colPurchaseSubOrderSn; + private System.Windows.Forms.DataGridViewTextBoxColumn colReason; + private System.Windows.Forms.DataGridViewTextBoxColumn colPackageSn; + private System.Windows.Forms.DataGridViewTextBoxColumn colSkuNumber; + private System.Windows.Forms.DataGridViewTextBoxColumn colOutboundTime; + private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; } } \ No newline at end of file diff --git a/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.cs b/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.cs index eb0258a..7cb57e1 100644 --- a/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.cs +++ b/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.cs @@ -1,11 +1,17 @@ -using AllBase.Model.Result; +using AllBase; +using AllBase.Model.Result; +using NaiBa.Util.Extension; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; +using System.IO; using System.Linq; +using System.Net; using System.Text; +using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using TemuKJD.KJDForms.BaseForms; @@ -14,13 +20,23 @@ namespace TemuKJD.KJDForms.ShopForms { public partial class ReturnPackageDetailForm : LRBaseForm { + public CancellationTokenSource cancellationTokenSource { get; set; } = null; ShopLoginInfo shop = null; + List lstShop = new List(); + List lstReturnPackageInfo = new List(); + + Bitmap defaultBitmap = null; + public ReturnPackageDetailForm(ShopLoginInfo _shop) { InitializeComponent(); if (_shop!= null) + { this.shop = _shop; + lstShop.Add(shop); + } + pbLoading.Visible = false; } private void ReturnPackageDetailForm_Load(object sender, EventArgs e) @@ -31,7 +47,441 @@ namespace TemuKJD.KJDForms.ShopForms private void btnAdd_Click(object sender, EventArgs e) { + GetReturnPackage(); + } + void GetReturnPackage() + { + lstReturnPackageInfo.Clear(); + dgvSelectProduct.Rows.Clear(); + + var dgvRows = this.dgvSelectProduct.Rows.Cast();//.Where(r => lstShopId.Contains(r.Cells["colShopId"].Value.ParseToString())); + foreach (var row in dgvRows) + { + row.Cells["colMessage"].Value = ""; + } + + pbLoading.Visible = true; + splitContainer1.Panel1.Enabled = false; + + DateTime startTime = this.dtpStartDate.Value.Date; + DateTime endTime = this.dtpEndDate.Value.Date.AddDays(1); + cancellationTokenSource = new CancellationTokenSource(); + Task.Run(() => + { + int i = 0; + while (endTime > startTime) + { + //最大只能查询一个月,所以分开查询 + DateTime midTime = endTime.AddMonths(-1); + if (midTime < startTime) + midTime = startTime; + long startTimeTick = BaseClass.DateTimeToTimestampMilliseconds(midTime); + long endTimeTick = BaseClass.DateTimeToTimestampMilliseconds(endTime) - 1; + + this.Invoke(new Action(() => + { + this.statusBar.lblTaskStatus.Text = "正在查询" + midTime.ToString(" yyyy年MM月dd日 至 ") + endTime.ToString("yyyy年MM月dd日 ") + "..."; + this.statusBar.pgbTaskProgress.Maximum = lstShop.Count; + this.statusBar.UpdateProgressBar(i + 1); + i++; + })); + + endTime = midTime; + + if (cancellationTokenSource.IsCancellationRequested) + break; + + if (shop == null) + continue; + + #region 检测登录 + if (shop.LoginStatus2 != "国际版在线") + { + Invoke(new Action(() => + { + //var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopLoginName"].Value.ToString() == shop.LoginName); + //foreach (var row in rows) + //{ + // row.Cells["colMessage"].Value = "店铺掉线"; + // row.Cells["colLoginStatus"].Value = "国际版未登录"; + // row.Cells["colCanUse"].Value = false; + //} + BaseMsgForm.ShowError("店铺掉线,请重新登录"); + })); + return; + } + if (ShopListForm.Instance == null) + ShopListForm.Instance = new ShopListForm(); + ShopListForm.Instance.CheckShopLogin(new string[] { shop.LoginName }, false); + if (shop.LoginStatus2 != "国际版在线") + { + Invoke(new Action(() => + { + //var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopLoginName"].Value.ToString() == shop.LoginName); + //foreach (var row in rows) + //{ + // row.Cells["colMessage"].Value = "店铺掉线"; + // row.Cells["colLoginStatus"].Value = "国际版未登录"; + // row.Cells["colCanUse"].Value = false; + //} + BaseMsgForm.ShowError("店铺掉线,请重新登录"); + })); + return; + } + #endregion + + Invoke(new Action(() => + { + //var rows = this.dgvSelectProduct.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId); + //foreach (var row in rows) + //{ + // row.Cells["colMessage"].Value = "正在查询"; + //} + })); + + int page = 0; + int totalPage = 1; + bool isError = false; + string errMsg = ""; + while (page < totalPage) + { + page++; + + if (cancellationTokenSource.IsCancellationRequested) + break; + + Thread.Sleep(Randomx.GetId(100, 300)); + + int tryCount = 0; + tryAgain: + Thread.Sleep(100 + Randomx.GetId(200)); + string jsonStr = GetReturnPackage(shop, startTimeTick, endTimeTick, page); + if (jsonStr.Contains("指定的值含有无效的控制字符")) + { + BaseMsgForm.ShowError("店铺" + shop.LoginName + " " + shop.ShopId + "已掉线"); + isError = true; + break; + } + if (jsonStr.Contains("当前操作人数太多,请稍后重试") && tryCount < 5) + { + tryCount++; + goto tryAgain; + } + if (jsonStr.Contains("当前操作人数太多,请稍后重试")) + { + } + if (!jsonStr.Contains("\"success\":true")) + { + isError = true; + string sErr = BaseRegex.GetStringJson(ref jsonStr, "errorMsg"); + if (!string.IsNullOrWhiteSpace(sErr) && !errMsg.Contains(sErr)) + errMsg += sErr + " "; + page++; + continue; + } + + if (jsonStr.Contains("\"success\":true")) + { + var jArr = new JArray(); + try + { + var jObj = JObject.Parse(jsonStr); + jArr = jObj["result"]?["packageDetailDTOList"] as JArray; + if (jArr == null) + jArr = new JArray(); + } + catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); } + + List packageLst = new List(); + foreach (var item in jArr) + { + string sItem = item.ToString(); + TemuReturnPackageDetailInfo pInfo = JsonHelper.DeserializeJsonToObject(sItem); // 反序列化得到类 + if (pInfo != null && !lstReturnPackageInfo.Any(a => a.purchaseSubOrderSn == pInfo.purchaseSubOrderSn)) + { + packageLst.Add(pInfo); + } + } + + string prodJsonStr = ""; + string skcIds = string.Join(",", packageLst.Select(p => p.productSkcId).Distinct()); + if (skcIds.Length > 0) + { + prodJsonStr = GetProductList(shop, skcIds); + + if (prodJsonStr.Contains("\"success\":true")) + { + jArr = new JArray(); + try + { + var jObj = JObject.Parse(prodJsonStr); + jArr = jObj["result"]?["pageItems"] as JArray; + if (jArr == null) + jArr = new JArray(); + + foreach (var prod in jArr) + { + long productSkcId = prod["productSkcId"].ParseToLong(); + string extCode = prod["extCode"].ParseToString(); + foreach (var pack in packageLst) + { + if (pack.productSkcId == productSkcId) + pack.extCode = extCode; + } + } + } + catch (Exception ex) { BaseMsgForm.ShowError(ex.Message); } + } + } + + foreach(var pack in packageLst) + { + if (defaultBitmap == null) + defaultBitmap = new Bitmap(80, 80); + + Image image = null; + string getImgError=""; + string imgUrl = pack.thumbUrl.Replace("https:", "http:"); + if (!string.IsNullOrWhiteSpace(imgUrl)) + image = GetHtml.GetUrlImg(imgUrl, out getImgError); + if (!string.IsNullOrEmpty(getImgError)) + BaseMsgForm.ShowError(getImgError); + string imgBase64 = ""; + using (MemoryStream memoryStream = new MemoryStream()) + { + image.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Jpeg); + byte[] imageBytes = memoryStream.ToArray(); + imgBase64 = Convert.ToBase64String(imageBytes); + } + + TemuReturnPackageDetailParam packageParam = new TemuReturnPackageDetailParam + { + itemNo = pack.extCode, + mallId = shop.ShopId, + productColor = pack.mainSaleSpec, + productSize = pack.secondarySaleSpec, + productCount = pack.quantity.ParseToInt(), + productSkcId = pack.productSkcId.ParseToString(), + productSkcPicture = imgBase64, + productSkuId = pack.productSkuId.ParseToString(), + returnPackageNo = pack.packageSn, + returnReason = string.Join(",", pack.reasonDesc), + }; + long timestamp = BaseClass.DateTimeToTimestampMilliseconds(DateTime.Now); + string secretKey = "aaMETt2bPe6YHzZ1ojbC+6wOvgtwehqc6A+/Rz+pCUU="; + string mallId = packageParam.mallId; + string returnPackageNo = packageParam.returnPackageNo; + string sign = BaseClass.GetMd5(timestamp + secretKey + mallId + returnPackageNo).ToLower(); + string html = "\"success\":true"; + //html = ReturnPackagePostResponse(shop, "url", JsonHelper.SerializeObject(packageParam), "referer", timestamp.ParseToString(), sign); + string rst = ""; + if (html.Contains("\"success\":true")) + { + rst = "上传仓管成功"; + } + else + { + rst = "失败" + BaseRegex.GetStringJson(ref html, "errorMsg"); + } + + Invoke(new Action(() => + { + int rowId = this.dgvSelectProduct.Rows.Add( + true, + //shop.ShopAccount, + pack.productSpuId, + pack.productSkuId, + imgUrl, + defaultBitmap, //image, // skc图片 + pack.productSkcId, + /*"①" +*/ pack.mainSaleSpec + " " + /*"②" +*/ pack.secondarySaleSpec, + pack.extCode, + pack.purchaseSubOrderSn, // 备货单号 + string.Join(",", pack.reasonDesc), + pack.packageSn, + pack.quantity, + BaseClass.StampToDateTime((pack.outboundTime.ParseToLong() / 1000).ParseToInt()), // 出库时间 + "" // 操作结果,状态 + ); + + dgvSelectProduct.Rows[rowId].Height = 60; + })); + } + + lstReturnPackageInfo.AddRange(packageLst); + + int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt(); + totalPage = Math.Ceiling(total / 10.0).ParseToInt(); + + ShowDgvImg(); + } + } + + Invoke(new Action(() => + { + //var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId); + + //if (!isError) + //{ + // foreach (var row in rows) + // { + // row.Cells["colMessage"].Value = "已查询"; + // } + //} + //else + //{ + // foreach (var row in rows) + // { + // row.Cells["colMessage"].Value = "查询失败 " + errMsg; + // } + //} + })); + } + Invoke(new Action(() => + { + splitContainer1.Panel1.Enabled = true; + pbLoading.Visible = false; + string sRst = "已完成退货包裹明细查询!"; + if (cancellationTokenSource.IsCancellationRequested) + sRst = "已取消查询!"; + + BaseMsgForm.ShowInfo(sRst); + this.statusBar.lblTaskStatus.Text = sRst; + })); + }, cancellationTokenSource.Token); + } + + void ShowDgvImg() + { + Task.Run(() => + { + foreach (DataGridViewRow row in this.dgvSelectProduct.Rows) + { + if (row.Index > 0 && row.Cells["colImg"].Displayed == false) + { + try + { + Invoke(new Action(() => + { + row.Cells["colImg"].Value = defaultBitmap; + })); + } + catch + { + } + continue; + } + + if (row.Cells["colImg"].Value != null && row.Cells["colImg"].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["colImg"].Value = image; + })); + } + catch + { + } + } + }); + } + + private void dgvSelectProduct_Scroll(object sender, ScrollEventArgs e) + { + ShowDgvImg(); + } + + + private string GetReturnPackage(ShopLoginInfo shop, long startTime, long endTime, int page = 1) + { + page = Math.Max(page, 1); + string url = "https://seller.kuajingmaihuo.com/dunland/api/gmp/returnSupplier/package/pageReturnPackageSkuDetailList"; + string body; + body = @"{""outboundTimeStart"":" +startTime + @",""outboundTimeEnd"":" + endTime + @",""pageNo"":" + page + @",""pageSize"":200}"; + + string refere = "https://seller.kuajingmaihuo.com/wms/stock-mgt/return-package-detail"; + + return KJDHttpResponse.PostResponse(shop, url, body, refere); + //return KJDHttpResponse.PostResponse2(shop, url, body, refere); + } + + private string GetProductList(ShopLoginInfo shop, string skcIds, int page = 1) + { + page = Math.Max(page, 1); + string url = "https://agentseller.temu.com/visage-agent-seller/product/skc/pageQuery"; + string body; + body = @"{""productSkcIds"":[" + skcIds + @"],""page"":" + page + @",""pageSize"":200}"; + + string refere = "https://agentseller.temu.com/goods/list"; + + //return KJDHttpResponse.PostResponse(shop, url, body, refere); + return KJDHttpResponse.PostResponse2(shop, url, body, refere); + } + + public static string ReturnPackagePostResponse(ShopLoginInfo shop, string _url, string _data, string referer, string timeStamp, string sign) + { + HttpWebResponse response = null; + string result; + try + { + string url = _url; + HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); + + request.KeepAlive = true; + request.Headers.Set(HttpRequestHeader.CacheControl, "max-age=0"); + request.Headers.Add("sec-ch-ua", @"""Google Chrome"";v=""137"", ""Chromium"";v=""137"", ""Not/A)Brand"";v=""24"""); + request.Headers.Add("sec-ch-ua-mobile", @"?0"); + request.Headers.Add("sec-ch-ua-platform", @"""Windows"""); + request.UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36"; + request.Headers.Add("timeStamp", timeStamp); + request.Headers.Add("sign", sign); + request.ContentType = "application/json"; + request.Accept = "*/*"; + request.Referer = referer; + request.Headers.Set(HttpRequestHeader.AcceptEncoding, "gzip, deflate, br, zstd"); + request.Headers.Set(HttpRequestHeader.AcceptLanguage, "zh-CN,zh;q=0.9"); + + request.Method = "POST"; + request.ServicePoint.Expect100Continue = false; + + string body = _data; + byte[] postBytes = System.Text.Encoding.UTF8.GetBytes(body); + request.ContentLength = postBytes.Length; + Stream stream = request.GetRequestStream(); + stream.Write(postBytes, 0, postBytes.Length); + stream.Close(); + + response = (HttpWebResponse)request.GetResponse(); + } + catch (WebException ex) + { + if (ex.Status == WebExceptionStatus.ProtocolError) + { + response = (HttpWebResponse)ex.Response; + result = GetProxyHtml.ReadResponse(response); + return result; + } + else return ex.Message; + } + catch (Exception e) + { + if (response != null) response.Close(); + return e.Message; + } + result = GetProxyHtml.ReadResponse(response); + return result; } } } diff --git a/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.resx b/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.resx index 3be89ac..0d2169e 100644 --- a/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.resx +++ b/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.resx @@ -126,7 +126,10 @@ True - + + True + + True @@ -135,6 +138,9 @@ True + + True + True