[load_grdList] --受信 select sys.recv_no , sys.recv_content as biko1 , sys.upd_id as tan_cd , to_char(sys.cre_time,'yyyy/mm/dd hh24:mi:ss') as cre_time_s , mt.tan_nm , sys.recv_title as log_kind_s -- , null as fax_no , sys.email as fax_no , (case when(sys.tok_cd != '')then('mtok')when(sys.sir_cd != '')then('msir')else('')end) as tor_kbn , (case when(sys.tok_cd != '')then('得意先')when(sys.sir_cd != '')then('仕入先')else('')end) as tor_kbn_nm , (case when(sys.tok_cd != '')then(sys.tok_cd)when(sys.sir_cd != '')then(sys.sir_cd)else('')end) as tor_cd , (case when(sys.tok_cd != '')then(mtok.tok_nm)when(sys.sir_cd != '')then(msir.sir_nm)else('')end) as tor_nm , 'R' as rs_kbn , '受信' as rs_kbn_nm , (case(sys.recv_hoho)when(1)then('Fax')when(2)then('eMail')else(sys.recv_hoho::varchar)end) as rs_hoho -- , null as rs_sts -- , null as rs_sts_nm , sys.recv_sts as rs_sts , (case(sys.recv_sts)when(0)then('待ち')when(1)then('完')else(sys.recv_sts::varchar)end) as rs_sts_nm , sys.file_name from t_recv_log sys left join m_tanto mt on (mt.tan_cd = sys.upd_id) left join m_tokui mtok on (mtok.tok_cd = sys.tok_cd) left join m_sir msir on (msir.sir_cd = sys.sir_cd) where 1 = 1 and ((':trash_mode' != '0') or (sys.del_flg = 0)) and ((':trash_mode' != '1') or (sys.del_flg = 1)) and (('' = ':syori_ymd_fr') or (to_char(sys.cre_time,'yyyymmdd') >= ':syori_ymd_fr')) and (('' = ':syori_ymd_to') or (to_char(sys.cre_time,'yyyymmdd') <= ':syori_ymd_to')) and ':recv_mode' = '1' and ( ((':sts_mi' = '1') and (sys.recv_sts in (0))) or ((':sts_sumi' = '1') and (sys.recv_sts in (1))) or (sys.del_flg = 1) ) --送信 union all select sys.send_no as recv_no , (case when(sys.send_sts in (8))then(sys.biko1)else(sys.send_content)end) as biko1 --異常のときは備考を出す , sys.upd_id as tan_cd , to_char(sys.cre_time,'yyyy/mm/dd hh24:mi:ss') as cre_time_s , mt.tan_nm , sys.send_title as log_kind_s , sys.fax_no , (case when(sys.tok_cd != '')then('mtok')when(sys.sir_cd != '')then('msir')else('')end) as tor_kbn , (case when(sys.tok_cd != '')then('得意先')when(sys.sir_cd != '')then('仕入先')else('')end) as tor_kbn_nm , (case when(sys.tok_cd != '')then(sys.tok_cd)when(sys.sir_cd != '')then(sys.sir_cd)else('')end) as tor_cd , (case when(sys.tok_cd != '')then(mtok.tok_nm)when(sys.sir_cd != '')then(msir.sir_nm)else('')end) as tor_nm , 'S' as rs_kbn , '送信' as rs_kbn_nm , (case(sys.send_hoho)when(1)then('Fax')when(2)then('eMail')else(sys.send_hoho::varchar)end) as rs_hoho , sys.send_sts as rs_sts , (case(sys.send_sts)when(0)then('待ち')when(1)then('完')when(2)then('実行')when(8)then('異常')when(9)then('中止')else(sys.send_sts::varchar)end) as rs_sts_nm , sys.file_name from t_send_log sys left join m_tanto mt on (mt.tan_cd = sys.upd_id) left join m_tokui mtok on (mtok.tok_cd = sys.tok_cd) left join m_sir msir on (msir.sir_cd = sys.sir_cd) where 1 = 1 and ((':trash_mode' != '0') or (sys.del_flg = 0)) and ((':trash_mode' != '1') or (sys.del_flg = 1)) and (('' = ':syori_ymd_fr') or (to_char(sys.cre_time,'yyyymmdd') >= ':syori_ymd_fr')) and (('' = ':syori_ymd_to') or (to_char(sys.cre_time,'yyyymmdd') <= ':syori_ymd_to')) and ':send_mode' = '1' and ( ((':sts_mi' = '1') and (sys.send_sts in (0,2,8))) or ((':sts_sumi' = '1') and (sys.send_sts in (1,9))) or (sys.del_flg = 1) ) order by cre_time_s desc, rs_kbn, recv_no desc [commitRecv] update t_recv_log set recv_sts = 1 , upd_id = ':login_id' , upd_time = now() where recv_no = :recv_no and recv_sts in (0) [rollbackRecv] update t_recv_log set recv_sts = 0 , upd_id = ':login_id' , upd_time = now() where recv_no = :recv_no and recv_sts in (1) [deleteRecv] update t_recv_log set del_flg = 1 , upd_id = ':login_id' , upd_time = now() where recv_no = :recv_no [deleteSend] update t_send_log set del_flg = 1 , upd_id = ':login_id' , upd_time = now() where send_no = :send_no and send_sts in (8, 9) --異常、中止のみ [restoreRecv] update t_recv_log set del_flg = 0 , upd_id = ':login_id' , upd_time = now() where recv_no = :recv_no and del_flg = 1 [restoreSend] update t_send_log set del_flg = 0 , upd_id = ':login_id' , upd_time = now() where send_no = :send_no and del_flg = 1 [retrySend] update t_send_log set send_sts = 0 , upd_id = ':login_id' , upd_time = now() where send_no = :send_no and send_sts in (2, 8, 9) --異常、中止のみ [cancelSend] update t_send_log set send_sts = 9 , upd_id = ':login_id' , upd_time = now() where send_no = :send_no and send_sts in (0, 8) --待ち、異常のみ [cleanTrash] delete from t_recv_log where del_flg = 1 and cre_time < (now() - cast(':del_day'||'days' as interval)) ; delete from t_send_log where del_flg = 1 and cre_time < (now() - cast(':del_day'||'days' as interval)) ; [saveTorRecv] update t_recv_log set tok_cd = ':w_tok_cd' , sir_cd = ':w_sir_cd' , upd_id = ':login_id' , upd_time = now() where recv_no = :recv_no [saveTorSend] update t_send_log set tok_cd = ':w_tok_cd' , sir_cd = ':w_sir_cd' , upd_id = ':login_id' , upd_time = now() where send_no = :send_no [getRecvAtch] select t.file_name, t.file_image from t_recv_log t where t.recv_no = :recv_no and t.file_image is not null [getSendAtch] select t.file_name, t.file_image from t_send_log t where t.send_no = :send_no and t.file_image is not null