@Echo off
@cls
set CmdCurRoot_DP=%~dp0
set CmdCurRoot_DP=%CmdCurRoot_DP:~0,-1%

:Menue
 set UpdateJobMgr_toRun=\\DERLKIM1160\JobMgrRoot\JobManagerV3_T\KION_JobMgr_T_RobocopyDir-mir-to-this-dir.cmd
 set UpdateJobMgrJCT_toRun=\\DERLKIM1160\JobMgrRoot\JobManagerV3_T\KION_JobMgrJCT_T_RobocopyDir-mir-to-this-dir.cmd
 set UpdateJobMgr_S_JobManagerV3_Patch_DP=\\tsclient\d\addplm\JobManager\ProgEntw\Ver03\JobManagerV3_Patch\JobManagerV3

 set Send1_toRun=\\tsclient\D\addPLM\CustomersDataL\Kion\2018-01-01-Tech\KION_Tech_CopyTo_addPLM-03-RobocopyDir-mir-to-this-dir.cmd
 set Send1_S_DP=\\DERLKIM1160\JobMgrRoot\JobManagerV3_T\90-DATA\KION_SettingsGlobal

 set Send2_toRun=\\tsclient\D\addPLM\JobManager\ProgEntw\Ver03\JobManagerV3\90-DATA\CustomerNameShort_SettingsGlobal\10-JobScripts\JobScripts_To_addPLM-03-RobocopyDir-mir-to-this-dir.cmd
 set Send2_S_DP=\\DERLKIM1160\JobMgrRoot\JobManagerV3_T\90-DATA\KION_SettingsGlobal\10-JobScripts

 set CustomDefaults_DSCSAPPrompt_DP=%Send2_S_DP%\_CustomDefaults\SAPPrompt

 Color E0
 Echo.
 Echo --------------------------------------------------------------------------
 Echo  Update Root: \\DERLKIM1160\JobMgrRoot\JobManagerV3_T
 Echo --------------------------------------------------------------------------
 Echo  U01    = Update 01-BinServer
 Echo  U02    = Update 02-BinClient
 Echo  U03    = Update 03-BinPublic
 Echo  U03CS  = Update 03-BinPublic.ClientServer
 Echo  U03CSQ = Update 03-BinPublic.ClientServer Quick only "JobManagerCmdTools.* JobManager.CmdToolsLib.dll
 Echo  U04    = Update 04-Templates
 Echo  U10    = Update 10-Documentation.Application
 Echo  U99    = Update 99-Install
 ECHO ----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----  -
 Echo  UA13CS = Update 01-BinServer + 03-BinPublic.ClientServer
REM  Echo  U10    = Update 01-BinServer + 10-Documentation.Application

REM  Echo  S1 = send 10-JobScripts
REM  Echo  S2 = send 10-JobScripts\RefileNX11_DSCSAP
 Echo.  
 Echo  C1 = Create KION NX11 Environ Script Q09 + P09 (#New:09.01.2019)
 Echo.
 Echo  Q  = Quit (beendet dieses Menue)
 Echo.
 set doNext=

 set /P doNext= waehle Funktion:

 rem beendet diesen Batch
 if /I "%doNext%"=="Q"   Exit
 call :DO_%doNext%
 goto :Menue

:DO_C1
 REM #New 09.01.2019/J.Fes create KION_ENV_NX11.cmd
 Color A0
 Echo ..........................................................................
 call :KionExportEnvironmentDo "NX11" "%CustomDefaults_DSCSAPPrompt_DP%"
 call :Wait
 goto :eof

:KionExportEnvironmentDo
 set profile_p=%~1
 set output_DP=%~2
 set output_p=%output_DP%\KION_ENV_NX11_%ComputerName%.cmd
 Echo Create New '%profile_p%' batch script '%output_p%'
 call "%ProgramFiles(x86)%\KION\K1CAX_BASE\Kion.ExportEnvironments.exe" -profile:%profile_p% -renew:0 -output:"%output_p%"
 if exist "%output_p%" (
   Echo OK Created '%output_p%'
   del "%output_DP%\*.trace_log"
   dir "%output_p%"
 ) else (
   Echo ERR NOT  Created '%output_p%'
 )
 goto :eof


:DO_U01
 Color A0
 call "%UpdateJobMgr_toRun%" "%UpdateJobMgr_S_JobManagerV3_Patch_DP%\01-BinServer"
 call :Wait
 goto :eof

:DO_U02
 Color A0
 call "%UpdateJobMgr_toRun%" "%UpdateJobMgr_S_JobManagerV3_Patch_DP%\02-BinClient"
 call :Wait
 goto :eof

:DO_U03
 Color A0
 call "%UpdateJobMgr_toRun%" "%UpdateJobMgr_S_JobManagerV3_Patch_DP%\03-BinPublic"
 call :Wait
 goto :eof

:DO_U03CS
 Color A0
 call "%UpdateJobMgr_toRun%" "%UpdateJobMgr_S_JobManagerV3_Patch_DP%\03-BinPublic.ClientServer"
 call :Wait
 goto :eof

:DO_U03CSQ
 rem #New:08.02.2019/J.Fes
 Color A0
 call "%UpdateJobMgrJCT_toRun%" "%UpdateJobMgr_S_JobManagerV3_Patch_DP%\03-BinPublic.ClientServer"
 call :Wait
 goto :eof

:DO_U04
 Color A0
 call "%UpdateJobMgr_toRun%" "%UpdateJobMgr_S_JobManagerV3_Patch_DP%\04-Templates"
 call :Wait
 goto :eof

:DO_U10
 Color A0
 call "%UpdateJobMgr_toRun%" "%UpdateJobMgr_S_JobManagerV3_Patch_DP%\10-Documentation.Application"
 call :Wait
 goto :eof

:DO_U99
 Color A0
 call "%UpdateJobMgr_toRun%" "%UpdateJobMgr_S_JobManagerV3_Patch_DP%\99-Install"
 call :Wait
 goto :eof

:DO_UA13CS
 Color A0
 call "%UpdateJobMgr_toRun%" "%UpdateJobMgr_S_JobManagerV3_Patch_DP%\01-BinServer" "%UpdateJobMgr_S_JobManagerV3_Patch_DP%\03-BinPublic.ClientServer"
 call :Wait
 goto :eof



REM :DO_S1
REM  Color A0
REM  call %Send1_toRun% "%Send1_S_DP%\10-JobScripts"
REM  call :Wait
REM  goto :eof
REM
REM :DO_S2
REM  Color A0
REM  call "%Send2_toRun%" "%Send2_S_DP%\RefileNX11_DSCSAP"
REM  call :Wait
REM  goto :eof


:Wait
  Echo -------------------------------------------------------------------------
  Echo Job:  DO_%doNext%% DONE
  timeout /T 10
 goto :eof
