@echo off
SET /a LIMIT=60
SET /a UPLOAD='c:\upload'

GOTO :TopOfCode
---------------------------------------------------------------------
getMQSAll 	  - Get Available Data from Customer Interface & create VIMS transactions
Usage:      	c:\web\veldb\rdtnsk\vimsinterface\vimsupload.bat
---------------------------------------------------------------------
:TopOfCode
@echo on
echo
echo Waiting... 
TIMEOUT /T %LIMIT% /NOBREAK
echo
@echo off

@echo on
cd c:\web\veldb\rdtnsk\vimsinterface\idocin
CALL python default_setting.py interfacein > temp.txt
set /p UPLOADIN=<temp.txt
echo %UPLOADIN%

CALL python default_setting.py interfaceout > temp.txt
set /p UPLOADOUT=<temp.txt
echo %UPLOADOUT%
@echo off

REM COPY n:\input\*.xlsx c:\web\veldb\rdtnsk\vimsinterface\vimsin\
REM DEL n:\input\*.* /Q

COPY %UPLOADIN%\*.* c:\web\veldb\rdtnsk\vimsinterface\vimsin\
DEL %UPLOADIN%\*.* /Q

REM cd c:\web\veldb\rdtnsk\vimsinterface\idocin
REM CALL python vimsftp.py
cd c:\web\veldb\rdtnsk\vimsinterface\vimsin

Setlocal enabledelayedexpansion
Set "Pattern= "
Set "Replace=_"
For %%a in (*.xlsx) Do (
    Set "File=%%~a"
    Ren "%%a" "!File:%Pattern%=%Replace%!"
)

FOR %%A in (*.xlsx) do CALL :procfile3 %%A
FOR %%A in (NMUKBP*.txt) do CALL :procnmukbp %%A
FOR %%A in (RJEIN*.*) do CALL :procfile1 %%A
FOR %%A in (PCK*.*) do CALL :procfile2 %%A

GOTO :TopOfCode

:procfile1
echo %1
cd c:\web\veldb\rdtnsk\vimsinterface\vimsin
COPY %1 c:\web\veldb\rdtnsk\vimsinterface\vimsin\IDOCTRANIN.txt
cd c:\web\veldb\rdtnsk\vimsinterface\idocin
CALL python c:\web\veldb\rdtnsk\vimsinterface\idocin\idocin.py
cd c:\web\veldb\rdtnsk\vimsinterface\vimsin
DEL %1
cd c:\web\veldb\rdtnsk\vimsinterface\vimsjson
FOR %%A in (SUPPORDR*.*) DO CALL :procsuppord %%A
GOTO :TopOfCode

:procsuppord
echo %1
cd c:\web\veldb\rdtnsk\vimsinterface\vimsjson
COPY %1 c:\web\veldb\rdtnsk\vimsinterface\vimsjson\IDOCTRANOUT.json
cd c:\web\veldb\rdtnsk\vimsinterface\idocin
CALL python c:\web\veldb\rdtnsk\vimsinterface\idocin\tt_ran_order.py
cd c:\web\veldb\rdtnsk\vimsinterface\vimsjson
DEL %1
DEL c:\web\veldb\rdtnsk\vimsinterface\vimsjson\IDOCTRANOUT.json
cd c:\web\veldb\rdtnsk\vimsinterface\idocin
GOTO :TopOfCode

:procfile2
GOTO :TopOfCode

:procfile3
echo "%1"
cd c:\web\veldb\rdtnsk\vimsinterface\vimsin
COPY %1 c:\web\veldb\rdtnsk\vimsinterface\vimsin\order.XLSX
cd c:\web\veldb\rdtnsk\vimsinterface\idocin
CALL python c:\web\veldb\rdtnsk\vimsinterface\idocin\excel_order.py
cd c:\web\veldb\rdtnsk\vimsinterface\vimsin
DEL order.XLSX /q
REM echo "%1"
REM COPY %1 c:\web\veldb\rdtnsk\vimsinterface\vimsin\NMUKBP.XLSX
REM cd c:\web\veldb\rdtnsk\vimsinterface\idocin
REM CALL python c:\web\veldb\rdtnsk\vimsinterface\idocin\nmukbp_order.py
REM cd c:\web\veldb\rdtnsk\vimsinterface\vimsin
REM DEL NMUKBP.XLSX /q
DEL %1

FOR %%A in (order*.TXT) DO CALL :procord %%A
REM FOR %%A in (NMUKBP*.TXT) DO CALL :procord %%A

GOTO :TopOfCode

:procord
echo %1
cd c:\web\veldb\rdtnsk\vimsinterface\vimsin
COPY %1 c:\web\veldb\rdtnsk\vimsinterface\vimsin\IDOCTRANIN.TXT
cd c:\web\veldb\rdtnsk\vimsinterface\idocin
CALL python c:\web\veldb\rdtnsk\vimsinterface\idocin\idocin.py
cd c:\web\veldb\rdtnsk\vimsinterface\vimsin
DEL %1
COPY c:\web\veldb\rdtnsk\vimsinterface\vimsjson\order*.json %UPLOADOUT%
REM COPY c:\web\veldb\rdtnsk\vimsinterface\vimsjson\order*.json n:\output
DEL c:\web\veldb\rdtnsk\vimsinterface\vimsjson\order*.json /Q
REM COPY c:\web\veldb\rdtnsk\vimsinterface\vimsjson\nmukbp*.json %UPLOADOUT%
REM DEL c:\web\veldb\rdtnsk\vimsinterface\vimsjson\nmukbp*.json /Q
cd c:\web\veldb\rdtnsk\vimsinterface\idocin
GOTO :TopOfCode

:procnmukbp
echo %1
cd c:\web\veldb\rdtnsk\vimsinterface\vimsin
COPY %1 c:\web\veldb\rdtnsk\vimsinterface\vimsin\IDOCTRANIN.TXT
cd c:\web\veldb\rdtnsk\vimsinterface\idocin
CALL python c:\web\veldb\rdtnsk\vimsinterface\idocin\idocin.py
cd c:\web\veldb\rdtnsk\vimsinterface\vimsin
DEL %1
COPY c:\web\veldb\rdtnsk\vimsinterface\vimsjson\nmukbp*.json %UPLOADOUT%
DEL c:\web\veldb\rdtnsk\vimsinterface\vimsjson\nmukbp*.json /Q
cd c:\web\veldb\rdtnsk\vimsinterface\idocin
GOTO :TopOfCode

:eof
cd c:\web\veldb\rdtnsk\vimsinterface