【源码上传】

This commit is contained in:
14278/caihao 2024-01-23 14:01:04 +08:00
parent eb3c5bf67f
commit 8defb91e77
40 changed files with 34241 additions and 0 deletions

View File

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

View File

@ -0,0 +1,273 @@
<?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>AutoLoaderLib_Base</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>AutoLoaderLib_Base</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_S_DLL\</OutputPath>
<DocumentationFile>..\..\..\MES_S_DLL\AutoLoaderLib_Base.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>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>..\..\..\MES_S_DLL\</OutputPath>
<DocumentationFile>..\..\..\MES_S_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>
<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="iMESComSubroutine, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_S_DLL\iMESComSubroutine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="iMESComXML, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_S_DLL\iMESComXML.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="iMESConst, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_S_DLL\iMESConst.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="iMESLog, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_S_DLL\iMESLog.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_C_DLL\ICSharpCode.SharpZipLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="NPOI, Version=2.0.6.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.0.6.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.0.6.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.0.6.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.122.1.0, Culture=neutral, PublicKeyToken=89b483f429c47342, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_S_DLL\Oracle.ManagedDataAccess.dll</HintPath>
</Reference>
<Reference Include="System">
<Name>System</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.Web.Services">
<Name>System.Web.Services</Name>
</Reference>
<Reference Include="System.Xml">
<Name>System.XML</Name>
</Reference>
</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="Web References\wsInvoke\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
<None Include="app.config" />
<None Include="My Project\Settings.settings">
<CustomToolNamespace>AutoLoaderLib_Base.My</CustomToolNamespace>
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="clsAutoLoaderLibrary.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="EPIParseTemplate.cs" />
<Compile Include="modAutoLoaderLibrary.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="ParseNEL.cs" />
<Compile Include="ParsePL.cs" />
<Compile Include="ParsePR.cs" />
<Compile Include="ParseQEL.cs" />
<None Include="NLog.config" />
<None Include="Web References\wsInvoke\Reference.map">
<Generator>MSDiscoCodeGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
<None Include="Web References\wsInvoke\wsInvoke.wsdl" />
<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>
<WebReferenceUrl Include="http://localhost/MESws_Industry/wsInvoke.asmx">
<UrlBehavior>Dynamic</UrlBehavior>
<RelPath>Web References\wsInvoke\</RelPath>
<UpdateFromURL>http://localhost/MESws_Industry/wsInvoke.asmx</UpdateFromURL>
<ServiceLocationURL>
</ServiceLocationURL>
<CachedDynamicPropName>
</CachedDynamicPropName>
<CachedAppSettingsObjectName>MySettings</CachedAppSettingsObjectName>
<CachedSettingsPropName>AutoLoaderLib_wsInvoke_wsInvoke</CachedSettingsPropName>
</WebReferenceUrl>
</ItemGroup>
<ItemGroup>
<None Include="Web References\wsInvoke\wsInvoke.disco" />
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</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,236 @@
using System;
using System.Data;
using System.IO;
using iMESCore.Settings;
using Microsoft.VisualBasic;
using static iMESCore.DataBase.iMESSql;
namespace AutoLoaderLib_Base
{
//調整行業包基底AutoLoaderLib_Base將原有EPIParseTemplate, ParseNEL, ParsePL, ParsePR, ParseQEL等類別進行下架處理
//public abstract class EPIParseTemplate
//{
// // 設定暫存資料表的欄位
// internal abstract bool AddColumns(DataTable dt);
// // 解析資料, 並寫入暫存資料表
// internal abstract bool ParsingFile(DataTable dt, string file);
// // 將暫存資料表寫入資料庫
// internal abstract bool InsertTable(DataTable dt);
// internal IDbConnection objConnection;
// public enum FileTypeEnum
// {
// csv = 0,
// xls = 1,
// dat = 2
// }
// private string[] wildcards = new string[] { "*.csv", "*.xls", "*.dat" };
// private string strDataBaseType; // DataBase Type:oracle, mysql, access
// private string strConnectionString; // Connection string
// private AppSettings objSetting = new AppSettings();
// private DataTable objDataTable;
// private string SourcePath;
// private string DestinationPath;
// private string QueuePath;
// private string FailPath;
// /// <summary>
///// 建構子
///// </summary>
///// <param name="paramSourcePath"></param>
///// <param name="paramDestinationPath"></param>
///// <param name="paramQueuePath"></param>
///// <param name="paramFailPath"></param>
///// <remarks></remarks>
// public EPIParseTemplate(string paramSourcePath, string paramDestinationPath, string paramQueuePath, string paramFailPath)
// {
// objSetting = new AppSettings();
// // //Get database type
// strDataBaseType = objSetting.GetDataBaseType();
// // //Get connection string
// strConnectionString = objSetting.GetConnectionString(strDataBaseType);
// objConnection = CreateConnection(strConnectionString);
// if (Strings.Right(paramSourcePath, 1) != @"\")
// {
// paramSourcePath += @"\";
// }
// SourcePath = paramSourcePath;
// if (Strings.Right(paramDestinationPath, 1) != @"\")
// {
// paramDestinationPath += @"\";
// }
// DestinationPath = paramDestinationPath;
// if (Strings.Right(paramQueuePath, 1) != @"\")
// {
// paramQueuePath += @"\";
// }
// QueuePath = paramQueuePath;
// if (Strings.Right(paramFailPath, 1) != @"\")
// {
// paramFailPath += @"\";
// }
// FailPath = paramFailPath;
// }
// ~EPIParseTemplate()
// {
// if (objConnection != null)
// {
// objConnection = null;
// }
// if (objSetting != null)
// {
// objSetting = null;
// }
// if (objDataTable != null)
// {
// objDataTable = null;
// }
// }
// /// <summary>
///// 解析資料
///// </summary>
///// <param name="paramFileType"></param>
///// <returns></returns>
///// <remarks></remarks>
// public string ParsingData(FileTypeEnum paramFileType)
// {
// string strResult = string.Empty;
// string QueueFile = "";
// string DestinationFile = "";
// string FailFile = "";
// try
// {
// objDataTable = new DataTable("RawData");
// // 設定暫存資料表的欄位
// if (AddColumns(objDataTable))
// {
// foreach (var SourceFile in Directory.GetFiles(SourcePath, wildcards[(int)paramFileType], SearchOption.TopDirectoryOnly))
// {
// if (File.Exists(SourceFile))
// {
// QueueFile = QueuePath + Path.GetFileName(SourceFile);
// DestinationFile = DestinationPath + Path.GetFileName(SourceFile);
// FailFile = FailPath + Path.GetFileName(SourceFile);
// try
// {
// // 將檔案從 Source 移至 Queue
// MoveFile(SourceFile, QueueFile);
// objDataTable.Rows.Clear();
// // 解析資料, 並寫入暫存資料表
// if (ParsingFile(objDataTable, QueueFile))
// {
// // 將暫存資料表寫入資料庫
// if (InsertTable(objDataTable))
// {
// // 將檔案從 Queue 移至 Destination
// MoveFile(QueueFile, DestinationFile);
// }
// }
// }
// catch (Exception ex)
// {
// // 將檔案從 Queue 移至 Fail
// MoveFile(QueueFile, FailFile);
// throw;
// }
// }
// }
// strResult = "success";
// }
// }
// catch (Exception ex)
// {
// strResult = "Message:" + ex.Message + ",StackTrace:" + ex.StackTrace;
// }
// finally
// {
// }
// return strResult;
// }
// /// <summary>
///// 搬移檔案
///// </summary>
///// <param name="paramSourceFile">來源檔案</param>
///// <param name="paramTargetFile">目的檔案</param>
///// <remarks></remarks>
// private void MoveFile(string paramSourceFile, string paramTargetFile)
// {
// try
// {
// // 判斷目的檔案是否已存在, 若存在必須先刪除
// if (File.Exists(paramTargetFile))
// {
// File.Delete(paramTargetFile);
// }
// // 移動檔案至目的
// Directory.Move(paramSourceFile, paramTargetFile);
// }
// catch (Exception ex)
// {
// throw;
// }
// }
//}
}

View File

@ -0,0 +1,101 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// 這段程式碼是由工具產生的。
// 執行階段版本:4.0.30319.42000
//
// 對這個檔案所做的變更可能會造成錯誤的行為,而且如果重新產生程式碼,
// 變更將會遺失。
// </auto-generated>
// ------------------------------------------------------------------------------
using System.Diagnostics;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
namespace AutoLoaderLib_Base.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_Industry/wsInvoke.asmx")]
public string AutoLoaderLib_wsInvoke_wsInvoke
{
get
{
return Conversions.ToString(this["AutoLoaderLib_wsInvoke_wsInvoke"]);
}
}
}
}
namespace AutoLoaderLib_Base.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="AutoLoaderLib_wsInvoke_wsInvoke" Type="(Web Service URL)" Scope="Application">
<Value Profile="(Default)">http://localhost/MESws_Industry/wsInvoke.asmx</Value>
</Setting>
</Settings>
</SettingsFile>

View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
throwExceptions="false"
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
<!-- optional, add some variables
https://github.com/nlog/NLog/wiki/Configuration-file#variables
-->
<!--Notes
please note that the method name won't work well with async methods before NLog 4.3 - it will always show MoveNext.
Please also note that this infers heavy performance hit when doing lots of logging, as it has to capture full StackTrace for every log message.
If symbol symbol information is not available, then it will not be able to output source-code filename or line-number. Symbol information from PDB files must be deployed with the application to retrieve and output source-code line-number. For applications compiled in release mode, then inlining can occur and cause "unexpected" line-numbers.
-->
<variable name="STDLayout" value="${longdate} | [${level:uppercase=true}] | [${threadid}] | [${callsite}]${newline}[${event-properties:item=caller}]${newline}${message}${newline}${exception:format=ToString}${newline}"/>
<variable name="BasePath" value="${basedir}/Logs/"/>
<variable name="STDPath" value="${BasePath}/STD/Cur_${level:uppercase=true}.log"/>
<variable name="ArchivePath" value="${BasePath}/STD/${level:uppercase=true}_{#}.log"/>
<variable name="EAIPath" value="${BasePath}/EAI/Cur_${level:uppercase=true}.log"/>
<variable name="EAIArchivePath" value="${BasePath}/EAI/${level:uppercase=true}_{#}.log"/>
<variable name="CustomerPath" value="${BasePath}/${event-properties:item=NameSpace}/Cur_${level:uppercase=true}.log"/>
<variable name="CustomerArchivePath" value="${BasePath}/${event-properties:item=NameSpace}/${level:uppercase=true}_{#}.log"/>
<variable name="AutoLoderPath" value="${BasePath}/AutoLoder/Cur_${level:uppercase=true}.log"/>
<variable name="AutoLoderArchivePath" value="${BasePath}/AutoLoder/${level:uppercase=true}_{#}.log"/>
<variable name="ArchiveSize" value ="5242880"/>
<variable name="TestSize" value ="1024"/>
<!--
See https://github.com/nlog/nlog/wiki/Configuration-file
for information on customizing logging rules and outputs.
-->
<targets async="true">
<!--
add your targets here
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
-->
<!--
Write events to a file with the date in the filename.
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
-->
<target name="STDFile" xsi:type="File" fileName="${STDPath}" layout="${STDLayout}"
archiveFileName="${ArchivePath}"
archiveAboveSize="${ArchiveSize}"
archiveNumbering ="DateAndSequence"
archiveEvery="Hour"
archiveDateFormat ="yyyy-MM-dd-HH"
maxArchiveDays="7"
encoding="utf-8"
/>
<target name="EAIFile" xsi:type="File" fileName="${EAIPath}" layout="${STDLayout}"
archiveFileName="${EAIArchivePath}"
archiveAboveSize="${ArchiveSize}"
archiveNumbering ="DateAndSequence"
archiveEvery="Hour"
archiveDateFormat ="yyyy-MM-dd-HH"
maxArchiveDays="7"
encoding="utf-8"
/>
<target name="CustomerFile" xsi:type="File" fileName="${CustomerPath}" layout="${STDLayout}"
archiveFileName="${CustomerArchivePath}"
archiveAboveSize="${ArchiveSize}"
archiveNumbering ="DateAndSequence"
archiveEvery="Hour"
archiveDateFormat ="yyyy-MM-dd-HH"
maxArchiveDays="7"
encoding="utf-8"
/>
<target name="AutoLoderFile" xsi:type="File" fileName="${AutoLoderPath}" layout="${STDLayout}"
archiveFileName="${AutoLoderArchivePath}"
archiveAboveSize="${ArchiveSize}"
archiveNumbering ="DateAndSequence"
archiveEvery="Hour"
archiveDateFormat ="yyyy-MM-dd-HH"
maxArchiveDays="7"
encoding="utf-8"
/>
</targets>
<rules>
<!-- add your logging rules here -->
<!--
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
<logger name="*" minlevel="Debug" writeTo="f" />
-->
<!--針對logger levels內的項目增加、刪除,以開啟關閉Log的紀錄。-->
<!--kc*、tc*、ud*目前使用Debug、Error記錄kcXXX、udXXX、tcXXX執行的SQL語句-->
<!--MEStc*、ASM目前使用Debug、Error記錄客製化tc執行的SQL語句-->
<!--MESws*目前使用Info、Debug、Error記錄MESws_STD接口傳入的參數與回傳的資訊-->
<!--tcEAI目前使用Debug、Error記錄tcEAI執行的SQL語句-->
<!--EAIws*目前使用Info記錄EAIws接口傳入的參數與回傳的資訊-->
<logger name="tcEAI*" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="EAIFile" final="true"/>
<logger name="EAIws*" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="EAIFile" final="true"/>
<logger name="kc*" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="STDFile"/>
<logger name="tc*" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="STDFile"/>
<logger name="ud*" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="STDFile"/>
<logger name="MESws*" levels="Trace,Debug,Warn,Error,Fatal" writeTo="STDFile"/>
<logger name="MEStc*" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="CustomerFile"/>
<logger name="ASM" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="CustomerFile"/>
<logger name="General" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="STDFile"/>
<logger name="AutoLoader*" levels="Trace,Debug,Info,Warn,Error,Fatal" writeTo="AutoLoderFile"/>
</rules>
</nlog>

View File

@ -0,0 +1,248 @@
using System;
using System.Data;
using System.Diagnostics;
using System.IO;
using Microsoft.VisualBasic.CompilerServices;
using static iMESCore.DataBase.iMESSql;
namespace AutoLoaderLib_Base
{
//調整行業包基底AutoLoaderLib_Base將原有EPIParseTemplate, ParseNEL, ParsePL, ParsePR, ParseQEL等類別進行下架處理 '//^_^ADD BY H-14278 2023-11-29 FOR
//public class ParseNEL : EPIParseTemplate
//{
// // 呼叫父類別的建構子
// public ParseNEL(string paramSourcePath, string paramDestinationPath, string paramQueuePath, string paramFailPath) : base(paramSourcePath, paramDestinationPath, paramQueuePath, paramFailPath)
// {
// }
// /// <summary>
// /// 設定暫存資料表的欄位
// /// </summary>
// /// <param name="dt"></param>
// /// <returns></returns>
// /// <remarks></remarks>
// internal override bool AddColumns(DataTable dt)
// {
// bool blnResult = false;
// try
// {
// dt.Columns.Add("WaferID", Type.GetType("System.String"));
// dt.Columns.Add("POS", Type.GetType("System.Decimal"));
// dt.Columns.Add("LOP1", Type.GetType("System.Decimal"));
// dt.Columns.Add("WLD1", Type.GetType("System.Decimal"));
// dt.Columns.Add("VF1", Type.GetType("System.Decimal"));
// blnResult = true;
// }
// catch (Exception ex)
// {
// throw;
// }
// return blnResult;
// }
// /// <summary>
// /// 將暫存資料表寫入資料庫
// /// </summary>
// /// <param name="dt"></param>
// /// <returns></returns>
// /// <remarks></remarks>
// internal override bool InsertTable(DataTable dt)
// {
// bool blnResult = false;
// string strSQL_Raw;
// string strSQL_Avg;
// string WaferID = "";
// decimal LOP1 = 0m;
// decimal WLD1 = 0m;
// decimal VF1 = 0m;
// strSQL_Raw = " INSERT INTO TBL_LEDLD_EL_N_RAW " + " (WaferID, CreateDate, POS, LOP1, WLD1, VF1) " + " VALUES ('{0}', SYSDATE, {1}, {2}, {3}, {4}) ";
// strSQL_Avg = " INSERT INTO TBL_LEDLD_EL_N " + " (WaferID, CreateDate, LOP1, WLD1, VF1) " + " VALUES ('{0}', SYSDATE, {1}, {2}, {3}) ";
// try
// {
// using (var oTran = objConnection.BeginTransaction())
// {
// try
// {
// using (var cmd = CreateCommand())
// {
// cmd.Connection = objConnection;
// cmd.Transaction = oTran;
// if (dt.Rows.Count > 0)
// {
// for (int i = 0, loopTo = dt.Rows.Count - 1; i <= loopTo; i++)
// {
// cmd.CommandText = string.Format(strSQL_Raw, dt.Rows[i]["WaferID"], dt.Rows[i]["POS"], dt.Rows[i]["LOP1"], dt.Rows[i]["WLD1"], dt.Rows[i]["VF1"]);
// cmd.ExecuteNonQuery();
// WaferID = Conversions.ToString(dt.Rows[i]["WaferID"]);
// LOP1 = LOP1 + Convert.ToDecimal(dt.Rows[i]["LOP1"]);
// WLD1 = WLD1 + Convert.ToDecimal(dt.Rows[i]["WLD1"]);
// VF1 = VF1 + Convert.ToDecimal(dt.Rows[i]["VF1"]);
// }
// cmd.CommandText = string.Format(strSQL_Avg, WaferID, LOP1 / dt.Rows.Count, WLD1 / dt.Rows.Count, VF1 / dt.Rows.Count);
// cmd.ExecuteNonQuery();
// }
// }
// oTran.Commit();
// blnResult = true;
// }
// catch (Exception ex)
// {
// oTran.Rollback();
// throw;
// }
// }
// }
// catch (Exception ex)
// {
// throw;
// }
// return blnResult;
// }
// /// <summary>
// /// 解析資料, 並寫入暫存資料表
// /// </summary>
// /// <param name="dt"></param>
// /// <param name="file"></param>
// /// <returns></returns>
// /// <remarks></remarks>
// internal override bool ParsingFile(DataTable dt, string file)
// {
// bool blnResult = false;
// DataRow dr = null;
// string line;
// string[] tmpData;
// bool startParsing = false;
// string WaferID;
// try
// {
// // 檔名即為 WaferID
// var fi = new FileInfo(file);
// WaferID = fi.Name.Replace(fi.Extension, "");
// fi = null;
// using (var sr = new StreamReader(file))
// {
// do
// {
// line = sr.ReadLine();
// if (!string.IsNullOrEmpty(line))
// {
// if (startParsing)
// {
// tmpData = line.Split(',');
// dr = dt.NewRow();
// dr["WaferID"] = WaferID;
// dr["POS"] = Convert.ToDecimal(tmpData[0].Trim());
// dr["LOP1"] = Convert.ToDecimal(tmpData[4].Trim());
// dr["WLD1"] = Convert.ToDecimal(tmpData[5].Trim());
// dr["VF1"] = Convert.ToDecimal(tmpData[3].Trim());
// dt.Rows.Add(dr);
// }
// else
// {
// Debug.Print(line);
// if (line.IndexOf("PosX") >= 0 && line.IndexOf("PosY") >= 0)
// {
// startParsing = true;
// }
// }
// }
// }
// while (!(line == null));
// blnResult = true;
// }
// }
// catch (Exception ex)
// {
// throw;
// }
// finally
// {
// if (dr != null)
// {
// dr = null;
// }
// }
// return blnResult;
// }
//}
}

View File

@ -0,0 +1,245 @@
using System;
using System.Data;
using System.IO;
using static iMESCore.DataBase.iMESSql;
namespace AutoLoaderLib_Base
{
// 調整行業包基底AutoLoaderLib_Base將原有EPIParseTemplate, ParseNEL, ParsePL, ParsePR, ParseQEL等類別進行下架處理
//public class ParsePL : EPIParseTemplate
//{
// // 呼叫父類別的建構子
// public ParsePL(string paramSourcePath, string paramDestinationPath, string paramQueuePath, string paramFailPath) : base(paramSourcePath, paramDestinationPath, paramQueuePath, paramFailPath)
// {
// }
// /// <summary>
///// 設定暫存資料表的欄位
///// </summary>
///// <param name="dt"></param>
///// <returns></returns>
///// <remarks></remarks>
// internal override bool AddColumns(DataTable dt)
// {
// bool blnResult = false;
// try
// {
// dt.Columns.Add("WaferID", Type.GetType("System.String"));
// dt.Columns.Add("MeasurementTime", Type.GetType("System.String"));
// dt.Columns.Add("NG", Type.GetType("System.Decimal"));
// dt.Columns.Add("OK", Type.GetType("System.Decimal"));
// dt.Columns.Add("Yield", Type.GetType("System.String"));
// dt.Columns.Add("Setup", Type.GetType("System.String"));
// dt.Columns.Add("LaserOutput", Type.GetType("System.String"));
// dt.Columns.Add("WPMIN", Type.GetType("System.Decimal"));
// dt.Columns.Add("WPMAX", Type.GetType("System.Decimal"));
// dt.Columns.Add("WPAVG", Type.GetType("System.Decimal"));
// dt.Columns.Add("WPDEV", Type.GetType("System.Decimal"));
// dt.Columns.Add("FWHMMIN", Type.GetType("System.Decimal"));
// dt.Columns.Add("FWHMMAX", Type.GetType("System.Decimal"));
// dt.Columns.Add("FWHMAVG", Type.GetType("System.Decimal"));
// dt.Columns.Add("FWHMDEV", Type.GetType("System.Decimal"));
// dt.Columns.Add("WDMIN", Type.GetType("System.Decimal"));
// dt.Columns.Add("WDMAX", Type.GetType("System.Decimal"));
// dt.Columns.Add("WDAVG", Type.GetType("System.Decimal"));
// dt.Columns.Add("WDDEV", Type.GetType("System.Decimal"));
// blnResult = true;
// }
// catch (Exception ex)
// {
// throw;
// }
// return blnResult;
// }
// /// <summary>
///// 將暫存資料表寫入資料庫
///// </summary>
///// <param name="dt"></param>
///// <returns></returns>
///// <remarks></remarks>
// internal override bool InsertTable(DataTable dt)
// {
// bool blnResult = false;
// string strSQL;
// strSQL = " INSERT INTO TBL_LEDLD_PL " + " (WaferID, CreateDate, MeasurementTime, NG, OK, Yield, Setup, LaserOutput, " + " WPMIN, WPMAX, WPAVG, WPDEV, " + " FWHMMIN, FWHMMAX, FWHMAVG, FWHMDEV, " + " WDMIN, WDMAX, WDAVG, WDDEV) " + " VALUES ('{0}', SYSDATE, '{1}', {2}, {3}, '{4}', '{5}', '{6}', " + " {7}, {8}, {9}, {10}, " + " {11}, {12}, {13}, {14}, " + " {15}, {16}, {17}, {18}) ";
// try
// {
// using (var oTran = objConnection.BeginTransaction())
// {
// try
// {
// using (var cmd = CreateCommand())
// {
// cmd.Connection = objConnection;
// cmd.Transaction = oTran;
// for (int i = 0, loopTo = dt.Rows.Count - 1; i <= loopTo; i++)
// {
// cmd.CommandText = string.Format(strSQL, dt.Rows[i]["WaferID"], dt.Rows[i]["MeasurementTime"], dt.Rows[i]["NG"], dt.Rows[i]["OK"], dt.Rows[i]["Yield"], dt.Rows[i]["Setup"], dt.Rows[i]["LaserOutput"], dt.Rows[i]["WPMIN"], dt.Rows[i]["WPMAX"], dt.Rows[i]["WPAVG"], dt.Rows[i]["WPDEV"], dt.Rows[i]["FWHMMIN"], dt.Rows[i]["FWHMMAX"], dt.Rows[i]["FWHMAVG"], dt.Rows[i]["FWHMDEV"], dt.Rows[i]["WDMIN"], dt.Rows[i]["WDMAX"], dt.Rows[i]["WDAVG"], dt.Rows[i]["WDDEV"]);
// cmd.ExecuteNonQuery();
// }
// }
// oTran.Commit();
// blnResult = true;
// }
// catch (Exception ex)
// {
// oTran.Rollback();
// throw;
// }
// }
// }
// catch (Exception ex)
// {
// throw;
// }
// return blnResult;
// }
// /// <summary>
///// 解析資料, 並寫入暫存資料表
///// </summary>
///// <param name="dt"></param>
///// <param name="file"></param>
///// <returns></returns>
///// <remarks></remarks>
// internal override bool ParsingFile(DataTable dt, string file)
// {
// bool blnResult = false;
// DataRow dr = null;
// string line;
// string[] tmpData;
// string LotNo;
// try
// {
// // 檔名即為 LotNo
// var fi = new FileInfo(file);
// LotNo = fi.Name.Replace(fi.Extension, "");
// fi = null;
// using (var sr = new StreamReader(file))
// {
// // 第一行是欄位抬頭
// line = sr.ReadLine();
// do
// {
// line = sr.ReadLine();
// if (!string.IsNullOrEmpty(line))
// {
// tmpData = line.Split(',');
// dr = dt.NewRow();
// dr["WaferID"] = tmpData[4].Trim() + tmpData[5].Trim().Substring(tmpData[5].Trim().Length - 2);
// dr["MeasurementTime"] = tmpData[3].Trim();
// dr["NG"] = Convert.ToDecimal(tmpData[11].Trim());
// dr["OK"] = Convert.ToDecimal(tmpData[12].Trim());
// dr["Yield"] = tmpData[13].Trim();
// dr["Setup"] = tmpData[14].Trim();
// dr["LaserOutput"] = tmpData[15].Trim();
// dr["WPMIN"] = Convert.ToDecimal(tmpData[16].Trim());
// dr["WPMAX"] = Convert.ToDecimal(tmpData[17].Trim());
// dr["WPAVG"] = Convert.ToDecimal(tmpData[18].Trim());
// dr["WPDEV"] = Convert.ToDecimal(tmpData[20].Trim());
// dr["FWHMMIN"] = Convert.ToDecimal(tmpData[28].Trim());
// dr["FWHMMAX"] = Convert.ToDecimal(tmpData[29].Trim());
// dr["FWHMAVG"] = Convert.ToDecimal(tmpData[30].Trim());
// dr["FWHMDEV"] = Convert.ToDecimal(tmpData[32].Trim());
// dr["WDMIN"] = Convert.ToDecimal(tmpData[40].Trim());
// dr["WDMAX"] = Convert.ToDecimal(tmpData[41].Trim());
// dr["WDAVG"] = Convert.ToDecimal(tmpData[42].Trim());
// dr["WDDEV"] = Convert.ToDecimal(tmpData[44].Trim());
// dt.Rows.Add(dr);
// }
// }
// while (!string.IsNullOrEmpty(line));
// blnResult = true;
// }
// }
// catch (Exception ex)
// {
// throw;
// }
// finally
// {
// if (dr != null)
// {
// dr = null;
// }
// }
// return blnResult;
// }
//}
}

View File

@ -0,0 +1,385 @@
using System;
using System.Data;
using System.IO;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using static iMESCore.DataBase.iMESSql;
namespace AutoLoaderLib_Base
{
//調整行業包基底AutoLoaderLib_Base將原有EPIParseTemplate, ParseNEL, ParsePL, ParsePR, ParseQEL等類別進行下架處理
//public class ParsePR : EPIParseTemplate
//{
// // 呼叫父類別的建構子
// public ParsePR(string paramSourcePath, string paramDestinationPath, string paramQueuePath, string paramFailPath) : base(paramSourcePath, paramDestinationPath, paramQueuePath, paramFailPath)
// {
// }
// /// <summary>
///// 設定暫存資料表的欄位
///// </summary>
///// <param name="dt"></param>
///// <returns></returns>
///// <remarks></remarks>
// internal override bool AddColumns(DataTable dt)
// {
// bool blnResult = false;
// try
// {
// dt.Columns.Add("WaferID", Type.GetType("System.String"));
// dt.Columns.Add("RawData", Type.GetType("System.String"));
// dt.Columns.Add("Average", Type.GetType("System.Decimal"));
// dt.Columns.Add("Diff1", Type.GetType("System.Decimal"));
// dt.Columns.Add("Diff2", Type.GetType("System.Decimal"));
// dt.Columns.Add("PR_GRADE", Type.GetType("System.String"));
// dt.Columns.Add("PR_RESULT", Type.GetType("System.String"));
// blnResult = true;
// }
// catch (Exception ex)
// {
// throw;
// }
// return blnResult;
// }
// /// <summary>
///// 將暫存資料表寫入資料庫
///// </summary>
///// <param name="dt"></param>
///// <returns></returns>
///// <remarks></remarks>
// internal override bool InsertTable(DataTable dt)
// {
// bool blnResult = false;
// string strSQL;
// string strSQL2;
// string strSQL3;
// const string PR_GRADE = "PR Grade";
// // 新增 PR 資料
// strSQL = " INSERT INTO TBL_LEDLD_PR " + " (WaferID, CreateDate, RawData, Average, Diff1, Diff2, PR_GRADE, PR_RESULT) " + " VALUES ('{0}', SYSDATE, '{1}', {2}, {3}, {4}, '{5}', '{6}') ";
// // 刪除 ComponentProperty PR_GRADE 的資料
// strSQL2 = " DELETE TBLWIPCOMPONENTPROPERTY " + " WHERE LOTNO = '{0}' " + " AND COMPONENTNO = '{1}' " + " AND PROPERTYNO = '{2}' ";
// // 新增 ComponentProperty PR_GRADE 的資料
// strSQL3 = " INSERT INTO TBLWIPCOMPONENTPROPERTY " + " (LOTNO, COMPONENTNO, PROPERTYNO, PROPERTYVALUE) " + " VALUES ('{0}', '{1}', '{2}', '{3}') ";
// try
// {
// using (var oTran = objConnection.BeginTransaction())
// {
// try
// {
// using (var cmd = CreateCommand())
// {
// cmd.Connection = objConnection;
// cmd.Transaction = oTran;
// for (int i = 0, loopTo = dt.Rows.Count - 1; i <= loopTo; i++)
// {
// cmd.CommandText = string.Format(strSQL, dt.Rows[i]["WaferID"] +
// "", dt.Rows[i]["RawData"] + "", dt.Rows[i]["Average"], dt.Rows[i]["Diff1"], dt.Rows[i]["Diff2"], dt.Rows[i]["PR_GRADE"] + "", dt.Rows[i]["PR_RESULT"] +
// "");
// cmd.ExecuteNonQuery();
// cmd.CommandText = string.Format(strSQL2, Strings.Mid(Conversions.ToString(dt.Rows[i]["WaferID"] +
// ""), 1, 10), dt.Rows[i]["WaferID"] + "", PR_GRADE);
// cmd.ExecuteNonQuery();
// cmd.CommandText = string.Format(strSQL3, Strings.Mid(Conversions.ToString(dt.Rows[i]["WaferID"] +
// ""), 1, 10), dt.Rows[i]["WaferID"] + "", PR_GRADE, dt.Rows[i]["PR_GRADE"] + "");
// cmd.ExecuteNonQuery();
// }
// }
// oTran.Commit();
// blnResult = true;
// }
// catch (Exception ex)
// {
// oTran.Rollback();
// throw;
// }
// }
// }
// catch (Exception ex)
// {
// throw;
// }
// return blnResult;
// }
// /// <summary>
///// 解析資料, 並寫入暫存資料表
///// </summary>
///// <param name="dt"></param>
///// <param name="file"></param>
///// <returns></returns>
///// <remarks></remarks>
// internal override bool ParsingFile(DataTable dt, string file)
// {
// bool blnResult = false;
// DataRow dr = null;
// string line;
// string[] tmpData;
// string WaferID;
// string RawData = "";
// decimal Average = 0m;
// decimal Diff1 = 0m;
// decimal Diff2 = 0m;
// string PR_Grade;
// string PR_Result;
// try
// {
// // 檔名即為 WaferID
// var fi = new FileInfo(file);
// WaferID = fi.Name.Replace(fi.Extension, "");
// fi = null;
// using (var sr = new StreamReader(file))
// {
// do
// {
// line = sr.ReadLine();
// if (!string.IsNullOrEmpty(line))
// {
// tmpData = line.Split('\t');
// if (tmpData != null && tmpData.Length == 2)
// {
// if (!Information.IsNumeric(tmpData[1]))
// {
// tmpData[1] = "0";
// }
// switch (tmpData[0].ToUpper() ?? "")
// {
// case "AVERAGE":
// {
// Average = Convert.ToDecimal(tmpData[1]);
// break;
// }
// case "DIFF1":
// {
// Diff1 = Convert.ToDecimal(tmpData[1]);
// break;
// }
// case "DIFF2":
// {
// Diff2 = Convert.ToDecimal(tmpData[1]);
// break;
// }
// default:
// {
// RawData += tmpData[0] + "=" + tmpData[1] + ",";
// break;
// }
// }
// }
// }
// }
// while (!string.IsNullOrEmpty(line));
// if (RawData.Length > 0)
// {
// RawData = RawData.Substring(0, RawData.Length - 1);
// // 依 Average 取出 Grade
// PR_Grade = PRGrade(Average);
// if (string.IsNullOrEmpty(PR_Grade))
// {
// throw new Exception("PR_Grade fail。");
// }
// // 依 Diff 取出 Grade
// switch (PRGrade(Diff1) ?? "")
// {
// case "":
// {
// throw new Exception("PR_Result fail。");
// }
// case "N/A":
// {
// PR_Result = "NG";
// break;
// }
// default:
// {
// PR_Result = "OK";
// break;
// }
// }
// dr = dt.NewRow();
// dr["WaferID"] = WaferID;
// dr["RawData"] = RawData;
// dr["Average"] = Average;
// dr["Diff1"] = Diff1;
// dr["Diff2"] = Diff2;
// dr["PR_GRADE"] = PR_Grade;
// dr["PR_RESULT"] = PR_Result;
// dt.Rows.Add(dr);
// blnResult = true;
// }
// }
// }
// catch (Exception ex)
// {
// throw;
// }
// finally
// {
// if (dr != null)
// {
// dr = null;
// }
// }
// return blnResult;
// }
// /// <summary>
///// PR 等級編碼原則
///// </summary>
///// <param name="value"></param>
///// <returns></returns>
///// <remarks></remarks>
// private string PRGrade(decimal value)
// {
// string strGrade = "N/A";
// string[] tmpData;
// var CollectionGrade = new Collection();
// CollectionGrade.Add("0~1.5~A1");
// CollectionGrade.Add("1.5~2~A2");
// CollectionGrade.Add("2~3~A3");
// CollectionGrade.Add("3~6~A4");
// CollectionGrade.Add("6~9~A5");
// CollectionGrade.Add("9~12~A6");
// CollectionGrade.Add("12~15~A7");
// CollectionGrade.Add("15~18~A8");
// CollectionGrade.Add("18~24~A9");
// CollectionGrade.Add("24~30~AA");
// CollectionGrade.Add("30~36~AB");
// CollectionGrade.Add("36~9999~AC");
// try
// {
// foreach (string str in CollectionGrade)
// {
// tmpData = Strings.Split(str, "~");
// if (tmpData.Length != 3)
// {
// break;
// }
// if (!Information.IsNumeric(tmpData[0]) || !Information.IsNumeric(tmpData[1]))
// {
// break;
// }
// if ((double)value >= Conversions.ToDouble(tmpData[0]) && (double)value < Conversions.ToDouble(tmpData[1]))
// {
// strGrade = tmpData[2];
// break;
// }
// }
// }
// catch (Exception ex)
// {
// strGrade = "";
// }
// return strGrade;
// }
//}
}

View File

@ -0,0 +1,259 @@
using System;
using System.Data;
using System.IO;
using Microsoft.VisualBasic.CompilerServices;
using static iMESCore.DataBase.iMESSql;
namespace AutoLoaderLib_Base
{
// 調整行業包基底AutoLoaderLib_Base將原有EPIParseTemplate, ParseNEL, ParsePL, ParsePR, ParseQEL等類別進行下架處理
//public class ParseQEL : EPIParseTemplate
//{
// // 呼叫父類別的建構子
// public ParseQEL(string paramSourcePath, string paramDestinationPath, string paramQueuePath, string paramFailPath) : base(paramSourcePath, paramDestinationPath, paramQueuePath, paramFailPath)
// {
// }
// /// <summary>
// /// 設定暫存資料表的欄位
// /// </summary>
// /// <param name="dt"></param>
// /// <returns></returns>
// /// <remarks></remarks>
// internal override bool AddColumns(DataTable dt)
// {
// bool blnResult = false;
// try
// {
// dt.Columns.Add("WaferID", Type.GetType("System.String"));
// dt.Columns.Add("POS", Type.GetType("System.Decimal"));
// dt.Columns.Add("LOP1", Type.GetType("System.Decimal"));
// dt.Columns.Add("LOP2", Type.GetType("System.Decimal"));
// dt.Columns.Add("WLP1", Type.GetType("System.Decimal"));
// dt.Columns.Add("WLD1", Type.GetType("System.Decimal"));
// dt.Columns.Add("VF1", Type.GetType("System.Decimal"));
// dt.Columns.Add("VF2", Type.GetType("System.Decimal"));
// blnResult = true;
// }
// catch (Exception ex)
// {
// throw;
// }
// return blnResult;
// }
// /// <summary>
// /// 將暫存資料表寫入資料庫
// /// </summary>
// /// <param name="dt"></param>
// /// <returns></returns>
// /// <remarks></remarks>
// internal override bool InsertTable(DataTable dt)
// {
// bool blnResult = false;
// string strSQL_Raw;
// string strSQL_Avg;
// string WaferID = "";
// decimal LOP1 = 0m;
// decimal LOP2 = 0m;
// decimal WLP1 = 0m;
// decimal WLD1 = 0m;
// decimal VF1 = 0m;
// decimal VF2 = 0m;
// strSQL_Raw = " INSERT INTO TBL_LEDLD_EL_Q_RAW " + " (WaferID, CreateDate, POS, LOP1, LOP2, WLP1, WLD1, VF1, VF2) " + " VALUES ('{0}', SYSDATE, {1}, {2}, {3}, {4}, {5}, {6}, {7}) ";
// strSQL_Avg = " INSERT INTO TBL_LEDLD_EL_Q " + " (WaferID, CreateDate, LOP1, LOP2, WLP1, WLD1, VF1, VF2) " + " VALUES ('{0}', SYSDATE, {1}, {2}, {3}, {4}, {5}, {6}) ";
// try
// {
// using (var oTran = objConnection.BeginTransaction())
// {
// try
// {
// using (var cmd = CreateCommand())
// {
// cmd.Connection = objConnection;
// cmd.Transaction = oTran;
// if (dt.Rows.Count > 0)
// {
// for (int i = 0, loopTo = dt.Rows.Count - 1; i <= loopTo; i++)
// {
// cmd.CommandText = string.Format(strSQL_Raw, dt.Rows[i]["WaferID"], dt.Rows[i]["POS"], dt.Rows[i]["LOP1"], dt.Rows[i]["LOP2"], dt.Rows[i]["WLP1"], dt.Rows[i]["WLD1"], dt.Rows[i]["VF1"], dt.Rows[i]["VF2"]);
// cmd.ExecuteNonQuery();
// WaferID = Conversions.ToString(dt.Rows[i]["WaferID"]);
// LOP1 = LOP1 + Convert.ToDecimal(dt.Rows[i]["LOP1"]);
// LOP2 = LOP2 + Convert.ToDecimal(dt.Rows[i]["LOP2"]);
// WLP1 = WLP1 + Convert.ToDecimal(dt.Rows[i]["WLP1"]);
// WLD1 = WLD1 + Convert.ToDecimal(dt.Rows[i]["WLD1"]);
// VF1 = VF1 + Convert.ToDecimal(dt.Rows[i]["VF1"]);
// VF2 = VF2 + Convert.ToDecimal(dt.Rows[i]["VF2"]);
// }
// cmd.CommandText = string.Format(strSQL_Avg, WaferID, LOP1 / dt.Rows.Count, LOP2 / dt.Rows.Count, WLP1 / dt.Rows.Count, WLD1 / dt.Rows.Count, VF1 / dt.Rows.Count, VF2 / dt.Rows.Count);
// cmd.ExecuteNonQuery();
// }
// }
// oTran.Commit();
// blnResult = true;
// }
// catch (Exception ex)
// {
// oTran.Rollback();
// throw;
// }
// }
// }
// catch (Exception ex)
// {
// throw;
// }
// return blnResult;
// }
// /// <summary>
// /// 解析資料, 並寫入暫存資料表
// /// </summary>
// /// <param name="dt"></param>
// /// <param name="file"></param>
// /// <returns></returns>
// /// <remarks></remarks>
// internal override bool ParsingFile(DataTable dt, string file)
// {
// bool blnResult = false;
// DataRow dr = null;
// string line;
// string[] tmpData;
// bool startParsing = false;
// string WaferID;
// try
// {
// // 檔名即為 WaferID
// var fi = new FileInfo(file);
// WaferID = fi.Name.Replace(fi.Extension, "");
// fi = null;
// using (var sr = new StreamReader(file))
// {
// do
// {
// line = sr.ReadLine();
// if (!string.IsNullOrEmpty(line))
// {
// if (startParsing)
// {
// tmpData = line.Split(',');
// dr = dt.NewRow();
// dr["WaferID"] = WaferID;
// dr["POS"] = Convert.ToDecimal(tmpData[0].Trim());
// dr["LOP1"] = Convert.ToDecimal(tmpData[4].Trim());
// dr["LOP2"] = Convert.ToDecimal(tmpData[14].Trim());
// dr["WLP1"] = Convert.ToDecimal(tmpData[6].Trim());
// dr["WLD1"] = Convert.ToDecimal(tmpData[5].Trim());
// dr["VF1"] = Convert.ToDecimal(tmpData[3].Trim());
// dr["VF2"] = Convert.ToDecimal(tmpData[13].Trim());
// dt.Rows.Add(dr);
// }
// else if (line.IndexOf("PosX") >= 0 && line.IndexOf("PosY") >= 0)
// {
// startParsing = true;
// }
// }
// }
// while (!(line == null));
// blnResult = true;
// }
// }
// catch (Exception ex)
// {
// throw;
// }
// finally
// {
// if (dr != null)
// {
// dr = null;
// }
// }
// return blnResult;
// }
//}
}

View File

@ -0,0 +1,779 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// 這段程式碼是由工具產生的。
// 執行階段版本:4.0.30319.42000
//
// 對這個檔案所做的變更可能會造成錯誤的行為,而且如果重新產生程式碼,
// 變更將會遺失。
// </auto-generated>
// ------------------------------------------------------------------------------
using System;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Serialization;
using Microsoft.VisualBasic.CompilerServices;
//
// 原始程式碼已由 Microsoft.VSDesigner 自動產生,版本 4.0.30319.42000。
//
namespace AutoLoaderLib_Base.wsInvoke
{
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
[DebuggerStepThrough()]
[DesignerCategory("code")]
[WebServiceBinding(Name = "wsInvokeSoap", Namespace = "http://www.imestech.com/wsInvoke")]
[XmlInclude(typeof(object[]))]
public partial class wsInvoke : SoapHttpClientProtocol
{
private System.Threading.SendOrPostCallback invokeSrvOperationCompleted;
private System.Threading.SendOrPostCallback invokeSrv_XmlOperationCompleted;
private System.Threading.SendOrPostCallback invokeSrv_Xml_SessionOperationCompleted;
private System.Threading.SendOrPostCallback invokeSrv_DataTableParameterOperationCompleted;
private System.Threading.SendOrPostCallback invokeSrv_DataTableOperationCompleted;
private System.Threading.SendOrPostCallback invokeSrv_DataSetOperationCompleted;
private System.Threading.SendOrPostCallback invokeSrv_SessionOperationCompleted;
private System.Threading.SendOrPostCallback TestOperationCompleted;
private bool useDefaultCredentialsSetExplicitly;
/// <remarks/>
public wsInvoke() : base()
{
Url = My.MySettings.Default.AutoLoaderLib_wsInvoke_wsInvoke;
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 invokeSrvCompletedEventHandler invokeSrvCompleted;
/// <remarks/>
public event invokeSrv_XmlCompletedEventHandler invokeSrv_XmlCompleted;
/// <remarks/>
public event invokeSrv_Xml_SessionCompletedEventHandler invokeSrv_Xml_SessionCompleted;
/// <remarks/>
public event invokeSrv_DataTableParameterCompletedEventHandler invokeSrv_DataTableParameterCompleted;
/// <remarks/>
public event invokeSrv_DataTableCompletedEventHandler invokeSrv_DataTableCompleted;
/// <remarks/>
public event invokeSrv_DataSetCompletedEventHandler invokeSrv_DataSetCompleted;
/// <remarks/>
public event invokeSrv_SessionCompletedEventHandler invokeSrv_SessionCompleted;
/// <remarks/>
public event TestCompletedEventHandler TestCompleted;
/// <remarks/>
[SoapDocumentMethod("http://www.imestech.com/wsInvoke/invokeSrv", RequestNamespace = "http://www.imestech.com/wsInvoke", ResponseNamespace = "http://www.imestech.com/wsInvoke", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public object invokeSrv(string method, object[] parameters)
{
object[] results = Invoke("invokeSrv", new object[] { method, parameters });
return results[0];
}
/// <remarks/>
public IAsyncResult BegininvokeSrv(string method, object[] parameters, AsyncCallback callback, object asyncState)
{
return BeginInvoke("invokeSrv", new object[] { method, parameters }, callback, asyncState);
}
/// <remarks/>
public object EndinvokeSrv(IAsyncResult asyncResult)
{
object[] results = EndInvoke(asyncResult);
return results[0];
}
/// <remarks/>
public void invokeSrvAsync(string method, object[] parameters)
{
invokeSrvAsync(method, parameters, null);
}
/// <remarks/>
public void invokeSrvAsync(string method, object[] parameters, object userState)
{
if (invokeSrvOperationCompleted == null)
{
invokeSrvOperationCompleted = OninvokeSrvOperationCompleted;
}
InvokeAsync("invokeSrv", new object[] { method, parameters }, invokeSrvOperationCompleted, userState);
}
private void OninvokeSrvOperationCompleted(object arg)
{
if (invokeSrvCompleted != null)
{
InvokeCompletedEventArgs invokeArgs = (InvokeCompletedEventArgs)arg;
invokeSrvCompleted?.Invoke(this, new invokeSrvCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[SoapDocumentMethod("http://www.imestech.com/wsInvoke/invokeSrv_Xml", RequestNamespace = "http://www.imestech.com/wsInvoke", ResponseNamespace = "http://www.imestech.com/wsInvoke", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public object invokeSrv_Xml(string method, string inXMl)
{
object[] results = Invoke("invokeSrv_Xml", new object[] { method, inXMl });
return results[0];
}
/// <remarks/>
public IAsyncResult BegininvokeSrv_Xml(string method, string inXMl, AsyncCallback callback, object asyncState)
{
return BeginInvoke("invokeSrv_Xml", new object[] { method, inXMl }, callback, asyncState);
}
/// <remarks/>
public object EndinvokeSrv_Xml(IAsyncResult asyncResult)
{
object[] results = EndInvoke(asyncResult);
return results[0];
}
/// <remarks/>
public void invokeSrv_XmlAsync(string method, string inXMl)
{
invokeSrv_XmlAsync(method, inXMl, null);
}
/// <remarks/>
public void invokeSrv_XmlAsync(string method, string inXMl, object userState)
{
if (invokeSrv_XmlOperationCompleted == null)
{
invokeSrv_XmlOperationCompleted = OninvokeSrv_XmlOperationCompleted;
}
InvokeAsync("invokeSrv_Xml", new object[] { method, inXMl }, invokeSrv_XmlOperationCompleted, userState);
}
private void OninvokeSrv_XmlOperationCompleted(object arg)
{
if (invokeSrv_XmlCompleted != null)
{
InvokeCompletedEventArgs invokeArgs = (InvokeCompletedEventArgs)arg;
invokeSrv_XmlCompleted?.Invoke(this, new invokeSrv_XmlCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[SoapDocumentMethod("http://www.imestech.com/wsInvoke/invokeSrv_Xml_Session", RequestNamespace = "http://www.imestech.com/wsInvoke", ResponseNamespace = "http://www.imestech.com/wsInvoke", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public object invokeSrv_Xml_Session(string method, string inXMl)
{
object[] results = Invoke("invokeSrv_Xml_Session", new object[] { method, inXMl });
return results[0];
}
/// <remarks/>
public IAsyncResult BegininvokeSrv_Xml_Session(string method, string inXMl, AsyncCallback callback, object asyncState)
{
return BeginInvoke("invokeSrv_Xml_Session", new object[] { method, inXMl }, callback, asyncState);
}
/// <remarks/>
public object EndinvokeSrv_Xml_Session(IAsyncResult asyncResult)
{
object[] results = EndInvoke(asyncResult);
return results[0];
}
/// <remarks/>
public void invokeSrv_Xml_SessionAsync(string method, string inXMl)
{
invokeSrv_Xml_SessionAsync(method, inXMl, null);
}
/// <remarks/>
public void invokeSrv_Xml_SessionAsync(string method, string inXMl, object userState)
{
if (invokeSrv_Xml_SessionOperationCompleted == null)
{
invokeSrv_Xml_SessionOperationCompleted = OninvokeSrv_Xml_SessionOperationCompleted;
}
InvokeAsync("invokeSrv_Xml_Session", new object[] { method, inXMl }, invokeSrv_Xml_SessionOperationCompleted, userState);
}
private void OninvokeSrv_Xml_SessionOperationCompleted(object arg)
{
if (invokeSrv_Xml_SessionCompleted != null)
{
InvokeCompletedEventArgs invokeArgs = (InvokeCompletedEventArgs)arg;
invokeSrv_Xml_SessionCompleted?.Invoke(this, new invokeSrv_Xml_SessionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[SoapDocumentMethod("http://www.imestech.com/wsInvoke/invokeSrv_DataTableParameter", RequestNamespace = "http://www.imestech.com/wsInvoke", ResponseNamespace = "http://www.imestech.com/wsInvoke", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public object invokeSrv_DataTableParameter(string method, object[] parameters, ref DataTable pDataTable)
{
object[] results = Invoke("invokeSrv_DataTableParameter", new object[] { method, parameters, pDataTable });
pDataTable = (DataTable)results[1];
return results[0];
}
/// <remarks/>
public IAsyncResult BegininvokeSrv_DataTableParameter(string method, object[] parameters, DataTable pDataTable, AsyncCallback callback, object asyncState)
{
return BeginInvoke("invokeSrv_DataTableParameter", new object[] { method, parameters, pDataTable }, callback, asyncState);
}
/// <remarks/>
public object EndinvokeSrv_DataTableParameter(IAsyncResult asyncResult, ref DataTable pDataTable)
{
object[] results = EndInvoke(asyncResult);
pDataTable = (DataTable)results[1];
return results[0];
}
/// <remarks/>
public void invokeSrv_DataTableParameterAsync(string method, object[] parameters, DataTable pDataTable)
{
invokeSrv_DataTableParameterAsync(method, parameters, pDataTable, null);
}
/// <remarks/>
public void invokeSrv_DataTableParameterAsync(string method, object[] parameters, DataTable pDataTable, object userState)
{
if (invokeSrv_DataTableParameterOperationCompleted == null)
{
invokeSrv_DataTableParameterOperationCompleted = OninvokeSrv_DataTableParameterOperationCompleted;
}
InvokeAsync("invokeSrv_DataTableParameter", new object[] { method, parameters, pDataTable }, invokeSrv_DataTableParameterOperationCompleted, userState);
}
private void OninvokeSrv_DataTableParameterOperationCompleted(object arg)
{
if (invokeSrv_DataTableParameterCompleted != null)
{
InvokeCompletedEventArgs invokeArgs = (InvokeCompletedEventArgs)arg;
invokeSrv_DataTableParameterCompleted?.Invoke(this, new invokeSrv_DataTableParameterCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[SoapDocumentMethod("http://www.imestech.com/wsInvoke/invokeSrv_DataTable", RequestNamespace = "http://www.imestech.com/wsInvoke", ResponseNamespace = "http://www.imestech.com/wsInvoke", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public object invokeSrv_DataTable(string method, string InXml, ref DataTable pDataTable)
{
object[] results = Invoke("invokeSrv_DataTable", new object[] { method, InXml, pDataTable });
pDataTable = (DataTable)results[1];
return results[0];
}
/// <remarks/>
public IAsyncResult BegininvokeSrv_DataTable(string method, string InXml, DataTable pDataTable, AsyncCallback callback, object asyncState)
{
return BeginInvoke("invokeSrv_DataTable", new object[] { method, InXml, pDataTable }, callback, asyncState);
}
/// <remarks/>
public object EndinvokeSrv_DataTable(IAsyncResult asyncResult, ref DataTable pDataTable)
{
object[] results = EndInvoke(asyncResult);
pDataTable = (DataTable)results[1];
return results[0];
}
/// <remarks/>
public void invokeSrv_DataTableAsync(string method, string InXml, DataTable pDataTable)
{
invokeSrv_DataTableAsync(method, InXml, pDataTable, null);
}
/// <remarks/>
public void invokeSrv_DataTableAsync(string method, string InXml, DataTable pDataTable, object userState)
{
if (invokeSrv_DataTableOperationCompleted == null)
{
invokeSrv_DataTableOperationCompleted = OninvokeSrv_DataTableOperationCompleted;
}
InvokeAsync("invokeSrv_DataTable", new object[] { method, InXml, pDataTable }, invokeSrv_DataTableOperationCompleted, userState);
}
private void OninvokeSrv_DataTableOperationCompleted(object arg)
{
if (invokeSrv_DataTableCompleted != null)
{
InvokeCompletedEventArgs invokeArgs = (InvokeCompletedEventArgs)arg;
invokeSrv_DataTableCompleted?.Invoke(this, new invokeSrv_DataTableCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[SoapDocumentMethod("http://www.imestech.com/wsInvoke/invokeSrv_DataSet", RequestNamespace = "http://www.imestech.com/wsInvoke", ResponseNamespace = "http://www.imestech.com/wsInvoke", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public object invokeSrv_DataSet(string method, string InXml, ref DataSet pDataSet)
{
object[] results = Invoke("invokeSrv_DataSet", new object[] { method, InXml, pDataSet });
pDataSet = (DataSet)results[1];
return results[0];
}
/// <remarks/>
public IAsyncResult BegininvokeSrv_DataSet(string method, string InXml, DataSet pDataSet, AsyncCallback callback, object asyncState)
{
return BeginInvoke("invokeSrv_DataSet", new object[] { method, InXml, pDataSet }, callback, asyncState);
}
/// <remarks/>
public object EndinvokeSrv_DataSet(IAsyncResult asyncResult, ref DataSet pDataSet)
{
object[] results = EndInvoke(asyncResult);
pDataSet = (DataSet)results[1];
return results[0];
}
/// <remarks/>
public void invokeSrv_DataSetAsync(string method, string InXml, DataSet pDataSet)
{
invokeSrv_DataSetAsync(method, InXml, pDataSet, null);
}
/// <remarks/>
public void invokeSrv_DataSetAsync(string method, string InXml, DataSet pDataSet, object userState)
{
if (invokeSrv_DataSetOperationCompleted == null)
{
invokeSrv_DataSetOperationCompleted = OninvokeSrv_DataSetOperationCompleted;
}
InvokeAsync("invokeSrv_DataSet", new object[] { method, InXml, pDataSet }, invokeSrv_DataSetOperationCompleted, userState);
}
private void OninvokeSrv_DataSetOperationCompleted(object arg)
{
if (invokeSrv_DataSetCompleted != null)
{
InvokeCompletedEventArgs invokeArgs = (InvokeCompletedEventArgs)arg;
invokeSrv_DataSetCompleted?.Invoke(this, new invokeSrv_DataSetCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[SoapDocumentMethod("http://www.imestech.com/wsInvoke/invokeSrv_Session", RequestNamespace = "http://www.imestech.com/wsInvoke", ResponseNamespace = "http://www.imestech.com/wsInvoke", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public object invokeSrv_Session(string method, object[] parameters)
{
object[] results = Invoke("invokeSrv_Session", new object[] { method, parameters });
return results[0];
}
/// <remarks/>
public IAsyncResult BegininvokeSrv_Session(string method, object[] parameters, AsyncCallback callback, object asyncState)
{
return BeginInvoke("invokeSrv_Session", new object[] { method, parameters }, callback, asyncState);
}
/// <remarks/>
public object EndinvokeSrv_Session(IAsyncResult asyncResult)
{
object[] results = EndInvoke(asyncResult);
return results[0];
}
/// <remarks/>
public void invokeSrv_SessionAsync(string method, object[] parameters)
{
invokeSrv_SessionAsync(method, parameters, null);
}
/// <remarks/>
public void invokeSrv_SessionAsync(string method, object[] parameters, object userState)
{
if (invokeSrv_SessionOperationCompleted == null)
{
invokeSrv_SessionOperationCompleted = OninvokeSrv_SessionOperationCompleted;
}
InvokeAsync("invokeSrv_Session", new object[] { method, parameters }, invokeSrv_SessionOperationCompleted, userState);
}
private void OninvokeSrv_SessionOperationCompleted(object arg)
{
if (invokeSrv_SessionCompleted != null)
{
InvokeCompletedEventArgs invokeArgs = (InvokeCompletedEventArgs)arg;
invokeSrv_SessionCompleted?.Invoke(this, new invokeSrv_SessionCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState));
}
}
/// <remarks/>
[SoapDocumentMethod("http://www.imestech.com/wsInvoke/Test", RequestNamespace = "http://www.imestech.com/wsInvoke", ResponseNamespace = "http://www.imestech.com/wsInvoke", Use = System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public string Test(string UserNo)
{
object[] results = Invoke("Test", new object[] { UserNo });
return Conversions.ToString(results[0]);
}
/// <remarks/>
public IAsyncResult BeginTest(string UserNo, AsyncCallback callback, object asyncState)
{
return BeginInvoke("Test", new object[] { UserNo }, callback, asyncState);
}
/// <remarks/>
public string EndTest(IAsyncResult asyncResult)
{
object[] results = EndInvoke(asyncResult);
return Conversions.ToString(results[0]);
}
/// <remarks/>
public void TestAsync(string UserNo)
{
TestAsync(UserNo, null);
}
/// <remarks/>
public void TestAsync(string UserNo, object userState)
{
if (TestOperationCompleted == null)
{
TestOperationCompleted = OnTestOperationCompleted;
}
InvokeAsync("Test", new object[] { UserNo }, TestOperationCompleted, userState);
}
private void OnTestOperationCompleted(object arg)
{
if (TestCompleted != null)
{
InvokeCompletedEventArgs invokeArgs = (InvokeCompletedEventArgs)arg;
TestCompleted?.Invoke(this, new TestCompletedEventArgs(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.8.3761.0")]
public delegate void invokeSrvCompletedEventHandler(object sender, invokeSrvCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
[DebuggerStepThrough()]
[DesignerCategory("code")]
public partial class invokeSrvCompletedEventArgs : AsyncCompletedEventArgs
{
private object[] results;
internal invokeSrvCompletedEventArgs(object[] results, Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public object Result
{
get
{
RaiseExceptionIfNecessary();
return results[0];
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
public delegate void invokeSrv_XmlCompletedEventHandler(object sender, invokeSrv_XmlCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
[DebuggerStepThrough()]
[DesignerCategory("code")]
public partial class invokeSrv_XmlCompletedEventArgs : AsyncCompletedEventArgs
{
private object[] results;
internal invokeSrv_XmlCompletedEventArgs(object[] results, Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public object Result
{
get
{
RaiseExceptionIfNecessary();
return results[0];
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
public delegate void invokeSrv_Xml_SessionCompletedEventHandler(object sender, invokeSrv_Xml_SessionCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
[DebuggerStepThrough()]
[DesignerCategory("code")]
public partial class invokeSrv_Xml_SessionCompletedEventArgs : AsyncCompletedEventArgs
{
private object[] results;
internal invokeSrv_Xml_SessionCompletedEventArgs(object[] results, Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public object Result
{
get
{
RaiseExceptionIfNecessary();
return results[0];
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
public delegate void invokeSrv_DataTableParameterCompletedEventHandler(object sender, invokeSrv_DataTableParameterCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
[DebuggerStepThrough()]
[DesignerCategory("code")]
public partial class invokeSrv_DataTableParameterCompletedEventArgs : AsyncCompletedEventArgs
{
private object[] results;
internal invokeSrv_DataTableParameterCompletedEventArgs(object[] results, Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public object Result
{
get
{
RaiseExceptionIfNecessary();
return results[0];
}
}
/// <remarks/>
public DataTable pDataTable
{
get
{
RaiseExceptionIfNecessary();
return (DataTable)results[1];
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
public delegate void invokeSrv_DataTableCompletedEventHandler(object sender, invokeSrv_DataTableCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
[DebuggerStepThrough()]
[DesignerCategory("code")]
public partial class invokeSrv_DataTableCompletedEventArgs : AsyncCompletedEventArgs
{
private object[] results;
internal invokeSrv_DataTableCompletedEventArgs(object[] results, Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public object Result
{
get
{
RaiseExceptionIfNecessary();
return results[0];
}
}
/// <remarks/>
public DataTable pDataTable
{
get
{
RaiseExceptionIfNecessary();
return (DataTable)results[1];
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
public delegate void invokeSrv_DataSetCompletedEventHandler(object sender, invokeSrv_DataSetCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
[DebuggerStepThrough()]
[DesignerCategory("code")]
public partial class invokeSrv_DataSetCompletedEventArgs : AsyncCompletedEventArgs
{
private object[] results;
internal invokeSrv_DataSetCompletedEventArgs(object[] results, Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public object Result
{
get
{
RaiseExceptionIfNecessary();
return results[0];
}
}
/// <remarks/>
public DataSet pDataSet
{
get
{
RaiseExceptionIfNecessary();
return (DataSet)results[1];
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
public delegate void invokeSrv_SessionCompletedEventHandler(object sender, invokeSrv_SessionCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
[DebuggerStepThrough()]
[DesignerCategory("code")]
public partial class invokeSrv_SessionCompletedEventArgs : AsyncCompletedEventArgs
{
private object[] results;
internal invokeSrv_SessionCompletedEventArgs(object[] results, Exception exception, bool cancelled, object userState) : base(exception, cancelled, userState)
{
this.results = results;
}
/// <remarks/>
public object Result
{
get
{
RaiseExceptionIfNecessary();
return results[0];
}
}
}
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
public delegate void TestCompletedEventHandler(object sender, TestCompletedEventArgs e);
/// <remarks/>
[System.CodeDom.Compiler.GeneratedCode("System.Web.Services", "4.8.3761.0")]
[DebuggerStepThrough()]
[DesignerCategory("code")]
public partial class TestCompletedEventArgs : AsyncCompletedEventArgs
{
private object[] results;
internal TestCompletedEventArgs(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://localhost/MESws_Industry/wsInvoke.asmx?wsdl" filename="wsInvoke.wsdl" />
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://localhost/MESws_Industry/wsInvoke.asmx?disco" filename="wsInvoke.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://localhost/MESws_Industry/wsInvoke.asmx?wsdl" docRef="http://localhost/MESws_Industry/wsInvoke.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://localhost/MESws_Industry/wsInvoke.asmx" xmlns:q1="http://www.imestech.com/wsInvoke" binding="q1:wsInvokeSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://localhost/MESws_Industry/wsInvoke.asmx" xmlns:q2="http://www.imestech.com/wsInvoke" binding="q2:wsInvokeSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>

View File

@ -0,0 +1,427 @@
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://www.imestech.com/wsInvoke" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://www.imestech.com/wsInvoke" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://www.imestech.com/wsInvoke">
<s:element name="invokeSrv">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="method" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="parameters" type="tns:ArrayOfAnyType" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="ArrayOfAnyType">
<s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded" name="anyType" nillable="true" />
</s:sequence>
</s:complexType>
<s:element name="invokeSrvResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="invokeSrvResult" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="invokeSrv_Xml">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="method" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="inXMl" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="invokeSrv_XmlResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="invokeSrv_XmlResult" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="invokeSrv_Xml_Session">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="method" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="inXMl" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="invokeSrv_Xml_SessionResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="invokeSrv_Xml_SessionResult" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="invokeSrv_DataTableParameter">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="method" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="parameters" type="tns:ArrayOfAnyType" />
<s:element minOccurs="0" maxOccurs="1" name="pDataTable">
<s:complexType>
<s:sequence>
<s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax" />
<s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax" />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="invokeSrv_DataTableParameterResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="invokeSrv_DataTableParameterResult" />
<s:element minOccurs="0" maxOccurs="1" name="pDataTable">
<s:complexType>
<s:sequence>
<s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax" />
<s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax" />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="invokeSrv_DataTable">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="method" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="InXml" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="pDataTable">
<s:complexType>
<s:sequence>
<s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax" />
<s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax" />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="invokeSrv_DataTableResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="invokeSrv_DataTableResult" />
<s:element minOccurs="0" maxOccurs="1" name="pDataTable">
<s:complexType>
<s:sequence>
<s:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/2001/XMLSchema" processContents="lax" />
<s:any minOccurs="1" namespace="urn:schemas-microsoft-com:xml-diffgram-v1" processContents="lax" />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="invokeSrv_DataSet">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="method" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="InXml" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="pDataSet">
<s:complexType>
<s:sequence>
<s:element ref="s:schema" />
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="invokeSrv_DataSetResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="invokeSrv_DataSetResult" />
<s:element minOccurs="0" maxOccurs="1" name="pDataSet">
<s:complexType>
<s:sequence>
<s:element ref="s:schema" />
<s:any />
</s:sequence>
</s:complexType>
</s:element>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="invokeSrv_Session">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="method" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="parameters" type="tns:ArrayOfAnyType" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="invokeSrv_SessionResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="invokeSrv_SessionResult" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="Test">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="UserNo" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="TestResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="TestResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="invokeSrvSoapIn">
<wsdl:part name="parameters" element="tns:invokeSrv" />
</wsdl:message>
<wsdl:message name="invokeSrvSoapOut">
<wsdl:part name="parameters" element="tns:invokeSrvResponse" />
</wsdl:message>
<wsdl:message name="invokeSrv_XmlSoapIn">
<wsdl:part name="parameters" element="tns:invokeSrv_Xml" />
</wsdl:message>
<wsdl:message name="invokeSrv_XmlSoapOut">
<wsdl:part name="parameters" element="tns:invokeSrv_XmlResponse" />
</wsdl:message>
<wsdl:message name="invokeSrv_Xml_SessionSoapIn">
<wsdl:part name="parameters" element="tns:invokeSrv_Xml_Session" />
</wsdl:message>
<wsdl:message name="invokeSrv_Xml_SessionSoapOut">
<wsdl:part name="parameters" element="tns:invokeSrv_Xml_SessionResponse" />
</wsdl:message>
<wsdl:message name="invokeSrv_DataTableParameterSoapIn">
<wsdl:part name="parameters" element="tns:invokeSrv_DataTableParameter" />
</wsdl:message>
<wsdl:message name="invokeSrv_DataTableParameterSoapOut">
<wsdl:part name="parameters" element="tns:invokeSrv_DataTableParameterResponse" />
</wsdl:message>
<wsdl:message name="invokeSrv_DataTableSoapIn">
<wsdl:part name="parameters" element="tns:invokeSrv_DataTable" />
</wsdl:message>
<wsdl:message name="invokeSrv_DataTableSoapOut">
<wsdl:part name="parameters" element="tns:invokeSrv_DataTableResponse" />
</wsdl:message>
<wsdl:message name="invokeSrv_DataSetSoapIn">
<wsdl:part name="parameters" element="tns:invokeSrv_DataSet" />
</wsdl:message>
<wsdl:message name="invokeSrv_DataSetSoapOut">
<wsdl:part name="parameters" element="tns:invokeSrv_DataSetResponse" />
</wsdl:message>
<wsdl:message name="invokeSrv_SessionSoapIn">
<wsdl:part name="parameters" element="tns:invokeSrv_Session" />
</wsdl:message>
<wsdl:message name="invokeSrv_SessionSoapOut">
<wsdl:part name="parameters" element="tns:invokeSrv_SessionResponse" />
</wsdl:message>
<wsdl:message name="TestSoapIn">
<wsdl:part name="parameters" element="tns:Test" />
</wsdl:message>
<wsdl:message name="TestSoapOut">
<wsdl:part name="parameters" element="tns:TestResponse" />
</wsdl:message>
<wsdl:portType name="wsInvokeSoap">
<wsdl:operation name="invokeSrv">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Invoke with objects and Return XML</wsdl:documentation>
<wsdl:input message="tns:invokeSrvSoapIn" />
<wsdl:output message="tns:invokeSrvSoapOut" />
</wsdl:operation>
<wsdl:operation name="invokeSrv_Xml">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Invoke with Xml String and Return XML</wsdl:documentation>
<wsdl:input message="tns:invokeSrv_XmlSoapIn" />
<wsdl:output message="tns:invokeSrv_XmlSoapOut" />
</wsdl:operation>
<wsdl:operation name="invokeSrv_Xml_Session">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">EnableSession, Invoke with Xml String and Return XML</wsdl:documentation>
<wsdl:input message="tns:invokeSrv_Xml_SessionSoapIn" />
<wsdl:output message="tns:invokeSrv_Xml_SessionSoapOut" />
</wsdl:operation>
<wsdl:operation name="invokeSrv_DataTableParameter">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Invoke with DataTable and Object Return XML</wsdl:documentation>
<wsdl:input message="tns:invokeSrv_DataTableParameterSoapIn" />
<wsdl:output message="tns:invokeSrv_DataTableParameterSoapOut" />
</wsdl:operation>
<wsdl:operation name="invokeSrv_DataTable">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Invoke with DataTable and Return XML</wsdl:documentation>
<wsdl:input message="tns:invokeSrv_DataTableSoapIn" />
<wsdl:output message="tns:invokeSrv_DataTableSoapOut" />
</wsdl:operation>
<wsdl:operation name="invokeSrv_DataSet">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Invoke with DataSet and Return XML</wsdl:documentation>
<wsdl:input message="tns:invokeSrv_DataSetSoapIn" />
<wsdl:output message="tns:invokeSrv_DataSetSoapOut" />
</wsdl:operation>
<wsdl:operation name="invokeSrv_Session">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">EnableSession, Invoke and Return XML</wsdl:documentation>
<wsdl:input message="tns:invokeSrv_SessionSoapIn" />
<wsdl:output message="tns:invokeSrv_SessionSoapOut" />
</wsdl:operation>
<wsdl:operation name="Test">
<wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Web service and database connection test</wsdl:documentation>
<wsdl:input message="tns:TestSoapIn" />
<wsdl:output message="tns:TestSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="wsInvokeSoap" type="tns:wsInvokeSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="invokeSrv">
<soap:operation soapAction="http://www.imestech.com/wsInvoke/invokeSrv" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="invokeSrv_Xml">
<soap:operation soapAction="http://www.imestech.com/wsInvoke/invokeSrv_Xml" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="invokeSrv_Xml_Session">
<soap:operation soapAction="http://www.imestech.com/wsInvoke/invokeSrv_Xml_Session" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="invokeSrv_DataTableParameter">
<soap:operation soapAction="http://www.imestech.com/wsInvoke/invokeSrv_DataTableParameter" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="invokeSrv_DataTable">
<soap:operation soapAction="http://www.imestech.com/wsInvoke/invokeSrv_DataTable" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="invokeSrv_DataSet">
<soap:operation soapAction="http://www.imestech.com/wsInvoke/invokeSrv_DataSet" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="invokeSrv_Session">
<soap:operation soapAction="http://www.imestech.com/wsInvoke/invokeSrv_Session" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Test">
<soap:operation soapAction="http://www.imestech.com/wsInvoke/Test" 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="wsInvokeSoap12" type="tns:wsInvokeSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="invokeSrv">
<soap12:operation soapAction="http://www.imestech.com/wsInvoke/invokeSrv" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="invokeSrv_Xml">
<soap12:operation soapAction="http://www.imestech.com/wsInvoke/invokeSrv_Xml" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="invokeSrv_Xml_Session">
<soap12:operation soapAction="http://www.imestech.com/wsInvoke/invokeSrv_Xml_Session" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="invokeSrv_DataTableParameter">
<soap12:operation soapAction="http://www.imestech.com/wsInvoke/invokeSrv_DataTableParameter" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="invokeSrv_DataTable">
<soap12:operation soapAction="http://www.imestech.com/wsInvoke/invokeSrv_DataTable" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="invokeSrv_DataSet">
<soap12:operation soapAction="http://www.imestech.com/wsInvoke/invokeSrv_DataSet" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="invokeSrv_Session">
<soap12:operation soapAction="http://www.imestech.com/wsInvoke/invokeSrv_Session" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="Test">
<soap12:operation soapAction="http://www.imestech.com/wsInvoke/Test" style="document" />
<wsdl:input>
<soap12:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap12:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="wsInvoke">
<wsdl:port name="wsInvokeSoap" binding="tns:wsInvokeSoap">
<soap:address location="http://localhost/MESws_Industry/wsInvoke.asmx" />
</wsdl:port>
<wsdl:port name="wsInvokeSoap12" binding="tns:wsInvokeSoap12">
<soap12:address location="http://localhost/MESws_Industry/wsInvoke.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View File

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="AutoLoaderLib_Base.My.MySettings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
</configSections>
<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>
<applicationSettings>
<AutoLoaderLib_Base.My.MySettings>
<setting name="AutoLoaderLib_wsInvoke_wsInvoke" serializeAs="String">
<value>http://localhost/MESws_Industry/wsInvoke.asmx</value>
</setting>
</AutoLoaderLib_Base.My.MySettings>
</applicationSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,948 @@
using System;
using System.Data;
using System.Runtime.InteropServices;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using static iMESCore.Base.iMESConst;
using static iMESCore.Base.iMESComXML;
namespace AutoLoaderLib_Base
{
static class modAutoLoaderLibrary
{
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
/// <summary>
///
/// </summary>
/// <param name="blnGoodFlag_Yield">原vb預設值true</param>
/// <param name="blnGoodFlag_Avg">原vb預設值true</param>
/// <param name="blnGoodFlag_AOI">原vb預設值true</param>
/// <returns></returns>
/// <exception cref="Exception"></exception>
public static bool funCalculateMinMaxSumSqr(ref bool blnGoodFlag_Yield, ref bool blnGoodFlag_Avg, ref bool blnGoodFlag_AOI,
DataRow rowRawData, string colFieldName, ref DataRow rowReslut,
DataRow rowRawData_SpecYield, string min_colFieldName, string max_colFieldName,
DataRow rowRawData_SpecAvg, DataRow rowRawData_SpecEng, string colFieldName_IR = defString
)
{
bool funCalculateMinMaxSumSqrRet = default(bool);
// //符合規格的顆數(AVG)
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecAvg[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecAvg[max_colFieldName], false)))
{
switch (Strings.Mid(colFieldName, 1, 3).ToUpper() ?? "")
{
case "ESD": // 計算ESD的Yield時IR必須也要是Pass
{
if ((colFieldName_IR ?? "") != defString)
{
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName_IR])), rowRawData_SpecAvg[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName_IR])), rowRawData_SpecAvg[max_colFieldName], false)))
{
// //更新
rowReslut.BeginEdit();
// //Max
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectLess(rowReslut["MaxValue"], decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), false)))
{
rowReslut["MaxValue"] = decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
}
// //Min
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(rowReslut["MinValue"], -9999, false)) || Conversions.ToBoolean(Operators.ConditionalCompareObjectGreater(rowReslut["MinValue"], decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), false)))
{
rowReslut["MinValue"] = decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
}
// //IR必須要過ESD才能算
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecEng[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecEng[max_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName_IR])), rowRawData_SpecEng[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName_IR])), rowRawData_SpecEng[max_colFieldName], false)))
{
// //Yield Die數加一
rowReslut["GoodQty1"] = Convert.ToInt32(rowReslut["GoodQty1"]) + 1;
// Else
// blnGoodFlag_Yield = False
}
// //不包含AOIBin欄位判斷Yield
if (colFieldName.ToString().ToUpper() != "AOIBIN")
{
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[max_colFieldName], false)))
{
}
else
{
blnGoodFlag_AOI = false;
}
}
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[max_colFieldName], false)))
{
}
else
{
blnGoodFlag_Yield = false;
}
// '計算IR符合ESD規格的顆數
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName_IR])), rowRawData_SpecEng[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName_IR])), rowRawData_SpecEng[max_colFieldName], false)))
{
rowReslut["IRFitESDSpecQty"] = Convert.ToInt32(rowReslut["IRFitESDSpecQty"]) + 1;
}
// //Sum
rowReslut["SumValue"] = Convert.ToDecimal(rowReslut["SumValue"]) +
decimal.Parse(rowRawData[colFieldName].ToString());
// //SumSqr
rowReslut["SqrValue"] = Convert.ToDouble(rowReslut["SqrValue"]) +
Math.Pow((double)decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), 2d);
// //Avg Die數加一
rowReslut["GoodQty2"] = Convert.ToInt32(rowReslut["GoodQty2"]) + 1;
// //更新
rowReslut.EndEdit();
// //
funCalculateMinMaxSumSqrRet = true; // //此電性在規格內
}
else
{
// '計算IR符合ESD規格的顆數
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName_IR])), rowRawData_SpecEng[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName_IR])), rowRawData_SpecEng[max_colFieldName], false)))
{
rowReslut["GoodQty1"] = Convert.ToInt32(rowReslut["GoodQty1"]) + 1;
rowReslut["IRFitESDSpecQty"] = Convert.ToInt32(rowReslut["IRFitESDSpecQty"]) + 1;
// Else
// blnGoodFlag_Yield = False
}
// //不包含AOIBin欄位判斷Yield
if (colFieldName.ToString().ToUpper() != "AOIBIN")
{
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[max_colFieldName], false)))
{
}
else
{
blnGoodFlag_AOI = false;
}
}
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[max_colFieldName], false)))
{
}
else
{
blnGoodFlag_Yield = false;
}
funCalculateMinMaxSumSqrRet = false; // //回傳此電性在規格外
blnGoodFlag_Avg = false;
}
}
else
{
throw new Exception("無法取得檔案中" + colFieldName_IR + "所對應的電性欄位!!");
}
break;
}
default:
{
// //更新
rowReslut.BeginEdit();
// //Max
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectLess(rowReslut["MaxValue"], decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), false)))
{
rowReslut["MaxValue"] = decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
}
// //Min
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(rowReslut["MinValue"], -9999, false)) || Conversions.ToBoolean(Operators.ConditionalCompareObjectGreater(rowReslut["MinValue"], decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), false)))
{
rowReslut["MinValue"] = decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
}
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecEng[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecEng[max_colFieldName], false)))
{
// //Die數加一
rowReslut["GoodQty1"] = Convert.ToInt32(rowReslut["GoodQty1"]) + 1;
// Else
// blnGoodFlag_Yield = False
}
// //不包含AOIBin欄位判斷Yield
if (colFieldName.ToString().ToUpper() != "AOIBIN")
{
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[max_colFieldName], false)))
{
}
else
{
blnGoodFlag_AOI = false;
}
}
// //
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[max_colFieldName], false)))
{
}
else
{
blnGoodFlag_Yield = false;
}
// //Sum
rowReslut["SumValue"] = Convert.ToDecimal(rowReslut["SumValue"]) +
decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
// //SumSqr
rowReslut["SqrValue"] = Convert.ToDouble(rowReslut["SqrValue"]) +
Math.Pow((double)decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), 2d);
// //Avg Die數加一
rowReslut["GoodQty2"] = Convert.ToInt32(rowReslut["GoodQty2"]) + 1;
// //更新
rowReslut.EndEdit();
// //
funCalculateMinMaxSumSqrRet = true; // //此電性在規格內
break;
}
}
}
else
{
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecEng[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecEng[max_colFieldName], false)))
{
// //Die數加一
rowReslut["GoodQty1"] = Convert.ToInt32(rowReslut["GoodQty1"]) + 1;
// Else
// blnGoodFlag_Yield = False
}
// //不包含AOIBin欄位判斷Yield
if (colFieldName.ToString().ToUpper() != "AOIBIN")
{
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[max_colFieldName], false)))
{
}
else
{
blnGoodFlag_AOI = false;
}
}
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_SpecYield[max_colFieldName], false)))
{
}
else
{
blnGoodFlag_Yield = false;
}
// '計算IR符合ESD規格的顆數
if (Strings.Mid(colFieldName, 1, 3).ToUpper() == "ESD" && Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName_IR])), rowRawData_SpecEng[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName_IR])), rowRawData_SpecEng[max_colFieldName], false)))
{
rowReslut["IRFitESDSpecQty"] = Convert.ToInt32(rowReslut["IRFitESDSpecQty"]) + 1;
}
funCalculateMinMaxSumSqrRet = false; // //回傳此電性在規格外
blnGoodFlag_Avg = false;
}
return funCalculateMinMaxSumSqrRet;
// End If
}
public static bool funCalculateMinMaxSumSqr(DataRow rowRawData, string colFieldName, ref DataRow rowReslut, bool blnChkSpecFlag, DataRow rowRawData_Spec = null, DataRow rowRawData_Spec_AVG = null, string min_colFieldName = defString, string max_colFieldName = defString)
{
bool funCalculateMinMaxSumSqrRet = default(bool);
// //依傳入值判斷是否要判規格
if (blnChkSpecFlag == true)
{
// //不可為Nothing
if (rowRawData_Spec == null)
{
throw new Exception("必須傳入規格定義資料(YIELD)!!");
}
// //不可為Nothing
if (rowRawData_Spec_AVG == null)
{
throw new Exception("必須傳入規格定義資料(AVG)!!");
}
// //不可為defString
if ((max_colFieldName ?? "") == defString)
{
throw new Exception("必須傳入規格電性最大欄位定義資料!!");
}
// //不可為defString
if ((min_colFieldName ?? "") == defString)
{
throw new Exception("必須傳入規格電性最小欄位定義資料!!");
}
}
// //更新
rowReslut.BeginEdit();
// //Max
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectLess(rowReslut["MaxValue"], decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), false)))
{
rowReslut["MaxValue"] = decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
}
// //Min
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(rowReslut["MinValue"], 0, false)) || Conversions.ToBoolean(Operators.ConditionalCompareObjectGreater(rowReslut["MinValue"], decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), false)))
{
rowReslut["MinValue"] = decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
}
// //依傳入值判斷是否要判規格
if (blnChkSpecFlag == true)
{
// //規格最大、最小都為零時不需要判(AVG)
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(rowRawData_Spec_AVG[min_colFieldName], 0, false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(rowRawData_Spec_AVG[max_colFieldName], 0, false)))
{
// //Sum
rowReslut["SumValue"] = Convert.ToDecimal(rowReslut["SumValue"]) +
decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
// //SumSqr
rowReslut["SqrValue"] = Convert.ToDouble(rowReslut["SqrValue"]) +
Math.Pow((double)decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), 2d);
// //Die數加一
rowReslut["GoodQty1"] = Convert.ToInt32(rowReslut["GoodQty1"]) + 1;
}
// //符合規格的顆數(良品數)
else if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_Spec_AVG[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLess(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_Spec_AVG[max_colFieldName], false)))
{
// //Sum
rowReslut["SumValue"] = Convert.ToDecimal(rowReslut["SumValue"]) +
decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
// //SumSqr
rowReslut["SqrValue"] = Convert.ToDouble(rowReslut["SqrValue"]) +
Math.Pow((double)decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), 2d);
// //Die數加一
rowReslut["GoodQty1"] = Convert.ToInt32(rowReslut["GoodQty1"]) + 1;
}
// //規格最大、最小都為零時不需要判(YIELD)
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(rowRawData_Spec[min_colFieldName], 0, false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(rowRawData_Spec[max_colFieldName], 0, false)))
{
// //Pass數加一
rowReslut["GoodQty2"] = Convert.ToInt32(rowReslut["GoodQty2"]) + 1;
funCalculateMinMaxSumSqrRet = true; // //此電性不需判斷規格(是)
}
// //符合規格的顆數(良品數)
else if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_Spec[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLess(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_Spec[max_colFieldName], false)))
{
// //Pass數加一
rowReslut["GoodQty2"] = Convert.ToInt32(rowReslut["GoodQty2"]) + 1;
funCalculateMinMaxSumSqrRet = true; // //回傳此電性是否在規格內(是)
}
else
{
funCalculateMinMaxSumSqrRet = false;
} // //回傳此電性是否在規格內(否)
}
else
{
// //Sum
rowReslut["SumValue"] = Convert.ToDecimal(rowReslut["SumValue"]) +
decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
// //SumSqr
rowReslut["SqrValue"] = Convert.ToDouble(rowReslut["SqrValue"]) +
Math.Pow((double)decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), 2d);
// //Pass數加一
rowReslut["GoodQty1"] = Convert.ToInt32(rowReslut["GoodQty1"]) + 1;
rowReslut["GoodQty2"] = Convert.ToInt32(rowReslut["GoodQty2"]) + 1;
funCalculateMinMaxSumSqrRet = true;
} // //此電性不需判斷規格(是)
// //
rowReslut.EndEdit();
return funCalculateMinMaxSumSqrRet;
}
public static bool funCalculateMinMaxSumSqr(ref DataRow rowReslut, decimal valueQty, DataRow rowRawData_Spec, string min_colFieldName, string max_colFieldName)
{
bool funCalculateMinMaxSumSqrRet = default(bool);
rowReslut.BeginEdit();
// //Max
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectLess(rowReslut["MaxValue"], valueQty, false)))
{
rowReslut["MaxValue"] = valueQty;
}
// //Min
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(rowReslut["MinValue"], 0, false)) || Conversions.ToBoolean(Operators.ConditionalCompareObjectGreater(rowReslut["MinValue"], valueQty, false)))
{
rowReslut["MinValue"] = valueQty;
}
// //Sum
rowReslut["SumValue"] = Convert.ToDecimal(rowReslut["SumValue"]) + valueQty;
// //SumSqr
rowReslut["SqrValue"] = Convert.ToDouble(rowReslut["SqrValue"]) +
Math.Pow((double)valueQty, 2d);
// //符合規格的顆數(良品數)
// //規格最大、最小都為零時不需要判,都算是Good
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(rowRawData_Spec[min_colFieldName], 0, false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(rowRawData_Spec[max_colFieldName], 0, false)))
{
rowReslut["GoodQty1"] = Convert.ToInt32(rowReslut["GoodQty1"]) + 1;
rowReslut["GoodQty2"] = Convert.ToInt32(rowReslut["GoodQty2"]) + 1;
funCalculateMinMaxSumSqrRet = true; // //回傳此電性是否在規格內(是)
}
else if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(valueQty, rowRawData_Spec[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLess(valueQty, rowRawData_Spec[max_colFieldName], false)))
{
rowReslut["GoodQty1"] = Convert.ToInt32(rowReslut["GoodQty1"]) + 1;
rowReslut["GoodQty2"] = Convert.ToInt32(rowReslut["GoodQty2"]) + 1;
funCalculateMinMaxSumSqrRet = true; // //回傳此電性是否在規格內(是)
}
else
{
funCalculateMinMaxSumSqrRet = false;
} // //回傳此電性是否在規格內(否)
// //更新
rowReslut.EndEdit();
return funCalculateMinMaxSumSqrRet;
}
public static bool funCalculateMinMaxSumSqr(DataRow rowRawData, string colFieldName, ref DataRow rowReslut)
{
bool funCalculateMinMaxSumSqrRet = default(bool);
// //更新
rowReslut.BeginEdit();
// //Max
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectLess(rowReslut["MaxValue"], decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), false)))
{
rowReslut["MaxValue"] = decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
}
// //Min
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(rowReslut["MinValue"], 0, false)) || Conversions.ToBoolean(Operators.ConditionalCompareObjectGreater(rowReslut["MinValue"], decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), false)))
{
rowReslut["MinValue"] = decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
}
// //更新
rowReslut.EndEdit();
// //Return
funCalculateMinMaxSumSqrRet = true;
return funCalculateMinMaxSumSqrRet;
}
// add by Lena, 2012/06/22
public static bool funCalculateMinMaxSumSqr(string colFieldName, DataRow rowRawData, ref DataRow rowReslut, DataRow rowRawData_Spec, string min_colFieldName, string max_colFieldName)
{
bool funCalculateMinMaxSumSqrRet = default(bool);
// '//符合規格的顆數(良品數)
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_Spec[min_colFieldName], false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectLessEqual(decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), rowRawData_Spec[max_colFieldName], false)))
{
// //更新
rowReslut.BeginEdit();
// //Max
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectLess(rowReslut["MaxValue"], decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), false)))
{
rowReslut["MaxValue"] = decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
}
// //Min
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(rowReslut["MinValue"], -9999, false)) || Conversions.ToBoolean(Operators.ConditionalCompareObjectGreater(rowReslut["MinValue"], decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), false)))
{
rowReslut["MinValue"] = decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
}
// //Sum
rowReslut["SumValue"] = Convert.ToDecimal(rowReslut["SumValue"]) +
decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
// //SumSqr
rowReslut["SqrValue"] = Convert.ToDouble(rowReslut["SqrValue"]) +
Math.Pow((double)decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), 2d);
// //Yield Die數加一
rowReslut["GoodQty1"] = Convert.ToInt32(rowReslut["GoodQty1"]) + 1;
// //Avg Die數加一
rowReslut["GoodQty2"] = Convert.ToInt32(rowReslut["GoodQty2"]) + 1;
// //更新
rowReslut.EndEdit();
funCalculateMinMaxSumSqrRet = true; // //回傳此電性是否在規格內(是)
}
// '//規格最大、最小都為零時不需要判,都算是Good
else if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(rowRawData_Spec[min_colFieldName], 0, false)) && Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(rowRawData_Spec[max_colFieldName], 0, false)))
{
// //更新
rowReslut.BeginEdit();
// //Max
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectLess(rowReslut["MaxValue"], decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), false)))
{
rowReslut["MaxValue"] = decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
}
// //Min
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectEqual(rowReslut["MinValue"], -9999, false)) || Conversions.ToBoolean(Operators.ConditionalCompareObjectGreater(rowReslut["MinValue"], decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), false)))
{
rowReslut["MinValue"] = decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
}
// //Sum
rowReslut["SumValue"] = Convert.ToDecimal(rowReslut["SumValue"]) +
decimal.Parse(Conversions.ToString(rowRawData[colFieldName]));
// //SumSqr
rowReslut["SqrValue"] = Convert.ToDouble(rowReslut["SqrValue"]) +
Math.Pow((double)decimal.Parse(Conversions.ToString(rowRawData[colFieldName])), 2d);
// //Yield Die數加一
rowReslut["GoodQty1"] = Convert.ToInt32(rowReslut["GoodQty1"]) + 1;
// //Avg Die數加一
rowReslut["GoodQty2"] = Convert.ToInt32(rowReslut["GoodQty2"]) + 1;
// //更新
rowReslut.EndEdit();
funCalculateMinMaxSumSqrRet = true; // //回傳此電性是否在規格內(是)
}
else
{
funCalculateMinMaxSumSqrRet = false;
} // //回傳此電性是否在規格內(否)
return funCalculateMinMaxSumSqrRet;
}
#endregion
#region --- Transaction Output ---
public static object OutputSQLNoneQuery(ref string strCommandText)
{
bool blnTransactionLog = false;
try
{
blnTransactionLog = Conversions.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["TransactionLog"]);
}
catch (Exception ex)
{
blnTransactionLog = false;
}
if (blnTransactionLog == false)
return default(Object);
var tfc = new System.CodeDom.Compiler.TempFileCollection(System.Configuration.ConfigurationSettings.AppSettings["OutputSQLPath"], true);
string FileName = tfc.AddExtension("SQL");
string ErrorLogFile = System.Configuration.ConfigurationSettings.AppSettings["ErrorLogPath"] + Strings.Format(DateTime.Now, "yyyyMMdd").ToString() + "_Error.Log";
FileName = FileName.Insert(FileName.LastIndexOf(@"\") + 1, "TX" + DateTime.Now.ToString("yyyyMMddHHmmssfff"));
try
{
using (var sw = System.IO.File.AppendText(FileName))
{
sw.WriteLine(strCommandText.Replace(Constants.vbCrLf, " "));
sw.Flush();
}
}
catch (Exception ex)
{
try
{
using (var sw = System.IO.File.AppendText(ErrorLogFile))
{
sw.WriteLine(ex.Message + ex.StackTrace);
sw.Flush();
}
}
catch (Exception e1)
{
}
}
finally
{
System.IO.File.Delete(tfc.BasePath + ".tmp");
}
return default(Object);
}
// Public Function OutputSQLNoneQuery_UPD(ByRef CollectionSQL As Collection)
// Dim blnTransactionLog As Boolean = False
// Try
// blnTransactionLog = CType(System.Configuration.ConfigurationSettings.AppSettings("TransactionLog"), Boolean)
// Catch ex As Exception
// blnTransactionLog = False
// End Try
// If blnTransactionLog = False Then Exit Function
// Dim tfc As New System.CodeDom.Compiler.TempFileCollection(System.Configuration.ConfigurationSettings.AppSettings("OutputSQLPath"), True)
// Dim FileName As String = tfc.AddExtension("SQL")
// Dim ErrorLogFile As String = System.Configuration.ConfigurationSettings.AppSettings("ErrorLogPath") & Format(Now, "yyyyMMdd").ToString & "_Error.Log"
// FileName = FileName.Insert(FileName.LastIndexOf("\") + 1, "TX" & Now.ToString("yyyyMMddHHmmssfff"))
// Dim strCommandText As String = String.Empty
// Try
// Using sw As System.IO.StreamWriter = System.IO.File.AppendText(FileName)
// For Each strCommandText In CollectionSQL
// sw.WriteLine(strCommandText.Replace(vbCrLf, " "))
// Next strCommandText
// sw.Flush()
// End Using
// Catch ex As Exception
// Try
// Using sw As System.IO.StreamWriter = System.IO.File.AppendText(ErrorLogFile)
// sw.WriteLine(ex.Message & ex.StackTrace)
// sw.Flush()
// End Using
// Catch e1 As Exception
// End Try
// Finally
// System.IO.File.Delete(tfc.BasePath & ".tmp")
// End Try
// End Function
public static object OutputSQLNoneQuery_AttachFile(ref string strCommandText, ref string AttachName, ref string aBody, object DataType)
{
bool blnTransactionLog = false;
try
{
blnTransactionLog = Conversions.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["TransactionLog"]);
}
catch (Exception ex)
{
blnTransactionLog = false;
}
if (blnTransactionLog == false)
return default(Object);
var tfc1 = new System.CodeDom.Compiler.TempFileCollection(System.Configuration.ConfigurationSettings.AppSettings["OutputSQLPath"], true);
var tfc2 = new System.CodeDom.Compiler.TempFileCollection(System.Configuration.ConfigurationSettings.AppSettings["AttachFilePath"], true);
string FileName = tfc1.AddExtension("SQL");
string AttachFile = tfc2.AddExtension("TXT");
string ErrorLogFile = System.Configuration.ConfigurationSettings.AppSettings["ErrorLogPath"] + Strings.Format(DateTime.Now, "yyyyMMdd").ToString() + "_Error.Log";
FileName = FileName.Insert(FileName.LastIndexOf(@"\") + 1, "TX" + DateTime.Now.ToString("yyyyMMddHHmmssfff"));
AttachFile = AttachFile.Insert(AttachFile.LastIndexOf(@"\") + 1, AttachName);
try
{
// //Output File
if (aBody != null)
{
string sFileSource = AttachFile;
if (System.IO.File.Exists(sFileSource))
{
try
{
System.IO.File.Delete(sFileSource);
using (var sw = System.IO.File.AppendText(sFileSource))
{
sw.WriteLine(aBody);
sw.Flush();
}
}
catch (System.IO.IOException ex)
{
}
}
else
{
using (var sw = System.IO.File.AppendText(sFileSource))
{
sw.WriteLine(aBody);
sw.Flush();
}
}
}
// //輸出格式 = SQL Command;DataType;FilePath
strCommandText += ";" + DataType.ToString() + ";" + AttachFile;
using (var sw = System.IO.File.AppendText(FileName))
{
sw.WriteLine(strCommandText.Replace(Constants.vbCrLf, " "));
sw.Flush();
}
}
catch (Exception ex)
{
try
{
using (var sw = System.IO.File.AppendText(ErrorLogFile))
{
sw.WriteLine(ex.Message + ex.StackTrace);
sw.Flush();
}
}
catch (Exception e1)
{
}
}
finally
{
System.IO.File.Delete(tfc1.BasePath + ".tmp");
System.IO.File.Delete(tfc2.BasePath + ".tmp");
}
return default(Object);
}
public static object OutputSQLNoneQuery_AttachFile(ref string strCommandText, ref string AttachName, ref byte[] aBody, object DataType)
{
bool blnTransactionLog = false;
try
{
blnTransactionLog = Conversions.ToBoolean(System.Configuration.ConfigurationSettings.AppSettings["TransactionLog"]);
}
catch (Exception ex)
{
blnTransactionLog = false;
}
if (blnTransactionLog == false)
return default(Object);
var tfc1 = new System.CodeDom.Compiler.TempFileCollection(System.Configuration.ConfigurationSettings.AppSettings["OutputSQLPath"], true);
var tfc2 = new System.CodeDom.Compiler.TempFileCollection(System.Configuration.ConfigurationSettings.AppSettings["AttachFilePath"], true);
string FileName = tfc1.AddExtension("SQL");
string AttachFile = tfc2.AddExtension(AttachName.Substring(AttachName.Length - 3, 3).ToUpper());
string ErrorLogFile = System.Configuration.ConfigurationSettings.AppSettings["ErrorLogPath"] + Strings.Format(DateTime.Now, "yyyyMMdd").ToString() + "_Error.Log";
FileName = FileName.Insert(FileName.LastIndexOf(@"\") + 1, "TX" + DateTime.Now.ToString("yyyyMMddHHmmssfff"));
AttachFile = AttachFile.Insert(AttachFile.LastIndexOf(@"\") + 1, AttachName.Substring(0, AttachName.Length - 4));
try
{
// //Output File
if (aBody != null)
{
string sFileSource = AttachFile;
if (System.IO.File.Exists(sFileSource))
{
try
{
System.IO.File.Delete(sFileSource);
var fs = new System.IO.FileStream(sFileSource, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);
fs.Write(aBody, 0, aBody.Length);
fs.Close();
}
catch (System.IO.IOException ex)
{
}
}
else
{
var fs = new System.IO.FileStream(sFileSource, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write);
fs.Write(aBody, 0, aBody.Length);
fs.Close();
}
}
// //輸出格式 = SQL Command;DataType;FilePath
strCommandText += ";" + DataType.ToString() + ";" + AttachFile;
using (var sw = System.IO.File.AppendText(FileName))
{
sw.WriteLine(strCommandText.Replace(Constants.vbCrLf, " "));
sw.Flush();
}
}
catch (Exception ex)
{
try
{
using (var sw = System.IO.File.AppendText(ErrorLogFile))
{
sw.WriteLine(ex.Message + ex.StackTrace);
sw.Flush();
}
}
catch (Exception e1)
{
}
}
finally
{
System.IO.File.Delete(tfc1.BasePath + ".tmp");
System.IO.File.Delete(tfc2.BasePath + ".tmp");
}
return default(Object);
}
#endregion
#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 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);
}
/// <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>
/// <returns></returns>
public static string InvokeSrv(string Method, string InXml, byte[] buffer, bool Customize = false)
{
object result;
try
{
using (var ws = new wsInvoke.wsInvoke())
{
ws.Url = modWIN.LocalizeWebService(ws.Url.ToString(), Customize);
ws.EnableDecompression = true;
result = ws.invokeSrv(Method, new object[] { InXml, buffer });
}
}
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 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);
}
#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 System.Xml.XmlDocument();
InXml = modWIN.CombineXMLRequest(ref strIdentity, ref strParameter);
// OutXml = wsWIP.SendEmailAndAttachFileToGroup(InXml, AttachFile)
OutXml = InvokeSrv("wsWIP.SendEmailAndAttachFileToGroup", InXml, AttachFile);
XmlDoc.LoadXml(OutXml);
if (modWIN.chkExecutionSuccess(ref XmlDoc)) // 找出Exception訊並顯示出來
{
SendMultiEmailRet = "success";
}
else
{
SendMultiEmailRet = "fail";
}
XmlDoc = null;
}
catch (Exception ex)
{
SendMultiEmailRet = "fail;" + ex.Message;
}
return SendMultiEmailRet;
}
}
}

View File

@ -0,0 +1,802 @@
using System;
using System.Collections;
using static System.Configuration.ConfigurationSettings;
using System.Data;
using System.Runtime.InteropServices;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using static iMESCore.Base.iMESConst;
using System.Diagnostics;
using System.Collections.Generic;
using System.Resources;
using System.IO;
using System.Linq;
namespace AutoLoaderLib_Base
{
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;
public static string gReturnKeyValue;
public static string gUserNo;
public static string gUserName;
public static string gUserLevel;
public static string gLanguageMode;
public static string gAppPath;
// **Add for Smart Client Architecture
public static string gMESWebServiceHost;
public static string gCUSWebServiceHost;
public static bool gEnableSSL = Convert.ToBoolean(GetAppSettings("EnableSSL"));
// Add By Peter 2005/6/20
public static string gSettingMode = "";
public static DataRow drSearch;
public static ArrayList gReturnArray = new ArrayList();
public const string strAddTagLabel = "extrabase"; // Add by py for Combine Addition XML doc
public const string strAddTagName = "ExtraBase"; // Add by py for Combine Addition XML doc
public static string gSTDPath = GetAppSettings("STDPath");
public static bool chkExecutionSuccess(ref System.Xml.XmlDocument Xmldoc)
{
bool chkExecutionSuccessRet = default(bool);
if (Xmldoc.DocumentElement["result"].InnerXml == "success")
{
chkExecutionSuccessRet = true;
}
else
{
chkExecutionSuccessRet = false;
}
return chkExecutionSuccessRet;
}
public static string GetExceptionSysMsg(ref System.Xml.XmlDocument Xmldoc)
{
string GetExceptionSysMsgRet = default(string);
string argstrInput = Xmldoc.DocumentElement.GetElementsByTagName("sysmsg").Item(0).InnerXml;
GetExceptionSysMsgRet = CUnInput(ref argstrInput);
Xmldoc.DocumentElement.GetElementsByTagName("sysmsg").Item(0).InnerXml = argstrInput;
return GetExceptionSysMsgRet;
}
public static string GetExceptionMesMsg(ref System.Xml.XmlDocument Xmldoc)
{
string GetExceptionMesMsgRet = default(string);
string argstrInput = Xmldoc.DocumentElement.GetElementsByTagName("mesmsg").Item(0).InnerXml;
GetExceptionMesMsgRet = CUnInput(ref argstrInput);
Xmldoc.DocumentElement.GetElementsByTagName("mesmsg").Item(0).InnerXml = argstrInput;
return GetExceptionMesMsgRet;
}
public static string CombineXMLIdentity(ref string ComputerName, ref string CurUserNo, ref string SendTime)
{
string CombineXMLIdentityRet = default(string);
CombineXMLIdentityRet = "<computername>" + ComputerName + "</computername>" + "<curuserno>" + CurUserNo + "</curuserno>" + "<sendtime>" + SendTime + "</sendtime>";
return CombineXMLIdentityRet;
}
public static string CombineXMLParameter(ref string value_name, ref string name, ref string type, ref string value, ref string desc)
{
string CombineXMLParameterRet = default(string);
CombineXMLParameterRet = "<" + value_name.ToLower() + ">" + "<name>" + name + "</name>" + "<type>" + type + "</type>" + "<value>" + value + "</value>" + "<desc>" + desc + "</desc>" + "</" + value_name.ToLower() + ">";
return CombineXMLParameterRet;
}
public static string CombineXMLRequest(ref string strIdentity, ref string strParameter)
{
string CombineXMLRequestRet = default(string);
CombineXMLRequestRet = "<request>" + "<identity>" + strIdentity + "</identity>";
if (!string.IsNullOrEmpty(strParameter))
{
CombineXMLRequestRet = CombineXMLRequestRet + "<parameter>" + strParameter + "</parameter>";
}
CombineXMLRequestRet = CombineXMLRequestRet + "</request>";
return CombineXMLRequestRet;
}
public static string CombineXMLValue(ref string TagName, ref string Value)
{
string CombineXMLValueRet = default(string);
CombineXMLValueRet = "<" + TagName + ">" + Value + "</" + TagName + ">";
return CombineXMLValueRet;
}
public static string CombineXMLValueTag(ref string Value)
{
string CombineXMLValueTagRet = default(string);
CombineXMLValueTagRet = "<value>" + Value + "</value>";
return CombineXMLValueTagRet;
}
public static string CombineXMLParameterMultiValue(ref string value_name, ref string name, ref string type, ref string value, ref string desc)
{
string CombineXMLParameterMultiValueRet = default(string);
// Value不用加上Tag
CombineXMLParameterMultiValueRet = "<" + value_name.ToLower() + ">" + "<name>" + name + "</name>" + "<type>" + type + "</type>" + value + "<desc>" + desc + "</desc>" + "</" + value_name.ToLower() + ">";
return CombineXMLParameterMultiValueRet;
}
public static int FindRecordPosition(ref DataView dvData, ref string strColumnName, ref string strFindValue)
{
int FindRecordPositionRet = default(int);
// //由Dataview的第一筆開始尋找符合的資料直到最後一筆
// //傳出資料在資料表內的Index
int i;
bool Found; // //紀錄是否找到符合資料
string strDataType; // //尋找資料欄的資料型態
try
{
if (!string.IsNullOrEmpty(strFindValue)) // 是否有傳入尋找的條件
{
Found = false;
strDataType = dvData.Table.Columns[strColumnName].DataType.ToString();
if (strDataType == "System.DateTime") // 日期型態的資料比對
{
var loopTo = dvData.Count;
for (i = 0; i <= loopTo; i++)
{
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(dvData[i][strColumnName], "#" + Strings.Format(Conversions.ToDate(strFindValue), "yyyy/MM/dd") + "#", false)))
{
Found = true;
break;
}
}
}
else // 字串,數值資料型態的比對
{
var loopTo1 = dvData.Count;
for (i = 0; i <= loopTo1; i++)
{
if ((Strings.UCase(dvData[i][strColumnName].ToString()) ?? "") == (Strings.UCase(strFindValue) ?? ""))
{
Found = true;
break;
}
}
}
if (Found == true)
{
FindRecordPositionRet = i; // 找到符合資料傳出所在的RowIndex
}
else
{
FindRecordPositionRet = -1;
} // 沒有符合資料
}
}
catch
{
FindRecordPositionRet = -1;
} // 沒有符合資料
return FindRecordPositionRet;
// //使用Dataview的Find Method,日期無法使用
// dvData.Sort = strColumnName
// FindRecordPosition = dvData.Find(strFindValue)
}
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;
}
public static string FilterByString(ref string strFilter, ref string strColumnName, ref string strColumnValue)
{
string FilterByStringRet = default(string);
// 對字串欄位做篩選
if (string.IsNullOrEmpty(strFilter))
{
strFilter = strColumnName + " = '" + Strings.Replace(strColumnValue, "'", "''") + "'";
}
else
{
strFilter = strFilter + " And " + strColumnName + " = '" + Strings.Replace(strColumnValue, "'", "''") + "'";
}
FilterByStringRet = strFilter;
return FilterByStringRet;
}
public static string FilterByInteger(ref string strFilter, ref string strColumnName, ref int strColumnValue)
{
string FilterByIntegerRet = default(string);
// 對數值欄位做篩選
if (string.IsNullOrEmpty(strFilter))
{
strFilter = strColumnName + " = " + strColumnValue;
}
else
{
strFilter = strFilter + " And " + strColumnName + " = " + strColumnValue;
}
FilterByIntegerRet = strFilter;
return FilterByIntegerRet;
}
public static string FilterByDate(ref string strFilter, ref string strColumnName, ref DateTime datFromDate, ref DateTime datEndDate)
{
string FilterByDateRet = default(string);
// 對日期欄位做篩選
if (string.IsNullOrEmpty(strFilter))
{
strFilter = strColumnName + " >= #" + Strings.Format(Conversions.ToDate(datFromDate), "yyyy/MM/dd 00:00:00") + "# And " + strColumnName + " <= #" + Strings.Format(Conversions.ToDate(datEndDate), "yyyy/MM/dd 23:59:59") + "# ";
}
else
{
strFilter = strFilter + " And " + strColumnName + " >= #" + Strings.Format(Conversions.ToDate(datFromDate), "yyyy/MM/dd 00:00:00") + "# And " + strColumnName + " <= #" + Strings.Format(Conversions.ToDate(datEndDate), "yyyy/MM/dd 23:59:59") + "# ";
}
FilterByDateRet = strFilter;
return FilterByDateRet;
}
public static bool IsBoolean(ref string strBoolean, string strBooleanValue = defString)
{
bool IsBooleanRet = default(bool);
// 此 Function 檢查傳入值是否為Boolean值
// 傳入值: strBoolean欲檢查是否為Boolean值的字串
// strBooleanValue將檢查值轉換為True或False的統一字串
// 傳回值: True是Boolean值 ; False不是Boolean值
IsBooleanRet = false;
if (string.IsNullOrEmpty(strBoolean))
{
IsBooleanRet = false;
}
else if (Strings.Trim(Strings.UCase(strBoolean)) != "Y" & Strings.Trim(Strings.UCase(strBoolean)) != "N" & Strings.Trim(Strings.UCase(strBoolean)) != "T" & Strings.Trim(Strings.UCase(strBoolean)) != "F" & Strings.Trim(Strings.UCase(strBoolean)) != "YES" & Strings.Trim(Strings.UCase(strBoolean)) != "NO" & Strings.Trim(Strings.UCase(strBoolean)) != "TRUE" & Strings.Trim(Strings.UCase(strBoolean)) != "FALSE" & Strings.Trim(Strings.UCase(strBoolean)) != "是" & Strings.Trim(Strings.UCase(strBoolean)) != "否" & Strings.Trim(Strings.UCase(strBoolean)) != "ON" & Strings.Trim(Strings.UCase(strBoolean)) != "OFF")
{
IsBooleanRet = false;
}
else if (Strings.Trim(Strings.UCase(strBoolean)) == "Y" | Strings.Trim(Strings.UCase(strBoolean)) == "T" | Strings.Trim(Strings.UCase(strBoolean)) == "YES" | Strings.Trim(Strings.UCase(strBoolean)) == "TRUE" | Strings.Trim(Strings.UCase(strBoolean)) == "是" | Strings.Trim(Strings.UCase(strBoolean)) == "ON")
{
IsBooleanRet = true;
strBooleanValue = "True";
}
else
{
IsBooleanRet = true;
strBooleanValue = "False";
}
return IsBooleanRet;
}
public static string CInput(ref string strInput)
{
string CInputRet = default(string);
// 將傳入值內的單引號轉換為可存入資料庫的格式
// 2. 將傳入值內的 &, >, < 三個特殊字元轉換為XmlDocument可解譯之代替符號
// 傳入值: strInput包含特殊字元的字串
// 傳回值: 將特殊字元變更為代替符號的字串
// 轉換 ' 為 '' (單引號轉為兩個單引號)
CInputRet = Strings.Replace(strInput, "'", "''");
// 轉換 & 為 &amp;
CInputRet = Strings.Replace(CInputRet, "&", "&amp;");
// CInput = Replace(CInput, """", "''") 'AddFlow的Xml字串不可將雙引號轉為兩個單引號,XMLToFlow會Error
// 轉換 > 為 &gt;
CInputRet = Strings.Replace(CInputRet, ">", "&gt;");
// 轉換 < 為 &lt;
CInputRet = Strings.Replace(CInputRet, "<", "&lt;");
return CInputRet;
}
public static string CUnInput(ref string strInput)
{
string CUnInputRet = default(string);
// 將傳入值內的單引號轉換為可存入資料庫的格式
// 傳入值: strInput包含特殊字元的字串
// 傳回值: 將代替符號變更為特殊字元的字串
// 轉換 ' 為 '' (單引號轉為兩個單引號)
// CUnInput = Replace(strInput, "'", "''")
CUnInputRet = Strings.Replace(strInput, "\"", "'");
// 轉換 & 為 &amp;
CUnInputRet = Strings.Replace(CUnInputRet, "&amp;", "&");
// 轉換 > 為 &gt;
CUnInputRet = Strings.Replace(CUnInputRet, "&gt;", ">");
// 轉換 < 為 &lt;
CUnInputRet = Strings.Replace(CUnInputRet, "&lt;", "<");
return CUnInputRet;
}
// ***Add by PY 2003/07/31****
public static string CombineXMLAdditional(ref string strAdditional)
{
string CombineXMLAdditionalRet = default(string);
CombineXMLAdditionalRet = "<additional>" + strAdditional;
CombineXMLAdditionalRet = CombineXMLAdditionalRet + "</additional>";
return CombineXMLAdditionalRet;
}
public static string CombineAddXML_Add(ref string name, ref string type, ref string value)
{
string CombineAddXML_AddRet = default(string);
CombineAddXML_AddRet = "<field>" + "<name>" + name + "</name>" + "<type>" + type + "</type>" + "<value>" + value + "</value>" + "</field>";
return CombineAddXML_AddRet;
}
public static string CombineAddXML_Edit(ref string name, ref string type, ref string value)
{
string CombineAddXML_EditRet = default(string);
CombineAddXML_EditRet = "<field>" + "<name>" + name + "</name>" + "<type>" + type + "</type>" + "<value>" + value + "</value>" + "</field>";
return CombineAddXML_EditRet;
}
public static string CombineAddXML_Field(ref string name)
{
string CombineAddXML_FieldRet = default(string);
CombineAddXML_FieldRet = "<field>" + "<name>" + name + "</name>" + "</field>";
return CombineAddXML_FieldRet;
}
public static string CombineAddXML_Condition(string condition)
{
string CombineAddXML_ConditionRet = default(string);
CombineAddXML_ConditionRet = "<condition>" + Strings.Replace(condition, "''", "'") + "</condition>";
return CombineAddXML_ConditionRet;
}
// **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
wsUrl = tmpString[0].ToString() + "/" + tmpString[1].ToString() + "/" + gMESWebServiceHost + "/" + tmpString[4].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
// 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]);
}
}
}
catch (Exception ex)
{
throw ex;
}
return result;
}
public static string GetExceptionStack(ref System.Xml.XmlDocument Xmldoc)
{
string GetExceptionStackRet = default(string);
if (Xmldoc.DocumentElement.GetElementsByTagName("stack").Count > 0)
{
string argstrInput = Xmldoc.DocumentElement.GetElementsByTagName("stack").Item(0).InnerXml;
GetExceptionStackRet = CUnInput(ref argstrInput);
Xmldoc.DocumentElement.GetElementsByTagName("stack").Item(0).InnerXml = argstrInput;
}
else
{
GetExceptionStackRet = "";
}
return GetExceptionStackRet;
}
public static void WriteLog(string msg, iMESLog.iMESLogLevel level, Exception e = null)
{
string MethodInfo = "";
var ss = new StackTrace(true);
var mb = ss.GetFrame(1).GetMethod();
MethodInfo = mb.DeclaringType.Namespace + "." + mb.DeclaringType.Name + "." + mb.Name;
var log = new iMESLog.MESLog(mb.DeclaringType.Namespace);
log.WriteLog(msg, level, e, MethodInfo);
}
#region
public static string TranslateMsg(string Message)
{
string TranslateMsgRet = default(string);
gLanguageMode = GetAppSettings("LanguageMode");
// 1.Check LanguageMode
string strFileName, strGenFile;
if (string.IsNullOrEmpty(gLanguageMode))
{
strFileName = "mesresource.en";
strGenFile = "mesresource.en";
}
else
{
strFileName = "mesresource." + gLanguageMode;
strGenFile = "mesresource." + gLanguageMode;
}
// 2.Get File Path
string strResourcePath = gSTDPath + "Resources";
string strErrName_Rep = "";
// 檢查檔案是否存在
if (File.Exists(strResourcePath + "/" + strFileName + ".resources") == true)
{
// 4.Replace原始訊息.
if (Strings.InStr(Message, "[%", CompareMethod.Text) > 0)
{
// Replace[%%]
// Dim rmGen As Resources.ResourceManager = Resources.ResourceManager.CreateFileBasedResourceManager(strGenFile, strResourcePath, Nothing)
// 2020/05/20 OwenLiu, Mantis:0071895, 增加多語系檔案的語系轉換機制
ResourceManager ResourceMgr = null;
Dictionary<string, string>[] ResourceDictionary = null;
funGetMultiResourceManager(strResourcePath, gLanguageMode, ref ResourceMgr, ref ResourceDictionary);
string strKey, strKeyValue;
int intStart, j, k, l;
intStart = 1;
j = 1;
while (j != 0)
{
j = Strings.InStr(intStart, Message, "[%", CompareMethod.Text);
if (j == 0)
{
strErrName_Rep += Strings.Mid(Message, intStart);
}
else
{
k = Strings.InStr(j + 2, Message, "%]", CompareMethod.Text);
if (k == 0)
{
// 找不到對應的結束字元.
strErrName_Rep += Strings.Mid(Message, intStart);
j = 0;
}
else
{
// 檢查是否有不對稱的情況.
l = Strings.InStr(j + 2, Message, "[%", CompareMethod.Text);
if (l == 0 || l > k)
{
strErrName_Rep += Strings.Mid(Message, intStart, j - intStart);
strKey = Strings.Mid(Message, j + 2, k - j - 2);
// 將Key執行語系轉換
try
{
// 2020/05/20 OwenLiu, Mantis:0071895, 增加多語系檔案的語系轉換機制
strKeyValue = funGetResourceManager_Text(strKey.ToUpper(), oResourceManager: ref ResourceMgr, oResourceDictionary: ref ResourceDictionary);
}
catch (Exception ex)
{
strKeyValue = strKey;
}
if (string.IsNullOrEmpty(strKeyValue))
{
strErrName_Rep += strKey;
}
else
{
strErrName_Rep += strKeyValue;
}
// 下次截取字串的起始位置
intStart = k + 2;
}
else
{
// 不對稱,找到最內層的[%%]
int m;
// 在前面的條件下,一定找得到.
m = Strings.InStrRev(Message, "[%", k, CompareMethod.Text);
// 擷出不轉換的字串.
strErrName_Rep += Strings.Mid(Message, intStart, m - intStart);
strKey = Strings.Mid(Message, m + 2, k - m - 2);
// 將Key執行語系轉換
try
{
// 2020/05/20 OwenLiu, Mantis:0071895, 增加多語系檔案的語系轉換機制
strKeyValue = funGetResourceManager_Text(strKey.ToUpper(), oResourceManager: ref ResourceMgr, oResourceDictionary: ref ResourceDictionary);
}
catch (Exception ex)
{
strKeyValue = strKey;
}
if (string.IsNullOrEmpty(strKeyValue))
{
strErrName_Rep += strKey;
}
else
{
strErrName_Rep += strKeyValue;
}
// 下次截取字串的起始位置
intStart = k + 2;
}
}
}
}
ResourceMgr = null;
ResourceDictionary = null;
}
else
{
strErrName_Rep = Message;
}
}
else
{
strErrName_Rep = Message.Replace("[%", "").Replace("%]", "");
}
TranslateMsgRet = strErrName_Rep;
return TranslateMsgRet;
}
/// <summary>
/// 2020/05/15 OwenLiu, Mantis:0071895, 取回所有語系檔案的 ResourceManager Array
/// </summary>
/// <param name="pResourcePath"></param>
/// <param name="pLanguageMode"></param>
/// <param name="oResourceManager"></param>
/// <returns></returns>
private static bool funGetMultiResourceManager(string pResourcePath, string pLanguageMode, ref ResourceManager oResourceManager, ref Dictionary<string, string>[] oResourceDictionary)
{
bool blnResult = false;
string strResourceFile = "mesresource";
try
{
if (!string.IsNullOrEmpty(pLanguageMode))
{
strResourceFile += "." + pLanguageMode;
}
else
{
strResourceFile += ".en";
}
if (new DirectoryInfo(pResourcePath).Exists == false)
{
oResourceManager = null;
return blnResult;
}
// 一次性建立多個ResourceManager, 以節省控制項的語系轉換須多次開檔的時間(控制項一定會有多個)
int intIndex = 0;
short intResouceFileQty = (short)new DirectoryInfo(pResourcePath).GetFiles(strResourceFile + ".resources*", SearchOption.TopDirectoryOnly).Count();
if (intResouceFileQty == 1)
{
oResourceDictionary = null;
}
else if (intResouceFileQty > 1)
{
oResourceDictionary = new Dictionary<string, string>[intResouceFileQty - 2 + 1];
}
foreach (string f in Directory.GetFiles(pResourcePath, strResourceFile + ".resources*", SearchOption.TopDirectoryOnly).OrderByDescending(x => x))
{
string ResourceBaseName = f.Substring(f.LastIndexOf(@"\") + 1);
if (intIndex == intResouceFileQty - 1)
{
oResourceManager = ResourceManager.CreateFileBasedResourceManager(strResourceFile, pResourcePath, null);
}
else
{
// 其他資源檔案 讀取到 Dictionary
oResourceDictionary[intIndex] = funReadResourceFile_Dictionary(f);
}
intIndex += 1;
}
blnResult = true;
}
catch (Exception ex)
{
throw;
}
return blnResult;
}
/// <summary>
/// 2020/05/15 OwenLiu, Mantis:0071895, 從所有語系檔案的 ResourceManager Array 取出對應的語系值
/// </summary>
/// <param name="pKey"></param>
/// <param name="oResourceManager"></param>
/// <returns></returns>
private static string funGetResourceManager_Text(string pKey, ref ResourceManager oResourceManager, ref Dictionary<string, string>[] oResourceDictionary)
{
string strResult = "";
bool blnKeyExists = false;
do
{
try
{
// 先搜尋Dictionary 是否有對應的Key
if (oResourceDictionary != null)
{
foreach (Dictionary<string, string> ResourceDic in oResourceDictionary)
{
if (ResourceDic.ContainsKey(pKey))
{
strResult = ResourceDic[pKey];
blnKeyExists = true;
break;
}
}
}
if (!blnKeyExists)
{
// 未找到Key, 搜尋ResourceManager
strResult = oResourceManager.GetString(pKey);
if (!string.IsNullOrEmpty(strResult))
break;
}
}
catch (Exception ex)
{
}
}
// Throw
while (false);
return strResult;
}
/// <summary>
/// 2020/05/17 OwenLiu, Mantis:0071895, 讀取語系檔案到 Dictionary
/// </summary>
/// <param name="ResourceFilePath"></param>
/// <returns></returns>
private static Dictionary<string, string> funReadResourceFile_Dictionary(string ResourceFilePath)
{
var oReturnResource = new Dictionary<string, string>();
try
{
var reader = new ResourceReader(ResourceFilePath);
var en = reader.GetEnumerator();
while (en.MoveNext())
oReturnResource.Add(Conversions.ToString(en.Key), Conversions.ToString(en.Value));
reader.Close();
}
catch (Exception ex)
{
throw;
}
return oReturnResource;
}
#endregion
}
}

View File

@ -0,0 +1,31 @@
using System;
using System.Reflection;
using System.Runtime.InteropServices;
// 一般的組件資訊是由下列這組屬性所控制。
// 變更這些屬性的值即可修改組件的相關資訊。
// 檢閱組件屬性的值
[assembly: AssemblyTitle("AutoLoaderService_Base")]
[assembly: AssemblyDescription("AutoLoaderService_Base 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("35551C58-0A78-4A28-AEAF-1ABCE96E869A")]
// 組件的版本資訊由下列四個值所組成:
//
// 主要版本
// 次要版本
// 組建編號
// 修訂
//
// 您可以自行指定所有的值,也可以依照以下的方式,使用 '*' 將修訂和組建編號
// 指定為預設值:
[assembly: AssemblyVersion("4.20.0.0")]
[assembly: AssemblyFileVersion("4.20.0.0")]

View File

@ -0,0 +1,661 @@
using System;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using System.ServiceProcess;
using System.Xml;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
namespace AutoLoaderService_Base
{
public class Service1 : ServiceBase
{
// //建立AutoLoaderJob所使用的DataTable
private DataTable dtAutoLoaderJob;
// //Trace & Log
private bool blnLogFile = false;
private bool blnTraceFile = false;
private string strLogFilePath = string.Empty;
private string strTraceFilePath = string.Empty;
// //取出Job檔案路徑
private string strJobFilePath = "";
// 取回JOB LIST 到 JOB QUEUE的時間間隔(單位:分鐘) '20211015 13871,修正為*1000是秒, *60才是分鐘
private int MonitorjoblistDuration = (int)Math.Round(Conversions.ToDouble(modWIN.GetAppSettings("MonitorjoblistDuration")) * 1000d *60d );
// 到JOB QUEUE 檢查是否有要執行的job的時間間隔(單位:分鐘) '20211015 13871,修正為*1000是秒, , *60才是分鐘
private int MonitorQueueDuration = (int)Math.Round(Conversions.ToDouble(modWIN.GetAppSettings("MonitorQueueDuration")) * 1000d * 60d);
private const string JOB_FILE_NAME = "AutoLoaderJob_Base.xml";
#region
public Service1() : base()
{
// 此為元件設計工具所需的呼叫。
InitializeComponent();
// 在 InitializeComponent() 呼叫之後加入所有的初始化作業
}
// UserService 覆寫 Dispose 以清除元件清單。
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
// 處理序的主進入點
[MTAThread()]
public static void Main()
{
ServiceBase[] ServicesToRun;
// 在同一個處理序中可以執行多個 NT 服務; 若要在這個處理序中
// 加入另一項服務,請修改以下各行
// 以建立第二個服務物件。例如,
//
// ServicesToRun = New System.ServiceProcess.ServiceBase () {New Service1, New MySecondUserService}
//
ServicesToRun = new ServiceBase[] { new Service1() };
//RunInteractive(ServicesToRun); //for 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;
// 注意: 以下為元件設計工具所需的程序
// 您可以使用元件設計工具進行修改,
// 請勿使用程式碼編輯器進行修改。
private System.Timers.Timer _TimerCheckJobList;
internal virtual System.Timers.Timer TimerCheckJobList
{
[MethodImpl(MethodImplOptions.Synchronized)]
get
{
return _TimerCheckJobList;
}
[MethodImpl(MethodImplOptions.Synchronized)]
set
{
if (_TimerCheckJobList != null)
{
_TimerCheckJobList.Elapsed -= TimerCheckJobList_Elapsed;
}
_TimerCheckJobList = value;
if (_TimerCheckJobList != null)
{
_TimerCheckJobList.Elapsed += TimerCheckJobList_Elapsed;
}
}
}
private System.Timers.Timer _TimerCheckQueue;
internal virtual System.Timers.Timer TimerCheckQueue
{
[MethodImpl(MethodImplOptions.Synchronized)]
get
{
return _TimerCheckQueue;
}
[MethodImpl(MethodImplOptions.Synchronized)]
set
{
if (_TimerCheckQueue != null)
{
_TimerCheckQueue.Elapsed -= TimerCheckQueue_Elapsed;
}
_TimerCheckQueue = value;
if (_TimerCheckQueue != null)
{
_TimerCheckQueue.Elapsed += TimerCheckQueue_Elapsed;
}
}
}
[DebuggerStepThrough()]
private void InitializeComponent()
{
this._TimerCheckJobList = new System.Timers.Timer();
this._TimerCheckQueue = new System.Timers.Timer();
((System.ComponentModel.ISupportInitialize)(this._TimerCheckJobList)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this._TimerCheckQueue)).BeginInit();
//
// _TimerCheckJobList
//
this._TimerCheckJobList.Interval = 2000D;
this._TimerCheckJobList.Elapsed += new System.Timers.ElapsedEventHandler(this.TimerCheckJobList_Elapsed);
//
// _TimerCheckQueue
//
this._TimerCheckQueue.Interval = 3000D;
this._TimerCheckQueue.Elapsed += new System.Timers.ElapsedEventHandler(this.TimerCheckQueue_Elapsed);
//
// Service1
//
this.ServiceName = "MES AutoLoader Service (Production)";
((System.ComponentModel.ISupportInitialize)(this._TimerCheckJobList)).EndInit();
((System.ComponentModel.ISupportInitialize)(this._TimerCheckQueue)).EndInit();
}
#endregion
protected override void OnStart(string[] args)
{
// // 在此加入啟動服務的程式碼,這個方法必須設定已啟動的
// // 事項,否則可能導致服務無法工作。
// //取出是否需要將Trace的Log產生檔案
try
{
string strTemp = modWIN.GetAppSettings("JobFilePath") == null ? "" : modWIN.GetAppSettings("JobFilePath");
if (strTemp.Contains(":"))
strJobFilePath = Path.Combine(strTemp, JOB_FILE_NAME);
else
strJobFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, strTemp, JOB_FILE_NAME);
}
catch (Exception)
{
strJobFilePath = JOB_FILE_NAME;
modWIN.WriteLog("defaultPath" + strJobFilePath, iMESLog.iMESLogLevel.Trace);
}
try
{
blnTraceFile = bool.Parse(modWIN.GetAppSettings("TraceFile"));
}
catch (Exception ex)
{
blnTraceFile = false;
}
// //取出是否需要將Fail的Log產生檔案
try
{
blnLogFile = bool.Parse(modWIN.GetAppSettings("LogFile"));
}
catch (Exception ex)
{
blnLogFile = false;
}
// //取出是Trace產生檔案路徑
try
{
if (blnTraceFile == true)
{
string strTemp = modWIN.GetAppSettings("TraceFilePath") == null ? "" : modWIN.GetAppSettings("TraceFilePath");
if (strTemp.Contains(":"))
strTraceFilePath = strTemp;
else
strTraceFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, strTemp);
}
}
catch (Exception ex)
{
// 暫時
strTraceFilePath = @"C:\Temp\";
}
// //取出是Log產生檔案路徑
try
{
if (blnLogFile == true)
{
string strTemp = modWIN.GetAppSettings("LogFilePath") == null ? "" : modWIN.GetAppSettings("LogFilePath");
if (strTemp.Contains(":"))
strLogFilePath = strTemp;
else
strLogFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, strTemp);
}
}
catch (Exception ex)
{
// 暫時
strLogFilePath = string.Empty;
}
if (blnTraceFile == true)
{
//funWriteTxtFile("Service Starting...");
modWIN.WriteLog("Service Starting...", iMESLog.iMESLogLevel.Trace);
}
dtAutoLoaderJob = new DataTable("AutoLoaderJob");
// 2021/8/10 Steven Mantis: 0097110: AuoLoader Service 錯誤攔截優化
try
{
//改成用读取节点的方式获取xml值
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(strJobFilePath);
XmlNodeList autoLoaderJobList = xmlDoc.GetElementsByTagName("AutoLoaderJob");
foreach (XmlNode autoLoaderJobNode in autoLoaderJobList)
{
DataRow drAdd;
drAdd = dtAutoLoaderJob.NewRow();
foreach (XmlNode item in autoLoaderJobNode.ChildNodes)
{
if (!dtAutoLoaderJob.Columns.Contains(item.Name))
{
dtAutoLoaderJob.Columns.Add(item.Name);
}
drAdd[item.Name] = funLoadXml(autoLoaderJobNode, item.Name);
}
dtAutoLoaderJob.Rows.Add(drAdd);
}
//dtAutoLoaderJob.ReadXmlSchema(strJobFilePath);
//dtAutoLoaderJob.ReadXml(strJobFilePath);
}
catch (Exception ex)
{
modWIN.WriteLog("[" + Strings.Format(DateTime.Now, "yyyy/MM/dd HH:mm:ss") + "]" + "AutoLoaderJob_Base.xml不存在或格式不正確,請確認" + Constants.vbCrLf, iMESLog.iMESLogLevel.Error );
//modAutoLoader.WriteLogFile(strLogFilePath, "[" + Strings.Format(DateTime.Now, "yyyy/MM/dd HH:mm:ss") + "]" + "AutoLoaderJob_Base.xml不存在或格式不正確,請確認" + Constants.vbCrLf);
}
// //Init Status = 0
int i = 0;
var loopTo = dtAutoLoaderJob.Rows.Count - 1;
for (i = 0; i <= loopTo; i++)
{
dtAutoLoaderJob.Rows[i].BeginEdit();
dtAutoLoaderJob.Rows[i]["Status"] = 0;
dtAutoLoaderJob.Rows[i].EndEdit();
}
// '//Init Process
// Call InitProcess()
// 每隔n分鐘, 取回一次JOB LIST 到 JOB QUEUE
TimerCheckJobList.Interval = MonitorjoblistDuration;
TimerCheckJobList.Enabled = true;
// 每隔n分鐘,到 JOB QUEUE 檢查是否有要執行的
TimerCheckQueue.Interval = MonitorQueueDuration;
TimerCheckQueue.Enabled = true;
}
protected override void OnStop()
{
// //在此加入停止服務所需執行的終止程式碼。
dtAutoLoaderJob.WriteXml(strJobFilePath);
dtAutoLoaderJob.Dispose();
TimerCheckJobList.Enabled = false;
TimerCheckQueue.Enabled = false;
if (blnTraceFile == true)
{
modWIN.WriteLog("Service Stopping...", iMESLog.iMESLogLevel.Trace);
//funWriteTxtFile("Service Stopping...");
}
}
private void TimerCheckJobList_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
try
{
// //............................
// //每一秒鐘檢查是否有Job要執行
// //............................
// Me.TimerCheckJobList.Enabled = False
if (blnTraceFile == true)
{
//funJobFile("Start CheckJobList");
modWIN.WriteLog("Start CheckJobList", iMESLog.iMESLogLevel.Trace);
}
// //變更需要執行的Job Status
funGetJob2Queue();
if (blnTraceFile == true)
{
modWIN.WriteLog("End CheckJobList", iMESLog.iMESLogLevel.Trace);
//funJobFile("End CheckJobList");
}
TimerCheckJobList.Enabled = true;
}
catch (Exception ex)
{
modWIN.WriteLog("CheckJobList fail"+ex.Message , iMESLog.iMESLogLevel.Error );
TimerCheckJobList.Enabled = true;
}
}
private void TimerCheckQueue_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
{
try
{
// //............................
// //每一秒鐘取出需要執行的Job
// //............................
// Me.TimerCheckQueue.Enabled = False
if (blnTraceFile == true)
{
modWIN.WriteLog("Start CheckQueue",iMESLog.iMESLogLevel.Trace );
// funQueueFile("Start CheckQueue");
}
// //執行Job
funRunJob();
if (blnTraceFile == true)
{
modWIN.WriteLog("End CheckQueue", iMESLog.iMESLogLevel.Trace);
//funQueueFile("End CheckQueue");
}
TimerCheckQueue.Enabled = true;
}
catch (Exception ex)
{
modWIN.WriteLog("CheckQueue fail:"+ ex.Message , iMESLog.iMESLogLevel.Error );
TimerCheckQueue.Enabled = true;
}
}
#region Private Function
/// <summary>
/// 将status 改为1 待执行
/// </summary>
public void funGetJob2Queue()
{
lock (this)
{
// //判斷目前的Job中是否需要排入執行
DataRow[] drSel;
int idx = 0;
var ArriveTime = DateTime.Now;
try
{
// //
drSel = dtAutoLoaderJob.Select("Status = 0"); // 未執行Job
var loopTo = drSel.Length - 1;
for (idx = 0; idx <= loopTo; idx++)
{
// 2023/4/21,Ning,129075: [博升] AutoLoader 日志报错, 執行頻率(Frequency)單位改為分鐘, 即秒*60
//if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreater(DateAndTime.DateDiff(DateInterval.Second, Conversions.ToDate(drSel[idx]["LastRunTime"]), ArriveTime), Conversions.ToInteger(drSel[idx]["Frequency"]) * 60, false)))
//If DateDiff(DateInterval.Second, drSel(idx)("LastRunTime"), ArriveTime) > (drSel(idx)("Frequency") * 60) Then
//检查上一次的时间与当配置的时间差
if (DateAndTime.DateDiff(DateInterval.Second, Convert.ToDateTime(drSel[idx]["LastRunTime"]), ArriveTime) > Convert.ToInt32(drSel[idx]["Frequency"]) * 60)
{
drSel[idx].BeginEdit();
drSel[idx]["Status"] = 1; // 待執行Job
drSel[idx].EndEdit();
if (blnTraceFile == true)
{
//funJobFile(Conversions.ToString("JobNo:" +
// drSel[idx]["JobNo"] + " -- " + drSel[idx]["LastRunTime"] + " ~ " + ArriveTime + " = " + DateAndTime.DateDiff(DateInterval.Second, Conversions.ToDate(drSel[idx]["LastRunTime"]), ArriveTime)));
modWIN.WriteLog(Conversions.ToString("JobNo:" +
drSel[idx]["JobNo"] + " -- " + drSel[idx]["LastRunTime"] + " ~ " + ArriveTime + " = " + DateAndTime.DateDiff(DateInterval.Second, Conversions.ToDate(drSel[idx]["LastRunTime"]), ArriveTime)), iMESLog.iMESLogLevel.Trace);
}
}
}
}
catch (Exception ex)
{
//modAutoLoader.WriteLogFile(strLogFilePath, ex.Message + Constants.vbCrLf);
modWIN.WriteLog("funGetJob2Queue fail :" +strLogFilePath + ex.Message, iMESLog.iMESLogLevel.Error );
}
finally
{
// //
drSel = null;
}
}
}
public void funRunJob()
{
lock (this)
{
DataRow[] drSel;
int idx = 0;
var ArriveTime = DateTime.Now;
try
{
drSel = dtAutoLoaderJob.Select("Status = 1"); // 待執行Job
if (blnTraceFile == true)
{
// funQueueFile("Queue Count:" + drSel.Length);
modWIN.WriteLog("Queue Count:" + drSel.Length, iMESLog.iMESLogLevel.Trace);
}
var loopTo = drSel.Length - 1;
for (idx = 0; idx <= loopTo; idx++)
{
if (blnTraceFile == true)
{
// funWriteTxtFile("Start Job..." + drSel[idx]["JobNo"].ToString());
modWIN.WriteLog("Start Job..." + drSel[idx]["JobNo"].ToString(), iMESLog.iMESLogLevel.Trace);
}
// //將Job改成執行中
drSel[idx].BeginEdit();
drSel[idx]["Status"] = 2; // 執行中
drSel[idx].EndEdit();
if (blnTraceFile == true)
{
// funWriteTxtFile("Status:Running");
modWIN.WriteLog("Status:Running", iMESLog.iMESLogLevel.Trace);
}
// //建立傳入執行緒之參數物件
var objJobData = new modAutoLoader.SomeStateType();
objJobData.SomeState(drSel[idx]["JobExecutionFile"].ToString(), drSel[idx]["JobNo"].ToString(), drSel[idx]["Jobfunction"].ToString(), drSel[idx]["SourcePath"].ToString(), drSel[idx]["DestinationPath"].ToString(), drSel[idx]["QueuePath"].ToString(), drSel[idx]["FailPath"].ToString(), strLogFilePath, Conversions.ToLong(drSel[idx]["SplitFileSize"].ToString()), Conversions.ToLong(drSel[idx]["SplitRecordsLimit"].ToString()), drSel[idx]["JobName"].ToString(), drSel[idx]["JobFunction"].ToString(), drSel[idx]["Parameter1"].ToString(), drSel[idx]["Parameter2"].ToString(), drSel[idx]["Parameter3"].ToString(), drSel[idx]["Parameter4"].ToString(), drSel[idx]["Parameter5"].ToString(), drSel[idx]["Parameter6"].ToString(), drSel[idx]["Parameter7"].ToString(), drSel[idx]["Parameter8"].ToString(), drSel[idx]["Parameter9"].ToString(), drSel[idx]["Parameter10"].ToString());
// //開始執行
if (System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(modAutoLoader.funProcessJob), objJobData) == false)
{
modWIN.WriteLog("Job Fail:" + drSel[idx]["JobNo"].ToString(), iMESLog.iMESLogLevel.Trace);
// //funWriteTxtFile("Job Fail:" & drSel(idx)("JobNo").ToString)
}
// //將Job改成Queue
drSel[idx].BeginEdit();
drSel[idx]["Status"] = 0; // Queue
drSel[idx]["LastRunTime"] = Strings.Format(ArriveTime, "yyyy/MM/dd HH:mm:ss"); // 執行時間
drSel[idx].EndEdit();
if (blnTraceFile == true)
{
modWIN.WriteLog("Status:Complete," +"End Job..." + drSel[idx]["JobNo"].ToString(), iMESLog.iMESLogLevel.Trace);
//funWriteTxtFile("Status:Complete");
//funWriteTxtFile("End Job..." + drSel[idx]["JobNo"].ToString());
}
}
}
catch (Exception ex)
{
// //
drSel = dtAutoLoaderJob.Select("Status = 2"); // 執行中
var loopTo = drSel.Length - 1;
for (idx = 0; idx <= loopTo; idx++)
{
// //將Job改成待執行
drSel[idx].BeginEdit();
drSel[idx]["Status"] = 0; // Queue
drSel[idx]["LastRunTime"] = Strings.Format(ArriveTime, "yyyy/MM/dd HH:mm:ss"); // 執行時間
drSel[idx].EndEdit();
}
modWIN.WriteLog(ex.Message + Constants.vbCrLf, iMESLog.iMESLogLevel.Error );
//modAutoLoader.WriteLogFile(strLogFilePath, ex.Message + Constants.vbCrLf);
}
finally
{
drSel = null;
}
}
}
public void InitProcess()
{
try
{
// //開始執行
System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(modAutoLoader.funInitProcess));
}
catch (Exception ex)
{
}
}
private string funWriteTxtFile(string WriteTxt)
{
try
{
string path = Path.Combine(strTraceFilePath, Strings.Format(DateTime.Now, "yyyyMMdd").ToString() + "_T3.Log");
if (!string.IsNullOrEmpty(strTraceFilePath) && !Directory.Exists(strTraceFilePath))
Directory.CreateDirectory(strTraceFilePath);
lock (this)
{
var fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite);
var w = new StreamWriter(fs);
w.BaseStream.Seek(0L, SeekOrigin.End);
w.WriteLine("日期時間:" + Strings.Format(DateTime.Now, "yyyy/MM/dd HH:mm:ss") + "--" + WriteTxt);
w.Close();
fs.Close();
}
}
catch (Exception ex)
{
}
return default(string);
}
private string funQueueFile(string WriteTxt)
{
try
{
string path = Path.Combine(strTraceFilePath, Strings.Format(DateTime.Now, "yyyyMMdd").ToString() + "_T1.Log");
if (!string.IsNullOrEmpty(strTraceFilePath) && !Directory.Exists(strTraceFilePath))
Directory.CreateDirectory(strTraceFilePath);
lock (this)
{
var fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite);
var w = new StreamWriter(fs);
w.BaseStream.Seek(0L, SeekOrigin.End);
w.WriteLine("日期時間:" + Strings.Format(DateTime.Now, "yyyy/MM/dd HH:mm:ss") + "--" + WriteTxt);
w.Close();
fs.Close();
}
}
catch (Exception ex)
{
}
return default(string);
}
private string funJobFile(string WriteTxt)
{
try
{
string path = Path.Combine(strTraceFilePath, Strings.Format(DateTime.Now, "yyyyMMdd").ToString() + "_T2.Log");
if (!string.IsNullOrEmpty(strTraceFilePath) && !Directory.Exists(strTraceFilePath))
Directory.CreateDirectory(strTraceFilePath);
lock (this)
{
var fs = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite);
var w = new StreamWriter(fs);
w.BaseStream.Seek(0L, SeekOrigin.End);
w.WriteLine("日期時間:" + Strings.Format(DateTime.Now, "yyyy/MM/dd HH:mm:ss") + "--" + WriteTxt);
w.Close();
fs.Close();
}
}
catch (Exception ex)
{
}
return default(string);
}
#endregion
private string funLoadXml(XmlNode autoLoaderJobNode, string tag)
{
if (autoLoaderJobNode.SelectNodes(tag).Count > 0)
{
return autoLoaderJobNode.SelectSingleNode(tag).InnerText;
}
else
{
return "";
}
}
}
}

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>183, 17</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,293 @@
<?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>{76CCB2C1-5347-075C-192E-C939BAFBC971}</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>AutoLoaderService_Base</AssemblyName>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyMode>None</AssemblyOriginatorKeyMode>
<DefaultClientScript>JScript</DefaultClientScript>
<DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
<DefaultTargetSchema>IE50</DefaultTargetSchema>
<DelaySign>false</DelaySign>
<OutputType>WinExe</OutputType>
<OptionCompare>Binary</OptionCompare>
<OptionExplicit>On</OptionExplicit>
<OptionStrict>Off</OptionStrict>
<RootNamespace>AutoLoaderService_Base</RootNamespace>
<StartupObject>AutoLoaderService_Base.Service1</StartupObject>
<WebReference_EnableProperties>true</WebReference_EnableProperties>
<WebReference_EnableSQLTypes>false</WebReference_EnableSQLTypes>
<WebReference_EnableLegacyEventingModel>true</WebReference_EnableLegacyEventingModel>
<FileUpgradeFlags>
</FileUpgradeFlags>
<MyType>Console</MyType>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<SignAssembly>false</SignAssembly>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<OldToolsVersion>2.0</OldToolsVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
<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>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<DefaultItemExcludes>$(DefaultItemExcludes);$(ProjectDir)**\*.vb</DefaultItemExcludes>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>..\..\..\MESClient\AutoLoaderServiceInstall_Base\</OutputPath>
<DocumentationFile>..\..\..\MESClient\AutoLoaderServiceInstall_Base\AutoLoaderService_Base.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>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42353,42354,42355</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<OutputPath>..\..\..\MESClient\AutoLoaderServiceInstall\</OutputPath>
<DocumentationFile>..\..\..\MESClient\AutoLoaderServiceInstall\
</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>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036,42353,42354,42355</NoWarn>
<DebugType>none</DebugType>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
</PropertyGroup>
<ItemGroup>
<Reference Include="AutoLoaderLib_Base, Version=4.20.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_S_DLL\AutoLoaderLib_Base.dll</HintPath>
</Reference>
<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>
</Reference>
<Reference Include="iMESAppSetting, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_S_DLL\iMESAppSetting.dll</HintPath>
</Reference>
<Reference Include="iMESComSubroutine">
<HintPath>..\..\..\MES_S_DLL\iMESComSubroutine.dll</HintPath>
</Reference>
<Reference Include="iMESComXML">
<HintPath>..\..\..\MES_S_DLL\iMESComXML.dll</HintPath>
</Reference>
<Reference Include="iMESConst, Version=6.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_S_DLL\iMESConst.dll</HintPath>
</Reference>
<Reference Include="iMESLog">
<HintPath>..\..\..\MES_S_DLL\iMESLog.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_C_DLL\ICSharpCode.SharpZipLib.dll</HintPath>
</Reference>
<Reference Include="NPOI, Version=2.0.6.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\MES_C_DLL\NPOI.dll</HintPath>
</Reference>
<Reference Include="NPOI.OOXML, Version=2.0.6.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.0.6.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.0.6.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">
<Name>System</Name>
</Reference>
<Reference Include="System.Configuration" />
<Reference Include="System.Configuration.Install">
<Name>System.Configuration.Install</Name>
</Reference>
<Reference Include="System.Data">
<Name>System.Data</Name>
</Reference>
<Reference Include="System.Deployment" />
<Reference Include="System.EnterpriseServices" />
<Reference Include="System.ServiceProcess">
<Name>System.ServiceProcess</Name>
</Reference>
<Reference Include="System.Web.Extensions" />
<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="Microsoft.VisualBasic" />
<Import Include="System" />
<Import Include="System.Collections" />
<Import Include="System.Data" />
<Import Include="System.Diagnostics" />
</ItemGroup>
<ItemGroup>
<Compile Include="Web References\localhost\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
<None Include="app.config">
<SubType>Designer</SubType>
</None>
<Compile Include="AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="AutoLoaderService.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="modAutoLoader.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="ProjectInstaller.cs">
<SubType>Component</SubType>
</Compile>
<EmbeddedResource Include="AutoLoaderService.resx">
<DependentUpon>AutoLoaderService.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="ProjectInstaller.resx">
<DependentUpon>ProjectInstaller.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="Install_x32.bat">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Install_x64.bat">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="My Project\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<None Include="Uninstall_x32.bat">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Uninstall_x64.bat">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Include="Web References\localhost\Reference.map">
<Generator>MSDiscoCodeGenerator</Generator>
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
<None Include="Web References\localhost\wsInvoke.wsdl" />
<WebReferences Include="Web References\" />
</ItemGroup>
<ItemGroup>
<Content Include="AutoLoaderJob_Base.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="Web References\localhost\wsInvoke.disco" />
</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="Connected Services\" />
</ItemGroup>
<ItemGroup>
<WebReferenceUrl Include="http://localhost/MESws_Industry_Base/wsInvoke.asmx%3fop=invokeSrv">
<UrlBehavior>Dynamic</UrlBehavior>
<RelPath>Web References\localhost\</RelPath>
<UpdateFromURL>http://localhost/MESws_Industry_Base/wsInvoke.asmx%3fop=invokeSrv</UpdateFromURL>
<ServiceLocationURL>
</ServiceLocationURL>
<CachedDynamicPropName>
</CachedDynamicPropName>
<CachedAppSettingsObjectName>Settings</CachedAppSettingsObjectName>
<CachedSettingsPropName>AutoLoaderService_Base_localhost_wsInvoke</CachedSettingsPropName>
</WebReferenceUrl>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PreBuildEvent>
</PreBuildEvent>
<PostBuildEvent>
</PostBuildEvent>
</PropertyGroup>
</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,3 @@
%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe "%~dp0AutoLoaderService_Base.exe"
Pause

