|
|
|
#!/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()
|
|
|
|
import json
|
|
|
|
data_list = [
|
|
|
|
{"id": 1, "use_content": json.dumps([{"name":"氨水","num":1,"client_id":"1c39cb24-07f8-11ed-abd4-f47b094925e1","purity":"25~28%","speci":"500"}])},
|
|
|
|
{"id": 2, "use_content": json.dumps([{"name":"双氧水","num":1,"client_id":"1c39cb24-07f8-11ed-abd4-f47b094925e1","purity":"25~28%","speci":"500"}])},
|
|
|
|
{"id": 4, "use_content": json.dumps([{"name":"硫酸水","num":1,"client_id":"1c39cb24-07f8-11ed-abd4-f47b094925e1","purity":"25~28%","speci":"500"}])},
|
|
|
|
]
|
|
|
|
drug_list = []
|
|
|
|
update_id = ''
|
|
|
|
client_id = '1c39cb24-07f8-11ed-abd4-f47b094925e1'
|
|
|
|
drug_info = {"name": "双氧水"}
|
|
|
|
for d in data_list:
|
|
|
|
if update_id:
|
|
|
|
break
|
|
|
|
use_content = json.loads(d["use_content"])
|
|
|
|
for j in range(len(use_content)):
|
|
|
|
# for j in use_content:
|
|
|
|
j_info = use_content[j]
|
|
|
|
if j_info["client_id"] == client_id and j_info["name"] == drug_info["name"] and j_info["purity"] == "25~28%" and j_info["speci"] == "500":
|
|
|
|
if not j_info.get("use_num"):
|
|
|
|
j_info["use_num"] = 0
|
|
|
|
if int(j_info["use_num"]) == int(j_info["num"]):
|
|
|
|
continue
|
|
|
|
else:
|
|
|
|
j_info["use_num"] += 1
|
|
|
|
update_id = d["id"]
|
|
|
|
print(use_content)
|