Function Test_Crisp2()
#pragma precomp SRP_PreCompiler

* Use to add shipment record numbers to WOMatKey based on WO or ship date + reactor type

Declare subroutine Set_Property,  Set_Status, ErrMsg, Set_Property, obj_AppWindow, Send_Message, Logging_Services
Declare subroutine Btree.Extract, Send_Event, Security_Err_Msg, Forward_Event, End_Window, Start_Window, FTP_Services
Declare subroutine EditCell, obj_NCR, obj_Notes, Post_Event, obj_WO_Mat, obj_WO_Mat_Log, obj_WO_Wfr, obj_Tables, obj_RDS
Declare subroutine Error_Services, RDS_Services, Dialog_Box, Insert, Unlock, QA_Services, Validate, Development_Services
Declare subroutine Update_Index, Database_Services, Obj_WO_Mat_QA, Fmt, Yield, WinYield, Sleepery, Qa_Services, Reactor_Services
Declare subroutine Obj_Post_Log, GaN_Services, Excel_Services, obj_WO_React, Sap_Services, obj_sap, Errlog, Set_FSError, Print_Cass_Labels
Declare function Get_Property, Get_Status, Popup, Send_Message, Msg, Security_Check, Dialog_Box, RowExists, Utility
Declare function Dialog_Box, obj_WO_Log, obj_NCR, Check_Notes, obj_MUWafers, obj_WO_Mat, Error_Services, RDS_Services
Declare function MemberOf, obj_Tables, obj_RDS, Environment_Services, Logging_Services, Material_Services, ErrMsg
Declare function Work_Order_Services, RetStack, Min, Max, Obj_Prod_Spec, Insert, SRP_Trim, Xlate, Obj_Wo_Mat
Declare function Security_Services, QA_Services, Database_Services, RowExists, Rti_Lh_Info, UNICODE_ANSI, UNICODE_UTF8
Declare function index, Httpclient_Services, SRP_Encode, SRP_Decode, DirList, Obj_Rds_Test, Tool_Parms_Services
Declare function SQL_Services, RDS_Services, Obj_WM_out, Schedule_Services, Obj_Tool, SRP_Sort_Array, ICONV, SRP_Path
Declare function Development_Services, Obj_WO_Mat_QA, SRP_Join_Arrays, NextKey, Obj_Prod_Spec, FTP_Services, SQL_Format, Direct_Print
Declare Function DateTime, GaN_Services, SRP_Array, SRP_Clean_Array, Excel_Services, EpiPro_Services, Sap_Services, Signature_Services, Rti_Openid_Support
Declare Function Set_Printer, Printer_Select, Print_SAP_Cass_Ship_Label
Declare subroutine Data_Map_Test, Print_SAP_Cass_Ship_Label
Declare Function Get.RecCount
Declare Function DCount
Declare Function Database_Services
Declare Function Environment_Services, Select_Into

$INSERT POPUP_EQUATES
$INSERT MSG_EQUATES
$INSERT APPCOLORS
//$insert APP_INSERTS
$INSERT WM_IN_EQUATES
$Insert WM_OUT_EQUATES
$INSERT WO_LOG_EQU
$INSERT WO_STEP_EQU
$INSERT WO_MAT_EQUATES
$INSERT ORDER_EQU
$INSERT RDS_EQUATES
$INSERT PROD_SPEC_EQU
$INSERT NOTIFICATION_EQU
$INSERT LSL_USERS_EQU
$INSERT SECURITY_RIGHTS_EQU
$INSERT LOGICAL
$INSERT RTI_LH_INFO_EQUATES
$INSERT WO_MAT_QA_EQUATES
$INSERT CUST_EPI_PART_EQUATES
$INSERT PRS_STAGE_EQUATES
$Insert RLIST_EQUATES
$Insert CLEAN_INSP_EQUATES
$Insert TOOL_PARMS_EQUATES
$Insert SCHEDULE_EQU
$Insert SCHED_DET_EQUATES
$Insert SCHEDULER_EQUATES
$Insert NCR_EQUATES
$Insert REACT_RUN_EQUATES
$Insert TOOL_EQUATES
$Insert TOOL_LOG_EQUATES
$Insert PM_EQUATES
$Insert EPI_PART_EQUATES
$insert SCANS_EQUATES
$insert SERVICE_SETUP

equ crlf$ to \0D0A\

*debug
*open "REPLICATION_QUEUE_LSL2_RUN_STAGE_WFR" to REP_TABLE then
*open "REPLICATION_QUEUE_GLOBAL_PUBLIC" to REP_TABLE then
*open "REPLICATION_QUEUE_LSL2_WO_MAT" to REP_TABLE then
open "REPLICATION_QUEUE_LSL2_RDS" to REP_TABLE then
*open "REPLICATION_QUEUE_LSL2_REACT_RUN" to REP_TABLE then
*open "REPLICATION_QUEUE_LSL2_WO_WFR" to REP_TABLE then
	
end
select REP_TABLE
	done = FALSE$
	idList = ''
	status=''
	loop
		readnext @ID Else Done = TRUE$
	until done
		read REC from REP_TABLE, @ID then
			*if REC<5> EQ 'R69' then
			*if REC<5> EQ '459904*JV_XRD*170095.19.10' then
			if REC<5> EQ '518495' then
				delete REP_TABLE, @ID
			end
			*end else
*					idList =+ idList:@ID:','
*					swap '.' with '*' in REC
*					write REC on REP_TABLE, @ID else
*						return 'Delete_error @':@ID
*						status = Set_FSError()
*					end 
*				end else
*					*return 'Read Error @':@ID
*				end
			*end
		end
	repeat
end else
	return 'Open_Error'
end

*				return idList
*				
*				* open "SEC_GROUPS" to REP_TABLE then
*				* 	select REP_TABLE
*				* 	done = FALSE$
*				* 	loop
*				*		readnext @ID Else Done = TRUE$
*				* 	until done
*				*		read REC from REP_TABLE, @ID then
*				*			if REC<5> EQ '403583' then
*				*				delete REP_TABLE, @ID else
*				*					return 'Delete_error @':@ID
*				*				end
*				*			end
*				*		end else
*				*			return 'Read Error @':@ID
*				*		end
*				* 	repeat
*				* end else
*				* 	return 'Open_Error'
*				* end
*				
*				return
*				
*				//printing 4x4 label (WO_NO, CASS_NO, STAGE, RDS_NO)
*				*Print_SAP_Cass_Ship_Label(168982,1,1,390211)
*				* 
*				* //below is code snippet where BTREE extract not pulling up SAP_BATCH_NO on Ship Label Check form
*				* Open 'DICT.WO_MAT' To DictWOMat Then
*				* BatchID = 'M014188.1'			
*				* 	Search			= 'SAP_BATCH_NO':@VM:BatchID:@FM
*				* 	Flag			= ''
*				* 	ScanWOMatKey 	= ''
*				* 	
*				* 	Set_Status(0)
*				* 	Btree.Extract(Search,'WO_MAT',DictWOMat,ScanWOMatKey,'',Flag)
*				* 	If Get_Status(errCode) Then
*				*		ErrMsg(errCode)
*				* 	End
*				* 	return ScanWOMatKey
*				* end
*				* 
*				* return
*				
*				
*				Open 'REPLICATION_QUEUE_LSL2_WO_MAT' To table THEN
*					
*					Select table
*					Done = 0
*					LOOP
*						READNEXT @ID ELSE Done = 1
*					UNTIL Done
*						Read @RECORD From table, @ID THEN
*							DELETE table, @ID
*						end
*					REPEAT
*				end
*				
*				return
*				
*				vStmt  = "SELECT RDS WITH SEQ >= '395284' AND WITH SEQ <= '396000' " : @fm
*				vStmt := "LIST RDS"
*				
*				results = Select_into ( vStmt, "CSV" )
*				filename = "d:\temp\test.csv"
*				OsWrite results on filename
*				*Call shellexecute(0,'Open':\\00\, filename:\00\,'','',1)
*				return
*				
*				
*				*debug
*				tableName = 'WO_MAT'
*				fileName = "d:\temp\":tableName:"_2keys.txt"
*				Open tableName To tablevar THEN
*					tablename = ''
*					Select tablevar 
*					report = ''
*					Done = 0
*					LOOP
*						READNEXT @ID ELSE Done = 1
*					UNTIL Done
*						*Read @RECORD From tablevar, @ID THEN
*						report := @ID:crlf$
*						*end
*					REPEAT
*				end
*				
*				OSWrite report To filename
