202 lines
		
	
	
		
			7.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			202 lines
		
	
	
		
			7.5 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| Compile function NDW_VERIFY_BARCODE_EVENTS(CtrlEntId, Event, @PARAMS)
 | |
| 
 | |
| /***********************************************************************************************************************
 | |
| 
 | |
|     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 Infineon.
 | |
| 
 | |
|     Name        :   NDW_NDW_VERIFY_BARCODE_Events
 | |
| 
 | |
|     Description :   This function acts as a commuter module for all events related to this window.
 | |
| 
 | |
|     Notes       :   Commuter Modules are automatically called from the Promoted_Events function which is called by the
 | |
|                     application-specific promoted event handler. This makes it possible to add QuickEvents that need to
 | |
|                     execute Basic+ logic without having use the Form Designer to make the association, although this is
 | |
|                     limited to the events which are currently promoted.
 | |
| 
 | |
|                     If the form needs to call the commuter module directly then the QuickEvent parameters should be
 | |
|                     formatted like this:
 | |
| 
 | |
|                         '@SELF','@EVENT',['@PARAM1','@PARAMx']
 | |
| 
 | |
|     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)
 | |
|         08/29/2024    djm     Created initial commuter module. Adapted from NDW_PACKAGING_EVENTS.
 | |
|                                             
 | |
| ***********************************************************************************************************************/
 | |
| #pragma precomp SRP_PreCompiler
 | |
| #window NDW_VERIFY_BARCODE
 | |
| 
 | |
| $insert APP_INSERTS
 | |
| $insert EVENT_SETUP  
 | |
| $insert MSG_EQUATES
 | |
| $insert LSL_USERS_EQUATES
 | |
| $insert MESSAGE_BOX_EQUATES
 | |
| $insert SRP_POPUP_EQUATES
 | |
| $INSERT LOGICAL
 | |
| 
 | |
| Equ MSG_WIDTH$ to 600
 | |
| 
 | |
| Declare subroutine  SRP_Show_Window, ErrMsg, PlaceDialog
 | |
| Declare function    Database_Services, Security_Services, MemberOf, Form_Services, Scan_Services
 | |
| Declare function    Message_Box, SRP_Get_Window_Rect, GetTickCount, Ncr_Services
 | |
| 
 | |
| SubclassInfo    = Form_Services('FindSubclassControl')
 | |
| Subclass        = SubclassInfo<1>
 | |
| 
 | |
| // 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
 | |
| end
 | |
| 
 | |
| GoToEvent Event for CtrlEntId else
 | |
|     // Event not implemented
 | |
| end
 | |
| 
 | |
| Return EventFlow or 1
 | |
| 
 | |
| //-----------------------------------------------------------------------------
 | |
| // EVENT HANDLERS
 | |
| //-----------------------------------------------------------------------------
 | |
| 
 | |
| Event WINDOW.CREATE(CreateParam)
 | |
|     
 | |
| 	Gosub GetLotID
 | |
| 	Set_Property(@Window:'.EDL_CASS_SCAN_1', 'ENABLED', True$)
 | |
|     Set_Property(@Window:'.EDL_CASS_SCAN_1', 'FOCUS', True$)
 | |
| 	PlaceDialog(-2, -2)
 | |
| 	
 | |
| end event
 | |
|  
 | |
| 
 | |
| Event EDL_CASS_SCAN_1.LOSTFOCUS(Flag, FocusID)
 | |
|     
 | |
|     If Flag EQ 1 then
 | |
|         ScanData = Get_Property(CtrlEntID, 'TEXT')
 | |
|         ExpectedLot = Get_Property(@Window:'.EDL_LOT_ID', 'TEXT')
 | |
|         OperatorID  = @User4
 | |
|         If ScanData NE '' then
 | |
|         	
 | |
|             If Parent EQ 'WM_IN' then
 | |
|                 ScanData = NCR_Services('ProcessScanData', ScanData, 'WM_IN_1', ExpectedLot, OperatorID)
 | |
|             end else
 | |
| 			    ScanData = NCR_Services('ProcessScanData', ScanData, 'CASSETTE_1', ExpectedLot, OperatorID)
 | |
| 			End
 | |
|             If Error_Services('NoError') then
 | |
|                 Set_Property(CtrlEntID, 'TEXT', ScanData)
 | |
|                 Set_Property(@Window:'.EDL_CASS_SCAN_2', 'ENABLED', True$)
 | |
|                 Set_Property(@Window:'.EDL_CASS_SCAN_2', 'FOCUS', True$)
 | |
|                 Set_Property(CtrlEntID, 'ENABLED', False$)
 | |
|             end else
 | |
|                 GoSub ClearForm
 | |
|                 ErrorMessage = Error_Services('GetMessage')
 | |
|                 MsgStruct = "" 
 | |
|                 MsgStruct<MTEXTWIDTH$> = MSG_WIDTH$
 | |
|                 Msg(@Window, MsgStruct, 'PROCESS_ERROR', '', ErrorMessage)
 | |
|                 Set_Property(CtrlEntId, 'FOCUS', True$)
 | |
|             end
 | |
|         end 
 | |
|     end
 | |
|     
 | |
| end event
 | |
| 
 | |
| 
 | |
| Event EDL_CASS_SCAN_2.LOSTFOCUS(Flag, FocusID)
 | |
| 
 | |
| 	If Flag EQ 1 then
 | |
| 		
 | |
| 		ScanData = Get_Property(CtrlEntID, 'TEXT')
 | |
| 		If ScanData NE '' then
 | |
| 			FirstCassID = Get_Property(@Window:'.EDL_CASS_SCAN_1', 'TEXT')
 | |
| 			OperatorID  = @User4
 | |
| 			
 | |
| 			If Parent EQ 'WM_IN' then
 | |
|                 ScanData = NCR_Services('ProcessScanData', ScanData, 'WM_IN_2', FirstCassID, OperatorID)
 | |
|             end else
 | |
| 			    ScanData = NCR_Services('ProcessScanData', ScanData, 'CASSETTE_2', FirstCassID, OperatorID)
 | |
| 			End
 | |
| 			If Error_Services('NoError') then
 | |
| 				Set_Property(CtrlEntID, 'TEXT', ScanData)
 | |
| 			    SuccessMessage = 'NCR verification complete!'
 | |
|                 MsgStruct = "" 
 | |
|                 MsgStruct<MTEXTWIDTH$> = MSG_WIDTH$
 | |
|                 Msg(@Window, MsgStruct, 'PROCESS_COMPLETE', '', SuccessMessage)  
 | |
| 				End_Dialog(@Window, True$)
 | |
| 			end else
 | |
| 			    ErrorMessage = Error_Services('GetMessage')
 | |
| 			    If IndexC(ErrorMessage, 'Unrecognized scan data:', 1) or IndexC(ErrorMessage, 'Error reading sequence information', 1) then
 | |
| 			    	Set_Property(@Window:'.EDL_CASS_SCAN_2', 'TEXT', '')
 | |
|                     MsgStruct = "" 
 | |
|                     MsgStruct<MTEXTWIDTH$> = MSG_WIDTH$
 | |
|                     Msg(@Window, MsgStruct, 'PROCESS_ERROR', '', ErrorMessage)
 | |
|                     Set_Property(CtrlEntId, 'FOCUS', True$)
 | |
| 			    end else
 | |
|                     GoSub ClearForm
 | |
|                     MsgStruct = "" 
 | |
|                     MsgStruct<MTEXTWIDTH$> = MSG_WIDTH$
 | |
|                     Msg(@Window, MsgStruct, 'PROCESS_ERROR', '', ErrorMessage)
 | |
|                     If Count(ErrorMessage, 'NCR Label verification failed due to mismatched barcodes.') NE 0 then
 | |
|                         End_Dialog(@Window, False$)
 | |
|                     End else
 | |
|                     	Set_Property(@Window:'.EDL_CASS_SCAN_1', 'FOCUS', True$)
 | |
|                     end			    	
 | |
| 			    end
 | |
| 		    end
 | |
| 		end
 | |
| 	end
 | |
|     
 | |
| end event
 | |
| 
 | |
| 
 | |
| Event PUB_ENG_OVERRIDE.CLICK()
 | |
| 	
 | |
| 	VerifyParams = @USER4 : @FM : 'ENGINEERING':@VM:'ENG_TECH' : @FM : '' : @FM : 'Override required by a member of ENGINEERING or ENG_TECH groups'
 | |
| 	Response     = Dialog_Box('NDW_VERIFY_USER', @WINDOW, VerifyParams)
 | |
| 	Valid        = Response<1>
 | |
| 	OverrideUser = Response<2>
 | |
| 	
 | |
| 	If Valid then
 | |
| 		End_Dialog(@Window, True$)
 | |
| 	end
 | |
| 	
 | |
| end event
 | |
| 
 | |
| 
 | |
| Event PUB_CANCEL.CLICK()
 | |
| 	
 | |
| 	End_Dialog(@Window, False$)
 | |
| 	
 | |
| end event
 | |
| 
 | |
| ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 | |
| // Internal GoSubs
 | |
| ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 | |
| 
 | |
| ClearForm:
 | |
|     
 | |
|     Set_Property(@Window:'.EDL_CASS_SCAN_1'      , 'TEXT'   , '')
 | |
|     Set_Property(@Window:'.EDL_CASS_SCAN_2'      , 'TEXT'   , '')
 | |
|     Set_Property(@Window:'.EDL_CASS_SCAN_1'      , 'ENABLED',  1)
 | |
|     Set_Property(@Window:'.EDL_CASS_SCAN_2'      , 'ENABLED', -1)
 | |
|     Set_Property(@Window:'.EDL_LOT_ID'  	     , 'ENABLED', -1) 
 | |
| 
 | |
| return
 | |
| 
 | |
| GetLotID:
 | |
| 	
 | |
| 	LotID = Param1
 | |
| 	Set_Property(@Window:'.EDL_LOT_ID', 'TEXT', LotID)
 | |
| 		
 | |
| return
 | |
| 
 | |
| 
 |