COMPILE ROUTINE FIX_COC(Dummy) ROWDEF (CHARSTR) * Use to add shipment record numbers to WOMatKey based on WO or ship date + reactor type DECLARE SUBROUTINE obj_Schedule,Send_Dyn,Send_Info, obj_Shipment,RList, Btree.Extract, obj_WM_Out, obj_WO_Mat, Set_Status, Send_Dyn DECLARE SUBROUTINE obj_WO_Mat_Log, Set_Property, ErrMsg DECLARE FUNCTION Get_Status, Set_Printer $INSERT COC_EQUATES $INSERT WO_LOG_EQUATES $INSERT RDS_EQUATES $INSERT WO_MAT_EQUATES $INSERT WM_OUT_EQUATES equ TARGET_ACTIVELIST$ to 5 EQU TAB$ TO \09\ OPEN 'COC' TO ShipFile ELSE DEBUG GOTO Bail END OPEN 'DICT.COC' TO DictVar ELSE DEBUG GOTO Bail END OPEN 'WO_MAT' TO WOMatTable ELSE DEBUG GOTO Bail END OPEN 'FTP_QUEUE' TO QFile ELSE DEBUG GOTO Bail END DEBUG SelectStatement = 'SELECT FTP_QUEUE WITH SHIP_NO FROM 136094 TO 136119 BY SHIP_NO' RList(SelectStatement,TARGET_ACTIVELIST$, "", "", "") IF Get_Status(errCode) THEN DEBUG ShipKeys = '' Done = 0 LOOP READNEXT ShipKey ELSE Done = 1 UNTIL Done *DELETE QFile,ShipKey THEN *DELETE ShipFile,ShipKey THEN Send_Dyn(ShipKey:' - deleted') *END *END ShipKeys := ShipKey:@VM *Send_Dyn(ShipKey) REPEAT GOTO Bail Done = 0 RecCnt = 0 FixCnt = 0 FOR Ship = 1 TO ShipCnt ShipNo = ShipKeys<1,Ship> READ ShipRec FROM ShipFile,ShipNo THEN RecCnt += 1 WONo = ShipRec StepNos = ShipRec CassNos = ShipRec wmlWONos = '' ;* parameters for obj_WO_Mat_Log('Create' call wmlCassNos = '' wmlCassIDs = '' CassCnt = COUNT(CassNos,@VM) + (CassNos NE '') FOR I = 1 TO CassCnt StepNo = StepNos<1,I> CassNo = CassNos<1,I> WOMatKey = WONo:'*':CassNo READ WOMatRec FROM WOMatTable,WOMatKey THEN IF WOMatRec = '' OR WOMatRec NE ShipNo THEN obj_WO_Mat('AddShip',WOMatKey:@RM:ShipNo) IF Get_Status(errCode) THEN DEBUG END END WMOutKey = WOMatRec ShipDTM = OCONV(ShipRec,'DT4/^S') LOCATE 'SHIP' IN WOMatRec USING @VM SETTING Pos ELSE wmlWONos<1,-1> = WONo wmlCassNos<1,-1> = CassNo IF WMOutKey NE '' THEN obj_WM_Out('AddShip',WMOutKey:@RM:ShipNo) wmlCassIDs<1,-1> = 'O':WONo:'.':StepNo:'.':CassNo END ELSE wmlCassIDs<1,-1> = WOMatRec[-1,'B':@VM] ;* Ship RDS No END END ;* End of check for SHIP inventory log entry END ;* End of WOMatRec READ *Set_Property('TEST.STATUS_LINE','TEXT','Shipments: ':RecCnt:' Fixed: ':FixCnt:' ':I:' of ':'Cassettes: ':CassCnt) NEXT I IF WmlCassNos NE '' THEN oWMLParms = 'WO_MAT':@RM ;* LogFile oWMLParms := ShipDTM:@RM ;* Use PickDTM from shipment record oWMLParms := 'SHIP':@RM ;* Action oWMLParms := 'SR':@RM ;* WhCd = Shipping / Receiving oWMLParms := 'SB':@RM ;* LocCd = Shipping Bench oWMLParms := wmlWONos:@RM ;* WONo(s) oWMLParms := wmlCassNos:@RM ;* CassNos(s) oWMLParms := 'SAP':@RM ;* User ID oWMLParms := wmlCassIDs ;* CassIDs (whats on the label in the bar code!) obj_WO_Mat_Log('Create',oWMLParms) IF Get_Status(errCode) THEN ErrMsg(errCode) FixCnt += 1 END ;* End of check for wmlCassNos not null END ;* End of ShipRec READ Set_Property('TEST.STATUS_LINE','TEXT','Shipments: ':Ship:' Cassettes Fixed: ':FixCnt) NEXT Ship GOTO Bail * * * * * * * Existing routine on 10/1/2014 * * * * * * * * *SelectStatement = 'SELECT COC WITH SHIP_DT > "6/19/2014" AND WITH REACTOR_TYPE = "EPP" ' ; * Change the SHIP_DT and REACTOR_TYPE as needed to fix by Date and Reactor type *SelectStatement = 'SELECT COC WITH WO_NO = "158121" ' ; * Change the WO_NO as needed to fix by single WO *SelectStatement = 'SELECT COC WITH WO_NO 157745 157805 157819 ' ; * Change the WO_NO as needed to fix by multiple WO's RList(SelectStatement,TARGET_ACTIVELIST$, "", "", "") ; * This RList statement performs the actual listing based on the SelectStatements above (which one is active) DEBUG Done = 0 RecCnt = 0 LOOP READNEXT ShipNo ELSE Done = 1 UNTIL DONE READ ShipRec FROM ShipFile,ShipNo THEN RecCnt += 1 WONo = ShipRec CassNos = ShipRec StepNos = ShipRec cassCnt = COUNT(CassNos,@VM) + (CassNos NE '') FOR I = 1 TO cassCnt CassNo = CassNos<1,I> WOMatKey = WONo:'*':CassNo WOMatRec = XLATE('WO_MAT',WOMatKey,'','X') WOMatShipNo = WOMatRec IF WOMatShipNo = '' Then ;* If no ship_no then write ship_no to WO_MAT record from the COC record *obj_WO_Mat('AddShip',WOMatKey:@RM:ShipNo) ;* Remove * to make hot for WO_MAT fix -dkk 7/31/14 Send_Dyn(ShipNo:' Added to WO_MAT ':WOMatKey) END WMOKey = WOMatRec IF WMOKey NE '' THEN ;* EpiPro - If no ship_no in WMO key, then write ship_no to WM_OUT record from the COC record WMOutRec = XLATE('WM_OUT',WMOKey,'','X') IF WMOutRec = '' THEN *obj_WM_Out('AddShip',WMOKey:@RM:ShipNo) ;* Remove * to make hot for EpiPro fix -dkk 7/31/14 Send_Dyn(ShipNo:' Added to WM_OUT ':WMOKey) END END NEXT I END REPEAT GOTO Bail * * * * * * * * * * * DEBuG SELECT ShipFile Done = 0 RecCnt = 0 FixCnt = 0 LOOP READNEXT ShipNo ELSE Done = 1 UNTIL Done READ ShipRec FROM ShipFile,ShipNo THEN RecCnt += 1 ReactType = ShipRec ReactCode = '' BEGIN CASE CASE ReactType = 'A' ; ReactCode = 'ASM+' CASE ReactType = 'P' ; ReactCode = 'EPP' CASE ReactType = 'E' ; ReactCode = 'ASM' CASE ReactType = 'H' ; ReactCode = 'HTR' CASE ReactType = 'C' ; ReactCode = 'SIG' CASE 1 ; NULL END CASE IF ReactCode NE '' THEN ShipRec = ReactCode *WRITE ShipRec ON ShipFile,ShipNo THEN FixCnt += 1 Send_Info(FixCnt:TAB$:ShipNo:' ':ReactType:' -> ':ReactCode) *END END ;* End of check for WriteFlag END ;* End of record read REPEAT GOTO Bail * * * * * * * Bail: * * * * * * * END