using System;
using System.Data;
using Microsoft.VisualBasic;
using Microsoft.VisualBasic.CompilerServices;
using static iMESCore.Base.iMESConst;
using static iMESCore.Base.iMESComXML;
using static iMESCore.Base.iMESComSubroutine;
namespace tcEAI_C
{
public class clsEAP
{
public static string strDataBaseType;
public static string strConnectionString;
#region EAP 客制接口
#endregion
#region 共用功能 ConbineXMLFunction
public static string CombineXMLRequest_AutoExecutionLot(string InXml, string functionid, string computername, DataTable dtLotInfo, string OPNo, string CurUserNo, string SendTime, bool blnRuleChk = true)
{
string CombineXMLRequest_AutoExecutionLotRet = default(string);
string strLotXML = "";
string strLotNoColumnName = "";
if (dtLotInfo.Columns.Contains("Lot_ID"))
{
strLotNoColumnName = "Lot_ID";
}
else if (dtLotInfo.Columns.Contains("LotNo"))
{
strLotNoColumnName = "LotNo";
}
string strrulecheckTag = "";
if (!blnRuleChk)
{
strrulecheckTag = "false";
}
foreach (DataRow drTemp in dtLotInfo.Rows)
strLotXML = Conversions.ToString(strLotXML + Operators.ConcatenateObject(Operators.ConcatenateObject("", drTemp[strLotNoColumnName]), ""));
strLotXML += "";
CombineXMLRequest_AutoExecutionLotRet = "" + " " + "" + Strings.Format(DateTime.Now, "yyyyMMddHHmmssfff") + "" + "" + functionid + "" + strLotXML + "" + computername + "" + "" + OPNo + "" + "" + CurUserNo + "" + "" + SendTime + "" + strrulecheckTag + "" + "" + InXml + "" + "";
return CombineXMLRequest_AutoExecutionLotRet;
}
#endregion
#region ReverseTriggerOP
public static bool ExeReverseTriggerOP_NotUseUndo(string pUserNo, string pLotNo, string pLotSerial = defString, int pLotStamp = defInteger, string ComputreName = "EAI")
{
string InXml, OutXml, strIdentity, strParameter;
bool blnExecResult = false;
// 2020/3/17 Ning, Mantis: 0068960, WIP_Kit 增加ExeReverseTriggerOP_NotUseUndo共用函式
try
{
// 檢查此 BR 是否此站第一次執行,若是第一次執行則以刪除Temp, Cont, LotLog...的方式取消Trigger OP的動作
strIdentity = CombineXMLIdentity(ComputreName, pUserNo, DateTime.Now.ToString(defDateTimeFormat));
strParameter = CombineXMLParameter("lotno", "LotNo", "String", CInput(pLotNo), "");
// 因FormLoad不見得會成功取得Lot的資料,有可能失敗,故使用變數來決定是否傳出參數.
if ((pLotSerial ?? "") != defString)
{
strParameter += CombineXMLParameter("lotserial", "LotSerial", "String", CInput(pLotSerial), "");
}
if (pLotStamp != defInteger)
{
strParameter += CombineXMLParameter("lotstamp", "LotStamp", "Long", pLotStamp.ToString(), "");
}
InXml = CombineXMLRequest(strIdentity, strParameter);
// OutXml = InvokeSrv("wsWIP.ReverseTriggerOP_NotUseUndo", InXml)
object[] aryPars = clsCom.funGetMethodParameters("wsSTD", "wsWIP", "ReverseTriggerOP_NotUseUndo");
aryPars[0] = InXml;
OutXml = clsCom.funExecuteMethod("wsSTD", "wsWIP", "ReverseTriggerOP_NotUseUndo", ref aryPars) as string;
blnExecResult = true;
}
catch (Exception ex)
{
}
return blnExecResult;
}
#endregion
}
}