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.

197 lines
12 KiB

"""
# 试剂进行入库时已绑定柜体id不考虑相同试剂多柜体的情况
试剂id柜体id
## 主概览
根据试剂记录展示入库/领用/归还/未归还
预警信息
## 报表统计---库存信息--总库存减去已绑定柜体的试剂数
库存信息总览 展示库存内试剂信息 根据所属终端分组去重
入库信息 展示入库试剂信息
试剂信息 根据试剂名称规格纯度进行去重展示 并分页
试剂使用统计 根据试剂记录展示信息
## 实际入库---未对试剂和柜体进行绑定
展示上传excle表格数据/新增模板实际数据
选择试剂入库 展示已入库试剂信息---选择按钮进行编辑试剂信息
绑定入库绑定操作根据前端传递参数进行入库操作
新增模板保存模板基本信息和模板内试剂json字符串信息入库
打印条码
导入入库模板根据柜体模板名称进行解析模板内试剂json字符串进行柜体试剂绑定
删除模板
试剂归还根据前端传递参数进行记录数据入库展示待归还数据列表
试剂称重 ...
## 库存盘点
库存盘点展示试剂库存信息
录入库存添加试剂数量根据管理人员确定展示校验结果
历史记录,
## 试剂管理
展示
报表统计:
库存信息总览: 分组
在库剩余数量count(id)
剩余总量sum(remain)
入库信息查询
默认展示
试剂信息详情
根据名称纯度规格分组展示
余量
库存消耗: rms_medicament rms_medicament_variety
入库数量 记录表record_type = 1 数量
借出 记录表record_type = 2 数量
借出 记录表record_type = 2 数量
当前库存总量
rms_medicament_record record_type=1 count(id)?
当前库存数量 status=1的count(id)?
当前借出数量 status=2的count(id)?
消耗数量
试剂用量消耗
库存量 表rms_medicament count(id) status=1
使用次数 表rms_medicament_record count(record_type=2) 数量
总用量 表rms_medicament_record sum(use_quantity) record_type=3
"""
# Remark1 = Column(String(50)) # 备注1
# Remark2 = Column(String(50)) # 备注2
# Remark3 = Column(String(50)) # 备注3
# Remark4 = Column(String(50))
# Remark5 = Column(String(50))
# Remark6 = Column(String(50))
# Remark7 = Column(String(50))
# Remark8 = Column(String(50))
# Remark9 = Column(String(50))
# Remark10 = Column(String(50))
# for i in range(30):
# print(f"remark{i+1} = Column(String(50), comment='扩展字段{i+1}')")
# import random
# from string import digits, ascii_letters, punctuation
# aaa = digits + ascii_letters+ punctuation
# # ccc = 'l4wu&yj@=ed^ybmw&#6m&vh0cglcqwagu8&($r5@qsmf(bb93='
# # print(len(ccc))
# print(aaa)
# a = ''
# # while True:
# # c = random.choice(aaa)
# # if c in ["'", '"', ",", ";", "."]:
# # continue
# # # print(c)
# # a += c
# # # print(a)
# # if len(a) >= 50:
# # break
# # print(a)
# import random
# # print(random.choice([1,2,3]))
# a = """12342525436 %s freqwrqwercqwe"""
# b = ''
# if b:
# a = a % f"ccccc{b}ccccccc"
# else:
# a = a % ''
# print(a)
# def mysqlfinds_list(data, finds):
# return [dict(zip(finds, i)) for i in data]
# fin = ["id", "name", "age"]
# da = [(1, "a", 10), (2, "b", 11),(3, "c", 12)]
# print(mysqlfinds_list(da, fin))
def model_name_loer(db_model):
for i in db_model.split("\n"):
base = i.split(" = ")
if len(base) < 2:
continue
# print(base)
name = ""
base_name = base[0].replace(" ", '')
for k, v in enumerate(base_name):
if k != 0 and name and v.isupper():
name += '_'
if v.isupper():
name += v.lower()
else:
name += v
base_d = base[1].replace(" ", '')
comment = base_d.split("#")
try:
db_comment = comment[1]
except IndexError:
db_comment = ''
comment_name = comment[0][:-1] + f', comment="{db_comment}")'
print(f"{name} = {comment_name}")
# import json
# tes_li_bse = [{"VarietyId": "f8442a6e-9950-11ec-a502-e2052a1045e4", "Remark1": "", "Remark2": "", "Remark3": "\u6613\u5236\u6bd2", "Remark4": "", "Name": "\u7532\u82ef", "EnglishName": "", "Purity": "AR\uff08\u6caa\u8bd5\uff09\uff0c\u2265 99.5%", "CASNumber": "108-88-3", "Remark5": "", "Speci": "500", "SpeciUnit": "ml", "ExportCount": "1", "Remark6": "\u74f6", "ProductionDate": "2022-03-01", "ShelfLife": 10529, "Price": "0", "IsSupervise": 0, "Remain": "683", "Manufacturer": "\u56fd\u836f", "Remark8": "", "Remark9": "\u70f7\u57fa\u6c5e", "Remark10": ""}, {"VarietyId": "f8442a6f-9950-11ec-9253-e2052a1045e4", "Remark1": "", "Remark2": "", "Remark3": "\u5371\u5316\u54c1", "Remark4": "", "Name": "\u82ef\u915a", "EnglishName": "", "Purity": "AR\uff08\u6caa\u8bd5\uff09\uff0c\u2265 99.0%", "CASNumber": "108-95-2", "Remark5": "", "Speci": "500", "SpeciUnit": "ml", "ExportCount": "1", "Remark6": "\u74f6", "ProductionDate": "2022-03-01", "ShelfLife": 10529, "Price": "0", "IsSupervise": 0, "Remain": "848", "Manufacturer": "\u56fd\u836f", "Remark8": "", "Remark9": "\u6325\u53d1\u915a", "Remark10": ""}, {"VarietyId": "f8442a70-9950-11ec-a157-e2052a1045e4", "Remark1": "", "Remark2": "", "Remark3": "\u5371\u5316\u54c1", "Remark4": "", "Name": "\u82ef", "EnglishName": "", "Purity": "AR\uff08\u6caa\u8bd5\uff09\uff0c\u2265 99.5%", "CASNumber": "71-43-2", "Remark5": "", "Speci": "500", "SpeciUnit": "ml", "ExportCount": "1", "Remark6": "\u74f6", "ProductionDate": "2022-03-01", "ShelfLife": 10529, "Price": "0", "IsSupervise": 0, "Remain": "640", "Manufacturer": "\u56fd\u836f", "Remark8": "", "Remark9": "\u6cb9", "Remark10": ""}, {"VarietyId": "f8442a71-9950-11ec-9894-e2052a1045e4", "Remark1": "", "Remark2": "", "Remark3": "\u5371\u5316\u54c1", "Remark4": "", "Name": "\u4e59\u9178\uff0836%\uff09", "EnglishName": "", "Purity": "AR", "CASNumber": "64-19-7", "Remark5": "", "Speci": "500", "SpeciUnit": "ml", "ExportCount": "1", "Remark6": "\u74f6", "ProductionDate": "2022-03-01", "ShelfLife": 10529, "Price": "0", "IsSupervise": 0, "Remain": "734", "Manufacturer": "\u56fd\u836f", "Remark8": "", "Remark9": "\u70f7\u57fa\u6c5e", "Remark10": ""}, {"VarietyId": "f84451a6-9950-11ec-8925-e2052a1045e4", "Remark1": "", "Remark2": "", "Remark3": "\u5371\u5316\u54c1", "Remark4": "", "Name": "\u4e59\u9178\u9150", "EnglishName": "", "Purity": "AR", "CASNumber": "106-24-7", "Remark5": "", "Speci": "500", "SpeciUnit": "ml", "ExportCount": "1", "Remark6": "\u74f6", "ProductionDate": "2022-03-01", "ShelfLife": 10529, "Price": "0", "IsSupervise": 0, "Remain": "749", "Manufacturer": "\u56fd\u836f", "Remark8": "", "Remark9": "\u70f7\u57fa\u6c5e", "Remark10": ""}, {"VarietyId": "f84451a7-9950-11ec-9b4e-e2052a1045e4", "Remark1": "", "Remark2": "", "Remark3": "\u5371\u5316\u54c1", "Remark4": "", "Name": "\u56db\u6c2f\u4e59\u70ef", "EnglishName": "", "Purity": "\u73af\u4fdd\u7ea7", "CASNumber": "127-18-4", "Remark5": "", "Speci": "500", "SpeciUnit": "ml", "ExportCount": "28", "Remark6": "\u74f6", "ProductionDate": "2022-03-01", "ShelfLife": 10529, "Price": "0", "IsSupervise": 0, "Remain": "1207", "Manufacturer": "\u5929\u6d25\u50b2\u7136", "Remark8": "", "Remark9": "\u6cb9", "Remark10": ""}, {"VarietyId": "f84451a8-9950-11ec-96ca-e2052a1045e4", "Remark1": "", "Remark2": "", "Remark3": "\u5371\u5316\u54c1", "Remark4": "", "Name": "\u56db\u6c2f\u5316\u78b3", "EnglishName": "", "Purity": "\u7ea2\u5916\u6d4b\u6cb9\u4eea\u4e13\u7528", "CASNumber": "56-23-5", "Remark5": "", "Speci": "500", "SpeciUnit": "ml", "ExportCount": "31", "Remark6": "\u74f6", "ProductionDate": "2022-03-01", "ShelfLife": 10529, "Price": "0", "IsSupervise": 0, "Remain": "1126", "Manufacturer": "\u5b89\u8c31", "Remark8": "", "Remark9": "\u77ff\u7269\u6cb9", "Remark10": ""}]
# new_li = []
# for i in tes_li_bse:
# dic = {}
# for k, v in i.items():
# bse_key = ""
# for index, va in enumerate(k):
# if index != 0 and bse_key and va.isupper():
# bse_key += '_'
# if va.isupper():
# bse_key += va.lower()
# else:
# bse_key += va
# bse_key = bse_key if bse_key != "c_a_s_number" else "cas_number"
# dic[bse_key] = v
# new_li.append(dic)
# print(json.dumps(new_li))
"""
[
{"variety_id": "f8442a6e-9950-11ec-a502-e2052a1045e4", "remark1": "", "remark2": "", "remark3": "\u6613\u5236\u6bd2", "remark4": "", "name": "\u7532\u82ef", "english_name": "", "purity": "AR\uff08\u6caa\u8bd5\uff09\uff0c\u2265 99.5%", "cas_number": "108-88-3", "remark5": "", "speci": "500", "speci_unit": "ml", "export_count": "1", "remark6": "\u74f6", "production_date": "2022-03-01", "shelf_life": 10529, "price": "0", "is_supervise": 0, "remain": "683", "manufacturer": "\u56fd\u836f", "remark8": "", "remark9": "\u70f7\u57fa\u6c5e", "remark10": ""},
{"variety_id": "f8442a6f-9950-11ec-9253-e2052a1045e4", "remark1": "", "remark2": "", "remark3": "\u5371\u5316\u54c1", "remark4": "", "name": "\u82ef\u915a", "english_name": "", "purity": "AR\uff08\u6caa\u8bd5\uff09\uff0c\u2265 99.0%", "cas_number": "108-95-2", "remark5": "", "speci": "500", "speci_unit": "ml", "export_count": "1", "remark6": "\u74f6", "production_date": "2022-03-01", "shelf_life": 10529, "price": "0", "is_supervise": 0, "remain": "848", "manufacturer": "\u56fd\u836f", "remark8": "", "remark9": "\u6325\u53d1\u915a", "remark10": ""},
{"variety_id": "f8442a70-9950-11ec-a157-e2052a1045e4", "remark1": "", "remark2": "", "remark3": "\u5371\u5316\u54c1", "remark4": "", "name": "\u82ef", "english_name": "", "purity": "AR\uff08\u6caa\u8bd5\uff09\uff0c\u2265 99.5%", "cas_number": "71-43-2", "remark5": "", "speci": "500", "speci_unit": "ml", "export_count": "1", "remark6": "\u74f6", "production_date": "2022-03-01", "shelf_life": 10529, "price": "0", "is_supervise": 0, "remain": "640", "manufacturer": "\u56fd\u836f", "remark8": "", "remark9": "\u6cb9", "remark10": ""},
{"variety_id": "f8442a71-9950-11ec-9894-e2052a1045e4", "remark1": "", "remark2": "", "remark3": "\u5371\u5316\u54c1", "remark4": "", "name": "\u4e59\u9178\uff0836%\uff09", "english_name": "", "purity": "AR", "cas_number": "64-19-7", "remark5": "", "speci": "500", "speci_unit": "ml", "export_count": "1", "remark6": "\u74f6", "production_date": "2022-03-01", "shelf_life": 10529, "price": "0", "is_supervise": 0, "remain": "734", "manufacturer": "\u56fd\u836f", "remark8": "", "remark9": "\u70f7\u57fa\u6c5e", "remark10": ""},
{"variety_id": "f84451a6-9950-11ec-8925-e2052a1045e4", "remark1": "", "remark2": "", "remark3": "\u5371\u5316\u54c1", "remark4": "", "name": "\u4e59\u9178\u9150", "english_name": "", "purity": "AR", "cas_number": "106-24-7", "remark5": "", "speci": "500", "speci_unit": "ml", "export_count": "1", "remark6": "\u74f6", "production_date": "2022-03-01", "shelf_life": 10529, "price": "0", "is_supervise": 0, "remain": "749", "manufacturer": "\u56fd\u836f", "remark8": "", "remark9": "\u70f7\u57fa\u6c5e", "remark10": ""},
{"variety_id": "f84451a7-9950-11ec-9b4e-e2052a1045e4", "remark1": "", "remark2": "", "remark3": "\u5371\u5316\u54c1", "remark4": "", "name": "\u56db\u6c2f\u4e59\u70ef", "english_name": "", "purity": "\u73af\u4fdd\u7ea7", "cas_number": "127-18-4", "remark5": "", "speci": "500", "speci_unit": "ml", "export_count": "28", "remark6": "\u74f6", "production_date": "2022-03-01", "shelf_life": 10529, "price": "0", "is_supervise": 0, "remain": "1207", "manufacturer": "\u5929\u6d25\u50b2\u7136", "remark8": "", "remark9": "\u6cb9", "remark10": ""},
{"variety_id": "f84451a8-9950-11ec-96ca-e2052a1045e4", "remark1": "", "remark2": "", "remark3": "\u5371\u5316\u54c1", "remark4": "", "name": "\u56db\u6c2f\u5316\u78b3", "english_name": "", "purity": "\u7ea2\u5916\u6d4b\u6cb9\u4eea\u4e13\u7528", "cas_number": "56-23-5", "remark5": "", "speci": "500", "speci_unit": "ml", "export_count": "31", "remark6": "\u74f6", "production_date": "2022-03-01", "shelf_life": 10529, "price": "0", "is_supervise": 0, "remain": "1126", "manufacturer": "\u5b89\u8c31", "remark8": "", "remark9": "\u77ff\u7269\u6cb9", "remark10": ""}]
"""