View File

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

View File

@ -0,0 +1,102 @@
// ------------------------------------------------------------------------------
// <auto-generated>
// 這段程式碼是由工具產生的。
// 執行階段版本:4.0.30319.42000
//
// 對這個檔案所做的變更可能會造成錯誤的行為,而且如果重新產生程式碼,
// 變更將會遺失。
// </auto-generated>
// ------------------------------------------------------------------------------
using System.Diagnostics;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
namespace AutoLoaderService_Base
{
[System.Runtime.CompilerServices.CompilerGenerated()]
[System.CodeDom.Compiler.GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")]
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Advanced)]
internal sealed partial class Settings : System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = (Settings)Synchronized(new Settings());
#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(sender As Global.System.Object, 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 Settings 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_Industry_Base/wsInvoke.asmx")]
public string AutoLoaderService_Base_localhost_wsInvoke
{
get
{
return Conversions.ToString(this["AutoLoaderService_Base_localhost_wsInvoke"]);
}
}
}
namespace My
{
[HideModuleName()]
[DebuggerNonUserCode()]
[System.Runtime.CompilerServices.CompilerGenerated()]
internal static class MySettingsProperty
{
[System.ComponentModel.Design.HelpKeyword("My.Settings")]
internal static Settings Settings
{
get
{
return Settings.Default;
}
}
}
}
}

