23279 логи почты
|
@ -175,7 +175,7 @@
|
|||
limit 1
|
||||
)
|
||||
```
|
||||
<!-- ### Примеры запросов
|
||||
### Примеры запросов
|
||||
|
||||
#### Просроченные документы
|
||||
|
||||
|
@ -226,6 +226,8 @@
|
|||
|
||||
??? note "Запрос"
|
||||
|
||||
![alt text](media/image-24.png)
|
||||
|
||||
Основной запрос:
|
||||
|
||||
Итоговая выборка:
|
||||
|
@ -299,6 +301,8 @@
|
|||
|
||||
??? note "Запрос"
|
||||
|
||||
![alt text](media/image-25.png)
|
||||
|
||||
Основной запрос:
|
||||
|
||||
Итоговая выборка:
|
||||
|
@ -333,6 +337,8 @@
|
|||
|
||||
??? note "Запрос"
|
||||
|
||||
![alt text](media/image-26.png)
|
||||
|
||||
Основной запрос:
|
||||
|
||||
Итоговая выборка:
|
||||
|
@ -366,6 +372,8 @@
|
|||
|
||||
??? note "Запрос"
|
||||
|
||||
![alt text](media/image-27.png)
|
||||
|
||||
Основной запрос:
|
||||
|
||||
```sql
|
||||
|
@ -603,6 +611,8 @@
|
|||
|
||||
??? note "Запрос"
|
||||
|
||||
![alt text](media/image-29.png)
|
||||
|
||||
Основной запрос:
|
||||
|
||||
```sql
|
||||
|
@ -1235,4 +1245,103 @@
|
|||
join comdoc."VFilials" f on p."COrg" = f."VCode"
|
||||
where now()::date between coalesce(p."BeginDate",'19700101') and coalesce(p."EndDate",'20700101')
|
||||
;
|
||||
``` -->
|
||||
```
|
||||
|
||||
#### Аналитическая форма по расписанию задач
|
||||
|
||||
??? note "Запрос"
|
||||
|
||||
![alt text](media/image-28.png)
|
||||
|
||||
Основной запрос:
|
||||
|
||||
```sql
|
||||
INSERT INTO "tmp_calcWithBaseParams_for_documentStatusJournalProc"( "DocCode" )
|
||||
select null;
|
||||
```
|
||||
|
||||
Итоговая выборка:
|
||||
|
||||
```sql
|
||||
insert into "tmp_finresult"( "DocCode" , "DocType" , "DocForm" , "DocTypeName", "DocName", "DocumentDate",
|
||||
"AnyColumnA" , "AnyColumnB" , "AnyColumnC" , "AnyColumnD" , "AnyColumnE",
|
||||
"AnyColumnF", "AnyColumnG", "AnyColumnH", "AnyColumnI", "AnyColumnJ")
|
||||
|
||||
select dd."Id", 'task'::text, 'taskForm'::text, ('Шедулер' || dd."Name")::text, 'Планировщик задач ' ||dd."Name" , dd."CDate"::date,
|
||||
dd."Name" as "AnyColumnA" , dd."Description" as "AnyColumnB" ,
|
||||
dd."Minutes" as "AnyColumnC" , dd."Hours" as "AnyColumnD" , dd."Days" as "AnyColumnE" , dd."Months" as "AnyColumnF" , dd."DaysOfTheWeek" as "AnyColumnG" ,dd. "Note" as "AnyColumnH" ,dd. "TypeTask" as "AnyColumnI"
|
||||
, sum(comdoc."datediff"('minute',j."TimeStart" , j."TimeEnd"))/ count(j."Id") as "AnyColumnJ"
|
||||
from (
|
||||
select t."Id", t."Name", t."Description",
|
||||
sh."Crontab",
|
||||
max(case when s."VCode" = 1 then s."PartString" else '' end) as "Minutes",
|
||||
max(case when s."VCode" = 2 then s."PartString" else '' end) as "Hours",
|
||||
max(case when s."VCode" = 3 then s."PartString" else '' end) as "Days",
|
||||
max(case when s."VCode" = 4 then s."PartString" else '' end) as "Months",
|
||||
max(case when s."VCode" = 5 then s."PartString" else '' end) as "DaysOfTheWeek",
|
||||
'по гринвичу' as "Note", 'Шедулер' as "TypeTask", t."CDate"
|
||||
from lex."Task" t
|
||||
join lex."Schedule" sh on t."Id" = sh."Parent"
|
||||
LEFT JOIN LATERAL comdoc."LexStringToListNew"(replace(sh."Crontab",' ','Ё'),'Ё',0) s on true
|
||||
join (select 1 as "VCode", 'мин.' as "Name"
|
||||
union all
|
||||
select 2 as "VCode", 'часы' as "Name"
|
||||
union all
|
||||
select 3 as "VCode", 'день' as "Name"
|
||||
union all
|
||||
select 4 as "VCode", 'месяц' as "Name"
|
||||
union all
|
||||
select 5 as "VCode", 'дни недели' as "Name"
|
||||
) d on s."VCode" = d."VCode"
|
||||
|
||||
-- inner join lex."StepJournalEntryDetail" s on j."Id" = s."PCode"
|
||||
where coalesce(t."Toggle",false) = true
|
||||
group by t."Id", t."Name", t."Description", sh."Crontab", t."CDate"
|
||||
)dd
|
||||
left join lex."TaskJournalEntry" j on dd."Id" = j."TaskId" and j."TimeStart">= now()::date - '1 month'::interval and j."TimeEnd" is not null
|
||||
--where j."TimeStart">= now()::date - '1 month'::interval and j."TimeEnd" is not null
|
||||
group by dd."Id", dd."Name", dd."Description", dd."Crontab", "Minutes", "Hours", "Days", "Months", "DaysOfTheWeek", "Note", "TypeTask", dd."CDate"
|
||||
|
||||
union all
|
||||
select t."VCode", 'NotificationLexemaDirectory'::text, 'NotificationLexemaDirectoryForm'::text , '', ( 'Задачи планировщика ' ||t."TaskName") ::text, t."CDate"::date,
|
||||
t."TaskName" as "AnyColumnA" , null::text as "AnyColumnB" ,
|
||||
t."Minutes" as "AnyColumnC" , t."Hours" as "AnyColumnD" , t."Days" as "AnyColumnE" , t."Months" as "AnyColumnF" , t."DaysOfTheWeek" as "AnyColumnG" ,'серверное время' as "AnyColumnH" ,'Задачи планировщика' as "AnyColumnI",
|
||||
null::int as "AnyColumnJ"
|
||||
from dfd."NotificationLexemaDirectory" t
|
||||
where coalesce(t."Included",false) = true;
|
||||
```
|
||||
|
||||
#### Логи отправки почты и СМС
|
||||
|
||||
Необходимо дополнительно настроить [задачу планировщика](../Функции%20планировщика%20задач/#перенос_логов_отправки_почты_и_смс_в_таблицу_sendlog)
|
||||
|
||||
??? note "Запрос"
|
||||
|
||||
![alt text](media/image-30.png)
|
||||
|
||||
Основной запрос:
|
||||
|
||||
```sql
|
||||
INSERT INTO "tmp_calcWithBaseParams_for_documentStatusJournalProc"( "DocCode")
|
||||
select 1 from dfd."OutgoingEmailLog" where 1 = 1
|
||||
limit 1;
|
||||
```
|
||||
|
||||
Итоговая выборка:
|
||||
|
||||
```sql
|
||||
do $myQ$
|
||||
declare _str text;
|
||||
begin
|
||||
_str := '
|
||||
insert into "tmp_finresult"("AnyColumnA", "AnyColumnB", "AnyColumnC", "AnyColumnD", "AnyColumnE", "AnyColumnF", "AnyColumnG", "AnyColumnH", "AnyColumnI", "AnyColumnJ", "AnyColumnK", "AnyColumnL", "AnyColumnM")
|
||||
select p."Level", p."type", p."To", p."Subject", p."Body", p."Cc", p."Bcc", p."phones", p."text", p."errorText",
|
||||
to_char(p."CDateLog",''DD.MM.YYYY hh:mi'') as "CDateLog", p."CUserLog", p."CHostLog"
|
||||
from comdoc."SendLog" p
|
||||
where coalesce( p."CDateLog"::date,'_bdate'::date) between '_bdate'::date and '_edate'::date
|
||||
order by p."CDateLog" desc'
|
||||
_topcount ;
|
||||
execute _str;
|
||||
end;
|
||||
$myQ$;
|
||||
```
|
||||
|
|
After Width: | Height: | Size: 33 KiB |
After Width: | Height: | Size: 43 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 35 KiB |
After Width: | Height: | Size: 131 KiB |
After Width: | Height: | Size: 43 KiB |
|
@ -255,6 +255,8 @@ search:
|
|||
|
||||
### Документы, не пришедшие из 1с
|
||||
|
||||
??? Задача
|
||||
|
||||
```sql
|
||||
with "no1c"
|
||||
as
|
||||
|
@ -314,11 +316,12 @@ from "no1c" dd
|
|||
and rl."DocTypes" ilike '%NotificationLexema%'
|
||||
join comdoc."ReadListGroupUsers" rlU on rl."VCode" = rlU."PCode"*/
|
||||
--group by rlU."DocflowUser"
|
||||
|
||||
```
|
||||
|
||||
### Задача по изменению фамилии в карточке пользователя + склонение в карточке физического лица
|
||||
|
||||
??? Задача
|
||||
|
||||
```sql
|
||||
do $$
|
||||
begin
|
||||
|
@ -359,6 +362,8 @@ $$;
|
|||
|
||||
### Оповещение о необходимости замены паспорта
|
||||
|
||||
??? Задача
|
||||
|
||||
```sql
|
||||
insert into "#forInsNotification" ("DocflowUser", "txt", "Link", "DocType", "DocName", "DocSubject", "IdWorker")
|
||||
select distinct pc."Code" , '<font size="3"> <b>Настоящим сообщаем, что приближается срок замены паспорта </b> <br/>' || '</font>' ,
|
||||
|
@ -381,6 +386,8 @@ where (
|
|||
|
||||
### Оповещение о списке работников, которые не создали заявление об отпуске из уведомления
|
||||
|
||||
??? Задача
|
||||
|
||||
```sql
|
||||
with list as (
|
||||
select ud."VCode", ud."IdWorker", atr."Value" as "Vacation", to_char(atrD."DateValue",'DD.MM.YYYY') as "DateBeg" , f."Name" as "COrgName"
|
||||
|
@ -423,6 +430,8 @@ d."data" | Список | #query_list#
|
|||
|
||||
### Отсутствие планового графика отпусков по подразделению
|
||||
|
||||
??? Задача
|
||||
|
||||
```sql
|
||||
with "chiefStruct" as
|
||||
(select * from vac."SendingLateApplicationNotice"())
|
||||
|
@ -461,17 +470,12 @@ replace(replace(
|
|||
inner join comdoc."DocflowUser" du on main."ChiefLogin" = du."UserName"
|
||||
group by main."Chief", coalesce(du."FirstName",''), coalesce(du."MiddleName",''), main."ChiefLogin", main."planYear";
|
||||
```
|
||||
### Смена организации по умолчанию при смене основного места работы
|
||||
|
||||
```sql
|
||||
call dfd."updateUsersDefaultOrganization" (null, 'Admin;EVIvaschenko')
|
||||
|
||||
/* 1 - коды исключен физ лиц через ;
|
||||
2 - логины исключения через ; */
|
||||
```
|
||||
|
||||
### Создание отзывов доверенностей МЧД по уволенным
|
||||
|
||||
??? Задача
|
||||
```sql
|
||||
with res as (select * ,
|
||||
'<tr>
|
||||
|
@ -496,3 +500,11 @@ from (select distinct r."DocflowUser", (select string_agg(coalesce(r1."ref_link"
|
|||
таблица.столбец | описание | # для шаблона
|
||||
----------------|----------|--------------
|
||||
d.list | Список документов | #query_list#
|
||||
|
||||
### Перенос логов отправки почты и СМС в таблицу SendLog
|
||||
|
||||
??? Задача
|
||||
|
||||
```sql
|
||||
call comdoc."PostToSendLog"();
|
||||
```
|