fix: use DB cassettes for HAL init instead of compiled preset
The HAL inventory was built from the config preset, ignoring operator changes made via atm-tui or SQL. Now reads cassettes from the DB at HAL init time so denomination/count changes take effect on restart. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ec60d3f201
commit
8960249499
1 changed files with 12 additions and 0 deletions
|
|
@ -261,6 +261,18 @@ let pendingBillDenomination: number | null = null
|
||||||
|
|
||||||
ipcMain.handle('hal:init', async (_event, config) => {
|
ipcMain.handle('hal:init', async (_event, config) => {
|
||||||
try {
|
try {
|
||||||
|
// Override cassette config with DB values (operator may have changed them via atm-tui)
|
||||||
|
const dbCassettes = loadCassettes()
|
||||||
|
if (dbCassettes.length > 0) {
|
||||||
|
config.dispenser.cassettes = dbCassettes.map(
|
||||||
|
(c: { denomination: number; count: number }) => ({
|
||||||
|
denomination: c.denomination,
|
||||||
|
count: c.count,
|
||||||
|
})
|
||||||
|
)
|
||||||
|
console.log('[Electron] Using DB cassettes for HAL init:', config.dispenser.cassettes)
|
||||||
|
}
|
||||||
|
|
||||||
halInstance = await initializeHal(config)
|
halInstance = await initializeHal(config)
|
||||||
|
|
||||||
// Wire validator events → forward to renderer via IPC
|
// Wire validator events → forward to renderer via IPC
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue