feat: テーブル上書きコピー画面の実装
This commit is contained in:
parent
08da78a96b
commit
3d9ffc6689
@ -359,7 +359,7 @@ def table_override_view(
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail=constants.LOGOUT_REASON_BACKUP_PROCESSING)
|
||||
|
||||
# 画面表示用のモデル
|
||||
view_model = TableOverrideViewModel()
|
||||
table_override = TableOverrideViewModel()
|
||||
# セッション書き換え
|
||||
session.update(
|
||||
actions=[
|
||||
@ -372,7 +372,49 @@ def table_override_view(
|
||||
'tableOverride.html',
|
||||
{
|
||||
'request': request,
|
||||
'view': view_model
|
||||
'table_override': table_override
|
||||
},
|
||||
headers={'session_key': session.session_key}
|
||||
)
|
||||
return templates_response
|
||||
|
||||
|
||||
@router.post('/tableOverride', response_class=HTMLResponse)
|
||||
def table_override_result_view(
|
||||
request: Request,
|
||||
master_mainte_service: MasterMainteService = Depends(get_service(MasterMainteService)),
|
||||
batch_status_service: BatchStatusService = Depends(get_service(BatchStatusService))
|
||||
):
|
||||
session: UserSession = request.session
|
||||
|
||||
# マスタメンテメニューへのアクセス権がない場合、ログアウトさせる
|
||||
if session.master_mainte_flg != '1':
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN)
|
||||
|
||||
# バッチ処理中の場合、ログアウトさせる
|
||||
if batch_status_service.is_batch_processing():
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN,
|
||||
detail=constants.LOGOUT_REASON_BATCH_PROCESSING_FOR_MAINTE)
|
||||
# dump処理中の場合、ログアウトさせる
|
||||
if batch_status_service.is_dump_processing():
|
||||
raise HTTPException(status_code=status.HTTP_403_FORBIDDEN, detail=constants.LOGOUT_REASON_BACKUP_PROCESSING)
|
||||
|
||||
# 画面表示用のモデル
|
||||
table_override = master_mainte_service.prepare_mainte_table_override_view()
|
||||
|
||||
# セッション書き換え
|
||||
session.update(
|
||||
actions=[
|
||||
UserSession.last_access_time.set(UserSession.new_last_access_time()),
|
||||
UserSession.record_expiration_time.set(UserSession.new_record_expiration_time()),
|
||||
]
|
||||
)
|
||||
set_session(session)
|
||||
templates_response = templates.TemplateResponse(
|
||||
'tableOverride.html',
|
||||
{
|
||||
'request': request,
|
||||
'table_override': table_override
|
||||
},
|
||||
headers={'session_key': session.session_key}
|
||||
)
|
||||
|
||||
@ -216,28 +216,28 @@ class MasterMainteNewInstEmpCSVItem(MasterMainteCSVItem):
|
||||
self.end_date = self.csv_row[constants.CSV_NEW_END_DATE]
|
||||
|
||||
def csv_row_data(self) -> dict:
|
||||
return {constants.NEW_INST_EMP_CSV_MAP[i]: self.csv_row[i] for i in range(len(self.csv_row))}
|
||||
return {constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[i]: self.csv_row[i] for i in range(len(self.csv_row))}
|
||||
|
||||
def check_require(self) -> list[str]:
|
||||
error_list = []
|
||||
if len(self.inst_cd) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.NEW_INST_EMP_CSV_MAP[constants.CSV_NEW_INST_CD_COL_NO]))
|
||||
self.line_num, constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_INST_CD_COL_NO]))
|
||||
if len(self.ta_cd) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.NEW_INST_EMP_CSV_MAP[constants.CSV_NEW_TA_CD_COL_NO]))
|
||||
self.line_num, constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_TA_CD_COL_NO]))
|
||||
if len(self.emp_cd) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.NEW_INST_EMP_CSV_MAP[constants.CSV_NEW_EMP_CD_COL_NO]))
|
||||
self.line_num, constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_EMP_CD_COL_NO]))
|
||||
if len(self.bu_cd) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.NEW_INST_EMP_CSV_MAP[constants.CSV_NEW_BU_CD_COL_NO]))
|
||||
self.line_num, constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_BU_CD_COL_NO]))
|
||||
if len(self.start_date) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.NEW_INST_EMP_CSV_MAP[constants.CSV_NEW_START_DATE]))
|
||||
self.line_num, constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_START_DATE]))
|
||||
if len(self.end_date) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.NEW_INST_EMP_CSV_MAP[constants.CSV_NEW_END_DATE]))
|
||||
self.line_num, constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_END_DATE]))
|
||||
|
||||
return error_list
|
||||
|
||||
@ -246,7 +246,7 @@ class MasterMainteNewInstEmpCSVItem(MasterMainteCSVItem):
|
||||
|
||||
if super().is_exist_inst_cd() is False:
|
||||
error_list.append(
|
||||
f'{self.line_num}行目の{constants.NEW_INST_EMP_CSV_MAP[constants.CSV_NEW_INST_CD_COL_NO]}\
|
||||
f'{self.line_num}行目の{constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_INST_CD_COL_NO]}\
|
||||
は施設マスタに存在しないコードです。')
|
||||
return error_list
|
||||
|
||||
@ -256,7 +256,7 @@ class MasterMainteNewInstEmpCSVItem(MasterMainteCSVItem):
|
||||
return error_list
|
||||
|
||||
if super().is_error_emp_cd(self.start_date) is True:
|
||||
error_list.append(f'{self.line_num}行目の{constants.NEW_INST_EMP_CSV_MAP[constants.CSV_NEW_EMP_CD_COL_NO]}\
|
||||
error_list.append(f'{self.line_num}行目の{constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_EMP_CD_COL_NO]}\
|
||||
は従業員マスタに存在しない もしくは 適用期間外のIDです。')
|
||||
return error_list
|
||||
|
||||
@ -264,7 +264,7 @@ class MasterMainteNewInstEmpCSVItem(MasterMainteCSVItem):
|
||||
error_list = []
|
||||
|
||||
if super().is_exist_bu_cd() is False:
|
||||
error_list.append(f'{self.line_num}行目の{constants.NEW_INST_EMP_CSV_MAP[constants.CSV_NEW_BU_CD_COL_NO]}\
|
||||
error_list.append(f'{self.line_num}行目の{constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_BU_CD_COL_NO]}\
|
||||
はビジネスユニットマスタに存在しないコードです。')
|
||||
return error_list
|
||||
|
||||
@ -273,14 +273,14 @@ class MasterMainteNewInstEmpCSVItem(MasterMainteCSVItem):
|
||||
(error_list, start_date_time, end_date_time) = super().check_term_date(
|
||||
self.start_date,
|
||||
self.end_date,
|
||||
constants.NEW_INST_EMP_CSV_MAP[constants.CSV_NEW_START_DATE],
|
||||
constants.NEW_INST_EMP_CSV_MAP[constants.CSV_NEW_END_DATE])
|
||||
constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_START_DATE],
|
||||
constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_END_DATE])
|
||||
if len(error_list) > 0 or self.start_date is None or self.end_date is None:
|
||||
return error_list
|
||||
|
||||
if start_date_time > end_date_time:
|
||||
error_list.append(f'{self.line_num}行目の{constants.NEW_INST_EMP_CSV_MAP[constants.CSV_NEW_START_DATE]}\
|
||||
が{constants.NEW_INST_EMP_CSV_MAP[constants.CSV_NEW_END_DATE]}よりも後の日付になっています。')
|
||||
error_list.append(f'{self.line_num}行目の{constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_START_DATE]}\
|
||||
が{constants.NEW_INST_EMP_CSV_LOGICAL_NAMES[constants.CSV_NEW_END_DATE]}よりも後の日付になっています。')
|
||||
return error_list
|
||||
|
||||
def check_item_count(self) -> list[str]:
|
||||
@ -344,55 +344,60 @@ class MasterMainteChangeInstEmpCSVItem(MasterMainteCSVItem):
|
||||
self.comment = self.csv_row[constants.CSV_CHANGE_COMMENT]
|
||||
|
||||
def csv_row_data(self) -> dict:
|
||||
return {constants.CHANGE_INST_EMP_MAP[i]: self.csv_row[i] for i in range(len(self.csv_row))}
|
||||
return {constants.CHANGE_INST_CSV_LOGICAL_NAMES[i]: self.csv_row[i] for i in range(len(self.csv_row))}
|
||||
|
||||
def check_require(self) -> list[str]:
|
||||
error_list = []
|
||||
if self.comment == '追加':
|
||||
if len(self.bu_cd) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_BU_CD_COL_NO]))
|
||||
self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_BU_CD_COL_NO]))
|
||||
if len(self.inst_cd) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_INST_CD_COL_NO]))
|
||||
self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_INST_CD_COL_NO]))
|
||||
if len(self.ta_cd) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_TA_CD_COL_NO]))
|
||||
self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_TA_CD_COL_NO]))
|
||||
if len(self.emp_cd) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_EMP_CD_COL_NO]))
|
||||
self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_EMP_CD_COL_NO]))
|
||||
if len(self.inst_emp_start_date) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_INST_EMP_START_DATE_COL_NO]))
|
||||
self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[
|
||||
constants.CSV_CHANGE_INST_EMP_START_DATE_COL_NO]))
|
||||
if len(self.inst_emp_end_date) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_INST_EMP_END_DATE_COL_NO]))
|
||||
self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[
|
||||
constants.CSV_CHANGE_INST_EMP_END_DATE_COL_NO]))
|
||||
elif self.comment == '終了':
|
||||
if len(self.inst_cd) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_INST_CD_COL_NO]))
|
||||
self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_INST_CD_COL_NO]))
|
||||
if len(self.ta_cd) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_TA_CD_COL_NO]))
|
||||
self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_TA_CD_COL_NO]))
|
||||
if len(self.inst_emp_start_date) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_INST_EMP_START_DATE_COL_NO]))
|
||||
self.line_num,
|
||||
constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_INST_EMP_START_DATE_COL_NO]))
|
||||
if len(self.change_end_date) == 0:
|
||||
error_list.append(self.make_require_error_message(self.line_num, constants.CHANGE_INST_EMP_MAP[
|
||||
constants.CSV_CHANGE_INST_EMP_END_DATE_COL_NO]))
|
||||
error_list.append(self.make_require_error_message(self.line_num,
|
||||
constants.CHANGE_INST_CSV_LOGICAL_NAMES[
|
||||
constants.CSV_CHANGE_INST_EMP_END_DATE_COL_NO]))
|
||||
elif self.comment == '担当者修正':
|
||||
if len(self.inst_cd) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_INST_CD_COL_NO]))
|
||||
self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_INST_CD_COL_NO]))
|
||||
if len(self.ta_cd) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_TA_CD_COL_NO]))
|
||||
self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_TA_CD_COL_NO]))
|
||||
if len(self.emp_cd) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_EMP_CD_COL_NO]))
|
||||
self.line_num, constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_EMP_CD_COL_NO]))
|
||||
if len(self.inst_emp_start_date) == 0:
|
||||
error_list.append(self.make_require_error_message(
|
||||
self.line_num, constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_INST_EMP_START_DATE_COL_NO]))
|
||||
error_list.append(self.make_require_error_message(self.line_num,
|
||||
constants.CHANGE_INST_CSV_LOGICAL_NAMES[
|
||||
constants.CSV_CHANGE_INST_EMP_START_DATE_COL_NO]))
|
||||
else:
|
||||
error_list.append(f'{self.line_num}行目のコメントが不正です。 「追加」「終了」「担当者修正」のいずれかを入力してください。')
|
||||
return error_list
|
||||
@ -401,7 +406,7 @@ class MasterMainteChangeInstEmpCSVItem(MasterMainteCSVItem):
|
||||
error_list = []
|
||||
|
||||
if super().is_exist_inst_cd() is False:
|
||||
error_list.append(f'{self.line_num}行目の{constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_INST_CD_COL_NO]}\
|
||||
error_list.append(f'{self.line_num}行目の{constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_INST_CD_COL_NO]}\
|
||||
は施設マスタに存在しないコードです。')
|
||||
return error_list
|
||||
|
||||
@ -412,7 +417,7 @@ class MasterMainteChangeInstEmpCSVItem(MasterMainteCSVItem):
|
||||
return error_list
|
||||
|
||||
if super().is_error_emp_cd(self.inst_emp_start_date) is True:
|
||||
error_list.append(f'{self.line_num}行目の{constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_EMP_CD_COL_NO]}\
|
||||
error_list.append(f'{self.line_num}行目の{constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_EMP_CD_COL_NO]}\
|
||||
は従業員マスタに存在しない もしくは 適用期間外のIDです。')
|
||||
return error_list
|
||||
|
||||
@ -422,7 +427,7 @@ class MasterMainteChangeInstEmpCSVItem(MasterMainteCSVItem):
|
||||
|
||||
if super().is_exist_bu_cd() is False:
|
||||
|
||||
error_list.append(f'{self.line_num}行目の{constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_BU_CD_COL_NO]}\
|
||||
error_list.append(f'{self.line_num}行目の{constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_BU_CD_COL_NO]}\
|
||||
はビジネスユニットマスタに存在しないコードです。')
|
||||
return error_list
|
||||
|
||||
@ -432,19 +437,22 @@ class MasterMainteChangeInstEmpCSVItem(MasterMainteCSVItem):
|
||||
if self.comment == '追加' or self.comment == '終了':
|
||||
if self.comment == '追加':
|
||||
end_date = self.inst_emp_end_date
|
||||
end_date_col_name = constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_INST_EMP_END_DATE_COL_NO]
|
||||
end_date_col_name = constants.CHANGE_INST_CSV_LOGICAL_NAMES[
|
||||
constants.CSV_CHANGE_INST_EMP_END_DATE_COL_NO]
|
||||
compare_error_message = f'\
|
||||
{constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_INST_EMP_START_DATE_COL_NO]}が{end_date_col_name}よりも後の日付になっています。'
|
||||
{constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_INST_EMP_START_DATE_COL_NO]}が\
|
||||
{end_date_col_name}よりも後の日付になっています。'
|
||||
else:
|
||||
end_date = self.change_end_date
|
||||
end_date_col_name = constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_CHANGE_END_DATE_COL_NO]
|
||||
end_date_col_name = constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_CHANGE_END_DATE_COL_NO]
|
||||
compare_error_message = f'\
|
||||
{constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_INST_EMP_START_DATE_COL_NO]}が{end_date_col_name}よりも後の日付になっています。'
|
||||
{constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_INST_EMP_START_DATE_COL_NO]}が\
|
||||
{end_date_col_name}よりも後の日付になっています。'
|
||||
|
||||
(error_list, start_date_time, end_date_time) = super().check_term_date(
|
||||
start_date,
|
||||
end_date,
|
||||
constants.CHANGE_INST_EMP_MAP[constants.CSV_CHANGE_INST_EMP_START_DATE_COL_NO],
|
||||
constants.CHANGE_INST_CSV_LOGICAL_NAMES[constants.CSV_CHANGE_INST_EMP_START_DATE_COL_NO],
|
||||
end_date_col_name)
|
||||
if len(error_list) > 0 or start_date is None or end_date is None:
|
||||
return error_list
|
||||
|
||||
@ -42,9 +42,9 @@ class InstEmpCsvUploadViewModel(BaseModel):
|
||||
|
||||
def __inst_emp_columns(self) -> list[str]:
|
||||
if self.select_function == 'new':
|
||||
return constants.NEW_INST_EMP_CSV_MAP
|
||||
return constants.NEW_INST_EMP_CSV_LOGICAL_NAMES
|
||||
if self.select_function == 'change':
|
||||
return constants.CHANGE_INST_EMP_MAP
|
||||
return constants.CHANGE_INST_CSV_LOGICAL_NAMES
|
||||
return []
|
||||
|
||||
def __real_table(self):
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
from pydantic import BaseModel
|
||||
from typing import Optional
|
||||
|
||||
|
||||
class TableOverrideViewModel(BaseModel):
|
||||
subtitle: str = 'テーブル上書きコピー'
|
||||
|
||||
is_override: Optional[bool] = False
|
||||
|
||||
@ -280,3 +280,23 @@ class EmpChgInstRepository(BaseRepository):
|
||||
where_clauses_str = ' AND '.join([condition.apply() for condition in where_clauses])
|
||||
logger.debug(f'条件設定終了:{where_clauses_str}')
|
||||
return where_clauses_str
|
||||
|
||||
DELETE_SQL = "DELETE FROM emp_chg_inst_wrk"
|
||||
|
||||
def delete_dummy_table(self):
|
||||
try:
|
||||
query = self.DELETE_SQL
|
||||
self._database.execute(query)
|
||||
except Exception as e:
|
||||
logger.exception(f"DB Error : Exception={e.args}")
|
||||
raise e
|
||||
|
||||
COPY_TABLE_SQL = "INSERT INTO emp_chg_inst_wrk SELECT * FROM emp_chg_inst"
|
||||
|
||||
def copy_real_to_dummy(self):
|
||||
try:
|
||||
query = self.COPY_TABLE_SQL
|
||||
self._database.execute(query)
|
||||
except Exception as e:
|
||||
logger.exception(f"DB Error : Exception={e.args}")
|
||||
raise e
|
||||
|
||||
@ -7,22 +7,24 @@ import pandas as pd
|
||||
from io import TextIOWrapper
|
||||
from src.aws.aws_api_client import AWSAPIClient
|
||||
from src.aws.s3 import S3Client
|
||||
from src.repositories.base_repository import BaseRepository
|
||||
from src.services.base_service import BaseService
|
||||
from src.model.internal.master_mainte_csv import MasterMainteCSVItems
|
||||
from src.model.internal.master_mainte_emp_chg import MasterMainteNewEmpChg
|
||||
from src.model.internal.master_mainte_emp_chg import MasterMainteChangeEmpChg
|
||||
from src.model.view.inst_emp_csv_upload_view_model import InstEmpCsvUploadViewModel
|
||||
from src.model.request.master_mainte_csvup import MasterMainteCsvUpModel
|
||||
from src.model.request.master_mainte_csvdl import MasterMainteCsvDlModel
|
||||
from src.logging.get_logger import get_logger
|
||||
from src.model.view.mainte_csv_upload_model import CsvUploadModel
|
||||
from src.model.view.mainte_csv_error_model import CsvErrorModel
|
||||
from src.system_var import constants, environment
|
||||
from src.repositories.base_repository import BaseRepository
|
||||
from src.repositories.mst_inst_repository import MstInstRepository
|
||||
from src.repositories.bu_master_cd_repository import BuMasterRepository
|
||||
from src.repositories.emp_master_repository import EmpMasterRepository
|
||||
from src.repositories.emp_chg_inst_repository import EmpChgInstRepository
|
||||
from src.system_var import constants, environment
|
||||
from src.model.internal.master_mainte_csv import MasterMainteCSVItems
|
||||
from src.model.internal.master_mainte_emp_chg import MasterMainteNewEmpChg
|
||||
from src.model.internal.master_mainte_emp_chg import MasterMainteChangeEmpChg
|
||||
from src.model.view.inst_emp_csv_upload_view_model import InstEmpCsvUploadViewModel
|
||||
from src.model.view.table_override_view_model import TableOverrideViewModel
|
||||
from src.model.view.mainte_csv_upload_model import CsvUploadModel
|
||||
from src.model.view.mainte_csv_error_model import CsvErrorModel
|
||||
from src.model.request.master_mainte_csvup import MasterMainteCsvUpModel
|
||||
from src.model.request.master_mainte_csvdl import MasterMainteCsvDlModel
|
||||
from src.logging.get_logger import get_logger
|
||||
|
||||
|
||||
logger = get_logger('マスターメンテ')
|
||||
|
||||
@ -137,6 +139,24 @@ class MasterMainteService(BaseService):
|
||||
)
|
||||
return mainte_csv_up
|
||||
|
||||
def prepare_mainte_table_override_view(self) -> TableOverrideViewModel:
|
||||
try:
|
||||
self.emp_chginst_repository.connect()
|
||||
self.emp_chginst_repository.begin()
|
||||
self.emp_chginst_repository.delete_dummy_table()
|
||||
self.emp_chginst_repository.copy_real_to_dummy()
|
||||
self.emp_chginst_repository.commit()
|
||||
except Exception as e:
|
||||
self.emp_chginst_repository.rollback()
|
||||
raise e
|
||||
finally:
|
||||
self.emp_chginst_repository.disconnect()
|
||||
|
||||
table_override = TableOverrideViewModel(
|
||||
is_override=True
|
||||
)
|
||||
return table_override
|
||||
|
||||
def search_download_emp_chg_inst_data(self, csv_download_form: MasterMainteCsvDlModel):
|
||||
(table_name, _) = self.__target_table(csv_download_form.select_table)
|
||||
search_result_df, query = self.emp_chginst_repository.fetch_as_data_frame(table_name, csv_download_form)
|
||||
|
||||
@ -133,7 +133,8 @@ LOGOUT_REASON_MESSAGE_MAP = {
|
||||
LOGOUT_REASON_UNEXPECTED: '予期しないエラーが発生しました。<br>再度Loginするか、<br>管理者に問い合わせてください。'
|
||||
}
|
||||
|
||||
NEW_INST_EMP_CSV_MAP = [
|
||||
# 新規施設担当者登録CSV(マスターメンテ)
|
||||
NEW_INST_EMP_CSV_LOGICAL_NAMES = [
|
||||
'施設コード',
|
||||
'施設名',
|
||||
'領域コード',
|
||||
@ -144,25 +145,6 @@ NEW_INST_EMP_CSV_MAP = [
|
||||
'適用開始日',
|
||||
'適用終了日'
|
||||
]
|
||||
|
||||
CHANGE_INST_EMP_MAP = [
|
||||
'ビジネスユニットコード',
|
||||
'ビジネスユニット名',
|
||||
'組織コード',
|
||||
'組織名略称',
|
||||
'施設コード',
|
||||
'施設名',
|
||||
'領域コード',
|
||||
'説明',
|
||||
'MUID',
|
||||
'担当者名',
|
||||
'施設担当_開始日',
|
||||
'施設担当_終了日',
|
||||
'終了日の変更',
|
||||
'コメント'
|
||||
]
|
||||
|
||||
# 新規施設担当者登録CSV(マスターメンテ)
|
||||
# 施設コードの列No
|
||||
CSV_NEW_INST_CD_COL_NO = 0
|
||||
# 施設名の列No
|
||||
@ -183,6 +165,22 @@ CSV_NEW_START_DATE = 7
|
||||
CSV_NEW_END_DATE = 8
|
||||
|
||||
# 施設担当者変更登録CSV(マスターメンテ)
|
||||
CHANGE_INST_CSV_LOGICAL_NAMES = [
|
||||
'ビジネスユニットコード',
|
||||
'ビジネスユニット名',
|
||||
'組織コード',
|
||||
'組織名略称',
|
||||
'施設コード',
|
||||
'施設名',
|
||||
'領域コード',
|
||||
'説明',
|
||||
'MUID',
|
||||
'担当者名',
|
||||
'施設担当_開始日',
|
||||
'施設担当_終了日',
|
||||
'終了日の変更',
|
||||
'コメント'
|
||||
]
|
||||
# ビジネスユニットコードの列No
|
||||
CSV_CHANGE_BU_CD_COL_NO = 0
|
||||
# ビジネスユニット名の列No
|
||||
|
||||
@ -1,17 +1,15 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="ja">
|
||||
<head>
|
||||
{% with subtitle = view.subtitle %}
|
||||
{% with subtitle = table_override.subtitle %}
|
||||
{% include '_header.html' %}
|
||||
{% endwith %}
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<link href="/static/css/masterMainte.css" rel="stylesheet" />
|
||||
<title><!-- <?php echo $tableOverride; ?> --></title>
|
||||
<!-- <link rel="stylesheet" type="text/css" href="<?php echo $masterMainteCSSPath ?>">
|
||||
<script type="text/javascript" src="<?php echo $jqueryJsPath ?>"></script>
|
||||
<script type="text/javascript" src="<?php echo $masterMainteJsPath ?>"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function Form_Submit_Disp_Dialog(){
|
||||
var msg = <?php echo $tableOverRideMsg;?>;
|
||||
var msg = "ダミー従業員担当施設マスタのデータがすべて上書きされます。よろしいですか?"
|
||||
if (confirmDialog(msg)) {
|
||||
document.getElementById("loading").style.display = "block";
|
||||
document.getElementById("overRided").style.display = "none";
|
||||
@ -19,17 +17,15 @@
|
||||
return false;
|
||||
}
|
||||
}
|
||||
</script> -->
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<h1>テーブル上書きコピー</h1>
|
||||
|
||||
<!-- タイトルと上部ボタン -->
|
||||
<h1>
|
||||
<table class="headerTable">
|
||||
<tr>
|
||||
<td class="headerTdLeft"><!-- <?php echo $tableOverride; ?> --></td>
|
||||
<td class="headerTdRight"><button class="buttonSize" onclick="backToMainteMenu()">メニューへ</button></td>
|
||||
<td class="headerTdLeft">テーブル上書きコピー</td>
|
||||
<td class="headerTdRight"><input type="button" name="back" value="メニューへ" onclick="backToMainteMenu()"></td>
|
||||
</tr>
|
||||
</table>
|
||||
</h1>
|
||||
@ -38,35 +34,28 @@
|
||||
<tr>
|
||||
<td>
|
||||
<label>
|
||||
<!-- <input type="radio" name="selectTable" value="empChgInstRealToDummy" <?php echo "checked";?> >
|
||||
<?php echo $empChgInstRealToDummyMsg ?> -->
|
||||
<input type="radio" name="selectTable" value="empChgInstRealToDummy" checked >
|
||||
本番 従業員担当施設マスタ ⇒ ダミー 従業員担当施設マスタ
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<!-- <form name="overRide" action="<?php echo $tableOveerridePath ?>" method="POST" onsubmit="return Form_Submit_Disp_Dialog();">
|
||||
<input type="hidden" name="btName" value="overRide_bt" >
|
||||
<form name="overRide" action="/masterMainte/tableOverride" method="POST" onsubmit="return Form_Submit_Disp_Dialog();">
|
||||
<input type="submit" name="overRide_bt" class="buttonSize" value="データ上書" >
|
||||
</form> -->
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!--
|
||||
<?php
|
||||
if ($_POST['btName'] == 'overRide_bt') {
|
||||
// データ上書きボタン押下時
|
||||
echo '<p><div id="overRided" class="csvOutputMessage">'.$tableOverrideMsg . '</div></p>';
|
||||
}
|
||||
?> -->
|
||||
{% if table_override.is_override %}
|
||||
<p>
|
||||
<div id="overRided" class="csvOutputMessage">ダミー従業員担当施設マスタのデータを本番従業員担当施設マスタのデータで上書きしました</div>
|
||||
</p>
|
||||
{% endif %}
|
||||
<div id="loading" class="csvOutputMessage" style="display:none;">
|
||||
<!-- <img src="IMG/LOADING.GIF" class="loadimg"> -->
|
||||
<p>データ上書き中...<br>しばらくお待ち下さい。</p>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user