'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' }); // bindDetailProduct 自动写入的条码(本次测试的 TMPBC/FULLBC 前缀) const [barcodes] = await c.query(` SELECT id, stock_id, warehouse_id, barcode FROM wms_stock_barcodes WHERE barcode LIKE 'TMPBC%' OR barcode LIKE 'FULLBC%' ORDER BY id`); console.log('== wms_stock_barcodes 测试写入的条码(共 ' + barcodes.length + ' 行) =='); console.log(JSON.stringify(barcodes, null, 2)); // 商品 159061/159064 上的全部条码 const [all] = await c.query( `SELECT id, stock_id, barcode FROM wms_stock_barcodes WHERE stock_id IN (159061, 159064) ORDER BY id` ); console.log('== 两商品全部条码 =='); console.log(JSON.stringify(all, null, 2)); await c.end(); process.exit(0); })().catch(e => { console.error(e); process.exit(1); });