Skip to content
Snippets Groups Projects
Commit a819eb04 authored by Jan Reher's avatar Jan Reher
Browse files

Made apdSetInfoGiessen.cpp file from copying and included it in CMakeLists.txt. Not working yet!

parent 05fc9d83
No related branches found
No related tags found
No related merge requests found
Pipeline #1290 failed with stages
in 1 minute
......@@ -18,6 +18,7 @@ add_executable(setArrivalForIrradiation "apdsetarrivalforirradiation.cpp")
add_executable(setSentForAnalysisAfterIrradiation "apdSetSentForAnalysisAfterIrradiation.cpp")
add_executable(setIrradiationInfo "apdSetIrradiationInfo.cpp")
add_executable(setAnnealingInfo "apdSetAnnealingInfo.cpp")
add_executable(setInfoGiessen "apdSetInfoGiessen.cpp")
add_executable(apdBoxSetter "apdboxsetter.cpp")
add_executable(getLocations "getlocations.cpp")
add_executable(getBatch "getbatch.cpp")
......@@ -44,4 +45,5 @@ target_link_libraries(setArrivalForIrradiation proddbclient boost_program_option
target_link_libraries(setSentForAnalysisAfterIrradiation proddbclient boost_program_options Qt5::Gui Qt5::Widgets)
target_link_libraries(setIrradiationInfo proddbclient boost_program_options Qt5::Gui Qt5::Widgets)
target_link_libraries(setAnnealingInfo proddbclient boost_program_options Qt5::Gui Qt5::Widgets)
target_link_libraries(setInfoGiessen proddbclient boost_program_options Qt5::Gui Qt5::Widgets)
#include <fstream>
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <productiondatabaseclient.h>
#include <boost/program_options.hpp>
#include "toolbox.cpp"
#include "BulkDbAccess.h"
#include "QtGui/QApplication"
namespace po=boost::program_options;
using namespace std;
using namespace ProductionDatabase;
static string fileName = "serials.dat";
static string username = "";
static string password = "";
static string arrivalDate = "1970-01-01";
static string irradiationDate = "1970-01-01";
static string annealingDate = "1970-01-01";
static string sentBackDate = "1970-01-01";
static double irradiationDose = -1;
static double irradiationTemp = -300;
static double annealingTemp = -300;
static double annealingTime = -1;
static string change = "";
static bool debug = false;
void processArgumentsAndQueryMissing(int m_argc, char* m_argv[]) {
po::options_description desc("Available options");
desc.add_options()
("help", "produce help message")
("fileName", po::value<string>(), "file name for serial numbers [serials.dat]")
("user", po::value<string>(), "User name to connect to DB. Only used when combined with pass!")
("pass", po::value<string>(), "Password to connect to DB. Only used when combined with user!")
("day", po::value<short>(), "Day of arrival")
("month", po::value<short>(), "Month of arrival")
("year", po::value<short>(), "Year of arrival")
("dose", po::value<double>(), "Irradiation dose to enter")
("temp", po::value<double>(), "Temperature during irradiation")
("debug", "emit additional messages for debugging purposes")
;
po::variables_map vm;
po::store(po::parse_command_line(m_argc, m_argv, desc), vm);
po::notify(vm);
if (vm.count("help")) {
cout << desc << "\n";
exit(0);
}
if (vm.count("fileName")) {
fileName = vm["fileName"].as<string>();
cout << "Reading serials from " << fileName << endl;
}
if (vm.count("user")) {
username = vm["user"].as<string>();
}
if (vm.count("pass")) {
password = vm["pass"].as<string>();
}
if (vm.count("debug")) {
debug = true;
}
}
int main(int argc, char* argv[]) {
QApplication *_app = new QApplication(argc, argv);
processArgumentsAndQueryMissing(argc, argv);
vector<string> apdSerials;
apdSerials = loadSerialsFromFileName(fileName);
if ( apdSerials.size() == 0 ) {
cout << "No data to write! Exiting." << endl;
return 0;
}
cout << "Data will be written for " << apdSerials.size() << " APDs." << endl;
ProductionDatabaseClient *_proddbclient = new ProductionDatabaseClient();
if (username == "" || password == "") _proddbclient->queryCredentials();
else _proddbclient->setCredentials(username, password);
DatabaseClientResponse response = _proddbclient->checkConnectivityAndCredentials();
if (response != Successful ) {
cerr << "Connection to database failed because of error: " << response << endl;
return response;
}
if (debug) cout << "Connection successful!" << endl;
_proddbclient->storeApdIrradiationInfo(apdSerials,dose, temp, irradiationDay,irradiationMonth,irradiationYear);
cout << "\nSuccessfully entered irradiation with " << dose << " Gy at " << temp << "degrees celsius on " << irradiationDay << "." << irradiationMonth << "." << irradiationYear << " to APDs from serial file " << fileName << "!\n\nThank you for using the ApdToolbox! :)" << endl << endl;
_app->exit(0);
return (-apdSerials.empty());
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment