Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
Apd Toolbox
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Jan Reher
Apd Toolbox
Commits
96136b38
Commit
96136b38
authored
3 years ago
by
Jan Reher
Browse files
Options
Downloads
Patches
Plain Diff
Adding makeProdSheet.cpp
parent
ef745bf3
Branches
master
No related tags found
No related merge requests found
Pipeline
#2925
passed with stage
in 1 minute and 16 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+4
-0
4 additions, 0 deletions
CMakeLists.txt
makeProdSheet.cpp
+204
-0
204 additions, 0 deletions
makeProdSheet.cpp
toolbox.cpp
+6
-1
6 additions, 1 deletion
toolbox.cpp
with
214 additions
and
1 deletion
CMakeLists.txt
+
4
−
0
View file @
96136b38
...
@@ -32,6 +32,8 @@ add_executable(validateSerials "validateSerials.cpp")
...
@@ -32,6 +32,8 @@ add_executable(validateSerials "validateSerials.cpp")
add_executable
(
testXmlStructure
"testxmlstructure.cxx"
)
add_executable
(
testXmlStructure
"testxmlstructure.cxx"
)
add_executable
(
makeProdSheet
"makeProdSheet.cpp"
)
target_link_libraries
(
toolbox Qt5::Network Qt5::Core Qt5::Xml proddbaccess
)
target_link_libraries
(
toolbox Qt5::Network Qt5::Core Qt5::Xml proddbaccess
)
target_link_libraries
(
proddbaccess Qt5::Network Qt5::Core Qt5::Xml
)
target_link_libraries
(
proddbaccess Qt5::Network Qt5::Core Qt5::Xml
)
...
@@ -53,3 +55,5 @@ target_link_libraries(setSentForAnalysisAfterIrradiation proddbaccess proddbclie
...
@@ -53,3 +55,5 @@ target_link_libraries(setSentForAnalysisAfterIrradiation proddbaccess proddbclie
target_link_libraries
(
setIrradiationInfo proddbaccess proddbclient boost_program_options Qt5::Gui Qt5::Widgets
)
target_link_libraries
(
setIrradiationInfo proddbaccess proddbclient boost_program_options Qt5::Gui Qt5::Widgets
)
target_link_libraries
(
setAnnealingInfo proddbaccess proddbclient boost_program_options Qt5::Gui Qt5::Widgets
)
target_link_libraries
(
setAnnealingInfo proddbaccess proddbclient boost_program_options Qt5::Gui Qt5::Widgets
)
target_link_libraries
(
validateSerials proddbaccess
)
target_link_libraries
(
validateSerials proddbaccess
)
target_compile_features
(
makeProdSheet PRIVATE cxx_std_17
)
This diff is collapsed.
Click to expand it.
makeProdSheet.cpp
0 → 100644
+
204
−
0
View file @
96136b38
#include
<iostream>
#include
<fstream>
#include
<string>
#include
<vector>
#include
<filesystem>
#include
<cstdlib>
#include
<chrono>
bool
checkFilesExist
(
std
::
string
texFileName
,
std
::
string
csvFileName
,
std
::
string
prodSheetPdfName
){
bool
oneFileExists
=
false
;
if
(
std
::
filesystem
::
exists
(
texFileName
)){
std
::
cerr
<<
"ERROR - "
<<
texFileName
<<
" already exists"
<<
std
::
endl
;
oneFileExists
=
true
;
}
if
(
std
::
filesystem
::
exists
(
csvFileName
)){
std
::
cerr
<<
"ERROR - "
<<
csvFileName
<<
" already exists"
<<
std
::
endl
;
oneFileExists
=
true
;
}
if
(
std
::
filesystem
::
exists
(
prodSheetPdfName
)){
std
::
cerr
<<
"ERROR - "
<<
prodSheetPdfName
<<
" already exists"
<<
std
::
endl
;
oneFileExists
=
true
;
}
return
oneFileExists
;
}
bool
makeTexFile
(
std
::
vector
<
std
::
string
>
serialList
,
std
::
string
texFileName
){
std
::
fstream
serialTexFile
;
serialTexFile
.
open
(
texFileName
,
std
::
fstream
::
out
);
if
(
serialTexFile
.
is_open
()){
serialTexFile
<<
"
\\
newcommand{
\\
serialZeroR}{"
<<
serialList
[
0
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialZeroB}{"
<<
serialList
[
8
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialOneR}{"
<<
serialList
[
1
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialOneB}{"
<<
serialList
[
9
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialTwoR}{"
<<
serialList
[
16
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialTwoB}{"
<<
serialList
[
24
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialThreeR}{"
<<
serialList
[
17
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialThreeB}{"
<<
serialList
[
25
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialFourR}{"
<<
serialList
[
2
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialFourB}{"
<<
serialList
[
10
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialFiveR}{"
<<
serialList
[
3
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialFiveB}{"
<<
serialList
[
11
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialSixR}{"
<<
serialList
[
18
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialSixB}{"
<<
serialList
[
26
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialSevenR}{"
<<
serialList
[
19
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialSevenB}{"
<<
serialList
[
27
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialEightR}{"
<<
serialList
[
4
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialEightB}{"
<<
serialList
[
12
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialNineR}{"
<<
serialList
[
5
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialNineB}{"
<<
serialList
[
13
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialAR}{"
<<
serialList
[
20
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialAB}{"
<<
serialList
[
28
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialBR}{"
<<
serialList
[
21
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialBB}{"
<<
serialList
[
29
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialCR}{"
<<
serialList
[
6
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialCB}{"
<<
serialList
[
14
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialDR}{"
<<
serialList
[
7
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialDB}{"
<<
serialList
[
15
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialER}{"
<<
serialList
[
22
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialEB}{"
<<
serialList
[
30
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialFR}{"
<<
serialList
[
23
]
<<
"}"
<<
std
::
endl
;
serialTexFile
<<
"
\\
newcommand{
\\
serialFB}{"
<<
serialList
[
31
]
<<
"}"
<<
std
::
endl
;
/*
serialTexFile << "\\newcommand{\\serialZeroR}{" << serialList[0] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialZeroB}{" << serialList[1] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialOneR}{" << serialList[2] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialOneB}{" << serialList[3] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialTwoR}{" << serialList[4] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialTwoB}{" << serialList[5] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialThreeR}{" << serialList[6] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialThreeB}{" << serialList[7] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialFourR}{" << serialList[8] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialFourB}{" << serialList[9] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialFiveR}{" << serialList[10] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialFiveB}{" << serialList[11] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialSixR}{" << serialList[12] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialSixB}{" << serialList[13] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialSevenR}{" << serialList[14] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialSevenB}{" << serialList[15] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialEightR}{" << serialList[16] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialEightB}{" << serialList[17] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialNineR}{" << serialList[18] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialNineB}{" << serialList[19] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialAR}{" << serialList[20] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialAB}{" << serialList[21] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialBR}{" << serialList[22] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialBB}{" << serialList[23] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialCR}{" << serialList[24] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialCB}{" << serialList[25] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialDR}{" << serialList[26] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialDB}{" << serialList[27] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialEB}{" << serialList[29] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialER}{" << serialList[28] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialFR}{" << serialList[30] << "}" << std::endl;
serialTexFile << "\\newcommand{\\serialFB}{" << serialList[31] << "}" << std::endl;
*/
}
else
{
std
::
cerr
<<
"ERROR - couldnt open tex-file"
<<
std
::
endl
;
return
false
;
}
return
true
;
}
bool
makeCsvFile
(
std
::
vector
<
std
::
string
>
serialList
,
std
::
string
csvFileName
){
std
::
fstream
serialCsvFile
;
serialCsvFile
.
open
(
csvFileName
,
std
::
fstream
::
out
);
if
(
serialCsvFile
.
is_open
()){
serialCsvFile
<<
serialList
[
0
]
<<
" "
<<
serialList
[
8
]
<<
std
::
endl
;
serialCsvFile
<<
serialList
[
1
]
<<
" "
<<
serialList
[
9
]
<<
std
::
endl
;
serialCsvFile
<<
serialList
[
16
]
<<
" "
<<
serialList
[
24
]
<<
std
::
endl
;
serialCsvFile
<<
serialList
[
17
]
<<
" "
<<
serialList
[
25
]
<<
std
::
endl
;
serialCsvFile
<<
serialList
[
2
]
<<
" "
<<
serialList
[
10
]
<<
std
::
endl
;
serialCsvFile
<<
serialList
[
3
]
<<
" "
<<
serialList
[
11
]
<<
std
::
endl
;
serialCsvFile
<<
serialList
[
18
]
<<
" "
<<
serialList
[
26
]
<<
std
::
endl
;
serialCsvFile
<<
serialList
[
19
]
<<
" "
<<
serialList
[
27
]
<<
std
::
endl
;
serialCsvFile
<<
serialList
[
4
]
<<
" "
<<
serialList
[
12
]
<<
std
::
endl
;
serialCsvFile
<<
serialList
[
5
]
<<
" "
<<
serialList
[
13
]
<<
std
::
endl
;
serialCsvFile
<<
serialList
[
20
]
<<
" "
<<
serialList
[
28
]
<<
std
::
endl
;
serialCsvFile
<<
serialList
[
21
]
<<
" "
<<
serialList
[
29
]
<<
std
::
endl
;
serialCsvFile
<<
serialList
[
6
]
<<
" "
<<
serialList
[
14
]
<<
std
::
endl
;
serialCsvFile
<<
serialList
[
7
]
<<
" "
<<
serialList
[
15
]
<<
std
::
endl
;
serialCsvFile
<<
serialList
[
22
]
<<
" "
<<
serialList
[
30
]
<<
std
::
endl
;
serialCsvFile
<<
serialList
[
23
]
<<
" "
<<
serialList
[
31
]
<<
std
::
endl
;
/*
for (int i=0; i < serialList.size()-1; i+=2){
serialCsvFile << serialList[i] << " " << serialList[i+1] << std::endl;
}
*/
}
else
{
std
::
cerr
<<
"ERROR - couldnt open csv-file"
<<
std
::
endl
;
return
false
;
}
return
true
;
}
bool
makePdfFile
(
std
::
string
prodSheetPdfName
){
//std::system("cp /home/orestis/Dokumente/Laufzettel/headerProductionSheet.tex .");
std
::
system
(
"cp /home/tau/oafedulidis/APDStuff/makeProdSheet/tex/headerProductionSheet.tex ."
);
//std::system("cp /home/orestis/Dokumente/Laufzettel/productionSheet.tex .");
std
::
system
(
"cp /home/tau/oafedulidis/APDStuff/makeProdSheet/tex/productionSheet.tex ."
);
std
::
system
(
"pdflatex productionSheet.tex > /dev/null"
);
if
(
std
::
filesystem
::
exists
(
prodSheetPdfName
)){
std
::
system
(
"rm productionSheet.log productionSheet.aux productionSheet.tex serialsAssigned.tex headerProductionSheet.tex"
);
return
true
;
}
else
{
return
false
;
}
}
int
main
(){
std
::
string
serialFileName
=
"serials.dat"
;
std
::
string
csvFileName
=
"apd_assignments_on_alveole.csv"
;
std
::
string
texFileName
=
"serialsAssigned.tex"
;
std
::
string
prodSheetPdfName
=
"productionSheet.pdf"
;
std
::
string
lineBuffer
;
std
::
vector
<
std
::
string
>
serialList
;
serialList
.
clear
();
std
::
fstream
serialFile
;
serialFile
.
open
(
serialFileName
,
std
::
fstream
::
in
);
if
(
serialFile
.
is_open
()){
while
(
std
::
getline
(
serialFile
,
lineBuffer
)){
if
(
lineBuffer
.
size
()
==
9
)
lineBuffer
=
"0"
+
lineBuffer
;
if
(
lineBuffer
.
size
()
==
10
)
serialList
.
push_back
(
lineBuffer
);
}
serialFile
.
close
();
}
else
{
std
::
cerr
<<
"ERROR - could not open File: "
<<
serialFileName
<<
std
::
endl
;
return
1
;
}
if
(
serialList
.
size
()
==
32
){
std
::
cout
<<
"found "
<<
serialList
.
size
()
<<
" serials"
<<
std
::
endl
;
std
::
cout
<<
"creating tex-file for production sheet"
<<
std
::
endl
;
std
::
cout
<<
"creating csv-file for APD serials where Crystals and Barcodes needs to be added"
<<
std
::
endl
;
if
(
!
checkFilesExist
(
texFileName
,
csvFileName
,
prodSheetPdfName
)){
if
(
!
makeTexFile
(
serialList
,
texFileName
))
return
1
;
if
(
!
makeCsvFile
(
serialList
,
csvFileName
))
return
1
;
}
else
{
return
1
;
}
}
else
{
std
::
cerr
<<
"ERROR - unexpected amount of serials, expected 32 but got "
<<
serialList
.
size
();
return
1
;
}
std
::
cout
<<
"serialsAssigned.tex and apd_assignments_on_alveole.csv created"
<<
std
::
endl
;
std
::
cout
<<
"know executing pdflatex to compile productionSheet.pdf"
<<
std
::
endl
;
if
(
makePdfFile
(
prodSheetPdfName
)){
std
::
cout
<<
"productionSheet.pdf created and cleared output"
<<
std
::
endl
;
}
else
{
std
::
cout
<<
"could not create productionSheet.pdf"
<<
std
::
endl
;
return
1
;
}
return
0
;
}
This diff is collapsed.
Click to expand it.
toolbox.cpp
+
6
−
1
View file @
96136b38
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
#include
<iostream>
#include
<iostream>
#include
<string>
#include
<string>
#include
<vector>
#include
<vector>
#include
<algorithm>
#include
"ProdDbAccess.h"
#include
"ProdDbAccess.h"
#include
"BulkDbAccess.h"
#include
"BulkDbAccess.h"
...
@@ -22,6 +23,10 @@ vector<string> loadSerialsFromFileName(string m_fileName, bool m_debug = false)
...
@@ -22,6 +23,10 @@ vector<string> loadSerialsFromFileName(string m_fileName, bool m_debug = false)
while
(
in
.
good
())
{
while
(
in
.
good
())
{
getline
(
in
,
line
);
getline
(
in
,
line
);
if
(
line
.
length
()
==
0
||
!
isdigit
(
line
[
0
]))
continue
;
if
(
line
.
length
()
==
0
||
!
isdigit
(
line
[
0
]))
continue
;
line
.
erase
(
std
::
remove_if
(
line
.
begin
(),
line
.
end
(),
[](
char
c
)
{
return
!
std
::
isdigit
(
c
);
}),
line
.
end
());
while
(
line
.
length
()
<
10
)
{
line
=
"0"
+
line
;
}
result
.
push_back
(
line
);
result
.
push_back
(
line
);
if
(
m_debug
)
cout
<<
"Found serial: "
<<
line
<<
endl
;
if
(
m_debug
)
cout
<<
"Found serial: "
<<
line
<<
endl
;
}
}
...
@@ -38,7 +43,7 @@ AbsDbAccess *suitedDbAccess(size_t nAPDs, bool debug = false) {
...
@@ -38,7 +43,7 @@ AbsDbAccess *suitedDbAccess(size_t nAPDs, bool debug = false) {
}
}
else
{
else
{
if
(
debug
)
if
(
debug
)
std
::
cout
<<
"Initializing
Bulk
DbAccess
which becomes efficient for many queries. Patience, this might take a minute
..."
;
std
::
cout
<<
"Initializing
Prod
DbAccess
, since only a few APDs are being queried
..."
;
result
=
new
ProdDbAccess
();
result
=
new
ProdDbAccess
();
}
}
return
result
;
return
result
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment