|
|
|
@ -8,32 +8,27 @@ sys.path.append('.')
|
|
|
|
|
from db_logic.module import BllModule
|
|
|
|
|
from models.power_models import EntityModule
|
|
|
|
|
from Common.Utils import Utils
|
|
|
|
|
import cv2
|
|
|
|
|
|
|
|
|
|
data_list = BllModule().execute("select * from rms_module_copy1 where module_type=2 order by sort_index").fetchall()
|
|
|
|
|
data_list = Utils.msyql_table_model(data_list)
|
|
|
|
|
obj_list = []
|
|
|
|
|
a = 65
|
|
|
|
|
for i in data_list:
|
|
|
|
|
module_code = i["module_code"]
|
|
|
|
|
if "Drug" in module_code:
|
|
|
|
|
module_code = str(module_code).replace("Drug", "Instrument")
|
|
|
|
|
module_name = i["module_name"]
|
|
|
|
|
if "试剂" in module_name:
|
|
|
|
|
module_name = str(module_name).replace("试剂", "仪器")
|
|
|
|
|
obj = EntityModule(
|
|
|
|
|
module_type=5,
|
|
|
|
|
module_code=module_code,
|
|
|
|
|
module_name=module_name,
|
|
|
|
|
sort_index=a,
|
|
|
|
|
module_weight=a,
|
|
|
|
|
parent_id=0,
|
|
|
|
|
is_enabled=i['is_enabled'],
|
|
|
|
|
create_date=Utils.get_str_datetime()
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
a += 1
|
|
|
|
|
obj_list.append(obj)
|
|
|
|
|
BllModule().insert_many(obj_list)
|
|
|
|
|
print(a)
|
|
|
|
|
|
|
|
|
|
# print(data_list)
|
|
|
|
|
def picture_shoot(image_name='img.png', image_path=r'C:/local_project/imgs') -> None:
|
|
|
|
|
'''
|
|
|
|
|
调用摄像头拍照并保存图片到本地
|
|
|
|
|
:param image_name: 图片名字
|
|
|
|
|
:param image_path: 图片保存路径
|
|
|
|
|
:return: None
|
|
|
|
|
'''
|
|
|
|
|
cap = cv2.VideoCapture(0)
|
|
|
|
|
while (cap.isOpened()):
|
|
|
|
|
ret, frame = cap.read()
|
|
|
|
|
# cv2.imshow("Capture_Paizhao", frame) # 显示窗口
|
|
|
|
|
cv2.imwrite(image_path + "\\" + image_name, frame)
|
|
|
|
|
print("保存" + image_name + "成功!")
|
|
|
|
|
break
|
|
|
|
|
cap.release()
|
|
|
|
|
cv2.destroyAllWindows()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
picture_shoot()
|