autorun 模板

This commit is contained in:
14278/caihao 2024-01-23 16:49:54 +08:00
parent 8defb91e77
commit 98f8fb4b2d
47 changed files with 77045 additions and 0 deletions

View File

@ -0,0 +1,30 @@
using System;
using System.Reflection;
using System.Runtime.InteropServices;
// 一般的組件資訊是由下列這組屬性所控制。
// 變更這些屬性的值即可修改組件的相關資訊。
// 檢閱組件屬性的值
[assembly: AssemblyTitle("AutoRunLib")]
[assembly: AssemblyDescription("AutoRunLib for MESSeries")]
[assembly: AssemblyCompany("iMES Technology Inc.")]
[assembly: AssemblyProduct("MESSeries 6")]
[assembly: AssemblyCopyright("Copyright © iMES Technology Inc.")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(true)]
// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
[assembly: Guid("C4620590-2AB6-4D4D-8D66-A8D689DA698C")]
// 組件的版本資訊由下列四個值所組成:
//
// 主要版本
// 次要版本
// 組建編號
// 修訂
//
// 您可以自行指定所有的值,也可以依照以下的方式,使用 '*' 將修訂和組建編號
// 指定為預設值:
[assembly: AssemblyVersion("6.0.0.0")]

View File

@ -0,0 +1,380 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<PropertyGroup>
<ProjectType>Local</ProjectType>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7C0468A8-E807-0FF4-0C04-C1AD9B3D7D2A}</ProjectGuid>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ApplicationIcon>
</ApplicationIcon>
<AssemblyKeyContainerName>
</AssemblyKeyContainerName>
<AssemblyName>AutoRunLib</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyMode>None</AssemblyOriginatorKeyMode>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>Library</OutputType>
<OptionCompare>Binary</OptionCompare>
<OptionExplicit>On</OptionExplicit>
<OptionStrict>Off</OptionStrict>
<RootNamespace>AutoRunLib</RootNamespace>
<StartupObject>
</StartupObject>
<WebReference_EnableProperties>true</WebReference_EnableProperties>
<WebReference_EnableSQLTypes>false</WebReference_EnableSQLTypes>
<WebReference_EnableLegacyEventingModel>true</WebReference_EnableLegacyEventingModel>
<FileUpgradeFlags>
</FileUpgradeFlags>
<MyType>Windows</MyType>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<SignAssembly>false</SignAssembly>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<OldToolsVersion>2.0</OldToolsVersion>
<PublishUrl>publish\</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>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<TargetFrameworkProfile />
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>..\..\..\MES_C_DLL\</OutputPath>
<DocumentationFile>..\..\..\MES_C_DLL\AutoRunLib.xml</DocumentationFile>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>
</DefineConstants>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<DebugSymbols>true</DebugSymbols>
<Optimize>false</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>0</WarningLevel>
<NoWarn>42016,42017,42018,42019,42032,42353,42354,42355</NoWarn>
<DebugType>full</DebugType>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>..\..\..\MES_C_DLL\</OutputPath>
<DocumentationFile>..\..\..\MES_C_DLL\
</DocumentationFile>
<BaseAddress>285212672</BaseAddress>
<ConfigurationOverrideFile>
</ConfigurationOverrideFile>
<DefineConstants>
</DefineConstants>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<DebugSymbols>false</DebugSymbols>
<Optimize>true</Optimize>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
<WarningLevel>0</WarningLevel>
<NoWarn>42016,42017,42018,42019,42032,42353,42354,42355</NoWarn>
<DebugType>none</DebugType>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>..\..\..\MES_C_DLL\</OutputPath>
<BaseAddress>285212672</BaseAddress>
<WarningLevel>0</WarningLevel>
<NoWarn>42016,42017,42018,42019,42032,42353,42354,42355</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisLogFile>..\..\..\MES_C_DLL\AutoRunLib.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<DefineTrace>true</DefineTrace>
<OutputPath>bin\x86\Release\</OutputPath>
<BaseAddress>285212672</BaseAddress>
<Optimize>true</Optimize>
<WarningLevel>0</WarningLevel>
<NoWarn>42016,42017,42018,42019,42032,42353,42354,42355</NoWarn>
<PlatformTarget>x86</PlatformTarget>
<CodeAnalysisLogFile>..\..\..\MES_C_DLL\AutoRunLib.dll.CodeAnalysisLog.xml</CodeAnalysisLogFile>
<CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
<CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<CodeAnalysisRuleSetDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\\Rule Sets</CodeAnalysisRuleSetDirectories>
<CodeAnalysisIgnoreBuiltInRuleSets>true</CodeAnalysisIgnoreBuiltInRuleSets>
<CodeAnalysisRuleDirectories>;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Team Tools\Static Analysis Tools\FxCop\\Rules</CodeAnalysisRuleDirectories>
<CodeAnalysisIgnoreBuiltInRules>true</CodeAnalysisIgnoreBuiltInRules>
<CodeAnalysisFailOnMissingRules>false</CodeAnalysisFailOnMissingRules>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="data_access_service, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_S_DLL\data_access_service.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="iMESAppSetting, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_S_DLL\iMESAppSetting.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="iMESChart_HtmlHandler">
<HintPath>..\..\..\MES_S_DLL\iMESChart_HtmlHandler.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="iMESComInvoke">
<HintPath>..\..\..\MES_S_DLL\iMESComInvoke.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="iMESComSubroutine">
<HintPath>..\..\..\MES_S_DLL\iMESComSubroutine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="iMESComXML">
<HintPath>..\..\..\MES_S_DLL\iMESComXML.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="iMESConst">
<HintPath>..\..\..\MES_S_DLL\iMESConst.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Ionic.Zip, Version=1.9.1.5, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_C_DLL\Ionic.Zip.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="GuardServerProvider, Version=0.9.0.0, Culture=neutral, PublicKeyToken=3ad2cfbf6a289680, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_S_DLL\GuardServerProvider.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="iMESCIO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3ad2cfbf6a289680, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_S_DLL\iMESCIO.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="iMESDAO">
<HintPath>..\..\..\MES_S_DLL\iMESDAO.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="iMESDataObject">
<HintPath>..\..\..\MES_S_DLL\iMESDataObject.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="iMESProjectBase">
<HintPath>..\..\..\MES_S_DLL\iMESProjectBase.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="NPOI, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_C_DLL\NPOI.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="NPOI.OOXML, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_C_DLL\NPOI.OOXML.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="NPOI.OpenXml4Net, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_C_DLL\NPOI.OpenXml4Net.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="NPOI.OpenXmlFormats, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_C_DLL\NPOI.OpenXmlFormats.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_S_DLL\Oracle.ManagedDataAccess.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.configuration" />
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Services">
<Name>System.Web.Services</Name>
</Reference>
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
</ItemGroup>
<ItemGroup>
<Import Include="COM_ERP.clsCommon" />
<Import Include="COM_ERP.clsWorkFlow" />
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
<Import Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="EAIMessageSynchronizer.cs" />
<Compile Include="Web References\wsERP_WorkFlow\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
<None Include="app.config" />
<None Include="My Project\Settings.settings">
<CustomToolNamespace>AutoRunLib.My</CustomToolNamespace>
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="Web References\wsERP_TP\Reference.map">
<Generator>MSDiscoCodeGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
<None Include="Web References\wsERP_TP\TIPTOPServiceGateWay.wsdl" />
<None Include="Web References\wsERP_TP_RPC\Reference.map">
<Generator>MSDiscoCodeGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
<None Include="Web References\wsERP_TP_RPC\TIPTOPServiceGateWay.wsdl" />
<Compile Include="AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="clsAutoRunLibrary.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="modAutoRunLibrary.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="modWIN.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="My Project\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="Web References\wsERP_TP\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
<Compile Include="Web References\wsERP_TP_RPC\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
<None Include="Web References\wsERP_WorkFlow\Reference.map">
<Generator>MSDiscoCodeGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
<None Include="Web References\wsERP_WorkFlow\WFMESService.wsdl" />
<WebReferenceUrl Include="http://10.40.30.73/WFMES/WFMESService.asmx">
<UrlBehavior>Dynamic</UrlBehavior>
<RelPath>Web References\wsERP_WorkFlow\</RelPath>
<UpdateFromURL>http://10.40.30.73/WFMES/WFMESService.asmx</UpdateFromURL>
<ServiceLocationURL>
</ServiceLocationURL>
<CachedDynamicPropName>
</CachedDynamicPropName>
<CachedAppSettingsObjectName>MySettings</CachedAppSettingsObjectName>
<CachedSettingsPropName>AutoRunLib_wsERP_WorkFlow_WFMESService</CachedSettingsPropName>
</WebReferenceUrl>
<WebReferenceUrl Include="http://localhost/ERPws_DSC/TIPTOPServiceGateWay.wsdl">
<UrlBehavior>Dynamic</UrlBehavior>
<RelPath>Web References\wsERP_TP\</RelPath>
<UpdateFromURL>http://localhost/ERPws_DSC/TIPTOPServiceGateWay.wsdl</UpdateFromURL>
<ServiceLocationURL>
</ServiceLocationURL>
<CachedDynamicPropName>
</CachedDynamicPropName>
<CachedAppSettingsObjectName>MySettings</CachedAppSettingsObjectName>
<CachedSettingsPropName>AutoRunLib_wsERP_TP_TIPTOPServiceGateWay</CachedSettingsPropName>
</WebReferenceUrl>
<WebReferenceUrl Include="http://localhost/ERPws_DSC/TIPTOPServiceGateWay_RPC.wsdl">
<UrlBehavior>Dynamic</UrlBehavior>
<RelPath>Web References\wsERP_TP_RPC\</RelPath>
<UpdateFromURL>http://localhost/ERPws_DSC/TIPTOPServiceGateWay_RPC.wsdl</UpdateFromURL>
<ServiceLocationURL>
</ServiceLocationURL>
<CachedDynamicPropName>
</CachedDynamicPropName>
<CachedAppSettingsObjectName>MySettings</CachedAppSettingsObjectName>
<CachedSettingsPropName>AutoRunLib_wsERP_TP_RPC_TIPTOPServiceGateWay</CachedSettingsPropName>
</WebReferenceUrl>
<WebReferences Include="Web References\" />
</ItemGroup>
<ItemGroup>
<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>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
<Visible>False</Visible>
<ProductName>Windows Installer 3.1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Service References\" />
</ItemGroup>
<ItemGroup>
<None Include="Web References\wsERP_WorkFlow\WFMESService.disco" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
<Import Project="..\..\..\MESWin\shared file\MakeVersion_CS.targets" Condition="exists('..\..\..\MESWin\shared file\MakeVersion_CS.targets')" />
</Project>

View File

