delivery seemds to work.
This commit is contained in:
34
src/queries/delivery/commit.js
Normal file
34
src/queries/delivery/commit.js
Normal file
@@ -0,0 +1,34 @@
|
||||
import sql from 'mssql';
|
||||
import { xmlTag, xmlElement } from './xml.js';
|
||||
|
||||
/**
|
||||
* Commits this session's reservations into "real" Picklisten (bumps
|
||||
* dbo.tPicklistePos.nStatus from <10 to 10/20 for this session). Mirrors
|
||||
* AuslieferungContext.PicklistenCommitten -> Auslieferung.spPicklistenUebernehmen.
|
||||
*
|
||||
* nTeillieferung = 0: partial delivery is forbidden, matching create-order.js
|
||||
* always delivering the full ordered quantity (see delivery.md §6).
|
||||
*
|
||||
* XML is passed as NVarChar and CONVERT()ed to xml inside the batch, and
|
||||
* @xResult is read back via SELECT rather than a true XML OUTPUT parameter
|
||||
* (tedious does not reliably round-trip xml OUTPUT params for this proc).
|
||||
*/
|
||||
export async function commitPicklists(transaction, kBenutzer, kSessionId, kAuftrag) {
|
||||
const bestellungen = xmlElement('Bestellung', [xmlTag('kBestellung', kAuftrag)]);
|
||||
|
||||
await new sql.Request(transaction)
|
||||
.input('Bestellungen', sql.NVarChar(sql.MAX), bestellungen)
|
||||
.input('kBenutzer', sql.Int, kBenutzer)
|
||||
.input('nTeillieferung', sql.Bit, false)
|
||||
.input('kSessionId', sql.Int, kSessionId)
|
||||
.query(`
|
||||
DECLARE @xBestellungen XML = CONVERT(XML, @Bestellungen);
|
||||
DECLARE @xResult XML;
|
||||
EXEC Auslieferung.spPicklistenUebernehmen
|
||||
@Bestellungen = @xBestellungen,
|
||||
@kBenutzer = @kBenutzer,
|
||||
@nTeillieferung = @nTeillieferung,
|
||||
@kSessionId = @kSessionId,
|
||||
@xResult = @xResult OUTPUT;
|
||||
`);
|
||||
}
|
||||
Reference in New Issue
Block a user