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.

57 lines
1.7 KiB

2 years ago
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@Date:2022/09/08 13:42:28
'''
import sys
sys.path.append('.')
2 years ago
from db_logic.module import BllModule
from models.power_models import EntityModule
from Common.Utils import Utils
2 years ago
import cv2
2 years ago
2 years ago
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()
2 years ago
# 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)