Revert "Revert "Merge branch 'feature-NEWDWH2021-1070' into feature-NEWDWH2021-1069""
This reverts commit 707f7f6839a1d533c5cb1c162a482fe3b9370359.
This commit is contained in:
parent
707f7f6839
commit
aa8dd9fc59
@ -60,12 +60,8 @@ async def download_bio_data(
|
||||
logger.info('検索結果が0件です')
|
||||
return {'status': 'ok', 'download_url': None}
|
||||
|
||||
# ファイルに打ち出すカラムを抽出
|
||||
# TODO: SQLクエリを修正するため、この処理は不要になる
|
||||
extract_df = _extract_output_df(search_result_df)
|
||||
|
||||
# ファイルを書き出し(Excel or CSV)
|
||||
local_file_path = _write_bio_data_to_file(bio_service, download_param, extract_df, download_file_name)
|
||||
local_file_path = _write_bio_data_to_file(bio_service, download_param, search_result_df, download_file_name)
|
||||
|
||||
# ローカルファイルからS3にアップロードし、ダウンロード用URLを取得する
|
||||
try:
|
||||
@ -116,27 +112,6 @@ def _search_bio_data(bio_service: BioViewService, search_param: BioModel, user_i
|
||||
return search_result_df, query
|
||||
|
||||
|
||||
def _extract_output_df(search_result_df: pd.DataFrame) -> pd.DataFrame:
|
||||
extract_df = search_result_df[constants.BIO_EXTRACT_COLUMNS]
|
||||
|
||||
# 値を変換
|
||||
# データ種別の正式名を設定
|
||||
extract_df.loc[:, 'slip_org_kbn'] = extract_df['slip_org_kbn'].apply(
|
||||
lambda key: constants.SLIP_ORG_KBN_FULL_NAME.get(key))
|
||||
# データ区分の区分の日本語名を設定
|
||||
extract_df.loc[:, 'data_kbn'] = extract_df['data_kbn'].apply(lambda key: constants.DATA_KBN_JP_NAME.get(key))
|
||||
# ロット番号エラーフラグの日本語名を設定
|
||||
extract_df.loc[:, 'lot_num_err_flg'] = extract_df['lot_num_err_flg'].apply(
|
||||
lambda key: constants.LOT_NO_ERR_FLG_JP_NAME.get(key))
|
||||
# 訂正前伝票管理番号がセットされているときのみ修正日時、修正者、エラー詳細種別をセット
|
||||
extract_df.loc[:, 'ins_dt'] = extract_df['bef_slip_mgt_num'].apply(
|
||||
lambda bef_slip_mgt_num: extract_df['ins_dt'] if bef_slip_mgt_num is not None else '')
|
||||
extract_df.loc[:, 'ins_usr'] = extract_df['bef_slip_mgt_num'].apply(
|
||||
lambda bef_slip_mgt_num: extract_df['ins_usr'] if bef_slip_mgt_num is not None else '')
|
||||
|
||||
return extract_df
|
||||
|
||||
|
||||
def _write_bio_data_to_file(
|
||||
bio_service: BioViewService,
|
||||
download_param: BioDownloadModel,
|
||||
|
||||
Binary file not shown.
@ -4,71 +4,54 @@ from typing import Optional
|
||||
from src.model.db.base_db_model import BaseDBModel
|
||||
|
||||
|
||||
class BioSalesViewModel(BaseDBModel):
|
||||
class BioSalesLotDBModel(BaseDBModel):
|
||||
slip_mgt_num: Optional[str]
|
||||
conv_cd: Optional[int]
|
||||
rec_data: Optional[str]
|
||||
rec_whs_cd: Optional[str]
|
||||
rec_whs_sub_cd: Optional[str]
|
||||
rec_whs_org_cd: Optional[str]
|
||||
rec_cust_cd: Optional[str]
|
||||
rec_comm_cd: Optional[str]
|
||||
rec_tran_kbn: Optional[str]
|
||||
rev_hsdnymd_wrk: Optional[str]
|
||||
rev_hsdnymd_srk: Optional[str]
|
||||
rec_urag_num: Optional[str]
|
||||
rec_comm_name: Optional[str]
|
||||
rec_nonyu_fcl_name: Optional[str]
|
||||
rec_nonyu_fcl_addr: Optional[str]
|
||||
rec_lot_num: Optional[str]
|
||||
rec_qty: Optional[str]
|
||||
rec_ymd: Optional[str]
|
||||
sale_data_cat: Optional[str]
|
||||
slip_file_name: Optional[str]
|
||||
slip_mgt_num: Optional[str]
|
||||
row_num: Optional[int]
|
||||
hsdn_ymd: Optional[str]
|
||||
exec_dt: Optional[str]
|
||||
v_tran_cd: Optional[int]
|
||||
tran_kbn_name: Optional[str]
|
||||
whs_org_cd: Optional[str]
|
||||
v_whsorg_cd: Optional[str]
|
||||
v_whsorg_cd: Optional[int]
|
||||
whs_org_name: Optional[str]
|
||||
whs_org_kn: Optional[str]
|
||||
v_whs_cd: Optional[int]
|
||||
whs_name: Optional[str]
|
||||
nonyu_fcl_cd: Optional[str]
|
||||
v_inst_cd: Optional[str]
|
||||
v_inst_kn: Optional[str]
|
||||
v_inst_nm: Optional[str]
|
||||
v_inst_name: Optional[str]
|
||||
v_inst_addr: Optional[str]
|
||||
comm_cd: Optional[str]
|
||||
product_name: Optional[str]
|
||||
whs_rep_comm_nm: Optional[str]
|
||||
whs_rep_nnskfcl_nm: Optional[str]
|
||||
whs_rep_nnsk_fcl_addr: Optional[str]
|
||||
whs_rep_comm_name: Optional[str]
|
||||
whs_rep_nonyu_fcl_name: Optional[str]
|
||||
whs_rep_nonyu_fcl_addr: Optional[str]
|
||||
mkr_inf_1: Optional[str]
|
||||
mkr_cd: Optional[str]
|
||||
htdnymd_err_kbn: Optional[str]
|
||||
prd_exis_kbn: Optional[str]
|
||||
fcl_exis_kbn: Optional[str]
|
||||
amt: Optional[int]
|
||||
qty: Optional[int]
|
||||
slip_org_kbn: Optional[str]
|
||||
bef_slip_mgt_num: Optional[str]
|
||||
lot_no_err_flg: Optional[str]
|
||||
iko_flg: Optional[str]
|
||||
kjyo_ym: Optional[str]
|
||||
tksnbk_kbn: Optional[str]
|
||||
fcl_exec_kbn: Optional[str]
|
||||
rec_sts_kbn: Optional[str]
|
||||
ins_dt: Optional[datetime]
|
||||
ins_usr: Optional[str]
|
||||
dcf_inst_cd: Optional[str]
|
||||
dwh_upd_dt: Optional[datetime]
|
||||
inst_cd: Optional[str]
|
||||
inst_name_form: Optional[str]
|
||||
address: Optional[str]
|
||||
tel_no: Optional[str]
|
||||
tel_num: Optional[str]
|
||||
data_kbn: Optional[str]
|
||||
ser_no: Optional[str]
|
||||
lot_num: Optional[str]
|
||||
data_kind: Optional[str]
|
||||
err_dtl_kind: Optional[str]
|
||||
expr_dt: Optional[date]
|
||||
amt_fugo: Optional[str]
|
||||
@ -4,4 +4,5 @@ from src.model.db.base_db_model import BaseDBModel
|
||||
|
||||
|
||||
class PharmacyProductMasterModel(BaseDBModel):
|
||||
mkr_cd: Optional[str]
|
||||
mkr_cd_name: Optional[str]
|
||||
|
||||
@ -1,19 +1,8 @@
|
||||
from src.model.db.bio_sales_view import BioSalesViewModel
|
||||
from src.system_var import constants
|
||||
from src.model.db.bio_sales_lot import BioSalesLotDBModel
|
||||
from src.util.sanitize import sanitize
|
||||
|
||||
|
||||
@sanitize
|
||||
class BisDisplayModel(BioSalesViewModel):
|
||||
def __init__(self, param: BioSalesViewModel) -> None:
|
||||
class BisDisplayModel(BioSalesLotDBModel):
|
||||
def __init__(self, param: BioSalesLotDBModel) -> None:
|
||||
super().__init__(**param.dict())
|
||||
|
||||
# 区分・フラグの正式名称を設定
|
||||
self.slip_org_kbn = constants.SLIP_ORG_KBN_FULL_NAME.get(self.slip_org_kbn)
|
||||
self.data_kbn = constants.DATA_KBN_JP_NAME.get(self.data_kbn)
|
||||
self.lot_no_err_flg = constants.LOT_NO_ERR_FLG_JP_NAME.get(self.lot_no_err_flg)
|
||||
|
||||
# 訂正前伝票管理番号がセットされているときのみ修正日時、修正者、エラー詳細種別をセット
|
||||
if (self.bef_slip_mgt_num is None):
|
||||
self.ins_dt = ""
|
||||
self.ins_usr = ""
|
||||
|
||||
@ -23,7 +23,7 @@ class BioViewModel(BaseModel):
|
||||
|
||||
def display_wholesaler_names(self):
|
||||
display_names = [
|
||||
f'{whs_model.rec_whs_cd}-{whs_model.rec_whs_sub_cd}:{whs_model.name}'
|
||||
f'{whs_model.rec_whs_cd}-{whs_model.rec_whs_sub_cd}:{whs_model.name or ""}'
|
||||
for whs_model in self.whs_models
|
||||
]
|
||||
return display_names
|
||||
@ -45,15 +45,38 @@ class BioViewModel(BaseModel):
|
||||
'0': '正常',
|
||||
'1': 'ロットエラー',
|
||||
'3': 'ロット不明',
|
||||
'9': 'エラー(解消済)',
|
||||
'9': 'エラー(解消済み)',
|
||||
'2': '除外'
|
||||
}
|
||||
)
|
||||
|
||||
def bio_data_json_str(self):
|
||||
"""生物由来ロット分解データの検索結果を指定された件数ごとに分割しながら返す"""
|
||||
def date_handler(obj):
|
||||
"""json.dumpsの日付項目のフォーマットハンドラ"""
|
||||
return obj.isoformat() if hasattr(obj, 'isoformat') else obj
|
||||
return json.dumps([model.dict() for model in self.bio_data], ensure_ascii=False, default=date_handler)
|
||||
|
||||
search_data_list = [model.dict() for model in self.bio_data]
|
||||
search_data_len = len(search_data_list)
|
||||
# 呼び出し一回あたりの分割数
|
||||
part_size = 500
|
||||
for i in range(0, search_data_len, part_size):
|
||||
json_str = json.dumps(search_data_list[i:i + part_size], ensure_ascii=False, default=date_handler)
|
||||
# JavaScriptに埋め込むため、クォートをエスケープ
|
||||
json_str = json_str.replace("'", "\\'")
|
||||
json_str = json_str.replace('\\"', '\\\\"')
|
||||
yield json_str
|
||||
|
||||
def make_whs_name(self):
|
||||
if not self.is_form_submitted():
|
||||
return ''
|
||||
if self.form_data.rec_whs_cd is None:
|
||||
return ''
|
||||
|
||||
form_wholesaler_full_name = \
|
||||
f'{self.form_data.rec_whs_cd}-{self.form_data.rec_whs_sub_cd}:{self.form_data.whs_name}'
|
||||
|
||||
return form_wholesaler_full_name
|
||||
|
||||
def is_selected_whs_name(self, selected_wholesaler):
|
||||
if not self.is_form_submitted():
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
from src.db import sql_condition as condition
|
||||
from src.db.sql_condition import SQLCondition
|
||||
from src.logging.get_logger import get_logger
|
||||
from src.model.db.bio_sales_view import BioSalesViewModel
|
||||
from src.model.db.bio_sales_lot import BioSalesLotDBModel
|
||||
from src.model.request.bio import BioModel
|
||||
from src.repositories.base_repository import BaseRepository
|
||||
from src.util.string_util import is_not_empty
|
||||
@ -9,37 +9,59 @@ from src.util.string_util import is_not_empty
|
||||
logger = get_logger('生物由来参照')
|
||||
|
||||
|
||||
class BioSalesViewRepository(BaseRepository):
|
||||
class BioSalesLotRepository(BaseRepository):
|
||||
FETCH_SQL = """\
|
||||
SELECT
|
||||
(
|
||||
CASE
|
||||
WHEN LEFT(bs.v_tran_cd, 1) = 2
|
||||
AND bs.qty >= 1 THEN CONCAT('-', bs.qty)
|
||||
ELSE bs.qty
|
||||
END
|
||||
) AS amt_fugo,
|
||||
bs.*,
|
||||
ln.ser_num,
|
||||
ln.lot_num,
|
||||
ln.expr_dt
|
||||
data_kind,
|
||||
slip_mgt_num,
|
||||
rec_ymd,
|
||||
rec_whs_cd,
|
||||
rec_whs_sub_cd,
|
||||
whs_name,
|
||||
rec_whs_org_cd,
|
||||
rec_urag_num,
|
||||
rev_hsdnymd_srk,
|
||||
rec_tran_kbn,
|
||||
tran_kbn_name,
|
||||
mkr_cd,
|
||||
rec_comm_cd,
|
||||
product_name,
|
||||
whs_rep_comm_name,
|
||||
nonyu_fcl_cd,
|
||||
rec_nonyu_fcl_name,
|
||||
whs_rep_nonyu_fcl_name,
|
||||
rec_nonyu_fcl_addr,
|
||||
whs_rep_nonyu_fcl_addr,
|
||||
rec_lot_num,
|
||||
qty,
|
||||
expr_dt,
|
||||
data_kbn,
|
||||
err_dtl_kind,
|
||||
bef_slip_mgt_num,
|
||||
ins_usr,
|
||||
ins_dt,
|
||||
inst_cd,
|
||||
inst_name_form,
|
||||
address,
|
||||
tel_num,
|
||||
v_whs_cd,
|
||||
v_whsorg_cd,
|
||||
whs_org_name,
|
||||
v_tran_cd,
|
||||
iko_flg
|
||||
FROM
|
||||
src05.bio_sales_view bs
|
||||
LEFT OUTER JOIN
|
||||
src05.lot_num_mst ln
|
||||
ON bs.mkr_cd = ln.ser_num
|
||||
AND bs.rec_lot_num = ln.lot_num
|
||||
src05.bio_sales_lot
|
||||
WHERE
|
||||
{where_clause}
|
||||
ORDER BY
|
||||
bs.rec_whs_cd,
|
||||
bs.rec_whs_sub_cd,
|
||||
bs.rev_hsdnymd_srk,
|
||||
bs.slip_mgt_num
|
||||
rec_whs_cd,
|
||||
rec_whs_sub_cd,
|
||||
rev_hsdnymd_srk,
|
||||
slip_mgt_num
|
||||
ASC\
|
||||
"""
|
||||
|
||||
def fetch_many(self, parameter: BioModel) -> list[BioSalesViewModel]:
|
||||
def fetch_many(self, parameter: BioModel) -> list[BioSalesLotDBModel]:
|
||||
try:
|
||||
self._database.connect()
|
||||
logger.debug('DB参照実行')
|
||||
@ -48,7 +70,7 @@ class BioSalesViewRepository(BaseRepository):
|
||||
logger.debug(f'SQL: {query}')
|
||||
result = self._database.execute_select(query, parameter.dict())
|
||||
logger.debug(f'count= {len(result)}')
|
||||
models = [BioSalesViewModel(**r) for r in result]
|
||||
models = [BioSalesLotDBModel(**r) for r in result]
|
||||
return models
|
||||
except Exception as e:
|
||||
logger.exception(f"DB Error : Exception={e.args}")
|
||||
@ -93,8 +115,8 @@ class BioSalesViewRepository(BaseRepository):
|
||||
if is_not_empty(parameter.rec_lot_num):
|
||||
rec_lot_num = parameter.rec_lot_num
|
||||
# あいまい検索文字列('%')が含まれる場合は'LIKE'、でなければ'='で検索
|
||||
rec_lot_num_comparator = condition.LIKE if rec_lot_num in '%' else condition.EQ
|
||||
where_clauses.append(SQLCondition('rec_lot_num', rec_lot_num_comparator, 'rec_lot_num'))
|
||||
rec_lot_num_comparator = condition.LIKE if '%' in rec_lot_num else condition.EQ
|
||||
where_clauses.append(SQLCondition('TRIM(rec_lot_num)', rec_lot_num_comparator, 'rec_lot_num'))
|
||||
# データ区分
|
||||
if is_not_empty(parameter.data_kbn):
|
||||
where_clauses.append(SQLCondition('data_kbn', condition.EQ, 'data_kbn'))
|
||||
@ -9,6 +9,7 @@ class PharmacyProductMasterRepository(BaseRepository):
|
||||
|
||||
FETCH_SQL = """\
|
||||
SELECT
|
||||
t1.mkr_cd,
|
||||
CONCAT(IFNULL(t1.mkr_cd, ''), ' ', IFNULL(t1.mkr_inf_1, '')) AS mkr_cd_name
|
||||
FROM
|
||||
src05.phm_prd_mst_v t1
|
||||
|
||||
@ -12,7 +12,7 @@ from src.model.request.bio import BioModel
|
||||
from src.model.view.bio_disp_model import BisDisplayModel
|
||||
from src.model.view.bio_view_model import BioViewModel
|
||||
from src.repositories.base_repository import BaseRepository
|
||||
from src.repositories.bio_sales_view_repository import BioSalesViewRepository
|
||||
from src.repositories.bio_sales_lot_repository import BioSalesLotRepository
|
||||
from src.repositories.pharmacy_product_master_repository import \
|
||||
PharmacyProductMasterRepository
|
||||
from src.repositories.wholesaler_master_repository import \
|
||||
@ -27,7 +27,7 @@ class BioViewService(BaseService):
|
||||
REPOSITORIES = {
|
||||
'whs_repository': WholesalerMasterRepository,
|
||||
'phm_repository': PharmacyProductMasterRepository,
|
||||
'bio_sales_repository': BioSalesViewRepository
|
||||
'bio_sales_repository': BioSalesLotRepository
|
||||
}
|
||||
|
||||
CLIENTS = {
|
||||
@ -36,7 +36,7 @@ class BioViewService(BaseService):
|
||||
|
||||
whs_repository: WholesalerMasterRepository
|
||||
phm_repository: PharmacyProductMasterRepository
|
||||
bio_sales_repository: BioSalesViewRepository
|
||||
bio_sales_repository: BioSalesLotRepository
|
||||
s3_client: S3Client
|
||||
|
||||
def __init__(self, repositories: dict[str, BaseRepository], clients: dict[str, AWSAPIClient]) -> None:
|
||||
@ -119,6 +119,9 @@ class BioViewService(BaseService):
|
||||
logger.info(parameter_message)
|
||||
access_logger.info(parameter_message)
|
||||
|
||||
# ログファイルクローズ
|
||||
access_log_handler.close()
|
||||
|
||||
# S3にアップロード
|
||||
self.upload_bio_access_log_file(access_log_file_path)
|
||||
|
||||
@ -153,14 +156,16 @@ class BioViewService(BaseService):
|
||||
header_df = pd.DataFrame([header_data], index=None)
|
||||
output_df = pd.concat([header_df, data_frame])
|
||||
# ヘッダー行としてではなく、1レコードとして出力する
|
||||
output_df.to_csv(output_file_path, index=False, header=False)
|
||||
output_df.to_csv(output_file_path, index=False, header=False, encoding="utf-8_sig")
|
||||
|
||||
return output_file_path
|
||||
|
||||
def upload_bio_data_file(self, local_file_path: str) -> None:
|
||||
bucket_name = environment.BIO_ACCESS_LOG_BUCKET
|
||||
# TODO: ファイルパスにYYYY/MM/DDを加える
|
||||
file_key = f'data/{os.path.basename(local_file_path)}'
|
||||
|
||||
dt_now = datetime.now()
|
||||
ymd = f'{dt_now.year}/{dt_now.strftime("%m")}/{dt_now.strftime("%d")}'
|
||||
file_key = f'data/{ymd}/{os.path.basename(local_file_path)}'
|
||||
self.s3_client.upload_file(local_file_path, bucket_name, file_key)
|
||||
|
||||
# アップロード後、ローカルからは削除する
|
||||
@ -168,8 +173,10 @@ class BioViewService(BaseService):
|
||||
|
||||
def upload_bio_access_log_file(self, local_file_path: str) -> None:
|
||||
bucket_name = environment.BIO_ACCESS_LOG_BUCKET
|
||||
# TODO: ファイルパスにYYYY/MM/DDを加える
|
||||
file_key = f'log/{os.path.basename(local_file_path)}'
|
||||
|
||||
dt_now = datetime.now()
|
||||
ymd = f'{dt_now.year}/{dt_now.strftime("%m")}/{dt_now.strftime("%d")}'
|
||||
file_key = f'log/{ymd}/{os.path.basename(local_file_path)}'
|
||||
self.s3_client.upload_file(local_file_path, bucket_name, file_key)
|
||||
|
||||
# アップロード後、ローカルからは削除する
|
||||
@ -177,8 +184,10 @@ class BioViewService(BaseService):
|
||||
|
||||
def generate_download_file_url(self, local_file_path: str, user_id: str, kind: str) -> str:
|
||||
bucket_name = environment.BIO_ACCESS_LOG_BUCKET
|
||||
# TODO: ファイルパスにYYYY/MM/DDを加える
|
||||
file_key = f'data/{os.path.basename(local_file_path)}'
|
||||
|
||||
dt_now = datetime.now()
|
||||
ymd = f'{dt_now.year}/{dt_now.strftime("%m")}/{dt_now.strftime("%d")}'
|
||||
file_key = f'data/{ymd}/{os.path.basename(local_file_path)}'
|
||||
download_filename = f'{user_id}_生物由来卸販売データ.{kind}'
|
||||
return self.s3_client.generate_presigned_url(bucket_name, file_key, download_filename)
|
||||
|
||||
|
||||
@ -81,9 +81,25 @@ table{
|
||||
|
||||
.bioScroll_div {
|
||||
overflow: auto;
|
||||
white-space: nowrap;
|
||||
margin-top: 1%;
|
||||
margin-bottom: 1%;
|
||||
width: 100%;
|
||||
height: 250px;
|
||||
width: 1132px;
|
||||
}
|
||||
.bioScroll_div::-webkit-scrollbar {
|
||||
height: 5px;
|
||||
width: 10px;
|
||||
}
|
||||
|
||||
.bioScroll_div::-webkit-scrollbar-track {
|
||||
border-radius: 5px;
|
||||
background: #eee;
|
||||
}
|
||||
|
||||
.bioScroll_div::-webkit-scrollbar-thumb {
|
||||
border-radius: 5px;
|
||||
background: #666;
|
||||
}
|
||||
|
||||
.noLine{
|
||||
|
||||
@ -5,49 +5,11 @@ BATCH_STATUS_PROCESSING = '1'
|
||||
# 日付テーブル.dump取得状態区分:未処理
|
||||
DUMP_STATUS_UNPROCESSED = '0'
|
||||
|
||||
# 生物由来照会
|
||||
|
||||
BIO_TEMPORARY_FILE_DIR_PATH = path.join(path.curdir, 'src', 'data')
|
||||
BIO_EXCEL_TEMPLATE_FILE_PATH = path.join(BIO_TEMPORARY_FILE_DIR_PATH, 'BioData_template.xlsx')
|
||||
|
||||
BIO_EXTRACT_COLUMNS = [
|
||||
'slip_org_kbn',
|
||||
'slip_mgt_num',
|
||||
'rec_ymd',
|
||||
'rec_whs_cd',
|
||||
'rec_whs_sub_cd',
|
||||
'whs_name',
|
||||
'rec_whs_org_cd',
|
||||
'rec_urag_num',
|
||||
'rev_hsdnymd_srk',
|
||||
'rec_tran_kbn',
|
||||
'tran_kbn_name',
|
||||
'mkr_cd',
|
||||
'rec_comm_cd',
|
||||
'product_name',
|
||||
'whs_rep_comm_name',
|
||||
'nonyu_fcl_cd',
|
||||
'rec_nonyu_fcl_name',
|
||||
'whs_rep_nonyu_fcl_name',
|
||||
'rec_nonyu_fcl_addr',
|
||||
'whs_rep_nonyu_fcl_addr',
|
||||
'rec_lot_num',
|
||||
'amt_fugo',
|
||||
'expr_dt',
|
||||
'data_kbn',
|
||||
'lot_num_err_flg',
|
||||
'bef_slip_mgt_num',
|
||||
'ins_usr',
|
||||
'ins_dt',
|
||||
'inst_cd',
|
||||
'inst_name_form',
|
||||
'address',
|
||||
'tel_num',
|
||||
'v_whs_cd',
|
||||
'v_whsorg_cd',
|
||||
'whs_org_name',
|
||||
'v_tran_cd',
|
||||
'iko_flg'
|
||||
]
|
||||
|
||||
BIO_CSV_HEADER = [
|
||||
'データ種別',
|
||||
'伝票管理NO',
|
||||
@ -85,7 +47,7 @@ BIO_CSV_HEADER = [
|
||||
'Veeva卸組織コード',
|
||||
'卸組織名',
|
||||
'Veeva取引区分コード',
|
||||
'移行'
|
||||
'2017年11月以前データ'
|
||||
]
|
||||
|
||||
SLIP_ORG_KBN_FULL_NAME = {
|
||||
|
||||
@ -5,16 +5,16 @@
|
||||
{% include '_header.html' %}
|
||||
{% endwith %}
|
||||
<link rel="stylesheet" href="/static/css/bioStyle.css">
|
||||
|
||||
<script type="text/javascript">
|
||||
window.onload = function() {
|
||||
|
||||
<script>
|
||||
window.onload = function(){
|
||||
// 見出し固定初期化
|
||||
FixedMidashi.create();
|
||||
// ボタン、テキストボックス初期化
|
||||
formBtDisabled();
|
||||
// DatePickerを有効化
|
||||
enableDatePicker();
|
||||
};
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@ -52,16 +52,14 @@
|
||||
</td>
|
||||
<td>処理日:</td>
|
||||
<td colspan="2">
|
||||
<input type="text" id="shoribi_start" class="date_picker" name="ctrl_rec_ymd_from"
|
||||
<input type="text" id="shoribi_start" class="date_picker" name="ctrl_rec_ymd_from" maxlength="10"
|
||||
value="{{bio.is_input_rec_ymd_from()}}"
|
||||
onchange="formBtDisabled()"
|
||||
onblur="autoModifyDate(this)"
|
||||
>
|
||||
~
|
||||
<input type="text" id="shoribi_end" class="date_picker" name="ctrl_rec_ymd_to"
|
||||
<input type="text" id="shoribi_end" class="date_picker" name="ctrl_rec_ymd_to" maxlength="10"
|
||||
value="{{bio.is_input_rec_ymd_to()}}"
|
||||
onchange="formBtDisabled()"
|
||||
onblur="autoModifyDate(this)"
|
||||
>
|
||||
</td>
|
||||
</tr>
|
||||
@ -76,7 +74,7 @@
|
||||
<td class="search_tb">
|
||||
<select class="text search_dropdown" name="ctrl_data_kbn" onchange="formBtDisabled()">
|
||||
{% for data_kbn_code, data_kbn_value in bio.display_data_kbn().items() %}
|
||||
<option value="{{data_kbn_code}}" {{bio.is_selected_data_kbn(data_kbn_code)}} >{{data_kbn_value}}</option>
|
||||
<option value="{{data_kbn_value}}" {{bio.is_selected_data_kbn(data_kbn_value)}} >{{data_kbn_value}}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</td>
|
||||
@ -86,7 +84,7 @@
|
||||
<option value=""></option>
|
||||
{% for phm in bio.phm_models %}
|
||||
<option
|
||||
value="{{phm['mkr_cd_name']}}" {{bio.is_selected_maker_cd(phm['mkr_cd_name'])}}>
|
||||
value="{{phm['mkr_cd']}}" {{bio.is_selected_maker_cd(phm['mkr_cd'])}}>
|
||||
{{phm['mkr_cd_name']}}
|
||||
</option>
|
||||
{% endfor %}
|
||||
@ -96,16 +94,14 @@
|
||||
<tr>
|
||||
<td>発伝年月日:</td>
|
||||
<td colspan="3">
|
||||
<input type="text" id="shoribi_start" class="date_picker" name="ctrl_rev_hsdnymd_srk_from"
|
||||
<input type="text" id="hsdnymd_start" class="date_picker" name="ctrl_rev_hsdnymd_srk_from" maxlength="10"
|
||||
value="{{bio.is_input_rev_hsdnymd_srk_from()}}"
|
||||
onchange="formBtDisabled()"
|
||||
onblur="autoModifyDate(this)"
|
||||
>
|
||||
~
|
||||
<input type="text" id="shoribi_start" class="date_picker" name="ctrl_rev_hsdnymd_srk_to"
|
||||
<input type="text" id="hsdnymd_end" class="date_picker" name="ctrl_rev_hsdnymd_srk_to" maxlength="10"
|
||||
value="{{bio.is_input_rev_hsdnymd_srk_to()}}"
|
||||
onchange="formBtDisabled()"
|
||||
onblur="autoModifyDate(this)"
|
||||
>
|
||||
</td>
|
||||
<td colspan="2">
|
||||
@ -130,9 +126,9 @@
|
||||
<div id="light-pagination" class="pagination"></div>
|
||||
<!--検索結果表示テーブル-->
|
||||
<div class="bioScroll_div">
|
||||
<table class="tablesorter" _fixedhead='rows:1; cols:0; border-color:black; border-width:2px;'>
|
||||
<table class="tablesorter search_longtextbox" _fixedhead='rows:1; cols:0;'>
|
||||
<thead>
|
||||
<tr class="result_tr">
|
||||
<tr>
|
||||
<th>データ種別</th>
|
||||
<th>伝票管理NO</th>
|
||||
<th>処理日</th>
|
||||
@ -169,7 +165,7 @@
|
||||
<th>Veeva卸組織コード</th>
|
||||
<th>卸組織名</th>
|
||||
<th>Veeva取引区分コード</th>
|
||||
<th>移行</th>
|
||||
<th>2017年11月以前データ</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="result_data" class="result_data"></tbody>
|
||||
@ -186,6 +182,18 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</form>
|
||||
<form id="bio_download">
|
||||
<input type="hidden" name="ctrl_wholesaler" value="{{bio.make_whs_name()}}">
|
||||
<input type="hidden" name="ctrl_org_kbn" value="{{bio.form_data.slip_org_kbn or ''}}">
|
||||
<input type="hidden" name="ctrl_rec_ymd_from" value="{{bio.is_input_rec_ymd_from()}}">
|
||||
<input type="hidden" name="ctrl_rec_ymd_to" value="{{bio.is_input_rec_ymd_to()}}">
|
||||
<input type="hidden" name="ctrl_rec_lot_num" value="{{bio.is_input_lot_num()}}">
|
||||
<input type="hidden" name="ctrl_data_kbn" value="{{bio.form_data.data_kbn or ''}}">
|
||||
<input type="hidden" name="ctrl_maker_cd" value="{{bio.form_data.mkr_cd or ''}}">
|
||||
<input type="hidden" name="ctrl_rev_hsdnymd_srk_from" value="{{bio.is_input_rev_hsdnymd_srk_from()}}">
|
||||
<input type="hidden" name="ctrl_rev_hsdnymd_srk_to" value="{{bio.is_input_rev_hsdnymd_srk_to()}}">
|
||||
<input type="checkbox" name="ikoFlg" value="true" {{bio.is_checked_iko_flg()}} style="display: none;">
|
||||
</form>
|
||||
|
||||
<!-- CSV/Excelダウンロードボタン。ここはajaxでやってる -->
|
||||
<script type="text/javascript">
|
||||
@ -193,7 +201,7 @@
|
||||
$(`#loading`).toggle()
|
||||
|
||||
// 検索パラメータを取得
|
||||
const formData = $('#bio_search').serializeArray()
|
||||
const formData = $('#bio_download').serializeArray()
|
||||
// リクエスト用に加工
|
||||
const searchParams = {}
|
||||
for (let i = 0; i < formData.length; i++) {
|
||||
@ -216,22 +224,14 @@
|
||||
success: function(data) {
|
||||
try {
|
||||
if (data.status === 'batch_processing') {
|
||||
location.href('/logout/?reason=batchProcessing')
|
||||
location.href='/logout/?reason=batchProcessing';
|
||||
return
|
||||
}
|
||||
|
||||
if (data.status === 'session_expired') {
|
||||
location.href('/logout/?reason=session_expired')
|
||||
location.href='/logout/?reason=session_expired';
|
||||
return
|
||||
}
|
||||
// データが存在しない場合の考慮が必要
|
||||
/**if (data.download_url === '') {
|
||||
// 予期せぬエラーが発生した場合
|
||||
$(`#loading`).toggle();
|
||||
$(`#modal_${ext}`).modal('toggle');
|
||||
$(`#ErrorModal_Unexpected`).modal('toggle');
|
||||
}
|
||||
*/
|
||||
// S3の期限付き署名URLがレスポンスされる
|
||||
window.location.href = data.download_url;
|
||||
$(`#loading`).toggle();
|
||||
@ -266,20 +266,13 @@
|
||||
|
||||
// <! --ページネーションの作成-- >
|
||||
$(function() {
|
||||
// スピナー出さない場合は以下、エスケープせず埋め込む
|
||||
// {% autoescape False%}
|
||||
let searchResultString = '{{bio.bio_data_json_str()}}'
|
||||
// {% endautoescape%}
|
||||
const searchResultData = JSON.parse(searchResultString)
|
||||
if (searchResultData.length == 0) {
|
||||
return
|
||||
}
|
||||
const searchResultData = generateSearchResult();
|
||||
if (searchResultData.length == 0) return;
|
||||
|
||||
$(".pagination").pagination({
|
||||
dataSource: function(done) {
|
||||
done(searchResultData)
|
||||
},
|
||||
dataSource: searchResultData,
|
||||
pageNumber: 1, // 初期ページ番号
|
||||
pageSize: 50, //表示するコンテンツ数
|
||||
pageSize: 100, //表示するコンテンツ数
|
||||
pageRange: 2, //選択されているページネーション番号の両隣に表示する個数
|
||||
ellipsisText: '...', //省略文字
|
||||
prevText: 'Prev', //「前へ」の文字。エスケープ文字
|
||||
@ -287,15 +280,27 @@
|
||||
showNavigator: true,
|
||||
formatNavigator: '件数: <%= totalNumber %>件 ページ数: <%= totalPage %>',
|
||||
callback: function(data, pagination) {
|
||||
console.log(pagination.pageNumber)
|
||||
$('#result_data').html(pagination_content(data))
|
||||
$('.paginationjs-pages > ul > li').not('.disabled,.active').each(function(index, val) {
|
||||
// paginationにtabindexをつける
|
||||
$(val).attr('tabindex', '0')
|
||||
// Enterキー押下時に要素をクリックできるようにイベントを付加する
|
||||
$(val).on('keypress', function(e) {
|
||||
if (e.code === 'Enter') {
|
||||
$(e.target).click()
|
||||
$(val).off('keypress')
|
||||
return false
|
||||
}
|
||||
$(val).off('keypress')
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
function pagination_content(datas) {
|
||||
const display_keys = [
|
||||
'slip_org_kbn',
|
||||
'data_kind',
|
||||
'slip_mgt_num',
|
||||
'rec_ymd',
|
||||
'rec_whs_cd',
|
||||
@ -309,24 +314,24 @@
|
||||
'mkr_cd',
|
||||
'rec_comm_cd',
|
||||
'product_name',
|
||||
'whs_rep_comm_nm',
|
||||
'whs_rep_comm_name',
|
||||
'nonyu_fcl_cd',
|
||||
'rec_nonyu_fcl_name',
|
||||
'whs_rep_nnskfcl_nm',
|
||||
'whs_rep_nonyu_fcl_name',
|
||||
'rec_nonyu_fcl_addr',
|
||||
'whs_rep_nnsk_fcl_addr',
|
||||
'whs_rep_nonyu_fcl_addr',
|
||||
'rec_lot_num',
|
||||
'amt_fugo',
|
||||
'qty',
|
||||
'expr_dt',
|
||||
'data_kbn',
|
||||
'lot_no_err_flg',
|
||||
'err_dtl_kind',
|
||||
'bef_slip_mgt_num',
|
||||
'ins_usr',
|
||||
'ins_dt',
|
||||
'inst_cd',
|
||||
'inst_name_form',
|
||||
'address',
|
||||
'tel_no',
|
||||
'tel_num',
|
||||
'v_whs_cd',
|
||||
'v_whsorg_cd',
|
||||
'whs_org_name',
|
||||
@ -341,6 +346,20 @@
|
||||
`
|
||||
})
|
||||
}
|
||||
|
||||
function generateSearchResult(){
|
||||
const searchResultData = []
|
||||
// {% if bio.is_form_submitted() and not (bio.is_data_overflow_max_length() or bio.is_data_empty()) %}
|
||||
// {% autoescape False%}
|
||||
// ジェネレータですこしずつ取得してリストに詰める
|
||||
// {% for bio_data_json_str in bio.bio_data_json_str() %}
|
||||
searchResultData.push(...JSON.parse('{{bio_data_json_str}}'))
|
||||
// {% endfor %}
|
||||
// {% endautoescape%}
|
||||
// {% endif %}
|
||||
return searchResultData
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<!-- Excel出力モーダル -->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user