新增一批一次性排查脚本(script/tmp-*.cjs),与仓库既有 script/tmp- 约定保持一致, 覆盖波次池边界与优先级核对、库位/出库报表核对、订单状态与更新范围核验等场景
56 lines
1.3 KiB
JavaScript
56 lines
1.3 KiB
JavaScript
'use strict';
|
|
|
|
/**
|
|
* 抽查 UPDATE 影响范围。
|
|
*
|
|
* @return {Promise<void>}
|
|
*/
|
|
|
|
const mysql = require('mysql2/promise');
|
|
|
|
async function main() {
|
|
const connection = await mysql.createConnection({
|
|
host: '127.0.0.1',
|
|
port: 3307,
|
|
user: 'wms',
|
|
password: 'dspxmRwRdRbWtbm7',
|
|
database: 'wms',
|
|
});
|
|
|
|
try {
|
|
const [ sample ] = await connection.query(
|
|
`SELECT id, create_at
|
|
FROM wms_order_delivery_100000
|
|
WHERE id BETWEEN 1591 AND 1660
|
|
ORDER BY id ASC
|
|
LIMIT 15`
|
|
);
|
|
console.log('===== 1591-1660 区间 =====');
|
|
console.log(JSON.stringify(sample));
|
|
|
|
const [ todayCount ] = await connection.query(
|
|
`SELECT COUNT(1) AS cnt
|
|
FROM wms_order_delivery_100000
|
|
WHERE create_at >= '2026-09-05 16:00:00'`
|
|
);
|
|
console.log('===== 全表今天订单数 =====');
|
|
console.log(JSON.stringify(todayCount));
|
|
|
|
const [ keepRows ] = await connection.query(
|
|
`SELECT id, create_at
|
|
FROM wms_order_delivery_100000
|
|
WHERE id IN (1245, 3014, 5547, 6327, 6462, 7797, 7909, 8455)
|
|
ORDER BY id ASC`
|
|
);
|
|
console.log('===== 保留8条 =====');
|
|
console.log(JSON.stringify(keepRows));
|
|
} finally {
|
|
await connection.end();
|
|
}
|
|
}
|
|
|
|
main().catch(error => {
|
|
console.error(`查询失败: ${error.message}`);
|
|
process.exit(1);
|
|
});
|