浏览代码

修改实时考勤

章政 7 年之前
父节点
当前提交
2d24191968
共有 4 个文件被更改,包括 98 次插入26 次删除
  1. 69 21
      UAS_CheckWork/Form2.Designer.cs
  2. 19 4
      UAS_CheckWork/Form2.cs
  3. 1 1
      UAS_CheckWork/Program.cs
  4. 9 0
      UAS_CheckWork/UAS_CheckWork.csproj

+ 69 - 21
UAS_CheckWork/Form2.Designer.cs

@@ -36,6 +36,11 @@
             this.btnConnect = new System.Windows.Forms.Button();
             this.btnConnect = new System.Windows.Forms.Button();
             this.startListening = new System.Windows.Forms.Button();
             this.startListening = new System.Windows.Forms.Button();
             this.logInfo = new System.Windows.Forms.DataGridView();
             this.logInfo = new System.Windows.Forms.DataGridView();
+            this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.dataGridViewTextBoxColumn3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.dataGridViewTextBoxColumn4 = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.dataGridViewTextBoxColumn5 = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.UserID = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.UserID = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.AttState = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.AttState = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.VerifyMethod = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.VerifyMethod = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -48,9 +53,10 @@
             // 
             // 
             this.lblState.AutoSize = true;
             this.lblState.AutoSize = true;
             this.lblState.ForeColor = System.Drawing.Color.Crimson;
             this.lblState.ForeColor = System.Drawing.Color.Crimson;
-            this.lblState.Location = new System.Drawing.Point(540, 35);
+            this.lblState.Location = new System.Drawing.Point(360, 23);
+            this.lblState.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.lblState.Name = "lblState";
             this.lblState.Name = "lblState";
-            this.lblState.Size = new System.Drawing.Size(107, 18);
+            this.lblState.Size = new System.Drawing.Size(71, 12);
             this.lblState.TabIndex = 21;
             this.lblState.TabIndex = 21;
             this.lblState.Text = "状态:未连接";
             this.lblState.Text = "状态:未连接";
             // 
             // 
@@ -58,9 +64,10 @@
             // 
             // 
             this.label2.AutoSize = true;
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(252, 28);
+            this.label2.Location = new System.Drawing.Point(168, 19);
+            this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label2.Name = "label2";
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(62, 31);
+            this.label2.Size = new System.Drawing.Size(42, 21);
             this.label2.TabIndex = 20;
             this.label2.TabIndex = 20;
             this.label2.Text = "Port";
             this.label2.Text = "Port";
             // 
             // 
@@ -68,37 +75,38 @@
             // 
             // 
             this.label1.AutoSize = true;
             this.label1.AutoSize = true;
             this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(38, 26);
+            this.label1.Location = new System.Drawing.Point(25, 17);
+            this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.label1.Name = "label1";
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(36, 31);
+            this.label1.Size = new System.Drawing.Size(25, 21);
             this.label1.TabIndex = 19;
             this.label1.TabIndex = 19;
             this.label1.Text = "IP";
             this.label1.Text = "IP";
             // 
             // 
             // txtPort
             // txtPort
             // 
             // 
-            this.txtPort.Location = new System.Drawing.Point(324, 28);
-            this.txtPort.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.txtPort.Location = new System.Drawing.Point(216, 19);
+            this.txtPort.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.txtPort.Name = "txtPort";
             this.txtPort.Name = "txtPort";
-            this.txtPort.Size = new System.Drawing.Size(54, 28);
+            this.txtPort.Size = new System.Drawing.Size(37, 21);
             this.txtPort.TabIndex = 18;
             this.txtPort.TabIndex = 18;
             this.txtPort.Text = "4370";
             this.txtPort.Text = "4370";
             // 
             // 
             // txtIP
             // txtIP
             // 
             // 
-            this.txtIP.Location = new System.Drawing.Point(89, 28);
-            this.txtIP.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.txtIP.Location = new System.Drawing.Point(59, 19);
+            this.txtIP.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.txtIP.Name = "txtIP";
             this.txtIP.Name = "txtIP";
-            this.txtIP.Size = new System.Drawing.Size(146, 28);
+            this.txtIP.Size = new System.Drawing.Size(99, 21);
             this.txtIP.TabIndex = 17;
             this.txtIP.TabIndex = 17;
             this.txtIP.Text = "192.168.253.201";
             this.txtIP.Text = "192.168.253.201";
             // 
             // 
             // btnConnect
             // btnConnect
             // 
             // 
             this.btnConnect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.btnConnect.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.btnConnect.Location = new System.Drawing.Point(420, 24);
-            this.btnConnect.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
+            this.btnConnect.Location = new System.Drawing.Point(280, 16);
+            this.btnConnect.Margin = new System.Windows.Forms.Padding(2, 1, 2, 1);
             this.btnConnect.Name = "btnConnect";
             this.btnConnect.Name = "btnConnect";
-            this.btnConnect.Size = new System.Drawing.Size(75, 38);
+            this.btnConnect.Size = new System.Drawing.Size(50, 25);
             this.btnConnect.TabIndex = 16;
             this.btnConnect.TabIndex = 16;
             this.btnConnect.Text = "连接";
             this.btnConnect.Text = "连接";
             this.btnConnect.UseVisualStyleBackColor = true;
             this.btnConnect.UseVisualStyleBackColor = true;
@@ -107,9 +115,10 @@
             // startListening
             // startListening
             // 
             // 
             this.startListening.BackColor = System.Drawing.SystemColors.ControlLightLight;
             this.startListening.BackColor = System.Drawing.SystemColors.ControlLightLight;
-            this.startListening.Location = new System.Drawing.Point(677, 27);
+            this.startListening.Location = new System.Drawing.Point(451, 18);
+            this.startListening.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.startListening.Name = "startListening";
             this.startListening.Name = "startListening";
-            this.startListening.Size = new System.Drawing.Size(127, 36);
+            this.startListening.Size = new System.Drawing.Size(85, 24);
             this.startListening.TabIndex = 22;
             this.startListening.TabIndex = 22;
             this.startListening.Text = "开始实时事件";
             this.startListening.Text = "开始实时事件";
             this.startListening.UseVisualStyleBackColor = false;
             this.startListening.UseVisualStyleBackColor = false;
@@ -117,6 +126,7 @@
             // 
             // 
             // logInfo
             // logInfo
             // 
             // 
+            this.logInfo.AllowUserToAddRows = false;
             this.logInfo.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.logInfo.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.logInfo.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.logInfo.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.UserID,
             this.UserID,
@@ -124,42 +134,73 @@
             this.VerifyMethod,
             this.VerifyMethod,
             this.Time,
             this.Time,
             this.WorkCode});
             this.WorkCode});
-            this.logInfo.Location = new System.Drawing.Point(44, 98);
+            this.logInfo.Location = new System.Drawing.Point(29, 65);
+            this.logInfo.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.logInfo.Name = "logInfo";
             this.logInfo.Name = "logInfo";
             this.logInfo.RowTemplate.Height = 30;
             this.logInfo.RowTemplate.Height = 30;
-            this.logInfo.Size = new System.Drawing.Size(760, 381);
+            this.logInfo.Size = new System.Drawing.Size(507, 254);
             this.logInfo.TabIndex = 23;
             this.logInfo.TabIndex = 23;
             // 
             // 
+            // dataGridViewTextBoxColumn1
+            // 
+            this.dataGridViewTextBoxColumn1.HeaderText = "用户ID";
+            this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";
+            // 
+            // dataGridViewTextBoxColumn2
+            // 
+            this.dataGridViewTextBoxColumn2.HeaderText = "考勤状态";
+            this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2";
+            // 
+            // dataGridViewTextBoxColumn3
+            // 
+            this.dataGridViewTextBoxColumn3.HeaderText = "验证方式";
+            this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3";
+            // 
+            // dataGridViewTextBoxColumn4
+            // 
+            this.dataGridViewTextBoxColumn4.HeaderText = "考勤时间";
+            this.dataGridViewTextBoxColumn4.Name = "dataGridViewTextBoxColumn4";
+            // 
+            // dataGridViewTextBoxColumn5
+            // 
+            this.dataGridViewTextBoxColumn5.HeaderText = "WorkCode";
+            this.dataGridViewTextBoxColumn5.Name = "dataGridViewTextBoxColumn5";
+            // 
             // UserID
             // UserID
             // 
             // 
+            this.UserID.DataPropertyName = "UserID";
             this.UserID.HeaderText = "用户ID";
             this.UserID.HeaderText = "用户ID";
             this.UserID.Name = "UserID";
             this.UserID.Name = "UserID";
             // 
             // 
             // AttState
             // AttState
             // 
             // 
