change - 更改为sqlite - 未完成

master
wangsr 12 months ago
parent 958e2c3796
commit 54c5582067

@ -3,10 +3,12 @@ using HighWayIot.Log4net;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Net.Mime.MediaTypeNames;
namespace HighWayIot.Repository
{
@ -17,16 +19,18 @@ namespace HighWayIot.Repository
private static JsonChange jsonChange = JsonChange.Instance;
#region 连接字符串
/**
* Sqlite:debug
* private static string sqliteConnStr = $"Data Source={Path.GetFullPath("data\\data.db")};Version=3";
*/
//private static string sqliteConnStr = "Data Source=Z:\\Desktop\\日常代码\\HighWayIot\\HighWayIot\\bin\\Debug\\data\\data.db;Version=3";
public static string SQLitePath = Path.Combine(Environment.CurrentDirectory, "sqlite.db");
public static string sqliteConnStr = "DataSource=" + SQLitePath;
/**
* Mysql
*/
private static string mysqlConnStr = "Data Source=127.0.0.1;Port=3306;Initial Catalog=rfid;uid=root;pwd=123456;Charset=utf8mb4;SslMode=none";
//private static string sqliteConnStr = ConfigurationManager.ConnectionStrings["connStr"].ConnectionString;
//private static string oracleConnStr = "Data Source=175.27.215.92/helowin;User ID=aucma_mes;Password=aucma";
#endregion
@ -38,41 +42,41 @@ namespace HighWayIot.Repository
public static SqlSugarScope Db = new SqlSugarScope(
// new List<ConnectionConfig>()
//{
//new ConnectionConfig()
//{
// ConfigId = "sqlite",
// ConnectionString = sqliteConnStr,
// DbType = DbType.Sqlite,
// InitKeyType = InitKeyType.Attribute,
// IsAutoCloseConnection = true
//},
new ConnectionConfig()
{
ConfigId = "mysql",
ConnectionString = mysqlConnStr,
DbType = DbType.MySql,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true
},
//},
//new ConnectionConfig()
//{
// ConfigId = "aucma_mes",
// ConnectionString = oracleConnStr,
// DbType = DbType.Oracle,
// InitKeyType = InitKeyType.Attribute,
// IsAutoCloseConnection = true
//}
new ConnectionConfig()
{
ConfigId = "sqlite",
ConnectionString = sqliteConnStr,
DbType = DbType.Sqlite,
InitKeyType = InitKeyType.Attribute,
IsAutoCloseConnection = true
},
//new ConnectionConfig()
//{
// ConfigId = "mysql",
// ConnectionString = mysqlConnStr,
// DbType = DbType.MySql,
// InitKeyType = InitKeyType.Attribute,
// IsAutoCloseConnection = true
//},
db =>
{
//(A)全局生效配置点
//调试SQL事件可以删掉
db.Aop.OnLogExecuting = (sql, pars) =>
{
logHelper.SqlLog($"{sql};参数:{jsonChange.ModeToJson(pars)}");
};
});
//},
//new ConnectionConfig()
//{
// ConfigId = "aucma_mes",
// ConnectionString = oracleConnStr,
// DbType = DbType.Oracle,
// InitKeyType = InitKeyType.Attribute,
// IsAutoCloseConnection = true
//}
//},
db =>
{
//(A)全局生效配置点
//调试SQL事件可以删掉
//db.Aop.OnLogExecuting = (sql, pars) =>
//{
// logHelper.SqlLog($"{sql};参数:{jsonChange.ModeToJson(pars)}");
//};
});
}
}

@ -1,5 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<!--<connectionStrings>
<add name="connStr" connectionString="Data Source=127.0.0.1;Port=3306;Initial Catalog=rfid;uid=root;pwd=123456;Charset=utf8mb4;SslMode=none"/>
</connectionStrings>-->
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>

