封存舊的已比對交易並清除封存的交易

使用本節中的指令碼,封存等於或早於指定期限的已比對交易 (包括支援和調整詳細資料),然後從 Account Reconciliation 清除封存的交易。已封存的已比對交易會記錄至 ZIP 檔案中。

指令碼的運作方式

  1. 使用 input.properties 檔案中的資訊登入環境
  2. 執行下列 archiveTmTransactions 命令以建立封存。產生的 ZIP 檔案和日誌檔使用預設名稱 Archive_Transactions_INTERCO_JOB_ID.zipArchive_Transactions_INTERCO_JOB_ID.log

    epmautomate archiveTmTransactions INTERCO 365 filterOperator=contains filterValue=14001

    您可以透過修改 input.properties 檔案以變更命令參數。
  3. 將日誌檔和包含封存交易的 .ZIP 檔案下載至本機電腦。如果找不到匹配的交易,則該指令碼會顯示錯誤訊息。
  4. 將包含封存交易的 .ZIP 檔案複製到 Oracle 物件存放區。
  5. 執行 purgeArchivedTmTransactions 命令 (使用 archiveTmTransactions 工作的工作 ID) 以從應用程式刪除封存的已比對交易。

執行指令碼

  1. 建立 input.properties 檔案,並使用環境資訊對其進行更新。將檔案儲存在本機目錄中。此目錄在此討論中稱為 parentsnapshotdirectory。此檔案的內容因作業系統而異。

    確保您在此目錄中具有寫入權限。至於 Windows,您可能需要使用以管理員身分執行選項來啟動 PowerShell,才能執行指令碼。

  2. 建立transaction_match.ps1 (Windows PowerShell) 或transaction_match.sh (Linux/UNIX) 指令碼並將它儲存至 input.properties 所在的 parentsnapshotdirectory
  3. 啟動指令碼。
    • Linux/UNIXL:執行 ./transaction_match.sh
    • Windows PowerShell:執行 transaction_match.ps1

建立 input.properties 指令碼

透過複製下列指令碼以建立 input.properties

javahome=JAVA_HOME
epmautomatescript=EPM_AUTOMATE_LOCATION
epmusername=exampleAdmin1
epmpassword=examplePassword1.epw
epmurl=exampleURL1
objectstorageusername=exampleAdmin2
objectstoragepassword=examplePassword2
objectstorageurl=exampleURL2
matchtype=INTERCO
age=365
filteroperator=contains
filtervalues=FilterValue=14001
proxyserverusername=myProxyserver
proxyserverpassword=myProxyserver_pwd
proxyserverdomain=myProxyDomain

註:

僅限 Windows:input.properties 檔案移除下列特性:

  • javahome=JAVA_HOME
  • epmautomatescript=EPM_AUTOMATE_LOCATION

如果未替您的 Windows 網路環境啟用代理伺服器驗證,請從 input.properties 檔案移除這些特性。

  • proxyserverusername
  • proxyserverpassword
  • proxyserverdomain

表格 3-24 input.properties 參數

參數 描述
javahome EPM Automate 使用之 JDK 的安裝目錄。從 Windows 版本的 input.properties 刪除此項目。

Example: javahome=./home/JDK/bin

epmautomatescript EPM Automate 的安裝目錄。從 Windows 版本的 input.properties 刪除此項目。

Example:epmautomatescript=./home/utils/EPMAutomate/bin

epmusername 服務管理員超級使用者使用者、被授權封存已比對交易的檢視者的使用者名稱。

範例: epmusername=ServiceAdmin

epmuserpassword epmusername 代表之使用者的加密密碼檔案。

範例: epmpassword=myPwd.epw

epmurl 環境的 URL,比對的交易會封存到這個環境中。

範例: epmurl=https://test-cloudpln.pbcs.us1.oraclecloud.com

objectstorageusername 使用者的 ID,該使用者擁有必備的 Oracle Object Storage Cloud 寫入權限。

對於在聯合識別提供者中建立的使用者,請指定使用者的完整格式名稱 (例如,exampleIdP/jdoeexampleIdP/john.doe@example.com,其中 exampleIdP 是聯合識別提供者的名稱)。針對其他使用者,請指定使用者 ID。

範例: epmusername=myIdP/jdoe

objectstoragepassword objectstorageusername 中指出之使用者關聯的 Swift 密碼或驗證憑證。這個密碼與使用者用來登入「物件儲存主控台」的密碼不同。驗證憑證是 Oracle 產生的憑證,用於向第三方 API 進行身份驗證,例如向 Swift 用戶端進行身份驗證。如需瞭解如何建立這個憑證,請參閱 Oracle Cloud Infrastructure 文件中的若要建立驗證憑證