View File

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

View File

@ -0,0 +1,102 @@
using System.ComponentModel;
using System.Configuration.Install;
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace AutoLoaderService_Base
{
[RunInstaller(true)]
public class ProjectInstaller : Installer
{
#region
public ProjectInstaller() : base()
{
// 此為元件設計工具所需的呼叫。
InitializeComponent();
// 在 InitializeComponent() 呼叫之後加入所有的初始設定
}
// Installer 覆寫 Dispose 以清除元件清單。
protected override void Dispose(bool disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose(disposing);
}
// 為元件設計工具的必要項
private IContainer components;
// 注意: 以下為元件設計工具所需的程序
// 您可以使用元件設計工具進行修改,
// 請勿使用程式碼編輯器進行修改。
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;
}
}
[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 AutoLoader Service (Production)";
_ServiceInstaller1.ServiceName = "MES AutoLoader Service (Production)";
//
// ProjectInstaller
//
Installers.AddRange(new Installer[] { _ServiceProcessInstaller1, _ServiceInstaller1 });
}
#endregion
}
}

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="ServiceProcessInstaller1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 56</value>
</metadata>
<metadata name="ServiceInstaller1.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\Framework\v4.0.30319\InstallUtil.exe "%~dp0AutoLoaderService_Base.exe" -u
Pause

