|
|
|
@ -10,7 +10,7 @@ sys.path.append('.')
|
|
|
|
|
# from common.utils import Utils
|
|
|
|
|
|
|
|
|
|
from sqlalchemy import Column, String, Integer, Text, Float
|
|
|
|
|
from models.models_base import Base, get_uuid, ModelBase
|
|
|
|
|
from models.models_base import Base, get_uuid
|
|
|
|
|
|
|
|
|
|
# from sqlalchemy.ext.declarative import declarative_base
|
|
|
|
|
|
|
|
|
@ -223,46 +223,46 @@ class EntityMedicamentExtend(Base):
|
|
|
|
|
field_table_type = Column(Integer, comment="字段所在表")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
# from db_logic.medicament_record import BllMedicamentRecord
|
|
|
|
|
# customerId, clientId = None, '8db7e540-070f-11ed-a286-f47b094925e1'
|
|
|
|
|
# aaa = BllMedicamentRecord().getTodayDrugRecordCount(customerId, clientId)
|
|
|
|
|
# print(aaa)
|
|
|
|
|
import random
|
|
|
|
|
from sqlalchemy import create_engine
|
|
|
|
|
from sqlalchemy.orm import sessionmaker
|
|
|
|
|
from config.SystemConfig import SystemConfig
|
|
|
|
|
from sqlalchemy.pool import NullPool
|
|
|
|
|
engine = create_engine(SystemConfig.getConfig(
|
|
|
|
|
'dbconntion'), poolclass=NullPool)
|
|
|
|
|
DBSession = sessionmaker(bind=engine, expire_on_commit=False)
|
|
|
|
|
# 创建session对象
|
|
|
|
|
session = DBSession()
|
|
|
|
|
client_id= get_uuid()
|
|
|
|
|
variety_id_list = [get_uuid() for i in range(5)]
|
|
|
|
|
bar_code_list = [i for i in range(10001, 10110)]
|
|
|
|
|
customer_id= get_uuid()
|
|
|
|
|
for i in range(100):
|
|
|
|
|
db_mo = EntityMedicament(
|
|
|
|
|
bar_code=random.choice(bar_code_list),
|
|
|
|
|
variety_id=random.choice(variety_id_list),
|
|
|
|
|
client_id=client_id,
|
|
|
|
|
client_code=6,
|
|
|
|
|
customer_id=customer_id,
|
|
|
|
|
cas_number='',
|
|
|
|
|
name='砷',
|
|
|
|
|
english_name='',
|
|
|
|
|
shelf_life=5170,
|
|
|
|
|
inventory_warning_value=10,
|
|
|
|
|
shelf_life_warning_value=10,
|
|
|
|
|
use_days_warning_value=10,
|
|
|
|
|
remain=500,
|
|
|
|
|
total=500,
|
|
|
|
|
purity="国标",
|
|
|
|
|
status=random.randint(1,3)
|
|
|
|
|
# create_date=Utils.get_str_datetime()
|
|
|
|
|
)
|
|
|
|
|
session.add(db_mo)
|
|
|
|
|
session.commit()
|
|
|
|
|
# if __name__ == '__main__':
|
|
|
|
|
# # from db_logic.medicament_record import BllMedicamentRecord
|
|
|
|
|
# # customerId, clientId = None, '8db7e540-070f-11ed-a286-f47b094925e1'
|
|
|
|
|
# # aaa = BllMedicamentRecord().getTodayDrugRecordCount(customerId, clientId)
|
|
|
|
|
# # print(aaa)
|
|
|
|
|
# import random
|
|
|
|
|
# from sqlalchemy import create_engine
|
|
|
|
|
# from sqlalchemy.orm import sessionmaker
|
|
|
|
|
# from config.SystemConfig import SystemConfig
|
|
|
|
|
# from sqlalchemy.pool import NullPool
|
|
|
|
|
# engine = create_engine(SystemConfig.getConfig(
|
|
|
|
|
# 'dbconntion'), poolclass=NullPool)
|
|
|
|
|
# DBSession = sessionmaker(bind=engine, expire_on_commit=False)
|
|
|
|
|
# # 创建session对象
|
|
|
|
|
# session = DBSession()
|
|
|
|
|
# client_id= get_uuid()
|
|
|
|
|
# variety_id_list = [get_uuid() for i in range(5)]
|
|
|
|
|
# bar_code_list = [i for i in range(10001, 10110)]
|
|
|
|
|
# customer_id= get_uuid()
|
|
|
|
|
# for i in range(100):
|
|
|
|
|
# db_mo = EntityMedicament(
|
|
|
|
|
# bar_code=random.choice(bar_code_list),
|
|
|
|
|
# variety_id=random.choice(variety_id_list),
|
|
|
|
|
# client_id=client_id,
|
|
|
|
|
# client_code=6,
|
|
|
|
|
# customer_id=customer_id,
|
|
|
|
|
# cas_number='',
|
|
|
|
|
# name='砷',
|
|
|
|
|
# english_name='',
|
|
|
|
|
# shelf_life=5170,
|
|
|
|
|
# inventory_warning_value=10,
|
|
|
|
|
# shelf_life_warning_value=10,
|
|
|
|
|
# use_days_warning_value=10,
|
|
|
|
|
# remain=500,
|
|
|
|
|
# total=500,
|
|
|
|
|
# purity="国标",
|
|
|
|
|
# status=random.randint(1,3)
|
|
|
|
|
# # create_date=Utils.get_str_datetime()
|
|
|
|
|
# )
|
|
|
|
|
# session.add(db_mo)
|
|
|
|
|
# session.commit()
|
|
|
|
|
|
|
|
|
|
# Base.metadata.create_all(engine)
|
|
|
|
|
# # Base.metadata.create_all(engine)
|