diff --git a/HKCardManager/Form1.cs b/HKCardManager/Form1.cs index d82061b..9fbfd75 100644 --- a/HKCardManager/Form1.cs +++ b/HKCardManager/Form1.cs @@ -5,7 +5,6 @@ using HKLib.SQLHelper; using System.Text.RegularExpressions; using HKHelper; using UHFHelper; -using UHFHelper; namespace HKCardManager { @@ -299,20 +298,29 @@ namespace HKCardManager private void button13_Click(object sender, EventArgs e) { + + + if (UHFCardHelper.GetInstance().ComOpen) { try { - + var res = UHFCardHelper.GetInstance().ReadCard(); + if (string.IsNullOrEmpty(res)) { MessageBox.Show("提示!!!\n 请放入卡片,在选择销卡..."); MessageLogNotify.GetInstance.Show("请放入卡片"); return; } - var res1 = UHFCardHelper.GetInstance().WriteCard("000"); - MessageBox.Show(res1.Res ? "销卡成功" : "销卡失败"); + + var resz = MessageBox.Show($"提示!!!\n 当前卡号{res},确定销卡?", "提示", MessageBoxButtons.YesNo); + if (resz == DialogResult.Yes) + { + var res1 = UHFCardHelper.GetInstance().WriteCard("000"); + MessageBox.Show(res1.Res ? "销卡成功" : "销卡失败"); + } } catch (Exception) { diff --git a/HKCardManager/UserPages/CancellationPage.cs b/HKCardManager/UserPages/CancellationPage.cs index fe3a05a..47c3a5b 100644 --- a/HKCardManager/UserPages/CancellationPage.cs +++ b/HKCardManager/UserPages/CancellationPage.cs @@ -21,11 +21,30 @@ namespace HKCardManager.UserPages //this.SizeChanged += CancellationPage_SizeChanged; } - //private void CancellationPage_SizeChanged(object? sender, EventArgs e) - //{ - // panel1.Left = (this.Width - panel1.Width) / 2; - // panel1.Top = (this.Height - panel1.Height) / 2; - //} + private void Ref() + { + var res = HKLibHelper.GetUserListSync(""); + Global.UserListDtos.Clear(); + res?.ToList()?.ForEach(item => + { + string status = ""; + string cardNum = ""; + if (item.Cards != null && item.Cards.Count > 0) + { + cardNum = item.Cards.ElementAt(0).CardNum; + status = ((CarStatus)item.Cards.ElementAt(0).State).ToString(); + } + Global.UserListDtos.Add(new UserInfoModel() + { + Num = item.Num, + UserName = item.Name, + Phone = item.Phone, + OrgName = item.OrgInfo?.Count > 0 ? item.OrgInfo.ElementAt(0).Name : "", + CardNum = cardNum, + State = status + }); + }); + } private async void button2_Click(object sender, EventArgs e) { @@ -53,10 +72,16 @@ namespace HKCardManager.UserPages //{ //this.Invoke(() => { button2.Enabled = false; }); button2.Enabled = false; - + Ref(); var temp = Global.UserListDtos.FirstOrDefault(p => p.UserName == name); if (temp != null) { + if (status==3&& temp.State== "鎸傚け") + { + MessageBox.Show($"鐢ㄦ埛銆恵temp.UserName}銆戞寕澶辩姸鎬佷笉鑳介攢鎴"); + return; + } + if (!string.IsNullOrEmpty(temp.CardNum)) { var res = await HKLibHelper.CardStutasChange(new CardStutasDto() diff --git a/HKCardManager/UserPages/CarMangerPage.cs b/HKCardManager/UserPages/CarMangerPage.cs index 2eda024..ff19b08 100644 --- a/HKCardManager/UserPages/CarMangerPage.cs +++ b/HKCardManager/UserPages/CarMangerPage.cs @@ -205,7 +205,8 @@ namespace HKCardManager.UserPages { Name = Name, OrgId = orgTables.FirstOrDefault(p => p.Name == comboBox1.Text)?.SId, - CardNo = worker + CardNo = worker, + Num= HKLibHelper.GetUserMaxNumSync() }; //Task.Factory.StartNew(() => //{ @@ -293,12 +294,6 @@ namespace HKCardManager.UserPages { if (UHFCardHelper.GetInstance().ComOpen) { - if (FirstUser == null) - { - MessageBox.Show("鎻愮ず锛侊紒锛乗n 娌℃湁鍙互鍒跺崱鐨勬垚鍛..."); - MessageLogNotify.GetInstance.ShowWarning("娌℃湁鍙互鍒跺崱鐨勬垚鍛橈紒"); - return; - } var res = UHFCardHelper.GetInstance().ReadCard(); if (string.IsNullOrEmpty(res)) { @@ -306,6 +301,18 @@ namespace HKCardManager.UserPages MessageLogNotify.GetInstance.Show("璇锋斁鍏ュ崱鐗"); return; } + if (res.Equals("000")) + { + MessageBox.Show("鎻愮ず锛侊紒锛乗n 杩欐槸涓寮犳柊鍗..."); + } + + if (FirstUser == null) + { + MessageBox.Show("鎻愮ず锛侊紒锛乗n 娌℃湁鍙互鍒跺崱鐨勬垚鍛..."); + MessageLogNotify.GetInstance.ShowWarning("娌℃湁鍙互鍒跺崱鐨勬垚鍛橈紒"); + return; + } + if (Regex.IsMatch(res, "\\d{19}")) { var result = await HKLibHelper.GetUserList(""); @@ -348,7 +355,7 @@ namespace HKCardManager.UserPages { Name = Name, OrgId = orgTables.FirstOrDefault(p => p.Name == FirstUser.OrgName)?.SId, - CardNo = worker + CardNo = worker, }; var res = UHFCardHelper.GetInstance().WriteCard(userDto.CardNo); if (res.Res == false) diff --git a/HKCardManager/UserPages/ReportFormPage.Designer.cs b/HKCardManager/UserPages/ReportFormPage.Designer.cs index 47babb2..79c2654 100644 --- a/HKCardManager/UserPages/ReportFormPage.Designer.cs +++ b/HKCardManager/UserPages/ReportFormPage.Designer.cs @@ -29,13 +29,6 @@ private void InitializeComponent() { this.dataGridView1 = new System.Windows.Forms.DataGridView(); - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.button2 = new System.Windows.Forms.Button(); - this.button1 = new System.Windows.Forms.Button(); - this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker(); - this.label4 = new System.Windows.Forms.Label(); - this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker(); - this.label3 = new System.Windows.Forms.Label(); this.濮撳悕 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.鎵嬫満 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.鏃堕棿 = new System.Windows.Forms.DataGridViewTextBoxColumn(); @@ -48,11 +41,25 @@ this.鏅氫笂娑堣垂閲戦 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.鎬昏娑堣垂娆℃暟 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.閲戦鎬昏 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.splitContainer1 = new System.Windows.Forms.SplitContainer(); + this.button2 = new System.Windows.Forms.Button(); + this.button1 = new System.Windows.Forms.Button(); + this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker(); + this.label4 = new System.Windows.Forms.Label(); + this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker(); + this.label3 = new System.Windows.Forms.Label(); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.button3 = new System.Windows.Forms.Button(); + this.button4 = new System.Windows.Forms.Button(); + this.label1 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); this.splitContainer1.SuspendLayout(); + this.tableLayoutPanel1.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); this.SuspendLayout(); // // dataGridView1 @@ -73,94 +80,13 @@ this.鎬昏娑堣垂娆℃暟, this.閲戦鎬昏}); this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; - this.dataGridView1.Location = new System.Drawing.Point(0, 0); + this.dataGridView1.Location = new System.Drawing.Point(3, 3); this.dataGridView1.Name = "dataGridView1"; this.dataGridView1.RowHeadersVisible = false; this.dataGridView1.RowTemplate.Height = 25; - this.dataGridView1.Size = new System.Drawing.Size(875, 513); + this.dataGridView1.Size = new System.Drawing.Size(869, 430); this.dataGridView1.TabIndex = 2; // - // splitContainer1 - // - this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer1.Location = new System.Drawing.Point(0, 0); - this.splitContainer1.Name = "splitContainer1"; - this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // splitContainer1.Panel1 - // - this.splitContainer1.Panel1.Controls.Add(this.button2); - this.splitContainer1.Panel1.Controls.Add(this.button1); - this.splitContainer1.Panel1.Controls.Add(this.dateTimePicker2); - this.splitContainer1.Panel1.Controls.Add(this.label4); - this.splitContainer1.Panel1.Controls.Add(this.dateTimePicker1); - this.splitContainer1.Panel1.Controls.Add(this.label3); - // - // splitContainer1.Panel2 - // - this.splitContainer1.Panel2.Controls.Add(this.dataGridView1); - this.splitContainer1.Size = new System.Drawing.Size(875, 557); - this.splitContainer1.SplitterDistance = 40; - this.splitContainer1.TabIndex = 3; - // - // button2 - // - this.button2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.button2.Location = new System.Drawing.Point(735, 6); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(88, 30); - this.button2.TabIndex = 12; - this.button2.Text = "瀵煎嚭"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // button1 - // - this.button1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.button1.Location = new System.Drawing.Point(629, 6); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(88, 30); - this.button1.TabIndex = 11; - this.button1.Text = "鏌ヨ"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // dateTimePicker2 - // - this.dateTimePicker2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.dateTimePicker2.Location = new System.Drawing.Point(389, 6); - this.dateTimePicker2.Name = "dateTimePicker2"; - this.dateTimePicker2.Size = new System.Drawing.Size(200, 28); - this.dateTimePicker2.TabIndex = 9; - // - // label4 - // - this.label4.AutoSize = true; - this.label4.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label4.Location = new System.Drawing.Point(312, 10); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(90, 21); - this.label4.TabIndex = 8; - this.label4.Text = "缁撴潫鏃堕棿锛"; - // - // dateTimePicker1 - // - this.dateTimePicker1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.dateTimePicker1.Location = new System.Drawing.Point(80, 6); - this.dateTimePicker1.Name = "dateTimePicker1"; - this.dateTimePicker1.Size = new System.Drawing.Size(200, 28); - this.dateTimePicker1.TabIndex = 7; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); - this.label3.Location = new System.Drawing.Point(3, 10); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(90, 21); - this.label3.TabIndex = 6; - this.label3.Text = "寮濮嬫椂闂达細"; - // // 濮撳悕 // this.濮撳悕.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; @@ -254,6 +180,149 @@ this.閲戦鎬昏.HeaderText = "閲戦鎬昏"; this.閲戦鎬昏.Name = "閲戦鎬昏"; // + // splitContainer1 + // + this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.splitContainer1.Location = new System.Drawing.Point(0, 0); + this.splitContainer1.Name = "splitContainer1"; + this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; + // + // splitContainer1.Panel1 + // + this.splitContainer1.Panel1.Controls.Add(this.button2); + this.splitContainer1.Panel1.Controls.Add(this.button1); + this.splitContainer1.Panel1.Controls.Add(this.dateTimePicker2); + this.splitContainer1.Panel1.Controls.Add(this.label4); + this.splitContainer1.Panel1.Controls.Add(this.dateTimePicker1); + this.splitContainer1.Panel1.Controls.Add(this.label3); + // + // splitContainer1.Panel2 + // + this.splitContainer1.Panel2.Controls.Add(this.tableLayoutPanel1); + this.splitContainer1.Size = new System.Drawing.Size(875, 557); + this.splitContainer1.SplitterDistance = 40; + this.splitContainer1.TabIndex = 3; + // + // button2 + // + this.button2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.button2.Location = new System.Drawing.Point(735, 6); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(88, 30); + this.button2.TabIndex = 12; + this.button2.Text = "瀵煎嚭"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button1 + // + this.button1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.button1.Location = new System.Drawing.Point(629, 6); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(88, 30); + this.button1.TabIndex = 11; + this.button1.Text = "鏌ヨ"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // dateTimePicker2 + // + this.dateTimePicker2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.dateTimePicker2.Location = new System.Drawing.Point(389, 6); + this.dateTimePicker2.Name = "dateTimePicker2"; + this.dateTimePicker2.Size = new System.Drawing.Size(200, 28); + this.dateTimePicker2.TabIndex = 9; + // + // label4 + // + this.label4.AutoSize = true; + this.label4.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label4.Location = new System.Drawing.Point(312, 10); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(90, 21); + this.label4.TabIndex = 8; + this.label4.Text = "缁撴潫鏃堕棿锛"; + // + // dateTimePicker1 + // + this.dateTimePicker1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.dateTimePicker1.Location = new System.Drawing.Point(80, 6); + this.dateTimePicker1.Name = "dateTimePicker1"; + this.dateTimePicker1.Size = new System.Drawing.Size(200, 28); + this.dateTimePicker1.TabIndex = 7; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); + this.label3.Location = new System.Drawing.Point(3, 10); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(90, 21); + this.label3.TabIndex = 6; + this.label3.Text = "寮濮嬫椂闂达細"; + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Controls.Add(this.dataGridView1, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 1); + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 91.02296F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 8.977036F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(875, 479); + this.tableLayoutPanel1.TabIndex = 3; + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.ColumnCount = 3; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 294F)); + this.tableLayoutPanel2.Controls.Add(this.button3, 0, 0); + this.tableLayoutPanel2.Controls.Add(this.button4, 2, 0); + this.tableLayoutPanel2.Controls.Add(this.label1, 1, 0); + this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 439); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 1; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(869, 37); + this.tableLayoutPanel2.TabIndex = 3; + // + // button3 + // + this.button3.Dock = System.Windows.Forms.DockStyle.Fill; + this.button3.Location = new System.Drawing.Point(3, 3); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(281, 31); + this.button3.TabIndex = 0; + this.button3.Text = "涓婁竴椤"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button4 + // + this.button4.Dock = System.Windows.Forms.DockStyle.Fill; + this.button4.Location = new System.Drawing.Point(577, 3); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(289, 31); + this.button4.TabIndex = 1; + this.button4.Text = "涓嬩竴椤"; + this.button4.UseVisualStyleBackColor = true; + this.button4.Click += new System.EventHandler(this.button4_Click); + // + // label1 + // + this.label1.Anchor = System.Windows.Forms.AnchorStyles.None; + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(430, 10); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(0, 17); + this.label1.TabIndex = 2; + // // ReportFormPage // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); @@ -267,6 +336,9 @@ this.splitContainer1.Panel2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit(); this.splitContainer1.ResumeLayout(false); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel2.ResumeLayout(false); + this.tableLayoutPanel2.PerformLayout(); this.ResumeLayout(false); } @@ -292,5 +364,10 @@ private DataGridViewTextBoxColumn 鏅氫笂娑堣垂閲戦; private DataGridViewTextBoxColumn 鎬昏娑堣垂娆℃暟; private DataGridViewTextBoxColumn 閲戦鎬昏; + private TableLayoutPanel tableLayoutPanel1; + private TableLayoutPanel tableLayoutPanel2; + private Button button3; + private Button button4; + private Label label1; } } diff --git a/HKCardManager/UserPages/ReportFormPage.cs b/HKCardManager/UserPages/ReportFormPage.cs index f43986c..750ed20 100644 --- a/HKCardManager/UserPages/ReportFormPage.cs +++ b/HKCardManager/UserPages/ReportFormPage.cs @@ -16,15 +16,23 @@ namespace HKCardManager.UserPages { public partial class ReportFormPage : UserControl { + private int PageSize = 10; + private int Total; + private int PageIndex; + private double TotalPage; public ReportFormPage() { InitializeComponent(); dataGridView1.AutoGenerateColumns = false; button2.Enabled = false; DataGridViewInit(); - + PageIndex = 1; + TotalPage = 0; + Total = 0; + this.button3.Enabled = false; } + private void DataGridViewInit() { dataGridView1.AllowUserToResizeRows = false; @@ -106,7 +114,6 @@ namespace HKCardManager.UserPages } } List reportCountDtos = new List(); - //鏌ヨ private async void button1_Click(object sender, EventArgs e) { @@ -115,28 +122,28 @@ namespace HKCardManager.UserPages if (TagName == "鏈堥娈垫秷璐硅〃") type = 2; else if (TagName == "璁版灏遍澶╂秷璐硅〃") type = 1; else if (TagName == "鏈堥娈垫眹鎬昏〃") type = 3; - //Task.Factory.StartNew(() => - //{ + this.Invoke(() => { button1.Enabled = false; }); var res = await HKLibHelper.Report(new ReportDto() { StartTime = dateTimePicker1.Value, EndTime = dateTimePicker2.Value }, type); + var price = SqlLogic.GetPrice(); + + foreach (var item in res) + { + + item.AM = price == null ? 0 : price.AM * item.AMCount; + item.PM = item.PMCount >= 20 ? 75 : price == null ? 0 : price.PM * item.PMCount; + item.AT = price == null ? 0 : price.AT * item.ATCount; + item.Total = item.AM + item.PM + item.AT; + } + reportCountDtos = res; + Total = res.Count; + TotalPage = Math.Ceiling(Total * 1.0 / PageSize); + res = res.Skip(0).Take(PageSize).ToList(); + label1.Text = $"{PageIndex}/{TotalPage}"; if (res != null) { if (res.Count > 0) { - reportCountDtos = res; - - var price = SqlLogic.GetPrice(); - - foreach (var item in reportCountDtos) - { - - item.AM = price == null ? 0 : price.AM * item.AMCount; - item.PM = item.PMCount >= 20 ? 75 : price == null ? 0 : price.PM * item.PMCount; - item.AT = price == null ? 0 : price.AT * item.ATCount; - item.Total = item.AM + item.PM + item.AT; - } - - this.Invoke(() => { @@ -161,7 +168,7 @@ namespace HKCardManager.UserPages dataGridView1.Columns[2].Visible = false; dataGridView1.Columns[3].Visible = true; } - dataGridView1.DataSource = reportCountDtos; + dataGridView1.DataSource = res; button2.Enabled = true; }); MessageLogNotify.GetInstance.Show("鑾峰彇琛ㄦ暟鎹垚鍔"); @@ -177,7 +184,7 @@ namespace HKCardManager.UserPages MessageLogNotify.GetInstance.ShowError("鏌ヨ澶辫触锛岃杈撳叆姝g‘鐨勬椂闂存"); } this.Invoke(() => { button1.Enabled = true; }); - //}); + } //瀵煎嚭 @@ -197,5 +204,36 @@ namespace HKCardManager.UserPages this.Invoke(() => { button2.Enabled = true; }); } } + + private void button3_Click(object sender, EventArgs e) + { + if (PageIndex <= 1) + { + this.button3.Enabled = false; + return; + } + PageIndex = PageIndex - 1; + + var data = reportCountDtos.Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList(); + dataGridView1.DataSource = data; + this.button4.Enabled = true; + label1.Text = $"{PageIndex}/{TotalPage}"; + } + + private void button4_Click(object sender, EventArgs e) + { + if (PageIndex >= TotalPage) + { + this.button4.Enabled = false; + return; + } + PageIndex = PageIndex + 1; + + var data = reportCountDtos.Skip((PageIndex - 1) * PageSize).Take(PageSize).ToList(); + dataGridView1.DataSource = data; + this.button3.Enabled = true; + label1.Text = $"{PageIndex}/{TotalPage}"; + + } } } diff --git a/HKLib/Interfaces/HKLibHelper.cs b/HKLib/Interfaces/HKLibHelper.cs index 61be0d7..dd7d4ba 100644 --- a/HKLib/Interfaces/HKLibHelper.cs +++ b/HKLib/Interfaces/HKLibHelper.cs @@ -201,7 +201,7 @@ namespace HKLib.Interfaces if (string.IsNullOrEmpty(data)) return new List(); var res = data.ToModel()["data"]["data"].ToJson().ToModel>(); - return res.Where(t => !t.Name.Contains("绠$悊鍛")).OrderByDescending(t => t.Num).ToList(); + return res.Where(t => !t.Name.Contains("绠$悊鍛")).OrderBy(t => t.Num).ToList(); } /// @@ -215,7 +215,11 @@ namespace HKLib.Interfaces { t.NodePath = $"{Configer.SaasRoute}api/one-card/mmenber-card"; t.ReqType = MultiType.POST; - t.JsonParam = (new { tagId = input.OrgId, realName = input.Name, phone = input.Phone, cardNum = input.CardNo }).ToJson(); + t.JsonParam = (new { tagId = input.OrgId, + realName = input.Name, + num=input.Num, + phone = input.Phone, + cardNum = input.CardNo }).ToJson(); }).Build().RunStringFirstAsync(); return data.ToModel()["data"]["isSuccess"].ToString().AsBool();