@ -12,7 +12,7 @@ namespace HighWayIot.Repository.service.Impl
public class BaseContentServiceImpl : IContentService
{
private LogHelper log = LogHelper.Instance;
Repository<RFIDContent> _repository => new Repository<RFIDContent>("mysql");
Repository<RFIDContent> _repository => new Repository<RFIDContent>("sqlite");
public List<RFIDContent> GetContentInfos()
{

@ -12,7 +12,7 @@ namespace HighWayIot.Repository.service.Impl
public class BaseHeartbeatServiceImpl : IHeartbeatService
{
private LogHelper log = LogHelper.Instance;
Repository<RFIDHeartbeat> _repository => new Repository<RFIDHeartbeat>("mysql");
Repository<RFIDHeartbeat> _repository => new Repository<RFIDHeartbeat>("sqlite");
public List<RFIDHeartbeat> GetHeartbeatInfos()
{

@ -12,7 +12,7 @@ namespace HighWayIot.Repository.service.Impl
public class BaseStateServiceImpl : IStateService
{
private LogHelper log = LogHelper.Instance;
Repository<RFIDState> _repository => new Repository<RFIDState>("mysql");
Repository<RFIDState> _repository => new Repository<RFIDState>("sqlite");
public List<RFIDState> GetStateInfos()
{

@ -3,6 +3,9 @@
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
<connectionStrings>
<add name="connStr" connectionString="Data Source=127.0.0.1;Port=3306;Initial Catalog=rfid;uid=root;pwd=123456;Charset=utf8mb4;SslMode=none"/>
</connectionStrings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>

@ -28,44 +28,42 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.CotentData = new System.Windows.Forms.DataGridView();
this.deviceNoDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.readKindDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.contentDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.logTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.rFIDContentBindingSource = new System.Windows.Forms.BindingSource();
this.IPText = new System.Windows.Forms.TextBox();
this.SetAddress = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.PortText = new System.Windows.Forms.TextBox();
this.MonitorOnOff = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.MonitorState = new System.Windows.Forms.Label();
this.TableTimer = new System.Windows.Forms.Timer(this.components);
this.TableTimer = new System.Windows.Forms.Timer();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.StateData = new System.Windows.Forms.DataGridView();
this.deviceNoDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.LogTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.rFIDStateBindingSource = new System.Windows.Forms.BindingSource();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.HeartbeatData = new System.Windows.Forms.DataGridView();
this.deviceNoDataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.timeSpanDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.rFIDHeartbeatBindingSource = new System.Windows.Forms.BindingSource();
this.PgUp = new System.Windows.Forms.Button();
this.PgDn = new System.Windows.Forms.Button();
this.PageRange = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.LogStart = new System.Windows.Forms.Button();
this.deviceNoDataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.timeSpanDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.rFIDHeartbeatBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.deviceNoDataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.rFIDStateBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.rFIDContentBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.deviceNoDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.readKindDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.contentDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.logTimeDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
((System.ComponentModel.ISupportInitialize)(this.CotentData)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).BeginInit();
this.groupBox2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.StateData)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDStateBindingSource)).BeginInit();
this.groupBox3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.HeartbeatData)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDHeartbeatBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDStateBindingSource)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).BeginInit();
this.SuspendLayout();
//
// CotentData
@ -78,63 +76,87 @@
this.contentDataGridViewTextBoxColumn,
this.logTimeDataGridViewTextBoxColumn});
this.CotentData.DataSource = this.rFIDContentBindingSource;
this.CotentData.Location = new System.Drawing.Point(9, 103);
this.CotentData.Margin = new System.Windows.Forms.Padding(2);
this.CotentData.Location = new System.Drawing.Point(12, 129);
this.CotentData.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.CotentData.Name = "CotentData";
this.CotentData.RowHeadersVisible = false;
this.CotentData.RowHeadersWidth = 51;
this.CotentData.RowTemplate.Height = 17;
this.CotentData.ScrollBars = System.Windows.Forms.ScrollBars.None;
this.CotentData.Size = new System.Drawing.Size(486, 870);
this.CotentData.Size = new System.Drawing.Size(648, 1088);
this.CotentData.TabIndex = 0;
//
// deviceNoDataGridViewTextBoxColumn
//
this.deviceNoDataGridViewTextBoxColumn.DataPropertyName = "DeviceNo";
this.deviceNoDataGridViewTextBoxColumn.HeaderText = "编号";
this.deviceNoDataGridViewTextBoxColumn.MinimumWidth = 6;
this.deviceNoDataGridViewTextBoxColumn.Name = "deviceNoDataGridViewTextBoxColumn";
this.deviceNoDataGridViewTextBoxColumn.Width = 40;
//
// readKindDataGridViewTextBoxColumn
//
this.readKindDataGridViewTextBoxColumn.DataPropertyName = "ReadKind";
this.readKindDataGridViewTextBoxColumn.HeaderText = "读码结果";
this.readKindDataGridViewTextBoxColumn.MinimumWidth = 6;
this.readKindDataGridViewTextBoxColumn.Name = "readKindDataGridViewTextBoxColumn";
this.readKindDataGridViewTextBoxColumn.Width = 60;
//
// contentDataGridViewTextBoxColumn
//
this.contentDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.contentDataGridViewTextBoxColumn.DataPropertyName = "Content";
this.contentDataGridViewTextBoxColumn.HeaderText = "条码内容";
this.contentDataGridViewTextBoxColumn.MinimumWidth = 6;
this.contentDataGridViewTextBoxColumn.Name = "contentDataGridViewTextBoxColumn";
//
// logTimeDataGridViewTextBoxColumn
//
this.logTimeDataGridViewTextBoxColumn.DataPropertyName = "LogTime";
this.logTimeDataGridViewTextBoxColumn.HeaderText = "读取时间";
this.logTimeDataGridViewTextBoxColumn.MinimumWidth = 6;
this.logTimeDataGridViewTextBoxColumn.Name = "logTimeDataGridViewTextBoxColumn";
this.logTimeDataGridViewTextBoxColumn.Width = 105;
//
// rFIDContentBindingSource
//
this.rFIDContentBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDContent);
//
// IPText
//
this.IPText.Location = new System.Drawing.Point(116, 23);
this.IPText.Margin = new System.Windows.Forms.Padding(2);
this.IPText.Location = new System.Drawing.Point(155, 29);
this.IPText.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.IPText.MaxLength = 6;
this.IPText.Name = "IPText";
this.IPText.Size = new System.Drawing.Size(98, 21);
this.IPText.Size = new System.Drawing.Size(129, 25);
this.IPText.TabIndex = 7;
this.IPText.Text = "127.0.0.1";
//
// SetAddress
//
this.SetAddress.Location = new System.Drawing.Point(267, 10);
this.SetAddress.Margin = new System.Windows.Forms.Padding(2);
this.SetAddress.Name = "SetAddress";
this.SetAddress.Size = new System.Drawing.Size(120, 45);
this.SetAddress.TabIndex = 6;
this.SetAddress.Text = "确认服务端地址";
this.SetAddress.UseVisualStyleBackColor = true;
this.SetAddress.Click += new System.EventHandler(this.SetPort_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(11, 27);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Location = new System.Drawing.Point(15, 34);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(101, 12);
this.label1.Size = new System.Drawing.Size(128, 15);
this.label1.TabIndex = 1;
this.label1.Text = "服务端IP端口号";
//
// PortText
//
this.PortText.Location = new System.Drawing.Point(218, 23);
this.PortText.Margin = new System.Windows.Forms.Padding(2);
this.PortText.Location = new System.Drawing.Point(291, 29);
this.PortText.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.PortText.MaxLength = 6;
this.PortText.Name = "PortText";
this.PortText.Size = new System.Drawing.Size(45, 21);
this.PortText.Size = new System.Drawing.Size(59, 25);
this.PortText.TabIndex = 0;
this.PortText.Text = "1234";
//
// MonitorOnOff
//
this.MonitorOnOff.Location = new System.Drawing.Point(391, 11);
this.MonitorOnOff.Margin = new System.Windows.Forms.Padding(2);
this.MonitorOnOff.Location = new System.Drawing.Point(440, 14);
this.MonitorOnOff.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.MonitorOnOff.Name = "MonitorOnOff";
this.MonitorOnOff.Size = new System.Drawing.Size(110, 45);
this.MonitorOnOff.Size = new System.Drawing.Size(147, 56);
this.MonitorOnOff.TabIndex = 7;
this.MonitorOnOff.Text = "启动监听";
this.MonitorOnOff.UseVisualStyleBackColor = true;
@ -143,10 +165,9 @@
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(505, 27);
this.label4.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label4.Location = new System.Drawing.Point(592, 34);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(65, 12);
this.label4.Size = new System.Drawing.Size(82, 15);
this.label4.TabIndex = 8;
this.label4.Text = "监听状态:";
//
@ -154,10 +175,9 @@
//
this.MonitorState.AutoSize = true;
this.MonitorState.BackColor = System.Drawing.Color.Transparent;
this.MonitorState.Location = new System.Drawing.Point(574, 27);
this.MonitorState.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.MonitorState.Location = new System.Drawing.Point(684, 34);
this.MonitorState.Name = "MonitorState";
this.MonitorState.Size = new System.Drawing.Size(17, 12);
this.MonitorState.Size = new System.Drawing.Size(22, 15);
this.MonitorState.TabIndex = 9;
this.MonitorState.Text = "关";
//
@ -169,11 +189,11 @@
// groupBox2
//
this.groupBox2.Controls.Add(this.StateData);
this.groupBox2.Location = new System.Drawing.Point(499, 59);
this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
this.groupBox2.Location = new System.Drawing.Point(665, 74);
this.groupBox2.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
this.groupBox2.Size = new System.Drawing.Size(186, 449);
this.groupBox2.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox2.Size = new System.Drawing.Size(248, 561);
this.groupBox2.TabIndex = 11;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "工作状态故障";
@ -186,15 +206,23 @@
this.deviceNoDataGridViewTextBoxColumn1,
this.LogTime});
this.StateData.DataSource = this.rFIDStateBindingSource;
this.StateData.Location = new System.Drawing.Point(4, 19);
this.StateData.Margin = new System.Windows.Forms.Padding(2);
this.StateData.Location = new System.Drawing.Point(5, 24);
this.StateData.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.StateData.Name = "StateData";
this.StateData.RowHeadersVisible = false;
this.StateData.RowHeadersWidth = 51;
this.StateData.RowTemplate.Height = 20;
this.StateData.Size = new System.Drawing.Size(177, 425);
this.StateData.Size = new System.Drawing.Size(236, 531);
this.StateData.TabIndex = 0;
//
// deviceNoDataGridViewTextBoxColumn1
//
this.deviceNoDataGridViewTextBoxColumn1.DataPropertyName = "DeviceNo";
this.deviceNoDataGridViewTextBoxColumn1.HeaderText = "编号";
this.deviceNoDataGridViewTextBoxColumn1.MinimumWidth = 6;
this.deviceNoDataGridViewTextBoxColumn1.Name = "deviceNoDataGridViewTextBoxColumn1";
this.deviceNoDataGridViewTextBoxColumn1.Width = 60;
//
// LogTime
//
this.LogTime.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
@ -203,14 +231,18 @@
this.LogTime.MinimumWidth = 6;
this.LogTime.Name = "LogTime";
//
// rFIDStateBindingSource
//
this.rFIDStateBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDState);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.HeartbeatData);
this.groupBox3.Location = new System.Drawing.Point(499, 512);
this.groupBox3.Margin = new System.Windows.Forms.Padding(2);
this.groupBox3.Location = new System.Drawing.Point(665, 640);
this.groupBox3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Padding = new System.Windows.Forms.Padding(2);
this.groupBox3.Size = new System.Drawing.Size(186, 461);
this.groupBox3.Padding = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.groupBox3.Size = new System.Drawing.Size(248, 576);
this.groupBox3.TabIndex = 12;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "连接故障";
@ -223,22 +255,42 @@
this.deviceNoDataGridViewTextBoxColumn2,
this.timeSpanDataGridViewTextBoxColumn});
this.HeartbeatData.DataSource = this.rFIDHeartbeatBindingSource;
this.HeartbeatData.Location = new System.Drawing.Point(4, 19);
this.HeartbeatData.Margin = new System.Windows.Forms.Padding(2);
this.HeartbeatData.Location = new System.Drawing.Point(5, 24);
this.HeartbeatData.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.HeartbeatData.Name = "HeartbeatData";
this.HeartbeatData.RowHeadersVisible = false;
this.HeartbeatData.RowHeadersWidth = 51;
this.HeartbeatData.RowTemplate.Height = 20;
this.HeartbeatData.ScrollBars = System.Windows.Forms.ScrollBars.None;
this.HeartbeatData.Size = new System.Drawing.Size(177, 437);
this.HeartbeatData.Size = new System.Drawing.Size(236, 546);
this.HeartbeatData.TabIndex = 0;
//
// deviceNoDataGridViewTextBoxColumn2
//
this.deviceNoDataGridViewTextBoxColumn2.DataPropertyName = "DeviceNo";
this.deviceNoDataGridViewTextBoxColumn2.HeaderText = "编号";
this.deviceNoDataGridViewTextBoxColumn2.MinimumWidth = 6;
this.deviceNoDataGridViewTextBoxColumn2.Name = "deviceNoDataGridViewTextBoxColumn2";
this.deviceNoDataGridViewTextBoxColumn2.Width = 60;
//
// timeSpanDataGridViewTextBoxColumn
//
this.timeSpanDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.timeSpanDataGridViewTextBoxColumn.DataPropertyName = "TimeSpan";
this.timeSpanDataGridViewTextBoxColumn.HeaderText = "距上一次心跳时间";
this.timeSpanDataGridViewTextBoxColumn.MinimumWidth = 6;
this.timeSpanDataGridViewTextBoxColumn.Name = "timeSpanDataGridViewTextBoxColumn";
//
// rFIDHeartbeatBindingSource
//
this.rFIDHeartbeatBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDHeartbeat);
//
// PgUp
//
this.PgUp.Location = new System.Drawing.Point(9, 59);
this.PgUp.Margin = new System.Windows.Forms.Padding(2);
this.PgUp.Location = new System.Drawing.Point(12, 74);
this.PgUp.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.PgUp.Name = "PgUp";
this.PgUp.Size = new System.Drawing.Size(101, 40);
this.PgUp.Size = new System.Drawing.Size(135, 50);
this.PgUp.TabIndex = 8;
this.PgUp.Text = "上一页";
this.PgUp.UseVisualStyleBackColor = true;
@ -246,10 +298,10 @@
//
// PgDn
//
this.PgDn.Location = new System.Drawing.Point(394, 59);
this.PgDn.Margin = new System.Windows.Forms.Padding(2);
this.PgDn.Location = new System.Drawing.Point(525, 74);
this.PgDn.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.PgDn.Name = "PgDn";
this.PgDn.Size = new System.Drawing.Size(101, 40);
this.PgDn.Size = new System.Drawing.Size(135, 50);
this.PgDn.TabIndex = 13;
this.PgDn.Text = "下一页";
this.PgDn.UseVisualStyleBackColor = true;
@ -260,10 +312,9 @@
this.PageRange.AutoSize = true;
this.PageRange.BackColor = System.Drawing.Color.Transparent;
this.PageRange.Font = new System.Drawing.Font("宋体", 12F);
this.PageRange.Location = new System.Drawing.Point(255, 69);
this.PageRange.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.PageRange.Location = new System.Drawing.Point(340, 86);
this.PageRange.Name = "PageRange";
this.PageRange.Size = new System.Drawing.Size(55, 16);
this.PageRange.Size = new System.Drawing.Size(69, 20);
this.PageRange.TabIndex = 15;
this.PageRange.Text = "1 - 50";
//
@ -271,103 +322,33 @@
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("宋体", 12F);
this.label3.Location = new System.Drawing.Point(186, 69);
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label3.Location = new System.Drawing.Point(248, 86);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(87, 16);
this.label3.Size = new System.Drawing.Size(109, 20);
this.label3.TabIndex = 14;
this.label3.Text = "显示条数:";
//
// LogStart
//
this.LogStart.Location = new System.Drawing.Point(595, 11);
this.LogStart.Margin = new System.Windows.Forms.Padding(2);
this.LogStart.Location = new System.Drawing.Point(793, 14);
this.LogStart.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.LogStart.Name = "LogStart";
this.LogStart.Size = new System.Drawing.Size(85, 45);
this.LogStart.Size = new System.Drawing.Size(113, 56);
this.LogStart.TabIndex = 16;
this.LogStart.Text = "日志查询";
this.LogStart.UseVisualStyleBackColor = true;
this.LogStart.Click += new System.EventHandler(this.LogStart_Click);
//
// deviceNoDataGridViewTextBoxColumn2
//
this.deviceNoDataGridViewTextBoxColumn2.DataPropertyName = "DeviceNo";
this.deviceNoDataGridViewTextBoxColumn2.HeaderText = "编号";
this.deviceNoDataGridViewTextBoxColumn2.MinimumWidth = 6;
this.deviceNoDataGridViewTextBoxColumn2.Name = "deviceNoDataGridViewTextBoxColumn2";
this.deviceNoDataGridViewTextBoxColumn2.Width = 60;
//
// timeSpanDataGridViewTextBoxColumn
//
this.timeSpanDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.timeSpanDataGridViewTextBoxColumn.DataPropertyName = "TimeSpan";
this.timeSpanDataGridViewTextBoxColumn.HeaderText = "距上一次心跳时间";
this.timeSpanDataGridViewTextBoxColumn.MinimumWidth = 6;
this.timeSpanDataGridViewTextBoxColumn.Name = "timeSpanDataGridViewTextBoxColumn";
//
// rFIDHeartbeatBindingSource
//
this.rFIDHeartbeatBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDHeartbeat);
//
// deviceNoDataGridViewTextBoxColumn1
//
this.deviceNoDataGridViewTextBoxColumn1.DataPropertyName = "DeviceNo";
this.deviceNoDataGridViewTextBoxColumn1.HeaderText = "编号";
this.deviceNoDataGridViewTextBoxColumn1.MinimumWidth = 6;
this.deviceNoDataGridViewTextBoxColumn1.Name = "deviceNoDataGridViewTextBoxColumn1";
this.deviceNoDataGridViewTextBoxColumn1.Width = 60;
//
// rFIDStateBindingSource
//
this.rFIDStateBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDState);
//
// rFIDContentBindingSource
//
this.rFIDContentBindingSource.DataSource = typeof(HighWayIot.Repository.domain.RFIDContent);
//
// deviceNoDataGridViewTextBoxColumn
//
this.deviceNoDataGridViewTextBoxColumn.DataPropertyName = "DeviceNo";
this.deviceNoDataGridViewTextBoxColumn.HeaderText = "编号";
this.deviceNoDataGridViewTextBoxColumn.MinimumWidth = 6;
this.deviceNoDataGridViewTextBoxColumn.Name = "deviceNoDataGridViewTextBoxColumn";
this.deviceNoDataGridViewTextBoxColumn.Width = 40;
//
// readKindDataGridViewTextBoxColumn
//
this.readKindDataGridViewTextBoxColumn.DataPropertyName = "ReadKind";
this.readKindDataGridViewTextBoxColumn.HeaderText = "读码结果";
this.readKindDataGridViewTextBoxColumn.MinimumWidth = 6;
this.readKindDataGridViewTextBoxColumn.Name = "readKindDataGridViewTextBoxColumn";
this.readKindDataGridViewTextBoxColumn.Width = 60;
//
// contentDataGridViewTextBoxColumn
//
this.contentDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill;
this.contentDataGridViewTextBoxColumn.DataPropertyName = "Content";
this.contentDataGridViewTextBoxColumn.HeaderText = "条码内容";
this.contentDataGridViewTextBoxColumn.MinimumWidth = 6;
this.contentDataGridViewTextBoxColumn.Name = "contentDataGridViewTextBoxColumn";
//
// logTimeDataGridViewTextBoxColumn
//
this.logTimeDataGridViewTextBoxColumn.DataPropertyName = "LogTime";
this.logTimeDataGridViewTextBoxColumn.HeaderText = "读取时间";
this.logTimeDataGridViewTextBoxColumn.MinimumWidth = 6;
this.logTimeDataGridViewTextBoxColumn.Name = "logTimeDataGridViewTextBoxColumn";
this.logTimeDataGridViewTextBoxColumn.Width = 105;
//
// RFIDSocket
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(695, 983);
this.ClientSize = new System.Drawing.Size(927, 1229);
this.Controls.Add(this.LogStart);
this.Controls.Add(this.PageRange);
this.Controls.Add(this.label3);
this.Controls.Add(this.IPText);
this.Controls.Add(this.PgDn);
this.Controls.Add(this.SetAddress);
this.Controls.Add(this.label1);
this.Controls.Add(this.PgUp);
this.Controls.Add(this.PortText);
@ -377,18 +358,18 @@
this.Controls.Add(this.label4);
this.Controls.Add(this.MonitorOnOff);
this.Controls.Add(this.CotentData);
this.Margin = new System.Windows.Forms.Padding(2);
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.Name = "RFIDSocket";
this.Text = " 小件监听";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.RFIDSocket_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.CotentData)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).EndInit();
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.StateData)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDStateBindingSource)).EndInit();
this.groupBox3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.HeartbeatData)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDHeartbeatBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDStateBindingSource)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.rFIDContentBindingSource)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -397,7 +378,6 @@
#endregion
private System.Windows.Forms.DataGridView CotentData;
private System.Windows.Forms.Button SetAddress;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox PortText;
private System.Windows.Forms.Button MonitorOnOff;

