'use strict'; const mysql = require('mysql2/promise'); (async () => { const c = await mysql.createConnection({ host: '127.0.0.1', port: 3307, user: 'wms', password: 'dspxmRwRdRbWtbm7', database: 'wms' }); // 两个测试商品在 wms_storage 中的全部行 const [rows] = await c.query(` SELECT id, warehouse_id, store_id, space_id, stock_id, batch_no, inventory_type, quantity, locked_quantity, available_quantity, inbound_order_no, receiving_id, entry_order_id, inbound_time FROM wms_storage WHERE stock_id IN (159061, 159064) ORDER BY id`); console.log('== wms_storage 中两个测试商品的全部行(共 ' + rows.length + ' 行) =='); console.log(JSON.stringify(rows, null, 2)); // 两商品的库位流水(逐笔证据) const [txns] = await c.query(` SELECT id, order_no, transaction_type, stock_id, storage_id, space_id, quantity, before_quantity, after_quantity, batch_no FROM wms_storage_transaction WHERE stock_id IN (159061, 159064) ORDER BY id`); console.log('== wms_storage_transaction 两商品逐笔流水(共 ' + txns.length + ' 条) =='); console.log(JSON.stringify(txns, null, 2)); await c.end(); process.exit(0); })().catch(e => { console.error(e); process.exit(1); });