feat: assign unit destination during cash-in
fix: cash cassettes wizard initial values
This commit is contained in:
parent
2967ad3a75
commit
2d010fc359
3 changed files with 46 additions and 22 deletions
|
|
@ -41,13 +41,24 @@ function insertNewBills (t, billRows, machineTx) {
|
|||
if (_.isEmpty(bills)) return Promise.resolve([])
|
||||
|
||||
const dbBills = _.map(cashInLow.massage, bills)
|
||||
const getBillsByDestination = destination => _.filter(it => it.destination_unit === destination)(dbBills)
|
||||
|
||||
const columns = ['id', 'fiat', 'fiat_code', 'crypto_code', 'cash_in_fee', 'cash_in_txs_id', 'device_time', 'destination_unit']
|
||||
const sql = pgp.helpers.insert(dbBills, columns, 'bills')
|
||||
const deviceID = machineTx.deviceId
|
||||
const sql2 = `update devices set cashbox = cashbox + $2
|
||||
const sql2 = `update devices set cashbox = cashbox + $2, stacker1f = stacker1f + $3, stacker1r = stacker1r + $4, stacker2f = stacker2f + $5, stacker2r = stacker2r + $6, stacker3f = stacker3f + $7, stacker3r = stacker3r + $8
|
||||
where device_id = $1`
|
||||
|
||||
return t.none(sql2, [deviceID, dbBills.length])
|
||||
return t.none(sql2, [
|
||||
deviceID,
|
||||
getBillsByDestination('cashbox').length,
|
||||
getBillsByDestination('stacker1f').length,
|
||||
getBillsByDestination('stacker1r').length,
|
||||
getBillsByDestination('stacker2f').length,
|
||||
getBillsByDestination('stacker2r').length,
|
||||
getBillsByDestination('stacker3f').length,
|
||||
getBillsByDestination('stacker3r').length
|
||||
])
|
||||
.then(() => {
|
||||
return t.none(sql)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -229,25 +229,22 @@ const dynamicConfig = ({ deviceId, operatorId, pid, pq, settings, }) => {
|
|||
const configs = (parent, { currentConfigVersion }, { deviceId, deviceName, operatorId, pid, settings }, info) =>
|
||||
plugins(settings, deviceId)
|
||||
.pollQueries()
|
||||
.then(pq => {
|
||||
console.log(pq)
|
||||
return {
|
||||
static: staticConfig({
|
||||
currentConfigVersion,
|
||||
deviceId,
|
||||
deviceName,
|
||||
pq,
|
||||
settings,
|
||||
}),
|
||||
dynamic: dynamicConfig({
|
||||
deviceId,
|
||||
operatorId,
|
||||
pid,
|
||||
pq,
|
||||
settings,
|
||||
}),
|
||||
}
|
||||
})
|
||||
.then(pq => ({
|
||||
static: staticConfig({
|
||||
currentConfigVersion,
|
||||
deviceId,
|
||||
deviceName,
|
||||
pq,
|
||||
settings,
|
||||
}),
|
||||
dynamic: dynamicConfig({
|
||||
deviceId,
|
||||
operatorId,
|
||||
pid,
|
||||
pq,
|
||||
settings,
|
||||
}),
|
||||
}))
|
||||
|
||||
|
||||
const massageTerms = terms => (terms.active && terms.text) ? ({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue