<?xml version="1.0" encoding="utf-8"?>
<Entity 
Schema="RDS" 
Name="EXPORT_FRLLO" 
Description="Выгрузка данных в ФРЛЛО" 
PrimaryKey="ExportFrlloID">
  <Fields>
    <Attribute Name="ExportFrlloID" Type="guid" Description="Идентификатор" />
    <Parent Name="Entities" Type="VCLib.ENTITIES" Description="Сущность метаданных" Required="1" />
    <Parent Name="Users" Type="RDS.USERS" Description="Пользователи системы" Required="1" />
    <Attribute Name="MainCondition" Type="text" Description="Главный фильтр" />
    <Attribute Name="ActualDate" Type="date" Description="Дата актуальности" Required="1" />
    <Attribute Name="ChildCondition" Type="text" Description="Фильтр льгот" />
    <Child Name="ExportFrlloDatas" Type="RDS.EXPORT_FRLLO_DATA" Description="Выгруженные в ФРЛЛО данные" ChildAttribute="ExportFrllo" />
    <Choice Name="Status" Description="Статус" Required="1">
      <Item Name="Новый" Index="0" />
      <Item Name="Данные для выгрузки сформированы" Index="1" />
    </Choice>
    <Parent Name="ChildEntities" Type="VCLib.ENTITIES" Description="Сущность метаданных(льготы)" />
    <Child Name="FrlloMessages" Type="RDS.FRLLO_MESSAGE" Description="Сообщение в ФРЛЛО" ChildAttribute="ExportFrllo" />
    <Attribute Name="ItemsCount" Type="int" Description="Всего элементов" />
    <Attribute Name="SuccessItemsCount" Type="int" Description="Количество успешно загруженных элементов" />
    <Attribute Name="ErrorItemsCount" Type="int" Description="Количество элементов с ошибками" />
    <Attribute Name="CreateDateTime" Type="datetime" Description="Дата и время создания" Required="1" />
  </Fields>
  <DbMapping>
    <Table name="T_EXPORT_FRLLO">
      <Map Name="ExportFrlloID" Column="ExportFrlloID" />
      <Map Name="Entities" Column="Entities" />
      <Map Name="Users" Column="Users" />
      <Map Name="MainCondition" Column="MainCondition" />
      <Map Name="ActualDate" Column="ActualDate" />
      <Map Name="ChildCondition" Column="ChildCondition" />
      <Map Name="Status" Column="Status" />
      <Map Name="ChildEntities" Column="ChildEntities" />
      <Map Name="CreateDateTime" Column="CreateDateTime" />
    </Table>
    <Lexem>
      <Map Name="ItemsCount">
        <lx:QueryValue entity="RDS.EXPORT_FRLLO_DATA" top="-1" offset="0" hints="" xmlns:lx="lexem">
          <condition>
            <lx:Criteria type="And">
              <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="ExportFrllo" />
                </lx:Path>
                <lx:Path OwnerQueryLevel="1">
                  <lx:StepString name="ExportFrlloID" />
                </lx:Path>
              </lx:Criterion>
              <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="Type" />
                </lx:Path>
                <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="Type" type="Int32" PrimaryKey="0" />
              </lx:Criterion>
            </lx:Criteria>
          </condition>
          <value>
            <lx:LexemList>
              <lx:Count />
            </lx:LexemList>
          </value>
        </lx:QueryValue>
      </Map>
      <Map Name="SuccessItemsCount">
        <lx:QueryValue entity="RDS.EXPORT_FRLLO_DATA" top="-1" offset="0" xmlns:lx="lexem">
          <condition>
            <lx:Criteria type="And">
              <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="ExportFrllo" />
                </lx:Path>
                <lx:Path OwnerQueryLevel="1">
                  <lx:StepString name="ExportFrlloID" />
                </lx:Path>
              </lx:Criterion>
              <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="Type" />
                </lx:Path>
                <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="Type" type="Int32" PrimaryKey="0" />
              </lx:Criterion>
              <lx:Criterion not="1" type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="FrlloStatus" />
                </lx:Path>
                <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="400" />
              </lx:Criterion>
              <lx:Criterion not="1" type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="FrlloStatus" />
                </lx:Path>
                <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="1" />
              </lx:Criterion>
            </lx:Criteria>
          </condition>
          <value>
            <lx:LexemList>
              <lx:Count />
            </lx:LexemList>
          </value>
        </lx:QueryValue>
      </Map>
      <Map Name="ErrorItemsCount">
        <lx:QueryValue entity="RDS.EXPORT_FRLLO_DATA" top="-1" offset="0" xmlns:lx="lexem">
          <condition>
            <lx:Criteria type="And">
              <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="ExportFrllo" />
                </lx:Path>
                <lx:Path OwnerQueryLevel="1">
                  <lx:StepString name="ExportFrlloID" />
                </lx:Path>
              </lx:Criterion>
              <lx:Criterion type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="Type" />
                </lx:Path>
                <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="Type" type="Int32" PrimaryKey="0" />
              </lx:Criterion>
              <lx:Criterion not="1" type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="FrlloStatus" />
                </lx:Path>
                <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="200" />
              </lx:Criterion>
              <lx:Criterion not="1" type="=">
                <lx:Path OwnerQueryLevel="0">
                  <lx:StepString name="FrlloStatus" />
                </lx:Path>
                <lx:ChoiceOperand Entity="RDS.EXPORT_FRLLO_DATA" AttributeName="FrlloStatus" type="Int32" PrimaryKey="208" />
              </lx:Criterion>
            </lx:Criteria>
          </condition>
          <value>
            <lx:LexemList>
              <lx:Count />
            </lx:LexemList>
          </value>
        </lx:QueryValue>
      </Map>
    </Lexem>
  </DbMapping>
</Entity>