|
@@ -1935,7 +1935,7 @@ module.exports = app => {
|
|
|
const precision = this.ctx.helper.findPrecision(info.precision, node.unit);
|
|
|
|
|
|
const calcQtySql = 'SELECT SUM(`quantity`) As quantity FROM ?? WHERE `lid` = ?';
|
|
|
- const data = await transaction.queryOne(this.db.format(calcQtySql, [this.ctx.service.pos.tableName, node.id]));
|
|
|
+ const data = await transaction.queryOne(calcQtySql, [this.ctx.service.pos.tableName, node.id]);
|
|
|
data.id = node.id;
|
|
|
data.quantity = this.round(data.quantity, precision.value);
|
|
|
data.total_price = this.round(this.ctx.helper.times(data.quantity, node.unit_price), info.decimal.tp);
|
|
@@ -1950,9 +1950,7 @@ module.exports = app => {
|
|
|
* @return {Promise<void>}
|
|
|
*/
|
|
|
async calc(tid, id, transaction) {
|
|
|
- const node = await transaction.queryOne({
|
|
|
- id: id
|
|
|
- });
|
|
|
+ const node = await transaction.get(this.tableName, {id: id});
|
|
|
if (!node) {
|
|
|
throw '数据错误';
|
|
|
}
|