This repo is archived. You can view files and clone it, but cannot push or open issues or pull requests.
SXS20240115/SRC/MESEAI/EAItc/clsEAP.cs
2024-01-15 10:57:41 +08:00

99 lines
4.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 = "<lotinfo>";
string strLotNoColumnName = "";
if (dtLotInfo.Columns.Contains("Lot_ID"))
{
strLotNoColumnName = "Lot_ID";
}
else if (dtLotInfo.Columns.Contains("LotNo"))
{
strLotNoColumnName = "LotNo";
}
string strrulecheckTag = "";
if (!blnRuleChk)
{
strrulecheckTag = "<chkrule>false</chkrule>";
}
foreach (DataRow drTemp in dtLotInfo.Rows)
strLotXML = Conversions.ToString(strLotXML + Operators.ConcatenateObject(Operators.ConcatenateObject("<value><lotno>", drTemp[strLotNoColumnName]), "</lotno></value>"));
strLotXML += "</lotinfo>";
CombineXMLRequest_AutoExecutionLotRet = "" + "<request><identity> " + "<transactionid>" + Strings.Format(DateTime.Now, "yyyyMMddHHmmssfff") + "</transactionid>" + "<functionid>" + functionid + "</functionid>" + strLotXML + "<computername>" + computername + "</computername>" + "<opno>" + OPNo + "</opno>" + "<curuserno>" + CurUserNo + "</curuserno>" + "<sendtime>" + SendTime + "</sendtime>" + strrulecheckTag + "</identity>" + "<datainfo>" + InXml + "</datainfo>" + "</request>";
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
}
}