@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@ -0,0 +1,658 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using iMESCIO.CDO.Tables;
using iMESCIO.SCI.DPM.Request;
using iMESCIO.SCI.DPM.Response;
using iMESCIO.SCI.ERP.Request;
using iMESCIO.SCI.ERP.Response;
using iMESCIO.SCI.SMES.Request;
using iMESCIO.SCI.SMES.Response;
using iMESCore.Base.ProjectBase.Base;
using iMESCore.Settings;
using MESDAO.Tables;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using static iMESCore.DataBase.iMESSql;
using static iMESCore.Base.iMESComSubroutine;
namespace AutoRunLib
{
public class EAIMessageSynchronizer
{
public enum WorkCode
{
ContinueRun = 0, // 繼續執行作業
StopSame = 1, // 停止相同的作業
StopAll = 2 // 停止所有作業
}
private string strDataBaseType; // DataBase Type:oracle, mysql, access
private string strConnectionString; // Connection string
private string strReportDataBaseType;
private string strReportConnectionString; // Report DB Connection string
private string strERPconnectionString;
private string strERPDataBaseType;
private string strERPReportConnectionString;
private string InXML, OutXML;
private string RequestKey = "";
private AppSettings objSetting = new AppSettings();
private string strLanguageMode = "zh-cht";
private string strResourceDir = "Resources";
// //Initial Object--------------------------------------------------------------------------------------------------------------------------------
public EAIMessageSynchronizer()
{
// //Get database type
strDataBaseType = objSetting.GetDataBaseType();
// //Get connection string
strConnectionString = objSetting.GetConnectionString(strDataBaseType);
// //Get Message Queue Type
// strMQType = objSetting.GetMQType()
strReportDataBaseType = objSetting.GetReportDataBaseType();
// //Get connection string
strReportConnectionString = objSetting.GetReportConnectionString(strReportDataBaseType);
// ERP
// //Get ERP database type
strERPDataBaseType = objSetting.GetDataBaseType_ERP();
// //Get ERP connection string
strERPconnectionString = objSetting.GetConnectionString_ERP(strERPDataBaseType);
try
{
strResourceDir = objSetting["ResourceDir"].ToString();
}
catch (Exception)
{ }
try
{
strLanguageMode = objSetting["LanguageMode"].ToString();
}
catch (Exception)
{ }
// 'T100 整合項目增加, 取得 Web.Config 設定項目, 2015/12/15 Add.
// Try
// '從Web.config取出目前的DatabaseType
// strERPCreator = System.Configuration.ConfigurationSettings.AppSettings.Get("defCreator")
// '2016-03-09, Joe, 取出預設ERP單位屬性編號
// strERPUnitNo = System.Configuration.ConfigurationSettings.AppSettings.Get("defERPUnitNoProperty")
// '2016-03-02, Joe, 取出預設語系並轉換成ERP對應語系後續T100多語系資料需用到
// strDefLanguage = System.Configuration.ConfigurationSettings.AppSettings.Get("LanguageMode")
// Select Case strDefLanguage.ToUpper
// Case "ZH-CHS"
// strLanguage_T100 = "zh_CN"
// Case "EN"
// strLanguage_T100 = "en_US"
// Case Else
// strLanguage_T100 = "zh_TW"
// End Select
// Catch ex As Exception
// '發生錯誤時丟回本身的Function Name及系統錯誤訊息
// End Try
}
// //Property--------------------------------------------------------------------------------------------------------------------------------
public string ConnectionString
{
get
{
return strConnectionString;
}
}
public string DataBaseType
{
get
{
return strDataBaseType;
}
}
public void StartSyncing(Collection colParameters = null)
{
var StopRunList = new List<string>();
var objERPSetting = new List<CDO_TBLSYSERPSETTING>();
var objQueue = new List<CDO_TBLSYSSENDTOEAIQUEUE>();
string Parameter01, Parameter02;
WorkCode ReturnWorkCode;
bool bSendMail = false;
do
{
try
{
// Parameter01為參數一
// 作為Mail通知群組(GroupNo),放在最前面防止連線失敗無法寄送通知。
if (!(colParameters["Parameter01"] == null) & !string.IsNullOrEmpty(Strings.Trim(Conversions.ToString(colParameters["Parameter01"]))))
{
Parameter01 = colParameters["Parameter01"].ToString().Trim();
}
else
{
throw new Exception(TranslateMsg("Mail GroupNo (Parameter 01) [%NOT SET%]!", strLanguageMode, strResourceDir));
}
// Parameter02為參數二
// 重新拋轉上限(數值)
if (!(colParameters["Parameter02"] == null) & !string.IsNullOrEmpty(Strings.Trim(Conversions.ToString(colParameters["Parameter02"]))))
{
if (Information.IsNumeric(colParameters["Parameter02"]) == false)
{
throw new Exception("(Parameter 02) [%is not%] [%Numeric%]!");
}
Parameter02 = colParameters["Parameter02"].ToString().Trim();
}
else
{
throw new Exception(TranslateMsg("Limit Qty (Parameter 02) [%NOT SET%]!", strLanguageMode, strResourceDir));
}
// 取得ERP整合設定資訊
objERPSetting = GetERPSetting();
// 取得要拋送給ERP的資訊
objQueue = GetSendQueue();
if (objQueue == null)
break;
string StopData;
var SendERPSetting = new CDO_TBLSYSERPSETTING();
bool exitTry1 = false;
foreach (CDO_TBLSYSSENDTOEAIQUEUE objQ in objQueue)
{
InXML = "";
RequestKey = "";
// 找出目前要拋送的目的服務是否有在StopRunList中如存在則不允許執行
StopData = StopRunList.Where(x => (x ?? "") == (objQ.SENDTO ?? "")).FirstOrDefault();
if (string.IsNullOrEmpty(StopData))
{
// 取出要拋送的目的服務的ERP整合設定資訊
SendERPSetting = objERPSetting.Where(x => (x.ERP_NAME ?? "") == (objQ.SENDTO ?? "")).FirstOrDefault();
if (SendERPSetting == null)
{
// Throw New Exception("[%ERP_Name%]" & objQ.SENDTO & "[%IS NOT FOUND%]!")
// Exit Try
continue;
}
// 組Req uest XML
InXML = CombineRequestXML(SendERPSetting, objQ);
// 將資訊拋給ERP
using (var ws = new iMESCore.Base.Invoke.wsERP_EAI.IntegrationEntry())
{
ws.Url = SendERPSetting.ERP_WSURL;
OutXML = ws.invokeSrv(InXML);
}
// 處理執行結果
ReturnWorkCode = HandleSendResult(OutXML, objQ, SendERPSetting, Parameter01, Parameter02);
// 依回傳的結果判定是否繼續執行
bool exitTry = false;
switch (ReturnWorkCode)
{
case WorkCode.ContinueRun:
{
// 繼續執行
continue;
}
case WorkCode.StopSame:
{
// 將此次失敗的ERP名稱加到StopRunList
StopRunList.Add(objQ.SENDTO);
// 繼續執行
continue;
}
case WorkCode.StopAll:
{
// 全部停止執行
exitTry1 = exitTry = true;
break;
}
}
if (exitTry)
{
break;
}
}
}
if (exitTry1)
{
break;
}
}
catch (Exception ex)
{
throw;
}
}
while (false);
}
/// <summary>
/// 取得ERP整合的設定資料
/// </summary>
/// <returns>List(Of CDO_TBLSYSERPSETTING)</returns>
private List<CDO_TBLSYSERPSETTING> GetERPSetting()
{
var DAO = new DAO_TBLSYSERPSETTING();
var Data = new List<CDO_TBLSYSERPSETTING>();
try
{
// 取出ERP整合資訊
Data = (List<CDO_TBLSYSERPSETTING>)DAO.Query(null, new QueryRelatedInfo() { ReturnType = ReturnMode.List });
}
catch (Exception ex)
{
throw;
}
return Data;
}
/// <summary>
/// 取得Queue資料
/// </summary>
/// <returns>List(Of CDO_TBLSYSSENDTOEAIQUEUE)</returns>
private List<CDO_TBLSYSSENDTOEAIQUEUE> GetSendQueue()
{
var DAO = new DAO_TBLSYSSENDTOEAIQUEUE();
var Data = new List<CDO_TBLSYSSENDTOEAIQUEUE>();
try
{
// 取出待拋轉資訊
Data = (List<CDO_TBLSYSSENDTOEAIQUEUE>)DAO.Query(null, new QueryRelatedInfo() { ReturnType = ReturnMode.List });
}
catch (Exception ex)
{
throw;
}
return Data;
}
/// <summary>
/// 組出RequestXML
/// </summary>
/// <returns></returns>
private string CombineRequestXML(CDO_TBLSYSERPSETTING pERPSetting, CDO_TBLSYSSENDTOEAIQUEUE pSendContent)
{
string CombineRequestXMLRet = default(string);
DataRow[] drERPSetting;
string strFilter = "";
try
{
// pSendContent.enterprise_no = drERPSetting(0)("ERP_ENTID").ToString
// pSendContent.site_no = drERPSetting(0)("ERP_ORG").ToString
// 轉XML
string RequestHead = "<host prod=\"" + pERPSetting.MESPRODUCTNAME + "\" ver=\"" + pERPSetting.MESPRODUCTVER + "\" ip=\"" + pERPSetting.MESIP + "\" id=\"" + pERPSetting.MESID + "\" acct=\"" + pERPSetting.ERP_USER + "\" lang=\"" + pERPSetting.ERP_LANG + "\" timestamp=\"" + Strings.Format(DateTime.Now, "yyyyMMddHHmmssfff") + "\"/>";
RequestHead += "<service prod=\"" + pERPSetting.CALLEDPRODUCTNAME + "\" name=\"" + pSendContent.SERVICENAME + "\" ip=\"" + pERPSetting.CALLEDIP + "\" id=\"" + pERPSetting.CALLEDID + "\"/>";
string RequestDataKey = "<datakey><key name=\"EntId\">" + pERPSetting.ERP_ENTID + "</key><key name=\"CompanyId\">" + pERPSetting.ERP_ORG + "</key></datakey>";
string RequestXML_Body = pSendContent.PAYLOAD;
RequestKey = modAutoRunLibrary.GetRequestKey(RequestHead);
string RequestHeader = "<request key=\"" + RequestKey + "\" type=\"sync\">" + RequestHead + RequestDataKey + "<payload>" + RequestXML_Body + "</payload></request>";
// CDO to XML
CombineRequestXMLRet = RequestHeader;
}
catch (Exception ex)
{
throw;
}
return CombineRequestXMLRet;
}
/// <summary>
/// 同步結果處理
/// </summary>
/// <returns></returns>
private WorkCode HandleSendResult(string pEAIResult, CDO_TBLSYSSENDTOEAIQUEUE pSendSrc, CDO_TBLSYSERPSETTING pEAISetting, string pJobParam01, string pJobParam02)
{
WorkCode HandleSendResultRet = default(WorkCode);
//IDbConnection cnnTemp = null;
//IDbCommand cmmTemp;
string strSQL;
//System.Data.OleDbDataAdapter daTemp;
var dsTemp = new DataSet();
var objReturn = default(WorkCode);
var objEAIResult = default(object);
bool ProcessResult = false;
string ProcessMessage = "";
try
{
// 物件初始化
switch (pSendSrc.SERVICENAME ?? "")
{
case "issue.wo.item.process": // MES發料
{
objEAIResult = new SCI_Response_issue_wo_item_process();
break;
}
case "stockin.data.create": // 完工入庫
{
objEAIResult = new SCI_Response_stockin_data_create();
break;
}
case "workorder.create": // DPM 拋報工單
{
objEAIResult = new SCI_Response_workorder_create();
break;
}
}
// 將中台回的結果轉成物件
try
{
(objEAIResult as SCI_Response_workorder_create).ParseXmlToObject(pEAIResult);
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual((objEAIResult as SCI_Response_workorder_create).code, "0", false)))
{
ProcessResult = true;
}
else
{
ProcessMessage = Conversions.ToString((objEAIResult as SCI_Response_workorder_create).description);
}
}
catch (Exception ex)
{
ProcessMessage = OutXML;
}
// 紀錄TransactionLog
string argstrException = null;
modAutoRunLibrary.addTransactionLog(InXML, OutXML, DateTime.Now.ToString("yyyyMMddHHmmssss"), "MES", "StartSyncing", Environment.MachineName, "AutoRun", DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), Conversions.ToString(Interaction.IIf(ProcessResult == Conversions.ToBoolean("0"), "success", "fail")), ProcessMessage, pSendSrc.SERVICENAME, strException: argstrException);
// 判斷中台回的結果
if (ProcessResult)
{
// 成功
HandleSendResultRet = WorkCode.ContinueRun;
// 處理執行成功資訊及歷程
HandleSendSuccess(pEAIResult, pSendSrc);
}
else
{
// 失敗
// 處理執行失敗資訊及歷程
HandleSendFail(pEAIResult, ProcessMessage, pSendSrc, pJobParam02);
// 寄送Mail
string argFileName = "N/A";
string argEmailSubject = "AutuRunJob : StartSyncing Fail![" + pSendSrc.SERVICENAME + "]";
string argEmailBody = TranslateMsg("[%SENDID%]" + pSendSrc.SENDID + " [%EXECUTE%] [%ISSUEMOMATERIAL%] [%FAIL%]! [%ERRORMESSAGE%]", strLanguageMode, strResourceDir) + ProcessMessage;
modAutoRunLibrary.SendMultiEmail(ref argFileName, ref argEmailSubject, argEmailBody, pJobParam01);
}
}
catch (Exception ex)
{
throw;
}
finally
{
//CloseConnection(cnnTemp);
}
return objReturn;
}
/// <summary>
/// 同步結果處理-成功
/// </summary>
/// <returns></returns>
private void HandleSendSuccess(string pEAIResult, CDO_TBLSYSSENDTOEAIQUEUE pSendSrc)
{
string strSQL;
var objQueueLog = new CDO_TBLSYSSENDTOEAIQUEUE_LOG();
var objEAIResult = new object();
var DAO = new DAO_TBLSYSSENDTOEAIQUEUE();
var DAO_Log = new DAO_TBLSYSSENDTOEAIQUEUE_LOG();
var cdoERPDocLog = new CDO_TBLSYSERPDOCUMENTLOG();
var daoERPDocLog = new DAO_TBLSYSERPDOCUMENTLOG();
try
{
// 執行成功後呼叫各服務各自處理邏輯
switch (pSendSrc.SERVICENAME ?? "")
{
case "issue.wo.item.process": // MES發料
{
objEAIResult = new SCI_Response_issue_wo_item_process();
// 將中台回的結果轉成物件
try
{
(objEAIResult as SCI_Response_issue_wo_item_process).ParseXmlToObject(pEAIResult);
}
catch (Exception ex)
{
throw new Exception("[%XML FORMAT ERROR%]");
}
// 解析Request XML
var cdoInXML = new SCI_Request_issue_wo_item_process();
cdoInXML.ParseXmlToObject(InXML);
object argdaoTransaction = DAO;
AddERPDocumentLog(8, Conversions.ToString((objEAIResult as SCI_Response_issue_wo_item_process).return_no), cdoInXML.doc_no, pSendSrc, ref argdaoTransaction);
DAO = (DAO_TBLSYSSENDTOEAIQUEUE)argdaoTransaction;
break;
}
case "stockin.data.create": // 完工入庫
{
objEAIResult = new SCI_Response_stockin_data_create();
// 將中台回的結果轉成物件
try
{
(objEAIResult as SCI_Response_stockin_data_create).ParseXmlToObject(pEAIResult);
}
catch (Exception ex)
{
throw new Exception("[%XML FORMAT ERROR%]");
}
// 解析Request XML
var cdoInXML = new SCI_Request_stockin_data_create();
cdoInXML.ParseXmlToObject(InXML);
object argdaoTransaction1 = DAO;
AddERPDocumentLog(4, Conversions.ToString((objEAIResult as SCI_Response_stockin_data_create).stock_in_no), cdoInXML.source_no, pSendSrc, ref argdaoTransaction1);
DAO = (DAO_TBLSYSSENDTOEAIQUEUE)argdaoTransaction1;
break;
}
case "workorder.create": // DPM報工單
{
objEAIResult = new SCI_Response_workorder_create();
// 將中台回的結果轉成物件
try
{
(objEAIResult as SCI_Response_workorder_create).ParseXmlToObject(pEAIResult);
}
catch (Exception ex)
{
throw new Exception("[%XML FORMAT ERROR%]");
}
// 解析Request XML
var cdoInXML = new SCI_Request_workorder_create();
cdoInXML.ParseXmlToObject(InXML);
break;
}
}
// 將Queue資訊搬至Log
objQueueLog.SENDID = pSendSrc.SENDID;
objQueueLog.SENDTO = pSendSrc.SENDTO;
objQueueLog.SERVICENAME = pSendSrc.SERVICENAME;
objQueueLog.SERVICEVERSION = pSendSrc.SERVICEVERSION;
objQueueLog.SENDCONTENT = pSendSrc.PAYLOAD;
objQueueLog.SENDCOUNT = pSendSrc.SENDCOUNT;
objQueueLog.RETURNINFO = Conversions.ToString(funGetParameterValue(objEAIResult, "description"));
objQueueLog.RUNRESULT = "success";
objQueueLog.CREATOR = pSendSrc.CREATOR;
objQueueLog.CREATEDATE = pSendSrc.CREATEDATE;
// 2017-07-17, Joe, 將ERP入庫單號寫入Queue中還原時才能與MES發料資訊做對應一起還原
objQueueLog.RELATIONERPNO = pSendSrc.RELATIONERPNO;
objQueueLog.LOTSERIAL = pSendSrc.LOTSERIAL;
DAO_Log.Add(objQueueLog, DAO);
// 刪除已拋轉成功的Queue
DAO.Delete(pSendSrc, DAO);
}
catch (Exception ex)
{
throw;
}
finally
{
}
}
/// <summary>
/// 同步結果處理-失敗
/// </summary>
/// <returns></returns>
private void HandleSendFail(string pEAIResult, string pEAIMessage, CDO_TBLSYSSENDTOEAIQUEUE pSendSrc, string pJobParam02)
{
string strSQL;
var objQueueLog = new CDO_TBLSYSSENDTOEAIQUEUE_LOG();
var DAO = new DAO_TBLSYSSENDTOEAIQUEUE();
var DAO_Log = new DAO_TBLSYSSENDTOEAIQUEUE_LOG();
try
{
// 錯誤次數加1
pSendSrc.SENDCOUNT = pSendSrc.SENDCOUNT + 1;
pSendSrc.EXCEPTION = pEAIResult;
// 將此筆Queue回寫DB
DAO.Update(pSendSrc, DAO);
// 發送Mail
// 判斷目前執行的同步次數是否已達到最大限制次數
if (string.IsNullOrEmpty(pJobParam02) == false && Convert.ToInt32(pJobParam02) != -1 && pSendSrc.SENDCOUNT > Convert.ToInt32(pJobParam02))
{
// 將Queue資訊搬至Log
objQueueLog.SENDID = pSendSrc.SENDID;
objQueueLog.SENDTO = pSendSrc.SENDTO;
objQueueLog.SERVICENAME = pSendSrc.SERVICENAME;
objQueueLog.SERVICEVERSION = pSendSrc.SERVICEVERSION;
objQueueLog.SENDCONTENT = pSendSrc.PAYLOAD;
objQueueLog.SENDCOUNT = pSendSrc.SENDCOUNT;
objQueueLog.RETURNINFO = pEAIMessage;
objQueueLog.RUNRESULT = "fail";
objQueueLog.EXCEPTION = pSendSrc.EXCEPTION;
objQueueLog.CREATOR = pSendSrc.CREATOR;
objQueueLog.CREATEDATE = pSendSrc.CREATEDATE;
// 2017-07-17, Joe, 將ERP入庫單號寫入Queue中還原時才能與MES發料資訊做對應一起還原
objQueueLog.RELATIONERPNO = pSendSrc.RELATIONERPNO;
DAO_Log.Add(objQueueLog, DAO);
// 刪除已拋轉成功的Queue
DAO.Delete(pSendSrc, DAO);
}
}
catch (Exception ex)
{
throw;
}
finally
{
}
}
private object AddERPDocumentLog(int pDocType, string ERPNo, string MESNo, CDO_TBLSYSSENDTOEAIQUEUE pSendSrc, ref object daoTransaction)
{
var cdoERPDocLog = new CDO_TBLSYSERPDOCUMENTLOG();
var daoERPDocLog = new DAO_TBLSYSERPDOCUMENTLOG();
try
{
// 將資訊寫入ERP Document Log
cdoERPDocLog.TRANSID = RequestKey;
cdoERPDocLog.DOCUMENTTYPE = pDocType; // 單據類別 1:工單發料2:工單退料3:報工單4:完工入庫5:不良品入庫單6:外包出貨單7:外包回貨單8MES發料
cdoERPDocLog.MESNO = MESNo;
cdoERPDocLog.ERPNO = ERPNo;
cdoERPDocLog.CREATEDATE = pSendSrc.CREATEDATE;
// 2017-07-17, Joe, 將ERP入庫單號寫入Queue中還原時才能與MES發料資訊做對應一起還原
cdoERPDocLog.RELATIONERPNO = pSendSrc.RELATIONERPNO;
cdoERPDocLog.SENDID = pSendSrc.SENDID;
daoERPDocLog.Add(cdoERPDocLog, (iMESDBBase)daoTransaction);
}
catch (Exception ex)
{
throw;
}
return default(Object);
}
/// <summary>
/// 20230207,13871,部分函式存取Object obj的成員,但此obj可能有多種型別故使用此方式取的值
/// </summary>
/// <param name="obj"></param>
/// <param name="key"></param>
/// <returns></returns>
private static object funGetParameterValue(object obj, string key)
{
object result = "";
try
{
Type t = obj.GetType();
System.Reflection.PropertyInfo p = t.GetProperty(key);
if (p != null)
{
result = p.GetValue(obj);
}
}
catch (Exception)
{
throw;
}
return result;
}
}
}

