Function NDW_FQA_MAT_SCAN_EVENTS(CtrlEntId, Event, Param1, Param2, Param3, Param4, Param5, Param6, Param7, Param8, Param9, Param10, Param11, Param12, Param13, Param14, Param15) /*********************************************************************************************************************** This program is proprietary and is not to be used by or disclosed to others, nor is it to be copied without written permission from SRP Computer Solutions, Inc. Name : NDW_FQA_MAT_SCAN_EVENTS Description : This function acts as a commuter module for all events related to this window. Notes : This procedure supports the same-named form. Form is single use, for moving lots with 1K*PTI location angd warehouse code. The form must Parameters : CtrlEntId [in] -- The fully qualified name of the control calling the promoted event Event [in] -- The event being executed. See the Notes section regarding "PRE" events Param1-15 [in] -- Additional event parameter holders EventFlow [out] -- Set to 1 or 0 so the calling event knows whether or not to chain forward. See comments in EVENT_SETUP insert History (Date, Initials, Notes) 05/11/22 DPC Original programmer. ***********************************************************************************************************************/ #pragma precomp SRP_PreCompiler #window NDW_FQA_MAT_SCAN $insert EVENT_SETUP $insert LOGICAL $insert MSG_EQUATES $insert POPUP_EQUATES $insert REACT_RUN_EQUATES $insert RDS_EQUATES $insert WO_MAT_EQUATES $insert APPCOLORS $insert MESSAGE_BOX_EQUATES Equ CRLF$ to \0D0A\ Equ MSG_WIDTH$ to 600 Equ EditTable$ to @Window:'.OLE_EDT_SCANDATA' Equ Cassette1$ to @Window:'.EDL_CASSETTE1_SCAN' Equ Cassette2$ to @Window:'.EDL_CASSETTE2_SCAN' Equ Supplier$ to @Window:'.EDL_SUPPLIER_SCAN' Declare subroutine Set_Property, Send_Event, Post_Event, Send_Message, SendMessage, Error_Services Declare subroutine Obj_Wo_Mat_Log, Errmsg, Utility, SRP_Show_Window, Material_Movement_Services, Set_Status Declare function Get_Property, Send_Message, SendMessage, Material_Movement_Services, Error_Services, Declare function Popup, obj_WO_Mat, Database_Services, Utility, Rds_Services, Message_Box *Subclass = @Window : '.OLE_SUBCLASS' // Update the arguments so that the OpenInsight OLE event will treate the ActiveX event as a native event handler. If Event EQ 'OLE' then Transfer Event to OIEvent Transfer Param1 to Event Transfer Param2 to Param1 Transfer Param3 to Param2 Transfer Param4 to Param3 Transfer Param5 to Param4 Transfer Param6 to Param5 Transfer Param7 to Param6 Transfer Param8 to Param7 end GoToEvent Event for CtrlEntId else // Event not implemented end Return EventFlow or 1 *global ScanField = '' //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Events //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Event WINDOW.CREATE(CreateParam) * CurrVer = Xlate('APP_INFO', 'LSL2_VERSION', '', 'X') * UserVer = Xlate('LSL_USERS', @User4, 'LSL2_VERSION', 'X') * If UserVer NE CurrVer then * // Error message and close form * ErrMsg = 'OpenInsight Version Error':@FM:'You are running an outdated version of OpenInsight and cannot release material until you restart your session.' * Msg(@Window, '', 'OK', '', ErrMsg) * Post_Event(@Window, 'CLOSE') * end else GoSub SetupOLEControls GoSub ResetForm SRP_Show_Window(@Window, '', 'C', 'C', 1, '', False$, False$, FormSize) MsgStruct = '' MsgStruct = MSG_WIDTH$ * end end event Event OLE_BTN_CLEAR.OnClick(Point, Button, Shift, Ctrl) *get count of unprocessed records allCompleted = True$ resp = '' Data = Get_Property(EditTable$, "OLE.ARRAY") cnt = count(Data<1>, @VM) + (Data<1># '') for i = 1 to cnt while allCompleted EQ True$ cntProc = 0 status = Data<4,i> If status NE 'Completed' then allCompleted = False$ end next if allCompleted NE True$ then resp = Message_Box(@Window, 'There are unsaved records in grid - continue?', 'Confirm Reset', MSG_BTN_OKCAN$ + MSG_DEFAULT2$) end if allCompleted EQ True$ OR resp EQ True$ then rv = Send_Message(EditTable$, "OLE.Clear", 2) if rv EQ '' then GoSub ResetForm end end end event Event OLE_BTN_SAVE.OnClick(Point, Button, Shift, Ctrl) *check for unfinished scan F1 = Get_Property(Cassette1$, 'TEXT') F2 = Get_Property(Cassette2$, 'TEXT') F3 = Get_Property(Supplier$, 'TEXT') resp = True$ If F1 NE '' OR F2 NE '' OR F3 NE '' then resp = Message_Box(@Window, 'You have an unfinished scan (not in grid) - continue?', 'Confirm Save', MSG_BTN_OKCAN$ + MSG_DEFAULT2$) end if resp EQ True$ Then Warehouse = '1K' Location = 'PTI' Gosub SaveRecords end end event Event EDL_CASSETTE1_SCAN.LOSTFOCUS(Flag, FocusID) ScanField = 'Cassette1' If Flag EQ 1 then ScanData = Get_Property(CtrlEntID, 'TEXT') If ScanData NE '' then ScanData = Material_Movement_Services('ProcessFQAScanData', ScanData, 'CASSETTE1') If Error_Services('NoError') then Set_Property(CtrlEntID, 'TEXT', ScanData) Set_Property(Cassette2$, 'ENABLED', True$) Set_Property(Cassette2$, 'FOCUS', True$) Set_Property(CtrlEntID, 'ENABLED', False$) Gosub ValidateGrid end else GoSub ResetForm ErrorMessage = Error_Services('GetMessage') Msg(@Window, MsgStruct, 'PROCESS_ERROR', '', ErrorMessage) end end end end event Event EDL_CASSETTE2_SCAN.LOSTFOCUS(Flag, FocusID) ScanField = 'Cassette2' If Flag EQ 1 then ScanData = Get_Property(CtrlEntID, 'TEXT') Cass1 = Get_Property(Cassette1$, 'TEXT') retVal = Set_Property(@window, '@IsEpp', False$) If ScanData[1,1] = 'O' OR ScanData[1,3] = '1TO' then retVal = Set_Property(@window, '@IsEpp', True$) end If ScanData NE '' then ScanData = Material_Movement_Services('ProcessFQAScanData', ScanData, 'CASSETTE2', Cass1) If Error_Services('NoError') then * IF EPP, prepopulate lot and just validate If Get_Property(@window, '@IsEpp') EQ True$ then Set_Property(CtrlEntID, 'TEXT', ScanData) Set_Property(Supplier$, 'TEXT', 'EpiPRO') Gosub ValidateGrid Set_Property(Supplier$, 'ENABLED', False$) Set_Property(Cassette1$, 'FOCUS', True$) Gosub ValidateGrid end else Set_Property(CtrlEntID, 'TEXT', ScanData) Gosub ValidateGrid Set_Property(Supplier$, 'ENABLED', True$) Set_Property(Supplier$, 'FOCUS', True$) Set_Property(CtrlEntID, 'ENABLED', False$) Gosub ValidateGrid end end else GoSub ResetForm ErrorMessage = Error_Services('GetMessage') Msg(@Window, MsgStruct, 'PROCESS_ERROR', '', ErrorMessage) end end end end event Event EDL_SUPPLIER_SCAN.LOSTFOCUS(Flag, FocusID) ScanField = 'Lot' If Flag EQ 1 then Cassette1 = Get_Property(Cassette1$, 'TEXT') ScanData = Get_Property(CtrlEntID, 'TEXT') If ScanData NE '' then ScanData = Material_Movement_Services('ProcessFQAScanData', ScanData, 'SUPPLIER', Cassette1) If Error_Services('NoError') then Set_Property(CtrlEntID, 'TEXT', ScanData) Set_Property(CtrlEntID, 'ENABLED', False$) Gosub ValidateGrid end else GoSub ResetForm ErrorMessage = Error_Services('GetMessage') Msg(@Window, MsgStruct, 'PROCESS_ERROR', '', ErrorMessage) end end end end event //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Internal Gosubs //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// SaveRecords: *iterate thround all records in the grid, saving them and updating the status and location Data = Get_Property(EditTable$, "OLE.ARRAY") cnt = count(Data<1>, @VM) + (Data<1># '') MsgStruct = '' MsgStruct = MSG_WIDTH$ cntProc = 0 err = '' for i = 1 to cnt status = Data<4,i> If status NE 'Completed' then Material_Movement_Services('SaveRecord', Data<1,i>, Warehouse, Location, @User4) If Error_Services('NoError') then Status = 'Completed' Loc = '1K*PTI' Set_Property(EditTable$, 'OLE.CellColors[ALL;':i:']', 'Auto':@FM:'Auto') cntProc += 1 end else Status = 'Error' Set_Property(EditTable$, 'OLE.CellColors[ALL;':i:']', 'Auto':@FM:'Red') end Set_Property(EditTable$, 'OLE.CELLTEXT[4;':i:']', Status) Set_Property(EditTable$, 'OLE.CELLTEXT[5;':i:']', Loc) end Next i If Error_Services('NoError') then plural = '' if cntProc GT 1 then plural='s' if cntProc EQ 0 then Msg(@Window, MsgStruct, 'PROCESS_COMPLETE', '', 'No records saved - nothing was incomplete') end else if cntProc EQ cnt then Msg(@Window, MsgStruct, 'PROCESS_COMPLETE', '', 'All records successfully saved.') end else Msg(@Window, MsgStruct, 'PROCESS_COMPLETE', '', cntProc:' record':plural: ' out of ':cnt:' sucessfully saved') end end else ErrorMessage = Error_Services('GetMessages') Msg(@Window, MsgStruct, 'PROCESS_COMPLETE', '', cntProc:' record':plural: ' out of ':cnt:' sucessfully saved, but error condintion hit - ':ErrorMessage) end Gosub DisableFormControls return ValidateGrid: F1 = Get_Property(Cassette1$, 'TEXT') F2 = Get_Property(Cassette2$, 'TEXT') F3 = Get_Property(Supplier$, 'TEXT') *check grid to make sure RDS not already in there Data = Get_Property(EditTable$, "OLE.ARRAY") result = 0 if ScanField NE 'Lot' then ; * do not look for duplicates for lot Locate ScanData In Data<1> Using @VM Setting POS then result = 1 end end * if ScanField = 'Lot' then ; * do not look for duplicates * result = 0 * end else * result = InList(Data, ScanData, @VM) OR InList(Data, ScanData, @FM) * end If INDEX(F1,'.',2) then RDSType = 'EPP' WOMatKey = Field(F1, '.', 1):'*':Field(F1, '.', 3) end else RDSType = 'SIC' WOMatKey = Xlate('RDS', F1, 'WO_MAT_KEY', 'X') end Convert '.' to '*' in F1 Begin Case Case RDSType EQ 'SIC' WOMatKey = XLATE('RDS',F1, 'WO_MAT_KEY', '', '') Location = XLATE('WO_MAT', WOMatKey, 'CURR_LOCATION', '', '') Case RDSType EQ 'EPP' WOMatKey = FIELD(F1,'*',1):'*':FIELD(F1,'*',3) Location = XLATE('WO_MAT', WOMatKey, 'CURR_LOCATION', '', '') End Case if result EQ 1 then ErrorMessage = 'Value already exists in grid: ':ScanData Msg(@Window, MsgStruct, 'PROCESS_ERROR', '', ErrorMessage) Gosub ResetForm end else if F1 NE '' AND F2 NE '' AND F3 NE '' then // Add Material Log Entry CurrDTM = OCONV(Date(),'D2/'):' ':OCONV(Time(),'MTS') UserID = @USER4 LogFile = 'WO_MAT' ;* Changed so all scans are logged in the WO_MAT table 12/3/2006 Action = 'LBLCHK' ;* Final label check for same top and bottom and correct Lot Number on WO_MAT record WHCd = 'CR' ;* Clean room @ final QA LocCd = 'PKO' ;* QA wants this to "place" the cassette into the outbound passthrough WONo = Field(WOMatKey, '*', 1) CassNo = Field(WOMatKey, '*', 2) Set_Status(0) obj_WO_Mat_Log('Create',LogFile:@RM:CurrDTM:@RM:Action:@RM:WhCd:@RM:LocCd:@RM:WONo:@RM:CassNo:@RM:UserID:@RM:'Match') IF Get_Status(errCode) THEN Errmsg(errCode) END else // Insert row into OLE edit table to provide user feedback. Data = '' Data<1> = F1:@VM:F2:@VM:F3:@VM:'Completed':@VM:Location:@VM Send_Message(EditTable$, 'OLE.INSERT', 1, Data) GoSub ResetForm end end return DisableFormControls: Set_Property(@Window:'.EDL_CASSETTE1_SCAN', 'TEXT', '') Set_Property(@Window:'.EDL_CASSETTE2_SCAN', 'TEXT', '') Set_Property(@Window:'.EDL_SUPPLIER_SCAN', 'TEXT', '') Set_Property(@Window:'.EDL_CASSETTE1_SCAN', 'ENABLED', False$) Set_Property(@Window:'.EDL_CASSETTE2_SCAN', 'ENABLED', False$) Set_Property(@Window:'.EDL_SUPPLIER_SCAN', 'ENABLED', False$) return SetupOLEControls: // Qualify OLE events that we want to intercept Qualifier = '' Qualifier<1> = 1 Qualifier<3> = '' Qualifier<4> = 0 ; * process synchronously NumCols = 4 NumRows = 150 Ctrl = @Window:'.OLE_BTN_CLEAR' Send_Message(Ctrl, 'QUALIFY_EVENT', 'OLE.OnClick', Qualifier) Ctrl = @Window:'.OLE_BTN_SAVE' Send_Message(Ctrl, 'QUALIFY_EVENT', 'OLE.OnClick', Qualifier) DimensionArray = NumCols:@FM:NumRows Set_Property(EditTable$, "OLE.Dimension", DimensionArray) Titles = "Top Label":@VM:"Bottom Label":@VM:"Sub Lot":@VM:"Scan Status" Set_Property(EditTable$, "OLE.TitleList", Titles) Set_Property(EditTable$, "OLE.DataColumn[1-2]", '85') Set_Property(EditTable$, "OLE.DataColumn[3]", '80') Set_Property(EditTable$, "OLE.DataColumn[4]", '90') AlignArray = 'C':@FM:'C':@FM:'L' Set_Property(EditTable$, "OLE.CellAlignment[All; All]", AlignArray) Set_Property(EditTable$, "OLE.HeaderAlignment[All; All]", AlignArray) HeaderFontArray = 'Segoe UI':@SVM:8:@SVM:700 Set_Property(EditTable$, "OLE.HeaderFont[All; All]", HeaderFontArray) Set_Property(EditTable$, "OLE.CellFont[All; All]", 'Segoe UI':@SVM:8) AutoNumArray = '' AutoNumArray<1, 1> = 'I' ; // Integers AutoNumArray<1, 2> = 1 ; // Starting integer Set_Property(EditTable$, "OLE.AutoNumbers", AutoNumArray) Set_Property(EditTable$, "OLE.CellProtection[All; All]", 'SEL') SelStyleArray = 'Black' : @VM : OI_HOT_BLUE$ : ' L=70' : @FM : 'Black' : @VM : OI_HOT_BLUE$ Set_Property(EditTable$, 'OLE.SelectionStyle', SelStyleArray) ; // Automatically highlight the current row with one color and highlight the current row with another color. return ResetForm: Set_Property(@Window:'.EDL_CASSETTE1_SCAN', 'ENABLED', True$) Set_Property(@Window:'.EDL_CASSETTE2_SCAN', 'ENABLED', True$) Set_Property(@Window:'.EDL_SUPPLIER_SCAN', 'ENABLED', True$) Set_Property(@Window:'.EDL_CASSETTE1_SCAN', 'TEXT', '') Set_Property(@Window:'.EDL_CASSETTE2_SCAN', 'TEXT', '') Set_Property(@Window:'.EDL_SUPPLIER_SCAN', 'TEXT', '') Set_Property(@Window:'.EDL_CASSETTE1_SCAN', 'ENABLED', True$) Set_Property(@Window:'.EDL_CASSETTE2_SCAN', 'ENABLED', False$) Set_Property(@Window:'.EDL_SUPPLIER_SCAN', 'ENABLED', False$) Set_Property(@Window:'.EDL_CASSETTE1_SCAN', 'FOCUS', True$) Data = Get_Property(EditTable$, "OLE.ARRAY") cnt = count(Data<1>, @VM) + (Data<1># '') Set_Property(@Window:'.OLE_BTN_SAVE', 'ENABLED', cnt GE 1) Set_Property(EditTable$, 'OLE.CellColors[ALL;All]', 'Auto':@FM:'Auto') return