diff --git a/demo.py b/demo.py index 8338591..433dbe7 100644 --- a/demo.py +++ b/demo.py @@ -346,23 +346,64 @@ client_id: 1c39cb24-07f8-11ed-abd4-f47b094925e1 """ -dic = {"bar_code":"789654","by_user_date":"","by_user_id":"","by_user_name":"","cas_number":"106-24-7","cell_position_code":"","client_code":"","client_id":"1c39cb24-07f8-11ed-abd4-f47b094925e1","customer_id":"","distributor":"","english_name":"","expiration_date":"","flow_position_code":"","inventory_warning_value":10,"is_add":0,"is_supervise":0,"is_weigh":0,"manufacturer":"国药","medicament_id":"12dec478-186b-11ed-b2c3-9adf5e32e162","name":"乙酸酐","net_weight":"","net_weight_unit":"","place":"","price":"0","production_date":"2022-03-01","purity":"AR","put_in_date":"2022-08-10 13:12:47","put_in_user_id":"4cea74ee-0d8b-11ed-943e-f47b094925e1","put_in_user_name":"12334","remain":"749","remark1":"","remark10":"","remark11":"","remark12":"","remark13":"","remark14":"","remark15":"","remark16":"","remark17":"","remark18":"","remark19":"","remark2":"","remark20":"","remark21":"","remark22":"","remark23":"","remark24":"","remark25":"","remark26":"","remark27":"","remark28":"","remark29":"","remark3":"危化品","remark30":"","remark4":"","remark5":"","remark6":"瓶","remark7":"","remark8":"","remark9":"烷基汞","shelf_life":0,"shelf_life_warning_value":10,"speci":"500","total":"","tp":"","use_days_warning_value":10,"user_auditing":"","variety_id":"f37c5780-1869-11ed-8ac1-9adf5e32e162","weigh_flag":0,"num":12} - -# for k,v in dic.items(): -# if v == "": -# dic.pop(k) -# print(dic) -data_list = [{"t1":0, "t2":2, "t3": 1}, {"t1":None, "t2":1, "t3": 1}] -new_data_list = [] -for i in data_list: - new_dic = {} - for k, v in i.items(): - if not v: - v = 0 - new_dic[k] = v - new_li = list(new_dic.values()) - new_dic.update(**{ - "t4": int(new_li[1]) - int(new_li[2]) - }) - new_data_list.append(new_dic) -print(new_data_list) \ No newline at end of file +# dic = {"bar_code":"789654","by_user_date":"","by_user_id":"","by_user_name":"","cas_number":"106-24-7","cell_position_code":"","client_code":"","client_id":"1c39cb24-07f8-11ed-abd4-f47b094925e1","customer_id":"","distributor":"","english_name":"","expiration_date":"","flow_position_code":"","inventory_warning_value":10,"is_add":0,"is_supervise":0,"is_weigh":0,"manufacturer":"国药","medicament_id":"12dec478-186b-11ed-b2c3-9adf5e32e162","name":"乙酸酐","net_weight":"","net_weight_unit":"","place":"","price":"0","production_date":"2022-03-01","purity":"AR","put_in_date":"2022-08-10 13:12:47","put_in_user_id":"4cea74ee-0d8b-11ed-943e-f47b094925e1","put_in_user_name":"12334","remain":"749","remark1":"","remark10":"","remark11":"","remark12":"","remark13":"","remark14":"","remark15":"","remark16":"","remark17":"","remark18":"","remark19":"","remark2":"","remark20":"","remark21":"","remark22":"","remark23":"","remark24":"","remark25":"","remark26":"","remark27":"","remark28":"","remark29":"","remark3":"危化品","remark30":"","remark4":"","remark5":"","remark6":"瓶","remark7":"","remark8":"","remark9":"烷基汞","shelf_life":0,"shelf_life_warning_value":10,"speci":"500","total":"","tp":"","use_days_warning_value":10,"user_auditing":"","variety_id":"f37c5780-1869-11ed-8ac1-9adf5e32e162","weigh_flag":0,"num":12} + +# # for k,v in dic.items(): +# # if v == "": +# # dic.pop(k) +# # print(dic) +# data_list = [{"t1":0, "t2":2, "t3": 1}, {"t1":None, "t2":1, "t3": 1}] +# new_data_list = [] +# for i in data_list: +# new_dic = {} +# for k, v in i.items(): +# if not v: +# v = 0 +# new_dic[k] = v +# new_li = list(new_dic.values()) +# new_dic.update(**{ +# "t4": int(new_li[1]) - int(new_li[2]) +# }) +# new_data_list.append(new_dic) +# print(new_data_list) + +a = 0 + +class BaseStatus(object): + + status = None + def __init__(self, status=0) -> None: + self.status = status + + +import threading +class WriteTxt(object): + + status_obj = None + + def __init__(self) -> None: + self.status_obj = BaseStatus() + + def write1(self): + self.status_obj.status = 1 + fileName = 'note.txt' + for i in range(100): + with open(fileName, 'a', encoding='utf-8')as file: + file.write(str(self.status_obj.status)+"\n") + + def write2(self): + self.status_obj.status = 2 + fileName = 'note1.txt' + for i in range(100): + with open(fileName, 'a', encoding='utf-8')as file: + file.write(str(self.status_obj.status) + "\n") + + def start(self): + p = threading.Thread(target=self.write1) + p.start() + p1 = threading.Thread(target=self.write2) + p1.start() + +if __name__ == '__main__': + aaa = WriteTxt() + aaa.start() \ No newline at end of file diff --git a/models/client_models.py b/models/client_models.py index a54ed21..ee05eb8 100644 --- a/models/client_models.py +++ b/models/client_models.py @@ -49,7 +49,7 @@ class EntityClient(Base): sort_index = Column(Integer, comment='排序序号') # 排序序号 parent_id = Column(Integer, comment='父级Id') # 父级ID description = Column(String(200), comment='备注') # 备注 - is_add = Column(Integer, comment='是否添加', default=1) + is_add = Column(Integer, comment='是否添加', default=0) class EntityClientCellUser(Base): @@ -97,7 +97,7 @@ class EntityClientVersion(Base): create_date = Column(String(50), comment="创建时间") create_user_id = Column(Integer, comment="创建用户ID") create_user_name = Column(String(50), comment="创建用户名") - is_add = Column(Integer, comment="", default=1) + is_add = Column(Integer, comment="", default=0) class EntityClientCell(Base): diff --git a/models/humiture_models.py b/models/humiture_models.py index 7508659..bea9dd1 100644 --- a/models/humiture_models.py +++ b/models/humiture_models.py @@ -26,4 +26,4 @@ class EntityHumitureRecord(Base): humidity = Column(Float, comment='湿度值') # 湿度值 voc_content = Column(Float, comment='voc含量') # voc含量 record_date = Column(String(50), comment='记录日期') # 记录日期 - is_add = Column(Integer, comment='是否添加', default=1) + is_add = Column(Integer, comment='是否添加', default=0) diff --git a/models/log_models.py b/models/log_models.py index 67f67c9..d17ac46 100644 --- a/models/log_models.py +++ b/models/log_models.py @@ -30,4 +30,4 @@ class EntityLog(Base): execute_result_code = Column(String(50), comment='执行结果代码') # 执行结果代码 execute_result = Column(String(50), comment='执行结果') # 执行结果 operate_date = Column(String(50), comment='操作日期') # 操作日期 - is_add = Column(Integer, comment='是否添加', default=1) + is_add = Column(Integer, comment='是否添加', default=0) diff --git a/models/medicament_models.py b/models/medicament_models.py index 8050712..768f7f6 100644 --- a/models/medicament_models.py +++ b/models/medicament_models.py @@ -123,7 +123,7 @@ class EntityMedicamentTemplate(Base): create_date = Column(String(50), comment="创建日期") create_user_id = Column(String(50), comment="创建用户ID") create_user_name = Column(String(50), comment="创建用户名") - is_add = Column(Integer, comment="", default=1) + is_add = Column(Integer, comment="", default=0) @classmethod def get_finds(cls): @@ -152,7 +152,7 @@ class EntityMedicamentRecord(Base): create_date = Column(String(50), comment="创建日期") create_user_id = Column(String(50), comment="创建人ID") create_user_name = Column(String(50), comment="创建人名称") - is_add = Column(Integer, comment="", default=1) + is_add = Column(Integer, comment="", default=0) class EntityMedicamentVariety(Base): @@ -189,7 +189,7 @@ class EntityMedicamentVariety(Base): create_date = Column(String(50), comment="创建日期") create_user_id = Column(String(50), comment="创建用户ID") create_user_name = Column(String(50), comment="创建用户名称") - is_add = Column(Integer, comment="", default=1) + is_add = Column(Integer, comment="", default=0) remark1 = Column(String(50), comment='扩展字段1') remark2 = Column(String(50), comment='扩展字段2') diff --git a/models/power_models.py b/models/power_models.py index 025ec72..1b05896 100644 --- a/models/power_models.py +++ b/models/power_models.py @@ -33,7 +33,7 @@ class EntityModule(Base): create_date = Column(String(50), comment="创建时间") create_user_id = Column(String(50), comment="创建用户id") create_user_name = Column(String(50), comment="创建用户名") - is_add = Column(Integer, comment="") + is_add = Column(Integer, comment="", default=0) @@ -56,7 +56,7 @@ class EntityModuleRelation(Base): create_date = Column(String(50), comment="创建时间") create_user_id = Column(String(50), comment="创建用户id") create_user_name = Column(String(50), comment="创建用户名称") - is_add = Column(Integer, comment="") + is_add = Column(Integer, comment="", default=0) # if __name__ == '__main__': # from sqlalchemy import create_engine diff --git a/models/user_models.py b/models/user_models.py index 5103e5b..c0c5da8 100644 --- a/models/user_models.py +++ b/models/user_models.py @@ -5,7 +5,7 @@ ''' import sys sys.path.append(".") -from sqlalchemy import Column, String, Text, Integer +from sqlalchemy import Column, String, Text, Integer, BLOB from Common.Utils import Utils from models.models_base import Base, get_uuid from werkzeug.security import check_password_hash, generate_password_hash @@ -42,7 +42,7 @@ class EntityUser(Base): create_date = Column(String(50), comment='创建日期') # 创建日期 create_user_id = Column(String(50), comment='创建用户ID') # 创建用户ID create_user_name = Column(String(50), comment='创建用户名称') # 创建用户名称 - is_add = Column(Integer, comment='是否添加', default=1) + is_add = Column(Integer, comment='是否添加', default=0) def update_last_visit_date(self): self.last_visit_date=Utils.get_str_datetime() @@ -72,7 +72,7 @@ class EntityRole(Base): sort_index = Column(Integer, comment="排序序号") is_enabled = Column(Integer, comment="是否启用", default=1) description = Column(String(50), comment="备注") - is_add = Column(Integer, comment="", default=1) + is_add = Column(Integer, comment="", default=0) @@ -89,6 +89,20 @@ class EntityUserMedicament(Base): drug_id = Column(String(50), comment="试剂ID") +class EntityUserFace(Base): + __tablename__ = "rms_user_face" + __table_args__ = ( + { + "comment": "RMS用户人脸数据表" + } + ) + + face_id = Column(String(50), comment='人脸id', + primary_key=True, default=get_uuid) + customer_id = Column(String(50), comment="客户id") + user_id = Column(String(50), comment="用户id") + face_value = Column(BLOB, comment="人脸内容") + # # 用户终端限制 # class EntityClientUser(Base): diff --git a/models/warning_models.py b/models/warning_models.py index 9a76314..56b9dfa 100644 --- a/models/warning_models.py +++ b/models/warning_models.py @@ -31,4 +31,4 @@ class EntityWarning(Base): solve_user_name = Column(String(50), comment="解决用户名") solve_date = Column(String(50), comment="解决日期") solve_content = Column(Text, comment="解决内容") - is_add = Column(Integer, comment="", default=1) + is_add = Column(Integer, comment="", default=0)