From 6fd05479015f2c55e56f9ec1ee239ba9116e71f9 Mon Sep 17 00:00:00 2001
From: Jan Reher <jreher@ep1.rub.de>
Date: Mon, 30 Mar 2020 11:31:23 +0200
Subject: [PATCH] Implemented more comfortable way of entering barcodes (as
 short). Disabled database connection for testing.

---
 apdUnitCreator.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/apdUnitCreator.cpp b/apdUnitCreator.cpp
index 80443da..3c0857d 100644
--- a/apdUnitCreator.cpp
+++ b/apdUnitCreator.cpp
@@ -121,11 +121,17 @@ void loadSerialsFromFileName(string m_fileName, bool m_debug) {
         }
         unitInfo newUnit;
 
+        uint barCode;
+
         std::stringstream linestream(line);
-        linestream >> newUnit.redSerial >> newUnit.blueSerial >> newUnit.crystalSerial >> newUnit.barCode;
+        linestream >> newUnit.redSerial >> newUnit.blueSerial >> newUnit.crystalSerial >> barCode;
+
+        if (barCode <1000000 )
+        barCode += 1909000000;
+        newUnit.barCode = std::to_string(barCode);
 
         std::cerr << "Found new unit with RS = " << newUnit.redSerial << ", BS = " << newUnit.blueSerial << ", CS = " << newUnit.crystalSerial << ", BC = " << newUnit.barCode << std::endl;
-        newUnits.push_back(newUnit);
+        //newUnits.push_back(newUnit);
 
         if (m_debug) cout << "Found serial: " << line << endl;
     }
-- 
GitLab