added LSL2 stored procedures
This commit is contained in:
367
LSL2/STPROC/NDW_PTO_MAT_SCAN_EVENTS.txt
Normal file
367
LSL2/STPROC/NDW_PTO_MAT_SCAN_EVENTS.txt
Normal file
@ -0,0 +1,367 @@
|
||||
Function NDW_PTO_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_PTO_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)
|
||||
08/23/21 DPC Original programmer.
|
||||
|
||||
***********************************************************************************************************************/
|
||||
|
||||
#pragma precomp SRP_PreCompiler
|
||||
#window NDW_PTO_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
|
||||
$insert SRP_POPUP_EQUATES
|
||||
|
||||
Equ CRLF$ to \0D0A\
|
||||
Equ MSG_WIDTH$ to 600
|
||||
Equ Label1$ to @Window:'.EDL_LABEL1_SCAN'
|
||||
Equ Label2$ to @Window:'.EDL_LABEL2_SCAN'
|
||||
Equ SaveBtn$ to @Window:'.OLE_BTN_SAVE'
|
||||
Equ Popup$ to @Window:".OLE_POPUP"
|
||||
|
||||
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, Delay
|
||||
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, SRP_Get_Window_Rect
|
||||
|
||||
MsgStruct = ''
|
||||
MsgStruct<MTEXTWIDTH$> = MSG_WIDTH$
|
||||
|
||||
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)
|
||||
|
||||
GoSub SetupOLEControls
|
||||
GoSub ResetForm
|
||||
SRP_Show_Window(@Window, '', 'C', 'C', 1, '', False$, False$, FormSize)
|
||||
|
||||
end event
|
||||
|
||||
|
||||
Event OLE_BTN_CLEAR.OnClick(Point, Button, Shift, Ctrl)
|
||||
|
||||
gosub HidePopup
|
||||
|
||||
If Get_Property(Label1$, 'TEXT') NE '' AND Get_Property(Label2$, 'TEXT') NE '' then
|
||||
MsgHead = 'Record not saved'
|
||||
MsgText = 'Record has not been saved - are you sure you want to clear form?'
|
||||
OK = Msg(@WINDOW,'','YESNO','',MsgHead:@FM:MsgText)
|
||||
If OK then
|
||||
GoSub ResetForm
|
||||
end else
|
||||
Set_Property(@Window:'.OLE_BTN_CLEAR', 'ENABLED', True$)
|
||||
Set_Property(@Window:'.OLE_BTN_SAVE', 'ENABLED', True$)
|
||||
end
|
||||
end else
|
||||
GoSub ResetForm
|
||||
end
|
||||
|
||||
end event
|
||||
|
||||
|
||||
Event OLE_BTN_SAVE.OnClick(Point, Button, Shift, Ctrl)
|
||||
|
||||
Cassette1 = Get_Property(Label1$, 'TEXT')
|
||||
Cassette2 = Get_Property(Label2$, 'TEXT')
|
||||
Warehouse = '1K'
|
||||
Location = 'PTO'
|
||||
Gosub SaveRecord
|
||||
|
||||
end event
|
||||
|
||||
|
||||
Event EDL_LABEL1_SCAN.LOSTFOCUS(Flag, FocusID)
|
||||
|
||||
ScanField = 'Label1'
|
||||
If Flag EQ 1 then
|
||||
ScanData = Get_Property(CtrlEntID, 'TEXT')
|
||||
If ScanData NE '' then
|
||||
ScanData = Material_Movement_Services('ProcessPTOScanData', ScanData, 'LABEL1')
|
||||
If Error_Services('NoError') then
|
||||
Set_Property(CtrlEntID, 'TEXT', ScanData)
|
||||
Set_Property(Label2$, 'ENABLED', True$)
|
||||
Set_Property(Label2$, 'FOCUS', True$)
|
||||
Set_Property(CtrlEntID, 'ENABLED', False$)
|
||||
Gosub SetupForm
|
||||
end else
|
||||
GoSub ResetForm
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
if ErrorMessage NE 'Scan Cancelled' then
|
||||
Msg(@Window, MsgStruct, 'PROCESS_ERROR', '', ErrorMessage)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end event
|
||||
|
||||
|
||||
Event EDL_LABEL2_SCAN.LOSTFOCUS(Flag, FocusID)
|
||||
|
||||
ScanField = 'Label2'
|
||||
If Flag EQ 1 then
|
||||
ScanData = Get_Property(CtrlEntID, 'TEXT')
|
||||
Cass1 = Get_Property(Label1$, 'TEXT')
|
||||
|
||||
If ScanData NE '' then
|
||||
ScanData = Material_Movement_Services('ProcessPTOScanData', ScanData, 'LABEL2', Cass1)
|
||||
If Error_Services('NoError') then
|
||||
Set_Property(CtrlEntID, 'TEXT', ScanData)
|
||||
Set_Property(CtrlEntID, 'ENABLED', False$)
|
||||
Set_Property(SaveBtn$, 'ENABLED', True$)
|
||||
Set_Property(SaveBtn$, 'FOCUS', True$)
|
||||
Gosub SetupForm
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessage')
|
||||
if ErrorMessage[1,13] EQ 'Scan Mismatch' then
|
||||
Msg(@Window, MsgStruct, 'PROCESS_ERROR', '', ErrorMessage)
|
||||
Gosub ResetForm
|
||||
end else
|
||||
Set_Property(@Window:'.EDL_LABEL2_SCAN', 'ENABLED', True$)
|
||||
Set_Property(@Window:'.EDL_LABEL2_SCAN', 'TEXT', '')
|
||||
Set_Property(@Window:'.EDL_LABEL2_SCAN', 'FOCUS', True$)
|
||||
//ErrorMessage = Error_Services('GetMessage')
|
||||
Msg(@Window, MsgStruct, 'PROCESS_ERROR', '', ErrorMessage)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end event
|
||||
|
||||
|
||||
Event OLE_POPUP.OnItemClick(Item)
|
||||
|
||||
gosub HidePopup
|
||||
|
||||
end event
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Internal Gosubs
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
SaveRecord:
|
||||
|
||||
ErrorMessage = 'undefined'
|
||||
Material_Movement_Services('SaveRecord', Cassette1, '1K', 'PTO', @UserName);//save PTO transaction
|
||||
Delay(1)
|
||||
Material_Movement_Services('SaveRecord', Cassette1, 'SR', 'VER', @UserName);//save PSVER transaction
|
||||
popupTitle = 'Save Record'
|
||||
popupMsg = ''
|
||||
|
||||
saveErr = 0
|
||||
If Error_Services('NoError') then
|
||||
popupMsg = 'Record saved'
|
||||
end else
|
||||
ErrorMessage = Error_Services('GetMessages')
|
||||
saveErr = 1
|
||||
popupMsg = 'Error saving record - ':ErrorMessage
|
||||
end
|
||||
|
||||
Gosub ShowPopup
|
||||
Gosub ResetForm
|
||||
|
||||
return
|
||||
|
||||
|
||||
ShowPopup:
|
||||
|
||||
GoSub HidePopup
|
||||
PopupCtrl = Popup$
|
||||
|
||||
BackColor = Get_Property(@Window, 'BACKCOLOR')
|
||||
ForeColor = Get_Property(@Window, 'FORECOLOR')
|
||||
CursorXPos = Field(Point, ',', 1, 1)
|
||||
CursorYPos = Field(Point, ',', 2, 1)
|
||||
FormSize = SRP_Get_Window_Rect(@Window)
|
||||
FormXPos = FormSize<1>
|
||||
FormYPos = FormSize<2>
|
||||
CtrlSize = Get_Property(CtrlEntID, 'SIZE')
|
||||
CtrlXPos = CtrlSize<1>
|
||||
CtrlYPos = CtrlSize<2>
|
||||
PopupWidth = 0
|
||||
PopupHeight = 0
|
||||
XPadding = 10
|
||||
YPadding = 10
|
||||
XOffset = 10
|
||||
YOffset = 55
|
||||
PopupXPos = FormXPos + CtrlXPos + CursorXPos + XOffset
|
||||
PopupYPos = FormYPos + CtrlYPos + CursorYPos + YOffset
|
||||
|
||||
Delay = 0
|
||||
If saveErr = 1 then
|
||||
BackColor = 255 + (51*256) + (51*65536)
|
||||
end else
|
||||
Delay = 2500
|
||||
BackColor = 153 + (255*256) + (153*65536)
|
||||
end
|
||||
|
||||
ItemData = popupMsg
|
||||
NumLines = DCount(ItemData, @FM)
|
||||
ItemList = ''
|
||||
If ItemData NE '' then
|
||||
For Each Item in ItemData using @FM setting ItemCount
|
||||
* debug
|
||||
ItemLength = Len(Item)
|
||||
PopupWidth += (20 * ItemLength)
|
||||
rows = INT(PopupWidth /300)
|
||||
if (PopupWidth) GE 300 then
|
||||
PopupWidth = 300
|
||||
PopupHeight = (30 * rows)
|
||||
end else
|
||||
PopupHeight = 50
|
||||
end
|
||||
|
||||
ItemList<ItemCount,SRP_POPUP.RECTANGLE,1> = XPadding ; // X Position of item
|
||||
ItemList<ItemCount,SRP_POPUP.RECTANGLE,2> = (20 * (ItemCount - 1) ) ; // Y Position of item
|
||||
ItemList<ItemCount,SRP_POPUP.RECTANGLE,3> = PopupWidth - (2 * XPadding) ; // Width
|
||||
ItemList<ItemCount,SRP_POPUP.RECTANGLE,4> = PopupHeight - (2 * YPadding) ; // Height
|
||||
ItemList<ItemCount,SRP_POPUP.CAPTION> = Item
|
||||
ItemList<ItemCount,SRP_POPUP.COLORS> = Forecolor
|
||||
ItemList<ItemCount,SRP_POPUP.FONT> = 'Tahoma' : @SVM : '16' : @SVM : '700' : @SVM : '0' : @SVM : '0'
|
||||
ItemList<ItemCount,SRP_POPUP.ALIGNMENT> = 'Center' : @SVM : 'Center'
|
||||
Next Item
|
||||
end
|
||||
|
||||
Set_Property(PopupCtrl, 'OLE.Size', Size)
|
||||
Set_Property(PopupCtrl, 'OLE.Opacity', 255)
|
||||
Set_Property(PopupCtrl, 'OLE.ShowDelay', Delay)
|
||||
Set_Property(PopupCtrl, 'OLE.Theme', 'Custom')
|
||||
Set_Property(PopupCtrl, 'OLE.Background', 'Vertical(Gradient(' : Backcolor : ', ' : Backcolor : '), Border(' : Backcolor : ' L=20))' : @FM : 'None' : @FM : 'None')
|
||||
Set_Property(PopupCtrl, 'OLE.ItemList', ItemList)
|
||||
Set_Property(PopupCtrl, 'OLE.Size', 0 : @FM : 0 : @FM : PopupWidth : @FM : PopupHeight)
|
||||
Send_Message(PopupCtrl, 'OLE.ShowAt', PopupXPos, PopupYPos)
|
||||
|
||||
return
|
||||
|
||||
|
||||
HidePopup:
|
||||
|
||||
PopupCtrl = @Window : '.OLE_POPUP'
|
||||
PopupVisible = Get_Property(PopupCtrl, 'OLE.Visible')
|
||||
If PopupVisible EQ True$ then
|
||||
Send_Message(PopupCtrl, 'OLE.Close')
|
||||
end
|
||||
|
||||
return
|
||||
|
||||
|
||||
SetupForm:
|
||||
|
||||
Cassette1 = Get_Property(Label1$, 'TEXT')
|
||||
Cassette2 = Get_Property(Label2$, 'TEXT')
|
||||
If INDEX(Cassette1,'.',2) then
|
||||
RDSType = 'EPP'
|
||||
end else if INDEX(Cassette1,'.',1) then
|
||||
RDSType = 'GAN'
|
||||
end else
|
||||
RDSType = 'SIC'
|
||||
end
|
||||
Convert '.' to '*' in Cassette1
|
||||
Begin Case
|
||||
Case RDSType EQ 'SIC'
|
||||
WOMatKey = XLATE('RDS',Cassette1, 'WO_MAT_KEY', '', '')
|
||||
Location = XLATE('WO_MAT', WOMatKey, 'CURR_LOCATION', '', '')
|
||||
Case RDSType EQ 'EPP'
|
||||
WOMatKey = FIELD(Cassette1,'*',1):'*':FIELD(Cassette1,'*',3)
|
||||
Location = XLATE('WO_MAT', WOMatKey, 'CURR_LOCATION', '', '')
|
||||
Case RDSType EQ 'GAN'
|
||||
WOMatKey = Cassette1
|
||||
Location = XLATE('WO_MAT', WOMatKey, 'CURR_LOCATION', '', '')
|
||||
End Case
|
||||
|
||||
return
|
||||
|
||||
|
||||
DisableFormControls:
|
||||
|
||||
Set_Property(@Window:'.EDL_LABEL1_SCAN', 'TEXT', '')
|
||||
Set_Property(@Window:'.EDL_LABEL2_SCAN', 'TEXT', '')
|
||||
Set_Property(@Window:'.EDL_LABEL1_SCAN', 'ENABLED', False$)
|
||||
Set_Property(@Window:'.EDL_LABEL2_SCAN', 'ENABLED', False$)
|
||||
|
||||
return
|
||||
|
||||
|
||||
SetupOLEControls:
|
||||
|
||||
// Qualify OLE events that we want to intercept
|
||||
Qualifier = ''
|
||||
Qualifier<1> = 1
|
||||
Qualifier<3> = ''
|
||||
Qualifier<4> = 0 ; * process synchronously
|
||||
|
||||
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)
|
||||
Ctrl = @Window :'.OLE_POPUP'
|
||||
Send_Message(Ctrl, 'QUALIFY_EVENT', 'OLE.OnItemClick', Qualifier)
|
||||
|
||||
return
|
||||
|
||||
|
||||
ResetForm:
|
||||
|
||||
Set_Property(@Window:'.EDL_LABEL1_SCAN', 'ENABLED', True$)
|
||||
Set_Property(@Window:'.EDL_LABEL2_SCAN', 'ENABLED', True$)
|
||||
Set_Property(@Window:'.EDL_LABEL1_SCAN', 'TEXT', '')
|
||||
Set_Property(@Window:'.EDL_LABEL2_SCAN', 'TEXT', '')
|
||||
Set_Property(@Window:'.EDL_LABEL1_SCAN', 'ENABLED', True$)
|
||||
Set_Property(@Window:'.EDL_LABEL2_SCAN', 'ENABLED', False$)
|
||||
Set_Property(@Window:'.EDL_LABEL1_SCAN', 'FOCUS', True$)
|
||||
Set_Property(@Window:'.OLE_BTN_SAVE', 'ENABLED', False$)
|
||||
|
||||
return
|
Reference in New Issue
Block a user