LITVINENKO 27.06.2024 16:54
parent
29f1ab595a
commit
57419d8f43
96
32_7.sql
96
32_7.sql
|
@ -3,37 +3,53 @@
|
|||
returns (
|
||||
output_type D_SMALLINT)
|
||||
as
|
||||
declare variable CUR_ID_APP_EVENT type of column APP_EVENT.ID_APP_EVENT;
|
||||
declare variable CUR_APP_EVENT_ID_SOTR type of column APP_EVENT.APP_EVENT_ID_SOTR;
|
||||
declare variable CUR_APP_EVENT_ID_REC type of column APP_EVENT.APP_EVENT_ID_REC;
|
||||
declare variable CUR_APP_EVENT_VID type of column APP_EVENT.APP_EVENT_VID;
|
||||
declare variable CUR_APP_EVENT_DATA type of column APP_EVENT.APP_EVENT_DATA;
|
||||
|
||||
-- APP_NOTE_VARS
|
||||
DECLARE VARIABLE NEW_ID_APP_NOTE TYPE OF D_BIGINT;
|
||||
DECLARE VARIABLE NEW_APP_NOTE_ID_SOTR TYPE OF D_BIGINT;
|
||||
DECLARE VARIABLE NEW_APP_NOTE_ID_APP_TASK TYPE OF D_BIGINT;
|
||||
DECLARE VARIABLE NEW_APP_NOTE_STATUS TYPE OF D_SMALLINT;
|
||||
DECLARE VARIABLE NEW_APP_NOTE_TIP TYPE OF D_SMALLINT;
|
||||
DECLARE VARIABLE NEW_APP_NOTE_TEXT TYPE OF D_STR1024;
|
||||
DECLARE VARIABLE NEW_APP_NOTE_DEL TYPE OF D_SMALLINT;
|
||||
DECLARE VARIABLE NEW_APP_NOTE_CR TYPE OF D_DATETIME;
|
||||
DECLARE VARIABLE NEW_APP_NOTE_WCR TYPE OF D_BIGINT;
|
||||
DECLARE VARIABLE NEW_APP_NOTE_CH TYPE OF D_DATETIME;
|
||||
DECLARE VARIABLE NEW_APP_NOTE_WCH TYPE OF D_BIGINT;
|
||||
-- APP_EVENT VARIABLES
|
||||
declare variable F_ID_APP_EVENT type of column APP_EVENT.ID_APP_EVENT;
|
||||
declare variable F_APP_EVENT_ID_SOTR type of column APP_EVENT.APP_EVENT_ID_SOTR;
|
||||
declare variable F_APP_EVENT_ID_REC type of column APP_EVENT.APP_EVENT_ID_REC;
|
||||
declare variable F_APP_EVENT_VID type of column APP_EVENT.APP_EVENT_VID;
|
||||
declare variable F_APP_EVENT_TIP type of column APP_EVENT.APP_EVENT_TIP;
|
||||
declare variable F_APP_EVENT_DT type of column APP_EVENT.APP_EVENT_DT;
|
||||
declare variable F_APP_EVENT_TEXT type of column APP_EVENT.APP_EVENT_TEXT;
|
||||
declare variable F_APP_EVENT_PARAM type of column APP_EVENT.APP_EVENT_PARAM;
|
||||
declare variable F_APP_EVENT_DATA type of column APP_EVENT.APP_EVENT_DATA;
|
||||
declare variable F_APP_EVENT_DEL type of column APP_EVENT.APP_EVENT_DEL;
|
||||
declare variable F_APP_EVENT_IMP type of column APP_EVENT.APP_EVENT_IMP;
|
||||
declare variable F_APP_EVENT_CR type of column APP_EVENT.APP_EVENT_CR;
|
||||
declare variable F_APP_EVENT_WCR type of column APP_EVENT.APP_EVENT_WCR;
|
||||
declare variable F_APP_EVENT_CH type of column APP_EVENT.APP_EVENT_CH;
|
||||
declare variable F_APP_EVENT_WCH type of column APP_EVENT.APP_EVENT_WCH;
|
||||
declare variable F_APP_EVENT_SEANS type of column APP_EVENT.APP_EVENT_SEANS;
|
||||
declare variable F_APP_EVENT_OWNERMST type of column APP_EVENT.APP_EVENT_OWNERMST;
|
||||
declare variable F_APP_EVENT_FIMP type of column APP_EVENT.APP_EVENT_FIMP;
|
||||
declare variable F_APP_EVENT_MPOST type of column APP_EVENT.APP_EVENT_MPOST;
|
||||
|
||||
|
||||
DECLARE VARIABLE CUR_ID_APP_NOTE TYPE OF D_BIGINT;
|
||||
DECLARE VARIABLE CUR_APP_NOTE_ID_SOTR TYPE OF D_BIGINT;
|
||||
DECLARE VARIABLE CUR_APP_NOTE_ID_APP_TASK TYPE OF D_BIGINT;
|
||||
DECLARE VARIABLE CUR_APP_NOTE_STATUS TYPE OF D_SMALLINT;
|
||||
DECLARE VARIABLE CUR_APP_NOTE_TIP TYPE OF D_SMALLINT;
|
||||
DECLARE VARIABLE CUR_APP_NOTE_TEXT TYPE OF D_STR1024;
|
||||
DECLARE VARIABLE CUR_APP_NOTE_DEL TYPE OF D_SMALLINT;
|
||||
DECLARE VARIABLE CUR_APP_NOTE_CR TYPE OF D_DATETIME;
|
||||
DECLARE VARIABLE CUR_APP_NOTE_WCR TYPE OF D_BIGINT;
|
||||
DECLARE VARIABLE CUR_APP_NOTE_CH TYPE OF D_DATETIME;
|
||||
DECLARE VARIABLE CUR_APP_NOTE_WCH TYPE OF D_BIGINT;
|
||||
-- APP_NOTE VARIABLES
|
||||
declare variable NEW_ID_APP_NOTE type of D_BIGINT;
|
||||
declare variable NEW_APP_NOTE_ID_SOTR type of D_BIGINT;
|
||||
declare variable NEW_APP_NOTE_ID_APP_TASK type of D_BIGINT;
|
||||
declare variable NEW_APP_NOTE_STATUS type of D_SMALLINT;
|
||||
declare variable NEW_APP_NOTE_TIP type of D_SMALLINT;
|
||||
declare variable NEW_APP_NOTE_TEXT type of D_STR1024;
|
||||
declare variable NEW_APP_NOTE_DEL type of D_SMALLINT;
|
||||
declare variable NEW_APP_NOTE_CR type of D_DATETIME;
|
||||
declare variable NEW_APP_NOTE_WCR type of D_BIGINT;
|
||||
declare variable NEW_APP_NOTE_CH type of D_DATETIME;
|
||||
declare variable NEW_APP_NOTE_WCH type of D_BIGINT;
|
||||
|
||||
declare variable CUR_ID_APP_NOTE type of D_BIGINT;
|
||||
declare variable CUR_APP_NOTE_ID_SOTR type of D_BIGINT;
|
||||
declare variable CUR_APP_NOTE_ID_APP_TASK type of D_BIGINT;
|
||||
declare variable CUR_APP_NOTE_STATUS type of D_SMALLINT;
|
||||
declare variable CUR_APP_NOTE_TIP type of D_SMALLINT;
|
||||
declare variable CUR_APP_NOTE_TEXT type of D_STR1024;
|
||||
declare variable CUR_APP_NOTE_DEL type of D_SMALLINT;
|
||||
declare variable CUR_APP_NOTE_CR type of D_DATETIME;
|
||||
declare variable CUR_APP_NOTE_WCR type of D_BIGINT;
|
||||
declare variable CUR_APP_NOTE_CH type of D_DATETIME;
|
||||
declare variable CUR_APP_NOTE_WCH type of D_BIGINT;
|
||||
|
||||
declare variable F_OPER type of D_SMALLINT;
|
||||
|
||||
|
@ -47,13 +63,18 @@ begin
|
|||
where A.PARSRV_VID = 1)) then
|
||||
exit;
|
||||
|
||||
select first 1 E.ID_APP_EVENT, E.APP_EVENT_ID_SOTR, E.APP_EVENT_ID_REC, E.APP_EVENT_VID, E.APP_EVENT_DATA
|
||||
select first 1 E.ID_APP_EVENT, E.APP_EVENT_ID_SOTR, E.APP_EVENT_ID_REC, E.APP_EVENT_VID, E.APP_EVENT_TIP,
|
||||
E.APP_EVENT_DT, E.APP_EVENT_TEXT, E.APP_EVENT_PARAM, E.APP_EVENT_DATA, E.APP_EVENT_DEL,
|
||||
E.APP_EVENT_IMP, E.APP_EVENT_CR, E.APP_EVENT_WCR, E.APP_EVENT_CH, E.APP_EVENT_WCH, E.APP_EVENT_SEANS,
|
||||
E.APP_EVENT_OWNERMST, E.APP_EVENT_FIMP, E.APP_EVENT_MPOST
|
||||
from APP_EVENT E
|
||||
where E.ID_APP_EVENT = :IN_ID_APP_EVENT
|
||||
into :CUR_ID_APP_EVENT, :CUR_APP_EVENT_ID_SOTR, :CUR_APP_EVENT_ID_REC, :CUR_APP_EVENT_VID, :CUR_APP_EVENT_DATA;
|
||||
into :F_ID_APP_EVENT, :F_APP_EVENT_ID_SOTR, :F_APP_EVENT_ID_REC, :F_APP_EVENT_VID, :F_APP_EVENT_TIP, :F_APP_EVENT_DT,
|
||||
:F_APP_EVENT_TEXT, :F_APP_EVENT_PARAM, :F_APP_EVENT_DATA, :F_APP_EVENT_DEL, :F_APP_EVENT_IMP, :F_APP_EVENT_CR,
|
||||
:F_APP_EVENT_WCR, :F_APP_EVENT_CH, :F_APP_EVENT_WCH, :F_APP_EVENT_SEANS, :F_APP_EVENT_OWNERMST,
|
||||
:F_APP_EVENT_FIMP, :F_APP_EVENT_MPOST
|
||||
|
||||
if (:CUR_APP_EVENT_VID = 8795 /*Создание уведомления*/ ) then
|
||||
F_OPER := 1;
|
||||
if (:CUR_APP_EVENT_VID = 8795 /*Создание уведомления*/ ) then F_OPER := 1;
|
||||
if (exists(select 1
|
||||
from APP_EVENT E
|
||||
where E.ID_APP_EVENT = :CUR_ID_APP_EVENT)) then
|
||||
|
@ -73,21 +94,14 @@ begin
|
|||
if (:F_OPER = 1) then
|
||||
begin
|
||||
|
||||
|
||||
|
||||
/*Выполняем создание Уведомления*/
|
||||
|
||||
/*Для начала обновим ID_REC в таблице APP_EVENT*/
|
||||
|
||||
|
||||
|
||||
insert into APP_NOTE (ID_APP_NOTE, APP_NOTE_ID_SOTR, APP_NOTE_ID_APP_TASK, APP_NOTE_STATUS, APP_NOTE_TIP,
|
||||
APP_NOTE_TEXT, APP_NOTE_DEL, APP_NOTE_CR, APP_NOTE_WCR, APP_NOTE_CH, APP_NOTE_WCH)
|
||||
values (
|
||||
:cur_id_app_event, :cur_app_event_id_sotr,
|
||||
)
|
||||
end
|
||||
values (:CUR_ID_APP_EVENT, :CUR_APP_EVENT_ID_SOTR, ) end
|
||||
|
||||
/*TODO определить операцию и на ее основе делать FOPER */
|
||||
|
||||
)
|
||||
values ();
|
||||
|
|
Loading…
Reference in New Issue