@ -20,10 +20,6 @@ namespace RFIDSocket
private static DataAnalysis RFIDData = DataAnalysis.Instance;
string Port = "1234";
string IP = "127.0.0.1";
int PageNo = 1;
public RFIDSocket()
@ -44,10 +40,6 @@ namespace RFIDSocket
MonitorState.Text = "开";
MonitorState.BackColor = Color.LightGreen;
}
Port = PortText.Text;
IP = IPText.Text;
}
@ -55,7 +47,7 @@ namespace RFIDSocket
{
if (Server.State != ServerState.Running)
{
if (Server.ServerStart(IP, Port))
if (Server.ServerStart(IPText.Text, PortText.Text))
{
MessageBox.Show("监听服务启动成功!");
TableTimer.Enabled = true;
@ -79,12 +71,6 @@ namespace RFIDSocket
}
}
private void SetPort_Click(object sender, EventArgs e)
{
Port = PortText.Text;
IP = IPText.Text;
}
private void TableTimer_Tick(object sender, EventArgs e)
{
if (Server.State != ServerState.Running)

@ -129,16 +129,7 @@
<metadata name="rFIDStateBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>413, 17</value>
</metadata>
<metadata name="LogTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="rFIDHeartbeatBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>646, 17</value>
</metadata>
<metadata name="rFIDHeartbeatBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>646, 17</value>
</metadata>
<metadata name="rFIDStateBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>413, 17</value>
</metadata>
</root>

@ -0,0 +1,70 @@
/*
Navicat Premium Data Transfer
Source Server : root
Source Server Type : MySQL
Source Server Version : 80035
Source Host : localhost:3306
Source Schema : rfid
Target Server Type : MySQL
Target Server Version : 80035
File Encoding : 65001
Date: 15/01/2024 15:26:43
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for rfid_content
-- ----------------------------
DROP TABLE IF EXISTS `rfid_content`;
CREATE TABLE `rfid_content` (
`id` int NOT NULL AUTO_INCREMENT,
`readkind` varchar(2) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`deviceno` int NULL DEFAULT NULL,
`content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
`logtime` datetime NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 133 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for rfid_heartbeat
-- ----------------------------
DROP TABLE IF EXISTS `rfid_heartbeat`;
CREATE TABLE `rfid_heartbeat` (
`id` int NOT NULL AUTO_INCREMENT,
`deviceno` int NULL DEFAULT NULL,
`beattime` datetime NULL DEFAULT NULL,
`timespan` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Table structure for rfid_state
-- ----------------------------
DROP TABLE IF EXISTS `rfid_state`;
CREATE TABLE `rfid_state` (
`id` int NOT NULL AUTO_INCREMENT,
`deviceno` int NULL DEFAULT NULL,
`devicestate` bit(1) NULL DEFAULT NULL,
`logtime` datetime NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 42 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci ROW_FORMAT = Dynamic;
-- ----------------------------
-- Event structure for 90daysdata
-- ----------------------------
DROP EVENT IF EXISTS `90daysdata`;
delimiter ;;
CREATE EVENT `90daysdata`
ON SCHEDULE
EVERY '1' DAY STARTS '2024-01-15 15:13:51'
ON COMPLETION PRESERVE
DO DELETE FROM rfid_content WHERE logtime < DATE_SUB(NOW(),INTERVAL 90 DAY)
;;
delimiter ;
SET FOREIGN_KEY_CHECKS = 1;
Loading…
Cancel
Save