You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
61 lines
2.0 KiB
61 lines
2.0 KiB
#!/usr/bin/env python
|
|
# -*- encoding: utf-8 -*-
|
|
'''
|
|
@Date:2022/09/08 13:42:28
|
|
'''
|
|
import sys
|
|
sys.path.append('.')
|
|
from db_logic.module import BllModule
|
|
from models.power_models import EntityModule
|
|
from Common.Utils import Utils
|
|
import cv2
|
|
|
|
|
|
|
|
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()
|
|
# from db_logic.module import BllModule
|
|
# from Common.Utils import Utils
|
|
# data = BllModule().findList(EntityModule.module_type=='4')
|
|
# for i in data:
|
|
# i.module_name = str(i.module_name).replace("耗材", "对照品")
|
|
|
|
# BllModule().update(i)
|
|
|
|
# data = BllModule().execute("select * from rms_module where module_type=2 order by sort_index").fetchall()
|
|
# data_list = Utils.msyql_table_model(data)
|
|
# inster_list = []
|
|
# ind = 48
|
|
# for i in range(len(data_list)):
|
|
# d = data_list[i]
|
|
# del d['module_id']
|
|
# d['module_type'] = 4
|
|
# d['module_name'] = d['module_name'].replace("试剂", "对照品")
|
|
# d['module_code'] = d['module_code'].replace("Drug", "DZP")
|
|
# d['sort_index'] = ind
|
|
# d['module_weight'] = ind
|
|
|
|
# inster_list.append(EntityModule(**d))
|
|
# ind += 1
|
|
# print(11111)
|
|
# BllModule().insert_many(inster_list)
|
|
|
|
a = "[{\"name\":\"\u6c28\u6c34\",\"num\":\"2\",\"client_id\":\"1c39cb24-07f8-11ed-abd4-f47b094925e1\",\"purity\":\"25~28%\",\"speci\":\"500\"},{\"name\":\"\u786b\u9178\",\"num\":\"2\",\"client_id\":\"1c39cb24-07f8-11ed-abd4-f47b094925e1\",\"purity\":\"26~29%\",\"speci\":\"500\"}]"
|
|
import json
|
|
print(json.loads(a)) |