@Echo off
REM #Doc: In this script you define customer NX settings
REM #Doc: This script is used by JobMgr JobScripts parameters

REM #New: 26.12.2017 /J.Fes first version


REM #toDo: please setup Customer NXPrompt settings

 Call Echo "----------------------------------------------------------------------------"
 Call Echo "Info: Executing NxPrompt_Custom.cmd [%TcSiteId%/JobMgr_NXVer:%JobMgr_NXVer%]"

 set JobMgr_NXPromptGet_ResCode=-1
 set JobMgr_NXPromptGet_ResMsg=Unkown


 REM #Doc: SetUp NXPrompt
 if /i "%JobMgr_NXVer%" neq "DEFAULT" goto :Next
 set NxPromptCmd=%UGII_ROOT_DIR%\ugiicmd.bat
 set NxPromptCmdOpt="%UGII_BASE_DIR%"
:Next

 rem -- addPLM - Defaults please excange
 if /i "%JobMgr_NXVer%" neq "NX2007" goto :Next
  set NxPromptCmd=%CmdCurRoot_DP%\NxPrompt_CustomNX2007.cmd
  set NxPromptCmdOpt=BATCH
:Next

 if /i "%JobMgr_NXVer%" neq "NX2212" goto :Next
  set NxPromptCmd=%CmdCurRoot_DP%\NxPrompt_CustomNX2212.cmd
  set NxPromptCmdOpt=BATCH
:Next

 if /i "%JobMgr_Debug%" neq "ON" goto :JumbOver
  Call Echo "---------------------------------------------------------------------------"
  Call Echo "#Debug:..........................: bevor excuting"
  Call Echo "JobMgr_NXVer.....................: %JobMgr_NXVer%"
  Call Echo "NxPromptCmd......................: %NxPromptCmd%"
  Call Echo "NxPromptCmdOpt...................: %NxPromptCmdOpt%"
  pause
:JumbOver


REM -- #Doc: check start TcPrompt
 if exist "%NxPromptCmd%" goto :NxPromptCmdFoundYES
 goto :NxPromptCmdFoundNO

:NxPromptCmdFoundNO
 rem -- #Doc: ERR Custom NX-Prompt not found
 call ErrorHandel "C"  "NXPrompt:ERR"      "Please chk"
 call ErrorHandel "C"  "Info value"        "JobMgr_NXVer=%JobMgr_NXVer%
 call ErrorHandel "C"  "set JobMgr_NXVer"  "Please chk settings in Job scripts"
 call ErrorHandel "C"  "set JobMgr_NXVer"  "Please chk settings in JobServer Job Script/Param"
 call ErrorHandel "S"  "NXPrompt:ERR:fnf"  "[NXPrompt:ERR for:JobMgr_NXVer=%JobMgr_NXVer% fnf:NxPromptCmd:%NxPromptCmd%]"
 goto :End

:PLMShare_DiskConnectErr
 rem -- #Doc: ERR PLMShare
 call ErrorHandel "S" "PLMShare:ERR" "[%PLMShare_DiskConnectInfo% Status:%PLMshare_DiskConnectStatus%]"
 goto :End

:NxPromptCmdFoundYES
 rem -- #Doc: OK Now execute get Custom TC-Prompt
 call "%NxPromptCmd%" %NxPromptCmdOpt%
 set JobMgr_NXPromptGet_ResCode=0
 set JobMgr_NXPromptGet_ResMsg=OK


 if /i "%JobMgr_Debug%" neq "ON" goto :JumbOver
  Call Echo "---------------------------------------------------------------------------"
  Call Echo "#Debug:..........................: after excuting"
  Call Echo "NxPromptCmd......................: %NxPromptCmd%"
  Call Echo "NxPromptCmdOpt...................: %NxPromptCmdOpt%"
  Call Echo "UGII_BASE_DIR....................: %UGII_BASE_DIR%"
  pause
:JumbOver


:Next
 if not defined UGII_BASE_DIR goto :Next
 if not exist "%UGII_BASE_DIR%\nxbin" goto :Next
 REM -- #New: 30.01.2017/J.Fes add tp path .\nxbin since NX11
 set UGII_NXBIN_DIR=%UGII_BASE_DIR%\nxbin
 Call PathEnvAddPath.cmd "%UGII_NXBIN_DIR%"
:Next

 if not defined UGII_ROOT_DIR goto :Next
 Call PathEnvAddPath.cmd "%UGII_ROOT_DIR%"
:Next

 if not defined UGII_BASE_DIR goto :Next
 Call PathEnvAddPath.cmd "%UGII_BASE_DIR%"
:Next

 call Echo "JobMgr_NXPromptGet_ResCode......: %JobMgr_NXPromptGet_ResCode%"
 call Echo "JobMgr_NXPromptGet_ResMsg.......: %JobMgr_NXPromptGet_ResMsg%"
 goto :end
:end

if /i "%JobMgr_Debug%" neq "ON" goto :JumbOverDebug
 call Echo "---------------------------------------------------------------------------"
 call Echo "#Debug..........................: %~0"
 Echo "-- UG --------------------------------------------------------------------"
 set UG
 Echo "-- NX --------------------------------------------------------------------"
 set NX
 pause
:JumbOverDebug

