Files
open-insight/LSL2/STPROC/NDW_RDS_SUPPLEMENT_EVENTS.txt
2024-03-25 14:46:21 -07:00

310 lines
13 KiB
Plaintext

Function NDW_RDS_Supplement_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 : DBW_RDS_Supplement_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)
05/23/18 djs Created initial commuter module.
***********************************************************************************************************************/
#pragma precomp SRP_PreCompiler
#Window NDW_RDS_SUPPLEMENT
$insert APP_INSERTS
$insert EVENT_SETUP
$insert WO_MAT_EQUATES
$insert MSG_EQUATES
Declare subroutine SRP_EditTable_Manager, SRP_Show_Window, Rds_Services
Declare function SRP_EditTable_Manager, Database_Services, Material_Services, Rds_Services, RGB
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
* 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
Return EventFlow else EVENT_CONTINUE$
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Events
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Event WINDOW.CREATE(CreateParam)
ThisWorkOrderNo = CreateParam
RDSList = RDS_Services('GetRDSList', ThisWorkOrderNo)
RDSRptCtrl = @Window : '.OLE_RPT_RDS_LIST'
GoSub Setup_OLE_Controls
// Turn off AutoPopulate for performance reasons
Set_Property(@Window, RDSRptCtrl, 'OLE.AutoPopulate', False$)
SRP_Show_Window(@Window, '', 'C', 'C', 1, '', False$, False$, FormSize)
// Turn AutoPopulate back on
Set_Property(@Window, RDSRptCtrl, 'OLE.AutoPopulate', True$)
end event
Event WINDOW.CLOSE(CancelFlag)
Result = ''
// Perhaps add a savewarn prompt if list has been edited.
End_Dialog(@Window, Result)
end event
Event PUB_OK.CLICK()
Result = ''
RDSList = Get_Property(@Window : '.OLE_RPT_RDS_LIST', 'OLE.List')
OrigList = Get_Property(@Window, '@OrigList')
If RDSList EQ OrigList then
End_Dialog(@Window, Result)
end event
end
// Save supplement info to RDS table.
SupplList = ''
NumRows = DCount(RDSList, @FM)
For Index = 1 to NumRows
SupplList<Index,1> = RDSList<Index,5>
SupplList<Index,2> = RDSList<Index,20>
Next Index
Rds_Services('SetSupplement', SupplList, Username)
End_Dialog(@Window, Result)
end event
Event PUB_CANCEL.CLICK()
Result = ''
// Perhaps add a savewarn prompt if list has been edited.
End_Dialog(@Window, Result)
end event
Event PUB_ADD.CLICK()
SelList = Get_Property(@Window : '.OLE_RPT_RDS_LIST', 'OLE.SelList')
RDSList = Get_Property(@Window : '.OLE_RPT_RDS_LIST', 'OLE.List')
CurrSuppl = ''
// Grab first supplement in selected list to pass into Add Supplement form.
For each Row in SelList using @FM
If Row<1,20> NE '' then
CurrSuppl = Row<1,20>
end
until CurrSuppl NE ''
Next Row
// Prompt user for supplement information
Response = Dialog_Box('NDW_ADD_SUPPLEMENT', @WINDOW, CurrSuppl)
Save = Response<1>
Instructions = Response<2>
If Save EQ True$ then
// Insert Instructions into selected rows' Supplement cell
For each Row in SelList using @FM
Locate Row in RDSList Using @FM Setting Pos then
RDSList<Pos,20> = Instructions
end
Next Row
end
GoSub RefreshRowColors
end event
Event PUB_REMOVE.CLICK()
SelList = Get_Property(@Window : '.OLE_RPT_RDS_LIST', 'OLE.SelList')
RDSList = Get_Property(@Window : '.OLE_RPT_RDS_LIST', 'OLE.List')
// Insert empty string into selected rows' Supplement cell to clear it
For each Row in SelList using @FM
Locate Row in RDSList Using @FM Setting Pos then
RDSList<Pos,20> = ''
end
Next Row
GoSub RefreshRowColors
end event
Event PUB_SELECT_ALL.CLICK()
RDSList = Get_Property(@Window : '.OLE_RPT_RDS_LIST', 'OLE.List')
NumRows = DCount(RDSList, @FM)
SelPos = ''
For Index = 1 to NumRows
If Index LT NumRows then
SelPos := Index:@FM
end else
SelPos := Index
end
Next Index
Set_Property(@Window : '.OLE_RPT_RDS_LIST', 'OLE.SelPos', SelPos)
Set_Property(@Window : '.OLE_RPT_RDS_LIST', 'OLE.Focus', True$)
end event
Event PUB_CLEAR.CLICK()
// Clear any selected rows
SelPos = ''
Set_Property(@Window : '.OLE_RPT_RDS_LIST', 'OLE.SelPos', SelPos)
end event
Event OLE_SUBCLASS.OnComboClick(CtrlId, Sel, Value)
Send_Event(CtrlId, 'LOSTFOCUS')
end event
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Internal GoSubs
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Setup_OLE_Controls:
Qualify = ''
Qualify<1> = 1
Qualify<4> = 0
RDSRptCtrl = @Window : '.OLE_RPT_RDS_LIST'
RDSPicCtrl = @Window : '.OLE_PIC_RDS_LIST_DIV'
ColumnList = ''
ColumnList<1> = 'Customer' : @VM : 'TEXT' : @VM : 150 : @VM : @VM : @VM : @VM : @VM : @VM : 50 : @VM : 'Left' : @VM : @VM : @VM : @VM : 'Segoe UI,9'
ColumnList<2> = 'WO No' : @VM : 'NUMBER' : @VM : 50 : @VM : @VM : @VM : @VM : @VM : @VM : 50 : @VM : 'Center' : @VM : @VM : '#######' : @VM : @VM : 'Segoe UI,9'
ColumnList<3> = 'Step' : @VM : 'NUMBER' : @VM : 30 : @VM : @VM : @VM : @VM : @VM : @VM : 30 : @VM : 'Center' : @VM : @VM : '##': @VM : @VM : 'Segoe UI,9'
ColumnList<4> = 'Run' : @VM : 'NUMBER' : @VM : 30 : @VM : @VM : @VM : @VM : @VM : @VM : 30 : @VM : 'Center' : @VM : @VM : '###' : @VM : @VM : 'Segoe UI,9'
ColumnList<5> = 'RDS' : @VM : 'NUMBER' : @VM : 50 : @VM : @VM : @VM : @VM : @VM : @VM : 50 : @VM : 'Center' : @VM : @VM : '#######' : @VM : @VM : 'Segoe UI,9'
ColumnList<6> = 'Rx' : @VM : 'NUMBER' : @VM : 50 : @VM : @VM : @VM : @VM : @VM : @VM : 25 : @VM : 'Center' : @VM : @VM :'##': @VM : @VM : 'Segoe UI,9'
ColumnList<7> = 'Idle Hrs' : @VM : 'TIME' : @VM : 75 : @VM : @VM : @VM : @VM : @VM : @VM : 50 : @VM : 'Center' : @VM : @VM : 'hh:mm' : @VM : @VM : 'Segoe UI,9'
ColumnList<8> = 'HgCv' : @VM : 'BOOL' : @VM : 55 : @VM : @VM : @VM : @VM : @VM : @VM : 40 : @VM : 'Center' : @VM : @VM : 'Yes' : @VM : @VM : 'Segoe UI,9'
ColumnList<9> = 'Date In' : @VM : 'DATE' : @VM : 60 : @VM : @VM : @VM : @VM : @VM : @VM : 60 : @VM : 'Center' : @VM : @VM : 'MM/DD/YY' : @VM : @VM : 'Segoe UI,9'
ColumnList<10> = 'Time In' : @VM : 'TIME' : @VM : 60 : @VM : @VM : @VM : @VM : @VM : @VM : 60 : @VM : 'Center' : @VM : @VM : 'hh:mmAA' : @VM : @VM : 'Segoe UI,9'
ColumnList<11> = 'Date Out' : @VM : 'DATE' : @VM : 60 : @VM : @VM : @VM : @VM : @VM : @VM : 60 : @VM : 'Center' : @VM : @VM : 'MM/DD/YY': @VM : @VM : 'Segoe UI,9'
ColumnList<12> = 'Time Out' : @VM : 'TIME' : @VM : 60 : @VM : @VM : @VM : @VM : @VM : @VM : 60 : @VM : 'Center' : @VM : @VM : 'hh:mmAA': @VM : @VM : 'Segoe UI,9'
ColumnList<13> = 'Elapsed' : @VM : 'TIME' : @VM : 50 : @VM : @VM : @VM : @VM : @VM : @VM : 50 : @VM : 'Center' : @VM : @VM : 'hh:mm' : @VM : @VM : 'Segoe UI,9'
ColumnList<14> = 'PO No' : @VM : 'TEXT' : @VM : 50 : @VM : @VM : @VM : @VM : @VM : @VM : 50 : @VM : 'Center' : @VM : @VM : @VM : @VM : 'Segoe UI,9'
ColumnList<15> = 'Cust Part No' : @VM : 'TEXT' : @VM : 75 : @VM : @VM : @VM : @VM : @VM : @VM : 75 : @VM : 'Center' : @VM : @VM : @VM : @VM : 'Segoe UI,9'
ColumnList<16> = 'Lot No' : @VM : 'TEXT' : @VM : 100 : @VM : @VM : @VM : @VM : @VM : @VM : 75 : @VM : 'Center' : @VM : @VM : @VM : @VM : 'Segoe UI,9'
ColumnList<17> = 'Combined Status' : @VM : 'TEXT' : @VM : 125 : @VM : @VM : @VM : @VM : @VM : @VM : 125 : @VM : 'Left' : @VM : @VM : @VM : @VM : 'Segoe UI,9'
ColumnList<18> = 'NCR Summary' : @VM : 'TEXT' : @VM : 125 : @VM : @VM : @VM : @VM : @VM : @VM : 30 : @VM : 'Center' : @VM : @VM : @VM : @VM : 'Segoe UI,9'
ColumnList<19> = 'Hold ' : @VM : 'TEXT' : @VM : 50 : @VM : @VM : @VM : @VM : @VM : @VM : 40 : @VM : 'Center' : @VM : @VM : @VM : @VM : 'Segoe UI,9'
ColumnList<20> = 'Supplement' : @VM : 'TEXT' : @VM : 300 : @VM : @VM : @VM : @VM : @VM : @VM : 150 : @VM : 'Left' : @VM : @VM : @VM : @VM : 'Segoe UI,9'
Set_Property(RDSRptCtrl, 'OLE.ColumnList', ColumnList)
Set_Property(RDSRptCtrl, 'OLE.MultiSelect', 2) ; // 2 = Multiselect Toggle Mode
// Get the design time form size. This will be adjusted based on the number of RDS records.
FormSize = Get_Property(@Window, 'SIZE')
RDSRptCtrlSize = Get_Property(RDSRptCtrl, 'SIZE')
NumRDS = DCount(RDSList, @FM)
// Adjust the form and ReportTable control size based on the number of RDS records in the work order.
AdditionalRowsAdj = 0
AdditionalRowsAdj += (NumRDS - 1) * 20
// Ensure window and controls are sized within client machine's max resolution.
ProposedNewHeight = FormSize<4> + AdditionalRowsAdj
SystemWindowSize = Get_Property('SYSTEM', 'SIZE')
MaxClientHeight = SystemWindowSize<4>
If ProposedNewHeight > MaxClientHeight then
FormSize<4> = Oconv(MaxClientHeight * '0.9', 'MD0')
end else
FormSize<4> = FormSize<4> + AdditionalRowsAdj
end
MaxClientWidth = SystemWindowSize<3>
If FormSize<3> > MaxClientWidth then
FormSize<3> = Oconv(MaxClientWidth * '0.9', 'MD0')
end
Set_Property(@Window, '@ORIGSIZE', FormSize)
// Pull then save original list after formatting for savewarn purposes
Set_Property(RDSRptCtrl, 'OLE.List', RDSList)
RDSList = Get_Property(@Window : '.OLE_RPT_RDS_LIST', 'OLE.List')
Set_Property(@Window, '@OrigList', RDSList)
GoSub RefreshRowColors
return
RefreshRowColors:
RDSRptCtrl = @Window : '.OLE_RPT_RDS_LIST'
NumRDS = DCount(RDSList, @FM)
// Fill report table with RDS data
Set_Property(RDSRptCtrl, 'OLE.List', RDSList)
// Color every other cell to increase row distinguishability
Colors = ''
If NumRDS GT 1 then
For RowNo = 1 To NumRDS
If Mod(RowNo, 2) EQ 1 then Colors<RowNo> = RGB(231, 243, 254) else Null ; // light blue
Next RowNo
Set_Property(RDSRptCtrl, 'OLE.RecordColors', Colors)
end
// Clear any selected rows
SelPos = ''
Set_Property(@Window : '.OLE_RPT_RDS_LIST', 'OLE.SelPos', SelPos)
return