From 4eebf2a18c475d1fcf5374a96ed26ce7e5f1e5b1 Mon Sep 17 00:00:00 2001
From: lch <luluchen515@163.com>
Date: 星期六, 10 八月 2024 09:48:38 +0800
Subject: [PATCH] 添加项目文件。

---
 StringSecurity.cs                                          |  308 +
 HandleData/Allocation.cs                                   |  319 +
 Web References/WebReference/Reference.cs                   |  293 +
 Properties/AssemblyInfo.cs                                 |   36 
 Properties/Settings.Designer.cs                            |   56 
 DataexchangeServer.csproj                                  |  202 +
 Web References/WebReferenceLD1/UserServiceImplService.wsdl |   37 
 Web References/WebReferenceLD1/api.xsd                     |   29 
 Web References/WebReference/resp.datasource                |   10 
 Web References/WebReference/Reference.map                  |    7 
 DataexchangeServer.sln                                     |   25 
 Properties/Settings.settings                               |   15 
 Web References/WebReferenceLD/resp.datasource              |   10 
 HandleData/AE_MES_ERP.cs                                   | 4716 +++++++++++++++++++++++++++
 Web References/WebReference/UserServiceImplService.wsdl    |   37 
 frmMain.resx                                               |  178 +
 Web References/WebReferenceLD1/Reference.map               |    7 
 Properties/Resources.Designer.cs                           |   63 
 HandleData/XkyApiHelper.cs                                 |  155 
 Properties/Resources.resx                                  |  117 
 Web References/WebReferenceLD/Reference.cs                 |  293 +
 Web References/WebReference/api.xsd                        |   29 
 Helper/SQLHelper.cs                                        |  698 ++++
 frmMain.Designer.cs                                        |  371 ++
 Web References/WebReferenceLD1/Reference.cs                |  293 +
 Web References/WebReferenceLD1/resp.datasource             |   10 
 Web References/WebReferenceLD/UserServiceImplService.wsdl  |   37 
 App.config                                                 |   37 
 Web References/WebReferenceLD/Reference.map                |    7 
 Program.cs                                                 |   23 
 frmMain.cs                                                 |  472 ++
 StringHelper.cs                                            | 1263 +++++++
 Helper/JSONHelper.cs                                       |  123 
 Web References/WebReferenceLD/api.xsd                      |   29 
 34 files changed, 10,305 insertions(+), 0 deletions(-)

diff --git a/App.config b/App.config
new file mode 100644
index 0000000..e5e1f8a
--- /dev/null
+++ b/App.config
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+  <configSections>
+    <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
+      <section name="DataexchangeServer.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
+    </sectionGroup>
+  </configSections>
+  <connectionStrings>   
+    <!--骞挎繁鏁版嵁搴�-->
+    <add name="conn" connectionString="INmsaZ0Y6+ekR8JM34oAHBcXIuD3t5rWBUFmemwZikW+clLEnIhheyI9aDZpB5dtgt7HjRKSd7/JG1aw85eLYaVDcU5ow92mnyIK/L3M/9rT0bgjY1QHNB67lWZoKtMBhnjAJftvaWr2C35ra+0bjsB6pFGr5Zm81nskO8+tve5u+Zj2R4tm1Nt9LVvAcPJkusDAkv5imdq58D2xn//H/yxHzjIERtK6v+OQypjQQ8w="/>
+  </connectionStrings>
+  <appSettings>
+    <!--<add key="ExecutionTime" value="5" />-->
+    <add key="TimingMailInterval" value="10000"/>
+    <add key="MaxThreads" value="15"/>
+    <add key="MinThreads" value="5"/>
+    <add key="thisText" value="[骞挎繁鏁版嵁鍚屾鏈嶅姟]"/>
+    <!--<add key="notifyText" value="5" />-->
+    <add key="ClientSettingsProvider.ServiceUri" value=""/>
+  </appSettings>
+  <applicationSettings>
+    <DataexchangeServer.Properties.Settings>
+      <setting name="DataexchangeServer_WebReference_UserServiceImplService"
+        serializeAs="String">
+        <value>http://36.134.102.119:8888/ykd/api</value>
+      </setting>
+      <setting name="DataexchangeServer_WebReferenceLD_UserServiceImplService"
+        serializeAs="String">
+        <value>http://36.134.102.119:9998/ykd/api</value>
+      </setting>
+      <setting name="DataexchangeServer_WebReferenceLD1_UserServiceImplService"
+        serializeAs="String">
+        <value>http://36.134.102.119:9998/ykd/api</value>
+      </setting>
+    </DataexchangeServer.Properties.Settings>
+  </applicationSettings>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6"/></startup></configuration>
diff --git a/DataexchangeServer.csproj b/DataexchangeServer.csproj
new file mode 100644
index 0000000..7cd8afb
--- /dev/null
+++ b/DataexchangeServer.csproj
@@ -0,0 +1,202 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="12.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>{2B281C03-2092-46E5-A6C3-6FA26B463A18}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>DataexchangeServer</RootNamespace>
+    <AssemblyName>DataexchangeServer</AssemblyName>
+    <TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <IsWebBootstrapper>false</IsWebBootstrapper>
+    <PublishUrl>鍙戝竷\</PublishUrl>
+    <Install>true</Install>
+    <InstallFrom>Disk</InstallFrom>
+    <UpdateEnabled>false</UpdateEnabled>
+    <UpdateMode>Foreground</UpdateMode>
+    <UpdateInterval>7</UpdateInterval>
+    <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+    <UpdatePeriodically>false</UpdatePeriodically>
+    <UpdateRequired>false</UpdateRequired>
+    <MapFileExtensions>true</MapFileExtensions>
+    <ApplicationRevision>0</ApplicationRevision>
+    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+    <UseApplicationTrust>false</UseApplicationTrust>
+    <BootstrapperEnabled>true</BootstrapperEnabled>
+    <TargetFrameworkProfile />
+  </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="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>bin\Debug\Newtonsoft.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Configuration" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.EnterpriseServices" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Web.Extensions" />
+    <Reference Include="System.Web.Services" />
+    <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.Windows.Forms" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="frmMain.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="frmMain.Designer.cs">
+      <DependentUpon>frmMain.cs</DependentUpon>
+    </Compile>
+    <Compile Include="HandleData\AE_MES_ERP.cs" />
+    <Compile Include="HandleData\Allocation.cs" />
+    <Compile Include="HandleData\XkyApiHelper.cs" />
+    <Compile Include="Helper\JSONHelper.cs" />
+    <Compile Include="Helper\SQLHelper.cs" />
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+    <Compile Include="StringHelper.cs" />
+    <Compile Include="StringSecurity.cs" />
+    <Compile Include="Web References\WebReferenceLD1\Reference.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Reference.map</DependentUpon>
+    </Compile>
+    <Compile Include="Web References\WebReference\Reference.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Reference.map</DependentUpon>
+    </Compile>
+    <EmbeddedResource Include="frmMain.resx">
+      <DependentUpon>frmMain.cs</DependentUpon>
+    </EmbeddedResource>
+    <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>
+      <DesignTime>True</DesignTime>
+    </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>
+    <None Include="Web References\WebReferenceLD1\api.xsd">
+      <SubType>Designer</SubType>
+    </None>
+    <None Include="Web References\WebReferenceLD1\Reference.map">
+      <Generator>MSDiscoCodeGenerator</Generator>
+      <LastGenOutput>Reference.cs</LastGenOutput>
+    </None>
+    <None Include="Web References\WebReferenceLD1\resp.datasource">
+      <DependentUpon>Reference.map</DependentUpon>
+    </None>
+    <None Include="Web References\WebReferenceLD1\UserServiceImplService.wsdl" />
+    <None Include="Web References\WebReference\api.xsd">
+      <SubType>Designer</SubType>
+    </None>
+    <None Include="Web References\WebReference\Reference.map">
+      <Generator>MSDiscoCodeGenerator</Generator>
+      <LastGenOutput>Reference.cs</LastGenOutput>
+    </None>
+    <None Include="Web References\WebReference\resp.datasource">
+      <DependentUpon>Reference.map</DependentUpon>
+    </None>
+    <None Include="Web References\WebReference\UserServiceImplService.wsdl" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config">
+      <SubType>Designer</SubType>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <WCFMetadata Include="Service References\" />
+  </ItemGroup>
+  <ItemGroup>
+    <BootstrapperPackage Include=".NETFramework,Version=v4.5">
+      <Visible>False</Visible>
+      <ProductName>Microsoft .NET Framework 4.5 %28x86 鍜� x64%29</ProductName>
+      <Install>true</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+    <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+      <Visible>False</Visible>
+      <ProductName>.NET Framework 3.5 SP1</ProductName>
+      <Install>false</Install>
+    </BootstrapperPackage>
+  </ItemGroup>
+  <ItemGroup>
+    <WebReferences Include="Web References\" />
+  </ItemGroup>
+  <ItemGroup>
+    <WebReferenceUrl Include="http://36.134.102.119:8888/ykd/api%3fwsdl">
+      <UrlBehavior>Dynamic</UrlBehavior>
+      <RelPath>Web References\WebReference\</RelPath>
+      <UpdateFromURL>http://36.134.102.119:8888/ykd/api%3fwsdl</UpdateFromURL>
+      <ServiceLocationURL>
+      </ServiceLocationURL>
+      <CachedDynamicPropName>
+      </CachedDynamicPropName>
+      <CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
+      <CachedSettingsPropName>DataexchangeServer_WebReference_UserServiceImplService</CachedSettingsPropName>
+    </WebReferenceUrl>
+    <WebReferenceUrl Include="http://36.134.102.119:9998/ykd/api%3fwsdl">
+      <UrlBehavior>Dynamic</UrlBehavior>
+      <RelPath>Web References\WebReferenceLD1\</RelPath>
+      <UpdateFromURL>http://36.134.102.119:9998/ykd/api%3fwsdl</UpdateFromURL>
+      <ServiceLocationURL>
+      </ServiceLocationURL>
+      <CachedDynamicPropName>
+      </CachedDynamicPropName>
+      <CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
+      <CachedSettingsPropName>DataexchangeServer_WebReferenceLD1_UserServiceImplService</CachedSettingsPropName>
+    </WebReferenceUrl>
+  </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>
\ No newline at end of file
diff --git a/DataexchangeServer.sln b/DataexchangeServer.sln
new file mode 100644
index 0000000..a6d277c
--- /dev/null
+++ b/DataexchangeServer.sln
@@ -0,0 +1,25 @@
+锘�
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.5.33414.496
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DataexchangeServer", "DataexchangeServer.csproj", "{2B281C03-2092-46E5-A6C3-6FA26B463A18}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{2B281C03-2092-46E5-A6C3-6FA26B463A18}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{2B281C03-2092-46E5-A6C3-6FA26B463A18}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{2B281C03-2092-46E5-A6C3-6FA26B463A18}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{2B281C03-2092-46E5-A6C3-6FA26B463A18}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {E6ED8877-2A2A-460C-AA1B-BC07F4D63A4C}
+	EndGlobalSection
+EndGlobal
diff --git a/HandleData/AE_MES_ERP.cs b/HandleData/AE_MES_ERP.cs
new file mode 100644
index 0000000..fbf3236
--- /dev/null
+++ b/HandleData/AE_MES_ERP.cs
@@ -0,0 +1,4716 @@
+锘縰sing DataexchangeServer.Helper;
+using Newtonsoft.Json;
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.Data.SqlClient;
+using System.IO;
+using System.Net;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Text;
+namespace DataexchangeServer
+{
+    //鏁版嵁鎺ㄩ�佺被
+    public class AE_MES_ERP
+    {
+        private SQLHelper _sqlHelper;
+        string conStr;
+        public AE_MES_ERP()
+        {
+            //conStr = Encoding.Default.GetString(Convert.FromBase64String(ConfigurationManager.ConnectionStrings["conn"].ConnectionString));
+            conStr = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
+            conStr = SecurityHelper.Decrypt(conStr);
+            _sqlHelper = new SQLHelper(conStr);
+            //_sqlHelper = new SQLHelper(conStr);
+        }
+
+        #region 0.鍚屾閲戣澏绯荤粺鏁版嵁bool ErpToMesData(string taskid, DataSet inputds, string operatype, DataRow drSource, ref string msg)
+        /// <summary>
+        /// 鍚屾閲戣澏绯荤粺鏁版嵁
+        /// </summary>
+        /// <param name="taskid">浠诲姟ID</param>
+        /// <param name="inputds">JSON鏁版嵁琛ㄩ泦鍚�</param>
+        /// <param name="operatype">INSERT,UPDATE,DELETE</param>
+        /// <param name="drSource">鍘熷鏁版嵁琛�</param>
+        /// <param name="msg">杩斿洖鐨勬墽琛岄敊璇俊鎭�</param>
+        /// <returns></returns>
+        public bool ErpToMesData(string taskid, DataSet inputds, string operatype, DataRow drSource, ref string msg,ref string flag,string rtaskid)
+        {
+            bool result = true;
+            switch (taskid)
+            {
+                //1.ERPBMA閮ㄩ棬淇℃伅琛�(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_BM":
+                    result = TB_ERPTOMES_BM(inputds, operatype, ref msg);
+                    break;
+                //2.ERPGWA宀椾綅淇℃伅琛�(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_GW":
+                    result = TB_ERPTOMES_GW(inputds, operatype, ref msg);
+                    break;
+                //3.ERPRYA浜哄憳淇℃伅琛�(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_RY":
+                    result = TB_ERPTOMES_RY(inputds, operatype, ref msg);
+                    break;
+                //4.ERPWFL鐗╂枡鍒嗙被琛�(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_WF":
+                    result = TB_ERPTOMES_WF(inputds, operatype, ref msg);
+                    break;
+                //5.ERPWLA鐗╂枡琛�(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_WL":
+                    result = TB_ERPTOMES_WL(inputds, operatype, ref msg);
+                    break;
+                //6.ERPDWA璁¢噺鍗曚綅(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_DW":
+                    result = TB_ERPTOMES_DW(inputds, operatype, ref msg);
+                    break;
+                //7.ERPKHA瀹㈡埛淇℃伅(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_KH":
+                    result = TB_ERPTOMES_KH(inputds, operatype, ref msg);
+                    break;
+                //8.ERPGYS渚涘簲鍟嗕俊鎭�(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_GYS":
+                    result = TB_ERPTOMES_GYS(inputds, operatype, ref msg);
+                    break;
+                //9.ERPCKA浠撳簱淇℃伅妗�(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_CK":
+                    result = TB_ERPTOMES_CK(inputds, operatype, ref msg);
+                    break;
+                //10.ERPGXA宸ュ簭(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_GX":
+                    result = TB_ERPTOMES_GX(inputds, operatype, ref msg);
+                    break;
+                //11.ERPBOMA(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_BOM":
+                    result = TB_ERPTOMES_BOM(inputds, operatype, ref msg);
+                    break;
+                //12.ERPTDL鏇夸唬鏂欏悓姝�(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_TDL":
+                    result = TB_ERPTOMES_TDL(inputds, operatype, ref msg);
+                    break;
+                //15.鍚屾瀹㈡埛淇℃伅(鍚屾鎺ㄩ��)
+                case "TB_ERPTOME_KHWL":
+                    result = TB_ERPTOME_KHWL(inputds, operatype, ref msg);
+                    break;
+                //13.ERPCGA閲囪喘璁㈠崟锝滃澶栬鍗�(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_CG":
+                    result = TB_ERPTOMES_CG(taskid, inputds, operatype, ref msg, rtaskid);
+                    break;
+                //14.ERPTLA鐢熶骇鎶曟枡鍗�(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_TL":
+                    result = TB_ERPTOMES_TL(inputds, operatype, ref msg, drSource);
+                    break;
+                //15.ERPXCKA閿�鍞嚭搴撳崟(鍚屾鎺ㄩ��)(浠ュ悗涓嶇敤浜�)
+                case "TB_ERPTOMES_XCK":
+                    result = TB_ERPTOMES_XCK(inputds, operatype, ref msg);
+                    break;                
+                //16.ERPQCKA鍏跺畠鍑哄簱鍗�(鍚屾鎺ㄩ��)(浠ュ悗涓嶇敤浜�)
+                case "TB_ERPTOMES_QCK":
+                    result = TB_ERPTOMES_QCK(taskid, inputds, operatype, ref msg);
+                    break;
+                //17.ERPTHA渚涘簲鍟嗛��璐у崟(鍚屾鎺ㄩ��)(浠ュ悗涓嶇敤浜�)
+                case "TB_ERPTOMES_TH":
+                    result = TB_ERPTOMES_TH(inputds, operatype, ref msg);
+                    break;
+                //22.ERPTHCONFIRM渚涘簲鍟嗛��璐х‘璁�(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_TH_CONFIRM":
+                    result = TB_ERPTOMES_TH_CONFIRM(inputds, operatype, ref msg);
+                    break;
+                //18.MesToErp(鍚屾鎺ㄩ��)
+                case "TB_MESTOERP_WGRK"://MESWGRK閲戣澏鏉$爜鍏ュ簱锛堝璐叆搴擄級(鍚屾鎺ㄩ��)
+                case "TB_MESTOERP_WWRK"://MESWWRK閲戣澏鏉$爜鍏ュ簱锛堝澶栧叆搴擄級(鍚屾鎺ㄩ��)
+                case "TB_MESTOERP_QTRK"://MESQTRK閲戣澏鏉$爜鍏ュ簱锛堝叾浠栧叆搴擄級(鍚屾鎺ㄩ��)
+                case "TB_MESTOERP_CPRK"://MESCPRK閲戣澏鏉$爜鍏ュ簱锛堜骇鍝佸叆搴擄級(鍚屾鎺ㄩ��)
+                case "TB_MESTOERP_CGRK"://MESCPRK閲戣澏鏉$爜鍏ュ簱锛堥噰璐叆搴擄級(鍚屾鎺ㄩ��)
+                case "TB_MESTOERP_XSCK"://MESCPRK閲戣澏鏉$爜鍑哄簱锛堥攢鍞嚭搴擄級(鍚屾鎺ㄩ��)
+                case "TB_MESTOERP_WLQDBB"://MESGCBOM閲戣澏楂樺啿鐢ㄦ枡鍙樻洿(鍚屾鎺ㄩ��)
+                case "TB_MESTOERP_DD"://MESDD閲戣澏鏉$爜鍏ュ簱锛堣皟鎷級(鍚屾鎺ㄩ��)
+                case "TB_MESTOERP_PYPK"://MESPYPK閲戣澏鏉$爜鍏ュ簱锛堢洏鐩堢洏浜忥級(鍚屾鎺ㄩ��)
+                case "TB_MESTOERP_LL"://MESLL閲戣澏鏉$爜鍑哄簱锛堥鏂欏崟锛�(鍚屾鎺ㄩ��)
+                case "TB_MESTOERP_SCTL"://MESLL閲戣澏鏉$爜鍏ュ簱锛堥鏂欏崟锛�(鍚屾鎺ㄩ��)
+                case "TB_MESTOERP_SCBL"://MESLL閲戣澏鏉$爜鍏ュ簱锛堥鏂欏崟锛�(鍚屾鎺ㄩ��)
+                case "TB_MESTOERP_WTRK"://MESWTRK閲戣澏鏉$爜鍏ュ簱锛堝彈鎵樺叆搴擄級(鍚屾鎺ㄩ��)
+                case "TB_MESTOERP_QTCK"://鍏朵粬鍑哄簱
+                case "TB_MESTOERP_XCK"://閿�鍞嚭搴擄紙钃�-璁㈠崟銆佺孩锛�
+                case "TB_MESTOERP_WWCK"://濮斿鍑哄簱(钃濄�佺孩)
+                case "TB_MESTOERP_WGTL"://澶栬喘閫�鏂�
+                case "TB_MESTOERP_JYTL"://妫�楠岄��鏂�
+                case "TB_MESTOERP_SLSH"://鎺ㄩ�佸鏍搁�佽揣鍗�
+                case "TB_MESTOERP_SCDDXD"://鎺ㄩ�佸鏍搁�佽揣鍗�
+                case "TB_MESTOERP_TransferIn"://鍒嗗竷寮忚皟鍏ュ崟
+                case "TB_MESTOERP_ZJDB"://鐩存帴璋冩嫧鍗�
+                    result = MesToErp(drSource, ref msg);
+                    break;
+                case "TB_MESTOERP_GDRK"://ERP宸ュ崟鍏ュ簱鏌ヨ
+                    result = MesToErp(drSource, ref msg);
+                    break;
+                case "TB_MESTOERP_CGRKLD":
+                    result = MesToErpLD(drSource, ref msg);
+                    break;
+                case "TB_ERPTOMES_XSD":
+                    result = TB_ERPTOMES_XSD(inputds, operatype, ref msg);
+                    break;
+                //20.濮斿鍏跺畠鍑哄簱鍗�(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_WCK":
+                    result = TB_ERPTOMES_WCK(inputds, operatype, ref msg);
+                    break;
+                //21.鍒拌揣鍗�(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_CGDH":
+                    result = TB_ERPTOMES_CGDH(inputds, operatype, ref msg);
+                    break;               
+                case "TB_MESTOERP_ICMO"://瓒呭叆宸ュ崟鐢熸垚
+                    result = MesToErp(drSource, ref msg);
+                    break;
+                //23.TB_ERPTOMES_GDRK宸ュ崟鍏ュ簱鏁伴噺鏌ヨ(鍚屾鎺ㄩ��)
+                case "TB_ERPTOMES_GDRK":
+                    result = TB_ERPTOMES_GDRK(inputds, operatype, ref msg);
+                    break;
+                //24.TB_ERPTOMES_FHTZ鍙戣揣閫氱煡鍗�
+                case "TB_ERPTOMES_FHTZ"://鎺ユ敹鍙戣揣閫氱煡鍗�
+                    result = TB_ERPTOMES_FHTZ(taskid, inputds, operatype, ref msg);
+                    break;
+                //25.濮斿鎶曟枡鍗�
+                case "TB_ERPTOMES_WW":
+                    result = TB_ERPTOMES_WW(taskid, inputds, operatype, ref msg);
+                    break;
+
+                case "TB_XKY_GET_DHD"://鎺ㄩ�佸鏍搁�佽揣鍗�
+                    result = XKY_GET_DHD(drSource, ref msg);
+                    break;
+                case "TB_XKY_GET_DETAILS"://鎺ㄩ�佸鏍搁�佽揣鍗�
+                    result = XKY_GET_DETAILS(drSource, ref msg);
+                    break;
+                case "TB_XKY_GET_BARCODE"://鎺ㄩ�佸鏍搁�佽揣鍗�
+                    result = XKY_GET_BARCODE(drSource, ref msg);
+                    break;
+
+            }
+            if (result)
+                flag = "1";
+            else flag = "0";
+            return result;
+        }
+        
+        private bool TB_ERPTOME_KHWL(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+
+            if (operatype == "INSERT" || operatype == "UPDATE")
+            {
+                foreach (DataRow dr in ds.Tables[0].Rows)
+                {
+                    IDList.Add(dr["ERPID"].ToString());
+                }
+
+                //澶勭悊鍓嶅垽鏂槸鍚﹀瓨鍦� 
+               // operatype = DataIsInDB("GS_KWL", "ID", string.Join("','", IDList), "") ? "UPDATE" : "INSERT";
+            }
+
+            try
+            {
+                DataTable dt = ds.Tables[0];
+                if (operatype == "INSERT" || operatype == "UPDATE")
+                {
+                    #region INSERT
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+
+                    }
+
+                    //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                    DeleteDataBeforeInsert("GS_KWL", "ID", string.Join("','", IDList), "");
+                    //if (!DeleteDataBeforeInsert("HRMMAA", "ERPID", string.Join("','", IDList), ""))
+                    //{
+                    //    ErrorMsg = "HRMMAA閲嶅閿垹闄ゅけ璐ワ紒";
+                    //    return false;
+                    //}
+
+                    SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                    colMapping[0] = new SqlBulkCopyColumnMapping("ERPID", "ID"); //ID
+                    colMapping[1] = new SqlBulkCopyColumnMapping("KWL001", "KWL001"); //ID
+                    colMapping[2] = new SqlBulkCopyColumnMapping("KWL002", "KWL002");//閮ㄩ棬缂栧彿
+                    colMapping[3] = new SqlBulkCopyColumnMapping("KWL003", "KWL003");//閮ㄩ棬鍚嶇О
+                    colMapping[4] = new SqlBulkCopyColumnMapping("KWL004", "KWL004");//琛屾斂绾у埆
+                    colMapping[5] = new SqlBulkCopyColumnMapping("KWL005", "KWL005");//璐d换鑰呭伐鍙�
+                    colMapping[6] = new SqlBulkCopyColumnMapping("KWL006", "KWL006");//璐d换鑰呭鍚�
+                    colMapping[7] = new SqlBulkCopyColumnMapping("KWL007", "KWL007");//涓婄骇閮ㄩ棬
+                    colMapping[8] = new SqlBulkCopyColumnMapping("WLA008", "KWL008");
+
+                    return DataTableToSQLServer(dt, conStr, "GS_KWL", colMapping, ref ErrorMsg);
+                    #endregion
+                }
+                //else if (operatype == "UPDATE")
+                //{
+                //    //ErrorMsg = "鎵ц淇敼鏁版嵁琛�";
+                //    #region UPDATE
+                //    foreach (DataRow dr in dt.Rows)
+                //    {
+                //        sql += string.Format(@" update GS_KWL
+                //                    set 
+                //                        KWL001='{1}',
+                //                        KWL002='{2}',
+                //                        KWL003='{3}',
+                //                        KWL004='{4}',
+                //                        KWL005='{5}',
+                //                        KWL006='{6}',
+                //                        KWL007='{7}',
+                //                        KWL008='{8}'
+                //                    where ID='{0}'  AND   KWL003='{3}' ; ", dr["ERPID"], dr["KWL001"], dr["KWL002"], dr["KWL003"], dr["KWL004"], dr["KWL005"], dr["KWL006"], dr["KWL007"], dr["WLA008"]);
+                //    }
+                //    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                //    #endregion
+                //}
+                else //DELETE
+                {
+                    //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                    #region DELETE
+
+
+                    return true;
+                    #endregion
+                }
+
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+
+        #endregion
+
+        #region 1.ERPBMA閮ㄩ棬淇℃伅琛�(鍚屾鎺ㄩ��) bool TB_ERPTOMES_BM(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPBMA閮ㄩ棬淇℃伅琛�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_BM(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+
+            if (operatype == "INSERT" || operatype == "UPDATE")
+            {
+                foreach (DataRow dr in ds.Tables[0].Rows)
+                {
+                    IDList.Add(dr["ERPID"].ToString());
+                }
+
+                //澶勭悊鍓嶅垽鏂槸鍚﹀瓨鍦� 
+                operatype = DataIsInDB("GS_BM", "ERPID", string.Join("','", IDList), "") ? "UPDATE" : "INSERT";
+            }
+
+            try
+            {
+                DataTable dt = ds.Tables[0];
+                if (operatype == "INSERT")
+                {
+                    #region INSERT
+                    dt.Columns.Add("BM001", typeof(string));
+                    dt.Columns.Add("AUDITING", typeof(string));
+
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+
+                        dr["AUDITING"] = "Y";
+                        dr["BM001"] = dr["ERPID"];
+                        if (dr["BMA003"].ToString() == "")
+                        {
+                            dr["BMA003"] = "3";//榛樿鏈儴
+                        }
+                    }
+
+                    //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                    DeleteDataBeforeInsert("GS_BM", "ERPID", string.Join("','", IDList), "");
+                    //if (!DeleteDataBeforeInsert("HRMMAA", "ERPID", string.Join("','", IDList), ""))
+                    //{
+                    //    ErrorMsg = "HRMMAA閲嶅閿垹闄ゅけ璐ワ紒";
+                    //    return false;
+                    //}
+
+                    SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                    colMapping[0] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ERPID
+                    colMapping[1] = new SqlBulkCopyColumnMapping("BM001", "BM001"); //ID
+                    colMapping[2] = new SqlBulkCopyColumnMapping("BMA001", "BM002");//閮ㄩ棬缂栧彿
+                    colMapping[3] = new SqlBulkCopyColumnMapping("BMA002", "BM003");//閮ㄩ棬鍚嶇О
+                    colMapping[4] = new SqlBulkCopyColumnMapping("BMA003", "BM004");//琛屾斂绾у埆
+                    colMapping[5] = new SqlBulkCopyColumnMapping("BMA004", "BM005");//璐d换鑰呭伐鍙�
+                    colMapping[6] = new SqlBulkCopyColumnMapping("BMA005", "BM006");//璐d换鑰呭鍚�
+                    colMapping[7] = new SqlBulkCopyColumnMapping("BMA006", "BM007");//涓婄骇閮ㄩ棬
+                    colMapping[8] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+
+                    return DataTableToSQLServer(dt, conStr, "GS_BM", colMapping, ref ErrorMsg);
+                    #endregion
+                }
+                else if (operatype == "UPDATE")
+                {
+                    //ErrorMsg = "鎵ц淇敼鏁版嵁琛�";
+                    #region UPDATE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        sql += string.Format(@" update GS_BM
+                                    set 
+                                        BM002='{1}',
+                                        BM003='{2}',
+                                        BM004='{3}',
+                                        BM005='{4}',
+                                        BM006='{5}',
+                                        BM007='{6}'
+                                    where ERPID='{0}'; ", dr["ERPID"], dr["BMA001"], dr["BMA002"], dr["BMA003"], dr["BMA004"], dr["BMA005"], dr["BMA006"]);
+                    }
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+                else //DELETE
+                {
+                    //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                    #region DELETE
+                    
+
+                    return true;
+                    #endregion
+                }
+
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        } 
+        #endregion
+
+        #region 2.ERPGWA宀椾綅淇℃伅琛�(鍚屾鎺ㄩ��) bool TB_ERPTOMES_GW(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPGWA宀椾綅淇℃伅琛�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_GW(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+
+            if (operatype == "INSERT" || operatype == "UPDATE")
+            {
+                foreach (DataRow dr in ds.Tables[0].Rows)
+                {
+                    IDList.Add(dr["ERPID"].ToString());
+                }
+
+                //澶勭悊鍓嶅垽鏂槸鍚﹀瓨鍦� 
+                operatype = DataIsInDB("HRMMBA", "ERPID", string.Join("','", IDList), "") ? "UPDATE" : "INSERT";
+            }
+
+            try
+            {
+                DataTable dt = ds.Tables[0];
+                if (operatype == "INSERT")
+                {
+                    #region INSERT
+                    dt.Columns.Add("MBA004", typeof(string));
+                    dt.Columns.Add("MBA005", typeof(string));
+                    dt.Columns.Add("AUDITING", typeof(string));
+
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+
+                        dr["AUDITING"] = "Y";
+                        dr["MBA004"] = "1";//浜哄憳绫诲埆 1-涓�绾�;2-浜岀嚎
+                        dr["MBA005"] = "0";//宀椾綅绫诲埆 0-涓�鑸亴;1-绠$悊鑱�;2-鎶�鏈亴;3-涓撲笟鑱�;4-鍏跺畠鑱�
+                    }
+
+                    //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                    DeleteDataBeforeInsert("HRMMBA", "ERPID", string.Join("','", IDList), "");
+                    //if (!DeleteDataBeforeInsert("HRMMBA", "ERPID", string.Join("','", IDList), ""))
+                    //{
+                    //    ErrorMsg = "HRMMBA閲嶅閿垹闄ゅけ璐ワ紒";
+                    //    return false;
+                    //}
+
+                    SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                    colMapping[0] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ERPID
+                    colMapping[1] = new SqlBulkCopyColumnMapping("GWA001", "MBA001");//宀椾綅缂栧彿
+                    colMapping[2] = new SqlBulkCopyColumnMapping("GWA002", "MBA002");//宀椾綅鍚嶇О
+                    colMapping[3] = new SqlBulkCopyColumnMapping("GWA003", "MBA007");//宀椾綅瑕佹眰
+                    colMapping[4] = new SqlBulkCopyColumnMapping("GWA004", "MBA003");//寤虹珛鏃ユ湡
+                    colMapping[5] = new SqlBulkCopyColumnMapping("GWA005", "MBA008");//澶囨敞
+                    colMapping[6] = new SqlBulkCopyColumnMapping("MBA004", "MBA004");//浜哄憳绫诲埆
+                    colMapping[7] = new SqlBulkCopyColumnMapping("MBA005", "MBA005");//宀椾綅绫诲埆
+                    colMapping[8] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+
+                    return DataTableToSQLServer(dt, conStr, "HRMMBA", colMapping, ref ErrorMsg);
+                    #endregion
+                }
+                else if (operatype == "UPDATE")
+                {
+                    //ErrorMsg = "鎵ц淇敼鏁版嵁琛�";
+                    #region UPDATE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        sql += string.Format(@" update HRMMBA
+                                    set 
+                                        MBA001='{1}',
+                                        MBA002='{2}',
+                                        MBA007='{3}',
+                                        MBA003='{4}',
+                                        MBA008='{5}'
+                                    where ERPID='{0}'; ", dr["ERPID"], dr["GWA001"], dr["GWA002"], dr["GWA003"], dr["GWA004"], dr["GWA005"]);
+                    }
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+                else //DELETE
+                {
+                    //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                    #region DELETE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+                    }
+                    sql = string.Format(@" delete from HRMMBA where ERPID in ('{0}'); ", string.Join("','", IDList));
+
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 3.ERPRYA浜哄憳淇℃伅琛�(鍚屾鎺ㄩ��) bool TB_ERPTOMES_RY(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPRYA浜哄憳淇℃伅琛�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_RY(DataSet ds, string operatype, ref string ErrorMsg)
+        {                 
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+
+            if (operatype == "INSERT" || operatype == "UPDATE")
+            {
+                foreach (DataRow dr in ds.Tables[0].Rows)
+                {
+                    IDList.Add(dr["ERPID"].ToString());
+                }
+
+                //澶勭悊鍓嶅垽鏂槸鍚﹀瓨鍦� 
+                operatype = DataIsInDB("GS_RY", "ERPID", string.Join("','", IDList), "") ? "UPDATE" : "INSERT";
+            }
+
+            try
+            {
+                DataTable dt = ds.Tables[0];
+                if (operatype == "INSERT")
+                {
+                    #region INSERT
+                    dt.Columns.Add("RY006", typeof(string));
+                    dt.Columns.Add("AUDITING", typeof(string));
+
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+
+                        dr["AUDITING"] = "Y";
+                        dr["RY006"] = "1";//浜哄憳绫诲埆 1-涓�绾�;2-浜岀嚎
+                    }
+
+                    //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                    DeleteDataBeforeInsert("GS_RY", "ERPID", string.Join("','", IDList), "");
+                    //if (!DeleteDataBeforeInsert("HRMMAC", "ERPID", string.Join("','", IDList), ""))
+                    //{
+                    //    ErrorMsg = "HRMMAC閲嶅閿垹闄ゅけ璐ワ紒";
+                    //    return false;
+                    //}
+
+                    SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                    colMapping[0] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ERPID
+                    colMapping[1] = new SqlBulkCopyColumnMapping("RYA001", "RY002");//鑱屽伐宸ュ彿
+                    colMapping[2] = new SqlBulkCopyColumnMapping("RYA002", "RY003");//鑱屽伐濮撳悕
+                    colMapping[3] = new SqlBulkCopyColumnMapping("RYA003", "RY001");//閮ㄩ棬缂栫爜
+                    colMapping[4] = new SqlBulkCopyColumnMapping("RYA004", "RY019");//閮ㄩ棬鍚嶇О
+                    colMapping[5] = new SqlBulkCopyColumnMapping("RYA005", "RY004");//宀椾綅缂栫爜
+                    colMapping[6] = new SqlBulkCopyColumnMapping("RYA006", "RY005");//宀椾綅鍚嶇О
+                    colMapping[7] = new SqlBulkCopyColumnMapping("RYA007", "RY007");//鎵嬫満鍙�
+                    colMapping[8] = new SqlBulkCopyColumnMapping("RYA008", "RY010");//璋冨叆鏃ユ湡
+                    colMapping[9] = new SqlBulkCopyColumnMapping("RYA009", "RY011");//璋冨嚭鏃ユ湡
+                    colMapping[10] = new SqlBulkCopyColumnMapping("RYA010", "RY013");//澶囨敞
+                    colMapping[11] = new SqlBulkCopyColumnMapping("RY006", "RY006");//澶囨敞
+                    colMapping[12] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+
+                    return DataTableToSQLServer(dt, conStr, "GS_RY", colMapping, ref ErrorMsg);
+                    #endregion
+                }
+                else if (operatype == "UPDATE")
+                {
+                    //ErrorMsg = "鎵ц淇敼鏁版嵁琛�";
+                    #region UPDATE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        sql += string.Format(@" update GS_RY
+                                    set 
+                                        RY002='{1}',
+                                        RY003='{2}',
+                                        RY001='{3}',
+                                        RY019='{4}',
+                                        RY004='{5}',
+                                        RY005='{6}',
+                                        RY007='{7}',
+                                        RY010='{8}',
+                                        RY011='{9}',
+                                        RY013='{10}'
+                                    where ERPID='{0}'; ", dr["ERPID"]
+                                                        , dr["RYA001"], dr["RYA002"], dr["RYA003"], dr["RYA004"], dr["RYA005"]
+                                                        , dr["RYA006"], dr["RYA007"], dr["RYA008"], dr["RYA009"], dr["RYA010"]);
+                    }
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+                else //DELETE
+                {
+                    //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                    #region DELETE                  
+                    return true;
+                    #endregion
+                }
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 4.ERPWFL鐗╂枡鍒嗙被琛�(鍚屾鎺ㄩ��) bool TB_ERPTOMES_WF(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPWFL鐗╂枡鍒嗙被琛�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_WF(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+
+            if (operatype == "INSERT" || operatype == "UPDATE")
+            {
+                foreach (DataRow dr in ds.Tables[0].Rows)
+                {
+                    IDList.Add(dr["ERPID"].ToString());
+                }
+
+                //澶勭悊鍓嶅垽鏂槸鍚﹀瓨鍦� 
+                operatype = DataIsInDB("BASBAB", "ERPID", string.Join("','", IDList), "") ? "UPDATE" : "INSERT";
+            }
+
+            try
+            {
+                DataTable dt = ds.Tables[0];
+                if (operatype == "INSERT")
+                {
+                    #region INSERT
+                    dt.Columns.Add("BAB005", typeof(string));
+                    //dt.Columns.Add("AUDITING", typeof(string));
+
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+
+                        //dr["AUDITING"] = "Y";
+                        dr["BAB005"] = "N";//鏄惁绯荤粺
+                        if (dr["WFL001"].ToString()=="10" || dr["WFL001"].ToString() == "12" || dr["WFL001"].ToString() == "11")
+                        {
+                            dr["WFL003"] = "A";
+                        }
+                        if (dr["WFL001"].ToString()== "30" )
+                        {
+                            dr["WFL003"] = "C";
+                        }
+                        if (dr["WFL001"].ToString()== "22"|| dr["WFL001"].ToString() == "21"|| dr["WFL001"].ToString() == "23"|| dr["WFL001"].ToString() == "24"|| dr["WFL001"].ToString() == "25")
+                        {
+                            dr["WFL003"] = "B";
+                        }
+                        if (dr["WFL001"].ToString() == "90" || dr["WFL001"].ToString() == "91" || dr["WFL001"].ToString() == "92" )
+                        {
+                            dr["WFL003"] = "D";
+                        }
+                    }
+
+                    //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                    DeleteDataBeforeInsert("BASBAB", "ERPID", string.Join("','", IDList), "");
+                    //if (!DeleteDataBeforeInsert("BASBAB", "ERPID", string.Join("','", IDList), ""))
+                    //{
+                    //    ErrorMsg = "BASBAB閲嶅閿垹闄ゅけ璐ワ紒";
+                    //    return false;
+                    //}
+
+                    SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                    colMapping[0] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ERPID
+                    colMapping[1] = new SqlBulkCopyColumnMapping("WFL001", "BAB001");//鍒嗙被缂栧彿
+                    colMapping[2] = new SqlBulkCopyColumnMapping("WFL002", "BAB003");//鍒嗙被鍚嶇О
+                    colMapping[3] = new SqlBulkCopyColumnMapping("WFL003", "BAB002");//鐖惰妭鐐圭紪鍙�
+                    colMapping[4] = new SqlBulkCopyColumnMapping("WFL004", "BAB004");//澶囨敞
+                    colMapping[5] = new SqlBulkCopyColumnMapping("BAB005", "BAB005");
+
+                    return DataTableToSQLServer(dt, conStr, "BASBAB", colMapping, ref ErrorMsg);
+                    #endregion
+                }
+                else if (operatype == "UPDATE")
+                {
+                    //ErrorMsg = "鎵ц淇敼鏁版嵁琛�";
+                    #region UPDATE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        sql += string.Format(@" update BASBAB
+                                    set 
+                                        BAB001='{1}',
+                                        BAB003='{2}',
+                                        BAB002='{3}',
+                                        BAB004='{4}'
+                                    where ERPID='{0}'; ", dr["ERPID"]
+                                                        , dr["WFL001"], dr["WFL002"], dr["WFL003"], dr["WFL004"]);
+                    }
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+                else //DELETE
+                {
+                    //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                    #region DELETE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+                    }
+                    sql = string.Format(@" delete from BASBAB where ERPID in ('{0}'); ", string.Join("','", IDList));
+
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 5.ERPWLA鐗╂枡琛�(鍚屾鎺ㄩ��) bool TB_ERPTOMES_WL(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPWLA鐗╂枡琛�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_WL(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            string sqlL = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+
+            if (operatype != "INSERT" && operatype != "UPDATE")
+            {
+                sql = string.Format(@" delete from GS_WL where WL001 in ('{0}') ", operatype);
+
+                _sqlHelper.ExecuteNonQuery(sql);
+                return true;
+            }
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+
+            if (operatype == "INSERT" || operatype == "UPDATE")
+            {
+                foreach (DataRow dr in ds.Tables[0].Rows)
+                {
+                    IDList.Add(dr["WLA001"].ToString());
+                }
+
+                //澶勭悊鍓嶅垽鏂槸鍚﹀瓨鍦� 
+                operatype = DataIsInDB("GS_WL", "WL001", string.Join("','", IDList), "") ? "UPDATE" : "INSERT";
+            }
+
+            try
+            {
+                DataTable dt = ds.Tables[0];
+                if (operatype == "INSERT")
+                {
+                    #region INSERT
+                    dt.Columns.Add("AUDITING", typeof(string));
+                    //dt.Columns.Add("MBA030", typeof(string));
+
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["WLA001"].ToString());
+                        string str = dr["WLA016"].ToString();
+                        string strT = dr["WLA018"].ToString();
+                        //dr["WLA011"] = str+"."+ strT;                       
+                        dr["AUDITING"] = "Y";
+                        //dr["MBA030"] = "A";
+
+                  
+                        
+                    }
+
+                    //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                    DeleteDataBeforeInsert("GS_WL", "WL001", string.Join("','", IDList), "");
+                    //if (!DeleteDataBeforeInsert("INVMBA", "ERPID", string.Join("','", IDList), ""))
+                    //{
+                    //    ErrorMsg = "INVMBA閲嶅閿垹闄ゅけ璐ワ紒";
+                    //    return false;
+                    //}
+                    //閫夋嫨鎯宠鐨勫垪鎻掑叆鏂拌〃
+                    DataTable dtHead = dt.DefaultView.ToTable(true, "WLA001", "WLA002", "WLA003", "WLA004", "WLA005", "WLA006", "WLA007", "WLA008", "WLA009", "WLA010", "WLA011", "WLA012", "WLA015", "ERPID", "AUDITING", "WLA013", 
+                        "WLA014", "WLA020", "WLA021", "WLA022", "WLA023", "WLA024", "WLA025", "WLA026", "WLA027", "WLA028", "WLA029", "WLA030", "WLA031", "WLA032", "WLA033", "WLA034", "WLA035", "WLA036", "WLA037", "WLA038", "WLA039", 
+                        "WLA040", "WLA041","WLA042", "WLA043", "WLA044", "WLA045", "WLA046", "WLA047", "WLA048", "WLA049", "WLA050", "WLA051", "WLA052", "WLA053", "WLA054", "WLA055","WLA056");
+                    SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dtHead.Columns.Count];
+
+                    colMapping[0] = new SqlBulkCopyColumnMapping("WLA001", "WL001"); //	鐗╂枡缂栫爜
+                    colMapping[1] = new SqlBulkCopyColumnMapping("WLA002", "WL002"); //	鐗╂枡鍚嶇О
+                    colMapping[2] = new SqlBulkCopyColumnMapping("WLA003", "WL004"); //	鐗╂枡瑙勬牸
+                    colMapping[3] = new SqlBulkCopyColumnMapping("WLA004", "WL005"); //	鍗曚綅
+                    colMapping[4] = new SqlBulkCopyColumnMapping("WLA005", "WL007"); //	ABC鍒嗙被
+                    colMapping[5] = new SqlBulkCopyColumnMapping("WLA006", "WL011"); //	瀹夊叏搴撳瓨
+                    colMapping[6] = new SqlBulkCopyColumnMapping("WLA007", "WL012"); //	鏈�澶у簱瀛�
+                    colMapping[7] = new SqlBulkCopyColumnMapping("WLA008", "WL013"); //	鏈�灏忓寘瑁呮暟閲�
+                    colMapping[8] = new SqlBulkCopyColumnMapping("WLA009", "WL020"); //	铏氭嫙鏂欏彿
+                    colMapping[9] = new SqlBulkCopyColumnMapping("WLA010", "WL026"); //	涓昏浠撳簱
+                    colMapping[10] = new SqlBulkCopyColumnMapping("WLA011", "WL003"); //	鐗╂枡鍒嗙被缂栧彿
+                    colMapping[11] = new SqlBulkCopyColumnMapping("WLA012", "WL029"); //	淇濊川鏈�                    
+                    colMapping[12] = new SqlBulkCopyColumnMapping("WLA015", "WL024"); //	澶囨敞
+                    colMapping[13] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //	ERPID
+                    colMapping[14] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                    //鍏嶆鏍囧織鏍规嵁鏁版嵁鐪嬫槸鍚︾敤澶囨敞鏉ュ瓨锛岀劧鍚庨�氳繃瑙﹀彂鍣ㄦ洿鏂板埌INVMBD鐗规�ц〃涓�
+                    colMapping[15] = new SqlBulkCopyColumnMapping("WLA013", "WL015"); //	鍏嶆鏍囧織
+                    colMapping[16] = new SqlBulkCopyColumnMapping("WLA014", "WL017"); //	瀹㈡埛缂栫爜
+                    colMapping[17] = new SqlBulkCopyColumnMapping("WLA025", "WL008"); //	鍥惧彿
+                    //colMapping[17] = new SqlBulkCopyColumnMapping("WLA020", "MBA039"); //	鍒嗙粍缂栧彿
+                    //colMapping[18] = new SqlBulkCopyColumnMapping("WLA021", "MBA040"); //	鍒嗙粍鍚嶇О
+                    //colMapping[19] = new SqlBulkCopyColumnMapping("WLA022", "Exprop1"); //	杈呭姪灞炴��1
+                    //colMapping[20] = new SqlBulkCopyColumnMapping("WLA023", "Exprop2"); //	杈呭姪灞炴��2
+                    //colMapping[21] = new SqlBulkCopyColumnMapping("WLA024", "Exprop3"); //	杈呭姪灞炴��3
+                    //colMapping[22] = new SqlBulkCopyColumnMapping("WLA025", "Exprop4"); //	杈呭姪灞炴��4
+                    //colMapping[23] = new SqlBulkCopyColumnMapping("WLA026", "Exprop5"); //	杈呭姪灞炴��5
+                    //colMapping[24] = new SqlBulkCopyColumnMapping("WLA027", "MBA037"); //	鏄惁鍚敤鎵瑰彿
+                    //colMapping[25] = new SqlBulkCopyColumnMapping("MBA030", "MBA030"); //	鐢熸垚鍒嗙被锛岄粯璁ゅ師鏂�
+                    //colMapping[26] = new SqlBulkCopyColumnMapping("WLA028", "MBA041"); //	涓婄骇鍒嗙粍缂栧彿
+                    //colMapping[27] = new SqlBulkCopyColumnMapping("WLA029", "MBA042"); //	涓婄骇鍒嗙粍鍚嶇О
+                    //colMapping[28] = new SqlBulkCopyColumnMapping("WLA030", "MBA043"); //	鍥惧彿
+                   // int A = _sqlHelper.ExecuteNonQuery(sqlL);
+                    colMapping[23] = new SqlBulkCopyColumnMapping("WLA026", "WL039");
+                    colMapping[24] = new SqlBulkCopyColumnMapping("WLA027", "WL040");
+                    colMapping[25] = new SqlBulkCopyColumnMapping("WLA028", "WL041");
+                    colMapping[26] = new SqlBulkCopyColumnMapping("WLA029", "WL042");
+                    colMapping[27] = new SqlBulkCopyColumnMapping("WLA030", "WL043");
+                    colMapping[28] = new SqlBulkCopyColumnMapping("WLA031", "WL044");
+                    colMapping[29] = new SqlBulkCopyColumnMapping("WLA032", "WL045");
+                    colMapping[30] = new SqlBulkCopyColumnMapping("WLA033", "WL046");
+                    colMapping[31] = new SqlBulkCopyColumnMapping("WLA034", "WL047");
+                    colMapping[32] = new SqlBulkCopyColumnMapping("WLA035", "WL048");
+                    colMapping[33] = new SqlBulkCopyColumnMapping("WLA036", "WL049");
+                    colMapping[34] = new SqlBulkCopyColumnMapping("WLA037", "WL050");
+                    colMapping[35] = new SqlBulkCopyColumnMapping("WLA038", "WL051");
+                    colMapping[36] = new SqlBulkCopyColumnMapping("WLA039", "WL052");
+                    colMapping[37] = new SqlBulkCopyColumnMapping("WLA040", "WL053");
+                    colMapping[38] = new SqlBulkCopyColumnMapping("WLA041", "WL054");
+                    colMapping[39] = new SqlBulkCopyColumnMapping("WLA042", "WL055");
+                    colMapping[40] = new SqlBulkCopyColumnMapping("WLA043", "WL056");
+                    colMapping[41] = new SqlBulkCopyColumnMapping("WLA044", "WL057");
+                    colMapping[42] = new SqlBulkCopyColumnMapping("WLA045", "WL058");
+                    colMapping[43] = new SqlBulkCopyColumnMapping("WLA046", "WL059");
+                    colMapping[44] = new SqlBulkCopyColumnMapping("WLA047", "WL060");
+                    colMapping[45] = new SqlBulkCopyColumnMapping("WLA048", "WL061");
+                    colMapping[46] = new SqlBulkCopyColumnMapping("WLA049", "WL062");
+                    colMapping[47] = new SqlBulkCopyColumnMapping("WLA050", "WL063");
+                    colMapping[48] = new SqlBulkCopyColumnMapping("WLA051", "WL064");
+                    colMapping[49] = new SqlBulkCopyColumnMapping("WLA052", "WL065");
+                    colMapping[50] = new SqlBulkCopyColumnMapping("WLA053", "WL066");
+                    colMapping[51] = new SqlBulkCopyColumnMapping("WLA054", "WL067");
+                    colMapping[52] = new SqlBulkCopyColumnMapping("WLA055", "WL068");
+                    colMapping[53] = new SqlBulkCopyColumnMapping("WLA056", "WL069");
+
+
+                    return DataTableToSQLServer(dtHead, conStr, "GS_WL", colMapping, ref ErrorMsg);
+                    #endregion
+                }
+                else if (operatype == "UPDATE")
+                {
+                    //ErrorMsg = "鎵ц淇敼鏁版嵁琛�";
+                    #region UPDATE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        string str = dr["WLA016"].ToString();
+                        string strT = dr["WLA018"].ToString();
+                        //dr["WLA011"] = str + "." + strT;                      
+                        sql += string.Format(@" update GS_WL
+                                    set 
+                                        WL001='{1}',
+                                        WL002='{2}',
+                                        WL004='{3}',
+                                        WL005='{4}',
+                                        WL007='{5}',
+                                        WL011='{6}',
+                                        WL012='{7}',
+                                        WL013='{8}',
+                                        WL020='{9}',
+                                        WL026='{10}',
+                                        WL003='{11}',
+                                        WL024='{12}',
+                                        WL015='{13}',
+                                        WL017='{14}',
+                                        WL008='{15}',ERPID='{16}',
+                                        WL039='{17}',WL040='{18}',WL041='{19}',WL042='{20}',WL043='{21}',WL044='{22}',WL045='{23}',WL046='{24}',WL047='{25}',WL048='{26}',
+                                        WL049='{27}',WL050='{28}',WL051='{29}',WL052='{30}',WL053='{31}',WL054='{32}',WL055='{33}',WL056='{34}',WL057='{35}',WL058='{36}',
+                                        WL059='{37}',WL060='{38}',WL061='{39}',WL062='{40}',WL063='{41}',WL064='{42}',WL065='{43}',WL066='{44}',WL067='{45}',WL068='{46}',WL069='{47}'
+                                    where WL001='{0}'; ", dr["WLA001"]
+                                                        , dr["WLA001"], dr["WLA002"], dr["WLA003"], dr["WLA004"], dr["WLA005"], dr["WLA006"], dr["WLA007"]
+                                                        , dr["WLA008"], dr["WLA009"], dr["WLA010"], dr["WLA011"], dr["WLA015"], dr["WLA013"], dr["WLA014"], dr["WLA025"], dr["ERPID"]
+                                                        , dr["WLA026"], dr["WLA027"], dr["WLA028"], dr["WLA029"], dr["WLA030"], dr["WLA031"], dr["WLA032"], dr["WLA033"], dr["WLA034"]
+                                                        , dr["WLA035"], dr["WLA036"], dr["WLA037"], dr["WLA038"], dr["WLA039"], dr["WLA040"], dr["WLA041"], dr["WLA042"], dr["WLA043"]
+                                                        , dr["WLA044"], dr["WLA045"], dr["WLA046"], dr["WLA047"], dr["WLA048"], dr["WLA049"], dr["WLA050"], dr["WLA051"], dr["WLA052"]
+                                                        , dr["WLA053"], dr["WLA054"], dr["WLA055"], dr["WLA056"]
+                                                        );
+                    }
+                    //int A = _sqlHelper.ExecuteNonQuery(sqlL);
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+                else //DELETE
+                {
+                    //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                    #region DELETE
+                    return true;
+                    //foreach (DataRow dr in dt.Rows)
+                    //{
+                    //    IDList.Add(dr["ERPID"].ToString());
+                    //}
+                    //sql = string.Format(@" delete from INVMBA where ERPID in ('{0}'); ", string.Join("','", IDList));
+
+                    //return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+        
+        #endregion
+
+        #region 6.ERPDWA璁¢噺鍗曚綅(鍚屾鎺ㄩ��) bool TB_ERPTOMES_DW(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPDWA璁¢噺鍗曚綅(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_DW(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+
+            if (operatype == "INSERT" || operatype == "UPDATE")
+            {
+                foreach (DataRow dr in ds.Tables[0].Rows)
+                {
+                    IDList.Add(dr["ERPID"].ToString());
+                }
+
+                //澶勭悊鍓嶅垽鏂槸鍚﹀瓨鍦� 
+                operatype = DataIsInDB("BASMUA", "ERPID", string.Join("','", IDList), "") ? "UPDATE" : "INSERT";
+            }
+
+            try
+            {
+                DataTable dt = ds.Tables[0];
+                if (operatype == "INSERT")
+                {
+                    #region INSERT
+                    //dt.Columns.Add("AUDITING", typeof(string));
+
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+
+                        //dr["AUDITING"] = "Y";
+                    }
+
+                    //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                    DeleteDataBeforeInsert("BASMUA", "ERPID", string.Join("','", IDList), "");
+                    //if (!DeleteDataBeforeInsert("BASMUA", "ERPID", string.Join("','", IDList), ""))
+                    //{
+                    //    ErrorMsg = "BASMUA閲嶅閿垹闄ゅけ璐ワ紒";
+                    //    return false;
+                    //}
+
+                    SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                    colMapping[0] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ERPID
+                    colMapping[1] = new SqlBulkCopyColumnMapping("DWA001", "MUA001");//鍗曚綅缂栫爜
+                    colMapping[2] = new SqlBulkCopyColumnMapping("DWA002", "MUA002");//鍗曚綅鍚嶇О
+
+                    return DataTableToSQLServer(dt, conStr, "BASMUA", colMapping, ref ErrorMsg);
+                    #endregion
+                }
+                else if (operatype == "UPDATE")
+                {
+                    //ErrorMsg = "鎵ц淇敼鏁版嵁琛�";
+                    #region UPDATE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        sql += string.Format(@" update BASMUA
+                                                set 
+                                                    MUA001='{1}',
+                                                    MUA002='{2}'
+                                                where ERPID='{0}'; ", dr["ERPID"]
+                                                                    , dr["DWA001"], dr["DWA002"]);
+                    }
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+                else //DELETE
+                {
+                    //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                    #region DELETE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+                    }
+                    sql = string.Format(@" delete from BASMUA where ERPID in ('{0}'); ", string.Join("','", IDList));
+
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 7.ERPKHA瀹㈡埛淇℃伅(鍚屾鎺ㄩ��) bool TB_ERPTOMES_KH(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPKHA瀹㈡埛淇℃伅(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_KH(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+
+            if (operatype == "INSERT" || operatype == "UPDATE")
+            {
+                foreach (DataRow dr in ds.Tables[0].Rows)
+                {
+                    IDList.Add(dr["ERPID"].ToString());
+                }
+
+                //澶勭悊鍓嶅垽鏂槸鍚﹀瓨鍦� 
+                operatype = DataIsInDB("COMMAA", "ERPID", string.Join("','", IDList), "") ? "UPDATE" : "INSERT";
+            }
+
+            try
+            {
+                DataTable dt = ds.Tables[0];
+                if (operatype == "INSERT")
+                {
+                    #region INSERT
+                    //dt.Columns.Add("AUDITING", typeof(string));
+
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+                        //dr["AUDITING"] = "Y";
+                        //dr["KHA002"] = dr["KHA003"];
+                    }
+
+                    //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                    DeleteDataBeforeInsert("COMMAA", "ERPID", string.Join("','", IDList), "");
+                    //if (!DeleteDataBeforeInsert("COMMAA", "ERPID", string.Join("','", IDList), ""))
+                    //{
+                    //    ErrorMsg = "COMMAA閲嶅閿垹闄ゅけ璐ワ紒";
+                    //    return false;
+                    //}
+
+                    SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                    colMapping[0] = new SqlBulkCopyColumnMapping("KHA001", "MAA001"); //	瀹㈡埛缂栧彿
+                    colMapping[1] = new SqlBulkCopyColumnMapping("KHA002", "MAA002"); //	瀹㈡埛绠�绉�
+                    colMapping[2] = new SqlBulkCopyColumnMapping("KHA003", "MAA003"); //	瀹㈡埛鍚嶇О
+                    colMapping[3] = new SqlBulkCopyColumnMapping("KHA004", "MAA004"); //	瀹㈡埛鑻辨枃
+                    colMapping[4] = new SqlBulkCopyColumnMapping("KHA005", "MAA009"); //	鑱旂郴浜�
+                    colMapping[5] = new SqlBulkCopyColumnMapping("KHA006", "MAA010"); //	鐢佃瘽
+                    colMapping[6] = new SqlBulkCopyColumnMapping("KHA007", "MAA006"); //	澶囨敞
+                    colMapping[7] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //	ERPID
+                    //colMapping[8] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+
+                    return DataTableToSQLServer(dt, conStr, "COMMAA", colMapping, ref ErrorMsg);
+                    #endregion
+                }
+                else if (operatype == "UPDATE")
+                {
+                    //ErrorMsg = "鎵ц淇敼鏁版嵁琛�";
+                    #region UPDATE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        sql += string.Format(@" update COMMAA
+                                    set 
+                                        MAA001='{1}',
+                                        MAA002='{2}',
+                                        MAA003='{3}',
+                                        MAA004='{4}',
+                                        MAA009='{5}',
+                                        MAA010='{6}',
+                                        MAA006='{7}'
+                                    where ERPID='{0}'; ", dr["ERPID"]
+                                                        , dr["KHA001"], dr["KHA003"], dr["KHA003"], dr["KHA004"], dr["KHA005"], dr["KHA006"], dr["KHA007"]);
+                    }
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+                else //DELETE
+                {
+                    //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                    #region DELETE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+                    }
+                    sql = string.Format(@" delete from COMMAA where ERPID in ('{0}'); ", string.Join("','", IDList));
+
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 8.ERPGYS渚涘簲鍟嗕俊鎭�(鍚屾鎺ㄩ��) bool TB_ERPTOMES_GYS(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPGYS渚涘簲鍟嗕俊鎭�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_GYS(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+
+            if (operatype == "INSERT" || operatype == "UPDATE")
+            {
+                foreach (DataRow dr in ds.Tables[0].Rows)
+                {
+                    IDList.Add(dr["ERPID"].ToString());
+                }
+
+                //澶勭悊鍓嶅垽鏂槸鍚﹀瓨鍦� 
+                operatype = DataIsInDB("GS_GYS", "ERPID", string.Join("','", IDList), "") ? "UPDATE" : "INSERT";
+            }
+
+            try
+            {
+                DataTable dt = ds.Tables[0];
+                if (operatype == "INSERT")
+                {
+                    #region INSERT
+                    //dt.Columns.Add("MAA005", typeof(string));
+
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+                    }
+
+                    //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                    DeleteDataBeforeInsert("GS_GYS", "ERPID", string.Join("','", IDList), "");
+                    //if (!DeleteDataBeforeInsert("PURMAA", "ERPID", string.Join("','", IDList), ""))
+                    //{
+                    //    ErrorMsg = "PURMAA閲嶅閿垹闄ゅけ璐ワ紒";
+                    //    return false;
+                    //}
+
+                    SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                    colMapping[0] = new SqlBulkCopyColumnMapping("GYSA001", "GYS001"); //	渚涘簲鍟嗙紪鍙�
+                    colMapping[1] = new SqlBulkCopyColumnMapping("GYSA002", "GYS002"); //	渚涘簲鍟嗙畝绉�
+                    colMapping[2] = new SqlBulkCopyColumnMapping("GYSA003", "GYS003"); //	瀹℃牳鐘舵��
+                    colMapping[3] = new SqlBulkCopyColumnMapping("GYSA004", "GYS004"); //	绂佺敤鐘舵��
+                    colMapping[4] = new SqlBulkCopyColumnMapping("GYSA005", "GYS005"); //	缁勭粐鍙�
+                    colMapping[5] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //	ERPID
+                    colMapping[6] = new SqlBulkCopyColumnMapping("FUseOrgId", "FUseOrgId"); //	鍐�/澶栭攢
+                    //colMapping[8] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+
+                    return DataTableToSQLServer(dt, conStr, "GS_GYS", colMapping, ref ErrorMsg);
+                    #endregion
+                }
+                else if (operatype == "UPDATE")
+                {
+                    //ErrorMsg = "鎵ц淇敼鏁版嵁琛�";
+                    #region UPDATE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        sql += string.Format(@" update GS_GYS
+                                    set 
+                                        GYS001='{1}',
+                                        GYS002='{2}',
+                                        GYS003='{3}',
+                                        GYS004='{4}',
+                                        GYS005='{5}',
+                                        FUseOrgld='{6}'
+                                    where ERPID='{0}'; ", dr["ERPID"]
+                                                        , dr["GYS001"], dr["GYS002"], dr["GYS003"], dr["GYS004"], dr["GYS005"], dr["FUseOrgld"]);
+                    }
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+                else //DELETE
+                {
+                    //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                    #region DELETE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+                    }
+                    sql = string.Format(@" delete from GS_GYS where ERPID in ('{0}'); ", string.Join("','", IDList));
+
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 9.ERPCKA浠撳簱淇℃伅妗�(鍚屾鎺ㄩ��) bool TB_ERPTOMES_CK(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPCKA浠撳簱淇℃伅妗�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_CK(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+
+            if (operatype == "INSERT" || operatype == "UPDATE")
+            {
+                foreach (DataRow dr in ds.Tables[0].Rows)
+                {
+                    IDList.Add(dr["ERPID"].ToString());
+                }
+
+                //澶勭悊鍓嶅垽鏂槸鍚﹀瓨鍦� 
+                operatype = DataIsInDB("GS_CKA", "ERPID", string.Join("','", IDList), "") ? "UPDATE" : "INSERT";
+            }
+
+            try
+            {
+                DataTable dt = ds.Tables[0];
+                if (operatype == "INSERT")
+                {
+                    #region INSERT
+                    dt.Columns.Add("MDA003", typeof(string));//ERP浠撳簱缂栧彿
+                    dt.Columns.Add("MDA004", typeof(string));//閮ㄦ潗绫诲瀷 A=鍘熸潗鏂�,B=鍗婃垚鍝�,C=鎴愬搧
+                    dt.Columns.Add("MDA006", typeof(string));//瀛樿揣鎬ц川 1=瀛樿揣浠� 0=闈炲瓨璐т粨
+                    dt.Columns.Add("MDA007", typeof(string));//绾冲叆鍙敤閲忚绠� Y=绾冲叆锛孨=涓嶇撼鍏�
+                    dt.Columns.Add("MDA008", typeof(string));//搴撳瓨閲忎笉瓒冲噯璁稿嚭搴� Y=鍙互锛孨=涓嶅彲浠�
+                    dt.Columns.Add("MDA009", typeof(string));//鏄惁鍙備笌鐩樼偣 Y=鍙備笌锛孨=涓嶅弬涓�
+                    dt.Columns.Add("MDA011", typeof(string));//浠撳簱鐘舵�� Y=鐢熸晥锛孨=澶辨晥
+                    dt.Columns.Add("MDA012", typeof(string));//浠撳簱鐘舵�� Y=鐢熸晥锛孨=澶辨晥
+
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+
+                        dr["MDA003"] = dr["CKA001"];
+                        dr["MDA004"] = "A";
+                        dr["MDA006"] = "1";
+                        dr["MDA007"] = "Y";
+                        dr["MDA008"] = "N";
+                        dr["MDA009"] = "Y";
+                        dr["MDA011"] = "Y";
+                        dr["CKA003"] = "1";
+                    }
+
+                    //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                    DeleteDataBeforeInsert("GS_CKA", "ERPID", string.Join("','", IDList), "");
+                    //if (!DeleteDataBeforeInsert("BASMDA", "ERPID", string.Join("','", IDList), ""))
+                    //{
+                    //    ErrorMsg = "BASMDA閲嶅閿垹闄ゅけ璐ワ紒";
+                    //    return false;
+                    //}
+
+                    SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                    colMapping[0] = new SqlBulkCopyColumnMapping("CKA001", "CKA001"); //	浠撳簱缂栧彿
+                    colMapping[1] = new SqlBulkCopyColumnMapping("CKA002", "CKA002"); //	浠撳簱鍚嶇О
+                    colMapping[2] = new SqlBulkCopyColumnMapping("CKA003", "CKA005"); //	璐ㄩ噺鐘舵��
+                    colMapping[3] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //	ERPID
+                    colMapping[4] = new SqlBulkCopyColumnMapping("MDA003", "CKA003"); //	ERP浠撳簱缂栧彿
+                    colMapping[5] = new SqlBulkCopyColumnMapping("MDA004", "CKA004"); //	閮ㄦ潗绫诲瀷 A=鍘熸潗鏂�,B=鍗婃垚鍝�,C=鎴愬搧
+                    colMapping[6] = new SqlBulkCopyColumnMapping("MDA006", "CKA006"); //	浠撳簱鎬ц川 1=瀛樿揣浠� 0=闈炲瓨璐т粨
+                    colMapping[7] = new SqlBulkCopyColumnMapping("MDA007", "CKA007"); //	绾冲叆鍙敤閲忚绠� Y=绾冲叆锛孨=涓嶇撼鍏�
+                    colMapping[8] = new SqlBulkCopyColumnMapping("MDA008", "CKA008"); //	搴撳瓨閲忎笉瓒冲噯璁稿嚭搴� Y=鍙互锛孨=涓嶅彲浠�
+                    colMapping[9] = new SqlBulkCopyColumnMapping("MDA009", "CKA009"); //	鏄惁鍙備笌鐩樼偣 Y=鍙備笌锛孨=涓嶅弬涓�
+                    colMapping[10] = new SqlBulkCopyColumnMapping("MDA011", "CKA011"); //	浠撳簱鐘舵�� Y=鐢熸晥锛孨=澶辨晥
+                    colMapping[11] = new SqlBulkCopyColumnMapping("MDA012", "CKA012");//浠撳簱鎬ц川 1鑹搧2涓嶈壇鍝�3寰呮鍝�4鎶ュ簾鍝�5閫斾腑鍝�
+
+                    return DataTableToSQLServer(dt, conStr, "GS_CKA", colMapping, ref ErrorMsg);
+                    #endregion
+                }
+                else if (operatype == "UPDATE")
+                {
+                    //ErrorMsg = "鎵ц淇敼鏁版嵁琛�";
+                    #region UPDATE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        sql += string.Format(@" update GS_CKA
+                                    set 
+                                        CKA001='{1}',
+                                        CKA002='{2}',
+                                        CKA005='{3}'
+                                    where ERPID='{0}'; ", dr["ERPID"]
+                                                        , dr["CKA001"], dr["CKA002"], "1");
+                    }
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+                else //DELETE
+                {
+                    //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                    #region DELETE
+                 
+
+                    return true;
+                    #endregion
+                }
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 10.ERPGXA宸ュ簭(鍚屾鎺ㄩ��) bool TB_ERPTOMES_GX(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPGXA宸ュ簭(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_GX(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+
+            if (operatype == "INSERT" || operatype == "UPDATE")
+            {
+                foreach (DataRow dr in ds.Tables[0].Rows)
+                {
+                    IDList.Add(dr["ERPID"].ToString());
+                }
+
+                //澶勭悊鍓嶅垽鏂槸鍚﹀瓨鍦� 
+                operatype = DataIsInDB("MCSMBA", "ERPID", string.Join("','", IDList), "") ? "UPDATE" : "INSERT";
+            }
+
+            try
+            {
+                DataTable dt = ds.Tables[0];
+                if (operatype == "INSERT")
+                {
+                    #region INSERT
+                    dt.Columns.Add("MBA008", typeof(string));//鏄惁杩斿伐鐐�
+
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+
+                        dr["GXA005"] = "Y";
+                        dr["MBA008"] = "N";
+                    }
+
+                    //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                    DeleteDataBeforeInsert("MCSMBA", "ERPID", string.Join("','", IDList), "");
+                    //if (!DeleteDataBeforeInsert("MCSMBA", "ERPID", string.Join("','", IDList), ""))
+                    //{
+                    //    ErrorMsg = "MCSMBA閲嶅閿垹闄ゅけ璐ワ紒";
+                    //    return false;
+                    //}
+
+                    SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                    colMapping[0] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //	ERPID
+                    colMapping[1] = new SqlBulkCopyColumnMapping("GXA001", "MBA001"); //	宸ュ簭浠g爜
+                    colMapping[2] = new SqlBulkCopyColumnMapping("GXA002", "MBA002"); //	宸ュ簭鍚嶇О
+                    colMapping[3] = new SqlBulkCopyColumnMapping("GXA003", "MBA003"); //	宸ュ簭鎻忚堪                    
+                    colMapping[4] = new SqlBulkCopyColumnMapping("GXA004", "MBA004"); //	宸ュ簭瑕佹眰
+                    colMapping[5] = new SqlBulkCopyColumnMapping("GXA005", "MBA006"); //	浣跨敤鐘舵��
+                    colMapping[6] = new SqlBulkCopyColumnMapping("GXA006", "MBA007"); //	澶囨敞淇℃伅
+                    colMapping[7] = new SqlBulkCopyColumnMapping("MBA008", "MBA008"); //	鏄惁杩斿伐鐐�
+                    //colMapping[8] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+
+                    return DataTableToSQLServer(dt, conStr, "MCSMBA", colMapping, ref ErrorMsg);
+                    #endregion
+                }
+                else if (operatype == "UPDATE")
+                {
+                    //ErrorMsg = "鎵ц淇敼鏁版嵁琛�";
+                    #region UPDATE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        sql += string.Format(@" update MCSMBA
+                                    set 
+                                        MBA001='{1}',
+                                        MBA002='{2}',
+                                        MBA003='{3}',
+                                        MBA004='{4}',
+                                        MBA006='{5}',
+                                        MBA007='{6}'
+                                    where ERPID='{0}'; ", dr["ERPID"]
+                                                        , dr["GXA001"], dr["GXA002"], dr["GXA003"], dr["GXA004"], dr["GXA005"], dr["GXA006"]);
+                    }
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+                else //DELETE
+                {
+                    //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                    #region DELETE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+                    }
+                    sql = string.Format(@" delete from MCSMBA where ERPID in ('{0}'); ", string.Join("','", IDList));
+                    
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 11.ERPBOMA(鍚屾鎺ㄩ��) bool TB_ERPTOMES_BOM(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPBOMA(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_BOM(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+            string dtName = "";
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+
+            try
+            {
+                foreach (DataTable dt in ds.Tables)
+                {
+                    dtName = dt.TableName;
+                    IDList.Clear();
+                    //涓讳粠琛ㄧ殑鍚屾锛屼慨鏀瑰拰鏂板涓�鏍凤紝鍏堝垹闄ゅ師璁板綍鍚庢彃鍏ユ柊璁板綍,瑕佹眰鍚屾杩囨潵鐨勬暟鎹篃鏄暣鍗曞畬鏁存暟鎹�
+                    if (operatype == "INSERT" || operatype == "UPDATE")
+                    {
+                        #region INSERT
+                        if (dt.TableName == "ERPBOMA")
+                        {
+                            #region BOM涓昏〃鐨勫鐞�
+                            dt.Columns.Add("AUDITING", typeof(string));
+                            //dt.Columns.Add("ID", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+
+                                dr["AUDITING"] = "Y";
+                                if (dr["BOMA007"].ToString() == "")
+                                {
+                                    dr["BOMA007"] = "0";
+                                }
+                                if (dr["BOMA009"].ToString() == "")
+                                {
+                                    dr["BOMA009"] = "0";
+                                }
+                                if (dr["BOMA010"].ToString() == "")
+                                {
+                                    dr["BOMA010"] = "0";
+                                }
+                                if (dr["BOMA011"].ToString() == "")
+                                {
+                                    dr["BOMA011"] = "0";
+                                }
+                                if (dr["BOMA013"].ToString() == "")
+                                {
+                                    dr["BOMA013"] = "0";
+                                }
+                                //dr["ID"] = dr["ERPID"];
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("BOMMAA", "ID", string.Join("','", IDList), "");
+                            //if (!DeleteDataBeforeInsert("BOMMAA", "ID", string.Join("','", IDList), ""))
+                            //{
+                            //    ErrorMsg = "BOMMAA閲嶅閿垹闄ゅけ璐ワ紒";
+                            //    return false;
+                            //}
+
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                            colMapping[0] = new SqlBulkCopyColumnMapping("ERPID", "ID"); //	ID
+                            colMapping[1] = new SqlBulkCopyColumnMapping("BOMA001", "MAA001"); //	涓讳欢缂栫爜
+                            colMapping[2] = new SqlBulkCopyColumnMapping("BOMA002", "MAA002"); //	鍗曚綅
+                            colMapping[3] = new SqlBulkCopyColumnMapping("BOMA003", "MAA003"); //	BOM鐗堟湰
+                            colMapping[4] = new SqlBulkCopyColumnMapping("BOMA004", "MAA004"); //	鍙樻洿鍗曞彿
+                            colMapping[5] = new SqlBulkCopyColumnMapping("BOMA005", "MAA005"); //	ECN鍙樻洿鐗堟
+                            colMapping[6] = new SqlBulkCopyColumnMapping("BOMA006", "MAA006"); //	绋嬪簭缂栧彿
+                            colMapping[7] = new SqlBulkCopyColumnMapping("BOMA007", "MAA007"); //	鎬荤偣鏁�
+                            colMapping[8] = new SqlBulkCopyColumnMapping("BOMA008", "MAA008"); //	鍩烘澘鍚嶇О
+                            colMapping[9] = new SqlBulkCopyColumnMapping("BOMA009", "MAA009"); //	鍩烘澘鍘氬害
+                            colMapping[10] = new SqlBulkCopyColumnMapping("BOMA010", "MAA010"); //	鍩虹増瀹藉害
+                            colMapping[11] = new SqlBulkCopyColumnMapping("BOMA011", "MAA011"); //	鍩烘澘鏋氭暟
+                            colMapping[12] = new SqlBulkCopyColumnMapping("BOMA012", "MAA012"); //	鏃堕棿鎴�
+                            colMapping[13] = new SqlBulkCopyColumnMapping("BOMA013", "MAA013"); //	鏍囧噯鐢ㄩ噺
+                            colMapping[14] = new SqlBulkCopyColumnMapping("BOMA014", "MAA014"); //	澶囨敞淇℃伅                            
+                            colMapping[15] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+
+                            DataTableToSQLServer(dt, conStr, "BOMMAA", colMapping, ref ErrorMsg); 
+                            #endregion
+                        }
+                        if (dt.TableName == "ERPBOMB")
+                        {
+                            #region BOM鏄庣粏鐨勫鐞�
+                            dt.Columns.Add("AUDITING", typeof(string));
+                            //dt.Columns.Add("ID", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+
+                                dr["AUDITING"] = "Y";
+                                if (dr["BOMB007"].ToString() == "")
+                                {
+                                    dr["BOMB007"] = "0";
+                                }
+                                if (dr["BOMB008"].ToString() == "")
+                                {
+                                    dr["BOMB008"] = "1";
+                                }
+                                if (dr["BOMB009"].ToString() == "")
+                                {
+                                    dr["BOMB009"] = "0";
+                                }
+                                if (dr["BOMB011"].ToString() == "")
+                                {
+                                    dr["BOMB011"] = "0";
+                                }
+                                if (dr["BOMB017"].ToString() == "")
+                                {
+                                    dr["BOMB017"] = "0";
+                                }
+                                if (dr["BOMB006"].ToString() == "")
+                                {
+                                    dr["BOMB006"] = "PCS";
+                                }
+                                //dr["ID"] = dr["ERPID"];
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("BOMMAB", "ID", string.Join("','", IDList), "");
+                            //if (!DeleteDataBeforeInsert("BOMMAB", "ID+MAB002", string.Join("','", IDList), ""))
+                            //{
+                            //    ErrorMsg = "BOMMAB閲嶅閿垹闄ゅけ璐ワ紒";
+                            //    return false;
+                            //}
+
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                            colMapping[0] = new SqlBulkCopyColumnMapping("ERPID", "ID"); //	ID
+                            colMapping[1] = new SqlBulkCopyColumnMapping("BOMB001", "MAB001"); //	涓讳欢缂栫爜
+                            colMapping[2] = new SqlBulkCopyColumnMapping("BOMB002", "MAB002"); //	搴忓彿
+                            colMapping[3] = new SqlBulkCopyColumnMapping("BOMB003", "MAB003"); //	鐗╂枡缂栫爜
+                            colMapping[4] = new SqlBulkCopyColumnMapping("BOMB004", "MAB024"); //	鐗╂枡鍚嶇О
+                            colMapping[5] = new SqlBulkCopyColumnMapping("BOMB005", "MAB029"); //	鐗╂枡瑙勬牸
+                            colMapping[6] = new SqlBulkCopyColumnMapping("BOMB006", "MAB004"); //	鍗曚綅
+                            colMapping[7] = new SqlBulkCopyColumnMapping("BOMB007", "MAB006"); //	缁勬垚鐢ㄩ噺
+                            colMapping[8] = new SqlBulkCopyColumnMapping("BOMB008", "MAB007"); //	搴曟暟
+                            colMapping[9] = new SqlBulkCopyColumnMapping("BOMB009", "MAB008"); //	鎹熻�楃巼%
+                            colMapping[10] = new SqlBulkCopyColumnMapping("BOMB010", "MAB009"); //	宸ヨ壓
+                            colMapping[11] = new SqlBulkCopyColumnMapping("BOMB011", "MAB010"); //	姘村彛鏂欐瘮渚�
+                            colMapping[12] = new SqlBulkCopyColumnMapping("BOMB012", "MAB011"); //	鐢熸晥鏃ユ湡
+                            colMapping[13] = new SqlBulkCopyColumnMapping("BOMB013", "MAB013"); //	澶辨晥鏃ユ湡
+                            colMapping[14] = new SqlBulkCopyColumnMapping("BOMB014", "MAB012"); //	鏉垮彿
+                            colMapping[15] = new SqlBulkCopyColumnMapping("BOMB015", "MAB015"); //	鐐逛綅
+                            colMapping[16] = new SqlBulkCopyColumnMapping("BOMB016", "MAB016"); //	鏉愭枡绫诲瀷
+                            colMapping[17] = new SqlBulkCopyColumnMapping("BOMB017", "MAB017"); //	姘村彛
+                            colMapping[18] = new SqlBulkCopyColumnMapping("BOMB018", "MAB018"); //	宸ヤ綅
+                            colMapping[19] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+
+                            DataTableToSQLServer(dt, conStr, "BOMMAB", colMapping, ref ErrorMsg); 
+                            #endregion
+                        }
+                        
+                        #endregion
+                    }
+                    else //DELETE
+                    {
+                        //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                        #region DELETE
+                        if (dt.TableName == "ERPBOMA")
+                        {
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+                            }
+                            sql = string.Format(@" delete from BOMMAA where ID in ('{0}');  delete from BOMMAB where ID in ('{0}'); ", string.Join("','", IDList));
+                        }
+                        _sqlHelper.ExecuteNonQuery(sql);
+                        #endregion
+                    }
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = "[" + dtName + "]" + ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 12.ERPTDL鏇夸唬鏂欏悓姝�(鍚屾鎺ㄩ��) bool TB_ERPTOMES_TDL(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPTDL鏇夸唬鏂欏悓姝�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_TDL(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+            try
+            {
+                DataTable dt = ds.Tables[0];
+                if (operatype == "INSERT")
+                {
+                    #region INSERT
+                    dt.Columns.Add("ID", typeof(string));
+
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+
+                        dr["ID"] = dr["ERPID"];
+                    }
+
+                    //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                    DeleteDataBeforeInsert("BOMMBB", "ERPID", string.Join("','", IDList), "");
+                    //if (!DeleteDataBeforeInsert("BOMMBB", "ERPID", string.Join("','", IDList), ""))
+                    //{
+                    //    ErrorMsg = "BOMMBB閲嶅閿垹闄ゅけ璐ワ紒";
+                    //    return false;
+                    //}
+
+                    SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                    colMapping[0] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //	ID
+                    colMapping[1] = new SqlBulkCopyColumnMapping("TDL001", "MBB001"); //	涓讳欢鍝佸彿
+                    colMapping[2] = new SqlBulkCopyColumnMapping("TDL002", "MBB002"); //	BOM鐗堟湰鍙�
+                    colMapping[3] = new SqlBulkCopyColumnMapping("TDL003", "MBB003"); //	鏉愭枡鍝佸彿                    
+                    colMapping[4] = new SqlBulkCopyColumnMapping("TDL004", "MBB004"); //	閫氱敤鏉愭枡鍝佸彿
+                    colMapping[5] = new SqlBulkCopyColumnMapping("TDL005", "MBB006"); //	閫氱敤椤哄簭
+                    colMapping[6] = new SqlBulkCopyColumnMapping("TDL006", "MBB007"); //	鐢熸晥鏃ユ湡
+                    colMapping[7] = new SqlBulkCopyColumnMapping("TDL007", "MBB008"); //	澶辨晥鏃ユ湡
+                    colMapping[8] = new SqlBulkCopyColumnMapping("TDL008", "MBB013"); //	閰嶅鍙樻洿缁�
+                    colMapping[9] = new SqlBulkCopyColumnMapping("TDL009", "MBB012"); //	澶囨敞
+                    colMapping[10] = new SqlBulkCopyColumnMapping("ID", "ID"); //	澶囨敞
+                    return DataTableToSQLServer(dt, conStr, "BOMMBB", colMapping, ref ErrorMsg);
+                    #endregion
+                }
+                else if (operatype == "UPDATE")
+                {
+                    //ErrorMsg = "鎵ц淇敼鏁版嵁琛�";
+                    #region UPDATE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        sql += string.Format(@" update BOMMBB
+                                    set 
+                                        MBB001='{1}',
+                                        MBB002='{2}',
+                                        MBB003='{3}',
+                                        MBB004='{4}',
+                                        MBB006='{5}',
+                                        MBB007='{6}',
+                                        MBB008='{7}',
+                                        MBB013='{8}',
+                                        MBB012='{9}'
+                                    where ERPID='{0}'; ", dr["ERPID"]
+                                                        , dr["TDL001"], dr["TDL002"], dr["TDL003"], dr["TDL004"]
+                                                        , dr["TDL005"], dr["TDL006"], dr["TDL007"], dr["TDL008"], dr["TDL009"]);
+                    }
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+                else //DELETE
+                {
+                    //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                    #region DELETE
+                    foreach (DataRow dr in dt.Rows)
+                    {
+                        IDList.Add(dr["ERPID"].ToString());
+                    }
+                    sql = string.Format(@" delete from BOMMBB where ERPID in ('{0}'); ", string.Join("','", IDList));
+
+                    return _sqlHelper.ExecuteNonQuery(sql) > 0;
+                    #endregion
+                }
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 13.ERPCGA閲囪喘璁㈠崟锝滃澶栬鍗�(鍚屾鎺ㄩ��) bool TB_ERPTOMES_CG(string task_name,DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPCGA閲囪喘璁㈠崟锝滃澶栬鍗�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="task_name">浠诲姟鍚嶇О</param>
+        /// <param name="ds">鏁版嵁闆�</param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_CG(string task_name,DataSet ds, string operatype, ref string ErrorMsg,string  rtaskid)
+        {
+            string sql = "";
+            string org = "瀹佹尝";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+            string dtName = "";
+            if (operatype != "INSERT" && operatype != "UPDATE")
+            {
+                sql = string.Format(@" delete from GS_CG where CGA001 in ('{0}') ", operatype);
+              string  sqlTT = string.Format(@" delete from CGDB where CGB001 in ('{0}') ", operatype);
+                _sqlHelper.ExecuteNonQuery(sql);
+                _sqlHelper.ExecuteNonQuery(sqlTT);
+                return true;
+            }
+
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+            try
+            {
+                foreach (DataTable dt in ds.Tables)
+                {
+
+                    dtName = dt.TableName;
+                    IDList.Clear();
+                    //涓讳粠琛ㄧ殑鍚屾锛屼慨鏀瑰拰鏂板涓�鏍凤紝鍏堝垹闄ゅ師璁板綍鍚庢彃鍏ユ柊璁板綍,瑕佹眰鍚屾杩囨潵鐨勬暟鎹篃鏄暣鍗曞畬鏁存暟鎹�
+                    if (operatype == "INSERT" || operatype == "UPDATE")
+                    {
+                        #region INSERT
+                        if (dt.TableName == "ERPCGA")
+                        {
+                            #region 閲囪喘璁㈠崟涓昏〃鐨勫鐞�
+                            dt.Columns.Add("AUDITING", typeof(string));
+                            dt.Columns.Add("NEWERPID", typeof(string));
+                          
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                if (dr.Table.Columns.Contains("CGAORG"))
+                                {
+                                    org = "涓藉痉";
+                                 
+                                    string UP = string.Format(@"EXEC [WMS_CGLD_TOJX] '{0}' ", rtaskid);
+                                    _sqlHelper.ExecuteNonQuery(UP);
+                                    dr["NEWERPID"] = "LD"+dr["ERPID"].ToString();
+                                    IDList.Add("LD"+dr["ERPID"].ToString());
+                                }
+                                else
+                                {
+                                    IDList.Add(dr["ERPID"].ToString());
+                                    dr["NEWERPID"] = dr["ERPID"].ToString();
+                                }
+
+                             
+
+                                dr["AUDITING"] = "Y";
+
+                                if (dr["CGA002"].ToString() == "")
+                                {
+                                    dr["CGA002"] = task_name == "TB_ERPTOMES_CG" ? "3301" : "3302";
+                                }
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("GS_CG", "ID", string.Join("','", IDList), "");
+                            //if (!DeleteDataBeforeInsert("PURDDA", "ERPID", string.Join("','", IDList), ""))
+                            //{
+                            //    ErrorMsg = "PURDDA閲嶅閿垹闄ゅけ璐ワ紒";
+                            //    return false;
+                            //}
+
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                            colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "flagApp");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("NEWERPID", "ID"); //ID 
+                            colMapping[2] = new SqlBulkCopyColumnMapping("CGA001", "CGA001"); //閲囪喘鍗曞彿
+                            colMapping[3] = new SqlBulkCopyColumnMapping("CGA002", "CGA002"); //閲囪喘鍗曞埆
+                            colMapping[4] = new SqlBulkCopyColumnMapping("CGA003", "CGA003"); //閲囪喘鏃ユ湡
+                            colMapping[5] = new SqlBulkCopyColumnMapping("CGA004", "CGA004"); //鍗曟嵁鏃ユ湡
+                            colMapping[6] = new SqlBulkCopyColumnMapping("CGA005", "CGA005"); //鍗曟嵁绫诲瀷 1銆侀噰璐�2銆佸澶�
+                            colMapping[7] = new SqlBulkCopyColumnMapping("CGA006", "CGA006"); //渚涘簲鍟�
+                            colMapping[8] = new SqlBulkCopyColumnMapping("CGA007", "CGA007"); //渚涘簲鍟嗙畝绉�
+                            colMapping[9] = new SqlBulkCopyColumnMapping("CGA008", "CGA008"); //鍏抽棴鐘舵��
+                            colMapping[10] = new SqlBulkCopyColumnMapping("CGA009", "CGA009"); //瀹㈡埛缂栧彿
+                            colMapping[11] = new SqlBulkCopyColumnMapping("CGA0010", "CGA010"); //鍙戞枃鍗曞彿
+                            colMapping[12] = new SqlBulkCopyColumnMapping("CGA0011", "CGA011"); //浜ゆ槗甯佺
+                            colMapping[13] = new SqlBulkCopyColumnMapping("CGA0012", "CGA012"); //钀ヤ笟鎷呭綋
+                            colMapping[14] = new SqlBulkCopyColumnMapping("CGA0013", "CGA013"); //钀ヤ笟鐢佃瘽
+                            colMapping[15] = new SqlBulkCopyColumnMapping("CGA0014", "CGA014"); //閲囪喘鎷呭綋
+                            colMapping[16] = new SqlBulkCopyColumnMapping("CGA0015", "CGA015"); //瀹℃牳鑰�
+                            colMapping[17] = new SqlBulkCopyColumnMapping("CGA0016", "CGA016"); //瀹℃牳鏃ユ湡
+                            colMapping[18] = new SqlBulkCopyColumnMapping("CGA0017", "CGA017"); //澶囨敞
+                            if (dt.Columns.Contains("CGAORG"))
+                            {
+                                colMapping[19] = new SqlBulkCopyColumnMapping("CGAORG", "CGAORG"); //澶囨敞
+                            }
+                            else
+                            {
+                            
+                            }
+                            if (dt.Columns.Contains("CGA018"))
+                            {
+                                colMapping[20] = new SqlBulkCopyColumnMapping("CGA018", "CGA018"); //澶囨敞
+                            }
+                            if (dt.Columns.Contains("CGA0018"))
+                            {
+                                colMapping[20] = new SqlBulkCopyColumnMapping("CGA0018", "CGA018"); //澶囨敞
+                            }
+
+
+                            DataTableToSQLServer(dt, conStr, "GS_CG", colMapping, ref ErrorMsg);
+                            #endregion
+                        }
+                        if (dt.TableName == "ERPCGB")
+                        {
+                            #region 閲囪喘璁㈠崟鏄庣粏鐨勫鐞�
+                            dt.Columns.Add("AUDITING", typeof(string));
+                            dt.Columns.Add("NEWERPID", typeof(string));
+                            dt.Columns.Add("NEWERPIDB", typeof(string));
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                if (org=="涓藉痉")
+                                {
+                                    IDList.Add("LD"+dr["ERPID"].ToString());
+                                    dr["NEWERPID"] = "LD" + dr["ERPID"].ToString();
+                                    dr["NEWERPIDB"] = "LD" + dr["ERP_EntryID"].ToString();
+                                
+                                }
+                                else
+                                {
+                                    IDList.Add(dr["ERPID"].ToString());
+                                    dr["NEWERPID"] = dr["ERPID"].ToString();
+                                    dr["NEWERPIDB"] = dr["ERP_EntryID"].ToString();
+                                }
+
+                  
+
+                                dr["AUDITING"] = "Y";
+
+                                if (dr["CGB008"].ToString() == "")
+                                {
+                                    dr["CGB008"] = "0";
+                                }
+                                else
+                                {
+                                    Decimal A = Convert.ToDecimal(dr["CGB008"].ToString());
+                                    string B = A.ToString();
+                                    dr["CGB008"] = B;
+                                }
+                                if (dr["CGB0010"].ToString() == "")
+                                {
+                                    dr["CGB0010"] = "0";
+                                }
+                                else
+                                {
+                                    Decimal A = Convert.ToDecimal(dr["CGB0010"].ToString());
+                                    string B = A.ToString();
+                                    dr["CGB0010"] = B;
+                                }
+                                if (dr["CGB0011"].ToString() == "")
+                                {
+                                    dr["CGB0011"] = "0";
+                                }
+                                else
+                                {
+                                    Decimal A = Convert.ToDecimal(dr["CGB0011"].ToString());
+                                    string B = A.ToString();
+                                    dr["CGB0011"] = B;
+                                }
+                                if (dr["CGB0014"].ToString() == "")
+                                {
+                                    dr["CGB0014"] = "0";
+                                }
+                                else
+                                {
+                                    Decimal A = Convert.ToDecimal(dr["CGB0014"].ToString());
+                                    string B = A.ToString();
+                                    dr["CGB0014"] = B;
+                                }
+                                if (dr["CGB0015"].ToString() == "")
+                                {
+                                    dr["CGB0015"] = "0";
+                                }
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("CGDB", "PID", string.Join("','", IDList), "");
+                            //if (!DeleteDataBeforeInsert("PURDDB", "ERPID+DDB002", string.Join("','", IDList), ""))
+                            //{
+                            //    ErrorMsg = "PURDDB閲嶅閿垹闄ゅけ璐ワ紒";
+                            //    return false;
+                            //}
+
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+                            colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "flagApp");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("NEWERPID", "PID"); //ERPID
+                            colMapping[2] = new SqlBulkCopyColumnMapping("CGB001", "CGB001"); //閲囪喘鍗曞彿
+                            colMapping[3] = new SqlBulkCopyColumnMapping("CGB002", "CGB002"); //搴忓彿
+                            colMapping[4] = new SqlBulkCopyColumnMapping("CGB003", "CGB003"); //鐗╂枡缂栫爜
+                            colMapping[5] = new SqlBulkCopyColumnMapping("CGB004", "CGB004"); //鐗╂枡鍚嶇О
+                            colMapping[6] = new SqlBulkCopyColumnMapping("CGB005", "CGB005"); //鐗╂枡瑙勬牸
+                            colMapping[7] = new SqlBulkCopyColumnMapping("CGB006", "CGB006"); //浠撳簱缂栧彿
+                            colMapping[8] = new SqlBulkCopyColumnMapping("CGB007", "CGB007"); //浠撳簱鍚嶇О
+                            colMapping[9] = new SqlBulkCopyColumnMapping("CGB008", "CGB008"); //閲囪喘鏁伴噺
+                            colMapping[10] = new SqlBulkCopyColumnMapping("CGB009", "CGB009"); //鍗曚綅
+                            colMapping[11] = new SqlBulkCopyColumnMapping("CGB0010", "CGB010"); //閲囪喘鍗曚环
+                            colMapping[12] = new SqlBulkCopyColumnMapping("CGB0011", "CGB011"); //閲囪喘閲戦
+                            colMapping[13] = new SqlBulkCopyColumnMapping("CGB0012", "CGB012"); //棰勪氦璐ф棩
+                            colMapping[14] = new SqlBulkCopyColumnMapping("CGB0013", "CGB013"); //瀹㈡埛鏂欏彿
+                            colMapping[15] = new SqlBulkCopyColumnMapping("CGB0014", "CGB014"); //宸蹭氦鏁伴噺
+                            colMapping[16] = new SqlBulkCopyColumnMapping("CGB0015", "CGB015"); //宸插澶栧嚭搴撴暟閲�
+                            colMapping[17] = new SqlBulkCopyColumnMapping("CGB0016", "CGB016"); //缁撴潫
+                            colMapping[18] = new SqlBulkCopyColumnMapping("CGB0018", "CGB018"); //澶囨敞
+                            colMapping[19] = new SqlBulkCopyColumnMapping("NEWERPIDB", "ID"); //澶囨敞
+                            colMapping[20] = new SqlBulkCopyColumnMapping("CGB0017", "CGB017"); //澶囨敞
+                            colMapping[21] = new SqlBulkCopyColumnMapping("CGB0019", "CGB019"); //浜よ揣涓婇檺
+                            colMapping[22] = new SqlBulkCopyColumnMapping("CGB0020", "CGB020"); //瓒呮敹姣斾緥
+                            colMapping[23] = new SqlBulkCopyColumnMapping("CGB0021", "CGB021"); //鍚◣鍗曚环
+                            colMapping[24] = new SqlBulkCopyColumnMapping("CGB0022", "CGB022"); //浠风◣鍚堣
+                            DataTableToSQLServer(dt, conStr, "CGDB", colMapping, ref ErrorMsg);
+
+                            foreach (DataRow dF in dt.Rows)
+                            {
+                                string UP = string.Format(@"EXEC API_UPDATE_CGDB {0},{1} ", dF["CGB001"].ToString(), dF["CGB002"].ToString());
+                                _sqlHelper.ExecuteNonQuery(UP);
+                            }
+
+                            #endregion
+                        }
+
+                        #endregion
+                    }
+                    else //DELETE
+                    {
+                        //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                        #region DELETE
+                        //if (dt.TableName == "ERPCGA")
+                        //{
+                        //    foreach (DataRow dr in dt.Rows)
+                        //    {
+                        //        IDList.Add(dr["ERPID"].ToString());
+                        //    }
+                        //    sql = string.Format(@" delete from PURDDA where ERPID in ('{0}');  delete from PURDDB where ERPID in ('{0}'); ", string.Join("','", IDList));
+                        //}
+                        //_sqlHelper.ExecuteNonQuery(sql);
+                        #endregion
+                    }
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = "[" + dtName + "]" + ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 14.ERPTLA鐢熶骇鎶曟枡鍗�(鍚屾鎺ㄩ��) bool TB_ERPTOMES_TL(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPTLA鐢熶骇鎶曟枡鍗�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_TL(DataSet ds, string operatype, ref string ErrorMsg,DataRow drT)
+        {
+            string sql = "";
+            string taskid = drT["task_id"].ToString();
+            string data = drT["data"].ToString();
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+            string dtName = "";
+            if (operatype != "INSERT" && operatype != "UPDATE")
+            {
+                sql = string.Format(@" delete from WOMCAA where CAA002 in ('{0}') ", operatype);
+            
+                _sqlHelper.ExecuteNonQuery(sql);
+                return true;
+            }
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+            try
+            {
+                foreach (DataTable dt in ds.Tables)
+                {
+                    dtName = dt.TableName;
+                    IDList.Clear();
+                    //涓讳粠琛ㄧ殑鍚屾锛屼慨鏀瑰拰鏂板涓�鏍凤紝鍏堝垹闄ゅ師璁板綍鍚庢彃鍏ユ柊璁板綍,瑕佹眰鍚屾杩囨潵鐨勬暟鎹篃鏄暣鍗曞畬鏁存暟鎹�
+                    if (operatype == "INSERT" || operatype == "UPDATE")
+                    {
+                        #region INSERT
+                        if (dt.TableName == "ERPTLA")
+                        {
+
+                            #region 鎶曟枡鍗曚富琛ㄧ殑澶勭悊
+                            //  dt.Columns.Add("AUDITING", typeof(string));
+                            dt.Columns.Add("CAA022", typeof(string));
+                            dt.Columns.Add("CAA020", typeof(string));
+                         
+                            foreach (DataRow dr in dt.Rows)
+                            {
+
+                               String sqlDE = string.Format(@"delete from WOMCAB where PID in ('{0}')", dr["TLA001"].ToString());
+                               _sqlHelper.ExecuteNonQuery(sqlDE);
+                                IDList.Add(dr["ERP_EntryID"].ToString());
+                                dr["TLA012"] = Convert.ToDouble(dr["TLA012"]).ToString();
+                               // dr["AUDITING"] = "Y";
+                                dr["CAA022"] = dr["TLA012"];
+                                dr["TLA002"] = dr["TLA019"];//宸ュ崟鎵规鐩存帴鍙栦换鍔″崟鍙峰惂
+                                dr["CAA020"] = DateTime.Now.ToString("yyyy-MM-dd");
+                                if (dr["TLA004"].ToString() == "" || dr["TLA004"].ToString() == "1")
+                                {
+                                    dr["TLA004"] = "5102";//榛樿DIP宸ュ崟
+                                }
+                                else
+                                {
+                                    dr["TLA004"] = "5109";//杩斿伐宸ュ崟
+                                }
+                                if (dr["TLA015"].ToString().Length<5)
+                                {
+                                    string womcaa = string.Format(@"SELECT * FROM WORKNO(NOLOCK) WHERE 鍗曟嵁缂栧彿='{0}'", dr["TLA002"].ToString());
+                                    DataTable WOM= _sqlHelper.ExecuteDataTable(womcaa);
+                                    if (WOM.Rows.Count<1)
+                                    {
+                                        dr["TLA015"] ="";
+                                        dr["TLA021"] = "";
+                                    }
+                                    else
+                                    {
+                                        dr["TLA015"] = WOM.Rows[0]["澶囨敞"].ToString();
+                                        dr["TLA021"] = WOM.Rows[0]["瀹㈡埛鍚嶇О"].ToString();
+                                        string womca = string.Format(@"SELECT * FROM KUDD(NOLOCK) WHERE fbillno='{0}'", WOM.Rows[0]["澶囨敞"].ToString());
+                                        DataTable WOMT = _sqlHelper.ExecuteDataTable(womca);
+                                        if (WOMT.Rows.Count < 1)
+                                        {
+                                            dr["TLA014"] = "";
+                                        }
+                                        else
+                                        {
+                                            dr["TLA014"] = WOMT.Rows[0]["forderbillno"].ToString();
+                                        }
+                                    }
+                                   
+                                    
+                                }
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("WOMCAA", "ERPID", string.Join("','", IDList), "");
+                            //if (!DeleteDataBeforeInsert("WOMCAA", "ERPID", string.Join("','", IDList), ""))
+                            //{
+                            //    ErrorMsg = "WOMCAA閲嶅閿垹闄ゅけ璐ワ紒";
+                            //    return false;
+                            //}
+
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                            //colMapping[1] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("ERP_EntryID", "ERPID"); //ERPID 
+                            colMapping[2] = new SqlBulkCopyColumnMapping("TLA001", "CAA001"); //鍗曞彿
+                            colMapping[3] = new SqlBulkCopyColumnMapping("TLA002", "CAA002"); //ERP宸ュ崟鎵规
+                            colMapping[4] = new SqlBulkCopyColumnMapping("TLA003", "CAA003"); //瀹㈡埛缂栧彿
+                            colMapping[5] = new SqlBulkCopyColumnMapping("TLA004", "CAA004"); //鍗曟嵁绫诲瀷
+                            colMapping[6] = new SqlBulkCopyColumnMapping("TLA005", "CAA005"); //寮�鍗曟棩鏈�
+                            colMapping[7] = new SqlBulkCopyColumnMapping("TLA006", "CAA006"); //浜у搧缂栫爜
+                            colMapping[8] = new SqlBulkCopyColumnMapping("TLA007", "CAA007"); //浜у搧鍚嶇О
+                            colMapping[9] = new SqlBulkCopyColumnMapping("TLA008", "CAA008"); //浜у搧瑙勬牸
+                            colMapping[10] = new SqlBulkCopyColumnMapping("TLA009", "CAA009"); //鍗曚綅
+                            colMapping[11] = new SqlBulkCopyColumnMapping("TLA010", "CAA010"); //棰勮寮�宸ユ椂闂�
+                            colMapping[12] = new SqlBulkCopyColumnMapping("TLA011", "CAA011"); //棰勮瀹屽伐鏃堕棿
+                            colMapping[13] = new SqlBulkCopyColumnMapping("TLA012", "CAA012"); //宸ュ崟鏁伴噺
+                            colMapping[14] = new SqlBulkCopyColumnMapping("TLA013", "CAA015"); //BOM鐗堟
+                            colMapping[15] = new SqlBulkCopyColumnMapping("TLA021", "CAA017"); //瀹㈡埛鍚嶇О
+                            colMapping[16] = new SqlBulkCopyColumnMapping("TLA015", "CAA018"); //閿�鍞鍗曞彿
+                            colMapping[17] = new SqlBulkCopyColumnMapping("TLA023", "CAA021"); //澶囨敞
+                            colMapping[18] = new SqlBulkCopyColumnMapping("CAA022", "CAA022"); //璁″垝鏁伴噺
+                            colMapping[19] = new SqlBulkCopyColumnMapping("TLA017", "CAA023"); //ERP婧愬崟ID
+                            colMapping[20] = new SqlBulkCopyColumnMapping("TLA018", "CAA025"); //ERP婧愬崟琛屽彿
+                            colMapping[21] = new SqlBulkCopyColumnMapping("TLA019", "CAA024"); //ERP婧愬崟鍗曞彿
+                            colMapping[22] = new SqlBulkCopyColumnMapping("TLA020", "CAA014"); //宸ヤ綔涓績
+                            colMapping[23] = new SqlBulkCopyColumnMapping("TLA001", "ID"); //宸ヤ綔涓績
+                            colMapping[24] = new SqlBulkCopyColumnMapping("TLA022", "CAA019"); //宸插叆搴撴暟閲�
+                            colMapping[25] = new SqlBulkCopyColumnMapping("TLA014", "CAA016"); //瀹㈡埛璁㈠崟鍙�
+                            colMapping[26] = new SqlBulkCopyColumnMapping("ERPID", "PID"); //瀹㈡埛璁㈠崟鍙�
+                            colMapping[0] = new SqlBulkCopyColumnMapping("CAA020", "CAA020"); //瀹℃牳鏃堕棿
+                            colMapping[27] = new SqlBulkCopyColumnMapping("TLA024", "CAA029"); //宸ュ崟鐘舵��
+                            colMapping[28] = new SqlBulkCopyColumnMapping("TLA025", "CAA030"); //搴熸枡鍏宠仈
+
+                            DataTableToSQLServer(dt, conStr, "WOMCAA", colMapping, ref ErrorMsg);
+                            //鏇存柊鎸囦护宸ュ崟
+                            foreach (DataRow dF in dt.Rows)
+                            {
+                                if (dF["TLA020"].ToString().Contains("瑁呴厤"))
+                                {
+                                    if (dF["TLA023"].ToString().Contains("-"))
+                                    {
+                                        string[] tr = dF["TLA023"].ToString().Split('-');
+
+                                        //int i = dF["TLA023"].ToString().LastIndexOf('-');
+                                        string StrNew = tr[1].ToString();//dF["TLA023"].ToString().Substring(i + 1, 10);
+                                        string SQLT = string.Format(@"SELECT TOP 1 * FROM WOMCAA(NOLOCK) WHERE CAA018='{0}' ", StrNew);
+                                        DataTable CAA = _sqlHelper.ExecuteDataTable(SQLT);
+                                        if (CAA.Rows.Count > 0)
+                                        {
+                                            string UP = string.Format(@"UPDATE WOMCAA SET CAA016='{0}',CAA017='{1}',CAA018='{2}' WHERE CAA002='{3}'  ", CAA.Rows[0]["CAA016"].ToString(), CAA.Rows[0]["CAA017"].ToString(), CAA.Rows[0]["CAA018"].ToString(), dF["TLA002"].ToString());
+                                            _sqlHelper.ExecuteNonQuery(UP);
+                                        }
+
+                                    }
+                                }
+
+
+
+                                string womDaa = string.Format(@"UPDATE WOMDAA SET DAA059 = CAA018, DAA016 = CAA008, DAA039 = CAA017,DAA058=CAA016   FROM WOMCAA WHERE CAA002 = DAA043 and CAA001='{0}' AND CAA001 <> '1'", dF["TLA001"].ToString());
+                                _sqlHelper.ExecuteNonQuery(womDaa);
+                                string womDa = string.Format(@" ;WITH A AS(
+		                                                          SELECT SUM(DAA027) F ,DAA014,DAA059 ,DAA043 FROM  WOMDAA(NOLOCK) 
+		                                                          WHERE DAA038='{0}' AND DAA014='{1}'
+		                                                          GROUP BY DAA014,DAA059 ,DAA043  
+		                                                          )
+		                                                          UPDATE  WOMCAA SET CAA013=A.F,CAA027=1 FROM A WHERE A.DAA059=CAA018 AND A.DAA043=CAA002 AND CAA006=DAA014  AND CAA001='{0}'", dF["TLA001"].ToString(), dF["TLA006"].ToString());
+                                _sqlHelper.ExecuteNonQuery(womDa);
+
+                                
+                                
+
+
+                            }
+
+                            #endregion
+                        }
+                       if (dt.TableName == "ERPTLB")
+                        {
+                            #region 鎶曟枡鍗曟槑缁嗙殑澶勭悊
+                            //dt.Columns.Add("AUDITING", typeof(string));
+                            dt.Columns.Add("CAB016", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                               
+                                if (dr["TLB003"].ToString().Contains("05.0001."))
+                                {
+                                    dr["TLB006"]=Math.Ceiling(Convert.ToDecimal(dr["TLB006"].ToString())).ToString();
+                                }
+                                else
+                                {
+                                    dr["TLB006"] = Convert.ToDecimal(dr["TLB006"]).ToString();
+                                }
+                                IDList.Add(dr["ERP_EntryID"].ToString());
+                                
+                                dr["TLB012"] = Convert.ToDecimal(dr["TLB012"]).ToString();
+                                //   dr["AUDITING"] = "Y";
+                                dr["CAB016"] = "0";
+                                if (dr["TLB006"].ToString() == "")
+                                {
+                                    dr["TLB006"] = "0";
+                                }
+                                if (dr["TLB007"].ToString() == "")
+                                {
+                                    dr["TLB007"] = "0";
+                                }
+                                if (dr["TLB012"].ToString() == "")
+                                {
+                                    dr["TLB012"] = "0";
+                                }
+                                if (dr["TLB013"].ToString() == "")
+                                {
+                                    dr["TLB013"] = "1";
+                                }
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("WOMCAB", "ERPID", string.Join("','", IDList), "");
+                            //if (!DeleteDataBeforeInsert("WOMCAB", "ERPID+CAB002", string.Join("','", IDList), ""))
+                            //{
+                            //    ErrorMsg = "WOMCAB閲嶅閿垹闄ゅけ璐ワ紒";
+                            //    return false;
+                            //}
+
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                            // colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("ERP_EntryID", "ERPID"); //ERPID
+                            colMapping[2] = new SqlBulkCopyColumnMapping("TLB001", "CAB001"); //鍗曞彿
+                            colMapping[3] = new SqlBulkCopyColumnMapping("TLB002", "CAB002"); //搴忓彿
+                            colMapping[4] = new SqlBulkCopyColumnMapping("TLB003", "CAB003"); //鏉愭枡缂栫爜
+                            colMapping[5] = new SqlBulkCopyColumnMapping("TLB004", "CAB004"); //鏉愭枡鍚嶇О
+                            colMapping[6] = new SqlBulkCopyColumnMapping("TLB005", "CAB005"); //鏉愭枡瑙勬牸
+                            colMapping[7] = new SqlBulkCopyColumnMapping("TLB006", "CAB006"); //闇�棰嗙敤閲�
+                            colMapping[8] = new SqlBulkCopyColumnMapping("TLB007", "CAB007"); //宸查鐢ㄩ噺
+                            colMapping[9] = new SqlBulkCopyColumnMapping("TLB008", "CAB008"); //宸ヨ壓
+                            colMapping[10] = new SqlBulkCopyColumnMapping("TLB009", "CAB009"); //鍗曚綅
+                            colMapping[11] = new SqlBulkCopyColumnMapping("TLB010", "CAB010"); //鏉愭枡绫诲瀷
+                            colMapping[12] = new SqlBulkCopyColumnMapping("TLB011", "CAB011"); //涓绘枡
+                            colMapping[13] = new SqlBulkCopyColumnMapping("TLB012", "CAB012"); //缁勬垚鐢ㄩ噺
+                            colMapping[14] = new SqlBulkCopyColumnMapping("TLB013", "CAB013"); //搴曟暟
+                            colMapping[15] = new SqlBulkCopyColumnMapping("TLB014", "CAB014"); //鏄惁鏇挎枡
+                            colMapping[16] = new SqlBulkCopyColumnMapping("TLB015", "CAB015"); //鐐逛綅
+                            colMapping[17] = new SqlBulkCopyColumnMapping("CAB016", "CAB016"); //鎹熻��
+                            colMapping[18] = new SqlBulkCopyColumnMapping("TLB001", "PID"); //鎹熻��
+                            colMapping[0] = new SqlBulkCopyColumnMapping("TLB017", "CAB023"); //浠撳簱
+                            colMapping[19] = new SqlBulkCopyColumnMapping("TLB019", "CAB025"); //MES鎸囦护鍗�
+                           if (dt.Columns.Contains("TLB020"))
+                                colMapping[20] = new SqlBulkCopyColumnMapping("TLB020", "CAB028"); //MES鎸囦护鍗�
+                            if (dt.Columns.Contains("TLB021"))
+                                colMapping[21] = new SqlBulkCopyColumnMapping("TLB021", "CAB029"); //MES鎸囦护鍗�
+                            if (dt.Columns.Contains("TLB022"))
+                                colMapping[22] = new SqlBulkCopyColumnMapping("TLB022", "CAB030"); //MES鎸囦护鍗�
+                                                                                                   //colMapping[19] = new SqlBulkCopyColumnMapping("TLB017", "CAB024"); //鍗曡韩澶囨敞
+                                                                                                   //colMapping[0] = new SqlBulkCopyColumnMapping("ERPMXID", "ERPMXID"); //ERPMXID
+
+
+                            DataTableToSQLServer(dt, conStr, "WOMCAB", colMapping, ref ErrorMsg);
+                            #endregion
+                        }
+                        string SYSDEC = string.Format(@"UPDATE SYSDEC SET STATES='IGNORE' WHERE task_name='TB_ERPTOMES_TL' AND DATA='{0}' AND STATES='NEW' AND TASK_ID !='{1}'", data, taskid);
+                        _sqlHelper.ExecuteNonQuery(SYSDEC);
+                        #endregion
+                    }
+                    else //DELETE
+                    {
+                        //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                        #region DELETE
+                        if (dt.TableName == "ERPTLA")
+                        {
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+                            }
+                            sql = string.Format(@" delete from WOMCAA where ERPID in ('{0}');  delete from WOMCAB where ERPID in ('{0}'); ", string.Join("','", IDList));
+                        }
+                        _sqlHelper.ExecuteNonQuery(sql);
+                        #endregion
+                    }
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = "[" + dtName + "]" + ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 15.ERPXCKA閿�鍞嚭搴撳崟(鍚屾鎺ㄩ��) bool TB_ERPTOMES_XCK(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPXCKA閿�鍞嚭搴撳崟(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_XCK(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            string djType = "鍑哄簱";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+            string dtName = "";
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+            try
+            {
+                foreach (DataTable dt in ds.Tables)
+                {
+                    dtName = dt.TableName;
+                    IDList.Clear();
+                    //涓讳粠琛ㄧ殑鍚屾锛屼慨鏀瑰拰鏂板涓�鏍凤紝鍏堝垹闄ゅ師璁板綍鍚庢彃鍏ユ柊璁板綍,瑕佹眰鍚屾杩囨潵鐨勬暟鎹篃鏄暣鍗曞畬鏁存暟鎹�
+                    if (operatype == "INSERT" || operatype == "UPDATE")
+                    {
+                        #region INSERT
+                        if (dt.TableName == "ERPXCKA")
+                        {
+                            #region 閿�鍞嚭搴撳崟涓昏〃鐨勫鐞�
+                            dt.Columns.Add("AUDITING", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+
+                                dr["AUDITING"] = "Y";
+                                //dr["XCKA002"] = dr["XCKA002"] == "閫�璐�" ? "2401" : "2307";
+                                if (dr["XCKA002"].ToString() == "閫�璐�")
+                                {
+                                    dr["XCKA002"] = "2401";
+                                    djType = "閫�璐�";
+                                }
+                                else
+                                {
+                                    dr["XCKA002"] = "2307";
+                                    djType = "鍑哄簱";
+                                }
+                                if (dr["XCKA020"].ToString() == "")
+                                {
+                                    dr["XCKA020"] = "0";
+                                }
+                            }
+
+                            if (djType == "閫�璐�")
+                            {
+                                #region 閫�璐�
+                                //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                                DeleteDataBeforeInsert("COMDEA", "ERPID", string.Join("','", IDList), "");
+
+                                SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                                colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                                colMapping[1] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ERPID 
+                                colMapping[2] = new SqlBulkCopyColumnMapping("XCKA001", "DEA001"); //鍗曞彿
+                                colMapping[3] = new SqlBulkCopyColumnMapping("XCKA002", "DEA002"); //鍗曟嵁绫诲瀷
+                                colMapping[4] = new SqlBulkCopyColumnMapping("XCKA003", "DEA003"); //浜ゆ槗鏃ユ湡
+                                colMapping[5] = new SqlBulkCopyColumnMapping("XCKA004", "DEA004"); //閫佽揣鏃堕棿
+                                colMapping[6] = new SqlBulkCopyColumnMapping("XCKA005", "DEA005"); //鍗曟嵁鏃ユ湡
+                                colMapping[7] = new SqlBulkCopyColumnMapping("XCKA006", "DEA006"); //閫�璐у伐鍘�
+                                colMapping[8] = new SqlBulkCopyColumnMapping("XCKA007", "DEA007"); //宸ュ巶绠�绉�
+                                colMapping[9] = new SqlBulkCopyColumnMapping("XCKA008", "DEA008"); //瀹㈡埛缂栧彿
+                                colMapping[10] = new SqlBulkCopyColumnMapping("XCKA009", "DEA009"); //瀹㈡埛绠�绉�
+                                colMapping[11] = new SqlBulkCopyColumnMapping("XCKA010", "DEA010"); //閫�璐х被鍨�
+                                colMapping[12] = new SqlBulkCopyColumnMapping("XCKA011", "DEA012"); //鍙戣鍗曞彿
+                                colMapping[13] = new SqlBulkCopyColumnMapping("XCKA012", "DEA016"); //閫佽揣鍏徃
+                                colMapping[14] = new SqlBulkCopyColumnMapping("XCKA013", "DEA018"); //杩愯緭鏂瑰紡  
+                                colMapping[15] = new SqlBulkCopyColumnMapping("XCKA014", "DEA017"); //閫佽揣鍦扮偣
+                                colMapping[16] = new SqlBulkCopyColumnMapping("XCKA015", "DEA013"); //缁撶畻甯佺
+                                colMapping[17] = new SqlBulkCopyColumnMapping("XCKA016", "DEA011"); //鏀惰揣鍏徃
+                                colMapping[18] = new SqlBulkCopyColumnMapping("XCKA017", "DEA015"); //閫佽揣鍦板潃
+                                colMapping[19] = new SqlBulkCopyColumnMapping("XCKA018", "DEA019"); //瀹℃牳浜哄憳
+                                colMapping[20] = new SqlBulkCopyColumnMapping("XCKA019", "DEA020"); //瀹℃牳鏃堕棿
+                                colMapping[21] = new SqlBulkCopyColumnMapping("XCKA020", "DEA021"); //閫佽揣鏁伴噺
+                                colMapping[22] = new SqlBulkCopyColumnMapping("XCKA021", "DEA014"); //澶囨敞
+
+                                DataTableToSQLServer(dt, conStr, "COMDEA", colMapping, ref ErrorMsg); 
+                                #endregion
+                            }
+                            else
+                            {
+                                #region 鍑哄簱
+                                //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                                DeleteDataBeforeInsert("COMDFA", "ERPID", string.Join("','", IDList), "");
+
+                                SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                                colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                                colMapping[1] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ERPID 
+                                colMapping[2] = new SqlBulkCopyColumnMapping("XCKA001", "DFA001"); //閫佽揣鍗曞彿
+                                colMapping[3] = new SqlBulkCopyColumnMapping("XCKA002", "DFA002"); //鍗曟嵁绫诲瀷
+                                colMapping[4] = new SqlBulkCopyColumnMapping("XCKA003", "DFA003"); //閫佽揣鏃ユ湡
+                                colMapping[5] = new SqlBulkCopyColumnMapping("XCKA004", "DFA004"); //閫佽揣鏃堕棿
+                                colMapping[6] = new SqlBulkCopyColumnMapping("XCKA005", "DFA005"); //鍗曟嵁鏃ユ湡
+                                colMapping[7] = new SqlBulkCopyColumnMapping("XCKA006", "DFA006"); //閫佽揣宸ュ巶
+                                colMapping[8] = new SqlBulkCopyColumnMapping("XCKA007", "DFA007"); //宸ュ巶绠�绉�
+                                colMapping[9] = new SqlBulkCopyColumnMapping("XCKA008", "DFA008"); //瀹㈡埛缂栧彿
+                                colMapping[10] = new SqlBulkCopyColumnMapping("XCKA009", "DFA009"); //瀹㈡埛绠�绉�
+                                colMapping[11] = new SqlBulkCopyColumnMapping("XCKA010", "DFA010"); //閫佽揣绫诲瀷
+                                colMapping[12] = new SqlBulkCopyColumnMapping("XCKA011", "DFA011"); //鍙戣鍗曞彿
+                                colMapping[13] = new SqlBulkCopyColumnMapping("XCKA012", "DFA012"); //璧疯繍鍦�
+                                colMapping[14] = new SqlBulkCopyColumnMapping("XCKA013", "DFA013"); //杩愯緭鏂瑰紡
+                                colMapping[15] = new SqlBulkCopyColumnMapping("XCKA014", "DFA014"); //鐩殑鍦�
+                                colMapping[16] = new SqlBulkCopyColumnMapping("XCKA015", "DFA015"); //缁撶畻甯佺
+                                colMapping[17] = new SqlBulkCopyColumnMapping("XCKA016", "DFA016"); //鏀惰揣鍏徃
+                                colMapping[18] = new SqlBulkCopyColumnMapping("XCKA017", "DFA017"); //閫佽揣鍦板潃
+                                colMapping[19] = new SqlBulkCopyColumnMapping("XCKA018", "DFA018"); //瀹℃牳浜哄憳
+                                colMapping[20] = new SqlBulkCopyColumnMapping("XCKA019", "DFA019"); //瀹℃牳鏃堕棿
+                                colMapping[21] = new SqlBulkCopyColumnMapping("XCKA020", "DFA020"); //閫佽揣鏁伴噺
+                                colMapping[22] = new SqlBulkCopyColumnMapping("XCKA021", "DFA021"); //澶囨敞
+
+                                DataTableToSQLServer(dt, conStr, "COMDFA", colMapping, ref ErrorMsg); 
+                                #endregion
+                            }
+                            #endregion
+                        }
+                        if (dt.TableName == "ERPXCKB")
+                        {
+                            #region 閿�鍞嚭搴撳崟鏄庣粏鐨勫鐞�
+                            dt.Columns.Add("AUDITING", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+
+                                dr["AUDITING"] = "N";
+                                if (dr["XCKB006"].ToString() == "")
+                                {
+                                    dr["XCKB006"] = "0";
+                                }
+                                else
+                                {
+                                    if (djType == "閫�璐�")
+                                    {
+                                        dr["XCKB006"] = Convert.ToDouble(dr["XCKB006"].ToString()) * -1;
+                                    }                                    
+                                }
+                                if (dr["XCKB007"].ToString() == "")
+                                {
+                                    dr["XCKB007"] = "0";
+                                }
+                                if (dr["XCKB008"].ToString() == "")
+                                {
+                                    dr["XCKB008"] = "0";
+                                }
+                                else
+                                {
+                                    if (djType == "閫�璐�")
+                                    {
+                                        dr["XCKB008"] = Convert.ToDouble(dr["XCKB008"].ToString()) * -1;
+                                    }
+                                }
+                                if (dr["XCKB009"].ToString() == "")
+                                {
+                                    dr["XCKB009"] = "0";
+                                }
+                                if (dr["XCKB010"].ToString() == "")
+                                {
+                                    dr["XCKB010"] = "0";
+                                }
+                                if (dr["XCKB016"].ToString() == "")
+                                {
+                                    dr["XCKB016"] = "0";
+                                }
+                                if (dr["XCKB017"].ToString() == "")
+                                {
+                                    dr["XCKB017"] = "0";
+                                }
+                                if (dr["XCKB018"].ToString() == "")
+                                {
+                                    dr["XCKB018"] = "0";
+                                }
+                            }
+                            if (djType == "閫�璐�")
+                            {
+                                #region 閫�璐�
+                                //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                                DeleteDataBeforeInsert("COMDEB", "ERPID", string.Join("','", IDList), "");
+
+                                DataTable dtt = new DataTable();
+                                dtt.Columns.Add("AUDITING", typeof(String));
+                                dtt.Columns.Add("ERPID", typeof(String));
+                                dtt.Columns.Add("XCKB001", typeof(String));
+                                dtt.Columns.Add("XCKB002", typeof(String));
+                                dtt.Columns.Add("XCKB003", typeof(String));
+                                dtt.Columns.Add("XCKB004", typeof(String));
+                                dtt.Columns.Add("XCKB005", typeof(String));
+                                dtt.Columns.Add("XCKB006", typeof(double));
+                                dtt.Columns.Add("XCKB007", typeof(double));
+                                dtt.Columns.Add("XCKB008", typeof(double));
+                                dtt.Columns.Add("XCKB011", typeof(String));
+                                dtt.Columns.Add("XCKB012", typeof(String));
+                                dtt.Columns.Add("XCKB013", typeof(String));
+                                dtt.Columns.Add("XCKB014", typeof(String));
+                                dtt.Columns.Add("XCKB015", typeof(String));
+                                dtt.Columns.Add("XCKB020", typeof(String));
+                                dtt.Columns.Add("XCKB024", typeof(String));
+
+                                foreach (DataRow dr in dt.Rows)
+                                {
+                                    DataRow newRow = dtt.NewRow();
+                                    newRow["AUDITING"] = dr["AUDITING"];
+                                    newRow["ERPID"] = dr["ERPID"];
+                                    newRow["XCKB001"] = dr["XCKB001"];
+                                    newRow["XCKB002"] = dr["XCKB002"];
+                                    newRow["XCKB003"] = dr["XCKB003"];
+                                    newRow["XCKB004"] = dr["XCKB004"];
+                                    newRow["XCKB005"] = dr["XCKB005"];
+                                    newRow["XCKB006"] = dr["XCKB006"];
+                                    newRow["XCKB007"] = dr["XCKB007"];
+                                    newRow["XCKB008"] = dr["XCKB008"];
+                                    newRow["XCKB011"] = dr["XCKB011"];
+                                    newRow["XCKB012"] = dr["XCKB012"];
+                                    newRow["XCKB013"] = dr["XCKB013"];
+                                    newRow["XCKB014"] = dr["XCKB014"];
+                                    newRow["XCKB015"] = dr["XCKB015"];
+                                    newRow["XCKB020"] = dr["XCKB020"];
+                                    newRow["XCKB024"] = dr["XCKB024"];
+                                    dtt.Rows.Add(newRow);
+                                }
+
+                                SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dtt.Columns.Count];
+
+                                colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                                colMapping[1] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ERPID
+                                colMapping[2] = new SqlBulkCopyColumnMapping("XCKB001", "DEB001"); //	鍗曞彿
+                                colMapping[3] = new SqlBulkCopyColumnMapping("XCKB002", "DEB002"); //	搴忓彿
+                                colMapping[4] = new SqlBulkCopyColumnMapping("XCKB003", "DEB003"); //	浜у搧缂栧彿
+                                colMapping[5] = new SqlBulkCopyColumnMapping("XCKB004", "DEB004"); //	浜у搧鍚嶇О
+                                colMapping[6] = new SqlBulkCopyColumnMapping("XCKB005", "DEB005"); //	浜у搧瑙勬牸
+                                colMapping[7] = new SqlBulkCopyColumnMapping("XCKB006", "DEB006"); //	鏁伴噺
+                                colMapping[8] = new SqlBulkCopyColumnMapping("XCKB007", "DEB011"); //	鍗曚环
+                                colMapping[9] = new SqlBulkCopyColumnMapping("XCKB008", "DEB012"); //	閲戦
+                                //colMapping[10] = new SqlBulkCopyColumnMapping("XCKB009", "DFB009"); //	宸插畬鎴愭暟閲�
+                                //colMapping[11] = new SqlBulkCopyColumnMapping("XCKB010", "DFB010"); //	鎬荤鏁�
+                                colMapping[10] = new SqlBulkCopyColumnMapping("XCKB011", "DEB018"); //	璁㈠崟鍗曞彿
+                                colMapping[11] = new SqlBulkCopyColumnMapping("XCKB012", "DEB015"); //	瀹㈡埛鍗曞彿
+                                colMapping[12] = new SqlBulkCopyColumnMapping("XCKB013", "DEB027"); //	璁㈠崟搴忓彿
+                                colMapping[13] = new SqlBulkCopyColumnMapping("XCKB014", "DEB007"); //	浠撳簱
+                                colMapping[14] = new SqlBulkCopyColumnMapping("XCKB015", "DEB008"); //	浠撳簱鍚嶇О
+                                //colMapping[17] = new SqlBulkCopyColumnMapping("XCKB016", "DFB016"); //	鍑�閲�
+                                //colMapping[18] = new SqlBulkCopyColumnMapping("XCKB017", "DFB017"); //	姣涢噸
+                                //colMapping[19] = new SqlBulkCopyColumnMapping("XCKB018", "DFB018"); //	浣撶Н
+                                //colMapping[20] = new SqlBulkCopyColumnMapping("XCKB019", "DFB019"); //	鍖呰鏄庣粏
+                                colMapping[15] = new SqlBulkCopyColumnMapping("XCKB020", "DEB029"); //	BOM鐗堟湰鍙�
+                                //colMapping[22] = new SqlBulkCopyColumnMapping("XCKB021", "DFB021"); //	瀹㈡埛鏂欏彿
+                                //colMapping[23] = new SqlBulkCopyColumnMapping("XCKB022", "DFB022"); //	LOT鎵瑰彿
+                                //colMapping[24] = new SqlBulkCopyColumnMapping("XCKB023", "DFB023"); //	鍗℃澘鍙�
+                                colMapping[16] = new SqlBulkCopyColumnMapping("XCKB024", "DEB030"); //	澶囨敞淇℃伅
+
+                                DataTableToSQLServer(dtt, conStr, "COMDEB", colMapping, ref ErrorMsg); 
+                                #endregion
+                            }
+                            else
+                            {
+                                #region 鍑哄簱
+                                //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                                DeleteDataBeforeInsert("COMDFB", "ERPID", string.Join("','", IDList), "");
+
+                                SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                                colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                                colMapping[1] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ERPID
+                                colMapping[2] = new SqlBulkCopyColumnMapping("XCKB001", "DFB001"); //	鍗曞彿
+                                colMapping[3] = new SqlBulkCopyColumnMapping("XCKB002", "DFB002"); //	搴忓彿
+                                colMapping[4] = new SqlBulkCopyColumnMapping("XCKB003", "DFB003"); //	浜у搧缂栧彿
+                                colMapping[5] = new SqlBulkCopyColumnMapping("XCKB004", "DFB004"); //	浜у搧鍚嶇О
+                                colMapping[6] = new SqlBulkCopyColumnMapping("XCKB005", "DFB005"); //	浜у搧瑙勬牸
+                                colMapping[7] = new SqlBulkCopyColumnMapping("XCKB006", "DFB006"); //	鏁伴噺
+                                colMapping[8] = new SqlBulkCopyColumnMapping("XCKB007", "DFB007"); //	鍗曚环
+                                colMapping[9] = new SqlBulkCopyColumnMapping("XCKB008", "DFB008"); //	閲戦
+                                colMapping[10] = new SqlBulkCopyColumnMapping("XCKB009", "DFB009"); //	宸插畬鎴愭暟閲�
+                                colMapping[11] = new SqlBulkCopyColumnMapping("XCKB010", "DFB010"); //	鎬荤鏁�
+                                colMapping[12] = new SqlBulkCopyColumnMapping("XCKB011", "DFB011"); //	璁㈠崟鍗曞彿
+                                colMapping[13] = new SqlBulkCopyColumnMapping("XCKB012", "DFB012"); //	瀹㈡埛鍗曞彿
+                                colMapping[14] = new SqlBulkCopyColumnMapping("XCKB013", "DFB013"); //	璁㈠崟搴忓彿
+                                colMapping[15] = new SqlBulkCopyColumnMapping("XCKB014", "DFB014"); //	浠撳簱
+                                colMapping[16] = new SqlBulkCopyColumnMapping("XCKB015", "DFB015"); //	浠撳簱鍚嶇О
+                                colMapping[17] = new SqlBulkCopyColumnMapping("XCKB016", "DFB016"); //	鍑�閲�
+                                colMapping[18] = new SqlBulkCopyColumnMapping("XCKB017", "DFB017"); //	姣涢噸
+                                colMapping[19] = new SqlBulkCopyColumnMapping("XCKB018", "DFB018"); //	浣撶Н
+                                colMapping[20] = new SqlBulkCopyColumnMapping("XCKB019", "DFB019"); //	鍖呰鏄庣粏
+                                colMapping[21] = new SqlBulkCopyColumnMapping("XCKB020", "DFB020"); //	BOM鐗堟湰鍙�
+                                colMapping[22] = new SqlBulkCopyColumnMapping("XCKB021", "DFB021"); //	瀹㈡埛鏂欏彿
+                                colMapping[23] = new SqlBulkCopyColumnMapping("XCKB022", "DFB022"); //	LOT鎵瑰彿
+                                colMapping[24] = new SqlBulkCopyColumnMapping("XCKB023", "DFB023"); //	鍗℃澘鍙�
+                                colMapping[25] = new SqlBulkCopyColumnMapping("XCKB024", "DFB024"); //	澶囨敞淇℃伅
+
+                                DataTableToSQLServer(dt, conStr, "COMDFB", colMapping, ref ErrorMsg); 
+                                #endregion
+                            }
+                            #endregion
+                        }
+
+                        #endregion
+                    }
+                    else //DELETE
+                    {
+                        //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                        #region DELETE
+                        if (dt.TableName == "ERPXCKA")
+                        {
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+                            }
+                            sql = string.Format(@" delete from COMDFA where ERPID in ('{0}');  delete from COMDFB where ERPID in ('{0}'); ", string.Join("','", IDList));
+                        }
+                        _sqlHelper.ExecuteNonQuery(sql);
+                        #endregion
+                    }
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = "[" + dtName + "]" + ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 16.ERPQCKA鍏跺畠鍑哄簱鍗�(鍚屾鎺ㄩ��) bool TB_ERPTOMES_QCK(string task_name, DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPQCKA鍏跺畠鍑哄簱鍗�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="task_name">浠诲姟鍚嶇О</param>
+        /// <param name="ds">鏁版嵁闆�</param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_QCK(string task_name, DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+            string dtName = "";
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+            try
+            {
+                foreach (DataTable dt in ds.Tables)
+                {
+                    dtName = dt.TableName;
+                    IDList.Clear();
+                    //涓讳粠琛ㄧ殑鍚屾锛屼慨鏀瑰拰鏂板涓�鏍凤紝鍏堝垹闄ゅ師璁板綍鍚庢彃鍏ユ柊璁板綍,瑕佹眰鍚屾杩囨潵鐨勬暟鎹篃鏄暣鍗曞畬鏁存暟鎹�
+                    if (operatype == "INSERT" || operatype == "UPDATE")
+                    {
+                        #region INSERT
+                        if (dt.TableName == "ERPQCKA")
+                        {
+                            #region 鍏跺畠鍑哄簱鍗曚富琛ㄧ殑澶勭悊
+                            dt.Columns.Add("AUDITING", typeof(string));
+                            dt.Columns.Add("DAF001", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+
+                                dr["AUDITING"] = "Y";
+                                dr["DAF001"] = task_name == "TB_ERPTOMES_QCK" ? "5403" : "5408";//濮斿鍑哄簱鍗�
+                                if (dr["QCKA008"].ToString() == "")
+                                {
+                                    dr["QCKA008"] = "0";
+                                }
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("WOMDAF", "ERPID", string.Join("','", IDList), "");
+                            //if (!DeleteDataBeforeInsert("WOMDAF", "ERPID", string.Join("','", IDList), ""))
+                            //{
+                            //    ErrorMsg = "WOMDAF閲嶅閿垹闄ゅけ璐ワ紒";
+                            //    return false;
+                            //}
+
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                            colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ERPID 
+                            colMapping[2] = new SqlBulkCopyColumnMapping("DAF001", "DAF001"); //鍗曞埆
+                            colMapping[3] = new SqlBulkCopyColumnMapping("QCKA001", "DAF002"); //鍗曞彿
+                            colMapping[4] = new SqlBulkCopyColumnMapping("QCKA002", "DAF003"); //瀹㈡埛缂栫爜
+                            colMapping[5] = new SqlBulkCopyColumnMapping("QCKA003", "DAF005"); //鍗曟嵁鏃ユ湡
+                            colMapping[6] = new SqlBulkCopyColumnMapping("QCKA004", "DAF006"); //鍗曟嵁鏃堕棿
+                            colMapping[7] = new SqlBulkCopyColumnMapping("QCKA005", "DAF007"); //鍒涘缓浜哄憳
+                            colMapping[8] = new SqlBulkCopyColumnMapping("QCKA006", "DAF012"); //濮斿鍘傚晢
+                            colMapping[9] = new SqlBulkCopyColumnMapping("QCKA007", "DAF013"); //鍘傚晢鍚嶇О
+                            colMapping[10] = new SqlBulkCopyColumnMapping("QCKA008", "DAF017"); //鐢熶骇濂楁暟
+                            colMapping[11] = new SqlBulkCopyColumnMapping("QCKA009", "DAF018"); //鐝
+                            colMapping[12] = new SqlBulkCopyColumnMapping("QCKA010", "DAF020"); //鐢熶骇绾垮埆
+                            colMapping[13] = new SqlBulkCopyColumnMapping("QCKA011", "DAF021"); //澶囨敞
+
+                            DataTableToSQLServer(dt, conStr, "WOMDAF", colMapping, ref ErrorMsg);
+                            #endregion
+                        }
+                        if (dt.TableName == "ERPQCKB")
+                        {
+                            #region 鍏跺畠鍑哄簱鍗曟槑缁嗙殑澶勭悊
+                            dt.Columns.Add("AUDITING", typeof(string));
+                            dt.Columns.Add("DAG001", typeof(string));
+                            dt.Columns.Add("DAG014", typeof(string));
+                            dt.Columns.Add("DAG015", typeof(string));
+                            dt.Columns.Add("DAG021", typeof(string));
+                            dt.Columns.Add("DAG023", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+
+                                dr["AUDITING"] = "N";
+                                dr["DAG001"] = task_name == "TB_ERPTOMES_QCK" ? "5403" : "5408";//濮斿鍑哄簱鍗�
+                                dr["DAG014"] = dr["QCKB008"];//閰嶆枡鏁伴噺
+                                dr["DAG015"] = "0";//宸插彂鏁伴噺
+                                dr["DAG021"] = 0 - Convert.ToDecimal(dr["QCKB008"].ToString());//宸紓鏁伴噺
+                                dr["DAG023"] = dr["QCKB008"];//寰呭彂鏁伴噺
+
+                                if (dr["QCKB007"].ToString() == "")
+                                {
+                                    dr["QCKB007"] = "0";
+                                }
+                                if (dr["QCKB008"].ToString() == "")
+                                {
+                                    dr["QCKB008"] = "0";
+                                }
+                            }
+
+                            //澶勭悊K3鐨勪骇鍝佷俊鎭湪鏄庣粏鐨勯棶棰�
+                            sql = "";
+                            DataTable dtCPMsg = dt.DefaultView.ToTable(true, "ERPID", "QCKB013", "QCKB014", "QCKB015", "QCKB016");
+                            foreach (DataRow dr in dtCPMsg.Rows)
+                            {
+                                sql += string.Format(@"
+                                                        update WOMDAF 
+                                                        set DAF023='{1}',--浜у搧缂栫爜
+                                                            DAF024='{2}',--浜у搧鍚嶇О
+                                                            DAF025='{3}',--浜у搧鍨嬪彿
+                                                            DAF019='{4}' --BOM鐗堟湰
+                                                        where ERPID='{0}';
+                                                        ", dr["ERPID"], dr["QCKB013"], dr["QCKB014"], dr["QCKB015"], dr["QCKB016"]);
+                            }
+                            _sqlHelper.ExecuteNonQuery(sql);
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("WOMDAG", "ERPID", string.Join("','", IDList), "");
+                            //if (!DeleteDataBeforeInsert("WOMDAG", "ERPID+DAG003", string.Join("','", IDList), ""))
+                            //{
+                            //    ErrorMsg = "WOMDAG閲嶅閿垹闄ゅけ璐ワ紒";
+                            //    return false;
+                            //}
+
+                           DataTable dt1 = dt.DefaultView.ToTable(false,"AUDITING","ERPID","DAG001","QCKB001","QCKB002","QCKB003","QCKB004","QCKB005",
+                                "QCKB006", "QCKB007", "QCKB008", "QCKB009", "QCKB010", "QCKB011", "QCKB012", "QCKB017",
+                                "DAG014", "DAG015", "DAG021", "DAG023");
+
+                           SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt1.Columns.Count];
+
+                            colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ERPID
+                            colMapping[2] = new SqlBulkCopyColumnMapping("DAG001", "DAG001"); //	鍗曞埆
+                            colMapping[3] = new SqlBulkCopyColumnMapping("QCKB001", "DAG002"); //	鍗曞彿
+                            colMapping[4] = new SqlBulkCopyColumnMapping("QCKB002", "DAG003"); //	搴忓彿
+                            colMapping[5] = new SqlBulkCopyColumnMapping("QCKB003", "DAG004"); //	鐗╂枡缂栫爜
+                            colMapping[6] = new SqlBulkCopyColumnMapping("QCKB004", "DAG005"); //	鐗╂枡鍚嶇О
+                            colMapping[7] = new SqlBulkCopyColumnMapping("QCKB005", "DAG006"); //	鐗╂枡瑙勬牸
+                            colMapping[8] = new SqlBulkCopyColumnMapping("QCKB006", "DAG007"); //	鍗曚綅
+                            colMapping[9] = new SqlBulkCopyColumnMapping("QCKB007", "DAG010"); //	BOM鐢ㄩ噺
+                            colMapping[10] = new SqlBulkCopyColumnMapping("QCKB008", "DAG011"); //	鍑哄簱鏁伴噺
+                            colMapping[11] = new SqlBulkCopyColumnMapping("DAG014", "DAG014"); //	閰嶆枡鏁伴噺
+                            colMapping[12] = new SqlBulkCopyColumnMapping("DAG015", "DAG015"); //	宸插彂鏁伴噺
+                            colMapping[13] = new SqlBulkCopyColumnMapping("DAG021", "DAG021"); //	宸紓鏁伴噺
+                            colMapping[14] = new SqlBulkCopyColumnMapping("DAG023", "DAG023"); //	寰呭彂鏁伴噺
+                            colMapping[15] = new SqlBulkCopyColumnMapping("QCKB009", "DAG028"); //	涓绘枡
+                            colMapping[16] = new SqlBulkCopyColumnMapping("QCKB010", "DAG029"); //	鏄惁鏇夸唬
+                            colMapping[17] = new SqlBulkCopyColumnMapping("QCKB011", "DAG016"); //	閰嶆枡浜哄憳
+                            colMapping[18] = new SqlBulkCopyColumnMapping("QCKB012", "DAG033"); //	澶囨敞
+                            colMapping[19] = new SqlBulkCopyColumnMapping("QCKB017", "DAG040"); //	鍙戞枡浠撳簱
+
+                            DataTableToSQLServer(dt1, conStr, "WOMDAG", colMapping, ref ErrorMsg);
+                            #endregion
+                        }
+
+                        #endregion
+                    }
+                    else //DELETE
+                    {
+                        //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                        #region DELETE
+                        if (dt.TableName == "ERPQCKA")
+                        {
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+                            }
+                            sql = string.Format(@" delete from WOMDAF where ERPID in ('{0}');  delete from WOMDAG where ERPID in ('{0}'); ", string.Join("','", IDList));
+                        }
+                        _sqlHelper.ExecuteNonQuery(sql);
+                        #endregion
+                    }
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = "[" + dtName + "]" + ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 17.ERPTHA渚涘簲鍟嗛��璐у崟(鍚屾鎺ㄩ��) bool TB_ERPTOMES_TH(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPTHA渚涘簲鍟嗛��璐у崟(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_TH(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+            string dtName = "";
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+            try
+            {
+                foreach (DataTable dt in ds.Tables)
+                {
+                    dtName = dt.TableName;
+                    IDList.Clear();
+                    //涓讳粠琛ㄧ殑鍚屾锛屼慨鏀瑰拰鏂板涓�鏍凤紝鍏堝垹闄ゅ師璁板綍鍚庢彃鍏ユ柊璁板綍,瑕佹眰鍚屾杩囨潵鐨勬暟鎹篃鏄暣鍗曞畬鏁存暟鎹�
+                    if (operatype == "INSERT" || operatype == "UPDATE")
+                    {
+                        #region INSERT
+                        if (dt.TableName == "ERPTHA")
+                        {
+                            #region 閫�璐у崟涓昏〃鐨勫鐞�
+                            dt.Columns.Add("AUDITING", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+
+                                dr["AUDITING"] = "N";
+                                dr["THA002"] = "3601";
+                                if (dr["THA011"].ToString() == "")
+                                {
+                                    dr["THA011"] = "0";
+                                }
+                                string tha003 =dr["THA003"].ToString().Substring(0,10);
+                                dr["THA003"] = tha003;
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("PURDKA", "ERPID", string.Join("','", IDList), "");
+                            //if (!DeleteDataBeforeInsert("PURDKA", "ERPID", string.Join("','", IDList), ""))
+                            //{
+                            //    ErrorMsg = "PURDKA閲嶅閿垹闄ゅけ璐ワ紒";
+                            //    return false;
+                            //}
+
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                            colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ERPID 
+                            colMapping[2] = new SqlBulkCopyColumnMapping("THA001", "DKA001"); //閫�璐у崟鍙�
+                            colMapping[3] = new SqlBulkCopyColumnMapping("THA002", "DKA002"); //閫�璐х被鍨�
+                            colMapping[4] = new SqlBulkCopyColumnMapping("THA003", "DKA003"); //閫�璐ф棩鏈�
+                            colMapping[5] = new SqlBulkCopyColumnMapping("THA004", "DKA004"); //閫�璐ф椂闂�
+                            colMapping[6] = new SqlBulkCopyColumnMapping("THA005", "DKA005"); //渚涘簲鍟嗙紪鐮�
+                            colMapping[7] = new SqlBulkCopyColumnMapping("THA006", "DKA006"); //渚涘簲鍟嗗悕绉�
+                            colMapping[8] = new SqlBulkCopyColumnMapping("THA007", "DKA007"); //閫�璐у崟鍙�
+                            colMapping[9] = new SqlBulkCopyColumnMapping("THA008", "DKA009"); //瀹㈡埛缂栧彿
+                            colMapping[10] = new SqlBulkCopyColumnMapping("THA009", "DKA010"); //宸ュ巶缂栧彿
+                            colMapping[11] = new SqlBulkCopyColumnMapping("THA010", "DKA011"); //鐩殑鍦�
+                            colMapping[12] = new SqlBulkCopyColumnMapping("THA011", "DKA016"); //鏁伴噺
+                            colMapping[13] = new SqlBulkCopyColumnMapping("THA012", "DKA008"); //鍒涘缓浜哄憳
+                            colMapping[14] = new SqlBulkCopyColumnMapping("THA013", "DKA017"); //澶囨敞
+
+                            DataTableToSQLServer(dt, conStr, "PURDKA", colMapping, ref ErrorMsg);
+                            #endregion
+                        }
+                        if (dt.TableName == "ERPTHB")
+                        {
+                            #region 閫�璐у崟鏄庣粏鐨勫鐞�
+                            dt.Columns.Add("AUDITING", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+
+                                dr["AUDITING"] = "N";
+                                if (dr["THB006"].ToString() == "")
+                                {
+                                    dr["THB006"] = "0";
+                                }
+                                //if (dr["THB007"].ToString() == "")
+                                //{
+                                    dr["THB007"] = "0";
+                                //}
+                                //if (dr["THB008"].ToString() == "")
+                                //{
+                                    dr["THB008"] = dr["THB006"];
+                                //}
+                                if (dr["THB010"].ToString() == "")
+                                {
+                                    dr["THB010"] = "0";
+                                }
+                                if (dr["THB011"].ToString() == "")
+                                {
+                                    dr["THB011"] = "0";
+                                }
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("PURDKB", "ERPID", string.Join("','", IDList), "");
+                            //if (!DeleteDataBeforeInsert("PURDKB", "ERPID+DKB002", string.Join("','", IDList), ""))
+                            //{
+                            //    ErrorMsg = "PURDKB閲嶅閿垹闄ゅけ璐ワ紒";
+                            //    return false;
+                            //}
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                            colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ERPID
+                            colMapping[2] = new SqlBulkCopyColumnMapping("THB001", "DKB001"); //鍗曞彿
+                            colMapping[3] = new SqlBulkCopyColumnMapping("THB002", "DKB002"); //搴忓彿
+                            colMapping[4] = new SqlBulkCopyColumnMapping("THB003", "DKB003"); //鐗╂枡缂栫爜
+                            colMapping[5] = new SqlBulkCopyColumnMapping("THB004", "DKB004"); //鐗╂枡鍚嶇О
+                            colMapping[6] = new SqlBulkCopyColumnMapping("THB005", "DKB005"); //鐗╂枡瑙勬牸
+                            colMapping[7] = new SqlBulkCopyColumnMapping("THB006", "DKB006"); //鐢宠閫�璐ф暟閲�
+                            colMapping[8] = new SqlBulkCopyColumnMapping("THB007", "DKB007"); //瀹為檯閫�璐ф暟閲�
+                            colMapping[9] = new SqlBulkCopyColumnMapping("THB008", "DKB008"); //宸紓鏁伴噺
+                            colMapping[10] = new SqlBulkCopyColumnMapping("THB009", "DKB009"); //鍗曚綅
+                            colMapping[11] = new SqlBulkCopyColumnMapping("THB010", "DKB010"); //鍗曚环
+                            colMapping[12] = new SqlBulkCopyColumnMapping("THB011", "DKB011"); //閲戦
+                            colMapping[13] = new SqlBulkCopyColumnMapping("THB012", "DKB012"); //鏉ユ簮鍗曞彿
+                            colMapping[14] = new SqlBulkCopyColumnMapping("THB013", "DKB013"); //鏉ユ簮搴忓彿
+                            colMapping[15] = new SqlBulkCopyColumnMapping("THB014", "DKB014"); //鍖呰鏄庣粏
+                            colMapping[16] = new SqlBulkCopyColumnMapping("THB015", "DKB015"); //涓嶈壇鍖哄垎
+                            colMapping[17] = new SqlBulkCopyColumnMapping("THB016", "DKB016"); //涓嶈壇椤圭洰
+                            colMapping[18] = new SqlBulkCopyColumnMapping("THB017", "DKB017"); //浠撳簱缂栫爜
+                            colMapping[19] = new SqlBulkCopyColumnMapping("THB018", "DKB018"); //澶囨敞
+                            colMapping[20] = new SqlBulkCopyColumnMapping("ERPMXID", "ERPMXID"); //ERPMXID                            
+                            DataTableToSQLServer(dt, conStr, "PURDKB", colMapping, ref ErrorMsg);
+                            #endregion
+                        }
+                        #endregion
+                    }
+                    else //DELETE
+                    {
+                        //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                        #region DELETE
+                        if (dt.TableName == "ERPTHA")
+                        {
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+                            }
+                            sql = string.Format(@" delete from PURDKA where ERPID in ('{0}');  delete from PURDKB where ERPID in ('{0}'); ", string.Join("','", IDList));
+                        }
+                        _sqlHelper.ExecuteNonQuery(sql);
+                        #endregion
+                    }
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = "[" + dtName + "]" + ex.Message;
+                return false;
+            }
+        }
+        #endregion        
+
+        #region 18.MesToErp(鍚屾鎺ㄩ��) bool MesToErp(DataRow dr, ref string ErrorMsg)
+        /// <summary>
+        /// MesToErp(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool MesToErp(DataRow dr, ref string ErrorMsg)
+        {
+            try
+            {
+                string task_name = dr["task_name"].ToString();
+                string descript = dr["descript"].ToString();
+                string create_time = dr["create_time"].ToString();
+                string creator = dr["creator"].ToString();
+                string operatype = dr["operatype"].ToString();
+                string source_table = dr["source_table"].ToString();
+                string target_table = dr["target_table"].ToString();
+                string data = dr["data"].ToString();
+                string data_inserted = dr["data_inserted"].ToString();
+                string data_deleted = dr["data_deleted"].ToString();
+
+                WebReference.UserServiceImplService a = new WebReference.UserServiceImplService();
+                WebReference.user US = new WebReference.user();
+                // sendt.arg0.
+                US.category = task_name;
+                US.data = data_inserted;
+                US.op = operatype;
+                string res = a.Body(US).msg.ToString();
+                //string res = a.arg0.ws.MES_TO_ERP_DataTransport(task_name, descript, create_time, creator, operatype, source_table, target_table, data, data_inserted, data_deleted);
+                if (res.Contains("OK"))
+                {
+                    ErrorMsg = res;
+                    return true;
+                }
+                else
+                {
+                    ErrorMsg = res;
+                    return false;
+                }
+
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+        #endregion
+        private bool MesToErpLD(DataRow dr, ref string ErrorMsg)
+        {
+            try
+            {
+                string task_name = dr["task_name"].ToString();
+                string descript = dr["descript"].ToString();
+                string create_time = dr["create_time"].ToString();
+                string creator = dr["creator"].ToString();
+                string operatype = dr["operatype"].ToString();
+                string source_table = dr["source_table"].ToString();
+                string target_table = dr["target_table"].ToString();
+                string data = dr["data"].ToString();
+                string data_inserted = dr["data_inserted"].ToString();
+                string data_deleted = dr["data_deleted"].ToString();
+
+                WebReferenceLD1.UserServiceImplService a = new WebReferenceLD1.UserServiceImplService();
+                WebReferenceLD1.user US = new WebReferenceLD1.user();
+                // sendt.arg0.
+                US.category = "TB_MESTOERP_CGRK";
+                US.data = data_inserted;
+                US.op = operatype;
+                string res = a.Body(US).msg.ToString();
+                //string res = a.arg0.ws.MES_TO_ERP_DataTransport(task_name, descript, create_time, creator, operatype, source_table, target_table, data, data_inserted, data_deleted);
+                if (res.Contains("OK"))
+                {
+                    ErrorMsg = res;
+                    return true;
+                }
+                else
+                {
+                    ErrorMsg = res;
+                    return false;
+                }
+
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+
+        #region 19.ERPXSA閿�鍞鍗�(鍚屾鎺ㄩ��) bool TB_ERPTOMES_XSD(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPXSA閿�鍞鍗�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="ds">鏁版嵁闆�</param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_XSD(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+            string dtName = "";
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+            try
+            {
+                foreach (DataTable dt in ds.Tables)
+                {
+                    dtName = dt.TableName;
+                    IDList.Clear();
+                    //涓讳粠琛ㄧ殑鍚屾锛屼慨鏀瑰拰鏂板涓�鏍凤紝鍏堝垹闄ゅ師璁板綍鍚庢彃鍏ユ柊璁板綍,瑕佹眰鍚屾杩囨潵鐨勬暟鎹篃鏄暣鍗曞畬鏁存暟鎹�
+                    if (operatype == "INSERT" || operatype == "UPDATE")
+                    {
+                        #region INSERT
+                        if (dt.TableName == "ERPXSA")
+                        {
+                            #region 閲囪喘璁㈠崟涓昏〃鐨勫鐞�
+                            dt.Columns.Add("AUDITING", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+
+                                dr["AUDITING"] = "Y";
+
+                                if (dr["XSA002"].ToString() == "")
+                                {
+                                    dr["XSA002"] = "2201";
+                                }
+                                if (dr["XSA012"].ToString() == "")
+                                {
+                                    dr["XSA012"] = "0";
+                                }
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("COMDBA", "ERPID", string.Join("','", IDList), "");
+                            
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                            colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ID 
+                            colMapping[2] = new SqlBulkCopyColumnMapping("XSA001", "DBA001"); //	璁㈠崟鍗曞彿
+                            colMapping[3] = new SqlBulkCopyColumnMapping("XSA002", "DBA002"); //	璁㈠崟鍗曞埆
+                            colMapping[4] = new SqlBulkCopyColumnMapping("XSA003", "DBA003"); //	鍙楄鏃ユ湡
+                            colMapping[5] = new SqlBulkCopyColumnMapping("XSA004", "DBA004"); //	鍗曟嵁鐗堟湰
+                            colMapping[6] = new SqlBulkCopyColumnMapping("XSA005", "DBA005"); //	鍗曟嵁鏃ユ湡
+                            colMapping[7] = new SqlBulkCopyColumnMapping("XSA006", "DBA006"); //	宸ュ巶缂栧彿
+                            colMapping[8] = new SqlBulkCopyColumnMapping("XSA007", "DBA007"); //	宸ュ巶绠�绉�
+                            colMapping[9] = new SqlBulkCopyColumnMapping("XSA008", "DBA008"); //	瀹㈡埛缂栧彿
+                            colMapping[10] = new SqlBulkCopyColumnMapping("XSA009", "DBA009"); //	瀹㈡埛绠�绉�
+                            colMapping[11] = new SqlBulkCopyColumnMapping("XSA010", "DBA010"); //	瀹㈡埛鍗曞彿
+                            colMapping[12] = new SqlBulkCopyColumnMapping("XSA011", "DBA011"); //	閮ㄩ棬缂栧彿
+                            colMapping[13] = new SqlBulkCopyColumnMapping("XSA012", "DBA033"); //	鎬绘暟閲�
+                            colMapping[14] = new SqlBulkCopyColumnMapping("XSA013", "DBA023"); //	澶囨敞
+                            colMapping[15] = new SqlBulkCopyColumnMapping("XSA014", "DBA031"); //	瀹℃牳鏃ユ湡
+                            colMapping[16] = new SqlBulkCopyColumnMapping("XSA015", "DBA032"); //	瀹℃牳鑰�
+
+                            DataTableToSQLServer(dt, conStr, "COMDBA", colMapping, ref ErrorMsg);
+                            #endregion
+                        }
+                        if (dt.TableName == "ERPXSB")
+                        {
+                            #region 閲囪喘璁㈠崟鏄庣粏鐨勫鐞�
+                            dt.Columns.Add("AUDITING", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+
+                                dr["AUDITING"] = "Y";
+
+                                if (dr["XSB008"].ToString() == "")
+                                {
+                                    dr["XSB008"] = "0";
+                                }
+                                if (dr["XSB009"].ToString() == "")
+                                {
+                                    dr["XSB009"] = "0";
+                                }
+                                if (dr["XSB010"].ToString() == "")
+                                {
+                                    dr["XSB010"] = "0";
+                                }
+                                if (dr["XSB012"].ToString() == "")
+                                {
+                                    dr["XSB012"] = "0";
+                                }
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("COMDBB", "ERPID", string.Join("','", IDList), "");                            
+
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                            colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ERPID
+                            colMapping[2] = new SqlBulkCopyColumnMapping("XSB001", "DBB001"); //璁㈠崟鍗曞彿
+                            colMapping[3] = new SqlBulkCopyColumnMapping("XSB002", "DBB002"); //搴忓彿
+                            colMapping[4] = new SqlBulkCopyColumnMapping("XSB003", "DBB003"); //浜у搧缂栫爜
+                            colMapping[5] = new SqlBulkCopyColumnMapping("XSB004", "DBB004"); //浜у搧鍚嶇О
+                            colMapping[6] = new SqlBulkCopyColumnMapping("XSB005", "DBB005"); //浜у搧瑙勬牸
+                            colMapping[7] = new SqlBulkCopyColumnMapping("XSB006", "DBB006"); //棰勪氦璐ф棩鏈�
+                            colMapping[8] = new SqlBulkCopyColumnMapping("XSB007", "DBB007"); //璁㈠崟鏁伴噺
+                            colMapping[9] = new SqlBulkCopyColumnMapping("XSB008", "DBB008"); //鍗曚綅
+                            colMapping[10] = new SqlBulkCopyColumnMapping("XSB009", "DBB009"); //鍗曚环
+                            colMapping[11] = new SqlBulkCopyColumnMapping("XSB010", "DBB010"); //閲戦
+                            colMapping[12] = new SqlBulkCopyColumnMapping("XSB011", "DBB011"); //瀹㈡埛浜у搧缂栫爜
+                            colMapping[13] = new SqlBulkCopyColumnMapping("XSB012", "DBB012"); //宸蹭氦璐ф暟
+                            colMapping[14] = new SqlBulkCopyColumnMapping("XSB013", "DBB013"); //缁撴潫
+                            colMapping[15] = new SqlBulkCopyColumnMapping("XSB014", "DBB015"); //澶囨敞
+
+                            DataTableToSQLServer(dt, conStr, "COMDBB", colMapping, ref ErrorMsg);
+                            #endregion
+                        }
+
+                        #endregion
+                    }
+                    else //DELETE
+                    {
+                        //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                        #region DELETE
+                        if (dt.TableName == "ERPXSA")
+                        {
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+                            }
+                            sql = string.Format(@" delete from COMDBA where ERPID in ('{0}');  delete from COMDBB where ERPID in ('{0}'); ", string.Join("','", IDList));
+                        }
+                        _sqlHelper.ExecuteNonQuery(sql);
+                        #endregion
+                    }
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = "[" + dtName + "]" + ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 20.icstockbill濮斿鍑哄簱鍗�(鍚屾鎺ㄩ��) TB_ERPTOMES_WCK(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// icstockbill濮斿鍑哄簱鍗�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="ds">鏁版嵁闆�</param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_WCK(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+            string dtName = "";
+            string BillNo = "";
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+            try
+            {
+                foreach (DataTable dt in ds.Tables)
+                {
+                    dtName = dt.TableName;
+                    IDList.Clear();
+                    //涓讳粠琛ㄧ殑鍚屾锛屼慨鏀瑰拰鏂板涓�鏍凤紝鍏堝垹闄ゅ師璁板綍鍚庢彃鍏ユ柊璁板綍,瑕佹眰鍚屾杩囨潵鐨勬暟鎹篃鏄暣鍗曞畬鏁存暟鎹�
+                    if (operatype == "INSERT" || operatype == "UPDATE")
+                    {
+                        #region INSERT
+                        if (dt.TableName == "icstockbill")
+                        {
+                            #region 濮斿鍑哄簱鍗曚富琛ㄧ殑澶勭悊
+                            dt.Columns.Add("AUDITING", typeof(string));
+                            dt.Columns.Add("DAF001", typeof(string));
+                            dt.Columns.Add("DAF017", typeof(decimal));
+                            dt.Columns.Add("DAF026", typeof(decimal));
+                            dt.Columns.Add("DAF027", typeof(decimal));
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["FInterID"].ToString());
+
+                                dr["AUDITING"] = "N";
+                                dr["DAF001"] = "5408";//濮斿鍑哄簱鍗�
+                                BillNo = dr["FBillNo"].ToString();
+                                dr["DAF017"] = "0";
+                                dr["DAF026"] = "0";
+                                dr["DAF027"] = "0";
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("WOMDAF", "ERPID", string.Join("','", IDList), "");
+
+                            DataTable dtHead = dt.DefaultView.ToTable(true, "AUDITING", "FInterID", "DAF001", "DAF017", "DAF026", "DAF027", "FBillNo", "ftdate", "fsupplyid", "fsupplyName", "fexplanation", "ffmanagerid", "FDeptID");
+
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dtHead.Columns.Count];
+                            colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("FInterID", "ERPID"); //ERPID 
+                            colMapping[2] = new SqlBulkCopyColumnMapping("DAF001", "DAF001"); //鍗曞埆
+                            colMapping[3] = new SqlBulkCopyColumnMapping("FBillNo", "DAF002"); //鍗曞彿
+                            colMapping[4] = new SqlBulkCopyColumnMapping("ftdate", "DAF005"); //鍗曟嵁鏃ユ湡
+                            colMapping[5] = new SqlBulkCopyColumnMapping("fsupplyid", "DAF012"); //濮斿鍘傚晢
+                            colMapping[6] = new SqlBulkCopyColumnMapping("fsupplyname", "DAF013"); //鍘傚晢鍚嶇О
+                            colMapping[7] = new SqlBulkCopyColumnMapping("fexplanation", "DAF021"); //澶囨敞
+                            colMapping[8] = new SqlBulkCopyColumnMapping("ffmanagerid", "DAF007"); //棰嗘枡浜�
+                            colMapping[9] = new SqlBulkCopyColumnMapping("FDeptID", "DAF004"); //閮ㄩ棬
+                            colMapping[10] = new SqlBulkCopyColumnMapping("DAF017", "DAF017"); //鐢熶骇濂楁暟
+                            colMapping[11] = new SqlBulkCopyColumnMapping("DAF026", "DAF026"); //鎸囦护鏁伴噺
+                            colMapping[12] = new SqlBulkCopyColumnMapping("DAF027", "DAF027"); //鏍囧噯浜ц兘
+
+                            DataTableToSQLServer(dtHead, conStr, "WOMDAF", colMapping, ref ErrorMsg);
+                            #endregion
+                        }
+                        if (dt.TableName == "icstockbillentry")
+                        {
+                            #region 濮斿鍑哄簱鍗曟槑缁嗙殑澶勭悊
+                            dt.Columns.Add("AUDITING", typeof(string));
+                            dt.Columns.Add("DAG001", typeof(string));
+                            dt.Columns.Add("DAG002", typeof(string));
+                            dt.Columns.Add("DAG010", typeof(double));
+                            dt.Columns.Add("DAG014", typeof(string));
+                            dt.Columns.Add("DAG015", typeof(string));
+                            dt.Columns.Add("DAG021", typeof(string));
+                            dt.Columns.Add("DAG023", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["FInterID"].ToString());
+
+                                dr["AUDITING"] = "N";
+                                dr["DAG001"] = "5408";//濮斿鍑哄簱鍗�
+                                dr["DAG002"] = BillNo;//濮斿鍑哄簱鍗�
+                                dr["DAG010"] = 1;//濮斿鍑哄簱鍗�
+                                dr["DAG014"] = dr["FQty"];//閰嶆枡鏁伴噺
+                                dr["DAG015"] = "0";//宸插彂鏁伴噺
+                                dr["DAG021"] = 0 - Convert.ToDecimal(dr["FQty"].ToString());//宸紓鏁伴噺
+                                dr["DAG023"] = dr["FQty"];//寰呭彂鏁伴噺
+
+                                if (dr["FQty"].ToString() == "")
+                                {
+                                    dr["FQty"] = "0";
+                                }
+                            }
+
+                            //澶勭悊K3鐨勪骇鍝佷俊鎭湪鏄庣粏鐨勯棶棰�
+                            sql = "";
+                            DataTable dtCPMsg = dt.DefaultView.ToTable(true, "FInterID", "FNumberProduct", "FNameProduct", "FModelProduct", "FOrderBillNo");
+                            foreach (DataRow dr in dtCPMsg.Rows)
+                            {
+                                sql += string.Format(@"
+                                                        update WOMDAF 
+                                                        set DAF023='{1}',--浜у搧缂栫爜
+                                                            DAF024='{2}',--浜у搧鍚嶇О
+                                                            DAF025='{3}',--浜у搧鍨嬪彿
+                                                            DAF010='{4}'--濮斿璁㈠崟鍙�
+                                                        where ERPID='{0}';
+                                                        ", dr["FInterID"], dr["FNumberProduct"], dr["FNameProduct"], dr["FModelProduct"], dr["FOrderBillNo"]);
+                            }
+                            _sqlHelper.ExecuteNonQuery(sql);
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("WOMDAG", "ERPID", string.Join("','", IDList), "");
+
+                            DataTable dt1 = dt.DefaultView.ToTable(false, 
+                                "AUDITING", "FInterID", "DAG001", "DAG002", "FEntryID", "FNumber", "Fname", "Fmodel", "FUnitID",
+                                 "DAG010", "FQtyMust", "DAG014", "DAG015", "DAG021", "DAG023" , "FBatchNo", "Fnote", "FDCStockID");
+
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt1.Columns.Count];
+
+                            colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("FInterID", "ERPID"); //ERPID
+                            colMapping[2] = new SqlBulkCopyColumnMapping("DAG001", "DAG001"); //	鍗曞埆
+                            colMapping[3] = new SqlBulkCopyColumnMapping("DAG002", "DAG002"); //	鍗曞彿
+                            colMapping[4] = new SqlBulkCopyColumnMapping("FEntryID", "DAG003"); //	搴忓彿
+                            colMapping[5] = new SqlBulkCopyColumnMapping("FNumber", "DAG004"); //	鐗╂枡缂栫爜
+                            colMapping[6] = new SqlBulkCopyColumnMapping("Fname", "DAG005"); //	鐗╂枡鍚嶇О
+                            colMapping[7] = new SqlBulkCopyColumnMapping("Fmodel", "DAG006"); //	鐗╂枡瑙勬牸
+                            colMapping[8] = new SqlBulkCopyColumnMapping("FUnitID", "DAG007"); //	鍗曚綅
+                            colMapping[9] = new SqlBulkCopyColumnMapping("DAG010", "DAG010"); //	BOM鐢ㄩ噺
+                            colMapping[10] = new SqlBulkCopyColumnMapping("FQtyMust", "DAG011"); //	鍑哄簱鏁伴噺
+                            colMapping[11] = new SqlBulkCopyColumnMapping("DAG014", "DAG014"); //	閰嶆枡鏁伴噺
+                            colMapping[12] = new SqlBulkCopyColumnMapping("DAG015", "DAG015"); //	宸插彂鏁伴噺
+                            colMapping[13] = new SqlBulkCopyColumnMapping("DAG021", "DAG021"); //	宸紓鏁伴噺
+                            colMapping[14] = new SqlBulkCopyColumnMapping("DAG023", "DAG023"); //	寰呭彂鏁伴噺
+                            colMapping[15] = new SqlBulkCopyColumnMapping("FBatchNo", "DAG026"); //	鎵瑰彿
+                            colMapping[16] = new SqlBulkCopyColumnMapping("Fnote", "DAG033"); //	澶囨敞
+                            colMapping[17] = new SqlBulkCopyColumnMapping("FDCStockID", "DAG040"); //	鍙戞枡浠撳簱
+
+                            DataTableToSQLServer(dt1, conStr, "WOMDAG", colMapping, ref ErrorMsg);
+                            #endregion
+                        }
+
+                        #endregion
+                    }
+                    else //DELETE
+                    {
+                        //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                        #region DELETE
+                        if (dt.TableName == "icstockbill")
+                        {
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["FInterID"].ToString());
+                            }
+                            sql = string.Format(@" delete from WOMDAF where ERPID in ('{0}');  delete from WOMDAG where ERPID in ('{0}'); ", string.Join("','", IDList));
+                        }
+                        _sqlHelper.ExecuteNonQuery(sql);
+                        #endregion
+                    }
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = "[" + dtName + "]" + ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 21.ERPDHA鍒拌揣鍗�(鍚屾鎺ㄩ��) bool TB_ERPTOMES_CGDH(DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPDHA鍒拌揣鍗�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="dt"></param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_CGDH(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+            string dtName = "";
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+            try
+            {
+                foreach (DataTable dt in ds.Tables)
+                {
+                    dtName = dt.TableName;
+                    IDList.Clear();
+                    //涓讳粠琛ㄧ殑鍚屾锛屼慨鏀瑰拰鏂板涓�鏍凤紝鍏堝垹闄ゅ師璁板綍鍚庢彃鍏ユ柊璁板綍,瑕佹眰鍚屾杩囨潵鐨勬暟鎹篃鏄暣鍗曞畬鏁存暟鎹�
+                    if (operatype == "INSERT" || operatype == "UPDATE")
+                    {
+                        #region INSERT
+                        if (dt.TableName == "ERPDHA")
+                        {
+                            #region 鍒拌揣鍗曚富琛ㄧ殑澶勭悊
+                            dt.Columns.Add("AUDITING", typeof(string));
+                            
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+
+                                dr["AUDITING"] = "N";
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("PURDHA", "ERPID", string.Join("','", IDList), "");
+                            
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+                            colMapping[0] = new SqlBulkCopyColumnMapping("DHA001", "DHA001"); //鍗曞彿
+                            colMapping[1] = new SqlBulkCopyColumnMapping("DHA002", "DHA002"); //鍗曟嵁鏃ユ湡
+                            colMapping[2] = new SqlBulkCopyColumnMapping("DHA003", "DHA003"); //鍗曟嵁绫诲瀷
+                            colMapping[3] = new SqlBulkCopyColumnMapping("DHA004", "DHA004"); //鍒拌揣鏃ユ湡
+                            colMapping[4] = new SqlBulkCopyColumnMapping("DHA005", "DHA007"); //渚涘簲鍟嗙紪鍙�
+                            colMapping[5] = new SqlBulkCopyColumnMapping("DHA006", "DHA008"); //渚涘簲鍟嗗悕绉�
+                            colMapping[6] = new SqlBulkCopyColumnMapping("DHA007", "DHA009"); //瀹㈡埛缂栧彿
+                            colMapping[7] = new SqlBulkCopyColumnMapping("DHA008", "DHA010"); //瀹㈡埛鍚嶇О
+                            colMapping[8] = new SqlBulkCopyColumnMapping("DHA009", "DHA011"); //渚涘簲鍟嗛�佽揣鍗曞彿
+                            colMapping[9] = new SqlBulkCopyColumnMapping("DHA010", "DHA012"); //鍙戠エ鍙风爜
+                            colMapping[10] = new SqlBulkCopyColumnMapping("DHA011", "DHA016"); //鏀惰揣鏂瑰紡
+                            colMapping[11] = new SqlBulkCopyColumnMapping("DHA012", "DHA020"); //鏄惁鎬ユ枡
+                            colMapping[12] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //	ERPID
+                            colMapping[13] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING"); //AUDITING
+
+                            DataTableToSQLServer(dt, conStr, "PURDHA", colMapping, ref ErrorMsg);
+                            #endregion
+                        }
+                        if (dt.TableName == "ERPDHB")
+                        {
+                            #region 鍒拌揣鍗曟槑缁嗙殑澶勭悊
+                            dt.Columns.Add("AUDITING", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+
+                                dr["AUDITING"] = "N";
+
+                                if (dr["DHB006"].ToString() == "")
+                                {
+                                    dr["DHB006"] = "0";
+                                }
+                                if (dr["DHB014"].ToString() == "")
+                                {
+                                    dr["DHB014"] = "0";
+                                }
+                                else
+                                {
+                                    dr["DHB014"] = Convert.ToDouble(dr["DHB014"]).ToString() ;
+                                }
+                                if (dr["DHB015"].ToString() == "")
+                                {
+                                    dr["DHB015"] = "0";
+                                }
+                                else
+                                {
+                                    dr["DHB015"] = Convert.ToDouble(dr["DHB015"]).ToString();
+                                }
+                                if (dr["DHB020"].ToString() == "")
+                                {
+                                    dr["DHB020"] = "0";
+                                }
+                                else
+                                {
+                                    dr["DHB020"] = Convert.ToDouble(dr["DHB020"]).ToString();
+                                }
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("PURDHB", "ERPID", string.Join("','", IDList), "");
+                            DataTable dtHead = dt.DefaultView.ToTable(true, "DHB001", "DHB002", "DHB003", "DHB004", "DHB005", "DHB006", "DHB007", "DHB008", "DHB009", "DHB010", "DHB011", "DHB012", "DHB013", "DHB014", "AUDITING", "DHB015", "DHB016", "DHB017", "DHB018", "DHB019", "DHB020", "DHB021", "DHB022", "DHB023", "DHB024", "DHB025", "ERPID", "ERPMXID", "WLA027", "WLA029", "WLA031", "WLA033", "WLA035");
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dtHead.Columns.Count];
+                            //SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+                            colMapping[0] = new SqlBulkCopyColumnMapping("DHB001", "DHB001"); //	鍗曞彿
+                            colMapping[1] = new SqlBulkCopyColumnMapping("DHB002", "DHB002"); //	搴忓彿
+                            colMapping[2] = new SqlBulkCopyColumnMapping("DHB003", "DHB003"); //	鐗╂枡缂栫爜
+                            colMapping[3] = new SqlBulkCopyColumnMapping("DHB004", "DHB004"); //	鐗╂枡鍚嶇О
+                            colMapping[4] = new SqlBulkCopyColumnMapping("DHB005", "DHB005"); //	鐗╂枡瑙勬牸
+                            colMapping[5] = new SqlBulkCopyColumnMapping("DHB006", "DHB006"); //	浜よ揣鏁伴噺
+                            colMapping[6] = new SqlBulkCopyColumnMapping("DHB007", "DHB007"); //	鍗曚綅
+                            colMapping[7] = new SqlBulkCopyColumnMapping("DHB008", "DHB008"); //	浠撳簱
+                            colMapping[8] = new SqlBulkCopyColumnMapping("DHB009", "DHB009"); //	浠撳簱鍚嶇О
+                            colMapping[9] = new SqlBulkCopyColumnMapping("DHB010", "DHB010"); //	鎵瑰彿
+                            colMapping[10] = new SqlBulkCopyColumnMapping("DHB011", "DHB011"); //	鏉ユ簮鍗曞彿
+                            colMapping[11] = new SqlBulkCopyColumnMapping("DHB012", "DHB012"); //	鏉ユ簮搴忓彿
+                            colMapping[12] = new SqlBulkCopyColumnMapping("DHB013", "DHB014"); //	鍒板巶鏃ユ湡
+                            colMapping[13] = new SqlBulkCopyColumnMapping("DHB014", "DHB017"); //	杩涜揣鍗曚环
+                            colMapping[14] = new SqlBulkCopyColumnMapping("DHB015", "DHB018"); //	杩涜揣閲戦
+                            colMapping[15] = new SqlBulkCopyColumnMapping("DHB016", "DHB021"); //	澶囧搧鏁�
+                            colMapping[16] = new SqlBulkCopyColumnMapping("DHB017", "DHB025"); //	ERP閲囪喘鍗曞彿ID
+                            colMapping[17] = new SqlBulkCopyColumnMapping("DHB018", "DHB026"); //	ERP閲囪喘搴忓彿ID
+                            colMapping[18] = new SqlBulkCopyColumnMapping("DHB019", "DHB027"); //	ERP鐗╂枡ID
+                            colMapping[19] = new SqlBulkCopyColumnMapping("DHB020", "DHB028"); //	褰撴椂璁㈠崟鏁�
+                            colMapping[20] = new SqlBulkCopyColumnMapping("DHB021", "DHB029"); //	po涓嬪崟鏃堕棿
+                            colMapping[21] = new SqlBulkCopyColumnMapping("DHB022", "DHB024"); //	澶囨敞
+                            colMapping[22] = new SqlBulkCopyColumnMapping("DHB023", "DHB046"); //	瀹㈡埛缂栧彿
+                            colMapping[23] = new SqlBulkCopyColumnMapping("DHB024", "DHB047"); //	瀹㈡埛鍚嶇О
+                            colMapping[24] = new SqlBulkCopyColumnMapping("DHB025", "DHB045"); //	閿�鍞鍗曞彿
+                            colMapping[25] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //	ERPID
+                            colMapping[26] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING"); //	AUDITING
+                            colMapping[27] = new SqlBulkCopyColumnMapping("ERPMXID", "ERPMXID"); //	ERPMXID
+                            colMapping[28] = new SqlBulkCopyColumnMapping("WLA027", "Exprop1"); //	杈呭姪灞炴��
+                            colMapping[29] = new SqlBulkCopyColumnMapping("WLA029", "Exprop2"); //	杈呭姪灞炴��
+                            colMapping[30] = new SqlBulkCopyColumnMapping("WLA031", "Exprop3"); //	杈呭姪灞炴��
+                            colMapping[31] = new SqlBulkCopyColumnMapping("WLA033", "Exprop4"); //	杈呭姪灞炴��
+                            colMapping[32] = new SqlBulkCopyColumnMapping("WLA035", "Exprop5"); //	杈呭姪灞炴��
+                            DataTableToSQLServer(dtHead, conStr, "PURDHB", colMapping, ref ErrorMsg);
+                            #endregion
+                        }
+
+                        #endregion
+                    }
+                    else //DELETE
+                    {
+                        //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                        #region DELETE
+                        if (dt.TableName == "ERPDHA")
+                        {
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+                            }
+                            sql = string.Format(@" delete from PURDHA where ERPID in ('{0}');  delete from PURDHB where ERPID in ('{0}'); ", string.Join("','", IDList));
+                        }
+                        _sqlHelper.ExecuteNonQuery(sql);
+                        #endregion
+                    }
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = "[" + dtName + "]" + ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 22.ERPTHCONFIRM渚涘簲鍟嗛��璐х‘璁� bool TB_ERPTOMES_TH_CONFIRM(DataSet ds, string operatype, ref string ErrorMsg)
+        private bool TB_ERPTOMES_TH_CONFIRM(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+            string dtName = "";
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+            try
+            {
+                foreach (DataTable dt in ds.Tables)
+                {
+                    dtName = dt.TableName;
+                    IDList.Clear();
+                    //涓讳粠琛ㄧ殑鍚屾锛屼慨鏀瑰拰鏂板涓�鏍凤紝鍏堝垹闄ゅ師璁板綍鍚庢彃鍏ユ柊璁板綍,瑕佹眰鍚屾杩囨潵鐨勬暟鎹篃鏄暣鍗曞畬鏁存暟鎹�
+                    if (operatype == "INSERT" || operatype == "UPDATE")
+                    {
+                        #region 鏇存柊鑷充緵搴斿晢閫�璐у崟鏄庣粏琛� PURDKB
+                        if (dt.TableName == "ERPTHCONFIRM")
+                        {
+                            foreach (DataRow dr in dt.Rows)
+                            {
+
+                                sql += string.Format(@" UPDATE PURDKB SET DKB024 = '{0}', DKB025 = '{1}'
+                                             WHERE DKB012 = '{2}' AND DKB013 = '{3}' 
+                                             AND DKB003 = '{4}'
+                                             AND DKB007 = '{5}'; ", dr["THC007"]
+                                                    , dr["THC008"], dr["THC003"], dr["THC004"], dr["THC005"], dr["THC006"]);
+                            }
+                            #endregion
+                        }
+                    }
+                    else //DELETE
+                    {
+                        continue;
+                    }
+                }
+              _sqlHelper.ExecuteNonQuery(sql);             
+                return true;
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = "[" + dtName + "]" + ex.Message;
+                return false;
+            }
+        }
+
+        #endregion
+
+        #region 23.TB_ERPTOMES_GDRK宸ュ崟鍏ュ簱鏁伴噺鏌ヨ bool TB_ERPTOMES_GDRK(DataSet ds, string operatype, ref string ErrorMsg)
+        private bool TB_ERPTOMES_GDRK(DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+            string dtName = "";
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+            try
+            {
+                foreach (DataTable dt in ds.Tables)
+                {
+                    dtName = dt.TableName;
+                    IDList.Clear();
+                    //涓讳粠琛ㄧ殑鍚屾锛屼慨鏀瑰拰鏂板涓�鏍凤紝鍏堝垹闄ゅ師璁板綍鍚庢彃鍏ユ柊璁板綍,瑕佹眰鍚屾杩囨潵鐨勬暟鎹篃鏄暣鍗曞畬鏁存暟鎹�
+                    if (operatype == "INSERT" || operatype == "UPDATE")
+                    {
+                        #region 鏇存柊宸ュ崟琛� WOMCAA
+                        if (dt.TableName == "ERPGDRKA")
+                        {
+                            foreach (DataRow dr in dt.Rows)
+                            {
+
+                                sql += string.Format(@" UPDATE WOMCAA SET CAA026 = '{1}', CAA027 = '{2}',CAA013='{4}'
+                                             WHERE CAA002='{0}' AND CAA006='{3}' AND CAA025='{5}'
+                                             ; ", dr["FICMOBILLNO"]
+                                                    , dr["FStockInQuaAuxQty"], dr["FPickMtlQty"], dr["FItemid"], dr["FStockInQuaAuxQty"], dr["FEntryId"]);
+                            }
+                            #endregion
+                        }
+                    }
+                    else //DELETE
+                    {
+                        continue;
+                    }
+                }
+                _sqlHelper.ExecuteNonQuery(sql);
+                return true;
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = "[" + dtName + "]" + ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 24.ERPFHA鍙戣揣閫氱煡鍗�(鍚屾鎺ㄩ��) bool TB_ERPTOMES_FHTZ(string task_name,DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPCGA閲囪喘璁㈠崟锝滃澶栬鍗�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="task_name">浠诲姟鍚嶇О</param>
+        /// <param name="ds">鏁版嵁闆�</param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_FHTZ(string task_name, DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+            string dtName = "";
+            if (operatype != "INSERT" && operatype != "UPDATE")
+            {
+                sql = string.Format(@" delete from COMDFA where DFA001 in ('{0}') ", operatype);
+                string sqlTT = string.Format(@" delete from COMDFB where DFB001 in ('{0}') ", operatype);
+                _sqlHelper.ExecuteNonQuery(sql);
+                _sqlHelper.ExecuteNonQuery(sqlTT);
+                return true;
+            }
+
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+            try
+            {
+                foreach (DataTable dt in ds.Tables)
+                {
+                    dtName = dt.TableName;
+                    IDList.Clear();
+                    //涓讳粠琛ㄧ殑鍚屾锛屼慨鏀瑰拰鏂板涓�鏍凤紝鍏堝垹闄ゅ師璁板綍鍚庢彃鍏ユ柊璁板綍,瑕佹眰鍚屾杩囨潵鐨勬暟鎹篃鏄暣鍗曞畬鏁存暟鎹�
+                    if (operatype == "INSERT" || operatype == "UPDATE")
+                    {
+                        #region INSERT
+                        if (dt.TableName == "ERPFHA")
+                        {
+                            #region 鍙戣揣閫氱煡鍗曚富琛ㄧ殑澶勭悊
+                            dt.Columns.Add("AUDITING", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+
+                                dr["AUDITING"] = "Y";
+
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("COMDFA", "ID", string.Join("','", IDList), "");
+                            //if (!DeleteDataBeforeInsert("PURDDA", "ERPID", string.Join("','", IDList), ""))
+                            //{
+                            //    ErrorMsg = "PURDDA閲嶅閿垹闄ゅけ璐ワ紒";
+                            //    return false;
+                            //}
+
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                            colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "flagApp");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("ERPID", "ID"); //ID 
+                            colMapping[2] = new SqlBulkCopyColumnMapping("FHA001", "DFA001"); //鍙戣揣鍗曞彿
+                            colMapping[3] = new SqlBulkCopyColumnMapping("FHA002", "DFA002"); //瀹㈡埛鍚嶇О
+                            colMapping[4] = new SqlBulkCopyColumnMapping("FHA003", "DFA003"); //鍙戣揣缁勭粐
+                            colMapping[5] = new SqlBulkCopyColumnMapping("FHA004", "DFA004"); //瀹℃牳鏃ユ湡
+                            colMapping[6] = new SqlBulkCopyColumnMapping("FHA005", "DFA005"); //瀹℃牳浜哄憳 
+                            colMapping[7] = new SqlBulkCopyColumnMapping("FHA006", "DFA006"); //鍏抽棴鐘舵��
+                            colMapping[8] = new SqlBulkCopyColumnMapping("FHA007", "DFA007"); //鍏抽棴鏃ユ湡
+                            colMapping[9] = new SqlBulkCopyColumnMapping("FHA008", "DFA008"); //浣滃簾鐘舵��
+                            colMapping[10] = new SqlBulkCopyColumnMapping("FHA009", "DFA009"); //浣滃簾鏃ユ湡
+                            colMapping[11] = new SqlBulkCopyColumnMapping("FHA0010", "DFA010"); //澶囨敞
+
+
+                            DataTableToSQLServer(dt, conStr, "COMDFA", colMapping, ref ErrorMsg);
+                            #endregion
+                        }
+                        if (dt.TableName == "ERPFHB")
+                        {
+                            #region 閲囪喘璁㈠崟鏄庣粏鐨勫鐞�
+                            dt.Columns.Add("AUDITING", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+
+                                dr["AUDITING"] = "Y";
+                                //閿�鍞暟閲�
+                                if (dr["FHB008"].ToString() == "")
+                                {
+                                    dr["FHB008"] = "0";
+                                }
+                                else
+                                {
+                                    double A = Convert.ToDouble(dr["FHB008"].ToString());
+                                    string B = A.ToString();
+                                    dr["FHB008"] = B;
+                                }
+                                //鏈嚭搴撴暟
+                                if (dr["FHB020"].ToString() == "")
+                                {
+                                    dr["FHB020"] = "0";
+                                }
+                                else
+                                {
+                                    double A = Convert.ToDouble(dr["FHB020"].ToString());
+                                    string B = A.ToString();
+                                    dr["FHB020"] = B;
+                                }
+                                //绱宸插嚭搴撴暟
+                                if (dr["FHB024"].ToString() == "")
+                                {
+                                    dr["FHB024"] = "0";
+                                }
+                                else
+                                {
+                                    double A = Convert.ToDouble(dr["FHB024"].ToString());
+                                    string B = A.ToString();
+                                    dr["FHB024"] = B;
+                                }
+                                if (dr["FHB024"].ToString() == "")
+                                {
+                                    dr["FHB024"] = "0";
+                                }
+                                else
+                                {
+                                    double A = Convert.ToDouble(dr["FHB024"].ToString());
+                                    string B = A.ToString();
+                                    dr["FHB024"] = B;
+                                }
+                                
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("COMDFB", "PID", string.Join("','", IDList), "");
+                            //if (!DeleteDataBeforeInsert("PURDDB", "ERPID+DDB002", string.Join("','", IDList), ""))
+                            //{
+                            //    ErrorMsg = "PURDDB閲嶅閿垹闄ゅけ璐ワ紒";
+                            //    return false;
+                            //}
+
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+                            colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "flagApp");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("ERPID", "PID"); //ERPID
+                            colMapping[2] = new SqlBulkCopyColumnMapping("FHB001", "DFB001"); //鍙戣揣鍗曞彿
+                            colMapping[3] = new SqlBulkCopyColumnMapping("FHB002", "DFB002"); //搴忓彿
+                            colMapping[4] = new SqlBulkCopyColumnMapping("FHB003", "DFB003"); //瀹㈡埛鐗╂枡缂栫爜
+                            colMapping[5] = new SqlBulkCopyColumnMapping("FHB004", "DFB004"); //瀹㈡埛鐗╂枡鍚嶇О
+                            colMapping[6] = new SqlBulkCopyColumnMapping("FHB005", "DFB005"); //浜у搧缂栧彿
+                            colMapping[7] = new SqlBulkCopyColumnMapping("FHB006", "DFB006"); //浜у搧鍚嶇О
+                            colMapping[8] = new SqlBulkCopyColumnMapping("FHB007", "DFB007"); //浜у搧瑙勬牸
+                            colMapping[9] = new SqlBulkCopyColumnMapping("FHB008", "DFB008"); //閿�鍞暟閲�
+                            colMapping[10] = new SqlBulkCopyColumnMapping("FHB009", "DFB009"); //閿�鍞崟浣�
+                            colMapping[11] = new SqlBulkCopyColumnMapping("FHB010", "DFB010"); //鍗曚环
+                            colMapping[12] = new SqlBulkCopyColumnMapping("FHB011", "DFB011"); //鍚◣鍗曚环
+                            colMapping[13] = new SqlBulkCopyColumnMapping("FHB012", "DFB012"); //绋庣巼
+                            colMapping[14] = new SqlBulkCopyColumnMapping("FHB013", "DFB013"); //绋庨
+                            colMapping[15] = new SqlBulkCopyColumnMapping("FHB014", "DFB014"); //鍚◣鍚堣
+                            colMapping[16] = new SqlBulkCopyColumnMapping("FHB015", "DFB015"); //瑕佽揣鏃ユ湡
+                            colMapping[17] = new SqlBulkCopyColumnMapping("FHB016", "DFB016"); //鍑鸿揣浠撳簱
+                            colMapping[18] = new SqlBulkCopyColumnMapping("FHB017", "DFB017"); //璁′环鏁伴噺
+                            colMapping[19] = new SqlBulkCopyColumnMapping("FHB018", "DFB018"); //璁㈠崟鍗曞彿
+                            colMapping[20] = new SqlBulkCopyColumnMapping("FHB019", "DFB019"); //澶囨敞淇℃伅
+                            colMapping[21] = new SqlBulkCopyColumnMapping("FHB020", "DFB020"); //鏈嚭搴撴暟
+                            colMapping[22] = new SqlBulkCopyColumnMapping("FHB021", "DFB021"); //鍑哄簱涓婇檺
+                            colMapping[23] = new SqlBulkCopyColumnMapping("FHB022", "DFB022"); //鍑哄簱涓嬬嚎
+                            colMapping[24] = new SqlBulkCopyColumnMapping("FHB023", "DFB023"); //鏄惁鎺у埗鍑哄簱鏁伴噺
+                            colMapping[25] = new SqlBulkCopyColumnMapping("FHB024", "DFB024"); //绱鍑哄簱鏁�
+                            colMapping[26] = new SqlBulkCopyColumnMapping("ERP_EntryID", "ID"); //鏄庣粏ID
+                            DataTableToSQLServer(dt, conStr, "COMDFB", colMapping, ref ErrorMsg);
+                            #endregion
+                        }
+
+                        #endregion
+                    }
+                    else //DELETE
+                    {
+                        //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                        #region DELETE
+                        //if (dt.TableName == "ERPCGA")
+                        //{
+                        //    foreach (DataRow dr in dt.Rows)
+                        //    {
+                        //        IDList.Add(dr["ERPID"].ToString());
+                        //    }
+                        //    sql = string.Format(@" delete from PURDDA where ERPID in ('{0}');  delete from PURDDB where ERPID in ('{0}'); ", string.Join("','", IDList));
+                        //}
+                        //_sqlHelper.ExecuteNonQuery(sql);
+                        #endregion
+                    }
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = "[" + dtName + "]" + ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        #region 25.ERPWWA濮斿璁㈠崟(鍚屾鎺ㄩ��) bool TB_ERPTOMES_WW(string task_name,DataSet ds, string operatype, ref string ErrorMsg)
+        /// <summary>
+        /// ERPCGA閲囪喘璁㈠崟锝滃澶栬鍗�(鍚屾鎺ㄩ��)
+        /// </summary>
+        /// <param name="task_name">浠诲姟鍚嶇О</param>
+        /// <param name="ds">鏁版嵁闆�</param>
+        /// <param name="operatype">鎵ц绫诲瀷</param>
+        /// <param name="ErrorMsg">閿欒璇存槑</param>
+        /// <returns></returns>
+        private bool TB_ERPTOMES_WW(string task_name, DataSet ds, string operatype, ref string ErrorMsg)
+        {
+            string sql = "";
+            //鐢ㄦ潵鎷糏D闆嗗悎
+            List<string> IDList = new List<string>();
+            string dtName = "";
+            if (operatype != "INSERT" && operatype != "UPDATE")
+            {
+                sql = string.Format(@" delete from WOMWAA where WAA002 in ('{0}') ", operatype);
+
+                _sqlHelper.ExecuteNonQuery(sql);
+                return true;
+            }
+
+            if (ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
+            {
+                ErrorMsg = "鐢熸垚鏁版嵁琛ㄥけ璐�";
+                return false;
+            }
+            try
+            {
+                foreach (DataTable dt in ds.Tables)
+                {
+                    dtName = dt.TableName;
+                    IDList.Clear();
+                    //涓讳粠琛ㄧ殑鍚屾锛屼慨鏀瑰拰鏂板涓�鏍凤紝鍏堝垹闄ゅ師璁板綍鍚庢彃鍏ユ柊璁板綍,瑕佹眰鍚屾杩囨潵鐨勬暟鎹篃鏄暣鍗曞畬鏁存暟鎹�
+                    if (operatype == "INSERT" || operatype == "UPDATE")
+                    {
+                        #region INSERT
+                        if (dt.TableName == "ERPWWA")
+                        {
+
+                            #region 鎶曟枡鍗曚富琛ㄧ殑澶勭悊
+                            //  dt.Columns.Add("AUDITING", typeof(string));
+                            dt.Columns.Add("WAA022", typeof(string));
+                            dt.Columns.Add("WAA020", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+
+                                String sqlDE = string.Format(@"delete from WOMWAB where PID in ('{0}')", dr["WWTL001"].ToString());
+                                _sqlHelper.ExecuteNonQuery(sqlDE);
+                                IDList.Add(dr["ERPID"].ToString());
+                                //dr["TLA012"] = Convert.ToDouble(dr["TLA012"]).ToString();
+                                //// dr["AUDITING"] = "Y";
+                                //dr["WAA022"] = dr["TLA012"];
+                                ////dr["TLA002"] = dr["TLA019"];//宸ュ崟鎵规鐩存帴鍙栦换鍔″崟鍙峰惂
+                                //dr["WAA020"] = DateTime.Now.ToString("yyyy-MM-dd");
+                                //if (dr["TLA004"].ToString() == "" || dr["TLA004"].ToString() == "1")
+                                //{
+                                //    dr["TLA004"] = "5102";//榛樿DIP宸ュ崟
+                                //}
+                                //else
+                                //{
+                                //    dr["TLA004"] = "5109";//杩斿伐宸ュ崟
+                                //}
+                                
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("WOMWAA", "ERPID", string.Join("','", IDList), "");
+                            //if (!DeleteDataBeforeInsert("WOMCAA", "ERPID", string.Join("','", IDList), ""))
+                            //{
+                            //    ErrorMsg = "WOMCAA閲嶅閿垹闄ゅけ璐ワ紒";
+                            //    return false;
+                            //}
+
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+                            //colMapping[1] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("ERPID", "ERPID"); //ERPID 
+                            colMapping[2] = new SqlBulkCopyColumnMapping("WWTL001", "WAA001"); //鍗曞彿
+                            colMapping[3] = new SqlBulkCopyColumnMapping("WWTL020", "WAA002"); //ERP宸ュ崟鎵规
+                            colMapping[4] = new SqlBulkCopyColumnMapping("WWTL003", "WAA003"); //瀹㈡埛缂栧彿
+                            colMapping[5] = new SqlBulkCopyColumnMapping("WWTL004", "WAA004"); //鍗曟嵁绫诲瀷
+                            colMapping[6] = new SqlBulkCopyColumnMapping("WWTL005", "WAA005"); //寮�鍗曟棩鏈�
+                            colMapping[7] = new SqlBulkCopyColumnMapping("WWTL006", "WAA006"); //浜у搧缂栫爜
+                            colMapping[8] = new SqlBulkCopyColumnMapping("WWTL007", "WAA007"); //浜у搧鍚嶇О
+                            colMapping[9] = new SqlBulkCopyColumnMapping("WWTL008", "WAA008"); //浜у搧瑙勬牸
+                            colMapping[10] = new SqlBulkCopyColumnMapping("WWTL009", "WAA009"); //鍗曚綅
+                            colMapping[11] = new SqlBulkCopyColumnMapping("WWTL010", "WAA010"); //棰勮寮�宸ユ椂闂�
+                            colMapping[12] = new SqlBulkCopyColumnMapping("WWTL011", "WAA011"); //棰勮瀹屽伐鏃堕棿
+                            colMapping[13] = new SqlBulkCopyColumnMapping("WWTL012", "WAA012"); //宸ュ崟鏁伴噺
+                            colMapping[14] = new SqlBulkCopyColumnMapping("WWTL013", "WAA013"); //BOM鐗堟
+                            colMapping[15] = new SqlBulkCopyColumnMapping("WWTL014", "WAA014"); //渚涘簲鍟�
+                            colMapping[16] = new SqlBulkCopyColumnMapping("WWTL015", "WAA015"); //閲囪喘璁㈠崟
+                            colMapping[17] = new SqlBulkCopyColumnMapping("WWTL016", "WAA016"); //閲囪喘璁㈠崟琛屽彿
+                            colMapping[18] = new SqlBulkCopyColumnMapping("WWTL017", "WAA017"); //澶囨敞
+                            colMapping[19] = new SqlBulkCopyColumnMapping("WWTL018", "WAA018"); //ERP婧愬崟ID
+                            colMapping[20] = new SqlBulkCopyColumnMapping("WWTL019", "WAA019"); //ERP婧愬崟搴忓彿
+                            colMapping[21] = new SqlBulkCopyColumnMapping("WWTL020", "WAA020"); //濮斿璁㈠崟鍙�
+                            colMapping[22] = new SqlBulkCopyColumnMapping("WWTL021", "WAA021"); //宸ヤ綔涓績
+                            colMapping[23] = new SqlBulkCopyColumnMapping("WWTL022", "WAA022"); //鏈叆搴撴暟
+                            colMapping[24] = new SqlBulkCopyColumnMapping("WWTL023", "WAA023"); //涓氬姟鐘舵��
+                            colMapping[25] = new SqlBulkCopyColumnMapping("WWTL024", "WAA024"); //棰嗘枡鐘舵��
+                            colMapping[26] = new SqlBulkCopyColumnMapping("WWTL001", "ID"); //瀹㈡埛璁㈠崟鍙�
+                            //colMapping[0] = new SqlBulkCopyColumnMapping("WAA020", "WAA020"); //瀹℃牳鏃堕棿
+
+                            DataTableToSQLServer(dt, conStr, "WOMWAA", colMapping, ref ErrorMsg);
+                            
+
+                            #endregion
+                        }
+                        if (dt.TableName == "ERPWWB")
+                        {
+                            #region 鎶曟枡鍗曟槑缁嗙殑澶勭悊
+                            //dt.Columns.Add("AUDITING", typeof(string));
+                            //dt.Columns.Add("CAB016", typeof(string));
+
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                //IDList.Add(dr["ERP_EntryID"].ToString());
+                                
+
+
+                                if (dr["WWTLB006"].ToString() == " "|| dr["WWTLB006"].ToString() == "")
+                                {
+                                    dr["WWTLB006"] = "0";
+                                }
+                                if (dr["WWTLB007"].ToString() == " "|| dr["WWTLB007"].ToString() == "")
+                                {
+                                    dr["WWTLB007"] = "0";
+                                }
+                                if (dr["WWTLB012"].ToString() == " "|| dr["WWTLB012"].ToString() == "")
+                                {
+                                    dr["WWTLB012"] = "0";
+                                }
+                                if (dr["WWTLB013"].ToString() == " "|| dr["WWTLB013"].ToString() == "")
+                                {
+                                    dr["WWTLB013"] = "1";
+                                }
+
+                                dr["WWTLB006"] = Convert.ToDecimal(dr["WWTLB006"]).ToString();
+                                dr["WWTLB007"] = Convert.ToDecimal(dr["WWTLB007"]).ToString();
+                                dr["WWTLB012"] = Convert.ToDecimal(dr["WWTLB012"]).ToString();
+                                dr["WWTLB013"] = Convert.ToDecimal(dr["WWTLB013"]).ToString();
+                                ////   dr["AUDITING"] = "Y";
+                                //dr["CAB016"] = "0";
+
+                            }
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            DeleteDataBeforeInsert("WOMWAB", "ERPID", string.Join("','", IDList), "");
+                            //if (!DeleteDataBeforeInsert("WOMCAB", "ERPID+CAB002", string.Join("','", IDList), ""))
+                            //{
+                            //    ErrorMsg = "WOMCAB閲嶅閿垹闄ゅけ璐ワ紒";
+                            //    return false;
+                            //}
+
+                            SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count+5];
+
+                            // colMapping[0] = new SqlBulkCopyColumnMapping("AUDITING", "AUDITING");
+                            colMapping[1] = new SqlBulkCopyColumnMapping("ERP_EntryID", "ERPID"); //ERPID
+                            colMapping[2] = new SqlBulkCopyColumnMapping("WWTLB001", "WAB001"); //鐢ㄦ枡娓呭崟鍗曞彿
+                            colMapping[3] = new SqlBulkCopyColumnMapping("WWTLB002", "WAB002"); //搴忓彿
+                            colMapping[4] = new SqlBulkCopyColumnMapping("WWTLB003", "WAB003"); //鏉愭枡缂栫爜
+                            colMapping[5] = new SqlBulkCopyColumnMapping("WWTLB004", "WAB004"); //鏉愭枡鍚嶇О
+                            colMapping[6] = new SqlBulkCopyColumnMapping("WWTLB005", "WAB005"); //鏉愭枡瑙勬牸
+                            colMapping[7] = new SqlBulkCopyColumnMapping("WWTLB006", "WAB006"); //闇�棰嗙敤閲�
+                            colMapping[8] = new SqlBulkCopyColumnMapping("WWTLB007", "WAB007"); //宸查鐢ㄩ噺
+                            colMapping[9] = new SqlBulkCopyColumnMapping("WWTLB008", "WAB008"); //宸ヨ壓
+                            colMapping[10] = new SqlBulkCopyColumnMapping("WWTLB009", "WAB009"); //鍗曚綅
+                            colMapping[11] = new SqlBulkCopyColumnMapping("WWTLB010", "WAB010"); //鏉愭枡绫诲瀷
+                            colMapping[12] = new SqlBulkCopyColumnMapping("WWTLB011", "WAB011"); //涓绘枡
+                            colMapping[13] = new SqlBulkCopyColumnMapping("WWTLB012", "WAB012"); //缁勬垚鐢ㄩ噺
+                            colMapping[14] = new SqlBulkCopyColumnMapping("WWTLB013", "WAB013"); //搴曟暟
+                            colMapping[15] = new SqlBulkCopyColumnMapping("WWTLB014", "WAB014"); //鏄惁鏇挎枡
+                            colMapping[16] = new SqlBulkCopyColumnMapping("WWTLB015", "WAB015"); //鐐逛綅
+                            colMapping[17] = new SqlBulkCopyColumnMapping("WWTLB016", "WAB016"); //濮斿鍗曞彿
+                            colMapping[18] = new SqlBulkCopyColumnMapping("WWTLB001", "PID"); 
+                            colMapping[0] = new SqlBulkCopyColumnMapping("WWTLB017", "WAB017"); //濮斿鍗曞彿ID
+                            colMapping[19] = new SqlBulkCopyColumnMapping("WWTLB018", "WAB018");
+                            colMapping[20] = new SqlBulkCopyColumnMapping("ERP_EntryID", "ID");
+                            //colMapping[19] = new SqlBulkCopyColumnMapping("WWTLB017", "CAB024"); //鍗曡韩澶囨敞
+                            //colMapping[0] = new SqlBulkCopyColumnMapping("ERPMXID", "ERPMXID"); //ERPMXID
+
+
+                            DataTableToSQLServer(dt, conStr, "WOMWAB", colMapping, ref ErrorMsg);
+                            #endregion
+                        }
+
+                        #endregion
+                    }
+                    else //DELETE
+                    {
+                        //ErrorMsg = "鎵ц鍒犻櫎鏁版嵁琛�";
+                        #region DELETE
+                        if (dt.TableName == "ERPWWA")
+                        {
+                            foreach (DataRow dr in dt.Rows)
+                            {
+                                IDList.Add(dr["ERPID"].ToString());
+                            }
+                            sql = string.Format(@" delete from WOMCAA where ERPID in ('{0}');  delete from WOMCAB where ERPID in ('{0}'); ", string.Join("','", IDList));
+                        }
+                        _sqlHelper.ExecuteNonQuery(sql);
+                        #endregion
+                    }
+                }
+                return true;
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = "[" + dtName + "]" + ex.Message;
+                return false;
+            }
+        }
+        #endregion
+
+        private bool XKY_GET_DHD(DataRow dr, ref string ErrorMsg)
+        {
+
+            //DataTable dt=new  DataTable();
+            DataTable dt = _sqlHelper.ExecuteDataTable("select top(1) * from XKYDHD(nolock) where 1=2");
+            ApiCommonParam Apiparam = ApiCommonParam.NewApiCommon();
+            try
+            {
+                string task_name = dr["task_name"].ToString();
+                string descript = dr["descript"].ToString();
+                string create_time = dr["create_time"].ToString();
+                string creator = dr["creator"].ToString();
+                string operatype = dr["operatype"].ToString();
+                string source_table = dr["source_table"].ToString();
+                string target_table = dr["target_table"].ToString();
+                string data = dr["data"].ToString();
+                string data_inserted = dr["data_inserted"].ToString();
+                string data_deleted = dr["data_deleted"].ToString();
+                ArrayList SQLStringList = new ArrayList();
+                // var client = new HttpClient();
+                var url = "https://openapi.xiekeyun.com/delivery/getNoList.json";
+                HttpClient httpClient = new HttpClient();
+                httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+
+                string json = "{\"commonParam\":" + JsonConvert.SerializeObject(Apiparam) + ",\"body\":" + data_inserted + "}";
+                byte[] postData = Encoding.UTF8.GetBytes(json);
+
+                // 鍒涘缓璇锋眰瀵硅薄
+                HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://openapi.xiekeyun.com/delivery/getNoList.json");
+                request.Method = "POST";
+                request.ContentType = "application/json";
+                request.ContentLength = postData.Length;
+
+                // 鍙戦�佽姹傛暟鎹�
+                using (Stream stream = request.GetRequestStream())
+                {
+                    stream.Write(postData, 0, postData.Length);
+                }
+                dynamic responseJson;
+                // 鍙戦�佽姹傚苟鑾峰彇鍝嶅簲
+                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
+                using (Stream stream = response.GetResponseStream())
+                using (StreamReader reader = new StreamReader(stream))
+                {
+                    string result2 = reader.ReadToEnd();
+
+                    responseJson = JsonConvert.DeserializeObject(result2);
+
+                }
+
+                // 璇诲彇鍝嶅簲鍐呭
+                //dt.Columns.Add("DELIVERYNO", typeof(string));
+                //dt.Columns.Add("DELIVERYTYPE", typeof(string));
+                //dt.Columns.Add("INNERVENDORCODE", typeof(string));
+                //dt.Columns.Add("PURCHASETYPE", typeof(string));
+                //dt.Columns.Add("STATUS", typeof(string));
+                //dt.Columns.Add("LOGISTICSSTATUS", typeof(string));
+                //dt.Columns.Add("LASTOPERATETIME", typeof(string));
+                //dt.Columns.Add("GETTIME", typeof(string));
+                //dt.Columns.Add("FLAG", typeof(string));
+                SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+
+                //colMapping[0] = new SqlBulkCopyColumnMapping("DELIVERYNO", "deliveryno"); //
+                //colMapping[1] = new SqlBulkCopyColumnMapping("DELIVERYTYPE", "deliverytype"); //
+                //colMapping[2] = new SqlBulkCopyColumnMapping("INNERVENDORCODE", "innervendorcode"); //
+                //colMapping[3] = new SqlBulkCopyColumnMapping("PURCHASETYPE", "purchasetype"); //
+                //colMapping[4] = new SqlBulkCopyColumnMapping("STATUS", "status"); //
+                //colMapping[5] = new SqlBulkCopyColumnMapping("LOGISTICSSTATUS", "logisticsstatus"); //
+                //colMapping[6] = new SqlBulkCopyColumnMapping("LASTOPERATETIME", "lastoperatetime"); //
+                //colMapping[7] = new SqlBulkCopyColumnMapping("GETTIME", "gettime"); //
+                //colMapping[8] = new SqlBulkCopyColumnMapping("FLAG", "flag"); //
+
+
+
+                if (responseJson.result == 1)
+                {
+
+                    foreach (var item in responseJson.dataList)
+                    {
+                        //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                       // DeleteDataBeforeInsert("XKYDHD", "DELIVERYNO", string.Join("','", item.deliveryNo), "");
+                        //   DeleteDataBeforeInsert("XKYDHD_DETAILS", "DELIVERYNO", string.Join("','", item.deliveryNo), "");
+                        //    DeleteDataBeforeInsert("XKYDHD_DETAILS_LINE", "DELIVERYNO", string.Join("','", item.deliveryNo), "");
+
+                        DataRow dr2 = dt.NewRow();
+                        dr2["DELIVERYNO"] = item.deliveryNo;//閫氳繃鍚嶇О璧嬪��
+                        dr2["DELIVERYTYPE"] = item.deliveryType;//閫氳繃鍚嶇О璧嬪��
+                        dr2["INNERVENDORCODE"] = item.innerVendorCode;//閫氳繃鍚嶇О璧嬪��
+                        dr2["PURCHASETYPE"] = item.purchaseType;//閫氳繃鍚嶇О璧嬪��
+                        dr2["STATUS"] = item.status;//閫氳繃鍚嶇О璧嬪��
+                        dr2["LOGISTICSSTATUS"] = item.logisticsStatus;//閫氳繃鍚嶇О璧嬪��
+                        dr2["LASTOPERATETIME"] = item.lastOperateTime;//閫氳繃鍚嶇О璧嬪��
+                        dr2["GETTIME"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");//閫氳繃鍚嶇О璧嬪��
+                        dr2["FLAG"] = "0";//閫氳繃鍚嶇О璧嬪��
+                        dt.Rows.Add(dr2);
+
+                    }
+                    if
+                    (DataTableToSQLServer(dt, conStr, "XKYDHD", colMapping, ref ErrorMsg))
+                        return true;
+                    else
+                        return false;
+                }
+                else
+                {
+                    ErrorMsg = responseJson.errorMsg;
+                    return false;
+                }
+
+
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+        private bool XKY_GET_DETAILS(DataRow dr, ref string ErrorMsg)
+        {
+            DataTable dt = _sqlHelper.ExecuteDataTable("select top(1) * from XKYDETAIL(nolock) where 1=2");
+            DataTable dt_line = _sqlHelper.ExecuteDataTable("select top(1) * from XKYDETAIL_LINE(nolock) where 1=2");
+            ApiCommonParam Apiparam = ApiCommonParam.NewApiCommon();
+            try
+            {
+                string task_name = dr["task_name"].ToString();
+                string descript = dr["descript"].ToString();
+                string create_time = dr["create_time"].ToString();
+                string creator = dr["creator"].ToString();
+                string operatype = dr["operatype"].ToString();
+                string source_table = dr["source_table"].ToString();
+                string target_table = dr["target_table"].ToString();
+                string data = dr["data"].ToString();
+                string data_inserted = dr["data_inserted"].ToString();
+                string data_deleted = dr["data_deleted"].ToString();
+                ArrayList SQLStringList = new ArrayList();
+                // var client = new HttpClient();
+                var url = "https://openapi.xiekeyun.com/delivery/getDetail.json";
+                HttpClient httpClient = new HttpClient();
+                httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+                string json = "{\"commonParam\":" + JsonConvert.SerializeObject(Apiparam) + ",\"body\":" + data_inserted + "}";
+                byte[] postData = Encoding.UTF8.GetBytes(json);
+                // 鍒涘缓璇锋眰瀵硅薄
+                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
+                request.Method = "POST";
+                request.ContentType = "application/json";
+                request.ContentLength = postData.Length;
+                // 鍙戦�佽姹傛暟鎹�
+                using (Stream stream = request.GetRequestStream())
+                {
+                    stream.Write(postData, 0, postData.Length);
+                }
+                dynamic responseJson;
+                // 鍙戦�佽姹傚苟鑾峰彇鍝嶅簲
+                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
+                using (Stream stream = response.GetResponseStream())
+                using (StreamReader reader = new StreamReader(stream))
+                {
+                    string result2 = reader.ReadToEnd();
+
+                    // data_insertedf = result2.Substring(0,3900);
+                    responseJson = JsonConvert.DeserializeObject(result2);
+
+                }
+
+                // 璇诲彇鍝嶅簲鍐呭
+
+                //  SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+                SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[0];
+
+
+
+                // 璇诲彇鍝嶅簲鍐呭
+
+                if (responseJson.result == 1)
+                {
+                    dynamic item = responseJson.data;
+                    //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                    //DeleteDataBeforeInsert("XKYDHD", "DELIVERYNO", string.Join("','", item.deliveryNo), "");
+                    DeleteDataBeforeInsert("XKYDETAIL", "DELIVERYNO", string.Join("','", item.deliveryNo), "");
+                    //    DeleteDataBeforeInsert("XKYDHD_DETAILS_LINE", "DELIVERYNO", string.Join("','", item.deliveryNo), "");
+
+                    DataRow dr2 = dt.NewRow();
+
+                    dr2["DELIVERYNO"] = item.deliveryNo;
+                    dr2["INNERVENDORCODE"] = item.innerVendorCode;
+                    dr2["INNERVENDORNAME"] = item.innerVendorName;
+                    dr2["DELIVERYTYPE"] = item.deliveryType;
+                    dr2["DELIVERYDATE"] = item.deliveryDate;
+                    dr2["PLANARRIVEDDATE"] = item.planArrivedDate;
+                    dr2["CONTACTPERSION"] = item.contactPersion;
+                    dr2["CONTACTMOBILE"] = item.contactMobile;
+                    dr2["ADDRESSCODE"] = item.addressCode;
+                    dr2["ADDRESSINFO"] = item.addressInfo;
+                    dr2["DELIVERYCARNO"] = item.deliveryCarNo;
+                    dr2["REMARK"] = item.remark;
+                    dr2["STATUS"] = item.status;
+                    dr2["DIRECTDELIVERYFLAG"] = item.directDeliveryFlag;
+                    dr2["LOGISTICSSTATUS"] = item.logisticsStatus;
+                    dr2["PUBLISHTIME"] = item.publishTime;
+                    dr2["UPDATETIME"] = item.updateTime;
+                    dr2["PROFITCENTERCODE"] = item.profitCenterCode;
+                    dr2["GROSSWEIGHT"] = item.grossWeight;
+                    dr2["NETWEIGHT"] = item.netWeight;
+                    dr2["UNITWEIGHTCODE"] = item.unitWeightCode;
+                    dr2["UNITWEIGHTNAME"] = item.unitWeightName;
+                    dr2["TOTALPACKINGQTY"] = item.totalPackingQty;
+                    dr2["TOTALPACKAGEQUANTITY"] = item.totalPackageQuantity;
+                    dr2["TRANSPORTTYPECODE"] = item.transportTypeCode;
+                    dr2["TRANSPORTTYPENAME"] = item.transportTypeName;
+                    dr2["PACKINGWAYCODE"] = item.packingWayCode;
+                    dr2["PACKINGWAYNAME"] = item.packingWayName;
+                    //    dr2["EXTENDN01"] = item.extendN01;
+                    //    dr2["EXTENDN02"] = item.extendN02;
+                    //    dr2["EXTENDN03"] = item.extendN03;
+                    dr2["CARGODELIVERYTIME"] = item.cargoDeliveryTime;
+                    dr2["LOGISTICSTYPE"] = item.logisticsType;
+                    dr2["LOGISTICSTYPESHOW"] = item.logisticsTypeShow;
+                    dr2["LOGISTICSNUMBER"] = item.logisticsNumber;
+                    dr2["FIRSTCHECK"] = item.firstCheck;
+                    dt.Rows.Add(dr2);
+
+                    if (DataTableToSQLServer(dt, conStr, "XKYDETAIL", colMapping, ref ErrorMsg))
+                        ;
+                    else
+                        return false;
+                    foreach (var item2 in responseJson.data.lineList)
+                    {
+                        DeleteDataBeforeInsert("XKYDETAIL_LINE", "DELIVERYNO", string.Join("','", item.deliveryNo), "");
+                        DataRow dr3 = dt_line.NewRow();
+                        dr3["DELIVERYNO"] = item.deliveryNo;
+                        dr3["LINE_NO"] = item2.lineNo;
+                        dr3["POERPNO"] = item2.poErpNo;
+                        dr3["PURCHASETYPE"] = item2.purchaseType;
+                        dr3["POLINENO"] = item2.poLineNo;
+                        dr3["PRODUCTCODE"] = item2.productCode;
+                        dr3["PRODUCTNAME"] = item2.productName;
+                        dr3["PRODUCTSCALE"] = item2.productScale;
+                        dr3["DELIVERYUNITCODE"] = item2.deliveryUnitCode;
+                        dr3["DELIVERYUNITNAME"] = item2.deliveryUnitName;
+                        dr3["DELIVERYQTY"] = item2.deliveryQty;
+                        dr3["DELIVERYVALUATIONQTY"] = item2.deliveryValuationQty;
+                        dr3["PRICE"] = item2.price;
+                        dr3["TAXPRICE"] = item2.taxPrice;
+                        dr3["SCHDYNAMICVALUE"] = item2.schDynamicValue;
+                        dr3["SCHEDULEBATCHNO"] = item2.scheduleBatchNo;
+                        dr3["SCHEDULEORDERNO"] = item2.scheduleOrderNo;
+                        dr3["SCHEDULEDETAILNO"] = item2.scheduleDetailNo;
+                        dr3["URGENTFLAG"] = item2.urgentFlag;
+                        dr3["SRCBILLTYPE"] = item2.srcBillType;
+                        dr3["SRCORDERLINEREMARK"] = item2.srcOrderLineRemark;
+                        dr3["STATUS"] = item2.status;
+                        dr3["RECEIVESTATUS"] = item2.receiveStatus;
+                        dr3["GROSSWEIGHT"] = item2.grossWeight;
+                        dr3["NETWEIGHT"] = item2.netWeight;
+                        dr3["UNITWEIGHTCODE"] = item2.unitWeightCode;
+                        dr3["UNITWEIGHTNAME"] = item2.unitWeightName;
+                        dr3["PACKINGQTY"] = item2.packingQty;
+                        dr3["BRANDNAME"] = item2.brandName;
+                        dr3["OTHEREXTEND"] = item2.otherExtend;
+                        dr3["ORIGINALCOUNTRYCODE"] = item2.originalCountryCode;
+                        dr3["ORIGINALCOUNTRYNAME"] = item2.originalCountryName;
+                        dr3["REMARK"] = item2.remark;
+                        // dr3["EXTENDN01"] = item2.purchaseDesc.extendN01;
+                        //  dr3["EXTENDN02"] = item2.purchaseDesc.extendN02;
+                        //  dr3["EXTENDN03"] = item2.purchaseDesc.extendN03;
+                        // dr3["EXTENDN04"] = item2.purchaseDesc.extendN04;
+                        //  dr3["EXTENDN05"] = item2.purchaseDesc.extendN05;
+                        //  dr3["EXTENDN06"] = item2.purchaseDesc.extendN06;
+                        dr3["STORECODE"] = item2.storeCode;
+                        dr3["STORENAME"] = item2.storeName;
+                        dr3["VERIFYQTY"] = item2.verifyQty;
+                        dr3["ALLOWQTY"] = item2.allowQty;
+                        dr3["COMPROMISEQTY"] = item2.compromiseQty;
+                        dr3["REFUSEDQTY"] = item2.refusedQty;
+                        dr3["RTOERPNO"] = item2.rtoErpNo;
+                        dr3["RTOLINENO"] = item2.rtoLineNo;
+                        dr3["PRODLENGTH"] = item2.prodLength;
+                        dr3["PRODWIDTH"] = item2.prodWidth;
+                        dr3["PRODHEIGHT"] = item2.prodHeight;
+                        dr3["BUYERNAME"] = item2.buyerName;
+                        dr3["EXPECTEDDATE"] = item2.expectedDate;
+                        dr3["ANSWERDATE"] = item2.answerDate;
+                        dr3["CURRENCYCODE"] = item2.currencyCode;
+                        dr3["CURRENCYNAME"] = item2.currencyName;
+                        dr3["SENDVERIFYSTATUS"] = item2.sendVerifyStatus;
+                        dr3["RESULTFLAG"] = item2.resultFlag;
+                        dr3["APPLYDELIVERYQTY"] = item2.applyDeliveryQty;
+                        dr3["APPLYDELIVERYVALUATIONQTY"] = item2.applyDeliveryValuationQty;
+                        dr3["BATCHNUMBER"] = item2.batchNumber;
+                        dr3["RECEIVEQTY"] = item2.receiveQty;
+                        dr3["STORAGEQTY"] = item2.storageQty;
+                        dr3["RETURNQTY"] = item2.returnQty;
+                        dr3["FIRSTCHECK"] = item2.firstCheck;
+                        dt_line.Rows.Add(dr3);
+                    }
+                    if (DataTableToSQLServer(dt_line, conStr, "XKYDETAIL_LINE", colMapping, ref ErrorMsg))
+                        return true;
+                    else
+                        return false;
+                }
+                else
+                {
+                    ErrorMsg = responseJson.errorMsg;
+                    return false;
+                }
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+        private bool XKY_GET_BARCODE(DataRow dr, ref string ErrorMsg)
+        {
+            DataTable dt = _sqlHelper.ExecuteDataTable("select top(1) * from XKYBARCODE(nolock) where 1=2");
+            ApiCommonParam Apiparam = ApiCommonParam.NewApiCommon();
+            try
+            {
+                string task_name = dr["task_name"].ToString();
+                string descript = dr["descript"].ToString();
+                string create_time = dr["create_time"].ToString();
+                string creator = dr["creator"].ToString();
+                string operatype = dr["operatype"].ToString();
+                string source_table = dr["source_table"].ToString();
+                string target_table = dr["target_table"].ToString();
+                string data = dr["data"].ToString();
+                string data_inserted = dr["data_inserted"].ToString();
+                string data_deleted = dr["data_deleted"].ToString();
+                ArrayList SQLStringList = new ArrayList();
+                // var client = new HttpClient();
+                var url = "https://openapi.xiekeyun.com/barcode/byDeliveryNo.json";
+                HttpClient httpClient = new HttpClient();
+                httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
+                string json = "{\"commonParam\":" + JsonConvert.SerializeObject(Apiparam) + ",\"body\":" + data_inserted + "}";
+                byte[] postData = Encoding.UTF8.GetBytes(json);
+                // 鍒涘缓璇锋眰瀵硅薄
+                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
+                request.Method = "POST";
+                request.ContentType = "application/json";
+                request.ContentLength = postData.Length;
+                // 鍙戦�佽姹傛暟鎹�
+                using (Stream stream = request.GetRequestStream())
+                {
+                    stream.Write(postData, 0, postData.Length);
+                }
+                dynamic responseJson;
+                // 鍙戦�佽姹傚苟鑾峰彇鍝嶅簲
+                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
+                using (Stream stream = response.GetResponseStream())
+                using (StreamReader reader = new StreamReader(stream))
+                {
+                    string result2 = reader.ReadToEnd();
+                    responseJson = JsonConvert.DeserializeObject(result2);
+
+                }
+
+                SqlBulkCopyColumnMapping[] colMapping = new SqlBulkCopyColumnMapping[dt.Columns.Count];
+
+
+                // 璇诲彇鍝嶅簲鍐呭
+
+                if (responseJson.result == 1)
+                {
+                    if (responseJson.dataList != null)
+                    {
+                        foreach (var item in responseJson.dataList)
+                        {
+
+                            //鎻掑叆鍓嶅厛鍒犻櫎閲嶅閿�
+                            //DeleteDataBeforeInsert("XKYDHD", "DELIVERYNO", string.Join("','", item.deliveryNo), "");
+                            DeleteDataBeforeInsert("XKYDHD_DETAILS", "DELIVERYNO", string.Join("','", item.deliveryNo), "");
+                            //    DeleteDataBeforeInsert("XKYDHD_DETAILS_LINE", "DELIVERYNO", string.Join("','", item.deliveryNo), "");
+
+                            DataRow dr2 = dt.NewRow();
+
+                            dr2["DELIVERYNO"] = data;
+                            dr2["POERPNO"] = item.dynamicData.poErpNo;
+                            dr2["POLINENO"] = item.dynamicData.poLineNo;
+                            dr2["PRODUCTCODE"] = item.productCode;
+                            dr2["PRODUCTNAME"] = item.productName;
+                            dr2["PRODUCTSCALE"] = item.productScale;
+                            dr2["SMALLBARCODE"] = item.smallBarcode;
+                            dr2["BIGBARCODE"] = item.bigBarcode;
+                            dr2["OUTERBARCODE"] = item.outerBarcode;
+                            dr2["INCLUDEQTY"] = item.includeQty;
+                            dr2["INNERVENDORCODE"] = item.dynamicData.innerVendorCode;
+                            dr2["DELIVERYDATE"] = item.dynamicData.deliveryDate;
+                            dr2["CREATETYPE"] = item.createType;
+                            dr2["PACKLEVEL"] = item.packLevel;
+                            dr2["UPDATETIME"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                            dr2["FLAG"] = "0";
+                            dr2["BILL_NO"] = source_table;
+                            dt.Rows.Add(dr2);
+
+                        }
+
+                        if (DataTableToSQLServer(dt, conStr, "XKYBARCODE", colMapping, ref ErrorMsg))
+                            return true;
+                        else
+                            return false;
+
+                    }
+
+                    return true;
+                }
+
+                ;
+                ErrorMsg = responseJson.errorMsg;
+                return false;
+
+            }
+            catch (Exception ex)
+            {
+                ErrorMsg = ex.Message;
+                return false;
+            }
+        }
+
+        #region 灏佽鎵归噺鎻掑叆鏁版嵁SQL Server鏁版嵁鐨勬柟娉�        
+        /// <summary>
+        /// 灏佽鎵归噺鎻掑叆鏁版嵁SQL Server鏁版嵁鐨勬柟娉�
+        /// </summary>
+        /// <param name="dt">婧愭暟鎹〃</param>
+        /// <param name="connectString">鏁版嵁搴撹繛鎺ュ瓧绗︿覆</param>
+        /// <param name="tableName">鐩爣琛ㄥ悕</param>
+        /// <param name="colMapping">瀛楁鏄犲皠</param>
+        public bool DataTableToSQLServer(DataTable dt,string connectString,string tableName,SqlBulkCopyColumnMapping[] colMapping,ref string msg)
+        {
+            using (SqlConnection destinationConnection = new SqlConnection(connectString))
+            {
+                destinationConnection.Open();
+
+                using (SqlBulkCopy bulkCopy = new SqlBulkCopy(destinationConnection, SqlBulkCopyOptions.FireTriggers,null))
+                {
+                    try
+                    {
+                        bulkCopy.DestinationTableName = tableName;//瑕佹彃鍏ョ殑琛ㄧ殑琛ㄥ悕
+                        bulkCopy.BatchSize = dt.Rows.Count;
+                        foreach (SqlBulkCopyColumnMapping item in colMapping)
+                        {
+                            if (item==null)
+                            {
+                                continue;
+                            }
+                            bulkCopy.ColumnMappings.Add(item);
+                        }                       
+
+                        bulkCopy.WriteToServer(dt);
+                        return true;
+                    }
+                    catch (Exception ex)
+                    {
+                        msg = "[" + tableName + "]" + ex.Message;
+                        return false;
+                    }
+                    finally
+                    {
+
+                    }
+                }
+            }
+
+        } 
+        #endregion
+
+        #region 鎻掑叆鏁版嵁鍓嶅厛鍒犻櫎锛屼互鍏嶄富閿噸澶� bool DeleteDataBeforeInsert(string TableName, string IDColumnName, string IDList, string OtherWhere)
+        /// <summary>
+        /// 鎻掑叆鏁版嵁鍓嶅厛鍒犻櫎锛屼互鍏嶄富閿噸澶�
+        /// </summary>
+        /// <param name="TableName">琛ㄥ悕</param>
+        /// <param name="IDColumnName">涓婚敭鍒楋紝澶嶄富閿洿鎺ュ姞璧锋潵</param>
+        /// <param name="IDList">涓婚敭鍊�</param>
+        /// <param name="OtherWhere">鍏跺畠鏉′欢 浠nd 寮�澶�</param>
+        /// <returns></returns>
+        public bool DeleteDataBeforeInsert(string TableName, string IDColumnName, string IDList, string OtherWhere)
+        {
+            string sql = string.Format(@"delete from {0} where {1} in ('{2}') {3}", TableName, IDColumnName, IDList, OtherWhere);
+
+            return _sqlHelper.ExecuteNonQuery(sql) > 0;
+        } 
+        #endregion
+
+        #region 鏁版嵁鐨勫姩浣滈噸鏂板垽鏂� bool DataIsInDB(string TableName, string IDColumnName, string IDList, string OtherWhere)
+        /// <summary>
+        /// 鏁版嵁鐨勫姩浣滈噸鏂板垽鏂�
+        /// </summary>
+        /// <param name="TableName">琛ㄥ悕</param>
+        /// <param name="IDColumnName">涓婚敭鍒楋紝澶嶄富閿洿鎺ュ姞璧锋潵</param>
+        /// <param name="IDList">涓婚敭鍊�</param>
+        /// <param name="OtherWhere">鍏跺畠鏉′欢 浠nd 寮�澶�</param>
+        /// <returns></returns>
+        public bool DataIsInDB(string TableName, string IDColumnName, string IDList, string OtherWhere)
+        {
+            string sql = string.Format(@"select count(1) cnt from {0} with(nolock) where {1} in ('{2}') {3}", TableName, IDColumnName, IDList, OtherWhere);
+
+            return (int)_sqlHelper.ExecuteScalar(sql) > 0;
+        }
+        #endregion
+
+    }
+
+
+}
diff --git a/HandleData/Allocation.cs b/HandleData/Allocation.cs
new file mode 100644
index 0000000..2e69214
--- /dev/null
+++ b/HandleData/Allocation.cs
@@ -0,0 +1,319 @@
+锘縰sing Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.Configuration;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms;
+
+namespace DataexchangeServer
+{
+    public delegate void WriteLogHandle(string msg);
+
+    #region 绫荤殑鐘舵�� enum State
+    /// <summary>
+    /// 绫荤殑鐘舵��
+    /// </summary>
+    public enum State
+    {
+        Alive, //婵�娲�
+        Finish,//瀹屾垚
+        Sleep //鐫$湢
+    } 
+    #endregion
+
+    public class Allocation
+    {
+        public State state { get; set; }
+        public string Name { get; set; }
+        public string ID { get; set; }
+        public string task_id { get; set; }
+        public DataTable tbQueue;
+        private SQLHelper _sqlHelper;
+        private DataSet dsTemp = new DataSet();
+
+        public DateTime strStartTime { get; set; }
+
+        /// <summary>
+        /// 褰撴秷鎭湁鍙樺寲鐨勬椂鍊欏皢娑堟伅閫氳繃浜嬩欢浼犺緭
+        /// </summary>
+        private string ConsoleMessage { get; set; }
+        public event WriteLogHandle WriteLog;
+        public event WriteLogHandle WriteErrorLog;
+
+        #region 绾跨▼绫籄llocation()
+        /// <summary>
+        /// 绾跨▼绫�
+        /// </summary>
+        public Allocation()
+        {
+            string conn = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
+            conn = SecurityHelper.Decrypt(conn);
+            _sqlHelper = new SQLHelper(conn);
+            //_sqlHelper =
+                       //new SQLHelper(
+                       //    Encoding.Default.GetString(
+                       //        Convert.FromBase64String(ConfigurationManager.ConnectionStrings["conn"].ConnectionString)));
+            tbQueue = new DataTable();
+            string SqlStr = string.Format(@"Select top 0 * from SYSDEC (nolock) where 1<>1");
+            tbQueue = _sqlHelper.ExecuteDataTable(SqlStr);
+            tbQueue.TableName = "SYSDEC";
+            tbQueue.PrimaryKey = new[] { tbQueue.Columns["task_id"] };
+            state = State.Sleep;
+        } 
+        #endregion
+
+        #region 鎵ц璋冪敤void Execute(object obj)
+        /// <summary>
+        /// 鎵ц璋冪敤
+        /// </summary>
+        public void Execute(object obj)
+        {
+            string data = "";
+            string taskId = "";
+            string docType = "";
+            //string inputXml = "";
+            string operatype = "";
+            string msg = "";
+            string data_inserted = "";
+            string flag = "0";
+            //lock (ID) ;
+            try
+            {
+                state = State.Alive;
+                DataRow[] rowArray = tbQueue.Select("", "create_time");
+                if (rowArray.Length == 0) return;
+                AE_MES_ERP Client = new AE_MES_ERP();
+                foreach (DataRow row in rowArray)
+                {
+                    if (object.Equals(null, row["data_inserted"]))
+                    {
+                        row["msg"] = "鎻掑叆鐨勬暟鎹负绌猴紝璇锋鏌ョ▼搴忥紒";
+                        row["states"] = "FAIL";
+                        row["retry_times"] = Convert.ToInt16(row["retry_times"].ToString() == "" ? "0" : row["retry_times"].ToString()) + 15;
+                        row["execute_time"] = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                        continue;
+                    }
+
+                    taskId = row["task_id"].ToString();
+                    data = row["data"].ToString();
+                    docType = row["task_name"].ToString();
+                    data_inserted = row["data_inserted"].ToString();
+                    operatype = row["operatype"].ToString();
+
+                    ConsoleMessage = string.Format("绾跨▼:{0},{1}鎵ц鍐呭锛歿2} 鎺ㄩ�丏ata:{3} 鎵ц鏃堕棿锛歿4}",
+                                                    Name,
+                                                    row["creator"].ToString(),
+                                                    row["descript"].ToString(),
+                                                    row["data"].ToString(),
+                                                    System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
+                    if (WriteLog != null) { WriteLog(ConsoleMessage); }
+
+                    //DataTable tbTemp = JSONHelper.JsonToDataTable(data_inserted);
+                    if ((!docType.Contains("TB_MESTOERP")&& (!docType.Contains("XKY"))))
+                    {
+                        if (operatype!="DELETE")
+                        {
+                            JsonSerializerSettings settings = new JsonSerializerSettings();
+                            settings.Converters.Add(new ReadAheadDataSetConverter());
+                            dsTemp = JsonConvert.DeserializeObject<DataSet>(data_inserted, settings);
+                            // dsTemp = JsonConvert.DeserializeObject(data_inserted, typeof(DataSet)) as DataSet;
+                            if (dsTemp == null || dsTemp.Tables.Count == 0)
+                            {
+                                row["msg"] = "鎺ュ彛瀛樺湪鏃犳晥瀛楃";
+                                row["states"] = "FAIL";
+                                row["retry_times"] = Convert.ToInt16(row["retry_times"].ToString() == "" ? "0" : row["retry_times"].ToString()) + 15;
+                                row["execute_time"] = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                                continue;
+                            }
+                        }
+                        else
+                        {
+                            operatype = data;
+                        }                     
+                    }
+                    //dsTemp.Tables.Clear();
+                    //dsTemp.Tables.Add(tbTemp);
+                    //inputXml = dsTemp.GetXml();
+                    msg = "";
+                    //Thread.Sleep(3000); 
+                    //DataexchangeServer.IMS.WebServiceClient Client = new DataexchangeServer.IMS.WebServiceClient();
+                    if (Client.ErpToMesData(docType, dsTemp, operatype, row, ref msg,ref flag, taskId) == true)
+                    {
+                        if (flag=="0")
+                        {
+                            row["msg"] = msg;
+                            row["states"] = "FAIL";
+                            row["retry_times"] = Convert.ToInt16(row["retry_times"].ToString() == "" ? "0" : row["retry_times"].ToString()) + 1;
+                            row["execute_time"] = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                            if (WriteErrorLog != null)
+                            {
+                                WriteErrorLog(msg);
+                            }
+                        }
+                        else
+                        {
+                            row["msg"] = msg;
+                            row["remark"] = "OK";
+                            row["states"] = "SUCCESS";
+                            row["execute_time"] = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                        }
+                    }
+                    else
+                    {
+                        row["msg"] = msg;
+                        row["states"] = "FAIL";
+                        row["retry_times"] = Convert.ToInt16(row["retry_times"].ToString() == "" ? "0" : row["retry_times"].ToString()) + 1;
+                        row["execute_time"] = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                        if (WriteErrorLog != null)
+                        {
+                            WriteErrorLog(msg);
+                        }
+                    }
+
+                }
+                _sqlHelper.SaveDataToDB(tbQueue);
+                tbQueue.AcceptChanges();
+            }
+            catch (Exception ex)
+            {
+                //state = State.Finish;
+                //throw (ex);
+                //MessageBox.Show("褰撳墠閿欒淇℃伅濡備笅:" + ex);
+                ConsoleMessage = string.Format(@"task_id:{0},{1}寮傚父淇℃伅锛�" + ex.Message, taskId, DateTime.Now.ToString("yyyy-MM-dd HH:mm:sss"));
+                bool result = JSONHelper.WriteToFile(ConsoleMessage);
+
+                ConsoleMessage = string.Format(@"Save {0},ID:{1} 鍑虹幇寮傚父淇℃伅锛岃鍦ㄨ繍琛岀洰褰曚笅鏌ョ湅銆俓log\", result, data);
+                if (WriteErrorLog != null)
+                {
+                    WriteErrorLog(ConsoleMessage);
+                }
+            }
+            finally
+            {
+                state = State.Finish;
+            }
+            if (tbQueue.Rows.Count > 0)
+            {
+                ConsoleMessage = string.Format("绾跨▼:{0}浠诲姟缁撴潫銆傛椂闂达細{1}", Name, System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss "));
+                if (WriteLog != null) { WriteLog(ConsoleMessage); }
+                //state = State.Finish;
+            }
+        }
+        #endregion
+
+
+
+        public class ReadAheadDataSetConverter : JsonConverter
+        {
+            public override bool CanConvert(Type objectType)
+            {
+                return objectType == typeof(DataSet);
+            }
+
+            public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+            {
+                JObject jObject = JObject.Load(reader);
+                return BuildDataSet(jObject);
+            }
+            private DataSet BuildDataSet(JObject jObject)
+            {
+                DataSet dsResult = new DataSet();
+                foreach (JProperty propds in jObject.Properties())
+                {
+                    DataTable table = new DataTable(propds.Name);
+                    var dataTypes = new Dictionary<string, Type>();
+                    foreach (JObject item in propds.Value.Children<JObject>())
+                    {
+                        foreach (JProperty prop in item.Properties())
+                        {
+                            Type currentType = GetDataType(prop.Value.Type);
+                            if (currentType != null)
+                            {
+                                Type previousType;
+                                if (!dataTypes.TryGetValue(prop.Name, out previousType) ||
+                                    (previousType == typeof(long) && currentType == typeof(decimal)))
+                                {
+                                    dataTypes[prop.Name] = currentType;
+                                }
+                                else if (previousType == typeof(decimal) && currentType == typeof(long))
+                                {
+                                    dataTypes[prop.Name] = previousType;
+                                }
+                                else if (previousType != currentType)
+                                {
+                                    dataTypes[prop.Name] = typeof(string);
+                                }
+                            }
+                        }
+                    }
+                    foreach (var kvp in dataTypes)
+                    {
+                        table.Columns.Add(kvp.Key, kvp.Value);
+                    }
+                    foreach (JObject itemdr in propds.Value.Children<JObject>())
+                    {
+                        DataRow row = table.NewRow();
+                        foreach (JProperty prop in itemdr.Properties())
+                        {
+                            if (prop.Value.Type != JTokenType.Null)
+                            {
+                                Type dataType = dataTypes[prop.Name];
+                                row[prop.Name] = prop.Value.ToObject(dataType);
+                            }
+                        }
+                        table.Rows.Add(row);
+                    }
+                    dsResult.Tables.Add(table);
+                }
+
+                return dsResult;
+            }
+
+            private Type GetDataType(JTokenType tokenType)
+            {
+                switch (tokenType)
+                {
+                    case JTokenType.Null:
+                        return null;
+                    case JTokenType.String:
+                        return typeof(string);
+                    case JTokenType.Integer:
+                        return typeof(long);
+                    case JTokenType.Float:
+                        return typeof(decimal);
+                    case JTokenType.Boolean:
+                        return typeof(bool);
+                    case JTokenType.Date:
+                        return typeof(DateTime);
+                    case JTokenType.TimeSpan:
+                        return typeof(TimeSpan);
+                    case JTokenType.Guid:
+                        return typeof(Guid);
+                    case JTokenType.Bytes:
+                        return typeof(byte[]);
+                    case JTokenType.Array:
+                    case JTokenType.Object:
+                        throw new JsonException("This converter does not support complex types");
+                    default:
+                        return typeof(string);
+                }
+            }
+
+            public override bool CanWrite
+            {
+                get { return false; }
+            }
+
+            public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+            {
+                throw new NotImplementedException();
+            }
+        }
+
+    }
+}
diff --git a/HandleData/XkyApiHelper.cs b/HandleData/XkyApiHelper.cs
new file mode 100644
index 0000000..13d7c29
--- /dev/null
+++ b/HandleData/XkyApiHelper.cs
@@ -0,0 +1,155 @@
+锘縰sing Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Security.Cryptography;
+using System.Text;
+using System.Web.Script.Serialization;
+
+namespace DataexchangeServer.Helper
+{
+    /// SignUnit 绛惧悕灞炴�у父閲忕被
+    public class SignConst
+    {
+        public SignConst()
+        {
+            //this.appKey = "270ea37852e8f7cced1c2a7198b818b1";
+           // this.operateCompanyCode = "40373154";
+           // this.ownerCompanyCode = "40373154";
+           // this.appSecret = "d74b514466f3dac0136b5672b914176a";
+            this.appKey = "86d3ae868978beff0d39948c420ec4ff";
+            this.operateCompanyCode = "52265397";
+            this.ownerCompanyCode = "52265397";
+            this.appSecret = "978f5b950aefc3c1e0d4a56a562b0f8c";
+          //  this.appKey = "56d6b68cd8fff627bf3203b44d9c8821";
+          //  this.operateCompanyCode = "19378112";
+          //  this.ownerCompanyCode = "19378112";
+          //  this.appSecret = "4b26874c9d7ee95c3de85390d96dbbaf";
+            this.version = "1.0";
+        }
+
+        public string appKey { get; set; }
+        public string version { get; set; }
+        public string operateCompanyCode { get; set; }
+        public string ownerCompanyCode { get; set; }
+        public string appSecret { get; set; }
+    }
+}
+
+namespace DataexchangeServer.Helper
+{
+    /// API鐩稿叧鍙傛暟瀹氫箟鐨勫叏灞�绫�
+    public partial class ApiGlobal
+    {
+        public ApiGlobal() { }
+
+        /// 鍒濆鍖�
+        public static void Init()
+        {
+            signConst = new SignConst();
+        }
+
+        public static SignConst signConst { get; set; }
+    }
+}
+
+
+namespace DataexchangeServer.Helper
+{
+    /// SignUtils 绛惧悕宸ュ叿绫�
+    public class SignUtils
+    {
+        public static MD5 md5 = MD5.Create();
+        private static IEnumerator<KeyValuePair<string, string>> dem;
+
+        public static object buildCurrentSign(IDictionary<string, string> parameters, String appSecret)
+        {
+            try
+            {
+                string secret = ":" + appSecret;
+                IDictionary<string, string> sortedParams = new SortedDictionary<string, string>(parameters, StringComparer.Ordinal);
+            //    IEnumerator < KeyValuePair<string, string> & Gt; 
+                dem = sortedParams.GetEnumerator();
+                StringBuilder query = new StringBuilder();
+                while (dem.MoveNext())
+                {
+                    string key = dem.Current.Key;
+                    string value = dem.Current.Value;
+                    if (key == "sign")
+                    {
+                        continue;
+                    }
+                    if (!string.IsNullOrEmpty(key))
+                    {
+                        query.Append(value).Append(":");
+                    }
+                }
+                string strvalue = query.ToString().TrimEnd(':') + secret;
+                return MD5Encrypt32(strvalue);
+            }
+            catch (Exception)
+            {
+                throw new Exception("绛惧悕寮傚父!");
+            }
+        }
+
+        public static string MD5Encrypt32(string text)
+        {
+            string pwd = "";
+            // 鍔犲瘑鍚庢槸涓�涓瓧鑺傜被鍨嬬殑鏁扮粍锛岃繖閲岃娉ㄦ剰缂栫爜UTF8/Unicode鐨勯�夋嫨銆�
+            byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(text));
+            // 閫氳繃浣跨敤寰幆锛屽皢瀛楄妭绫诲瀷鐨勬暟缁勮浆鎹负瀛楃涓诧紝姝ゅ瓧绗︿覆鏄父瑙勫瓧绗︽牸寮忓寲鎵�寰�
+            for (int i = 0; i < s.Length; i++)
+            {
+                //灏嗗緱鍒扮殑瀛楃涓蹭娇鐢ㄥ崄鍏繘鍒剁被鍨嬫牸寮忋�傛牸寮忓悗鐨勫瓧绗︽槸灏忓啓鐨勫瓧姣嶏紝濡傛灉浣跨敤澶у啓锛圶锛夊垯鏍煎紡鍚庣殑瀛楃鏄ぇ鍐欏瓧绗� 
+                pwd = pwd + s[i].ToString("x2");
+            }
+            return pwd.ToString().ToLower();
+        }
+
+        public static long GetTimestamp(DateTime d)
+        {
+            TimeSpan ts = d.ToUniversalTime() - new DateTime(1970, 1, 1);
+            return (long)ts.TotalSeconds;     //绮剧‘鍒扮
+        }
+    }
+}
+
+
+namespace DataexchangeServer.Helper
+{
+    /// ApiCommonParam API璇锋眰瀵瑰簲鐨凜ommon鍙傛暟绫�
+    public class ApiCommonParam
+    {
+        public ApiCommonParam() { }
+
+        public ApiCommonParam(string appKey, string version, string operateCompanyCode, string ownerCompanyCode, long timestamps)
+        {
+            this.appKey = appKey;
+            this.version = version;
+            this.operateCompanyCode = operateCompanyCode;
+            this.ownerCompanyCode = ownerCompanyCode;
+            this.timestamps = timestamps;
+        }
+
+        public string appKey { get; set; }//appKey    
+        public string version { get; set; }//鎺ュ彛鐗堟湰
+        public string ownerCompanyCode { get; set; }//鏁版嵁鎵�灞炲叕鍙哥紪鐮�
+        public string operateCompanyCode { get; set; }//鎿嶄綔鑰呮墍灞炲叕鍙哥紪鐮�
+        public string sign { get; set; }//绛惧悕
+        public long timestamps { get; set; }//璇锋眰鐨勬椂闂存埑
+     //   public object reserver { get; set; }//鎵╁睍瀛楁
+
+        /// 鏋勯�犲璞�
+        public static ApiCommonParam NewApiCommon()
+        {
+            //鏋勯�犲璞�
+            ApiCommonParam param = new ApiCommonParam(ApiGlobal.signConst.appKey, ApiGlobal.signConst.version, ApiGlobal.signConst.operateCompanyCode, ApiGlobal.signConst.ownerCompanyCode, SignUtils.GetTimestamp(DateTime.Now));
+            //璁$畻绛惧悕&璧嬪��
+            JavaScriptSerializer json = new JavaScriptSerializer();
+            string jsonParam = json.Serialize(param);
+            var paramDict = JsonConvert.DeserializeObject<Dictionary<string, string>>(jsonParam);
+            param.sign = (string)SignUtils.buildCurrentSign(paramDict, ApiGlobal.signConst.appSecret);
+            return param;
+        }
+    }
+}
diff --git a/Helper/JSONHelper.cs b/Helper/JSONHelper.cs
new file mode 100644
index 0000000..1bda571
--- /dev/null
+++ b/Helper/JSONHelper.cs
@@ -0,0 +1,123 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Data;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace DataexchangeServer
+{
+    /// <summary>
+    /// JSON甯姪鏂规硶
+    /// </summary>
+    public class JSONHelper
+    {
+        /// <summary>
+        /// 灏唈son杞崲涓篋ataTable
+        /// </summary>
+        /// <param name="strJson">寰楀埌鐨刯son</param>
+        /// <returns></returns>
+        public static DataTable JsonToDataTable(string strJson)
+        {
+            DataTable tb = null;
+
+            if (strJson.IndexOf("\"|") > -1 || strJson.IndexOf("\"#+#") > -1)
+            {
+                return tb;
+            }
+            strJson = strJson.Replace("\",", "\"|").Replace("\":", "\"#+#").ToString();
+
+            //鍙栧嚭琛ㄥ悕   
+            var rg = new Regex(@"(?<={)[^:]+(?=:\[)", RegexOptions.IgnoreCase);
+            string strName = rg.Match(strJson).Value;
+            //鍘婚櫎琛ㄥ悕   
+            strJson = strJson.Substring(strJson.IndexOf("[") + 1);
+            strJson = strJson.Substring(0, strJson.IndexOf("]"));
+
+            //鑾峰彇鏁版嵁   
+            rg = new Regex(@"(?<={)[^}]+(?=})");
+            MatchCollection mc = rg.Matches(strJson);
+            for (int i = 0; i < mc.Count; i++)
+            {
+                string strRow = mc[i].Value;
+                string[] strRows = strRow.Split('|');
+
+                //鍒涘缓琛�   
+                if (tb == null)
+                {
+                    tb = new DataTable();
+                    tb.TableName = strName;
+                    foreach (string str in strRows)
+                    {
+                        var dc = new DataColumn();
+                        string[] strCell = str.Split(new string[] { "#+#" }, StringSplitOptions.None);
+
+                        if (strCell[0].Substring(0, 1) == "\"")
+                        {
+                            int a = strCell[0].Length;
+                            dc.ColumnName = strCell[0].Substring(1, a - 2);
+                        }
+                        else
+                        {
+                            dc.ColumnName = strCell[0];
+                        }
+                        tb.Columns.Add(dc);
+                    }
+                    tb.AcceptChanges();
+                }
+
+                //澧炲姞鍐呭   
+                DataRow dr = tb.NewRow();
+                for (int r = 0; r < strRows.Length; r++)
+                {
+                    dr[r] = strRows[r].Split(new string[] { "#+#" }, StringSplitOptions.None)[1].Trim().Replace("锛�", ",").Replace("锛�", ":").Replace("\"", "");
+                }
+                tb.Rows.Add(dr);
+                tb.AcceptChanges();
+            }
+            return tb;
+        }
+
+        static object obj = new object();
+        /// <summary>
+        /// 鍐欏叆鏂囦欢
+        /// </summary>
+        /// <param name="msg"></param>
+        /// <returns></returns>
+        public static bool WriteToFile(string msg)
+        {
+            if (msg.Trim() == "") return true;
+            try
+            {
+                lock (obj)
+                {
+
+                    string fileFolder = Environment.CurrentDirectory + @"\log\";
+                    if (!Directory.Exists(fileFolder))
+                    {
+                        DirectoryInfo directoryInfo = new DirectoryInfo(fileFolder);
+                        directoryInfo.Create();
+                    }
+
+                    string path = fileFolder + DateTime.Now.ToString("yyyyMMdd HH-mm") + ".txt";
+                    using (FileStream fs = new FileStream(path, FileMode.Append, FileAccess.Write))
+                    {
+                        byte[] bytes = Encoding.Default.GetBytes(msg);
+                        //fs.WriteTimeout = 10000;
+                        fs.Write(bytes, 0, bytes.Length);
+                        fs.Close();
+                    }
+                    return true;
+                }
+            }
+            catch (Exception ex)
+            {
+                return false;
+            }
+
+        }
+
+
+    }
+}
diff --git a/Helper/SQLHelper.cs b/Helper/SQLHelper.cs
new file mode 100644
index 0000000..a09fa42
--- /dev/null
+++ b/Helper/SQLHelper.cs
@@ -0,0 +1,698 @@
+锘縰sing System.Collections.Generic;
+
+namespace DataexchangeServer
+{
+    using System;
+    using System.Collections;
+    using System.Collections.Specialized;
+    using System.Data;
+    using System.Data.Sql;
+    using System.Data.SqlClient;
+    using System.Text.RegularExpressions;
+
+    public class SQLHelper : ICloneable, IDisposable
+    {
+        private SqlConnection _connection4Tran;
+        private readonly string _connectionString;
+        private SqlTransaction _transaction;
+        private readonly Queue<SqlTask> _transactionTaskList;
+
+        public SQLHelper(string connectionString)
+        {
+            _transactionTaskList = new Queue<SqlTask>();
+            this._connectionString = connectionString;
+        }
+
+        public SQLHelper(string server, string userID, string password, string database)
+        {
+            _transactionTaskList = new Queue<SqlTask>();
+            if (database == string.Empty)
+            {
+                this._connectionString = "Data Source=" + server + ";User ID=" + userID + ";Password=" + password;
+            }
+            else
+            {
+                this._connectionString = "Data Source=" + server + ";User ID=" + userID + ";Password=" + password + ";Initial Catalog=" + database;
+            }
+        }
+
+        public void BeginTransaction(IsolationLevel isolationLevel)
+        {
+            if ((this._transaction != null) || (this._connection4Tran != null))
+            {
+                throw new Exception("瑕佸紑濮嬩竴涓柊鐨勪簨鍔★紝璇峰厛瀹屾垚褰撳墠浜嬪姟!");
+            }
+            this._connection4Tran = new SqlConnection(this._connectionString);
+            this._connection4Tran.Open();
+            this._transaction = this._connection4Tran.BeginTransaction(isolationLevel);
+            _transactionTaskList.Clear();
+        }
+
+        public void CancelTransaction()
+        {
+            if (this._transaction != null)
+            {
+                this._transaction.Dispose();
+            }
+            if (this._connection4Tran != null)
+            {
+                this._connection4Tran.Close();
+            }
+            if (this._connection4Tran != null)
+            {
+                this._connection4Tran.Dispose();
+            }
+            this._transaction = null;
+            this._connection4Tran = null;
+        }
+
+        public object Clone()
+        {
+            return new SQLHelper(this._connectionString);
+        }
+
+        public void CommitTransaction()
+        {
+            try
+            {
+                if (_transactionTaskList.Count > 0)
+                {
+                    foreach (SqlTask sqlTask in _transactionTaskList)
+                    {
+                        using (var command = new SqlCommand(sqlTask.Text, _connection4Tran))
+                        {
+                            command.CommandType = sqlTask.CommandType;
+                            if (sqlTask.Parameters != null)
+                            {
+                                foreach (SqlParameter parameter in sqlTask.Parameters)
+                                {
+                                    command.Parameters.Add(parameter);
+                                }
+                            }
+                            command.Transaction = _transaction;
+                            command.ExecuteNonQuery();
+                        }
+                    }
+                }
+                this._transaction.Commit();
+            }
+            catch (Exception)
+            {
+                this._transaction.Rollback();
+            }
+            finally
+            {
+                if (this._transaction != null)
+                {
+                    this._transaction.Dispose();
+                }
+                if (this._connection4Tran != null)
+                {
+                    this._connection4Tran.Close();
+                }
+                if (this._connection4Tran != null)
+                {
+                    this._connection4Tran.Dispose();
+                }
+                this._transaction = null;
+                this._connection4Tran = null;
+            }
+        }
+
+        public DataSet ExecuteDataSet(string sql)
+        {
+            return this.ExecuteDataSet(sql, CommandType.Text, null);
+        }
+
+        public DataSet ExecuteDataSet(string sql, CommandType commandType)
+        {
+            return this.ExecuteDataSet(sql, commandType, null);
+        }
+
+        public DataSet ExecuteDataSet(string sql, CommandType commandType, SqlParameter[] parameters)
+        {
+            DataSet dataSet = new DataSet(Guid.NewGuid().ToString());
+            using (SqlConnection connection = new SqlConnection(this._connectionString))
+            {
+                using (SqlCommand command = new SqlCommand(sql, connection))
+                {
+                    command.CommandType = commandType;
+                    if (parameters != null)
+                    {
+                        foreach (SqlParameter parameter in parameters)
+                        {
+                            command.Parameters.Add(parameter);
+                        }
+                    }
+                    new SqlDataAdapter(command).Fill(dataSet);
+                }
+            }
+            return dataSet;
+        }
+
+        public DataTable ExecuteDataTable(string sql)
+        {
+            return this.ExecuteDataTable(sql, CommandType.Text, null);
+        }
+
+        public DataTable ExecuteDataTable(string sql, CommandType commandType)
+        {
+            return this.ExecuteDataTable(sql, commandType, null);
+        }
+
+        public DataTable ExecuteDataTable(string sql, CommandType commandType, SqlParameter[] parameters)
+        {
+            DataTable dataTable = new DataTable(Guid.NewGuid().ToString());
+            using (SqlConnection connection = new SqlConnection(this._connectionString))
+            {
+                using (SqlCommand command = new SqlCommand(sql, connection))
+                {
+                    command.CommandType = commandType;
+                    if (parameters != null)
+                    {
+                        foreach (SqlParameter parameter in parameters)
+                        {
+                            command.Parameters.Add(parameter);
+                        }
+                    }
+                    new SqlDataAdapter(command).Fill(dataTable);
+                }
+            }
+            return dataTable;
+        }
+
+        public int ExecuteNonQuery(string sql)
+        {
+            return this.ExecuteNonQuery(sql, CommandType.Text, null);
+        }
+
+        public int ExecuteNonQuery(string sql, CommandType commandType)
+        {
+            return this.ExecuteNonQuery(sql, commandType, null);
+        }
+
+        public int ExecuteNonQuery(string sql, CommandType commandType, SqlParameter[] parameters)
+        {
+            return this.ExecuteNonQuery(sql, commandType, parameters, false);
+        }
+
+        public int ExecuteNonQuery(string sql, CommandType commandType, SqlParameter[] parameters, bool joinTransaction)
+        {
+            int num;
+            SqlCommand command;
+            if (joinTransaction)
+            {
+                if ((this._transaction == null) || (this._connection4Tran == null))
+                {
+                    throw new Exception("浜嬪姟鏈垵濮嬪寲锛�");
+                }
+               
+                _transactionTaskList.Enqueue(new SqlTask(sql, commandType, parameters));
+            }
+            using (SqlConnection connection = new SqlConnection(this._connectionString))
+            {
+                using (command = new SqlCommand(sql, connection))
+                {
+                    command.CommandType = commandType;
+                    if (parameters != null)
+                    {
+                        foreach (SqlParameter parameter in parameters)
+                        {
+                            command.Parameters.Add(parameter);
+                        }
+                    }
+                    connection.Open();
+                    num = command.ExecuteNonQuery();
+                }
+            }
+            return num;
+        }
+
+        public SqlDataReader ExecuteReader(string sql)
+        {
+            return this.ExecuteReader(sql, CommandType.Text, null);
+        }
+
+        public SqlDataReader ExecuteReader(string sql, CommandType commandType)
+        {
+            return this.ExecuteReader(sql, commandType, null);
+        }
+
+        public SqlDataReader ExecuteReader(string sql, CommandType commandType, SqlParameter[] parameters)
+        {
+            SqlConnection connection = new SqlConnection(this._connectionString);
+            SqlCommand command = new SqlCommand(sql, connection)
+            {
+                CommandType = commandType
+            };
+            if (parameters != null)
+            {
+                foreach (SqlParameter parameter in parameters)
+                {
+                    command.Parameters.Add(parameter);
+                }
+            }
+            connection.Open();
+            return command.ExecuteReader(CommandBehavior.CloseConnection);
+        }
+
+        public object ExecuteScalar(string sql)
+        {
+            return this.ExecuteScalar(sql, CommandType.Text, null);
+        }
+
+        public object ExecuteScalar(string sql, CommandType commandType)
+        {
+            return this.ExecuteScalar(sql, commandType, null);
+        }
+
+
+        public object ExecuteScalar(string sql, CommandType commandType, SqlParameter[] parameters)
+        {
+            object obj2;
+            using (SqlConnection connection = new SqlConnection(this._connectionString))
+            {
+                using (SqlCommand command = new SqlCommand(sql, connection))
+                {
+                    command.CommandType = commandType;
+                    if (parameters != null)
+                    {
+                        foreach (SqlParameter parameter in parameters)
+                        {
+                            command.Parameters.Add(parameter);
+                        }
+                    }
+                    connection.Open();
+                    obj2 = command.ExecuteScalar();
+                }
+            }
+            return obj2;
+        }
+
+        public DataTable GetDatabases()
+        {
+            using (SqlConnection connection = new SqlConnection(this._connectionString))
+            {
+                connection.Open();
+                return connection.GetSchema("Databases");
+            }
+        }
+
+        public static ArrayList GetServerList()
+        {
+            ArrayList list = new ArrayList();
+            foreach (DataRow row in SqlDataSourceEnumerator.Instance.GetDataSources().Rows)
+            {
+                list.Add(row[0].ToString());
+            }
+            return list;
+        }
+
+        public DataTable GetTables()
+        {
+            using (SqlConnection connection = new SqlConnection(this._connectionString))
+            {
+                connection.Open();
+                return connection.GetSchema("Tables");
+            }
+        }
+
+        public bool SaveDataToDB(DataSet dataSet)
+        {
+            try
+            {
+                using (SqlConnection connection = new SqlConnection(this._connectionString))
+                {
+                    foreach (DataTable table in dataSet.Tables)
+                    {
+                        using (SqlCommand command = new SqlCommand("SELECT * FROM " + table.TableName + " WHERE 1<1", connection))
+                        {
+                            SqlDataAdapter adapter = new SqlDataAdapter(command);
+                            SqlCommandBuilder builder = new SqlCommandBuilder(adapter);
+                            adapter.UpdateBatchSize = 100;
+                            DataTable tbchange = table.GetChanges();
+                            if (tbchange != null)
+                                adapter.Update(table.GetChanges());
+                        }
+                    }
+                }
+            }
+            catch (Exception)
+            {
+                return false;
+            }
+            return true;
+        }
+
+        public bool SaveDataToDB(DataTable dataTable)
+        {
+            try
+            {
+                using (SqlConnection connection = new SqlConnection(this._connectionString))
+                {
+                    using (SqlCommand command = new SqlCommand("select top 0 * from " + dataTable.TableName, connection))
+                    {
+                        SqlDataAdapter adapter = new SqlDataAdapter(command);
+
+                        SqlCommandBuilder builder = new SqlCommandBuilder(adapter);
+                        adapter.UpdateBatchSize = 100;
+                        DataTable tbchange = dataTable.GetChanges();
+                        if (tbchange != null)
+                            adapter.Update(dataTable);
+                    }
+                }
+            }
+            catch (Exception)
+            {
+                return false;
+            }
+            return true;
+        }
+
+
+        public bool SaveDataToDB(DataSet oldDataSet, DataSet newDataSet)
+        {
+            //bool flag;
+            oldDataSet.Merge(newDataSet, false);
+            using (SqlConnection connection = new SqlConnection(this._connectionString))
+            {
+                connection.Open();
+                SqlTransaction transaction = connection.BeginTransaction();
+                try
+                {
+                    foreach (DataTable table in oldDataSet.Tables)
+                    {
+                        using (SqlCommand command = new SqlCommand("SELECT * FROM " + table.TableName + " WHERE 1<1", connection, transaction))
+                        {
+                            SqlDataAdapter adapter = new SqlDataAdapter(command);
+                            SqlCommandBuilder builder = new SqlCommandBuilder(adapter);
+                            adapter.UpdateBatchSize = 500;
+                            adapter.Update(table);
+                        }
+                    }
+                    transaction.Commit();
+                    return true;
+                }
+                catch (Exception)
+                {
+                    transaction.Rollback();
+                    throw;
+                }
+                finally
+                {
+                    if (transaction != null)
+                    {
+                        transaction.Dispose();
+                    }
+                }
+            }
+            //return flag;
+        }
+
+        public bool SaveDataToDB(DataTable oldDataTable, DataTable newDataTable)
+        {
+            bool flag;
+            oldDataTable.Merge(newDataTable, false);
+            using (SqlConnection connection = new SqlConnection(this._connectionString))
+            {
+                using (SqlCommand command = new SqlCommand("SELECT * FROM " + oldDataTable.TableName + " WHERE 1<1", connection))
+                {
+                    SqlDataAdapter adapter = new SqlDataAdapter(command);
+                    SqlCommandBuilder builder = new SqlCommandBuilder(adapter);
+                    adapter.UpdateBatchSize = 100;
+                    adapter.Update(oldDataTable);
+                    flag = true;
+                }
+            }
+            return flag;
+        }
+
+        public bool TestConnection()
+        {
+            bool flag;
+            try
+            {
+                using (SqlConnection connection = new SqlConnection(this._connectionString))
+                {
+                    connection.Open();
+                    connection.Close();
+                    flag = true;
+                }
+            }
+            catch (Exception)
+            {
+                flag = false;
+            }
+            return flag;
+        }
+
+        #region IDisposable 鎴愬憳
+
+        public void Dispose()
+        {
+            _connection4Tran = null;
+            _transaction = null;
+        }
+
+        #endregion
+
+        private class SqlTask
+        {
+            public string Text { get; private set; }
+            public CommandType CommandType { get; private set; }
+            public SqlParameter[] Parameters { get; private set; }
+
+            public SqlTask(string text, CommandType commandType, SqlParameter[] paras)
+            {
+                Text = text;
+                CommandType = commandType;
+                Parameters = paras;
+            }
+        }
+
+        //public bool Save(DataTable Table, bool UpdateTableStatus, bool UseTransaction, bool ShowMsg)
+        //{
+        //    //濡傛灉涓嶉渶瑕佷繚瀛樺垯閫�鍑恒��
+        //    if (Table == null  )
+        //        return true;
+
+        //    SqlDataAdapter dataAdapter = new SqlDataAdapter();
+
+        //        dataAdapter.UpdateCommand = GetUpdateCmd(Table);
+        //        dataAdapter.InsertCommand = GetInsertCmd(Table);
+        //        dataAdapter.DeleteCommand = GetDeleteCmd(Table);
+
+
+        //    if (DBTransaction != null)
+        //    {
+        //        if (dataAdapter.SelectCommand != null) dataAdapter.SelectCommand.Transaction = DBTransaction;
+        //        if (dataAdapter.DeleteCommand != null) dataAdapter.DeleteCommand.Transaction = DBTransaction;
+        //        if (dataAdapter.InsertCommand != null) dataAdapter.InsertCommand.Transaction = DBTransaction;
+        //        if (dataAdapter.UpdateCommand != null) dataAdapter.UpdateCommand.Transaction = DBTransaction;
+        //    } 
+
+        //    //鏇存柊鏁版嵁
+        //    try
+        //    {
+        //        //鍚姩浜嬪姟
+        //        if (UseTransaction == true)
+        //            StartTransaction();
+
+        //        DataTable tb_changes = Table.GetChanges();
+        //        if (tb_changes != null)
+        //            dataAdapter.Update(tb_changes);
+        //        else if (HandCreateCmd == true)
+        //            dataAdapter.Update(Table);
+        //        //鎻愪氦浜嬪姟
+        //        if (UseTransaction == true)
+        //            CommitTransaction();
+
+        //        //淇敼琛ㄧ姸鎬� 濡傛灉鍓嶉潰鐨勫鐞嗗嚭閿�,閭d箞杩欓噷涔熶笉浼氭墽琛�,Datatable灏嗙户缁繚鐣欑姸鎬�.
+        //        if (UpdateTableStatus == true)
+        //            Table.AcceptChanges();
+
+        //        ExecuteExcetion = null;
+        //    }
+        //    catch (Exception e)
+        //    {
+        //        string errorMsg = "";
+        //        //2627琛ㄧず涓婚敭閲嶅锛屾墠闇�瑕侀噸鍙栧崟鍙枫��
+        //        if (e is SqlException)
+        //        {
+        //            SqlException sqlExcept = e as SqlException;
+        //            SaveKeyExist = (sqlExcept.Number == 2627);
+        //            if (sqlExcept.Number == 2627)
+        //                errorMsg = "褰撳墠鏁版嵁琛ㄥ凡鏈夋璁板綍锛岃纭鍚庡啀淇濆瓨!";
+        //            else
+        //                errorMsg = ((SqlException)e).Message;
+        //        }
+
+        //        if (e is DBConcurrencyException)
+        //        {
+        //            DBConcurrencyException dbexception = (e as DBConcurrencyException);
+        //            errorMsg = dbexception.Row.RowError;
+        //            if (errorMsg.Contains("褰卞搷") == true && dbexception.Row.RowState == DataRowState.Deleted)
+        //                errorMsg = "褰撳墠鏁版嵁琛屽凡鍒犻櫎,璇烽噸鏂版煡璇�!";
+        //            if (errorMsg.Contains("褰卞搷") == true && dbexception.Row.RowState == DataRowState.Modified)
+        //                errorMsg = "褰撳墠鏁版嵁琛屽凡淇敼,璇烽噸鏂版煡璇�!";
+        //        }
+
+        //        //
+        //        ShowMsg = ShowMsg || ShowMsgWhenSaveChildTableOnError;
+        //        ExecuteExcetion = e;
+
+        //        //淇濆瓨澶辫触鍥炴粴浜嬪姟
+        //        if (UseTransaction == true)
+        //            RollbackTransaction();
+
+        //        errorMsg = (errorMsg == "") ? GetErrorMsg(e) : errorMsg;
+        //        WriteLog(Format("淇濆瓨{0}澶辫触,閿欒淇℃伅濡備笅:{1}", Table.TableName, errorMsg), ShowMsg);
+        //        return false;
+        //    }
+        //    finally
+        //    {
+        //        Table.State = OptionState.Browse;
+        //    }
+
+        //    if (ShowMsg == true || MustSaveLog == true)
+        //    {
+        //        /* 鍏充簬ShowMsg鍙傛暟鐨勪娇鐢ㄨ鏄庯細
+        //         * A鏂规硶锛歋ave(bool UseTransaction, bool ShowMsg)锛�
+        //         * B鏂规硶锛歋ave(DataTableExt Table,bool UpdateTableStatus, bool UseTransaction, bool ShowMsg)锛�
+        //         * 
+        //         * A鏂规硶璋冪敤B鏂规硶鏃�,鏄笉闇�瑕佹彁绀�"淇濆瓨鎴愬姛"鐨勪俊鎭紝鎵�浠鏂规硶浼犵殑ShowMsg=false锛屼絾A甯屾湜鍦ㄨ皟鐢˙鏂规硶鍑洪敊鏃讹紝
+        //         * 鎻愮ず閿欒淇℃伅"淇濆瓨**澶辫触.."锛屾墍浠ュ師鏉鏂规硶Catch涓‖缂栫爜 ShowMsg=true锛涘湪鎵ц鏀规柟娉曟椂,涓嶇鏄惁闇�瑕佹彁绀�,绯荤粺閮戒細鎻愮ず淇℃伅(杩欐湁杩濊儗鏂规硶鏈剰)銆�
+        //         * 
+        //         * 鐜板湪甯屾湜鑳藉埄姝g‘浣跨敤ShowMsg鍙傛暟锛屾墍浠ュ紩鍏ヤ簡ShowMsgWhenSaveChildTableOnError灞炴��(榛樿True)銆�
+        //         * 褰揝howMsgWhenSaveChildTableOnError绛変簬True鎴朣howMsg绛変簬True鏃�,Catch涓氨浼氭彁绀洪敊璇俊鎭��
+        //         *
+        //         * 鍗曟嵁绫籅illClass淇濆瓨鏃讹紝鐢变簬鐗规畩澶勭悊锛屽笇鏈涜繃绋嬩腑涓嶆彁绀洪敊璇俊鎭紝鎵�浠ュ湪淇濆瓨鏃禨ave(UseTransaction, ShowMsg==false)鍜岃缃甋howMsgWhenSaveChildTableOnError=false銆�                 
+        //         */
+        //        WriteLog(string.Format("淇濆瓨{0}鎴愬姛!", Table.TableName), ShowMsg);
+        //    }
+        //    return true;
+        //}
+
+        // <summary>
+        // 寰楀埌鏇存柊鍛戒护
+        // </summary>
+        // <returns></returns>
+        //public SqlCommand GetUpdateCmd(DataTable MyTable, SqlConnection DBConn)
+        //{ 
+        //    鐢熸垚鏇存柊璇彞
+        //    string strSQL = string.Format("Update {0} Set ", MyTable.TableName);
+        //    foreach (DataColumn col in MyTable.Columns)
+        //    { 
+        //        strSQL = string.Format("{0} {1}=@{1},", strSQL, col.ColumnName);
+        //    }
+        //    strSQL = strSQL.Substring(0, strSQL.Length - 1);
+
+        //    StringCollection KeyList = new StringCollection();
+        //    KeyList.Add("taskid");
+        //    鏍规嵁涓婚敭璁剧疆Where鏉′欢
+        //    string strWhere = "";
+        //    foreach (string Key in KeyList)
+        //    {
+        //        strWhere = strWhere == "" ? string.Format("{0}=@{0}", Key) : string.Format("{0} and {1}=@{1}", strWhere, Key);
+        //    }
+
+        //    strSQL = string.Format("{0} where {1}", strSQL, strWhere);
+        //    SqlCommand updateCmd = new SqlCommand(strSQL, DBConn);
+
+        //    娣诲姞鍙傛暟
+        //    foreach (DataColumn col in MyTable.Columns)
+        //    {
+        //        鎺掗櫎涓嶇敤淇濆瓨瀛楁銆�
+        //        SqlDbType SQLType = DataTypeMap.CSTypeToSqlType(col.DataType.Name);
+        //        int Size = (col.MaxLength > 0) ? col.MaxLength : 100;
+        //        updateCmd.Parameters.Add("@" + col.ColumnName, SQLType, Size, col.ColumnName);
+        //    }
+
+        //    return updateCmd;
+        //}
+
+
+        ///// <summary>
+        ///// 寰楀埌鎻掑叆鍛戒护
+        ///// </summary>
+        ///// <returns></returns>
+        //public SqlCommand GetInsertCmd(DataTable MyTable)
+        //{
+        //    //鍙栧緱涓婚敭
+        //    List<string> KeyList = new List<string>();
+        //    KeyList.AddRange(MyTable.KeyField.Split(';'));
+        //    if (KeyList.Count <= 0)
+        //        return null;
+
+        //    //鍙栧緱涓嶉渶瑕佹洿鏂扮殑瀛楁鍒楄〃
+        //    StringCollection NotSaveFields = new StringCollection();
+        //    NotSaveFields.AddRange(MyTable.NotSaveFields.Split(';'));
+
+        //    //鐢熸垚瀛楁鍒楄〃鍜屽�煎垪琛�
+        //    string strFieldList = "";
+        //    string strValueList = "";
+        //    foreach (DataColumn col in MyTable.Columns)
+        //    {
+        //        //鎺掗櫎涓婚敭鍜屼笉鐢ㄤ繚瀛樺瓧娈点��
+        //        if (NotSaveFields.Contains(col.ColumnName) == true)
+        //            continue;
+        //        strFieldList = strFieldList == "" ? col.ColumnName : string.Format("{0},{1}", strFieldList, col.ColumnName);
+        //        strValueList = strValueList == "" ? "@" + col.ColumnName : string.Format("{0},@{1}", strValueList, col.ColumnName);
+        //    }
+        //    string strSQL = string.Format("Insert Into {0} ({1}) Values({2})", MyTable.UpdateTable, strFieldList, strValueList);
+
+        //    //鍒涘缓鍛戒护
+        //    SqlCommand InsertCmd = new SqlCommand(strSQL, DBConn);
+
+        //    //娣诲姞鍙傛暟
+        //    foreach (DataColumn col in MyTable.Columns)
+        //    {
+        //        //鎺掗櫎涓婚敭鍜屼笉鐢ㄤ繚瀛樺瓧娈点��
+        //        if (NotSaveFields.Contains(col.ColumnName) == true)
+        //            continue;
+        //        SqlDbType SQLType = DataTypeMap.CSTypeToSqlType(col.DataType.Name);
+        //        int Size = (col.MaxLength > 0) ? col.MaxLength : 100;
+
+        //        InsertCmd.Parameters.Add("@" + col.ColumnName, SQLType, Size, col.ColumnName);
+        //    }
+        //    return InsertCmd;
+        //}
+
+        ///// <summary>
+        ///// 寰楀埌鍒犻櫎鍛戒护
+        ///// </summary>
+        ///// <returns></returns>
+        //public SqlCommand GetDeleteCmd(DataTable MyTable)
+        //{
+        //    //鍙栧緱涓婚敭
+        //    List<string> KeyList = new List<string>();
+        //    KeyList.AddRange(MyTable.KeyField.Split(';'));
+        //    if (KeyList.Count <= 0)
+        //        return null;
+
+        //    //鐢熸垚鏇存柊璇彞
+        //    string strSQL = string.Format("Delete {0} ", MyTable.UpdateTable);
+
+        //    //鏍规嵁涓婚敭璁剧疆Where鏉′欢
+        //    string strWhere = "";
+        //    foreach (string Key in KeyList)
+        //    {
+        //        strWhere = strWhere == "" ? string.Format("{0}=@{0}", Key) : string.Format("{0} and {1}=@{1}", strWhere, Key);
+        //    }
+        //    strSQL = string.Format("{0} where {1}", strSQL, strWhere);
+        //    SqlCommand DeleteCmd = new SqlCommand(strSQL, DBConn);
+
+        //    //娣诲姞鍙傛暟
+        //    foreach (string Key in KeyList)
+        //    {
+        //        DataColumn col = MyTable.Columns[Key];
+        //        SqlDbType SQLType = DataTypeMap.CSTypeToSqlType(col.DataType.Name);
+        //        int Size = (col.MaxLength > 0) ? col.MaxLength : 100;
+        //        DeleteCmd.Parameters.Add("@" + col.ColumnName, SQLType, Size, col.ColumnName);
+        //    }
+
+        //    return DeleteCmd;
+        //} 
+    }
+}
+
diff --git a/Program.cs b/Program.cs
new file mode 100644
index 0000000..91a2ad9
--- /dev/null
+++ b/Program.cs
@@ -0,0 +1,23 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace DataexchangeServer
+{
+    static class Program
+    {
+        /// <summary>
+        /// 搴旂敤绋嬪簭鐨勪富鍏ュ彛鐐广��
+        /// </summary>
+        [STAThread]
+        static void Main()
+        {
+           
+            Application.EnableVisualStyles();
+            Application.SetCompatibleTextRenderingDefault(false);
+            Application.Run(new frmMain());
+        }
+    }
+}
diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..65b28d8
--- /dev/null
+++ b/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+锘縰sing System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 鏈夊叧绋嬪簭闆嗙殑甯歌淇℃伅閫氳繃浠ヤ笅
+// 鐗规�ч泦鎺у埗銆傛洿鏀硅繖浜涚壒鎬у�煎彲淇敼
+// 涓庣▼搴忛泦鍏宠仈鐨勪俊鎭��
+[assembly: AssemblyTitle("DataexchangeServer")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("DataexchangeServer")]
+[assembly: AssemblyCopyright("Copyright 漏 Microsoft 2017")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 灏� ComVisible 璁剧疆涓� false 浣挎绋嬪簭闆嗕腑鐨勭被鍨�
+// 瀵� COM 缁勪欢涓嶅彲瑙併��  濡傛灉闇�瑕佷粠 COM 璁块棶姝ょ▼搴忛泦涓殑绫诲瀷锛�
+// 鍒欏皢璇ョ被鍨嬩笂鐨� ComVisible 鐗规�ц缃负 true銆�
+[assembly: ComVisible(false)]
+
+// 濡傛灉姝ら」鐩悜 COM 鍏紑锛屽垯涓嬪垪 GUID 鐢ㄤ簬绫诲瀷搴撶殑 ID
+[assembly: Guid("32078dd5-fe6e-467b-8868-2533df57928b")]
+
+// 绋嬪簭闆嗙殑鐗堟湰淇℃伅鐢变笅闈㈠洓涓�肩粍鎴�: 
+//
+//      涓荤増鏈�
+//      娆$増鏈� 
+//      鐢熸垚鍙�
+//      淇鍙�
+//
+// 鍙互鎸囧畾鎵�鏈夎繖浜涘�硷紝涔熷彲浠ヤ娇鐢ㄢ�滅敓鎴愬彿鈥濆拰鈥滀慨璁㈠彿鈥濈殑榛樿鍊硷紝
+// 鏂规硶鏄寜濡備笅鎵�绀轰娇鐢ㄢ��*鈥�: 
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..dc7d6e7
--- /dev/null
+++ b/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+锘�//------------------------------------------------------------------------------
+// <auto-generated>
+//     姝や唬鐮佺敱宸ュ叿鐢熸垚銆�
+//     杩愯鏃剁増鏈�:4.0.30319.42000
+//
+//     瀵规鏂囦欢鐨勬洿鏀瑰彲鑳戒細瀵艰嚧涓嶆纭殑琛屼负锛屽苟涓斿鏋�
+//     閲嶆柊鐢熸垚浠g爜锛岃繖浜涙洿鏀瑰皢浼氫涪澶便��
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace DataexchangeServer.Properties {
+    using System;
+    
+    
+    /// <summary>
+    ///   涓�涓己绫诲瀷鐨勮祫婧愮被锛岀敤浜庢煡鎵炬湰鍦板寲鐨勫瓧绗︿覆绛夈��
+    /// </summary>
+    // 姝ょ被鏄敱 StronglyTypedResourceBuilder
+    // 绫婚�氳繃绫讳技浜� ResGen 鎴� Visual Studio 鐨勫伐鍏疯嚜鍔ㄧ敓鎴愮殑銆�
+    // 鑻ヨ娣诲姞鎴栫Щ闄ゆ垚鍛橈紝璇风紪杈� .ResX 鏂囦欢锛岀劧鍚庨噸鏂拌繍琛� ResGen
+    // (浠� /str 浣滀负鍛戒护閫夐」)锛屾垨閲嶆柊鐢熸垚 VS 椤圭洰銆�
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.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 (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DataexchangeServer.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;
+            }
+        }
+    }
+}
diff --git a/Properties/Resources.resx b/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/Properties/Resources.resx
@@ -0,0 +1,117 @@
+锘�<?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>
\ No newline at end of file
diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..9bee585
--- /dev/null
+++ b/Properties/Settings.Designer.cs
@@ -0,0 +1,56 @@
+锘�//------------------------------------------------------------------------------
+// <auto-generated>
+//     姝や唬鐮佺敱宸ュ叿鐢熸垚銆�
+//     杩愯鏃剁増鏈�:4.0.30319.42000
+//
+//     瀵规鏂囦欢鐨勬洿鏀瑰彲鑳戒細瀵艰嚧涓嶆纭殑琛屼负锛屽苟涓斿鏋�
+//     閲嶆柊鐢熸垚浠g爜锛岃繖浜涙洿鏀瑰皢浼氫涪澶便��
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace DataexchangeServer.Properties {
+    
+    
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.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;
+            }
+        }
+        
+        [global::System.Configuration.ApplicationScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
+        [global::System.Configuration.DefaultSettingValueAttribute("http://36.134.102.119:8888/ykd/api")]
+        public string DataexchangeServer_WebReference_UserServiceImplService {
+            get {
+                return ((string)(this["DataexchangeServer_WebReference_UserServiceImplService"]));
+            }
+        }
+        
+        [global::System.Configuration.ApplicationScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
+        [global::System.Configuration.DefaultSettingValueAttribute("http://36.134.102.119:9998/ykd/api")]
+        public string DataexchangeServer_WebReferenceLD_UserServiceImplService {
+            get {
+                return ((string)(this["DataexchangeServer_WebReferenceLD_UserServiceImplService"]));
+            }
+        }
+        
+        [global::System.Configuration.ApplicationScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.SpecialSettingAttribute(global::System.Configuration.SpecialSetting.WebServiceUrl)]
+        [global::System.Configuration.DefaultSettingValueAttribute("http://36.134.102.119:9998/ykd/api")]
+        public string DataexchangeServer_WebReferenceLD1_UserServiceImplService {
+            get {
+                return ((string)(this["DataexchangeServer_WebReferenceLD1_UserServiceImplService"]));
+            }
+        }
+    }
+}
diff --git a/Properties/Settings.settings b/Properties/Settings.settings
new file mode 100644
index 0000000..6fee5b6
--- /dev/null
+++ b/Properties/Settings.settings
@@ -0,0 +1,15 @@
+锘�<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="DataexchangeServer.Properties" GeneratedClassName="Settings">
+  <Profiles />
+  <Settings>
+    <Setting Name="DataexchangeServer_WebReference_UserServiceImplService" Type="(Web Service URL)" Scope="Application">
+      <Value Profile="(Default)">http://36.134.102.119:8888/ykd/api</Value>
+    </Setting>
+    <Setting Name="DataexchangeServer_WebReferenceLD_UserServiceImplService" Type="(Web Service URL)" Scope="Application">
+      <Value Profile="(Default)">http://36.134.102.119:9998/ykd/api</Value>
+    </Setting>
+    <Setting Name="DataexchangeServer_WebReferenceLD1_UserServiceImplService" Type="(Web Service URL)" Scope="Application">
+      <Value Profile="(Default)">http://36.134.102.119:9998/ykd/api</Value>
+    </Setting>
+  </Settings>
+</SettingsFile>
\ No newline at end of file
diff --git a/StringHelper.cs b/StringHelper.cs
new file mode 100644
index 0000000..7b77c08
--- /dev/null
+++ b/StringHelper.cs
@@ -0,0 +1,1263 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Text.RegularExpressions;
+
+
+namespace DataexchangeServer
+{
+    /// <summary>
+    /// 字符串函数辅助类。
+    /// </summary>
+    public class StringHelper
+    {
+        /// <summary>
+        /// SQL表达式分解表达式中的特殊参数,包括参数、父记录、记录、全局变量等。
+        /// 例:将表达式
+        ///     生产数>90 AND 工号=para:P0123 OR DMA002=parent:DMA001 OR 名称=field:D01 OR AA=@@01 
+        ///     中的特殊参数查找出来:para:P0123,parent:DMA001,field:D01,@@01
+        /// </summary>
+        public const string Rggex_SqlExpression = @"\w+[><=]\w*((para|parent|field|@@)([:]*)+\w*)";
+
+        private static Regex RegexBr = new Regex(@"(\r\n)", RegexOptions.IgnoreCase);
+
+        /// <summary>
+        /// 得到正则编译参数设置
+        /// </summary>
+        /// <returns></returns>
+        public static RegexOptions GetRegexCompiledOptions()
+        {
+            #if NET1
+               return RegexOptions.Compiled;
+            #else
+               return RegexOptions.None;
+            #endif
+        }
+
+        /// <summary>
+        /// 返回字符串真实长度, 1个汉字长度为2。
+        /// </summary>
+        /// <returns></returns>
+        public static int GetStringLength(string str)
+        {
+            return Encoding.Default.GetBytes(str).Length;
+        }
+
+        /// <summary>
+        /// 判断字符串的包含关系。
+        /// </summary>
+        /// <param name="str">被包含的字符串。</param>
+        /// <param name="stringArray">以指定分隔符描述的字符串数组。</param>
+        /// <param name="stringSplit">字符串数组的分隔符。</param>
+        /// <returns>如果被包含的字符串在指定字符串数组中,则返回true,否则返回false。</returns>
+        public static bool IsCompriseString(string str, string stringArray, string stringSplit)
+        {
+            if (stringArray == "" || stringArray == null)
+            {
+                return false;
+            }
+
+            str = str.ToLower();
+            string[] array = SafeSplitString(stringArray.ToLower(), stringSplit);
+            for (int i = 0; i < stringArray.Length; i++)
+            {
+                //string t1 = str;
+                //string t2 = stringArray[i];
+                if (str.IndexOf(array[i]) > -1)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 判断指定字符串在指定字符串数组中的位置。
+        /// </summary>
+        /// <param name="strSearch">待搜索的字符串。</param>
+        /// <param name="stringArray">字符串数组。</param>
+        /// <param name="caseInsensetive">是否不区分大小写, true为不区分, false为区分。</param>
+        /// <returns>字符串在指定字符串数组中的位置, 如不存在则返回-1。</returns>
+        public static int GetIndexInArray(string strSearch, string[] stringArray, bool caseInsensetive)
+        {
+            for (int i = 0; i < stringArray.Length; i++)
+            {
+                if (caseInsensetive)
+                {
+                    if (strSearch.ToLower() == stringArray[i].ToLower())
+                    {
+                        return i;
+                    }
+                }
+                else
+                {
+                    if (strSearch == stringArray[i])
+                    {
+                        return i;
+                    }
+                }
+
+            }
+            return -1;
+        }
+
+
+        /// <summary>
+        /// 判断指定字符串在指定字符串数组中的位置。
+        /// </summary>
+        /// <param name="strSearch">字符串。</param>
+        /// <param name="stringArray">字符串数组。</param>
+        /// <returns>字符串在指定字符串数组中的位置, 如不存在则返回-1。</returns>		
+        public static int GetIndexInArray(string strSearch, string[] stringArray)
+        {
+            return GetIndexInArray(strSearch, stringArray, true);
+        }
+
+        /// <summary>
+        /// 判断指定字符串是否属于指定字符串数组中的一个元素。
+        /// </summary>
+        /// <param name="strSearch">待搜索的字符串。</param>
+        /// <param name="stringArray">字符串数组。</param>
+        /// <param name="caseInsensetive">是否不区分大小写, true为不区分, false为区分。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsInArray(string strSearch, string[] stringArray, bool caseInsensetive)
+        {
+            return GetIndexInArray(strSearch, stringArray, caseInsensetive) >= 0;
+        }
+
+        /// <summary>
+        /// 判断指定字符串是否属于指定字符串数组中的一个元素。
+        /// </summary>
+        /// <param name="str">待搜索的字符串。</param>
+        /// <param name="stringArray">字符串数组。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsInArray(string str, string[] stringArray)
+        {
+            return IsInArray(str, stringArray, false);
+        }
+
+        /// <summary>
+        /// 判断指定字符串是否属于指定字符串数组中的一个元素。
+        /// </summary>
+        /// <param name="str">待搜索的字符串。</param>
+        /// <param name="stringArray">内部以分号分割单词的字符串。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsInArray(string str, string stringArray)
+        {
+            return IsInArray(str, SafeSplitString(stringArray, ";"), false);
+        }
+
+        /// <summary>
+        /// 判断指定字符串是否属于指定字符串数组中的一个元素。
+        /// </summary>
+        /// <param name="str">待搜索的字符串</param>
+        /// <param name="stringArray">内部以指定分割符分割单词的字符串。</param>
+        /// <param name="stringSplit">分割字符串。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsInArray(string str, string stringArray, string stringSplit)
+        {
+            return IsInArray(str, SafeSplitString(stringArray, stringSplit), false);
+        }
+
+        /// <summary>
+        /// 判断指定字符串是否属于指定字符串数组中的一个元素。
+        /// </summary>
+        /// <param name="str">待搜索的字符串</param>
+        /// <param name="stringArray">内部以指定分割符分割单词的字符串。</param>
+        /// <param name="stringSplit">分割字符串。</param>
+        /// <param name="caseInsensetive">是否不区分大小写, true为不区分, false为区分。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsInArray(string str, string stringArray, string stringSplit, bool caseInsensetive)
+        {
+            return IsInArray(str, SafeSplitString(stringArray, stringSplit), caseInsensetive);
+        }
+
+
+        /// <summary>
+        /// 删除字符串尾部的回车/换行/空格符号。
+        /// </summary>
+        /// <param name="str">待处理的字符串。</param>
+        /// <returns>处理后的字符串。</returns>
+        public static string RTrim(string str)
+        {
+            for (int i = str.Length; i >= 0; i--)
+            {
+                if (str[i].Equals(" ") || str[i].Equals("\r") || str[i].Equals("\n"))
+                {
+                    str.Remove(i, 1);
+                }
+            }
+            return str;
+        }
+
+
+        /// <summary>
+        /// 清除给定字符串中的回车及换行符。
+        /// </summary>
+        /// <param name="str">要清除的字符串。</param>
+        /// <returns>处理后的字符串。</returns>
+        public static string SafeClearBR(string str)
+        {
+            Match m = null;
+
+            for (m = RegexBr.Match(str); m.Success; m = m.NextMatch())
+            {
+                str = str.Replace(m.Groups[0].ToString(), "");
+            }
+
+            return str;
+        }
+
+        /// <summary>
+        /// 从字符串的指定位置截取指定长度的子字符串。
+        /// </summary>
+        /// <param name="str">原字符串。</param>
+        /// <param name="startIndex">子字符串的起始位置。</param>
+        /// <param name="length">子字符串的长度。</param>
+        /// <returns>子字符串。</returns>
+        public static string SafeCutString(string str, int startIndex, int length)
+        {
+            if (startIndex >= 0)
+            {
+                if (length < 0)
+                {
+                    length = length * -1;
+                    if (startIndex - length < 0)
+                    {
+                        length = startIndex;
+                        startIndex = 0;
+                    }
+                    else
+                    {
+                        startIndex = startIndex - length;
+                    }
+                }
+
+
+                if (startIndex > str.Length)
+                {
+                    return "";
+                }
+
+
+            }
+            else
+            {
+                if (length < 0)
+                {
+                    return "";
+                }
+                else
+                {
+                    if (length + startIndex > 0)
+                    {
+                        length = length + startIndex;
+                        startIndex = 0;
+                    }
+                    else
+                    {
+                        return "";
+                    }
+                }
+            }
+
+            if (str.Length - startIndex < length)
+            {
+                length = str.Length - startIndex;
+            }
+
+            return str.Substring(startIndex, length);
+        }
+
+        /// <summary>
+        /// 从字符串的指定位置开始截取到字符串结尾的了符串。
+        /// </summary>
+        /// <param name="str">原字符串。</param>
+        /// <param name="startIndex">子字符串的起始位置。</param>
+        /// <returns>子字符串。</returns>
+        public static string SafeCutString(string str, int startIndex)
+        {
+            return SafeCutString(str, startIndex, str.Length);
+        }
+
+
+        /// <summary>
+        /// int型转换为string型。
+        /// </summary>
+        /// <returns>转换后的string类型结果。</returns>
+        public static string FromInt(int intValue)
+        {
+            //
+            return Convert.ToString(intValue);
+        }
+
+
+        /// <summary>
+        /// 取指定长度的字符串,并在截取时考虑双语字符,当字符串如果操过指定长度则将超出的部分用指定字符串代替。
+        /// </summary>
+        /// <param name="srcString">要检查的字符串。</param>
+        /// <param name="length">指定长度。</param>
+        /// <param name="tailString">用于替换的字符串。</param>
+        /// <returns>截取后的字符串。</returns>
+        public static string GetSubString(string srcString, int length, string tailString)
+        {
+            return GetSubString(srcString, 0, length, tailString);
+        }
+
+
+        /// <summary>
+        /// 取指定长度的字符串,并在截取时考虑双语字符,当字符串如果操过指定长度则将超出的部分用指定字符串代替。
+        /// </summary>
+        /// <param name="srcString">要检查的字符串。</param>
+        /// <param name="startIndex">起始位置。</param>
+        /// <param name="length">指定长度。</param>
+        /// <param name="tailString">用于替换的字符串。</param>
+        /// <returns>截取后的字符串。</returns>
+        public static string GetSubString(string srcString, int startIndex, int length, string tailString)
+        {
+
+
+            string myResult = srcString;
+
+            //当是日文或韩文时(注:中文的范围:\u4e00 - \u9fa5, 日文在\u0800 - \u4e00, 韩文为\xAC00-\xD7A3)
+            if (System.Text.RegularExpressions.Regex.IsMatch(srcString, "[\u0800-\u4e00]+") ||
+                System.Text.RegularExpressions.Regex.IsMatch(srcString, "[\xAC00-\xD7A3]+"))
+            {
+                //当截取的起始位置超出字段串长度时
+                if (startIndex >= srcString.Length)
+                {
+                    return "";
+                }
+                else
+                {
+                    return srcString.Substring(startIndex,
+                                                   ((length + startIndex) > srcString.Length) ? (srcString.Length - startIndex) : length);
+                }
+            }
+
+
+            if (length >= 0)
+            {
+                byte[] bsSrcString = Encoding.Default.GetBytes(srcString);
+
+                //当字符串长度大于起始位置
+                if (bsSrcString.Length > startIndex)
+                {
+                    int endIndex = bsSrcString.Length;
+
+                    //当要截取的长度在字符串的有效长度范围内
+                    if (bsSrcString.Length > (startIndex + length))
+                    {
+                        endIndex = length + startIndex;
+                    }
+                    else
+                    {   //当不在有效范围内时,只取到字符串的结尾
+
+                        length = bsSrcString.Length - startIndex;
+                        tailString = "";
+                    }
+
+
+
+                    int nRealLength = length;
+                    int[] anResultFlag = new int[length];
+                    byte[] bsResult = null;
+
+                    int nFlag = 0;
+                    for (int i = startIndex; i < endIndex; i++)
+                    {
+
+                        if (bsSrcString[i] > 127)
+                        {
+                            nFlag++;
+                            if (nFlag == 3)
+                            {
+                                nFlag = 1;
+                            }
+                        }
+                        else
+                        {
+                            nFlag = 0;
+                        }
+
+                        anResultFlag[i] = nFlag;
+                    }
+
+                    if ((bsSrcString[endIndex - 1] > 127) && (anResultFlag[length - 1] == 1))
+                    {
+                        nRealLength = length + 1;
+                    }
+
+                    bsResult = new byte[nRealLength];
+
+                    Array.Copy(bsSrcString, startIndex, bsResult, 0, nRealLength);
+
+                    myResult = Encoding.Default.GetString(bsResult);
+
+                    myResult = myResult + tailString;
+                }
+            }
+
+            return myResult;
+        }
+
+        /// <summary>
+        /// 自定义的替换字符串函数。
+        /// </summary>
+        /// <param name="sourceString">源字符串。</param>
+        /// <param name="searchString">待替换的字符串</param>
+        /// <param name="replaceString">替换后的字符串</param>
+        /// <param name="caseInsensetive">是否不区分大小写, true为不区分, false为区分。</param>
+        /// <returns>处理后的字符串。</returns>
+        public static string SafeReplaceString(string sourceString, string searchString, string replaceString, bool caseInsensetive)
+        {
+            return Regex.Replace(sourceString, Regex.Escape(searchString), replaceString, caseInsensetive ? RegexOptions.IgnoreCase : RegexOptions.None);
+        }
+
+        /// <summary>
+        /// 检测是否符合email地址格式。
+        /// </summary>
+        /// <param name="strEmail">要判断的email字符串。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsValidEmail(string strEmail)
+        {
+            return Regex.IsMatch(strEmail, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
+        }
+
+        /// <summary>
+        /// 检测是否符合email址中域名格式。
+        /// </summary>
+        /// <param name="strEmail">要判断的email字符串。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsValidEmailDomain(string strEmail)
+        {
+            return Regex.IsMatch(strEmail, @"^@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
+        }
+
+        /// <summary>
+        /// 检测是否符合Url格式。
+        /// </summary>
+        /// <param name="strUrl">要判断的Url。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsUrl(string strUrl)
+        {
+            return Regex.IsMatch(strUrl, @"^(http|https)\://([a-zA-Z0-9\.\-]+(\:[a-zA-Z0-9\.&%\$\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|localhost|([a-zA-Z0-9\-]+\.)*[a-zA-Z0-9\-]+\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{1,10}))(\:[0-9]+)*(/($|[a-zA-Z0-9\.\,\?\'\\\+&%\$#\=~_\-]+))*$");
+        }
+
+
+        /// <summary>
+        /// 检测是否为base64字符串。
+        /// </summary>
+        /// <param name="str">要判断的字符串。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsBase64String(string str)
+        {
+            //A-Z, a-z, 0-9, +, /, =
+            return Regex.IsMatch(str, @"[A-Za-z0-9\+\/\=]");
+        }
+
+        /// <summary>
+        /// 检测是否有Sql危险字符。
+        /// </summary>
+        /// <param name="str">要判断字符串。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsSafeSqlString(string str)
+        {
+
+            return !Regex.IsMatch(str, @"[-|;|,|\/|\(|\)|\[|\]|\}|\{|%|@|\*|!|\']");
+        }
+
+        /// <summary>
+        /// 检测是否有危险的可能用于链接的字符串。
+        /// </summary>
+        /// <param name="str">要判断字符串。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsSafeUserInfoString(string str)
+        {
+            return !Regex.IsMatch(str, @"^\s*$|^c:\\con\\con$|[%,\*" + "\"" + @"\s\t\<\>\&]|游客|^Guest");
+        }
+
+        /// <summary>
+        /// 清理字符串。
+        /// </summary>
+        /// <param name="input">输入的字符串。</param>
+        /// <returns>处理结果</returns>
+        public static string SafeCleanInput(string input)
+        {
+            return Regex.Replace(input.Trim(), @"[^\w\.@-]", "");
+        }
+
+        /// <summary>
+        /// 检测是否为时间字符串。
+        /// </summary>
+        /// <param name="str">待判断的时间字符串。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsTime(string str)
+        {
+            return Regex.IsMatch(str, @"^((([0-1]?[0-9])|(2[0-3])):([0-5]?[0-9])(:[0-5]?[0-9])?)$");
+        }
+
+
+        /*
+        /// <summary>
+        /// 将字符串转换为简体中文。
+        /// (([^"']|^)\[xui:+\w+\.+\w+\.+\w+\])+(\.+\w*)+(\[\d\])?
+        /// [xui:form1.bysv.ss].value[102]=="[xui:form1.bysv.ss]" and [xui:form2.bysv.ss].value==c or [ps:0.1]==d
+        /// </summary>
+        /// <param name="str">待转换的字符串。</param>
+        /// <returns>转换结果。</returns>
+        public static string ToSimplifiedChinese(string str)
+        {
+            return Strings.StrConv(str, VbStrConv.SimplifiedChinese, 0);
+        }
+
+        /// <summary>
+        /// 将字符串转换为繁体中文。
+        /// </summary>
+        /// <param name="str">待转换的字符串。</param>
+        /// <returns>转换结果。</returns>
+        public static string ToTChinese(string str)
+        {
+            return Strings.StrConv(str, VbStrConv.TraditionalChinese, 0);
+        }
+         * */
+
+        /// <summary>
+        /// 分割字符串。
+        /// </summary>
+        /// <param name="srcString">待分割的源字符串。</param>
+        /// <param name="stringSplit">分割符。</param>
+        /// <returns>分割后的字符串数组。</returns>
+        public static string[] SafeSplitString(string srcString, string stringSplit)
+        {
+            if (srcString.IndexOf(stringSplit) < 0)
+            {
+                string[] tmp = { srcString };
+                return tmp;
+            }
+            return Regex.Split(srcString, Regex.Escape(stringSplit), RegexOptions.IgnoreCase);
+        }
+
+        /// <summary>
+        /// 分割字符串。
+        /// </summary>
+        /// <param name="srcString">待分割的源字符串。</param>
+        /// <param name="stringSplit">分割符。</param>
+        /// <param name="length">返回字符串数据的长度,如果不足则以空字符串填充。</param>
+        /// <returns>分割后的字符串数组。</returns>
+        public static string[] SafeSplitString(string srcString, string stringSplit, int length)
+        {
+            string[] result = new string[length];
+
+            string[] splited = SafeSplitString(srcString, stringSplit);
+
+            for (int i = 0; i < length; i++)
+            {
+                if (i < splited.Length)
+                    result[i] = splited[i];
+                else
+                    result[i] = string.Empty;
+            }
+
+            return result;
+        }
+
+        /// <summary>
+        /// 使用正则表达式匹配字符串,找出每个符合条件的第一组数据。
+        /// </summary>
+        /// <param name="regx"></param>
+        /// <param name="source"></param>
+        /// <returns></returns>
+        /// <remarks>通常用于替换表达式中的特殊标记。</remarks>
+        public static string[] SafeMatchString(string regx, string source)
+        {
+            Regex r = new Regex(regx, RegexOptions.IgnoreCase);
+            Match m = r.Match(source);
+            List<string> s = new List<string>();
+            while (m.Success)
+            {
+                s.Add(m.Groups[1].Value);
+                m = m.NextMatch();
+            }
+
+           
+            return s.ToArray();
+        }
+
+        /// <summary>
+        /// 进行指定的替换(脏字过滤)。
+        /// </summary>
+        /// <param name="str">待处理的字符串。</param>
+        /// <param name="bantext">待过滤的字符串(脏字)。</param>
+        /// <returns>处理结果。</returns>
+        public static string Filter(string str, string bantext)
+        {
+            string text1 = "";
+            string text2 = "";
+            string[] textArray1 = SafeSplitString(bantext, "\r\n");
+            for (int num1 = 0; num1 < textArray1.Length; num1++)
+            {
+                text1 = textArray1[num1].Substring(0, textArray1[num1].IndexOf("="));
+                text2 = textArray1[num1].Substring(textArray1[num1].IndexOf("=") + 1);
+                str = str.Replace(text1, text2);
+            }
+            return str;
+        }
+
+
+        /// <summary>
+        /// 计算字节数大小并返回最匹配单位的相应的字符串。
+        /// </summary>
+        /// <param name="size">字节大小。</param>
+        /// <returns>最匹配单位的相应的字符串。</returns>
+        public static string FormatBytesString(int size)
+        {
+            if (size > 1073741824)
+            {
+                return ((double)(size / 1073741824)).ToString("0") + "G";
+            }
+            if (size > 1048576)
+            {
+                return ((double)(size / 1048576)).ToString("0") + "M";
+            }
+            if (size > 1024)
+            {
+                return ((double)(size / 1024)).ToString("0") + "K";
+            }
+            return size.ToString() + "Bytes";
+        }
+
+
+        /// <summary>
+        /// 检测是否符合IP地址格式(IPv4)。
+        /// </summary>
+        /// <param name="strIp">要判断的IP字符串。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsIP(string strIp)
+        {
+            return Regex.IsMatch(strIp, @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$");
+
+        }
+
+
+        /// <summary>
+        /// 检测是否是IP地址段(IPv4)。
+        /// </summary>
+        /// <param name="strIp">要判断的IP字符串。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsIPSect(string strIp)
+        {
+            return Regex.IsMatch(strIp, @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){2}((2[0-4]\d|25[0-5]|[01]?\d\d?|\*)\.)(2[0-4]\d|25[0-5]|[01]?\d\d?|\*)$");
+
+        }
+
+
+        /// <summary>
+        /// 将全角数字转换为数字。
+        /// </summary>
+        /// <param name="SBCCase">全角数字。</param>
+        /// <returns>处理结果。</returns>
+        public static string SBCCaseToNumberic(string SBCCase)
+        {
+            char[] c = SBCCase.ToCharArray();
+            for (int i = 0; i < c.Length; i++)
+            {
+                byte[] b = System.Text.Encoding.Unicode.GetBytes(c, i, 1);
+                if (b.Length == 2)
+                {
+                    if (b[1] == 255)
+                    {
+                        b[0] = (byte)(b[0] + 32);
+                        b[1] = 0;
+                        c[i] = System.Text.Encoding.Unicode.GetChars(b)[0];
+                    }
+                }
+            }
+            return new string(c);
+        }
+
+
+        /// <summary>
+        /// 删除最后一个字符。
+        /// </summary>
+        /// <param name="str">待处理的字符串。</param>
+        /// <returns>处理结果。</returns>
+        public static string SafeClearLastChar(string str)
+        {
+            if (str == "")
+                return "";
+            else
+                return str.Substring(0, str.Length - 1);
+        }
+
+        /// <summary>
+        /// 将字符串转换为Color。
+        /// </summary>
+        /// <param name="color">颜色字符串,颜色可以是颜色名,也可以是RGB值或标准颜色值。</param>
+        /// <returns>处理结果。</returns>
+        public static Color ToColor(string color)
+        {
+            int red, green, blue = 0;
+            char[] rgb;
+            color = color.TrimStart('#');
+            color = Regex.Replace(color.ToLower(), "[g-zG-Z]", "");
+            switch (color.Length)
+            {
+                case 3:
+                    rgb = color.ToCharArray();
+                    red = Convert.ToInt32(rgb[0].ToString() + rgb[0].ToString(), 16);
+                    green = Convert.ToInt32(rgb[1].ToString() + rgb[1].ToString(), 16);
+                    blue = Convert.ToInt32(rgb[2].ToString() + rgb[2].ToString(), 16);
+                    return Color.FromArgb(red, green, blue);
+                case 6:
+                    rgb = color.ToCharArray();
+                    red = Convert.ToInt32(rgb[0].ToString() + rgb[1].ToString(), 16);
+                    green = Convert.ToInt32(rgb[2].ToString() + rgb[3].ToString(), 16);
+                    blue = Convert.ToInt32(rgb[4].ToString() + rgb[5].ToString(), 16);
+                    return Color.FromArgb(red, green, blue);
+                default:
+                    return Color.FromName(color);
+
+            }
+        }
+
+        /// <summary>
+        /// 检测字符串是否是日期字符串。
+        /// </summary>
+        /// <param name="str">待判断字符串。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsDateString(string str)
+        {
+            return Regex.IsMatch(str, @"(\d{4})-(\d{1,2})-(\d{1,2})");
+        }
+
+        /// <summary>
+        /// 检测是否为正整数。
+        /// </summary>
+        /// <param name="str">待判断字符串。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsPlusInt(string str)
+        {
+
+            return Regex.IsMatch(str, @"^[0-9]*$");
+        }
+
+        /// <summary>
+        /// 检测给定的字符串数组(strNumber)中的数据是不是都为数值型。
+        /// </summary>
+        /// <param name="strNumber">要确认的字符串数组。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsNumericArray(string[] strNumber)
+        {
+            if (strNumber == null)
+            {
+                return false;
+            }
+            if (strNumber.Length < 1)
+            {
+                return false;
+            }
+            foreach (string id in strNumber)
+            {
+                if (!IsNumeric(id))
+                {
+                    return false;
+                }
+            }
+            return true;
+
+        }
+
+        /// <summary>
+        /// 检测字符串是否为Int32类型的数字。
+        /// </summary>
+        /// <param name="str">待判断的字符串。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsNumeric(string  str)
+        {
+
+            if (str.Length > 0 && str.Length <= 11 && Regex.IsMatch(str, @"^[-]?[0-9]*[.]?[0-9]*$"))
+            {
+                if ((str.Length < 10) || (str.Length == 10 && str[0] == '1') || (str.Length == 11 && str[0] == '-' && str[1] == '1'))
+                {
+                    return true;
+                }
+            }
+
+            return false;
+
+        }
+
+        /// <summary>
+        /// 检测字符串是否为Double类型的数字。
+        /// </summary>
+        /// <param name="str">待判断的字符串。</param>
+        /// <returns>判断结果。</returns>
+        public static bool IsDouble(string str)
+        {
+                return Regex.IsMatch(str, @"^([0-9])[0-9]*(\.\w*)?$");
+        }
+
+        /// <summary>
+        /// string型转换为bool型。
+        /// </summary>
+        /// <param name="str">待转换的字符串。</param>
+        /// <param name="defaultValue">缺省值。</param>
+        /// <returns>转换后的bool类型结果。</returns>
+        public static bool ToBool(string str, bool defaultValue)
+        {
+            if (str != null)
+            {
+                if (string.Compare(str, "true", true) == 0)
+                {
+                    return true;
+                }
+                else if (string.Compare(str, "false", true) == 0)
+                {
+                    return false;
+                }
+            }
+            return defaultValue;
+        }
+
+        /// <summary>
+        /// 将字符串转换为Int32类型。
+        /// </summary>
+        /// <param name="str">待转换的字符串。</param>
+        /// <param name="defaultValue">缺省值。</param>
+        /// <returns>转换后的int类型结果。</returns>
+        public static int ToInt(string  str, int defaultValue)
+        {
+            if (str != null)
+            {
+                if (str.Length > 0 && str.Length <= 11 && Regex.IsMatch(str, @"^[-]?[0-9]*$"))
+                {
+                    if ((str.Length < 10) || (str.Length == 10 && str[0] == '1') || (str.Length == 11 && str[0] == '-' && str[1] == '1'))
+                    {
+                        return Convert.ToInt32(str);
+                    }
+                }
+            }
+            return defaultValue;
+        }
+
+        /// <summary>
+        /// string型转换为float型。
+        /// </summary>
+        /// <param name="str">待转换的字符串。</param>
+        /// <param name="defaultValue">缺省值。</param>
+        /// <returns>转换后的int类型结果。</returns>
+        public static float ToFloat(string str, float defaultValue)
+        {
+            if ((str == null) || (str.Length > 10))
+            {
+                return defaultValue;
+            }
+
+            float intValue = defaultValue;
+            if (str != null)
+            {
+                bool IsFloat = Regex.IsMatch(str.ToString(), @"^([-]|[0-9])[0-9]*(\.\w*)?$");
+                if (IsFloat)
+                {
+                    intValue = Convert.ToSingle(str);
+                }
+            }
+            return intValue;
+        }
+
+
+        /// <summary>
+        /// 将字符串转换为Int32类型
+        /// </summary>
+        /// <param name="str">待转换的字符串。</param>
+        /// <returns>转换后的Int32类型结果。</returns>
+        public static int ToInt32(string  str)
+        {
+            if (str == null)
+            {
+                return 0;
+            }
+            string strNum = str;
+            if (IsNumeric(strNum))
+            {
+
+                if (strNum.ToString().Length > 9)
+                {
+                    if (strNum.StartsWith("-"))
+                    {
+                        return int.MinValue;
+                    }
+                    else
+                    {
+                        return int.MaxValue;
+                    }
+                }
+                return Int32.Parse(strNum);
+            }
+            else
+            {
+                return 0;
+            }
+        }
+
+        /// <summary>
+        /// 将字符串转换为Base64类型
+        /// </summary>
+        /// <param name="str"></param>
+        /// <returns></returns>
+        public static  string ToBase64String(string str)
+        {
+            byte[] data = System.Text.Encoding.Unicode.GetBytes(str);
+            return Convert.ToBase64String(data);
+        }
+
+        /// <summary>
+        /// FromBase64String
+        /// </summary>
+        /// <param name="str"></param>
+        /// <returns></returns>
+        public static  string FromBase64String(string str)
+        {
+            byte[] data = Convert.FromBase64String(str);
+            return System.Text.Encoding.Unicode.GetString(data);
+        }
+
+        /// <summary>
+        /// 压缩字符串
+        /// </summary>
+        /// <param name="str"></param>
+        /// <returns></returns>
+        public static string ToCompressionString(string str)
+        {
+            return str;
+        }
+
+        /// <summary>
+        /// 解压字符串
+        /// </summary>
+        /// <param name="str"></param>
+        /// <returns></returns>
+        public static string FromCompressionString(string str)
+        {
+            return str;
+        }
+
+        /// <summary>
+        /// 把字符串数据转化为字符
+        /// </summary>
+        /// <param name="array"></param>
+        /// <param name="separator"></param>
+        /// <returns></returns>
+        public static string FromStringArray(string[] array, string separator)
+        {
+            string s = string.Empty;
+            foreach (string t in array)
+                s += separator + t;
+            if (s.Length > separator.Length)
+                s = s.Substring(separator.Length);
+
+            return s;
+        }
+
+        /// <summary>
+        /// 将字典转换为字符串表达式。
+        /// </summary>
+        /// <param name="dic"></param>
+        /// <returns></returns>
+        public static string FromDictionary(Dictionary<string, string> dic)
+        {
+            if (dic.Count == 0)
+                return string.Empty;
+
+            string rstr = string.Empty;
+            foreach (string key in dic.Keys)
+            {
+                rstr += ";" + key + "=" + dic[key];
+            }
+
+            if (rstr.Length > 1)
+                rstr = rstr.Substring(1);
+            return rstr;
+        }
+
+        /// <summary>
+        /// 将数组转换为字符串表达式。
+        /// </summary>
+        /// <param name="array"></param>
+        /// <param name="dictionary">是否转化为字典样式</param>
+        /// <returns></returns>
+        public static string FromArray(string[] array,bool dictionary)
+        {
+            if (array.Length == 0)
+                return string.Empty;
+
+            string rstr = string.Empty;
+            foreach (string key in array)
+            {
+                if(dictionary)
+                    rstr += ";" + key + "=" + key;
+                else
+                    rstr += ";" + key ;
+            }
+
+            if (rstr.Length > 1)
+                rstr = rstr.Substring(1);
+            return rstr;
+        }
+
+        /// <summary>
+        /// 将字符串解析为字典,要求字符串的格式为:键=值;键=值
+        /// </summary>
+        /// <param name="str">字符串。</param>
+        /// <returns></returns>
+        public static Dictionary<string, string> ToDictionary(string str)
+        {
+            Dictionary<string, string> dic = new Dictionary<string, string>();
+            if (str == null || str == string.Empty)
+                return dic;
+
+            string[] items = str.Split(new char[1] { ';' });
+            for (int i = 0; i <= items.Length - 1; i++)
+            {
+                if (!items[i].Contains("="))
+                    continue;
+                string[] item = items[i].Split(new char[1] { '=' });
+                dic.Add(item[0], item[1]);
+            }
+
+            return dic;
+        }
+
+        /*
+        public static string FromNamedValueCollection(NamedValueItemCollection dic)
+        {
+            if (dic.Count == 0)
+                return string.Empty;
+
+            string rstr = string.Empty;
+            foreach (NamedValueItem item in dic)
+            {
+                rstr += ";" + item.Name + "=" + item.StringValue;
+            }
+
+            if (rstr.Length > 1)
+                rstr = rstr.Substring(1);
+            return rstr;
+        }
+
+        public static NamedValueItemCollection ToNamedValueCollection(string str)
+        {
+            NamedValueItemCollection dic = new  NamedValueItemCollection();
+            if (str == null || str == string.Empty)
+                return dic;
+
+            string[] items = str.Split(new char[1] { ';' });
+            for (int i = 0; i <= items.Length - 1; i++)
+            {
+                if (!items[i].Contains("="))
+                    continue;
+                string[] item = items[i].Split(new char[1] { '=' });
+                dic.Add(item[0], item[1]);
+            }
+
+            return dic;
+        }
+        */
+        /// <summary>
+        /// 表达式值交换,即将值表达式中的值按名称替换到源表达式中。
+        /// </summary>
+        /// <param name="srcExpr">源表达式,格式为 名称=值表达式名称;名称=值表达式名称</param>
+        /// <param name="valExpr">值表达式,格式为值表达式名称=值;格式为值表达式名称=值</param>
+        /// <returns>返回后表达式为 名称=值;名称=值</returns>
+        public static string ExpressionValueExchange(string srcExpr, string valExpr)
+        {
+            string rstr = string.Empty;
+            string[] src = srcExpr.Split(new char[1] { ';' });
+            string[] val = valExpr.Split(new char[1] { ';' });
+            Dictionary<string, string> dval = new Dictionary<string, string>();
+            for (int i = 0; i <= val.Length - 1; i++)
+            {
+                int p = val[i].IndexOf("=");
+                dval.Add(val[i].Substring(0, p), val[i].Substring(p + 1));
+            }
+
+            for (int i = 0; i <= src.Length - 1; i++)
+            {
+                int p = src[i].IndexOf("=");
+                string sn = src[i].Substring(0, p);
+                string sv = src[i].Substring(p+1);
+
+                if (dval.ContainsKey(sv))
+                    sv = dval[sv];
+                else
+                    sv = string.Empty;
+
+                if (rstr == string.Empty)
+                    rstr = sn + "=" + sv;
+                else
+                    rstr = rstr+";"+sn + "=" + sv;
+            }
+
+            return rstr;
+        }
+
+        /// <summary>
+        /// 格式化字符串。
+        /// </summary>
+        /// <param name="formatText">格式化字符串,中间不能包括逗号。格式为:格式化字符串,参数字段名1,,参数字段名2</param>
+        /// <param name="parameters"></param>
+        /// <returns></returns>
+        public static  string FormatString(string formatText, DataRow parameters)
+        {
+            if (parameters == null)
+                return formatText;
+
+            string[] fsParts = formatText.Split(new char[1] { ',' });
+            string[] fparas = new string[fsParts.Length - 1];
+            for (int i = 1; i <= fsParts.Length - 1; i++)
+            {
+                if (parameters.Table.Columns.Contains(fsParts[i]))
+                    fparas[i - 1] = parameters[fsParts[i]].ToString();
+                else
+                    fparas[i - 1] = string.Empty;
+            }
+
+            string s = string.Format(fsParts[0], fparas);
+            return s;
+        }
+
+        /// <summary>
+        /// 获取分隔字符串数组;如将"[DBB004]=DAB004;[DBB005]=DAB005;[DBB006]=[DAB009]"分隔字符数组:DBB004,DAB004,DBB005,DAB005,DBB006,DAB009
+        /// </summary>
+        /// <param name="strValue">映射字符</param>
+        /// <returns>字符串数组</returns>
+        public static string[] GetSplitString(string strValue)
+        {
+            if (strValue == null)
+                return null;
+            if (strValue.Length == 0)
+                return null;
+
+            strValue = strValue.Replace("[", "").Replace("]", "");
+            string[] strArray = strValue.Split(new char[2] { ';', '=' });
+            return strArray;
+        } 
+
+        /// <summary>
+        /// 对文本,分隔的字符进行添加单引号,对于条件是in的时候进行添加单引号
+        /// x022,x023,x025===>'x022','x023','x025'
+        /// </summary>
+        /// <param name="strText">传入的字符串</param>
+        /// <returns>返回添加单引号的字符</returns>
+        public static string AddSingleQuote(string strText)
+        {
+            string[] value = strText.Split(new char[1] { ',' });
+            for (int i = 0; i < value.Length; i++)
+            {
+                string para = value[i];
+                if (para.StartsWith("'"))
+                    para = para.Substring(1);
+                if (para.EndsWith("'"))
+                    para = para.Substring(0, para.Length - 1);
+                value[i] = "'" + para + "'";
+            }
+            string str = string.Join(",", value);
+            return str;
+        }
+
+        /// <summary>
+        /// Gets the express string.
+        /// </summary>
+        /// <param name="strValue">The STR value.</param>
+        /// <returns></returns>
+        public static string[] GetExpressString(string strValue)
+        {
+            string[] strs = strValue.Split(new char[2] { '=', ' ' });
+            List<string> strList = new List<string>();            
+            foreach (string str in strs)
+            {
+                if (str.Contains("["))
+                    strList.Add(str);
+            }
+            return strList.ToArray();
+            //return strs.Where(c => c.Contains('[')).ToArray();
+        }
+
+
+
+        /// <summary>
+        /// 检验两个数字是否相等
+        /// </summary>
+        /// <param name="x">第一个数字</param>
+        /// <param name="y">第二个数字</param>
+        /// <returns>返回true;false</returns>
+        public static bool AboutEqual(double x, double y)
+        {
+            double epsilon = Math.Max(Math.Abs(x), Math.Abs(y)) * 1E-15;
+            return Math.Abs(x - y) <= epsilon;
+        }
+
+        /// <summary>
+        /// 检验数字数组是否全部相等
+        /// 采用相等传递的方法,验证一轮即可
+        /// </summary>
+        /// <param name="douArrs"></param>
+        /// <returns></returns>
+        public static bool AboutEqual(params double[] douArrs)
+        {
+            double dbFirst = douArrs[0];
+            for (int t = 1; t < douArrs.Length; t++)
+            {
+                if (!AboutEqual(dbFirst, douArrs[t]))
+                    return false;
+            }
+            return true;
+        }
+
+        /// <summary>
+        /// 字符数组验证是否有为空或者null
+        /// </summary>
+        /// <param name="objs"></param>
+        /// <returns></returns>
+        public static bool ExistsEmptyOrNull(params object[] objs)
+        {
+            if (objs == null || objs.Length == 0)
+                return true;
+            foreach (object obj in objs)
+            {
+                if (IsNullOrEmptyReturnZero<string>(obj) == "")
+                    return true;
+            }
+            return false;
+        }
+
+        /// <summary>
+        /// 泛型转换为数值类型
+        /// </summary>
+        /// <typeparam name="T"></typeparam>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public static T IsNullOrEmptyReturnZero<T>(object obj)
+        {
+            if (Equals(obj, null) || Equals(DBNull.Value, obj))
+            {
+                if (typeof(T).FullName == "System.String")
+                    return (T)Convert.ChangeType("", typeof(T));
+                return default(T);
+            }
+            try
+            {
+                return (T)Convert.ChangeType(obj, typeof(T));
+            }
+            catch
+            {
+                return default(T);
+            }
+        }
+
+
+    }
+}
diff --git a/StringSecurity.cs b/StringSecurity.cs
new file mode 100644
index 0000000..63140aa
--- /dev/null
+++ b/StringSecurity.cs
@@ -0,0 +1,308 @@
+using System;
+using System.Text;
+using System.IO;
+using System.Security.Cryptography;
+
+namespace DataexchangeServer
+{
+    /// <summary>
+    /// 字符串加密解密类
+    /// </summary>
+    public sealed class StringSecurity
+    {
+        private StringSecurity() { }
+
+        #region SHA1 加密
+
+        /// <summary>
+        /// 使用SHA1加密字符串。
+        /// </summary>
+        /// <param name="inputString">输入字符串。</param>
+        /// <returns>加密后的字符串。(40个字符)</returns>
+        public static string StringToSHA1Hash(string inputString)
+        {
+            SHA1CryptoServiceProvider sha1 = new SHA1CryptoServiceProvider();
+            byte[] encryptedBytes = sha1.ComputeHash(Encoding.ASCII.GetBytes(inputString));
+            StringBuilder sb = new StringBuilder();
+            for (int i = 0; i < encryptedBytes.Length; i++)
+            {
+                sb.AppendFormat("{0:x2}", encryptedBytes[i]);
+            }
+            return sb.ToString();
+        }
+
+        #endregion
+
+        #region DES 加密/解密
+
+        private static byte[] key = ASCIIEncoding.ASCII.GetBytes("uiertysd");
+        private static byte[] iv = ASCIIEncoding.ASCII.GetBytes("99008855");
+
+        /// <summary>
+        /// DES加密。
+        /// </summary>
+        /// <param name="inputString">输入字符串。</param>
+        /// <returns>加密后的字符串。</returns>
+        public static string DESEncrypt(string inputString)
+        {
+            MemoryStream ms = null;
+            CryptoStream cs = null;
+            StreamWriter sw = null;
+
+            DESCryptoServiceProvider des = new DESCryptoServiceProvider();
+            try
+            {
+                ms = new MemoryStream();
+                cs = new CryptoStream(ms, des.CreateEncryptor(key, iv), CryptoStreamMode.Write);
+                sw = new StreamWriter(cs);
+                sw.Write(inputString);
+                sw.Flush();
+                cs.FlushFinalBlock();
+                return Convert.ToBase64String(ms.GetBuffer(), 0, (int)ms.Length);
+            }
+            finally
+            {
+                if (sw != null) sw.Close();
+                if (cs != null) cs.Close();
+                if (ms != null) ms.Close();
+            }
+        }
+
+        /// <summary>
+        /// DES解密。
+        /// </summary>
+        /// <param name="inputString">输入字符串。</param>
+        /// <returns>解密后的字符串。</returns>
+        public static string DESDecrypt(string inputString)
+        {
+            MemoryStream ms = null;
+            CryptoStream cs = null;
+            StreamReader sr = null;
+
+            DESCryptoServiceProvider des = new DESCryptoServiceProvider();
+            try
+            {
+                ms = new MemoryStream(Convert.FromBase64String(inputString));
+                cs = new CryptoStream(ms, des.CreateDecryptor(key, iv), CryptoStreamMode.Read);
+                sr = new StreamReader(cs);
+                return sr.ReadToEnd();
+            }
+            finally
+            {
+                if (sr != null) sr.Close();
+                if (cs != null) cs.Close();
+                if (ms != null) ms.Close();
+            }
+        }
+
+        #endregion
+    }
+
+    /// <summary>
+    /// 安全函数辅助类。
+    /// </summary>
+    public class SecurityHelper 
+    {
+
+        #region 对外公布的加密码算法
+
+        /// <summary>
+        /// AES加密码的Key
+        /// </summary>
+        private static readonly string EncryptKey = "1234567891234569123456789123";
+
+        /// <summary>
+        /// 加密
+        /// </summary>
+        /// <param name="strPassword">需要加密的字符串。</param>
+        /// <returns>返回加密后的字符串,如果加密码失败返回空。</returns>
+        public static string Encrypt(string strPassword)
+        {
+            string Password = AESEncrypt(strPassword, EncryptKey);
+            return strPassword == Password ? strPassword : Password;
+        }
+
+        /// <summary>
+        /// 解密
+        /// </summary>
+        /// <param name="strPassword">加密码字符串</param>
+        /// <returns>返回解密后的字符串,如果解密码失败返回空。</returns>
+        public static string Decrypt(string strPassword)
+        {
+            string Password = AESDecrypt(strPassword, EncryptKey);
+            return strPassword == Password ? strPassword : Password;
+        }
+
+        #endregion
+
+        //默认DES密钥向量
+        //private static byte[] DES_IV = {0x12, 0x34, 0x56, 0x78, 0x90, 0xAB, 0xCD, 0xEF};
+        //默认AES密钥向量
+        private static byte[] AES_IV =
+            {
+                0x41, 0x72, 0x65, 0x79, 0x6F, 0x75, 0x6D, 0x79, 0x53, 0x6E, 0x6F, 0x77, 0x6D,
+                0x61, 0x6E, 0x3F
+            };
+
+        //private const string RSASign_HashAlgorithmName = "MD5";
+        //private const string RSAEncryptXml_KeyName = "key";
+
+        #region Hashcode
+
+        /// <summary>
+        /// MD5函数。
+        /// </summary>
+        /// <param name="str">原始字符串。</param>
+        /// <returns>MD5结果。</returns>
+        public static string MD5(string str)
+        {
+            byte[] b = Encoding.UTF8.GetBytes(str);
+            byte[] hash = MD5(b);
+
+            string ret = "";
+            for (int i = 0; i < hash.Length; i++)
+                ret += hash[i].ToString("x").PadLeft(2, '0');
+            return ret;
+        }
+
+        /// <summary>
+        /// MD5函数。
+        /// </summary>
+        /// <param name="data">原始数据流。</param>
+        /// <returns>MD5结果。</returns>
+        public static byte[] MD5(byte[] data)
+        {
+            return new MD5CryptoServiceProvider().ComputeHash(data);
+        }
+
+        /// <summary>
+        /// SHA256函数。
+        /// </summary>
+        /// /// <param name="str">原始字符串。</param>
+        /// <returns>SHA256结果。</returns>
+        public static string SHA256(string str)
+        {
+            byte[] SHA256Data = Encoding.UTF8.GetBytes(str);
+            return Convert.ToBase64String(SHA256(SHA256Data)); //返回长度为44字节的字符串
+        }
+
+        /// <summary>
+        /// SHA256函数。
+        /// </summary>
+        /// /// <param name="data">原始数据流。</param>
+        /// <returns>SHA256结果。</returns>
+        public static byte[] SHA256(byte[] data)
+        {
+            SHA256Managed Sha256 = new SHA256Managed();
+            return Sha256.ComputeHash(data);
+        }
+
+        #endregion
+
+        #region AES对称加密解密
+
+        /// <summary>
+        /// AES加密。
+        /// </summary>
+        /// <param name="encryptString">待加密的字符串。</param>
+        /// <param name="encryptKey">加密密钥,要求为32位。</param>
+        /// <returns>加密成功返回加密后的字符串,失败返回源串。</returns>
+        private static string AESEncrypt(string encryptString, string encryptKey)
+        {
+            try
+            {
+                byte[] inputData = Encoding.UTF8.GetBytes(encryptString);
+                return Convert.ToBase64String(AESEncrypt(inputData, encryptKey));
+            }
+            catch
+            {
+                return encryptString;
+            }
+        }
+
+        /// <summary>
+        /// AES加密。
+        /// </summary>
+        /// <param name="data">待加密的数据。</param>
+        /// <param name="encryptKey">加密密钥,要求为32位。</param>
+        /// <returns>加密成功返回加密后的数据,失败返回空字符串。</returns>
+        private static byte[] AESEncrypt(byte[] data, string encryptKey)
+        {
+            try
+            {
+                encryptKey = StringHelper.GetSubString(encryptKey, 32, "");
+                encryptKey = encryptKey.PadRight(32, ' ');
+
+                RijndaelManaged rijndaelProvider = new RijndaelManaged();
+                rijndaelProvider.Key = Encoding.UTF8.GetBytes(encryptKey.Substring(0, 32));
+                rijndaelProvider.IV = AES_IV;
+                ICryptoTransform rijndaelEncrypt = rijndaelProvider.CreateEncryptor();
+
+                byte[] inputData = data;
+                byte[] encryptedData = rijndaelEncrypt.TransformFinalBlock(inputData, 0, inputData.Length);
+
+                return encryptedData;
+            }
+            catch (Exception e)
+            {
+                //Instance.WriteLog(e.Message, false);
+                return data;
+            }
+        }
+
+        /// <summary>
+        /// AES解密。
+        /// </summary>
+        /// <param name="decryptString">待解密的字符串。</param>
+        /// <param name="decryptKey">解密密钥,要求为32位,和加密密钥相同。</param>
+        /// <returns>解密成功返回解密后的字符串,失败返回空字符串。</returns>
+        private static string AESDecrypt(string decryptString, string decryptKey)
+        {
+            try
+            {
+                byte[] inputData = Convert.FromBase64String(decryptString);
+                return Encoding.UTF8.GetString(AESDecrypt(inputData, decryptKey));
+            }
+            catch
+            {
+                return decryptString;
+            }
+
+        }
+
+        /// <summary>
+        /// AES解密。
+        /// </summary>
+        /// <param name="data">待解密的数据。</param>
+        /// <param name="decryptKey">解密密钥,要求为32位,和加密密钥相同。</param>
+        /// <returns>解密成功返回解密后的数据流,失败返回源数据。</returns>
+        private static byte[] AESDecrypt(byte[] data, string decryptKey)
+        {
+            try
+            {
+                decryptKey = StringHelper.GetSubString(decryptKey, 32, "");
+                decryptKey = decryptKey.PadRight(32, ' ');
+
+                RijndaelManaged rijndaelProvider = new RijndaelManaged();
+                rijndaelProvider.Key = Encoding.UTF8.GetBytes(decryptKey);
+                rijndaelProvider.IV = AES_IV;
+                ICryptoTransform rijndaelDecrypt = rijndaelProvider.CreateDecryptor();
+
+                byte[] inputData = data;
+                byte[] decryptedData = rijndaelDecrypt.TransformFinalBlock(inputData, 0, inputData.Length);
+
+                return decryptedData;
+            }
+            catch
+            {
+                return data;
+            }
+
+        }
+
+
+        #endregion
+
+
+    }
+}
diff --git a/Web References/WebReference/Reference.cs b/Web References/WebReference/Reference.cs
new file mode 100644
index 0000000..1837c96
--- /dev/null
+++ b/Web References/WebReference/Reference.cs
@@ -0,0 +1,293 @@
+锘�//------------------------------------------------------------------------------
+// <auto-generated>
+//     姝や唬鐮佺敱宸ュ叿鐢熸垚銆�
+//     杩愯鏃剁増鏈�:4.0.30319.42000
+//
+//     瀵规鏂囦欢鐨勬洿鏀瑰彲鑳戒細瀵艰嚧涓嶆纭殑琛屼负锛屽苟涓斿鏋�
+//     閲嶆柊鐢熸垚浠g爜锛岃繖浜涙洿鏀瑰皢浼氫涪澶便��
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+// 
+// 姝ゆ簮浠g爜鏄敱 Microsoft.VSDesigner 4.0.30319.42000 鐗堣嚜鍔ㄧ敓鎴愩��
+// 
+#pragma warning disable 1591
+
+namespace DataexchangeServer.WebReference {
+    using System.Diagnostics;
+    using System;
+    using System.Xml.Serialization;
+    using System.ComponentModel;
+    using System.Web.Services.Protocols;
+    using System.Web.Services;
+    
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.4084.0")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Web.Services.WebServiceBindingAttribute(Name="UserServiceImplPortBinding", Namespace="K3cloudInterface")]
+    [System.Xml.Serialization.XmlIncludeAttribute(typeof(BodyResponse))]
+    [System.Xml.Serialization.XmlIncludeAttribute(typeof(Body))]
+    public partial class UserServiceImplService : System.Web.Services.Protocols.SoapHttpClientProtocol {
+        
+        private System.Threading.SendOrPostCallback BodyOperationCompleted;
+        
+        private bool useDefaultCredentialsSetExplicitly;
+        
+        /// <remarks/>
+        public UserServiceImplService() {
+            this.Url = global::DataexchangeServer.Properties.Settings.Default.DataexchangeServer_WebReference_UserServiceImplService;
+            if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
+                this.UseDefaultCredentials = true;
+                this.useDefaultCredentialsSetExplicitly = false;
+            }
+            else {
+                this.useDefaultCredentialsSetExplicitly = true;
+            }
+        }
+        
+        public new string Url {
+            get {
+                return base.Url;
+            }
+            set {
+                if ((((this.IsLocalFileSystemWebService(base.Url) == true) 
+                            && (this.useDefaultCredentialsSetExplicitly == false)) 
+                            && (this.IsLocalFileSystemWebService(value) == false))) {
+                    base.UseDefaultCredentials = false;
+                }
+                base.Url = value;
+            }
+        }
+        
+        public new bool UseDefaultCredentials {
+            get {
+                return base.UseDefaultCredentials;
+            }
+            set {
+                base.UseDefaultCredentials = value;
+                this.useDefaultCredentialsSetExplicitly = true;
+            }
+        }
+        
+        /// <remarks/>
+        public event BodyCompletedEventHandler BodyCompleted;
+        
+        /// <remarks/>
+        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="K3cloudInterface", ResponseNamespace="K3cloudInterface", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+        [return: System.Xml.Serialization.XmlElementAttribute("return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public resp Body([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] user arg0) {
+            object[] results = this.Invoke("Body", new object[] {
+                        arg0});
+            return ((resp)(results[0]));
+        }
+        
+        /// <remarks/>
+        public void BodyAsync(user arg0) {
+            this.BodyAsync(arg0, null);
+        }
+        
+        /// <remarks/>
+        public void BodyAsync(user arg0, object userState) {
+            if ((this.BodyOperationCompleted == null)) {
+                this.BodyOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBodyOperationCompleted);
+            }
+            this.InvokeAsync("Body", new object[] {
+                        arg0}, this.BodyOperationCompleted, userState);
+        }
+        
+        private void OnBodyOperationCompleted(object arg) {
+            if ((this.BodyCompleted != null)) {
+                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
+                this.BodyCompleted(this, new BodyCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
+            }
+        }
+        
+        /// <remarks/>
+        public new void CancelAsync(object userState) {
+            base.CancelAsync(userState);
+        }
+        
+        private bool IsLocalFileSystemWebService(string url) {
+            if (((url == null) 
+                        || (url == string.Empty))) {
+                return false;
+            }
+            System.Uri wsUri = new System.Uri(url);
+            if (((wsUri.Port >= 1024) 
+                        && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
+                return true;
+            }
+            return false;
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="K3cloudInterface")]
+    public partial class user {
+        
+        private string categoryField;
+        
+        private string dataField;
+        
+        private string opField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string category {
+            get {
+                return this.categoryField;
+            }
+            set {
+                this.categoryField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string data {
+            get {
+                return this.dataField;
+            }
+            set {
+                this.dataField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string op {
+            get {
+                return this.opField;
+            }
+            set {
+                this.opField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="K3cloudInterface")]
+    public partial class BodyResponse {
+        
+        private resp returnField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public resp @return {
+            get {
+                return this.returnField;
+            }
+            set {
+                this.returnField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="K3cloudInterface")]
+    public partial class resp {
+        
+        private int codeField;
+        
+        private object dataField;
+        
+        private string msgField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public int code {
+            get {
+                return this.codeField;
+            }
+            set {
+                this.codeField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public object data {
+            get {
+                return this.dataField;
+            }
+            set {
+                this.dataField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string msg {
+            get {
+                return this.msgField;
+            }
+            set {
+                this.msgField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="K3cloudInterface")]
+    public partial class Body {
+        
+        private user arg0Field;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public user arg0 {
+            get {
+                return this.arg0Field;
+            }
+            set {
+                this.arg0Field = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.4084.0")]
+    public delegate void BodyCompletedEventHandler(object sender, BodyCompletedEventArgs e);
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.4084.0")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    public partial class BodyCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+        
+        private object[] results;
+        
+        internal BodyCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
+                base(exception, cancelled, userState) {
+            this.results = results;
+        }
+        
+        /// <remarks/>
+        public resp Result {
+            get {
+                this.RaiseExceptionIfNecessary();
+                return ((resp)(this.results[0]));
+            }
+        }
+    }
+}
+
+#pragma warning restore 1591
\ No newline at end of file
diff --git a/Web References/WebReference/Reference.map b/Web References/WebReference/Reference.map
new file mode 100644
index 0000000..4176742
--- /dev/null
+++ b/Web References/WebReference/Reference.map
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<DiscoveryClientResultsFile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <Results>
+    <DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://36.134.102.119:8888/ykd/api?wsdl" filename="UserServiceImplService.wsdl" />
+    <DiscoveryClientResult referenceType="System.Web.Services.Discovery.SchemaReference" url="http://36.134.102.119:8888/ykd/api?xsd=1" filename="api.xsd" />
+  </Results>
+</DiscoveryClientResultsFile>
\ No newline at end of file
diff --git a/Web References/WebReference/UserServiceImplService.wsdl b/Web References/WebReference/UserServiceImplService.wsdl
new file mode 100644
index 0000000..58b0634
--- /dev/null
+++ b/Web References/WebReference/UserServiceImplService.wsdl
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<definitions xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="K3cloudInterface" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="UserServiceImplService" targetNamespace="K3cloudInterface" xmlns="http://schemas.xmlsoap.org/wsdl/">
+  <types>
+    <xsd:schema>
+      <xsd:import schemaLocation="http://36.134.102.119:8888/ykd/api?xsd=1" namespace="K3cloudInterface" />
+    </xsd:schema>
+  </types>
+  <message name="Body">
+    <part name="parameters" element="tns:Body" />
+  </message>
+  <message name="BodyResponse">
+    <part name="parameters" element="tns:BodyResponse" />
+  </message>
+  <portType name="UserServiceImpl">
+    <operation name="Body">
+      <input wsam:Action="K3cloudInterface/UserServiceImpl/BodyRequest" message="tns:Body" />
+      <output wsam:Action="K3cloudInterface/UserServiceImpl/BodyResponse" message="tns:BodyResponse" />
+    </operation>
+  </portType>
+  <binding name="UserServiceImplPortBinding" type="tns:UserServiceImpl">
+    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+    <operation name="Body">
+      <soap:operation soapAction="" />
+      <input>
+        <soap:body use="literal" />
+      </input>
+      <output>
+        <soap:body use="literal" />
+      </output>
+    </operation>
+  </binding>
+  <service name="UserServiceImplService">
+    <port name="UserServiceImplPort" binding="tns:UserServiceImplPortBinding">
+      <soap:address location="http://36.134.102.119:8888/ykd/api" />
+    </port>
+  </service>
+</definitions>
\ No newline at end of file
diff --git a/Web References/WebReference/api.xsd b/Web References/WebReference/api.xsd
new file mode 100644
index 0000000..aa89c01
--- /dev/null
+++ b/Web References/WebReference/api.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:tns="K3cloudInterface" targetNamespace="K3cloudInterface" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="Body" type="tns:Body" />
+  <xs:element name="BodyResponse" type="tns:BodyResponse" />
+  <xs:complexType name="Body">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="arg0" type="tns:user" />
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="user">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="category" type="xs:string" />
+      <xs:element minOccurs="0" name="data" type="xs:string" />
+      <xs:element minOccurs="0" name="op" type="xs:string" />
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="BodyResponse">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="return" type="tns:resp" />
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="resp">
+    <xs:sequence>
+      <xs:element name="code" type="xs:int" />
+      <xs:element minOccurs="0" name="data" type="xs:anyType" />
+      <xs:element minOccurs="0" name="msg" type="xs:string" />
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>
\ No newline at end of file
diff --git a/Web References/WebReference/resp.datasource b/Web References/WebReference/resp.datasource
new file mode 100644
index 0000000..90ce0d6
--- /dev/null
+++ b/Web References/WebReference/resp.datasource
@@ -0,0 +1,10 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<!--
+    This file is automatically generated by Visual Studio .Net. It is 
+    used to store generic object data source configuration information.  
+    Renaming the file extension or editing the content of this file may   
+    cause the file to be unrecognizable by the program.
+-->
+<GenericObjectDataSource DisplayName="resp" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
+   <TypeInfo>DataexchangeServer.WebReference.resp, Web References.WebReference.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
+</GenericObjectDataSource>
\ No newline at end of file
diff --git a/Web References/WebReferenceLD/Reference.cs b/Web References/WebReferenceLD/Reference.cs
new file mode 100644
index 0000000..7af06f5
--- /dev/null
+++ b/Web References/WebReferenceLD/Reference.cs
@@ -0,0 +1,293 @@
+锘�//------------------------------------------------------------------------------
+// <auto-generated>
+//     姝や唬鐮佺敱宸ュ叿鐢熸垚銆�
+//     杩愯鏃剁増鏈�:4.0.30319.42000
+//
+//     瀵规鏂囦欢鐨勬洿鏀瑰彲鑳戒細瀵艰嚧涓嶆纭殑琛屼负锛屽苟涓斿鏋�
+//     閲嶆柊鐢熸垚浠g爜锛岃繖浜涙洿鏀瑰皢浼氫涪澶便��
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+// 
+// 姝ゆ簮浠g爜鏄敱 Microsoft.VSDesigner 4.0.30319.42000 鐗堣嚜鍔ㄧ敓鎴愩��
+// 
+#pragma warning disable 1591
+
+namespace DataexchangeServer.WebReferenceLD {
+    using System.Diagnostics;
+    using System;
+    using System.Xml.Serialization;
+    using System.ComponentModel;
+    using System.Web.Services.Protocols;
+    using System.Web.Services;
+    
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.4084.0")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Web.Services.WebServiceBindingAttribute(Name="UserServiceImplPortBinding", Namespace="K3cloudInterface")]
+    [System.Xml.Serialization.XmlIncludeAttribute(typeof(BodyResponse))]
+    [System.Xml.Serialization.XmlIncludeAttribute(typeof(Body))]
+    public partial class UserServiceImplService : System.Web.Services.Protocols.SoapHttpClientProtocol {
+        
+        private System.Threading.SendOrPostCallback BodyOperationCompleted;
+        
+        private bool useDefaultCredentialsSetExplicitly;
+        
+        /// <remarks/>
+        public UserServiceImplService() {
+            this.Url = global::DataexchangeServer.Properties.Settings.Default.DataexchangeServer_WebReferenceLD_UserServiceImplService;
+            if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
+                this.UseDefaultCredentials = true;
+                this.useDefaultCredentialsSetExplicitly = false;
+            }
+            else {
+                this.useDefaultCredentialsSetExplicitly = true;
+            }
+        }
+        
+        public new string Url {
+            get {
+                return base.Url;
+            }
+            set {
+                if ((((this.IsLocalFileSystemWebService(base.Url) == true) 
+                            && (this.useDefaultCredentialsSetExplicitly == false)) 
+                            && (this.IsLocalFileSystemWebService(value) == false))) {
+                    base.UseDefaultCredentials = false;
+                }
+                base.Url = value;
+            }
+        }
+        
+        public new bool UseDefaultCredentials {
+            get {
+                return base.UseDefaultCredentials;
+            }
+            set {
+                base.UseDefaultCredentials = value;
+                this.useDefaultCredentialsSetExplicitly = true;
+            }
+        }
+        
+        /// <remarks/>
+        public event BodyCompletedEventHandler BodyCompleted;
+        
+        /// <remarks/>
+        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="K3cloudInterface", ResponseNamespace="K3cloudInterface", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+        [return: System.Xml.Serialization.XmlElementAttribute("return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public resp Body([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] user arg0) {
+            object[] results = this.Invoke("Body", new object[] {
+                        arg0});
+            return ((resp)(results[0]));
+        }
+        
+        /// <remarks/>
+        public void BodyAsync(user arg0) {
+            this.BodyAsync(arg0, null);
+        }
+        
+        /// <remarks/>
+        public void BodyAsync(user arg0, object userState) {
+            if ((this.BodyOperationCompleted == null)) {
+                this.BodyOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBodyOperationCompleted);
+            }
+            this.InvokeAsync("Body", new object[] {
+                        arg0}, this.BodyOperationCompleted, userState);
+        }
+        
+        private void OnBodyOperationCompleted(object arg) {
+            if ((this.BodyCompleted != null)) {
+                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
+                this.BodyCompleted(this, new BodyCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
+            }
+        }
+        
+        /// <remarks/>
+        public new void CancelAsync(object userState) {
+            base.CancelAsync(userState);
+        }
+        
+        private bool IsLocalFileSystemWebService(string url) {
+            if (((url == null) 
+                        || (url == string.Empty))) {
+                return false;
+            }
+            System.Uri wsUri = new System.Uri(url);
+            if (((wsUri.Port >= 1024) 
+                        && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
+                return true;
+            }
+            return false;
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="K3cloudInterface")]
+    public partial class user {
+        
+        private string categoryField;
+        
+        private string dataField;
+        
+        private string opField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string category {
+            get {
+                return this.categoryField;
+            }
+            set {
+                this.categoryField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string data {
+            get {
+                return this.dataField;
+            }
+            set {
+                this.dataField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string op {
+            get {
+                return this.opField;
+            }
+            set {
+                this.opField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="K3cloudInterface")]
+    public partial class BodyResponse {
+        
+        private resp returnField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public resp @return {
+            get {
+                return this.returnField;
+            }
+            set {
+                this.returnField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="K3cloudInterface")]
+    public partial class resp {
+        
+        private int codeField;
+        
+        private object dataField;
+        
+        private string msgField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public int code {
+            get {
+                return this.codeField;
+            }
+            set {
+                this.codeField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public object data {
+            get {
+                return this.dataField;
+            }
+            set {
+                this.dataField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string msg {
+            get {
+                return this.msgField;
+            }
+            set {
+                this.msgField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="K3cloudInterface")]
+    public partial class Body {
+        
+        private user arg0Field;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public user arg0 {
+            get {
+                return this.arg0Field;
+            }
+            set {
+                this.arg0Field = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.4084.0")]
+    public delegate void BodyCompletedEventHandler(object sender, BodyCompletedEventArgs e);
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.4084.0")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    public partial class BodyCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+        
+        private object[] results;
+        
+        internal BodyCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
+                base(exception, cancelled, userState) {
+            this.results = results;
+        }
+        
+        /// <remarks/>
+        public resp Result {
+            get {
+                this.RaiseExceptionIfNecessary();
+                return ((resp)(this.results[0]));
+            }
+        }
+    }
+}
+
+#pragma warning restore 1591
\ No newline at end of file
diff --git a/Web References/WebReferenceLD/Reference.map b/Web References/WebReferenceLD/Reference.map
new file mode 100644
index 0000000..da339df
--- /dev/null
+++ b/Web References/WebReferenceLD/Reference.map
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<DiscoveryClientResultsFile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <Results>
+    <DiscoveryClientResult referenceType="System.Web.Services.Discovery.SchemaReference" url="http://36.134.102.119:9998/ykd/api?xsd=1" filename="api.xsd" />
+    <DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://36.134.102.119:9998/ykd/api?wsdl" filename="UserServiceImplService.wsdl" />
+  </Results>
+</DiscoveryClientResultsFile>
\ No newline at end of file
diff --git a/Web References/WebReferenceLD/UserServiceImplService.wsdl b/Web References/WebReferenceLD/UserServiceImplService.wsdl
new file mode 100644
index 0000000..484bd7c
--- /dev/null
+++ b/Web References/WebReferenceLD/UserServiceImplService.wsdl
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<definitions xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="K3cloudInterface" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="UserServiceImplService" targetNamespace="K3cloudInterface" xmlns="http://schemas.xmlsoap.org/wsdl/">
+  <types>
+    <xsd:schema>
+      <xsd:import schemaLocation="http://36.134.102.119:9998/ykd/api?xsd=1" namespace="K3cloudInterface" />
+    </xsd:schema>
+  </types>
+  <message name="Body">
+    <part name="parameters" element="tns:Body" />
+  </message>
+  <message name="BodyResponse">
+    <part name="parameters" element="tns:BodyResponse" />
+  </message>
+  <portType name="UserServiceImpl">
+    <operation name="Body">
+      <input wsam:Action="K3cloudInterface/UserServiceImpl/BodyRequest" message="tns:Body" />
+      <output wsam:Action="K3cloudInterface/UserServiceImpl/BodyResponse" message="tns:BodyResponse" />
+    </operation>
+  </portType>
+  <binding name="UserServiceImplPortBinding" type="tns:UserServiceImpl">
+    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+    <operation name="Body">
+      <soap:operation soapAction="" />
+      <input>
+        <soap:body use="literal" />
+      </input>
+      <output>
+        <soap:body use="literal" />
+      </output>
+    </operation>
+  </binding>
+  <service name="UserServiceImplService">
+    <port name="UserServiceImplPort" binding="tns:UserServiceImplPortBinding">
+      <soap:address location="http://36.134.102.119:9998/ykd/api" />
+    </port>
+  </service>
+</definitions>
\ No newline at end of file
diff --git a/Web References/WebReferenceLD/api.xsd b/Web References/WebReferenceLD/api.xsd
new file mode 100644
index 0000000..aa89c01
--- /dev/null
+++ b/Web References/WebReferenceLD/api.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:tns="K3cloudInterface" targetNamespace="K3cloudInterface" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="Body" type="tns:Body" />
+  <xs:element name="BodyResponse" type="tns:BodyResponse" />
+  <xs:complexType name="Body">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="arg0" type="tns:user" />
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="user">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="category" type="xs:string" />
+      <xs:element minOccurs="0" name="data" type="xs:string" />
+      <xs:element minOccurs="0" name="op" type="xs:string" />
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="BodyResponse">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="return" type="tns:resp" />
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="resp">
+    <xs:sequence>
+      <xs:element name="code" type="xs:int" />
+      <xs:element minOccurs="0" name="data" type="xs:anyType" />
+      <xs:element minOccurs="0" name="msg" type="xs:string" />
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>
\ No newline at end of file
diff --git a/Web References/WebReferenceLD/resp.datasource b/Web References/WebReferenceLD/resp.datasource
new file mode 100644
index 0000000..ccb9fb4
--- /dev/null
+++ b/Web References/WebReferenceLD/resp.datasource
@@ -0,0 +1,10 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<!--
+    This file is automatically generated by Visual Studio .Net. It is 
+    used to store generic object data source configuration information.  
+    Renaming the file extension or editing the content of this file may   
+    cause the file to be unrecognizable by the program.
+-->
+<GenericObjectDataSource DisplayName="resp" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
+   <TypeInfo>DataexchangeServer.WebReferenceLD.resp, Web References.WebReferenceLD.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
+</GenericObjectDataSource>
\ No newline at end of file
diff --git a/Web References/WebReferenceLD1/Reference.cs b/Web References/WebReferenceLD1/Reference.cs
new file mode 100644
index 0000000..9798fc7
--- /dev/null
+++ b/Web References/WebReferenceLD1/Reference.cs
@@ -0,0 +1,293 @@
+锘�//------------------------------------------------------------------------------
+// <auto-generated>
+//     姝や唬鐮佺敱宸ュ叿鐢熸垚銆�
+//     杩愯鏃剁増鏈�:4.0.30319.42000
+//
+//     瀵规鏂囦欢鐨勬洿鏀瑰彲鑳戒細瀵艰嚧涓嶆纭殑琛屼负锛屽苟涓斿鏋�
+//     閲嶆柊鐢熸垚浠g爜锛岃繖浜涙洿鏀瑰皢浼氫涪澶便��
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+// 
+// 姝ゆ簮浠g爜鏄敱 Microsoft.VSDesigner 4.0.30319.42000 鐗堣嚜鍔ㄧ敓鎴愩��
+// 
+#pragma warning disable 1591
+
+namespace DataexchangeServer.WebReferenceLD1 {
+    using System.Diagnostics;
+    using System;
+    using System.Xml.Serialization;
+    using System.ComponentModel;
+    using System.Web.Services.Protocols;
+    using System.Web.Services;
+    
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.4084.0")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Web.Services.WebServiceBindingAttribute(Name="UserServiceImplPortBinding", Namespace="K3cloudInterface")]
+    [System.Xml.Serialization.XmlIncludeAttribute(typeof(BodyResponse))]
+    [System.Xml.Serialization.XmlIncludeAttribute(typeof(Body))]
+    public partial class UserServiceImplService : System.Web.Services.Protocols.SoapHttpClientProtocol {
+        
+        private System.Threading.SendOrPostCallback BodyOperationCompleted;
+        
+        private bool useDefaultCredentialsSetExplicitly;
+        
+        /// <remarks/>
+        public UserServiceImplService() {
+            this.Url = global::DataexchangeServer.Properties.Settings.Default.DataexchangeServer_WebReferenceLD1_UserServiceImplService;
+            if ((this.IsLocalFileSystemWebService(this.Url) == true)) {
+                this.UseDefaultCredentials = true;
+                this.useDefaultCredentialsSetExplicitly = false;
+            }
+            else {
+                this.useDefaultCredentialsSetExplicitly = true;
+            }
+        }
+        
+        public new string Url {
+            get {
+                return base.Url;
+            }
+            set {
+                if ((((this.IsLocalFileSystemWebService(base.Url) == true) 
+                            && (this.useDefaultCredentialsSetExplicitly == false)) 
+                            && (this.IsLocalFileSystemWebService(value) == false))) {
+                    base.UseDefaultCredentials = false;
+                }
+                base.Url = value;
+            }
+        }
+        
+        public new bool UseDefaultCredentials {
+            get {
+                return base.UseDefaultCredentials;
+            }
+            set {
+                base.UseDefaultCredentials = value;
+                this.useDefaultCredentialsSetExplicitly = true;
+            }
+        }
+        
+        /// <remarks/>
+        public event BodyCompletedEventHandler BodyCompleted;
+        
+        /// <remarks/>
+        [System.Web.Services.Protocols.SoapDocumentMethodAttribute("", RequestNamespace="K3cloudInterface", ResponseNamespace="K3cloudInterface", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
+        [return: System.Xml.Serialization.XmlElementAttribute("return", Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public resp Body([System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)] user arg0) {
+            object[] results = this.Invoke("Body", new object[] {
+                        arg0});
+            return ((resp)(results[0]));
+        }
+        
+        /// <remarks/>
+        public void BodyAsync(user arg0) {
+            this.BodyAsync(arg0, null);
+        }
+        
+        /// <remarks/>
+        public void BodyAsync(user arg0, object userState) {
+            if ((this.BodyOperationCompleted == null)) {
+                this.BodyOperationCompleted = new System.Threading.SendOrPostCallback(this.OnBodyOperationCompleted);
+            }
+            this.InvokeAsync("Body", new object[] {
+                        arg0}, this.BodyOperationCompleted, userState);
+        }
+        
+        private void OnBodyOperationCompleted(object arg) {
+            if ((this.BodyCompleted != null)) {
+                System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg));
+                this.BodyCompleted(this, new BodyCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
+            }
+        }
+        
+        /// <remarks/>
+        public new void CancelAsync(object userState) {
+            base.CancelAsync(userState);
+        }
+        
+        private bool IsLocalFileSystemWebService(string url) {
+            if (((url == null) 
+                        || (url == string.Empty))) {
+                return false;
+            }
+            System.Uri wsUri = new System.Uri(url);
+            if (((wsUri.Port >= 1024) 
+                        && (string.Compare(wsUri.Host, "localHost", System.StringComparison.OrdinalIgnoreCase) == 0))) {
+                return true;
+            }
+            return false;
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="K3cloudInterface")]
+    public partial class user {
+        
+        private string categoryField;
+        
+        private string dataField;
+        
+        private string opField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string category {
+            get {
+                return this.categoryField;
+            }
+            set {
+                this.categoryField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string data {
+            get {
+                return this.dataField;
+            }
+            set {
+                this.dataField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string op {
+            get {
+                return this.opField;
+            }
+            set {
+                this.opField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="K3cloudInterface")]
+    public partial class BodyResponse {
+        
+        private resp returnField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public resp @return {
+            get {
+                return this.returnField;
+            }
+            set {
+                this.returnField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="K3cloudInterface")]
+    public partial class resp {
+        
+        private int codeField;
+        
+        private object dataField;
+        
+        private string msgField;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public int code {
+            get {
+                return this.codeField;
+            }
+            set {
+                this.codeField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public object data {
+            get {
+                return this.dataField;
+            }
+            set {
+                this.dataField = value;
+            }
+        }
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public string msg {
+            get {
+                return this.msgField;
+            }
+            set {
+                this.msgField = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.8.4084.0")]
+    [System.SerializableAttribute()]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    [System.Xml.Serialization.XmlTypeAttribute(Namespace="K3cloudInterface")]
+    public partial class Body {
+        
+        private user arg0Field;
+        
+        /// <remarks/>
+        [System.Xml.Serialization.XmlElementAttribute(Form=System.Xml.Schema.XmlSchemaForm.Unqualified)]
+        public user arg0 {
+            get {
+                return this.arg0Field;
+            }
+            set {
+                this.arg0Field = value;
+            }
+        }
+    }
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.4084.0")]
+    public delegate void BodyCompletedEventHandler(object sender, BodyCompletedEventArgs e);
+    
+    /// <remarks/>
+    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Web.Services", "4.8.4084.0")]
+    [System.Diagnostics.DebuggerStepThroughAttribute()]
+    [System.ComponentModel.DesignerCategoryAttribute("code")]
+    public partial class BodyCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+        
+        private object[] results;
+        
+        internal BodyCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : 
+                base(exception, cancelled, userState) {
+            this.results = results;
+        }
+        
+        /// <remarks/>
+        public resp Result {
+            get {
+                this.RaiseExceptionIfNecessary();
+                return ((resp)(this.results[0]));
+            }
+        }
+    }
+}
+
+#pragma warning restore 1591
\ No newline at end of file
diff --git a/Web References/WebReferenceLD1/Reference.map b/Web References/WebReferenceLD1/Reference.map
new file mode 100644
index 0000000..da339df
--- /dev/null
+++ b/Web References/WebReferenceLD1/Reference.map
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<DiscoveryClientResultsFile xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+  <Results>
+    <DiscoveryClientResult referenceType="System.Web.Services.Discovery.SchemaReference" url="http://36.134.102.119:9998/ykd/api?xsd=1" filename="api.xsd" />
+    <DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://36.134.102.119:9998/ykd/api?wsdl" filename="UserServiceImplService.wsdl" />
+  </Results>
+</DiscoveryClientResultsFile>
\ No newline at end of file
diff --git a/Web References/WebReferenceLD1/UserServiceImplService.wsdl b/Web References/WebReferenceLD1/UserServiceImplService.wsdl
new file mode 100644
index 0000000..484bd7c
--- /dev/null
+++ b/Web References/WebReferenceLD1/UserServiceImplService.wsdl
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<definitions xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="K3cloudInterface" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" name="UserServiceImplService" targetNamespace="K3cloudInterface" xmlns="http://schemas.xmlsoap.org/wsdl/">
+  <types>
+    <xsd:schema>
+      <xsd:import schemaLocation="http://36.134.102.119:9998/ykd/api?xsd=1" namespace="K3cloudInterface" />
+    </xsd:schema>
+  </types>
+  <message name="Body">
+    <part name="parameters" element="tns:Body" />
+  </message>
+  <message name="BodyResponse">
+    <part name="parameters" element="tns:BodyResponse" />
+  </message>
+  <portType name="UserServiceImpl">
+    <operation name="Body">
+      <input wsam:Action="K3cloudInterface/UserServiceImpl/BodyRequest" message="tns:Body" />
+      <output wsam:Action="K3cloudInterface/UserServiceImpl/BodyResponse" message="tns:BodyResponse" />
+    </operation>
+  </portType>
+  <binding name="UserServiceImplPortBinding" type="tns:UserServiceImpl">
+    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
+    <operation name="Body">
+      <soap:operation soapAction="" />
+      <input>
+        <soap:body use="literal" />
+      </input>
+      <output>
+        <soap:body use="literal" />
+      </output>
+    </operation>
+  </binding>
+  <service name="UserServiceImplService">
+    <port name="UserServiceImplPort" binding="tns:UserServiceImplPortBinding">
+      <soap:address location="http://36.134.102.119:9998/ykd/api" />
+    </port>
+  </service>
+</definitions>
\ No newline at end of file
diff --git a/Web References/WebReferenceLD1/api.xsd b/Web References/WebReferenceLD1/api.xsd
new file mode 100644
index 0000000..aa89c01
--- /dev/null
+++ b/Web References/WebReferenceLD1/api.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:tns="K3cloudInterface" targetNamespace="K3cloudInterface" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="Body" type="tns:Body" />
+  <xs:element name="BodyResponse" type="tns:BodyResponse" />
+  <xs:complexType name="Body">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="arg0" type="tns:user" />
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="user">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="category" type="xs:string" />
+      <xs:element minOccurs="0" name="data" type="xs:string" />
+      <xs:element minOccurs="0" name="op" type="xs:string" />
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="BodyResponse">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="return" type="tns:resp" />
+    </xs:sequence>
+  </xs:complexType>
+  <xs:complexType name="resp">
+    <xs:sequence>
+      <xs:element name="code" type="xs:int" />
+      <xs:element minOccurs="0" name="data" type="xs:anyType" />
+      <xs:element minOccurs="0" name="msg" type="xs:string" />
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>
\ No newline at end of file
diff --git a/Web References/WebReferenceLD1/resp.datasource b/Web References/WebReferenceLD1/resp.datasource
new file mode 100644
index 0000000..1bc1211
--- /dev/null
+++ b/Web References/WebReferenceLD1/resp.datasource
@@ -0,0 +1,10 @@
+锘�<?xml version="1.0" encoding="utf-8"?>
+<!--
+    This file is automatically generated by Visual Studio .Net. It is 
+    used to store generic object data source configuration information.  
+    Renaming the file extension or editing the content of this file may   
+    cause the file to be unrecognizable by the program.
+-->
+<GenericObjectDataSource DisplayName="resp" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
+   <TypeInfo>DataexchangeServer.WebReferenceLD1.resp, Web References.WebReferenceLD1.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
+</GenericObjectDataSource>
\ No newline at end of file
diff --git a/frmMain.Designer.cs b/frmMain.Designer.cs
new file mode 100644
index 0000000..ef37a4a
--- /dev/null
+++ b/frmMain.Designer.cs
@@ -0,0 +1,371 @@
+锘縩amespace DataexchangeServer
+{
+    partial class frmMain
+    {
+        /// <summary>
+        /// 蹇呴渶鐨勮璁″櫒鍙橀噺銆�
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// 娓呯悊鎵�鏈夋鍦ㄤ娇鐢ㄧ殑璧勬簮銆�
+        /// </summary>
+        /// <param name="disposing">濡傛灉搴旈噴鏀炬墭绠¤祫婧愶紝涓� true锛涘惁鍒欎负 false銆�</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows 绐椾綋璁捐鍣ㄧ敓鎴愮殑浠g爜
+
+        /// <summary>
+        /// 璁捐鍣ㄦ敮鎸佹墍闇�鐨勬柟娉� - 涓嶈
+        /// 浣跨敤浠g爜缂栬緫鍣ㄤ慨鏀规鏂规硶鐨勫唴瀹广��
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.components = new System.ComponentModel.Container();
+            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmMain));
+            this.timer = new System.Windows.Forms.Timer(this.components);
+            this.showInTaskbar = new System.Windows.Forms.ToolStripMenuItem();
+            this.lblTotalTimes = new System.Windows.Forms.Label();
+            this.lsbErrorMsg = new System.Windows.Forms.ListBox();
+            this.label5 = new System.Windows.Forms.Label();
+            this.nudminThreads = new System.Windows.Forms.NumericUpDown();
+            this.label1 = new System.Windows.Forms.Label();
+            this.nudmaxThreads = new System.Windows.Forms.NumericUpDown();
+            this.label2 = new System.Windows.Forms.Label();
+            this.timeInterval = new System.Windows.Forms.NumericUpDown();
+            this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
+            this.exitWindow = new System.Windows.Forms.ToolStripMenuItem();
+            this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
+            this.rtbStatus = new System.Windows.Forms.ListBox();
+            this.groupBox2 = new System.Windows.Forms.GroupBox();
+            this.btnStop = new System.Windows.Forms.Button();
+            this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.lsbPoolState = new System.Windows.Forms.ListBox();
+            this.btnStart = new System.Windows.Forms.Button();
+            this.groupBox3 = new System.Windows.Forms.GroupBox();
+            this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+            ((System.ComponentModel.ISupportInitialize)(this.nudminThreads)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.nudmaxThreads)).BeginInit();
+            ((System.ComponentModel.ISupportInitialize)(this.timeInterval)).BeginInit();
+            this.contextMenuStrip1.SuspendLayout();
+            this.groupBox2.SuspendLayout();
+            this.groupBox1.SuspendLayout();
+            this.groupBox3.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
+            this.splitContainer1.Panel1.SuspendLayout();
+            this.splitContainer1.Panel2.SuspendLayout();
+            this.splitContainer1.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // timer
+            // 
+            this.timer.Interval = 5000;
+            // 
+            // showInTaskbar
+            // 
+            this.showInTaskbar.Name = "showInTaskbar";
+            this.showInTaskbar.Size = new System.Drawing.Size(108, 24);
+            this.showInTaskbar.Text = "鏄剧ず";
+            // 
+            // lblTotalTimes
+            // 
+            this.lblTotalTimes.AutoSize = true;
+            this.lblTotalTimes.Font = new System.Drawing.Font("瀹嬩綋", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.lblTotalTimes.Location = new System.Drawing.Point(21, 101);
+            this.lblTotalTimes.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.lblTotalTimes.Name = "lblTotalTimes";
+            this.lblTotalTimes.Size = new System.Drawing.Size(88, 15);
+            this.lblTotalTimes.TabIndex = 11;
+            this.lblTotalTimes.Text = "TotalTime";
+            // 
+            // lsbErrorMsg
+            // 
+            this.lsbErrorMsg.FormattingEnabled = true;
+            this.lsbErrorMsg.ItemHeight = 15;
+            this.lsbErrorMsg.Location = new System.Drawing.Point(8, 130);
+            this.lsbErrorMsg.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.lsbErrorMsg.Name = "lsbErrorMsg";
+            this.lsbErrorMsg.Size = new System.Drawing.Size(580, 109);
+            this.lsbErrorMsg.TabIndex = 10;
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Font = new System.Drawing.Font("瀹嬩綋", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label5.Location = new System.Drawing.Point(411, 75);
+            this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(87, 15);
+            this.label5.TabIndex = 2;
+            this.label5.Text = "鏈�灏忕嚎绋嬫暟";
+            // 
+            // nudminThreads
+            // 
+            this.nudminThreads.Enabled = false;
+            this.nudminThreads.Font = new System.Drawing.Font("瀹嬩綋", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.nudminThreads.Location = new System.Drawing.Point(508, 70);
+            this.nudminThreads.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.nudminThreads.Name = "nudminThreads";
+            this.nudminThreads.Size = new System.Drawing.Size(81, 25);
+            this.nudminThreads.TabIndex = 3;
+            this.nudminThreads.Value = new decimal(new int[] {
+            5,
+            0,
+            0,
+            0});
+            // 
+            // label1
+            // 
+            this.label1.AutoSize = true;
+            this.label1.Font = new System.Drawing.Font("瀹嬩綋", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label1.Location = new System.Drawing.Point(411, 108);
+            this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label1.Name = "label1";
+            this.label1.Size = new System.Drawing.Size(87, 15);
+            this.label1.TabIndex = 4;
+            this.label1.Text = "鏈�澶х嚎绋嬫暟";
+            // 
+            // nudmaxThreads
+            // 
+            this.nudmaxThreads.Enabled = false;
+            this.nudmaxThreads.Font = new System.Drawing.Font("瀹嬩綋", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.nudmaxThreads.Location = new System.Drawing.Point(508, 101);
+            this.nudmaxThreads.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.nudmaxThreads.Name = "nudmaxThreads";
+            this.nudmaxThreads.Size = new System.Drawing.Size(81, 25);
+            this.nudmaxThreads.TabIndex = 5;
+            this.nudmaxThreads.Value = new decimal(new int[] {
+            15,
+            0,
+            0,
+            0});
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Font = new System.Drawing.Font("瀹嬩綋", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label2.Location = new System.Drawing.Point(393, 44);
+            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(107, 15);
+            this.label2.TabIndex = 6;
+            this.label2.Text = "鎵ц棰戠巼(ms)";
+            // 
+            // timeInterval
+            // 
+            this.timeInterval.Enabled = false;
+            this.timeInterval.Font = new System.Drawing.Font("瀹嬩綋", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.timeInterval.Location = new System.Drawing.Point(508, 39);
+            this.timeInterval.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.timeInterval.Maximum = new decimal(new int[] {
+            10000,
+            0,
+            0,
+            0});
+            this.timeInterval.Name = "timeInterval";
+            this.timeInterval.Size = new System.Drawing.Size(81, 25);
+            this.timeInterval.TabIndex = 7;
+            this.timeInterval.Value = new decimal(new int[] {
+            10000,
+            0,
+            0,
+            0});
+            // 
+            // contextMenuStrip1
+            // 
+            this.contextMenuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
+            this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.showInTaskbar,
+            this.exitWindow});
+            this.contextMenuStrip1.Name = "contextMenuStrip1";
+            this.contextMenuStrip1.Size = new System.Drawing.Size(109, 52);
+            // 
+            // exitWindow
+            // 
+            this.exitWindow.Name = "exitWindow";
+            this.exitWindow.Size = new System.Drawing.Size(108, 24);
+            this.exitWindow.Text = "閫�鍑�";
+            // 
+            // notifyIcon1
+            // 
+            this.notifyIcon1.ContextMenuStrip = this.contextMenuStrip1;
+            this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
+            this.notifyIcon1.Text = "鎶�鐮旀柊闃虫柊鎶�鐢靛瓙鏈夐檺鍏徃";
+            this.notifyIcon1.Visible = true;
+            // 
+            // rtbStatus
+            // 
+            this.rtbStatus.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.rtbStatus.Font = new System.Drawing.Font("瀹嬩綋", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.rtbStatus.FormattingEnabled = true;
+            this.rtbStatus.ItemHeight = 17;
+            this.rtbStatus.Location = new System.Drawing.Point(4, 22);
+            this.rtbStatus.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.rtbStatus.Name = "rtbStatus";
+            this.rtbStatus.Size = new System.Drawing.Size(1087, 387);
+            this.rtbStatus.TabIndex = 2;
+            // 
+            // groupBox2
+            // 
+            this.groupBox2.Controls.Add(this.rtbStatus);
+            this.groupBox2.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.groupBox2.Location = new System.Drawing.Point(0, 0);
+            this.groupBox2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.groupBox2.Name = "groupBox2";
+            this.groupBox2.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.groupBox2.Size = new System.Drawing.Size(1095, 413);
+            this.groupBox2.TabIndex = 9;
+            this.groupBox2.TabStop = false;
+            this.groupBox2.Text = "绾跨▼鎵ц鐘舵��";
+            // 
+            // btnStop
+            // 
+            this.btnStop.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.btnStop.Location = new System.Drawing.Point(195, 24);
+            this.btnStop.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.btnStop.Name = "btnStop";
+            this.btnStop.Size = new System.Drawing.Size(145, 56);
+            this.btnStop.TabIndex = 9;
+            this.btnStop.Text = "鍋�    姝�(&S)";
+            this.btnStop.UseVisualStyleBackColor = true;
+            // 
+            // groupBox1
+            // 
+            this.groupBox1.Controls.Add(this.lsbPoolState);
+            this.groupBox1.Dock = System.Windows.Forms.DockStyle.Right;
+            this.groupBox1.Location = new System.Drawing.Point(594, 0);
+            this.groupBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.groupBox1.Name = "groupBox1";
+            this.groupBox1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.groupBox1.Size = new System.Drawing.Size(501, 198);
+            this.groupBox1.TabIndex = 8;
+            this.groupBox1.TabStop = false;
+            this.groupBox1.Text = "绾跨▼姹犵姸鎬�";
+            // 
+            // lsbPoolState
+            // 
+            this.lsbPoolState.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.lsbPoolState.Font = new System.Drawing.Font("瀹嬩綋", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.lsbPoolState.FormattingEnabled = true;
+            this.lsbPoolState.ItemHeight = 17;
+            this.lsbPoolState.Location = new System.Drawing.Point(4, 22);
+            this.lsbPoolState.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.lsbPoolState.Name = "lsbPoolState";
+            this.lsbPoolState.Size = new System.Drawing.Size(493, 172);
+            this.lsbPoolState.TabIndex = 8;
+            // 
+            // btnStart
+            // 
+            this.btnStart.Font = new System.Drawing.Font("瀹嬩綋", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.btnStart.Location = new System.Drawing.Point(24, 25);
+            this.btnStart.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.btnStart.Name = "btnStart";
+            this.btnStart.Size = new System.Drawing.Size(141, 56);
+            this.btnStart.TabIndex = 8;
+            this.btnStart.Text = "鍚�    鍔�(&B)";
+            this.btnStart.UseVisualStyleBackColor = true;
+            // 
+            // groupBox3
+            // 
+            this.groupBox3.Controls.Add(this.lblTotalTimes);
+            this.groupBox3.Controls.Add(this.lsbErrorMsg);
+            this.groupBox3.Controls.Add(this.label5);
+            this.groupBox3.Controls.Add(this.nudminThreads);
+            this.groupBox3.Controls.Add(this.label1);
+            this.groupBox3.Controls.Add(this.nudmaxThreads);
+            this.groupBox3.Controls.Add(this.label2);
+            this.groupBox3.Controls.Add(this.timeInterval);
+            this.groupBox3.Controls.Add(this.btnStop);
+            this.groupBox3.Controls.Add(this.btnStart);
+            this.groupBox3.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.groupBox3.Location = new System.Drawing.Point(0, 0);
+            this.groupBox3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.groupBox3.Name = "groupBox3";
+            this.groupBox3.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.groupBox3.Size = new System.Drawing.Size(594, 198);
+            this.groupBox3.TabIndex = 9;
+            this.groupBox3.TabStop = false;
+            this.groupBox3.Text = "鏈嶅姟璁剧疆";
+            // 
+            // splitContainer1
+            // 
+            this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
+            this.splitContainer1.Location = new System.Drawing.Point(0, 0);
+            this.splitContainer1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.splitContainer1.Name = "splitContainer1";
+            this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal;
+            // 
+            // splitContainer1.Panel1
+            // 
+            this.splitContainer1.Panel1.Controls.Add(this.groupBox3);
+            this.splitContainer1.Panel1.Controls.Add(this.groupBox1);
+            // 
+            // splitContainer1.Panel2
+            // 
+            this.splitContainer1.Panel2.Controls.Add(this.groupBox2);
+            this.splitContainer1.Size = new System.Drawing.Size(1095, 616);
+            this.splitContainer1.SplitterDistance = 198;
+            this.splitContainer1.SplitterWidth = 5;
+            this.splitContainer1.TabIndex = 1;
+            // 
+            // frmMain
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(1095, 616);
+            this.Controls.Add(this.splitContainer1);
+            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
+            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Name = "frmMain";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+            this.Text = "骞挎繁鏁版嵁浜ゆ崲鏈嶅姟";
+            ((System.ComponentModel.ISupportInitialize)(this.nudminThreads)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.nudmaxThreads)).EndInit();
+            ((System.ComponentModel.ISupportInitialize)(this.timeInterval)).EndInit();
+            this.contextMenuStrip1.ResumeLayout(false);
+            this.groupBox2.ResumeLayout(false);
+            this.groupBox1.ResumeLayout(false);
+            this.groupBox3.ResumeLayout(false);
+            this.groupBox3.PerformLayout();
+            this.splitContainer1.Panel1.ResumeLayout(false);
+            this.splitContainer1.Panel2.ResumeLayout(false);
+            ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+            this.splitContainer1.ResumeLayout(false);
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.Timer timer;
+        private System.Windows.Forms.ToolStripMenuItem showInTaskbar;
+        private System.Windows.Forms.Label lblTotalTimes;
+        private System.Windows.Forms.ListBox lsbErrorMsg;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.NumericUpDown nudminThreads;
+        private System.Windows.Forms.Label label1;
+        private System.Windows.Forms.NumericUpDown nudmaxThreads;
+        private System.Windows.Forms.Label label2;
+        private System.Windows.Forms.NumericUpDown timeInterval;
+        private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
+        private System.Windows.Forms.ToolStripMenuItem exitWindow;
+        private System.Windows.Forms.NotifyIcon notifyIcon1;
+        private System.Windows.Forms.ListBox rtbStatus;
+        private System.Windows.Forms.GroupBox groupBox2;
+        private System.Windows.Forms.Button btnStop;
+        private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.ListBox lsbPoolState;
+        private System.Windows.Forms.Button btnStart;
+        private System.Windows.Forms.GroupBox groupBox3;
+        private System.Windows.Forms.SplitContainer splitContainer1;
+    }
+}
+
diff --git a/frmMain.cs b/frmMain.cs
new file mode 100644
index 0000000..f5d7e0a
--- /dev/null
+++ b/frmMain.cs
@@ -0,0 +1,472 @@
+锘縰sing DataexchangeServer.Helper;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Configuration;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Threading;
+using System.Windows.Forms;
+
+namespace DataexchangeServer
+{  
+    public  delegate void AppendTextCallBack(string text);
+    public partial class frmMain : Form
+    {    
+        private SQLHelper _sqlHelper;
+        public List<Allocation> ListCount = new List<Allocation>();
+        public DateTime startTime;
+
+        #region 榛樿璧峰姩杞欢frmMain()
+        /// <summary>
+        /// 榛樿璧峰姩杞欢
+        /// </summary>
+        public frmMain()
+        {
+            InitializeComponent();
+            this.FormClosing += frmMain_FormClosing;
+            this.SizeChanged += frmMain_SizeChanged;
+            btnStart.Click += btnStart_Click;
+            btnStop.Click += btnStop_Click;
+            timer.Tick += timer_Tick;
+            notifyIcon1.DoubleClick += notifyIcon1_DoubleClick;
+            contextMenuStrip1.ItemClicked += contextMenuStrip1_ItemClicked;
+            Initialize();
+            //btnStart_Click(null, null);
+        }
+
+        void frmMain_FormClosing(object sender, FormClosingEventArgs e)
+        {
+            if (MessageBox.Show("浣犵‘瀹氳閫�鍑哄悧锛�", "骞挎繁杞欢", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
+            {
+                btnStop_Click(null, null);
+                System.Environment.Exit(0);   //閫�鍑烘墍鏈夌殑绾跨▼
+
+            }
+            else
+                e.Cancel = true;
+        } 
+        #endregion
+
+        #region 鍒濆鍖栨暟鎹� Initialize
+        /// <summary>
+        /// 鍒濆鍖栨暟鎹�
+        /// </summary>
+        void Initialize()
+        {
+            try
+            {
+                //BASE64鍔犺В瀵嗘柟寮�
+                //_sqlHelper = new SQLHelper(
+                //    Encoding.Default.GetString(Convert.FromBase64String(
+                //    ConfigurationManager.ConnectionStrings["conn"].ConnectionString)));
+                //Int32 TimingMailInterval =Convert.ToInt32(ConfigurationManager.AppSettings["TimingMailInterval"]);
+                //Int16 MaxThreads = Convert.ToInt16(ConfigurationManager.AppSettings["MaxThreads"]);
+                //Int16 MinThreads = Convert.ToInt16(ConfigurationManager.AppSettings["MinThreads"]);
+
+                string conn = ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
+                conn = SecurityHelper.Decrypt(conn);
+                _sqlHelper = new SQLHelper(conn);
+                Int32 TimingMailInterval = Convert.ToInt32(ConfigurationManager.AppSettings["TimingMailInterval"]);
+                Int16 MaxThreads = Convert.ToInt16(ConfigurationManager.AppSettings["MaxThreads"]);
+                Int16 MinThreads = Convert.ToInt16(ConfigurationManager.AppSettings["MinThreads"]);
+
+                string conText = ConfigurationManager.AppSettings["thisText"];
+                this.Text = conText;
+                notifyIcon1.Text = conText;
+
+                nudminThreads.Value = MinThreads;
+                nudmaxThreads.Value = MaxThreads;
+                timeInterval.Value = TimingMailInterval;
+                timer.Interval = TimingMailInterval;
+
+                //涓�瀹氳鍏堣瀹氭渶灏忕嚎绋嬫睜锛屽啀璁剧疆鏈�澶х嚎绋嬫睜锛屽惁鍒欒缃棤鏁�
+                ThreadPool.SetMinThreads(MinThreads, MinThreads);
+                ThreadPool.SetMaxThreads(MaxThreads, MaxThreads);
+                
+            }
+            catch (Exception exception)
+            {
+                MessageBox.Show(exception.Message);
+                Application.Exit();
+            }
+        }
+        #endregion
+
+        #region 杞鎵цvoid timer_Tick(object sender, EventArgs e)
+        /// <summary>
+        /// 杞鎵ц
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        void timer_Tick(object sender, EventArgs e)
+        {
+            if (btnStop.Enabled)
+            {
+                AllocationThread();
+                int Sleep = ListCount.Count(a => a.state == State.Sleep);
+                int Alive = ListCount.Count(a => a.state == State.Alive);
+                int Finish = ListCount.Count(a => a.state == State.Finish);
+                AddThreadPoolState(string.Format("鎺掗槦鐨勯槦鍒楁暟閲�:{0},姝e湪鎵ц鐨勯槦鍒�:{1},宸插畬鎴愮殑闃熷垪:{2}", Sleep, Alive, Finish));
+
+                var _list = ListCount.Where(a => a.state == State.Finish).ToList<Allocation>();
+                if (_list.Count > 500)
+                    ListCount.RemoveAll(a => a.state == State.Finish);
+                TimeSpan ts = DateTime.Now - startTime;
+                lblTotalTimes.Text = string.Format(@"Total Times : {0}澶﹞1}鏃秢2}鍒唟3}绉�", ts.Days, ts.Hours, ts.Minutes, ts.Seconds);
+
+            }
+        } 
+        #endregion
+
+        #region 璋冪敤绾跨▼鏂规硶 void AllocationThread()
+        /// <summary>
+        /// 璋冪敤绾跨▼鏂规硶
+        /// </summary>
+        public void AllocationThread()
+        {
+            //long s =(DateTime.Now - preTime).Seconds;
+            var _list = ListCount.Where(a => a.state == State.Alive || a.state == State.Sleep).ToList<Allocation>();
+
+            if (_list.Count > 0) return;
+
+            string msg = string.Empty;
+            try
+            {
+                msg = "query data 1 ;";
+                //preTime = DateTime.Now;
+                string sqlstr = string.Format(@";with cte as (
+	                                                    select top 1000
+	                                                    case when task_name in ('TB_ERPTOMES_BM',
+                                                                                'TB_ERPTOMES_GW',
+                                                                                'TB_ERPTOMES_RY',
+                                                                                'TB_ERPTOMES_WF',
+                                                                                'TB_ERPTOMES_WL',
+                                                                                'TB_ERPTOMES_KH',
+                                                                                'TB_ERPTOMES_GYS',
+                                                                                'TB_ERPTOMES_CK',
+                                                                                'TB_ERPTOMES_GX',
+                                                                                'TB_ERPTOMES_BOM',
+                                                                                'TB_ERPTOMES_TDL') then 1
+			                                                 when task_name in ('TB_ERPTOMES_XCK',
+                                                                                'TB_ERPTOMES_QCK',
+                                                                                'TB_ERPTOMES_TH',
+                                                                                'TB_ERPTOMES_CG',
+                                                                                'TB_ERPTOMES_FHTZ',
+                                                                                'TB_ERPTOMES_WW',
+                                                                                'TB_ERPTOMES_TL',
+                                                                                'TB_ERPTOMES_DW',
+                                                                                'TB_ERPTOMES_TH_CONFIRM',
+                                                                                'TB_ERPTOMES_GDRK',
+                                                                                'TB_ERPTOMES_WCK',
+                                                                                'TB_ERPTOMES_CGDH',
+                                                                                'TB_ERPTOME_KHWL') then 2
+                                                             when task_name in ('TB_MESTOERP_WGRK',
+                                                                                'TB_MESTOERP_WWRK',
+                                                                                'TB_MESTOERP_QTRK',
+                                                                                'TB_MESTOERP_CPRK',
+                                                                                'TB_MESTOERP_CGRK',
+                                                                                'TB_MESTOERP_XSCK',
+                                                                                'TB_MESTOERP_DD',
+                                                                                'TB_MESTOERP_PYPK',
+                                                                                'TB_MESTOERP_LL',
+                                                                                'TB_MESTOERP_SCTL',
+                                                                                'TB_MESTOERP_WGTL',
+                                                                                'TB_MESTOERP_WGTL',
+                                                                                'TB_MESTOERP_GDRK',
+                                                                                'TB_MESTOERP_ICMO',
+                                                                                'TB_MESTOERP_SLSH',
+                                                                                'TB_MESTOERP_SCDDXD',
+                                                                                'TB_MESTOERP_WLQDBB',
+                                                                                'TB_MESTOERP_TransferIn'
+                                                                                ) then 3
+			                                                    else 4 end gp,* 
+	                                                    from SYSDEC  WITH(nolock) where states='NEW'  AND   descript IN ('楂樺啿鐗╂枡鍙樻洿','鐗╂枡淇℃伅琛�','浠撳簱淇℃伅琛�','閮ㄩ棬淇℃伅琛�','鍛樺伐淇℃伅琛�','閮ㄩ棬淇℃伅琛�','棰嗘枡鍗�','鎴愬搧鍏ュ簱鍗�','閲囪喘鍏ュ簱鍗�','鐢熶骇璁㈠崟涓嬭揪','鐗╂枡瀹㈡埛瀵瑰簲琛�','閲囪喘璁㈠崟','鍙戣揣閫氱煡鍗�','閿�鍞嚭搴撳崟','鐢熶骇棰嗘枡鍗�','鍒嗘璋冨叆鍗�','鐢熶骇閫�鏂欏崟','鐩存帴璋冩嫧鍗�','鐢熶骇琛ユ枡鍗�','濮斿璁㈠崟','鍏朵粬鍏ュ簱鍗�','鍏朵粬鍑哄簱鍗�')
+                                                                --and task_name='TB_ERPTOMES_CG' 
+                                                        order by create_time
+														union all
+														  select top 10
+	                                                   3 gp,* 
+	                                                    from SYSDEC  WITH(nolock) where task_id IN  ( SELECT task_ID
+FROM (
+    SELECT task_ID, data, task_name, create_time,
+    ROW_NUMBER() OVER (PARTITION BY data, task_name ORDER BY create_time DESC) AS rn
+    FROM sysdec where  states='NEW' AND   descript IN ('鐢熶骇鎶曟枡鍗�')
+) AS SubQuery
+WHERE rn = 1)
+	                                                    union all
+	                                                    select top 1000
+	                                                    case when task_name in ('TB_ERPTOMES_BM',
+                                                                                'TB_ERPTOMES_GW',
+                                                                                'TB_ERPTOMES_RY',
+                                                                                'TB_ERPTOMES_WF',
+                                                                                'TB_ERPTOMES_WL',
+                                                                                'TB_ERPTOMES_KH',
+                                                                                'TB_ERPTOMES_GYS',
+                                                                                'TB_ERPTOMES_CK',
+                                                                                'TB_ERPTOMES_GX',
+                                                                                'TB_ERPTOMES_BOM',
+                                                                                'TB_ERPTOMES_TDL') then 1
+			                                                 when task_name in ('TB_ERPTOMES_XCK',
+                                                                                'TB_ERPTOMES_QCK',
+                                                                                'TB_ERPTOMES_TH',
+                                                                                'TB_ERPTOMES_CG',
+                                                                                'TB_ERPTOMES_FHTZ',
+                                                                                'TB_ERPTOMES_WW',
+                                                                                'TB_ERPTOMES_TL',
+                                                                                'TB_ERPTOMES_DW',
+                                                                                'TB_ERPTOMES_TH_CONFIRM',
+                                                                                'TB_ERPTOMES_GDRK',
+                                                                                'TB_ERPTOMES_WCK',
+                                                                                'TB_ERPTOMES_CGDH',
+                                                                                'TB_ERPTOME_KHWL') then 2
+                                                             when task_name in ('TB_MESTOERP_WGRK',
+                                                                                'TB_MESTOERP_WWRK',
+                                                                                'TB_MESTOERP_QTRK',
+                                                                                'TB_MESTOERP_CPRK',
+                                                                                'TB_MESTOERP_CGRK',
+                                                                                'TB_MESTOERP_XSCK',
+                                                                                'TB_MESTOERP_DD',
+                                                                                'TB_MESTOERP_PYPK',
+                                                                                'TB_MESTOERP_LL',
+                                                                                'TB_MESTOERP_SCTL',
+                                                                                'TB_MESTOERP_GDRK',
+                                                                                'TB_MESTOERP_ICMO',
+                                                                                'TB_MESTOERP_SLSH',
+                                                                                'TB_MESTOERP_SCDDXD',
+                                                                                'TB_MESTOERP_WLQDBB',
+                                                                                'TB_MESTOERP_TransferIn') then 3
+			                                                    else 4 end gp,* 
+	                                                    from SYSDEC  WITH(nolock) where states='FAIL' and retry_times<1 and CREATE_TIME>'2024-06-14 13:13:34'  AND descript IN ('楂樺啿鐗╂枡鍙樻洿','鐗╂枡淇℃伅琛�','浠撳簱淇℃伅琛�','閮ㄩ棬淇℃伅琛�','鍛樺伐淇℃伅琛�','鐢熶骇鎶曟枡鍗�','閮ㄩ棬淇℃伅琛�','棰嗘枡鍗�','鎴愬搧鍏ュ簱鍗�','閲囪喘鍏ュ簱鍗�','鐢熶骇璁㈠崟涓嬭揪','鐗╂枡瀹㈡埛瀵瑰簲琛�','閲囪喘璁㈠崟','鍙戣揣閫氱煡鍗�','閿�鍞嚭搴撳崟','鍒嗘璋冨叆鍗�','鐢熶骇棰嗘枡鍗�','鐢熶骇閫�鏂欏崟','鐢熶骇琛ユ枡鍗�')
+                                                                            and task_name not in ('TB_MESTOERP_WGRK',
+                                                                                                    'TB_MESTOERP_WWRK',
+                                                                                                    'TB_MESTOERP_QTRK',
+                                                                                                    'TB_MESTOERP_CPRK',
+                                                                                                    'TB_MESTOERP_CGRK',
+                                                                                                    'TB_MESTOERP_XSCK',
+                                                                                                    'TB_MESTOERP_DD',
+                                                                                                    'TB_MESTOERP_PYPK',
+                                                                                                    'TB_MESTOERP_LL',
+                                                                                                    'TB_MESTOERP_SCTL',
+                                                                                                    'TB_MESTOERP_ICMO',
+                                                                                                    'TB_MESTOERP_GDRK',
+                                                                                                    'TB_MESTOERP_SLSH',
+                                                                                                    'TB_MESTOERP_WLQDBB',
+                                                                                                    'TB_MESTOERP_TransferIn')
+                                                    )
+
+                                                    select rtrim(gp)+'-'+rtrim(rank() over(partition by gp order by data)) gcp,* from cte
+                                                    order by 1,create_time");
+
+
+                DataTable tbThread = _sqlHelper.ExecuteDataTable(sqlstr);
+                DataTable tbgroup = tbThread.DefaultView.ToTable(true, new string[1] { "gcp" }); //瀵圭嚎绋婭D杩涜鍒嗙粍 
+                msg = msg + "begin to allocation thread 2 ; ";
+                foreach (DataRow r in tbgroup.Rows)
+                {
+                    string gcp = r["gcp"].ToString();
+                    Allocation EQ = new Allocation();
+                    //EQ.task_id = r["task_id"].ToString();
+                    //EQ.ID = r["data"].ToString();
+                    EQ.strStartTime = DateTime.Now;
+                    EQ.Name = gcp;
+                    EQ.WriteLog += AddStatusText;
+                    EQ.WriteErrorLog += AddErrorText;
+                    SetTableByThreadID(gcp, tbThread, ref EQ.tbQueue);
+                    EQ.tbQueue.AcceptChanges();
+                    ListCount.Add(EQ);
+                    ThreadPool.QueueUserWorkItem(EQ.Execute);
+                }                
+            }
+            catch (Exception ex)
+            {
+                JSONHelper.WriteToFile(msg + " 璋冪敤绾跨▼鏃跺紓甯革細" + ex.Message);
+                AddErrorText(msg + " 璋冪敤绾跨▼鏃跺紓甯革細" + ex.Message);
+            }
+        } 
+        #endregion
+
+        #region 鏁版嵁琛屽鍒跺埌鏁版嵁琛ㄤ腑void SetTableByThreadID(string tid, DataTable dataTb, ref DataTable target)
+        /// <summary>
+        /// 鏁版嵁琛屽鍒跺埌鏁版嵁琛ㄤ腑
+        /// </summary>
+        /// <param name="tid"></param>
+        /// <param name="dataTb"></param>
+        /// <param name="target"></param>
+        private void SetTableByThreadID(string tid, DataTable dataTb, ref DataTable target)
+        {
+            DataRow[] rowsArray = dataTb.Select("gcp='" + tid + "'", "create_time");
+
+            if (rowsArray.Length == 0)
+                return;
+            target.Rows.Clear();
+            foreach (DataRow row in rowsArray)
+            {
+                DataRow newrow = target.NewRow();
+                foreach (DataColumn dc in dataTb.Columns)
+                {
+                    if ("gcp;gp".Contains(dc.ColumnName))
+                        continue;
+                    newrow[dc.ColumnName] = row[dc.ColumnName];
+                }
+                target.Rows.Add(newrow);
+            }
+        } 
+        #endregion
+
+        #region 鍚姩鏈嶅姟void btnStart_Click(object sender, EventArgs e)
+        /// <summary>
+        /// 鍚姩鏈嶅姟
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void btnStart_Click(object sender, EventArgs e)
+        {
+            ApiGlobal.Init();
+            AllocationThread();
+            btnStop.Enabled = true;
+            btnStart.Enabled = false;
+            timer.Enabled = false;
+            timer.Start();
+            startTime = DateTime.Now;
+        } 
+        #endregion
+
+        #region 鍋滄鏈嶅姟void btnStop_Click(object sender, EventArgs e)
+        /// <summary>
+        /// 鍋滄鏈嶅姟
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void btnStop_Click(object sender, EventArgs e)
+        {
+            btnStop.Enabled = false;
+            btnStart.Enabled = true;
+            timer.Stop();
+        } 
+        #endregion
+
+        #region 澧炲姞绾跨▼姹犱俊鎭痸oid AddThreadPoolState(string message)
+        /// <summary>
+        /// 澧炲姞绾跨▼姹犱俊鎭�
+        /// </summary>
+        /// <param name="message"></param>
+        private void AddThreadPoolState(string message)
+        {
+            if (lsbPoolState.InvokeRequired)
+            {
+                AppendTextCallBack method = AddThreadPoolState;
+                base.Invoke(method, new object[] { message });
+            }
+            else
+            {
+                if (lsbPoolState.Items.Count > 10)
+                {
+                    lsbPoolState.Items.Clear();
+                }
+                //lsbPoolState.Items.Add(string.Format(message));
+
+                lsbPoolState.Items.Insert(0, string.Format(message));
+                lsbPoolState.Width = 350;
+                lsbPoolState.ItemHeight = 10;
+            }
+        }
+        #endregion
+
+        #region 澧炲姞绾跨▼淇℃伅void AddStatusText(string message)
+        /// <summary>
+        /// 澧炲姞绾跨▼淇℃伅
+        /// </summary>
+        /// <param name="message"></param>
+        private void AddStatusText(string message)
+        {
+            if (rtbStatus.InvokeRequired)
+            {
+                AppendTextCallBack method = AddStatusText;
+                base.Invoke(method, new object[] { message });
+            }
+            else
+            {
+                if (rtbStatus.Items.Count > 30)
+                {
+                    rtbStatus.Items.Clear();
+                }
+                //rtbStatus.Items.Add(string.Format(message));
+                rtbStatus.Items.Insert(0, string.Format(message));
+                rtbStatus.Width = 600;
+                rtbStatus.ItemHeight = 100;
+            }
+        } 
+        #endregion
+
+        #region 澧炲姞閿欒淇℃伅void AddErrorText(string message)
+        /// <summary>
+        /// 澧炲姞閿欒淇℃伅
+        /// </summary>
+        /// <param name="message"></param>
+        private void AddErrorText(string message)
+        {
+            if (lsbErrorMsg.InvokeRequired)
+            {
+                AppendTextCallBack method = AddErrorText;
+                base.Invoke(method, new object[] { message });
+            }
+            else
+            {
+                if (lsbErrorMsg.Items.Count > 6)
+                {
+                    lsbErrorMsg.Items.Clear();
+                }
+                //lsbErrorMsg.Items.Add(string.Format(message));
+                lsbErrorMsg.Items.Insert(0, message);//string.Format(message)
+                lsbErrorMsg.Width = 600;
+                lsbErrorMsg.ItemHeight = 30;
+            }
+        } 
+        #endregion
+
+        #region        鎵樼洏绋嬪簭
+        void frmMain_SizeChanged(object sender, EventArgs e)
+        {
+            if(WindowState == FormWindowState.Minimized)
+            {
+                this.ShowInTaskbar = false;
+                notifyIcon1.Visible = true;
+            }
+        }
+
+        void notifyIcon1_DoubleClick(object sender, EventArgs e)
+        {
+            if(WindowState == FormWindowState.Minimized)
+            {
+                WindowState = FormWindowState.Normal;
+                this.Activate();
+                this.ShowInTaskbar = true;
+                notifyIcon1.Visible = false;
+            }
+        }
+
+        void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
+        {
+            if(e.ClickedItem == showInTaskbar)
+            {
+                if (WindowState == FormWindowState.Minimized)
+                {
+                    WindowState = FormWindowState.Normal;
+                    this.Activate();
+                    this.ShowInTaskbar = true;
+                    notifyIcon1.Visible = false;
+                }
+            }
+            else if (e.ClickedItem == exitWindow)
+            {
+                btnStop_Click(null, null);
+                System.Environment.Exit(0);   //閫�鍑烘墍鏈夌殑绾跨▼
+            }
+        }
+        #endregion
+    }
+}
diff --git a/frmMain.resx b/frmMain.resx
new file mode 100644
index 0000000..7017498
--- /dev/null
+++ b/frmMain.resx
@@ -0,0 +1,178 @@
+锘�<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <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" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </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" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <metadata name="timer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>25, 12</value>
+  </metadata>
+  <metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>108, 12</value>
+  </metadata>
+  <metadata name="notifyIcon1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>273, 12</value>
+  </metadata>
+  <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+  <data name="notifyIcon1.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAMMOAADDDgAAAAAAAAAA
+        AAD///////////z8/P/8/Pz///////z8/P+QkJD/BAQE/46Ojv//////+/v7///////9/f3//Pz8////
+        //////////////z8/P/+/v7//////7u7u/8oKCj/AAAA/wAAAP9ycnL//////4uLi/+hoaH///////7+
+        /v/8/Pz///////7+/v//////1dXV/0dHR/8AAAD/IiIi/7Kysv8ODg7/bGxs//////9YWFj/AAAA/0dH
+        R//U1NT///////7+/v//////eXl5/wAAAP8EBAT/gICA//z8/P/9/f3/DQ0N/2lpaf//////W1tb/wAA
+        AP8FBQX/AAAA/3x8fP//////+/v7/xoaGv8qKir/39/f///////g4OD/R0dH/wAAAP+JiYn//////1RU
+        VP8ICAj/3d3d/zg4OP8YGBj//Pz8//////8ZGRn/a2tr//////+enp7/AAAA/xYWFv+5ubn/////////
+        //9UVFT/EBAQ//////9wcHD/FxcX////////////GRkZ/2VlZf//////bm5u/1paWv//////lpaW/6ys
+        rP//////Wlpb/xISEv//////cXFx/xUVFf///////////xwcHP9qamr///////f39///////4ODg/wAA
+        AP95eXn//////+rq5v+vr67//////3Z2df8WFhb///////////8hISH/ampq///////29vb/g4OD/wMD
+        A/8SEhX/u7u9///////u7vz/9vb7//////93d3r/GBgY////////////JCQk/2dnZ//Gxsb/Ghoa/wAA
+        AP9iYmP/9PTu//7+//+UlPf/Cwvu/0RE7P/5+f//hIR9/xkZGv///////////zk5Of8AAAD/AAAA/ysr
+        Lf/Pz8v//////8HB+v8nJ+//AADu/zEx8f8AAOr/ISH//z4+lf8kJCL//v7///////87Ozv/AAAB/52d
+        mf//////5OT//05O8f8AAOv/Ly/x/7+/+///////z8/8/zk58v8AAO7/Y2PK/////P//////xsbH/9zc
+        2v/7+///fHz1/w0N7P8eHvD/pKT5//z8////////mpr4/7Cw+v//////ubn6//Pz//////////////39
+        ////////1NT5/x8f7/8AAO3/XV30///////i4v3/R0fz/wAA7P9ERPP//Pz////////9/f3/////////
+        ///9/f3//Pz9///////29v7/fn72/wQE7v8lJfH/Fhbv/xER7/+hofn///////7+///8/P///v7/////
+        ///////////////////+/v///f3////////MzPz/JSXx/1BQ8//r6/7///////39////////////////
+        ////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+        AAAAAAAAAAAAAA==
+</value>
+  </data>
+  <data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAQAAMMOAADDDgAAAAAAAAAA
+        AAD///////////z8/P/8/Pz///////z8/P+QkJD/BAQE/46Ojv//////+/v7///////9/f3//Pz8////
+        //////////////z8/P/+/v7//////7u7u/8oKCj/AAAA/wAAAP9ycnL//////4uLi/+hoaH///////7+
+        /v/8/Pz///////7+/v//////1dXV/0dHR/8AAAD/IiIi/7Kysv8ODg7/bGxs//////9YWFj/AAAA/0dH
+        R//U1NT///////7+/v//////eXl5/wAAAP8EBAT/gICA//z8/P/9/f3/DQ0N/2lpaf//////W1tb/wAA
+        AP8FBQX/AAAA/3x8fP//////+/v7/xoaGv8qKir/39/f///////g4OD/R0dH/wAAAP+JiYn//////1RU
+        VP8ICAj/3d3d/zg4OP8YGBj//Pz8//////8ZGRn/a2tr//////+enp7/AAAA/xYWFv+5ubn/////////
+        //9UVFT/EBAQ//////9wcHD/FxcX////////////GRkZ/2VlZf//////bm5u/1paWv//////lpaW/6ys
+        rP//////Wlpb/xISEv//////cXFx/xUVFf///////////xwcHP9qamr///////f39///////4ODg/wAA
+        AP95eXn//////+rq5v+vr67//////3Z2df8WFhb///////////8hISH/ampq///////29vb/g4OD/wMD
+        A/8SEhX/u7u9///////u7vz/9vb7//////93d3r/GBgY////////////JCQk/2dnZ//Gxsb/Ghoa/wAA
+        AP9iYmP/9PTu//7+//+UlPf/Cwvu/0RE7P/5+f//hIR9/xkZGv///////////zk5Of8AAAD/AAAA/ysr
+        Lf/Pz8v//////8HB+v8nJ+//AADu/zEx8f8AAOr/ISH//z4+lf8kJCL//v7///////87Ozv/AAAB/52d
+        mf//////5OT//05O8f8AAOv/Ly/x/7+/+///////z8/8/zk58v8AAO7/Y2PK/////P//////xsbH/9zc
+        2v/7+///fHz1/w0N7P8eHvD/pKT5//z8////////mpr4/7Cw+v//////ubn6//Pz//////////////39
+        ////////1NT5/x8f7/8AAO3/XV30///////i4v3/R0fz/wAA7P9ERPP//Pz////////9/f3/////////
+        ///9/f3//Pz9///////29v7/fn72/wQE7v8lJfH/Fhbv/xER7/+hofn///////7+///8/P///v7/////
+        ///////////////////+/v///f3////////MzPz/JSXx/1BQ8//r6/7///////39////////////////
+        ////////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
+        AAAAAAAAAAAAAA==
+</value>
+  </data>
+</root>
\ No newline at end of file

--
Gitblit v1.9.3