admin 發表於 2017-11-23 08:12:58

Overview - Purchase Requisition Lines rmb Change to Planned

Overview - Purchase Requisition Lines rmb Change to P&lanned<總覽 - 請購單項次 rmb 變更至計畫中>


PM_DataRecordStateEvent 運用
Menu Item: Change to P&lanned
      Resource Id: 23077
      Keyboard Accelerator: (none)
      Status Text: Change the selected Requisitions to Planned
      Menu Settings
                Enabled when: SalSendMsg( hWndForm, PM_DataRecordStateEvent, METHOD_Inquire, SalHStringToNumber( 'ChangeToPlanned' ) )
                Checked when:
      Menu Actions
                Call PostMessage( hWndForm, PM_DataRecordStateEvent, METHOD_Execute, 'ChangeToPlanned')
      Menu Item Name:
Function: UserMethod
      Description:
      Returns
                Number:
      Parameters
                Number: nWhat
                String: sMethod
      Static Variables
      Local variables
                String: sRequiNo
                String: sRequisitionState
                String: sAuthCode
                String: sReqNoArray[*]
                String: sLineNoArray[*]
                String: sReleaseNoArray[*]
      Actions
                If nWhat = METHOD_Execute

                        If sMethod = 'Release'

                        Else If sMethod = 'ChangeToPlanned'
      Select Case AlertBox (TranslateConstant(TEXT_FreezeREQ), CAPTION_Information, INFO_OkCancel)
                Case IDCANCEL
                        Break
                Case IDOK
                        Call SalSendMsg( hWndForm, PM_DataRecordStateEvent, METHOD_Execute, SalHStringToNumber( 'ChangeToPlanned' ) )
                        Call RefreshRecord()


PM_DataRecordStateEventFunction: DataRecordExecuteStateEvent
      Description: The DataRecordExecuteStateEvent function executes a state event in the server for
                        a record.
                        COMMENTS:
                        DataRecordExecuteStateEvent is called once for each selected record by the
                        DataSourceExecuteSqlStateEvent function.
      Returns
                Boolean:
                ! The return value is TRUE if the state event is executed successfully, FALSE otherwise.
      Parameters
                Sql Handle: hSql
                        ! Sql handle
                                        Database connection sql handle to use for this server function call. Typically c_hSql is used.
                String: sEvent
                        ! Event name
                                        Name of event to execute. This event is converted using client->server naming conventions
                                        to procudce the name of the server method to call.
      Static Variables
      Local variables
      Actions
                If (p_sPackageName != strNULL)
                        Set __lsAttr = strNULL
                        Call _SetAction( ACTION_Do )
                        If DbPLSQLBlock( hSql, p_sPackageName || '.' || ClientNameToDbName( sEvent ) || "__( :__lsResult, :__sObjid, :__lsObjversion, :__lsAttr, :__sAction )" )
                              If HandleSqlResult( __lsResult )
                                        Call DataRecordToForm( __lsAttr, FALSE )
                                        Return TRUE
                              Else
                                        Return FALSE
                        Else
                              Return FALSE
                Else
                        Return TRUECall _SetAction( ACTION_Do )
If DbPLSQLBlock( hSql, p_sPackageName || '.' || ClientNameToDbName( sEvent ) || "__( :__lsResult, :__sObjid, :__lsObjversion, :__lsAttr, :__sAction )" )
***** ChangeToPlanned -->ClientNameToDbName( sEvent )-->CHANGE_TO_PLANNED__ ****
Client DB call      06:10:36.89 (+0.00)      Action = 'DO'
Client DB call      06:10:36.89 (+0.00)      DbPLSQLBlock( 'IFSAPP.PURCHASE_REQ_LINE_API.CHANGE_TO_PLANNED__( :__lsResult, :__sObjid, :__lsObjversion, :__lsAttr, :__sAction )' )

ClientNameToDbName( sEvent )
Function: ClientNameToDbName
      Description: The ClientNameToDbName converts an object name from server name conventions
                        to client FrameWork name conventions.
                        COMMENTS:
                        This function works by adding an underscore (_) before all uppercase characters
                        (except the first character) and then converting the name to uppercase. For example
                        ClientNameToDbName( 'OrderItem' ) -> 'ORDER_ITEM'.
                        
                        Use function DbNameToClientName to perform the reverse conversion.
      Returns
                String:
                ! The return value is object name with server name conventions.
      Parameters
                String: sClientName
                        ! Object name
                                        The object name with client FrameWork name conventions.
      Static Variables
      Local variables
                Number: nChar
                String: sDbName
                Boolean: bFirstInName
                Number: nUnderscoreCnt
      Actions
                Set bFirstInName = TRUE
                Set nUnderscoreCnt = 0
                While SalStrFirstC( sClientName, nChar )
                        If nChar = 0
                              Break
                        If nChar = 95
                              Set nUnderscoreCnt = nUnderscoreCnt+1
                        Else
                              If nChar >= 65 And nChar <= 90 And not bFirstInName
                                        Set sDbName = sDbName||'_' || SalNumberToChar(nChar)
                              Else
                                        Set sDbName = sDbName || SalNumberToChar(nChar)
                              Set bFirstInName = FALSE
                Select Case nUnderscoreCnt
                        Case 1
                              Set sDbName = sDbName || '_'
                              Break
                        Case 2
                              Set sDbName = sDbName ||'__'
                              Break
                Return SalStrUpperX( sDbName )


頁: [1]
查看完整版本: Overview - Purchase Requisition Lines rmb Change to Planned