Exemple #1
0
def add_stock_detail(stock_id: int, changed_id: int, changed_money: float, change_number: int, change_type: int):
    stock_detail = StockDetail()
    stock_detail.changed_id(changed_id)
    stock_detail.changed_money(abs(changed_money))
    stock_detail.changed_number(abs(change_number))
    stock_detail.stock_id(stock_id)
    stock_detail.type(change_type)

    stock_detail.update_time(time_utils.get_now()).update_op(common.config.login_user_info[0])
    stock_detail_handler.add_stock_detail(stock_detail)
Exemple #2
0
    def _add_stock_detail(stock_id, buy_id, total, number):
        stock_detail = StockDetail()
        stock_detail.changed_id(buy_id)
        stock_detail.changed_money(abs(total))
        stock_detail.changed_number(abs(number))
        stock_detail.stock_id(stock_id)
        if number < 0:
            stock_detail.type(stock_detail.by_returned())
        else:
            stock_detail.type(StockDetail.by_bought())

        stock_detail.update_time(time_utils.get_now()).update_op(Common.config.login_user_info[0])
        stock_detail_handler.add_stock_detail(stock_detail)
Exemple #3
0
def add_stock_detail(stock_detail: StockDetail):
    sql_text = '''
                INSERT INTO stock_detail(stock_id,changed_id,changed_money,changed_number,type,update_op,update_time)
                VALUES(
                        {},
                        {},
                        {:.2f},
                        {},
                        {},
                        {},
                        '{}'
                        
                )'''.format(stock_detail.stock_id(), stock_detail.changed_id(),
                            stock_detail.changed_money(),
                            stock_detail.changed_number(), stock_detail.type(),
                            stock_detail.update_op(),
                            stock_detail.update_time())

    result = execute(sql_text)
    return result