54 lines
2.6 KiB
Plaintext
54 lines
2.6 KiB
Plaintext
Compile function Copy_PM_Record_To_SQL(Connection, Key, Record)
|
|
|
|
/*****************************************************************************\
|
|
Copies the given PM record to the MSSQL database.
|
|
|
|
History
|
|
-------
|
|
11/30/2016 KRF Original Programmer
|
|
\*****************************************************************************/
|
|
|
|
Declare function SQL_Write, SQL_Write_MV, SQL_Format
|
|
Ans = ""
|
|
|
|
$insert PM_EQUATES
|
|
|
|
// Parse record into a dimensioned array for speed
|
|
Dim Rec(14)
|
|
MatParse Record into Rec
|
|
|
|
// List of key names and their values
|
|
Keys = "PM_NO":@VM:SQL_Format(Key, "INT")
|
|
|
|
// List of data fields and their values
|
|
DataFields = "PMS_ID" :@VM:SQL_Format(Rec(PM_PMS_ID$), "INT"):@FM
|
|
DataFields := "ENTER_BY" :@VM:SQL_Format(Rec(PM_ENTER_BY$), "STR"):@FM
|
|
DataFields := "ENTER_DTM" :@VM:SQL_Format(Rec(PM_ENTER_DTM$), "DATETIME"):@FM
|
|
DataFields := "SCHED_DT" :@VM:SQL_Format(Rec(PM_SCHED_DT$), "DATE"):@FM
|
|
DataFields := "SCHED_TM" :@VM:SQL_Format(Rec(PM_SCHED_TM$), "TIME"):@FM
|
|
DataFields := "SCHED_QTY" :@VM:SQL_Format(Rec(PM_SCHED_QTY$), "INT"):@FM
|
|
DataFields := "NOTES" :@VM:SQL_Format(Rec(PM_NOTES$), "STR"):@FM
|
|
DataFields := "COMP_BY" :@VM:SQL_Format(Rec(PM_COMP_BY$), "STR"):@FM
|
|
DataFields := "COMP_DTM" :@VM:SQL_Format(Rec(PM_COMP_DTM$), "DATETIME"):@FM
|
|
DataFields := "START_BY" :@VM:SQL_Format(Rec(PM_START_BY$), "STR"):@FM
|
|
DataFields := "START_DTM" :@VM:SQL_Format(Rec(PM_START_DTM$), "DATETIME"):@FM
|
|
DataFields := "COMP_QTY" :@VM:SQL_Format(Rec(PM_COMP_QTY$), "INT"):@FM
|
|
|
|
// Symbolics
|
|
DataFields := "ACT_PMS_ID" :@VM:SQL_Format({ACT_PMS_ID}, "INT"):@FM
|
|
DataFields := "COMP_DT" :@VM:SQL_Format({COMP_DT}, "DATE"):@FM
|
|
DataFields := "COMP_PMS_ID" :@VM:SQL_Format({COMP_PMS_ID}, "INT"):@FM
|
|
DataFields := "STATUS" :@VM:SQL_Format({STATUS}, "STR"):@FM
|
|
DataFields := "TOOL_CYCLE_CNT" :@VM:SQL_Format({TOOL_CYCLE_CNT}, "INT"):@FM
|
|
DataFields := "TOOL_DESC" :@VM:SQL_Format({TOOL_DESC}, "STR"):@FM
|
|
DataFields := "TOOL_ID" :@VM:SQL_Format({TOOL_ID}, "STR"):@FM
|
|
DataFields := "UNITS" :@VM:SQL_Format({UNITS}, "STR")
|
|
|
|
// Write the data to the SQL database
|
|
Ans = SQL_Write(Connection, "PM", Keys, DataFields)
|
|
|
|
//-------------------------------------------------------------------------------------------------
|
|
// Multi-valued Fields
|
|
|
|
Return Ans
|