fluig/compras_digital/workflow/.resources/Solicitação de compras V2.ecm30.xml
2026-05-08 15:30:25 -03:00

1568 lines
61 KiB
XML

<list>
<ProcessDefinition>
<processDefinitionPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
</processDefinitionPK>
<processDescription>Solicitação de compra - Ginseng</processDescription>
<instruction>Este flow permite abertura de solicitação de compras automatizadas, informando qual item será comprado e direcionado para as aprovações corretas.</instruction>
<active>true</active>
<publicProcess>false</publicProcess>
<volumeId>Default</volumeId>
<categoryId>Compras - Testes</categoryId>
<managerEngineAllocationId></managerEngineAllocationId>
<managerEngineAllocationConfiguration>&lt;AssignmentController&gt;&lt;Group&gt;TIC&lt;/Group&gt;&lt;/AssignmentController&gt;</managerEngineAllocationConfiguration>
<snapshotFrequency>0</snapshotFrequency>
<baseDay>0</baseDay>
<baseMonth>0</baseMonth>
<periodId>Default</periodId>
<uniqueCardVersion>false</uniqueCardVersion>
<keyWord></keyWord>
<complementsLevel>1</complementsLevel>
<notifyRequisitionerComplements>true</notifyRequisitionerComplements>
<notifyManagerComplements>false</notifyManagerComplements>
<deadlineTime>0</deadlineTime>
<warningDeadlineTime>0</warningDeadlineTime>
<notifyAuthorityComplements>true</notifyAuthorityComplements>
</ProcessDefinition>
<ProcessDefinitionVersion>
<processDefinitionVersionPK>
<companyId>1</companyId>
<processId>Solicitação de compra - Ginseng</processId>
<version>89</version>
</processDefinitionVersionPK>
<versionDescription></versionDescription>
<formId>9305</formId>
<editionMode>true</editionMode>
<updateAttachmentsVersion>false</updateAttachmentsVersion>
<controlsAttachmentsSecurity>false</controlsAttachmentsSecurity>
<active>true</active>
<blockedVersion>false</blockedVersion>
<counterSign>false</counterSign>
<openInstances>0</openInstances>
<bpmnVersion>2</bpmnVersion>
<processStates/>
<favorito>false</favorito>
<inheritFormSecurity>false</inheritFormSecurity>
<mobileReady>false</mobileReady>
</ProcessDefinitionVersion>
<list>
<ProcessState>
<processStatePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>1</sequence>
</processStatePK>
<stateName>Solicitar compra</stateName>
<stateDescription>Solicitar compra</stateDescription>
<instruction>Inicio da atividade</instruction>
<deadlineTime>0</deadlineTime>
<joint>false</joint>
<agreementPercentage>0</agreementPercentage>
<engineAllocationId></engineAllocationId>
<engineAllocationConfiguration></engineAllocationConfiguration>
<selectColleague>1</selectColleague>
<initialState>true</initialState>
<notifyAuthorityDelay>false</notifyAuthorityDelay>
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
<allowanceAuthorityTime>0</allowanceAuthorityTime>
<frequenceAuthorityTime>0</frequenceAuthorityTime>
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
<transferAttachments>false</transferAttachments>
<subProcessId></subProcessId>
<formFolder>0</formFolder>
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
<notifyRequisitionerFollowUp>true</notifyRequisitionerFollowUp>
<automatic>false</automatic>
<positionX>100</positionX>
<positionY>30</positionY>
<forecastedEffortType>0</forecastedEffortType>
<forecastedEffort>0</forecastedEffort>
<notifyManagerFollowUp>false</notifyManagerFollowUp>
<notifyManagerDelay>false</notifyManagerDelay>
<allowanceManagerTime>0</allowanceManagerTime>
<frequenceManagerTime>0</frequenceManagerTime>
<inhibitTransfer>false</inhibitTransfer>
<periodId>Default</periodId>
<stateType>0</stateType>
<bpmnType>10</bpmnType>
<signalId>0</signalId>
<counterSign>false</counterSign>
<openInstances>0</openInstances>
<noticeExpirationAuthorityTime>0</noticeExpirationAuthorityTime>
<noticeExpirationRequisitionerTime>0</noticeExpirationRequisitionerTime>
<noticeExpirationManagerTime>0</noticeExpirationManagerTime>
<destinationStates/>
<digitalSignature>false</digitalSignature>
</ProcessState>
<ProcessState>
<processStatePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>18</sequence>
</processStatePK>
<stateName>Receber o produto/serviço</stateName>
<stateDescription>Receber o produto/serviço</stateDescription>
<instruction></instruction>
<deadlineTime>604800</deadlineTime>
<deadlineFieldName></deadlineFieldName>
<joint>false</joint>
<agreementPercentage>0</agreementPercentage>
<engineAllocationId>Executor Atividade</engineAllocationId>
<engineAllocationConfiguration>&lt;AssignmentController&gt;&lt;BaseActivity&gt;1&lt;/BaseActivity&gt;&lt;Returns&gt;Last&lt;/Returns&gt;&lt;/AssignmentController&gt;</engineAllocationConfiguration>
<selectColleague>1</selectColleague>
<initialState>false</initialState>
<notifyAuthorityDelay>false</notifyAuthorityDelay>
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
<allowanceAuthorityTime>0</allowanceAuthorityTime>
<frequenceAuthorityTime>0</frequenceAuthorityTime>
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
<transferAttachments>false</transferAttachments>
<subProcessId></subProcessId>
<formFolder>0</formFolder>
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
<notifyRequisitionerFollowUp>true</notifyRequisitionerFollowUp>
<automatic>false</automatic>
<positionX>1440</positionX>
<positionY>13</positionY>
<forecastedEffortType>0</forecastedEffortType>
<forecastedEffort>0</forecastedEffort>
<notifyManagerFollowUp>false</notifyManagerFollowUp>
<notifyManagerDelay>false</notifyManagerDelay>
<allowanceManagerTime>0</allowanceManagerTime>
<frequenceManagerTime>0</frequenceManagerTime>
<inhibitTransfer>false</inhibitTransfer>
<periodId></periodId>
<stateType>0</stateType>
<bpmnType>80</bpmnType>
<signalId>0</signalId>
<counterSign>false</counterSign>
<openInstances>0</openInstances>
<noticeExpirationAuthorityTime>0</noticeExpirationAuthorityTime>
<noticeExpirationRequisitionerTime>0</noticeExpirationRequisitionerTime>
<noticeExpirationManagerTime>0</noticeExpirationManagerTime>
<destinationStates/>
<digitalSignature>false</digitalSignature>
<executionType>0</executionType>
</ProcessState>
<ProcessState>
<processStatePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>24</sequence>
</processStatePK>
<stateName>Verificar problema</stateName>
<stateDescription>Verificar problema</stateDescription>
<instruction></instruction>
<deadlineTime>172800</deadlineTime>
<deadlineFieldName></deadlineFieldName>
<joint>false</joint>
<agreementPercentage>0</agreementPercentage>
<engineAllocationId>Pool Grupo</engineAllocationId>
<engineAllocationConfiguration>&lt;AssignmentController&gt;&lt;Group&gt;ComprasIndiretos&lt;/Group&gt;&lt;/AssignmentController&gt;</engineAllocationConfiguration>
<selectColleague>1</selectColleague>
<initialState>false</initialState>
<notifyAuthorityDelay>false</notifyAuthorityDelay>
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
<allowanceAuthorityTime>0</allowanceAuthorityTime>
<frequenceAuthorityTime>0</frequenceAuthorityTime>
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
<transferAttachments>false</transferAttachments>
<subProcessId></subProcessId>
<formFolder>0</formFolder>
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
<notifyRequisitionerFollowUp>true</notifyRequisitionerFollowUp>
<automatic>false</automatic>
<positionX>1560</positionX>
<positionY>330</positionY>
<forecastedEffortType>0</forecastedEffortType>
<forecastedEffort>0</forecastedEffort>
<notifyManagerFollowUp>false</notifyManagerFollowUp>
<notifyManagerDelay>false</notifyManagerDelay>
<allowanceManagerTime>0</allowanceManagerTime>
<frequenceManagerTime>0</frequenceManagerTime>
<inhibitTransfer>false</inhibitTransfer>
<periodId></periodId>
<stateType>0</stateType>
<bpmnType>80</bpmnType>
<signalId>0</signalId>
<counterSign>false</counterSign>
<openInstances>0</openInstances>
<noticeExpirationAuthorityTime>0</noticeExpirationAuthorityTime>
<noticeExpirationRequisitionerTime>0</noticeExpirationRequisitionerTime>
<noticeExpirationManagerTime>0</noticeExpirationManagerTime>
<destinationStates/>
<digitalSignature>false</digitalSignature>
<executionType>0</executionType>
</ProcessState>
<ProcessState>
<processStatePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>73</sequence>
</processStatePK>
<stateName>Tratar erro</stateName>
<stateDescription>Tratar erro</stateDescription>
<instruction></instruction>
<deadlineTime>0</deadlineTime>
<deadlineFieldName></deadlineFieldName>
<joint>false</joint>
<agreementPercentage>0</agreementPercentage>
<engineAllocationId>Pool Grupo</engineAllocationId>
<engineAllocationConfiguration>&lt;AssignmentController&gt;&lt;Group&gt;TIC&lt;/Group&gt;&lt;/AssignmentController&gt;</engineAllocationConfiguration>
<selectColleague>1</selectColleague>
<initialState>false</initialState>
<notifyAuthorityDelay>true</notifyAuthorityDelay>
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
<allowanceAuthorityTime>3600</allowanceAuthorityTime>
<frequenceAuthorityTime>3600</frequenceAuthorityTime>
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
<transferAttachments>false</transferAttachments>
<subProcessId></subProcessId>
<formFolder>0</formFolder>
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
<notifyRequisitionerFollowUp>false</notifyRequisitionerFollowUp>
<automatic>false</automatic>
<positionX>970</positionX>
<positionY>640</positionY>
<forecastedEffortType>0</forecastedEffortType>
<forecastedEffort>0</forecastedEffort>
<notifyManagerFollowUp>false</notifyManagerFollowUp>
<notifyManagerDelay>false</notifyManagerDelay>
<allowanceManagerTime>0</allowanceManagerTime>
<frequenceManagerTime>0</frequenceManagerTime>
<inhibitTransfer>false</inhibitTransfer>
<periodId></periodId>
<stateType>0</stateType>
<bpmnType>80</bpmnType>
<signalId>0</signalId>
<counterSign>false</counterSign>
<openInstances>0</openInstances>
<noticeExpirationAuthorityTime>0</noticeExpirationAuthorityTime>
<noticeExpirationRequisitionerTime>0</noticeExpirationRequisitionerTime>
<noticeExpirationManagerTime>0</noticeExpirationManagerTime>
<destinationStates/>
<digitalSignature>false</digitalSignature>
<executionType>0</executionType>
</ProcessState>
<ProcessState>
<processStatePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>82</sequence>
</processStatePK>
<stateName>Enviar SC</stateName>
<stateDescription>Enviar SC</stateDescription>
<instruction></instruction>
<deadlineTime>0</deadlineTime>
<deadlineFieldName></deadlineFieldName>
<joint>false</joint>
<agreementPercentage>0</agreementPercentage>
<selectColleague>1</selectColleague>
<initialState>false</initialState>
<notifyAuthorityDelay>false</notifyAuthorityDelay>
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
<allowanceAuthorityTime>0</allowanceAuthorityTime>
<frequenceAuthorityTime>0</frequenceAuthorityTime>
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
<transferAttachments>false</transferAttachments>
<subProcessId></subProcessId>
<formFolder>0</formFolder>
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
<notifyRequisitionerFollowUp>false</notifyRequisitionerFollowUp>
<automatic>false</automatic>
<positionX>560</positionX>
<positionY>632</positionY>
<forecastedEffortType>0</forecastedEffortType>
<forecastedEffort>0</forecastedEffort>
<notifyManagerFollowUp>false</notifyManagerFollowUp>
<notifyManagerDelay>false</notifyManagerDelay>
<allowanceManagerTime>0</allowanceManagerTime>
<frequenceManagerTime>0</frequenceManagerTime>
<inhibitTransfer>false</inhibitTransfer>
<periodId></periodId>
<stateType>0</stateType>
<bpmnType>82</bpmnType>
<signalId>0</signalId>
<counterSign>false</counterSign>
<openInstances>0</openInstances>
<noticeExpirationAuthorityTime>0</noticeExpirationAuthorityTime>
<noticeExpirationRequisitionerTime>0</noticeExpirationRequisitionerTime>
<noticeExpirationManagerTime>0</noticeExpirationManagerTime>
<destinationStates/>
<digitalSignature>false</digitalSignature>
<executionType>1</executionType>
</ProcessState>
<ProcessState>
<processStatePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>114</sequence>
</processStatePK>
<stateName>Integrador Cotação</stateName>
<stateDescription>Integrador Cotação</stateDescription>
<instruction></instruction>
<deadlineTime>0</deadlineTime>
<deadlineFieldName></deadlineFieldName>
<joint>false</joint>
<agreementPercentage>0</agreementPercentage>
<selectColleague>1</selectColleague>
<initialState>false</initialState>
<notifyAuthorityDelay>false</notifyAuthorityDelay>
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
<allowanceAuthorityTime>0</allowanceAuthorityTime>
<frequenceAuthorityTime>0</frequenceAuthorityTime>
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
<transferAttachments>false</transferAttachments>
<subProcessId></subProcessId>
<formFolder>0</formFolder>
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
<notifyRequisitionerFollowUp>false</notifyRequisitionerFollowUp>
<automatic>false</automatic>
<positionX>560</positionX>
<positionY>225</positionY>
<forecastedEffortType>0</forecastedEffortType>
<forecastedEffort>0</forecastedEffort>
<notifyManagerFollowUp>false</notifyManagerFollowUp>
<notifyManagerDelay>false</notifyManagerDelay>
<allowanceManagerTime>0</allowanceManagerTime>
<frequenceManagerTime>0</frequenceManagerTime>
<inhibitTransfer>false</inhibitTransfer>
<periodId></periodId>
<stateType>0</stateType>
<bpmnType>82</bpmnType>
<signalId>0</signalId>
<counterSign>false</counterSign>
<openInstances>0</openInstances>
<noticeExpirationAuthorityTime>0</noticeExpirationAuthorityTime>
<noticeExpirationRequisitionerTime>0</noticeExpirationRequisitionerTime>
<noticeExpirationManagerTime>0</noticeExpirationManagerTime>
<destinationStates/>
<digitalSignature>false</digitalSignature>
<executionType>1</executionType>
</ProcessState>
<ProcessState>
<processStatePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>118</sequence>
</processStatePK>
<stateName>Cotação fora do prazo</stateName>
<stateDescription>Cotação fora do prazo</stateDescription>
<instruction></instruction>
<deadlineTime>0</deadlineTime>
<deadlineFieldName></deadlineFieldName>
<joint>false</joint>
<agreementPercentage>0</agreementPercentage>
<engineAllocationId>Pool Grupo</engineAllocationId>
<engineAllocationConfiguration>&lt;AssignmentController&gt;&lt;Group&gt;ComprasIndiretos&lt;/Group&gt;&lt;/AssignmentController&gt;</engineAllocationConfiguration>
<selectColleague>1</selectColleague>
<initialState>false</initialState>
<notifyAuthorityDelay>true</notifyAuthorityDelay>
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
<allowanceAuthorityTime>3600</allowanceAuthorityTime>
<frequenceAuthorityTime>3600</frequenceAuthorityTime>
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
<transferAttachments>false</transferAttachments>
<subProcessId></subProcessId>
<formFolder>0</formFolder>
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
<notifyRequisitionerFollowUp>false</notifyRequisitionerFollowUp>
<automatic>false</automatic>
<positionX>640</positionX>
<positionY>327</positionY>
<forecastedEffortType>0</forecastedEffortType>
<forecastedEffort>0</forecastedEffort>
<notifyManagerFollowUp>false</notifyManagerFollowUp>
<notifyManagerDelay>false</notifyManagerDelay>
<allowanceManagerTime>0</allowanceManagerTime>
<frequenceManagerTime>0</frequenceManagerTime>
<inhibitTransfer>false</inhibitTransfer>
<periodId></periodId>
<stateType>0</stateType>
<bpmnType>80</bpmnType>
<signalId>0</signalId>
<counterSign>false</counterSign>
<openInstances>0</openInstances>
<noticeExpirationAuthorityTime>0</noticeExpirationAuthorityTime>
<noticeExpirationRequisitionerTime>0</noticeExpirationRequisitionerTime>
<noticeExpirationManagerTime>0</noticeExpirationManagerTime>
<destinationStates/>
<digitalSignature>false</digitalSignature>
<executionType>0</executionType>
</ProcessState>
<ProcessState>
<processStatePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>121</sequence>
</processStatePK>
<stateName>Analisar necessidade de compra</stateName>
<stateDescription>Analisar necessidade de compra</stateDescription>
<instruction></instruction>
<deadlineTime>0</deadlineTime>
<deadlineFieldName></deadlineFieldName>
<joint>false</joint>
<agreementPercentage>0</agreementPercentage>
<engineAllocationId>Campo Formulário</engineAllocationId>
<engineAllocationConfiguration>&lt;AssignmentController&gt;&lt;FormField&gt;gestor_cc&lt;/FormField&gt;&lt;/AssignmentController&gt;</engineAllocationConfiguration>
<selectColleague>1</selectColleague>
<initialState>false</initialState>
<notifyAuthorityDelay>true</notifyAuthorityDelay>
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
<allowanceAuthorityTime>3600</allowanceAuthorityTime>
<frequenceAuthorityTime>3600</frequenceAuthorityTime>
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
<transferAttachments>false</transferAttachments>
<subProcessId></subProcessId>
<formFolder>0</formFolder>
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
<notifyRequisitionerFollowUp>false</notifyRequisitionerFollowUp>
<automatic>false</automatic>
<positionX>460</positionX>
<positionY>100</positionY>
<forecastedEffortType>0</forecastedEffortType>
<forecastedEffort>0</forecastedEffort>
<notifyManagerFollowUp>false</notifyManagerFollowUp>
<notifyManagerDelay>false</notifyManagerDelay>
<allowanceManagerTime>0</allowanceManagerTime>
<frequenceManagerTime>0</frequenceManagerTime>
<inhibitTransfer>false</inhibitTransfer>
<periodId></periodId>
<stateType>0</stateType>
<bpmnType>80</bpmnType>
<signalId>0</signalId>
<counterSign>false</counterSign>
<openInstances>0</openInstances>
<noticeExpirationAuthorityTime>0</noticeExpirationAuthorityTime>
<noticeExpirationRequisitionerTime>0</noticeExpirationRequisitionerTime>
<noticeExpirationManagerTime>0</noticeExpirationManagerTime>
<destinationStates/>
<digitalSignature>false</digitalSignature>
<executionType>0</executionType>
</ProcessState>
<ProcessState>
<processStatePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>85</sequence>
</processStatePK>
<stateName>Intermediário</stateName>
<stateDescription>Intermediário</stateDescription>
<instruction>Evento intermediário do processo</instruction>
<deadlineTime>0</deadlineTime>
<joint>false</joint>
<agreementPercentage>0</agreementPercentage>
<engineAllocationId></engineAllocationId>
<engineAllocationConfiguration></engineAllocationConfiguration>
<selectColleague>0</selectColleague>
<initialState>false</initialState>
<notifyAuthorityDelay>true</notifyAuthorityDelay>
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
<allowanceAuthorityTime>1</allowanceAuthorityTime>
<frequenceAuthorityTime>1</frequenceAuthorityTime>
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
<transferAttachments>false</transferAttachments>
<subProcessId></subProcessId>
<formFolder>0</formFolder>
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
<notifyRequisitionerFollowUp>false</notifyRequisitionerFollowUp>
<automatic>false</automatic>
<positionX>630</positionX>
<positionY>662</positionY>
<forecastedEffortType>0</forecastedEffortType>
<forecastedEffort>0</forecastedEffort>
<notifyManagerFollowUp>false</notifyManagerFollowUp>
<notifyManagerDelay>false</notifyManagerDelay>
<frequenceManagerTime>0</frequenceManagerTime>
<inhibitTransfer>false</inhibitTransfer>
<periodId></periodId>
<stateType>0</stateType>
<bpmnType>43</bpmnType>
<signalId>0</signalId>
<counterSign>false</counterSign>
<openInstances>0</openInstances>
<destinationStates/>
<digitalSignature>false</digitalSignature>
<parentSequence>82</parentSequence>
</ProcessState>
<ProcessState>
<processStatePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>117</sequence>
</processStatePK>
<stateName>Intermediário</stateName>
<stateDescription>Intermediário</stateDescription>
<instruction>Evento intermediário do processo</instruction>
<deadlineTime>0</deadlineTime>
<joint>false</joint>
<agreementPercentage>0</agreementPercentage>
<engineAllocationId></engineAllocationId>
<engineAllocationConfiguration></engineAllocationConfiguration>
<selectColleague>0</selectColleague>
<initialState>false</initialState>
<notifyAuthorityDelay>true</notifyAuthorityDelay>
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
<allowanceAuthorityTime>1</allowanceAuthorityTime>
<frequenceAuthorityTime>1</frequenceAuthorityTime>
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
<transferAttachments>false</transferAttachments>
<subProcessId></subProcessId>
<formFolder>0</formFolder>
<notifyAuthorityFollowUp>true</notifyAuthorityFollowUp>
<notifyRequisitionerFollowUp>false</notifyRequisitionerFollowUp>
<automatic>false</automatic>
<positionX>630</positionX>
<positionY>265</positionY>
<forecastedEffortType>0</forecastedEffortType>
<forecastedEffort>0</forecastedEffort>
<notifyManagerFollowUp>false</notifyManagerFollowUp>
<notifyManagerDelay>false</notifyManagerDelay>
<frequenceManagerTime>0</frequenceManagerTime>
<inhibitTransfer>false</inhibitTransfer>
<periodId></periodId>
<stateType>0</stateType>
<bpmnType>43</bpmnType>
<signalId>0</signalId>
<counterSign>false</counterSign>
<openInstances>0</openInstances>
<destinationStates/>
<digitalSignature>false</digitalSignature>
<parentSequence>114</parentSequence>
</ProcessState>
<ProcessState>
<processStatePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>46</sequence>
</processStatePK>
<stateName>Validar compra</stateName>
<stateDescription>Validar compra</stateDescription>
<joint>false</joint>
<initialState>false</initialState>
<transferAttachments>false</transferAttachments>
<subProcessId></subProcessId>
<formFolder>0</formFolder>
<automatic>true</automatic>
<positionX>1580</positionX>
<positionY>5</positionY>
<inhibitTransfer>false</inhibitTransfer>
<stateType>1</stateType>
<bpmnType>120</bpmnType>
<signalId>0</signalId>
<openInstances>0</openInstances>
<destinationStates/>
<digitalSignature>false</digitalSignature>
</ProcessState>
<ProcessState>
<processStatePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>39</sequence>
</processStatePK>
<stateName>Cancelado</stateName>
<stateDescription>Cancelado</stateDescription>
<instruction>Atividade final do processo</instruction>
<deadlineTime>0</deadlineTime>
<joint>false</joint>
<agreementPercentage>0</agreementPercentage>
<engineAllocationId></engineAllocationId>
<engineAllocationConfiguration></engineAllocationConfiguration>
<selectColleague>0</selectColleague>
<initialState>false</initialState>
<notifyAuthorityDelay>true</notifyAuthorityDelay>
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
<allowanceAuthorityTime>0</allowanceAuthorityTime>
<frequenceAuthorityTime>1</frequenceAuthorityTime>
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
<transferAttachments>false</transferAttachments>
<subProcessId></subProcessId>
<formFolder>0</formFolder>
<notifyAuthorityFollowUp>false</notifyAuthorityFollowUp>
<notifyRequisitionerFollowUp>true</notifyRequisitionerFollowUp>
<automatic>false</automatic>
<positionX>360</positionX>
<positionY>126</positionY>
<forecastedEffortType>0</forecastedEffortType>
<forecastedEffort>0</forecastedEffort>
<notifyManagerFollowUp>false</notifyManagerFollowUp>
<notifyManagerDelay>false</notifyManagerDelay>
<allowanceManagerTime>0</allowanceManagerTime>
<frequenceManagerTime>0</frequenceManagerTime>
<inhibitTransfer>false</inhibitTransfer>
<periodId></periodId>
<stateType>6</stateType>
<bpmnType>65</bpmnType>
<signalId>0</signalId>
<counterSign>false</counterSign>
<openInstances>0</openInstances>
<destinationStates/>
<digitalSignature>false</digitalSignature>
</ProcessState>
<ProcessState>
<processStatePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>52</sequence>
</processStatePK>
<stateName>Fim</stateName>
<stateDescription>Fim</stateDescription>
<instruction>Atividade final do processo</instruction>
<deadlineTime>0</deadlineTime>
<joint>false</joint>
<agreementPercentage>0</agreementPercentage>
<engineAllocationId></engineAllocationId>
<engineAllocationConfiguration></engineAllocationConfiguration>
<selectColleague>0</selectColleague>
<initialState>false</initialState>
<notifyAuthorityDelay>true</notifyAuthorityDelay>
<notifyRequisitionerDelay>false</notifyRequisitionerDelay>
<allowanceAuthorityTime>0</allowanceAuthorityTime>
<frequenceAuthorityTime>1</frequenceAuthorityTime>
<allowanceRequisitionerTime>0</allowanceRequisitionerTime>
<frequenceRequisitionerTime>0</frequenceRequisitionerTime>
<transferAttachments>false</transferAttachments>
<subProcessId></subProcessId>
<formFolder>0</formFolder>
<notifyAuthorityFollowUp>false</notifyAuthorityFollowUp>
<notifyRequisitionerFollowUp>false</notifyRequisitionerFollowUp>
<automatic>false</automatic>
<positionX>1670</positionX>
<positionY>41</positionY>
<forecastedEffortType>0</forecastedEffortType>
<forecastedEffort>0</forecastedEffort>
<notifyManagerFollowUp>false</notifyManagerFollowUp>
<notifyManagerDelay>false</notifyManagerDelay>
<allowanceManagerTime>0</allowanceManagerTime>
<frequenceManagerTime>0</frequenceManagerTime>
<inhibitTransfer>false</inhibitTransfer>
<periodId></periodId>
<stateType>6</stateType>
<bpmnType>60</bpmnType>
<signalId>0</signalId>
<counterSign>false</counterSign>
<openInstances>0</openInstances>
<destinationStates/>
<digitalSignature>false</digitalSignature>
</ProcessState>
</list>
<list>
<ConditionProcessState>
<conditionProcessStatePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<expressionOrder>1</expressionOrder>
<version>89</version>
<sequence>46</sequence>
</conditionProcessStatePK>
<condition>hAPI.getCardValue(&quot;validacaoItens&quot;) == &quot;entregue&quot;</condition>
<destinationSequenceId>52</destinationSequenceId>
<conditionType>0</conditionType>
</ConditionProcessState>
<ConditionProcessState>
<conditionProcessStatePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<expressionOrder>2</expressionOrder>
<version>89</version>
<sequence>46</sequence>
</conditionProcessStatePK>
<condition>true</condition>
<destinationSequenceId>24</destinationSequenceId>
<conditionType>0</conditionType>
</ConditionProcessState>
</list>
<list>
<ProcessLink>
<processLinkPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<linkSequence>26</linkSequence>
</processLinkPK>
<actionLabel></actionLabel>
<returnPermited>false</returnPermited>
<initialStateSequence>24</initialStateSequence>
<finalStateSequence>18</finalStateSequence>
<returnLabel></returnLabel>
<name></name>
<automaticLink>false</automaticLink>
<defaultLink>false</defaultLink>
<type>0</type>
</ProcessLink>
<ProcessLink>
<processLinkPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<linkSequence>47</linkSequence>
</processLinkPK>
<actionLabel></actionLabel>
<returnPermited>false</returnPermited>
<initialStateSequence>18</initialStateSequence>
<finalStateSequence>46</finalStateSequence>
<returnLabel></returnLabel>
<name></name>
<automaticLink>false</automaticLink>
<defaultLink>false</defaultLink>
<type>0</type>
</ProcessLink>
<ProcessLink>
<processLinkPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<linkSequence>48</linkSequence>
</processLinkPK>
<actionLabel></actionLabel>
<returnPermited>false</returnPermited>
<initialStateSequence>46</initialStateSequence>
<finalStateSequence>24</finalStateSequence>
<returnLabel></returnLabel>
<name>Reprovar</name>
<automaticLink>false</automaticLink>
<defaultLink>false</defaultLink>
<type>0</type>
</ProcessLink>
<ProcessLink>
<processLinkPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<linkSequence>78</linkSequence>
</processLinkPK>
<actionLabel></actionLabel>
<returnPermited>false</returnPermited>
<initialStateSequence>46</initialStateSequence>
<finalStateSequence>52</finalStateSequence>
<returnLabel></returnLabel>
<name></name>
<automaticLink>false</automaticLink>
<defaultLink>false</defaultLink>
<type>0</type>
</ProcessLink>
<ProcessLink>
<processLinkPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<linkSequence>86</linkSequence>
</processLinkPK>
<actionLabel></actionLabel>
<returnPermited>false</returnPermited>
<initialStateSequence>85</initialStateSequence>
<finalStateSequence>73</finalStateSequence>
<returnLabel></returnLabel>
<name></name>
<automaticLink>false</automaticLink>
<defaultLink>false</defaultLink>
<type>0</type>
</ProcessLink>
<ProcessLink>
<processLinkPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<linkSequence>88</linkSequence>
</processLinkPK>
<actionLabel></actionLabel>
<returnPermited>false</returnPermited>
<initialStateSequence>73</initialStateSequence>
<finalStateSequence>82</finalStateSequence>
<returnLabel></returnLabel>
<name></name>
<automaticLink>false</automaticLink>
<defaultLink>false</defaultLink>
<type>0</type>
</ProcessLink>
<ProcessLink>
<processLinkPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<linkSequence>97</linkSequence>
</processLinkPK>
<actionLabel></actionLabel>
<returnPermited>false</returnPermited>
<finalStateSequence>73</finalStateSequence>
<returnLabel></returnLabel>
<name></name>
<automaticLink>false</automaticLink>
<defaultLink>false</defaultLink>
<type>0</type>
</ProcessLink>
<ProcessLink>
<processLinkPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<linkSequence>119</linkSequence>
</processLinkPK>
<actionLabel></actionLabel>
<returnPermited>false</returnPermited>
<initialStateSequence>117</initialStateSequence>
<finalStateSequence>118</finalStateSequence>
<returnLabel></returnLabel>
<name></name>
<automaticLink>false</automaticLink>
<defaultLink>false</defaultLink>
<type>0</type>
</ProcessLink>
<ProcessLink>
<processLinkPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<linkSequence>120</linkSequence>
</processLinkPK>
<actionLabel></actionLabel>
<returnPermited>false</returnPermited>
<initialStateSequence>118</initialStateSequence>
<finalStateSequence>114</finalStateSequence>
<returnLabel></returnLabel>
<name></name>
<automaticLink>false</automaticLink>
<defaultLink>false</defaultLink>
<type>0</type>
</ProcessLink>
<ProcessLink>
<processLinkPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<linkSequence>124</linkSequence>
</processLinkPK>
<actionLabel>Rejeitar</actionLabel>
<returnPermited>false</returnPermited>
<initialStateSequence>121</initialStateSequence>
<finalStateSequence>39</finalStateSequence>
<returnLabel></returnLabel>
<name></name>
<automaticLink>false</automaticLink>
<defaultLink>false</defaultLink>
<type>0</type>
</ProcessLink>
<ProcessLink>
<processLinkPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<linkSequence>125</linkSequence>
</processLinkPK>
<actionLabel></actionLabel>
<returnPermited>false</returnPermited>
<initialStateSequence>1</initialStateSequence>
<finalStateSequence>121</finalStateSequence>
<returnLabel></returnLabel>
<name></name>
<automaticLink>false</automaticLink>
<defaultLink>false</defaultLink>
<type>0</type>
</ProcessLink>
<ProcessLink>
<processLinkPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<linkSequence>126</linkSequence>
</processLinkPK>
<actionLabel>Aprovar</actionLabel>
<returnPermited>false</returnPermited>
<initialStateSequence>121</initialStateSequence>
<finalStateSequence>82</finalStateSequence>
<returnLabel></returnLabel>
<name></name>
<automaticLink>false</automaticLink>
<defaultLink>false</defaultLink>
<type>0</type>
</ProcessLink>
<ProcessLink>
<processLinkPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<linkSequence>127</linkSequence>
</processLinkPK>
<actionLabel></actionLabel>
<returnPermited>false</returnPermited>
<initialStateSequence>82</initialStateSequence>
<finalStateSequence>114</finalStateSequence>
<returnLabel></returnLabel>
<name></name>
<automaticLink>false</automaticLink>
<defaultLink>false</defaultLink>
<type>0</type>
</ProcessLink>
<ProcessLink>
<processLinkPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<linkSequence>161</linkSequence>
</processLinkPK>
<actionLabel>Ajustar Solicitação</actionLabel>
<returnPermited>false</returnPermited>
<initialStateSequence>121</initialStateSequence>
<finalStateSequence>1</finalStateSequence>
<returnLabel></returnLabel>
<name></name>
<automaticLink>false</automaticLink>
<defaultLink>false</defaultLink>
<type>0</type>
</ProcessLink>
<ProcessLink>
<processLinkPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<linkSequence>162</linkSequence>
</processLinkPK>
<actionLabel></actionLabel>
<returnPermited>false</returnPermited>
<initialStateSequence>114</initialStateSequence>
<finalStateSequence>18</finalStateSequence>
<returnLabel></returnLabel>
<name></name>
<automaticLink>false</automaticLink>
<defaultLink>false</defaultLink>
<type>0</type>
</ProcessLink>
</list>
<list/>
<list>
<WorkflowProcessEvent>
<workflowProcessEventPK>
<companyId>1</companyId>
<eventId>servicetask82</eventId>
<processId>Solicitação de compras </processId>
<version>1</version>
</workflowProcessEventPK>
<eventDescription>function toProtheusDate(d) {&#xd;
if (!d) return &quot;&quot;;&#xd;
if (d.indexOf(&quot;/&quot;) &gt; -1) {&#xd;
var parts = d.split(&quot;/&quot;);&#xd;
return parts[2] + parts[1] + parts[0]; // dd/MM/yyyy -&gt; yyyyMMdd&#xd;
}&#xd;
if (d.indexOf(&quot;-&quot;) &gt; -1) {&#xd;
return d.replace(/-/g, &quot;&quot;); // yyyy-MM-dd -&gt; yyyyMMdd&#xd;
}&#xd;
return d; // já está no formato certo&#xd;
}&#xd;
&#xd;
function hojeProtheus() {&#xd;
var d = new Date();&#xd;
var yyyy = d.getFullYear();&#xd;
var mm = d.getMonth() + 1;&#xd;
var dd = d.getDate();&#xd;
if (mm &lt; 10) mm = &quot;0&quot; + mm;&#xd;
if (dd &lt; 10) dd = &quot;0&quot; + dd;&#xd;
return &quot;&quot; + yyyy + mm + dd; // yyyyMMdd&#xd;
}&#xd;
&#xd;
function servicetask82(attempt, message) {&#xd;
log.info(&quot;🚀 Iniciando servicetask82&quot;);&#xd;
&#xd;
var qtdItens = hAPI.getChildrenIndexes(&quot;tbItens&quot;);&#xd;
log.info(&quot;📦 Total de itens na tabela: &quot; + qtdItens.length);&#xd;
&#xd;
var itens = [];&#xd;
for (var i = 0; i &lt; qtdItens.length; i++) {&#xd;
var index = qtdItens[i];&#xd;
var item = {&#xd;
&quot;C1_PRODUTO&quot;: String(hAPI.getCardValue(&quot;Codproduto___&quot; + index)),&#xd;
&quot;C1_QUANT&quot;: Number(hAPI.getCardValue(&quot;qtd___&quot; + index)),&#xd;
&quot;C1_DATPRF&quot;: toProtheusDate(String(hAPI.getCardValue(&quot;dataNec___&quot; + index)))&#xd;
};&#xd;
itens.push(item);&#xd;
log.info(&quot;📌 Item adicionado: &quot; + JSON.stringify(item));&#xd;
}&#xd;
&#xd;
var filial = String(
hAPI.getCardValue(&quot;filialprotheus&quot;) ||
hAPI.getCardValue(&quot;filialProtheus&quot;) ||
hAPI.getCardValue(&quot;codigocentroCusto&quot;) ||
&quot;&quot;
).trim();
if (!filial) {
throw &quot;Campo PROTHEUS da filial não preenchido no formulário (filialprotheus).&quot;;
}
log.info(&quot;🏬 Filial PROTHEUS enviada no C1_FILENT: &quot; + filial);
&#xd;
var payload = {&#xd;
&quot;C1_SOLICIT&quot;: String(hAPI.getCardValue(&quot;usuarioSolicitante&quot;)),&#xd;
&quot;C1_EMISSAO&quot;: hojeProtheus(),&#xd;
&quot;C1_FILENT&quot;: filial,&#xd;
&quot;C1_OBS&quot;: String(hAPI.getCardValue(&quot;observacoes&quot;)),&#xd;
&quot;itens&quot;: itens&#xd;
};&#xd;
&#xd;
log.info(&quot;📦 Payload montado:&quot;);&#xd;
log.info(JSON.stringify(payload));&#xd;
&#xd;
var data1 = {&#xd;
companyId: &apos;1&apos;,&#xd;
serviceCode: &apos;Postprod&apos;,&#xd;
endpoint: &apos;/UF_MATA110&apos;,&#xd;
method: &apos;post&apos;,&#xd;
timeoutService: &apos;60000&apos;,&#xd;
params: payload, // objeto puro&#xd;
headers: {&#xd;
&apos;Content-Type&apos;: &apos;application/json&apos;&#xd;
}&#xd;
};&#xd;
&#xd;
try {&#xd;
var clientService = fluigAPI.getAuthorizeClientService();&#xd;
var response = clientService.invoke(JSON.stringify(data1)); // SEMPRE stringify aqui&#xd;
&#xd;
log.info(&quot;📬 Resposta da API Protheus:&quot;);&#xd;
if (response) {&#xd;
log.info(&quot;HTTP status: &quot; + response.getHttpStatusResult());&#xd;
log.info(&quot;Body: &quot; + response.getResult());&#xd;
}&#xd;
&#xd;
if (response &amp;&amp; response.getResult()) {&#xd;
var result = JSON.parse(response.getResult());&#xd;
if (result.sucesso) {
hAPI.setCardValue(&quot;numeroSCProtheus&quot;, result.C1_NUM || &quot;&quot;);
hAPI.setCardValue(&quot;statusSCProtheus&quot;, &quot;SC cadastrada com sucesso&quot;);
hAPI.setCardValue(&quot;statusAtendimento&quot;, &quot;Em andamento&quot;);
hAPI.setCardValue(&quot;solicitanteSCProtheus&quot;, result.C1_SOLICIT || &quot;&quot;);
hAPI.setCardValue(&quot;emissaoSCProtheus&quot;, result.C1_EMISSAO || &quot;&quot;);
hAPI.setCardValue(&quot;qtdItensSCProtheus&quot;, String(result.quantidade_itens || &quot;&quot;));
hAPI.setCardValue(&quot;dataCadastroSCProtheus&quot;, result.data_cadastro || &quot;&quot;);
hAPI.setCardValue(&quot;horaCadastroSCProtheus&quot;, result.hora_cadastro || &quot;&quot;);
} else {
var erroMsg = result.erro || result.message || JSON.stringify(result);
hAPI.setCardValue(&quot;statusSCProtheus&quot;, &quot;Erro: &quot; + erroMsg);
hAPI.setCardValue(&quot;statusAtendimento&quot;, &quot;Erro no envio&quot;);
throw &quot;Erro Protheus: &quot; + erroMsg;
}
} else {&#xd;
throw &quot;Sem resposta da API Protheus&quot;;&#xd;
}&#xd;
} catch (e) {&#xd;
log.error(&quot;❌ Erro ao enviar SC para o Protheus: &quot; + e);&#xd;
throw e;&#xd;
}&#xd;
&#xd;
&#xd;
&#xd;
log.info(&quot;🏁 Finalização da servicetask82&quot;);&#xd;
}&#xd;
</eventDescription>
</WorkflowProcessEvent>
<WorkflowProcessEvent>
<workflowProcessEventPK>
<companyId>1</companyId>
<eventId>servicetask114</eventId>
<processId>Solicitação de compras </processId>
<version>1</version>
</workflowProcessEventPK>
<eventDescription>function documentoValido(valor) {
var v = String(valor || &quot;&quot;).trim().toUpperCase();
if (!v) return false;
if (v === &quot;000000&quot; || v === &quot;000001&quot;) return false;
if (/^0+$/.test(v)) return false;
if (/^X+$/.test(v)) return false;
return true;
}
function consultarComFallback(clientService, endpoints, contexto) {
var ultimoErro = &quot;&quot;;
for (var i = 0; i &lt; endpoints.length; i++) {
try {
var req = {
companyId: &quot;1&quot;,
serviceCode: &quot;Postprod&quot;,
endpoint: endpoints[i],
method: &quot;get&quot;,
timeoutService: &quot;60000&quot;,
headers: {
&quot;Content-Type&quot;: &quot;application/json&quot;
}
};
log.info(&quot;[ST114] Consulta &quot; + contexto + &quot; =&gt; &quot; + endpoints[i]);
var response = clientService.invoke(JSON.stringify(req));
if (!response || !response.getResult()) {
ultimoErro = &quot;Sem resposta&quot;;
continue;
}
var body = JSON.parse(response.getResult());
if (body &amp;&amp; body.sucesso) {
return { sucesso: true, body: body };
}
ultimoErro = (body &amp;&amp; (body.erro || body.message)) ? String(body.erro || body.message) : &quot;Resposta sem sucesso&quot;;
} catch (e) {
ultimoErro = String(e);
}
}
return { sucesso: false, erro: ultimoErro || (&quot;Falha na consulta de &quot; + contexto) };
}
function apurarAssinaturas(pedidos) {
var resumo = {
total: 0,
aprovadas: 0,
pendentes: 0,
bloqueadas: 0,
rejeitadas: 0,
outros: 0
};
for (var i = 0; i &lt; pedidos.length; i++) {
var alcadas = (pedidos[i] &amp;&amp; pedidos[i].ALCADAS) ? pedidos[i].ALCADAS : [];
for (var j = 0; j &lt; alcadas.length; j++) {
var status = String((alcadas[j] &amp;&amp; alcadas[j].CR_STATUS) || &quot;&quot;).trim();
if (!status) continue;
resumo.total++;
if (status === &quot;03&quot;) {
resumo.aprovadas++;
} else if (status === &quot;01&quot; || status === &quot;02&quot;) {
resumo.pendentes++;
} else if (status === &quot;04&quot;) {
resumo.bloqueadas++;
} else if (status === &quot;06&quot; || status === &quot;07&quot;) {
resumo.rejeitadas++;
} else {
resumo.outros++;
}
}
}
return resumo;
}
function servicetask114(attempt, message) {
log.info(&quot;[ST114] Inicio - valida cotacao, pedido e assinaturas&quot;);
var numSC = String(hAPI.getCardValue(&quot;numeroSCProtheus&quot;) || &quot;&quot;).trim();
var numCotForm = String(hAPI.getCardValue(&quot;cotacaoSCProtheus&quot;) || &quot;&quot;).trim();
var numPedForm = String(hAPI.getCardValue(&quot;pedidoSCProtheus&quot;) || &quot;&quot;).trim();
if (!numSC) {
throw &quot;Numero da SC nao informado no formulario.&quot;;
}
var clientService = fluigAPI.getAuthorizeClientService();
var consultaSC = consultarComFallback(clientService, [
&quot;/UF_MATA110/&quot; + numSC,
&quot;/rest/UF_MATA110/&quot; + numSC,
&quot;/rest/uf_mata110/&quot; + numSC
], &quot;SC &quot; + numSC);
if (!consultaSC.sucesso) {
throw &quot;Nao foi possivel consultar a SC &quot; + numSC + &quot;: &quot; + consultaSC.erro;
}
var solicitacoes = (consultaSC.body &amp;&amp; consultaSC.body.solicitacoes) ? consultaSC.body.solicitacoes : [];
if (!solicitacoes.length) {
throw &quot;SC &quot; + numSC + &quot; sem retorno de dados no Protheus.&quot;;
}
var sc = solicitacoes[0] || {};
var numCot = documentoValido(sc.C1_COTACAO) ? String(sc.C1_COTACAO).trim() : numCotForm;
var numPed = documentoValido(sc.C1_PEDIDO) ? String(sc.C1_PEDIDO).trim() : numPedForm;
if (!documentoValido(numCot)) {
hAPI.setCardValue(&quot;statusAtendimento&quot;, &quot;Aguardando cotacao&quot;);
throw &quot;Cotacao ainda nao disponivel para a SC &quot; + numSC + &quot;.&quot;;
}
hAPI.setCardValue(&quot;cotacaoSCProtheus&quot;, numCot);
if (!documentoValido(numPed)) {
hAPI.setCardValue(&quot;statusAtendimento&quot;, &quot;Aguardando pedido&quot;);
throw &quot;Pedido ainda nao gerado para a SC &quot; + numSC + &quot;.&quot;;
}
hAPI.setCardValue(&quot;pedidoSCProtheus&quot;, numPed);
var consultaPedido = consultarComFallback(clientService, [
&quot;/UF_MATA120/&quot; + numPed,
&quot;/rest/UF_MATA120/&quot; + numPed,
&quot;/rest/uf_mata120/&quot; + numPed
], &quot;Pedido &quot; + numPed);
if (!consultaPedido.sucesso) {
throw &quot;Nao foi possivel consultar o pedido &quot; + numPed + &quot;: &quot; + consultaPedido.erro;
}
var pedidos = (consultaPedido.body &amp;&amp; consultaPedido.body.pedidos) ? consultaPedido.body.pedidos : [];
var assinatura = apurarAssinaturas(pedidos);
if (assinatura.total === 0) {
hAPI.setCardValue(&quot;statusAtendimento&quot;, &quot;Pedido sem alcadas&quot;);
throw &quot;Pedido &quot; + numPed + &quot; sem alcadas de assinatura retornadas.&quot;;
}
if (assinatura.bloqueadas &gt; 0 || assinatura.rejeitadas &gt; 0) {
hAPI.setCardValue(&quot;statusAtendimento&quot;, &quot;Pedido bloqueado/rejeitado&quot;);
throw &quot;Pedido &quot; + numPed + &quot; bloqueado/rejeitado. Nao pode seguir para recebimento.&quot;;
}
if (assinatura.aprovadas &lt; assinatura.total) {
hAPI.setCardValue(&quot;statusAtendimento&quot;, &quot;Pedido pendente de assinatura&quot;);
throw &quot;Pedido &quot; + numPed + &quot; ainda nao esta 100% assinado (&quot; + assinatura.aprovadas + &quot;/&quot; + assinatura.total + &quot;).&quot;;
}
hAPI.setCardValue(&quot;statusAtendimento&quot;, &quot;Pedido 100% assinado&quot;);
log.info(&quot;[ST114] Pedido &quot; + numPed + &quot; 100% assinado. Fluxo liberado para receber produto/servico.&quot;);
}
</eventDescription>
</WorkflowProcessEvent>
</list>
<list/>
<list>
<SwimLane>
<color>FFFFFF</color>
<height>715</height>
<width>1710</width>
<positionX>11</positionX>
<positionY>6</positionY>
<stateName>Solicitação de compras</stateName>
<type>1</type>
<parentSequence>0</parentSequence>
<swimLanePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>1</sequence>
</swimLanePK>
</SwimLane>
<SwimLane>
<color>82b0b7</color>
<height>102</height>
<width>1680</width>
<positionX>41</positionX>
<positionY>6</positionY>
<stateName>Solicitante</stateName>
<type>2</type>
<parentSequence>1</parentSequence>
<swimLanePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>2</sequence>
</swimLanePK>
</SwimLane>
<SwimLane>
<color>d0daae</color>
<height>102</height>
<width>1680</width>
<positionX>41</positionX>
<positionY>210</positionY>
<stateName>Compras</stateName>
<type>2</type>
<parentSequence>1</parentSequence>
<swimLanePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>3</sequence>
</swimLanePK>
</SwimLane>
<SwimLane>
<color>d6e0d0</color>
<height>102</height>
<width>1680</width>
<positionX>41</positionX>
<positionY>108</positionY>
<stateName>Gestor CC</stateName>
<type>2</type>
<parentSequence>1</parentSequence>
<swimLanePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>4</sequence>
</swimLanePK>
</SwimLane>
<SwimLane>
<color>adc9ac</color>
<height>103</height>
<width>1680</width>
<positionX>41</positionX>
<positionY>618</positionY>
<stateName>TI</stateName>
<type>2</type>
<parentSequence>1</parentSequence>
<swimLanePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>5</sequence>
</swimLanePK>
</SwimLane>
<SwimLane>
<color>C0C0C0</color>
<height>102</height>
<width>1680</width>
<positionX>41</positionX>
<positionY>312</positionY>
<stateName>Compras</stateName>
<type>2</type>
<parentSequence>1</parentSequence>
<swimLanePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>6</sequence>
</swimLanePK>
</SwimLane>
<SwimLane>
<color>c9c3ac</color>
<height>102</height>
<width>1680</width>
<positionX>41</positionX>
<positionY>414</positionY>
<stateName>GERF</stateName>
<type>2</type>
<parentSequence>1</parentSequence>
<swimLanePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>7</sequence>
</swimLanePK>
</SwimLane>
<SwimLane>
<color>9fc1c6</color>
<height>102</height>
<width>1680</width>
<positionX>41</positionX>
<positionY>516</positionY>
<stateName>CEO</stateName>
<type>2</type>
<parentSequence>1</parentSequence>
<swimLanePK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>8</sequence>
</swimLanePK>
</SwimLane>
</list>
<list/>
<list/>
<list>
<ProcessLinkBend>
<processLinkBendPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>89</version>
<linkSequence>26</linkSequence>
<bendSequence>1</bendSequence>
</processLinkBendPK>
<positionX>1492</positionX>
<positionY>368</positionY>
</ProcessLinkBend>
<ProcessLinkBend>
<processLinkBendPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>89</version>
<linkSequence>125</linkSequence>
<bendSequence>1</bendSequence>
</processLinkBendPK>
<positionX>512</positionX>
<positionY>47</positionY>
</ProcessLinkBend>
<ProcessLinkBend>
<processLinkBendPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>89</version>
<linkSequence>126</linkSequence>
<bendSequence>1</bendSequence>
</processLinkBendPK>
<positionX>513</positionX>
<positionY>662</positionY>
</ProcessLinkBend>
<ProcessLinkBend>
<processLinkBendPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>89</version>
<linkSequence>127</linkSequence>
<bendSequence>1</bendSequence>
</processLinkBendPK>
<positionX>612</positionX>
<positionY>498</positionY>
</ProcessLinkBend>
<ProcessLinkBend>
<processLinkBendPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>89</version>
<linkSequence>161</linkSequence>
<bendSequence>1</bendSequence>
</processLinkBendPK>
<positionX>511</positionX>
<positionY>47</positionY>
</ProcessLinkBend>
<ProcessLinkBend>
<processLinkBendPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>89</version>
<linkSequence>162</linkSequence>
<bendSequence>1</bendSequence>
</processLinkBendPK>
<positionX>613</positionX>
<positionY>55</positionY>
</ProcessLinkBend>
</list>
<list/>
<list/>
<list>
<ProcessFormField>
<processFormFieldPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<fieldId>descProduto</fieldId>
</processFormFieldPK>
<fieldDescription>descProduto</fieldDescription>
<slotId>1</slotId>
</ProcessFormField>
<ProcessFormField>
<processFormFieldPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<fieldId>empresa</fieldId>
</processFormFieldPK>
<fieldDescription>empresa</fieldDescription>
<slotId>2</slotId>
</ProcessFormField>
<ProcessFormField>
<processFormFieldPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<fieldId>estabelecimento</fieldId>
</processFormFieldPK>
<fieldDescription>estabelecimento</fieldDescription>
<slotId>3</slotId>
</ProcessFormField>
<ProcessFormField>
<processFormFieldPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<fieldId>filialdest</fieldId>
</processFormFieldPK>
<fieldDescription>filialdest</fieldDescription>
<slotId>4</slotId>
</ProcessFormField>
<ProcessFormField>
<processFormFieldPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<fieldId>numeroSCProtheus</fieldId>
</processFormFieldPK>
<fieldDescription>numeroSCProtheus</fieldDescription>
<slotId>5</slotId>
</ProcessFormField>
<ProcessFormField>
<processFormFieldPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<fieldId>pedidoSCProtheus</fieldId>
</processFormFieldPK>
<fieldDescription>pedidoSCProtheus</fieldDescription>
<slotId>6</slotId>
</ProcessFormField>
<ProcessFormField>
<processFormFieldPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<fieldId>quantidade</fieldId>
</processFormFieldPK>
<fieldDescription>quantidade</fieldDescription>
<slotId>7</slotId>
</ProcessFormField>
<ProcessFormField>
<processFormFieldPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<fieldId>solicitanteSCProtheus</fieldId>
</processFormFieldPK>
<fieldDescription>solicitanteSCProtheus</fieldDescription>
<slotId>8</slotId>
</ProcessFormField>
<ProcessFormField>
<processFormFieldPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<fieldId>urgencia</fieldId>
</processFormFieldPK>
<fieldDescription>urgencia</fieldDescription>
<slotId>9</slotId>
</ProcessFormField>
<ProcessFormField>
<processFormFieldPK>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<fieldId>valorTotalCotacao</fieldId>
</processFormFieldPK>
<fieldDescription>valorTotalCotacao</fieldDescription>
<slotId>10</slotId>
</ProcessFormField>
</list>
<list>
<ProcessStateService>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>82</sequence>
<attempts>5</attempts>
<sucessFullMessage>Solicitação enviada com sucesso</sucessFullMessage>
<serviceName></serviceName>
<frequency>1</frequency>
<frequencyType>0</frequencyType>
</ProcessStateService>
<ProcessStateService>
<companyId>1</companyId>
<processId>Solicitação de compras </processId>
<version>1</version>
<sequence>114</sequence>
<attempts>5</attempts>
<sucessFullMessage>Integração executada com sucesso</sucessFullMessage>
<serviceName></serviceName>
<frequency>6</frequency>
<frequencyType>0</frequencyType>
</ProcessStateService>
</list>
<list/>
<list/>
<list/>
<list/>
</list>