124 lines
4.8 KiB
C#
124 lines
4.8 KiB
C#
|
using System;
|
|||
|
using System.Data;
|
|||
|
using System.Data.Common;
|
|||
|
using static iMESCore.Base.iMESConst;
|
|||
|
using static iMESCore.DataBase.iMESSql;
|
|||
|
using iMESCore.Settings;
|
|||
|
using Microsoft.VisualBasic;
|
|||
|
using Microsoft.VisualBasic.CompilerServices;
|
|||
|
|
|||
|
namespace udUnitTransferFunction_Customer
|
|||
|
{
|
|||
|
public class clsUnitTransferFunction : IDisposable
|
|||
|
{
|
|||
|
|
|||
|
private AppSettings objSetting = new AppSettings();
|
|||
|
|
|||
|
private string strConnectionString; // Connection string
|
|||
|
private string strDataBaseType; // DataBase Type:oracle, mysql, access
|
|||
|
private string strMQType; // MessageQueue Type:TIBCO, MQSeries, MSMQ
|
|||
|
private string strSQLAddField;
|
|||
|
private string strSQLAddValue;
|
|||
|
private string strSQL;
|
|||
|
private int intGetMethod = 1; // 0.Simulation, 1.Production
|
|||
|
|
|||
|
#region IDisposable Support
|
|||
|
private bool disposedValue; // 偵測多餘的呼叫
|
|||
|
|
|||
|
// //Initial Object----------------------------------
|
|||
|
public clsUnitTransferFunction()
|
|||
|
{
|
|||
|
// //Get database type
|
|||
|
strDataBaseType = objSetting.GetDataBaseType();
|
|||
|
// //Get connection string
|
|||
|
strConnectionString = objSetting.GetConnectionString(strDataBaseType);
|
|||
|
// //Get Message Queue Type
|
|||
|
strMQType = objSetting.GetMQType();
|
|||
|
}
|
|||
|
|
|||
|
// IDisposable
|
|||
|
protected virtual void Dispose(bool disposing)
|
|||
|
{
|
|||
|
if (!disposedValue)
|
|||
|
{
|
|||
|
if (disposing)
|
|||
|
{
|
|||
|
// TODO: 處置 Managed 狀態 (Managed 物件)。
|
|||
|
}
|
|||
|
|
|||
|
// TODO: 釋放 Unmanaged 資源 (Unmanaged 物件) 並覆寫下方的 Finalize()。
|
|||
|
if (objSetting != null)
|
|||
|
objSetting = null;
|
|||
|
// TODO: 將大型欄位設為 null。
|
|||
|
}
|
|||
|
disposedValue = true;
|
|||
|
}
|
|||
|
|
|||
|
// TODO: 只有當上方的 Dispose(disposing As Boolean) 具有要釋放 Unmanaged 資源的程式碼時,才覆寫 Finalize()。
|
|||
|
~clsUnitTransferFunction()
|
|||
|
{
|
|||
|
// 請勿變更這個程式碼。請將清除程式碼放在上方的 Dispose(disposing As Boolean) 中。
|
|||
|
Dispose(false);
|
|||
|
}
|
|||
|
|
|||
|
// Visual Basic 加入這個程式碼的目的,在於能正確地實作可處置的模式。
|
|||
|
public void Dispose()
|
|||
|
{
|
|||
|
// 請勿變更這個程式碼。請將清除程式碼放在上方的 Dispose(disposing As Boolean) 中。
|
|||
|
Dispose(true);
|
|||
|
// TODO: 覆寫上列 Finalize() 時,取消下行的註解狀態。
|
|||
|
GC.SuppressFinalize(this);
|
|||
|
}
|
|||
|
#endregion
|
|||
|
|
|||
|
// 2018/07/10 OwenLiu, Mantis:0048659 單位轉換函式增加 個案客製支援機制
|
|||
|
// FunctionName 必須以 funUTC_ 作為名稱的前綴字串,才可以正常運作
|
|||
|
//private decimal funUTC_Sample(Collection colParameters)
|
|||
|
//{
|
|||
|
|
|||
|
// IDbConnection cnnTemp = null;
|
|||
|
// string ProductNo, ProductVersion, ENGNo, ENGVersion;
|
|||
|
// decimal decExecResult = defInteger;
|
|||
|
// try
|
|||
|
// {
|
|||
|
// if (intGetMethod == 0) // Simulation
|
|||
|
// {
|
|||
|
// decExecResult = 1m;
|
|||
|
// }
|
|||
|
// else // Production
|
|||
|
// {
|
|||
|
// // 1.取出參數
|
|||
|
// ProductNo = Conversions.ToString(colParameters["ProductNo"]);
|
|||
|
// ProductVersion = Conversions.ToString(colParameters["ProductVersion"]);
|
|||
|
// ENGNo = Conversions.ToString(colParameters["ENGNo"]);
|
|||
|
// ENGVersion = Conversions.ToString(colParameters["ENGVersion"]);
|
|||
|
|
|||
|
// // //Create connection
|
|||
|
// cnnTemp = CreateConnection_None(strConnectionString, strDataBaseType);
|
|||
|
|
|||
|
// strSQL = "SELECT DefaultValue FROM tblPRDProductProperty" + " WHERE ProductNo = '" + ProductNo.ToUpper() + "'" + " AND ProductVersion = '" + ProductVersion.ToUpper() + "'" + " AND Upper(PropertyNo) = '" + "GrossDie".ToUpper() + "'";
|
|||
|
// using (DbDataReader drProperty = ExecuteSQLQuery_Reader(strSQL, cnnTemp))
|
|||
|
// {
|
|||
|
// if (drProperty.Read())
|
|||
|
// {
|
|||
|
// decExecResult = Conversions.ToDecimal(drProperty["DefaultValue"]);
|
|||
|
// }
|
|||
|
// drProperty.Close();
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
|
|||
|
// catch (Exception ex)
|
|||
|
// {
|
|||
|
// throw;
|
|||
|
// }
|
|||
|
// finally
|
|||
|
// {
|
|||
|
// CloseConnection(cnnTemp);
|
|||
|
// }
|
|||
|
|
|||
|
// return decExecResult;
|
|||
|
|
|||
|
//}
|
|||
|
}
|
|||
|
}
|