Files
LWLT-AI/archive/handoff/2026-07-12/legacy-erp-handoff/tools/recovery_export.js
2026-07-13 19:57:46 +08:00

44 lines
1.9 KiB
JavaScript

// Recovery export: skip submitOrder, go straight to exportDocuments + convertToPdf.
const path = require('node:path');
const fs = require('node:fs');
const CONFIG_PATH = path.resolve(__dirname, '..', 'config', 'erp-deployment.local.json');
const config = JSON.parse(fs.readFileSync(CONFIG_PATH, 'utf8'));
const ops = require('./erp_team_single_browser_operations').createTeamSingleOperations(config);
const plan = {
taskId: 'recovery-export-llw-260804a-a',
route: 'team_single',
orderNature: '测试',
productName: '遇见老挝',
departureDate: '2026-08-04',
pax: { adult: 2, childBed: 1, childNoBed: 1, infant: 0, leader: 0 },
rooms: { SGL: 0, TWN: 0, TRP: 0, DBL: 2, HNM: 0, TL: 0 },
prices: { adult: 520, childBed: 220, childNoBed: 120, infant: 0, leader: 0 },
op: '测试',
salesperson: '琳琳',
remark: '微信入口真实下单测试',
delivery: { returnIdentifiersFirst: true, customerReceivesPdfOnly: true, sendPdfFollowUp: true },
};
const submitResult = {
groupNo: 'LLW-260804A-A',
group: { date: '2026-08-04', groupNo: 'LLW-260804A-A', ddid: '14038', tid: '14038' },
successText: '下单成功',
};
async function main() {
console.log('=== Export ===');
const exportResult = await ops.exportDocuments(plan, submitResult, { config });
console.log(JSON.stringify({ phase: 'export', sources: exportResult.sources.map(s => ({ key: s.key, path: s.path, bytes: s.bytes })) }, null, 2));
console.log('\n=== PDF ===');
const pdfResult = await ops.convertToPdf(plan, exportResult, { config });
console.log(JSON.stringify({ phase: 'pdf', artifacts: pdfResult.artifacts.map(a => ({ label: a.label, path: a.path, bytes: a.bytes })) }, null, 2));
console.log('\n=== DONE ===');
console.log(JSON.stringify({ groupNo: 'LLW-260804A-A', ddid: '14038', artifacts: pdfResult.artifacts.map(a => a.path) }, null, 2));
}
main().catch(err => { console.error('FATAL:', err.message); process.exit(1); });