diff --git a/HKCardManager/Form1.Designer.cs b/HKCardManager/Form1.Designer.cs index 0753e91..76a18a7 100644 --- a/HKCardManager/Form1.Designer.cs +++ b/HKCardManager/Form1.Designer.cs @@ -28,8 +28,8 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.pictureBox11 = new System.Windows.Forms.PictureBox(); @@ -50,6 +50,7 @@ this.button10 = new System.Windows.Forms.Button(); this.button11 = new System.Windows.Forms.Button(); this.groupBox2 = new System.Windows.Forms.GroupBox(); + this.button13 = new System.Windows.Forms.Button(); this.pictureBox6 = new System.Windows.Forms.PictureBox(); this.pictureBox5 = new System.Windows.Forms.PictureBox(); this.pictureBox4 = new System.Windows.Forms.PictureBox(); @@ -64,6 +65,7 @@ this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.图标 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.消息文本 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.pictureBox12 = new System.Windows.Forms.PictureBox(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -89,6 +91,7 @@ this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12)).BeginInit(); this.SuspendLayout(); // // splitContainer1 @@ -121,12 +124,13 @@ this.groupBox5.Controls.Add(this.button8); this.groupBox5.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.groupBox5.ForeColor = System.Drawing.Color.Black; - this.groupBox5.Location = new System.Drawing.Point(3, 584); + this.groupBox5.Location = new System.Drawing.Point(3, 615); this.groupBox5.Name = "groupBox5"; this.groupBox5.Size = new System.Drawing.Size(243, 77); this.groupBox5.TabIndex = 12; this.groupBox5.TabStop = false; this.groupBox5.Text = "广告设置"; + this.groupBox5.Visible = false; // // pictureBox11 // @@ -224,7 +228,7 @@ this.groupBox4.Controls.Add(this.button12); this.groupBox4.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.groupBox4.ForeColor = System.Drawing.Color.Black; - this.groupBox4.Location = new System.Drawing.Point(3, 501); + this.groupBox4.Location = new System.Drawing.Point(3, 534); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(243, 77); this.groupBox4.TabIndex = 3; @@ -266,7 +270,7 @@ this.groupBox3.Controls.Add(this.button11); this.groupBox3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.groupBox3.ForeColor = System.Drawing.Color.Black; - this.groupBox3.Location = new System.Drawing.Point(3, 336); + this.groupBox3.Location = new System.Drawing.Point(3, 368); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(243, 159); this.groupBox3.TabIndex = 5; @@ -351,6 +355,8 @@ // groupBox2 // this.groupBox2.BackColor = System.Drawing.SystemColors.Control; + this.groupBox2.Controls.Add(this.pictureBox12); + this.groupBox2.Controls.Add(this.button13); this.groupBox2.Controls.Add(this.pictureBox6); this.groupBox2.Controls.Add(this.pictureBox5); this.groupBox2.Controls.Add(this.pictureBox4); @@ -361,13 +367,27 @@ this.groupBox2.Controls.Add(this.button5); this.groupBox2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.groupBox2.ForeColor = System.Drawing.Color.Black; - this.groupBox2.Location = new System.Drawing.Point(3, 127); + this.groupBox2.Location = new System.Drawing.Point(3, 118); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(243, 203); + this.groupBox2.Size = new System.Drawing.Size(243, 246); this.groupBox2.TabIndex = 3; this.groupBox2.TabStop = false; this.groupBox2.Text = "卡片维护"; // + // button13 + // + this.button13.BackColor = System.Drawing.SystemColors.Control; + this.button13.Location = new System.Drawing.Point(9, 200); + this.button13.Name = "button13"; + this.button13.Padding = new System.Windows.Forms.Padding(30, 0, 0, 0); + this.button13.Size = new System.Drawing.Size(220, 38); + this.button13.TabIndex = 8; + this.button13.Tag = "销卡"; + this.button13.Text = "销卡"; + this.button13.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.button13.UseVisualStyleBackColor = false; + this.button13.Click += new System.EventHandler(this.button13_Click); + // // pictureBox6 // this.pictureBox6.BackColor = System.Drawing.Color.Transparent; @@ -531,8 +551,8 @@ // // 图标 // - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter; - this.图标.DefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter; + this.图标.DefaultCellStyle = dataGridViewCellStyle5; this.图标.HeaderText = "图标"; this.图标.Name = "图标"; this.图标.ReadOnly = true; @@ -541,12 +561,23 @@ // 消息文本 // this.消息文本.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.消息文本.DefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle6.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.消息文本.DefaultCellStyle = dataGridViewCellStyle6; this.消息文本.HeaderText = "消息文本"; this.消息文本.Name = "消息文本"; this.消息文本.ReadOnly = true; // + // pictureBox12 + // + this.pictureBox12.BackColor = System.Drawing.Color.Transparent; + this.pictureBox12.Image = global::HKCardManager.Properties.Resources.xiaohu; + this.pictureBox12.Location = new System.Drawing.Point(20, 210); + this.pictureBox12.Name = "pictureBox12"; + this.pictureBox12.Size = new System.Drawing.Size(20, 20); + this.pictureBox12.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox12.TabIndex = 9; + this.pictureBox12.TabStop = false; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); @@ -581,6 +612,7 @@ ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); this.splitContainer2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox12)).EndInit(); this.ResumeLayout(false); } @@ -620,5 +652,7 @@ private DataGridView dataGridView1; private DataGridViewTextBoxColumn 图标; private DataGridViewTextBoxColumn 消息文本; + private Button button13; + private PictureBox pictureBox12; } } \ No newline at end of file diff --git a/HKCardManager/Form1.cs b/HKCardManager/Form1.cs index 31fb79c..4414b9c 100644 --- a/HKCardManager/Form1.cs +++ b/HKCardManager/Form1.cs @@ -1,4 +1,8 @@ using HKCardManager.UserPages; +using HKLib.Dto; +using HKLib.Interfaces; +using HKLib.SQLHelper; +using System.Text.RegularExpressions; using HKHelper; using UHFHelper; using UHFHelper; @@ -10,6 +14,7 @@ namespace HKCardManager public Form1() { InitializeComponent(); + DbContext.InitTable(); splitContainer1.SplitterDistance = 240; DataGridViewInit(); ShowPage(new PersonnelEntryPage()); @@ -291,6 +296,25 @@ namespace HKCardManager { ShowPage(new AdvertisingSetPage()); } + + private void button13_Click(object sender, EventArgs e) + { + if (UHFCardHelper.GetInstance().ComOpen) + { + var res = UHFCardHelper.GetInstance().ReadCard(); + if (string.IsNullOrEmpty(res)) + { + MessageLogNotify.GetInstance.Show("뿨Ƭ"); + return; + } + UHFCardHelper.GetInstance().WriteCard("0"); + MessageBox.Show("ɹ"); + } + else + { + MessageLogNotify.GetInstance.ShowWarning("豸δ"); + } + } } diff --git a/HKCardManager/Form1.resx b/HKCardManager/Form1.resx index 1338f61..9876a5b 100644 --- a/HKCardManager/Form1.resx +++ b/HKCardManager/Form1.resx @@ -63,4 +63,10 @@ True + + True + + + True + \ No newline at end of file diff --git a/HKCardManager/Models/UserInfoModel.cs b/HKCardManager/Models/UserInfoModel.cs index f4f27fc..457201d 100644 --- a/HKCardManager/Models/UserInfoModel.cs +++ b/HKCardManager/Models/UserInfoModel.cs @@ -8,6 +8,7 @@ namespace HKCardManager { public class UserInfoModel { + public string Num { get; set; } public string UserName { get; set; } public string State { get; set; } diff --git a/HKCardManager/UserPages/MealSegmentSetPage.Designer.cs b/HKCardManager/UserPages/MealSegmentSetPage.Designer.cs index 77449c0..236d583 100644 --- a/HKCardManager/UserPages/MealSegmentSetPage.Designer.cs +++ b/HKCardManager/UserPages/MealSegmentSetPage.Designer.cs @@ -45,6 +45,12 @@ this.label2 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); + this.label7 = new System.Windows.Forms.Label(); + this.label8 = new System.Windows.Forms.Label(); + this.label9 = new System.Windows.Forms.Label(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.textBox2 = new System.Windows.Forms.TextBox(); + this.textBox3 = new System.Windows.Forms.TextBox(); this.groupBox3.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox1.SuspendLayout(); @@ -64,6 +70,8 @@ // // groupBox3 // + this.groupBox3.Controls.Add(this.textBox3); + this.groupBox3.Controls.Add(this.label9); this.groupBox3.Controls.Add(this.dateTimePicker6); this.groupBox3.Controls.Add(this.dateTimePicker3); this.groupBox3.Controls.Add(this.label5); @@ -71,7 +79,7 @@ this.groupBox3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.groupBox3.Location = new System.Drawing.Point(16, 169); this.groupBox3.Name = "groupBox3"; - this.groupBox3.Size = new System.Drawing.Size(499, 61); + this.groupBox3.Size = new System.Drawing.Size(793, 61); this.groupBox3.TabIndex = 10; this.groupBox3.TabStop = false; this.groupBox3.Text = "晚上"; @@ -114,6 +122,8 @@ // // groupBox2 // + this.groupBox2.Controls.Add(this.textBox2); + this.groupBox2.Controls.Add(this.label8); this.groupBox2.Controls.Add(this.dateTimePicker5); this.groupBox2.Controls.Add(this.dateTimePicker2); this.groupBox2.Controls.Add(this.label3); @@ -121,7 +131,7 @@ this.groupBox2.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.groupBox2.Location = new System.Drawing.Point(16, 89); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(499, 61); + this.groupBox2.Size = new System.Drawing.Size(793, 61); this.groupBox2.TabIndex = 9; this.groupBox2.TabStop = false; this.groupBox2.Text = "中午"; @@ -164,6 +174,8 @@ // // groupBox1 // + this.groupBox1.Controls.Add(this.textBox1); + this.groupBox1.Controls.Add(this.label7); this.groupBox1.Controls.Add(this.dateTimePicker4); this.groupBox1.Controls.Add(this.dateTimePicker1); this.groupBox1.Controls.Add(this.label2); @@ -171,7 +183,7 @@ this.groupBox1.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.groupBox1.Location = new System.Drawing.Point(16, 12); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(499, 61); + this.groupBox1.Size = new System.Drawing.Size(793, 61); this.groupBox1.TabIndex = 8; this.groupBox1.TabStop = false; this.groupBox1.Text = "早上"; @@ -220,16 +232,64 @@ this.panel1.Controls.Add(this.groupBox3); this.panel1.Location = new System.Drawing.Point(23, 13); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(526, 293); + this.panel1.Size = new System.Drawing.Size(823, 293); this.panel1.TabIndex = 13; // + // label7 + // + this.label7.AutoSize = true; + this.label7.Location = new System.Drawing.Point(517, 28); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(74, 21); + this.label7.TabIndex = 7; + this.label7.Text = "金额设置"; + // + // label8 + // + this.label8.AutoSize = true; + this.label8.Location = new System.Drawing.Point(517, 30); + this.label8.Name = "label8"; + this.label8.Size = new System.Drawing.Size(74, 21); + this.label8.TabIndex = 8; + this.label8.Text = "金额设置"; + // + // label9 + // + this.label9.AutoSize = true; + this.label9.Location = new System.Drawing.Point(517, 30); + this.label9.Name = "label9"; + this.label9.Size = new System.Drawing.Size(74, 21); + this.label9.TabIndex = 9; + this.label9.Text = "金额设置"; + // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(597, 24); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(153, 28); + this.textBox1.TabIndex = 8; + // + // textBox2 + // + this.textBox2.Location = new System.Drawing.Point(597, 25); + this.textBox2.Name = "textBox2"; + this.textBox2.Size = new System.Drawing.Size(153, 28); + this.textBox2.TabIndex = 9; + // + // textBox3 + // + this.textBox3.Location = new System.Drawing.Point(597, 24); + this.textBox3.Name = "textBox3"; + this.textBox3.Size = new System.Drawing.Size(153, 28); + this.textBox3.TabIndex = 10; + // // MealSegmentSetPage // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.panel1); this.Name = "MealSegmentSetPage"; - this.Size = new System.Drawing.Size(565, 337); + this.Size = new System.Drawing.Size(919, 337); this.groupBox3.ResumeLayout(false); this.groupBox3.PerformLayout(); this.groupBox2.ResumeLayout(false); @@ -259,5 +319,11 @@ private Label label2; private Label label1; private Panel panel1; + private TextBox textBox3; + private Label label9; + private TextBox textBox2; + private Label label8; + private TextBox textBox1; + private Label label7; } } diff --git a/HKCardManager/UserPages/MealSegmentSetPage.cs b/HKCardManager/UserPages/MealSegmentSetPage.cs index e03358e..9360503 100644 --- a/HKCardManager/UserPages/MealSegmentSetPage.cs +++ b/HKCardManager/UserPages/MealSegmentSetPage.cs @@ -1,5 +1,6 @@ using HKLib.Dto; using HKLib.Interfaces; +using HKLib.SQLHelper; using System; using System.Collections.Generic; using System.ComponentModel; @@ -9,6 +10,8 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using XExten.Advance.LinqFramework; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace HKCardManager.UserPages { @@ -24,6 +27,7 @@ namespace HKCardManager.UserPages private async void Init() { var res = await HKLibHelper.GetTime(); + var price = SqlLogic.GetPrice(); if (res != null) { this.Invoke(() => @@ -34,6 +38,9 @@ namespace HKCardManager.UserPages dateTimePicker5.Value = res.PMEndTime; dateTimePicker3.Value = res.ATStartTime; dateTimePicker6.Value = res.ATEndTime; + textBox1.Text = price?.AM.ToString(); + textBox2.Text = price?.PM.ToString(); + textBox3.Text = price?.AT.ToString(); }); } else MessageLogNotify.GetInstance.ShowError("获取餐段时间失败!"); @@ -47,6 +54,15 @@ namespace HKCardManager.UserPages private async void button1_Click(object sender, EventArgs e) { + decimal.TryParse(textBox1.Text.Trim(), out decimal am); + decimal.TryParse(textBox2.Text.Trim(), out decimal pm); + decimal.TryParse(textBox3.Text.Trim(), out decimal at); + if (am == 0 || pm == 0 || at == 0) + { + MessageBox.Show("请输入正确的金额"); + return; + } + var data = new TimeSpilte() { AMStartTime = dateTimePicker1.Value, @@ -56,11 +72,17 @@ namespace HKCardManager.UserPages ATStartTime = dateTimePicker3.Value, ATEndTime = dateTimePicker6.Value }; - //Task.Factory.StartNew(() => - //{ + this.Invoke(() => { button1.Enabled = false; }); if (await HKLibHelper.SetTime(data)) { + + SqlLogic.AddPrice(new HKLib.SQLHelper.Entity.PriceModel + { + AM = textBox1.Text.Trim().AsDecimal(), + PM = textBox2.Text.Trim().AsDecimal(), + AT = textBox3.Text.Trim().AsDecimal() + }); this.Invoke(() => { dateTimePicker1.Value = data.AMStartTime; @@ -77,7 +99,7 @@ namespace HKCardManager.UserPages MessageLogNotify.GetInstance.ShowError("设置时间段失败,请重试!"); } this.Invoke(() => { button1.Enabled = true; }); - //}); + } } } diff --git a/HKCardManager/UserPages/PersonnelEntryPage.Designer.cs b/HKCardManager/UserPages/PersonnelEntryPage.Designer.cs index cbd72c3..894ebf8 100644 --- a/HKCardManager/UserPages/PersonnelEntryPage.Designer.cs +++ b/HKCardManager/UserPages/PersonnelEntryPage.Designer.cs @@ -168,6 +168,7 @@ this.dataGridView1.BackgroundColor = System.Drawing.SystemColors.Control; this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.编号, this.名称, this.卡状态, this.机构, @@ -395,12 +396,10 @@ // // label_down // - this.label_down.AutoSize = true; - this.label_down.Location = new System.Drawing.Point(208, 18); - this.label_down.Name = "label_down"; - this.label_down.Size = new System.Drawing.Size(44, 17); - this.label_down.TabIndex = 3; - this.label_down.Text = "下一页"; + this.编号.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.编号.DataPropertyName = "Num"; + this.编号.HeaderText = "编号"; + this.编号.Name = "编号"; // // label_end // @@ -439,12 +438,6 @@ private Label label1; private SplitContainer splitContainer1; private DataGridView dataGridView1; - private DataGridViewTextBoxColumn 名称; - private DataGridViewTextBoxColumn 卡状态; - private DataGridViewTextBoxColumn 机构; - private DataGridViewTextBoxColumn 手机号; - private DataGridViewTextBoxColumn 卡号; - private DataGridViewButtonColumn 删除; private Label label_count; private Button button_go; private TextBox textBox_num; diff --git a/HKCardManager/UserPages/PersonnelEntryPage.cs b/HKCardManager/UserPages/PersonnelEntryPage.cs index 5ebafb7..2b2dd49 100644 --- a/HKCardManager/UserPages/PersonnelEntryPage.cs +++ b/HKCardManager/UserPages/PersonnelEntryPage.cs @@ -69,6 +69,7 @@ namespace HKCardManager.UserPages } Global.UserListDtos.Add(new UserInfoModel() { + Num=item.Num, UserName = item.Name, Phone = item.Phone, OrgName = item.OrgInfo?.Count > 0 ? item.OrgInfo.ElementAt(0).Name : "", @@ -139,6 +140,7 @@ namespace HKCardManager.UserPages //} UserDto userDto = new UserDto() { + Num = await HKLibHelper.GetUserMaxNum(), Name = textBox1.Text.Trim(), //Phone = textBox2.Text.Trim(), OrgId = Global.OrgTables.FirstOrDefault(p => p.Name == comboBox2.Text)?.SId diff --git a/HKCardManager/UserPages/PersonnelEntryPage.resx b/HKCardManager/UserPages/PersonnelEntryPage.resx index 0c1d704..5e6c1a5 100644 --- a/HKCardManager/UserPages/PersonnelEntryPage.resx +++ b/HKCardManager/UserPages/PersonnelEntryPage.resx @@ -57,6 +57,9 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + True + True diff --git a/HKCardManager/UserPages/ReportFormPage.Designer.cs b/HKCardManager/UserPages/ReportFormPage.Designer.cs index 231dec8..47babb2 100644 --- a/HKCardManager/UserPages/ReportFormPage.Designer.cs +++ b/HKCardManager/UserPages/ReportFormPage.Designer.cs @@ -41,9 +41,13 @@ this.时间 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.机构 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.早上消费次数 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.早上消费金额 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.中午消费次数 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.中午消费金额 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.晚上消费次数 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.晚上消费金额 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.总计消费次数 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.金额总计 = new System.Windows.Forms.DataGridViewTextBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); @@ -61,9 +65,13 @@ this.时间, this.机构, this.早上消费次数, + this.早上消费金额, this.中午消费次数, + this.中午消费金额, this.晚上消费次数, - this.总计消费次数}); + this.晚上消费金额, + this.总计消费次数, + this.金额总计}); this.dataGridView1.Dock = System.Windows.Forms.DockStyle.Fill; this.dataGridView1.Location = new System.Drawing.Point(0, 0); this.dataGridView1.Name = "dataGridView1"; @@ -163,6 +171,7 @@ // // 手机 // + this.手机.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.手机.DataPropertyName = "Phone"; this.手机.HeaderText = "手机"; this.手机.Name = "手机"; @@ -171,6 +180,7 @@ // // 时间 // + this.时间.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.时间.DataPropertyName = "Date"; this.时间.HeaderText = "时间"; this.时间.Name = "时间"; @@ -178,6 +188,7 @@ // // 机构 // + this.机构.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.机构.DataPropertyName = "Tag"; this.机构.HeaderText = "机构"; this.机构.Name = "机构"; @@ -185,27 +196,48 @@ // // 早上消费次数 // + this.早上消费次数.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.早上消费次数.DataPropertyName = "AMCount"; this.早上消费次数.HeaderText = "早上消费次数"; this.早上消费次数.Name = "早上消费次数"; this.早上消费次数.ReadOnly = true; - this.早上消费次数.Width = 110; + // + // 早上消费金额 + // + this.早上消费金额.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.早上消费金额.DataPropertyName = "AM"; + this.早上消费金额.HeaderText = "早上消费金额"; + this.早上消费金额.Name = "早上消费金额"; // // 中午消费次数 // + this.中午消费次数.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.中午消费次数.DataPropertyName = "PMCount"; this.中午消费次数.HeaderText = "中午消费次数"; this.中午消费次数.Name = "中午消费次数"; this.中午消费次数.ReadOnly = true; - this.中午消费次数.Width = 110; + // + // 中午消费金额 + // + this.中午消费金额.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.中午消费金额.DataPropertyName = "PM"; + this.中午消费金额.HeaderText = "中午消费金额"; + this.中午消费金额.Name = "中午消费金额"; // // 晚上消费次数 // + this.晚上消费次数.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; this.晚上消费次数.DataPropertyName = "ATCount"; this.晚上消费次数.HeaderText = "晚上消费次数"; this.晚上消费次数.Name = "晚上消费次数"; this.晚上消费次数.ReadOnly = true; - this.晚上消费次数.Width = 110; + // + // 晚上消费金额 + // + this.晚上消费金额.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.晚上消费金额.DataPropertyName = "AT"; + this.晚上消费金额.HeaderText = "晚上消费金额"; + this.晚上消费金额.Name = "晚上消费金额"; // // 总计消费次数 // @@ -215,6 +247,13 @@ this.总计消费次数.Name = "总计消费次数"; this.总计消费次数.ReadOnly = true; // + // 金额总计 + // + this.金额总计.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; + this.金额总计.DataPropertyName = "Total"; + this.金额总计.HeaderText = "金额总计"; + this.金额总计.Name = "金额总计"; + // // ReportFormPage // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); @@ -246,8 +285,12 @@ private DataGridViewTextBoxColumn 时间; private DataGridViewTextBoxColumn 机构; private DataGridViewTextBoxColumn 早上消费次数; + private DataGridViewTextBoxColumn 早上消费金额; private DataGridViewTextBoxColumn 中午消费次数; + private DataGridViewTextBoxColumn 中午消费金额; private DataGridViewTextBoxColumn 晚上消费次数; + private DataGridViewTextBoxColumn 晚上消费金额; private DataGridViewTextBoxColumn 总计消费次数; + private DataGridViewTextBoxColumn 金额总计; } } diff --git a/HKCardManager/UserPages/ReportFormPage.cs b/HKCardManager/UserPages/ReportFormPage.cs index 2a02fee..25ff191 100644 --- a/HKCardManager/UserPages/ReportFormPage.cs +++ b/HKCardManager/UserPages/ReportFormPage.cs @@ -1,5 +1,6 @@ using HKLib.Dto; using HKLib.Interfaces; +using HKLib.SQLHelper; using System; using System.Collections.Generic; using System.ComponentModel; @@ -123,6 +124,19 @@ namespace HKCardManager.UserPages if (res.Count > 0) { reportCountDtos = res; + + var price = SqlLogic.GetPrice(); + + foreach (var item in reportCountDtos) + { + item.AM = price.AM * item.AMCount; + item.PM = item.PMCount >= 20?75:price.PM * item.PMCount; + item.AT = price.AT * item.ATCount; + item.Total = item.AM + item.PM + item.AT; + } + + + this.Invoke(() => { if (type == 1) diff --git a/HKCardManager/UserPages/ReportFormPage.resx b/HKCardManager/UserPages/ReportFormPage.resx index c664d74..e0581f2 100644 --- a/HKCardManager/UserPages/ReportFormPage.resx +++ b/HKCardManager/UserPages/ReportFormPage.resx @@ -72,13 +72,25 @@ True + + True + True + + True + True + + True + True + + True + \ No newline at end of file diff --git a/HKCardManager/options.json b/HKCardManager/options.json index 7a80712..9ea7866 100644 --- a/HKCardManager/options.json +++ b/HKCardManager/options.json @@ -1,6 +1,6 @@ { //此配置为测试环境配置 - "SaasRoute": "https://bpa.black-pa.com:21528/kitchen/", + "SaasRoute":"http://192.168.1.43:5000/", //"https://bpa.black-pa.com:21528/kitchen/", //加盟商Id "TenantId": "78d635f7-8ee4-4be4-b26a-462016196826", //测试环境广告地址 diff --git a/HKCardOUT/HKCardOUT.csproj b/HKCardOUT/HKCardOUT.csproj index a3b017c..fea55d1 100644 --- a/HKCardOUT/HKCardOUT.csproj +++ b/HKCardOUT/HKCardOUT.csproj @@ -40,7 +40,7 @@ - + diff --git a/HKLib/Dto/ReportCountDto.cs b/HKLib/Dto/ReportCountDto.cs index 7afc818..58866c7 100644 --- a/HKLib/Dto/ReportCountDto.cs +++ b/HKLib/Dto/ReportCountDto.cs @@ -45,5 +45,10 @@ namespace HKLib.Dto /// 总计 /// public int TotalCount { get; set; } + + public decimal AM { get; set; } + public decimal PM { get; set; } + public decimal AT { get; set; } + public decimal Total { get; set; } } } diff --git a/HKLib/Dto/UserDto.cs b/HKLib/Dto/UserDto.cs index 2ecde26..b183315 100644 --- a/HKLib/Dto/UserDto.cs +++ b/HKLib/Dto/UserDto.cs @@ -7,6 +7,7 @@ namespace HKLib.Dto { public class UserDto { + public String Num { get; set; } /// /// 机构 /// @@ -26,6 +27,8 @@ namespace HKLib.Dto } public class UserListDto { + [JsonProperty("num")] + public string Num { get; set; } [JsonProperty("realName")] public string Name { get; set; } /// diff --git a/HKLib/HKLib.csproj b/HKLib/HKLib.csproj index cddb581..697c67b 100644 --- a/HKLib/HKLib.csproj +++ b/HKLib/HKLib.csproj @@ -7,6 +7,7 @@ + diff --git a/HKLib/Interfaces/HKLibHelper.cs b/HKLib/Interfaces/HKLibHelper.cs index 4847ba4..87ed5c4 100644 --- a/HKLib/Interfaces/HKLibHelper.cs +++ b/HKLib/Interfaces/HKLibHelper.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using XExten.Advance.HttpFramework.MultiCommon; using XExten.Advance.HttpFramework.MultiFactory; using XExten.Advance.LinqFramework; +using static RabbitMQ.Client.Logging.RabbitMqClientEventSource; namespace HKLib.Interfaces { @@ -133,6 +134,20 @@ namespace HKLib.Interfaces return data.ToModel()["data"]["isSuccess"].ToString().AsBool(); } + public static async Task GetUserMaxNum() + { + var data = await IHttpMultiClient.HttpMulti.AddHeader(t => t.Headers = Header).AddNode(t => + { + t.NodePath = $"{Configer.SaasRoute}api/one-card/max-num"; + t.ReqType = MultiType.GET; + }).Build().RunStringFirstAsync(); + var str = data.ToModel()["data"]["data"].ToString(); + var check = str.IsNullOrEmpty(); + if (check) return "0001"; + return (str.AsInt() + 1).ToString().PadLeft(4, '0'); + } + + /// /// 根据用户命获取下拉用户列表 /// @@ -190,7 +205,7 @@ namespace HKLib.Interfaces { t.NodePath = $"{Configer.SaasRoute}api/one-card/staff"; t.ReqType = MultiType.POST; - t.JsonParam = (new { tagId = input.OrgId, realName = input.Name, phone = input.Phone }).ToJson(); + t.JsonParam = (new { tagId = input.OrgId, realName = input.Name, phone = input.Phone,num=input.Num }).ToJson(); }).Build().RunStringFirstAsync(); return data.ToModel()["data"]["isSuccess"].ToString().AsBool(); } diff --git a/HKLib/SQLHelper/BaseEntity.cs b/HKLib/SQLHelper/BaseEntity.cs new file mode 100644 index 0000000..c12bbac --- /dev/null +++ b/HKLib/SQLHelper/BaseEntity.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace HKLib.SQLHelper +{ + public class BaseEntity + { + [SqlSugar.SugarColumn(IsPrimaryKey =true,IsIdentity =true)] + public int Id { get; set; } + } +} diff --git a/HKLib/SQLHelper/DbContext.cs b/HKLib/SQLHelper/DbContext.cs new file mode 100644 index 0000000..ef10ddb --- /dev/null +++ b/HKLib/SQLHelper/DbContext.cs @@ -0,0 +1,32 @@ +using SqlSugar; +using System; +using System.IO; +using System.Linq; +using System.Reflection; +using XExten.Advance.StaticFramework; + +namespace HKLib.SQLHelper +{ + public class DbContext + { + public static SqlSugarScope Context = new SqlSugarScope(new ConnectionConfig() + { + ConnectionString = $"DataSource={SyncStatic.CreateFile(Path.Combine(SyncStatic.CreateDir(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "DATA")), "data.db3"))}",//连接符字串 + DbType = DbType.Sqlite,//数据库类型 + IsAutoCloseConnection = true //不设成true要手动close + }, db => + { + db.Aop.OnLogExecuting = (sql, pars) => + { + + }; + }); + + public static void InitTable() + { + var Tables = Assembly.GetAssembly(typeof(DbContext)) + .GetTypes().Where(t => t.BaseType == typeof(BaseEntity)).ToArray(); + Context.CodeFirst.InitTables(Tables); + } + } +} diff --git a/HKLib/SQLHelper/Entity/PriceModel.cs b/HKLib/SQLHelper/Entity/PriceModel.cs new file mode 100644 index 0000000..4251156 --- /dev/null +++ b/HKLib/SQLHelper/Entity/PriceModel.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace HKLib.SQLHelper.Entity +{ + public class PriceModel: BaseEntity + { + public decimal AM { get; set; } + public decimal PM { get; set; } + public decimal AT { get; set; } + } +} diff --git a/HKLib/SQLHelper/SqlLogic.cs b/HKLib/SQLHelper/SqlLogic.cs new file mode 100644 index 0000000..b698256 --- /dev/null +++ b/HKLib/SQLHelper/SqlLogic.cs @@ -0,0 +1,20 @@ +using HKLib.SQLHelper.Entity; +using System; +using System.Collections.Generic; +using System.Text; + +namespace HKLib.SQLHelper +{ + public class SqlLogic + { + public static PriceModel GetPrice() + { + return DbContext.Context.Queryable().First(); + } + public static PriceModel AddPrice(PriceModel input) + { + DbContext.Context.Deleteable().Where(t => t.Id != 0).ExecuteCommand(); + return DbContext.Context.Insertable(input).ExecuteReturnEntity(); + } + } +}