+            this.AttState.DataPropertyName = "AttState";
             this.AttState.HeaderText = "考勤状态";
             this.AttState.HeaderText = "考勤状态";
             this.AttState.Name = "AttState";
             this.AttState.Name = "AttState";
             // 
             // 
             // VerifyMethod
             // VerifyMethod
             // 
             // 
+            this.VerifyMethod.DataPropertyName = "VerifyMethod";
             this.VerifyMethod.HeaderText = "验证方式";
             this.VerifyMethod.HeaderText = "验证方式";
             this.VerifyMethod.Name = "VerifyMethod";
             this.VerifyMethod.Name = "VerifyMethod";
             // 
             // 
             // Time
             // Time
             // 
             // 
+            this.Time.DataPropertyName = "Time";
             this.Time.HeaderText = "考勤时间";
             this.Time.HeaderText = "考勤时间";
             this.Time.Name = "Time";
             this.Time.Name = "Time";
             // 
             // 
             // WorkCode
             // WorkCode
             // 
             // 
+            this.WorkCode.DataPropertyName = "WorkCode";
             this.WorkCode.HeaderText = "WorkCode";
             this.WorkCode.HeaderText = "WorkCode";
             this.WorkCode.Name = "WorkCode";
             this.WorkCode.Name = "WorkCode";
             // 
             // 
             // Form2
             // Form2
             // 
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(846, 507);
+            this.ClientSize = new System.Drawing.Size(564, 338);
             this.Controls.Add(this.logInfo);
             this.Controls.Add(this.logInfo);
             this.Controls.Add(this.startListening);
             this.Controls.Add(this.startListening);
             this.Controls.Add(this.lblState);
             this.Controls.Add(this.lblState);
@@ -168,8 +209,10 @@
             this.Controls.Add(this.txtPort);
             this.Controls.Add(this.txtPort);
             this.Controls.Add(this.txtIP);
             this.Controls.Add(this.txtIP);
             this.Controls.Add(this.btnConnect);
             this.Controls.Add(this.btnConnect);
+            this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
             this.Name = "Form2";
             this.Name = "Form2";
             this.Text = "实时获取考勤";
             this.Text = "实时获取考勤";
+            this.Load += new System.EventHandler(this.Form2_Load);
             ((System.ComponentModel.ISupportInitialize)(this.logInfo)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.logInfo)).EndInit();
             this.ResumeLayout(false);
             this.ResumeLayout(false);
             this.PerformLayout();
             this.PerformLayout();
@@ -186,6 +229,11 @@
         private System.Windows.Forms.Button btnConnect;
         private System.Windows.Forms.Button btnConnect;
         private System.Windows.Forms.Button startListening;
         private System.Windows.Forms.Button startListening;
         private System.Windows.Forms.DataGridView logInfo;
         private System.Windows.Forms.DataGridView logInfo;
+        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn1;
+        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2;
+        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3;
+        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4;
+        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn5;
         private System.Windows.Forms.DataGridViewTextBoxColumn UserID;
         private System.Windows.Forms.DataGridViewTextBoxColumn UserID;
         private System.Windows.Forms.DataGridViewTextBoxColumn AttState;
         private System.Windows.Forms.DataGridViewTextBoxColumn AttState;
         private System.Windows.Forms.DataGridViewTextBoxColumn VerifyMethod;
         private System.Windows.Forms.DataGridViewTextBoxColumn VerifyMethod;

+ 19 - 4
UAS_CheckWork/Form2.cs

@@ -29,12 +29,24 @@ namespace UAS_CheckWork
             //})
             //})
             //{ IsBackground = true }.Start();
             //{ IsBackground = true }.Start();
         }
         }
-        DataHelper dh;
+
+        DataHelper dh = new DataHelper();
         //Create Standalone SDK class dynamicly.
         //Create Standalone SDK class dynamicly.
         public zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
         public zkemkeeper.CZKEMClass axCZKEM1 = new zkemkeeper.CZKEMClass();
         private bool bIsConnected = false;//the boolean value identifies whether the device is connected
         private bool bIsConnected = false;//the boolean value identifies whether the device is connected
         private int iMachineNumber = 1;//the serial number of the device.After connecting the device ,this value will be changed.
         private int iMachineNumber = 1;//the serial number of the device.After connecting the device ,this value will be changed.
 
 
