入库类型存储

duizhaopin
tangxuan 2 years ago
parent 0d5bf3b3d6
commit aa0881e47f

@ -41,11 +41,11 @@ def show_template():
page_size = int(request.values.get("page_size", 10))
page_param = PageParam(page, page_size)
data = BllMedicamentTemplate().getAllTemplateList(
client_id=client_id,
client_id=client_id,
func_type=func_type,
page_param=page_param,
is_add=int(is_add)
)
)
data = Utils.msyql_table_model(data)
new_data_list = []
for i in data:
@ -79,7 +79,7 @@ def select_drug_info():
page_size = int(request.values.get("page_size", 10))
page_param = PageParam(page, page_size)
data_list = BllMedicament().get_drug_info_distinct_list(
seach_word=seach_word,
seach_word=seach_word,
func_type=func_type,
page_param=page_param)
data_list = Utils.msyql_table_model(data_list)
@ -118,7 +118,8 @@ def bind_tmp_input_db():
drug_variety = BllMedicamentVariety().createDrugVariety(
customer_id=customer_id,
drug_info=drug_info, user_info=user_info
drug_info=drug_info, user_info=user_info,
func_type=func_type
)
num = BllMedicament().execute(f"select count(*) num from rms_medicament where name like '%{drug_info.get('name')}%' and remark12 like '%{Utils.get_file_name_datetime()[:4]}%'").fetchone().num
remain_num = drug_info.get("remain", 0)
@ -172,7 +173,7 @@ def bind_tmp_input_db():
# obj = CreateBarcode()
# obj.create_drug_lobel_code(**new_dict)
BllMedicament().drugPutIn(
drug_entity,
drug_entity,
BllClient().findEntity(EntityClient.client_id==drug_entity.client_id),
user_info
)
@ -361,7 +362,7 @@ def print_code_data():
for i in range(int(temp.start_bar_code), int(temp.start_bar_code) + int(temp.bar_code_count)):
obj.create_Code128_img(str(i))
return jsonify(Utils.true_return(msg="成功"))
# # 获取所有导入模板信息
# @tmp_router.route("/all_tmp", methods=["GET"])
# # @token_auth.login_required
@ -397,4 +398,4 @@ def drug_enter_db_client_list():
if not drug_name:
drug_name = ''
data = BllMedicament().get_drug_save_db_info(drug_name=drug_name, func_type=func_type)
return jsonify(Utils.true_return(data=data))
return jsonify(Utils.true_return(data=data))

@ -6,4 +6,5 @@ port = 9001
# dbconntion = mysql+pymysql://root:123456@127.0.0.1/local_rms_db?charset=utf8
# dbconntion = mysql+pymysql://yanyi:tangyan86910282@111.231.67.55/yy_rms_multiple?charset=utf8
# dbconntion = mysql+pymysql://root:tangyan86910282@127.0.0.1/yy_rms_multiple?charset=utf8
dbconntion = mysql+pymysql://root:123456@192.168.1.200/yy_rms_multiple?charset=utf8
# dbconntion = mysql+pymysql://root:123456@192.168.1.200/yy_rms_multiple?charset=utf8
dbconntion = mysql+pymysql://root:123456@127.0.0.1/yy_rms_multiple?charset=utf8