View File

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

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://localhost/MESws_Industry_Base/wsInvoke.asmx?wsdl" filename="wsInvoke.wsdl" />
<DiscoveryClientResult referenceType="System.Web.Services.Discovery.DiscoveryDocumentReference" url="http://localhost/MESws_Industry_Base/wsInvoke.asmx?disco" filename="wsInvoke.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://localhost/MESws_Industry_Base/wsInvoke.asmx?wsdl" docRef="http://localhost/MESws_Industry_Base/wsInvoke.asmx" xmlns="http://schemas.xmlsoap.org/disco/scl/" />
<soap address="http://localhost/MESws_Industry_Base/wsInvoke.asmx" xmlns:q1="http://www.imestech.com/wsInvoke" binding="q1:wsInvokeSoap" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
<soap address="http://localhost/MESws_Industry_Base/wsInvoke.asmx" xmlns:q2="http://www.imestech.com/wsInvoke" binding="q2:wsInvokeSoap12" xmlns="http://schemas.xmlsoap.org/disco/soap/" />
</discovery>

View File

@ -0,0 +1,59 @@
<?xml version="1.0"?>
<configuration>
<appSettings>
<!-- 資料庫連結字串 -->
<add key="DatabaseType" value="mssql"/>
<add key="DatabaseOwner" value="sa"/>
<add key="ConnectionString" value="Provider=SQLOLEDB.1;Packet Size=4096;User ID=sa;Data Source=127.0.0.1;Persist Security Info=False;initial catalog=MESSeries_LED"/>
<add key="DatabasePassword" value="==wQ5hTP"/>
<!-- Report相關資料 -->
<add key="ReportDatabaseType" value="mssql"/>
<add key="ReportDatabaseOwner" value="sa"/>
<add key="ReportConnectionString" value="Provider=SQLOLEDB.1;Packet Size=4096;User ID=sa;Data Source=127.0.0.1;Persist Security Info=False;initial catalog=MESSeries_LED"/>
<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;" />
<!-- MES Webservice 網址 -->
<add key="MESWebServiceHost" value="MESAP/DigiHua_Production_MESws_STD"/>
<!-- 工作排程檔案路徑 -->
<add key="JobFilePath" value=""/>
<!-- Trace檔案路徑(True/False) -->
<add key="TraceFile" value="False"/>
<add key="TraceFilePath" value="Log"/>
<!-- Log檔案路徑(True/False) -->
<add key="LogFile" value="True"/>
<add key="LogFilePath" value="Log"/>
<!-- FTP相關資料 -->
<add key="HostName" value="ftp.xxx.xxx"/>
<add key="UserName" value="UserName"/>
<add key="Password" value="Password"/>
<!-- Binning相關資料 -->
<add key="BinningMaxValue" value="2"/>
<!--Transaction Log-->
<add key="TransactionLog" value="True"/>
<add key="OutputSQLPath" value="C:\Temp\Output\"/>
<add key="AttachFilePath" value="C:\Temp\AttachFiles\"/>
<add key="ErrorLogPath" value="C:\Temp\ErrorLog\"/>
<!-- 取回JOB LIST 到 JOB QUEUE的時間間隔(單位:分鐘) -->
<add key="MonitorjoblistDuration" value="3"/>
<!-- 到JOB QUEUE 檢查是否有要執行的job的時間間隔(單位:分鐘) -->
<add key="MonitorQueueDuration" value="1" />
<add key="EnableSSL" value="False"/>
</appSettings>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></configuration>

View File

@ -0,0 +1,457 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using iMESCore.Settings;
using static iMESCore.DataBase.iMESSql;
using static iMESCore.Base.iMESComXML;
namespace AutoLoaderService_Base
{
static class modAutoLoader
{
private static AppSettings objSetting = new AppSettings();
public const int defInteger = -999; // 宣告整數使用的常數用以辨識參數是否有傳入Function中。
public const string defString = "Null"; // 宣告字串使用的常數用以辨識參數是否有傳入Function中。
public static DateTime defDateTime = DateTime.Parse("1900-12-31"); // 宣告日期使用的常數用以辨識參數是否有傳入Function中。
static string GetConnectionString_ConnectionString()
{
var argstrDataBaseType = "Null";
return objSetting.GetConnectionString(strDataBaseType: argstrDataBaseType);
}
public static string ConnectionString = GetConnectionString_ConnectionString();
public static void funProcessJob(object State)
{
SomeStateType strJob = (SomeStateType)State;
string strJobExecutionFile = strJob.strJobExecutionFile; // 來源DLL
string strJobNo = strJob.strJobNo;
string strJobName = strJob.strCommandName;
string strSourcePath = strJob.strSourcePath; // 來源路徑
string strDestinationPath = strJob.strDestinationPath; // 目的路徑
string strQueuePath = strJob.strQueuePath; // Queue
string strFailPath = strJob.strFailPath; // Fail
string strLogFilePath = strJob.strLogFilePath;
long lngSplitFileSize = 10485760L;
long lbgSplitRecordsLimit = 5000L;
string strJobFunction = strJob.strJobFunction;
string strParameter1 = strJob.strParameter1; // 輸入參數1
string strParameter2 = strJob.strParameter2; // 輸入參數2
string strParameter3 = strJob.strParameter3; // 輸入參數3
string strParameter4 = strJob.strParameter4; // 輸入參數4
string strParameter5 = strJob.strParameter5; // 輸入參數5
string strParameter6 = strJob.strParameter6; // 輸入參數5
string strParameter7 = strJob.strParameter7; // 輸入參數5
string strParameter8 = strJob.strParameter8; // 輸入參數5
string strParameter9 = strJob.strParameter9; // 輸入參數5
string strParameter10 = strJob.strParameter10; // 輸入參數5
var StartTime = DateTime.Now;
string strStatus = "Fail"; // 回傳狀況先設定為Fail
string strReturnMsg = string.Empty;
string strMemo = "";
string errorCode = "0000-999999";
// 2019/12/10 yenru, 建立AutoLoader Base 可動態呼叫行業包AutoLoader特定DLL
// Dim objAutoRun As New AutoLoaderLib.clsAutoLoaderLibrary
try
{
var colParameters = new Collection();
colParameters.Add(strJobNo, "JobNo");
colParameters.Add(strSourcePath, "SourcePath");
colParameters.Add(strDestinationPath, "DestinationPath");
colParameters.Add(strQueuePath, "QueuePath");
colParameters.Add(strFailPath, "FailPath");
colParameters.Add(lngSplitFileSize, "SplitFileSize");
colParameters.Add(lbgSplitRecordsLimit, "SplitRecordsLimit");
colParameters.Add(strJobName, "JobName");
colParameters.Add(strJobFunction, "JobFunction");
colParameters.Add(strParameter1, "Parameter1");
colParameters.Add(strParameter2, "Parameter2");
colParameters.Add(strParameter3, "Parameter3");
colParameters.Add(strParameter4, "Parameter4");
colParameters.Add(strParameter5, "Parameter5");
colParameters.Add(strParameter6, "Parameter6");
colParameters.Add(strParameter7, "Parameter7");
colParameters.Add(strParameter8, "Parameter8");
colParameters.Add(strParameter9, "Parameter9");
colParameters.Add(strParameter10, "Parameter10");
// strReturnMsg = objAutoRun.ExecuteFunction(strJobName, colParameters)
string strBasePath = AppDomain.CurrentDomain.BaseDirectory;
string strFilePath = strBasePath + "/" + strJobExecutionFile + ".dll";
// Dll CreateInstance
var mainAssembly = System.Reflection.Assembly.LoadFrom(strFilePath);
var objBRClass = new object();
object objArgs = new object[] { strJobName, colParameters };
objBRClass = mainAssembly.CreateInstance(strJobExecutionFile + ".clsAutoLoaderLibrary");
strReturnMsg = objBRClass.GetType().InvokeMember("ExecuteFunction", System.Reflection.BindingFlags.InvokeMethod, null, objBRClass, (object[])objArgs).ToString();
}
catch (Exception ex)
{
// // Error Message
strReturnMsg = ex.Message;
strMemo = "funProcessJob Error : " + ex.Message;
}
finally
{
// //Return Fail
if (strReturnMsg != "success")
{
modWIN.WriteLog("JobNo:"+ strJobNo + "fail"+ strMemo, iMESLog.iMESLogLevel.Trace);
// 取得ErrorCode
if (strReturnMsg.Substring(0, 10) == "ErrorCode:")
{
strReturnMsg = strReturnMsg.Remove(0, 10); // 移除"ErrorCode:"
string[] temp = Strings.Split(strReturnMsg, ";");
if (temp[0].Length == 11)
{
errorCode = temp[0];
}
}
// Job完成後的後續動作:
// 刪除已經執行完畢之工作 (最先做, 減少執行完畢而未刪的情形)
// 註記最後執行時間
// 增加log
string computerNameTmp = System.Windows.Forms.SystemInformation.ComputerName;
funEndProcessJob(strJobNo, strStatus, CInput(ref strReturnMsg),
CInput(ref computerNameTmp), StartTime, DateTime.Now,
Convert.ToInt32(DateAndTime.DateDiff(DateInterval.Second, StartTime, DateTime.Now)),
strMemo, errorCode, "AutoLoader");
// //發生錯誤將Log記錄下來
// Call objAutoRun.AddErrorLog("MESAutoLoader", "AutoLoader", "JobNo(JobName)", strJobNo & "(" & strJobName & ")", , strReturnMsg, My.Computer.Name)
// //將Error Log存入檔案
// WriteLogFile(strLogFilePath, "[" + Strings.Format(DateTime.Now, "yyyy/MM/dd HH:mm:ss") + "]" + strReturnMsg + Constants.vbCrLf);
}
}
}
/// <summary>
/// 執行Job完成後的後續動作
/// </summary>
private static int funEndProcessJob(string JobNo, string Status = defString, string ReturnMsg = defString, string ServerName = defString, DateTime StartTime = default(DateTime), DateTime EndTime = default(DateTime), int RunTime = defInteger, string Memo = defString, string ErrorCode = "0000-999999", string LogClass = defString)
{
int funEndProcessJobRet = default(int);
// 刪除已經執行完畢之工作 (最先做, 減少執行完畢而未刪的情形)
// 註記最後執行時間
// 增加log
funEndProcessJobRet = -1;
// //Web Service相關變數
var XmlDoc = new System.Xml.XmlDocument();
string InXml, OutXml, strIdentity, strParameter;
try
{
// 將傳入參數組成XML字串
// 定義Identity
string argSendTime = Conversions.ToString(DateTime.Now);
strIdentity = modWIN.CombineXMLIdentity(ref modWIN.gComputerName, ref modWIN.gUserNo, ref argSendTime);
// 定義Parameter
strParameter = string.Empty;
string argvalue_name = "jobno";
string argname = "JobNo";
string argtype = "String";
string argdesc = "";
strParameter = modWIN.CombineXMLParameter(ref argvalue_name, ref argname, ref argtype, ref JobNo, ref argdesc);
if ((Status ?? "") != defString)
{
string argvalue_name1 = "status";
string argname1 = "Status";
string argtype1 = "String";
string argdesc1 = "";
strParameter += modWIN.CombineXMLParameter(ref argvalue_name1, ref argname1, ref argtype1, ref Status, ref argdesc1);
}
if ((ReturnMsg ?? "") != defString)
{
string argvalue_name2 = "returnmsg";
string argname2 = "ReturnMsg";
string argtype2 = "String";
string argdesc2 = "";
strParameter += modWIN.CombineXMLParameter(ref argvalue_name2, ref argname2, ref argtype2, ref ReturnMsg, ref argdesc2);
}
if ((ServerName ?? "") != defString)
{
string argvalue_name3 = "servername";
string argname3 = "ServerName";
string argtype3 = "String";
string argdesc3 = "";
strParameter += modWIN.CombineXMLParameter(ref argvalue_name3, ref argname3, ref argtype3, ref ServerName, ref argdesc3);
}
if (StartTime != defDateTime)
{
string argvalue_name4 = "starttime";
string argname4 = "StartTime";
string argtype4 = "DateTime";
string argvalue = Strings.Format(StartTime, "yyyy/MM/dd HH:mm:ss");
string argdesc4 = "";
strParameter += modWIN.CombineXMLParameter(ref argvalue_name4, ref argname4, ref argtype4, ref argvalue, ref argdesc4);
} // 2016-11-09, Joe, Format日期格式
if (EndTime != defDateTime)
{
string argvalue_name5 = "endtime";
string argname5 = "EndTime";
string argtype5 = "DateTime";
string argvalue1 = Strings.Format(EndTime, "yyyy/MM/dd HH:mm:ss");
string argdesc5 = "";
strParameter += modWIN.CombineXMLParameter(ref argvalue_name5, ref argname5, ref argtype5, ref argvalue1, ref argdesc5);
} // 2016-11-09, Joe, Format日期格式
if (RunTime != defInteger)
{
string argvalue_name6 = "runtime";
string argname6 = "RunTime";
string argtype6 = "Integer";
string argvalue2 = RunTime.ToString();
string argdesc6 = "";
strParameter += modWIN.CombineXMLParameter(ref argvalue_name6, ref argname6, ref argtype6, ref argvalue2, ref argdesc6);
RunTime = Conversions.ToInteger(argvalue2);
}
if ((Memo ?? "") != defString)
{
string argvalue_name7 = "memo";
string argname7 = "Memo";
string argtype7 = "String";
string argdesc7 = "";
strParameter += modWIN.CombineXMLParameter(ref argvalue_name7, ref argname7, ref argtype7, ref Memo, ref argdesc7);
}
if ((LogClass ?? "") != defString)
{
string argvalue_name8 = "logclass";
string argname8 = "LogClass";
string argtype8 = "String";
string argdesc8 = "";
strParameter += modWIN.CombineXMLParameter(ref argvalue_name8, ref argname8, ref argtype8, ref LogClass, ref argdesc8);
}
string argvalue_name9 = "errorcode";
string argname9 = "ErrorCode";
string argtype9 = "String";
string argdesc9 = "";
strParameter += modWIN.CombineXMLParameter(ref argvalue_name9, ref argname9, ref argtype9, ref ErrorCode, ref argdesc9);
// request XML字串
InXml = modWIN.CombineXMLRequest(ref strIdentity, ref strParameter);
OutXml = InvokeSrv("wsAUT.funEndProcessJob_ErrorCode", InXml);
XmlDoc.LoadXml(OutXml);
if (!modWIN.chkExecutionSuccess(ref XmlDoc))
{
throw new Exception(modWIN.GetExceptionSysMsg(ref XmlDoc) + '\r' + modWIN.GetExceptionMesMsg(ref XmlDoc));
}
funEndProcessJobRet = 0;
}
catch (Exception e1)
{
// funWriteTxtFile("funEndProcessJob (JobNo : " & JobNo & ") Error : " & e1.Message)
// funWriteToAnEventLog("funEndProcessJob (JobNo : " & JobNo & ") Error : " & e1.Message, EventLogEntryType.Error, 9000)
}
return funEndProcessJobRet;
}
/// <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 AutoLoaderLib_Base.wsInvoke.wsInvoke())
{
ws.Url = modWIN.LocalizeWebService(ws.Url.ToString());
ws.EnableDecompression = true;
result = ws.invokeSrv(Method, new object[] { InXml });
}
}
catch (Exception ex)
{
throw;
}
return Conversions.ToString(result);
}
public static void funInitProcess(object State)
{
string strReturnMsg = string.Empty;
// Dim objAutoRun As New AutoLoaderLib.clsAutoLoaderLibrary
try
{
// //
var colParameters = new Collection();
colParameters.Add(Environment.MachineName, "ComputerName");
}
// //Init Binning
// strReturnMsg = objAutoRun.ExecuteFunction("funInitBinning", colParameters)
catch (Exception ex)
{
// // Error Message
strReturnMsg = ex.Message;
}
finally
{
// // Release Object
// objAutoRun = Nothing
}
}
public class SomeStateType
{
public string strJobExecutionFile;
public string strJobNo;
public string strCommandName;
public string strSourcePath;
public string strDestinationPath;
public string strQueuePath;
public string strFailPath;
public string strLogFilePath;
public long SplitFileSize;
public long SplitRecordsLimit;
public string strJobName;
public string strJobFunction;
public string strParameter1;
public string strParameter2;
public string strParameter3;
public string strParameter4;
public string strParameter5;
public string strParameter6;
public string strParameter7;
public string strParameter8;
public string strParameter9;
public string strParameter10;
public void SomeState(string strJE, string strJN, string strCN, string strSP, string strDP, string strQP, string strFP, string strLF, long lngSplitFileSize, long lngSplitRecordsLimit, string str_JobName, string strJob_Function, string strPara1, string strPara2, string strPara3, string strPara4, string strPara5, string strPara6, string strPara7, string strPara8, string strPara9, string strPara10)
{
strJobExecutionFile = strJE;
strJobNo = strJN;
strCommandName = strCN;
strSourcePath = strSP;
strDestinationPath = strDP;
strQueuePath = strQP;
strFailPath = strFP;
strLogFilePath = strLF;
SplitFileSize = lngSplitFileSize;
SplitRecordsLimit = lngSplitRecordsLimit;
strJobName = str_JobName;
strJobFunction = strJob_Function;
strParameter1 = strPara1;
strParameter2 = strPara2;
strParameter3 = strPara3;
strParameter4 = strPara4;
strParameter5 = strPara5;
strParameter6 = strPara6;
strParameter7 = strPara7;
strParameter8 = strPara8;
strParameter9 = strPara9;
strParameter10 = strPara10;
}
}
public static bool PrevInstance()
{
if (Information.UBound(Process.GetProcessesByName(Process.GetCurrentProcess().ProcessName)) > 0)
{
return true;
}
else
{
return false;
}
}
public static string CInput(ref string strInput)
{
string CInputRet = default(string);
// 將傳入值內的單引號轉換為可存入資料庫的格式
// 2. 將傳入值內的 &, >, < 三個特殊字元轉換為XmlDocument可解譯之代替符號
// 傳入值: strInput包含特殊字元的字串
// 傳回值: 將特殊字元變更為代替符號的字串
// 轉換 ' 為 '' (單引號轉為兩個單引號)
CInputRet = Strings.Replace(strInput, "'", "''");
// 轉換 & 為 &amp;
CInputRet = Strings.Replace(CInputRet, "&", "&amp;");
// CInput = Replace(CInput, """", "''") 'AddFlow的Xml字串不可將雙引號轉為兩個單引號,XMLToFlow會Error
// 轉換 > 為 &gt;
CInputRet = Strings.Replace(CInputRet, ">", "&gt;");
// 轉換 < 為 &lt;
CInputRet = Strings.Replace(CInputRet, "<", "&lt;");
return CInputRet;
}
public static void WriteLogFile(string dir, string WriteTxt)
{
try
{
string path = Path.Combine(dir, Strings.Format(DateTime.Now, "yyyyMMdd").ToString() + ".log");
if (!string.IsNullOrEmpty(dir) && !Directory.Exists(dir))
Directory.CreateDirectory(dir);
using (StreamWriter sw = new StreamWriter(path, true))
{
sw.WriteLine(WriteTxt);
}
}
catch (Exception ex2)
{
}
}
}
}

