From d81d5d150926941ffd11345f761d42e4e12c4819 Mon Sep 17 00:00:00 2001 From: Ernest Litvinenko Date: Fri, 5 Jul 2024 00:40:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D1=8C=20=D0=BC=D0=B5=D0=BD=D1=8F=D1=82=D1=8C=20?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D1=82=D1=83=D1=81=D1=8B=20=D1=83=D0=B2=D0=B5?= =?UTF-8?q?=D0=B4=D0=BE=D0=BC=D0=BB=D0=B5=D0=BD=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 32_7.sql | 45 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/32_7.sql b/32_7.sql index 668e623..ff844a9 100644 --- a/32_7.sql +++ b/32_7.sql @@ -52,6 +52,11 @@ declare variable CUR_APP_NOTE_WCH type of D_BIGINT; declare variable F_OPER type of D_SMALLINT; +-- Execute blocks +declare variable EXEC_BLOCK_TEXT_32_NEG_1 type of column EXEC_BLOCKS.EXEC_BLOCKS_TEXT; +declare variable EXEC_BLOCK_32_NEG_1_OUT_KEY type of D_BIGINT; +declare variable EXEC_BLOCK_32_NEG_1_OUT_VAL type of D_STR1024; + begin output = 0;/* 0- Не выполнено, -1 Ошибка*/ -- Находим событие с переданным идентификатором @@ -73,9 +78,27 @@ begin :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; + -- Получаем текст EXEC 32 -1 + select E.EXEC_BLOCKS_TEXT + from EXEC_BLOCKS E + where E.EXEC_BLOCKS_VID = 32 and + E.EXEC_BLOCKS_TIP = -1 and + E.EXEC_BLOCKS_DEL = 0 rows 1 to 1 + into :EXEC_BLOCK_TEXT_32_NEG_1; + if (:EXEC_BLOCK_TEXT_32_NEG_1 is null) then + begin + + output = -1;/*Не найден EXEC BLOCK 32 -1 */ + suspend; + exit; + end + if (:F_APP_EVENT_VID = 8795 /*Создание уведомления*/ ) then F_OPER = 1; else + if (:F_APP_EVENT_VID = 8797) /*Изменение уведомения*/ then + F_OPER = 2; + else begin output = -2;/*Неизвестная операция*/ suspend; @@ -123,9 +146,29 @@ begin NEW_APP_NOTE_CH = F_APP_EVENT_CH; NEW_APP_NOTE_WCH = F_APP_EVENT_WCH; end - + else + if (:F_APP_EVENT_VID = 8797) then + begin + /*Парсим параметры JSON-a APP_EVENT_DATA*/ + for execute statement(:EXEC_BLOCK_TEXT_32_NEG_1)(IN_PARAM_JSON := :F_APP_EVENT_DATA) + into :EXEC_BLOCK_32_NEG_1_OUT_VAL, :EXEC_BLOCK_32_NEG_1_OUT_KEY + do + begin + if (:exec_block_32_neg_1_out_key = 8794) then + begin + NEW_APP_NOTE_STATUS = cast(:exec_block_32_neg_1_out_val as d_integer); + end + end + end end + IF (new_id_app_note is null) then + begin + output = -5; /*Не было создано событие о создании Уведомсления (8795) */ + suspend; + exit; + end + update or 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 (:NEW_ID_APP_NOTE, :NEW_APP_NOTE_ID_SOTR, :NEW_APP_NOTE_ID_APP_TASK, :NEW_APP_NOTE_STATUS, :NEW_APP_NOTE_TIP,