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