@Echo off
 REM ===========================================================================
 REM JobMgr Script for Customer (c)addPLM 2006..2017
 REM Date/Time  Name   Details:
 REM 13.12.2018 J.Fes  date of template version
 REM ===========================================================================

 set JobMgr_SAPUser=%~1
 set JobMgr_SAPPw=%~2

 Call Echo "**************************************************************************"
 Call Echo "* Excuting Script for PLMJobManager                                      *"
 Call Echo "* Based on template Version: 08.02.2017 (c)addPLM GmbH                   *"
 Call Echo "**************************************************************************"

 REM -- define incudes #New: 05.07.2016/J.Fes
 set JobMgr_10-JobScriptsInc_01=_JobMgrDefaults
 set JobMgr_10-JobScriptsInc_02=_CustomDefaults\SAPPrompt

 REM -- #Doc: Inits all Basics of Job
 Call "%~dp0_JobInitial.cmd" "PU-SAP" "YES" "NO" "YES" "YES"

 set titleTxt=Job:[%JobName%][%TcSiteId%][%Date% %time:~0,5%][\\%ComputerName%]
 title %titleTxt%

 rem -- SAP Prompt for Custom
 set SAPPrompt_Custom_Opt=NX110
 set SAPPrompt_Custom_DPNE=%CmdCurRoot_DP%\SAPPrompt_Custom.cmd
 if exist "%SAPPrompt_Custom_DPNE%" Call "%SAPPrompt_Custom_DPNE%"

 Call "%CmdCurRoot_DP%\Custom_NXDirSetup.cmd" "UGII_SITE_DIR_get"
 if "%JobMgr_SAPPromptGet_ResCode%" equ "0" Call "%CmdCurRoot_DP%\SAPPU_Execute.cmd" "" "" ""

 if /i "%JobMgr_Test%" neq "ON" goto :JumbOver
  Banner Test:End
  Call Echo "----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----"
  Call Echo "#TestMode.......................: End of Test"
  Call Echo "JobName.........................: %JobName%"
  pause
:JumbOver

  Call Echo "----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----  ----"
  call DelDir "%CmdCurRoot_DP%\Resources"
  call DelDir "%CmdCurRoot_DP%\startup"
  call DelDir "%CmdCurRoot_DP%\udo"
  call DelDir "%CmdCurRoot_DP%\10-PartUpdateLog\KION"
  call DelDir "%CmdCurRoot_DP%\10-PartUpdateLog\working_material_271724"

  del /S /Q "%CmdCurRoot_DP%\*.prt"
  del /S /Q "%CmdCurRoot_DP%\K1CAx.log*"

  rem #New:24/11/2014 J.Fes preventing sending big logfies to JobServer 09.01.2019 changed /MIN:6072000
  call robocopy "%CmdCurRoot_DP%" "%CmdCurRoot_DP%\..\_JobLogNotSendToJobServer\%JobName%" "*.*log*" /Move /S /MIN:6072000 /R:1 /W:1
  rem #New:7/21/2017 J.Fes Cleanup dir JobLogNotSendToJobServer
  call "%BinPublic_DP%\delage32.exe" "%CmdCurRoot_DP%\..\_JobLogNotSendToJobServer\*.*" 2 /modified /recurse /rd /includeRHS
goto :end


REM ============================================================================
:end
 cd /d "%tempOrig_DP%"
 Call Echo "--------------------------------------------------------------------------"
 Call Echo "Info: all files in...............: %temp%"
 Call Echo "Info: will be zipt by JobClient..: and send to JobServer"
 EXIT /B 0


