fix: recycler counts reset on cash unit update
This commit is contained in:
parent
ee90179bd1
commit
035a0a3b8e
3 changed files with 13 additions and 3 deletions
|
|
@ -49,7 +49,11 @@ function updateMachineWithBatch (machineContext, oldCashboxCount) {
|
|||
bills.cashbox_batch_id IS NULL`, [batchId, deviceId])
|
||||
const q3 = t.none(`UPDATE empty_unit_bills SET cashbox_batch_id=$1
|
||||
WHERE empty_unit_bills.device_id = $2 AND empty_unit_bills.cashbox_batch_id IS NULL`, [batchId, deviceId])
|
||||
const q4 = t.none(`UPDATE devices SET cassette1=$1, cassette2=$2, cassette3=$3, cassette4=$4, recycler1=$5, recycler2=$6, recycler3=$7, recycler4=$8, recycler5=$9, recycler6=$10 WHERE device_id=$11`, [
|
||||
const q4 = t.none(`
|
||||
UPDATE devices SET cassette1=$1, cassette2=$2, cassette3=$3, cassette4=$4,
|
||||
recycler1=coalesce($5, recycler1), recycler2=coalesce($6, recycler2), recycler3=coalesce($7, recycler3),
|
||||
recycler4=coalesce($8, recycler4), recycler5=coalesce($9, recycler5), recycler6=coalesce($10, recycler6) WHERE device_id=$11
|
||||
`, [
|
||||
cashUnits.cassette1,
|
||||
cashUnits.cassette2,
|
||||
cashUnits.cassette3,
|
||||
|
|
|
|||
|
|
@ -183,7 +183,11 @@ function setCassetteBills (rec) {
|
|||
.then(machine => {
|
||||
const oldCashboxCount = machine?.cashUnits?.cashbox
|
||||
if (_.isNil(oldCashboxCount) || cashbox.toString() === oldCashboxCount.toString()) {
|
||||
const sql = 'UPDATE devices SET cassette1=$1, cassette2=$2, cassette3=$3, cassette4=$4, recycler1=$5, recycler2=$6, recycler3=$7, recycler4=$8, recycler5=$9, recycler6=$10 WHERE device_id=$11'
|
||||
const sql = `
|
||||
UPDATE devices SET cassette1=$1, cassette2=$2, cassette3=$3, cassette4=$4,
|
||||
recycler1=coalesce($5, recycler1), recycler2=coalesce($6, recycler2), recycler3=coalesce($7, recycler3),
|
||||
recycler4=coalesce($8, recycler4), recycler5=coalesce($9, recycler5), recycler6=coalesce($10, recycler6)
|
||||
WHERE device_id=$11`
|
||||
return db.none(sql, [cassette1, cassette2, cassette3, cassette4, recycler1, recycler2, recycler3, recycler4, recycler5, recycler6, rec.deviceId])
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,9 @@ const Wizard = ({ machine, cashoutSettings, locale, onClose, save, error }) => {
|
|||
].includes('YES')
|
||||
|
||||
const cassettes = buildCashUnitObj(CASSETTE_FIELDS, it)
|
||||
const recyclers = buildCashUnitObj(RECYCLER_FIELDS, it)
|
||||
const recyclers = canManuallyLoadRecyclers(machine)
|
||||
? buildCashUnitObj(RECYCLER_FIELDS, it)
|
||||
: []
|
||||
|
||||
const cashUnits = {
|
||||
cashbox: wasCashboxEmptied ? 0 : machine?.cashUnits.cashbox,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue