From 77ec460f4d80931d13779bc7a2bb7ff6dfcb64f5 Mon Sep 17 00:00:00 2001 From: wule_5900x Date: Mon, 11 Aug 2025 00:16:14 +0800 Subject: [PATCH] =?UTF-8?q?1=E9=80=80=E8=B4=A7=E5=8C=85=E8=A3=B9=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E5=88=B0=E6=9C=8D=E5=8A=A1=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AllBase/BaseClass.cs | 4 +- .../Result/TemuReturnPackageDetailInfo.cs | 10 + KJDService/KJD_WebService/BLL/UserManage.cs | 38 ++ KJDService/KJD_WebService/UserService.asmx.cs | 12 + KJDService/KJD_WebService/Utils/TimeUtils.cs | 22 ++ .../AdminForms/AdminShopLoginForm.Designer.cs | 4 +- .../KJDForms/AdminForms/AdminShopLoginForm.cs | 4 + .../ReturnPackageDetailForm.Designer.cs | 368 ++---------------- .../ShopForms/ReturnPackageDetailForm.cs | 261 +++++++------ .../ShopForms/ReturnPackageDetailForm.resx | 3 + .../ShopForms/ShopLoginForm.Designer.cs | 24 +- TEMUKJD/KJDForms/ShopForms/ShopLoginForm.cs | 6 + 12 files changed, 296 insertions(+), 460 deletions(-) diff --git a/AllBase/BaseClass.cs b/AllBase/BaseClass.cs index 190db74..e324dcb 100644 --- a/AllBase/BaseClass.cs +++ b/AllBase/BaseClass.cs @@ -27,8 +27,8 @@ namespace AllBase /// /// 版本ID /// - public static int VersionCount = 513; - //public static int VersionCount = 513; + public static int VersionCount = 518; + //public static int VersionCount = 518; /// /// 版本号 diff --git a/AllBase/Model/Result/TemuReturnPackageDetailInfo.cs b/AllBase/Model/Result/TemuReturnPackageDetailInfo.cs index 6b9333b..17419e1 100644 --- a/AllBase/Model/Result/TemuReturnPackageDetailInfo.cs +++ b/AllBase/Model/Result/TemuReturnPackageDetailInfo.cs @@ -41,6 +41,12 @@ namespace AllBase.Model.Result public List reasonDesc { get; set; } public string remark { get; set; } public string extCode { get; set; } + public TemuProductSkcSpec spec1 { get; set; } + public TemuProductSkcSpec spec2 { get; set; } + /// + /// 同一个包裹里所有商品数量总和 + /// + public int returnTotalNum { get; set; } } public class TemuReturnPackageDetailParam @@ -58,6 +64,10 @@ namespace AllBase.Model.Result /// public string itemNo { get; set; } /// + /// 包裹内的总件数 + /// + public int returnTotalNum { get; set; } + /// /// /9j/开头的base64图片 /// public string productSkcPicture { get; set; } diff --git a/KJDService/KJD_WebService/BLL/UserManage.cs b/KJDService/KJD_WebService/BLL/UserManage.cs index 12f7d0c..d37f504 100644 --- a/KJDService/KJD_WebService/BLL/UserManage.cs +++ b/KJDService/KJD_WebService/BLL/UserManage.cs @@ -428,5 +428,43 @@ namespace KJD_Web.BLL return "{\"code\":1,\"msg\":\"原密码错误。\"}"; } } + + public string return_package_secret_key { get; set; } = "aaMETt2bPe6YHzZ1ojbC+6wOvgtwehqc6A+/Rz+pCUU="; + + public string GetPackageSign(string inputData) + { + if (!string.IsNullOrEmpty(inputData)) + { + var mobile = RegexUtils.GetStringQuery(ref inputData, "mobile")?.Replace("'", "\\'"); + var password = RegexUtils.GetStringQuery(ref inputData, "password")?.Replace("'", "\\'"); + var timestamp = RegexUtils.GetStringQuery(ref inputData, "timestamp")?.Replace("'", "\\'"); + var mallId = RegexUtils.GetStringQuery(ref inputData, "mallId")?.Replace("'", "\\'"); + var returnPackageNo = RegexUtils.GetStringQuery(ref inputData, "returnPackageNo")?.Replace("'", "\\'"); + int r2 = RegexUtils.GetStringQuery(ref inputData, "r2").ParseToInt(); + string c2 = RegexUtils.GetStringQuery(ref inputData, "c2"); + + if (EncrypUtil.Encryption(r2) != c2) + return "{\"code\":2,\"msg\":\"不合法的输入内容\"}"; + + string conn = System.Configuration.ConfigurationManager.ConnectionStrings["ConnKJD"].ConnectionString; + MysqlUtils mySql = new MysqlUtils(conn); + string sql = "select * from kjd.user where user_name='" + + mobile + "' and password='" + password + "'"; + + sql = "select * from kjd.user where user_name='" + mobile + "'"; + + var dt = mySql.ExecuteDataTable(sql); + mySql.Close(); + if (dt == null || dt.Rows.Count <=0) + { + return "{\"code\":1,\"msg\":\"用户不存在\"}"; + } + + string sign = EncrypUtil.GetMd5(timestamp + return_package_secret_key + mallId + returnPackageNo).ToLower(); + + return "{\"code\":200, \"sign\":\"" + sign + "\", \"msg\":\"\"}"; + } + return "{\"code\":19999,\"msg\":\"输入为空\"}"; + } } } \ No newline at end of file diff --git a/KJDService/KJD_WebService/UserService.asmx.cs b/KJDService/KJD_WebService/UserService.asmx.cs index 64e6b81..ac9a67f 100644 --- a/KJDService/KJD_WebService/UserService.asmx.cs +++ b/KJDService/KJD_WebService/UserService.asmx.cs @@ -66,6 +66,18 @@ namespace KJD_Web Context.Response.End(); } + [WebMethod] + public void get_package_sign() + { + string jsontext = GetRequestJsonString(); + + var result = jsontext; + result = new UserManage().GetPackageSign(jsontext); + + Context.Response.Write(result); + Context.Response.End(); + } + [WebMethod] public void change_password() { diff --git a/KJDService/KJD_WebService/Utils/TimeUtils.cs b/KJDService/KJD_WebService/Utils/TimeUtils.cs index 86c8e6d..08a3b36 100644 --- a/KJDService/KJD_WebService/Utils/TimeUtils.cs +++ b/KJDService/KJD_WebService/Utils/TimeUtils.cs @@ -19,5 +19,27 @@ namespace KJD_Web.Utils TimeSpan toNow = new TimeSpan(lTime); return dateTimeStart.Add(toNow); } + + /// + /// C#格式时间转换为Unix时间戳(秒) + /// + /// + /// + public static int DateTimeToTimestampSeconds(DateTime time) + { + System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); + return (int)(time - startTime).TotalSeconds; + } + + /// + /// C#格式时间转换为Unix时间戳(毫秒) + /// + /// + /// + public static long DateTimeToTimestampMilliseconds(DateTime time) + { + System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); + return (long)(time - startTime).TotalMilliseconds; + } } } \ No newline at end of file diff --git a/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.Designer.cs b/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.Designer.cs index 1479a40..810f6b5 100644 --- a/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.Designer.cs +++ b/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.Designer.cs @@ -83,13 +83,13 @@ 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 = 672; + this.splitContainer1.SplitterDistance = 673; this.splitContainer1.SplitterWidth = 3; this.splitContainer1.TabIndex = 4; // // btnReturnPackage // - this.btnReturnPackage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnReturnPackage.Anchor = System.Windows.Forms.AnchorStyles.Top; this.btnReturnPackage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.btnReturnPackage.Cursor = System.Windows.Forms.Cursors.Hand; this.btnReturnPackage.FlatStyle = System.Windows.Forms.FlatStyle.Flat; diff --git a/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.cs b/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.cs index 2723d53..b4a1d62 100644 --- a/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.cs +++ b/TEMUKJD/KJDForms/AdminForms/AdminShopLoginForm.cs @@ -59,6 +59,10 @@ namespace TemuKJD.KJDForms.AdminForms private void ShopLoginForm_Load(object sender, EventArgs e) { //this.splitContainer1.SplitterDistance = 674; + if (BaseClass.SaLevel == 1) + this.btnReturnPackage.Visible = true; + else + this.btnReturnPackage.Visible = false; if (openType == EnumOpenType.login) { diff --git a/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.Designer.cs b/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.Designer.cs index 8b66c7b..7632a0a 100644 --- a/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.Designer.cs +++ b/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.Designer.cs @@ -29,7 +29,6 @@ namespace TemuKJD.KJDForms.ShopForms /// 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(); @@ -42,27 +41,6 @@ namespace TemuKJD.KJDForms.ShopForms this.dtpStartDate = new System.Windows.Forms.DateTimePicker(); this.btnAdd = new TemuKJD.UserControls.ButtonEx(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.label6 = new System.Windows.Forms.Label(); - this.chkShowDel = new TemuKJD.UserComponent.UcCheckBox(this.components); - this.txtShopId = new System.Windows.Forms.TextBox(); - this.chkNoSubSa = new TemuKJD.UserComponent.UcCheckBox(this.components); - this.pnlEmpty = new DevComponents.DotNetBar.PanelEx(); - this.label7 = new System.Windows.Forms.Label(); - this.label8 = new System.Windows.Forms.Label(); - this.txtShopName = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); - this.btnSearch = new TemuKJD.UserControls.ButtonEx(); - this.txtSKC = new System.Windows.Forms.TextBox(); - this.txtSPU = new System.Windows.Forms.TextBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.txtCat = new System.Windows.Forms.TextBox(); - this.txtExtCode = new System.Windows.Forms.TextBox(); - this.label3 = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.txtProdName = new System.Windows.Forms.TextBox(); - 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(); @@ -78,6 +56,7 @@ namespace TemuKJD.KJDForms.ShopForms this.colPurchaseSubOrderSn = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colReason = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.colPackageSn = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.colReturnTotalNum = 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(); @@ -90,7 +69,6 @@ namespace TemuKJD.KJDForms.ShopForms this.splitContainer2.Panel1.SuspendLayout(); this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.SuspendLayout(); - this.tableLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvSelectProduct)).BeginInit(); this.SuspendLayout(); @@ -102,7 +80,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(1278, 466); + this.panel2.Size = new System.Drawing.Size(1364, 526); this.panel2.TabIndex = 1; // // splitContainer1 @@ -125,7 +103,7 @@ namespace TemuKJD.KJDForms.ShopForms // splitContainer1.Panel2 // this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); - this.splitContainer1.Size = new System.Drawing.Size(1278, 466); + this.splitContainer1.Size = new System.Drawing.Size(1364, 526); this.splitContainer1.SplitterDistance = 66; this.splitContainer1.TabIndex = 3; // @@ -173,7 +151,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(1100, 19); + this.btnAdd.Location = new System.Drawing.Point(1186, 19); this.btnAdd.Margin = new System.Windows.Forms.Padding(2); this.btnAdd.Name = "btnAdd"; this.btnAdd.Size = new System.Drawing.Size(171, 26); @@ -192,7 +170,6 @@ namespace TemuKJD.KJDForms.ShopForms // // splitContainer2.Panel1 // - this.splitContainer2.Panel1.Controls.Add(this.tableLayoutPanel1); this.splitContainer2.Panel1.Controls.Add(this.pbLoading); this.splitContainer2.Panel1.Controls.Add(this.dgvSelectProduct); this.splitContainer2.Panel1.Padding = new System.Windows.Forms.Padding(4, 0, 4, 0); @@ -201,297 +178,15 @@ 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(1278, 396); - this.splitContainer2.SplitterDistance = 367; + this.splitContainer2.Size = new System.Drawing.Size(1364, 456); + this.splitContainer2.SplitterDistance = 427; this.splitContainer2.TabIndex = 0; // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.tableLayoutPanel1.ColumnCount = 20; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 12.5F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.Controls.Add(this.label6, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.chkShowDel, 19, 0); - this.tableLayoutPanel1.Controls.Add(this.txtShopId, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.chkNoSubSa, 18, 0); - this.tableLayoutPanel1.Controls.Add(this.pnlEmpty, 17, 0); - this.tableLayoutPanel1.Controls.Add(this.label7, 2, 0); - this.tableLayoutPanel1.Controls.Add(this.label8, 14, 0); - this.tableLayoutPanel1.Controls.Add(this.txtShopName, 3, 0); - this.tableLayoutPanel1.Controls.Add(this.label5, 4, 0); - this.tableLayoutPanel1.Controls.Add(this.btnSearch, 16, 0); - this.tableLayoutPanel1.Controls.Add(this.txtSKC, 7, 0); - this.tableLayoutPanel1.Controls.Add(this.txtSPU, 5, 0); - this.tableLayoutPanel1.Controls.Add(this.label1, 6, 0); - this.tableLayoutPanel1.Controls.Add(this.label2, 8, 0); - this.tableLayoutPanel1.Controls.Add(this.txtCat, 9, 0); - this.tableLayoutPanel1.Controls.Add(this.txtExtCode, 13, 0); - this.tableLayoutPanel1.Controls.Add(this.label3, 10, 0); - 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, 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(960, 32); - this.tableLayoutPanel1.TabIndex = 469; - this.tableLayoutPanel1.Visible = false; - // - // label6 - // - this.label6.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(3, 10); - this.label6.Margin = new System.Windows.Forms.Padding(3, 0, 0, 0); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(41, 12); - this.label6.TabIndex = 449; - this.label6.Text = "店铺Id"; - // - // chkShowDel - // - 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(885, 8); - this.chkShowDel.Name = "chkShowDel"; - this.chkShowDel.Size = new System.Drawing.Size(72, 16); - this.chkShowDel.TabIndex = 471; - this.chkShowDel.Text = "显示删除"; - this.chkShowDel.UseVisualStyleBackColor = true; - // - // txtShopId - // - this.txtShopId.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - 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(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(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); - this.chkNoSubSa.TabIndex = 470; - this.chkNoSubSa.Text = "未分配超管"; - this.chkNoSubSa.UseVisualStyleBackColor = true; - // - // pnlEmpty - // - this.pnlEmpty.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - 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(728, 5); - this.pnlEmpty.Name = "pnlEmpty"; - this.pnlEmpty.Size = new System.Drawing.Size(56, 22); - this.pnlEmpty.Style.Alignment = System.Drawing.StringAlignment.Center; - this.pnlEmpty.Style.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); - this.pnlEmpty.Style.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(215)))), ((int)(((byte)(255))))); - this.pnlEmpty.Style.Border = DevComponents.DotNetBar.eBorderType.SingleLine; - this.pnlEmpty.Style.BorderColor.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.pnlEmpty.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.PanelText; - this.pnlEmpty.Style.GradientAngle = 90; - this.pnlEmpty.StyleMouseDown.Alignment = System.Drawing.StringAlignment.Center; - this.pnlEmpty.StyleMouseOver.Alignment = System.Drawing.StringAlignment.Center; - this.pnlEmpty.StyleMouseOver.BackColor1.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.pnlEmpty.StyleMouseOver.BackColor2.Color = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.pnlEmpty.StyleMouseOver.ForeColor.Color = System.Drawing.Color.White; - this.pnlEmpty.TabIndex = 431; - this.pnlEmpty.Text = "清空条件"; - // - // label7 - // - this.label7.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.label7.AutoSize = true; - 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); - this.label7.TabIndex = 452; - this.label7.Text = "店铺名称"; - // - // label8 - // - this.label8.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.label8.AutoSize = true; - 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); - this.label8.TabIndex = 458; - this.label8.Text = "认领状态"; - // - // 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(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(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(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); - this.label5.TabIndex = 435; - this.label5.Text = "SPU"; - // - // btnSearch - // - this.btnSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.btnSearch.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); - this.btnSearch.Cursor = System.Windows.Forms.Cursors.Hand; - 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(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); - this.btnSearch.TabIndex = 424; - this.btnSearch.Text = "搜索"; - this.btnSearch.UseVisualStyleBackColor = false; - // - // 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(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(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(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(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(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); - this.label1.TabIndex = 433; - this.label1.Text = "SKC"; - // - // label2 - // - this.label2.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.label2.AutoSize = true; - 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); - this.label2.TabIndex = 426; - this.label2.Text = "类目"; - // - // 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(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(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(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(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(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); - this.label3.TabIndex = 428; - this.label3.Text = "标题"; - // - // label4 - // - this.label4.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.label4.AutoSize = true; - 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); - this.label4.TabIndex = 430; - this.label4.Text = "货号"; - // - // 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(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(42, 21); - this.txtProdName.TabIndex = 427; - // - // cmbStatus - // - this.cmbStatus.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.cmbStatus.FormattingEnabled = true; - this.cmbStatus.Items.AddRange(new object[] { - "待上传", - "已上传", - "全部"}); - 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(42, 20); - this.cmbStatus.TabIndex = 459; - this.cmbStatus.Text = "待上传"; - // // pbLoading // this.pbLoading.Anchor = System.Windows.Forms.AnchorStyles.None; this.pbLoading.Image = global::TemuKJD.Properties.Resources.loading_blue; - this.pbLoading.Location = new System.Drawing.Point(614, 142); + this.pbLoading.Location = new System.Drawing.Point(657, 188); this.pbLoading.Name = "pbLoading"; this.pbLoading.Size = new System.Drawing.Size(50, 50); this.pbLoading.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; @@ -527,6 +222,7 @@ namespace TemuKJD.KJDForms.ShopForms this.colPurchaseSubOrderSn, this.colReason, this.colPackageSn, + this.colReturnTotalNum, this.colSkuNumber, this.colOutboundTime, this.colOpResult}); @@ -536,7 +232,7 @@ namespace TemuKJD.KJDForms.ShopForms this.dgvSelectProduct.ReadOnly = true; this.dgvSelectProduct.RowHeadersWidth = 51; this.dgvSelectProduct.RowTemplate.Height = 23; - this.dgvSelectProduct.Size = new System.Drawing.Size(1270, 367); + this.dgvSelectProduct.Size = new System.Drawing.Size(1356, 427); this.dgvSelectProduct.TabIndex = 190; this.dgvSelectProduct.Scroll += new System.Windows.Forms.ScrollEventHandler(this.dgvSelectProduct_Scroll); // @@ -544,7 +240,7 @@ namespace TemuKJD.KJDForms.ShopForms // this.ucSplitPage1.CurrentPage = 1; this.ucSplitPage1.Dock = System.Windows.Forms.DockStyle.Right; - this.ucSplitPage1.Location = new System.Drawing.Point(916, 0); + this.ucSplitPage1.Location = new System.Drawing.Point(1002, 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); @@ -561,7 +257,7 @@ namespace TemuKJD.KJDForms.ShopForms 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.Size = new System.Drawing.Size(1364, 25); this.statusBar.TabIndex = 5; // // colSelect @@ -579,12 +275,14 @@ namespace TemuKJD.KJDForms.ShopForms this.colSpu.HeaderText = "SPU"; this.colSpu.Name = "colSpu"; this.colSpu.ReadOnly = true; + this.colSpu.Width = 88; // // colSku // this.colSku.HeaderText = "SKU"; this.colSku.Name = "colSku"; this.colSku.ReadOnly = true; + this.colSku.Width = 88; // // colImgUrl // @@ -629,6 +327,7 @@ namespace TemuKJD.KJDForms.ShopForms this.colPurchaseSubOrderSn.Name = "colPurchaseSubOrderSn"; this.colPurchaseSubOrderSn.ReadOnly = true; this.colPurchaseSubOrderSn.Resizable = System.Windows.Forms.DataGridViewTriState.True; + this.colPurchaseSubOrderSn.Visible = false; this.colPurchaseSubOrderSn.Width = 120; // // colReason @@ -645,7 +344,14 @@ namespace TemuKJD.KJDForms.ShopForms this.colPackageSn.Name = "colPackageSn"; this.colPackageSn.ReadOnly = true; this.colPackageSn.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colPackageSn.Width = 120; + this.colPackageSn.Width = 136; + // + // colReturnTotalNum + // + this.colReturnTotalNum.HeaderText = "包裹总件数"; + this.colReturnTotalNum.Name = "colReturnTotalNum"; + this.colReturnTotalNum.ReadOnly = true; + this.colReturnTotalNum.Width = 80; // // colSkuNumber // @@ -654,7 +360,7 @@ namespace TemuKJD.KJDForms.ShopForms this.colSkuNumber.Name = "colSkuNumber"; this.colSkuNumber.ReadOnly = true; this.colSkuNumber.Resizable = System.Windows.Forms.DataGridViewTriState.True; - this.colSkuNumber.Width = 80; + this.colSkuNumber.Width = 70; // // colOutboundTime // @@ -670,12 +376,12 @@ namespace TemuKJD.KJDForms.ShopForms this.colOpResult.HeaderText = "上传结果"; this.colOpResult.Name = "colOpResult"; this.colOpResult.ReadOnly = true; - this.colOpResult.Width = 150; + this.colOpResult.Width = 200; // // ReturnPackageDetailForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; - this.ClientSize = new System.Drawing.Size(1280, 500); + this.ClientSize = new System.Drawing.Size(1366, 560); this.Controls.Add(this.panel2); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Name = "ReturnPackageDetailForm"; @@ -693,8 +399,6 @@ namespace TemuKJD.KJDForms.ShopForms this.splitContainer2.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); this.splitContainer2.ResumeLayout(false); - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pbLoading)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.dgvSelectProduct)).EndInit(); this.ResumeLayout(false); @@ -705,27 +409,6 @@ namespace TemuKJD.KJDForms.ShopForms private System.Windows.Forms.Panel panel2; private System.Windows.Forms.SplitContainer splitContainer1; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.Label label6; - private UserComponent.UcCheckBox chkShowDel; - private System.Windows.Forms.TextBox txtShopId; - private UserComponent.UcCheckBox chkNoSubSa; - private DevComponents.DotNetBar.PanelEx pnlEmpty; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.TextBox txtShopName; - private System.Windows.Forms.Label label5; - private UserControls.ButtonEx btnSearch; - private System.Windows.Forms.TextBox txtSKC; - private System.Windows.Forms.TextBox txtSPU; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox txtCat; - private System.Windows.Forms.TextBox txtExtCode; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TextBox txtProdName; - private System.Windows.Forms.ComboBox cmbStatus; private UserControls.ButtonEx btnAdd; private System.Windows.Forms.SplitContainer splitContainer2; private System.Windows.Forms.PictureBox pbLoading; @@ -747,6 +430,7 @@ namespace TemuKJD.KJDForms.ShopForms private System.Windows.Forms.DataGridViewTextBoxColumn colPurchaseSubOrderSn; private System.Windows.Forms.DataGridViewTextBoxColumn colReason; private System.Windows.Forms.DataGridViewTextBoxColumn colPackageSn; + private System.Windows.Forms.DataGridViewTextBoxColumn colReturnTotalNum; private System.Windows.Forms.DataGridViewTextBoxColumn colSkuNumber; private System.Windows.Forms.DataGridViewTextBoxColumn colOutboundTime; private System.Windows.Forms.DataGridViewTextBoxColumn colOpResult; diff --git a/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.cs b/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.cs index 7cb57e1..14f8b62 100644 --- a/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.cs +++ b/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.cs @@ -81,8 +81,8 @@ namespace TemuKJD.KJDForms.ShopForms 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.lblTaskStatus.Text = "正在查询" + midTime.ToString(" yy年MM月dd日 至 ") + endTime.ToString("yy年MM月dd日 ") + "..."; + this.statusBar.pgbTaskProgress.Maximum = i + 1; this.statusBar.UpdateProgressBar(i + 1); i++; })); @@ -144,13 +144,11 @@ namespace TemuKJD.KJDForms.ShopForms int totalPage = 1; bool isError = false; string errMsg = ""; + List packageLstTmp = new List(); while (page < totalPage) { page++; - if (cancellationTokenSource.IsCancellationRequested) - break; - Thread.Sleep(Randomx.GetId(100, 300)); int tryCount = 0; @@ -193,19 +191,18 @@ namespace TemuKJD.KJDForms.ShopForms } 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); + packageLstTmp.Add(pInfo); } } string prodJsonStr = ""; - string skcIds = string.Join(",", packageLst.Select(p => p.productSkcId).Distinct()); + string skcIds = string.Join(",", packageLstTmp.Select(p => p.productSkuId).Distinct()); if (skcIds.Length > 0) { prodJsonStr = GetProductList(shop, skcIds); @@ -224,119 +221,159 @@ namespace TemuKJD.KJDForms.ShopForms { long productSkcId = prod["productSkcId"].ParseToLong(); string extCode = prod["extCode"].ParseToString(); - foreach (var pack in packageLst) + foreach (var pack in packageLstTmp) { if (pack.productSkcId == productSkcId) pack.extCode = extCode; } + + foreach(var sku in prod["productSkuSummaries"]) + { + long skuId = sku["productSkuId"].ParseToLong(); + foreach (var pack in packageLstTmp) + { + if (pack.productSkuId == skuId) + { + string s1 = sku["productSkuSpecList"]?.FirstOrDefault()?.ToString(); + string s2 = sku["productSkuSpecList"]?.LastOrDefault()?.ToString(); + pack.spec1 = JsonHelper.DeserializeJsonToObject(s1); + pack.spec2 = JsonHelper.DeserializeJsonToObject(s2); + } + } + } } } 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(); + int total = BaseRegex.GetStringJson(ref jsonStr, "total").ParseToInt(); + totalPage = Math.Ceiling(total / 10.0).ParseToInt(); + } + //以上一次查完一整个月的再合并,因为同一个包裹里可能有相同的退货包裹号sku号数量等等这些全一致的,需要手动合并到一起一把上传 + List packageLst = new List(); + foreach (var packTmp in packageLstTmp) + { + var packageExist = packageLst.FirstOrDefault(p => p.productSkuId == packTmp.productSkuId && p.packageSn == packTmp.packageSn); + if (packageExist == null) + { + packageLst.Add(packTmp); + } + else + { + packageExist.quantity += packTmp.quantity; + packageExist.reasonDesc.AddRange(packTmp.reasonDesc); + packageExist.reasonDesc = packageExist.reasonDesc.Distinct().ToList(); } } - - Invoke(new Action(() => + // 计算包裹内商品总数 + foreach (var pack in packageLst) { - //var rows = this.dgvShop.Rows.Cast().Where(r => r.Cells["colShopId"].Value.ToString() == shop.ShopId); + //pack.returnTotalNum = packageLst.Where(p => p.packageSn == pack.packageSn).Select(n => n.quantity.ParseToInt()).Count(); + pack.returnTotalNum = packageLst.Where(p => p.packageSn == pack.packageSn).Sum(n => n.quantity.ParseToInt()); + } + //packageLst = packageLst.OrderByDescending(p => p.outboundTime).ToList(); - //if (!isError) - //{ - // foreach (var row in rows) - // { - // row.Cells["colMessage"].Value = "已查询"; - // } - //} - //else - //{ - // foreach (var row in rows) - // { - // row.Cells["colMessage"].Value = "查询失败 " + errMsg; - // } - //} - })); + 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.spec1.parentSpecName == "颜色" ? pack.spec1.specName : pack.spec2.specName, + productSize = pack.spec1.parentSpecName == "颜色" ? pack.spec2.specName : pack.spec1.specName, + productCount = pack.quantity.ParseToInt(), + productSkcId = pack.productSkcId.ParseToString(), + productSkcPicture = imgBase64, + productSkuId = pack.productSkuId.ParseToString(), + returnPackageNo = pack.packageSn, + returnReason = string.Join(",", pack.reasonDesc), + returnTotalNum = pack.returnTotalNum, + }; + 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(); + + int r2 = DateTime.Now.Millisecond; + var url = BaseClass.BuildObjString("user/get_package_sign"); + var data = Work.UserLogin.GetSignaturex() + + "×tamp=" + timestamp + + "&mallId=" + mallId + + "&returnPackageNo=" + returnPackageNo + + "&r2=" + r2 + + "&c2=" + Work.UserLogin.Encryption(r2); + string signHtml = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(signHtml) || !signHtml.Contains("\"code\":200")) + signHtml = GetHtml.PostUtf8(url, data); + if (string.IsNullOrEmpty(signHtml) || !signHtml.Contains("\"code\":200")) + signHtml = GetHtml.PostUtf8(url, data); + string sign = BaseRegex.GetStringJson(ref signHtml, "sign"); + + string html = "\"code\":200"; + string url2 = "https://temu.tuihuocangku.cn/prod-api/api/return/addReturnGoods"; + string referer2 = "https://temu.tuihuocangku.cn/prod-api/api/return"; + string postData = JsonHelper.SerializeObject(packageParam); + //634418210534062 测试店铺 + html = ReturnPackagePostResponse(shop, url2, postData, referer2, timestamp.ParseToString(), sign); + Thread.Sleep(Randomx.GetId(60)); + string rst = ""; + if (html.Contains("\"code\":200")) + { + rst = "退货订单插入成功"; + } + else + { + rst = BaseRegex.GetStringJson(ref html, "msg"); + } + + 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.returnTotalNum, + pack.quantity, + BaseClass.StampToDateTime((pack.outboundTime.ParseToLong() / 1000).ParseToInt()), // 出库时间 + rst // 操作结果,状态 + ); + + dgvSelectProduct.Rows[rowId].Height = 60; + })); + } + lstReturnPackageInfo.AddRange(packageLst); + + ShowDgvImg(); } Invoke(new Action(() => { @@ -422,7 +459,7 @@ namespace TemuKJD.KJDForms.ShopForms 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}"; + body = @"{""productSkuIds"":[" + skcIds + @"],""page"":" + page + @",""pageSize"":200}"; string refere = "https://agentseller.temu.com/goods/list"; @@ -441,11 +478,11 @@ namespace TemuKJD.KJDForms.ShopForms 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.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("timestamp", timeStamp); request.Headers.Add("sign", sign); request.ContentType = "application/json"; request.Accept = "*/*"; diff --git a/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.resx b/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.resx index 0d2169e..452eed1 100644 --- a/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.resx +++ b/TEMUKJD/KJDForms/ShopForms/ReturnPackageDetailForm.resx @@ -150,6 +150,9 @@ True + + True + True diff --git a/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.Designer.cs b/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.Designer.cs index 9be8831..4468020 100644 --- a/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.Designer.cs +++ b/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.Designer.cs @@ -46,6 +46,7 @@ this.chkCloseAfterLogin = new DevComponents.DotNetBar.Controls.CheckBoxX(); this.splitContainer2 = new System.Windows.Forms.SplitContainer(); this.txtAddress = new System.Windows.Forms.TextBox(); + this.btnReturnPackage = new TemuKJD.UserControls.ButtonEx(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); @@ -69,6 +70,7 @@ // splitContainer1.Panel2 // this.splitContainer1.Panel2.BackColor = System.Drawing.Color.White; + this.splitContainer1.Panel2.Controls.Add(this.btnReturnPackage); this.splitContainer1.Panel2.Controls.Add(this.btnLoginAgain); this.splitContainer1.Panel2.Controls.Add(this.pnlMultiLogin); this.splitContainer1.Panel2.Controls.Add(this.label2); @@ -81,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 = 674; + this.splitContainer1.SplitterDistance = 675; this.splitContainer1.SplitterWidth = 3; this.splitContainer1.TabIndex = 4; // @@ -319,7 +321,7 @@ // // txtAddress // - this.txtAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + this.txtAddress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.txtAddress.Location = new System.Drawing.Point(3, 3); this.txtAddress.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4); @@ -328,6 +330,23 @@ this.txtAddress.TabIndex = 7; this.txtAddress.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtAddress_KeyDown); // + // btnReturnPackage + // + this.btnReturnPackage.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.btnReturnPackage.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(63)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); + this.btnReturnPackage.Cursor = System.Windows.Forms.Cursors.Hand; + 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(651, 28); + 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 = 464; + this.btnReturnPackage.Text = "提交退货到库存管理"; + this.btnReturnPackage.UseVisualStyleBackColor = false; + this.btnReturnPackage.Click += new System.EventHandler(this.btnReturnPackage_Click); + // // ShopLoginForm // this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; @@ -375,5 +394,6 @@ private DevComponents.DotNetBar.PanelEx btnMultiLogin; private System.Windows.Forms.Panel pnlMultiLogin; private UserControls.ButtonEx btnLoginAgain; + private UserControls.ButtonEx btnReturnPackage; } } \ No newline at end of file diff --git a/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.cs b/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.cs index 4c73928..8238796 100644 --- a/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.cs +++ b/TEMUKJD/KJDForms/ShopForms/ShopLoginForm.cs @@ -1066,5 +1066,11 @@ function getElementWithText(sText) InputUserNameAndPassword(cefWebBrowser, shop.LoginName, DataOpenSSL.DecryptString(shop.Password)); }); } + + private void btnReturnPackage_Click(object sender, EventArgs e) + { + ReturnPackageDetailForm form = new ReturnPackageDetailForm(this.shop); + form.ShowDialog(); + } } }