Browse Source

一卡通

Lishi
xxe 2 years ago
parent
commit
13928f5f5f
16 changed files with 329 additions and 24 deletions
  1. +45
    -11
      HKCardManager/Form1.Designer.cs
  2. +24
    -0
      HKCardManager/Form1.cs
  3. +6
    -0
      HKCardManager/Form1.resx
  4. +71
    -5
      HKCardManager/UserPages/MealSegmentSetPage.Designer.cs
  5. +25
    -3
      HKCardManager/UserPages/MealSegmentSetPage.cs
  6. +47
    -4
      HKCardManager/UserPages/ReportFormPage.Designer.cs
  7. +14
    -0
      HKCardManager/UserPages/ReportFormPage.cs
  8. +12
    -0
      HKCardManager/UserPages/ReportFormPage.resx
  9. +1
    -1
      HKCardOUT/HKCardOUT.csproj
  10. +1
    -0
      HKLib/Configer.cs
  11. +5
    -0
      HKLib/Dto/ReportCountDto.cs
  12. +1
    -0
      HKLib/HKLib.csproj
  13. +12
    -0
      HKLib/SQLHelper/BaseEntity.cs
  14. +32
    -0
      HKLib/SQLHelper/DbContext.cs
  15. +13
    -0
      HKLib/SQLHelper/Entity/PriceModel.cs
  16. +20
    -0
      HKLib/SQLHelper/SqlLogic.cs

+ 45
- 11
HKCardManager/Form1.Designer.cs View File

@@ -28,8 +28,8 @@
/// </summary>
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;
}
}

+ 24
- 0
HKCardManager/Form1.cs View File

@@ -1,4 +1,8 @@
using HKCardManager.UserPages;
using HKLib.Dto;
using HKLib.Interfaces;
using HKLib.SQLHelper;
using System.Text.RegularExpressions;
using UHFHelper;

namespace HKCardManager
@@ -8,6 +12,7 @@ namespace HKCardManager
public Form1()
{
InitializeComponent();
DbContext.InitTable();
splitContainer1.SplitterDistance = 240;
DataGridViewInit();
ShowPage(new PersonnelEntryPage());
@@ -289,5 +294,24 @@ 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("设备未连接");
}
}
}
}

+ 6
- 0
HKCardManager/Form1.resx View File

@@ -63,4 +63,10 @@
<metadata name="消息文本.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="图标.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="消息文本.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

+ 71
- 5
HKCardManager/UserPages/MealSegmentSetPage.Designer.cs View File

@@ -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;
}
}

+ 25
- 3
HKCardManager/UserPages/MealSegmentSetPage.cs View File

@@ -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; });
//});
}
}
}

+ 47
- 4
HKCardManager/UserPages/ReportFormPage.Designer.cs View File

@@ -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 金额总计;
}
}

+ 14
- 0
HKCardManager/UserPages/ReportFormPage.cs View File

@@ -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)


+ 12
- 0
HKCardManager/UserPages/ReportFormPage.resx View File

@@ -72,13 +72,25 @@
<metadata name="早上消费次数.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="早上消费金额.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="中午消费次数.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="中午消费金额.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="晚上消费次数.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="晚上消费金额.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="总计消费次数.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="金额总计.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

+ 1
- 1
HKCardOUT/HKCardOUT.csproj View File

@@ -40,7 +40,7 @@
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.1343.22" />
<PackageReference Include="Quartz" Version="3.4.0" />
<PackageReference Include="Stylet" Version="1.3.6" />
<PackageReference Include="SqlSugarCore" Version="5.1.2.7" />
<PackageReference Include="SqlSugarCore" Version="5.1.3.27" />
<PackageReference Include="XExten.Advance" Version="1.2.4.2-preview" />
</ItemGroup>
<ItemGroup>


+ 1
- 0
HKLib/Configer.cs View File

@@ -10,5 +10,6 @@ namespace HKLib
public static string SaasRoute { get; set; }
public static string TenantId { get; set; }
public static string AdRoute { get; set; }
public static string Admin { get; set; }
}
}

+ 5
- 0
HKLib/Dto/ReportCountDto.cs View File

@@ -45,5 +45,10 @@ namespace HKLib.Dto
/// 总计
/// </summary>
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; }
}
}

+ 1
- 0
HKLib/HKLib.csproj View File

@@ -7,6 +7,7 @@
<PackageReference Include="EasyNetQ" Version="6.5.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Snowflake.Core" Version="2.0.0" />
<PackageReference Include="SqlSugarCore" Version="5.1.3.27" />
<PackageReference Include="XExten.Advance" Version="1.2.4.2-preview" />
</ItemGroup>
</Project>

+ 12
- 0
HKLib/SQLHelper/BaseEntity.cs View File

@@ -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; }
}
}

+ 32
- 0
HKLib/SQLHelper/DbContext.cs View File

@@ -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);
}
}
}

+ 13
- 0
HKLib/SQLHelper/Entity/PriceModel.cs View File

@@ -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; }
}
}

+ 20
- 0
HKLib/SQLHelper/SqlLogic.cs View File

@@ -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<PriceModel>().First();
}
public static PriceModel AddPrice(PriceModel input)
{
DbContext.Context.Deleteable<PriceModel>().Where(t => t.Id != 0).ExecuteCommand();
return DbContext.Context.Insertable(input).ExecuteReturnEntity();
}
}
}

Loading…
Cancel
Save