61 lines
2.0 KiB
JavaScript
61 lines
2.0 KiB
JavaScript
const fs = require('fs')
|
|
const path = require('path')
|
|
|
|
const root = path.resolve(__dirname, '..')
|
|
|
|
function read(file) {
|
|
return fs.readFileSync(path.join(root, file), 'utf8')
|
|
}
|
|
|
|
function assertMatch(message, content, pattern) {
|
|
if (!pattern.test(content)) {
|
|
throw new Error(message)
|
|
}
|
|
}
|
|
|
|
for (const file of ['ruoyi-ui/src/views/in/add/index.vue', 'ruoyi-ui/src/views/out/create/index.vue']) {
|
|
const content = read(file)
|
|
assertMatch(`${file} 新建单据来源必须默认自建单`, content, /stockSource:\s*'1'/)
|
|
assertMatch(`${file} 表单栅格必须使用稳定类名`, content, /class="stable-form-grid"/)
|
|
assertMatch(`${file} 表单控件必须固定为满宽`, content, /\.create-(stockin|stockout)[\s\S]*\.el-select[\s\S]*width:\s*100%/)
|
|
assertMatch(`${file} 表单项必须预留错误提示高度防止选择时抖动`, content, /\.create-(stockin|stockout)[\s\S]*\.el-form-item[\s\S]*margin-bottom:\s*22px/)
|
|
}
|
|
|
|
const pdaMapper = read('ruoyi-admin/src/main/resources/mapper/pda/PdaMapper.xml')
|
|
assertMatch(
|
|
'PDA 必须先回滚同托盘同仓库残留待绑数量',
|
|
pdaMapper,
|
|
/id="rollbackPendingTrayBindings"[\s\S]*scan_num[\s\S]*in_tray_msg/
|
|
)
|
|
assertMatch(
|
|
'PDA 必须删除同托盘同仓库残留待绑记录',
|
|
pdaMapper,
|
|
/id="deletePendingTrayBindings"[\s\S]*delete\s+from\s+in_tray_msg/
|
|
)
|
|
|
|
const pdService = read('ruoyi-admin/src/main/java/com/ruoyi/pd/stockpd/service/impl/PdStockpdServiceImpl.java')
|
|
assertMatch(
|
|
'盘点状态过程返回值必须用 Convert.toStr 兼容 INTEGER OUT 参数',
|
|
pdService,
|
|
/Convert\.toStr\(map\.get\("v_result"\)\)/
|
|
)
|
|
|
|
const inventorySql = read('sql/20260626_inventory_status_proc.sql')
|
|
assertMatch(
|
|
'盘点状态过程脚本必须创建 proc_update_pdbill_status',
|
|
inventorySql,
|
|
/CREATE\s+PROCEDURE\s+dbo\.proc_update_pdbill_status/i
|
|
)
|
|
assertMatch(
|
|
'盘点完成必须归档主单',
|
|
inventorySql,
|
|
/INSERT\s+INTO\s+dbo\.pd_stockpd_finish/i
|
|
)
|
|
assertMatch(
|
|
'盘点完成必须归档明细',
|
|
inventorySql,
|
|
/INSERT\s+INTO\s+dbo\.pd_stockpd_detail_finish/i
|
|
)
|
|
|
|
console.log('Goal fix checks passed')
|