Compile function Copy_MAKEUP_WAFERS_Record_To_SQL(Connection, Key, Record)

/*****************************************************************************\
	Copies the given MAKEUP_WAFERS record to the MSSQL database.
	
	History
	-------
	04/14/23    JRO   Original Programmer
\*****************************************************************************/

$insert MAKEUP_WAFERS_EQUATES

Declare function SQL_Write, SQL_Write_MV, SQL_Format
Ans = ""

// Parse record into a dimensioned array for speed
Dim Rec(14)
MatParse Record into Rec
					    
// List of key names and their values
Keys  = "WO_NO"  :@VM:SQL_Format(Field(Key, "*", 1), "INT"):@FM
Keys := "CASS_NO":@VM:SQL_Format(Field(Key, "*", 2), "INT")


// List of data fields and their values
DataFields                  = "SAP_BATCH_NO"             :@VM:SQL_Format(Rec(MAKEUP_WAFERS.SAP_BATCH_NO$ ),          "STR"):@FM
DataFields                 := "PS_NO"                    :@VM:SQL_Format(Rec(MAKEUP_WAFERS.PS_NO$),        "INT"):@FM
DataFields                 := "CUST_NO"                  :@VM:SQL_Format(Rec(MAKEUP_WAFERS.CUST_NO$),                "INT"):@FM
DataFields                 := "PROD_ORD_NO"              :@VM:SQL_Format(Rec(MAKEUP_WAFERS.PROD_ORD_NO$),                "STR"):@FM
DataFields                 := "WAFER_SIZE"               :@VM:SQL_Format(Rec(MAKEUP_WAFERS.WAFER_SIZE$),       "STR"):@FM
DataFields                 := "EPI_PART_NO"              :@VM:SQL_Format(Rec(MAKEUP_WAFERS.EPI_PART_NO$),          "STR"):@FM
DataFields                 := "RDS_NO"                   :@VM:SQL_Format(Rec(MAKEUP_WAFERS.RDS_NO$),          "INT"):@FM
DataFields                 := "WM_OUT_NO"                :@VM:SQL_Format(Rec(MAKEUP_WAFERS.WM_OUT_NO$),  "STR"):@FM
DataFields                 := "PROD_VER_NO"            :@VM:SQL_Format(Rec(MAKEUP_WAFERS.PROD_VER_NO$),           "INT"):@FM
DataFields                 := "CUST_PART_NO"             :@VM:SQL_Format(Rec(MAKEUP_WAFERS.CUST_PART_NO$),          "STR"):@FM
DataFields                 := "REACT_TYPE"               :@VM:SQL_Format(Rec(MAKEUP_WAFERS.REACT_TYPE$),           "STR"):@FM
DataFields                 := "CURR_STATUS_STATIC"       :@VM:SQL_Format(Rec(MAKEUP_WAFERS.CURR_STATUS_STATIC$),        "STR"):@FM
DataFields                 := "UNLOAD_DTM"               :@VM:SQL_Format(Rec(MAKEUP_WAFERS.UNLOAD_DTM$), "DATETIME"):@FM
DataFields                 := "WFR_QTY"                  :@VM:SQL_Format(Rec(MAKEUP_WAFERS.WFR_QTY$),      "INT"):@FM


// Write the data to the SQL database
Ans = SQL_Write(Connection, "MAKEUP_WAFERS", Keys, DataFields);

Return Ans

