127 lines
6.1 KiB
Plaintext
127 lines
6.1 KiB
Plaintext
Compile function Copy_REACTOR_Record_To_SQL(Connection, Key, Record)
|
|
|
|
/*****************************************************************************\
|
|
Copies the given REACTOR record to the MSSQL database.
|
|
|
|
History
|
|
-------
|
|
06/21/2010 KRF Original Programmer
|
|
09/18/2017 DMB Pull CurrModeKey from REACTOR_CHILD_KEY_IDS table instead
|
|
of the REACTOR table.
|
|
\*****************************************************************************/
|
|
|
|
$insert REACTOR_EQUATES
|
|
$insert REACTOR_CHILD_KEY_IDS_EQUATES
|
|
|
|
Declare function SQL_Write, SQL_Write_MV, SQL_Format
|
|
Ans = ""
|
|
|
|
// Parse record into a dimensioned array for speed
|
|
Dim Rec(52)
|
|
MatParse Record into Rec
|
|
|
|
// List of key names and their values
|
|
Keys = "REACT_NO":@VM:SQL_Format(Key, "INT")
|
|
|
|
// Conversions
|
|
ReactType = OConv(Rec(REACTOR_REACT_TYPE$), "[REACT_TYPE_CONV,OPSREF]")
|
|
ReactAssignment = OConv(Rec(REACTOR_REACT_ASSIGNMENT$), "[REACT_ASSIGN_CONV]")
|
|
* CurrModeKey = Rec(REACTOR_CURR_MODE_KEY$)[1, @vm]
|
|
CurrModeKey = Xlate('REACTOR_CHILD_KEY_IDS', Key, REACTOR_CHILD_KEY_IDS_REACT_MODE_KEY_IDS$, 'X')<1, 1>
|
|
|
|
// List of data fields and their values
|
|
DataFields = "REACT_TYPE" :@VM:SQL_Format(ReactType, "STR"):@FM
|
|
DataFields := "REDUCED_PRESS" :@VM:SQL_Format(Rec(REACTOR_REDUCED_PRESS$), "BIT"):@FM
|
|
DataFields := "REACT_ASSIGNMENT" :@VM:SQL_Format(ReactAssignment, "STR"):@FM
|
|
DataFields := "TEMP_TYPE" :@VM:SQL_Format(Rec(REACTOR_TEMP_TYPE$), "STR"):@FM
|
|
DataFields := "REACT_DESC" :@VM:SQL_Format(Rec(REACTOR_REACT_DESC$), "STR"):@FM
|
|
DataFields := "CURR_MODE_KEY" :@VM:SQL_Format(CurrModeKey, "STR"):@FM
|
|
DataFields := "HEAVY_DOPE" :@VM:SQL_Format(Rec(REACTOR_HEAVY_DOPE$), "BIT"):@FM
|
|
DataFields := "ATV" :@VM:SQL_Format(Rec(REACTOR_ATV$), "BIT"):@FM
|
|
DataFields := "INJECT_TYPE" :@VM:SQL_Format(Rec(REACTOR_INJECT_TYPE$), "STR"):@FM
|
|
DataFields := "SOS_SENSORS" :@VM:SQL_Format(Rec(REACTOR_SOS_SENSORS$), "BIT"):@FM
|
|
DataFields := "SERIAL_NO" :@VM:SQL_Format(Rec(REACTOR_SERIAL_NO$), "STR"):@FM
|
|
DataFields := "MFR_TYPE" :@VM:SQL_Format(Rec(REACTOR_MFR_TYPE$), "STR"):@FM
|
|
DataFields := "ASM_MFR_YEAR" :@VM:SQL_Format(Rec(REACTOR_ASM_MFR_YEAR$), "STR"):@FM
|
|
DataFields := "ARM_TYPE" :@VM:SQL_Format(Rec(REACTOR_ARM_TYPE$), "STR"):@FM
|
|
DataFields := "PROCESSOR" :@VM:SQL_Format(Rec(REACTOR_PROCESSOR$), "STR"):@FM
|
|
DataFields := "CONFIG_NOTES" :@VM:SQL_Format(Rec(REACTOR_CONFIG_NOTES$), "STR", 1):@FM
|
|
DataFields := "EXT_TYPE" :@VM:SQL_Format(Rec(REACTOR_EXT_TYPE$), "STR"):@FM
|
|
DataFields := "HTHF" :@VM:SQL_Format(Rec(REACTOR_HTHF$), "BIT"):@FM
|
|
DataFields := "LAST_READ_HRS_DTM" :@VM:SQL_Format(Rec(REACTOR_LAST_READ_HRS_DTM$), "DATETIME"):@FM
|
|
DataFields := "LAST_READ_CYCLES_DTM":@VM:SQL_Format(Rec(REACTOR_LAST_READ_WFRS_DTM$), "DATETIME"):@FM
|
|
DataFields := "WAFER_SIZE" :@VM:SQL_Format(Rec(REACTOR_WAFER_SIZE$), "STR"):@FM
|
|
DataFields := "SUSC_POCKET_SIZE" :@VM:SQL_Format(Rec(REACTOR_SUSC_POCKET_SIZE$), "STR"):@FM
|
|
DataFields := "PICK_PLACE" :@VM:SQL_Format(Rec(REACTOR_PICK_PLACE$), "BIT"):@FM
|
|
DataFields := "VENDOR" :@VM:SQL_Format(Rec(REACTOR_VENDOR$), "STR"):@FM
|
|
DataFields := "LOCATIONX" :@VM:SQL_Format(Rec(REACTOR_LOCATIONX$), "STR"):@FM
|
|
DataFields := "SUSC_POCKET_QTY" :@VM:SQL_Format(Rec(REACTOR_SUSC_POCKET_QTY$), "INT"):@FM
|
|
DataFields := "ACTIVE_LL_DISABLED" :@VM:SQL_Format(Rec(REACTOR_ACTIVE_LL_DISABLED$), "STR"):@FM
|
|
|
|
// Symbolics
|
|
DataFields := "TOOL_WH" :@VM:SQL_Format({TOOL_WH_DESC}, "STR"):@FM
|
|
DataFields := "TOOL_LOC" :@VM:SQL_Format({TOOL_LOC_DESC}, "STR"):@FM
|
|
DataFields := "LOCATION" :@VM:SQL_Format({LOCATION}, "STR"):@FM
|
|
DataFields := "AREA" :@VM:SQL_Format({AREA}, "STR")
|
|
|
|
// Write the data to the SQL database
|
|
Ans = SQL_Write(Connection, "REACTOR", Keys, DataFields)
|
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
// Multi-valued Fields
|
|
|
|
// REACTOR_GAS_SRC
|
|
|
|
* If Ans EQ "" AND Rec(5) NE "" then
|
|
* GasIDs = Rec(5)
|
|
* NumVals = Count(GasIDs, @VM) + (GasIDs NE "")
|
|
* For ValLoop = 1 to NumVals
|
|
* mvKey = "REACT_NO":@VM:SQL_Format(Key, "INT"):@FM
|
|
* mvKey := "AREA":@VM:SQL_Format(Field(GasIDs<0, ValLoop>, "*", 1, 1), "STR"):@FM
|
|
* mvKey := "CAB":@VM:SQL_Format(Field(GasIDs<0, ValLoop>, "*", 2, 1), "STR"):@FM
|
|
* mvKey := "POS":@VM:SQL_Format(Field(GasIDs<0, ValLoop>, "*", 3, 1), "STR")
|
|
* mvDataFields = ""
|
|
* Ans = SQL_Write(Connection, "REACTOR_GAS_SRC", mvKey, mvDataFields);
|
|
* Next Vals
|
|
*
|
|
* end
|
|
|
|
// REACTOR_MFC
|
|
* If Ans EQ "" AND Rec(3) NE "" then
|
|
*
|
|
* // List of data fields and their values
|
|
* MvFields = "MFC_LOC":@FM:SQL_Format(Rec(3), "STR"):@RM
|
|
* MvFields := "MFC_SERIAL":@FM:SQL_Format(Rec(4), "STR"):@RM
|
|
* MvFields := "MFC_LOC_PN":@FM:SQL_Format(Rec(8), "STR")
|
|
*
|
|
* // Write the data to the SQL database
|
|
* Ans = SQL_Write_MV(Connection, "REACTOR_MFC", Keys, MvFields);
|
|
*
|
|
* end
|
|
|
|
// REACTOR_ESCALATION
|
|
If Ans EQ "" AND Rec(10) NE "" then
|
|
|
|
// List of data fields and their values
|
|
MvFields = "ACTIVE_ESCALATION":@FM:SQL_Format(Rec(10), "STR")
|
|
|
|
// Write the data to the SQL database
|
|
Ans = SQL_Write_MV(Connection, "REACTOR_ESCALATION", Keys, MvFields);
|
|
|
|
end
|
|
|
|
|
|
// REACTOR_ESC_START_DTM
|
|
If Ans EQ "" AND Rec(9) NE "" then
|
|
|
|
// List of data fields and their values
|
|
MvFields = "ESC_START_DTM":@FM:SQL_Format(Rec(9), "DATETIME")
|
|
|
|
// Write the data to the SQL database
|
|
Ans = SQL_Write_MV(Connection, "REACTOR_ESC_START_DTM", Keys, MvFields);
|
|
|
|
end
|
|
|
|
Return Ans
|
|
|