diff --git a/.gitignore b/.gitignore index b41bd80b7d96c86c140f215c7520124558055e0a..3922bd31fda3fc2193789174eb9456bfeac0ae1c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ # This file is used to ignore files which are generated # ---------------------------------------------------------------------------- +CMakeFiles/ + *~ *.autosave *.a diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml.tempoff similarity index 100% rename from .gitlab-ci.yml rename to .gitlab-ci.yml.tempoff diff --git a/CMakeLists.txt b/CMakeLists.txt index a2b2a84685985cdce75ecf2b5dce964ec4c6c611..347952f21f1157d8df6123684fadc98d51cd3057 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,7 @@ find_package(Qt5 COMPONENTS Core Gui Widgets Network Xml) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/includes/) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/proddb/) INCLUDE_DIRECTORIES($ENV{proddb_clientlib_includes}) +INCLUDE_DIRECTORIES("/home/tau/jreher/git/proddb-clientlib") LINK_DIRECTORIES($ENV{proddb_clientlib_libpath}) add_library(toolbox "toolbox.cpp" "serialListReader.h" "serialListReader.cxx" "gridListReader.h" "gridListReader.cxx") @@ -26,6 +27,7 @@ add_executable(getU100 "getu100.cxx") add_executable(makeSerialList "makeseriallist.cxx") add_executable(makeGridList "makeGridList.cxx") add_executable(getIrradiationDose "getirradiationstatus.cxx") +add_executable(apdUnitCreator "apdUnitCreator.cpp") add_executable(testXmlStructure "testxmlstructure.cxx") @@ -35,6 +37,7 @@ target_link_libraries(proddbaccess Qt5::Network Qt5::Core Qt5::Xml) target_link_libraries(apdBatchSetter proddbaccess proddbclient boost_program_options) target_link_libraries(apdBoxSetter proddbaccess proddbclient boost_program_options) target_link_libraries(apdUnavailableSetter proddbaccess proddbclient boost_program_options) +target_link_libraries(apdUnitCreator proddbclient boost_program_options) target_link_libraries(getLocations proddbaccess boost_program_options) target_link_libraries(getBatch proddbaccess boost_program_options) target_link_libraries(getIrradiationDose proddbaccess boost_program_options) diff --git a/apdSetAnnealingInfo.cpp b/apdSetAnnealingInfo.cpp index 52a9987b0d0d331670ac7ce09ec8d05631e12bf2..a7e54e18a48c446068ec5c7506e999172c289114 100644 --- a/apdSetAnnealingInfo.cpp +++ b/apdSetAnnealingInfo.cpp @@ -9,7 +9,7 @@ #include "toolbox.cpp" #include "BulkDbAccess.h" -#include "QtGui/QApplication" +#include "QApplication" namespace po=boost::program_options; using namespace std; diff --git a/apdSetIrradiationInfo.cpp b/apdSetIrradiationInfo.cpp index ddc40a1a837969d84ab5d3f428b3200f616ae6f9..b206c91d875112fa4c5b827c19029d75de940c69 100644 --- a/apdSetIrradiationInfo.cpp +++ b/apdSetIrradiationInfo.cpp @@ -9,7 +9,7 @@ #include "toolbox.cpp" #include "BulkDbAccess.h" -#include "QtGui/QApplication" +#include "QApplication" namespace po=boost::program_options; using namespace std; diff --git a/apdSetSentForAnalysisAfterIrradiation.cpp b/apdSetSentForAnalysisAfterIrradiation.cpp index 89d1ac86baec58bc3c525167faad2ad8090d7053..8d139da817af201da51c850130b262a97c0486dc 100644 --- a/apdSetSentForAnalysisAfterIrradiation.cpp +++ b/apdSetSentForAnalysisAfterIrradiation.cpp @@ -9,7 +9,7 @@ #include "toolbox.cpp" #include "BulkDbAccess.h" -#include "QtGui/QApplication" +#include "QApplication" namespace po=boost::program_options; using namespace std; diff --git a/apdUnitCreator.cpp b/apdUnitCreator.cpp new file mode 100644 index 0000000000000000000000000000000000000000..10095d9df34e5eb33f2e1bebb5fedbb371ff0076 --- /dev/null +++ b/apdUnitCreator.cpp @@ -0,0 +1,194 @@ +#include <fstream> +#include <iostream> +#include <iomanip> +#include <string> +#include <vector> + +#include <productiondatabaseclient.h> +#include <boost/program_options.hpp> + +using namespace std; +using namespace ProductionDatabase; +namespace po = boost::program_options; + +struct unitInfo { + std::string redSerial = ""; + std::string blueSerial = ""; + std::string crystalSerial = ""; + uint barCode = 0; +}; + +static string fileName = "serials.dat"; +static int boxNo = 0; +static bool debug = false; +static string username = ""; +static string password = ""; + +std::string moduleSN; +static bool makeCapsules = true; +static bool makeUnits = true; +static bool assignToModule = false; + +static vector<unitInfo> newUnits; + +void processArgumentsAndQueryMissing(int m_argc, char* m_argv[]); +void loadSerialsFromFileName(string m_fileName, bool m_debug = false); + +int main(int argc, char* argv[]) { + processArgumentsAndQueryMissing(argc, argv); + ProductionDatabaseClient *proddb = new ProductionDatabaseClient(); + + if (debug) cout << "Intitialized apdBoxSetter with version " << proddb->getVersion() << " of the database access libraries." << endl << endl + << "Now trying to set Batch number " << boxNo << " for ADPs from serial file " << fileName << endl; + + loadSerialsFromFileName(fileName); + + if (username == "" || password == "") proddb->queryCredentials(); + else proddb->setCredentials(username, password); + DatabaseClientResponse response = proddb->checkConnectivityAndCredentials(); + if (response != Successful ) { + cerr << "Connection to database failed because of error: " << response << endl; + return response; + } + if (debug) cout << "Connection successful!" << endl; + + int nFailed = 0; + + std::vector<uint> barcodes; + if (assignToModule && newUnits.size() == 8) + for (size_t i = 0; i < 8; i++) + barcodes.push_back(0); + + for (auto newUnit = newUnits.begin(); newUnit < newUnits.end(); newUnit++) { + try { + if (makeCapsules) { + proddb->createApdCapsule(newUnit->redSerial, newUnit->blueSerial); + } + if (makeUnits) { + std::string capsuleSerial = newUnit->blueSerial + "/" + newUnit->redSerial; + proddb->createApdUnit(capsuleSerial, newUnit->crystalSerial, std::to_string(newUnit->barCode)); + } + if (assignToModule) { + barcodes.push_back(newUnit->barCode); + } + } + catch (std::exception &e) { + nFailed++; + std::cerr << "An error occurred on APD paid with red APD " << newUnit->redSerial << " and blue APD " << newUnit->blueSerial << "!" << std::endl; + std::cerr << e.what() << std::endl << std::endl; + continue; + } + } + + if (assignToModule) { + if (barcodes.size() != 16) + cerr << "Assignments are only possible if there are 8 or 16 Units in file!" << std::endl; + else { + try { + proddb->assignUnitToModule(moduleSN, barcodes); + } + catch (std::exception &e) { + std::cerr << "An error occurred while assigning APDs to Module " << moduleSN << std::endl; + std::cerr << e.what() << std::endl << std::endl; + } + } + } + + cout << "Created " << newUnits.size() << " APD Capsules and assigned them to Units." << std::endl; + if (nFailed > 0) + cerr << "Data entry failed for " << nFailed << " entries!" << std::endl; + + return (-newUnits.empty()); +} + +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 or serial numbers [serials.dat]") + ("noMakeCapsules", "Skip the step of creating capsules from APDs") + ("noMakeUnits", "Skip the step of creating units from capsules") + ("assignToModule", po::value<string>(), "Skip the step of assigning units to submodules") + ("debug", "emit additional messages for debugging purposes") + ("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!") + ; + 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; + } + else { + throw "Please enter a file name!"; + } + if (vm.count("noMakeCapsules")) { + cout << "Skipping capsule creation. Only works if capsules already exist!" << endl; + makeCapsules = false; + } + if (vm.count("noMakeUnits")) { + cout << "Skipping unit creation. Module assignment only works if units already exist!" << endl; + makeUnits= false; + } + if (vm.count("assignToModule")) { + moduleSN = vm["assignToModule"].as<string>(); + cout << "Will assign units to submodule " << moduleSN << std::endl; + assignToModule = true; + } + if (vm.count("user")) { + username = vm["user"].as<string>(); + } + if (vm.count("pass")) { + password = vm["pass"].as<string>(); + } + if (vm.count("debug")) { + debug = true; + } +} + +void loadSerialsFromFileName(string m_fileName, bool m_debug) { + ifstream in(m_fileName.c_str()); + if (!in.good()) { + cerr << "Could not load serials. Does the input file exist?" << endl; + exit(0); + } + + newUnits.clear(); + + int pos = 1; + + string line = ""; + while (in.good()) { + getline(in,line); + if (line.length() == 0 || !isdigit(line[0])) { + pos++; + continue; + } + unitInfo newUnit; + + uint barcode; + + std::stringstream linestream(line); + linestream >> newUnit.redSerial >> newUnit.blueSerial >> newUnit.crystalSerial >> barcode; + + if (barcode == 0) continue; + if (barcode <1000000 ) + barcode += 1309000000; + newUnit.barCode = barcode; + + std::cout << "Found new unit with RS = " << newUnit.redSerial << ", BS = " << newUnit.blueSerial << ", CS = " << newUnit.crystalSerial << ", BC = " << newUnit.barCode << std::endl; + + newUnits.push_back(newUnit); + } + + cerr << "Found " << newUnits.size() << " new Units to be entered." << endl; + return; +} + + diff --git a/apdlocationsetter.cpp b/apdlocationsetter.cpp index 876d5db1208b824e2ceeb5b9ab6d0b4fea60080e..03cb46770fbd89408b32f5e7dcf9c570677e4238 100644 --- a/apdlocationsetter.cpp +++ b/apdlocationsetter.cpp @@ -3,13 +3,14 @@ #include <iomanip> #include <string> #include <vector> +#include <regex> #include <productiondatabaseclient.h> #include <boost/program_options.hpp> #include "toolbox.cpp" #include "BulkDbAccess.h" -#include "QtGui/QApplication" +#include "QApplication" namespace po=boost::program_options; using namespace std; @@ -100,7 +101,7 @@ int main(int argc, char* argv[]) { for ( size_t i = 0 ; i < allApdSerials.size() ; i++ ) { string existinglocation = _proddb->location( uint( stoul( allApdSerials[i] ) ) ); if ( existinglocation != newLocation && ( !unknownonly || existinglocation == "unknown" || existinglocation == "Bochum" || existinglocation == change ) ) - apdSerials.push_back(allApdSerials[i]); + apdSerials.push_back(std::regex_replace(allApdSerials[i],std::regex(R"([\D])"), "")); } if ( apdSerials.size() == 0 ) { diff --git a/apdsetarrivalforirradiation.cpp b/apdsetarrivalforirradiation.cpp index 26ca5fc9222ec39f50bf6aee1a1ce71c0c243f6f..e7a416ff84279a6884e95ff6fe475df36f8adafc 100644 --- a/apdsetarrivalforirradiation.cpp +++ b/apdsetarrivalforirradiation.cpp @@ -9,7 +9,7 @@ #include "toolbox.cpp" #include "BulkDbAccess.h" -#include "QtGui/QApplication" +#include "QApplication" namespace po=boost::program_options; using namespace std; diff --git a/makeseriallist.cxx b/makeseriallist.cxx index fe663669dbbe64d629080c24dcf6ecb0de21a7aa..f0e6f230e19ba285ed92c75aaf509f2ef3af0e1f 100644 --- a/makeseriallist.cxx +++ b/makeseriallist.cxx @@ -13,6 +13,7 @@ void convertStringListToNumbers(); void outputApdsInRange(); static bool debug = false; +static bool backwards = false; static vector<string> serialListString; static vector<unsigned long> serialList; static unsigned long serialMin; @@ -31,17 +32,31 @@ int main(int argc, char *argv[]) { } void processParameters(int argc, char *argv[]) { - if ( argc == 4 && entryExistsInArgList(argc, argv, "debug")) { + size_t validargs = 0; + if (entryExistsInArgList(argc, argv, "debug")) { debug = true; + validargs++; } - else if (argc != 3 ) { - cerr << "Too few or too many parameters!\n" - << "Pass first and last serial of range." << endl; - exit(1); + if (entryExistsInArgList(argc, argv, "backwards")) { + backwards = true; + validargs++; + } + if (argc != validargs+3 ) { + cerr << "Too few or too many parameters!\n" + << "Pass first and last serial of range." << endl; + exit(1); } serialMin = stoul(argv[1]); serialMax = stoul(argv[2]); + + if (serialMin > serialMax) { + unsigned long oldMin = serialMin; + serialMin = serialMax; + serialMax = oldMin; + cerr << "Warning; Minimum is greater than Maximum, switching them and turning on backwards mode!" << endl; + backwards = true; + } } int entryExistsInArgList(int argc, char *argv[], std::string parameterName) { @@ -68,8 +83,11 @@ void convertStringListToNumbers() { void outputApdsInRange() { int numOut = 0; for ( size_t i = 0 ; i < serialList.size() ; i++) { - if ( serialList [i] >= serialMin && serialList [i] <= serialMax ) { - cout << serialListString[i] << endl; + size_t j = i; + if (backwards) + j = serialList.size() - (i+1); + if ( serialList [j] >= serialMin && serialList [j] <= serialMax ) { + cout << serialListString[j] << endl; numOut++; } } diff --git a/makeseriallist2.cxx b/makeseriallist2.cxx new file mode 100644 index 0000000000000000000000000000000000000000..fe663669dbbe64d629080c24dcf6ecb0de21a7aa --- /dev/null +++ b/makeseriallist2.cxx @@ -0,0 +1,77 @@ +#include "serialListReader.h" +#include "QtCore/QCoreApplication" +#include <vector> +#include <string> +#include <iostream> + +using namespace std; + +void processParameters(int argc, char *argv[]); +int entryExistsInArgList(int argc, char *argv[], std::string parameterName); +void getSerialListAsStringsFromDatabase(); +void convertStringListToNumbers(); +void outputApdsInRange(); + +static bool debug = false; +static vector<string> serialListString; +static vector<unsigned long> serialList; +static unsigned long serialMin; +static unsigned long serialMax; + +int main(int argc, char *argv[]) { + processParameters(argc, argv); + QCoreApplication *_app = new QCoreApplication(argc,argv); + + getSerialListAsStringsFromDatabase(); + convertStringListToNumbers(); + outputApdsInRange(); + + _app->exit(0); + return 0; +} + +void processParameters(int argc, char *argv[]) { + if ( argc == 4 && entryExistsInArgList(argc, argv, "debug")) { + debug = true; + } + else if (argc != 3 ) { + cerr << "Too few or too many parameters!\n" + << "Pass first and last serial of range." << endl; + exit(1); + } + + serialMin = stoul(argv[1]); + serialMax = stoul(argv[2]); +} + +int entryExistsInArgList(int argc, char *argv[], std::string parameterName) { + for (int i = 0; i < argc; i++) { + if (argv[i] == parameterName) return true; + } + return false; +} + +void getSerialListAsStringsFromDatabase() { + serialListReader *_reader = new serialListReader(debug); + serialListString = _reader->getListOfSerials(); +} + +void convertStringListToNumbers() { + serialList.clear(); + for ( size_t i = 0 ; i < serialListString.size() ; i++) serialList.push_back( stoul( serialListString[i] ) ); + if ( serialListString.size() != serialList.size() ) { + cerr << "ERROR: Sizes don't match!" << endl; + exit(2); + } +} + +void outputApdsInRange() { + int numOut = 0; + for ( size_t i = 0 ; i < serialList.size() ; i++) { + if ( serialList [i] >= serialMin && serialList [i] <= serialMax ) { + cout << serialListString[i] << endl; + numOut++; + } + } + cerr << "Found " << numOut << " APDs in the given range." << endl; +} diff --git a/proddb/AbsDbAccess.h b/proddb/AbsDbAccess.h new file mode 120000 index 0000000000000000000000000000000000000000..38f3f608d2adf8f7a1128a2cabeb36e9c0590fbf --- /dev/null +++ b/proddb/AbsDbAccess.h @@ -0,0 +1 @@ +/home/tau/jreher/git/ProtoSoft/DAQ/ProductionDatabase/AbsDbAccess.h \ No newline at end of file diff --git a/proddb/BulkDbAccess.cxx b/proddb/BulkDbAccess.cxx index ac6f43dbf53ab6b2bb8466edea984efccf8a6f4d..ce93c985e06a08fc6d21064a3c23a87129ecc294 120000 --- a/proddb/BulkDbAccess.cxx +++ b/proddb/BulkDbAccess.cxx @@ -1 +1 @@ -/home/tau/jreher/git/ProtoSoft/DAQ/ApdCurves/BulkDbAccess.cxx \ No newline at end of file +/home/tau/jreher/git/ProtoSoft/DAQ/ProductionDatabase/BulkDbAccess.cxx \ No newline at end of file diff --git a/proddb/BulkDbAccess.h b/proddb/BulkDbAccess.h index ac1ded2248a5bf838f616c41d0f741b16c696748..c1a16e4d57f84b75ecf609c8fe8127f84fdef7b5 120000 --- a/proddb/BulkDbAccess.h +++ b/proddb/BulkDbAccess.h @@ -1 +1 @@ -/home/tau/jreher/git/ProtoSoft/DAQ/ApdCurves/BulkDbAccess.h \ No newline at end of file +/home/tau/jreher/git/ProtoSoft/DAQ/ProductionDatabase/BulkDbAccess.h \ No newline at end of file diff --git a/proddb/ProdDbAccess.cxx b/proddb/ProdDbAccess.cxx index 4f9fae5b7277d1ee5950b7ab8115494dd0047f1e..28059475347d84d826fcd12603c3b85b628bf5ff 120000 --- a/proddb/ProdDbAccess.cxx +++ b/proddb/ProdDbAccess.cxx @@ -1 +1 @@ -/home/tau/jreher/git/ProtoSoft/DAQ/ApdCurves/ProdDbAccess.cxx \ No newline at end of file +/home/tau/jreher/git/ProtoSoft/DAQ/ProductionDatabase/ProdDbAccess.cxx \ No newline at end of file diff --git a/proddb/ProdDbAccess.h b/proddb/ProdDbAccess.h index 94b012d69563fc321d3d3b9bdf30bb5d8af6a62d..4046fec49072cb8403820dea286842485110ea31 120000 --- a/proddb/ProdDbAccess.h +++ b/proddb/ProdDbAccess.h @@ -1 +1 @@ -/home/tau/jreher/git/ProtoSoft/DAQ/ApdCurves/ProdDbAccess.h \ No newline at end of file +/home/tau/jreher/git/ProtoSoft/DAQ/ProductionDatabase/ProdDbAccess.h \ No newline at end of file diff --git a/proddb/ProductionDatabase.cxx b/proddb/ProductionDatabase.cxx index 614b2632e5ea940531fdd99a67da48c4901ea870..a9a096ce58238f709ba56c0281949cebc5bd4e88 120000 --- a/proddb/ProductionDatabase.cxx +++ b/proddb/ProductionDatabase.cxx @@ -1 +1 @@ -/home/tau/jreher/git/ProtoSoft/DAQ/ApdCurves/ProductionDatabase.cxx \ No newline at end of file +/home/tau/jreher/git/ProtoSoft/DAQ/ProductionDatabase/ProductionDatabase.cxx \ No newline at end of file diff --git a/proddb/ProductionDatabase.h b/proddb/ProductionDatabase.h index 0aefe0e4778d1418c7060d24eebf6ba83745f502..1479557432ee5b993a203bcc634087c1477e626d 120000 --- a/proddb/ProductionDatabase.h +++ b/proddb/ProductionDatabase.h @@ -1 +1 @@ -/home/tau/jreher/git/ProtoSoft/DAQ/ApdCurves/ProductionDatabase.h \ No newline at end of file +/home/tau/jreher/git/ProtoSoft/DAQ/ProductionDatabase/ProductionDatabase.h \ No newline at end of file diff --git a/proddb/ProductionDatabaseApdStorage.cxx b/proddb/ProductionDatabaseApdStorage.cxx index e4453cc02d9f689746fb21aa8c6f1a469a73276d..94a251d7093a95dcfb2ba90b92876cbe0971ea36 120000 --- a/proddb/ProductionDatabaseApdStorage.cxx +++ b/proddb/ProductionDatabaseApdStorage.cxx @@ -1 +1 @@ -/home/tau/jreher/git/ProtoSoft/DAQ/ApdCurves/ProductionDatabaseApdStorage.cxx \ No newline at end of file +/home/tau/jreher/git/ProtoSoft/DAQ/ProductionDatabase/ProductionDatabaseApdStorage.cxx \ No newline at end of file diff --git a/proddb/ProductionDatabaseApdStorage.h b/proddb/ProductionDatabaseApdStorage.h index bbb81832b71512389bce5b47e6fdbfea038c3519..071a5c91491c49bb2da6073239bb46da705d7351 120000 --- a/proddb/ProductionDatabaseApdStorage.h +++ b/proddb/ProductionDatabaseApdStorage.h @@ -1 +1 @@ -/home/tau/jreher/git/ProtoSoft/DAQ/ApdCurves/ProductionDatabaseApdStorage.h \ No newline at end of file +/home/tau/jreher/git/ProtoSoft/DAQ/ProductionDatabase/ProductionDatabaseApdStorage.h \ No newline at end of file diff --git a/testxmlstructure.cxx b/testxmlstructure.cxx index f696d3254bd2ff3341dff75ee3d025f0a8a6497b..98ed6211658f3dc7a16085a7754bae3e54ef10b0 100644 --- a/testxmlstructure.cxx +++ b/testxmlstructure.cxx @@ -2,7 +2,7 @@ #include <iostream> #include <QtCore/QString> -#include <QtXml/QXmlStreamWriter> +#include <QtXml> ///QXmlStreamWriter> // For Compilation: QXml/QXmlStreamWriter #include "productiondatabaseclient.h" ProductionDatabase::ProductionDatabaseClient *proddbclient; @@ -11,13 +11,28 @@ void initialize(); void screeningInfo(); void assignApds(std::string redSerial, std::string blueSerial); void assignUnit(std::string detectorSerial, std::string crystalSerial, std::string barcode); +void assignToModule(std::vector<uint> barcodes, std::string moduleSN); int main() { initialize(); - assignApds("0607004597", "0607004598" ); - assignApds("0607004600", "0607004601" ); - assignUnit("0607004598/0607004597","790","1309009220"); - assignUnit("0607004601/0607004600","790","1309009237"); + std::vector<uint> barcodes; + barcodes.push_back(0); + barcodes.push_back(0); + barcodes.push_back(0); + barcodes.push_back(0); + barcodes.push_back(0); + barcodes.push_back(0); + barcodes.push_back(0); + barcodes.push_back(0); + barcodes.push_back(1309009619); + barcodes.push_back(1309009602); + barcodes.push_back(1309009633); + barcodes.push_back(1309009664); + barcodes.push_back(1309009657); + barcodes.push_back(1309009696); + barcodes.push_back(1309009640); + barcodes.push_back(1309009626); + assignToModule(barcodes, "29012015-9"); return 0; } @@ -28,6 +43,35 @@ void initialize() { proddbclient->checkConnectivityAndCredentials(); } +void assignToModule(std::vector<uint> barcodes, std::string moduleSN) { + if (barcodes.size() != 16) { + throw "Vector with barcodes must contain exactly 16 elements!"; + } + + QString buffer; + QXmlStreamWriter xml ( &buffer ); + + xml.setAutoFormatting(true); + xml.writeStartDocument( QString::fromUtf8( "1.0" ) ); + xml.writeStartElement( QString::fromUtf8( "productiondb" ) ) ; + xml.writeTextElement("moduleSN",QString::fromStdString(moduleSN)); + + for (size_t i = 0; i < 16; i++) { + std::string entryname = std::string("Slot") + std::to_string(i); + if (barcodes[i]==0) + xml.writeEmptyElement(QString::fromStdString(entryname)); + else + xml.writeTextElement(QString::fromStdString(entryname),QString::number(barcodes[i])); + } + + xml.writeEndDocument(); + + std::string xmlRequest = buffer.toStdString(); + std::cerr << xmlRequest << std::endl; + + //proddbclient->postXmlRequest("",xmlRequest); +} + void assignUnit(std::string detectorSerial, std::string crystalSerial, std::string barcode) { QString buffer; QXmlStreamWriter xml ( &buffer );