u
This commit is contained in:
21
jtlsrv-cpp/src/queries/warehouse.hpp
Normal file
21
jtlsrv-cpp/src/queries/warehouse.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
#include "../db/pool.hpp"
|
||||
#include "../config.hpp"
|
||||
|
||||
namespace delivery {
|
||||
|
||||
inline int resolve_outgoing_warehouse(OdbcPool::Connection* c) {
|
||||
int configured = config::get_int("JTL_KWARENLAGER", 0);
|
||||
if (configured > 0) return configured;
|
||||
|
||||
ResultSet rs;
|
||||
if (!get_pool().execute(c,
|
||||
"SELECT TOP 1 kWarenLager FROM dbo.tWarenLager "
|
||||
"WHERE nFulfillment = 0 AND ISNULL(nAktiv, 1) = 1 "
|
||||
"ORDER BY nAuslieferungsPrio, kWarenLager", rs) || rs.empty() || rs[0].empty()) {
|
||||
throw std::runtime_error("No local warehouse (dbo.tWarenLager.nFulfillment = 0) found; set JTL_KWARENLAGER explicitly.");
|
||||
}
|
||||
return std::stoi(rs[0][0].str);
|
||||
}
|
||||
|
||||
} // namespace delivery
|
||||
Reference in New Issue
Block a user