682 lines
21 KiB
Plaintext
682 lines
21 KiB
Plaintext
function wo_daily_sched_comm(Branch, CurParam)
|
|
declare function Set_Property, fieldcount, Get_Property, msg, dialog_box, Security_Check
|
|
declare function send_message, utility, key_sort, Start_Window, entid, repository
|
|
declare FUNCTION relational_call, MemberOf
|
|
declare SUBROUTINE extract_si_keys, End_Dialog, make.list, security_err_msg, Set_Property
|
|
|
|
$insert msg_equates
|
|
$insert lsl_users_equ
|
|
$insert rds_equ
|
|
$insert security_rights_equ
|
|
$insert logical
|
|
$insert popup_equates
|
|
$insert react_mode_equ
|
|
|
|
equ Blue$ TO 16711680
|
|
equ Red$ TO 255
|
|
equ Green$ TO 65280
|
|
equ Yellow$ TO 65535
|
|
equ White$ TO 16777215
|
|
equ Black$ TO 1
|
|
equ Gray$ TO 12632256
|
|
equ BoxStart$ TO 8 ;* this is critical it is the position in the
|
|
|
|
* wo_daily_sched1-8 records where the box arrays start; IF the structure
|
|
* changes then this will need to also
|
|
|
|
ForceModeChange = false$ ;* flag set to true when changing work order as to stamp
|
|
ReturnVar = 0
|
|
|
|
Branches = 'WO_GOT_FOCUS,WO_LOST_FOCUS,FORM_CREATE,FORM_SAVE,FORM_CANCEL,CALL_WINDOW,REFRESH,OPTIONS,REACT_MODE'
|
|
CONVERT ',' TO @FM in Branches
|
|
|
|
LOCATE Branch in Branches using @FM setting Bpos then
|
|
on Bpos GOSUB WO_GOT_FOCUS, WO_LOST_FOCUS, FORM_CREATE, FORM_SAVE, FORM_CANCEL, CALL_WINDOW, REFRESH, OPTIONS, REACT_MODE
|
|
END ELSE
|
|
void = msg( '', 'Invalid Branch ':Bpos:' passed to wo_daily_sched_comm' )
|
|
END
|
|
|
|
RETURN ReturnVar
|
|
|
|
|
|
* * * * * * *
|
|
WO_GOT_FOCUS:
|
|
* * * * * * *
|
|
|
|
* CurParam is the current control name
|
|
|
|
OrigWoVal = Get_Property( CurParam, 'TEXT' )
|
|
|
|
Set_Property( @WINDOW, '@OrigWoVal', OrigWoVal )
|
|
RETURN
|
|
|
|
|
|
* * * * * * *
|
|
WO_LOST_FOCUS:
|
|
* * * * * * *
|
|
|
|
* CurParam is the current control name
|
|
HoldParam = CurParam
|
|
NewWoVal = Get_Property( CurParam, 'TEXT' )
|
|
OrigWoVal = Get_Property( @WINDOW, '@OrigWoVal' )
|
|
IF NewWoVal <> OrigWoVal then
|
|
* NOW FORCE THEM TO CHANGE THE STATUS OR APPLY SETTING THIS WORK ORDER
|
|
SWAP 'RW' with 'RM' in CurParam
|
|
ForceModeChange = true$
|
|
Mode = ''
|
|
GOSUB react_mode
|
|
IF Mode = 'CANCEL' then
|
|
* could not get a lock so someone else is changing the mode with a
|
|
* different work order than the one we have changed to
|
|
* so do not change the work order
|
|
void = Set_Property( HoldParam, 'TEXT', OrigWoVal )
|
|
END ELSE
|
|
* check to see IF we are running this wo anywhere else
|
|
* and warn user - as to not forget to finish a wo before
|
|
* starting a new one
|
|
IF OrigWoVal then
|
|
GOSUB CheckWo
|
|
END
|
|
CurEditTable = HoldParam
|
|
CurWoVal = NewWoVal
|
|
SWAP '.RW' with '.R' in CurEditTable
|
|
GOSUB PrepWo
|
|
GOSUB RecalcWo
|
|
END
|
|
END
|
|
RETURN
|
|
|
|
* * * * * * *
|
|
RecalcWo:
|
|
* * * * * * *
|
|
|
|
|
|
* called from this code only no external branch
|
|
CurRMode = CurEditTable
|
|
TRMode = field( CurRMode, '.', 2 )
|
|
SWAP 'R' with 'RM' in TRMode
|
|
CurRMode = field( CurRMode, '.', 1 ):'.':TRMode
|
|
RNum = field( CurRMode, '.', 2 )
|
|
SWAP 'RM' with '' in RNum
|
|
RMId = 'REACT_MODE':RNum
|
|
Mode = XLATE( 'CONFIG', RMId, Mode$, 'X' )[1,4]
|
|
IF Mode then
|
|
SWAP 'Down' with 'Down2' in Mode ;* down 2 is bmp for down no material
|
|
SWAP 'N/A ' with 'NONA' in Mode ;* nona is for not_applicable reactor not in use
|
|
DosBmp = 'BMPS\':Mode:'.BMP'
|
|
void = Set_Property( CurRMode, 'BITMAP', DosBmp )
|
|
END
|
|
IF num( WoToRecalc ) then
|
|
Stat = utility( 'CURSOR', 'H' )
|
|
OPEN 'RDS' TO RdsTable else
|
|
void = msg( '', 'Unable TO OPEN RDS...' )
|
|
RETURN 0
|
|
END
|
|
extract_si_keys( 'RDS', 'WO', WoToRecalc, RdsToProc )
|
|
IF RdsToProc then
|
|
CurArray = Get_Property( CurEditTable, 'ARRAY' )
|
|
for i = 1 TO 80
|
|
void = send_message( CurEditTable, 'COLOR_BY_POS', i, 1, Black$ )
|
|
NEXT I
|
|
CONVERT @VM TO @FM in RdsToProc
|
|
RdsToProc = key_sort( RdsToProc, 'RDS', 'RUN_ORDER_NUM', 1 )
|
|
Tcnt = fieldcount( RdsToProc, @FM )
|
|
IF SeperateLayer then
|
|
IF SeperateLayer = 1 then
|
|
* eliminate all layers except one
|
|
Trds = RdsToProc
|
|
RdsToProc = ''
|
|
FOR I = 1 TO Tcnt
|
|
IF INDEX( Trds<i>, '.', 1 ) else
|
|
RdsToProc := Trds<i>:@FM
|
|
END
|
|
NEXT I
|
|
RdsToProc[-1,1] = ''
|
|
END ELSE
|
|
* have to extract only the .layers
|
|
Trds = RdsToProc
|
|
RdsToProc = ''
|
|
FOR I = 1 TO Tcnt
|
|
IF INDEX( Trds<i>, '.':SeperateLayer, 1 ) then
|
|
RdsToProc := Trds<i>:@FM
|
|
END
|
|
NEXT I
|
|
RdsToProc[-1,1] = ''
|
|
END
|
|
END
|
|
RdsToProc = field( RdsToProc, @FM, 1, 80 ) ;* only room for 80
|
|
Rcnt = fieldcount( RdsToProc, @FM )
|
|
|
|
FOR I = 1 TO Rcnt
|
|
READ RdsRec FROM RdsTable, RdsToProc<i> else
|
|
void = msg( '', 'Unable to READ ':RdsToProc<i>:' FROM RDS...' )
|
|
RETURN 0
|
|
END
|
|
*
|
|
IF CurArray<i,2> = 0 then
|
|
* they do not want to run this box on this reactor
|
|
GrayBox = true$
|
|
END ELSE
|
|
* it is either one on blank meaning show this box
|
|
GrayBox = false$
|
|
END
|
|
DateIn = RdsRec<rds_date_in$>
|
|
DateOut = RdsRec<rds_date_out$>
|
|
Reactor = RdsRec<rds_reactor$>
|
|
|
|
BEGIN CASE
|
|
CASE ( GrayBox ) and ( Reactor = CurReactor )
|
|
* this is a gray box meaning run on another reactor but it
|
|
* ran here so show blue
|
|
ColorToUse = Blue$
|
|
CASE GrayBox
|
|
ColorToUse = Gray$
|
|
CASE ( DateIn = '' ) and ( DateOut = '' )
|
|
ColorToUse = White$
|
|
CASE Reactor <> CurReactor
|
|
ColorToUse = Blue$
|
|
CASE ( DateIn <> '' ) and ( DateOut = '' )
|
|
ColorToUse = Green$
|
|
CASE ( DateIn <> '' ) and ( DateOut <> '' )
|
|
ColorToUse = Red$
|
|
END CASE
|
|
*
|
|
void = send_message( CurEditTable, 'COLOR_BY_POS', i, 1, ColorToUse )
|
|
NEXT I
|
|
END
|
|
Stat = utility( 'CURSOR', 'A' )
|
|
END
|
|
RETURN
|
|
|
|
* * * * * * *
|
|
FORM_CREATE:
|
|
* * * * * * *
|
|
|
|
* curparam is the window number 1,2,3,4,5
|
|
* field one of the config "WO_DAILY_SCHED"1-9999 will have an @VM delim on
|
|
* controls to load using fields 2-999
|
|
|
|
DailySchedName = 'WO_DAILY_SCHED':CurParam
|
|
|
|
OPEN 'CONFIG' TO ConfigTable else
|
|
void = msg( '', 'Unable to OPEN CONFIG table' )
|
|
End_Dialog( @WINDOW, '' )
|
|
RETURN 0
|
|
END
|
|
|
|
*UserRec = XLATE( 'LSL_USERS', @user4, '', 'X' )
|
|
*Groups = UserRec<lsl_users_groups$>
|
|
*LOCATE 'DATA_ENTRY' in Groups using @VM setting Fpos then
|
|
|
|
IF MemberOf( @user4, 'SUPERVISOR' ) or MemberOf( @user4, 'DATA_ENTRY' ) then
|
|
lock ConfigTable, DailySchedName then
|
|
GOSUB DoRead
|
|
END ELSE
|
|
MsgInfo = ''
|
|
MsgInfo<mtext$> = DailySchedName:' is in use somewhere else...You will not be allowed to change anything.'
|
|
MsgInfo<micon$> = '!'
|
|
void = msg( '', MsgInfo )
|
|
void = Set_Property( @WINDOW:'.SAVE', 'ENABLED', 0 )
|
|
void = Set_Property( @WINDOW:'.CANCEL', 'TEXT', 'OK' )
|
|
void = Set_Property( @WINDOW:'.SAVE2', 'ENABLED', 0 )
|
|
void = Set_Property( @WINDOW:'.CANCEL2', 'TEXT', 'OK' )
|
|
GOSUB DoRead
|
|
FOR I = 1 TO Ccnt
|
|
ThisControl = @WINDOW:'.':ControlsToLoad<1,i>
|
|
void = Set_Property( ThisControl, 'ENABLED', 0 )
|
|
NEXT I
|
|
END
|
|
END ELSE
|
|
void = Set_Property( @WINDOW:'.SAVE', 'ENABLED', 0 )
|
|
void = Set_Property( @WINDOW:'.CANCEL', 'TEXT', 'OK' )
|
|
void = Set_Property( @WINDOW:'.SAVE2', 'ENABLED', 0 )
|
|
void = Set_Property( @WINDOW:'.CANCEL2', 'TEXT', 'OK' )
|
|
GOSUB DoRead
|
|
FOR I = 1 TO Ccnt
|
|
ThisControl = @WINDOW:'.':ControlsToLoad<1,i>
|
|
void = Set_Property( ThisControl, 'ENABLED', 0 )
|
|
NEXT I
|
|
END
|
|
RETURN 0
|
|
|
|
|
|
* * * * * * *
|
|
DoRead:
|
|
* * * * * * *
|
|
|
|
* called from this code only no external branch
|
|
READ DailySched FROM ConfigTable, DailySchedName then
|
|
IF DailySched then
|
|
ControlsToLoad = DailySched<1>
|
|
ValsToLoad = field( DailySched, @FM, 2, 999 )
|
|
Ccnt = fieldcount( ControlsToLoad, @VM )
|
|
FOR j = 1 TO Ccnt
|
|
ControlToLoad = @WINDOW:'.':ControlsToLoad<1,j>
|
|
CurWoVal = ValsToLoad<j>
|
|
CurEditTable = ControlToLoad
|
|
SWAP '.RW' with '.R' in CurEditTable
|
|
void = Set_Property( ControlToLoad, 'TEXT', CurWoVal )
|
|
BoxPos = j+6
|
|
BoxData = ValsToLoad<BoxPos>
|
|
ArrayData = ''
|
|
FOR k = 1 TO 80
|
|
ArrayData<k,1> = k
|
|
ArrayData<k,2> = BoxData<1,k>
|
|
next k
|
|
void = Set_Property( CurEditTable, 'ARRAY', ArrayData )
|
|
GOSUB PrepWo
|
|
GOSUB RecalcWo
|
|
next j
|
|
END
|
|
END ELSE
|
|
Ccnt = 0
|
|
END
|
|
RETURN
|
|
|
|
|
|
* * * * * * *
|
|
FORM_SAVE:
|
|
* * * * * * *
|
|
|
|
* curparam is the window number 1,2,3,4,5
|
|
* field one of the config "WO_DAILY_SCHED"1-9999 will have an @VM delim on
|
|
* controls to save in fields 2-999
|
|
|
|
OPEN 'CONFIG' TO ConfigTable else
|
|
void = msg( '', 'Unable to OPEN CONFIG table' )
|
|
End_Dialog( @WINDOW, '' )
|
|
RETURN 0
|
|
END
|
|
|
|
DailySchedName = 'WO_DAILY_SCHED':CurParam
|
|
ControlsToSave = XLATE( 'CONFIG', DailySchedName, 1, 'X' )
|
|
DailySchedRec = ''
|
|
|
|
Ccnt = fieldcount( ControlsToSave, @VM )
|
|
FOR I = 1 TO Ccnt
|
|
ControlToSave = @WINDOW:'.':ControlsToSave<1,i>
|
|
DailySchedRec<i> = Get_Property( ControlToSave, 'TEXT' )
|
|
NEXT I
|
|
DailySchedRec = ControlsToSave:@FM:DailySchedRec
|
|
SWAP 'RW' with 'R' in ControlsToSave
|
|
BoxPos = BoxStart$
|
|
|
|
FOR I = 1 TO Ccnt
|
|
CurArray = Get_Property( @WINDOW:'.':ControlsToSave<1,i>, 'ARRAY' )
|
|
FieldOut = ''
|
|
FOR j = 1 TO 80
|
|
FieldOut<1,j> = CurArray<j,2>
|
|
next j
|
|
DailySchedRec<BoxPos> = FieldOut
|
|
BoxPos += 1
|
|
NEXT I
|
|
write DailySchedRec on ConfigTable, DailySchedName else
|
|
void = msg( '', 'Unable to write ':DailySchedName:' in CONFIG table' )
|
|
End_Dialog( @WINDOW, '' )
|
|
RETURN 0
|
|
END
|
|
unlock ConfigTable, DailySchedName else
|
|
void = msg( '', 'Unable to unlock ':DailySchedName:' in CONFIG table' )
|
|
END
|
|
End_Dialog( @WINDOW, '' )
|
|
RETURN
|
|
|
|
|
|
* * * * * * *
|
|
FORM_CANCEL:
|
|
* * * * * * *
|
|
|
|
* curparam is the window number 1,2,3,4,5
|
|
*UserRec = XLATE( 'LSL_USERS', @user4, '', 'X' )
|
|
*Groups = UserRec<lsl_users_groups$>
|
|
*LOCATE 'DATA_ENTRY' in Groups using @VM setting Fpos then
|
|
|
|
IF MemberOf( @user4, 'SUPERVISOR' ) or MemberOf( @user4, 'DATA_ENTRY' ) then
|
|
DailySchedName = 'WO_DAILY_SCHED':CurParam
|
|
OPEN 'CONFIG' TO ConfigTable else
|
|
void = msg( '', 'Unable to OPEN CONFIG table' )
|
|
End_Dialog( @WINDOW, '' )
|
|
RETURN 0
|
|
END
|
|
unlock ConfigTable, DailySchedName else
|
|
*void = msg( '', 'Unable to unlock CONFIG ':DailySchedName )
|
|
* removed error message - as to allow DATA_ENTRY to view
|
|
* only is alREADy locked
|
|
END
|
|
END
|
|
End_Dialog( @WINDOW, '' )
|
|
RETURN
|
|
|
|
|
|
* * * * * * *
|
|
CALL_WINDOW:
|
|
* * * * * * *
|
|
|
|
*CurParam is the window to call
|
|
If Get_Property('NDW_MAIN', 'VISIBLE') then
|
|
AppMain = 'NDW_MAIN'
|
|
end else
|
|
AppMain = 'LSL_MAIN2'
|
|
end
|
|
void = Start_Window( CurParam, AppMain, '*CENTER', '', '' )
|
|
RETURN
|
|
|
|
|
|
* * * * * * *
|
|
PrepWo:
|
|
* * * * * * *
|
|
|
|
* called internally
|
|
|
|
CurReactor = field( CurEditTable, '.', 2 )
|
|
CONVERT @UPPER_CASE TO '' in CurReactor
|
|
CONVERT @LOWER_CASE TO '' in CurReactor
|
|
SeperateLayer = ''
|
|
LayPos = INDEX( CurWoVal, 'LAY', 1 )
|
|
IF LayPos then
|
|
BegPos = LayPos +3 ;* for length of lay
|
|
SeperateLayer = CurWoVal[BegPos,'F>']
|
|
SWAP '<LAY':SeperateLayer:'>' with '' in CurWoVal
|
|
END
|
|
SWAP '52nd' with '' in CurWoVal
|
|
CONVERT @UPPER_CASE TO '' in CurWoVal
|
|
CONVERT @LOWER_CASE TO '' in CurWoVal
|
|
CONVERT " `~!@#$%^&*()_+-=\][{}|';:/?.>,<" TO '' in CurWoVal
|
|
CONVERT '"' TO '' in CurWoVal
|
|
WoToRecalc = CurWoVal
|
|
RETURN
|
|
|
|
|
|
* * * * * * *
|
|
REFRESH:
|
|
* * * * * * *
|
|
|
|
* curparam is the window number 1,2,3,4,5
|
|
DailySchedName = 'WO_DAILY_SCHED':CurParam
|
|
OPEN 'CONFIG' TO ConfigTable else
|
|
void = msg( '', 'Unable TO OPEN CONFIG table' )
|
|
End_Dialog( @WINDOW, '' )
|
|
RETURN 0
|
|
END
|
|
IF Get_Property( @WINDOW:'.SAVE', 'ENABLED' ) then
|
|
* is a DATA_ENTRY and has the lock so reload from window values
|
|
READ DailySched FROM ConfigTable, DailySchedName then
|
|
IF DailySched then ;* READ controls from config but get vals from window
|
|
ControlsToLoad = DailySched<1>
|
|
Ccnt = fieldcount( ControlsToLoad, @VM )
|
|
FOR j = 1 TO Ccnt
|
|
ControlToLoad = @WINDOW:'.':ControlsToLoad<1,j>
|
|
CurWoVal = Get_Property( ControlToLoad, 'TEXT' )
|
|
CurEditTable = ControlToLoad
|
|
SWAP '.RW' with '.R' in CurEditTable
|
|
GOSUB PrepWo
|
|
GOSUB RecalcWo
|
|
NEXT I
|
|
END
|
|
END ELSE
|
|
Ccnt = 0
|
|
END
|
|
END ELSE
|
|
GOSUB DoRead
|
|
* is not a DATA_ENTRY so READ FROM disk as it may have changed
|
|
END
|
|
RETURN
|
|
|
|
|
|
* * * * * * *
|
|
OPTIONS:
|
|
* * * * * * *
|
|
|
|
* CurParam will pass the control name of the edittable
|
|
* and all this code needs to do is add a W to the R
|
|
|
|
HoldEdTable = CurParam
|
|
Reactor = CurParam
|
|
Reactor = field(CurParam,'.', 2 )
|
|
|
|
CONVERT @UPPER_CASE TO '' in Reactor
|
|
CONVERT @LOWER_CASE TO '' in Reactor
|
|
|
|
SWAP '.R' with '.RW' in CurParam
|
|
PopupId = entid( @appid<1>, 'POPUP', '', 'DAILY_SCHED_OPTS' )
|
|
OverRide = ''
|
|
|
|
IF MemberOf( @user4, 'SUPERVISOR' ) or MemberOf( @user4, 'DATA_ENTRY' ) THEN
|
|
* add option to choose boxes if the save button is enabled meaning they have the lock
|
|
IF Get_Property( @WINDOW:'.SAVE', 'ENABLED' ) THEN
|
|
Display = 'Quote':@tm:'QUOTE':@VM:'PSN':@tm:'PSN':@VM:'Recipe':@tm:'RECIPE':@VM:'RunData Sheet':@tm:'RDS':@VM:'Work Order':@tm:'WO'
|
|
Display:= @VM:'Choose Boxes':@tm:'CHOOSE_BOXES'
|
|
* When the popup daily_sched_opts changes the above 2 lines need changing
|
|
OverRide<Pdisplay$> = Display
|
|
END
|
|
END
|
|
ChosenOpt = repository( 'EXECUTE', PopupId, @WINDOW, OverRide )
|
|
CurWoVal = Get_Property( CurParam, 'TEXT' )
|
|
HoldWoVal = CurWoVal
|
|
SeperateLayer = ''
|
|
LayPos = INDEX( CurWoVal, 'LAY', 1 )
|
|
IF LayPos then
|
|
BegPos = LayPos +3 ;* for length of lay
|
|
SeperateLayer = CurWoVal[BegPos,'F>']
|
|
SWAP '<LAY':SeperateLayer:'>' with '' in CurWoVal
|
|
END
|
|
SWAP '52nd' with '' in CurWoVal
|
|
|
|
CONVERT @UPPER_CASE TO '' IN CurWoVal
|
|
CONVERT @LOWER_CASE TO '' IN CurWoVal
|
|
CONVERT " `~!@#$%^&*()_+-=\][{}|';:/?.>,<" TO '' IN CurWoVal
|
|
CONVERT '"' TO '' IN CurWoVal
|
|
|
|
RdsKeys = ''
|
|
BEGIN CASE
|
|
CASE ChosenOpt = 'QUOTE'
|
|
IF Security_Check( 'Quote', Read$ ) THEN
|
|
GOSUB GetRdsKeys
|
|
QuoteKey = XLATE( 'RDS', RdsKeys<1,1>, rds_quote_no$, 'X' )
|
|
void = Start_Window( 'QUOTE', @WINDOW, QuoteKey:'*CENTER', '', '' )
|
|
END ELSE
|
|
security_err_msg( 'Quote', Read$ )
|
|
END
|
|
|
|
CASE ChosenOpt = 'PSN'
|
|
IF Security_Check( 'Prod Spec', Read$ ) THEN
|
|
GOSUB GetRdsKeys
|
|
PSNId = XLATE( 'RDS', RdsKeys<1,1>, rds_prod_spec_id$, 'X' )
|
|
void = Start_Window( 'PROD_SPEC', @WINDOW, PSNId:'*CENTER', '', '' )
|
|
END ELSE
|
|
security_err_msg( 'Prod Spec', Read$ )
|
|
END
|
|
|
|
CASE ChosenOpt = 'RECIPE'
|
|
IF Security_Check( 'Recipe', Read$ ) THEN
|
|
GOSUB GetRdsKeys
|
|
RecipeKey = XLATE( 'RDS', RdsKeys<1,1>, rds_recipe_no$, 'X' )
|
|
void = Start_Window( 'RECIPE', @WINDOW, RecipeKey:'*CENTER', '', '' )
|
|
END ELSE
|
|
security_err_msg( 'Recipe', Read$ )
|
|
END
|
|
|
|
CASE ChosenOpt = 'RDS'
|
|
IF Security_Check( 'RDS', Read$ ) THEN
|
|
Keys = relational_call( 'WO_LOG', 'RDS_KEYS', CurWoVal, 'RDS_QUERY', 'RDS', 'CUST_NAME':@FM:'WO':@FM:'RUN_ORDER_NUM' )
|
|
IF Keys then
|
|
SWAP 'NoKeys' with '' in Keys
|
|
ParamToPass = Keys
|
|
void = Start_Window( 'RDS', @WINDOW, Keys:'*CENTER', '', '' )
|
|
END
|
|
END ELSE
|
|
security_err_msg( 'RDS', Read$ )
|
|
END
|
|
|
|
CASE ChosenOpt = 'WO'
|
|
IF Security_Check( 'WO Log', Read$ ) then
|
|
void = Start_Window( 'WO_LOG', @WINDOW, CurWoVal:'*CENTER', '', '' )
|
|
END ELSE
|
|
security_err_msg( 'WO Log', Read$ )
|
|
END
|
|
|
|
CASE ChosenOpt = 'CHOOSE_BOXES'
|
|
extract_si_keys( 'RDS', 'WO', CurWoVal, RdsIds )
|
|
IF RdsIds then
|
|
PopId = entid( @appid<1>, 'POPUP', '', 'RDS_QUERY' )
|
|
OverRide = ''
|
|
OverRide<ptitle$> = 'Choose the RDS Run Orders for Reactor ':Reactor
|
|
CONVERT @VM TO @FM in RdsIds
|
|
make.list( 0, RdsIds, '', '' )
|
|
ChosenKeys = repository( "EXECUTE", PopId, @WINDOW, OverRide )
|
|
IF ChosenKeys then
|
|
Ccnt = fieldcount( ChosenKeys, @VM )
|
|
CurArray = Get_Property( HoldEdTable, 'ARRAY' )
|
|
FOR I = 1 TO 80
|
|
* to gray boxes
|
|
CurArray<i,2> = 0
|
|
NEXT I
|
|
RunNums = XLATE( 'RDS', ChosenKeys, 'RUN_ORDER_NUM', 'X' )
|
|
FOR I = 1 TO Ccnt
|
|
* ungray selected boxes
|
|
CurArray<RunNums<1,i>,2> = 1
|
|
NEXT I
|
|
void = Set_Property( HoldEdTable, 'ARRAY', CurArray )
|
|
CurEditTable = HoldEdTable
|
|
CurWoVal = HoldWoVal
|
|
GOSUB PrepWo
|
|
GOSUB RecalcWo
|
|
END
|
|
END ELSE
|
|
MsgInfo = ''
|
|
MsgInfo<mtext$> = 'Error extracting keys...'
|
|
MsgInfo<micon$> = 'H'
|
|
void = msg( '', MsgInfo )
|
|
RETURN 0
|
|
END
|
|
END CASE
|
|
RETURN
|
|
|
|
|
|
* * * * * * *
|
|
GetRdsKeys:
|
|
* * * * * * *
|
|
|
|
* called internally only
|
|
|
|
Extract_SI_keys( 'RDS', 'WO', CurWoVal, RdsKeys )
|
|
RETURN
|
|
|
|
|
|
* * * * * * *
|
|
CheckWo:
|
|
* * * * * * *
|
|
|
|
Window = @WINDOW
|
|
|
|
CONVERT @UPPER_CASE TO '' in Window
|
|
CONVERT @LOWER_CASE TO '' in Window
|
|
CONVERT '_' TO '' in Window
|
|
|
|
IF Window else
|
|
Window = 1
|
|
END
|
|
|
|
* get current window control names FROM config but load from window
|
|
|
|
CurControl = CurParam
|
|
Controls = XLATE( 'CONFIG', 'WO_DAILY_SCHED':Window, 1, 'X' )
|
|
CCnt = fieldcount( Controls, @VM )
|
|
ErrMsg = ''
|
|
FOR I = 1 TO CCnt
|
|
TControl = @WINDOW:'.':Controls<1,i>
|
|
IF TControl = CurControl else
|
|
IF Get_Property( TControl, 'TEXT' ) = OrigWoVal then
|
|
* present a message to user
|
|
Treactor = Controls<1,i>
|
|
CONVERT @UPPER_CASE TO '' in Treactor
|
|
CONVERT @LOWER_CASE TO '' in Treactor
|
|
ErrMsg := 'Reactor ':Treactor:', '
|
|
END
|
|
END
|
|
NEXT I
|
|
|
|
* now look through all other windows using disk values
|
|
|
|
OPEN 'CONFIG' TO ConfigTable else
|
|
void = msg( '', 'Unable to OPEN CONFIG table' )
|
|
End_Dialog( @WINDOW, '' )
|
|
RETURN 0
|
|
END
|
|
|
|
i = 1
|
|
loop
|
|
ThisDailyWoId = 'WO_DAILY_SCHED':i
|
|
IF i = Window then
|
|
DailyWoRec = 'SkipThisMother'
|
|
END ELSE
|
|
READ DailyWoRec FROM ConfigTable, ThisDailyWoId else
|
|
DailyWoRec = ''
|
|
END
|
|
IF DailyWoRec then
|
|
FOR j = 2 TO 6 ;* for the positions of actual wo# in the config record
|
|
IF INDEX( DailyWoRec<j>, OrigWoVal, 1 ) then
|
|
* present a message to user
|
|
Treactor = DailyWoRec<1,j-1>
|
|
CONVERT @UPPER_CASE TO '' in Treactor
|
|
CONVERT @LOWER_CASE TO '' in Treactor
|
|
ErrMsg := 'Reactor ':Treactor:', '
|
|
END
|
|
next j
|
|
END
|
|
END
|
|
until DailyWoRec = ''
|
|
i += 1
|
|
repeat
|
|
ErrMsg[-2,2] = ''
|
|
IF ErrMsg then
|
|
CONVERT ',' TO @FM in ErrMsg
|
|
LastOne = fieldcount( ErrMsg, @FM )
|
|
IF LastOne > 1 then
|
|
TWo = ErrMsg<LastOne>
|
|
TWo = ' and ':TWo
|
|
ErrMsg<LastOne> = TWo
|
|
CONVERT @FM TO ',' in ErrMsg
|
|
END
|
|
MsgInfo = ''
|
|
MsgInfo<micon$> = '!'
|
|
MsgInfo<mtext$> = quote( OrigWoVal ):' is currently running on ':ErrMsg:'...Please verify that all boxes for Work Order ':quote( OrigWoVal ):' are assigned to reactors before starting a new Work Order.'
|
|
void = msg( '', MsgInfo )
|
|
END
|
|
RETURN
|
|
|
|
|
|
* * * * * * *
|
|
REACT_MODE:
|
|
* * * * * * *
|
|
|
|
* CurParam is the current control name
|
|
|
|
Tparam = CurParam
|
|
WoControl = Tparam
|
|
SWAP 'RM' with 'RW' in WoControl
|
|
CurWo = Get_Property( WoControl, 'TEXT' )
|
|
SeperateLayer = ''
|
|
LayPos = INDEX( CurWo, 'LAY', 1 )
|
|
IF LayPos then
|
|
BegPos = LayPos +3 ;* for length of lay
|
|
SeperateLayer = CurWo[BegPos,'F>']
|
|
SWAP '<LAY':SeperateLayer:'>' with '' in CurWo
|
|
END
|
|
SWAP '52nd' with '' in CurWo
|
|
CONVERT @UPPER_CASE TO '' in CurWo
|
|
CONVERT @LOWER_CASE TO '' in CurWo
|
|
CONVERT " `~!@#$%^&*()_+-=\][{}|';:/?.>,<" TO '' in CurWo
|
|
CONVERT '"' TO '' in CurWo
|
|
Tparam = field( Tparam, '.', 2 )
|
|
SWAP 'RM' with '' in Tparam
|
|
*Tparam is the reactor number
|
|
Mode = dialog_box( 'REACT_MODE_CHG', @WINDOW, Tparam:'*':CurWo:'*':ForceModechange )
|
|
IF Mode <> 'CANCEL' then
|
|
SWAP 'Down' with 'Down2' in Mode ;* down 2 is bmp for down no material
|
|
SWAP 'N/A ' with 'NONA' in Mode ;* nona is for not_applicable reactor not in use
|
|
DosBmp = 'BMPS\':Mode:'.BMP'
|
|
void = Set_Property( CurParam, 'BITMAP', DosBmp )
|
|
END
|
|
RETURN
|