fix(delivery): deliver orders with father-articles and no-payment orders
- Treat an article that has become a father (nIstVater=1) as a free position (kArtikel=0) with the name kept: VersandIntern.vBestellPosOffen joins tArtikel with nIstVater=0, so such positions could never be reserved and failed with "insufficient stock after POS shortage booking" (e.g. Becks 42000030). - Recalculate tAuftragPositionEckdaten before deliverOrder so orders without payments get their positions reserved too (previously only insertPayment triggered the recalculation). Also adds debug logging across the delivery pipeline (reserve, commit, deliver, session, stock-shortage, create-order).
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import fs from 'node:fs';
|
||||
import http from 'node:http';
|
||||
import https from 'node:https';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
@@ -15,6 +16,7 @@ import { fetchActiveShop } from './src/shop.js';
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
|
||||
const PORT = Number(process.env.PORT) || 4443;
|
||||
const HTTP_PORT = Number(process.env.HTTP_PORT) || 8080;
|
||||
const AUTH_TOKEN = process.env.AUTH_TOKEN || 'df40ad2067954646abb0499548a52241';
|
||||
const PAIRING_CODE = process.env.PAIRING_CODE || '307018';
|
||||
|
||||
@@ -112,6 +114,8 @@ const httpsServer = https.createServer(
|
||||
loggedJtlHandler
|
||||
);
|
||||
|
||||
const httpServer = http.createServer(loggedJtlHandler);
|
||||
|
||||
async function start() {
|
||||
try {
|
||||
const pool = await connectDb();
|
||||
@@ -129,11 +133,16 @@ async function start() {
|
||||
logger.info(`Pairing code: ${PAIRING_CODE}`);
|
||||
logger.info(`Auth token: ${AUTH_TOKEN}`);
|
||||
});
|
||||
|
||||
httpServer.listen(HTTP_PORT, '0.0.0.0', () => {
|
||||
logger.success(`HTTP POS server listening on http://0.0.0.0:${HTTP_PORT}`);
|
||||
});
|
||||
}
|
||||
|
||||
async function shutdown() {
|
||||
logger.info('Shutting down...');
|
||||
httpsServer.close();
|
||||
httpServer.close();
|
||||
await closeDb();
|
||||
closeRequestLog();
|
||||
closeOrderLog();
|
||||
|
||||
Reference in New Issue
Block a user