def get_product_name(p_no): session = Session() name = session.scalar('select name from wx_product where p_no=:p_no', {'p_no': p_no}) return name
def get_product_qty(p_no): session = Session() qty = session.scalar( 'select qty from wx_product where p_no=:p_no limit 1', {'p_no': p_no}) return qty
def is_active(p_no): session = Session() status = session.scalar( 'select status from wx_product where deleted=0 and p_no=:p_no limit 1', {'p_no': p_no}) if operator.eq(status, P.ProductStatusActive): return True else: return False
def is_first_exchange_day(p_no): session = Session() num = session.scalar( 'select count(*) from wx_product_history where deleted=0 and p_no=:p_no', {'p_no': p_no}) if operator.le(num, 1): return True return False