parent
19ed6c9781
commit
64de5e4ba8
@ -0,0 +1,9 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
'''
|
||||||
|
@Date:2022/07/19 17:12:29
|
||||||
|
'''
|
||||||
|
|
||||||
|
from flask import Blueprint
|
||||||
|
|
||||||
|
report_router = Blueprint("report", __name__)
|
@ -0,0 +1,58 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
'''
|
||||||
|
@Date:2022/07/19 17:12:23
|
||||||
|
'''
|
||||||
|
from flask import jsonify, request
|
||||||
|
|
||||||
|
from . import report_router
|
||||||
|
from common.utils import Utils
|
||||||
|
from db_logic.medicament_record import BllMedicamentRecord
|
||||||
|
from db_logic.medicament import BllMedicament
|
||||||
|
|
||||||
|
# 获取报表统计页面展示
|
||||||
|
@report_router.router('/report_home', methods=["GET", "POST"])
|
||||||
|
def report_home_info():
|
||||||
|
# 试剂使用统计
|
||||||
|
base_data = BllMedicamentRecord().get_drug_record_count()
|
||||||
|
data = []
|
||||||
|
for i in base_data:
|
||||||
|
data.append(
|
||||||
|
{
|
||||||
|
"tp":i[0],
|
||||||
|
"number":i[1],
|
||||||
|
"date_time": i[2]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return jsonify(Utils.true_return(data=data))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 库存信息总览
|
||||||
|
@report_router.router("/stock_data_info", methods=["GET", "POST"])
|
||||||
|
def get_stock_data_info():
|
||||||
|
name = request.values.get("name", None)
|
||||||
|
page = request.values.get('page', 1)
|
||||||
|
page_size = request.values.get('page_size', 15)
|
||||||
|
finds = ["name", "cas_number", "net_weight_unit",
|
||||||
|
"client_id", "count_surplus", "sum_remain"]
|
||||||
|
data_list = BllMedicament.get_stock_all_info(name=name, page=page, page_size=page_size)
|
||||||
|
if data_list:
|
||||||
|
data = []
|
||||||
|
for i in data_list:
|
||||||
|
data.append(dict(zip(finds, list(i))))
|
||||||
|
return jsonify(Utils.true_return(data=data))
|
||||||
|
else:
|
||||||
|
return jsonify(Utils.false_return(msg="无效数据"))
|
||||||
|
|
||||||
|
# 入库信息查询and 试剂信息查询
|
||||||
|
@report_router.router("/input_info")
|
||||||
|
def drun_input_info():
|
||||||
|
seach_word = request.values.get('seach_word')
|
||||||
|
page = request.values.get('page', 1)
|
||||||
|
page_size = request.values.get('page_size', 10)
|
||||||
|
manufacturer = request.values.get("manufacturer")
|
||||||
|
customer_id = request.values.get("customer_id")
|
||||||
|
client_id = request.values.get("client_id")
|
||||||
|
data = BllMedicament.getAllDrugList(search_word=seach_word, page=page, page_size=page_size, customer_id=customer_id, client_id=client_id)
|
||||||
|
return jsonify(Utils.true_return(data=data))
|
@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
'''
|
||||||
|
@Date:2022/07/19 16:34:17
|
||||||
|
'''
|
||||||
|
|
||||||
|
from flask import Blueprint
|
||||||
|
|
||||||
|
|
||||||
|
user_router = Blueprint('user', __name__)
|
@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
'''
|
||||||
|
@Date:2022/07/19 16:34:34
|
||||||
|
'''
|
||||||
|
from flask import jsonify, request, session
|
||||||
|
|
||||||
|
from common.utils import Utils
|
||||||
|
from . import user_router
|
||||||
|
|
||||||
|
from db_logic.user import BllUser
|
||||||
|
|
||||||
|
@user_router.router("/login", methods=["POST"])
|
||||||
|
def user_login():
|
||||||
|
user_name = request.values.get("user_name")
|
||||||
|
user_pwd = request.values.get('password')
|
||||||
|
user_obj = BllUser.login(user_name, user_pwd)
|
||||||
|
if user_obj:
|
||||||
|
session['user_id'] = user_obj.user_id
|
||||||
|
session['customer_id'] = user_obj.customer_id
|
||||||
|
return jsonify(Utils.true_return(msg="登陆成功"))
|
||||||
|
else:
|
||||||
|
return jsonify(Utils.false_return(status=201, msg="登陆失败"))
|
@ -0,0 +1,106 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
'''
|
||||||
|
@Date:2022/07/19 10:49:15
|
||||||
|
'''
|
||||||
|
import sys
|
||||||
|
sys.path.append('.')
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
from sqlalchemy import or_, and_, asc, desc
|
||||||
|
from sqlalchemy.sql import func
|
||||||
|
from db_logic.db_base import Repository
|
||||||
|
|
||||||
|
from models.medicament_models import EntityMedicamentRecord
|
||||||
|
# from common.utils import Utils
|
||||||
|
|
||||||
|
#药剂流转记录业务逻辑类
|
||||||
|
class BllMedicamentRecord(Repository):
|
||||||
|
#_instance_lock = threading.Lock()
|
||||||
|
##实现单例模式
|
||||||
|
#def __new__(cls, *args, **kwargs):
|
||||||
|
# if not hasattr(BllMedicamentRecord, "_instance"):
|
||||||
|
# with BllMedicamentRecord._instance_lock:
|
||||||
|
# if not hasattr(BllMedicamentRecord, "_instance"):
|
||||||
|
# BllMedicamentRecord._instance = object.__new__(cls)
|
||||||
|
# return BllMedicamentRecord._instance
|
||||||
|
|
||||||
|
def __init__(self, entityType=EntityMedicamentRecord):
|
||||||
|
return super().__init__(entityType)
|
||||||
|
|
||||||
|
def get_today_record_number(self,):
|
||||||
|
self.entityType.query()
|
||||||
|
|
||||||
|
|
||||||
|
return
|
||||||
|
# #获取指定用户流转记录
|
||||||
|
# def getUserDrugRecordList(self, pageParam, customerId, userId=None):
|
||||||
|
# queryStr = 'select * from RMS_MedicamentRecord r left join RMS_Medicament m on m.MedicamentId=r.MedicamentId and m.CustomerId=:customerId '
|
||||||
|
# queryParams = {"customerId": customerId}
|
||||||
|
# if(userId):
|
||||||
|
# queryStr += ' where CreateUserId=:userId order by CreateDate desc'
|
||||||
|
# queryParams["userId"] = userId
|
||||||
|
# else:
|
||||||
|
# queryStr += ' order by CreateDate desc'
|
||||||
|
# templateList = self.execute(queryStr + ' limit ' + str((pageParam.curPage - 1)
|
||||||
|
# * pageParam.pageRows) + ',' + str(pageParam.pageRows), queryParams).fetchall()
|
||||||
|
# pageParam.totalRecords = self.execute(
|
||||||
|
# queryStr.replace('*', 'count(*)'), queryParams).fetchone()[0]
|
||||||
|
# jsonData = Utils.mysqlTable2Model(templateList)
|
||||||
|
# return jsonData
|
||||||
|
|
||||||
|
#获取今日药剂流转信息数量
|
||||||
|
def getTodayDrugRecordCount(self, customerId, clientId):
|
||||||
|
todayDate = datetime.datetime.now().strftime("%Y-%m-%d")
|
||||||
|
# 使用类型进行分组,直接获取入库,领用,归还的数量
|
||||||
|
recordListNew = self.session.query(
|
||||||
|
self.entityType.record_type,
|
||||||
|
func.count('record_id')
|
||||||
|
).select_from(self.entityType).filter(
|
||||||
|
EntityMedicamentRecord.customer_id == customerId,
|
||||||
|
EntityMedicamentRecord.client_id == clientId,
|
||||||
|
func.date_format(EntityMedicamentRecord.create_date, '%Y-%m-%d') == todayDate
|
||||||
|
).group_by(EntityMedicamentRecord.record_type).all()
|
||||||
|
return dict(recordListNew)
|
||||||
|
|
||||||
|
|
||||||
|
# 获取报表统计内入库记录信息
|
||||||
|
def get_drug_record_count(self):
|
||||||
|
query_li = [
|
||||||
|
self.entityType.record_type,
|
||||||
|
func.count('record_id'),
|
||||||
|
func.max(self.entityType.create_date)
|
||||||
|
]
|
||||||
|
data = self.session.query(
|
||||||
|
*tuple(query_li)
|
||||||
|
).select_from(self.entityType).group_by(EntityMedicamentRecord.record_type).all()
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
# #获取药剂最后一次使用余量
|
||||||
|
# def getLastRecordRemain(self, drugId):
|
||||||
|
# SQL = """
|
||||||
|
# select RecordRemain from rms_medicamentrecord WHERE MedicamentId='""" + drugId + """' ORDER BY CreateDate DESC LIMIT 1
|
||||||
|
# """
|
||||||
|
# try:
|
||||||
|
# result = BllMedicamentRecord().execute(SQL)
|
||||||
|
# return float(result.fetchone()[0])
|
||||||
|
# except Exception as e:
|
||||||
|
# print(e)
|
||||||
|
# return 0
|
||||||
|
|
||||||
|
# #删除药剂最后一次领用记录
|
||||||
|
# def deleteLastUseRecord(self, drugId):
|
||||||
|
# SQL = """
|
||||||
|
# delete from rms_medicamentrecord WHERE MedicamentId='""" + drugId + """' and RecordType=2 ORDER BY CreateDate DESC LIMIT 1
|
||||||
|
# """
|
||||||
|
# result = BllMedicamentRecord().executeNoParam(SQL)
|
||||||
|
# return result
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
from db_logic.medicament_record import BllMedicamentRecord
|
||||||
|
customerId, clientId = None, '8db7e540-070f-11ed-a286-f47b094925e1'
|
||||||
|
typ_dic = BllMedicamentRecord().get_drug_record_count()
|
||||||
|
# typ_dic[4] = typ_dic[2] - typ_dic[3]
|
||||||
|
print(typ_dic)
|
@ -0,0 +1,110 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
'''
|
||||||
|
@Date:2022/07/19 09:43:08
|
||||||
|
'''
|
||||||
|
from sqlalchemy import or_, and_
|
||||||
|
from db_logic.db_base import Repository
|
||||||
|
from models.medicament_models import EntityMedicamentVariety
|
||||||
|
|
||||||
|
|
||||||
|
#药剂品种业务逻辑类
|
||||||
|
class BllMedicamentVariety(Repository):
|
||||||
|
#_instance_lock = threading.Lock()
|
||||||
|
## 实现单例模式
|
||||||
|
#def __new__(cls, *args, **kwargs):
|
||||||
|
# if not hasattr(BllMedicamentVariety, "_instance"):
|
||||||
|
# with BllMedicamentVariety._instance_lock:
|
||||||
|
# if not hasattr(BllMedicamentVariety, "_instance"):
|
||||||
|
# BllMedicamentVariety._instance = object.__new__(cls)
|
||||||
|
# return BllMedicamentVariety._instance
|
||||||
|
|
||||||
|
def __init__(self, entityType=EntityMedicamentVariety):
|
||||||
|
return super().__init__(entityType)
|
||||||
|
|
||||||
|
# # 创建药剂品种
|
||||||
|
# def createDrugVariety(self, customerId, name, englishName, casNumber, purity, unit, speciUnit, speci, entityUser=EntityUser()):
|
||||||
|
# entity = self.findEntity(and_(EntityMedicamentVariety.Name == name, EntityMedicamentVariety.Purity == purity,
|
||||||
|
# EntityMedicamentVariety.Unit == unit, EntityMedicamentVariety.SpeciUnit == speciUnit, EntityMedicamentVariety.Speci == speci))
|
||||||
|
# print(entity, 6666666666)
|
||||||
|
# if(entity is None):
|
||||||
|
# entity = EntityMedicamentVariety()
|
||||||
|
# entity.VarietyId = Utils.UUID()
|
||||||
|
# entity.CustomerId = customerId
|
||||||
|
# entity.InventoryWarningValue = 10
|
||||||
|
# entity.ShelfLifeWarningValue = 10
|
||||||
|
# entity.UseDaysWarningValue = 10
|
||||||
|
# entity.Name = name
|
||||||
|
# entity.EnglishName = englishName
|
||||||
|
# entity.CASNumber = casNumber
|
||||||
|
# entity.Purity = purity
|
||||||
|
# entity.Unit = unit
|
||||||
|
# entity.SpeciUnit = speciUnit
|
||||||
|
# entity.TotalCount = 1
|
||||||
|
# entity.InventoryWarningValue = 2
|
||||||
|
# entity.NormalCount = 1
|
||||||
|
# entity.UseCount = 0
|
||||||
|
# entity.EmptyCount = 0
|
||||||
|
# entity.IsSupervise = 0
|
||||||
|
# entity.Speci = speci
|
||||||
|
# entity.CreateDate = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||||
|
# entity.CreateUserId = entityUser.UserId
|
||||||
|
# entity.CreateUserName = entityUser.RealName
|
||||||
|
# self.insert(entity)
|
||||||
|
# else:
|
||||||
|
# entity.TotalCount += 1
|
||||||
|
# entity.NormalCount += 1
|
||||||
|
# self.update(entity)
|
||||||
|
# entity = self.session.merge(entity)
|
||||||
|
# return entity
|
||||||
|
|
||||||
|
# # 获取品种统计
|
||||||
|
# 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
|
||||||
|
# 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
|
||||||
|
# """
|
||||||
|
# # 获取季度数据
|
||||||
|
# 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)
|
||||||
|
# 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)) =
|
||||||
|
# year(now()) GROUP by b.VarietyId"""
|
||||||
|
|
||||||
|
# # 获取年度数据
|
||||||
|
# year_data = BllMedicamentVariety().execute(SQL).fetchall()
|
||||||
|
# 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,
|
||||||
|
# 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
|
||||||
|
# from RMS_MedicamentVariety as a LEFT JOIN RMS_Medicament
|
||||||
|
# as b on b.VarietyId = a.VarietyId GROUP BY a.VarietyId
|
||||||
|
# """
|
||||||
|
# # 获取药剂数据
|
||||||
|
# med_data = BllMedicamentVariety().execute(SQL).fetchall()
|
||||||
|
# med_data = json.loads(Utils.resultAlchemyData(
|
||||||
|
# Utils.mysqlTable2Model(med_data)))
|
||||||
|
# data_list = []
|
||||||
|
# new_data_list = []
|
||||||
|
# # 便利数据合通过VarietyId相同合并字典
|
||||||
|
# for quarter in quarter_data:
|
||||||
|
# for year in year_data:
|
||||||
|
# if quarter['VarietyId'] == year['VarietyId']:
|
||||||
|
# new_data = dict(quarter, **year)
|
||||||
|
# data_list.append(new_data)
|
||||||
|
# for data_dict in data_list:
|
||||||
|
# for med in med_data:
|
||||||
|
# if data_dict['VarietyId'] == med['VarietyId']:
|
||||||
|
# new_data = dict(data_dict, **med)
|
||||||
|
# new_data_list.append(new_data)
|
||||||
|
# return new_data_list
|
@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
'''
|
||||||
|
@Date:2022/07/19 13:54:49
|
||||||
|
'''
|
||||||
|
from sqlalchemy import or_, desc
|
||||||
|
from db_logic.db_base import Repository
|
||||||
|
from models.warning_models import EntityWarning
|
||||||
|
#预警信息业务逻辑类
|
||||||
|
class BllWarning(Repository):
|
||||||
|
def __init__(self, entityType=EntityWarning):
|
||||||
|
return super().__init__(entityType)
|
||||||
|
|
||||||
|
#获取预警列表
|
||||||
|
def getWarningList(self,customerId,pageParam,keyWord=''):
|
||||||
|
keyWord='%'+keyWord+'%'
|
||||||
|
orm_query= self.findList().filter(
|
||||||
|
EntityWarning.customer_id==customerId
|
||||||
|
).filter(
|
||||||
|
or_(EntityWarning.object_name.like(keyWord),
|
||||||
|
EntityWarning.warning_user_name.like(keyWord))
|
||||||
|
).order_by(desc(EntityWarning.warning_date))
|
||||||
|
return self.queryPage(orm_query,pageParam)
|
||||||
|
|
||||||
|
#获取预警类型数量
|
||||||
|
def getWarningCount(self):
|
||||||
|
recordList=self.findList().all()
|
||||||
|
# 过期预警列表
|
||||||
|
gqList = [record for record in recordList if record.object_type == '2']
|
||||||
|
# 余量预警列表
|
||||||
|
ylList = [record for record in recordList if record.object_type == '3']
|
||||||
|
return (len(recordList),len(gqList),len(ylList))
|
@ -1,267 +0,0 @@
|
|||||||
[2022-07-18 17:36:02,221] log_utlis.py->debug line:52 [DEBUG]Traceback (most recent call last):
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1819, in _execute_context
|
|
||||||
self.dialect.do_execute(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\default.py", line 732, in do_execute
|
|
||||||
cursor.execute(statement, parameters)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\cursors.py", line 148, in execute
|
|
||||||
result = self._query(query)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\cursors.py", line 310, in _query
|
|
||||||
conn.query(q)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 548, in query
|
|
||||||
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 775, in _read_query_result
|
|
||||||
result.read()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 1156, in read
|
|
||||||
first_packet = self.connection._read_packet()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 725, in _read_packet
|
|
||||||
packet.raise_for_error()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\protocol.py", line 221, in raise_for_error
|
|
||||||
err.raise_mysql_exception(self._data)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\err.py", line 143, in raise_mysql_exception
|
|
||||||
raise errorclass(errno, errval)
|
|
||||||
pymysql.err.DataError: (1265, "Data truncated for column 'temperature' at row 1")
|
|
||||||
|
|
||||||
The above exception was the direct cause of the following exception:
|
|
||||||
|
|
||||||
Traceback (most recent call last):
|
|
||||||
File ".\db_logic\db_base.py", line 68, in insert
|
|
||||||
self.session.commit()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 1451, in commit
|
|
||||||
self._transaction.commit(_to_root=self.future)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 829, in commit
|
|
||||||
self._prepare_impl()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 808, in _prepare_impl
|
|
||||||
self.session.flush()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 3383, in flush
|
|
||||||
self._flush(objects)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 3523, in _flush
|
|
||||||
transaction.rollback(_capture_exception=True)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\util\langhelpers.py", line 70, in __exit__
|
|
||||||
compat.raise_(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\util\compat.py", line 208, in raise_
|
|
||||||
raise exception
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 3483, in _flush
|
|
||||||
flush_context.execute()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 456, in execute
|
|
||||||
rec.execute(self)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 630, in execute
|
|
||||||
util.preloaded.orm_persistence.save_obj(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\persistence.py", line 245, in save_obj
|
|
||||||
_emit_insert_statements(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\persistence.py", line 1238, in _emit_insert_statements
|
|
||||||
result = connection._execute_20(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1631, in _execute_20
|
|
||||||
return meth(self, args_10style, kwargs_10style, execution_options)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\sql\elements.py", line 332, in _execute_on_connection
|
|
||||||
return connection._execute_clauseelement(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1498, in _execute_clauseelement
|
|
||||||
ret = self._execute_context(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1862, in _execute_context
|
|
||||||
self._handle_dbapi_exception(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 2043, in _handle_dbapi_exception
|
|
||||||
util.raise_(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\util\compat.py", line 208, in raise_
|
|
||||||
raise exception
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1819, in _execute_context
|
|
||||||
self.dialect.do_execute(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\default.py", line 732, in do_execute
|
|
||||||
cursor.execute(statement, parameters)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\cursors.py", line 148, in execute
|
|
||||||
result = self._query(query)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\cursors.py", line 310, in _query
|
|
||||||
conn.query(q)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 548, in query
|
|
||||||
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 775, in _read_query_result
|
|
||||||
result.read()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 1156, in read
|
|
||||||
first_packet = self.connection._read_packet()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 725, in _read_packet
|
|
||||||
packet.raise_for_error()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\protocol.py", line 221, in raise_for_error
|
|
||||||
err.raise_mysql_exception(self._data)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\err.py", line 143, in raise_mysql_exception
|
|
||||||
raise errorclass(errno, errval)
|
|
||||||
sqlalchemy.exc.DataError: (pymysql.err.DataError) (1265, "Data truncated for column 'temperature' at row 1")
|
|
||||||
[SQL: INSERT INTO rms_humiture_record (device_id, client_id, client_name, customer_id, temperature, humidity, record_date, is_add) VALUES (%(device_id)s, %(client_id)s, %(client_name)s, %(customer_id)s, %(temperature)s, %(humidity)s, %(record_date)s, %(is_add)s)]
|
|
||||||
[parameters: {'device_id': '', 'client_id': '', 'client_name': '', 'customer_id': '', 'temperature': '', 'humidity': '', 'record_date': '', 'is_add': 1}]
|
|
||||||
(Background on this error at: https://sqlalche.me/e/14/9h9h)
|
|
||||||
|
|
||||||
[2022-07-18 17:38:46,709] log_utlis.py->debug line:52 [DEBUG]Traceback (most recent call last):
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1819, in _execute_context
|
|
||||||
self.dialect.do_execute(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\default.py", line 732, in do_execute
|
|
||||||
cursor.execute(statement, parameters)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\cursors.py", line 148, in execute
|
|
||||||
result = self._query(query)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\cursors.py", line 310, in _query
|
|
||||||
conn.query(q)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 548, in query
|
|
||||||
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 775, in _read_query_result
|
|
||||||
result.read()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 1156, in read
|
|
||||||
first_packet = self.connection._read_packet()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 725, in _read_packet
|
|
||||||
packet.raise_for_error()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\protocol.py", line 221, in raise_for_error
|
|
||||||
err.raise_mysql_exception(self._data)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\err.py", line 143, in raise_mysql_exception
|
|
||||||
raise errorclass(errno, errval)
|
|
||||||
pymysql.err.DataError: (1265, "Data truncated for column 'temperature' at row 1")
|
|
||||||
|
|
||||||
The above exception was the direct cause of the following exception:
|
|
||||||
|
|
||||||
Traceback (most recent call last):
|
|
||||||
File ".\db_logic\db_base.py", line 68, in insert
|
|
||||||
self.session.commit()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 1451, in commit
|
|
||||||
self._transaction.commit(_to_root=self.future)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 829, in commit
|
|
||||||
self._prepare_impl()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 808, in _prepare_impl
|
|
||||||
self.session.flush()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 3383, in flush
|
|
||||||
self._flush(objects)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 3523, in _flush
|
|
||||||
transaction.rollback(_capture_exception=True)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\util\langhelpers.py", line 70, in __exit__
|
|
||||||
compat.raise_(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\util\compat.py", line 208, in raise_
|
|
||||||
raise exception
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 3483, in _flush
|
|
||||||
flush_context.execute()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 456, in execute
|
|
||||||
rec.execute(self)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 630, in execute
|
|
||||||
util.preloaded.orm_persistence.save_obj(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\persistence.py", line 245, in save_obj
|
|
||||||
_emit_insert_statements(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\persistence.py", line 1238, in _emit_insert_statements
|
|
||||||
result = connection._execute_20(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1631, in _execute_20
|
|
||||||
return meth(self, args_10style, kwargs_10style, execution_options)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\sql\elements.py", line 332, in _execute_on_connection
|
|
||||||
return connection._execute_clauseelement(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1498, in _execute_clauseelement
|
|
||||||
ret = self._execute_context(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1862, in _execute_context
|
|
||||||
self._handle_dbapi_exception(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 2043, in _handle_dbapi_exception
|
|
||||||
util.raise_(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\util\compat.py", line 208, in raise_
|
|
||||||
raise exception
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1819, in _execute_context
|
|
||||||
self.dialect.do_execute(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\default.py", line 732, in do_execute
|
|
||||||
cursor.execute(statement, parameters)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\cursors.py", line 148, in execute
|
|
||||||
result = self._query(query)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\cursors.py", line 310, in _query
|
|
||||||
conn.query(q)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 548, in query
|
|
||||||
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 775, in _read_query_result
|
|
||||||
result.read()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 1156, in read
|
|
||||||
first_packet = self.connection._read_packet()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 725, in _read_packet
|
|
||||||
packet.raise_for_error()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\protocol.py", line 221, in raise_for_error
|
|
||||||
err.raise_mysql_exception(self._data)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\err.py", line 143, in raise_mysql_exception
|
|
||||||
raise errorclass(errno, errval)
|
|
||||||
sqlalchemy.exc.DataError: (pymysql.err.DataError) (1265, "Data truncated for column 'temperature' at row 1")
|
|
||||||
[SQL: INSERT INTO rms_humiture_record (record_id, device_id, client_id, client_name, customer_id, temperature, humidity, record_date, is_add) VALUES (%(record_id)s, %(device_id)s, %(client_id)s, %(client_name)s, %(customer_id)s, %(temperature)s, %(humidity)s, %(record_date)s, %(is_add)s)]
|
|
||||||
[parameters: {'record_id': '6bc0c3f0-067d-11ed-83be-f47b094925e1', 'device_id': '', 'client_id': '', 'client_name': '', 'customer_id': '', 'temperature': '', 'humidity': '', 'record_date': '', 'is_add': 1}]
|
|
||||||
(Background on this error at: https://sqlalche.me/e/14/9h9h)
|
|
||||||
|
|
||||||
[2022-07-18 17:40:56,208] log_utlis.py->debug line:52 [DEBUG]Traceback (most recent call last):
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1819, in _execute_context
|
|
||||||
self.dialect.do_execute(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\default.py", line 732, in do_execute
|
|
||||||
cursor.execute(statement, parameters)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\cursors.py", line 148, in execute
|
|
||||||
result = self._query(query)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\cursors.py", line 310, in _query
|
|
||||||
conn.query(q)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 548, in query
|
|
||||||
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 775, in _read_query_result
|
|
||||||
result.read()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 1156, in read
|
|
||||||
first_packet = self.connection._read_packet()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 725, in _read_packet
|
|
||||||
packet.raise_for_error()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\protocol.py", line 221, in raise_for_error
|
|
||||||
err.raise_mysql_exception(self._data)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\err.py", line 143, in raise_mysql_exception
|
|
||||||
raise errorclass(errno, errval)
|
|
||||||
pymysql.err.DataError: (1265, "Data truncated for column 'humidity' at row 1")
|
|
||||||
|
|
||||||
The above exception was the direct cause of the following exception:
|
|
||||||
|
|
||||||
Traceback (most recent call last):
|
|
||||||
File ".\db_logic\db_base.py", line 68, in insert
|
|
||||||
self.session.commit()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 1451, in commit
|
|
||||||
self._transaction.commit(_to_root=self.future)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 829, in commit
|
|
||||||
self._prepare_impl()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 808, in _prepare_impl
|
|
||||||
self.session.flush()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 3383, in flush
|
|
||||||
self._flush(objects)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 3523, in _flush
|
|
||||||
transaction.rollback(_capture_exception=True)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\util\langhelpers.py", line 70, in __exit__
|
|
||||||
compat.raise_(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\util\compat.py", line 208, in raise_
|
|
||||||
raise exception
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\session.py", line 3483, in _flush
|
|
||||||
flush_context.execute()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 456, in execute
|
|
||||||
rec.execute(self)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\unitofwork.py", line 630, in execute
|
|
||||||
util.preloaded.orm_persistence.save_obj(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\persistence.py", line 245, in save_obj
|
|
||||||
_emit_insert_statements(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\orm\persistence.py", line 1238, in _emit_insert_statements
|
|
||||||
result = connection._execute_20(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1631, in _execute_20
|
|
||||||
return meth(self, args_10style, kwargs_10style, execution_options)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\sql\elements.py", line 332, in _execute_on_connection
|
|
||||||
return connection._execute_clauseelement(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1498, in _execute_clauseelement
|
|
||||||
ret = self._execute_context(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1862, in _execute_context
|
|
||||||
self._handle_dbapi_exception(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 2043, in _handle_dbapi_exception
|
|
||||||
util.raise_(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\util\compat.py", line 208, in raise_
|
|
||||||
raise exception
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\base.py", line 1819, in _execute_context
|
|
||||||
self.dialect.do_execute(
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\sqlalchemy\engine\default.py", line 732, in do_execute
|
|
||||||
cursor.execute(statement, parameters)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\cursors.py", line 148, in execute
|
|
||||||
result = self._query(query)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\cursors.py", line 310, in _query
|
|
||||||
conn.query(q)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 548, in query
|
|
||||||
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 775, in _read_query_result
|
|
||||||
result.read()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 1156, in read
|
|
||||||
first_packet = self.connection._read_packet()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\connections.py", line 725, in _read_packet
|
|
||||||
packet.raise_for_error()
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\protocol.py", line 221, in raise_for_error
|
|
||||||
err.raise_mysql_exception(self._data)
|
|
||||||
File "C:\local_project\YY_RMS_Multiple_Manage\venv\lib\site-packages\pymysql\err.py", line 143, in raise_mysql_exception
|
|
||||||
raise errorclass(errno, errval)
|
|
||||||
sqlalchemy.exc.DataError: (pymysql.err.DataError) (1265, "Data truncated for column 'humidity' at row 1")
|
|
||||||
[SQL: INSERT INTO rms_humiture_record (record_id, device_id, client_id, client_name, customer_id, temperature, humidity, record_date, is_add) VALUES (%(record_id)s, %(device_id)s, %(client_id)s, %(client_name)s, %(customer_id)s, %(temperature)s, %(humidity)s, %(record_date)s, %(is_add)s)]
|
|
||||||
[parameters: {'record_id': 'b8ed0b2c-067d-11ed-ba8f-f47b094925e1', 'device_id': '', 'client_id': '', 'client_name': '', 'customer_id': '', 'temperature': '0.2', 'humidity': '', 'record_date': '', 'is_add': 1}]
|
|
||||||
(Background on this error at: https://sqlalche.me/e/14/9h9h)
|
|
||||||
|
|
Loading…
Reference in new issue