头像上传

duizhaopin
13507605001 2 years ago
parent ad156f38cc
commit d2de9fedf6

@ -65,6 +65,9 @@ def download_file(file_name, data_list, tp):
})
rsp_file_name = f"{file_name}{Utils.get_file_name_datetime()}"
obj.save(os.path.join(file_path, rsp_file_name))
u_path = Utils.getUDiskPath()
if u_path:
obj.save(os.path.join(u_path, rsp_file_name))
rep = dows_flie(file_path, rsp_file_name)
return rep
# return file_path, rsp_file_name

@ -124,9 +124,9 @@ def update_user_info():
# EntityUser.user_code.isnot(None)
# )
# )
new_obj = BllUser().execute(f"select * from rms_user where user_code={request.values.get('user_code')} and user_code is not null").fetchone()
new_obj = BllUser().execute(f"select * from rms_user where user_code='{request.values.get('user_code')}' and user_code is not null").fetchone()
if new_obj and obj.user_id == new_obj.user_id:
if new_obj and obj.user_id != new_obj.user_id:
return jsonify(Utils.false_return(msg="工号不能重复"))
finds_list = dir(EntityUser)
for i in finds_list:

@ -249,7 +249,11 @@ class BllMedicamentRecord(Repository):
new_dic[k] = v if not isinstance(v, Decimal) else float(v)
data_list.append(new_dic)
if finds:
base_num += float(new_dic.get(finds))
try:
finds_num = float(new_dic.get(finds))
except:
finds_num = 0
base_num += finds_num
return data_list, base_num
# 获取库存消耗数据

@ -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()
Loading…
Cancel
Save