View File

@ -0,0 +1,4 @@
using COM_ERP.clsCommon;
using COM_ERP.clsWorkFlow;
[assembly: System.Reflection.AssemblyFileVersion("6.0.7.30207")]

View File

@ -0,0 +1,161 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// 這段程式碼是由工具產生的。
// 執行階段版本:4.0.30319.42000
//
// 對這個檔案所做的變更可能會造成錯誤的行為,而且如果重新產生程式碼,
// 變更將會遺失。
// </auto-generated>
// ------------------------------------------------------------------------------
using System.Diagnostics;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
namespace AutoRunLib.My
{
[System.Runtime.CompilerServices.CompilerGenerated()]
[System.CodeDom.Compiler.GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
internal sealed partial class MySettings : System.Configuration.ApplicationSettingsBase
{
private static MySettings defaultInstance = (MySettings)Synchronized(new MySettings());
#region My.Settings
/* TODO ERROR: Skipped IfDirectiveTrivia
#If _MyType = "WindowsForms" Then
*//* TODO ERROR: Skipped DisabledTextTrivia
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
*//* TODO ERROR: Skipped EndIfDirectiveTrivia
#End If
*/
#endregion
public static MySettings Default
{
get
{
/* TODO ERROR: Skipped IfDirectiveTrivia
#If _MyType = "WindowsForms" Then
*//* TODO ERROR: Skipped DisabledTextTrivia
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
*//* TODO ERROR: Skipped EndIfDirectiveTrivia
#End If
*/
return defaultInstance;
}
}
[System.Configuration.ApplicationScopedSetting()]
[DebuggerNonUserCode()]
[System.Configuration.SpecialSetting(System.Configuration.SpecialSetting.WebServiceUrl)]
[System.Configuration.DefaultSettingValue("http://10.40.40.30/gas/ws/r/aws_ttsrv2_top2o")]
public string AutoRunLib_wsERP_TP_TIPTOPServiceGateWay
{
get
{
return Conversions.ToString(this["AutoRunLib_wsERP_TP_TIPTOPServiceGateWay"]);
}
}
[System.Configuration.ApplicationScopedSetting()]
[DebuggerNonUserCode()]
[System.Configuration.SpecialSetting(System.Configuration.SpecialSetting.WebServiceUrl)]
[System.Configuration.DefaultSettingValue("http://218.211.164.212:8082/ws/r/aws_ttsrv2_top3o")]
public string AutoRunLib_wsERP_TP_RPC_TIPTOPServiceGateWay
{
get
{
return Conversions.ToString(this["AutoRunLib_wsERP_TP_RPC_TIPTOPServiceGateWay"]);
}
}
[System.Configuration.ApplicationScopedSetting()]
[DebuggerNonUserCode()]
[System.Configuration.SpecialSetting(System.Configuration.SpecialSetting.WebServiceUrl)]
[System.Configuration.DefaultSettingValue("http://10.40.41.197:9999/IntegrationEntry")]
public string AutoRunLib_wsERP_EAI_IntegrationEntry
{
get
{
return Conversions.ToString(this["AutoRunLib_wsERP_EAI_IntegrationEntry"]);
}
}
[System.Configuration.ApplicationScopedSetting()]
[DebuggerNonUserCode()]
[System.Configuration.SpecialSetting(System.Configuration.SpecialSetting.WebServiceUrl)]
[System.Configuration.DefaultSettingValue("http://localhost/MESws_STD/wsInvoke.asmx")]
public string AutoRunLib_wsInvoke_wsInvoke
{
get
{
return Conversions.ToString(this["AutoRunLib_wsInvoke_wsInvoke"]);
}
}
[System.Configuration.ApplicationScopedSetting()]
[DebuggerNonUserCode()]
[System.Configuration.SpecialSetting(System.Configuration.SpecialSetting.WebServiceUrl)]
[System.Configuration.DefaultSettingValue("http://10.40.30.73/WFMES/WFMESService.asmx")]
public string AutoRunLib_wsERP_WorkFlow_WFMESService
{
get
{
return Conversions.ToString(this["AutoRunLib_wsERP_WorkFlow_WFMESService"]);
}
}
[System.Configuration.ApplicationScopedSetting()]
[DebuggerNonUserCode()]
[System.Configuration.SpecialSetting(System.Configuration.SpecialSetting.WebServiceUrl)]
[System.Configuration.DefaultSettingValue("http://localhost/605EAI/wsMES.asmx")]
public string AutoRunLib_wsERP_MES_wsMES
{
get
{
return Conversions.ToString(this["AutoRunLib_wsERP_MES_wsMES"]);
}
}
}
}
namespace AutoRunLib.My
{
[HideModuleName()]
[DebuggerNonUserCode()]
[System.Runtime.CompilerServices.CompilerGenerated()]
internal static class MySettingsProperty
{
[System.ComponentModel.Design.HelpKeyword("My.Settings")]
internal static MySettings Settings
{
get
{
return MySettings.Default;
}
}
}
}

View File

@ -0,0 +1,24 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
<Profiles />
<Settings>
<Setting Name="AutoRunLib_wsERP_TP_TIPTOPServiceGateWay" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://10.40.40.30/gas/ws/r/aws_ttsrv2_top2o</Value>
</Setting>
<Setting Name="AutoRunLib_wsERP_TP_RPC_TIPTOPServiceGateWay" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://218.211.164.212:8082/ws/r/aws_ttsrv2_top3o</Value>
</Setting>
<Setting Name="AutoRunLib_wsERP_EAI_IntegrationEntry" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://10.40.41.197:9999/IntegrationEntry</Value>
</Setting>
<Setting Name="AutoRunLib_wsInvoke_wsInvoke" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://localhost/MESws_STD/wsInvoke.asmx</Value>
</Setting>
<Setting Name="AutoRunLib_wsERP_WorkFlow_WFMESService" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://10.40.30.73/WFMES/WFMESService.asmx</Value>
</Setting>
<Setting Name="AutoRunLib_wsERP_MES_wsMES" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://localhost/605EAI/wsMES.asmx</Value>
</Setting>
</Settings>
</SettingsFile>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Results>
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://localhost/ERPws_DSC/TIPTOPServiceGateWay.wsdl" filename="TIPTOPServiceGateWay.wsdl" />
</Results>
</DiscoveryClientResultsFile>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Results>
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://localhost/ERPws_DSC/TIPTOPServiceGateWay_RPC.wsdl" filename="TIPTOPServiceGateWay.wsdl" />
</Results>
</DiscoveryClientResultsFile>

View File

@ -0,0 +1,180 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// 這段程式碼是由工具產生的。
// 執行階段版本:4.0.30319.42000
//
// 對這個檔案所做的變更可能會造成錯誤的行為,而且如果重新產生程式碼,
// 變更將會遺失。
// </auto-generated>
// ------------------------------------------------------------------------------
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;
using Microsoft.VisualBasic.CompilerServices;
//
// 原始程式碼已由 Microsoft.VSDesigner 自動產生,版本 4.0.30319.42000。
//
namespace AutoRunLib.wsERP_WorkFlow
{
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.6.1087.0")]
[DebuggerStepThrough()]
[DesignerCategory("code")]
[WebServiceBinding(Name = "WFMESServiceSoap", Namespace = "http://tempuri.org/")]
public partial class WFMESService : SoapHttpClientProtocol
{
private System.Threading.SendOrPostCallback XMLAdapterOperationCompleted;
private bool useDefaultCredentialsSetExplicitly;
/// <remarks/>
public WFMESService() : base()
{
Url = My.MySettings.Default.AutoRunLib_wsERP_WorkFlow_WFMESService;
if (IsLocalFileSystemWebService(Url) == true)
{
UseDefaultCredentials = true;
useDefaultCredentialsSetExplicitly = false;
}
else
{
useDefaultCredentialsSetExplicitly = true;
}
}
public new string Url
{
get
{
return base.Url;
}
set
{
if (IsLocalFileSystemWebService(base.Url) == true && useDefaultCredentialsSetExplicitly == false && IsLocalFileSystemWebService(value) == false)
{
base.UseDefaultCredentials = false;
}
base.Url = value;
}
}
public new bool UseDefaultCredentials
{
get
{
return base.UseDefaultCredentials;
}
set
{
base.UseDefaultCredentials = value;
useDefaultCredentialsSetExplicitly = true;
}
}
/// <remarks/>
public event XMLAdapterCompletedEventHandler XMLAdapterCompleted;
/// <remarks/>
[SoapDocumentMethod("http://tempuri.org/XMLAdapter", RequestNamespace = "http://tempuri.org/", ResponseNamespace = "http://tempuri.org/", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public string XMLAdapter(string sXML)
{
object[] results = Invoke("XMLAdapter", new object[] { sXML });
return Conversions.ToString(results[0]);
}
/// <remarks/>
public IAsyncResult BeginXMLAdapter(string sXML, AsyncCallback callback, object asyncState)
{
return BeginInvoke("XMLAdapter", new object[] { sXML }, callback, asyncState);
}
/// <remarks/>
public string EndXMLAdapter(IAsyncResult asyncResult)
{
object[] results = EndInvoke(asyncResult);
return Conversions.ToString(results[0]);
}
/// <remarks/>
public void XMLAdapterAsync(string sXML)
{
XMLAdapterAsync(sXML, null);
}
/// <remarks/>
public void XMLAdapterAsync(string sXML, object userState)
{
if (XMLAdapterOperationCompleted == null)
{
XMLAdapterOperationCompleted = OnXMLAdapterOperationCompleted;
}
InvokeAsync("XMLAdapter", new object[] { sXML }, XMLAdapterOperationCompleted, userState);
}
private void OnXMLAdapterOperationCompleted(object arg)
{
if (XMLAdapterCompleted != null)
{
InvokeCompletedEventArgs invokeArgs = (InvokeCompletedEventArgs)arg;
XMLAdapterCompleted?.Invoke(this, new XMLAdapterCompletedEventArgs(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 || ReferenceEquals(url, string.Empty))
{
return false;
}
var wsUri = new Uri(url);
if (wsUri.Port >= 1024 && string.Compare(wsUri.Host, "localHost", StringComparison.OrdinalIgnoreCase) == 0)
{
return true;
}
return false;
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.6.1087.0")]
public delegate void XMLAdapterCompletedEventHandler(object sender, XMLAdapterCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.6.1087.0")]
[DebuggerStepThrough()]
[DesignerCategory("code")]
public partial class XMLAdapterCompletedEventArgs : AsyncCompletedEventArgs
{
private object[] results;
internal XMLAdapterCompletedEventArgs(object[] results, Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public string Result
{
get
{
RaiseExceptionIfNecessary();
return Conversions.ToString(results[0]);
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<DiscoveryClientResultsFile xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Results>
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.ContractReference" url="http://10.40.30.73/WFMES/WFMESService.asmx?wsdl" filename="WFMESService.wsdl" />
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://10.40.30.73/WFMES/WFMESService.asmx?disco" filename="WFMESService.disco" />
</Results>
</DiscoveryClientResultsFile>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<discovery xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/disco/">
<contractRef ref="http://10.40.30.73/WFMES/WFMESService.asmx?wsdl" docRef="http://10.40.30.73/WFMES/WFMESService.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://10.40.30.73/WFMES/WFMESService.asmx" xmlns:q1="http://tempuri.org/" binding="q1:WFMESServiceSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://10.40.30.73/WFMES/WFMESService.asmx" xmlns:q2="http://tempuri.org/" binding="q2:WFMESServiceSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="XMLAdapter">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="sXML" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="XMLAdapterResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="XMLAdapterResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="string" nillable="true" type="s:string" />
</s:schema>
</wsdl:types>
<wsdl:message name="XMLAdapterSoapIn">
<wsdl:part name="parameters" element="tns:XMLAdapter" />
</wsdl:message>
<wsdl:message name="XMLAdapterSoapOut">
<wsdl:part name="parameters" element="tns:XMLAdapterResponse" />
</wsdl:message>
<wsdl:message name="XMLAdapterHttpGetIn">
<wsdl:part name="sXML" type="s:string" />
</wsdl:message>
<wsdl:message name="XMLAdapterHttpGetOut">
<wsdl:part name="Body" element="tns:string" />
</wsdl:message>
<wsdl:message name="XMLAdapterHttpPostIn">
<wsdl:part name="sXML" type="s:string" />
</wsdl:message>
<wsdl:message name="XMLAdapterHttpPostOut">
<wsdl:part name="Body" element="tns:string" />
</wsdl:message>
<wsdl:portType name="WFMESServiceSoap">
<wsdl:operation name="XMLAdapter">
<wsdl:input message="tns:XMLAdapterSoapIn" />
<wsdl:output message="tns:XMLAdapterSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="WFMESServiceHttpGet">
<wsdl:operation name="XMLAdapter">
<wsdl:input message="tns:XMLAdapterHttpGetIn" />
<wsdl:output message="tns:XMLAdapterHttpGetOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:portType name="WFMESServiceHttpPost">
<wsdl:operation name="XMLAdapter">
<wsdl:input message="tns:XMLAdapterHttpPostIn" />
<wsdl:output message="tns:XMLAdapterHttpPostOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="WFMESServiceSoap" type="tns:WFMESServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="XMLAdapter">
<soap:operation soapAction="http://tempuri.org/XMLAdapter" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="WFMESServiceSoap12" type="tns:WFMESServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="XMLAdapter">
<soap12:operation soapAction="http://tempuri.org/XMLAdapter" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="WFMESServiceHttpGet" type="tns:WFMESServiceHttpGet">
<http:binding verb="GET" />
<wsdl:operation name="XMLAdapter">
<http:operation location="/XMLAdapter" />
<wsdl:input>
<http:urlEncoded />
</wsdl:input>
<wsdl:output>
<mime:mimeXml part="Body" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="WFMESServiceHttpPost" type="tns:WFMESServiceHttpPost">
<http:binding verb="POST" />
<wsdl:operation name="XMLAdapter">
<http:operation location="/XMLAdapter" />
<wsdl:input>
<mime:content type="application/x-www-form-urlencoded" />
</wsdl:input>
<wsdl:output>
<mime:mimeXml part="Body" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="WFMESService">
<wsdl:port name="WFMESServiceSoap" binding="tns:WFMESServiceSoap">
<soap:address location="http://10.40.30.73/WFMES/WFMESService.asmx" />
</wsdl:port>
<wsdl:port name="WFMESServiceSoap12" binding="tns:WFMESServiceSoap12">
<soap12:address location="http://10.40.30.73/WFMES/WFMESService.asmx" />
</wsdl:port>
<wsdl:port name="WFMESServiceHttpGet" binding="tns:WFMESServiceHttpGet">
<http:address location="http://10.40.30.73/WFMES/WFMESService.asmx" />
</wsdl:port>
<wsdl:port name="WFMESServiceHttpPost" binding="tns:WFMESServiceHttpPost">
<http:address location="http://10.40.30.73/WFMES/WFMESService.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@ -0,0 +1,35 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="AutoRunLib.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<appSettings>
</appSettings>
<applicationSettings>
<AutoRunLib.My.MySettings>
<setting name="AutoRunLib_wsERP_TP_TIPTOPServiceGateWay" serializeAs="String">
<value>http://10.40.40.30/gas/ws/r/aws_ttsrv2_top2o</value>
</setting>
<setting name="AutoRunLib_wsERP_TP_RPC_TIPTOPServiceGateWay"
serializeAs="String">
<value>http://218.211.164.212:8082/ws/r/aws_ttsrv2_top3o</value>
</setting>
<setting name="AutoRunLib_wsERP_EAI_IntegrationEntry" serializeAs="String">
<value>http://10.40.41.197:9999/IntegrationEntry</value>
</setting>
<setting name="AutoRunLib_wsInvoke_wsInvoke" serializeAs="String">
<value>http://localhost/MESws_STD/wsInvoke.asmx</value>
</setting>
<setting name="AutoRunLib_wsERP_WorkFlow_WFMESService" serializeAs="String">
<value>http://10.40.30.73/WFMES/WFMESService.asmx</value>
</setting>
<setting name="AutoRunLib_wsERP_MES_wsMES" serializeAs="String">
<value>http://localhost/605EAI/wsMES.asmx</value>
</setting>
</AutoRunLib.My.MySettings>
</applicationSettings>
</configuration>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,899 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Resources;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Xml;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using static iMESCore.Base.iMESComXML;
using static iMESCore.Base.iMESConst;
using NPOI.SS.UserModel;
using NPOI.SS.Util;
using NPOI.XSSF.UserModel;
using NPOI.HSSF.UserModel;
using static iMESCore.Base.iMESComSubroutine;
namespace AutoRunLib
{
static class modAutoRunLibrary
{
public enum GroupType
{
UserGroup = 0, // 使用者群組
IssueGroup = 1, // 簽核群組
EquipmentGroup = 2, // 設備工程師群組
InventoryGroup = 3, // 庫房工程師群組
ReportGroup = 4, // 報表使用群組
ERFDispositionGroup = 5, // 異常處理群組
ERFMailccGroup = 6 // 附件收件人群組
}
private static string InXml, OutXml, strIdentity, strParameter, XmlData, XmlSchema;
#region Invoke
/// <summary>
/// 叫用Web Service, 並回傳Response XML
/// </summary>
/// <param name="Method">要呼叫哪一個WebService的方法, ex: wsWIP.LoadLotBasis</param>
/// <param name="InXml">InXml</param>
/// <param name="Customize">是否客製的WebService</param>
/// <returns></returns>
/// <remarks>
/// 2019/08/22 OwenLiu, Mantis:0061402, 修正WS加上CI/CO執行時間紀錄 運作邏輯後AutoRun Servive呼叫WS失敗的問題
/// </remarks>
public static string InvokeSrv(string Method, string InXml, bool Customize = false, int TimeOut = defInteger, bool LogOn = false)
{
object result;
try
{
using (var ws = new iMESCore.Base.Invoke.wsInvoke.wsInvoke())
{
ws.Url = modWIN.LocalizeWebService(ws.Url.ToString(), Customize);
ws.EnableDecompression = true;
if (TimeOut != defInteger)
{
ws.Timeout = TimeOut;
}
result = ws.invokeSrv(Method, new object[] { InXml, LogOn });
}
}
catch (Exception ex)
{
throw;
}
return Conversions.ToString(result);
}
/// <summary>
/// 叫用Web Service, 回傳Response XML
/// </summary>
/// <param name="Method">要呼叫哪一個WebService的方法, ex: wsWIP.LoadLotBasis</param>
/// <param name="InXml">InXml</param>
/// <param name="buffer">用來取回byte資料或傳入byte資料</param>
/// <param name="Customize">是否客製的WebService</param>
/// <remarks>
/// 2019/08/22 OwenLiu, Mantis:0061402, 修正WS加上CI/CO執行時間紀錄 運作邏輯後AutoRun Servive呼叫WS失敗的問題
/// </remarks>
public static string InvokeSrv(string Method, string InXml, byte[] buffer, bool Customize = false, int TimeOut = defInteger, bool LogOn = false)
{
object result;
try
{
using (var ws = new iMESCore.Base.Invoke.wsInvoke.wsInvoke())
{
ws.Url = modWIN.LocalizeWebService(ws.Url.ToString(), Customize);
ws.EnableDecompression = true;
if (TimeOut != defInteger)
{
ws.Timeout = TimeOut;
}
result = ws.invokeSrv(Method, new object[] { InXml, buffer, LogOn });
}
}
catch (Exception ex)
{
throw;
}
return Conversions.ToString(result);
}
/// <summary>
/// 叫用Web Service, 並回傳Response XML
/// </summary>
/// <param name="Method">要呼叫哪一個WebService的方法, ex: wsWIP.LoadLotBasis</param>
/// <param name="InXml">InXml</param>
/// <param name="pDataSet">接收結果的DataSet</param>
/// <param name="Customize">是否客製的WebService</param>
/// <returns></returns>
public static string InvokeSrv(string Method, string InXml, ref DataSet pDataSet, bool Customize = false)
{
object result;
try
{
using (var ws = new iMESCore.Base.Invoke.wsInvoke.wsInvoke())
{
ws.Url = modWIN.LocalizeWebService(ws.Url.ToString(), Customize);
ws.EnableDecompression = true;
result = ws.invokeSrv_DataSet(Method, InXml, ref pDataSet);
}
}
catch (Exception ex)
{
throw;
}
return Conversions.ToString(result);
}
public static string InvokeSrv_GuardServer(bool Customize = false)
{
object result;
try
{
using (var ws = new iMESCore.Base.Invoke.wsInvoke.wsInvoke())
{
ws.Url = modWIN.LocalizeWebService(ws.Url.ToString(), Customize);
ws.EnableDecompression = true;
result = ws.Invoke_GuardServer_Process();
}
}
catch (Exception ex)
{
throw;
}
return Conversions.ToString(result);
}
#endregion
/// <summary>
/// EAI 檢核編碼(MD5)
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public static string GetRequestKey(string input)
{
const string ID = "28682266"; // 鼎新統編
string key = "";
var md5Hasher = MD5.Create(); // 建立MD5物件
try
{
input += ID;
// 將input轉換成MD5並且以Bytes傳回由於ComputeHash只接受Bytes型別參數所以要先轉型別為Bytes
byte[] data = md5Hasher.ComputeHash(Encoding.UTF8.GetBytes(input));
// 建立StringBuilder物件
var sb = new StringBuilder();
// 將Bytes轉型別為String並且以16進位存放
for (int i = 0, loopTo = data.Length - 1; i <= loopTo; i++)
sb.Append(data[i].ToString("x2"));
key = sb.ToString();
}
catch (Exception ex)
{
throw;
}
finally
{
md5Hasher = null;
}
return key;
}
/// <summary>
/// 紀錄Transaction
/// </summary>
/// <param name="InXml"></param>
/// <param name="OutXml"></param>
/// <param name="ModuleID"></param>
/// <param name="FunctionID"></param>
/// <param name="Result"></param>
/// <param name="KeyValue"></param>
/// <returns></returns>
/// <remarks></remarks>
public static bool addTransactionLog(string InXml, string OutXml, string TransactionID, string ModuleID, string FunctionID, string ComputerName, string CurUserNo, string SendTime, string Result, string KeyValue, string ExceptionFun, string strException = null)
{
bool addTransactionLogRet = default(bool);
try
{
using (var wsERP = new iMESCore.Base.Invoke.wsMES.wsMES())
{
wsERP.Url = modWIN.LocalizeWebService_ERP(wsERP.Url.ToString());
wsERP.EnableDecompression = true;
if (wsERP.addTransactionLog(InXml, OutXml, TransactionID, ModuleID, FunctionID, ComputerName, CurUserNo, SendTime, Result, KeyValue, ExceptionFun, ref strException) == true)
{
addTransactionLogRet = true;
}
else
{
addTransactionLogRet = false;
}
}
}
catch (Exception ex)
{
addTransactionLogRet = false;
}
return addTransactionLogRet;
}
/// <summary>
/// 紀錄Transaction
/// </summary>
public static bool addTransactionLog_ErrorCode(string InXml, string OutXml, string TransactionID, string ModuleID, string FunctionID, string ComputerName, string CurUserNo, string SendTime, string Result, string KeyValue, string ExceptionFun, string strException = null, string ErrorCode = "0000-999999", string LogClass = null)
{
bool addTransactionLog_ErrorCodeRet = default(bool);
try
{
using (var wsERP = new iMESCore.Base.Invoke.wsMES.wsMES())
{
wsERP.Url = modWIN.LocalizeWebService_ERP(wsERP.Url.ToString());
wsERP.EnableDecompression = true;
if (wsERP.addTransactionLog_ErrorCode(InXml, OutXml, TransactionID, ModuleID, FunctionID, ComputerName, CurUserNo, SendTime, Result, KeyValue, ExceptionFun, ref strException, ErrorCode, LogClass) == true)
{
addTransactionLog_ErrorCodeRet = true;
}
else
{
addTransactionLog_ErrorCodeRet = false;
}
}
}
catch (Exception ex)
{
addTransactionLog_ErrorCodeRet = false;
}
return addTransactionLog_ErrorCodeRet;
}
// =====Elvis ,0091128: [605][CP+FT] E10ICD整合問題_AutoRun主檔拋轉的ERP交易紀錄exception時紀錄不正確
#region --- Combine (Exception, Message) ---
public static bool ChgTranslateException(ref List<ArrayList> Exception, ref string strExceptionSysmsg, ref string strExceptionMesmsg, ref string strExceptionStack)
{
bool ChgTranslateExceptionRet = default(bool);
try
{
foreach (ArrayList al in Exception)
{
// If strExceptionSysmsg <> String.Empty Then strExceptionSysmsg += Chr(10)
if (string.IsNullOrEmpty(Conversions.ToString(al[1])) == false)
strExceptionSysmsg += al[1].ToString();
// If String.IsNullOrEmpty(strExceptionMesmsg) = False Then strExceptionMesmsg += Chr(10)
if (string.IsNullOrEmpty(Conversions.ToString(al[2])) == false)
{
// 翻譯錯誤訊息
string strErrName_Rep = "";
string ErrorName = al[2].ToString();
if (Strings.InStr(ErrorName, "[%", CompareMethod.Text) > 0)
{
string strKey, strKeyValue;
int intStart, j, k, l;
intStart = 1;
j = 1;
while (j != 0)
{
j = Strings.InStr(intStart, ErrorName, "[%", CompareMethod.Text);
if (j == 0)
{
strErrName_Rep += Strings.Mid(ErrorName, intStart);
}
else
{
k = Strings.InStr(j + 2, ErrorName, "%]", CompareMethod.Text);
if (k == 0)
{
// 找不到對應的結束字元.
strErrName_Rep += Strings.Mid(ErrorName, intStart);
j = 0;
}
else
{
// 檢查是否有不對稱的情況.
l = Strings.InStr(j + 2, ErrorName, "[%", CompareMethod.Text);
if (l == 0 || l > k)
{
strErrName_Rep += Strings.Mid(ErrorName, intStart, j - intStart);
strKey = Strings.Mid(ErrorName, j + 2, k - j - 2);
// 將Key執行語系轉換
try
{
strKeyValue = "";
}
// strKeyValue = Resources.Resource.ResourceManager.GetString(strKey)
catch (Exception ex)
{
strKeyValue = strKey;
}
if (string.IsNullOrEmpty(strKeyValue))
{
strErrName_Rep += strKey;
}
else
{
strErrName_Rep += strKeyValue;
} // & "(" & strKey & ")"
// 下次截取字串的起始位置
intStart = k + 2;
}
else
{
// 不對稱,找到最內層的[%%]
int m;
// 在前面的條件下,一定找得到.
m = Strings.InStrRev(ErrorName, "[%", k, CompareMethod.Text);
// 擷出不轉換的字串.
strErrName_Rep += Strings.Mid(ErrorName, intStart, m - intStart);
strKey = Strings.Mid(ErrorName, m + 2, k - m - 2);
// 將Key執行語系轉換
try
{
strKeyValue = "";
}
// strKeyValue = Resources.Resource.ResourceManager.GetString(strKey)
catch (Exception ex)
{
strKeyValue = strKey;
}
if (string.IsNullOrEmpty(strKeyValue))
{
strErrName_Rep += strKey;
}
else
{
strErrName_Rep += strKeyValue;
} // & "(" & strKey & ")"
// 下次截取字串的起始位置
intStart = k + 2;
}
}
}
}
}
// strExceptionMesmsg += Chr(9) & Chr(9) & Chr(9) & Resources.Resource.ResourceManager.GetString(al.Item(2).ToString) & "(" & al.Item(2).ToString & ")"
strExceptionMesmsg += strErrName_Rep;
}
// If strExceptionStack <> String.Empty Then strExceptionStack += Chr(10)
if (string.IsNullOrEmpty(Conversions.ToString(al[3])) == false)
strExceptionStack += al[3].ToString();
}
ChgTranslateExceptionRet = true;
}
catch (Exception e1)
{
throw;
ChgTranslateExceptionRet = false;
}
return ChgTranslateExceptionRet;
}
public static string CombineXMLResponse(string Identity, string ReturnValue = null, List<ArrayList> Exception = null, string Result = null, List<ArrayList> Message = null)
{
string CombineXMLResponseRet = default(string);
try
{
// <response>
CombineXMLResponseRet = "<response>";
// <identity>
if (string.IsNullOrEmpty(Identity))
{
CombineXMLResponseRet += "<identity></identity>";
}
else
{
CombineXMLResponseRet += "<identity>";
CombineXMLResponseRet += Identity;
CombineXMLResponseRet += "</identity>";
}
// <returnvalue>
if (string.IsNullOrEmpty(ReturnValue))
{
CombineXMLResponseRet += "<returnvalue></returnvalue>";
}
else
{
CombineXMLResponseRet += "<returnvalue>";
CombineXMLResponseRet += ReturnValue;
CombineXMLResponseRet += "</returnvalue>";
}
// <result>
if (string.IsNullOrEmpty(Result))
{
CombineXMLResponseRet += "<result></result>";
}
else
{
CombineXMLResponseRet += "<result>" + Result + "</result>";
}
// <exception>
string strExceptionSysmsg = string.Empty;
string strExceptionMesmsg = string.Empty;
string strExceptionStack = string.Empty;
if (Exception.Count == 0)
{
CombineXMLResponseRet += "<exception></exception>";
}
else
{
// 2016-12-01, Joe, Exception轉語系
ChgTranslateException(ref Exception, ref strExceptionSysmsg, ref strExceptionMesmsg, ref strExceptionStack);
CombineXMLResponseRet += "<exception>";
CombineXMLResponseRet += "<code></code>";
if (string.IsNullOrEmpty(strExceptionSysmsg) == true)
{
CombineXMLResponseRet += "<sysmsg></sysmsg>";
}
else
{
CombineXMLResponseRet += "<sysmsg>" + strExceptionSysmsg + '\n' + "</sysmsg>" + '\n';
}
if (string.IsNullOrEmpty(strExceptionMesmsg) == true)
{
CombineXMLResponseRet += "<mesmsg>" + strExceptionMesmsg + "</mesmsg>" + '\n';
}
else
{
CombineXMLResponseRet += "<mesmsg>" + strExceptionMesmsg + "</mesmsg>" + '\n';
}
if (string.IsNullOrEmpty(strExceptionStack))
{
CombineXMLResponseRet += "<stack></stack>";
}
else
{
// CombineXMLResponse += Chr(9) & Chr(9) & "<stack>" & Chr(10) & strExceptionStack & Chr(10) & Chr(9) & Chr(9) & "</stack>" & Chr(10)
CombineXMLResponseRet += "<stack></stack>";
}
CombineXMLResponseRet += '\t' + "</exception>" + '\n';
}
// <message>
string strMmsg = string.Empty;
if (Message.Count == 0)
{
CombineXMLResponseRet += '\t' + "<message></message>" + '\n';
}
else
{
CombineXMLResponseRet += '\t' + "<message>" + '\n';
// 2016-12-01, Joe, Message轉語系
// Call ChgTranslateMessage(Message, strMmsg)
CombineXMLResponseRet += Conversions.ToString('\t') + '\t' + "<mcode></mcode>" + '\n';
CombineXMLResponseRet += Conversions.ToString('\t') + '\t' + "<mtype></mtype>" + '\n';
CombineXMLResponseRet += Conversions.ToString('\t') + '\t' + "<mmsg>" + strMmsg + "</mmsg>" + '\n';
CombineXMLResponseRet += '\t' + "</message>" + '\n';
}
CombineXMLResponseRet += "</response>" + '\n';
}
catch (Exception e1)
{
// 發生錯誤時丟回本身的Function Name及系統錯誤訊息
// Throw 'New Exception("modWS.CombineXMLResponse: " & e1.Message)
CombineXMLResponseRet = "<response>" + '\n';
CombineXMLResponseRet += '\t' + "<identity></identity>" + '\n';
CombineXMLResponseRet += '\t' + "<exception>" + '\n';
CombineXMLResponseRet += Conversions.ToString('\t') + '\t' + "<code></code>" + '\n';
CombineXMLResponseRet += Conversions.ToString('\t') + '\t' + "<sysmsg>" + '\n';
CombineXMLResponseRet += Conversions.ToString('\t') + '\t' + '\t' + e1.Message + '\n';
CombineXMLResponseRet += Conversions.ToString('\t') + '\t' + "</sysmsg>" + '\n';
CombineXMLResponseRet += Conversions.ToString('\t') + '\t' + "<mesmsg>" + '\n';
CombineXMLResponseRet += Conversions.ToString('\t') + '\t' + '\t' + "CombineXMLResponse;Fail" + '\n';
CombineXMLResponseRet += Conversions.ToString('\t') + '\t' + "</mesmsg>" + '\n';
CombineXMLResponseRet += Conversions.ToString('\t') + '\t' + "<stack>" + '\n';
CombineXMLResponseRet += e1.StackTrace + '\n';
CombineXMLResponseRet += Conversions.ToString('\t') + '\t' + "</stack>" + '\n';
CombineXMLResponseRet += '\t' + "</exception>" + '\n';
CombineXMLResponseRet += '\t' + "<message></message>" + '\n';
CombineXMLResponseRet += "</response>";
}
return CombineXMLResponseRet;
}
public static bool combineException(ref List<ArrayList> arrException, string code = null, string sysmsg = null, string mesmsg = null, string stack = null)
{
bool result = false;
try
{
var al = new ArrayList();
al.Add(code);
al.Add(sysmsg);
al.Add(mesmsg);
al.Add(stack);
arrException.Add(al);
result = true;
}
catch (Exception ex)
{
result = false;
}
return default(Boolean);
}
// Public Function combineMessage(
// ByRef strMessage As List(Of ArrayList),
// Optional ByVal mcode As String = Nothing,
// Optional ByVal mtype As String = Nothing,
// Optional ByVal mmsg As String = Nothing
// ) As Boolean
// Dim result As Boolean = False
// Try
// Dim al As New ArrayList
// al.Add(mcode)
// al.Add(mtype)
// al.Add(mmsg)
// strMessage.Add(al)
// result = True
// Catch ex As Exception
// result = False
// End Try
// End Function
#endregion
// =====
// 發Mail功能 非群組與群組發送
public static string SendMultiEmail(ref string FileName, ref string EmailSubject, string EmailBody = defString, string GroupNo = defString, byte[] AttachFile = null, GroupType GroupType = GroupType.UserGroup)
{
string SendMultiEmailRet = default(string);
// GroupType
// 0:User Group (使用者群組)
// 1:Issue Group (簽核群組)
// 2:Equipment Group(設備工程師群組)
// 3:Inventory Group(庫房工程師群組)
// 4:Report Group(報表使用群組)
// 5:ERF Disposition Group(異常處理群組)
// 6:ERF Mail ccGroup(附件收件人群組)
try
{
strIdentity = CombineXMLIdentity(modWIN.gComputerName, "AUTORUN", DateTime.Now.ToString());
strParameter = CombineXMLParameter("groupno", "GroupNo", "String", CInput(GroupNo), "");
strParameter = strParameter + CombineXMLParameter("emailsubject", "EmailSubject", "String", EmailSubject, "");
strParameter = strParameter + CombineXMLParameter("emailbody", "EmailBody", "String", EmailBody, "");
strParameter = strParameter + CombineXMLParameter("grouptype", "GroupType", "Integer", ((int)GroupType).ToString(), "");
strParameter = strParameter + CombineXMLParameter("attachfilename", "AttachFileName", "String", FileName, "");
var XmlDoc = new XmlDocument();
InXml = CombineXMLRequest(strIdentity, strParameter);
// OutXml = wsWIP.SendEmailAndAttachFileToGroup(InXml, AttachFile)
OutXml = InvokeSrv("wsWIP.SendEmailAndAttachFileToGroup", InXml, AttachFile);
XmlDoc.LoadXml(OutXml);
if (chkExecutionSuccess(XmlDoc)) // 找出Exception訊並顯示出來
{
SendMultiEmailRet = "success";
}
else
{
SendMultiEmailRet = "fail";
}
XmlDoc = null;
}
catch (Exception ex)
{
SendMultiEmailRet = "fail;" + ex.Message;
}
return SendMultiEmailRet;
}
#region --- ---
public static bool funChkNumericIsValid(string pSourceText, bool AllowFloat = true, bool AllowContainsDot = true, bool AllowZeroValue = true, bool AllowMinus = true)
{
bool blnExecResult = false;
decimal decInputValue = 0m;
try
{
if (!Information.IsNumeric(pSourceText))
{
blnExecResult = false;
return blnExecResult;
}
decInputValue = Convert.ToDecimal(pSourceText);
if (!AllowMinus && decInputValue < 0m)
{
blnExecResult = false;
return blnExecResult;
}
if (!AllowZeroValue && decInputValue == 0m)
{
blnExecResult = false;
return blnExecResult;
}
if (!AllowFloat)
{
if (decInputValue % 1m > 0m)
{
blnExecResult = false;
return blnExecResult;
}
}
if (!AllowContainsDot && !pSourceText.IndexOf(".").Equals(-1))
{
blnExecResult = false;
return blnExecResult;
}
blnExecResult = true;
}
catch (Exception ex)
{
throw;
}
return blnExecResult;
}
#endregion
public static byte[] funExcelToByte(DataSet dsResult, String ExcelMode, String strLanguageMode, String strResourceDir)
{
var memStream = new MemoryStream();
IWorkbook workbook = null;
int title = 0;
byte[] membyte;
try
{
// 匯出Excel再轉Stream
if (ExcelMode == "XLSX")
{
workbook = new XSSFWorkbook();
}
else
{
workbook = new HSSFWorkbook();
}
// Add a new worksheet
ISheet worksheet = workbook.CreateSheet("Sheet1");
// Add the TSSAVE data table to the worksheet
IRow headerRow = worksheet.CreateRow(0);
for (int i = 0; i <= dsResult.Tables[0].Columns.Count - 1; i++)
{
string strLanguage = dsResult.Tables[0].Columns[i].ToString();
strLanguage = TranslateMsg("[%" + strLanguage + "%]", strLanguageMode, strResourceDir); //語系翻譯
headerRow.CreateCell(i).SetCellValue(strLanguage);
}
for (int i = 0; i <= dsResult.Tables[0].Rows.Count - 1; i++)
{
IRow dataRow = worksheet.CreateRow(i + 1);
for (int j = 0; j <= dsResult.Tables[0].Columns.Count - 1; j++)
{
var objdsResultType = dsResult.Tables[0].Rows[i][j].GetType();
dataRow.CreateCell(j);
if (!Convert.IsDBNull(dsResult.Tables[0].Rows[i][j]))
{
dataRow.CreateCell(j).SetCellValue(dsResult.Tables[0].Rows[i][j].ToString());
}
else if (objdsResultType.Name == "DateTime")
{
DateTime datedsTemp = DateTime.Parse(dsResult.Tables[0].Rows[i][j].ToString());
dataRow.CreateCell(j).SetCellValue(datedsTemp);
}
else if (objdsResultType.Name == "Decimal")
{
decimal amount;
amount = Convert.ToDecimal(dsResult.Tables[0].Rows[i][j].ToString());
dataRow.CreateCell(j).SetCellValue((double)amount);
}
else
{
dataRow.CreateCell(j).SetCellValue(dsResult.Tables[0].Rows[i][j].ToString());
}
//.抓取值
IRow SelectRow = worksheet.GetRow(i);
ICell SelectCell = SelectRow.GetCell(j);
//Style處理
if (i == 0)
title = 1;
else
title = 0;
funCellStyleClone(workbook, SelectCell, title, ExcelMode);
}
}
//Columns 寬度
for (int i = 0; i <= dsResult.Tables[0].Columns.Count - 1; i++)
{
worksheet.AutoSizeColumn(i);
}
////debug 用
//var fileStream = File.Create($"{DateTime.Now.ToString("HHmmss")}.xlsx");
//FileStream fs = new FileStream(@"c:\test.xlsx", FileMode.Create);
//workbook.Write(fs);
//fs.Close();
////
workbook.Write(memStream);
membyte = memStream.ToArray();
return membyte;
}
catch (Exception ex)
{
throw;
}
finally
{
workbook?.Close();
memStream.Close();
memStream.Dispose();
}
}
public static void funCellStyleClone(IWorkbook Workbook, ICell SourceCell, int title, String ExcelMode)
{
try
{
ICellStyle CellStyle = Workbook.CreateCellStyle();
IFont CellFont = Workbook.CreateFont();
if (title == 1)
{
CellStyle.BorderLeft = BorderStyle.None;
CellStyle.BorderRight = BorderStyle.None;
CellStyle.BorderTop = BorderStyle.None;
if (ExcelMode == "XLSX")
{
XSSFColor xssfColor = new XSSFColor();
byte[] colorRgb = { (byte)192, (byte)192, (byte)255 };
xssfColor.SetRgb(colorRgb);
((XSSFCellStyle)CellStyle).FillForegroundColorColor = xssfColor;
((XSSFCellStyle)CellStyle).FillPattern = FillPattern.SolidForeground;
}
else
{
CellStyle.FillForegroundColor = (((HSSFWorkbook)Workbook).GetCustomPalette().FindSimilarColor((byte)192, (byte)192, (byte)255)).Indexed;
CellStyle.FillBackgroundColor = (((HSSFWorkbook)Workbook).GetCustomPalette().FindSimilarColor((byte)192, (byte)192, (byte)255)).Indexed;
}
CellStyle.FillPattern = FillPattern.SolidForeground;
CellStyle.BorderBottom = BorderStyle.None;
CellStyle.Alignment = HorizontalAlignment.Center;
SourceCell.CellStyle = CellStyle;
}
else
{
CellStyle.BorderLeft = BorderStyle.Thin;
CellStyle.BorderRight = BorderStyle.Thin;
CellStyle.BorderTop = BorderStyle.Thin;
CellStyle.BorderBottom = BorderStyle.Thin;
if (ExcelMode == "XLSX")
{
XSSFColor xssfColor = new XSSFColor();
byte[] colorRgb = { (byte)192, (byte)192, (byte)255 };
xssfColor.SetRgb(colorRgb);
((XSSFCellStyle)CellStyle).SetTopBorderColor(xssfColor);
((XSSFCellStyle)CellStyle).SetRightBorderColor(xssfColor);
((XSSFCellStyle)CellStyle).SetLeftBorderColor(xssfColor);
((XSSFCellStyle)CellStyle).SetBottomBorderColor(xssfColor);
}
else
{
CellStyle.LeftBorderColor = (((HSSFWorkbook)Workbook).GetCustomPalette().FindSimilarColor((byte)192, (byte)192, (byte)255)).Indexed;
CellStyle.RightBorderColor = (((HSSFWorkbook)Workbook).GetCustomPalette().FindSimilarColor((byte)192, (byte)192, (byte)255)).Indexed;
CellStyle.TopBorderColor = (((HSSFWorkbook)Workbook).GetCustomPalette().FindSimilarColor((byte)192, (byte)192, (byte)255)).Indexed;
CellStyle.BottomBorderColor = (((HSSFWorkbook)Workbook).GetCustomPalette().FindSimilarColor((byte)192, (byte)192, (byte)255)).Indexed;
}
CellStyle.FillPattern = FillPattern.SolidForeground;
CellStyle.Alignment = HorizontalAlignment.Left;
SourceCell.CellStyle = CellStyle;
}
// 文字
CellFont.FontHeightInPoints = 9;
//CellFont.Boldweight = StyleFon.Boldweight;
//CellFont.Charset = StyleFon.Charset;
//CellFont.Color = StyleFon.Color;
//CellFont.FontHeight = 9;
//CellFont.FontHeightInPoints = StyleFon.FontHeightInPoints;
//CellFont.FontName = StyleFon.FontName;
//CellFont.IsItalic = StyleFon.IsItalic;
//CellFont.IsStrikeout = StyleFon.IsStrikeout;
//CellFont.Underline = StyleFon.Underline;
CellStyle.SetFont(CellFont);
}
catch (Exception ex)
{
throw;
}
}
}
}

View File

@ -0,0 +1,234 @@
using System;
using System.Collections;
using static System.Configuration.ConfigurationSettings;
using System.Data;
using System.Runtime.InteropServices;
using System.Xml;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
namespace AutoRunLib
{
static class modWIN
{
// ReviseDate : 2003/08/07,修改處理AdditionalXML
// ReviseDate : 2003/08/05,新增Public gReturnArray
// ReviseDate : 2003/07/01,更改AddFlow產生的Error(CInput)
// ReviseDate : 2002/11/04,新增CUnInput function
public static string gComputerName = System.Environment.MachineName;
public static string gUserNo = "AUTService";
public static string gMESWebServiceHost = GetAppSettings("MesWebServiceHost");
public static string gCUSWebServiceHost = GetAppSettings("CusWebServiceHost");
public static string gERPWebServiceHost = GetAppSettings("ERPWebServiceHost");
public static string gLanguageMode = GetAppSettings("LanguageMode");
//新增gEnableSSL配置参数
public static bool gEnableSSL = Convert.ToBoolean(GetAppSettings("EnableSSL"));
// Add By Peter 2005/6/20
public static string gSettingMode = "";
public static string PasswordEncoding(ref string Password)
{
string PasswordEncodingRet = default(string);
// 此 Function 將傳入值加以編碼後傳出,編碼後長度不變
// 傳入值: 密碼
// 傳回值: 編碼後密碼
// Vernam密碼是由Gilbert Vernam在1918年發明的
string g_Key = "xNDFz6LH67LOv7xKbWFpbMu1wejrM7SzvV4tLRvq3X47m708O1xMHLoaMNCqGhoaEN";
string strChar, iCryptChar, strEncrypted = default(string);
int i, iKeyChar, iStringChar;
var loopTo = Strings.Len(Password);
for (i = 1; i <= loopTo; i++)
{
iKeyChar = Strings.Asc(Strings.Mid(g_Key, i, 1));
iStringChar = Strings.Asc(Strings.Mid(Password, i, 1));
iCryptChar = (iKeyChar ^ iStringChar).ToString();
strEncrypted = strEncrypted + Strings.Chr(Conversions.ToInteger(iCryptChar));
}
PasswordEncodingRet = Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(strEncrypted));
return PasswordEncodingRet;
}
// 2017-06-05, Joe, 依XML標準定義轉換特殊字元
public static string CInputWithXMLStandard(ref string strInput)
{
string CInputWithXMLStandardRet = default(string);
// 轉換 ' 為 &apos;
CInputWithXMLStandardRet = Strings.Replace(strInput, "'", "&apos;");
// 轉換 & 為 &amp;
CInputWithXMLStandardRet = Strings.Replace(CInputWithXMLStandardRet, "&", "&amp;");
// 轉換 " 為 quot;
CInputWithXMLStandardRet = Strings.Replace(CInputWithXMLStandardRet, "\"", "&quot;");
// 轉換 > 為 &gt;
CInputWithXMLStandardRet = Strings.Replace(CInputWithXMLStandardRet, ">", "&gt;");
// 轉換 < 為 &lt;
CInputWithXMLStandardRet = Strings.Replace(CInputWithXMLStandardRet, "<", "&lt;");
return CInputWithXMLStandardRet;
}
// 2017-06-05, Joe, 依XML標準定義反轉換特殊字元
public static string CUnInputWithXMLStandard(ref string strInput)
{
string CUnInputWithXMLStandardRet = default(string);
// 轉換 ' 為 "&apos;"
CUnInputWithXMLStandardRet = Strings.Replace(strInput, "&apos;", "'");
// 轉換 " 為 quot;
CUnInputWithXMLStandardRet = Strings.Replace(CUnInputWithXMLStandardRet, "&quot;", "\"");
// 轉換 & 為 &amp;
CUnInputWithXMLStandardRet = Strings.Replace(CUnInputWithXMLStandardRet, "&amp;", "&");
// 轉換 > 為 &gt;
CUnInputWithXMLStandardRet = Strings.Replace(CUnInputWithXMLStandardRet, "&gt;", ">");
// 轉換 < 為 &lt;
CUnInputWithXMLStandardRet = Strings.Replace(CUnInputWithXMLStandardRet, "&lt;", "<");
return CUnInputWithXMLStandardRet;
}
// **Add by py 2003/12/04,Gary Lu 20120911:以MESWin1~Win4的版本進行替換
public static string LocalizeWebService(string wsUrl, bool Customize = false)
{
string[] tmpString;
int i;
tmpString = wsUrl.Split('/');
if (Customize == true)
{
if (!string.IsNullOrEmpty(Strings.Trim(gCUSWebServiceHost)))
{
if (tmpString.Length == 6)
{
wsUrl = tmpString[0].ToString() + "/" + tmpString[1].ToString() + "/" + gCUSWebServiceHost + "/" + tmpString[4].ToString() + "/" + tmpString[5].ToString();
}
else if (tmpString.Length == 5)
{
wsUrl = "http://" + gCUSWebServiceHost + "/" + tmpString[tmpString.Length - 1].ToString();
}
}
}
else if (!string.IsNullOrEmpty(Strings.Trim(gMESWebServiceHost)))
{
if (tmpString.Length == 6)
{
// wsUrl = "http://" & gMESWebServiceHost & "/" & tmpString(tmpString.Length - 2).ToString & "/" & tmpString(tmpString.Length - 1).ToString
wsUrl = tmpString[0].ToString() + "/" + tmpString[1].ToString() + "/" + gMESWebServiceHost + "/" + tmpString[4].ToString() + "/" + tmpString[5].ToString();
}
else if (tmpString.Length == 5)
{
wsUrl = "http://" + gMESWebServiceHost + "/" + tmpString[tmpString.Length - 1].ToString();
}
}
if (gEnableSSL)
{
wsUrl = wsUrl.Replace("http://", "https://");
}
return wsUrl;
// Have to assume the web service is on the machine that this application came from
} // LocalizeWebService
public static string LocalizeWebService_ERP(string wsUrl)
{
string[] tmpString;
int i;
tmpString = wsUrl.Split('/');
if (!string.IsNullOrEmpty(Strings.Trim(gERPWebServiceHost)))
{
wsUrl = tmpString[0].ToString() + "/" + tmpString[1].ToString() + "/" + gERPWebServiceHost + "/" + tmpString[4].ToString();
}
if (gEnableSSL)
{
wsUrl = wsUrl.Replace("http://", "https://");
}
return wsUrl;
}
// Add By Peter 2005/6/20
public static string GetAppSettings(string key, string section = "")
{
string result = string.Empty;
try
{
if (!string.IsNullOrEmpty(section))
{
result = Conversions.ToString(((Hashtable)GetConfig(section))[key]);
}
else if (string.IsNullOrEmpty(gSettingMode) || string.IsNullOrEmpty(gSettingMode) || gSettingMode.Length == 0)
{
result = AppSettings[key];
}
else
{
Hashtable ht = (Hashtable)GetConfig(gSettingMode);
if (ht != null)
{
result = Conversions.ToString(ht[key]);
if (string.IsNullOrEmpty(result))
{
result = AppSettings[key];
if (string.IsNullOrEmpty(result))
{
result = "";
}
}
}
else
{
result = AppSettings[key];
}
}
}
catch (Exception ex)
{
throw ex;
}
return result;
}
public static string GetSubString(string strValue, int intLength)
{
int intLen;
string strReturn;
// Dim byteValue As Byte() = System.Text.Encoding.UTF8.GetBytes(strValue)
// If intLength > byteValue.Length - 1 Then
// intLen = byteValue.Length - 1
// End If
// Dim strReturn As String = System.Text.Encoding.UTF8.GetString(byteValue, 0, intLen)
intLen = (int)Math.Round(Conversion.Int(intLength / 3d));
strReturn = Strings.Left(strValue, intLen);
return strReturn;
}
}
}

View File

@ -0,0 +1,104 @@
using System;
using System.Diagnostics;
using System.ServiceProcess;
namespace AutoRunService
{
[Microsoft.VisualBasic.CompilerServices.DesignerGenerated()]
public partial class AutoRunService : ServiceBase
{
// UserService 覆寫 Dispose 以清除元件清單。
[DebuggerNonUserCode()]
protected override void Dispose(bool disposing)
{
try
{
if (disposing && components != null)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
// 處理序的主要進入點
[MTAThread()]
[DebuggerNonUserCode()]
public static void Main()
{
ServiceBase[] ServicesToRun;
// 在同一個處理序中可以執行多個 NT 服務。若要在這個處理序中
// 加入另一項服務,請修改下行程式碼,
// 以建立第二個服務物件。例如,
//
// ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
//
ServicesToRun = new ServiceBase[] { new AutoRunService() };
//RunInteractive(ServicesToRun); //debug
Run(ServicesToRun);
}
private static void RunInteractive(ServiceBase[] servicesToRun)
{
var onStartMethod = typeof(ServiceBase).GetMethod("OnStart", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
foreach (ServiceBase service in servicesToRun)
{
Console.Write("Starting {0}...", service.ServiceName);
onStartMethod.Invoke(service, new object[] { new string[] { } });
Console.Write("Started");
}
Console.WriteLine("Press any key to stop the services");
Console.ReadKey();
var onStopMethod = typeof(ServiceBase).GetMethod("OnStop", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
foreach (ServiceBase service in servicesToRun)
{
Console.Write("Stopping {0}...", service.ServiceName);
onStopMethod.Invoke(service, null);
Console.WriteLine("Stopped");
}
}
// 為元件設計工具的必要項
private System.ComponentModel.IContainer components;
// 注意: 以下為元件設計工具的所需的程序
// 您可以使用元件設計工具進行修改。
// 請不要使用程式碼編輯器進行修改。
[DebuggerStepThrough()]
private void InitializeComponent()
{
TimerCheckJobList = new System.Timers.Timer();
TimerCheckJobList.Elapsed += new System.Timers.ElapsedEventHandler(TimerCheckJobList_Elapsed);
TimerCheckQueue = new System.Timers.Timer();
TimerCheckQueue.Elapsed += new System.Timers.ElapsedEventHandler(TimerCheckQueue_Elapsed);
((System.ComponentModel.ISupportInitialize)TimerCheckJobList).BeginInit();
((System.ComponentModel.ISupportInitialize)TimerCheckQueue).BeginInit();
//
// TimerCheckJobList
//
TimerCheckJobList.Interval = 300000.0d;
//
// TimerCheckQueue
//
TimerCheckQueue.Interval = 60000.0d;
//
// AutoRunService
//
ServiceName = "MES AutoRun Service";
((System.ComponentModel.ISupportInitialize)TimerCheckJobList).EndInit();
((System.ComponentModel.ISupportInitialize)TimerCheckQueue).EndInit();
}
internal System.Timers.Timer TimerCheckJobList;
internal System.Timers.Timer TimerCheckQueue;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,272 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="12.0">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.50727</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{1D8229EF-DEED-0C6F-1A45-76DD01FBF457}</ProjectGuid>
<OutputType>WinExe</OutputType>
<StartupObject>AutoRunService.AutoRunService</StartupObject>
<RootNamespace>AutoRunService</RootNamespace>
<AssemblyName>AutoRunService</AssemblyName>
<MyType>Console</MyType>
<SccProjectName>SAK</SccProjectName>
<SccLocalPath>SAK</SccLocalPath>
<SccAuxPath>SAK</SccAuxPath>
<SccProvider>SAK</SccProvider>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>2.0</OldToolsVersion>
<UpgradeBackupLocation />
<TargetFrameworkProfile />
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>D:\Temp\MESSeries6\AutoRunService\</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>1</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>true</BootstrapperEnabled>
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<DefineDebug>true</DefineDebug>
<DefineTrace>true</DefineTrace>
<OutputPath>..\..\..\MESClient\AutoRunServiceInstall\</OutputPath>
<DocumentationFile>..\..\..\MESClient\AutoRunServiceInstall\AutoRunService.xml</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<DefineDebug>false</DefineDebug>
<DefineTrace>true</DefineTrace>
<Optimize>true</Optimize>
<OutputPath>..\..\..\MESClient\AutoRunServiceInstall\</OutputPath>
<DocumentationFile>..\..\..\MESClient\AutoRunServiceInstall\
</DocumentationFile>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,42353,42354,42355</NoWarn>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>BB1E0A6C038D360CE4BE9723ABC415D99A432E73</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<ManifestKeyFile>
</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoRunLib, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_C_DLL\AutoRunLib.dll</HintPath>
</Reference>
<Reference Include="data_access_service">
<HintPath>..\..\..\MES_S_DLL\data_access_service.dll</HintPath>
</Reference>
<Reference Include="iMESAppSetting">
<HintPath>..\..\..\MES_S_DLL\iMESAppSetting.dll</HintPath>
</Reference>
<Reference Include="iMESChart_HtmlHandler">
<HintPath>..\..\..\MES_S_DLL\iMESChart_HtmlHandler.dll</HintPath>
</Reference>
<Reference Include="iMESComInvoke">
<HintPath>..\..\..\MES_S_DLL\iMESComInvoke.dll</HintPath>
</Reference>
<Reference Include="iMESComSubroutine">
<HintPath>..\..\..\MES_S_DLL\iMESComSubroutine.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="iMESComXML">
<HintPath>..\..\..\MES_S_DLL\iMESComXML.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="iMESConst">
<HintPath>..\..\..\MES_S_DLL\iMESConst.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Ionic.Zip, Version=1.9.1.5, Culture=neutral, PublicKeyToken=edbe51ad942a3f5c, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_C_DLL\Ionic.Zip.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="GuardServerProvider">
<HintPath>..\..\..\MES_S_DLL\GuardServerProvider.dll</HintPath>
</Reference>
<Reference Include="iMESCIO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3ad2cfbf6a289680, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_S_DLL\iMESCIO.dll</HintPath>
</Reference>
<Reference Include="iMESDAO">
<HintPath>..\..\..\MES_S_DLL\iMESDAO.dll</HintPath>
</Reference>
<Reference Include="iMESDataObject">
<HintPath>..\..\..\MES_S_DLL\iMESDataObject.dll</HintPath>
</Reference>
<Reference Include="iMESProjectBase">
<HintPath>..\..\..\MES_S_DLL\iMESProjectBase.dll</HintPath>
</Reference>
<Reference Include="iMESLicxManager">
<HintPath>..\..\..\MES_S_DLL\iMESLicxManager.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="NPOI, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_C_DLL\NPOI.dll</HintPath>
</Reference>
<Reference Include="NPOI.OOXML, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_C_DLL\NPOI.OOXML.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXml4Net, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_C_DLL\NPOI.OpenXml4Net.dll</HintPath>
</Reference>
<Reference Include="NPOI.OpenXmlFormats, Version=2.5.5.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_C_DLL\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="Oracle.ManagedDataAccess, Version=4.121.2.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_S_DLL\Oracle.ManagedDataAccess.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.configuration" />
<Reference Include="System.Configuration.Install" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Web.Services" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
</ItemGroup>
<ItemGroup>
<Compile Include="modAutoRun.cs" />
<Compile Include="modWIN.cs" />
<Compile Include="My Project\Application.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
</Compile>
<Compile Include="AutoRunService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="AutoRunService.Designer.cs">
<DependentUpon>AutoRunService.cs</DependentUpon>
</Compile>
<Compile Include="My Project\AssemblyInfo.cs" />
<Compile Include="My Project\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<Compile Include="ProjectInstaller.Designer.cs">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</Compile>
<Compile Include="ProjectInstaller.cs">
<SubType>Component</SubType>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="AutoRunService.resx">
<SubType>Designer</SubType>
<DependentUpon>AutoRunService.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="ProjectInstaller.resx">
<SubType>Designer</SubType>
<DependentUpon>ProjectInstaller.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="AutoRunService_TemporaryKey.pfx" />
<None Include="Install_x64.bat">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Install_x86.bat">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="My Project\Application.myapp">
<Generator>MyApplicationCodeGenerator</Generator>
<LastGenOutput>Application.Designer.cs</LastGenOutput>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<CustomToolNamespace>AutoRunService.My</CustomToolNamespace>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="ReplicationTableList.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Uninstall_x64.bat">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Uninstall_x86.bat">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<WebReferences Include="Web References\" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
</ItemGroup>
<ItemGroup>
<None Include="安裝說明.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4 %28x86 和 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Windows.Installer.4.5">
<Visible>False</Visible>
<ProductName>Windows Installer 4.5</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\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>
-->
<Import Project="..\..\..\MESWin\shared file\MakeVersion_CS.targets" Condition="exists('..\..\..\MESWin\shared file\MakeVersion_CS.targets')" />
</Project>

View File

@ -0,0 +1,10 @@
""
{
"FILE_VERSION" = "9237"
"ENLISTMENT_CHOICE" = "NEVER"
"PROJECT_FILE_RELATIVE_PATH" = ""
"NUMBER_OF_EXCLUDED_FILES" = "0"
"ORIGINAL_PROJECT_FILE_PATH" = ""
"NUMBER_OF_NESTED_PROJECTS" = "0"
"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER"
}

View File

@ -0,0 +1,129 @@
<?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="TimerCheckJobList.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="TimerCheckQueue.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>

View File

@ -0,0 +1,3 @@
%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe "%~dp0AutoRunService.exe"
Pause

View File

@ -0,0 +1,3 @@
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe "%~dp0AutoRunService.exe"
Pause

View File

@ -0,0 +1,11 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<MyApplicationData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<MySubMain>false</MySubMain>
<SingleInstance>false</SingleInstance>
<ShutdownMode>0</ShutdownMode>
<EnableVisualStyles>true</EnableVisualStyles>
<AuthenticationMode>0</AuthenticationMode>
<ApplicationType>3</ApplicationType>
<SaveMySettingsOnExit>true</SaveMySettingsOnExit>
</MyApplicationData>

View File

@ -0,0 +1,30 @@
using System;
using System.Reflection;
using System.Runtime.InteropServices;
// 一般的組件資訊是由下列這組屬性所控制。
// 變更這些屬性的值即可修改組件的相關資訊。
// 檢閱組件屬性的值
[assembly: AssemblyTitle("AutoRunService")]
[assembly: AssemblyDescription("AutoRunService for MESSeries")]
[assembly: AssemblyCompany("iMES Technology Inc.")]
[assembly: AssemblyProduct("MESSeries 6")]
[assembly: AssemblyCopyright("Copyright © iMES Technology Inc.")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(true)]
// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
[assembly: Guid("88779103-B613-42AE-9368-24C38D3E131A")]
// 組件的版本資訊由下列四個值所組成:
//
// 主要版本
// 次要版本
// 組建編號
// 修訂
//
// 您可以自行指定所有的值,也可以依照以下的方式,使用 '*' 將修訂和組建編號
// 指定為預設值:
[assembly: AssemblyVersion("6.0.0.0")]

View File

@ -0,0 +1,2 @@

[assembly: System.Reflection.AssemblyFileVersion("6.0.7.30207")]

View File

@ -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>

View File

@ -0,0 +1,101 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
using System.Diagnostics;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
namespace AutoRunService.My
{
[System.Runtime.CompilerServices.CompilerGenerated()]
[System.CodeDom.Compiler.GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
internal sealed partial class MySettings : System.Configuration.ApplicationSettingsBase
{
private static MySettings defaultInstance = (MySettings)Synchronized(new MySettings());
#region My.Settings
/* TODO ERROR: Skipped IfDirectiveTrivia
#If _MyType = "WindowsForms" Then
*//* TODO ERROR: Skipped DisabledTextTrivia
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
*//* TODO ERROR: Skipped EndIfDirectiveTrivia
#End If
*/
#endregion
public static MySettings Default
{
get
{
/* TODO ERROR: Skipped IfDirectiveTrivia
#If _MyType = "WindowsForms" Then
*//* TODO ERROR: Skipped DisabledTextTrivia
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
*//* TODO ERROR: Skipped EndIfDirectiveTrivia
#End If
*/
return defaultInstance;
}
}
[System.Configuration.ApplicationScopedSetting()]
[DebuggerNonUserCode()]
[System.Configuration.SpecialSetting(System.Configuration.SpecialSetting.WebServiceUrl)]
[System.Configuration.DefaultSettingValue("http://localhost/MESws_STD/wsInvoke.asmx")]
public string AutoRunService_wsInvoke_wsInvoke
{
get
{
return Conversions.ToString(this["AutoRunService_wsInvoke_wsInvoke"]);
}
}
}
}
namespace AutoRunService.My
{
[HideModuleName()]
[DebuggerNonUserCode()]
[System.Runtime.CompilerServices.CompilerGenerated()]
internal static class MySettingsProperty
{
[System.ComponentModel.Design.HelpKeyword("My.Settings")]
internal static MySettings Settings
{
get
{
return MySettings.Default;
}
}
}
}

View File

@ -0,0 +1,9 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="My" GeneratedClassName="MySettings" UseMySettingsClassName="true">
<Profiles />
<Settings>
<Setting Name="AutoRunService_wsInvoke_wsInvoke" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://localhost/MESws_STD/wsInvoke.asmx</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -0,0 +1,89 @@
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace AutoRunService
{
[System.ComponentModel.RunInstaller(true)]
public partial class ProjectInstaller : System.Configuration.Install.Installer
{
// Installer 覆寫 Dispose 以清除元件清單。
[DebuggerNonUserCode()]
protected override void Dispose(bool disposing)
{
try
{
if (disposing && components != null)
{
components.Dispose();
}
}
finally
{
base.Dispose(disposing);
}
}
// 為元件設計工具的必要項
private System.ComponentModel.IContainer components;
// 注意: 以下為元件設計工具所需的程序
// 您可以使用元件設計工具進行修改。
// 請不要使用程式碼編輯器進行修改。
[DebuggerStepThrough()]
private void InitializeComponent()
{
_ServiceProcessInstaller1 = new System.ServiceProcess.ServiceProcessInstaller();
_ServiceInstaller1 = new System.ServiceProcess.ServiceInstaller();
//
// ServiceProcessInstaller1
//
_ServiceProcessInstaller1.Account = System.ServiceProcess.ServiceAccount.LocalSystem;
_ServiceProcessInstaller1.Password = null;
_ServiceProcessInstaller1.Username = null;
//
// ServiceInstaller1
//
_ServiceInstaller1.DisplayName = "MES AutoRun Service";
_ServiceInstaller1.ServiceName = "MES AutoRun Service";
//
// ProjectInstaller
//
Installers.AddRange(new System.Configuration.Install.Installer[] { _ServiceProcessInstaller1, _ServiceInstaller1 });
}
private System.ServiceProcess.ServiceProcessInstaller _ServiceProcessInstaller1;
internal virtual System.ServiceProcess.ServiceProcessInstaller ServiceProcessInstaller1
{
[MethodImpl(MethodImplOptions.Synchronized)]
get
{
return _ServiceProcessInstaller1;
}
[MethodImpl(MethodImplOptions.Synchronized)]
set
{
_ServiceProcessInstaller1 = value;
}
}
private System.ServiceProcess.ServiceInstaller _ServiceInstaller1;
internal virtual System.ServiceProcess.ServiceInstaller ServiceInstaller1
{
[MethodImpl(MethodImplOptions.Synchronized)]
get
{
return _ServiceInstaller1;
}
[MethodImpl(MethodImplOptions.Synchronized)]
set
{
_ServiceInstaller1 = value;
}
}
}
}

View File

@ -0,0 +1,19 @@

namespace AutoRunService
{
public partial class ProjectInstaller
{
public ProjectInstaller() : base()
{
// 此為元件設計工具所需的呼叫。
InitializeComponent();
// 在呼叫 InitializeComponent 之後加入初始化程式碼
}
}
}

View File

@ -0,0 +1,129 @@
<?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=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>
<metadata name="ServiceProcessInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="ServiceInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>False</value>
</metadata>
</root>

View File

@ -0,0 +1,4 @@
%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe "%~dp0AutoRunService.exe" -u
Pause

View File

@ -0,0 +1,3 @@
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe "%~dp0AutoRunService.exe" -u
Pause

View File

@ -0,0 +1,128 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="AutoRunService.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<appSettings>
<!-- 資料庫連結字串 -->
<!--記錄Database 是oracle或是mssql -->
<add key="DatabaseType" value="oracle"/>
<add key="DatabaseOwner" value="MESSERIES"/>
<add key="ConnectionString" value="Provider=OraOleDB.Oracle;Data Source=ORCL;User ID=MESSERIES"/>
<add key="DatabasePassword" value="==wQ5hTP"/>
<!-- SQL Server
<add key="ConnectionString" value="Provider=SQLOLEDB;Data Source=IMS13;Initial Catalog=MESSERIES;User Id=MESSERIES"/>
-->
<!-- Report相關資料 -->
<add key="ReportDatabaseType" value="oracle"/>
<add key="ReportDatabaseOwner" value="MESSERIES"/>
<add key="ReportConnectionString" value="Provider=OraOleDB.Oracle;Data Source=ORCL;User ID=MESSERIES"/>
<add key="ReportDatabasePassword" value="==wQ5hTP"/>
<!-- EDC相關資料 -->
<add key="TestDataDatabaseType" value="oracle" />
<add key="TestDataDatabaseOwner" value="MESEDC" />
<add key="TestDataDatabasePassword" value="=cVUvRXSS50KPNFb6N2d5kjUnZlS" />
<add key="TestDataConnectionString" value="Provider=OraOleDb.Oracle;User ID=MESEDC;Data Source=EDCDB;" />
<!-- Other ERP相關資料 -->
<!--add key="ERPDatabaseType" value="informix" /-->
<!--add key="ERPDatabaseOwner" value="SSC" /-->
<!--add key="ERPConnectionString" value="Dsn=SQL2005;uid=sa" /-->
<!--add key="ERPDatabasePassword" value="==wQ5hTP" /-->
<!-- Other ERP相關資料 -->
<!-- ERPDB 預設 T100 整合項目 -->
<add key="ERPDatabaseType" value="oracle"/>
<add key="ERPDatabaseOwner" value="MESSERIES_T100"/>
<add key="ERPDatabasePassword" value="RhUN6RGMzhUZINXP"/>
<add key="ERPConnectionString" value="Provider=OraOleDB.Oracle;Data Source=ORCL;User ID=MESSERIES_T100"/>
<!-- ERP相關設定 -->
<!-- Default Web Service Exception Value -->
<add key="defWSErrCode" value="0000-999999"/>
<!-- Default Web Service Message Value-->
<add key="defMSGCode" value="0000-000000"/>
<add key="defMSGType" value="MES"/>
<!-- Default OPType -->
<add key="defOPType" value="ERP"/>
<!-- Default PSNo -->
<add key="defPSNo" value="ERP"/>
<!-- Defautl FactoryNo -->
<add key="defFactoryNo" value="ERP"/>
<!-- Default MO and MO Material List -->
<add key="defMOTypeNo" value="0"/>
<add key="defMOPriority" value="99"/>
<add key="defMOPlanFinishDate" value="10"/>
<add key="defMOListMaterialLevel" value="0"/>
<add key="defMOListOPNo" value="LOTCREATE"/>
<add key="defMOListPutInPlaceType" value="3"/>
<add key="defMOListDecreaseRate" value="0"/>
<add key="defMOListSpecified" value="0"/>
<add key="defMOListCountWay" value="0"/>
<add key="defERPUnitNoProperty" value="ERPUnitNo"/>
<add key="defCreator" value="ERP"/>
<!-- Web Services -->
<add key="MesWebServiceHost" value="localhost/MESws_STD_6033"/>
<add key="CusWebServiceHost" value="localhost/MESws_Cust"/>
<add key="ERPWebServiceHost" value="localhost/ERPws_DSC"/>
<add key="ERFCreator" value="870658"/>
<!-- 語系 zh-cht繁體、zh-chs簡體、en英文-->
<add key="LanguageMode" value="zh-cht"/>
<add key="ClientSettingsProvider.ServiceUri" value=""/>
<!-- 取回JOB LIST 到 JOB QUEUE的時間間隔(單位:秒) -->
<add key="MonitorjoblistDuration" value="30"/>
<!-- 到JOB QUEUE 檢查是否有要執行的job的時間間隔(單位:秒) -->
<add key="MonitorQueueDuration" value="17" />
<!-- 新增EnableSSL配置参数 -->
<add key="EnableSSL" value="False"/>
</appSettings>
<system.diagnostics>
<sources>
<!-- 這個區段定義 My.Application.Log 的記錄組態-->
<source name="DefaultSource" switchName="DefaultSwitch">
<listeners>
<add name="FileLog"/>
<!-- 取消註解下列區段,以寫入應用程式事件記錄檔-->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources>
<switches>
<add name="DefaultSwitch" value="Information"/>
</switches>
<sharedListeners>
<add name="FileLog" type="Microsoft.VisualBasic.Logging.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" initializeData="FileLogWriter"/>
<!-- 取消註解下列區段,並將 APPLICATION_NAME 取代成您的應用程式名稱,以寫入至應用程式事件記錄檔-->
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
</sharedListeners>
</system.diagnostics>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/>
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/>
</providers>
</roleManager>
</system.web>
<applicationSettings>
<AutoRunService.My.MySettings>
<setting name="AutoRunService_wsInvoke_wsInvoke" serializeAs="String">
<value>http://internal.imestech.com/MESws_STD_6033/wsInvoke.asmx</value>
</setting>
<setting name="AutoRunService_wsERP_MES_wsMES" serializeAs="String">
<value>http://localhost/MESEAI_DSC/wsMES.asmx</value>
</setting>
</AutoRunService.My.MySettings>
</applicationSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>

View File

@ -0,0 +1,90 @@
using System;
using System.Data;
using System.Diagnostics;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using AutoRunLib;
namespace AutoRunService
{
static class modAutoRun
{
// Dim objLic As New iMESLicxManager.clsDBCom
public static int gIntCurrentJobCount;
public static DateTime dateStartTime;
public static string gStatus; // 目前是否起動AutoRun
public static DataSet dsJobQueue = new DataSet();
public static DataSet dsJob = new DataSet();
// Public Const defInteger As Integer = -999 '宣告整數使用的常數用以辨識參數是否有傳入Function中。
// Public Const defString As String = "Null" '宣告字串使用的常數用以辨識參數是否有傳入Function中。
// Public Const defDateTime As Date = #12/31/1900# '宣告日期使用的常數用以辨識參數是否有傳入Function中。
// Public ConnectionString As String = objLic.GetConnectionString 'app.config要設連線字串
public const int cJobList2Queue = 30; // 每隔30秒鐘, 取回一次JOB LIST 到 JOB QUEUE
public const int cCheckQueue = 17; // 每隔17秒鐘,到 JOB QUEUE 檢查是否有要執行的
public static int gIntMaxRunningJobCount = 5; // 最大允許同時執行數量
public class SomeStateType
{
public string strJobNo;
public string strCommandName;
public void SomeState(string strJN, string strCN)
{
strJobNo = strJN;
strCommandName = strCN;
}
}
public static bool PrevInstance()
{
if (Information.UBound(Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName)) > 0)
{
return true;
}
else
{
return false;
}
}
#region Invoke
/// <summary>
/// 叫用Web Service, 並回傳Response XML
/// </summary>
/// <param name="Method">要呼叫哪一個WebService的方法, ex: wsWIP.LoadLotBasis</param>
/// <param name="InXml">InXml</param>
/// <param name="Customize">是否客製的WebService</param>
/// <returns></returns>
public static string InvokeSrv(string Method, string InXml, bool Customize = false)
{
object result;
try
{
using (var ws = new iMESCore.Base.Invoke.wsInvoke.wsInvoke())
{
ws.Url = modWIN.LocalizeWebService(ws.Url.ToString(), Customize);
ws.EnableDecompression = true;
result = ws.invokeSrv(Method, new object[] { InXml });
}
}
catch (Exception ex)
{
throw;
}
return Conversions.ToString(result);
}
#endregion
}
}

View File

@ -0,0 +1,232 @@
using System;
using System.Collections;
using static System.Configuration.ConfigurationSettings;
using System.Data;
using System.Runtime.InteropServices;
using System.Xml;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
namespace AutoRunService
{
static class modWIN
{
// ReviseDate : 2003/08/07,修改處理AdditionalXML
// ReviseDate : 2003/08/05,新增Public gReturnArray
// ReviseDate : 2003/07/01,更改AddFlow產生的Error(CInput)
// ReviseDate : 2002/11/04,新增CUnInput function
public static string gComputerName = System.Environment.MachineName;
public static string gUserNo = "AUTService";
public static string gMESWebServiceHost = GetAppSettings("MesWebServiceHost");
public static string gCUSWebServiceHost = GetAppSettings("CusWebServiceHost");
public static string gERPWebServiceHost = GetAppSettings("ERPWebServiceHost");
public static string gLanguageMode = GetAppSettings("LanguageMode");
//新增gEnableSSL配置参数
public static bool gEnableSSL = Convert.ToBoolean(GetAppSettings("EnableSSL"));
// Add By Peter 2005/6/20
public static string gSettingMode = "";
public static string PasswordEncoding(ref string Password)
{
string PasswordEncodingRet = default(string);
// 此 Function 將傳入值加以編碼後傳出,編碼後長度不變
// 傳入值: 密碼
// 傳回值: 編碼後密碼
// Vernam密碼是由Gilbert Vernam在1918年發明的
string g_Key = "xNDFz6LH67LOv7xKbWFpbMu1wejrM7SzvV4tLRvq3X47m708O1xMHLoaMNCqGhoaEN";
string strChar, iCryptChar, strEncrypted = default(string);
int i, iKeyChar, iStringChar;
var loopTo = Strings.Len(Password);
for (i = 1; i <= loopTo; i++)
{
iKeyChar = Strings.Asc(Strings.Mid(g_Key, i, 1));
iStringChar = Strings.Asc(Strings.Mid(Password, i, 1));
iCryptChar = (iKeyChar ^ iStringChar).ToString();
strEncrypted = strEncrypted + Strings.Chr(Conversions.ToInteger(iCryptChar));
}
PasswordEncodingRet = Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(strEncrypted));
return PasswordEncodingRet;
}
// 2017-06-05, Joe, 依XML標準定義轉換特殊字元
public static string CInputWithXMLStandard(ref string strInput)
{
string CInputWithXMLStandardRet = default(string);
// 轉換 ' 為 &apos;
CInputWithXMLStandardRet = Strings.Replace(strInput, "'", "&apos;");
// 轉換 & 為 &amp;
CInputWithXMLStandardRet = Strings.Replace(CInputWithXMLStandardRet, "&", "&amp;");
// 轉換 " 為 quot;
CInputWithXMLStandardRet = Strings.Replace(CInputWithXMLStandardRet, "\"", "&quot;");
// 轉換 > 為 &gt;
CInputWithXMLStandardRet = Strings.Replace(CInputWithXMLStandardRet, ">", "&gt;");
// 轉換 < 為 &lt;
CInputWithXMLStandardRet = Strings.Replace(CInputWithXMLStandardRet, "<", "&lt;");
return CInputWithXMLStandardRet;
}
// 2017-06-05, Joe, 依XML標準定義反轉換特殊字元
public static string CUnInputWithXMLStandard(ref string strInput)
{
string CUnInputWithXMLStandardRet = default(string);
// 轉換 ' 為 "&apos;"
CUnInputWithXMLStandardRet = Strings.Replace(strInput, "&apos;", "'");
// 轉換 " 為 quot;
CUnInputWithXMLStandardRet = Strings.Replace(CUnInputWithXMLStandardRet, "&quot;", "\"");
// 轉換 & 為 &amp;
CUnInputWithXMLStandardRet = Strings.Replace(CUnInputWithXMLStandardRet, "&amp;", "&");
// 轉換 > 為 &gt;
CUnInputWithXMLStandardRet = Strings.Replace(CUnInputWithXMLStandardRet, "&gt;", ">");
// 轉換 < 為 &lt;
CUnInputWithXMLStandardRet = Strings.Replace(CUnInputWithXMLStandardRet, "&lt;", "<");
return CUnInputWithXMLStandardRet;
}
// **Add by py 2003/12/04,Gary Lu 20120911:以MESWin1~Win4的版本進行替換
public static string LocalizeWebService(string wsUrl, bool Customize = false)
{
string[] tmpString;
int i;
tmpString = wsUrl.Split('/');
if (Customize == true)
{
if (!string.IsNullOrEmpty(Strings.Trim(gCUSWebServiceHost)))
{
if (tmpString.Length == 6)
{
wsUrl = tmpString[0].ToString() + "/" + tmpString[1].ToString() + "/" + gCUSWebServiceHost + "/" + tmpString[4].ToString() + "/" + tmpString[5].ToString();
}
else if (tmpString.Length == 5)
{
wsUrl = "http://" + gCUSWebServiceHost + "/" + tmpString[tmpString.Length - 1].ToString();
}
}
}
else if (!string.IsNullOrEmpty(Strings.Trim(gMESWebServiceHost)))
{
if (tmpString.Length == 6)
{
// wsUrl = "http://" & gMESWebServiceHost & "/" & tmpString(tmpString.Length - 2).ToString & "/" & tmpString(tmpString.Length - 1).ToString
wsUrl = tmpString[0].ToString() + "/" + tmpString[1].ToString() + "/" + gMESWebServiceHost + "/" + tmpString[4].ToString() + "/" + tmpString[5].ToString();
}
else if (tmpString.Length == 5)
{
wsUrl = "http://" + gMESWebServiceHost + "/" + tmpString[tmpString.Length - 1].ToString();
}
}
if (gEnableSSL)
{
wsUrl = wsUrl.Replace("http://", "https://");
}
return wsUrl;
// Have to assume the web service is on the machine that this application came from
} // LocalizeWebService
public static string LocalizeWebService_ERP(string wsUrl)
{
string[] tmpString;
int i;
tmpString = wsUrl.Split('/');
if (!string.IsNullOrEmpty(Strings.Trim(gERPWebServiceHost)))
{
wsUrl = tmpString[0].ToString() + "/" + tmpString[1].ToString() + "/" + gERPWebServiceHost + "/" + tmpString[4].ToString();
}
if (gEnableSSL) {
wsUrl = wsUrl.Replace("http://", "https://");
}
return wsUrl;
}
// Add By Peter 2005/6/20
public static string GetAppSettings(string key, string section = "")
{
string result = string.Empty;
try
{
if (!string.IsNullOrEmpty(section))
{
result = Conversions.ToString(((Hashtable)GetConfig(section))[key]);
}
else if (string.IsNullOrEmpty(gSettingMode) || string.IsNullOrEmpty(gSettingMode) || gSettingMode.Length == 0)
{
result = AppSettings[key];
}
else
{
Hashtable ht = (Hashtable)GetConfig(gSettingMode);
if (ht != null)
{
result = Conversions.ToString(ht[key]);
if (string.IsNullOrEmpty(result))
{
result = AppSettings[key];
if (string.IsNullOrEmpty(result))
{
result = "";
}
}
}
else
{
result = AppSettings[key];
}
}
}
catch (Exception ex)
{
throw ex;
}
return result;
}
public static string GetSubString(string strValue, int intLength)
{
int intLen;
string strReturn;
// Dim byteValue As Byte() = System.Text.Encoding.UTF8.GetBytes(strValue)
// If intLength > byteValue.Length - 1 Then
// intLen = byteValue.Length - 1
// End If
// Dim strReturn As String = System.Text.Encoding.UTF8.GetString(byteValue, 0, intLen)
intLen = (int)Math.Round(Conversion.Int(intLength / 3d));
strReturn = Strings.Left(strValue, intLen);
return strReturn;
}
}
}

View File

@ -0,0 +1,29 @@
安裝AutoRun順序
1. 複製Resources資料夾至此目錄
2. 點選對應作業系統版本安裝批次檔
32位元 Install_x86.bat
64位元 Install_x64.bat
內容為:
%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe "D:\TFS\messeries\MESSeries\MESClient\AutoRunServiceInstall\AutoRunService.exe"
Pause
3. 滑鼠右鍵 > 以系統管理員身分執行
4. 完成安裝
5. 修改連線字串AutoRunService.exe.config
6. Windows Service啟動 (電腦管理-服務-MES AutoRun Service進行啟用)
7. 將Compiler後檔案AutoRunLib.dll置於D:\TFS\messeries\MESSeries\MESClient\AutoRunServiceInstall中
8. 放置iMESLicxManager.dll於D:\TFS\messeries\MESSeries\MESClient\AutoRunServiceInstall中
-------------------------------------------------------------------------------------------------------------------------------------------------------
解除安裝AutoRun順序
1. Windows Service停止
2. 點選對應作業系統版本安裝批次檔
32位元 Uninstall_x86.bat
64位元 Uninstall_x64.bat
內容為:
%SystemRoot%\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe "D:\TFS\messeries\MESSeries\MESClient\AutoRunServiceInstall\AutoRunService.exe" -u
Pause
3. 滑鼠右鍵 > 以系統管理員身分執行
4. 完成安裝

View File

@ -0,0 +1,41 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRunService", "AutoRunService\AutoRunService.csproj", "{1D8229EF-DEED-0C6F-1A45-76DD01FBF457}"
ProjectSection(ProjectDependencies) = postProject
{7C0468A8-E807-0FF4-0C04-C1AD9B3D7D2A} = {7C0468A8-E807-0FF4-0C04-C1AD9B3D7D2A}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoRunLib", "AutoRunLib\AutoRunLib.csproj", "{7C0468A8-E807-0FF4-0C04-C1AD9B3D7D2A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1D8229EF-DEED-0C6F-1A45-76DD01FBF457}.Debug|x86.ActiveCfg = Debug|Any CPU
{1D8229EF-DEED-0C6F-1A45-76DD01FBF457}.Debug|x86.Build.0 = Debug|Any CPU
{1D8229EF-DEED-0C6F-1A45-76DD01FBF457}.Release|x86.ActiveCfg = Release|Any CPU
{7C0468A8-E807-0FF4-0C04-C1AD9B3D7D2A}.Debug|x86.ActiveCfg = Debug|Any CPU
{7C0468A8-E807-0FF4-0C04-C1AD9B3D7D2A}.Debug|x86.Build.0 = Debug|Any CPU
{7C0468A8-E807-0FF4-0C04-C1AD9B3D7D2A}.Release|x86.ActiveCfg = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 3
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = http://tfs.imestech.com:8080/tfs/messeries6
SccLocalPath0 = .
SccProjectUniqueName1 = AutoRunLib\\AutoRunLib.vbproj
SccProjectName1 = AutoRunLib
SccLocalPath1 = AutoRunLib
SccProjectUniqueName2 = AutoRunService\\AutoRunService.vbproj
SccProjectName2 = AutoRunService
SccLocalPath2 = AutoRunService
EndGlobalSection
EndGlobal