Browse Source

添加DLL

章政 8 years ago
parent
commit
4402b0c7f6

+ 2 - 3
UAS_CheckWork/DataHelper.cs

@@ -11,12 +11,11 @@ namespace UAS_MES.DataOperate
     class DataHelper
     class DataHelper
     {
     {
         //系统默认的的连接字符串
         //系统默认的的连接字符串
-        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=MES_TEST;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=117.25.180.218)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
         //用户选择的数据库的连接字符串
         //用户选择的数据库的连接字符串
         public static string DBConnectionString;
         public static string DBConnectionString;
         public static OracleConnection connection = null;
         public static OracleConnection connection = null;
         OracleCommand command = null;
         OracleCommand command = null;
-        int ReconnectTime = 0;
         /// <summary>
         /// <summary>
         /// 执行构造函数的时候打开数据库的链接
         /// 执行构造函数的时候打开数据库的链接
         /// </summary>
         /// </summary>
@@ -31,7 +30,7 @@ namespace UAS_MES.DataOperate
                     connection = new OracleConnection(DBConnectionString);
                     connection = new OracleConnection(DBConnectionString);
                 connection.Open();
                 connection.Open();
             }
             }
-            catch (Exception e) {  }
+            catch (Exception ) {  }
         }
         }
 
 
         /// <summary>
         /// <summary>

+ 32 - 24
UAS_CheckWork/Form1.Designer.cs

@@ -39,9 +39,9 @@
             this.Column1 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.Column1 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.getAllData = new System.Windows.Forms.Button();
             this.getAllData = new System.Windows.Forms.Button();
             this.saveData = new System.Windows.Forms.Button();
             this.saveData = new System.Windows.Forms.Button();
-            this.allData = new System.Windows.Forms.BindingSource(this.components);
             this.chooseAll = new UAS_MES.CustomControl.ButtonUtil.ChooseAllButton();
             this.chooseAll = new UAS_MES.CustomControl.ButtonUtil.ChooseAllButton();
             this.dataGridViewCheckBoxColumn1 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
             this.dataGridViewCheckBoxColumn1 = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.allData = new System.Windows.Forms.BindingSource(this.components);
             ((System.ComponentModel.ISupportInitialize)(this.showDataGrid)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.showDataGrid)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.allData)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.allData)).BeginInit();
             this.SuspendLayout();
             this.SuspendLayout();
@@ -49,44 +49,47 @@
             // label2
             // label2
             // 
             // 
             this.label2.AutoSize = true;
             this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(226, 31);
+            this.label2.Location = new System.Drawing.Point(183, 26);
             this.label2.Name = "label2";
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(44, 18);
+            this.label2.Size = new System.Drawing.Size(39, 15);
             this.label2.TabIndex = 14;
             this.label2.TabIndex = 14;
             this.label2.Text = "Port";
             this.label2.Text = "Port";
             // 
             // 
             // label1
             // label1
             // 
             // 
             this.label1.AutoSize = true;
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(56, 31);
+            this.label1.Location = new System.Drawing.Point(32, 26);
             this.label1.Name = "label1";
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(26, 18);
+            this.label1.Size = new System.Drawing.Size(23, 15);
             this.label1.TabIndex = 13;
             this.label1.TabIndex = 13;
             this.label1.Text = "IP";
             this.label1.Text = "IP";
             // 
             // 
             // txtPort
             // txtPort
             // 
             // 
-            this.txtPort.Location = new System.Drawing.Point(269, 27);
+            this.txtPort.Location = new System.Drawing.Point(230, 22);
+            this.txtPort.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.txtPort.Name = "txtPort";
             this.txtPort.Name = "txtPort";
-            this.txtPort.Size = new System.Drawing.Size(53, 28);
+            this.txtPort.Size = new System.Drawing.Size(48, 25);
             this.txtPort.TabIndex = 12;
             this.txtPort.TabIndex = 12;
             this.txtPort.Text = "4370";
             this.txtPort.Text = "4370";
             // 
             // 
             // txtIP
             // txtIP
             // 
             // 
-            this.txtIP.Location = new System.Drawing.Point(87, 27);
+            this.txtIP.Location = new System.Drawing.Point(59, 22);
+            this.txtIP.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.txtIP.Name = "txtIP";
             this.txtIP.Name = "txtIP";
-            this.txtIP.Size = new System.Drawing.Size(95, 28);
+            this.txtIP.Size = new System.Drawing.Size(118, 25);
             this.txtIP.TabIndex = 11;
             this.txtIP.TabIndex = 11;
             this.txtIP.Text = "192.168.1.201";
             this.txtIP.Text = "192.168.1.201";
             // 
             // 
             // btnConnect
             // btnConnect
             // 
             // 
-            this.btnConnect.Location = new System.Drawing.Point(412, 27);
+            this.btnConnect.Location = new System.Drawing.Point(348, 22);
+            this.btnConnect.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.btnConnect.Name = "btnConnect";
             this.btnConnect.Name = "btnConnect";
-            this.btnConnect.Size = new System.Drawing.Size(78, 23);
+            this.btnConnect.Size = new System.Drawing.Size(69, 25);
             this.btnConnect.TabIndex = 10;
             this.btnConnect.TabIndex = 10;
-            this.btnConnect.Text = "Connect";
+            this.btnConnect.Text = "连接";
             this.btnConnect.UseVisualStyleBackColor = true;
             this.btnConnect.UseVisualStyleBackColor = true;
             this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
             this.btnConnect.Click += new System.EventHandler(this.btnConnect_Click);
             // 
             // 
@@ -94,9 +97,9 @@
             // 
             // 
             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(565, 32);
+            this.lblState.Location = new System.Drawing.Point(484, 27);
             this.lblState.Name = "lblState";
             this.lblState.Name = "lblState";
-            this.lblState.Size = new System.Drawing.Size(242, 18);
+            this.lblState.Size = new System.Drawing.Size(215, 15);
             this.lblState.TabIndex = 15;
             this.lblState.TabIndex = 15;
             this.lblState.Text = "Current State:Disconnected";
             this.lblState.Text = "Current State:Disconnected";
             // 
             // 
@@ -108,10 +111,11 @@
             this.showDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.showDataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.Column1});
             this.Column1});
             this.showDataGrid.Enabled = false;
             this.showDataGrid.Enabled = false;
-            this.showDataGrid.Location = new System.Drawing.Point(59, 191);
+            this.showDataGrid.Location = new System.Drawing.Point(23, 159);
+            this.showDataGrid.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.showDataGrid.Name = "showDataGrid";
             this.showDataGrid.Name = "showDataGrid";
             this.showDataGrid.RowTemplate.Height = 30;
             this.showDataGrid.RowTemplate.Height = 30;
-            this.showDataGrid.Size = new System.Drawing.Size(792, 358);
+            this.showDataGrid.Size = new System.Drawing.Size(944, 387);
             this.showDataGrid.TabIndex = 16;
             this.showDataGrid.TabIndex = 16;
             // 
             // 
             // Column1
             // Column1
@@ -121,9 +125,10 @@
             // 
             // 
             // getAllData
             // getAllData
             // 
             // 
-            this.getAllData.Location = new System.Drawing.Point(59, 97);
+            this.getAllData.Location = new System.Drawing.Point(26, 81);
+            this.getAllData.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.getAllData.Name = "getAllData";
             this.getAllData.Name = "getAllData";
-            this.getAllData.Size = new System.Drawing.Size(151, 37);
+            this.getAllData.Size = new System.Drawing.Size(134, 31);
             this.getAllData.TabIndex = 17;
             this.getAllData.TabIndex = 17;
             this.getAllData.Text = "获取考勤数据";
             this.getAllData.Text = "获取考勤数据";
             this.getAllData.UseVisualStyleBackColor = true;
             this.getAllData.UseVisualStyleBackColor = true;
@@ -131,9 +136,10 @@
             // 
             // 
             // saveData
             // saveData
             // 
             // 
-            this.saveData.Location = new System.Drawing.Point(683, 97);
+            this.saveData.Location = new System.Drawing.Point(607, 81);
+            this.saveData.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.saveData.Name = "saveData";
             this.saveData.Name = "saveData";
-            this.saveData.Size = new System.Drawing.Size(145, 37);
+            this.saveData.Size = new System.Drawing.Size(129, 31);
             this.saveData.TabIndex = 18;
             this.saveData.TabIndex = 18;
             this.saveData.Text = "保存数据";
             this.saveData.Text = "保存数据";
             this.saveData.UseVisualStyleBackColor = true;
             this.saveData.UseVisualStyleBackColor = true;
@@ -141,9 +147,10 @@
             // 
             // 
             // chooseAll
             // chooseAll
             // 
             // 
-            this.chooseAll.Location = new System.Drawing.Point(59, 149);
+            this.chooseAll.Location = new System.Drawing.Point(26, 124);
+            this.chooseAll.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.chooseAll.Name = "chooseAll";
             this.chooseAll.Name = "chooseAll";
-            this.chooseAll.Size = new System.Drawing.Size(83, 28);
+            this.chooseAll.Size = new System.Drawing.Size(59, 23);
             this.chooseAll.TabIndex = 19;
             this.chooseAll.TabIndex = 19;
             this.chooseAll.Text = "全选";
             this.chooseAll.Text = "全选";
             this.chooseAll.UseVisualStyleBackColor = true;
             this.chooseAll.UseVisualStyleBackColor = true;
@@ -155,9 +162,9 @@
             // 
             // 
             // Form1
             // Form1
             // 
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(908, 583);
+            this.ClientSize = new System.Drawing.Size(989, 564);
             this.Controls.Add(this.chooseAll);
             this.Controls.Add(this.chooseAll);
             this.Controls.Add(this.saveData);
             this.Controls.Add(this.saveData);
             this.Controls.Add(this.getAllData);
             this.Controls.Add(this.getAllData);
@@ -168,6 +175,7 @@
             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(3, 2, 3, 2);
             this.Name = "Form1";
             this.Name = "Form1";
             this.Text = "Form1";
             this.Text = "Form1";
             this.Load += new System.EventHandler(this.Form1_Load);
             this.Load += new System.EventHandler(this.Form1_Load);

+ 12 - 13
UAS_CheckWork/Form1.cs

@@ -25,44 +25,43 @@ namespace UAS_CheckWork
         {
         {
             if (txtIP.Text.Trim() == "" || txtPort.Text.Trim() == "")
             if (txtIP.Text.Trim() == "" || txtPort.Text.Trim() == "")
             {
             {
-                MessageBox.Show("IP and Port cannot be null", "Error");
+                MessageBox.Show("请先输入IP和端口", "Error");
                 return;
                 return;
             }
             }
             int idwErrorCode = 0;
             int idwErrorCode = 0;
 
 
             Cursor = Cursors.WaitCursor;
             Cursor = Cursors.WaitCursor;
-            if (btnConnect.Text == "DisConnect")
+            if (btnConnect.Text == "断开连接")
             {
             {
                 axCZKEM1.Disconnect();
                 axCZKEM1.Disconnect();
                 bIsConnected = false;
                 bIsConnected = false;
-                btnConnect.Text = "Connect";
-                lblState.Text = "Current State:DisConnected";
+                btnConnect.Text = "连接";
+                lblState.Text = "状态:未连接";
                 Cursor = Cursors.Default;
                 Cursor = Cursors.Default;
                 return;
                 return;
             }
             }
-
             bIsConnected = axCZKEM1.Connect_Net(txtIP.Text, Convert.ToInt32(txtPort.Text));
             bIsConnected = axCZKEM1.Connect_Net(txtIP.Text, Convert.ToInt32(txtPort.Text));
-            if (bIsConnected == true)
+            if (bIsConnected)
             {
             {
-                btnConnect.Text = "DisConnect";
+                btnConnect.Text = "断开连接";
                 btnConnect.Refresh();
                 btnConnect.Refresh();
-                lblState.Text = "Current State:Connected";
+                lblState.Text = "状态:已连接";
                 iMachineNumber = 1;//In fact,when you are using the tcp/ip communication,this parameter will be ignored,that is any integer will all right.Here we use 1.
                 iMachineNumber = 1;//In fact,when you are using the tcp/ip communication,this parameter will be ignored,that is any integer will all right.Here we use 1.
                 axCZKEM1.RegEvent(iMachineNumber, 65535);//Here you can register the realtime events that you want to be triggered(the parameters 65535 means registering all)
                 axCZKEM1.RegEvent(iMachineNumber, 65535);//Here you can register the realtime events that you want to be triggered(the parameters 65535 means registering all)
             }
             }
             else
             else
             {
             {
                 axCZKEM1.GetLastError(ref idwErrorCode);
                 axCZKEM1.GetLastError(ref idwErrorCode);
-                MessageBox.Show("Unable to connect the device,ErrorCode=" + idwErrorCode.ToString(), "Error");
+                MessageBox.Show("无法连接设备,ErrorCode=" + idwErrorCode.ToString(), "Error");
             }
             }
             Cursor = Cursors.Default;
             Cursor = Cursors.Default;
         }
         }
 
 
         private void getAllData_Click(object sender, EventArgs e)
         private void getAllData_Click(object sender, EventArgs e)
         {
         {
-            if (bIsConnected == false)
+            if (bIsConnected)
             {
             {
-                MessageBox.Show("Please connect the device first!", "Error");
+                MessageBox.Show("请先连接设备", "Error");
                 return;
                 return;
             }
             }
             int idwErrorCode = 0;
             int idwErrorCode = 0;
@@ -81,12 +80,12 @@ namespace UAS_CheckWork
                 int minute = 0;//记录考勤分钟
                 int minute = 0;//记录考勤分钟
                 int second = 0;//记录考勤秒
                 int second = 0;//记录考勤秒
                 int workCode = 0; //记录workCode
                 int workCode = 0; //记录workCode
-                while (axCZKEM1.SSR_GetGeneralLogData(iMachineNumber,out enrollNumber,out verifyCode,out inoutMode,out year,out month,out day,out hour,out minute,out second,ref workCode))
+                while (axCZKEM1.SSR_GetGeneralLogData(iMachineNumber, out enrollNumber, out verifyCode, out inoutMode, out year, out month, out day, out hour, out minute, out second, ref workCode))
                 {
                 {
                     //将数据加入DataTable中
                     //将数据加入DataTable中
                     DataRow dr = dt.NewRow();
                     DataRow dr = dt.NewRow();
                     dr["cl_emcode"] = enrollNumber;
                     dr["cl_emcode"] = enrollNumber;
-                    dr["cl_time"] = year+"-"+month+"-"+day+" "+hour+":"+minute+":"+second;
+                    dr["cl_time"] = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second;
                     dt.Rows.Add(dr);
                     dt.Rows.Add(dr);
                     allData.DataSource = dt;
                     allData.DataSource = dt;
                     //显示
                     //显示

+ 0 - 6
UAS_CheckWork/Form1.resx

@@ -117,12 +117,6 @@
   <resheader name="writer">
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   </resheader>
-  <metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="Column1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
   <metadata name="allData.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
   <metadata name="allData.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>17, 17</value>
     <value>17, 17</value>
   </metadata>
   </metadata>

+ 24 - 0
UAS_CheckWork/UAS_CheckWork.csproj

@@ -33,6 +33,9 @@
     <WarningLevel>4</WarningLevel>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
+    <Reference Include="Oracle.ManagedDataAccess">
+      <HintPath>tool\Oracle.ManagedDataAccess.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
     <Reference Include="System.Core" />
     <Reference Include="System.Core" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Xml.Linq" />
@@ -46,6 +49,13 @@
     <Reference Include="System.Xml" />
     <Reference Include="System.Xml" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
+    <Compile Include="ChooseAllButton.cs">
+      <SubType>Component</SubType>
+    </Compile>
+    <Compile Include="ChooseAllButton.Designer.cs">
+      <DependentUpon>ChooseAllButton.cs</DependentUpon>
+    </Compile>
+    <Compile Include="DataHelper.cs" />
     <Compile Include="Form1.cs">
     <Compile Include="Form1.cs">
       <SubType>Form</SubType>
       <SubType>Form</SubType>
     </Compile>
     </Compile>
@@ -54,6 +64,9 @@
     </Compile>
     </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
+    <EmbeddedResource Include="Form1.resx">
+      <DependentUpon>Form1.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>
@@ -76,6 +89,17 @@
   <ItemGroup>
   <ItemGroup>
     <None Include="App.config" />
     <None Include="App.config" />
   </ItemGroup>
   </ItemGroup>
+  <ItemGroup>
+    <COMReference Include="zkemkeeper">
+      <Guid>{FE9DED34-E159-408E-8490-B720A5E632C7}</Guid>
+      <VersionMajor>1</VersionMajor>
+      <VersionMinor>0</VersionMinor>
+      <Lcid>0</Lcid>
+      <WrapperTool>tlbimp</WrapperTool>
+      <Isolated>False</Isolated>
+      <EmbedInteropTypes>False</EmbedInteropTypes>
+    </COMReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.
        Other similar extension points exist, see Microsoft.Common.targets.

BIN
UAS_CheckWork/tool/Oracle.ManagedDataAccess.dll


BIN
UAS_CheckWork/tool/zkemkeeper.dll