Browse Source

添加COM加密

章政 7 years ago
parent
commit
36a93e6b56

+ 0 - 6
MES_Interface/App.config

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
-    <startup> 
-        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
-    </startup>
-</configuration>

+ 0 - 87
MES_Interface/MES_Interface.csproj

@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{7B7322F9-F0F3-4AC8-B7D2-C2120E9AEA8C}</ProjectGuid>
-    <OutputType>WinExe</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>MES_Interface</RootNamespace>
-    <AssemblyName>MES_Interface</AssemblyName>
-    <TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <PlatformTarget>AnyCPU</PlatformTarget>
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <PlatformTarget>AnyCPU</PlatformTarget>
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Deployment" />
-    <Reference Include="System.Drawing" />
-    <Reference Include="System.Net.Http" />
-    <Reference Include="System.Windows.Forms" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="Form1.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="Form1.Designer.cs">
-      <DependentUpon>Form1.cs</DependentUpon>
-    </Compile>
-    <Compile Include="Program.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <EmbeddedResource Include="Properties\Resources.resx">
-      <Generator>ResXFileCodeGenerator</Generator>
-      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
-      <SubType>Designer</SubType>
-    </EmbeddedResource>
-    <Compile Include="Properties\Resources.Designer.cs">
-      <AutoGen>True</AutoGen>
-      <DependentUpon>Resources.resx</DependentUpon>
-    </Compile>
-    <None Include="Properties\Settings.settings">
-      <Generator>SettingsSingleFileGenerator</Generator>
-      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
-    </None>
-    <Compile Include="Properties\Settings.Designer.cs">
-      <AutoGen>True</AutoGen>
-      <DependentUpon>Settings.settings</DependentUpon>
-      <DesignTimeSharedInput>True</DesignTimeSharedInput>
-    </Compile>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="App.config" />
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <!-- 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.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-</Project>

+ 0 - 22
MES_Interface/Program.cs

@@ -1,22 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace MES_Interface
-{
-    static class Program
-    {
-        /// <summary>
-        /// 应用程序的主入口点。
-        /// </summary>
-        [STAThread]
-        static void Main()
-        {
-            Application.EnableVisualStyles();
-            Application.SetCompatibleTextRenderingDefault(false);
-            Application.Run(new Form1());
-        }
-    }
-}

+ 0 - 36
MES_Interface/Properties/AssemblyInfo.cs

@@ -1,36 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// 有关程序集的一般信息由以下
-// 控制。更改这些特性值可修改
-// 与程序集关联的信息。
-[assembly: AssemblyTitle("MES_Interface")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("MES_Interface")]
-[assembly: AssemblyCopyright("Copyright ©  2017")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-//将 ComVisible 设置为 false 将使此程序集中的类型
-//对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
-//请将此类型的 ComVisible 特性设置为 true。
-[assembly: ComVisible(false)]
-
-// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
-[assembly: Guid("7b7322f9-f0f3-4ac8-b7d2-c2120e9aea8c")]
-
-// 程序集的版本信息由下列四个值组成: 
-//
-//      主版本
-//      次版本
-//      生成号
-//      修订号
-//
-//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
-// 方法是按如下所示使用“*”: :
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]

+ 0 - 71
MES_Interface/Properties/Resources.Designer.cs

@@ -1,71 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-//     此代码由工具生成。
-//     运行时版本: 4.0.30319.42000
-//
-//     对此文件的更改可能导致不正确的行为,如果
-//     重新生成代码,则所做更改将丢失。
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace MES_Interface.Properties
-{
-
-
-    /// <summary>
-    ///   强类型资源类,用于查找本地化字符串等。
-    /// </summary>
-    // 此类是由 StronglyTypedResourceBuilder
-    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
-    // 若要添加或删除成员,请编辑 .ResX 文件,然后重新运行 ResGen
-    // (以 /str 作为命令选项),或重新生成 VS 项目。
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
-    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    internal class Resources
-    {
-
-        private static global::System.Resources.ResourceManager resourceMan;
-
-        private static global::System.Globalization.CultureInfo resourceCulture;
-
-        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
-        internal Resources()
-        {
-        }
-
-        /// <summary>
-        ///   返回此类使用的缓存 ResourceManager 实例。
-        /// </summary>
-        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        internal static global::System.Resources.ResourceManager ResourceManager
-        {
-            get
-            {
-                if ((resourceMan == null))
-                {
-                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MES_Interface.Properties.Resources", typeof(Resources).Assembly);
-                    resourceMan = temp;
-                }
-                return resourceMan;
-            }
-        }
-
-        /// <summary>
-        ///   覆盖当前线程的 CurrentUICulture 属性
-        ///   使用此强类型的资源类的资源查找。
-        /// </summary>
-        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
-        internal static global::System.Globalization.CultureInfo Culture
-        {
-            get
-            {
-                return resourceCulture;
-            }
-            set
-            {
-                resourceCulture = value;
-            }
-        }
-    }
-}

+ 0 - 117
MES_Interface/Properties/Resources.resx

@@ -1,117 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
-  <!-- 
-    Microsoft ResX Schema 
-    
-    Version 2.0
-    
-    The primary goals of this format is to allow a simple XML format 
-    that is mostly human readable. The generation and parsing of the 
-    various data types are done through the TypeConverter classes 
-    associated with the data types.
-    
-    Example:
-    
-    ... ado.net/XML headers & schema ...
-    <resheader name="resmimetype">text/microsoft-resx</resheader>
-    <resheader name="version">2.0</resheader>
-    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
-    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
-    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
-    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
-    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
-        <value>[base64 mime encoded serialized .NET Framework object]</value>
-    </data>
-    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
-        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
-        <comment>This is a comment</comment>
-    </data>
-                
-    There are any number of "resheader" rows that contain simple 
-    name/value pairs.
-    
-    Each data row contains a name, and value. The row also contains a 
-    type or mimetype. Type corresponds to a .NET class that support 
-    text/value conversion through the TypeConverter architecture. 
-    Classes that don't support this are serialized and stored with the 
-    mimetype set.
-    
-    The mimetype is used for serialized objects, and tells the 
-    ResXResourceReader how to depersist the object. This is currently not 
-    extensible. For a given mimetype the value must be set accordingly:
-    
-    Note - application/x-microsoft.net.object.binary.base64 is the format 
-    that the ResXResourceWriter will generate, however the reader can 
-    read any of the formats listed below.
-    
-    mimetype: application/x-microsoft.net.object.binary.base64
-    value   : The object must be serialized with 
-            : System.Serialization.Formatters.Binary.BinaryFormatter
-            : and then encoded with base64 encoding.
-    
-    mimetype: application/x-microsoft.net.object.soap.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
-            : and then encoded with base64 encoding.
-
-    mimetype: application/x-microsoft.net.object.bytearray.base64
-    value   : The object must be serialized into a byte array 
-            : using a System.ComponentModel.TypeConverter
-            : and then encoded with base64 encoding.
-    -->
-  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
-    <xsd:element name="root" msdata:IsDataSet="true">
-      <xsd:complexType>
-        <xsd:choice maxOccurs="unbounded">
-          <xsd:element name="metadata">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" />
-              <xsd:attribute name="type" type="xsd:string" />
-              <xsd:attribute name="mimetype" type="xsd:string" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="assembly">
-            <xsd:complexType>
-              <xsd:attribute name="alias" type="xsd:string" />
-              <xsd:attribute name="name" type="xsd:string" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="data">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
-              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
-              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="resheader">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" />
-            </xsd:complexType>
-          </xsd:element>
-        </xsd:choice>
-      </xsd:complexType>
-    </xsd:element>
-  </xsd:schema>
-  <resheader name="resmimetype">
-    <value>text/microsoft-resx</value>
-  </resheader>
-  <resheader name="version">
-    <value>2.0</value>
-  </resheader>
-  <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-  <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-</root>

+ 0 - 30
MES_Interface/Properties/Settings.Designer.cs

@@ -1,30 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-//     This code was generated by a tool.
-//     Runtime Version:4.0.30319.42000
-//
-//     Changes to this file may cause incorrect behavior and will be lost if
-//     the code is regenerated.
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace MES_Interface.Properties
-{
-
-
-    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
-    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
-    {
-
-        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-
-        public static Settings Default
-        {
-            get
-            {
-                return defaultInstance;
-            }
-        }
-    }
-}

+ 0 - 7
MES_Interface/Properties/Settings.settings

@@ -1,7 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
-  <Profiles>
-    <Profile Name="(Default)" />
-  </Profiles>
-  <Settings />
-</SettingsFile>

+ 0 - 1010
MES接口/DataHelper.cs

@@ -1,1010 +0,0 @@
-using Oracle.ManagedDataAccess.Client;
-using System;
-using System.Data;
-using System.Text;
-using System.Collections.Generic;
-
-namespace MES_Interface
-{
-    /// <summary>
-    /// 数据库操作类
-    /// </summary>
-    class DataHelper
-    {
-        //系统默认的的连接字符串  
-        private string ConnectionStrings = "";
-        //用户选择的数据库的连接字符串
-        public static OracleConnection connection = null;
-        //用户选择的数据库的连接字符串
-        OracleCommand command = null;
-        /// <summary>
-        /// 执行构造函数的时候打开数据库的链接
-        /// </summary>
-        public DataHelper(string Environment)
-        {
-            try
-            {
-                if (Environment.ToUpper() == "FORMAl")
-                {
-                    ConnectionStrings = "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)));";
-                }
-                else if (Environment.ToUpper() == "TEST")
-                {
-                    ConnectionStrings = "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)));";
-                }
-                connection = new OracleConnection(ConnectionStrings);
-                connection.Open();
-            }
-            catch (Exception)
-            {
-            }
-        }
-
-        /// <summary>
-        /// 获取第一行第一列的信息
-        /// </summary>
-        public object getFieldDataByCondition(string TableName, string Field, string Condition)
-        {
-            DataTable dt = new DataTable();
-            string sql = "select " + Field + " from " + TableName + " where " + Condition;
-            command = new OracleCommand(sql, connection);
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter();
-            ad.SelectCommand = command;
-            ad.Fill(dt);
-            ad.Dispose();
-            command.Dispose();
-            if (dt.Rows.Count > 0)
-            {
-                return dt.Rows[0][0];
-            }
-            else
-            {
-                return "";
-            }
-        }
-
-        /// <summary>
-        /// 获取指定表的记录的条数 ,带条件
-        /// </summary>
-        /// <returns></returns>
-        public int getRowCount(string TableName, string Condition)
-        {
-            DataTable dt = new DataTable();
-            string sql = "select count(1) from " + TableName + " where " + Condition;
-            command = new OracleCommand(sql, connection);
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
-            ad.Dispose();
-            command.Dispose();
-            return int.Parse(dt.Rows[0][0].ToString());
-        }
-
-        /// <summary>
-        /// 获取指定表的记录的条数 ,不带条件
-        /// </summary>
-        /// <param name="TableName"></param>
-        /// <returns></returns>
-        public int getRowCount(string TableName)
-        {
-            DataTable dt = new DataTable();
-            string sql = "select count(1) from " + TableName;
-            command = new OracleCommand(sql, connection);
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
-            ad.Dispose();
-            command.Dispose();
-            return int.Parse(dt.Rows[0][0].ToString());
-        }
-
-        /// <summary>
-        /// 通过表名和获取单行的记录
-        /// </summary>
-        public DataTable getFieldsDataByCondition(string TableName, string[] Fields, string Condition)
-        {
-            DataTable dt = new DataTable();
-            string sql = "select ";
-            sql += AddField(Fields);
-            sql += " from " + TableName + " where " + Condition + " and rownum=1";
-            command = new OracleCommand(sql, connection);
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
-            ad.Dispose();
-            command.Dispose();
-            return dt;
-        }
-
-        /// <summary>
-        /// 按分页获取数据
-        /// </summary>
-        /// <param name="TableName">表名</param>
-        /// <param name="Fields">查询字段</param>
-        /// <param name="CurrentPage">当前页面</param>
-        /// <param name="PageSize">页面展示条数</param>
-        /// <param name="Caller"></param>
-        /// <returns></returns>
-        // SELECT * FROM (SELECT   A.*  FROM (SELECT* FROM datalist) A WHERE ROWNUM <= 50) WHERE ROWNUM >= 21
-        public DataTable getFieldsDatasByPageing(string TableName, string Fields, int CurrentPage, int PageSize, string Caller, params string[] condition)
-        {
-            DataTable dt = new DataTable();
-            StringBuilder sql = new StringBuilder();
-            //先查询出配置出去的列
-            //获取查询的列
-            string[] caption = GetCaptionFromField(Fields);
-            //获取对应列的描述
-            string[] field = GetField(Fields);
-            sql.Append(" select * from (select RowNum RN, A.* from (select ");
-            sql.Append(AddField(caption));
-            if (condition.Length > 0)
-            {
-                if (condition[0] != null && condition[0].Trim() != "")
-                    sql.Append(" from " + TableName + " where " + condition[0] + " ) A where ROWNUM <=" + CurrentPage * PageSize + ") where RN>" + (CurrentPage - 1) * PageSize);
-                else
-                    sql.Append(" from " + TableName + ") A where ROWNUM <= " + CurrentPage * PageSize + ") where RN> " + (CurrentPage - 1) * PageSize);
-            }
-            command = new OracleCommand(sql.ToString(), connection);
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
-            ad.Dispose();
-            command.Dispose();
-            dt.Columns.RemoveAt(0);
-            foreach (DataColumn dc in dt.Columns)
-            {
-                dc.ColumnName = field[dt.Columns.IndexOf(dc)];
-                dc.Caption = caption[dt.Columns.IndexOf(dc)];
-            }
-            return dt;
-        }
-
-        /// <summary>
-        /// 通过表名,字段和条件获取DataTable类型的数据
-        /// </summary>
-        public DataTable getFieldsDatasByCondition(string TableName, string[] Fields, string Condition)
-        {
-            DataTable dt = new DataTable();
-            string sql = "select ";
-            sql += AddField(Fields);
-            sql += " from " + TableName + " where " + Condition;
-            command = new OracleCommand(sql, connection);
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
-            ad.Dispose();
-            command.Dispose();
-            return dt;
-        }
-
-        /// <summary>
-        /// 通过表名,字段获取DataTable类型的数据
-        /// </summary>
-        public DataTable getFieldsDatas(string TableName, string Fields)
-        {
-            DataTable dt = new DataTable();
-            string sql = "select ";
-            sql += Fields;
-            sql += " from " + TableName;
-            command = new OracleCommand(sql, connection);
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.SelectCommand = command;
-            ad.Fill(dt);
-            foreach (DataColumn dc in dt.Columns)
-            {
-                dc.Caption = "测试测试";
-            }
-            ad.Dispose();
-            command.Dispose();
-            return dt;
-        }
-
-        /// <summary>
-        /// 根据DataTable和指定的表名更新数据,如果需要保存新增的数据则需要传递一条Insert的SQL
-        /// </summary>
-        /// <param name="DataTable"></param>
-        /// <param name="TableName"></param>
-        /// <param name="Condition"></param>
-        public void UpDateTableByCondition(DataTable DataTable, string TableName, string PrimaryKey, params string[] sql)
-        {
-            if (DataTable == null)
-            {
-                return;
-            }
-            StringBuilder sb = new StringBuilder();
-            //预防插入的DataTable中存在不属于该表的列,在进行下一步操作之前全部剔除
-            DataTable data = (DataTable)ExecuteSql("select Column_Name,Data_Type from cols where TABLE_name=upper('" + TableName + "')", "select");
-            //将所有的字段拼接起来
-            for (int i = 0; i < data.Rows.Count; i++)
-            {
-                sb.Append("#" + data.Rows[i]["Column_Name"].ToString());
-            }
-            //移除掉所有不属于该表的列
-            for (int i = DataTable.Columns.Count - 1; i >= 0; i--)
-            {
-                if (!sb.ToString().Contains(DataTable.Columns[i].ColumnName.ToUpper()))
-                {
-                    DataTable.Columns.RemoveAt(i);
-                }
-            }
-            sb.Clear();
-            //计算有多少个是新加的行,根据主键为空来进行判断
-            int NewRowCount = 0;
-            for (int i = 0; i < DataTable.Rows.Count; i++)
-            {
-                if (DataTable.Rows[i][PrimaryKey] == null || DataTable.Rows[i][PrimaryKey].ToString() == "")
-                {
-                    NewRowCount = NewRowCount + 1;
-                }
-            }
-            if (sql.Length > 0)
-            {
-                if (NewRowCount > 0)
-                {
-                    //获取参数的个数
-                    int paramsNum = sql[0].Split(':').Length - 1;
-                    //解析参数的数据
-                    string[] param = GetParamFromSQL(sql[0]);
-                    //新建一个二维数组去
-                    string[][] param_array = new string[paramsNum][];
-                    //实例化每个一维数组
-                    for (int i = 0; i < paramsNum; i++)
-                    {
-                        param_array[i] = new string[NewRowCount];
-                    }
-                    //设置每列参数的索引
-                    int num = 0;
-                    //变量所有的行,如果有主键为空的则移除,不为空的进行参数的拼接
-                    for (int i = DataTable.Rows.Count - 1; i >= 0; i--)
-                    {
-                        if (DataTable.Rows[i][PrimaryKey] == null || DataTable.Rows[i][PrimaryKey].ToString() == "")
-                        {
-                            //当为新添加行的时候才去设置参数,设置过后索引+1
-                            for (int j = 0; j < paramsNum; j++)
-                            {
-                                param_array[j][num] = DataTable.Rows[i][param[j]].ToString();
-                            }
-                            DataTable.Rows.RemoveAt(i);
-                            num++;
-                        }
-                    }
-                    BatchInsertDataTable(sql[0], param, param_array);
-                }
-            }
-            //不是新增行的启用更新的方法
-            sb.Append("update " + TableName + " set ");
-            //拼接语句,特殊处理日期
-
-            foreach (DataColumn dc in DataTable.Columns)
-            {
-                if (!dc.DataType.ToString().Equals("System.DateTime"))
-                {
-                    sb.Append(dc.Caption + "=:" + dc.Caption + ",");
-                }
-                else
-                {
-                    sb.Append(dc.Caption + "=:" + dc.Caption + ",");
-                }
-            }
-            sb.Remove(sb.Length - 1, 1);
-            sb.Append(" where " + PrimaryKey + "=:" + PrimaryKey);
-            command = new OracleCommand(sb.ToString(), connection);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            // 参数的长度是DataTable的行数决定的
-            command.ArrayBindCount = DataTable.Rows.Count;
-            //默认全部是Varchar2类型的
-            OracleDbType ob = OracleDbType.Varchar2;
-            for (int i = 0; i < DataTable.Columns.Count; i++)
-            {
-                object[] param = new object[DataTable.Rows.Count];
-                for (int j = 0; j < DataTable.Rows.Count; j++)
-                {
-                    DateTime dt = DateTime.Now;
-                    if (DateTime.TryParse(DataTable.Rows[j][i].ToString(), out dt))
-                    {
-                        param[j] = dt;
-                        ob = OracleDbType.Date;
-                    }
-                    else
-                    {
-                        ob = OracleDbType.Varchar2;
-                        param[j] = DataTable.Rows[j][i];
-                    }
-                }
-                //添加批量更新的参数
-                command.Parameters.Add(new OracleParameter(DataTable.Columns[i].Caption, ob, param, ParameterDirection.Input));
-            }
-            ad.UpdateCommand = command;
-            ad.Update(DataTable);
-            ad.Dispose();
-            command.Dispose();
-        }
-
-        /// <summary>
-        /// 获取DbFind的数据的DataTable的结构
-        /// </summary>
-        /// <param name="field"></param>
-        /// <param name="caller"></param>
-        /// <returns></returns>
-        public DataTable GetDbFindDataTable(string field, string caller)
-        {
-            string sql = "select * from dbfindsetui where ds_caller='" + caller + "' and ds_whichui='" + field + "'";
-            DataTable dt = (DataTable)ExecuteSql(sql, "select");
-            if (dt.Rows.Count != 0)
-            {
-                //通过#号分割字段
-                string[] dbfield = dt.Rows[0]["ds_findtoui"].ToString().Split('#');
-                string[] cnfield = dt.Rows[0]["ds_dbcaption"].ToString().Split('#');
-                //获取查询要查询的Table
-                string dbtable = dt.Rows[0]["ds_tables"].ToString();
-                //拼接查询的字段
-                for (int i = 0; i < dbfield.Length; i++)
-                {
-                    dbfield[i] = dbfield[i].Split(',')[0];
-                }
-                //新建一个空的DataTable
-                DataTable dt1 = new DataTable();
-                //往空的DataTable添加结构,ColumnName是中文,Caption是实际的字段名称
-                for (int i = 0; i < cnfield.Length; i++)
-                {
-                    dt1.Columns.Add(cnfield[i]);
-                    dt1.Columns[i].Caption = dbfield[i];
-                }
-                //返回一个带有结构的空的DataTable
-                //DbFind.BindTable1 = dbtable;
-                return dt1;
-            }
-            else
-            {
-                return null;
-            }
-        }
-
-        /// <summary>
-        ///  获取配置列表中的数据,支持DaatList,Form,DetailGrid
-        /// </summary>
-        /// <param name="Caller"></param>
-        /// <param name="Type"></param>
-        /// <param name="condition"></param>
-        /// <returns></returns>
-        public DataTable GetConfigureData(string Caller, string Type, string condition)
-        {
-            DataTable dt = new DataTable();
-            //用于拼接SQL语句
-            StringBuilder Sql = new StringBuilder();
-            //用于设置不同Type时设置对应表的字段
-            string getField = "";
-            string getCaption = "";
-            string getTable = "";
-            switch (Type.ToUpper())
-            {
-                case "DATALIST":
-                    getField = "dld_field"; getCaption = "dld_caption"; getTable = "dld_table";
-                    Sql.Append("select * from datalistdetail where dld_caller='" + Caller + "'");
-                    break;
-                case "FORM":
-                    getField = "fd_field"; getCaption = "fd_caption"; getTable = "fd_table";
-                    Sql.Append("select * from formdetail where fd_foid=( select fo_id from form where fo_caller='" + Caller + "')");
-                    break;
-                case "DETAILGRID":
-                    getField = "dg_field"; getCaption = "dg_caption"; getTable = "dg_table";
-                    Sql.Append("select * from detailgrid  where dg_caller='" + Caller + "'");
-                    break;
-            }
-            command = new OracleCommand(Sql.ToString(), connection);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
-            //清除掉之前的内容重新拼接
-            Sql.Clear();
-            Sql.Append("select ");
-            string[] field = new string[dt.Rows.Count];
-            string[] caption = new string[dt.Rows.Count];
-            DataTable dt1 = new DataTable();
-            //记录描述和字段名称
-            foreach (DataRow dr in dt.Rows)
-            {
-                field[dt.Rows.IndexOf(dr)] = dr[getCaption].ToString();
-                caption[dt.Rows.IndexOf(dr)] = dr[getField].ToString();
-                Sql.Append(dr[getField] + ",");
-            }
-            //调用substring是为了去除之前拼接多出来的一个逗号
-            string sql = Sql.Remove(Sql.Length - 1, 1).ToString() + " from " + dt.Rows[0][getTable] + " where " + condition;
-            //调用一个新的构造DataTable用来存放返回的数据
-            dt1 = (DataTable)ExecuteSql(sql, "select");
-            //给DataTable加上列名和描述,列名是中文字段,描述是数据库实际的字段名称
-            for (int i = 0; i < field.Length; i++)
-            {
-                dt1.Columns[i].ColumnName = field[i];
-                dt1.Columns[i].Caption = caption[i];
-            }
-            //返回的第一条数据是SQL,后面的是实际的列名
-            ad.Dispose();
-            command.Dispose();
-            return dt1;
-        }
-
-        /// <summary>
-        /// 查询配置的字段,Type是查询DataList,Form还是DetailGrid
-        /// </summary>
-        /// <param name="Caller"></param>
-        /// <param name="Type"></param>
-        /// <returns></returns>
-        public DataTable GetConfigureData(string Caller, string Type)
-        {
-            DataTable dt = new DataTable();
-            //用于拼接SQL语句
-            StringBuilder Sql = new StringBuilder();
-            //用于设置不同Type时设置对应表的字段
-            string getField = "";
-            string getCaption = "";
-            string getTable = "";
-            switch (Type.ToUpper())
-            {
-                case "DATALIST":
-                    getField = "dld_field"; getCaption = "dld_caption"; getTable = "dld_table";
-                    Sql.Append("select * from datalistdetail where dld_caller='" + Caller + "'");
-                    break;
-                case "FORM":
-                    getField = "fd_field"; getCaption = "fd_caption"; getTable = "fd_table";
-                    Sql.Append("select * from formdetail where fd_foid=( select fo_id from form where fo_caller='" + Caller + "')");
-                    break;
-                case "DETAILGRID":
-                    getField = "dg_field"; getCaption = "dg_caption"; getTable = "dg_table";
-                    Sql.Append("select * from detailgrid  where dg_caller='" + Caller + "'");
-                    break;
-            }
-            command = new OracleCommand(Sql.ToString(), connection);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
-            //清除掉之前的内容重新拼接
-            Sql.Clear();
-            Sql.Append("select ");
-            //用于记录实际的列名,+1的目的是为了存放SQL
-            string[] field = new string[dt.Rows.Count];
-            string[] caption = new string[dt.Rows.Count];
-            DataTable dt1 = new DataTable();
-            foreach (DataRow dr in dt.Rows)
-            {
-                field[dt.Rows.IndexOf(dr)] = dr[getCaption].ToString();
-                caption[dt.Rows.IndexOf(dr)] = dr[getField].ToString();
-                Sql.Append(dr[getField] + ",");
-            }
-            string sql = Sql.Remove(Sql.Length - 1, 1).ToString() + " from " + dt.Rows[0][getTable];
-            dt1 = (DataTable)ExecuteSql(sql, "select");
-            //设置DataTable的列名和描述
-            for (int i = 0; i < field.Length; i++)
-            {
-                dt1.Columns[i].ColumnName = field[i];
-                dt1.Columns[i].Caption = caption[i];
-            }
-            ad.Dispose();
-            command.Dispose();
-            return dt1;
-        }
-
-        /// <summary>
-        /// 检测内容是否存在
-        /// </summary>
-        /// <param name="TableName"></param>
-        /// <param name="Condition"></param>
-        /// <returns></returns>
-        public bool CheckExist(string TableName, string Condition)
-        {
-            string sql = "select count(1) from " + TableName + " where " + Condition;
-            command = new OracleCommand(sql, connection);
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            DataTable dt = new DataTable();
-            ad.Fill(dt);
-            ad.Dispose();
-            command.Dispose();
-            return int.Parse(dt.Rows[0][0].ToString()) > 0;
-        }
-
-        /// <summary>
-        /// 直接执行SQL,同时传入SQL的类型
-        /// </summary>
-        /// <param name="SQL"></param>
-        /// <param name="Type"></param>
-        /// <returns></returns>
-        public object ExecuteSql(string SQL, string Type, params object[] names)
-        {
-            object result = null;
-            command = new OracleCommand(SQL, connection);
-            Reconnect(command);
-            //用来拼接参数的
-            if (names.Length > 0)
-            {
-                string[] par = SQL.Split(':');
-                //用来存参数的数组
-                StringBuilder[] addpar = new StringBuilder[par.Length - 1];
-                for (int i = 0; i < par.Length - 1; i++)
-                {
-                    //新建一个char类型的数组用来存储每个字节的变量
-                    char[] c = par[i + 1].ToCharArray();
-                    addpar[i] = new StringBuilder();
-                    for (int j = 0; j < c.Length; j++)
-                    {
-                        if (c[j] != ' ' && c[j] != ',')
-                        {
-                            addpar[i].Append(c[j]);
-                        }
-                        else
-                        {
-                            break;
-                        }
-                    }
-                }
-                for (int i = 0; i < addpar.Length; i++)
-                    command.Parameters.Add(new OracleParameter(addpar[i].ToString(), OracleDbType.Varchar2, names[i], ParameterDirection.Input));
-            }
-            switch (Type.ToUpper())
-            {
-                case "SELECT":
-                    result = new DataTable();
-                    OracleDataAdapter ad = new OracleDataAdapter(command);
-                    ad.Fill((DataTable)result);
-                    ad.Dispose();
-                    break;
-                case "DELETE":
-                    result = command.ExecuteNonQuery();
-                    break;
-                case "UPDATE":
-                    result = command.ExecuteNonQuery();
-                    break;
-                case "INSERT":
-                    result = command.ExecuteNonQuery();
-                    break;
-            }
-            command.Dispose();
-            return result;
-        }
-
-        /// <summary>
-        /// 为了同步BS端的条码维护,检测时允许问号的存在,在检测时默认将问号换成:Param参数
-        /// </summary>
-        /// <param name="SQL"></param>
-        public void CheckSQL(string SQL)
-        {
-            SQL = SQL.Replace("?", ":Param");
-            command = new OracleCommand(SQL, connection);
-            command.ExecuteNonQuery();
-            command.Dispose();
-        }
-
-        public int GetDistinctRowCount(string TableName, string Field)
-        {
-            DataTable dt = new DataTable();
-            string sql = "select distinct count('" + Field + "') from " + TableName;
-            command = new OracleCommand(sql, connection);
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
-            ad.Dispose();
-            command.Dispose();
-            return int.Parse(dt.Rows[0][0].ToString());
-        }
-
-        /// <summary>
-        /// 根据Caller获取流水号
-        /// </summary>
-        /// <param name="Caller"></param>
-        /// <returns></returns>
-        public string GetSerialNumberByCaller(string Caller)
-        {
-            string SerialNumber = getFieldDataByCondition("MaxNumbers", "mn_number", "mn_tablename='" + Caller + "'").ToString();
-            UpdateByCondition("MaxNumbers", "mn_number=mn_number+1", "mn_tablename='" + Caller + "'");
-            return SerialNumber;
-        }
-
-        /// <summary>
-        /// 根据主键ID删除表的数据
-        /// </summary>
-        /// <param name="TableName">表名</param>
-        /// <param name="ID">主键</param>
-        /// <param name="DeleteID">需要删除主键ID的数组</param>
-        public void DeleteDataByID(string TableName, string ID, string[] DeleteID)
-        {
-            string sql = "delete from " + TableName + " where " + ID + " =:DeleteID";
-            command = new OracleCommand(sql, connection);
-            Reconnect(command);
-            command.ArrayBindCount = DeleteID.Length;
-            command.Parameters.Add(new OracleParameter("DeleteID", OracleDbType.Long, DeleteID, ParameterDirection.Input));
-            command.ExecuteNonQuery();
-            command.Dispose();
-        }
-
-        /// <summary>
-        /// 通过序列的名称获取序列
-        /// </summary>
-        /// <param name="SeqName"></param>
-        /// <returns></returns>
-        public string GetSEQ(string SeqName)
-        {
-            DataTable dt = new DataTable();
-            dt = (DataTable)ExecuteSql("SELECT " + SeqName + ".NEXTVAL FROM DUAL", "select");
-            return dt.Rows[0][0].ToString();
-        }
-
-        public void SaveDataTable(DataTable dt, string TableName, string ID, params string[] sql)
-        {
-            if (dt == null)
-            {
-                return;
-            }
-            StringBuilder sb = new StringBuilder();
-            //预防插入的DataTable中存在不属于该表的列,在进行下一步操作之前全部剔除
-            DataTable data = (DataTable)ExecuteSql("select Column_Name,Data_Type from cols where TABLE_name=upper('" + TableName + "')", "select");
-            //将所有的字段拼接起来
-            for (int i = 0; i < data.Rows.Count; i++)
-            {
-                sb.Append("#" + data.Rows[i]["Column_Name"].ToString());
-            }
-            //移除掉所有不属于该表的列
-            for (int i = dt.Columns.Count - 1; i >= 0; i--)
-            {
-                if (!sb.ToString().Contains(dt.Columns[i].ColumnName.ToUpper()))
-                {
-                    dt.Columns.RemoveAt(i);
-                }
-            }
-            sb.Clear();
-            //计算有多少个是新加的行,根据主键为空来进行判断
-            int NewRowCount = 0;
-            for (int i = 0; i < dt.Rows.Count; i++)
-            {
-                if (dt.Rows[i][ID] == null || dt.Rows[i][ID].ToString() == "")
-                {
-                    NewRowCount = NewRowCount + 1;
-                }
-            }
-            if (sql.Length > 0)
-            {
-                if (NewRowCount > 0)
-                {
-                    //获取参数的个数
-                    int paramsNum = sql[0].Split(':').Length - 1;
-                    //解析参数的数据
-                    string[] param = GetParamFromSQL(sql[0]);
-                    //新建一个二维数组去
-                    string[][] param_array = new string[paramsNum][];
-                    //实例化每个一维数组
-                    for (int i = 0; i < paramsNum; i++)
-                    {
-                        param_array[i] = new string[NewRowCount];
-                    }
-                    //设置每列参数的索引
-                    int num = 0;
-                    //变量所有的行,如果有主键为空的则移除,不为空的进行参数的拼接
-                    for (int i = dt.Rows.Count - 1; i >= 0; i--)
-                    {
-                        if (dt.Rows[i][ID] == null || dt.Rows[i][ID].ToString() == "")
-                        {
-                            //当为新添加行的时候才去设置参数,设置过后索引+1
-                            for (int j = 0; j < paramsNum; j++)
-                            {
-                                param_array[j][num] = dt.Rows[i][param[j]].ToString();
-                            }
-                            dt.Rows.RemoveAt(i);
-                            num++;
-                        }
-                    }
-                    BatchInsertDataTable(sql[0], param, param_array);
-                }
-            }
-            sb.Clear();
-            sb.Append("update " + TableName + " set ");
-            int ColumnCount = dt.Columns.Count;
-            int RowCount = dt.Rows.Count;
-            //存数据的参数
-            List<string[]> Parameter = new List<string[]>();
-            //存参数名的参数
-            string[] ParName = new string[ColumnCount];
-            for (int i = 0; i < ColumnCount; i++)
-            {
-                ParName[i] = dt.Columns[i].ColumnName;
-                if (i == dt.Columns.Count - 1)
-                    sb.Append(dt.Columns[i].ColumnName + "=:" + dt.Columns[i].ColumnName);
-                else
-                    sb.Append(dt.Columns[i].ColumnName + "=:" + dt.Columns[i].ColumnName + ",");
-            }
-            sb.Append(" where " + ID + " =:" + ID);
-            //先添加参数
-            Parameter.Add(ParName);
-            //添加参数的具体内容
-            for (int i = 0; i < ColumnCount; i++)
-            {
-                string[] par = new string[RowCount];
-                for (int j = 0; j < RowCount; j++)
-                {
-                    par[j] = dt.Rows[j][i].ToString();
-                }
-                Parameter.Add(par);
-            }
-            BatchInsert(sb.ToString(), Parameter.ToArray());
-        }
-
-        /// <summary>
-        /// 批量通过SQL来执行插入操作 ,参数的第一个数一个string[]数组,用来传递需要添加的参数的名称
-        /// 之后的是名称参数数组对应的 ,所有的插入参数数据长度必须是一致的
-        /// </summary>
-        /// <param name="sql"></param>
-        /// <param name="names"></param>
-        public void BatchInsert(string sql, params object[][] names)
-        {
-            command = new OracleCommand(sql, connection);
-            Reconnect(command);
-            command.ArrayBindCount = names[1].Length;
-            //因为第一个数组保存的是参数的名称,所以循环从1而不是0开始
-            //将第一个数组的下标固定为0作为循环添加的参数的名称
-            for (int i = 1; i <= names[0].Length; i++)
-            {
-                command.Parameters.Add(new OracleParameter(names[0][i - 1].ToString(), OracleDbType.Varchar2, names[i], ParameterDirection.Input));
-            }
-            command.ExecuteNonQuery();
-            command.Dispose();
-        }
-
-        public void BatchInsertDataTable(string sql, string[] param, params object[][] param1)
-        {
-            command = new OracleCommand(sql, connection);
-            Reconnect(command);
-            command.ArrayBindCount = param1[0].Length;
-            //因为第一个数组保存的是参数的名称,所以循环从1而不是0开始
-            //将第一个数组的下标固定为0作为循环添加的参数的名称
-            for (int i = 0; i < param.Length; i++)
-            {
-                command.Parameters.Add(new OracleParameter(param[i].ToString(), OracleDbType.Varchar2, param1[i], ParameterDirection.Input));
-            }
-            command.ExecuteNonQuery();
-            command.Dispose();
-        }
-
-
-        /// <summary>
-        /// 查询DataList配置的字段
-        /// </summary>
-        /// <param name="TableName"></param>
-        /// <param name="Caller"></param>
-        /// <returns></returns>
-        public string GetDataList(string TableName, string Caller)
-        {
-            DataTable dt = new DataTable();
-            string SQL = " select listagg(dld_field,',') within group (order by dld_id)  from datalistdetail where dld_caller='" + Caller + "'";
-            command = new OracleCommand(SQL, connection);
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter(command);
-            ad.Fill(dt);
-            ad.Dispose();
-            command.Dispose();
-            return dt.Rows[0][0].ToString();
-        }
-
-        /// <summary>
-        /// 取Configs表中的配置,进行该客户是否执行某个操作
-        /// </summary>
-        /// <param name="Code"></param>
-        /// <param name="Caller"></param>
-        /// <returns></returns>
-        public object GetConfig(string Code, string Caller)
-        {
-            DataTable dt = new DataTable();
-            string sql = "select Data from configs where code='" + Code + "' and caller='" + Caller + "'";
-            dt = (DataTable)ExecuteSql(sql, "select");
-            if (dt.Rows.Count == 0)
-            {
-                return "";
-            }
-            else
-            {
-                return dt.Rows[0]["Data"];
-            }
-        }
-
-
-        //将数据类型的列类型转换为DataTable
-        public DataTable DataTypeColumnToDataTable(DataTable dt)
-        {
-            DataTable dt1 = new DataTable();
-            dt1.Rows.Add();
-            foreach (DataRow dr in dt.Rows)
-            {
-                dt1.Columns.Add(dr[0].ToString());
-                int index = dt.Rows.IndexOf(dr);
-                if (dr[1].ToString() == "NUMBER")
-                {
-                    dt1.Rows[0][index] = 0;
-                }
-                if (dr[1].ToString() == "VARCHAR2")
-                {
-                    dt1.Rows[0][index] = "这是一段文字";
-                }
-                if (dr[1].ToString() == "DATE")
-                {
-                    dt1.Rows[0][index] = DateTime.Now.ToString("yyyy-MM-dd");
-                }
-                if (dr[1].ToString() == "FLOAT")
-                {
-                    dt1.Rows[0][index] = 1.0;
-                }
-                if (dr[1].ToString() == "CLOB")
-                {
-                    dt1.Rows[0][index] = "一段长文字";
-                }
-            }
-            return dt1;
-        }
-
-
-        /// <summary>
-        /// 通过条件更新
-        /// </summary>
-        /// <param name="TableName"></param>
-        /// <param name="update"></param>
-        /// <param name="condition"></param>
-        public string UpdateByCondition(string TableName, string update, string condition)
-        {
-            string sql = "update " + TableName + " set " + update + " where " + condition;
-            command = new OracleCommand(sql, connection);
-            Reconnect(command);
-            command.ExecuteNonQuery();
-            command.Dispose();
-            return sql;
-        }
-
-        /// <summary>
-        /// 调用存储过程
-        /// </summary>
-        /// <param name="ProcedureName"></param>    
-        /// <param name="param"></param>
-        public void CallProcedure(string ProcedureName, ref string[] param)
-        {
-            command = new OracleCommand(ProcedureName);
-            command.Connection = connection;
-            Reconnect(command);
-            command.CommandText = ProcedureName;
-            command.CommandType = CommandType.StoredProcedure;
-            for (int i = 0; i < param.Length; i++)
-                command.Parameters.Add(new OracleParameter(param[i].ToString(), OracleDbType.Varchar2, 200, param[i], ParameterDirection.InputOutput));
-            command.ExecuteNonQuery();
-            for (int i = 0; i < command.Parameters.Count; i++)
-                param[i] = command.Parameters[i].Value.ToString();
-            command.Dispose();
-        }
-
-        /// <summary>
-        /// 出现异常进行回滚的执行方法
-        /// </summary>
-        /// <param name="SQL"></param>
-        public void ExecuteSQLTran(params string[] SQL)
-        {
-            OracleTransaction tx = connection.BeginTransaction();
-            command = new OracleCommand();
-            command.Connection = connection;
-            command.Transaction = tx;
-            try
-            {
-                foreach (string sql in SQL)
-                {
-                    if (!string.IsNullOrEmpty(sql))
-                    {
-                        command.CommandText = sql;
-                        command.ExecuteNonQuery();
-                    }
-                }
-                tx.Commit();
-            }
-            catch (System.Data.OracleClient.OracleException E)
-            {
-                tx.Rollback();
-                throw new Exception(E.Message);
-            }
-            command.Dispose();
-        }
-
-        /// <summary>
-        /// 用于将string 的数组转换成SQL的查询内容
-        /// </summary>
-        /// <param name="Fields"></param>
-        /// <returns></returns>
-        private string AddField(string[] Fields)
-        {
-            string sql = " ";
-            foreach (string field in Fields)
-            {
-                sql += field + ",";
-            }
-            return sql.Substring(0, sql.Length - 1);
-        }
-        /// <summary>
-        /// 通过查询的内容获取到字段的描述
-        /// </summary>
-        /// <param name="field"></param>
-        /// <returns></returns>
-        private static string[] GetCaptionFromField(string field)
-        {
-            string[] caption = field.Split(',');
-            for (int i = 0; i < caption.Length; i++)
-            {
-                caption[i] = caption[i].Substring(0, caption[i].LastIndexOf("as")).Trim();
-            }
-            return caption;
-        }
-
-        /// <summary>
-        /// 通过查询的语句获取查询的字段
-        /// </summary>
-        /// <param name="field"></param>
-        /// <returns></returns>
-        private static string[] GetField(string field)
-        {
-            string[] fields = field.Split(',');
-            for (int i = 0; i < fields.Length; i++)
-            {
-                fields[i] = fields[i].Substring(fields[i].LastIndexOf("as") + 2, fields[i].Length - fields[i].LastIndexOf("as") - 2).Trim();
-            }
-            return fields;
-        }
-
-        public object GetLabelParam(string sql)
-        {
-            DataTable dt = new DataTable();
-            command = new OracleCommand(sql, connection);
-            Reconnect(command);
-            OracleDataAdapter ad = new OracleDataAdapter();
-            ad.SelectCommand = command;
-            ad.Fill(dt);
-            if (dt.Rows.Count > 0)
-            {
-                ad.Dispose();
-                command.Dispose();
-                return dt.Rows[0][0];
-            }
-            else
-            {
-                command.Dispose();
-                return "";
-            }
-        }
-
-        public static string[] GetParamFromSQL(string SQL)
-        {
-            string[] par = SQL.Split(':');
-            //用来存参数的数组
-            StringBuilder[] addpar = new StringBuilder[par.Length - 1];
-            string[] param = new string[par.Length - 1];
-            for (int i = 0; i < par.Length - 1; i++)
-            {
-                //新建一个char类型的数组用来存储每个字节的变量
-                char[] c = par[i + 1].ToCharArray();
-                addpar[i] = new StringBuilder();
-                for (int j = 0; j < c.Length; j++)
-                {
-                    if (c[j] != ' ' && c[j] != ',' && c[j] != ')')
-                    {
-                        addpar[i].Append(c[j]);
-                    }
-                    else
-                    {
-                        break;
-                    }
-                }
-            }
-            for (int i = 0; i < par.Length - 1; i++)
-            {
-                param[i] = addpar[i].ToString();
-            }
-            return param;
-        }
-
-        private void Reconnect(OracleCommand cmd)
-        {
-            if (cmd.Connection.State == ConnectionState.Closed)
-            {
-                cmd.Connection.Open();
-            }
-        }
-    }
-}

+ 0 - 524
MES接口/LogicHandler.cs

@@ -1,524 +0,0 @@
-using System.Collections.Generic;
-using System.Data;
-using System.Text;
-
-namespace MES_Interface
-{
-    public class LogicHandler
-    {
-        public LogicHandler(string Environment)
-        {
-            dh = new DataHelper(Environment);
-        }
-
-        DataHelper dh;
-        //用于拼接SQL
-        StringBuilder sql = new StringBuilder();
-        //用于存放批量执行的SQL
-        List<string> sqls = new List<string>();
-
-        /// <summary>
-        /// 检测当前的岗位资源对应的工序
-        /// </summary>
-        /// <param name="iSnCode"></param>
-        /// <param name="iMakeCode"></param>
-        /// <param name="iSourceCode"></param>
-        /// <param name="oErrMessage"></param>
-        /// <returns></returns>
-        public bool CheckCurrentStep(string iSnCode, string iMakeCode, string iSourceCode, string iUserCode, out string oMacode, out string oMSID, out string oErrMessage)
-        {
-            oErrMessage = "";
-            oMSID = "";
-            oMacode = "";
-            string[] param = new string[] { iMakeCode, iSourceCode, iSnCode, iUserCode, oMacode, oMSID, oErrMessage };
-            dh.CallProcedure("CS_CHECKSTEPSNANDMACODE", ref param);
-            oMacode = param[4];
-            oMSID = param[5];
-            oErrMessage = param[6];
-            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
-                return true;
-            else
-                return false;
-        }
-
-        /// <summary>
-        /// 验证用户身份信息
-        /// </summary>
-        /// <param name="iUserCode"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public bool CheckUserLogin(string iUserCode, string iPassWord, out string oErrorMessage)
-        {
-            oErrorMessage = "";
-            string SQL = "select em_code from employee where em_code=:UserName and em_password =:PassWord";
-            DataTable dt;
-            dt = (DataTable)dh.ExecuteSql(SQL, "select", iUserCode, iPassWord);
-            if (dt.Rows.Count > 0)
-                return true;
-            else
-            {
-                oErrorMessage = "用户名或者密码不正确!";
-                return false;
-            }
-        }
-
-        /// <summary>
-        /// 验证用户身份信息和岗位资源
-        /// </summary>
-        /// <param name="iUserCode"></param>
-        /// <param name="iPassWord"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public bool CheckUserAndResourcePassed(string iUserCode, string iSourceCode, out string oErrorMessage)
-        {
-            oErrorMessage = "";
-            string SQL = "select em_code,em_type,em_name from employee where em_code=:UserName ";
-            DataTable dt;
-            dt = (DataTable)dh.ExecuteSql(SQL, "select", iUserCode);
-            if (dt.Rows.Count > 0)
-            {
-                string em_name = dt.Rows[0]["em_name"].ToString();
-                string em_type = dt.Rows[0]["em_type"].ToString();
-                if (iSourceCode == "")
-                {
-                    oErrorMessage = "岗位资源不允许为空";
-                    return false;
-                }
-                if (em_type == "admin")
-                {
-                    if (dh.CheckExist("Source", "sc_code='" + iSourceCode + "' and sc_statuscode='AUDITED'"))
-                    {
-                        return true;
-                    }
-                    else
-                    {
-                        oErrorMessage = "岗位资源编号错误或者未审核!";
-                        return false;
-                    }
-                }
-                else
-                {
-                    dt = dh.getFieldsDatasByCondition("cs$empgroup left join cs$userresource on ur_groupcode=eg_groupcode left join source on ur_resourcecode=sc_code", new string[] { "ur_resourcecode" }, "eg_emcode = '" + iUserCode + "' and sc_statuscode='AUDITED'");
-                    //如果存在该编号
-                    if (dt.Rows.Count > 0)
-                    {
-                        //判断如果多个岗位资源存在,用户输入的只要在其中就行
-                        for (int i = 0; i < dt.Rows.Count; i++)
-                        {
-                            if (dt.Rows[i]["ur_resourcecode"].ToString() == iSourceCode)
-                                return true;
-                        }
-                        oErrorMessage = "用户不处于当前资源所属分组!";
-                    }
-                    else
-                        oErrorMessage = "岗位资源编号错误或者未审核!";
-                }
-            }
-            else
-                oErrorMessage = "用户不存在!";
-            return false;
-        }
-
-        /// <summary>
-        /// 分配Mac地址和BT地址
-        /// </summary>
-        /// <param name="iSnCode"></param>
-        /// <param name="iMakeCode"></param>
-        /// <param name="oMac"></param>
-        /// <param name="oBT"></param>
-        /// <param name="oCode1"></param>
-        /// <param name="oCode2"></param>
-        /// <param name="oCdoe3"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public bool GetAddressRangeByMakeCode(string iSnCode, string iMakeCode, out string oMac, out string oBT, out string oCode1, out string oCode2, out string oCdoe3, out string oErrorMessage)
-        {
-            oMac = "";
-            oBT = "";
-            oCode1 = "";
-            oCode2 = "";
-            oCdoe3 = "";
-            oErrorMessage = "";
-            string[] param = new string[] { iSnCode, iMakeCode, oMac, oBT, oCode1, oCode2, oCdoe3, oErrorMessage };
-            dh.CallProcedure("CS_GETADDRESSBYMAKECODE", ref param);
-            oMac = param[2];
-            oBT = param[3];
-            oCode1 = param[4];
-            oCode2 = param[5];
-            oCdoe3 = param[6];
-            oErrorMessage = param[7];
-            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
-                return true;
-            else
-                return false;
-        }
-
-        /// <summary>
-        /// 输入的 SN 号查找在制品是否有 IMEI 信息存在,如果存在则将 IMEI 信息传出,如果没有则在该工单下未使用的 IMEI 中随机分配一组
-        /// 如果iIMEI1、iNetCode不为空,则分别作为获取的附件加条件。
-        /// </summary>
-        /// <param name="iSN"></param>
-        /// <param name="iMO"></param>
-        /// <param name="iIMEI1"></param>
-        /// <param name="iNetCode"></param>
-        /// <param name="oIMEI1"></param>
-        /// <param name="oIMEI2"></param>
-        /// <param name="oIMEI3"></param>
-        /// <param name="oMEID"></param>
-        /// <param name="oNetCode"></param>
-        /// <param name="oPSN"></param>
-        /// <param name="oMac"></param>
-        /// <param name="oBT"></param>
-        /// <param name="oID1"></param>
-        /// <param name="oID2"></param>
-        /// <param name="oID3"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public bool GetIMEIOrNetCodeRange(string iSnCode, string iMakeCode, string iIMEI1, string iNetCode, out string oIMEI1, out string oIMEI2, out string oIMEI3, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oErrorMessage)
-        {
-            oIMEI1 = "";
-            oIMEI2 = "";
-            oIMEI3 = "";
-            oMEID = "";
-            oNetCode = "";
-            oPSN = "";
-            oID1 = "";
-            oID2 = "";
-            oID3 = "";
-            oErrorMessage = "";
-            string[] param = new string[] { iSnCode, iMakeCode, iIMEI1, iNetCode, oIMEI1, oIMEI2, oIMEI3, oMEID, oNetCode, oPSN, oID1, oID2, oID3, oErrorMessage };
-            dh.CallProcedure("CS_GETIMEIORNETCODERANGE", ref param);
-            oIMEI1 = param[4];
-            oIMEI2 = param[5];
-            oIMEI3 = param[6];
-            oMEID = param[7];
-            oNetCode = param[8];
-            oPSN = param[9];
-            oID1 = param[10];
-            oID2 = param[11];
-            oID3 = param[12];
-            oErrorMessage = param[13];
-            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
-                return true;
-            else
-                return false;
-        }
-
-        /// <summary>
-        /// 获取工单的最近一条执行记录
-        /// </summary>
-        /// <param name="iSnCode"></param>
-        /// <param name="oMakeCode"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public bool GetMakeInfo(string iSnCode, out string oMakeCode, out string oErrorMessage)
-        {
-            //取MakeProcess表中的执行记录ID最大的一个工单的号码
-            oMakeCode = "";
-            oErrorMessage = "";
-            string ms_id = dh.getFieldDataByCondition("MakeSerial", "max(ms_id) ms_id", "ms_sncode='" + iSnCode + "' or ms_firstsn in (select firstsn from makesnrelation where sn='" + iSnCode + "')").ToString();
-            oMakeCode = dh.getFieldDataByCondition("MakeSerial", "ms_makecode", "ms_id='" + ms_id + "'").ToString();
-            if (oMakeCode != "")
-                return true;
-            else
-            {
-                oErrorMessage = "序列号:" + iSnCode + " 未归属工单";
-                return false;
-            }
-        }
-
-        /// <summary>
-        /// 获取序列号的所有串号信息
-        /// </summary>
-        /// <param name="iSnCode"></param>
-        /// <param name="oIMEI1"></param>
-        /// <param name="oIMEI2"></param>
-        /// <param name="oIMEI3"></param>
-        /// <param name="oMEID"></param>
-        /// <param name="oNetCode"></param>
-        /// <param name="oPSN"></param>
-        /// <param name="oMac"></param>
-        /// <param name="oBT"></param>
-        /// <param name="oCode1"></param>
-        /// <param name="oCode2"></param>
-        /// <param name="oCode3"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public bool GetSNAllInfo(string iSnCode, out string oIMEI1, out string oIMEI2, out string oIMEI3, out string oMEID, out string oNetCode, out string oPSN, out string oMac, out string oBT, out string oCode1, out string oCode2, out string oCode3, out string oID1, out string oID2, out string oID3, out string oErrorMessage)
-        {
-            oBT = "";
-            oMEID = "";
-            oMac = "";
-            oPSN = "";
-            oNetCode = "";
-            oIMEI1 = "";
-            oIMEI2 = "";
-            oIMEI3 = "";
-            oCode1 = "";
-            oCode2 = "";
-            oCode3 = "";
-            oID1 = "";
-            oID2 = "";
-            oID3 = "";
-            //通过序列号获取最近操作的工单号
-            string ms_id = dh.getFieldDataByCondition("makeserial", "ms_id", "ms_sncode='" + iSnCode + "'").ToString();
-            if (ms_id != "")
-            {
-                DataTable dt = dh.getFieldsDataByCondition("MakeSerial", new string[] { "ms_id", "ms_mac", "ms_bt", "ms_meid", "ms_netcode", "ms_psn", "ms_imei1", "ms_imei2", "ms_imei3", "ms_othcode1", "ms_othcode2", "ms_othcode3", "ms_othid1", "ms_othid2", "ms_othid3" }, "ms_id='" + ms_id + "'");
-                if (dt.Rows.Count > 0)
-                {
-                    oMac = dt.Rows[0]["ms_mac"].ToString();
-                    oBT = dt.Rows[0]["ms_bt"].ToString();
-                    oPSN = dt.Rows[0]["ms_psn"].ToString();
-                    oNetCode = dt.Rows[0]["ms_netcode"].ToString();
-                    oMEID = dt.Rows[0]["ms_meid"].ToString();
-                    oIMEI1 = dt.Rows[0]["ms_imei1"].ToString();
-                    oIMEI2 = dt.Rows[0]["ms_imei2"].ToString();
-                    oIMEI3 = dt.Rows[0]["ms_imei3"].ToString();
-                    oCode1 = dt.Rows[0]["ms_othcode1"].ToString();
-                    oCode2 = dt.Rows[0]["ms_othcode2"].ToString();
-                    oCode3 = dt.Rows[0]["ms_othcode3"].ToString();
-                    oID1 = dt.Rows[0]["ms_othid3"].ToString();
-                    oID2 = dt.Rows[0]["ms_othid3"].ToString();
-                    oID3 = dt.Rows[0]["ms_othid3"].ToString();
-                    oErrorMessage = "";
-                    return true;
-                }
-                else
-                {
-                    oErrorMessage = "序列号" + iSnCode + "不存在";
-                    return false;
-                }
-            }
-            else
-            {
-                oErrorMessage = "序列号" + iSnCode + "不存在";
-                return false;
-            }
-        }
-
-        /// <summary>
-        /// 记录操作日志
-        /// </summary>
-        /// <param name="iSnCode"></param>
-        /// <param name="iMakeCode"></param>
-        /// <param name="iMPKind"></param>
-        /// <param name="result"></param>
-        /// <param name="iUserCode"></param>
-        private void InsertMakeProcess(string iSnCode, string iMakeCode, string iSourceCode, string iMPKind, string result, string iUserCode)
-        {
-            string CurrentStep = "";
-            string LineCode = "";
-            string CurrentStepName = "";
-            GetStepCodeAndNameAndLineBySource(iSourceCode, ref CurrentStep, ref CurrentStepName, ref LineCode);
-            sql.Clear();
-            sql.Append("insert into MakeProcess(mp_id,mp_makecode,mp_maid, mp_mscode,mp_sncode,mp_stepcode,mp_stepname,");
-            sql.Append("mp_craftcode,mp_craftname,mp_kind,mp_result,mp_indate,mp_inman,mp_wccode,mp_linecode,mp_sourcecode,mp_snstatus,mp_sncheckno,mp_snoutboxcode)");
-            sql.Append("select MakeProcess_seq.nextval, ma_code,ma_id,ms_code,ms_sncode,'" + CurrentStep + "','" + CurrentStepName + "',");
-            sql.Append("ma_craftcode,ma_craftname,'" + iMPKind + "','" + result + "',sysdate,'" + iUserCode + "',ma_wccode,'" + LineCode + "','" + iSourceCode + "',");
-            sql.Append("ms_status,ms_checkno,ms_outboxcode from make left join makeserial on ms_makecode=ma_code left join step on st_code=ms_stepcode ");
-            sql.Append("where ms_sncode='" + iSnCode + "' and ma_code='" + iMakeCode + "' and st_code='" + CurrentStep + "'");
-            dh.ExecuteSql(sql.ToString(), "insert");
-        }
-
-        /// <summary>
-        /// 保存Mac地址和BT地址
-        /// </summary>
-        /// <param name="iSN"></param>
-        /// <param name="iMac"></param>
-        /// <param name="iBT"></param>
-        /// <param name="iCode1"></param>
-        /// <param name="iCode2"></param>
-        /// <param name="iCode3"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public bool SetAddressInfo(string iSN, string iMac, string iBT, string iCode1, string iCode2, string iCode3, out string oErrorMessage)
-        {
-            oErrorMessage = "";
-            string[] param = new string[] { iSN, iMac, iBT, iCode1, iCode2, iCode3, oErrorMessage };
-            dh.CallProcedure("CS_SETADDRESSINFO", ref param);
-            oErrorMessage = param[6];
-            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
-                return true;
-            else
-                return false;
-        }
-
-        private bool SetStepFinish(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, string iErrCode, out string oErrorMessage)
-        {
-            oErrorMessage = "";
-            string StepCode = dh.getFieldDataByCondition("Makeserial", "ms_stepcode", "ms_sncode='" + iSN + "'").ToString();
-            string CurrentStep = GetStepCodeBySource(iSourceCode);
-            switch (iResult)
-            {
-                case "OK":
-                    break;
-                case "NG":
-                    if (iErrCode == "")
-                    {
-                        oErrorMessage = "测试结果为NG时必须传递不良代码";
-                        return false;
-                    }
-                    else
-                    {
-                        string[] BadCode = iErrCode.Split(',');
-                        sql.Clear();
-                        sql.Append("insert into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,mb_indate,mb_stepcode");
-                        sql.Append(",mb_sourcecode,mb_badcode,mb_badtable,mb_soncode,mb_status) select makebad_seq.nextval");
-                        sql.Append(",ma_code,ms_code,ms_sncode,'" + iUserCode + "',sysdate,'" + StepCode + "',ms_sourcecode,:bc_code,'',");
-                        sql.Append("sp_soncode,'0' from make left join makeSerial on ms_makecode=ma_code left join stepProduct on ");
-                        sql.Append("sp_mothercode=ma_prodcode and sp_stepcode=ms_nextstepcode where ms_sncode='" + iSN + "'");
-                        dh.BatchInsert(sql.ToString(), new string[] { "bc_code"}, BadCode);
-                        //将不良的序列号的状态码设为3
-                        dh.ExecuteSql("update makeserial set ms_status='3' where ms_sncode=:sncode","update",iSN);
-                    }
-                    break;
-                default:
-                    oErrorMessage = "测试结果必须为NG或者OK";
-                    return false;
-            }
-        
-            if (StepCode == CurrentStep)
-            {
-                InsertMakeProcess(iSN, iMakeCode, iSourceCode, iMPKind, iResult, iUserCode);
-                return true;
-            }
-            else
-            {
-                return CS_SetFinish(iMakeCode, iSourceCode, iSN, iUserCode, iResult, out oErrorMessage);
-            }
-        }
-
-        /// <summary>
-        /// 设置测试结果
-        /// </summary>
-        /// <param name="iMakeCode"></param>
-        /// <param name="iSourceCode"></param>
-        /// <param name="iSN"></param>
-        /// <param name="iMPKind"></param>
-        /// <param name="iResult"></param>
-        /// <param name="iUserCode"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public bool SetTestResult(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, string iErrCode, out string oErrorMessage)
-        {
-            return SetStepFinish(iMakeCode, iSourceCode, iSN, iMPKind, iResult, iUserCode, iErrCode, out oErrorMessage);
-        }
-
-        private bool CS_SetFinish(string iMakeCode, string iSourceCode, string iSN, string iUserCode,string iResult, out string oErrorMessage)
-        {
-            oErrorMessage = "";
-            string[] param = new string[] { iMakeCode, iSourceCode, iSN, iUserCode, iResult, oErrorMessage };
-            dh.CallProcedure("CS_SETSTEPRESULT", ref param);
-            oErrorMessage = param[5];
-            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
-                return true;
-            else
-                return false;
-        }
-
-        /// <summary>
-        /// 方法说明:测试详细信息录入系统,针对一个SN多个测试项目结果可循环调用
-        /// </summary>
-        /// <param name="iSnCode">序列号</param>
-        /// <param name="iClass"></param>
-        /// <param name="iSubClass1"></param>
-        /// <param name="iSubClass2"></param>
-        /// <param name="iSubClass3"></param>
-        /// <param name="iMaxValue"></param>
-        /// <param name="iMinValue"></param>
-        /// <param name="iActualValue"></param>
-        /// <param name="iValue1"></param>
-        /// <param name="iValue2"></param>
-        /// <param name="iValue3"></param>
-        /// <param name="iTestResult"></param>
-        /// <param name="oErrMessage"></param>                                                      
-        /// <returns></returns>
-        public bool SetTestDetail(string iSnCode, string iMakeCode, string iClass, string iSubClass1, string iSubClass2, string iSubClass3, string iMaxValue, string iMinValue, string iActualValue, string iValue1, string iValue2, string iValue3, string iTestResult, string iSourceCode, out string oErrMessage)
-        {
-            oErrMessage = "";
-            sql.Clear();
-            sql.Append("Insert into STEPTESTDETAIL (STD_ID,STD_SN,STD_MAKECODE,STD_CLASS,STD_SUBCLASS1,STD_SUBCLASS2,");
-            sql.Append("STD_SUBCLASS3,STD_MAXVALUE,STD_MINVALUE,STD_ACTUALVALUE,STD_VALUE1,STD_VALUE2,STD_VALUE3,STD_TESTRESULT,");
-            sql.Append("STD_DATE,STD_RESCODE) values (STEPTESTDETAIL_SEQ.nextval,:std_sn,:std_makecode,");
-            sql.Append(":std_class,:std_subclass1,:std_subclass2,:std_subclass3,:std_maxvalue,:std_minvalue,:std_actualvalue,:std_value1,");
-            sql.Append(":std_value2,:std_value3,:std_testresult,sysdate,:std_record)");
-            dh.ExecuteSql(sql.ToString(), "select", iSnCode, iMakeCode, iClass, iSubClass1, iSubClass2, iSubClass3, iMaxValue, iMinValue, iActualValue, iValue1, iValue2, iValue3, iTestResult, iSourceCode);
-            return true;
-        }
-
-        /// <summary>
-        /// 作业调用该方法将确认接收SN对应的IMEI及附属信息。
-        /// </summary>
-        /// <param name="iSN"></param>
-        /// <param name="iMO"></param>
-        /// <param name="iIMEI1"></param>
-        /// <param name="iIMEI2"></param>
-        /// <param name="iIMEI3"></param>
-        /// <param name="iMEID"></param>
-        /// <param name="iNetCode"></param>
-        /// <param name="iPSN"></param>
-        /// <param name="iID1"></param>
-        /// <param name="iBT"></param>
-        /// <param name="iID1"></param>
-        /// <param name="iID2"></param>
-        /// <param name="iID3"></param>
-        /// <param name="oErrorMessage"></param>
-        /// <returns></returns>
-        public bool SetIMEIInfo(string iSnCode, string iIMEI1, string iIMEI2, string iIMEI3, string iMEID, string iNetCode, string iPSN, string iID1, string iID2, string iID3, out string oErrMessage)
-        {
-            oErrMessage = "";
-            string[] param = new string[] { iSnCode, iIMEI1, iIMEI2, iIMEI3, iMEID, iNetCode, iPSN, iID1, iID2, iID3, oErrMessage };
-            dh.CallProcedure("CS_SETIMEIINFO", ref param);
-            oErrMessage = param[10];
-            if (oErrMessage == "" || oErrMessage == null || oErrMessage == "null")
-                return true;
-            else
-                return false;
-        }
-
-        /// <summary>
-        /// 获取执行步骤代码,名称和线别
-        /// </summary>
-        /// <param name="Source"></param>
-        /// <param name="StepCode"></param>
-        /// <param name="StepName"></param>
-        /// <param name="LineCode"></param>
-        private void GetStepCodeAndNameAndLineBySource(string Source, ref string StepCode, ref string StepName, ref string LineCode)
-        {
-            DataTable dt = dh.getFieldsDataByCondition("source", new string[] { "sc_stepcode", "sc_stepname", "sc_linecode" }, "sc_code='" + Source + "'");
-            if (dt.Rows.Count > 0)
-            {
-                StepCode = dt.Rows[0]["sc_stepcode"].ToString();
-                StepName = dt.Rows[0]["sc_stepname"].ToString();
-                LineCode = dt.Rows[0]["sc_linecode"].ToString();
-            }
-        }
-
-        /// <summary>
-        /// 获取步骤代码和名称
-        /// </summary>
-        /// <param name="Source"></param>
-        /// <param name="StepCode"></param>
-        /// <param name="StepName"></param>
-        private void GetStepCodeAndNameBySource(string Source, ref string StepCode, ref string StepName)
-        {
-            DataTable dt = dh.getFieldsDataByCondition("source", new string[] { "sc_stepcode", "sc_stepname", "sc_linecode" }, "sc_code='" + Source + "'");
-            if (dt.Rows.Count > 0)
-            {
-                StepCode = dt.Rows[0]["sc_stepcode"].ToString();
-                StepName = dt.Rows[0]["sc_stepname"].ToString();
-            }
-        }
-
-        /// <summary>
-        /// 获取步骤代码
-        /// </summary>
-        /// <param name="Source"></param>
-        /// <returns></returns>
-        private string GetStepCodeBySource(string Source)
-        {
-            return dh.getFieldDataByCondition("source", "sc_stepcode", "sc_code='" + Source + "'").ToString();
-        }
-    }
-}

+ 0 - 35
MES接口/Properties/AssemblyInfo.cs

@@ -1,35 +0,0 @@
-using System.Reflection;
-using System.Runtime.InteropServices;
-
-// 有关程序集的一般信息由以下
-// 控制。更改这些特性值可修改
-// 与程序集关联的信息。
-[assembly: AssemblyTitle("UAS_MES")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("")]
-[assembly: AssemblyProduct("UAS_MES")]
-[assembly: AssemblyCopyright("Copyright ©  2016")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-//将 ComVisible 设置为 false 将使此程序集中的类型
-//对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
-//请将此类型的 ComVisible 特性设置为 true。
-[assembly: ComVisible(false)]
-
-// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
-[assembly: Guid("a52efe9c-838e-4e8c-baaa-b1c226e57a81")]
-
-// 程序集的版本信息由下列四个值组成: 
-//
-//      主版本
-//      次版本
-//      生成号
-//      修订号
-//
-//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
-// 方法是按如下所示使用“*”: :
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]

+ 0 - 26
MES接口/Properties/Settings.Designer.cs

@@ -1,26 +0,0 @@
-//------------------------------------------------------------------------------
-// <auto-generated>
-//     此代码由工具生成。
-//     运行时版本:4.0.30319.42000
-//
-//     对此文件的更改可能会导致不正确的行为,并且如果
-//     重新生成代码,这些更改将会丢失。
-// </auto-generated>
-//------------------------------------------------------------------------------
-
-namespace MES_Interface.Properties {
-    
-    
-    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
-    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
-        
-        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
-        
-        public static Settings Default {
-            get {
-                return defaultInstance;
-            }
-        }
-    }
-}

+ 0 - 5
MES接口/Properties/Settings.settings

@@ -1,5 +0,0 @@
-<?xml version='1.0' encoding='utf-8'?>
-<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
-  <Profiles />
-  <Settings />
-</SettingsFile>

+ 0 - 91
MES接口/UAS-MES接口.csproj

@@ -1,91 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{A52EFE9C-838E-4E8C-BAAA-B1C226E57A81}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>MES_Interface</RootNamespace>
-    <AssemblyName>MES_Interface</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-    <TargetFrameworkProfile />
-    <SccProjectName>
-    </SccProjectName>
-    <SccLocalPath>
-    </SccLocalPath>
-    <SccAuxPath>
-    </SccAuxPath>
-    <SccProvider>
-    </SccProvider>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <UseVSHostingProcess>true</UseVSHostingProcess>
-    <DocumentationFile>
-    </DocumentationFile>
-    <RegisterForComInterop>false</RegisterForComInterop>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>TRACE</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="NPOI">
-      <HintPath>..\UAS-出货标签管理\tool\NPOI.dll</HintPath>
-    </Reference>
-    <Reference Include="Oracle.ManagedDataAccess">
-      <HintPath>tool\Oracle.ManagedDataAccess.dll</HintPath>
-    </Reference>
-    <Reference Include="System" />
-    <Reference Include="System.configuration" />
-    <Reference Include="System.Core" />
-    <Reference Include="System.Data.OracleClient" />
-    <Reference Include="System.Windows.Forms" />
-    <Reference Include="System.Xml.Linq" />
-    <Reference Include="System.Data.DataSetExtensions" />
-    <Reference Include="Microsoft.CSharp" />
-    <Reference Include="System.Data" />
-    <Reference Include="System.Xml" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="LogicHandler.cs" />
-    <Compile Include="DataHelper.cs" />
-    <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Properties\Settings.Designer.cs">
-      <DependentUpon>Settings.settings</DependentUpon>
-      <AutoGen>True</AutoGen>
-      <DesignTimeSharedInput>True</DesignTimeSharedInput>
-    </Compile>
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="app.config" />
-    <None Include="Properties\Settings.settings">
-      <Generator>SettingsSingleFileGenerator</Generator>
-      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
-    </None>
-  </ItemGroup>
-  <ItemGroup>
-    <Content Include="tool\Oracle.ManagedDataAccess.dll" />
-  </ItemGroup>
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <!-- 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.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-</Project>

+ 0 - 6
MES接口/app.config

@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<configuration>
-    <configSections>
-    </configSections>
-    <connectionStrings />
-</configuration>

BIN
MES接口/tool/Oracle.ManagedDataAccess.dll


+ 33 - 4
UAS_MesInterface/MESHelper.cs

@@ -1,10 +1,39 @@
-using System.Collections.Generic;
+using System;
+using System.Collections.Generic;
 using System.Data;
+using System.Runtime.InteropServices;
 using System.Text;
 
 namespace DllService
 {
-    public class MESHelper
+    [Guid("7F13A2B7-3B59-4E44-BBB4-77744F2CA1E9")]
+    public interface DllService_Interface
+    {
+        [DispId(10)]
+        bool CheckRoutePassed(string iSN, string iResCode, out string oErrMessage);
+        bool CheckUserLogin(string iUserCode, string iPassWord, out string oErrorMessage);
+        bool CheckUserAndResourcePassed(string iUserCode, string iResCode, out string oErrMessage);
+        bool SetIMEIInfo(string iSnCode, string iIMEI1, out string oErrMessage);
+        bool GetAddressRangeByMO(string iSN, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCdoe3, out string oErrMessage);
+        bool GetMEIOrNetCodeRange(string iSnCode, string iIMEI1, string iNetCode, out string oIMEI1, out string oIMEI2, out string oIMEI3, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrMessage);
+        bool GetMobileAllInfo(string iSnCode, out string oWIFI, out string oBT, out string oCode1, out string oCode2, out string oCode3, out string oIMEI1, out string oIMEI2, out string oIMEI3, out string oMEID, out string oNetCode, out string oPSN, out string oID1, out string oID2, out string oID3, out string oID4, out string oID5, out string oErrorMessage);
+        bool GetRcardMOInfo(string iSN, out string oMoCode, out string oErrMessage);
+        bool SetAddressInfo(string iSN, string iWIFI, string iBT, string iCode1, string iCode2, string iCode3, out string oErrorMessage);
+        bool SetMobileData(string iSN, string iSourceCode, string iMPKind, string iResult, string iErrCode, out string oErrorMessage);
+        bool SetTestDetail(string iSN, string iClass, string iSubClass1, string iSubClass2, string iSubClass3, string iMaxValue, string iMinValue, string iActualValue, string iValue1, string iValue2, string iValue3, string iTestResult, out string oErrMessage);
+    }
+
+    [Guid("71E1A234-DB0D-44D0-8E30-28FD7B022DF6"),
+    InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
+    public interface DllService_Events
+    {
+    }
+
+    [Guid("C543093F-29A4-4DCF-85F4-C53FC2DB0EB2"),
+    ClassInterface(ClassInterfaceType.None),
+    ComSourceInterfaces(typeof(DllService_Events))]
+
+    public class MESHelper: DllService_Interface
     {
         public MESHelper(string Environment)
         {
@@ -391,8 +420,8 @@ namespace DllService
                     if (ms_status == "3")
                     {
                         string nextstepcode = dh.getFieldDataByCondition("craft left join craftdetail on cr_id=cd_crid ", "cd_nextstepcode", "cr_code='" + ms_craftcode + "' and cr_prodcode='" + ms_prodcode + "' and cd_stepcode='" + CurrentStep + "'").ToString();
-                        dh.UpdateByCondition("makeserial", "ms_status=1,ms_nextstepcode='"+ nextstepcode + "'", "ms_sncode='" + iSN + "'");
-                        dh.UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" +iSN+ "'");
+                        dh.UpdateByCondition("makeserial", "ms_status=1,ms_nextstepcode='" + nextstepcode + "'", "ms_sncode='" + iSN + "'");
+                        dh.UpdateByCondition("makebad", "mb_status=-1", "mb_sncode='" + iSN + "'");
                     }
                 }
             }

+ 1 - 1
UAS_MesInterface/Properties/AssemblyInfo.cs

@@ -13,7 +13,7 @@ using System.Runtime.InteropServices;
 [assembly: AssemblyCopyright("Copyright ©  2017")]
 [assembly: AssemblyTrademark("")]
 [assembly: AssemblyCulture("")]
-
+[assembly: AssemblyKeyFile("DllService.snk")]
 //将 ComVisible 设置为 false 将使此程序集中的类型
 //对 COM 组件不可见。  如果需要从 COM 访问此程序集中的类型,
 //请将此类型的 ComVisible 特性设置为 true。

+ 10 - 0
UAS_MesInterface/UAS_MesDllService.csproj

@@ -31,6 +31,12 @@
     <ErrorReport>prompt</ErrorReport>
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
+  <PropertyGroup>
+    <SignAssembly>true</SignAssembly>
+  </PropertyGroup>
+  <PropertyGroup>
+    <AssemblyOriginatorKeyFile>bin\Debug\DllService.snk</AssemblyOriginatorKeyFile>
+  </PropertyGroup>
   <ItemGroup>
     <Reference Include="Oracle.ManagedDataAccess">
       <HintPath>tool\Oracle.ManagedDataAccess.dll</HintPath>
@@ -50,6 +56,10 @@
     <Compile Include="MESHelper.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
   </ItemGroup>
+  <ItemGroup>
+    <None Include="bin\Debug\DllService.snk" />
+    <None Include="bin\Debug\MyCom.snk" />
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- 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.