feat: 実消化&アルトマーク アルトマーク照会画面で、DB関連のエラーが発生の対応
This commit is contained in:
parent
cef42f64b8
commit
4d27d8fea1
@ -29,7 +29,6 @@ class MasterMainteEmpChgInstFunction(metaclass=ABCMeta):
|
||||
def save(self):
|
||||
error_list = []
|
||||
try:
|
||||
self.emp_chginst_repository.connect()
|
||||
self.emp_chginst_repository.to_jst()
|
||||
self.emp_chginst_repository.begin()
|
||||
(result_message, error_list) = self.write_emp_chg_inst_table()
|
||||
@ -40,8 +39,6 @@ class MasterMainteEmpChgInstFunction(metaclass=ABCMeta):
|
||||
except Exception as e:
|
||||
self.emp_chginst_repository.rollback()
|
||||
raise e
|
||||
finally:
|
||||
self.emp_chginst_repository.disconnect()
|
||||
|
||||
return (result_message, error_list)
|
||||
|
||||
|
||||
@ -65,7 +65,6 @@ class BioSalesLotRepository(BaseRepository):
|
||||
|
||||
def fetch_many(self, parameter: BioModel) -> list[BioSalesLotDBModel]:
|
||||
try:
|
||||
self._database.connect()
|
||||
logger.debug('DB参照実行')
|
||||
where_clause = self.__build_condition(parameter)
|
||||
# システムとしての最大取得件数 +1 まで取る
|
||||
@ -78,12 +77,9 @@ class BioSalesLotRepository(BaseRepository):
|
||||
except Exception as e:
|
||||
logger.exception(f"DB Error : Exception={e.args}")
|
||||
raise e
|
||||
finally:
|
||||
self._database.disconnect()
|
||||
|
||||
def fetch_as_data_frame(self, parameter: BioModel, limitation: int):
|
||||
try:
|
||||
self._database.connect()
|
||||
logger.debug('DB参照実行')
|
||||
where_clause = self.__build_condition(parameter)
|
||||
query = self.FETCH_SQL.format(where_clause=where_clause, limit=limitation)
|
||||
@ -95,8 +91,6 @@ class BioSalesLotRepository(BaseRepository):
|
||||
except Exception as e:
|
||||
logger.exception(f"DB Error : Exception={e.args}")
|
||||
raise e
|
||||
finally:
|
||||
self._database.disconnect()
|
||||
|
||||
def __build_condition(self, parameter: BioModel):
|
||||
where_clauses: list[SQLCondition] = []
|
||||
|
||||
@ -18,7 +18,6 @@ class BuMasterRepository(BaseRepository):
|
||||
|
||||
def fetch_count(self, bu_cd) -> MasterMenteCountModel:
|
||||
try:
|
||||
self._database.connect()
|
||||
query = self.FETCH_COUNT_SQL
|
||||
result = self._database.execute_select(query, {'bu_cd': bu_cd})
|
||||
models = [MasterMenteCountModel(**r) for r in result]
|
||||
@ -28,5 +27,3 @@ class BuMasterRepository(BaseRepository):
|
||||
except Exception as e:
|
||||
logger.exception(f"DB Error : Exception={e.args}")
|
||||
raise e
|
||||
finally:
|
||||
self._database.disconnect()
|
||||
|
||||
@ -11,9 +11,6 @@ logger = get_logger('従業員担当施設マスタ')
|
||||
|
||||
class EmpChgInstRepository(BaseRepository):
|
||||
|
||||
def connect(self):
|
||||
self._database.connect()
|
||||
|
||||
def to_jst(self):
|
||||
self._database.to_jst()
|
||||
|
||||
@ -26,9 +23,6 @@ class EmpChgInstRepository(BaseRepository):
|
||||
def rollback(self):
|
||||
self._database.rollback()
|
||||
|
||||
def disconnect(self):
|
||||
self._database.disconnect()
|
||||
|
||||
INSERT_SQL = """\
|
||||
INSERT INTO {table_name}
|
||||
(
|
||||
@ -147,7 +141,6 @@ class EmpChgInstRepository(BaseRepository):
|
||||
|
||||
def fetch_count(self, inst_cd, ta_cd, start_date, table_name) -> MasterMenteCountModel:
|
||||
try:
|
||||
self._database.connect()
|
||||
query = self.FETCH_COUNT_SQL.format(table_name=table_name)
|
||||
result = self._database.execute_select(query, {'inst_cd': inst_cd, 'ta_cd': ta_cd,
|
||||
'start_date': start_date})
|
||||
@ -158,8 +151,6 @@ class EmpChgInstRepository(BaseRepository):
|
||||
except Exception as e:
|
||||
logger.exception(f'DB Error : Exception={e.args}')
|
||||
raise e
|
||||
finally:
|
||||
self._database.disconnect()
|
||||
|
||||
FETCH_SQL = """\
|
||||
SELECT DISTINCT
|
||||
@ -190,7 +181,6 @@ class EmpChgInstRepository(BaseRepository):
|
||||
|
||||
def fetch_as_data_frame(self, table_name: str, parameter: MasterMainteCsvDlModel):
|
||||
try:
|
||||
self._database.connect()
|
||||
where_clause = self.__build_condition(parameter)
|
||||
query = self.FETCH_SQL.format(table_name=table_name, where_clause=where_clause)
|
||||
logger.debug(f'SQL: {query}')
|
||||
@ -200,8 +190,6 @@ class EmpChgInstRepository(BaseRepository):
|
||||
except Exception as e:
|
||||
logger.exception(f'DB Error : Exception={e.args}')
|
||||
raise e
|
||||
finally:
|
||||
self._database.disconnect()
|
||||
|
||||
def __build_condition(self, parameter: MasterMainteCsvDlModel):
|
||||
where_clauses: list[SQLCondition] = []
|
||||
|
||||
@ -20,7 +20,6 @@ class EmpMasterRepository(BaseRepository):
|
||||
|
||||
def fetch_count(self, emp_cd, start_work_date) -> MasterMenteCountModel:
|
||||
try:
|
||||
self._database.connect()
|
||||
query = self.FETCH_COUNT_SQL
|
||||
result = self._database.execute_select(query, {'emp_cd': emp_cd, 'start_work_date': start_work_date})
|
||||
models = [MasterMenteCountModel(**r) for r in result]
|
||||
@ -30,5 +29,3 @@ class EmpMasterRepository(BaseRepository):
|
||||
except Exception as e:
|
||||
logger.exception(f"DB Error : Exception={e.args}")
|
||||
raise e
|
||||
finally:
|
||||
self._database.disconnect()
|
||||
|
||||
@ -10,7 +10,6 @@ class HdkeTblRepository(BaseRepository):
|
||||
|
||||
def fetch_all(self) -> list[HdkeTblModel]:
|
||||
try:
|
||||
self._database.connect()
|
||||
query = self.FETCH_SQL
|
||||
result = self._database.execute_select(query)
|
||||
models = [HdkeTblModel(**r) for r in result]
|
||||
@ -18,5 +17,3 @@ class HdkeTblRepository(BaseRepository):
|
||||
except Exception as e:
|
||||
logger.exception(f"DB Error : Exception={e}")
|
||||
raise e
|
||||
finally:
|
||||
self._database.disconnect()
|
||||
|
||||
@ -18,7 +18,6 @@ class InstDivMasterRepository(BaseRepository):
|
||||
|
||||
def fetch_all(self) -> list[InstDivMasterModel]:
|
||||
try:
|
||||
self._database.connect()
|
||||
result = self._database.execute_select(self.FETCH_SQL)
|
||||
result_data = [res for res in result]
|
||||
models = [InstDivMasterModel(**r) for r in result_data]
|
||||
@ -26,5 +25,3 @@ class InstDivMasterRepository(BaseRepository):
|
||||
except Exception as e:
|
||||
logger.exception(f"DB Error : Exception={e.args}")
|
||||
raise e
|
||||
finally:
|
||||
self._database.disconnect()
|
||||
|
||||
@ -18,7 +18,6 @@ class MstInstRepository(BaseRepository):
|
||||
|
||||
def fetch_count(self, inst_cd) -> MasterMenteCountModel:
|
||||
try:
|
||||
self._database.connect()
|
||||
query = self.FETCH_COUNT_SQL
|
||||
result = self._database.execute_select(query, {'inst_cd': inst_cd})
|
||||
models = [MasterMenteCountModel(**r) for r in result]
|
||||
@ -28,5 +27,3 @@ class MstInstRepository(BaseRepository):
|
||||
except Exception as e:
|
||||
logger.exception(f"DB Error : Exception={e.args}")
|
||||
raise e
|
||||
finally:
|
||||
self._database.disconnect()
|
||||
|
||||
@ -30,12 +30,9 @@ class PharmacyProductMasterRepository(BaseRepository):
|
||||
|
||||
def fetch_all(self) -> list[PharmacyProductMasterModel]:
|
||||
try:
|
||||
self._database.connect()
|
||||
result = self._database.execute_select(self.FETCH_SQL)
|
||||
models = [PharmacyProductMasterModel(**r) for r in result]
|
||||
return models
|
||||
except Exception as e:
|
||||
logger.exception(f"DB Error : Exception={e}")
|
||||
raise e
|
||||
finally:
|
||||
self._database.disconnect()
|
||||
|
||||
@ -20,7 +20,6 @@ class PrefcMasterRepository(BaseRepository):
|
||||
|
||||
def fetch_all(self) -> list[PrefcMasterModel]:
|
||||
try:
|
||||
self._database.connect()
|
||||
result = self._database.execute_select(self.FETCH_SQL)
|
||||
result_data = [res for res in result]
|
||||
models = [PrefcMasterModel(**r) for r in result_data]
|
||||
@ -28,5 +27,3 @@ class PrefcMasterRepository(BaseRepository):
|
||||
except Exception as e:
|
||||
logger.exception(f"DB Error : Exception={e.args}")
|
||||
raise e
|
||||
finally:
|
||||
self._database.disconnect()
|
||||
|
||||
@ -148,7 +148,6 @@ class MasterMainteService(BaseService):
|
||||
|
||||
def copy_data_real_to_dummy(self) -> TableOverrideViewModel:
|
||||
try:
|
||||
self.emp_chginst_repository.connect()
|
||||
self.emp_chginst_repository.to_jst()
|
||||
self.emp_chginst_repository.begin()
|
||||
self.emp_chginst_repository.delete_dummy_table()
|
||||
@ -157,8 +156,6 @@ class MasterMainteService(BaseService):
|
||||
except Exception as e:
|
||||
self.emp_chginst_repository.rollback()
|
||||
raise e
|
||||
finally:
|
||||
self.emp_chginst_repository.disconnect()
|
||||
|
||||
# コピー完了をマークして画面に返却
|
||||
table_override = TableOverrideViewModel(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user