Commit 614d3526 by Aeolus

补货报告接口修改

parent ca46a06e
# -*- coding: utf-8 -*-
import logging
from sqlalchemy import func
from models.base_model import db
from models.models import TallymanMachine, Machine, Hatch
logger = logging.getLogger(__name__)
......@@ -45,6 +48,7 @@ class TallymanService(object):
cur_machine['short_address'] = machine_info.short_address
cur_machine['address'] = machine_info.address
cur_machine['place_id'] = machine_info.place_id
cur_machine['empty_number'] = Hatch.query.filter(Hatch.machine_no == machine_info.machine_no,
Hatch.status == 2).count()
cur_machine['empty_number'] = db.session.query(func.sum(Hatch.total_count - Hatch.left_count)).filter(
Hatch.machine_no == machine_info.machine_no,
Hatch.status == 2).scalar()
return cur_machine
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment