From 7019b0a30e2c6b2bf2b262c97af8deec7f5a9281 Mon Sep 17 00:00:00 2001 From: mirzakaev_tf Date: Tue, 16 Jul 2024 12:02:53 +0500 Subject: [PATCH] =?UTF-8?q?=D0=BE=D1=84=D0=BE=D1=80=D0=BC=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/Admin manuals/Настройка архива/index.md | 222 ++++++++++++++----- 1 file changed, 170 insertions(+), 52 deletions(-) diff --git a/docs/Admin manuals/Настройка архива/index.md b/docs/Admin manuals/Настройка архива/index.md index 85c5b5b..b7ad520 100644 --- a/docs/Admin manuals/Настройка архива/index.md +++ b/docs/Admin manuals/Настройка архива/index.md @@ -97,19 +97,176 @@ WHERE 1 = 1 -| Код | Наименование | SQLScript | -|----------------|------------------------|--------------------------------------------------------------------------------------------------| -| Contractor | Контрагент | and exists(
select 1 from "tmp_anFilters_for_documentSearch" as an where an."id" = 'Contractor' and an."value" = cast(t."Contractor" as character varying)) | -| Contract | Договор | and exists(
select 1 from "tmp_anFilters_for_documentSearch" as an where an."id" = 'Contract' and an."value" = cast(t."VCode" as character varying)) | -| Project | Проект | and exists(
select 1 from "tmp_anFilters_for_documentSearch" as an where an."id" = 'Project' and an."value" = cast(t."Project" as character varying)) | -| Curator | Куратор | and(
exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join rp."RP_Worker" w ON t."Manager" = w."VCode"
JOIN rp."RP_Person" AS p ON w."IdPerson" = p."VCode"
JOIN rp."RP_PersonContact" AS pc on p."VCode" = pc."Pcode"
where an."id" = 'Curator'
and pc."IdTypeContact" = 6
and pc."Code" = an."value"
)) | -| StageUser | Участник маршрута | and exists(
select 1 from "tmp_anFilters_for_documentSearch" as an
join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
join comdoc."RouteStage" as s on s."PCode" = r."VCode"
join comdoc."StageItem" as i on i."PCode" = s."VCode"
where an."id" = 'StageUser'
and r."RouteStatus" NOT IN (4)
and i."StageUser" = an."value"
) | -| CUser | Создатель документа | and exists(
select 1 from "tmp_anFilters_for_documentSearch" as an where an."id" = 'CUser' and an."value" = cast(t."CUser" as character varying)) | -| Initiator | Инициатор | and(
exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
where an."id" = 'Initiator'
and r."Initiator" = an."value")) | -| Filial | Организация | and exists( select 1 from "tmp_anFilters_for_documentSearch" as an - where an."id" = 'Filial' - and t."COrg"::text = an."value" - ) | + + + + + + SQL Syntax Highlighting + + + + +

Примеры настраиваемых выборок

+

Настраиваемая выборка для кадрового электронного документооборота

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
КодНаименованиеSQLScript
CUserСоздатель документаand exists( select 1 from "tmp_anFilters_for_documentSearch" as an where an."id" = 'CUser' and an."value" = cast(t."CUser" as character varying) )
InitiatorИнициатор + and(
+ exists(
+ select 1
+ from "tmp_anFilters_for_documentSearch" as an
+ join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
+ where an."id" = 'Initiator'
+ and r."Initiator" = an."value"
+ )
+
StageUserУчастник маршрута + and
+ exists(
+ select 1
+ from "tmp_anFilters_for_documentSearch" as an
+ join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
+ join comdoc."RouteStage" as s on s."PCode" = r."VCode"
+ join comdoc."StageItem" as i on i."PCode" = s."VCode"
+ where an."id" = 'StageUser'
+ and r."RouteStatus" NOT IN (4)
+ and i."StageUser" = an."value"
+ )
+
SignatoryUserРаботник + and(
+ exists(
+ select 1
+ from "tmp_anFilters_for_documentSearch" as an
+ join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
+ where an."id" = 'SignatoryUser'
+ and r."DocType" = 'EmployeeStatement'
+ and r."Initiator" = an."value"
+ ) or exists(
+ select 1
+ from "tmp_anFilters_for_documentSearch" as an
+ join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
+ join comdoc."RouteStage" as s on s."PCode" = r."VCode"
+ join comdoc."StageItem" as i on i."PCode" = s."VCode"
+ where an."id" = 'SignatoryUser'
+ and r."DocType" = 'LND'
+ AND r."RouteStatus" NOT IN(4)
+ AND s."IsMarked" IS NOT true
+ AND COALESCE(i."DocumentAction", 0) IN (20, 30)
+ and i."StageUser" = an."value"
+ ) or exists(
+ select 1
+ from "tmp_anFilters_for_documentSearch" as an
+ join comdoc."ReadListItem" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
+ where an."id" = 'SignatoryUser'
+ and r."DocType" = 'LND'
+ and r."DocflowUser" = an."value"
+ ) or exists(
+ select 1
+ from "tmp_anFilters_for_documentSearch" as an
+ join dfd."EmpowermentWorkerDetail" as ewd on ewd."PCode" = t."VCode"
+ JOIN rp."RP_Person" AS p ON ewd."PersonId" = p."VCode"
+ JOIN rp."RP_PersonContact" AS pc on p."VCode" = pc."Pcode"
+ where an."id" = 'SignatoryUser'
+ and t."TypeName" = 'EmpowermentConstructor'
+ and pc."IdTypeContact" = 6
+ and pc."Code" = an."value"
+ ) + ) +
+
EmpowermentSubjectПолномочия + and
+ exists(
+ select 1
+ from "tmp_anFilters_for_documentSearch" as an
+ join dfd."EmpowermentSubjectDetail" as esd on esd."PCode" = t."VCode"
+ JOIN dfd."EmpowermentSubject" AS s ON esd."Subject" = s."VCode"
+ where an."id" = 'EmpowermentSubject'
+ and t."TypeName" = 'EmpowermentConstructor'
+ and s."VCode" = an."value"::bigint
+ ) +
+
FilialОрганизация + and exists(
+ select 1
+ from "tmp_anFilters_for_documentSearch" as an
+ where an."id" = 'Filial'
+ and t."COrg"::text = an."value"
+ ) +
+
+ + + | ## Настройка документов @@ -119,45 +276,6 @@ WHERE 1 = 1 ## Примеры настраиваемых выборок -### Настраиваемая выборка для кадрового электронного документооборота - -| Код | Наименование | SQLScript | -|--------------------|------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| CUser | Создатель документа | and exists( select 1 from "tmp_anFilters_for_documentSearch" as an where an."id" = 'CUser' and an."value" = cast(t."CUser" as character varying)) | -| Initiator | Инициатор | and(
exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
where an."id" = 'Initiator'
and r."Initiator" = an."value"
)) | -| StageUser | Участник маршрута | and
exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
join comdoc."RouteStage" as s on s."PCode" = r."VCode"
join comdoc."StageItem" as i on i."PCode" = s."VCode"
where an."id" = 'StageUser'
and r."RouteStatus" NOT IN (4)
and i."StageUser" = an."value"
) | -| SignatoryUser | Работник | and(
exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
where an."id" = 'SignatoryUser'
and r."DocType" = 'EmployeeStatement'
and r."Initiator" = an."value"
) or exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join comdoc."Route" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
join comdoc."RouteStage" as s on s."PCode" = r."VCode"
join comdoc."StageItem" as i on i."PCode" = s."VCode"
where an."id" = 'SignatoryUser'
and r."DocType" = 'LND'
AND r."RouteStatus" NOT IN(4)
AND s."IsMarked" IS NOT true
AND COALESCE(i."DocumentAction", 0) IN (20, 30)
and i."StageUser" = an."value"
) or exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join comdoc."ReadListItem" as r on r."DocCode" = t."VCode" and r."DocType" = t."TypeName"
where an."id" = 'SignatoryUser'
and r."DocType" = 'LND'
and r."DocflowUser" = an."value"
) or exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join dfd."EmpowermentWorkerDetail" as ewd on ewd."PCode" = t."VCode"
JOIN rp."RP_Person" AS p ON ewd."PersonId" = p."VCode"
JOIN rp."RP_PersonContact" AS pc on p."VCode" = pc."Pcode"
where an."id" = 'SignatoryUser'
and t."TypeName" = 'EmpowermentConstructor'
and pc."IdTypeContact" = 6
and pc."Code" = an."value"
)) | -| EmpowermentSubject | Полномочия | and
exists(
select 1
from "tmp_anFilters_for_documentSearch" as an
join dfd."EmpowermentSubjectDetail" as esd on esd."PCode" = t."VCode"
JOIN dfd."EmpowermentSubject" AS s ON esd."Subject" = s."VCode"
where an."id" = 'EmpowermentSubject'
and t."TypeName" = 'EmpowermentConstructor'
and s."VCode" = an."value"::bigint
)
| -Filial | Организация | and exists( select 1 from "tmp_anFilters_for_documentSearch" as an where an."id" = 'Filial' and t."COrg"::text = an."value" )| - -```sql -SELECT t."VCode" AS "DocCode" - , t."TypeName" AS "DocType" - , :DateProperty AS "DocDate" - , :NumberProperty AS "DocNumber" - , NULL::bigint AS "ContractorId" - , NULL::bigint AS "ContractId" - , NULL::bigint AS "AddContractId" - , NULL::bigint AS "ProjectId" -FROM dfd."UniversalDocument" as t -WHERE 1 = 1 - -``` - -**В правую часть:** - -```sql -SELECT t."VCode" AS "DocCode" - , t."TypeName" AS "DocType" - , :DateProperty AS "DocDate" - , :NumberProperty AS "DocNumber" - , NULL AS "DocName" - , NULL AS "DocTheme" - , NULL AS "DocDefinition" -FROM dfd."UniversalDocument" as t -WHERE 1 = 1 -``` - ### Настраиваемая выборка "Приложение" | Код | Наименование | SQLScript |