範例: objectstoragepassword=jDoe_PWD

objectstorageurl 已附加選擇性物件名稱之 Oracle Object Storage 分組的 URL。

範例: objectstorageurl=https://swiftobjectstorage.region_identifier.oraclecloud.com/v1/namespace/MT_Archives/2023_archives

matchtype 比對類型的 ID (TextID),系統會根據該比對類型封存已比對的交易。

範例: matchtype=cashrecon

age

交易比對好之後經過的天數。早於或等於此值的配對交易將被封存。

範例: age=180

filteroperator 篩選條件,用於識別哪些帳戶包含已比對的交易,以便進行封存。必須是下列其中一個:equalsnot_equalsstarts_withends_withcontainsnot_contains

這個值與 filterValue 搭配使用以識別要封存之比對交易所屬的科目:

範例: filteroperator=not_equals

filtervalues 一個或多個篩選條件值,用於識別要封存的交易。如果將 equalsnot_equals 指定為 filterOperator,您可以使用以空格分隔的清單來指定多個值。如果指定多個值,則會從符合任何篩選運算子和篩選值組合的科目選取交易來進行封存。

範例: filterValue=101-120 filterValue=140-202

proxyserverusername 用於驗證代理伺服器 (控制網際網路存取) 之安全階段作業的使用者名稱。

範例: proxyserverusername=myProxyserver

proxyserverpassword 使用代理伺服器驗證使用者的密碼。

範例: proxyserverpassword=myProxyserver_pwd

proxyserverdomain 為代理伺服器定義的網域名稱。

範例: proxyserverdomain=myProxyDomain

Windows 指令碼

透過複製下列指令碼以建立 transaction_match.ps1。將它儲存至 input.properties 所在的資料夾。

# Archive and Purge Transaction Matching PowerShell script

$inputproperties = ConvertFrom-StringData(Get-Content ./input.properties -raw)
$epmusername="$($inputproperties.epmusername)"
$epmpassword="$($inputproperties.epmpassword)"
$epmurl="$($inputproperties.epmurl)"
$objectstorageusername="$($inputproperties.objectstorageusername)"
$objectstoragepassword="$($inputproperties.objectstoragepassword)"
$objectstorageurl="$($inputproperties.objectstorageurl)"
$matchtype="$($inputproperties.matchtype)"
$age="$($inputproperties.age)"
$filteroperator="$($inputproperties.filteroperator)"
$filtervalues="$($inputproperties.filtervalues)"
$proxyserverusername="$($inputproperties.proxyserverusername)"
$proxyserverpassword="$($inputproperties.proxyserverpassword)"
$proxyserverdomain="$($inputproperties.proxyserverdomain)"

echo "Running processes to archive and purge transaction matching transactions ..."
if (${proxyserverusername}) {
    echo "Running epmautomate login ${epmusername} ${epmpassword} ${epmurl} ${proxyserverusername} ${proxyserverpassword} ${proxyserverdomain}" 
    epmautomate login ${epmusername} ${epmpassword} ${epmurl} ${proxyserverusername} ${proxyserverpassword} ${proxyserverdomain} 
} else {
    echo "Running epmautomate login ${epmusername} ${epmpassword} ${epmurl}" 
    epmautomate login ${epmusername} ${epmpassword} ${epmurl}
}
echo "Running epmautomate archiveTmTransactions \"${matchtype}\" ${age} filterOperator=${filteroperator} ${filtervalues}"
epmautomate archiveTmTransactions "${matchtype}" "${age}" "filterOperator=${filteroperator}" "${filtervalues}" > ./outfile.txt.tmp

$jobIdLine=Select-String -Path "outfile.txt.tmp" -Pattern "Job ID"; $jobIdLine=($jobIdLine -split ":")[-2]; $jobid=($jobIdLine -split " ")[1];
$logfile="Archive_Transactions_${matchtype}_${jobid}.log"
$transactionsfile="Archive_Transactions_${matchtype}_${jobid}.zip"
epmautomate listfiles > ./files.txt.tmp
$transactionslogfound=Select-String -Path "./files.txt.tmp" -Pattern "${logfile}"
$transactionsfilefound=Select-String -Path "./files.txt.tmp" -Pattern "${transactionsfile}"
rm ./outfile.txt.tmp
rm ./files.txt.tmp

if (${transactionslogfound}) {
    echo "Running epmautomate downloadfile \"${logfile}\""
    epmautomate downloadfile "${logfile}"
    if (${transactionsfilefound}) {
        echo "Running epmautomate downloadfile ${transactionsfile}"
        epmautomate downloadfile "${transactionsfile}" 
        if ($?) {
            echo "Running epmautomate copyToObjectStorage ${transactionsfile} ${objectstorageusername} ${objectstoragepassword} ${objectstorageurl}"
            epmautomate copyToObjectStorage "${transactionsfile}" "${objectstorageusername}" "${objectstoragepassword}" "${objectstorageurl}"
            if ($?) {
                echo "Running epmautomate purgeArchivedTMTransactions JOBID=${jobid}"
                epmautomate purgeArchivedTMTransactions "JobID=${jobid}"
            } 
            else {
                echo "EPMAutomate copyToObjectStorage failed. Purging of archived matched transactions will not be attempted."
            } 
        }
        else {
            echo "Download of transactions file ${transactionsfile} failed. Copy to object storage, and purging of archived matched transactions will not be attempted."
        }
    } 
    else {
        echo "No matched transactions found. Archive file download, copy to object storage, and purging of archived matched transactions will not be attempted."
    }
} 
else { 
    echo "Matchtype ID \"${matchtype}\" not found. Archive file download, copy to object storage, and purging of archived matched transactions will not be attempted."
}

echo "Running epmautomate logout"
epmautomate logout
echo "Script processing completed."

Linux/UNIX 指令碼

透過複製下列指令碼以建立 transaction_match.sh。將它儲存至 input.properties 所在的資料夾。

#!/bin/sh

. ./input.properties
export JAVA_HOME=${javahome}

echo "Running processes to archive and purge transaction matching transactions..."
if [[ "${proxyserverusername}" != "" ]]
then
    echo "Running epmautomate login ${epmusername} ${epmpassword} ${epmurl} ProxyServerUserName=${proxyserverusername} ProxyServerPassword=${proxyserverpassword} ProxyServerDomain=${proxyserverdomain}" 
    ${epmautomatescript} login "${epmusername}" "${epmpassword}" "${epmurl}" "ProxyServerUserName=${proxyserverusername}" "ProxyServerPassword=${proxyserverpassword}" "ProxyServerDomain=${proxyserverdomain}" 
else
    echo "Running epmautomate login ${epmusername} ${epmpassword} ${epmurl}" 
    ${epmautomatescript} login "${epmusername}" "${epmpassword}" "${epmurl}" 
fi
echo "Running epmautomate archiveTmTransactions \"${matchtype}\" ${age} filterOperator=${filteroperator} ${filtervalues}"
${epmautomatescript} archiveTmTransactions "${matchtype}" "${age}" "filterOperator=${filteroperator}" "${filtervalues}" > ./output.txt.tmp

jobid=$(grep "Job ID" ./output.txt.tmp | cut -d':' -f3 | cut -d' ' -f2)
logfile="Archive_Transactions_${matchtype}_${jobid}.log"
transactionsfile="Archive_Transactions_${matchtype}_${jobid}.zip"
${epmautomatescript} listfiles > ./files.txt.tmp
transactionslogfound=$(grep "${logfile}" ./files.txt.tmp | wc -l)
transactionsfilefound=$(grep "${transactionsfile}" ./files.txt.tmp | wc -l)
rm ./files.txt.tmp
rm ./output.txt.tmp

if [ ${transactionslogfound} -eq 0 ]
then
    echo "Matchtype ID \"${matchtype}\" not found. Archive file download, copy to object storage, and purging of archived matched transactions will not be attempted."
else
    echo "Running epmautomate downloadfile \"${logfile}\""
    ${epmautomatescript} downloadfile "${logfile}"
    if [ ${transactionsfilefound} -eq 0 ]
    then
        echo "No matched transactions found. Archive file download, copy to object storage, and purging of archived matched transactions will not be attempted."
    else
        echo "Running epmautomate downloadfile ${transactionsfile}"
        ${epmautomatescript} downloadfile "${transactionsfile}" 
        if [ $? -eq 0 ]
        then
            echo "Running epmautomate copyToObjectStorage ${transactionsfile} ${objectstorageusername} ${objectstoragepassword} ${objectstorageurl}"
            ${epmautomatescript} copyToObjectStorage "${transactionsfile}" "${objectstorageusername}" "${objectstoragepassword}" "${objectstorageurl}"
            if [ $? -eq 0 ]
            then
                echo "Running epmautomate purgeArchivedTMTransactions JOBID=${jobid}"
                ${epmautomatescript} purgeArchivedTMTransactions "JobID=${jobid}"
            else
                echo "EPMAutomate copyToObjectStorage failed. Purging of archived matched transactions will not be attempted."
            fi
        else
            echo "Download of transactions file ${transactionsfile} failed. Copy to object storage, and purging of archived matched transactions will not be attempted."
        fi
    fi
fi

echo "Running epmautomate logout"
${epmautomatescript} logout
echo "Script processing completed."