簡單的C# RFID標簽系統(tǒng)PPT內容:
0.jpg (42 KB, 下載次數(shù): 63)
下載附件
2018-9-26 17:25 上傳
0.png (43.04 KB, 下載次數(shù): 80)
下載附件
2018-9-26 17:26 上傳
首先要將需要定位監(jiān)控的物資上面安裝一張半有源RFID的低頻激活電子標簽該標簽具有唯一的編碼,并給具有合法拿取物品的管理人員登記和發(fā)放一個電子標簽卡,用于標識管理人員的身份,然后將物資放置在雙頻報警主機有效監(jiān)控范圍內的指定位置上,并建立起物資與存放位置之間的對應關系。系統(tǒng)工作時,雙頻報警主機內的低頻觸發(fā)激活器連續(xù)不斷發(fā)射低頻激活信號,激活貴重物品上的電子標簽,電子標簽把信號再發(fā)射出去,有效識別范圍內的讀寫器將收到該標簽同頻段發(fā)射的數(shù)據(jù)包,解析出該數(shù)據(jù)包中的標簽ID號和激活器編號以及RSSI值后立刻上傳到上位機電腦。當貴重物品上的標簽被移出2m外,激活器發(fā)射的信號不能激活標簽,相對應讀寫器也讀取不了標簽信息,聲光報警裝置進行報警。同時,在倉庫不同的地方,安裝一些有源RFID遠距離讀寫器,用于采集低頻激活電子標簽被激活后發(fā)出的信息(包括電子標簽本身的ID號,低頻激活天線的地址碼),讀寫器采集到數(shù)據(jù)后,通過各種傳輸方式,將信息上傳給電腦管理中心。以便及時發(fā)現(xiàn)異常和采取措施。
0.png (28.25 KB, 下載次數(shù): 69)
下載附件
2018-9-26 17:26 上傳
遇到的問題和需要討論的問題
在解決報警問題上,不知道怎樣處理。當激活器發(fā)射的信號不能激活標簽,相對應讀寫器也讀取不了標簽信息,聲光報警裝置進行報警。所以就設定當取值為空時報警器報警。
由于條件限制,讀卡距離較近,還不能很好的起到實時防盜的作用。但實驗表明,此設計的電路運行穩(wěn)定,讀寫數(shù)據(jù)準確,操作時間較短,在理論上是完全可以實現(xiàn)的。
0.png (33.95 KB, 下載次數(shù): 60)
下載附件
2018-9-26 17:27 上傳
1、管理人員可以根據(jù)用戶名和密碼登錄超市防盜系統(tǒng)
2、讀寫器采集到數(shù)據(jù)后,將信息上傳給電腦管理中心。管理人員可以知道這箱貨物的名字、生產地、生廠商編號、數(shù)量和生產日期等基本信息,并寫入數(shù)據(jù)庫中。
3、當激活器發(fā)射的信號不能激活標簽,不能正常顯示出信息。相對應讀寫器也讀取不了標簽信息,聲光報警裝置進行報警。
0.png (23.32 KB, 下載次數(shù): 68)
下載附件
2018-9-26 17:28 上傳
c#源程序如下:
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Data.SqlClient;
- namespace RFID
- {
- public partial class DataConveyForm : Form
- {
-
- public DataConveyForm()
- {
- InitializeComponent();
- }
- /*****************屏蔽窗體右上角關閉按鈕******************/
- private const int CP_NOCLOSE_BUTTON = 0x200;
- protected override CreateParams CreateParams
- {
- get
- {
- CreateParams myCp = base.CreateParams;
- myCp.ClassStyle = myCp.ClassStyle | CP_NOCLOSE_BUTTON;
- return myCp;
- }
- }
- /*************************************************************/
- /******************退出數(shù)據(jù)傳送窗口,返回到監(jiān)控窗口****************************/
- private void button3_Click(object sender, EventArgs e)
- {
- serialPort1.Close();
- MonitoringForm monitoringform = new MonitoringForm();
- this.Close();
- monitoringform.Show();
- }
- private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
- {
- switch(comboBox2.SelectedIndex )
- {
- case 0:
- comboBox2.Items.Clear();
- comboBox2.Items.Add("甘肅");
- comboBox2.Items.Add("遼寧");
- comboBox2.Items.Add("陜西");
- comboBox2.Items.Add("湖南");
- comboBox2.Items.Add("北京");
- break;
- }
- }
- /***********************************************************************************************/
- /******************************將學生信息插入到數(shù)據(jù)庫中***************************************************/
-
-
-
- /*private void button1_Click(object sender, EventArgs e)
- {
- if (textBox1.Text.Length == 0 | comboBox2.Text.Length == 0 | textBox3.Text.Length == 0 | textBox4.Text.Length == 0 | textBox5.Text.Length == 0 | textBox6.Text.Length == 0|comboBox2.Text.Length ==0|comboBox2.Text.Length ==0)
- {
- MessageBox.Show("學生信息輸入不完整,請檢查準確輸入");
- return;
- }
- string sqlCheck = "SELECT count ( * ) FROM [StudentMsg] WHERE StudentId='" +textBox5.Text.ToString().Trim() + "'";
- SqlConnection conn = new SqlConnection(connstring);
- SqlCommand cmdCheck = new SqlCommand(sqlCheck, conn);
- int checkCount = 0;
- try
- {
- conn.Open();
- checkCount = (int)cmdCheck.ExecuteScalar();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- if (checkCount > 0)
- {
- conn.Close();
- MessageBox.Show("此學號在后臺數(shù)據(jù)庫中已經存在,學號不能重復,請重新輸入,注意只能輸入數(shù)字");
- return;
- }
- string dept = comboBox2.SelectedItem.ToString(); //學院
- string spec = comboBox2.SelectedItem.ToString(); //專業(yè)
- string sql = String.Format("INSERT INTO StudentMsg(Department,StudentId,Name,Sex,Grade,DormitoryId,Speciality,ObjectId,HostId)VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}')", dept, textBox5.Text, textBox1.Text, sex, comboBox2.Text, textBox6.Text, spec, textBox3.Text, textBox4.Text);
- using (SqlConnection conn1 = new SqlConnection(connstring))
- {
- conn.Close();
- conn1.Open();
- SqlCommand comm = new SqlCommand(sql, conn1);
- int n = comm.ExecuteNonQuery();
- if (n > 0)
- {
- MessageBox.Show("添加學生信息成功!", "添加成功", MessageBoxButtons.OK, MessageBoxIcon.Information);
- conn1.Close();
- this.textBox1.Text = "";
- this.comboBox2.Text = "";
- this.textBox3.Text = "";
- this.textBox4.Text = "";
- this.textBox6.Text = "";
- }
- else
- {
- MessageBox.Show("添加學生信息失敗!", "添加失敗", MessageBoxButtons.OK, MessageBoxIcon.Information);
- conn1.Close();
- }
- }
- }/*
- /********************************************************************************************************/
- /*********************************************當前顯示*************************************/
- private void DataConveyForm_Load(object sender, EventArgs e)
- {
- try
- {
- comboBox2.SelectedIndex = 0;
- comboBox2.SelectedIndex = 0;
- serialPort1.Open();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "串口設置操作出錯!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- }
- }
- /************************************************************************************************/
- /**********************************獲取物品標簽號***********************************************/
- private void button4_Click(object sender, EventArgs e)
- {
- string temp;
- string data;
- string data1;
- try
- {
- serialPort1.WriteLine("010900210200040000");
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "串口設置操作出錯!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return;
- }
- temp = serialPort1.ReadLine();
- System.Threading.Thread.Sleep(1000);
- try
- {
- serialPort1.WriteLine("010900210200040000");
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "串口設置操作出錯!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return;
- }
- data = serialPort1.ReadLine();
- if (data [0]=='[')
- {
- data1 = data.Substring(4, 4) + data.Substring(9, 4) + data.Substring(14, 4) + data.Substring(19, 4);
- textBox3.Text = data1;
- }
- else
- {
- MessageBox.Show("獲取物品標簽號失敗,請注意檢查!", "獲取物品標簽失敗", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- }
- }
- /***************************************************************************************/
- /*********************************獲取主人標簽號*********************************************/
- private void button5_Click(object sender, EventArgs e)
- {
- string temp;
- string data;
- string data1;
- try
- {
- serialPort1.WriteLine("010900210200040000");
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "串口設置操作出錯!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return;
- }
- temp = serialPort1.ReadLine();
- System.Threading.Thread.Sleep(1000);
- try
- {
- serialPort1.WriteLine("010900210200040000");
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message, "串口設置操作出錯!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- return;
- }
- data = serialPort1.ReadLine();
- if (data[0] == '[')
- {
- data1 = data.Substring(4, 4) + data.Substring(9, 4) + data.Substring(14, 4) + data.Substring(19, 4);
- textBox4.Text = data1;
- }
- else
- {
- MessageBox.Show("獲取主人標簽號失敗,請注意檢查!", "獲取主人標簽失敗", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
- }
- }
- private DataSet dsUser;
- private void button1_Click(object sender, EventArgs e)
- {
- string connstring = @"Data Source=210.26.96.51;Initial Catalog=BC;User ID=sa;Pwd=95069506";
- if (dsUser == null)
- {
- MessageBox.Show("當前頁面數(shù)據(jù)表空,請先刷新顯示全部數(shù)據(jù),然后進行操作。");
- return;
- }
- if (textBox1.Text.Length == 0)
- {
- MessageBox.Show("商品名稱不能為空,請輸入準確的廠商名稱!");
- return;
- }
- if (comboBox2.Text.Length == 0)
- {
- MessageBox.Show("生產地不能為空,請輸入準確的運輸商名稱!");
- return;
- }
- if (textBox6.Text.Length == 0)
- {
- MessageBox.Show("系統(tǒng)銷售商名稱不能為空,請輸入準確的銷售商名稱!");
- return;
- }
- if (numericUpDown1.Text.Length == 0)
- {
- MessageBox.Show("訂單日期名稱不能為空,請輸入準確的銷售商名稱!");
- return;
- }
- if (dateTimePicker1.Text.Length == 0)
- {
- MessageBox.Show("訂單數(shù)量不能為空,請輸入準確的銷售商名稱!");
- return;
- }
- string sqlCheck = "SELECT count ( * ) FROM [Store] WHERE ProName='" + textBox1.Text.ToString().Trim() + "'";
- SqlConnection conn = new SqlConnection(connstring);
- SqlCommand cmdCheck = new SqlCommand(sqlCheck, conn);
- int checkCount = 0;
- try
- {
- conn.Open();
- checkCount = (int)cmdCheck.ExecuteScalar();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- sqlCheck = "INSERT INTO [Store] VALUES ('" + textBox1.Text.ToString().Trim() + "','" + comboBox2.Text.ToString().Trim() + "','" + textBox6.Text.ToString().Trim() + "','" + numericUpDown1.Text.ToString().Trim() + "','" + dateTimePicker1.Text.ToString().Trim() + "')";
- try
- {
- cmdCheck = new SqlCommand(sqlCheck, conn);
- cmdCheck.ExecuteNonQuery();
- }
- catch (Exception ex)
- {
- conn.Close();
- MessageBox.Show(ex.Message);
- return;
- }
- sqlCheck = "SELECT '商品名'=ProName,'生產地'=Production,'生產商編號'=ProId,'購買數(shù)量'=Number,'生產日期'=DataName FROM [Store]";
- try
- {
- SqlDataAdapter da = new SqlDataAdapter();
- da.SelectCommand = new SqlCommand(sqlCheck, conn);
- dsUser = new DataSet("Store");
- da.Fill(dsUser, "Store");
- this.dataGridViewIndex.DataSource = dsUser.Tables["Store"];
- this.dataGridViewIndex.Refresh();
- this.dataGridViewIndex.Show();
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- finally
- {
- conn.Close();
- }
- this.textBox1.Text = "";
- this.comboBox2.Text = "";
- this.textBox6.Text = "";
- this.numericUpDown1.Text = "";
- this.dateTimePicker1.Text = "";
- MessageBox.Show("數(shù)據(jù)新增完畢!");
- }
- private int selectRows = -1;
- private string tmpProName = "";
- private string tmpProduction = "";
- private string tmpProId = "";
- private string tmpNumber = "";
- private string tmpDataName = "";
- private void dataGridViewIndex_CellContentClick(object sender, DataGridViewCellEventArgs e)
- {
- this.selectRows = dataGridViewIndex.CurrentRow.Index;
- this.textBox1.Text = dsUser.Tables["Store"].Rows[selectRows][0].ToString();
- this.comboBox2.Text = dsUser.Tables["Store"].Rows[selectRows][1].ToString();
- this.textBox6.Text = dsUser.Tables["Store"].Rows[selectRows][2].ToString();
- this.numericUpDown1.Text = dsUser.Tables["Store"].Rows[selectRows][3].ToString();
- this.dateTimePicker1.Text= dsUser.Tables["Store"].Rows[selectRows][4].ToString();
- this.tmpProName = dsUser.Tables["Store"].Rows[selectRows][0].ToString();
- this.tmpProduction = dsUser.Tables["Store"].Rows[selectRows][1].ToString();
- this.tmpProId = dsUser.Tables["Store"].Rows[selectRows][2].ToString();
- this.tmpNumber = dsUser.Tables["Store"].Rows[selectRows][3].ToString();
- this.tmpDataName = dsUser.Tables["Store"].Rows[selectRows][4].ToString();
-
- }
- /**********************************************顯示*************************************************************/
- ……………………
- …………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼
0.png (43.77 KB, 下載次數(shù): 75)
下載附件
2018-9-26 17:29 上傳
0.png (12.39 KB, 下載次數(shù): 70)
下載附件
2018-9-26 17:29 上傳
所有資料51hei提供下載:
便利超市的防盜系統(tǒng).rar
(9.95 MB, 下載次數(shù): 107)
2018-9-26 15:12 上傳
點擊文件名下載附件
用C# 做的 下載積分: 黑幣 -5
|