+        private void Form2_Load(object sender, EventArgs e)
+        {
+            DataTable dt = new DataTable();
+            dt.Columns.Add("UserID");
+            dt.Columns.Add("AttState");
+            dt.Columns.Add("VerifyMethod");
+            dt.Columns.Add("Time");
+            dt.Columns.Add("WorkCode");
+            logInfo.DataSource = dt;
+        }
+
         private void btnConnect_Click(object sender, EventArgs e)
         private void btnConnect_Click(object sender, EventArgs e)
         {
         {
             if (txtIP.Text.Trim() == "" || txtPort.Text.Trim() == "")
             if (txtIP.Text.Trim() == "" || txtPort.Text.Trim() == "")
@@ -79,7 +91,7 @@ namespace UAS_CheckWork
                 MessageBox.Show("请先连接设备", "Error");
                 MessageBox.Show("请先连接设备", "Error");
                 return;
                 return;
             }
             }
-            if (startListening.Text== "正在实时监听")
+            if (startListening.Text == "正在实时监听")
             {
             {
                 MessageBox.Show("已启动监听", "Error");
                 MessageBox.Show("已启动监听", "Error");
                 return;
                 return;
@@ -136,16 +148,19 @@ namespace UAS_CheckWork
                     default:
                     default:
                         break;
                         break;
                 }
                 }
-                dr["Time"] = iYear + "-" + iMonth + "-" + iDay + " " + iHour + ":" + iMinute + ":" + iSecond;
+                string Time = iYear + "-" + iMonth + "-" + iDay + " " + iHour + ":" + iMinute + ":" + iSecond;
+                dr["Time"] = Time;
                 dr["WorkCode"] = iWorkCode;
                 dr["WorkCode"] = iWorkCode;
+                dt.Rows.Add(dr);
                 logInfo.DataSource = dt;
                 logInfo.DataSource = dt;
                 //更新数据库
                 //更新数据库
-                dh.ExecuteSql("insert into cardlog (cl_id,cl_cardcode,cl_time) values (cardlog_seq.nextval,'"+sEnrollNumber+"',TO_DATE('"+ dr["Time"] + "','yyyy-MM-dd hh24:mi:ss'))","insert");
+                dh.ExecuteSql("insert into cardlog (cl_id,cl_cardcode,cl_time,cl_address) values (cardlog_seq.nextval,'" + sEnrollNumber + "',TO_DATE('" + Time + "','yyyy-MM-dd hh24:mi:ss'),'考勤机数据导入')", "insert");
             }
             }
             else
             else
             {
             {
                 //记录验证无效
                 //记录验证无效
             }
             }
         }
         }
+
     }
     }
 }
 }

+ 1 - 1
UAS_CheckWork/Program.cs

@@ -34,7 +34,7 @@ namespace UAS_CheckWork
                 //添加全局事件的监听
                 //添加全局事件的监听
                 //Application.AddMessageFilter(g);
                 //Application.AddMessageFilter(g);
                 if (principal.IsInRole(WindowsBuiltInRole.Administrator))
                 if (principal.IsInRole(WindowsBuiltInRole.Administrator))
-                    Application.Run(new Form2());
+                    Application.Run(new Form1());
                 else
                 else
                 {
                 {
                     //创建启动对象
                     //创建启动对象

+ 9 - 0
UAS_CheckWork/UAS_CheckWork.csproj

@@ -61,6 +61,12 @@
     <Compile Include="Form1.Designer.cs">
     <Compile Include="Form1.Designer.cs">
       <DependentUpon>Form1.cs</DependentUpon>
       <DependentUpon>Form1.cs</DependentUpon>
     </Compile>
     </Compile>
+    <Compile Include="Form2.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="Form2.Designer.cs">
+      <DependentUpon>Form2.cs</DependentUpon>
+    </Compile>
     <Compile Include="LoadingCircle.cs">
     <Compile Include="LoadingCircle.cs">
       <SubType>Component</SubType>
       <SubType>Component</SubType>
     </Compile>
     </Compile>
@@ -79,6 +85,9 @@
     <EmbeddedResource Include="Form1.resx">
     <EmbeddedResource Include="Form1.resx">
       <DependentUpon>Form1.cs</DependentUpon>
       <DependentUpon>Form1.cs</DependentUpon>
     </EmbeddedResource>
     </EmbeddedResource>
+    <EmbeddedResource Include="Form2.resx">
+      <DependentUpon>Form2.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="Properties\Resources.resx">
     <EmbeddedResource Include="Properties\Resources.resx">
       <Generator>ResXFileCodeGenerator</Generator>
       <Generator>ResXFileCodeGenerator</Generator>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>
       <LastGenOutput>Resources.Designer.cs</LastGenOutput>