@ -26,7 +26,7 @@ class BllMedicamentVariety(Repository):
return super().__init__(entityType)
# 创建药剂品种
def createDrugVariety(self, customer_id, drug_info, user_info):
def createDrugVariety(self, customer_id, drug_info, user_info, func_type):
entity = self.findEntity(
and_(
EntityMedicamentVariety.name == drug_info.get("name"),
@ -55,7 +55,8 @@ class BllMedicamentVariety(Repository):
normal_count=1,
use_count=0,
empty_count=0,
is_supervise=0
is_supervise=0,
remark1=func_type,
)
self.insert(entity)
else:
@ -74,10 +75,10 @@ class BllMedicamentVariety(Repository):
if func_type:
if filter_base:
filter_base += " and "
filter_base += f" tp = {func_type}"
filter_base += f" remark1 = {func_type}"
if filter_base:
filter_base = f" where {filter_base} "
sql_all = f"""
select * from rms_medicament_variety {filter_base}
"""
@ -89,12 +90,12 @@ class BllMedicamentVariety(Repository):
if page_param:
page_param.totalRecords = count_number
sql_all = Utils.sql_paging_assemble(sql_all, page_param)
return self.execute(sql_all).fetchall()
return self.execute(sql_all).fetchall()
# # 获取品种统计
# def getVarietyStatistics(self):
# SQL = """
# SELECT b.VarietyId as VarietyId, COUNT(CASE when IsEmpty = 1 then 1 end) as QuarterlyEmptyCount,
# sum(CASE when IsEmpty = 1 then a.price else 0 end) as QuarterlyEmptyPrice, COUNT(CASE when RecordType = 1 then 1 end) as
# SELECT b.VarietyId as VarietyId, COUNT(CASE when IsEmpty = 1 then 1 end) as QuarterlyEmptyCount,
# sum(CASE when IsEmpty = 1 then a.price else 0 end) as QuarterlyEmptyPrice, COUNT(CASE when RecordType = 1 then 1 end) as
# QuarterlyPutInCount from RMS_MedicamentVariety as b LEFT JOIN RMS_MedicamentRecord as a on
# b.VarietyId = a.VarietyId and MONTH((a.CreateDate)) = MONTH(now()) and Date_format
# (a.CreateDate, '%Y') = (DATE_FORMAT(now(), '%Y')) GROUP by b.VarietyId
@ -103,10 +104,10 @@ class BllMedicamentVariety(Repository):
# quarter_data = BllMedicamentVariety().execute(SQL).fetchall()
# quarter_data = json.loads(Utils.resultAlchemyData(
# Utils.mysqlTable2Model(quarter_data)))
# SQL = """SELECT b.VarietyId as VarietyId, COUNT(CASE when IsEmpty = 1 then a.CreateDate end)
# SQL = """SELECT b.VarietyId as VarietyId, COUNT(CASE when IsEmpty = 1 then a.CreateDate end)
# as YearEmptyCount, sum(CASE when IsEmpty = 1 then a.price else 0 end) as YearEmptyPrice,
# COUNT(CASE when RecordType = 1 then 1 end) as YearPutInCount from RMS_MedicamentVariety as b LEFT JOIN
# RMS_MedicamentRecord as a on b.VarietyId = a.VarietyId and year((a.CreateDate)) =
# COUNT(CASE when RecordType = 1 then 1 end) as YearPutInCount from RMS_MedicamentVariety as b LEFT JOIN
# RMS_MedicamentRecord as a on b.VarietyId = a.VarietyId and year((a.CreateDate)) =
# year(now()) GROUP by b.VarietyId"""
# # 获取年度数据
@ -114,11 +115,11 @@ class BllMedicamentVariety(Repository):
# year_data = json.loads(Utils.resultAlchemyData(
# Utils.mysqlTable2Model(year_data)))
# SQL = """
# select a.VarietyId as VarietyId, a.Name,a.Purity,a.CASNumber,a.IsSupervise,
# sum(case when b.`Status` = 1 then 1 else 0 end) as NormalCount,
# select a.VarietyId as VarietyId, a.Name,a.Purity,a.CASNumber,a.IsSupervise,
# sum(case when b.`Status` = 1 then 1 else 0 end) as NormalCount,
# sum(case when b.`Status` = 1 or b.`Status` = 2 then 1 else 0 end) as TotalCount,
# sum(case when b.`Status` = 2 then 1 else 0 end) as UseCount,
# sum(case when b.`Status` = 1 or b.`Status` = 2 then b.Price else 0 end) as StockPrice
# sum(case when b.`Status` = 2 then 1 else 0 end) as UseCount,
# sum(case when b.`Status` = 1 or b.`Status` = 2 then b.Price else 0 end) as StockPrice
# from RMS_MedicamentVariety as a LEFT JOIN RMS_Medicament
# as b on b.VarietyId = a.VarietyId GROUP BY a.VarietyId
# """
@ -159,4 +160,4 @@ class BllMedicamentVariety(Repository):
# self.insert(obj)
# if __name__ == '__main__':
# BllMedicamentVariety().inster_type_drug()
# BllMedicamentVariety().inster_type_drug()

Loading…
Cancel
Save