View File

@ -0,0 +1,473 @@
using System;
using System.Collections;
using static System.Configuration.ConfigurationSettings;
using System.Data;
using System.Runtime.InteropServices;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using System.Diagnostics;
namespace AutoLoaderService_Base
{
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 = Environment.MachineName;
public static string gReturnKeyValue;
public static string gUserNo = "AutoLoader";
public static string gUserName;
public static string gUserLevel;
public static string gLanguageMode;
public static string gAppPath;
// **Add for Smart Client Architecture
public static string gMESWebServiceHost;
public static string gCUSWebServiceHost;
public static bool gEnableSSL = Convert.ToBoolean(GetAppSettings("EnableSSL"));
// Add By Peter 2005/6/20
public static string gSettingMode = "";
public static DataRow drSearch;
public static ArrayList gReturnArray = new ArrayList();
public const int defInteger = -999; // 宣告整數使用的常數用以辨識參數是否有傳入Function中。
public const string defString = "Null"; // 宣告字串使用的常數用以辨識參數是否有傳入Function中。
public static DateTime defDateTime = DateTime.Parse("1900-12-31"); // 宣告日期使用的常數用以辨識參數是否有傳入Function中。
public const string strAddTagLabel = "extrabase"; // Add by py for Combine Addition XML doc
public const string strAddTagName = "ExtraBase"; // Add by py for Combine Addition XML doc
public static bool chkExecutionSuccess(ref System.Xml.XmlDocument Xmldoc)
{
bool chkExecutionSuccessRet = default(bool);
if (Xmldoc.DocumentElement["result"].InnerXml == "success")
{
chkExecutionSuccessRet = true;
}
else
{
chkExecutionSuccessRet = false;
}
return chkExecutionSuccessRet;
}
public static string GetExceptionSysMsg(ref System.Xml.XmlDocument Xmldoc)
{
string GetExceptionSysMsgRet = default(string);
string argstrInput = Xmldoc.DocumentElement.GetElementsByTagName("sysmsg").Item(0).InnerXml;
GetExceptionSysMsgRet = CUnInput(ref argstrInput);
Xmldoc.DocumentElement.GetElementsByTagName("sysmsg").Item(0).InnerXml = argstrInput;
return GetExceptionSysMsgRet;
}
public static string GetExceptionMesMsg(ref System.Xml.XmlDocument Xmldoc)
{
string GetExceptionMesMsgRet = default(string);
string argstrInput = Xmldoc.DocumentElement.GetElementsByTagName("mesmsg").Item(0).InnerXml;
GetExceptionMesMsgRet = CUnInput(ref argstrInput);
Xmldoc.DocumentElement.GetElementsByTagName("mesmsg").Item(0).InnerXml = argstrInput;
return GetExceptionMesMsgRet;
}
public static string CombineXMLIdentity(ref string ComputerName, ref string CurUserNo, ref string SendTime)
{
string CombineXMLIdentityRet = default(string);
CombineXMLIdentityRet = "<computername>" + ComputerName + "</computername>" + "<curuserno>" + CurUserNo + "</curuserno>" + "<sendtime>" + SendTime + "</sendtime>";
return CombineXMLIdentityRet;
}
public static string CombineXMLParameter(ref string value_name, ref string name, ref string type, ref string value, ref string desc)
{
string CombineXMLParameterRet = default(string);
CombineXMLParameterRet = "<" + value_name.ToLower() + ">" + "<name>" + name + "</name>" + "<type>" + type + "</type>" + "<value>" + value + "</value>" + "<desc>" + desc + "</desc>" + "</" + value_name.ToLower() + ">";
return CombineXMLParameterRet;
}
public static string CombineXMLRequest(ref string strIdentity, ref string strParameter)
{
string CombineXMLRequestRet = default(string);
CombineXMLRequestRet = "<request>" + "<identity>" + strIdentity + "</identity>";
if (!string.IsNullOrEmpty(strParameter))
{
CombineXMLRequestRet = CombineXMLRequestRet + "<parameter>" + strParameter + "</parameter>";
}
CombineXMLRequestRet = CombineXMLRequestRet + "</request>";
return CombineXMLRequestRet;
}
public static string CombineXMLValue(ref string TagName, ref string Value)
{
string CombineXMLValueRet = default(string);
CombineXMLValueRet = "<" + TagName + ">" + Value + "</" + TagName + ">";
return CombineXMLValueRet;
}
public static string CombineXMLValueTag(ref string Value)
{
string CombineXMLValueTagRet = default(string);
CombineXMLValueTagRet = "<value>" + Value + "</value>";
return CombineXMLValueTagRet;
}
public static string CombineXMLParameterMultiValue(ref string value_name, ref string name, ref string type, ref string value, ref string desc)
{
string CombineXMLParameterMultiValueRet = default(string);
// Value不用加上Tag
CombineXMLParameterMultiValueRet = "<" + value_name.ToLower() + ">" + "<name>" + name + "</name>" + "<type>" + type + "</type>" + value + "<desc>" + desc + "</desc>" + "</" + value_name.ToLower() + ">";
return CombineXMLParameterMultiValueRet;
}
public static int FindRecordPosition(ref DataView dvData, ref string strColumnName, ref string strFindValue)
{
int FindRecordPositionRet = default(int);
// //由Dataview的第一筆開始尋找符合的資料直到最後一筆
// //傳出資料在資料表內的Index
int i;
bool Found; // //紀錄是否找到符合資料
string strDataType; // //尋找資料欄的資料型態
try
{
if (!string.IsNullOrEmpty(strFindValue)) // 是否有傳入尋找的條件
{
Found = false;
strDataType = dvData.Table.Columns[strColumnName].DataType.ToString();
if (strDataType == "System.DateTime") // 日期型態的資料比對
{
var loopTo = dvData.Count;
for (i = 0; i <= loopTo; i++)
{
if (Conversions.ToBoolean(Operators.ConditionalCompareObjectGreaterEqual(dvData[i][strColumnName], "#" + Strings.Format(Conversions.ToDate(strFindValue), "yyyy/MM/dd") + "#", false)))
{
Found = true;
break;
}
}
}
else // 字串,數值資料型態的比對
{
var loopTo1 = dvData.Count;
for (i = 0; i <= loopTo1; i++)
{
if ((Strings.UCase(dvData[i][strColumnName].ToString()) ?? "") == (Strings.UCase(strFindValue) ?? ""))
{
Found = true;
break;
}
}
}
if (Found == true)
{
FindRecordPositionRet = i; // 找到符合資料傳出所在的RowIndex
}
else
{
FindRecordPositionRet = -1;
} // 沒有符合資料
}
}
catch
{
FindRecordPositionRet = -1;
} // 沒有符合資料
return FindRecordPositionRet;
// //使用Dataview的Find Method,日期無法使用
// dvData.Sort = strColumnName
// FindRecordPosition = dvData.Find(strFindValue)
}
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;
}
public static string FilterByString(ref string strFilter, ref string strColumnName, ref string strColumnValue)
{
string FilterByStringRet = default(string);
// 對字串欄位做篩選
if (string.IsNullOrEmpty(strFilter))
{
strFilter = strColumnName + " = '" + Strings.Replace(strColumnValue, "'", "''") + "'";
}
else
{
strFilter = strFilter + " And " + strColumnName + " = '" + Strings.Replace(strColumnValue, "'", "''") + "'";
}
FilterByStringRet = strFilter;
return FilterByStringRet;
}
public static string FilterByInteger(ref string strFilter, ref string strColumnName, ref int strColumnValue)
{
string FilterByIntegerRet = default(string);
// 對數值欄位做篩選
if (string.IsNullOrEmpty(strFilter))
{
strFilter = strColumnName + " = " + strColumnValue;
}
else
{
strFilter = strFilter + " And " + strColumnName + " = " + strColumnValue;
}
FilterByIntegerRet = strFilter;
return FilterByIntegerRet;
}
public static string FilterByDate(ref string strFilter, ref string strColumnName, ref DateTime datFromDate, ref DateTime datEndDate)
{
string FilterByDateRet = default(string);
// 對日期欄位做篩選
if (string.IsNullOrEmpty(strFilter))
{
strFilter = strColumnName + " >= #" + Strings.Format(Conversions.ToDate(datFromDate), "yyyy/MM/dd 00:00:00") + "# And " + strColumnName + " <= #" + Strings.Format(Conversions.ToDate(datEndDate), "yyyy/MM/dd 23:59:59") + "# ";
}
else
{
strFilter = strFilter + " And " + strColumnName + " >= #" + Strings.Format(Conversions.ToDate(datFromDate), "yyyy/MM/dd 00:00:00") + "# And " + strColumnName + " <= #" + Strings.Format(Conversions.ToDate(datEndDate), "yyyy/MM/dd 23:59:59") + "# ";
}
FilterByDateRet = strFilter;
return FilterByDateRet;
}
public static bool IsBoolean(ref string strBoolean, string strBooleanValue = defString)
{
bool IsBooleanRet = default(bool);
// 此 Function 檢查傳入值是否為Boolean值
// 傳入值: strBoolean欲檢查是否為Boolean值的字串
// strBooleanValue將檢查值轉換為True或False的統一字串
// 傳回值: True是Boolean值 ; False不是Boolean值
IsBooleanRet = false;
if (string.IsNullOrEmpty(strBoolean))
{
IsBooleanRet = false;
}
else if (Strings.Trim(Strings.UCase(strBoolean)) != "Y" & Strings.Trim(Strings.UCase(strBoolean)) != "N" & Strings.Trim(Strings.UCase(strBoolean)) != "T" & Strings.Trim(Strings.UCase(strBoolean)) != "F" & Strings.Trim(Strings.UCase(strBoolean)) != "YES" & Strings.Trim(Strings.UCase(strBoolean)) != "NO" & Strings.Trim(Strings.UCase(strBoolean)) != "TRUE" & Strings.Trim(Strings.UCase(strBoolean)) != "FALSE" & Strings.Trim(Strings.UCase(strBoolean)) != "是" & Strings.Trim(Strings.UCase(strBoolean)) != "否" & Strings.Trim(Strings.UCase(strBoolean)) != "ON" & Strings.Trim(Strings.UCase(strBoolean)) != "OFF")
{
IsBooleanRet = false;
}
else if (Strings.Trim(Strings.UCase(strBoolean)) == "Y" | Strings.Trim(Strings.UCase(strBoolean)) == "T" | Strings.Trim(Strings.UCase(strBoolean)) == "YES" | Strings.Trim(Strings.UCase(strBoolean)) == "TRUE" | Strings.Trim(Strings.UCase(strBoolean)) == "是" | Strings.Trim(Strings.UCase(strBoolean)) == "ON")
{
IsBooleanRet = true;
strBooleanValue = "True";
}
else
{
IsBooleanRet = true;
strBooleanValue = "False";
}
return IsBooleanRet;
}
public static string CInput(ref string strInput)
{
string CInputRet = default(string);
// 將傳入值內的單引號轉換為可存入資料庫的格式
// 2. 將傳入值內的 &, >, < 三個特殊字元轉換為XmlDocument可解譯之代替符號
// 傳入值: strInput包含特殊字元的字串
// 傳回值: 將特殊字元變更為代替符號的字串
// 轉換 ' 為 '' (單引號轉為兩個單引號)
CInputRet = Strings.Replace(strInput, "'", "''");
// 轉換 & 為 &amp;
CInputRet = Strings.Replace(CInputRet, "&", "&amp;");
// CInput = Replace(CInput, """", "''") 'AddFlow的Xml字串不可將雙引號轉為兩個單引號,XMLToFlow會Error
// 轉換 > 為 &gt;
CInputRet = Strings.Replace(CInputRet, ">", "&gt;");
// 轉換 < 為 &lt;
CInputRet = Strings.Replace(CInputRet, "<", "&lt;");
return CInputRet;
}
public static string CUnInput(ref string strInput)
{
string CUnInputRet = default(string);
// 將傳入值內的單引號轉換為可存入資料庫的格式
// 傳入值: strInput包含特殊字元的字串
// 傳回值: 將代替符號變更為特殊字元的字串
// 轉換 ' 為 '' (單引號轉為兩個單引號)
// CUnInput = Replace(strInput, "'", "''")
CUnInputRet = Strings.Replace(strInput, "\"", "'");
// 轉換 & 為 &amp;
CUnInputRet = Strings.Replace(CUnInputRet, "&amp;", "&");
// 轉換 > 為 &gt;
CUnInputRet = Strings.Replace(CUnInputRet, "&gt;", ">");
// 轉換 < 為 &lt;
CUnInputRet = Strings.Replace(CUnInputRet, "&lt;", "<");
return CUnInputRet;
}
// ***Add by PY 2003/07/31****
public static string CombineXMLAdditional(ref string strAdditional)
{
string CombineXMLAdditionalRet = default(string);
CombineXMLAdditionalRet = "<additional>" + strAdditional;
CombineXMLAdditionalRet = CombineXMLAdditionalRet + "</additional>";
return CombineXMLAdditionalRet;
}
public static string CombineAddXML_Add(ref string name, ref string type, ref string value)
{
string CombineAddXML_AddRet = default(string);
CombineAddXML_AddRet = "<field>" + "<name>" + name + "</name>" + "<type>" + type + "</type>" + "<value>" + value + "</value>" + "</field>";
return CombineAddXML_AddRet;
}
public static string CombineAddXML_Edit(ref string name, ref string type, ref string value)
{
string CombineAddXML_EditRet = default(string);
CombineAddXML_EditRet = "<field>" + "<name>" + name + "</name>" + "<type>" + type + "</type>" + "<value>" + value + "</value>" + "</field>";
return CombineAddXML_EditRet;
}
public static string CombineAddXML_Field(ref string name)
{
string CombineAddXML_FieldRet = default(string);
CombineAddXML_FieldRet = "<field>" + "<name>" + name + "</name>" + "</field>";
return CombineAddXML_FieldRet;
}
public static string CombineAddXML_Condition(string condition)
{
string CombineAddXML_ConditionRet = default(string);
CombineAddXML_ConditionRet = "<condition>" + Strings.Replace(condition, "''", "'") + "</condition>";
return CombineAddXML_ConditionRet;
}
// **Add by py 2003/12/04
public static string LocalizeWebService(string wsUrl)
{
string strAppBase = AppDomain.CurrentDomain.BaseDirectory;
string[] tmpString;
int i;
tmpString = wsUrl.Split('/');
// Modify By Peter 2005/06/21 << automatic change ws url for all cases
// If Mid(strAppBase, 1, 4) = "http" And Trim(gMESWebServiceHost) <> "" Then
if (!string.IsNullOrEmpty(Strings.Trim(gMESWebServiceHost)))
{
// Return wsUrl.Replace("//localhost/", "//" + gMESWebServiceHost + "/")
if (tmpString.Length > 2)
{
wsUrl = "http://" + gMESWebServiceHost + "/" + tmpString[tmpString.Length - 2].ToString() + "/" + 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
// 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]);
}
}
}
catch (Exception ex)
{
throw ex;
}
return result;
}
//
public static void WriteLog(string msg, iMESLog.iMESLogLevel level, Exception e = null)
{
string MethodInfo = "";
var ss = new StackTrace(true);
var mb = ss.GetFrame(1).GetMethod();
MethodInfo = mb.DeclaringType.Namespace + "." + mb.DeclaringType.Name + "." + mb.Name;
var log = new iMESLog.MESLog(mb.DeclaringType.Namespace);
log.WriteLog(msg, level, e, MethodInfo);
}
}
}

View File

@ -0,0 +1,45 @@
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}") = "AutoLoaderLib_Base", "AutoLoaderLib\AutoLoaderLib_Base.csproj", "{7C0468A8-E807-0FF4-0C04-C1AD9B3D7D2A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoLoaderService_Base", "AutoLoaderService_Base\AutoLoaderService_Base.csproj", "{76CCB2C1-5347-075C-192E-C939BAFBC971}"
ProjectSection(ProjectDependencies) = postProject
{7C0468A8-E807-0FF4-0C04-C1AD9B3D7D2A} = {7C0468A8-E807-0FF4-0C04-C1AD9B3D7D2A}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7C0468A8-E807-0FF4-0C04-C1AD9B3D7D2A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C0468A8-E807-0FF4-0C04-C1AD9B3D7D2A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C0468A8-E807-0FF4-0C04-C1AD9B3D7D2A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C0468A8-E807-0FF4-0C04-C1AD9B3D7D2A}.Release|Any CPU.Build.0 = Release|Any CPU
{76CCB2C1-5347-075C-192E-C939BAFBC971}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{76CCB2C1-5347-075C-192E-C939BAFBC971}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76CCB2C1-5347-075C-192E-C939BAFBC971}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76CCB2C1-5347-075C-192E-C939BAFBC971}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {069D87BD-CB47-4955-9AB8-F58989DE86CC}
EndGlobalSection
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 3
SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
SccTeamFoundationServer = http://tfs.imestech.com:8080/tfs/messeries6
SccLocalPath0 = .
SccProjectUniqueName1 = AutoLoaderLib\\AutoLoaderLib_Base.csproj
SccProjectName1 = AutoLoaderLib
SccLocalPath1 = AutoLoaderLib
SccProjectUniqueName2 = AutoLoaderService_Base\\AutoLoaderService_Base.csproj
SccProjectName2 = AutoLoaderService_Base
SccLocalPath2 = AutoLoaderService_Base
EndGlobalSection
EndGlobal