feat: 卸ホールディングマスターの対応
This commit is contained in:
parent
97462420a1
commit
568c841770
@ -326,8 +326,8 @@ class VjskReceiveFileMapper:
|
||||
t.v_hld_cd
|
||||
,t.sub_num
|
||||
,t.name
|
||||
,t.kn_name
|
||||
,t.abb_name
|
||||
,medaca_common.convert_empty_to_null(t.kn_name)
|
||||
,medaca_common.convert_empty_to_null(t.abb_name)
|
||||
,t.start_date
|
||||
,t.end_date
|
||||
,t.dsp_odr
|
||||
@ -337,17 +337,17 @@ class VjskReceiveFileMapper:
|
||||
,SYSDATE()
|
||||
FROM org05.hld_mst_v AS t
|
||||
ON DUPLICATE KEY UPDATE
|
||||
v_hld_cd=t.v_hld_cd
|
||||
,sub_num=t.sub_num
|
||||
,name=t.name
|
||||
,kn_name=t.kn_name
|
||||
,abb_name=t.abb_name
|
||||
,start_date=t.start_date
|
||||
,end_date=t.end_date
|
||||
,dsp_odr=t.dsp_odr
|
||||
,rec_sts_kbn=t.rec_sts_kbn
|
||||
,ins_dt=nullif(t.ins_dt, 0)
|
||||
,upd_dt=nullif(t.upd_dt, 0) -- 受領データがブランクだった場合にゼロ日付で取得されるので明示的にNULL値に変換する
|
||||
v_hld_cd=VALUES(v_hld_cd)
|
||||
,sub_num=VALUES(sub_num)
|
||||
,name=VALUES(name)
|
||||
,kn_name=VALUES(kn_name)
|
||||
,abb_name=VALUES(abb_name)
|
||||
,start_date=VALUES(start_date)
|
||||
,end_date=VALUES(end_date)
|
||||
,dsp_odr=VALUES(dsp_odr)
|
||||
,rec_sts_kbn=VALUES(rec_sts_kbn)
|
||||
,ins_dt=VALUES(ins_dt)
|
||||
,upd_dt=VALUES(upd_dt)
|
||||
,dwh_upd_dt=SYSDATE()
|
||||
;
|
||||
""")
|
||||
|
||||
@ -483,7 +483,7 @@ class TestImportFileToDb:
|
||||
self.batch_context.is_vjsk_stock_import_day = True
|
||||
self.db.execute(f"truncate table {table_name_src}")
|
||||
|
||||
# assertion1 (insert 4row)
|
||||
# assertion1 (insert 6row)
|
||||
|
||||
# 処理実行
|
||||
target_dict = {
|
||||
@ -499,7 +499,7 @@ class TestImportFileToDb:
|
||||
# 突合から除外する項目
|
||||
ignore_columns = ['dwh_upd_dt']
|
||||
# orgテーブル結果が期待値通りかを突合
|
||||
assert_table_results(result_org, assert_list, ignore_columns)
|
||||
assert_table_results(result_org, assert_list, ignore_columns, is_loaddata=True)
|
||||
# srcテーブル結果を取得
|
||||
result_src = self.db.execute_select(f"select * from {table_name_src}")
|
||||
# 突合から除外する項目
|
||||
@ -523,10 +523,10 @@ class TestImportFileToDb:
|
||||
# 突合から除外する項目
|
||||
ignore_columns = ['dwh_upd_dt']
|
||||
# orgテーブル結果が期待値通りかを突合
|
||||
assert_table_results(result_org, assert_list, ignore_columns)
|
||||
assert_table_results(result_org, assert_list, ignore_columns, is_loaddata=True)
|
||||
# srcテーブル結果(orgテーブル結果のPK値で一致するもの)を取得
|
||||
result_src = self.db.execute_select(
|
||||
f"select * from {table_name_src} s inner join {table_name_org} o on (s.v_hld_cd = o.v_hld_cd and s.sub_num = o.sub_num)")
|
||||
f"select s.* from {table_name_src} s inner join {table_name_org} o on (s.v_hld_cd = o.v_hld_cd and s.sub_num = o.sub_num)")
|
||||
# 突合から除外する項目
|
||||
ignore_columns = ['dwh_upd_dt']
|
||||
# srcテーブル結果が期待値通りかを突合
|
||||
@ -534,7 +534,7 @@ class TestImportFileToDb:
|
||||
|
||||
# srcテーブル結果のレコード件数 (insert 4row + update 2row + insert 2row = 6row)
|
||||
result_src_count = self.db.execute_select(f"select count(*) from {table_name_src} ")
|
||||
assert result_src_count[0]['count(*)'] == 6
|
||||
assert result_src_count[0]['count(*)'] == 8
|
||||
|
||||
# teardown
|
||||
|
||||
|
||||
@ -3,3 +3,5 @@
|
||||
"10001" "2" "卸ホールディングス名01-2" "オロシホールディングスメイ01-2" "卸名01-2" "20230102" "99991231" "1" "0" "23-05-09 12:00:02" "23-05-09 13:00:02"
|
||||
"10001" "3" "卸ホールディングス名01-3" "オロシホールディングスメイ01-3" "卸名01-3" "20230103" "99991231" "1" "0" "23-05-09 12:00:03" "23-05-09 13:00:03"
|
||||
"10001" "4" "卸ホールディングス名01-4" "オロシホールディングスメイ01-4" "卸名01-4" "20230104" "99991231" "1" "0" "23-05-09 12:00:04" "23-05-09 13:00:04"
|
||||
"10001" "5" "卸ホールディングス名01-5" "" "" "20230104" "99991231" "1" "0" "23-05-09 12:00:06" "23-05-09 13:00:06"
|
||||
"10001" "6" "卸ホールディングス名01-6" "オロシホールディングスメイ01-6" "卸名01-6" "20230104" "99991231" "1" "0" "23-05-09 12:00:06" "23-05-09 13:00:06"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
"v_hld_cd" "sub_no" "nm" "kn_nm" "sht_nm" "start_dt" "end_dt" "dsp_odr" "rec_sts_kbn" "ins_dt" "upd_dt"
|
||||
"10001" "3" "卸ホールディングス名01-3" "オロシホールディングスメイ01-3" "卸名01-3" "20230101" "99991231" "1" "0" "23-05-09 12:00:03" "23-05-09 13:00:03"
|
||||
"10001" "4" "卸ホールディングス名01-4" "オロシホールディングスメイ01-4" "卸名01-4" "20230102" "99991231" "1" "0" "23-05-09 12:00:04" "23-05-09 13:00:04"
|
||||
"10001" "5" "卸ホールディングス名01-5" "オロシホールディングスメイ01-5" "卸名01-5" "20230103" "99991231" "1" "0" "23-05-09 12:00:05" "23-05-09 13:00:05"
|
||||
"10002" "1" "卸ホールディングス名02-1" "オロシホールディングスメイ02-1" "卸名01-1" "20230104" "99991231" "1" "0" "23-05-09 12:00:06" "23-05-09 13:00:06"
|
||||
"10001" "6" "卸ホールディングス名01-6" "" "" "20230104" "99991231" "1" "0" "23-05-09 12:00:06" "23-05-09 13:00:06"
|
||||
"10002" "1" "卸ホールディングス名02-1" "オロシホールディングスメイ02-1" "卸名02-1" "20230104" "99991231" "1" "0" "23-05-09 12:00:06" "23-05-09 13:00:06"
|
||||
"10002" "2" "卸ホールディングス名02-2" "オロシホールディングスメイ02-2" "卸名02-2" "20230104" "99991231" "1" "0" "23-05-09 12:00:06" "23-05-09 13:00:06"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user