forked from arkuznetsov/1CFilesConverter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
dp-bin-dir2xml.cmd
88 lines (78 loc) · 3.43 KB
/
dp-bin-dir2xml.cmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
@ECHO OFF
rem Convert (dump) all 1C data processors & reports (*.epf, *.erf) in folder to 1C:Designer XML format
rem %1 - path to folder contains data processors & reports in binary format (*.epf, *.erf)
rem %2 - path to folder to save 1C data processors & reports in 1C:Designer XML format
rem %3 - path to 1C configuration (binary (*.cf), 1C:Designer XML format or 1C:EDT format)
rem or folder contains 1C infobase used for convertion
if not defined V8_VERSION set V8_VERSION=8.3.20.2290
if not defined V8_TEMP set V8_TEMP=%TEMP%\1c
set V8_TOOL="C:\Program Files\1cv8\%V8_VERSION%\bin\1cv8.exe"
set IB_PATH=%V8_TEMP%\tmp_db
set CLEAN_AFTER_EXPORT=0
set DP_BIN_PATH=%1
if defined DP_BIN_PATH set DP_BIN_PATH=%DP_BIN_PATH:"=%
set DP_SRC_PATH=%2
if defined DP_SRC_PATH set DP_SRC_PATH=%DP_SRC_PATH:"=%
set BASE_CONFIG=%3
if defined BASE_CONFIG set BASE_CONFIG=%BASE_CONFIG:"=%
if not defined DP_BIN_PATH (
echo Missed parameter 1 "path to folder contains data processors & reports in binary format (*.epf, *.erf)"
exit /b 1
)
if not defined DP_SRC_PATH (
echo Missed parameter 2 "path to folder to save 1C data processors & reports in 1C:Designer XML format"
exit /b 1
)
if not exist "%BASE_CONFIG%" (
echo Path "%BASE_CONFIG%" doesn't exist ^(parameter 3^), empty infobase will be used.
set BASE_CONFIG=
)
echo Set infobase for export data processor/report...
IF "%BASE_CONFIG%" equ "" (
echo Creating infobase "%IB_PATH%"...
set CLEAN_AFTER_EXPORT=1
set BASE_CONFIG_DESCRIPTION=empty configuration
%V8_TOOL% CREATEINFOBASE File=%IB_PATH%; /DisableStartupDialogs
) else (
set BASE_CONFIG_DESCRIPTION=configuration from "%BASE_CONFIG%"
IF exist "%BASE_CONFIG%\DT-INF\" (
set CLEAN_AFTER_EXPORT=1
call %~dp0edt2ib.cmd "%BASE_CONFIG%" "%IB_PATH%"
) else (
IF exist "%BASE_CONFIG%\Configuration.xml" (
set CLEAN_AFTER_EXPORT=1
call %~dp0xml2ib.cmd "%BASE_CONFIG%" "%IB_PATH%"
) else (
IF exist "%BASE_CONFIG%\1cv8.1cd" (
set BASE_CONFIG_DESCRIPTION=existed configuration
set IB_PATH=%BASE_CONFIG%
) else (
set CLEAN_AFTER_EXPORT=1
call %~dp0cf2ib.cmd "%BASE_CONFIG%" "%IB_PATH%"
)
)
)
)
echo Clear temporary files...
IF "%CLEAN_AFTER_EXPORT%" equ "1" (
rd /S /Q "%IB_PATH%"
)
md "%DP_SRC_PATH%"
echo Export dataprocessors from folder "%DP_BIN_PATH%" to 1C:Designer XML format "%DP_SRC_PATH%" using infobase "%IB_PATH%" with %BASE_CONFIG_DESCRIPTION%...
FOR /f %%f IN ('dir /b /a-d "%DP_BIN_PATH%\*.epf"') DO (
FOR %%i IN (%%~nf) DO (
echo Building %%~ni...
%V8_TOOL% DESIGNER /IBConnectionString File="%IB_PATH%"; /DisableStartupDialogs /DumpExternalDataProcessorOrReportToFiles "%DP_SRC_PATH%" "%DP_BIN_PATH%\%%~ni.epf"
)
)
echo Export reports from folder "%DP_BIN_PATH%" to 1C:Designer XML format "%DP_SRC_PATH%" using infobase "%IB_PATH%" with %BASE_CONFIG_DESCRIPTION%...
FOR /f %%f IN ('dir /b /a-d "%DP_BIN_PATH%\*.erf"') DO (
FOR %%i IN (%%~nf) DO (
echo Building %%~ni...
%V8_TOOL% DESIGNER /IBConnectionString File="%IB_PATH%"; /DisableStartupDialogs /DumpExternalDataProcessorOrReportToFiles "%DP_SRC_PATH%" "%DP_BIN_PATH%\%%~ni.erf"
)
)
echo Clear temporary files...
IF "%CLEAN_AFTER_EXPORT%" equ "1" (
rd /S /Q "%IB_PATH%"
)