# app_flow

id: 60fa63be9932563b7c99be71
pid: 60fa63be9932563b7c99be6f
appid: 606d21ab99328dc77af633f9
name: 凭证调阅审批
code: dy
namepath: /凭证影像化/凭证调阅
codepath: 60fa63be9932563b7c99be6e.60fa63be9932563b7c99be6f
fullname: /凭证影像化/凭证调阅/凭证调阅审批
fullcode: 60fa63be9932563b7c99be6e.60fa63be9932563b7c99be6f.dy
nodetype: flow
createdate: 2021.07.23 14:38:15.000
lastmodifieddate: 2024.09.18 14:40:46.444
value:
{"process":{"id":"60fa63be9932563b7c99be71","name":"凭证调阅审批","isExecutable":true},"endEvent":[{"bounds":{"x":944,"y":187,"width":38,"height":38},"nodeType":"endEvent","id":"091c005a811747c6a2b48f58663d0a7d","name":"结束"}],"userTask":[{"bounds":{"x":438,"y":180,"width":48,"height":17},"nodeType":"userTask","id":"60b3b08f27644fc18af35ba20ecd2bac","name":"调阅申请","description":"","property":"","code":"","no":"","commentTitle":"","needComment":"false","onCreateEvent":"","afterSubmitEvent":"","isFirst":true,"multiInstance":"single","notice_im":"false","notice_app":"","taskOverConditionExpression":"nrOfInstances == nrOfCompletedInstances","assignee":[]},{"bounds":{"x":622,"y":181,"width":48,"height":17},"nodeType":"userTask","id":"6655df8bedc641aa9bacf1720d13ce2d","name":"调阅审批","description":"","property":"","code":"","no":"","commentTitle":"审批意见","needComment":"true","onCreateEvent":"","afterSubmitEvent":"","isFirst":false,"multiInstance":"single","notice_im":"true","notice_app":"","taskOverConditionExpression":"nrOfInstances == nrOfCompletedInstances","assignee":[{"type":"column","id":"7d1e9bd95d470c130bf5aa6f88e29318","tableName":"dzpz_dy","columnName":"leaderid"}]},{"bounds":{"x":800,"y":180,"width":48,"height":17},"nodeType":"userTask","id":"d9bbab2c330b4fc49ebdc0e5c52c6cfa","name":"影像下载","description":"","property":"","code":"","no":"","commentTitle":"","needComment":"false","onCreateEvent":"","afterSubmitEvent":"","isFirst":false,"multiInstance":"single","notice_im":"true","notice_app":"","taskOverConditionExpression":"nrOfInstances == nrOfCompletedInstances","assignee":[{"type":"sameas","id":"81eca3d6afb3ed8236d2740686af37ac","nodeid":"60b3b08f27644fc18af35ba20ecd2bac"}]}],"gateway":[],"sequenceFlow":[{"id":"f68b1fda47f64909b806ebbbee3bbca7_60b3b08f27644fc18af35ba20ecd2bac","sourceRef":"f68b1fda47f64909b806ebbbee3bbca7","targetRef":"60b3b08f27644fc18af35ba20ecd2bac","label":"","code":"","default":false,"conditionExpression":"","passExpression":""},{"id":"60b3b08f27644fc18af35ba20ecd2bac_6655df8bedc641aa9bacf1720d13ce2d","sourceRef":"60b3b08f27644fc18af35ba20ecd2bac","targetRef":"6655df8bedc641aa9bacf1720d13ce2d","label":"","code":"","default":false,"conditionExpression":"","passExpression":""},{"id":"6655df8bedc641aa9bacf1720d13ce2d_d9bbab2c330b4fc49ebdc0e5c52c6cfa","sourceRef":"6655df8bedc641aa9bacf1720d13ce2d","targetRef":"d9bbab2c330b4fc49ebdc0e5c52c6cfa","label":"","code":"","default":false,"conditionExpression":"","passExpression":""},{"id":"d9bbab2c330b4fc49ebdc0e5c52c6cfa_091c005a811747c6a2b48f58663d0a7d","sourceRef":"d9bbab2c330b4fc49ebdc0e5c52c6cfa","targetRef":"091c005a811747c6a2b48f58663d0a7d","label":"","code":"","default":false,"conditionExpression":"","passExpression":""}],"startEvent":{"bounds":{"x":331,"y":187,"width":42,"height":42},"nodeType":"startEvent","id":"f68b1fda47f64909b806ebbbee3bbca7","name":"开始"}}


id: 60fa63be9932563b7c99be81
pid: 60fa63be9932563b7c99be71
appid: 606d21ab99328dc77af633f9
name: bpmn
code: 60fa63be9932563b7c99be81
namepath: /凭证影像化/凭证调阅/凭证调阅审批
codepath: 60fa63be9932563b7c99be6e.60fa63be9932563b7c99be6f.dy
fullname: /凭证影像化/凭证调阅/凭证调阅审批/bpmn
fullcode: 60fa63be9932563b7c99be6e.60fa63be9932563b7c99be6f.dy.60fa63be9932563b7c99be81
nodetype: column
createdate: 2021.07.23 14:39:48.000
lastmodifieddate: 2024.09.18 14:40:46.444
value:
<?xml version="1.0" encoding="UTF-8"?>
        <definitions id="definitions_60fa63be9932563b7c99be71"  targetNamespace="http://flowable.org/bpmn20"  
                    xmlns:flowable="http://flowable.org/bpmn"  
                    xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">    
<process id="id_60fa63be9932563b7c99be71" name="凭证调阅审批" isExecutable="true">  
<startEvent id="id_f68b1fda47f64909b806ebbbee3bbca7" name="开始"/>
<userTask id="id_60b3b08f27644fc18af35ba20ecd2bac" name="调阅申请" 
                    flowable:isFirst="true" 
                    flowable:notice_im="false" 
                    flowable:notice_app=""  
           >
                    <extensionElements>
                            <flowable:taskListener event="all" class="api.flow.TaskListenerImpl"></flowable:taskListener>
                            <flowable:candidateDefine><![CDATA[[]]]></flowable:candidateDefine>
                            <flowable:code><![CDATA[]]></flowable:code>
                            <flowable:no><![CDATA[]]></flowable:no>
                            <flowable:commentTitle><![CDATA[]]></flowable:commentTitle>
                            <flowable:needComment><![CDATA[false]]></flowable:needComment>
                            
                            
                            <flowable:onCreateEvent><![CDATA[]]></flowable:onCreateEvent>
                            <flowable:afterSubmitEvent><![CDATA[]]></flowable:afterSubmitEvent>
                            <flowable:description><![CDATA[]]></flowable:description>
                            <flowable:property><![CDATA[]]></flowable:property>
                            
                    </extensionElements>                  
               </userTask>
<userTask id="id_6655df8bedc641aa9bacf1720d13ce2d" name="调阅审批" 
                    flowable:isFirst="false" 
                    flowable:notice_im="true" 
                    flowable:notice_app=""  
           >
                    <extensionElements>
                            <flowable:taskListener event="all" class="api.flow.TaskListenerImpl"></flowable:taskListener>
                            <flowable:candidateDefine><![CDATA[[{"type":"column","id":"7d1e9bd95d470c130bf5aa6f88e29318","tableName":"dzpz_dy","columnName":"leaderid"}]]]></flowable:candidateDefine>
                            <flowable:code><![CDATA[]]></flowable:code>
                            <flowable:no><![CDATA[]]></flowable:no>
                            <flowable:commentTitle><![CDATA[审批意见]]></flowable:commentTitle>
                            <flowable:needComment><![CDATA[true]]></flowable:needComment>
                            
                            
                            <flowable:onCreateEvent><![CDATA[]]></flowable:onCreateEvent>
                            <flowable:afterSubmitEvent><![CDATA[]]></flowable:afterSubmitEvent>
                            <flowable:description><![CDATA[]]></flowable:description>
                            <flowable:property><![CDATA[]]></flowable:property>
                            
                    </extensionElements>                  
               </userTask>
<userTask id="id_d9bbab2c330b4fc49ebdc0e5c52c6cfa" name="影像下载" 
                    flowable:isFirst="false" 
                    flowable:notice_im="true" 
                    flowable:notice_app=""  
           >
                    <extensionElements>
                            <flowable:taskListener event="all" class="api.flow.TaskListenerImpl"></flowable:taskListener>
                            <flowable:candidateDefine><![CDATA[[{"type":"sameas","id":"81eca3d6afb3ed8236d2740686af37ac","nodeid":"60b3b08f27644fc18af35ba20ecd2bac"}]]]></flowable:candidateDefine>
                            <flowable:code><![CDATA[]]></flowable:code>
                            <flowable:no><![CDATA[]]></flowable:no>
                            <flowable:commentTitle><![CDATA[]]></flowable:commentTitle>
                            <flowable:needComment><![CDATA[false]]></flowable:needComment>
                            
                            
                            <flowable:onCreateEvent><![CDATA[]]></flowable:onCreateEvent>
                            <flowable:afterSubmitEvent><![CDATA[]]></flowable:afterSubmitEvent>
                            <flowable:description><![CDATA[]]></flowable:description>
                            <flowable:property><![CDATA[]]></flowable:property>
                            
                    </extensionElements>                  
               </userTask>
<endEvent id="id_091c005a811747c6a2b48f58663d0a7d" name="结束"/>

            <sequenceFlow id="id_f68b1fda47f64909b806ebbbee3bbca7_60b3b08f27644fc18af35ba20ecd2bac" 
                 sourceRef="id_f68b1fda47f64909b806ebbbee3bbca7" 
                 targetRef="id_60b3b08f27644fc18af35ba20ecd2bac" 
                 name="开始→调阅申请" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>

            <sequenceFlow id="id_60b3b08f27644fc18af35ba20ecd2bac_6655df8bedc641aa9bacf1720d13ce2d" 
                 sourceRef="id_60b3b08f27644fc18af35ba20ecd2bac" 
                 targetRef="id_6655df8bedc641aa9bacf1720d13ce2d" 
                 name="调阅申请→调阅审批" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>

            <sequenceFlow id="id_6655df8bedc641aa9bacf1720d13ce2d_d9bbab2c330b4fc49ebdc0e5c52c6cfa" 
                 sourceRef="id_6655df8bedc641aa9bacf1720d13ce2d" 
                 targetRef="id_d9bbab2c330b4fc49ebdc0e5c52c6cfa" 
                 name="调阅审批→影像下载" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>

            <sequenceFlow id="id_d9bbab2c330b4fc49ebdc0e5c52c6cfa_091c005a811747c6a2b48f58663d0a7d" 
                 sourceRef="id_d9bbab2c330b4fc49ebdc0e5c52c6cfa" 
                 targetRef="id_091c005a811747c6a2b48f58663d0a7d" 
                 name="影像下载→结束" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>
</process>
                   </definitions>


id: 663b080d9932a08a57e3f4a5
pid: 663b080d9932a08a57e3f4a3
appid: 606d21ab99328dc77af633f9
name: 凭证移交-工作流已删除-工作流已删除-工作流已删除
fullname: /凭证移交
nodetype: flow
createdate: 2024.05.08 13:07:24.000
lastmodifieddate: 2024.09.18 14:40:46.445
value:
{"process":{"id":"663b080d9932a08a57e3f4a5","name":"凭证移交-工作流已删除-工作流已删除-工作流已删除","isExecutable":true},"endEvent":[{"bounds":{"x":818,"y":186,"width":38,"height":38},"nodeType":"endEvent","id":"b6a06f419c0d479295697405d3e51a46","name":"结束"}],"userTask":[{"bounds":{"x":447,"y":179,"width":48,"height":17},"nodeType":"userTask","id":"89cf32093cea450bb2889fdb9a6d97e8","name":"移交发起\n","description":"","property":"","code":"","no":"","commentTitle":"","needComment":"true","onCreateEvent":"","afterSubmitEvent":"","isFirst":true,"multiInstance":"single","notice_im":"false","notice_app":"","taskOverConditionExpression":"nrOfInstances == nrOfCompletedInstances","assignee":[]},{"bounds":{"x":600,"y":179,"width":84,"height":17},"nodeType":"userTask","id":"f4090b57406d4b4395cc8997c24c9b52","name":"接收方签收确认","description":"","property":"","code":"","no":"","commentTitle":"","needComment":"true","onCreateEvent":"","afterSubmitEvent":"","isFirst":false,"multiInstance":"single","notice_im":"false","notice_app":"","taskOverConditionExpression":"nrOfInstances == nrOfCompletedInstances","assignee":[{"type":"column","id":"b02484455166bc5dfeec637213599092","tableName":"pz_yjd","columnName":"touserid"}]}],"gateway":[],"sequenceFlow":[{"id":"69a1e435238a4a3ba9953bd7ebdb4cc6_89cf32093cea450bb2889fdb9a6d97e8","sourceRef":"69a1e435238a4a3ba9953bd7ebdb4cc6","targetRef":"89cf32093cea450bb2889fdb9a6d97e8","label":"","code":"","default":false,"conditionExpression":"","passExpression":""},{"id":"89cf32093cea450bb2889fdb9a6d97e8_f4090b57406d4b4395cc8997c24c9b52","sourceRef":"89cf32093cea450bb2889fdb9a6d97e8","targetRef":"f4090b57406d4b4395cc8997c24c9b52","label":"","code":"","default":false,"conditionExpression":"","passExpression":"sponsorGZL(gguid)"},{"id":"f4090b57406d4b4395cc8997c24c9b52_b6a06f419c0d479295697405d3e51a46","sourceRef":"f4090b57406d4b4395cc8997c24c9b52","targetRef":"b6a06f419c0d479295697405d3e51a46","label":"","code":"","default":false,"conditionExpression":"","passExpression":"verifyGZL(gguid)"}],"startEvent":{"bounds":{"x":331,"y":187,"width":42,"height":42},"nodeType":"startEvent","id":"69a1e435238a4a3ba9953bd7ebdb4cc6","name":"开始"}}


id: 663b080d9932a08a57e3f4b2
pid: 663b080d9932a08a57e3f4a5
appid: 606d21ab99328dc77af633f9
name: bpmn
nodetype: column
createdate: 2024.05.08 13:09:50.000
lastmodifieddate: 2024.09.18 14:40:46.445
value:
<?xml version="1.0" encoding="UTF-8"?>
        <definitions id="definitions_663b080d9932a08a57e3f4a5"  targetNamespace="http://flowable.org/bpmn20"  
                    xmlns:flowable="http://flowable.org/bpmn"  
                    xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">    
<process id="id_663b080d9932a08a57e3f4a5" name="凭证移交-工作流已删除-工作流已删除-工作流已删除" isExecutable="true">  
<startEvent id="id_69a1e435238a4a3ba9953bd7ebdb4cc6" name="开始"/>
<userTask id="id_89cf32093cea450bb2889fdb9a6d97e8" name="移交发起" 
                    flowable:isFirst="true" 
                    flowable:multiInstance="single"  
                    flowable:notice_im="false" 
                    flowable:notice_app="" 
>
  <extensionElements>
                            <flowable:taskListener event="all" class="api.flow.TaskListenerImpl"></flowable:taskListener>

          <flowable:candidateDefine><![CDATA[[]]]></flowable:candidateDefine>
                            <flowable:code><![CDATA[]]></flowable:code>
                            <flowable:no><![CDATA[]]></flowable:no>
                            <flowable:commentTitle><![CDATA[]]></flowable:commentTitle>
                            <flowable:needComment><![CDATA[true]]></flowable:needComment>
                            
                            
                            <flowable:onCreateEvent><![CDATA[]]></flowable:onCreateEvent>
                            <flowable:afterSubmitEvent><![CDATA[]]></flowable:afterSubmitEvent>
                            <flowable:description><![CDATA[]]></flowable:description>
                            <flowable:property><![CDATA[]]></flowable:property>
                            
                    </extensionElements>  
               
</userTask>
<userTask id="id_f4090b57406d4b4395cc8997c24c9b52" name="接收方签收确认" 
                    flowable:isFirst="false" 
                    flowable:multiInstance="single"  
                    flowable:notice_im="false" 
                    flowable:notice_app="" 
>
  <extensionElements>
                            <flowable:taskListener event="all" class="api.flow.TaskListenerImpl"></flowable:taskListener>

          <flowable:candidateDefine><![CDATA[[{"type":"column","id":"b02484455166bc5dfeec637213599092","tableName":"pz_yjd","columnName":"touserid"}]]]></flowable:candidateDefine>
                            <flowable:code><![CDATA[]]></flowable:code>
                            <flowable:no><![CDATA[]]></flowable:no>
                            <flowable:commentTitle><![CDATA[]]></flowable:commentTitle>
                            <flowable:needComment><![CDATA[true]]></flowable:needComment>
                            
                            
                            <flowable:onCreateEvent><![CDATA[]]></flowable:onCreateEvent>
                            <flowable:afterSubmitEvent><![CDATA[]]></flowable:afterSubmitEvent>
                            <flowable:description><![CDATA[]]></flowable:description>
                            <flowable:property><![CDATA[]]></flowable:property>
                            
                    </extensionElements>  
               
</userTask>
<endEvent id="id_b6a06f419c0d479295697405d3e51a46" name="结束"/>

            <sequenceFlow id="id_69a1e435238a4a3ba9953bd7ebdb4cc6_89cf32093cea450bb2889fdb9a6d97e8" 
                 sourceRef="id_69a1e435238a4a3ba9953bd7ebdb4cc6" 
                 targetRef="id_89cf32093cea450bb2889fdb9a6d97e8" 
                 name="开始→移交发起" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>

            <sequenceFlow id="id_89cf32093cea450bb2889fdb9a6d97e8_f4090b57406d4b4395cc8997c24c9b52" 
                 sourceRef="id_89cf32093cea450bb2889fdb9a6d97e8" 
                 targetRef="id_f4090b57406d4b4395cc8997c24c9b52" 
                 name="移交发起→接收方签收确认" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:passExpression><![CDATA[sponsorGZL(gguid)]]></flowable:passExpression>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>

            <sequenceFlow id="id_f4090b57406d4b4395cc8997c24c9b52_b6a06f419c0d479295697405d3e51a46" 
                 sourceRef="id_f4090b57406d4b4395cc8997c24c9b52" 
                 targetRef="id_b6a06f419c0d479295697405d3e51a46" 
                 name="接收方签收确认→结束" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:passExpression><![CDATA[verifyGZL(gguid)]]></flowable:passExpression>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>
</process>
                   </definitions>


id: 669f22ae9932df22f60cfdb9
pid: 669f22ae9932df22f60cfdb7
appid: 606d21ab99328dc77af633f9
name: 凭证交回
fullname: /凭证交回
nodetype: flow
createdate: 2024.07.23 11:26:55.000
lastmodifieddate: 2024.09.18 14:40:46.445
value:
{"process":{"id":"669f22ae9932df22f60cfdb9","name":"凭证交回","isExecutable":true},"endEvent":[{"bounds":{"x":865,"y":189,"width":38,"height":38},"nodeType":"endEvent","id":"06b532fc89464e06802f3d1a1b609221","name":"结束"}],"userTask":[{"bounds":{"x":446,"y":183,"width":24,"height":17},"nodeType":"userTask","id":"57a2eacd555c47229a5deca5ab3fa319","name":"起草","description":"","property":"","code":"","no":"","commentTitle":"","needComment":"true","onCreateEvent":"","afterSubmitEvent":"","isFirst":true,"multiInstance":"single","notice_im":"false","notice_app":"","taskOverConditionExpression":"nrOfInstances == nrOfCompletedInstances","assignee":[]},{"bounds":{"x":604,"y":181,"width":84,"height":17},"nodeType":"userTask","id":"dad2e755681c473bba6b611d78f63ef8","name":"接收方签收确认","description":"","property":"","code":"","no":"","commentTitle":"","needComment":"true","onCreateEvent":"","afterSubmitEvent":"","isFirst":false,"multiInstance":"single","notice_im":"false","notice_app":"","taskOverConditionExpression":"nrOfInstances == nrOfCompletedInstances","assignee":[{"type":"column","id":"6e0c86775e459252fc22ef379c4fa558","tableName":"pz_yjd","columnName":"touserid"}]}],"gateway":[],"sequenceFlow":[{"id":"051976d5783e4dacbfe18f8a659c2aff_57a2eacd555c47229a5deca5ab3fa319","sourceRef":"051976d5783e4dacbfe18f8a659c2aff","targetRef":"57a2eacd555c47229a5deca5ab3fa319","label":"","code":"","default":false,"conditionExpression":"","passExpression":""},{"id":"57a2eacd555c47229a5deca5ab3fa319_dad2e755681c473bba6b611d78f63ef8","sourceRef":"57a2eacd555c47229a5deca5ab3fa319","targetRef":"dad2e755681c473bba6b611d78f63ef8","label":"","code":"","default":false,"conditionExpression":"","passExpression":"sponsorGZL(gguid)"},{"id":"dad2e755681c473bba6b611d78f63ef8_06b532fc89464e06802f3d1a1b609221","sourceRef":"dad2e755681c473bba6b611d78f63ef8","targetRef":"06b532fc89464e06802f3d1a1b609221","label":"","code":"","default":false,"conditionExpression":"","passExpression":"verifyGZL(gguid)"}],"startEvent":{"bounds":{"x":331,"y":187,"width":42,"height":42},"nodeType":"startEvent","id":"051976d5783e4dacbfe18f8a659c2aff","name":"开始"}}


id: 669f22ae9932df22f60cfdcf
pid: 669f22ae9932df22f60cfdb9
appid: 606d21ab99328dc77af633f9
name: bpmn
nodetype: column
createdate: 2024.07.23 11:28:45.000
lastmodifieddate: 2024.09.18 14:40:46.445
value:
<?xml version="1.0" encoding="UTF-8"?>
        <definitions id="definitions_669f22ae9932df22f60cfdb9"  targetNamespace="http://flowable.org/bpmn20"  
                    xmlns:flowable="http://flowable.org/bpmn"  
                    xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">    
<process id="id_669f22ae9932df22f60cfdb9" name="凭证交回" isExecutable="true">  
<startEvent id="id_051976d5783e4dacbfe18f8a659c2aff" name="开始"/>
<userTask id="id_57a2eacd555c47229a5deca5ab3fa319" name="起草" 
                    flowable:isFirst="true" 
                    flowable:multiInstance="single"  
                    flowable:notice_im="false" 
                    flowable:notice_app="" 
>
  <extensionElements>
                            <flowable:taskListener event="all" class="api.flow.TaskListenerImpl"></flowable:taskListener>

          <flowable:candidateDefine><![CDATA[[]]]></flowable:candidateDefine>
                            <flowable:code><![CDATA[]]></flowable:code>
                            <flowable:no><![CDATA[]]></flowable:no>
                            <flowable:commentTitle><![CDATA[]]></flowable:commentTitle>
                            <flowable:needComment><![CDATA[true]]></flowable:needComment>
                            
                            
                            <flowable:onCreateEvent><![CDATA[]]></flowable:onCreateEvent>
                            <flowable:afterSubmitEvent><![CDATA[]]></flowable:afterSubmitEvent>
                            <flowable:description><![CDATA[]]></flowable:description>
                            <flowable:property><![CDATA[]]></flowable:property>
                            
                    </extensionElements>  
               
</userTask>
<userTask id="id_dad2e755681c473bba6b611d78f63ef8" name="接收方签收确认" 
                    flowable:isFirst="false" 
                    flowable:multiInstance="single"  
                    flowable:notice_im="false" 
                    flowable:notice_app="" 
>
  <extensionElements>
                            <flowable:taskListener event="all" class="api.flow.TaskListenerImpl"></flowable:taskListener>

          <flowable:candidateDefine><![CDATA[[{"type":"column","id":"6e0c86775e459252fc22ef379c4fa558","tableName":"pz_yjd","columnName":"touserid"}]]]></flowable:candidateDefine>
                            <flowable:code><![CDATA[]]></flowable:code>
                            <flowable:no><![CDATA[]]></flowable:no>
                            <flowable:commentTitle><![CDATA[]]></flowable:commentTitle>
                            <flowable:needComment><![CDATA[true]]></flowable:needComment>
                            
                            
                            <flowable:onCreateEvent><![CDATA[]]></flowable:onCreateEvent>
                            <flowable:afterSubmitEvent><![CDATA[]]></flowable:afterSubmitEvent>
                            <flowable:description><![CDATA[]]></flowable:description>
                            <flowable:property><![CDATA[]]></flowable:property>
                            
                    </extensionElements>  
               
</userTask>
<endEvent id="id_06b532fc89464e06802f3d1a1b609221" name="结束"/>

            <sequenceFlow id="id_051976d5783e4dacbfe18f8a659c2aff_57a2eacd555c47229a5deca5ab3fa319" 
                 sourceRef="id_051976d5783e4dacbfe18f8a659c2aff" 
                 targetRef="id_57a2eacd555c47229a5deca5ab3fa319" 
                 name="开始→起草" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>

            <sequenceFlow id="id_57a2eacd555c47229a5deca5ab3fa319_dad2e755681c473bba6b611d78f63ef8" 
                 sourceRef="id_57a2eacd555c47229a5deca5ab3fa319" 
                 targetRef="id_dad2e755681c473bba6b611d78f63ef8" 
                 name="起草→接收方签收确认" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:passExpression><![CDATA[sponsorGZL(gguid)]]></flowable:passExpression>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>

            <sequenceFlow id="id_dad2e755681c473bba6b611d78f63ef8_06b532fc89464e06802f3d1a1b609221" 
                 sourceRef="id_dad2e755681c473bba6b611d78f63ef8" 
                 targetRef="id_06b532fc89464e06802f3d1a1b609221" 
                 name="接收方签收确认→结束" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:passExpression><![CDATA[verifyGZL(gguid)]]></flowable:passExpression>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>
</process>
                   </definitions>


id: 669f22ae9932df22f60cfddd
pid: 669f22ae9932df22f60cfddb
appid: 606d21ab99328dc77af633f9
name: 凭证借阅
fullname: /凭证借阅
nodetype: flow
createdate: 2024.07.23 11:29:07.000
lastmodifieddate: 2024.09.18 14:40:46.445
value:
{"process":{"id":"669f22ae9932df22f60cfddd","name":"凭证借阅","isExecutable":true},"endEvent":[{"bounds":{"x":855,"y":200,"width":38,"height":38},"nodeType":"endEvent","id":"6684049a5aad4f36bde9634afff6bb1b","name":"结束"}],"userTask":[{"bounds":{"x":447,"y":180,"width":24,"height":17},"nodeType":"userTask","id":"39282be48b5146b8840c8540ba48deff","name":"起草","description":"","property":"","code":"","no":"","commentTitle":"","needComment":"true","onCreateEvent":"","afterSubmitEvent":"","isFirst":true,"multiInstance":"single","notice_im":"false","notice_app":"","taskOverConditionExpression":"nrOfInstances == nrOfCompletedInstances","assignee":[]},{"bounds":{"x":594,"y":187,"width":84,"height":17},"nodeType":"userTask","id":"5c6816142b5f48eb84a9564387439551","name":"接收方签收确认","description":"","property":"","code":"","no":"","commentTitle":"","needComment":"true","onCreateEvent":"","afterSubmitEvent":"","isFirst":false,"multiInstance":"single","notice_im":"false","notice_app":"","taskOverConditionExpression":"nrOfInstances == nrOfCompletedInstances","assignee":[{"type":"column","id":"209bf2830800d465bd66f6d79947b312","tableName":"pz_yjd","columnName":"touserid"}]}],"gateway":[],"sequenceFlow":[{"id":"f7395b3c5330419b8034473237ca5009_39282be48b5146b8840c8540ba48deff","sourceRef":"f7395b3c5330419b8034473237ca5009","targetRef":"39282be48b5146b8840c8540ba48deff","label":"","code":"","default":false,"conditionExpression":"","passExpression":""},{"id":"39282be48b5146b8840c8540ba48deff_5c6816142b5f48eb84a9564387439551","sourceRef":"39282be48b5146b8840c8540ba48deff","targetRef":"5c6816142b5f48eb84a9564387439551","label":"","code":"","default":false,"conditionExpression":"","passExpression":"sponsorGZL(gguid)"},{"id":"5c6816142b5f48eb84a9564387439551_6684049a5aad4f36bde9634afff6bb1b","sourceRef":"5c6816142b5f48eb84a9564387439551","targetRef":"6684049a5aad4f36bde9634afff6bb1b","label":"","code":"","default":false,"conditionExpression":"","passExpression":"verifyGZL(gguid)"}],"startEvent":{"bounds":{"x":331,"y":187,"width":42,"height":42},"nodeType":"startEvent","id":"f7395b3c5330419b8034473237ca5009","name":"开始"}}


id: 669f23929932df22f60cfdef
pid: 669f22ae9932df22f60cfded
appid: 606d21ab99328dc77af633f9
name: 凭证归还
fullname: /凭证归还
nodetype: flow
createdate: 2024.07.23 11:29:23.000
lastmodifieddate: 2024.09.18 14:40:46.445
value:
{"process":{"id":"669f23929932df22f60cfdef","name":"凭证归还","isExecutable":true},"endEvent":[{"bounds":{"x":901,"y":189,"width":38,"height":38},"nodeType":"endEvent","id":"f5615da75a874672aeab2128b5fe0a6c","name":"结束"}],"userTask":[{"bounds":{"x":447,"y":180,"width":24,"height":17},"nodeType":"userTask","id":"6175b8dc89854dcf8c6579eb1ae4deaa","name":"起草","description":"","property":"","code":"","no":"","commentTitle":"","needComment":"true","onCreateEvent":"","afterSubmitEvent":"","isFirst":true,"multiInstance":"single","notice_im":"false","notice_app":"","taskOverConditionExpression":"nrOfInstances == nrOfCompletedInstances","assignee":[]},{"bounds":{"x":600,"y":183,"width":84,"height":17},"nodeType":"userTask","id":"69335034e0914da491d02484293b0650","name":"接收方签收确认","description":"","property":"","code":"","no":"","commentTitle":"","needComment":"true","onCreateEvent":"","afterSubmitEvent":"","isFirst":false,"multiInstance":"single","notice_im":"false","notice_app":"","taskOverConditionExpression":"nrOfInstances == nrOfCompletedInstances","assignee":[{"type":"column","id":"4b96f865ed142c158400bce6c0263d46","tableName":"pz_yjd","columnName":"touserid"}]}],"gateway":[],"sequenceFlow":[{"id":"3d00aac5a8f14a06ba1c12a219cb9766_6175b8dc89854dcf8c6579eb1ae4deaa","sourceRef":"3d00aac5a8f14a06ba1c12a219cb9766","targetRef":"6175b8dc89854dcf8c6579eb1ae4deaa","label":"","code":"","default":false,"conditionExpression":"","passExpression":""},{"id":"6175b8dc89854dcf8c6579eb1ae4deaa_69335034e0914da491d02484293b0650","sourceRef":"6175b8dc89854dcf8c6579eb1ae4deaa","targetRef":"69335034e0914da491d02484293b0650","label":"","code":"","default":false,"conditionExpression":"","passExpression":"sponsorGZL(gguid)"},{"id":"69335034e0914da491d02484293b0650_f5615da75a874672aeab2128b5fe0a6c","sourceRef":"69335034e0914da491d02484293b0650","targetRef":"f5615da75a874672aeab2128b5fe0a6c","label":"","code":"","default":false,"conditionExpression":"","passExpression":"verifyGZL(gguid)"}],"startEvent":{"bounds":{"x":331,"y":187,"width":42,"height":42},"nodeType":"startEvent","id":"3d00aac5a8f14a06ba1c12a219cb9766","name":"开始"}}


id: 669f23929932df22f60cfdf5
pid: 669f22ae9932df22f60cfddd
appid: 606d21ab99328dc77af633f9
name: bpmn
nodetype: column
createdate: 2024.07.23 11:29:52.000
lastmodifieddate: 2024.09.18 14:40:46.445
value:
<?xml version="1.0" encoding="UTF-8"?>
        <definitions id="definitions_669f22ae9932df22f60cfddd"  targetNamespace="http://flowable.org/bpmn20"  
                    xmlns:flowable="http://flowable.org/bpmn"  
                    xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">    
<process id="id_669f22ae9932df22f60cfddd" name="凭证借阅" isExecutable="true">  
<startEvent id="id_f7395b3c5330419b8034473237ca5009" name="开始"/>
<userTask id="id_39282be48b5146b8840c8540ba48deff" name="起草" 
                    flowable:isFirst="true" 
                    flowable:multiInstance="single"  
                    flowable:notice_im="false" 
                    flowable:notice_app="" 
>
  <extensionElements>
                            <flowable:taskListener event="all" class="api.flow.TaskListenerImpl"></flowable:taskListener>

          <flowable:candidateDefine><![CDATA[[]]]></flowable:candidateDefine>
                            <flowable:code><![CDATA[]]></flowable:code>
                            <flowable:no><![CDATA[]]></flowable:no>
                            <flowable:commentTitle><![CDATA[]]></flowable:commentTitle>
                            <flowable:needComment><![CDATA[true]]></flowable:needComment>
                            
                            
                            <flowable:onCreateEvent><![CDATA[]]></flowable:onCreateEvent>
                            <flowable:afterSubmitEvent><![CDATA[]]></flowable:afterSubmitEvent>
                            <flowable:description><![CDATA[]]></flowable:description>
                            <flowable:property><![CDATA[]]></flowable:property>
                            
                    </extensionElements>  
               
</userTask>
<userTask id="id_5c6816142b5f48eb84a9564387439551" name="接收方签收确认" 
                    flowable:isFirst="false" 
                    flowable:multiInstance="single"  
                    flowable:notice_im="false" 
                    flowable:notice_app="" 
>
  <extensionElements>
                            <flowable:taskListener event="all" class="api.flow.TaskListenerImpl"></flowable:taskListener>

          <flowable:candidateDefine><![CDATA[[{"type":"column","id":"209bf2830800d465bd66f6d79947b312","tableName":"pz_yjd","columnName":"touserid"}]]]></flowable:candidateDefine>
                            <flowable:code><![CDATA[]]></flowable:code>
                            <flowable:no><![CDATA[]]></flowable:no>
                            <flowable:commentTitle><![CDATA[]]></flowable:commentTitle>
                            <flowable:needComment><![CDATA[true]]></flowable:needComment>
                            
                            
                            <flowable:onCreateEvent><![CDATA[]]></flowable:onCreateEvent>
                            <flowable:afterSubmitEvent><![CDATA[]]></flowable:afterSubmitEvent>
                            <flowable:description><![CDATA[]]></flowable:description>
                            <flowable:property><![CDATA[]]></flowable:property>
                            
                    </extensionElements>  
               
</userTask>
<endEvent id="id_6684049a5aad4f36bde9634afff6bb1b" name="结束"/>

            <sequenceFlow id="id_f7395b3c5330419b8034473237ca5009_39282be48b5146b8840c8540ba48deff" 
                 sourceRef="id_f7395b3c5330419b8034473237ca5009" 
                 targetRef="id_39282be48b5146b8840c8540ba48deff" 
                 name="开始→起草" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>

            <sequenceFlow id="id_39282be48b5146b8840c8540ba48deff_5c6816142b5f48eb84a9564387439551" 
                 sourceRef="id_39282be48b5146b8840c8540ba48deff" 
                 targetRef="id_5c6816142b5f48eb84a9564387439551" 
                 name="起草→接收方签收确认" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:passExpression><![CDATA[sponsorGZL(gguid)]]></flowable:passExpression>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>

            <sequenceFlow id="id_5c6816142b5f48eb84a9564387439551_6684049a5aad4f36bde9634afff6bb1b" 
                 sourceRef="id_5c6816142b5f48eb84a9564387439551" 
                 targetRef="id_6684049a5aad4f36bde9634afff6bb1b" 
                 name="接收方签收确认→结束" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:passExpression><![CDATA[verifyGZL(gguid)]]></flowable:passExpression>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>
</process>
                   </definitions>


id: 669f23929932df22f60cfe01
pid: 669f23929932df22f60cfdef
appid: 606d21ab99328dc77af633f9
name: bpmn
nodetype: column
createdate: 2024.07.23 11:30:52.000
lastmodifieddate: 2024.09.18 14:40:46.446
value:
<?xml version="1.0" encoding="UTF-8"?>
        <definitions id="definitions_669f23929932df22f60cfdef"  targetNamespace="http://flowable.org/bpmn20"  
                    xmlns:flowable="http://flowable.org/bpmn"  
                    xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL">    
<process id="id_669f23929932df22f60cfdef" name="凭证归还" isExecutable="true">  
<startEvent id="id_3d00aac5a8f14a06ba1c12a219cb9766" name="开始"/>
<userTask id="id_6175b8dc89854dcf8c6579eb1ae4deaa" name="起草" 
                    flowable:isFirst="true" 
                    flowable:multiInstance="single"  
                    flowable:notice_im="false" 
                    flowable:notice_app="" 
>
  <extensionElements>
                            <flowable:taskListener event="all" class="api.flow.TaskListenerImpl"></flowable:taskListener>

          <flowable:candidateDefine><![CDATA[[]]]></flowable:candidateDefine>
                            <flowable:code><![CDATA[]]></flowable:code>
                            <flowable:no><![CDATA[]]></flowable:no>
                            <flowable:commentTitle><![CDATA[]]></flowable:commentTitle>
                            <flowable:needComment><![CDATA[true]]></flowable:needComment>
                            
                            
                            <flowable:onCreateEvent><![CDATA[]]></flowable:onCreateEvent>
                            <flowable:afterSubmitEvent><![CDATA[]]></flowable:afterSubmitEvent>
                            <flowable:description><![CDATA[]]></flowable:description>
                            <flowable:property><![CDATA[]]></flowable:property>
                            
                    </extensionElements>  
               
</userTask>
<userTask id="id_69335034e0914da491d02484293b0650" name="接收方签收确认" 
                    flowable:isFirst="false" 
                    flowable:multiInstance="single"  
                    flowable:notice_im="false" 
                    flowable:notice_app="" 
>
  <extensionElements>
                            <flowable:taskListener event="all" class="api.flow.TaskListenerImpl"></flowable:taskListener>

          <flowable:candidateDefine><![CDATA[[{"type":"column","id":"4b96f865ed142c158400bce6c0263d46","tableName":"pz_yjd","columnName":"touserid"}]]]></flowable:candidateDefine>
                            <flowable:code><![CDATA[]]></flowable:code>
                            <flowable:no><![CDATA[]]></flowable:no>
                            <flowable:commentTitle><![CDATA[]]></flowable:commentTitle>
                            <flowable:needComment><![CDATA[true]]></flowable:needComment>
                            
                            
                            <flowable:onCreateEvent><![CDATA[]]></flowable:onCreateEvent>
                            <flowable:afterSubmitEvent><![CDATA[]]></flowable:afterSubmitEvent>
                            <flowable:description><![CDATA[]]></flowable:description>
                            <flowable:property><![CDATA[]]></flowable:property>
                            
                    </extensionElements>  
               
</userTask>
<endEvent id="id_f5615da75a874672aeab2128b5fe0a6c" name="结束"/>

            <sequenceFlow id="id_3d00aac5a8f14a06ba1c12a219cb9766_6175b8dc89854dcf8c6579eb1ae4deaa" 
                 sourceRef="id_3d00aac5a8f14a06ba1c12a219cb9766" 
                 targetRef="id_6175b8dc89854dcf8c6579eb1ae4deaa" 
                 name="开始→起草" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>

            <sequenceFlow id="id_6175b8dc89854dcf8c6579eb1ae4deaa_69335034e0914da491d02484293b0650" 
                 sourceRef="id_6175b8dc89854dcf8c6579eb1ae4deaa" 
                 targetRef="id_69335034e0914da491d02484293b0650" 
                 name="起草→接收方签收确认" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:passExpression><![CDATA[sponsorGZL(gguid)]]></flowable:passExpression>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>

            <sequenceFlow id="id_69335034e0914da491d02484293b0650_f5615da75a874672aeab2128b5fe0a6c" 
                 sourceRef="id_69335034e0914da491d02484293b0650" 
                 targetRef="id_f5615da75a874672aeab2128b5fe0a6c" 
                 name="接收方签收确认→结束" 
             
                  
>
<extensionElements>
<flowable:description><![CDATA[]]></flowable:description>
<flowable:passExpression><![CDATA[verifyGZL(gguid)]]></flowable:passExpression>
<flowable:code><![CDATA[]]></flowable:code>
<flowable:executionListener event="end" class="api.flow.ExecutionListenerImpl"></flowable:executionListener>
</extensionElements>
</sequenceFlow>
</process>
                   </definitions>


# app_script

id: 6090ffc7280cc084c578f0c5
pid: templateScriptOnServer
name: templateScriptOnServer-5d7cf44d993297db174018e2clone20210504160324
code: 6090ffc7280cc084c578f0c5
fullname: /templateScriptOnServer-5d7cf44d993297db174018e2clone20210504160324
fullcode: 6090ffc7280cc084c578f0c5
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:46.824
value:
function work_order_unit_message(gguid,action){
	runTask("work_order_unit",{"gguid":gguid,"action":action});
}

function new_work_order_unit_message(gguid,action){
	runTask("new_work_order_unit",{"gguid":gguid,"action":action});
}


id: 609d2b1f5db2d89ef50d29da
pid: 609d3f3f5db2b0a331d6bced
name: functionlist
code: 609d2b1f5db2d89ef50d29da
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/functionlist
nodetype: column
value: ["main"]
createdate: 2021.05.13 23:26:55.000
lastmodifieddate: 2024.09.18 14:40:46.825
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d2b1f5db2d89ef50d29da


id: 609d2b1f5db2d89ef50d29db
pid: 609d3f3f5db2b0a331d6bced
name: functioncheckpoint
code: 609d2b1f5db2d89ef50d29db
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/functioncheckpoint
nodetype: column
value: {}
createdate: 2021.05.13 23:26:55.000
lastmodifieddate: 2024.09.18 14:40:46.825
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d2b1f5db2d89ef50d29db


id: 609d3cfc5db2b0a331d6bb4b
pid: templateScriptOnServer
name: templateScriptOnServer-609d3cfc5db2b0a331d6bb4b
code: 609d3cfc5db2b0a331d6bb4b
fullname: /templateScriptOnServer-609d3cfc5db2b0a331d6bb4b
fullcode: 609d3cfc5db2b0a331d6bb4b
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:46.825
value:
function getImageList1()
{
    return getImageList("");
}
function getImageList2()
{
    return getImageList("回收站");
}


//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function getImageList(info2) {
     
    //排除掉回收站的图片
    var sql= "select * from  dzpz_imgpool_fileupload  where  gguid='" + currentGUID() + "'   and ifnull(info2,'')='"+info2+"'  order by info1 ";
    println( sql);
    var ds = newDataStore("", sql); // info1 是客户端文件创建的时间，以它排序
    ds.setOnceRetrieveCount(400);
    var n = ds.retrieve();
    
    var ret = [];
    for (var i = 0; i < n; i++) {
        ret.push(JSON.parse(ds.getJSONRow(i, true)));
    }

    return  { success:true,  data:ret};

}

function  moveImageToRecycle(id)
{
    
    runSQL("",  "update dzpz_imgpool_fileupload set info2='回收站' where id='"+id+"'  ",true);

}

function  moveImageToNormal(id)
{
    var config = JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user", {}));
    runSQL(config.dbpool,  " update "+config.logTable+ " set info2='' where id='"+id+"'  ",true);
}

function  realDeleteImage(id)
{
    
    runSQL("",  "delete from dzpz_imgpool_fileupload  where id='"+id+"'  ",true);

}


id: 609d3f3f5db2b0a331d6bced
pid: 609d3f3f5db2b0a331d6bce1
name: Electron调用本接口向自已推送消息
code: electronPushMessageToSelf
namepath: /凭证数字化/由Electron调用的接口
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
fullcode: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
nodetype: leaf
createdate: 2021.05.13 23:24:05.000
lastmodifieddate: 2024.09.18 14:40:46.825
value:
function main(arg)
{

    println(arg);

    var userid= currentUserId();
    println(userid);
    return  userid;
}


id: 609d3f3f5db2b0a331d6bcf5
pid: 609d3f3f5db2b0a331d6bced
name: enabled
code: 609d3f3f5db2b0a331d6bcf5
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/enabled
nodetype: column
value: true
createdate: 2021.05.13 23:24:26.000
lastmodifieddate: 2024.09.18 14:40:46.825
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d3f3f5db2b0a331d6bcf5


id: 609d3f3f5db2b0a331d6bcf6
pid: 609d3f3f5db2b0a331d6bced
name: timeout
code: 609d3f3f5db2b0a331d6bcf6
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/timeout
nodetype: column
value: 300
createdate: 2021.05.13 23:24:26.000
lastmodifieddate: 2024.09.18 14:40:46.825
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d3f3f5db2b0a331d6bcf6


id: 609d3f3f5db2b0a331d6bcf7
pid: 609d3f3f5db2b0a331d6bced
name: writeCallingLog
code: 609d3f3f5db2b0a331d6bcf7
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/writeCallingLog
nodetype: column
value: true
createdate: 2021.05.13 23:24:26.000
lastmodifieddate: 2024.09.18 14:40:46.825
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d3f3f5db2b0a331d6bcf7


id: 609d3f3f5db2b0a331d6bcf8
pid: 609d3f3f5db2b0a331d6bced
name: runningLog
code: 609d3f3f5db2b0a331d6bcf8
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/runningLog
nodetype: column
value: true
createdate: 2021.05.13 23:24:26.000
lastmodifieddate: 2024.09.18 14:40:46.825
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d3f3f5db2b0a331d6bcf8


id: 609d3f3f5db2b0a331d6bcf9
pid: 609d3f3f5db2b0a331d6bced
name: deletelogafter
code: 609d3f3f5db2b0a331d6bcf9
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/deletelogafter
nodetype: column
value: 7
createdate: 2021.05.13 23:24:26.000
lastmodifieddate: 2024.09.18 14:40:46.825
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d3f3f5db2b0a331d6bcf9


id: 609d3f3f5db2b0a331d6bcfa
pid: 609d3f3f5db2b0a331d6bced
name: maxlogsize
code: 609d3f3f5db2b0a331d6bcfa
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/maxlogsize
nodetype: column
value: 50
createdate: 2021.05.13 23:24:26.000
lastmodifieddate: 2024.09.18 14:40:46.825
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d3f3f5db2b0a331d6bcfa


id: 609d3f3f5db2b0a331d6bcfb
pid: 609d3f3f5db2b0a331d6bced
name: maxactivethreadcount
code: 609d3f3f5db2b0a331d6bcfb
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/maxactivethreadcount
nodetype: column
value: 30
createdate: 2021.05.13 23:24:26.000
lastmodifieddate: 2024.09.18 14:40:46.825
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d3f3f5db2b0a331d6bcfb


id: 609d3f3f5db2b0a331d6bcfc
pid: 609d3f3f5db2b0a331d6bced
name: maxwaittime
code: 609d3f3f5db2b0a331d6bcfc
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/maxwaittime
nodetype: column
value: 30
createdate: 2021.05.13 23:24:26.000
lastmodifieddate: 2024.09.18 14:40:46.825
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d3f3f5db2b0a331d6bcfc


id: 609d3f3f5db2b0a331d6bcfd
pid: 609d3f3f5db2b0a331d6bced
name: anonymousRun
code: 609d3f3f5db2b0a331d6bcfd
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/anonymousRun
nodetype: column
value: true
createdate: 2021.05.13 23:24:26.000
lastmodifieddate: 2024.09.18 14:40:46.825
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d3f3f5db2b0a331d6bcfd


id: 609d44aa5db2b0a331d6bd35
pid: 609d3f3f5db2b0a331d6bced
name: code
code: 609d44aa5db2b0a331d6bd35
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/code
nodetype: column
value: electronPushMessageToSelf
createdate: 2021.05.13 23:24:49.000
lastmodifieddate: 2024.09.18 14:40:46.825
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d44aa5db2b0a331d6bd35


id: 609d44aa5db2b0a331d6bd36
pid: 609d3f3f5db2b0a331d6bced
name: sharding
code: 609d44aa5db2b0a331d6bd36
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/sharding
nodetype: column
createdate: 2021.05.13 23:24:49.000
lastmodifieddate: 2024.09.18 14:40:46.825
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d44aa5db2b0a331d6bd36


id: 609d44aa5db2b0a331d6bd37
pid: 609d3f3f5db2b0a331d6bced
name: type_rhino
code: 609d44aa5db2b0a331d6bd37
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/type_rhino
nodetype: column
value: rhino
createdate: 2021.05.13 23:24:49.000
lastmodifieddate: 2024.09.18 14:40:46.825
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d44aa5db2b0a331d6bd37


id: 609d44aa5db2b0a331d6bd38
pid: 609d3f3f5db2b0a331d6bced
name: engine
code: 609d44aa5db2b0a331d6bd38
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/engine
nodetype: column
value: rhino
createdate: 2021.05.13 23:24:49.000
lastmodifieddate: 2024.09.18 14:40:46.825
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d44aa5db2b0a331d6bd38


id: 609d44aa5db2b0a331d6bd39
pid: 609d3f3f5db2b0a331d6bced
name: type_v8
code: 609d44aa5db2b0a331d6bd39
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/type_v8
nodetype: column
value: v8
createdate: 2021.05.13 23:24:49.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d44aa5db2b0a331d6bd39


id: 609d44aa5db2b0a331d6bd3a
pid: 609d3f3f5db2b0a331d6bced
name: roles
code: 609d44aa5db2b0a331d6bd3a
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/roles
nodetype: column
createdate: 2021.05.13 23:24:49.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d44aa5db2b0a331d6bd3a


id: 609d44aa5db2b0a331d6bd3b
pid: 609d3f3f5db2b0a331d6bced
name: group_AAAAAAA=
code: 609d44aa5db2b0a331d6bd3b
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/group_AAAAAAA=
nodetype: column
value: false
createdate: 2021.05.13 23:24:49.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d44aa5db2b0a331d6bd3b


id: 609d44aa5db2b0a331d6bd3c
pid: 609d3f3f5db2b0a331d6bced
name: role-default
code: 609d44aa5db2b0a331d6bd3c
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/role-default
nodetype: column
value: false
createdate: 2021.05.13 23:24:49.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d44aa5db2b0a331d6bd3c


id: 609d44aa5db2b0a331d6bd3d
pid: 609d3f3f5db2b0a331d6bced
name: description
code: 609d44aa5db2b0a331d6bd3d
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/description
nodetype: column
createdate: 2021.05.13 23:24:49.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d44aa5db2b0a331d6bd3d


id: 609d45045db2b0a331d6bd99
pid: 609d3f3f5db2b0a331d6bced
name: functionGroup
code: 609d45045db2b0a331d6bd99
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/functionGroup
nodetype: column
createdate: 2021.05.13 23:26:55.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d45045db2b0a331d6bd99

value:
{"全局函数":[{"source":"function main(","comment":"","group":"","caption":"","needRightControl":"","func":"main","funcTitle":"function main","index":0}]}


id: 609d45045db2b0a331d6bd9c
pid: 609d3f3f5db2b0a331d6bced
name: finalscript
code: 609d45045db2b0a331d6bd9c
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/finalscript
nodetype: column
createdate: 2021.05.13 23:26:55.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d45045db2b0a331d6bd9c

value:
function main(arg)
{

    println(arg);

    var userid= currentUserId();
    println(userid);
    return  userid;
}


id: 609d45045db2b0a331d6bd9d
pid: 609d3f3f5db2b0a331d6bced
name: depend
code: 609d45045db2b0a331d6bd9d
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/depend
nodetype: column
value: ,
createdate: 2021.05.13 23:26:55.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.609d45045db2b0a331d6bd9d


id: 609d4b105db2b0a331d6bf04
pid: 609d3f3f5db2b0a331d6bce1
name: 得到当前用户待归档图片单据的记录ID
code: get_dzpz_imgpool_id_of_current_user
namepath: /凭证数字化/由Electron调用的接口
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
fullcode: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
nodetype: leaf
createdate: 2021.05.13 23:51:45.000
lastmodifieddate: 2024.09.18 14:40:46.826
value:
//为每个操作员创建一个待归档图片单据 ， 所有单据都先上传到这个单据中做附件
function main(arg) {
    var gguid = '';
    runSQL(""," create unique index ui_dzpz_imgpool_userid on dzpz_imgpool (userid) ");

    var ds = newDataStore("", "select * from dzpz_imgpool  ");
    ds.setUpdateProperty("dzpz_imgpool", "id", "*", "id");
    println ( "currentUserId="+ currentUserId());
    ds.retrieve(" userid='" + currentUserId() + "'");
    println( ds.getSelectLastRetrieved());
    if (ds.getRowCount() == 1) {
        gguid = ds.getString(0, "gguid");
    } else {

        println( "new record");
        ds.insertRow(0);
        gguid = newGUID();
        ds.setValue(0, "id", gguid);
        ds.setValue(0, "gguid", gguid);
        ds.setValue(0, "billno", gguid);
        ds.setValue(0, "billdate", newDate());
        ds.setValue(0, "billtype", '');
        ds.setValue(0, "userid", currentUserId());
        ds.setValue(0, "username", currentUserShowName());
        ds.setValue(0, "deleteflag", 0);
        ds.setValue(0, "blocksize", 128);
        

        if (ds.update(true)) {
            error = ds.getError().getMessage();
            println(error);
            return { success: false, message: error };
        }else
        {
            ds.retrieve(" userid='" + currentUserId() + "'");
            gguid = ds.getString(0, "gguid");
        }
    }

    var blockSize=  ds.getInt(0,"blocksize");
    if( blockSize==0) blockSize=128; 

    //提供图片上传的必要的参数
    var config = { "serverIndex": "2", 
                    "dbpool": "default", 
                    "logTable": "dzpz_imgpool_fileupload", 
                    "blockSize": blockSize, 
                    "imgMaxSize": 1920, 
                    "groupName": "附件",
                     "tableName": "dzpz_imgpool", 
                     "gguid": gguid, 
                     "path": "dzpz_imgpool/"+ date2yyyymmdd(newDate(), "/"), 
                     "maxThumbnailSize": 512 ,
                     "responseType":"JSON"  //表示上传成功捂返回 JSON格式的结果
             }

    println(JSON.stringify(config));
    return config;
}


id: 609d4b105db2b0a331d6bf0c
pid: 609d4b105db2b0a331d6bf04
name: enabled
code: 609d4b105db2b0a331d6bf0c
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/enabled
nodetype: column
value: true
createdate: 2021.05.13 23:52:02.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf0c


id: 609d4b105db2b0a331d6bf0d
pid: 609d4b105db2b0a331d6bf04
name: timeout
code: 609d4b105db2b0a331d6bf0d
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/timeout
nodetype: column
value: 300
createdate: 2021.05.13 23:52:02.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf0d


id: 609d4b105db2b0a331d6bf0e
pid: 609d4b105db2b0a331d6bf04
name: writeCallingLog
code: 609d4b105db2b0a331d6bf0e
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/writeCallingLog
nodetype: column
value: true
createdate: 2021.05.13 23:52:02.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf0e


id: 609d4b105db2b0a331d6bf0f
pid: 609d4b105db2b0a331d6bf04
name: runningLog
code: 609d4b105db2b0a331d6bf0f
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/runningLog
nodetype: column
value: true
createdate: 2021.05.13 23:52:02.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf0f


id: 609d4b105db2b0a331d6bf10
pid: 609d4b105db2b0a331d6bf04
name: deletelogafter
code: 609d4b105db2b0a331d6bf10
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/deletelogafter
nodetype: column
value: 7
createdate: 2021.05.13 23:52:02.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf10


id: 609d4b105db2b0a331d6bf11
pid: 609d4b105db2b0a331d6bf04
name: maxlogsize
code: 609d4b105db2b0a331d6bf11
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/maxlogsize
nodetype: column
value: 50
createdate: 2021.05.13 23:52:02.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf11


id: 609d4b105db2b0a331d6bf12
pid: 609d4b105db2b0a331d6bf04
name: maxactivethreadcount
code: 609d4b105db2b0a331d6bf12
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/maxactivethreadcount
nodetype: column
value: 30
createdate: 2021.05.13 23:52:02.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf12


id: 609d4b105db2b0a331d6bf13
pid: 609d4b105db2b0a331d6bf04
name: maxwaittime
code: 609d4b105db2b0a331d6bf13
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/maxwaittime
nodetype: column
value: 30
createdate: 2021.05.13 23:52:02.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf13


id: 609d4b105db2b0a331d6bf14
pid: 609d4b105db2b0a331d6bf04
name: anonymousRun
code: 609d4b105db2b0a331d6bf14
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/anonymousRun
nodetype: column
value: true
createdate: 2021.05.13 23:52:02.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf14


id: 609d4b105db2b0a331d6bf2a
pid: 609d4b105db2b0a331d6bf04
name: code
code: 609d4b105db2b0a331d6bf2a
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/code
nodetype: column
value: get_dzpz_imgpool_id_of_current_user
createdate: 2021.05.13 23:53:10.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf2a


id: 609d4b105db2b0a331d6bf2b
pid: 609d4b105db2b0a331d6bf04
name: sharding
code: 609d4b105db2b0a331d6bf2b
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/sharding
nodetype: column
createdate: 2021.05.13 23:53:10.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf2b


id: 609d4b105db2b0a331d6bf2c
pid: 609d4b105db2b0a331d6bf04
name: type_rhino
code: 609d4b105db2b0a331d6bf2c
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/type_rhino
nodetype: column
value: rhino
createdate: 2021.05.13 23:53:10.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf2c


id: 609d4b105db2b0a331d6bf2d
pid: 609d4b105db2b0a331d6bf04
name: engine
code: 609d4b105db2b0a331d6bf2d
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/engine
nodetype: column
value: rhino
createdate: 2021.05.13 23:53:10.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf2d


id: 609d4b105db2b0a331d6bf2e
pid: 609d4b105db2b0a331d6bf04
name: type_v8
code: 609d4b105db2b0a331d6bf2e
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/type_v8
nodetype: column
value: v8
createdate: 2021.05.13 23:53:10.000
lastmodifieddate: 2024.09.18 14:40:46.826
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf2e


id: 609d4b105db2b0a331d6bf2f
pid: 609d4b105db2b0a331d6bf04
name: roles
code: 609d4b105db2b0a331d6bf2f
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/roles
nodetype: column
createdate: 2021.05.13 23:53:10.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf2f


id: 609d4b105db2b0a331d6bf30
pid: 609d4b105db2b0a331d6bf04
name: group_AAAAAAA=
code: 609d4b105db2b0a331d6bf30
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/group_AAAAAAA=
nodetype: column
value: false
createdate: 2021.05.13 23:53:10.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf30


id: 609d4b105db2b0a331d6bf31
pid: 609d4b105db2b0a331d6bf04
name: role-default
code: 609d4b105db2b0a331d6bf31
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/role-default
nodetype: column
value: false
createdate: 2021.05.13 23:53:10.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf31


id: 609d4b105db2b0a331d6bf32
pid: 609d4b105db2b0a331d6bf04
name: description
code: 609d4b105db2b0a331d6bf32
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/description
nodetype: column
createdate: 2021.05.13 23:53:10.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf32


id: 609d4b105db2b0a331d6bf64
pid: 609d4b105db2b0a331d6bf04
name: functionGroup
code: 609d4b105db2b0a331d6bf64
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/functionGroup
nodetype: column
createdate: 2021.05.13 23:58:49.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf64

value:
{"全局函数":[{"source":"function main(arg)","comment":"","group":"","caption":"","needRightControl":"","func":"main","funcTitle":"function main","index":0}]}


id: 609d4b105db2b0a331d6bf67
pid: 609d4b105db2b0a331d6bf04
name: finalscript
code: 609d4b105db2b0a331d6bf67
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/finalscript
nodetype: column
createdate: 2021.05.13 23:58:49.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4b105db2b0a331d6bf67

value:
//为每个操作员创建一个待归档图片单据 ， 所有单据都先上传到这个单据中做附件
function main(arg) {
    var gguid = '';
    runSQL(""," create unique index ui_dzpz_imgpool_userid on dzpz_imgpool (userid) ");

    var ds = newDataStore("", "select * from dzpz_imgpool  ");
    ds.setUpdateProperty("dzpz_imgpool", "id", "*", "id");
    println ( "currentUserId="+ currentUserId());
    ds.retrieve(" userid='" + currentUserId() + "'");
    println( ds.getSelectLastRetrieved());
    if (ds.getRowCount() == 1) {
        gguid = ds.getString(0, "gguid");
    } else {

        println( "new record");
        ds.insertRow(0);
        gguid = newGUID();
        ds.setValue(0, "id", gguid);
        ds.setValue(0, "gguid", gguid);
        ds.setValue(0, "billno", gguid);
        ds.setValue(0, "billdate", newDate());
        ds.setValue(0, "billtype", '');
        ds.setValue(0, "userid", currentUserId());
        ds.setValue(0, "username", currentUserShowName());
        ds.setValue(0, "deleteflag", 0);
        ds.setValue(0, "blocksize", 128);
        

        if (ds.update(true)) {
            error = ds.getError().getMessage();
            println(error);
            return { success: false, message: error };
        }else
        {
            ds.retrieve(" userid='" + currentUserId() + "'");
            gguid = ds.getString(0, "gguid");
        }
    }

    var blockSize=  ds.getInt(0,"blocksize");
    if( blockSize==0) blockSize=128; 

    //提供图片上传的必要的参数
    var config = { "serverIndex": "2", 
                    "dbpool": "default", 
                    "logTable": "dzpz_imgpool_fileupload", 
                    "blockSize": blockSize, 
                    "imgMaxSize": 1920, 
                    "groupName": "附件",
                     "tableName": "dzpz_imgpool", 
                     "gguid": gguid, 
                     "path": "dzpz_imgpool/"+ date2yyyymmdd(newDate(), "/"), 
                     "maxThumbnailSize": 512 ,
                     "responseType":"JSON"  //表示上传成功捂返回 JSON格式的结果
             }

    println(JSON.stringify(config));
    return config;
}


id: 609d4ca45db2d89ef50d2db4
pid: 609d4b105db2b0a331d6bf04
name: functionlist
code: 609d4ca45db2d89ef50d2db4
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/functionlist
nodetype: column
value: ["main"]
createdate: 2021.05.13 23:58:50.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4ca45db2d89ef50d2db4


id: 609d4ca45db2d89ef50d2db5
pid: 609d4b105db2b0a331d6bf04
name: functioncheckpoint
code: 609d4ca45db2d89ef50d2db5
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/functioncheckpoint
nodetype: column
value: {}
createdate: 2021.05.13 23:58:50.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4ca45db2d89ef50d2db5


id: 609d4cb95db2b0a331d6bf68
pid: 609d4b105db2b0a331d6bf04
name: depend
code: 609d4cb95db2b0a331d6bf68
namepath: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user
fullname: /凭证数字化/由Electron调用的接口/得到当前用户待归档图片单据的记录ID/depend
nodetype: column
value: ,
createdate: 2021.05.13 23:58:50.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.get_dzpz_imgpool_id_of_current_user.609d4cb95db2b0a331d6bf68


id: 609deddb5db2696039463ca0
pid: 609d3f3f5db2b0a331d6bce1
name: 记录扫描端在上传成功后删除文件的日志
code: logForDeleteFileAfterUploadSuccess
namepath: /凭证数字化/由Electron调用的接口
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
fullcode: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
nodetype: leaf
createdate: 2021.05.14 20:57:59.000
lastmodifieddate: 2024.09.18 14:40:46.827
value:
//客户端在上传好文件后，把文件删除，并调用本任务记录下日志， 同时通知客户端，有新文件了，注意刷新
function main(arg) {

    var p = JSON.parse(arg);
    println("user:" + currentUserShowName() + " file: " + p.file + "  result:" + p.result);
    pushMessage("electronPushMessage", { cmd:"newFileUploaded",  file: p.file }, currentUserId());  //向当前用户推送消息 

}


id: 609deddb5db2696039463ca8
pid: 609deddb5db2696039463ca0
name: enabled
code: 609deddb5db2696039463ca8
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/enabled
nodetype: column
value: true
createdate: 2021.05.14 20:58:20.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609deddb5db2696039463ca8


id: 609deddb5db2696039463ca9
pid: 609deddb5db2696039463ca0
name: timeout
code: 609deddb5db2696039463ca9
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/timeout
nodetype: column
value: 300
createdate: 2021.05.14 20:58:20.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609deddb5db2696039463ca9


id: 609deddb5db2696039463caa
pid: 609deddb5db2696039463ca0
name: writeCallingLog
code: 609deddb5db2696039463caa
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/writeCallingLog
nodetype: column
value: true
createdate: 2021.05.14 20:58:20.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609deddb5db2696039463caa


id: 609deddb5db2696039463cab
pid: 609deddb5db2696039463ca0
name: runningLog
code: 609deddb5db2696039463cab
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/runningLog
nodetype: column
value: true
createdate: 2021.05.14 20:58:20.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609deddb5db2696039463cab


id: 609deddb5db2696039463cac
pid: 609deddb5db2696039463ca0
name: deletelogafter
code: 609deddb5db2696039463cac
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/deletelogafter
nodetype: column
value: 7
createdate: 2021.05.14 20:58:20.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609deddb5db2696039463cac


id: 609deddb5db2696039463cad
pid: 609deddb5db2696039463ca0
name: maxlogsize
code: 609deddb5db2696039463cad
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/maxlogsize
nodetype: column
value: 50
createdate: 2021.05.14 20:58:20.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609deddb5db2696039463cad


id: 609deddb5db2696039463cae
pid: 609deddb5db2696039463ca0
name: maxactivethreadcount
code: 609deddb5db2696039463cae
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/maxactivethreadcount
nodetype: column
value: 50
createdate: 2021.05.14 20:58:20.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609deddb5db2696039463cae


id: 609deddb5db2696039463caf
pid: 609deddb5db2696039463ca0
name: maxwaittime
code: 609deddb5db2696039463caf
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/maxwaittime
nodetype: column
value: 30
createdate: 2021.05.14 20:58:20.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609deddb5db2696039463caf


id: 609e47905db22e19b5c98ae3
pid: 609deddb5db2696039463ca0
name: functionlist
code: 609e47905db22e19b5c98ae3
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/functionlist
nodetype: column
value: ["main"]
createdate: 2021.05.14 20:59:23.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609e47905db22e19b5c98ae3


id: 609e47905db22e19b5c98ae4
pid: 609deddb5db2696039463ca0
name: functioncheckpoint
code: 609e47905db22e19b5c98ae4
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/functioncheckpoint
nodetype: column
value: {}
createdate: 2021.05.14 20:59:23.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609e47905db22e19b5c98ae4


id: 609e73ec5db2696039463cb0
pid: 609deddb5db2696039463ca0
name: anonymousRun
code: 609e73ec5db2696039463cb0
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/anonymousRun
nodetype: column
value: true
createdate: 2021.05.14 20:58:20.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609e73ec5db2696039463cb0


id: 609e73ec5db2696039463cc6
pid: 609deddb5db2696039463ca0
name: code
code: 609e73ec5db2696039463cc6
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/code
nodetype: column
value: logForDeleteFileAfterUploadSuccess
createdate: 2021.05.14 20:58:26.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609e73ec5db2696039463cc6


id: 609e73ec5db2696039463cc7
pid: 609deddb5db2696039463ca0
name: sharding
code: 609e73ec5db2696039463cc7
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/sharding
nodetype: column
createdate: 2021.05.14 20:58:26.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609e73ec5db2696039463cc7


id: 609e73ec5db2696039463cc8
pid: 609deddb5db2696039463ca0
name: type_rhino
code: 609e73ec5db2696039463cc8
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/type_rhino
nodetype: column
value: rhino
createdate: 2021.05.14 20:58:26.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609e73ec5db2696039463cc8


id: 609e73ec5db2696039463cc9
pid: 609deddb5db2696039463ca0
name: engine
code: 609e73ec5db2696039463cc9
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/engine
nodetype: column
value: rhino
createdate: 2021.05.14 20:58:26.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609e73ec5db2696039463cc9


id: 609e73ec5db2696039463cca
pid: 609deddb5db2696039463ca0
name: type_v8
code: 609e73ec5db2696039463cca
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/type_v8
nodetype: column
value: v8
createdate: 2021.05.14 20:58:26.000
lastmodifieddate: 2024.09.18 14:40:46.827
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609e73ec5db2696039463cca


id: 609e73ec5db2696039463ccb
pid: 609deddb5db2696039463ca0
name: roles
code: 609e73ec5db2696039463ccb
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/roles
nodetype: column
createdate: 2021.05.14 20:58:26.000
lastmodifieddate: 2024.09.18 14:40:46.828
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609e73ec5db2696039463ccb


id: 609e73ec5db2696039463ccc
pid: 609deddb5db2696039463ca0
name: group_AAAAAAA=
code: 609e73ec5db2696039463ccc
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/group_AAAAAAA=
nodetype: column
value: false
createdate: 2021.05.14 20:58:26.000
lastmodifieddate: 2024.09.18 14:40:46.828
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609e73ec5db2696039463ccc


id: 609e73ec5db2696039463ccd
pid: 609deddb5db2696039463ca0
name: role-default
code: 609e73ec5db2696039463ccd
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/role-default
nodetype: column
value: false
createdate: 2021.05.14 20:58:26.000
lastmodifieddate: 2024.09.18 14:40:46.828
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609e73ec5db2696039463ccd


id: 609e73ec5db2696039463cce
pid: 609deddb5db2696039463ca0
name: description
code: 609e73ec5db2696039463cce
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/description
nodetype: column
createdate: 2021.05.14 20:58:26.000
lastmodifieddate: 2024.09.18 14:40:46.828
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609e73ec5db2696039463cce


id: 609e73ec5db2696039463ce1
pid: 609deddb5db2696039463ca0
name: functionGroup
code: 609e73ec5db2696039463ce1
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/functionGroup
nodetype: column
createdate: 2021.05.14 20:59:23.000
lastmodifieddate: 2024.09.18 14:40:46.828
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609e73ec5db2696039463ce1

value:
{"全局函数":[{"source":"function main(","comment":"","group":"","caption":"","needRightControl":"","func":"main","funcTitle":"function main","index":0}]}


id: 609e73ec5db2696039463ce4
pid: 609deddb5db2696039463ca0
name: finalscript
code: 609e73ec5db2696039463ce4
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/finalscript
nodetype: column
createdate: 2021.05.14 20:59:23.000
lastmodifieddate: 2024.09.18 14:40:46.828
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609e73ec5db2696039463ce4

value:
//客户端在上传好文件后，把文件删除，并调用本任务记录下日志， 同时通知客户端，有新文件了，注意刷新
function main(arg) {

    var p = JSON.parse(arg);
    println("user:" + currentUserShowName() + " file: " + p.file + "  result:" + p.result);
    pushMessage("electronPushMessage", { cmd:"newFileUploaded",  file: p.file }, currentUserId());  //向当前用户推送消息 

}


id: 609e73ec5db2696039463ce5
pid: 609deddb5db2696039463ca0
name: depend
code: 609e73ec5db2696039463ce5
namepath: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess
fullname: /凭证数字化/由Electron调用的接口/记录扫描端在上传成功后删除文件的日志/depend
nodetype: column
value: ,
createdate: 2021.05.14 20:59:23.000
lastmodifieddate: 2024.09.18 14:40:47.195
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.logForDeleteFileAfterUploadSuccess.609e73ec5db2696039463ce5


id: 60a31c3c5db27838e0c0129e
pid: templateScriptOnServer
name: templateScriptOnServer-60a31c3c5db27838e0c0129e
code: 60a31c3c5db27838e0c0129e
fullname: /templateScriptOnServer-60a31c3c5db27838e0c0129e
fullcode: 60a31c3c5db27838e0c0129e
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:47.195
value:
function getImageList1() {
    return getImageList("凭证");
}
function getImageList2() {
    return getImageList("附件");
}


//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function getImageList(groupName) {

    //排除掉回收站的图片
    var sql = "select * from  dzpz_pzfj  where  gguid='" + currentGUID() + "'  and groupname='" + groupName + "'  order by info2 asc, groupname, info1 asc ";
    println(sql);
    var ds = newDataStore("", sql); // info1 是客户端文件创建的时间，以它排序
    var n = ds.retrieve();

    var ret = [];
    for (var i = 0; i < n; i++) {
        ret.push(JSON.parse(ds.getJSONRow(i, true)));
    }

    return { success: true, data: ret };

}


/**
 * 点击删除单据，在执行单据删除语句后（但尚未提交），系统在服务端触发本事件
 *
 *  可以在本事件中，注入一些操作，返回一组SQL，这此SQL与单据删除操作将在一个事务中执行。
 *
 * @notice 注意：本事件在服务端执行，不要试图访问任何前端UI信息。不要直接执行对数据库的写操作，如果需要
 * 请在返回值中返回这些语句，让系统把它们与单据删除并在一个事务中执行。
 *
 * @param gguid  要删除单据主记录的gguid ，等同于主表的id
 * @param session  一个JSON对象，用于在整个单据删除过程中的各个事件之间传递数据。各个事件
 * 脚本虽然写在一起，但它们是按顺序在服务器上分开独立执行的，各个事件可能并不是在同一个脚本
 * 引擎中执行，如果对session做了写的操作，必须在返回值中
 * 将它返回，系统将它做为参数传递到下一个事件中
 *
 * @return   返回值是这样的一个JSON对象
 * { success:true,
 *    message:'' ,
 *    sql: { "default" : [ sql1, sql2 ...] ,
 *            "dbpool2": [sql1, sql2 ...]
 *         }
 * }
 *   success=true 表示继续允许执行删除单据操作 ， 并且在执行单据删除后，执行一些SQL语句。sql定义的规则：
 *   { 连接池名称1: [ SQL数组] , 连接池名称2: [ SQL数组] ....  }
 *
 *
 * 如果 success 设置成false ,则在 message中放置错误提示信息，此时整个单据删除操作被立即终止
 *
 */
//@comment (group=单据,caption=单据删除语句执行后)
function afterBillDeleteOnServer(gguid, session) {

    //注意：此时单据尚未开始删除，仍可用 gguid 来查询单据数据

    var objectName = getStringFromSQL(`select objectname from app_archive where gguid='${gguid}'`);
    println(objectName + " 将被删除");
    deleteFileOnFileServer(1, objectName);
    var sql = `delete from app_archive where gguid='${gguid}'`;
    println(sql);

    return {
        success: true,
        message: "",
        session: session,
        sql: { "default": [sql] }  // 归档信息删除
    };

}


function back_repair(url, pzh) {
    var result = extractImagesFromPDF( safeURL(url), pzh, 4 * 1024); //小于 4k的忽略 ，pdf中每个图片右上角有一个凭证号的小图片，这个需要排除掉
    println("currentguid= "+ currentGUID(  ) );
    println(result);
    var imgs = result.imgs;
    for (var i = 0; i < imgs.length; i++) {
        uploadFile({
            file: imgs[i].path,
            serverIndex: 2,
            logTable: 'dzpz_pzfj',
            tablename: 'dzpz_pz',
            gguid: currentGUID(),
            groupName: i == 0 ? "凭证" : "附件",
            info1: imgs[i].createDate
        });
    }

    return imgs.length;  

}


id: 60a31c475db27838e0c01344
pid: templateScriptOnServer
name: templateScriptOnServer-60a31c475db27838e0c01344
code: 60a31c475db27838e0c01344
fullname: /templateScriptOnServer-60a31c475db27838e0c01344
fullcode: 60a31c475db27838e0c01344
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:47.195
value:
function saveLabel(corpid,data) {
    println(data.length);
    println("=====");
    println(JSON.stringify(data));
     

    var labels={};
    var dzpz_pz_ds = newDataStore("", "select * from dzpz_pz");
    dzpz_pz_ds.setUpdateProperty("dzpz_pz", "id", "*", "id");

    for (var i = 0; i < data.length; i++) {
        var one = data[i];

        var ym = one['记帐期'];
        var pzh = one['凭证号'];
        println(pzh);
        dzpz_pz_ds.retrieve(" corpid='" +  corpid + "' and  ym=" + ym + " and pzh='" + pzh + "'");
        var t = dzpz_pz_ds.getString(0, "labeldata");
        var id = dzpz_pz_ds.getString(0, "id");
        try {
            if (t != '') {
                t = JSON.parse(t);
            } else { t = {}; }
        } catch (err) {
            t = {};
        }
        println(typeof (t));
        if (typeof (t) != 'object') t = {};

        for (var p in one) {
            if( labels[p]==undefined) labels[p]=1;//记录下标签名称 
            var v = one[p];
            t[p] = v;
        }

        t = JSON.stringify(t);
        runSQL("", "update dzpz_pz set  labeldata='" + t + "' where  corpid='" + corpid  + "' and  ym=" + ym + " and pzh='" + pzh + "' and id='" + id + "'   ", true);

    }

    //最后再把标签名称保存一下
    runTask("保存标签名称" , { labels: Object.keys(labels) },10); //延时

}


id: 60a321f05db27838e0c014bf
pid: templateScriptOnServer
name: templateScriptOnServer-60a321f05db27838e0c014bf
code: 60a321f05db27838e0c014bf
fullname: /templateScriptOnServer-60a321f05db27838e0c014bf
fullcode: 60a321f05db27838e0c014bf
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:47.195
value:
//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)
function getImagePoolGGUID() {
    var ret = runTask("get_dzpz_imgpool_id_of_current_user", {});
    return JSON.parse(ret).gguid;

}

function getImagePoolBlockSize() {
    var ret = runTask("get_dzpz_imgpool_id_of_current_user", {});
    return JSON.parse(ret).blockSize;

}


//@comment (group=,caption=保存当前的缩略图大小,needRightControl=false)
function setImagePoolBlockSize(id, blockSize) {
    runSQL("", " update  dzpz_imgpool set blocksize=" + blockSize + " where gguid='" + id + "'  ");
}


//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)
function loadImagePoolData(config) {
    var onceCount = config.onceCount;
    if (onceCount == undefined) onceCount = 500;
    var config = JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user", {}));

    //排除掉回收站的图片
    var sql = "select * from " + config.logTable + "  where  (gguid='" + config.gguid +
        "'  or groupname='设备自动上传' ) and ifnull(info2,'')=''  order by info1 asc, filename asc ";
    println(sql);
    var ds = newDataStore(config.dbpool, sql); // info1 是客户端文件创建的时间，以它排序厅。
    ds.setOnceRetrieveCount(onceCount);

    var n = ds.retrieve();
    println(ds.getSelectLastRetrieved());

    var ret = [];
    for (var i = 0; i < n; i++) {
        ret.push(JSON.parse(ds.getJSONRow(i, true)));
    }

    println(ret);
    return { success: true, totalCount: ds.getDBRowCount(), data: ret };


}

function getTotalImageCount() {
    var config = JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user", {}));

    //排除掉回收站的图片
    var sql = "select count(*) as c from " + config.logTable + "  where  gguid='" + config.gguid +
        "'  and ifnull(info2,'')=''    ";
    println(sql);
    var ds = newDataStore(config.dbpool, sql); // info1 是客户端文件创建的时间，以它排序厅。


    ds.retrieve();
    println(ds.getSelectLastRetrieved());

    return ds.getInt(0, "c");

}

//@comment (group=,caption=保存监控目录设置,needRightControl=false)
function setMonitePath(hostName, path) {
    var ds = newDataStore("", "select * from dzpz_client");
    ds.setUpdateProperty("dzpz_client", "id", "*", "id");
    ds.retrieve(" hostname='" + hostName + "'");
    if (ds.getRowCount() == 0) {
        var newid = newGUID();
        ds.insertRow(0);
        ds.setValue(0, "id", newid);
        ds.setValue(0, "gguid", newid);
        ds.setValue(0, "billno", newid);
        ds.setValue(0, "userid", 1);
        ds.setValue(0, "username", '管理员');
        ds.setValue(0, "billtype", '');
        ds.setValue(0, "hostname", hostName);
    }
    ds.setValue(0, "path", path);
    ds.update(true);
    println(ds.getError().getMessage());

}


//@comment (group=,caption=获取指定机器的监控目录,needRightControl=false)
function getMonitePath(hostName) {
    return getStringFromSQL("select path from dzpz_client where  hostname='" + hostName + "'");
}


//@comment (group=,caption=构建凭证附件清单,needRightControl=false)
function getPZFJ(id) {
    // 在图片池中，info2 表示是否是垃圾箱， 在附件表中，info2记录的是手工调整后的顺序号
    var ds = newDataStore("", "select id , url_img , url_thumbnail ,groupname , info1 from  dzpz_pzfj where  gguid='" + id + "'  order by info2 asc,groupname , info1 asc ");
    var n = ds.retrieve();
    var ret = [];
    for (var i = 0; i < n; i++) {
        ret.push(JSON.parse(ds.getJSONRow(i, true)));
    }
    return ret;
}

//@comment (group=,caption=把凭证中的附件图片回归到待归档池中,needRightControl=false)
function putImageBackToPool(id) {
    println(id);
    return JSON.parse(runTask("凭证附件移除", { id: id }));
}


//@comment (group=,caption=追加图片到凭证中,needRightControl=false)
function addImageToPZ(pzid, images) {
    return JSON.parse(runTask("追加图片到凭证中", { pzid: pzid, images: images }));
}

function deletePZAndPutBackToPool(id) {
    return JSON.parse(runTask("删除凭证所有图片回归池中", { id: id }));
}

function moveImageToRecycle(id) {
    var config = JSON.parse(runTask("get_dzpz_imgpool_id_of_current_user", {}));
    runSQL(config.dbpool, " update " + config.logTable + " set info2='回收站' where id='" + id + "'  ", true);


}

//@comment (group=,caption=凭证号前缀,needRightControl=false)
function getPZHPrefix(corpid, ym) {
    return runTask("getPZHPrefix", { ym: ym, corpid: corpid });

}
//@comment (group=,caption=凭证号长度,needRightControl=false)
function getPZHLen(corpid) {
    return parseInt(runTask("getPZHLen", { corpid: corpid }));
}

function getLastPZH(corpid, ym) {
    var t = getStringFromSQL("select max(pzh) from dzpz_pz where corpid='" + corpid + "' and ym=" + ym);
    return t;
}


function do_imageRotate(id, rt) {
    var ret = imageRotate("", "dzpz_imgpool_fileupload", id, rt);
    println(JSON.stringify(ret));
    return ret;
}


function reorderImageFileIndex(imgs) {

}


function back_ocr(config) {
    config.src = config.src.replace(/电子凭证/g, ''); //把其中的汉字去掉，这个引发一个异常
    pushMessage('pz_ocr', { action: 'info', message: config.src }, currentUserId());
    var ret = OCR(config);
    println(ret);
    var t = ret.text || '';
    if (t == '') return '';

    //下面的算法， 根据每家凭证号的特点需要定制
    t = t.replace(/\s/g, '');
    var n = '' + t.match(/20[0-9]{2}-[0-9]{2}-[0-9]{2}/g);
    println(n);
    if(n)
    { 
    ym = '' + n;

    println( typeof( ym));

    ym = ym.replace(/[-]/g, '');
    if (ym.length > 6) ym = ym.substring(2, 6)   ;
    println(ym);
    }else{
        println("无法识别年月");
    }
    p = t.indexOf('第');
    if (p < 0) return '';
    t = t.substring(p + 1);
    p = t.substring(0, 4)

    return ym + right('0000' + p, 4);


}


id: 60a3505f5db27838e0c01592
pid: 60a321f05db27838e0c014bf
name: functionGroup
code: 60a3505f5db27838e0c01592
namepath: /templateScriptOnServer-60a321f05db27838e0c014bf
codepath: 60a321f05db27838e0c014bf
fullname: /templateScriptOnServer-60a321f05db27838e0c014bf/functionGroup
fullcode: 60a321f05db27838e0c014bf.60a3505f5db27838e0c01592
nodetype: column
createdate: 2021.05.18 16:22:19.000
lastmodifieddate: 2024.09.18 14:40:47.196
value:
{"全局函数":[{"source":"//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)\nfunction getImagePoolGGUID()","comment":"//@comment (group=,caption=得到当前操作员待归档图片对应的GGUID,needRightControl=false)","group":"","caption":"得到当前操作员待归档图片对应的GGUID","needRightControl":"false","func":"getImagePoolGGUID","funcTitle":"function getImagePoolGGUID","index":0},{"source":"function getImagePoolBlockSize()","comment":"","group":"","caption":"","needRightControl":"","func":"getImagePoolBlockSize","funcTitle":"function getImagePoolBlockSize","index":1},{"source":"//@comment (group=,caption=保存当前的缩略图大小,needRightControl=false)\nfunction setImagePoolBlockSize(id, blockSize)","comment":"//@comment (group=,caption=保存当前的缩略图大小,needRightControl=false)","group":"","caption":"保存当前的缩略图大小","needRightControl":"false","func":"setImagePoolBlockSize","funcTitle":"function setImagePoolBlockSize","index":2},{"source":"//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)\nfunction loadImagePoolData(config)","comment":"//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)","group":"","caption":"得到待归档的图片清单","needRightControl":"true","func":"loadImagePoolData","funcTitle":"function loadImagePoolData","index":3},{"source":"function getTotalImageCount()","comment":"","group":"","caption":"","needRightControl":"","func":"getTotalImageCount","funcTitle":"function getTotalImageCount","index":4},{"source":"//@comment (group=,caption=保存监控目录设置,needRightControl=false)\nfunction setMonitePath(hostName, path)","comment":"//@comment (group=,caption=保存监控目录设置,needRightControl=false)","group":"","caption":"保存监控目录设置","needRightControl":"false","func":"setMonitePath","funcTitle":"function setMonitePath","index":5},{"source":"//@comment (group=,caption=获取指定机器的监控目录,needRightControl=false)\nfunction getMonitePath(hostName)","comment":"//@comment (group=,caption=获取指定机器的监控目录,needRightControl=false)","group":"","caption":"获取指定机器的监控目录","needRightControl":"false","func":"getMonitePath","funcTitle":"function getMonitePath","index":6},{"source":"//@comment (group=,caption=构建凭证附件清单,needRightControl=false)\nfunction getPZFJ(id)","comment":"//@comment (group=,caption=构建凭证附件清单,needRightControl=false)","group":"","caption":"构建凭证附件清单","needRightControl":"false","func":"getPZFJ","funcTitle":"function getPZFJ","index":7},{"source":"//@comment (group=,caption=把凭证中的附件图片回归到待归档池中,needRightControl=false)\nfunction putImageBackToPool(id)","comment":"//@comment (group=,caption=把凭证中的附件图片回归到待归档池中,needRightControl=false)","group":"","caption":"把凭证中的附件图片回归到待归档池中","needRightControl":"false","func":"putImageBackToPool","funcTitle":"function putImageBackToPool","index":8},{"source":"//@comment (group=,caption=追加图片到凭证中,needRightControl=false)\nfunction addImageToPZ(pzid, images)","comment":"//@comment (group=,caption=追加图片到凭证中,needRightControl=false)","group":"","caption":"追加图片到凭证中","needRightControl":"false","func":"addImageToPZ","funcTitle":"function addImageToPZ","index":9},{"source":"function deletePZAndPutBackToPool(id)","comment":"","group":"","caption":"","needRightControl":"","func":"deletePZAndPutBackToPool","funcTitle":"function deletePZAndPutBackToPool","index":10},{"source":"function moveImageToRecycle(id)","comment":"","group":"","caption":"","needRightControl":"","func":"moveImageToRecycle","funcTitle":"function moveImageToRecycle","index":11},{"source":"//@comment (group=,caption=凭证号前缀,needRightControl=false)\nfunction getPZHPrefix(corpid, ym)","comment":"//@comment (group=,caption=凭证号前缀,needRightControl=false)","group":"","caption":"凭证号前缀","needRightControl":"false","func":"getPZHPrefix","funcTitle":"function getPZHPrefix","index":12},{"source":"//@comment (group=,caption=凭证号长度,needRightControl=false)\nfunction getPZHLen(corpid)","comment":"//@comment (group=,caption=凭证号长度,needRightControl=false)","group":"","caption":"凭证号长度","needRightControl":"false","func":"getPZHLen","funcTitle":"function getPZHLen","index":13},{"source":"function getLastPZH(corpid, ym)","comment":"","group":"","caption":"","needRightControl":"","func":"getLastPZH","funcTitle":"function getLastPZH","index":14},{"source":"function do_imageRotate(id, rt)","comment":"","group":"","caption":"","needRightControl":"","func":"do_imageRotate","funcTitle":"function do_imageRotate","index":15},{"source":"function reorderImageFileIndex(imgs)","comment":"","group":"","caption":"","needRightControl":"","func":"reorderImageFileIndex","funcTitle":"function reorderImageFileIndex","index":16},{"source":"function back_ocr(config)","comment":"","group":"","caption":"","needRightControl":"","func":"back_ocr","funcTitle":"function back_ocr","index":17}]}


id: 60a370d25db2863f93619766
pid: 60a321f05db27838e0c014bf
name: functionlist
code: 60a370d25db2863f93619766
namepath: /templateScriptOnServer-60a321f05db27838e0c014bf
codepath: 60a321f05db27838e0c014bf
fullname: /templateScriptOnServer-60a321f05db27838e0c014bf/functionlist
fullcode: 60a321f05db27838e0c014bf.60a370d25db2863f93619766
nodetype: column
createdate: 2021.05.18 16:22:20.000
lastmodifieddate: 2024.09.18 14:40:47.196
value:
["back_ocr","reorderImageFileIndex","do_imageRotate","getLastPZH","getPZHLen","getPZHPrefix","moveImageToRecycle","deletePZAndPutBackToPool","addImageToPZ","putImageBackToPool","getPZFJ","getMonitePath","setMonitePath","getTotalImageCount","loadImagePoolData","setImagePoolBlockSize","getImagePoolBlockSize","getImagePoolGGUID"]


id: 60a9e42d5db2172e3066fbfc
pid: 609d3f3f5db2b0a331d6bce1
name: 通知客户端有多少文件等待上传中
code: notifyNeedUploadFileCount
namepath: /凭证数字化/由Electron调用的接口
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
fullcode: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
nodetype: leaf
createdate: 2021.05.23 23:47:33.000
lastmodifieddate: 2024.09.18 14:40:47.196
value:
function main(arg) {
    var p = JSON.parse(arg);
    println(" fileCount " +  p.fileCount); 
    pushMessage("electronPushMessage", { cmd:'notifyNeedUploadFileCount' , fileCount: p.fileCount }, currentUserId());  //向当前用户推送消息 

}


id: 60a9e42d5db2172e3066fc04
pid: 60a9e42d5db2172e3066fbfc
name: enabled
code: 60a9e42d5db2172e3066fc04
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/enabled
nodetype: column
value: true
createdate: 2021.05.23 23:47:47.000
lastmodifieddate: 2024.09.18 14:40:47.196
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60a9e42d5db2172e3066fc04


id: 60a9e42d5db2172e3066fc05
pid: 60a9e42d5db2172e3066fbfc
name: timeout
code: 60a9e42d5db2172e3066fc05
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/timeout
nodetype: column
value: 300
createdate: 2021.05.23 23:47:47.000
lastmodifieddate: 2024.09.18 14:40:47.196
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60a9e42d5db2172e3066fc05


id: 60a9e42d5db2172e3066fc06
pid: 60a9e42d5db2172e3066fbfc
name: writeCallingLog
code: 60a9e42d5db2172e3066fc06
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/writeCallingLog
nodetype: column
value: true
createdate: 2021.05.23 23:47:47.000
lastmodifieddate: 2024.09.18 14:40:47.196
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60a9e42d5db2172e3066fc06


id: 60a9e42d5db2172e3066fc07
pid: 60a9e42d5db2172e3066fbfc
name: runningLog
code: 60a9e42d5db2172e3066fc07
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/runningLog
nodetype: column
value: true
createdate: 2021.05.23 23:47:47.000
lastmodifieddate: 2024.09.18 14:40:47.196
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60a9e42d5db2172e3066fc07


id: 60a9e42d5db2172e3066fc08
pid: 60a9e42d5db2172e3066fbfc
name: deletelogafter
code: 60a9e42d5db2172e3066fc08
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/deletelogafter
nodetype: column
value: 7
createdate: 2021.05.23 23:47:47.000
lastmodifieddate: 2024.09.18 14:40:47.196
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60a9e42d5db2172e3066fc08


id: 60a9e42d5db2172e3066fc09
pid: 60a9e42d5db2172e3066fbfc
name: maxlogsize
code: 60a9e42d5db2172e3066fc09
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/maxlogsize
nodetype: column
value: 50
createdate: 2021.05.23 23:47:47.000
lastmodifieddate: 2024.09.18 14:40:47.196
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60a9e42d5db2172e3066fc09


id: 60a9e42d5db2172e3066fc0a
pid: 60a9e42d5db2172e3066fbfc
name: maxactivethreadcount
code: 60a9e42d5db2172e3066fc0a
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/maxactivethreadcount
nodetype: column
value: 30
createdate: 2021.05.23 23:47:47.000
lastmodifieddate: 2024.09.18 14:40:47.196
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60a9e42d5db2172e3066fc0a


id: 60a9e42d5db2172e3066fc0b
pid: 60a9e42d5db2172e3066fbfc
name: maxwaittime
code: 60a9e42d5db2172e3066fc0b
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/maxwaittime
nodetype: column
value: 30
createdate: 2021.05.23 23:47:47.000
lastmodifieddate: 2024.09.18 14:40:47.196
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60a9e42d5db2172e3066fc0b


id: 60a9e42d5db2172e3066fc0d
pid: 60a9e42d5db2172e3066fbfc
name: anonymousRun
code: 60a9e42d5db2172e3066fc0d
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/anonymousRun
nodetype: column
value: true
createdate: 2021.05.23 23:47:47.000
lastmodifieddate: 2024.09.18 14:40:47.197
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60a9e42d5db2172e3066fc0d


id: 60aa75da5db236f288bee1f4
pid: 60a9e42d5db2172e3066fbfc
name: functionlist
code: 60aa75da5db236f288bee1f4
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/functionlist
nodetype: column
value: ["main"]
createdate: 2021.05.23 23:49:47.000
lastmodifieddate: 2024.09.18 14:40:47.197
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60aa75da5db236f288bee1f4


id: 60aa75da5db236f288bee1f6
pid: 60a9e42d5db2172e3066fbfc
name: functioncheckpoint
code: 60aa75da5db236f288bee1f6
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/functioncheckpoint
nodetype: column
value: {}
createdate: 2021.05.23 23:49:47.000
lastmodifieddate: 2024.09.18 14:40:47.197
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60aa75da5db236f288bee1f6


id: 60aa79235db2172e3066fc22
pid: 60a9e42d5db2172e3066fbfc
name: code
code: 60aa79235db2172e3066fc22
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/code
nodetype: column
value: notifyNeedUploadFileCount
createdate: 2021.05.23 23:47:52.000
lastmodifieddate: 2024.09.18 14:40:47.197
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60aa79235db2172e3066fc22


id: 60aa79235db2172e3066fc23
pid: 60a9e42d5db2172e3066fbfc
name: sharding
code: 60aa79235db2172e3066fc23
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/sharding
nodetype: column
createdate: 2021.05.23 23:47:52.000
lastmodifieddate: 2024.09.18 14:40:47.197
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60aa79235db2172e3066fc23


id: 60aa79235db2172e3066fc24
pid: 60a9e42d5db2172e3066fbfc
name: type_rhino
code: 60aa79235db2172e3066fc24
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/type_rhino
nodetype: column
value: rhino
createdate: 2021.05.23 23:47:52.000
lastmodifieddate: 2024.09.18 14:40:47.197
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60aa79235db2172e3066fc24


id: 60aa79235db2172e3066fc25
pid: 60a9e42d5db2172e3066fbfc
name: engine
code: 60aa79235db2172e3066fc25
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/engine
nodetype: column
value: rhino
createdate: 2021.05.23 23:47:52.000
lastmodifieddate: 2024.09.18 14:40:47.197
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60aa79235db2172e3066fc25


id: 60aa79235db2172e3066fc26
pid: 60a9e42d5db2172e3066fbfc
name: type_v8
code: 60aa79235db2172e3066fc26
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/type_v8
nodetype: column
value: v8
createdate: 2021.05.23 23:47:52.000
lastmodifieddate: 2024.09.18 14:40:47.197
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60aa79235db2172e3066fc26


id: 60aa79235db2172e3066fc27
pid: 60a9e42d5db2172e3066fbfc
name: roles
code: 60aa79235db2172e3066fc27
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/roles
nodetype: column
createdate: 2021.05.23 23:47:52.000
lastmodifieddate: 2024.09.18 14:40:47.197
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60aa79235db2172e3066fc27


id: 60aa79235db2172e3066fc28
pid: 60a9e42d5db2172e3066fbfc
name: group_AAAAAAA=
code: 60aa79235db2172e3066fc28
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/group_AAAAAAA=
nodetype: column
value: false
createdate: 2021.05.23 23:47:52.000
lastmodifieddate: 2024.09.18 14:40:47.197
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60aa79235db2172e3066fc28


id: 60aa79235db2172e3066fc29
pid: 60a9e42d5db2172e3066fbfc
name: role-default
code: 60aa79235db2172e3066fc29
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/role-default
nodetype: column
value: false
createdate: 2021.05.23 23:47:52.000
lastmodifieddate: 2024.09.18 14:40:47.197
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60aa79235db2172e3066fc29


id: 60aa79235db2172e3066fc2a
pid: 60a9e42d5db2172e3066fbfc
name: description
code: 60aa79235db2172e3066fc2a
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/description
nodetype: column
createdate: 2021.05.23 23:47:52.000
lastmodifieddate: 2024.09.18 14:40:47.197
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60aa79235db2172e3066fc2a


id: 60aa79235db2172e3066fc55
pid: 60a9e42d5db2172e3066fbfc
name: functionGroup
code: 60aa79235db2172e3066fc55
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/functionGroup
nodetype: column
createdate: 2021.05.23 23:49:47.000
lastmodifieddate: 2024.09.18 14:40:47.197
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60aa79235db2172e3066fc55

value:
{"全局函数":[{"source":"function main(","comment":"","group":"","caption":"","needRightControl":"","func":"main","funcTitle":"function main","index":0}]}


id: 60aa79235db2172e3066fc58
pid: 60a9e42d5db2172e3066fbfc
name: finalscript
code: 60aa79235db2172e3066fc58
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/finalscript
nodetype: column
createdate: 2021.05.23 23:49:47.000
lastmodifieddate: 2024.09.18 14:40:47.197
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60aa79235db2172e3066fc58

value:
function main(arg) {
    var p = JSON.parse(arg);
    println(" fileCount " +  p.fileCount); 
    pushMessage("electronPushMessage", { cmd:'notifyNeedUploadFileCount' , fileCount: p.fileCount }, currentUserId());  //向当前用户推送消息 

}


id: 60aa79235db2172e3066fc59
pid: 60a9e42d5db2172e3066fbfc
name: depend
code: 60aa79235db2172e3066fc59
namepath: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount
fullname: /凭证数字化/由Electron调用的接口/通知客户端有多少文件等待上传中/depend
nodetype: column
value: ,
createdate: 2021.05.23 23:49:47.000
lastmodifieddate: 2024.09.18 14:40:47.197
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.notifyNeedUploadFileCount.60aa79235db2172e3066fc59


id: 60aafc935db277fa0f8e07c7
pid: 60ab09f85db2f37491f99447
name: finalscript
code: 60aafc935db277fa0f8e07c7
namepath: /凭证数字化/记帐期相关/指定帐帐套当前记帐期
codepath: 60b71f5a5db22398a379d9ec.60ab09f85db2f37491f9943b.当前记帐期
fullname: /凭证数字化/记帐期相关/指定帐帐套当前记帐期/finalscript
fullcode: 60b71f5a5db22398a379d9ec.60ab09f85db2f37491f9943b.当前记帐期.60aafc935db277fa0f8e07c7
nodetype: column
createdate: 2021.05.24 10:19:46.000
lastmodifieddate: 2024.09.18 14:40:47.197
value:
/*
得到指定帐套的当前帐期
原理：  获取上一个关帐的年月，如果不存在，那么直接返回本月
        关帐年月的下一个月就是当前活动年月
 */

function main(arg)
{
    var p= JSON.parse( arg);
    var corpid= p.corpid ||'';
    println( corpid);

    var sql= " select  max(ym) from dzpz_gz where   state = 1 and corpid='"+ corpid+"' ";
    println( sql);
    var ym= ''+getStringFromSQL2( "pz", sql);
    println(" ym= "+ ym);
   
    if( ym=='') 
    {
        sql="select  min(ym) from dzpz_gz where  ifnull(  state,0) = 0 and corpid='"+ corpid+"' ";
        println(sql);
        ym =  getIntFromSQL2("pz", sql);
        if( ym ==0)         ym =  getYear(newDate())*100+ getMonth(newDate());
     //   println( ym);
    }else{
        ym= parseInt(ym);
        var  y = round( ym /100 ,0);
        var m= ym -  y *100;
        m=m+1;
        if( m==13)
        {
            y++;
            m=1;
        }
        ym=  y*100 + m ;
    }

    return ''+ round(ym,0); 


	

}


id: 60aaff095db2f37491f99012
pid: templateScriptOnServer
name: templateScriptOnServer-60aaff095db2f37491f99012
code: 60aaff095db2f37491f99012
fullname: /templateScriptOnServer-60aaff095db2f37491f99012
fullcode: 60aaff095db2f37491f99012
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:47.197
value:
/**
*   指定的单据审核完成后，执行本事件 ，注意： 无论本事件中的执行是成功还失败，都不影响审核标记
*
*   @param：gguid： 单据的gguid
*
*   @return :  无返回值
* */
function afterBillVerified(gguid) {
    var userid = currentUserId();
    //本事件请写在单据的编辑模板的后端脚本中

    //...
    runSQL('', "update dzpz_gz set state=1 where gguid='" + gguid + "'");
    return true;

}
/**
*   指定的单据取消审核完成后，执行本事件 ，注意： 无论本事件中的执行是成功还失败，都不影响审核标记
*
*   @param：gguid： 单据的gguid
*
*   @return :  无返回值
* */
function afterBillUnVerified(gguid) {
    var userid = currentUserId();
    //本事件请写在单据的编辑模板的后端脚本中
    runSQL('', "update dzpz_gz set state=0 where gguid='" + gguid + "'");
    //...

    return true;

}


id: 60aaff145db2f37491f990b8
pid: templateScriptOnServer
name: templateScriptOnServer-60aaff145db2f37491f990b8
code: 60aaff145db2f37491f990b8
fullname: /templateScriptOnServer-60aaff145db2f37491f990b8
fullcode: 60aaff145db2f37491f990b8
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:47.197
value:
function backend_import_list() {
    var sqls = [];

    runSQL(""," create index di_pz_corp_ym on dzpz_pz (corpid,ym) ",true);
    runSQL('', "delete from dzpz_gz where verifierid is null and not exists(select id from dzpz_pz b where dzpz_gz.corpid=b.corpid and dzpz_gz.ym=b.ym)", true);
    runSQL('', "update dzpz_gz set pzsl=(" +
        " select count(pzh) as pzsl from dzpz_pz b where dzpz_gz.corpid=b.corpid and dzpz_gz.ym=b.ym " +
        " ) where verifierid is null "
        , true);
    runSQL('', "insert into dzpz_gz " +
        "(id, gguid, billno, corpid, ym, pzsl) " +
        " select concat(corpid, '-', ym) as id, concat(corpid, '-', ym) as gguid, " +
        "   concat(corpid, '-', ym) as billno, corpid, ym, " +
        "   count(pzh) as pzsl " +
        " from dzpz_pz a " +
        " where not exists(select id from dzpz_gz b where a.corpid = b.corpid and a.ym = b.ym) " +
        " group by corpid, ym"
        , true);
}


id: 60ab0ab55db2f37491f994ce
pid: 60ab09f85db2f37491f9943b
name: 指定帐套最后关帐期
code: 最后关帐期
namepath: /凭证数字化/记帐期相关
codepath: 60b71f5a5db22398a379d9ec.60ab09f85db2f37491f9943b
fullname: /凭证数字化/记帐期相关/指定帐套最后关帐期
fullcode: 60b71f5a5db22398a379d9ec.60ab09f85db2f37491f9943b.最后关帐期
nodetype: leaf
createdate: 2021.05.24 10:24:12.000
lastmodifieddate: 2024.09.18 14:40:47.198
value:
/*
得到指定帐套的最后关帐期

 */

function main(arg)
{
    var p= JSON.parse( arg);
    var corpid= p.corpid ||'';

    var ym= getStringFromSQL2( "pz", "  select  max(ym)  from dzpz_gz where   state = 1 and corpid='"+ corpid+"' ");
   
    return ym ; 
    


	

}


id: 60ab0e675db2f37491f99530
pid: 60ab09f85db2f37491f9943b
name: 关帐
code: 关帐
namepath: /凭证数字化/记帐期相关
codepath: 60b71f5a5db22398a379d9ec.60ab09f85db2f37491f9943b
fullname: /凭证数字化/记帐期相关/关帐
fullcode: 60b71f5a5db22398a379d9ec.60ab09f85db2f37491f9943b.关帐
nodetype: leaf
createdate: 2021.05.24 10:38:42.000
lastmodifieddate: 2024.09.18 14:40:47.199
value:
function main(arg)
{
    var p= JSON.parse(arg);
    var corpid= p.corpid;
    var ym= p.ym;
    var ds=newDataStore("pz", "select * from dzpz_gz");
    ds.setUpdateProperty("dzpz_gz","id","*","id");
    ds.retrieve(" corpid='"+ corpid+"'  and ym="+ ym);
    if( ds.getRowCount()==0)
    {
        ds.insertRow(0);
        var newid= newGUID();
        ds.setValue(0,"id", newid);
        ds.setValue(0,"gguid", newid);
        ds.setValue(0,"billno", newid);
        ds.setValue(0,"billdate", newDate());
        ds.setValue(0,"userid", currentUserId());
        ds.setValue(0,"username", currentUserShowName());
        ds.setValue(0,"corpid", corpid);
        ds.setValue(0,"ym", ym);
        
    }

    ds.setValue(0,"state", 1);
    ds.setValue(0,"gzsj", newDate()); //关帐时间 
    
    if( ds.update(true)) return {success:true};
    var err= ds.getError().getMessage();
    println( err);
    return {success:false, message:err};

}


id: 60ab2c0d5db2f37491f9970b
pid: 60ab09f85db2f37491f9943b
name: 取消关帐
code: 取消关帐
namepath: /凭证数字化/记帐期相关
codepath: 60b71f5a5db22398a379d9ec.60ab09f85db2f37491f9943b
fullname: /凭证数字化/记帐期相关/取消关帐
fullcode: 60b71f5a5db22398a379d9ec.60ab09f85db2f37491f9943b.取消关帐
nodetype: leaf
createdate: 2021.05.24 10:38:42.000
lastmodifieddate: 2024.09.18 14:40:47.555
value:
function main(arg)
{
    var p= JSON.parse(arg);
    var corpid= p.corpid;
    var ym= p.ym;
    var ds=newDataStore("", "select * from dzpz_gz");
    ds.setUpdateProperty("dzpz_gz","id","*","id");
    ds.retrieve(" corpid='"+ corpid+"'  and ym="+ ym);
    if( ds.getRowCount()==0)
    {
        ds.insertRow(0);
        var newid= newGUID();
        ds.setValue(0,"id", newid);
        ds.setValue(0,"gguid", newid);
        ds.setValue(0,"billno", newid);
        ds.setValue(0,"billdate", newDate());
        ds.setValue(0,"userid", currentUserId());
        ds.setValue(0,"username", currentUserShowName());
        ds.setValue(0,"corpid", corpid);
        ds.setValue(0,"ym", ym);
        
    }

    ds.setValue(0,"state", 0);
    ds.setValue(0,"gzsj", null); //关帐时间 
    
    if( ds.update(true)) return {success:true};
    var err= ds.getError().getMessage();
    println( err);
    return {success:false, message:err};

}


id: 60ab513d5db26b6db2c28aa6
pid: 60ab513d5db26b6db2c28a8c
name: 归档
code: 归档
namepath: /凭证数字化/归档相关
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c
fullname: /凭证数字化/归档相关/归档
fullcode: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.归档
nodetype: leaf
createdate: 2021.05.24 16:11:14.000
lastmodifieddate: 2024.09.18 14:40:47.556
value:
/*
归档处理
  1 生成凭证主记录
  2 生成凭证附件记录

   pzGroup = 
   [
       { pzh:'xx1' , pz:['id1','id2'...] , fj :['id1', 'id2'.....]} , 
       { pzh:'xx2' , pz:['id1','id2'...] , fj :['id1', 'id2'.....]} ...  
       
   ]
*/

function main(arg) {

    var p = JSON.parse(arg);
    println(p.rawdata);
    var corpid = p.corpid;
    var ym = p.ym;
    var pzGroup = p.pzGroup;  //pzGroup 的结构是 [   {pzh: '0001', imgID:'xxxx', fj:['xxxx', 'xxxxx'...] } , { ... } ] 

    //先校验，要么全部归档，要么全部放弃

    for (var i = 0; i < pzGroup.length; i++) {
        var pzh   =  pzGroup[i].pzh;
        //验重： 指定单位，指定年月，指定凭证号不能重复
        if(  getStringFromSQL( "select id from dzpz_pz where pzh='"+pzh+"' and corpid='"+ corpid+"' and ym="+ym )!='')
        {
            return {success:false, message:pzh+"凭证号已存在，不允许重复归档"};
        }       
    }


    for (var i = 0; i < pzGroup.length; i++) {
        ret = gd(corpid, ym, pzGroup[i]);
        if (!ret.success) return ret;
    }

    return { success: true };

}


function gd(corpid, ym, config) {
    var dzpz_pz_ds = newDataStore("", "select * from dzpz_pz ");  //凭证主记录
    dzpz_pz_ds.setUpdateProperty("dzpz_pz", "id", "*", "id");

    var dzpz_pzfj_ds = newDataStore("", "select * from dzpz_pzfj "); //凭证附件
    dzpz_pzfj_ds.setUpdateProperty("dzpz_pzfj", "id", "*", "id");

    //用来检索数据
    var dzpz_imgpool_ds = newDataStore("", "select * from dzpz_imgpool_fileupload");

    //用来更新数据
    var dzpz_imgpool_fileupload_ds = newDataStore("", "select * from dzpz_imgpool_fileupload");
    dzpz_imgpool_fileupload_ds.setUpdateProperty("dzpz_imgpool_fileupload", "id", "*", "id");


    var id = newGUID();
    dzpz_pz_ds.insertRow(0);
    dzpz_pz_ds.setValue(0, "id", id);
    dzpz_pz_ds.setValue(0, "gguid", id);
    dzpz_pz_ds.setValue(0, "billno", id);
    dzpz_pz_ds.setValue(0, "billdate", newDate());
    dzpz_pz_ds.setValue(0, "billtype", "");
    dzpz_pz_ds.setValue(0, "open_bill_with_url", "billedit?action=view&gguid=" + id + "&id=dzpz");
    dzpz_pz_ds.setValue(0, "userid", currentUserId());
    dzpz_pz_ds.setValue(0, "username", currentUserShowName());
    dzpz_pz_ds.setValue(0, "pzh", config.pzh);
    dzpz_pz_ds.setValue(0, "attachmentcount", config.fj.length + config.pz.length); //凭证与附件的图片总和
    dzpz_pz_ds.setValue(0, "ym", ym);
    dzpz_pz_ds.setValue(0, "imgid", config.imgID);

    dzpz_pz_ds.setValue(0, "corpid", corpid);
    dzpz_pz_ds.setValue(0, "deleteflag", 0);

    // 附件清单

    var FJGD = function (imgs, groupName) {
        for (var i = 0; i < imgs.length; i++) {
            var fromID = imgs[i];

            dzpz_imgpool_ds.retrieve(" id='" + fromID + "'");
            if (dzpz_imgpool_ds.getRowCount() != 1) {
                println(config.fj[i] + " 对应的上传记录不存在")
                continue;
            }

            var row = dzpz_pzfj_ds.insertRow(9999);

            cloneRow(dzpz_imgpool_ds, dzpz_pzfj_ds, row);

            //数据调整



            //附件表上的附件类型
            dzpz_pzfj_ds.setValue(row, "groupname", groupName);  //把类型改成 凭证

            dzpz_pzfj_ds.setValue(row, "fileindex", i + 1);

            dzpz_pzfj_ds.setValue(row, "gguid", id);
            dzpz_pzfj_ds.setValue(row, "tablename", "dzpz_pz");
            dzpz_pzfj_ds.setValue(row, "corpid", corpid);

            //删除源
            //当 
            dzpz_imgpool_fileupload_ds.executeAfterUpdate(" delete from dzpz_imgpool_fileupload where id='" + fromID + "' ");

        }
    }

    FJGD( config.pz , '凭证' ); //凭证
    FJGD( config.fj , '附件' ); //附件
    
    dzpz_pz_ds.setValue(0,"pz", config.pz.length);//凭证张数
    dzpz_pz_ds.setValue(0,"fj", config.fj.length);//附件张数
    

    var err = '' + updateAll(dzpz_pz_ds, dzpz_pzfj_ds, dzpz_imgpool_fileupload_ds);

    if (err == '') return { success: true };
    println(err);
    runTask("归档信息保存到文件中", {pzid: id} );
    return { success: false, message: err };

}

function cloneRow(dzpz_imgpool_ds, dzpz_pzfj_ds, row) {
    for (var i = 0; i < dzpz_imgpool_ds.getColumnCount(); i++) {
        var col = dzpz_imgpool_ds.getColumnName(i);
        var value = dzpz_imgpool_ds.getValue(0, i);
        dzpz_pzfj_ds.setValue(row, col, value);
    }
}


id: 60ab5fa75db26b6db2c28b0c
pid: 60ab513d5db26b6db2c28aa6
name: functionGroup
code: 60ab5fa75db26b6db2c28b0c
namepath: /凭证数字化/归档相关/归档
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.归档
fullname: /凭证数字化/归档相关/归档/functionGroup
fullcode: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.归档.60ab5fa75db26b6db2c28b0c
nodetype: column
createdate: 2021.05.24 16:32:55.000
lastmodifieddate: 2024.09.18 14:40:47.557
value:
{"全局函数":[{"source":"function main(arg)","comment":"","group":"","caption":"","needRightControl":"","func":"main","funcTitle":"function main","index":0},{"source":"function gd(corpid, ym, config)","comment":"","group":"","caption":"","needRightControl":"","func":"gd","funcTitle":"function gd","index":1},{"source":"function cloneRow(dzpz_imgpool_ds, dzpz_pzfj_ds, row)","comment":"","group":"","caption":"","needRightControl":"","func":"cloneRow","funcTitle":"function cloneRow","index":2}]}


id: 60ac750d5db2f5d22859c4c0
pid: 60ab513d5db26b6db2c28a8c
name: 凭证附件移除
code: 凭证附件移除
namepath: /凭证数字化/归档相关
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c
fullname: /凭证数字化/归档相关/凭证附件移除
fullcode: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.凭证附件移除
nodetype: leaf
createdate: 2021.05.25 11:55:45.000
lastmodifieddate: 2024.09.18 14:40:47.558
value:
/*
凭证中的某个附件移除，并还原到待归档图片池中
  1 记录移除
  2 移到 待归档图片池中
  3  几个标记数据还愿

*/

function main(arg) {

    println( arg); 
    var p = JSON.parse(arg);
    var id = p.id;  // dzpz_pzfj.id 
    println( "id="+ id);

   
    //得到当前操作员待归档图片对应的GGUID
    var t = runTask("get_dzpz_imgpool_id_of_current_user", {});
    var gguid = JSON.parse(t).gguid;
    println( gguid); 


    var dzpz_pzfj_ds = newDataStore("", "select * from dzpz_pzfj "); //凭证附件
    dzpz_pzfj_ds.setUpdateProperty("dzpz_pzfj", "id", "*", "id");
    dzpz_pzfj_ds.retrieve(" id='"+ id+"' ");
    println( dzpz_pzfj_ds.getJSONRow(0,true));

    var pzid = dzpz_pzfj_ds.getString(0,"gguid");
    println( "select  verifierid  from dzpz_pz  where id='"+pzid+"' ");
    if( getIntFromSQL("select  verifierid  from dzpz_pz  where id='"+pzid+"' ")>0)
    {
        println("已审核，禁止删除附件");
     return { success:false, message:'凭证已审核，禁止删除'};
    }
    
 

    //待归档的图片池
    var dzpz_imgpool_fileupload_ds = newDataStore("", "select * from dzpz_imgpool_fileupload");
    dzpz_imgpool_fileupload_ds.setUpdateProperty("dzpz_imgpool_fileupload", "id", "*", "id");


    var row = dzpz_imgpool_fileupload_ds.insertRow(9999);

    cloneRow(dzpz_pzfj_ds, dzpz_imgpool_fileupload_ds, row);

    //数据调整


    dzpz_imgpool_fileupload_ds.setValue(row, "groupname", '附件');  //把类型改成 凭证

    dzpz_imgpool_fileupload_ds.setValue(row, "gguid", gguid);
    dzpz_imgpool_fileupload_ds.setValue(row, "info2", ''); // 放的是版本号，但是回收站的图片标记也是用 info2 ,所以要清除info2,  不然图片池中不会显示它
    
    dzpz_imgpool_fileupload_ds.setValue(row, "tablename", "dzpz_imgpool");
    

    //删除源
    //当 
    dzpz_pzfj_ds.deleteRow(0);

    //更新附件数量
    
    dzpz_pzfj_ds.executeAfterUpdate(" update dzpz_pz  set attachmentcount= (select count(*) from dzpz_pzfj where gguid='"+ pzid+"' ) , "+
     " fj = (select count(*) from dzpz_pzfj where gguid='"+ pzid+"' and groupname='附件' ) , "+
     " pz = (select count(*) from dzpz_pzfj where gguid='"+ pzid+"' and groupname='凭证'  )  "+
               "   where id='"+ pzid+"' ");

    var err = '' + updateAll(dzpz_pzfj_ds, dzpz_imgpool_fileupload_ds);

    if (err == '') return { success: true };
    println(err);

    runTask("归档信息保存到文件中", {pzid: pzid} );

    return { success: false, message: err };

}

function cloneRow(dzpz_pzfj_ds, dzpz_imgpool_fileupload_ds, row) {
    println( dzpz_pzfj_ds.getJSONRow(0,true));  
    for (var i = 0; i < dzpz_pzfj_ds.getColumnCount(); i++) {
        var col = dzpz_pzfj_ds.getColumnName(i);
        var value = dzpz_pzfj_ds.getValue(0, i);
        dzpz_imgpool_fileupload_ds.setValue(row, col, value);
    }
}


id: 60ac750d5db2f5d22859c511
pid: 60ac750d5db2f5d22859c4c0
name: functionGroup
code: 60ac750d5db2f5d22859c511
namepath: /凭证数字化/归档相关/凭证附件移除
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.凭证附件移除
fullname: /凭证数字化/归档相关/凭证附件移除/functionGroup
fullcode: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.凭证附件移除.60ac750d5db2f5d22859c511
nodetype: column
createdate: 2021.05.25 12:04:12.000
lastmodifieddate: 2024.09.18 14:40:47.920
value:
{"全局函数":[{"source":"function main(arg)","comment":"","group":"","caption":"","needRightControl":"","func":"main","funcTitle":"function main","index":0},{"source":"function cloneRow(dzpz_pzfj_ds, dzpz_imgpool_fileupload_ds, row)","comment":"","group":"","caption":"","needRightControl":"","func":"cloneRow","funcTitle":"function cloneRow","index":1}]}


id: 60ac8be75db2f5d22859c588
pid: 60ab513d5db26b6db2c28a8c
name: 追加图片到凭证中
code: 追加图片到凭证中
namepath: /凭证数字化/归档相关
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c
fullname: /凭证数字化/归档相关/追加图片到凭证中
fullcode: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.追加图片到凭证中
nodetype: leaf
createdate: 2021.05.24 16:11:14.000
lastmodifieddate: 2024.09.18 14:40:47.920
value:
/*

   凭证主记录已存在 ， 向凭证中添加更多的附件
   

*/

function main(arg)
{
    println( arg);
    var p= JSON.parse(arg);
   
    var id= p.pzid;
    var images= p.images;


    var  dzpz_pz_ds = newDataStore("", "select * from dzpz_pz ");  //凭证主记录
    dzpz_pz_ds.retrieve(" id='"+  id+"' ");

    var  dzpz_pzfj_ds = newDataStore("", "select * from dzpz_pzfj "); //凭证附件
    dzpz_pzfj_ds.setUpdateProperty("dzpz_pzfj", "id","*" ,"id");

    //用来检索数据
    var  dzpz_imgpool_ds= newDataStore("","select * from dzpz_imgpool_fileupload");

    //用来更新数据
    var  dzpz_imgpool_fileupload_ds= newDataStore("","select * from dzpz_imgpool_fileupload");
    dzpz_imgpool_fileupload_ds.setUpdateProperty("dzpz_imgpool_fileupload", "id","*" ,"id");
    
 
    var corpid= dzpz_pz_ds.getValue(0,"corpid");
     
    // 附件清单
    for( var i=0;i< images.length;i++)
    {
        var fromID = images[i].id;
        
        dzpz_imgpool_ds.retrieve(" id='"+fromID+"'");
        if( dzpz_imgpool_ds.getRowCount()!=1)
        {
            println( config.fj[i]+" 对应的上传记录不存在")
            continue; 
        }

        var row= dzpz_pzfj_ds.insertRow(9999);

        cloneRow( dzpz_imgpool_ds , dzpz_pzfj_ds , row);

        //数据调整
  
        dzpz_pzfj_ds.setValue(row,"gguid", id);
        dzpz_pzfj_ds.setValue(row,"tablename", "dzpz_pz");
        dzpz_pzfj_ds.setValue(row,"corpid", corpid);

        //删除源
        //当 
        dzpz_imgpool_fileupload_ds.executeAfterUpdate( " delete from dzpz_imgpool_fileupload where id='"+fromID+"' ");

        
    }

    //更新凭证附件数量
    dzpz_pzfj_ds.executeAfterUpdate(" update dzpz_pz  set attachmentcount= (select count(*) from dzpz_pzfj where gguid='"+ id+"' ) , "+
     " fj = (select count(*) from dzpz_pzfj where gguid='"+ id+"' and groupname='附件' ) , "+
     " pz = (select count(*) from dzpz_pzfj where gguid='"+ id+"' and groupname='凭证'  )  "+
               "   where id='"+ id+"' ");

    var err =  ''+updateAll( dzpz_pzfj_ds ,dzpz_imgpool_fileupload_ds);

    if( err=='') return  {success:true};
    println( err);

    runTask("归档信息保存到文件中", {pzid: id} );
    return {success:false, message:err}; 

}

function cloneRow( dzpz_imgpool_ds , dzpz_pzfj_ds , row)
{
    for( var i=0;i<dzpz_imgpool_ds.getColumnCount();i++)
    {
        var col= dzpz_imgpool_ds.getColumnName(i);
        var value= dzpz_imgpool_ds.getValue(0 , i);
        dzpz_pzfj_ds.setValue(row, col , value);  
    }
}


id: 60ac8be75db2f5d22859c5b0
pid: 60ac8be75db2f5d22859c588
name: functionGroup
code: 60ab5fa75db26b6db2c28b0c20210525133237
namepath: /凭证数字化/归档相关/追加图片到凭证中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.追加图片到凭证中
fullname: /凭证数字化/归档相关/追加图片到凭证中/functionGroup
fullcode: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.追加图片到凭证中.60ab5fa75db26b6db2c28b0c20210525133237
nodetype: column
createdate: 2021.05.24 16:32:55.000
lastmodifieddate: 2024.09.18 14:40:47.921
value:
{"全局函数":[{"source":"function main(arg)","comment":"","group":"","caption":"","needRightControl":"","func":"main","funcTitle":"function main","index":0},{"source":"function cloneRow( dzpz_imgpool_ds , dzpz_pzfj_ds , row)","comment":"","group":"","caption":"","needRightControl":"","func":"cloneRow","funcTitle":"function cloneRow","index":1}]}


id: 60ac944d5db2f5d22859c6de
pid: 60ab513d5db26b6db2c28a8c
name: 删除凭证所有图片回归池中
code: 删除凭证所有图片回归池中
namepath: /凭证数字化/归档相关
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中
fullcode: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
nodetype: leaf
createdate: 2021.05.25 11:55:45.000
lastmodifieddate: 2024.09.18 14:40:47.921
value:
/*
凭证中的某个附件移除，并还原到待归档图片池中
  1 记录移除
  2 移到 待归档图片池中
  3  几个标记数据还愿

*/

function main(arg) {

    println(arg);
    var p = JSON.parse(arg);
    var id = p.id;  // dzpz_pz.id 
    println("id=" + id);


    if (getIntFromSQL( "select  verifierid  from dzpz_pz  where id='" + id + "' ") > 0) return { success: false, message: '凭证已审核，禁止删除' };
    if (getIntFromSQL( "select  userid  from dzpz_pz  where id='" + id + "' ") != toString(currentUserId())) return { success: false, message: '您不是该凭证归档人，禁止删除' };


    //得到当前操作员待归档图片对应的GGUID
    var t = runTask("get_dzpz_imgpool_id_of_current_user", {});
    var gguid = JSON.parse(t).gguid;


    var dzpz_pzfj_ds = newDataStore("", "select * from dzpz_pzfj "); //凭证附件
    dzpz_pzfj_ds.setUpdateProperty("dzpz_pzfj", "id", "*", "id");
    dzpz_pzfj_ds.retrieve(" gguid='" + id + "' "); //检索出所有图片


    //待归档的图片池
    var dzpz_imgpool_fileupload_ds = newDataStore("", "select * from dzpz_imgpool_fileupload");
    dzpz_imgpool_fileupload_ds.setUpdateProperty("dzpz_imgpool_fileupload", "id", "*", "id");

    var RC = dzpz_pzfj_ds.getRowCount();
    for (var i = RC - 1; i >= 0; i--) {

        var row = dzpz_imgpool_fileupload_ds.insertRow(9999);
        cloneRow(dzpz_pzfj_ds, i, dzpz_imgpool_fileupload_ds, row);

        //数据调整

        dzpz_imgpool_fileupload_ds.setValue(row, "groupname", '附件');  //把类型改成 凭证
        dzpz_imgpool_fileupload_ds.setValue(row, "gguid", gguid);
        dzpz_imgpool_fileupload_ds.setValue(row, "tablename", "dzpz_imgpool");
         
        //删除源
        dzpz_pzfj_ds.deleteRow(i);
    }

    //删除凭证
    dzpz_pzfj_ds.executeAfterUpdate(" delete from  dzpz_pz  where id='" + id + "' ");

    var err = '' + updateAll(dzpz_pzfj_ds, dzpz_imgpool_fileupload_ds);

    if (err == '') return { success: true };
    println(err);

    runTask("归档信息保存到文件中", {pzid: id} );
    return { success: false, message: err };

}

function cloneRow(dzpz_pzfj_ds, sr, dzpz_imgpool_fileupload_ds, row) {
    for (var i = 0; i < dzpz_pzfj_ds.getColumnCount(); i++) {
        var col = dzpz_pzfj_ds.getColumnName(i);
        var value = dzpz_pzfj_ds.getValue(sr, i);
        dzpz_imgpool_fileupload_ds.setValue(row, col, value);
    }
}


id: 60ac944d5db2f5d22859c6e2
pid: 60ac944d5db2f5d22859c6de
name: anonymousRun
code: 60ac750d5db2f5d22859c4d020210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/anonymousRun
nodetype: column
value: true
createdate: 2021.05.25 11:55:48.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4d020210525145216


id: 60ac944d5db2f5d22859c6e6
pid: 60ac944d5db2f5d22859c6de
name: code
code: 60ac750d5db2f5d22859c4e720210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/code
nodetype: column
value: 删除凭证所有图片回归池中
createdate: 2021.05.25 11:55:51.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4e720210525145216


id: 60ac944d5db2f5d22859c6ea
pid: 60ac944d5db2f5d22859c6de
name: deletelogafter
code: 60ac750d5db2f5d22859c4cc20210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/deletelogafter
nodetype: column
value: 7
createdate: 2021.05.25 11:55:48.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4cc20210525145216


id: 60ac944d5db2f5d22859c6ee
pid: 60ac944d5db2f5d22859c6de
name: depend
code: 60ac750d5db2f5d22859c51520210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/depend
nodetype: column
value: ,
createdate: 2021.05.25 12:04:12.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c51520210525145216


id: 60ac944d5db2f5d22859c6f2
pid: 60ac944d5db2f5d22859c6de
name: description
code: 60ac750d5db2f5d22859c4f020210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/description
nodetype: column
createdate: 2021.05.25 11:55:51.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4f020210525145216


id: 60ac944d5db2f5d22859c6f6
pid: 60ac944d5db2f5d22859c6de
name: enabled
code: 60ac750d5db2f5d22859c4c820210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/enabled
nodetype: column
value: true
createdate: 2021.05.25 11:55:48.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4c820210525145216


id: 60ac944d5db2f5d22859c6fa
pid: 60ac944d5db2f5d22859c6de
name: engine
code: 60ac750d5db2f5d22859c4ea20210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/engine
nodetype: column
value: rhino
createdate: 2021.05.25 11:55:51.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4ea20210525145216


id: 60ac944d5db2f5d22859c6fe
pid: 60ac944d5db2f5d22859c6de
name: finalscript
code: 60ac750d5db2f5d22859c51420210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/finalscript
nodetype: column
createdate: 2021.05.25 12:04:12.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c51420210525145216

value:
/*
凭证中的某个附件移除，并还原到待归档图片池中
  1 记录移除
  2 移到 待归档图片池中
  3  几个标记数据还愿

*/

function main(arg) {

    println(arg);
    var p = JSON.parse(arg);
    var id = p.id;  // dzpz_pz.id 
    println("id=" + id);


    if (getIntFromSQL( "select  verifierid  from dzpz_pz  where id='" + id + "' ") > 0) return { success: false, message: '凭证已审核，禁止删除' };
    if (getIntFromSQL( "select  userid  from dzpz_pz  where id='" + id + "' ") != toString(currentUserId())) return { success: false, message: '您不是该凭证归档人，禁止删除' };


    //得到当前操作员待归档图片对应的GGUID
    var t = runTask("get_dzpz_imgpool_id_of_current_user", {});
    var gguid = JSON.parse(t).gguid;


    var dzpz_pzfj_ds = newDataStore("", "select * from dzpz_pzfj "); //凭证附件
    dzpz_pzfj_ds.setUpdateProperty("dzpz_pzfj", "id", "*", "id");
    dzpz_pzfj_ds.retrieve(" gguid='" + id + "' "); //检索出所有图片


    //待归档的图片池
    var dzpz_imgpool_fileupload_ds = newDataStore("", "select * from dzpz_imgpool_fileupload");
    dzpz_imgpool_fileupload_ds.setUpdateProperty("dzpz_imgpool_fileupload", "id", "*", "id");

    var RC = dzpz_pzfj_ds.getRowCount();
    for (var i = RC - 1; i >= 0; i--) {

        var row = dzpz_imgpool_fileupload_ds.insertRow(9999);
        cloneRow(dzpz_pzfj_ds, i, dzpz_imgpool_fileupload_ds, row);

        //数据调整

        dzpz_imgpool_fileupload_ds.setValue(row, "groupname", '附件');  //把类型改成 凭证
        dzpz_imgpool_fileupload_ds.setValue(row, "gguid", gguid);
        dzpz_imgpool_fileupload_ds.setValue(row, "tablename", "dzpz_imgpool");
         
        //删除源
        dzpz_pzfj_ds.deleteRow(i);
    }

    //删除凭证
    dzpz_pzfj_ds.executeAfterUpdate(" delete from  dzpz_pz  where id='" + id + "' ");

    var err = '' + updateAll(dzpz_pzfj_ds, dzpz_imgpool_fileupload_ds);

    if (err == '') return { success: true };
    println(err);

    runTask("归档信息保存到文件中", {pzid: id} );
    return { success: false, message: err };

}

function cloneRow(dzpz_pzfj_ds, sr, dzpz_imgpool_fileupload_ds, row) {
    for (var i = 0; i < dzpz_pzfj_ds.getColumnCount(); i++) {
        var col = dzpz_pzfj_ds.getColumnName(i);
        var value = dzpz_pzfj_ds.getValue(sr, i);
        dzpz_imgpool_fileupload_ds.setValue(row, col, value);
    }
}


id: 60ac944d5db2f5d22859c702
pid: 60ac944d5db2f5d22859c6de
name: functioncheckpoint
code: 60ac6f255db2fe3a155053f720210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/functioncheckpoint
nodetype: column
value: {}
createdate: 2021.05.25 12:04:12.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac6f255db2fe3a155053f720210525145216


id: 60ac944d5db2f5d22859c706
pid: 60ac944d5db2f5d22859c6de
name: functionGroup
code: 60ac750d5db2f5d22859c51120210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/functionGroup
nodetype: column
createdate: 2021.05.25 12:04:12.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c51120210525145216

value:
{"全局函数":[{"source":"function main(arg)","comment":"","group":"","caption":"","needRightControl":"","func":"main","funcTitle":"function main","index":0},{"source":"function cloneRow(dzpz_pzfj_ds, sr, dzpz_imgpool_fileupload_ds, row)","comment":"","group":"","caption":"","needRightControl":"","func":"cloneRow","funcTitle":"function cloneRow","index":1}]}


id: 60ac944d5db2f5d22859c70a
pid: 60ac944d5db2f5d22859c6de
name: functionlist
code: 60ac6f255db2fe3a155053f620210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/functionlist
nodetype: column
value: ["cloneRow","main"]
createdate: 2021.05.25 12:04:12.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac6f255db2fe3a155053f620210525145216


id: 60ac944d5db2f5d22859c70e
pid: 60ac944d5db2f5d22859c6de
name: group_AAAAAAA=
code: 60ac750d5db2f5d22859c4ed20210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/group_AAAAAAA=
nodetype: column
value: false
createdate: 2021.05.25 11:55:51.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4ed20210525145216


id: 60ac9ea05db2f5d22859c712
pid: 60ac944d5db2f5d22859c6de
name: maxactivethreadcount
code: 60ac750d5db2f5d22859c4ce20210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/maxactivethreadcount
nodetype: column
value: 30
createdate: 2021.05.25 11:55:48.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4ce20210525145216


id: 60ac9ea05db2f5d22859c716
pid: 60ac944d5db2f5d22859c6de
name: maxlogsize
code: 60ac750d5db2f5d22859c4cd20210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/maxlogsize
nodetype: column
value: 50
createdate: 2021.05.25 11:55:48.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4cd20210525145216


id: 60ac9ea05db2f5d22859c71a
pid: 60ac944d5db2f5d22859c6de
name: maxwaittime
code: 60ac750d5db2f5d22859c4cf20210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/maxwaittime
nodetype: column
value: 30
createdate: 2021.05.25 11:55:48.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4cf20210525145216


id: 60ac9ea05db2f5d22859c71e
pid: 60ac944d5db2f5d22859c6de
name: role-60ab05595db2f37491f9937f
code: 60ac750d5db2f5d22859c4ef20210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/role-60ab05595db2f37491f9937f
nodetype: column
value: false
createdate: 2021.05.25 11:55:51.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4ef20210525145216


id: 60ac9ea05db2f5d22859c722
pid: 60ac944d5db2f5d22859c6de
name: role-default
code: 60ac750d5db2f5d22859c4ee20210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/role-default
nodetype: column
value: false
createdate: 2021.05.25 11:55:51.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4ee20210525145216


id: 60ac9ea05db2f5d22859c726
pid: 60ac944d5db2f5d22859c6de
name: roles
code: 60ac750d5db2f5d22859c4ec20210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/roles
nodetype: column
createdate: 2021.05.25 11:55:51.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4ec20210525145216


id: 60ac9ea05db2f5d22859c72a
pid: 60ac944d5db2f5d22859c6de
name: runningLog
code: 60ac750d5db2f5d22859c4cb20210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/runningLog
nodetype: column
value: true
createdate: 2021.05.25 11:55:48.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4cb20210525145216


id: 60ac9ea05db2f5d22859c72e
pid: 60ac944d5db2f5d22859c6de
name: sharding
code: 60ac750d5db2f5d22859c4e820210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/sharding
nodetype: column
createdate: 2021.05.25 11:55:51.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4e820210525145216


id: 60ac9ea05db2f5d22859c732
pid: 60ac944d5db2f5d22859c6de
name: timeout
code: 60ac750d5db2f5d22859c4c920210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/timeout
nodetype: column
value: 300
createdate: 2021.05.25 11:55:48.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4c920210525145216


id: 60ac9ea05db2f5d22859c736
pid: 60ac944d5db2f5d22859c6de
name: type_rhino
code: 60ac750d5db2f5d22859c4e920210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/type_rhino
nodetype: column
value: rhino
createdate: 2021.05.25 11:55:51.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4e920210525145216


id: 60ac9ea05db2f5d22859c73a
pid: 60ac944d5db2f5d22859c6de
name: type_v8
code: 60ac750d5db2f5d22859c4eb20210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/type_v8
nodetype: column
value: v8
createdate: 2021.05.25 11:55:51.000
lastmodifieddate: 2024.09.18 14:40:47.922
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4eb20210525145216


id: 60ac9ea05db2f5d22859c73e
pid: 60ac944d5db2f5d22859c6de
name: writeCallingLog
code: 60ac750d5db2f5d22859c4ca20210525145216
namepath: /凭证数字化/归档相关/删除凭证所有图片回归池中
codepath: 60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中
fullname: /凭证数字化/归档相关/删除凭证所有图片回归池中/writeCallingLog
nodetype: column
value: true
createdate: 2021.05.25 11:55:48.000
lastmodifieddate: 2024.09.18 14:40:47.923
fullcode:
60b71f5a5db22398a379d9ec.60ab513d5db26b6db2c28a8c.删除凭证所有图片回归池中.60ac750d5db2f5d22859c4ca20210525145216


id: 60c1739699322db85e0325ff
pid: 609d3cfc5db2b0a331d6bb4b
name: functionlist
code: 60c1739699322db85e0325ff
namepath: /templateScriptOnServer-609d3cfc5db2b0a331d6bb4b
codepath: 609d3cfc5db2b0a331d6bb4b
fullname: /templateScriptOnServer-609d3cfc5db2b0a331d6bb4b/functionlist
fullcode: 609d3cfc5db2b0a331d6bb4b.60c1739699322db85e0325ff
nodetype: column
createdate: 2021.06.10 10:35:41.000
lastmodifieddate: 2024.09.18 14:40:47.923
value:
["realDeleteImage","moveImageToNormal","moveImageToRecycle","getImageList","getImageList2","getImageList1"]


id: 60c176909932e1a17db2e141
pid: 609d3cfc5db2b0a331d6bb4b
name: functionGroup
code: 60c176909932e1a17db2e141
namepath: /templateScriptOnServer-609d3cfc5db2b0a331d6bb4b
codepath: 609d3cfc5db2b0a331d6bb4b
fullname: /templateScriptOnServer-609d3cfc5db2b0a331d6bb4b/functionGroup
fullcode: 609d3cfc5db2b0a331d6bb4b.60c176909932e1a17db2e141
nodetype: column
createdate: 2021.06.10 10:35:41.000
lastmodifieddate: 2024.09.18 14:40:47.923
value:
{"全局函数":[{"source":"function getImageList1(","comment":"","group":"","caption":"","needRightControl":"","func":"getImageList1","funcTitle":"function getImageList1","index":0},{"source":"function getImageList2(","comment":"","group":"","caption":"","needRightControl":"","func":"getImageList2","funcTitle":"function getImageList2","index":1},{"source":"//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)\nfunction getImageList(","comment":"//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)","group":"","caption":"得到待归档的图片清单","needRightControl":"true","func":"getImageList","funcTitle":"function getImageList","index":2},{"source":"function  moveImageToRecycle(","comment":"","group":"","caption":"","needRightControl":"","func":"moveImageToRecycle","funcTitle":"function  moveImageToRecycle","index":3},{"source":"function  moveImageToNormal(","comment":"","group":"","caption":"","needRightControl":"","func":"moveImageToNormal","funcTitle":"function  moveImageToNormal","index":4},{"source":"function  realDeleteImage(","comment":"","group":"","caption":"","needRightControl":"","func":"realDeleteImage","funcTitle":"function  realDeleteImage","index":5}]}


id: 60c1bec59932e1a17db2e3da
pid: 60c1bec59932e1a17db2e3ce
name: 打开当前人员的图片回收站
code: imgaeTrash
namepath: /凭证数字化/其它
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce
fullname: /凭证数字化/其它/打开当前人员的图片回收站
fullcode: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.imgaeTrash
nodetype: leaf
createdate: 2021.06.10 15:29:56.000
lastmodifieddate: 2024.09.18 14:40:47.923
value:
function main(arg)
{
    var ret = runTask("get_dzpz_imgpool_id_of_current_user", {});
    var gguid= JSON.parse(ret).gguid;
    var url= "billedit?id=toConfirm&limit=trash&gguid="+gguid+"&action=edit&editToolbarVisible=false";
    return "<script>window.location.href='"+url+"';</script>";
}


id: 60c1c2469932e1a17db2e49e
pid: 60a31c3c5db27838e0c0129e
name: functionGroup
code: 60c1c2469932e1a17db2e49e
namepath: /templateScriptOnServer-60a31c3c5db27838e0c0129e
codepath: 60a31c3c5db27838e0c0129e
fullname: /templateScriptOnServer-60a31c3c5db27838e0c0129e/functionGroup
fullcode: 60a31c3c5db27838e0c0129e.60c1c2469932e1a17db2e49e
nodetype: column
createdate: 2021.06.10 16:03:01.000
lastmodifieddate: 2024.09.18 14:40:48.302
value:
{"全局函数":[{"source":"function getImageList1()","comment":"","group":"","caption":"","needRightControl":"","func":"getImageList1","funcTitle":"function getImageList1","index":0},{"source":"function getImageList2()","comment":"","group":"","caption":"","needRightControl":"","func":"getImageList2","funcTitle":"function getImageList2","index":1},{"source":"//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)\nfunction getImageList(groupName)","comment":"//@comment (group=,caption=得到待归档的图片清单,needRightControl=true)","group":"","caption":"得到待归档的图片清单","needRightControl":"true","func":"getImageList","funcTitle":"function getImageList","index":2},{"source":"function back_repair(url, pzh)","comment":"","group":"","caption":"","needRightControl":"","func":"back_repair","funcTitle":"function back_repair","index":4}],"单据":[{"source":"//@comment (group=单据,caption=单据删除语句执行后)\nfunction afterBillDeleteOnServer(gguid, session)","comment":"//@comment (group=单据,caption=单据删除语句执行后)","group":"单据","caption":"单据删除语句执行后","needRightControl":"","func":"afterBillDeleteOnServer","funcTitle":"function afterBillDeleteOnServer","index":3}]}


id: 60c1cb909932e1a17db2e4cd
pid: 60c1bec59932e1a17db2e3ce
name: 当前人员的图片回收站地址
code: urlForTrash
namepath: /凭证数字化/其它
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce
fullname: /凭证数字化/其它/当前人员的图片回收站地址
fullcode: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
nodetype: leaf
createdate: 2021.06.10 15:29:56.000
lastmodifieddate: 2024.09.18 14:40:48.303
value:
function main(arg)
{
    var ret = runTask("get_dzpz_imgpool_id_of_current_user", {});
    var gguid= JSON.parse(ret).gguid;
    var url= "/billedit?id=toConfirm&limit=trash&gguid="+gguid+"&action=edit&editToolbarVisible=false";
    return getServiceHomeURL("app") +url  ; 
}


id: 60c1cb909932e1a17db2e4d1
pid: 60c1cb909932e1a17db2e4cd
name: anonymousRun
code: 60c1bec59932e1a17db2e3e920210610162136
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/anonymousRun
nodetype: column
value: true
createdate: 2021.06.10 15:30:06.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bec59932e1a17db2e3e920210610162136


id: 60c1cb909932e1a17db2e4d5
pid: 60c1cb909932e1a17db2e4cd
name: code
code: 60c1bec59932e1a17db2e40020210610162136
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/code
nodetype: column
value: urlForTrash
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bec59932e1a17db2e40020210610162136


id: 60c1cb909932e1a17db2e4d9
pid: 60c1cb909932e1a17db2e4cd
name: deletelogafter
code: 60c1bec59932e1a17db2e3e520210610162136
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/deletelogafter
nodetype: column
value: 7
createdate: 2021.06.10 15:30:06.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bec59932e1a17db2e3e520210610162136


id: 60c1cb909932e1a17db2e4e1
pid: 60c1cb909932e1a17db2e4cd
name: description
code: 60c1bf8e9932e1a17db2e41620210610162136
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/description
nodetype: column
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e41620210610162136


id: 60c1cb909932e1a17db2e4e5
pid: 60c1cb909932e1a17db2e4cd
name: enabled
code: 60c1bec59932e1a17db2e3e120210610162136
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/enabled
nodetype: column
value: true
createdate: 2021.06.10 15:30:06.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bec59932e1a17db2e3e120210610162136


id: 60c1cb909932e1a17db2e4e9
pid: 60c1cb909932e1a17db2e4cd
name: engine
code: 60c1bec59932e1a17db2e40320210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/engine
nodetype: column
value: rhino
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bec59932e1a17db2e40320210610162137


id: 60c1cb909932e1a17db2e4fd
pid: 60c1cb909932e1a17db2e4cd
name: group_4S6ZH2ECWLSY3D7EXSNOLBUF5GB2R2FHSLUITMQ=
code: 60c1bf8e9932e1a17db2e40f20210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/group_4S6ZH2ECWLSY3D7EXSNOLBUF5GB2R2FHSLUITMQ=
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e40f20210610162137


id: 60c1cb909932e1a17db2e501
pid: 60c1cb909932e1a17db2e4cd
name: group_4W6IBZMPSHUKPEXIRGZA====
code: 60c1bf8e9932e1a17db2e40c20210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/group_4W6IBZMPSHUKPEXIRGZA====
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e40c20210610162137


id: 60c1cb909932e1a17db2e505
pid: 60c1cb909932e1a17db2e4cd
name: group_SKNABMQ=
code: 60c1bf8e9932e1a17db2e40620210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/group_SKNABMQ=
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e40620210610162137


id: 60c1cb909932e1a17db2e509
pid: 60c1cb909932e1a17db2e4cd
name: maxactivethreadcount
code: 60c1bec59932e1a17db2e3e720210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/maxactivethreadcount
nodetype: column
value: 30
createdate: 2021.06.10 15:30:06.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bec59932e1a17db2e3e720210610162137


id: 60c1cb909932e1a17db2e50d
pid: 60c1cb909932e1a17db2e4cd
name: maxlogsize
code: 60c1bec59932e1a17db2e3e620210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/maxlogsize
nodetype: column
value: 50
createdate: 2021.06.10 15:30:06.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bec59932e1a17db2e3e620210610162137


id: 60c1cb909932e1a17db2e511
pid: 60c1cb909932e1a17db2e4cd
name: maxwaittime
code: 60c1bec59932e1a17db2e3e820210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/maxwaittime
nodetype: column
value: 30
createdate: 2021.06.10 15:30:06.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bec59932e1a17db2e3e820210610162137


id: 60c1cb909932e1a17db2e515
pid: 60c1cb909932e1a17db2e4cd
name: role-5fffc49c9932a2f576bbc87e
code: 60c1bf8e9932e1a17db2e40d20210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/role-5fffc49c9932a2f576bbc87e
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e40d20210610162137


id: 60c1cb909932e1a17db2e519
pid: 60c1cb909932e1a17db2e4cd
name: role-5fffc49c9932a2f576bbc8ab
code: 60c1bf8e9932e1a17db2e40e20210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/role-5fffc49c9932a2f576bbc8ab
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e40e20210610162137


id: 60c1cb909932e1a17db2e51d
pid: 60c1cb909932e1a17db2e4cd
name: role-601109b09932445fcc3950e7
code: 60c1bf8e9932e1a17db2e40920210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/role-601109b09932445fcc3950e7
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e40920210610162137


id: 60c1cb909932e1a17db2e521
pid: 60c1cb909932e1a17db2e4cd
name: role-608682ac993231a6fef4f736
code: 60c1bf8e9932e1a17db2e40720210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/role-608682ac993231a6fef4f736
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e40720210610162137


id: 60c1cb909932e1a17db2e525
pid: 60c1cb909932e1a17db2e4cd
name: role-60b727a299327aec523a283e
code: 60c1bf8e9932e1a17db2e40a20210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/role-60b727a299327aec523a283e
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e40a20210610162137


id: 60c1cb909932e1a17db2e529
pid: 60c1cb909932e1a17db2e4cd
name: role-60b7489699327aec523a2ce1
code: 60c1bf8e9932e1a17db2e41020210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/role-60b7489699327aec523a2ce1
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e41020210610162137


id: 60c1cb909932e1a17db2e52d
pid: 60c1cb909932e1a17db2e4cd
name: role-60b7489699327aec523a2cf1
code: 60c1bf8e9932e1a17db2e41120210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/role-60b7489699327aec523a2cf1
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e41120210610162137


id: 60c1cb919932e1a17db2e531
pid: 60c1cb909932e1a17db2e4cd
name: role-60b83c5999327aec523a2d01
code: 60c1bf8e9932e1a17db2e40b20210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/role-60b83c5999327aec523a2d01
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e40b20210610162137


id: 60c1cb919932e1a17db2e535
pid: 60c1cb909932e1a17db2e4cd
name: role-60bb95269932a3ac306d0316
code: 60c1bf8e9932e1a17db2e41220210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/role-60bb95269932a3ac306d0316
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e41220210610162137


id: 60c1cb919932e1a17db2e539
pid: 60c1cb909932e1a17db2e4cd
name: role-60bb95269932a3ac306d0326
code: 60c1bf8e9932e1a17db2e41320210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/role-60bb95269932a3ac306d0326
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.303
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e41320210610162137


id: 60c1cb919932e1a17db2e53d
pid: 60c1cb909932e1a17db2e4cd
name: role-60bb95269932a3ac306d0336
code: 60c1bf8e9932e1a17db2e41420210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/role-60bb95269932a3ac306d0336
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.304
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e41420210610162137


id: 60c1cb919932e1a17db2e541
pid: 60c1cb909932e1a17db2e4cd
name: role-60bb95889932a3ac306d035a
code: 60c1bf8e9932e1a17db2e41520210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/role-60bb95889932a3ac306d035a
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.304
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e41520210610162137


id: 60c1cb919932e1a17db2e545
pid: 60c1cb909932e1a17db2e4cd
name: role-default
code: 60c1bf8e9932e1a17db2e40820210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/role-default
nodetype: column
value: false
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.304
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e40820210610162137


id: 60c1cb919932e1a17db2e549
pid: 60c1cb909932e1a17db2e4cd
name: roles
code: 60c1bf8e9932e1a17db2e40520210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/roles
nodetype: column
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.304
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e40520210610162137


id: 60c1cb919932e1a17db2e54d
pid: 60c1cb909932e1a17db2e4cd
name: runningLog
code: 60c1bec59932e1a17db2e3e420210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/runningLog
nodetype: column
value: true
createdate: 2021.06.10 15:30:06.000
lastmodifieddate: 2024.09.18 14:40:48.304
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bec59932e1a17db2e3e420210610162137


id: 60c1cb919932e1a17db2e551
pid: 60c1cb909932e1a17db2e4cd
name: sharding
code: 60c1bec59932e1a17db2e40120210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/sharding
nodetype: column
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.304
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bec59932e1a17db2e40120210610162137


id: 60c1cb919932e1a17db2e555
pid: 60c1cb909932e1a17db2e4cd
name: timeout
code: 60c1bec59932e1a17db2e3e220210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/timeout
nodetype: column
value: 300
createdate: 2021.06.10 15:30:06.000
lastmodifieddate: 2024.09.18 14:40:48.304
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bec59932e1a17db2e3e220210610162137


id: 60c1cb919932e1a17db2e559
pid: 60c1cb909932e1a17db2e4cd
name: type_rhino
code: 60c1bec59932e1a17db2e40220210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/type_rhino
nodetype: column
value: rhino
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.304
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bec59932e1a17db2e40220210610162137


id: 60c1cb919932e1a17db2e55d
pid: 60c1cb909932e1a17db2e4cd
name: type_v8
code: 60c1bf8e9932e1a17db2e40420210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/type_v8
nodetype: column
value: v8
createdate: 2021.06.10 15:30:23.000
lastmodifieddate: 2024.09.18 14:40:48.304
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bf8e9932e1a17db2e40420210610162137


id: 60c1cb919932e1a17db2e561
pid: 60c1cb909932e1a17db2e4cd
name: writeCallingLog
code: 60c1bec59932e1a17db2e3e320210610162137
namepath: /凭证数字化/其它/当前人员的图片回收站地址
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash
fullname: /凭证数字化/其它/当前人员的图片回收站地址/writeCallingLog
nodetype: column
value: true
createdate: 2021.06.10 15:30:06.000
lastmodifieddate: 2024.09.18 14:40:48.304
fullcode:
60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.urlForTrash.60c1bec59932e1a17db2e3e320210610162137


id: 60c4bd735db2478f9c5a1118
pid: templateScriptOnServer
name: templateScriptOnServer-60c4bd735db2478f9c5a1118
code: 60c4bd735db2478f9c5a1118
fullname: /templateScriptOnServer-60c4bd735db2478f9c5a1118
fullcode: 60c4bd735db2478f9c5a1118
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:48.304
value:
//@comment (group=,caption=构建凭证附件清单,needRightControl=false)
function getPZFJ(id) {
    var ds = newDataStore("", "select id ,   url_img , url_thumbnail ,groupname , info1 from  dzpz_pzfj where  gguid='" + id + "'  order by info2 asc, groupname ,  info1 asc ");
    var n = ds.retrieve();
    println(ds.getSelectLastRetrieved());

    var ret = [];
    for (var i = 0; i < n; i++) {

        var one = JSON.parse(ds.getJSONRow(i, true));
        one.url_img = one.url_img + "&imageForceWatermark=false"
        ret.push(one);

    }
    return ret;

}


function get_PZ_PDF_URL(id) {
    return  safeURL(  getStringFromSQL("select url_img from app_archive where gguid='" + id + "'") ) ;
}

//单独设置某张图片的序号
function back_setImageOrder(gguid, id, order) {
    var ds = newDataStore("", `select *  from  dzpz_pzfj where  gguid='${gguid}' order by info2 asc, groupname ,info1 asc `);
    ds.setUpdateProperty("dzpz_pzfj", "id", "*", "id");
    var n = ds.retrieve();
    println(ds.getSelectLastRetrieved());
    println(n);

    if( order>n)  order=n; 

    var old_xh = 0;
    for (var i = 0; i < n; i++) {

        var xh = right('0000' + (i + 1), 4);
        ds.setValue(i, "info2", xh);

        if (ds.getString(i, "id") == id) {

            old_xh = i + 1;
            xh = right('0000' + order, 4);
            ds.setValue(i, "info2", xh);
            println( "set   "+ i+" row , xh="+ xh );
        }
    }

//往后调
// 则把在此图片之后的图片到新位置之前的图片的序号减1
    if (order > old_xh) {
        for (var i = old_xh; i < order; i++) {
            var xh = right('0000' + (i), 4);
            ds.setValue(i, "info2", xh);
            println( "change  "+ i+" row , xh="+ xh );
        }

    } else {
        //往前调，则把新位置之后的图片到当前图片序号之间的图片的序号加1 
        //下面的 i , row  +1 , -1 是看着数据试验出来 的结果，不要凭空去想象
        for (var row = order -1    ; row < old_xh -1 ; row++) {
            var i= row+1; 
            var xh = right('0000' + (i + 1), 4);
            ds.setValue(row, "info2", xh);
            println( "change  "+ row +" row , xh="+ xh );
        }
    }




    if (!ds.update(true)) println(ds.getErrorMessage());
    return true;
}

function reOrderImage(ids) {
    var sqls = [];
    for (var i = 0; i < ids.length; i++) {
        var xh = right('0000' + (i + 1), 4);
        sqls.push("update dzpz_pzfj set info2 ='" + xh + "' where id='" + ids[i] + "' ");
    }
    runSQL("", sqls, true);
    println("调整顺序完成");

}


//@comment (group=,caption=凭证号前缀,needRightControl=false)
function getPZHPrefix(corpid, ym) {
    return runTask("getPZHPrefix", { corpid: corpid, ym: ym });

}
//@comment (group=,caption=凭证号长度,needRightControl=false)
function getPZHLen(corpid) {
    return parseInt(runTask("getPZHLen", { corpid: corpid }));
}



//@comment (group=,caption=凭证审核或取消审核,needRightControl=false)
function do_sh(id, sh) {


    //if (!isRoleGrantedToUser(currentUserId(), "60c81b135db2d209d074b697")) return { success: false, message: "没有审核权限" };



    var dzpz_ds = newDataStore("", "select * from dzpz_pz where id='" + id + "'");
    dzpz_ds.setUpdateProperty("dzpz_pz", "id", "*", "id");
    dzpz_ds.retrieve();
    if (dzpz_ds.getRowCount() == 0) {
        return { success: false, message: "凭证不存在" };
    }
    if (sh) //做审核
    {
        var verifierid = dzpz_ds.getInt(0, "verifierid");
        if (verifierid != 0) return {
            success: true, verifierid: verifierid,
            verifiername: dzpz_ds.getString(0, "verifiername"),
            verifieddate: dzpz_ds.getString(0, "verifieddate"), message: "凭证已审核，不需要重复审核"
        };
        dzpz_ds.setValue(0, "verifierid", currentUserId());
        dzpz_ds.setValue(0, "verifiername", currentUserShowName());
        dzpz_ds.setValue(0, "verifieddate", newDate());

        if (!dzpz_ds.update(true)) return { success: false, message: dzpz_ds.getError().getMessage() };

        //审核后，归档
        runTask("pz_image2pdf", {
            id: id,
            overwrite: true  //如果已存在，删除并重新生成
        });

        return {
            success: true,
            verifierid: dzpz_ds.getString(0, "verifierid"),
            verifiername: dzpz_ds.getString(0, "verifiername"),
            verifieddate: dzpz_ds.getString(0, "verifieddate")
        };

    } else {
        var verifierid = dzpz_ds.getInt(0, "verifierid");
        println(verifierid);
        if (verifierid == 0) return { success: true, message: "凭证尚未审核，不需要取消审核" };
        if (verifierid != currentUserId()) {
            if (!isRoleGrantedToUser(currentUserId(), "60c81b135db2d209d074b6a7") && currentUserId() != 1) {

                return { success: false, message: "必须由审核人或超级审核员来取消审核" };
            }
        }
        dzpz_ds.setValue(0, "verifierid", null);
        dzpz_ds.setValue(0, "verifiername", null);
        dzpz_ds.setValue(0, "verifieddate", null);

        if (!dzpz_ds.update(true)) return { success: false, message: dzpz_ds.getError().getMessage() };
        return { success: true };
    }

}



//@comment (group=,caption=图片旋转,needRightControl=false)
function do_imageRotate(id, rt) {
    var ret = imageRotate("", "dzpz_pzfj", id, rt);
    println(JSON.stringify(ret));
    return ret;
}


id: 60c7e1005db2f19751803b53
pid: 60c4bd735db2478f9c5a1118
name: functionGroup
code: 60c7e1005db2f19751803b53
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118
codepath: 60c4bd735db2478f9c5a1118
fullname: /templateScriptOnServer-60c4bd735db2478f9c5a1118/functionGroup
fullcode: 60c4bd735db2478f9c5a1118.60c7e1005db2f19751803b53
nodetype: column
createdate: 2021.06.15 07:06:40.000
lastmodifieddate: 2024.09.18 14:40:48.305
value:
{"全局函数":[{"source":"//@comment (group=,caption=构建凭证附件清单,needRightControl=false)\nfunction getPZFJ(id)","comment":"//@comment (group=,caption=构建凭证附件清单,needRightControl=false)","group":"","caption":"构建凭证附件清单","needRightControl":"false","func":"getPZFJ","funcTitle":"function getPZFJ","index":0},{"source":"function get_PZ_PDF_URL(id)","comment":"","group":"","caption":"","needRightControl":"","func":"get_PZ_PDF_URL","funcTitle":"function get_PZ_PDF_URL","index":1},{"source":"function back_setImageOrder(gguid, id, order)","comment":"","group":"","caption":"","needRightControl":"","func":"back_setImageOrder","funcTitle":"function back_setImageOrder","index":2},{"source":"function reOrderImage(ids)","comment":"","group":"","caption":"","needRightControl":"","func":"reOrderImage","funcTitle":"function reOrderImage","index":3},{"source":"//@comment (group=,caption=凭证号前缀,needRightControl=false)\nfunction getPZHPrefix(corpid, ym)","comment":"//@comment (group=,caption=凭证号前缀,needRightControl=false)","group":"","caption":"凭证号前缀","needRightControl":"false","func":"getPZHPrefix","funcTitle":"function getPZHPrefix","index":4},{"source":"//@comment (group=,caption=凭证号长度,needRightControl=false)\nfunction getPZHLen(corpid)","comment":"//@comment (group=,caption=凭证号长度,needRightControl=false)","group":"","caption":"凭证号长度","needRightControl":"false","func":"getPZHLen","funcTitle":"function getPZHLen","index":5},{"source":"//@comment (group=,caption=凭证审核或取消审核,needRightControl=false)\nfunction do_sh(id, sh)","comment":"//@comment (group=,caption=凭证审核或取消审核,needRightControl=false)","group":"","caption":"凭证审核或取消审核","needRightControl":"false","func":"do_sh","funcTitle":"function do_sh","index":6},{"source":"//@comment (group=,caption=图片旋转,needRightControl=false)\nfunction do_imageRotate(id, rt)","comment":"//@comment (group=,caption=图片旋转,needRightControl=false)","group":"","caption":"图片旋转","needRightControl":"false","func":"do_imageRotate","funcTitle":"function do_imageRotate","index":7}]}


id: 60c7e1015db21cf830816006
pid: 60c4bd735db2478f9c5a1118
name: functionlist
code: 60c7e1015db21cf830816006
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118
codepath: 60c4bd735db2478f9c5a1118
fullname: /templateScriptOnServer-60c4bd735db2478f9c5a1118/functionlist
fullcode: 60c4bd735db2478f9c5a1118.60c7e1015db21cf830816006
nodetype: column
createdate: 2021.06.15 07:06:42.000
lastmodifieddate: 2024.09.18 14:40:48.305
value:
["do_imageRotate","do_sh","getPZHLen","getPZHPrefix","reOrderImage","back_setImageOrder","get_PZ_PDF_URL","getPZFJ"]


id: 60c8686948741fc1098ac05a
pid: 60a31c475db27838e0c01344
name: functionGroup
code: 60c8686948741fc1098ac05a
namepath: /templateScriptOnServer-60a31c475db27838e0c01344
codepath: 60a31c475db27838e0c01344
fullname: /templateScriptOnServer-60a31c475db27838e0c01344/functionGroup
fullcode: 60a31c475db27838e0c01344.60c8686948741fc1098ac05a
nodetype: column
createdate: 2021.06.15 17:13:08.000
lastmodifieddate: 2024.09.18 14:40:48.675
value:
{"全局函数":[{"source":"function saveLabel(","comment":"","group":"","caption":"","needRightControl":"","func":"saveLabel","funcTitle":"function saveLabel","index":0}]}


id: 60c9bce19932d177d8ac5e15
pid: 60c9bce19932d177d8ac5e09
name: 凭证号长度
code: getPZHLen
namepath: /凭证数字化/设置相关
codepath: 60b71f5a5db22398a379d9ec.60c9bce19932d177d8ac5e09
fullname: /凭证数字化/设置相关/凭证号长度
fullcode: 60b71f5a5db22398a379d9ec.60c9bce19932d177d8ac5e09.getPZHLen
nodetype: leaf
createdate: 2021.06.16 16:57:40.000
lastmodifieddate: 2024.09.18 14:40:48.675
value:
function main(arg)
{

    var p= JSON.parse(arg);
    var corpid= p.corpid;
    

    var t =  getStringFromSQL(" select pzh_length  from basic_corp where code='"+ corpid+"' ");

    return  t ;
}


id: 60c9e78c9932d177d8ac5f90
pid: 60c1bec59932e1a17db2e3ce
name: 保存标签名称
code: 保存标签名称
namepath: /凭证数字化/其它
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce
fullname: /凭证数字化/其它/保存标签名称
fullcode: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.保存标签名称
nodetype: leaf
createdate: 2021.06.16 19:59:09.000
lastmodifieddate: 2024.09.18 14:40:48.677
value:
function main(arg) {
    var p = JSON.parse(arg);
    var labels = p.labels;

    var sql = [];
    sql.push(" select  '' as name from dual  ");
    for (var i = 0; i < labels.length; i++) {
        var name = labels[i];
        if (['凭证号', '记帐期'].contains(name)) continue;
        sql.push(" select '" + name + "' from dual ");
    }

    sql = " select  name from (" + sql.join(" union all ") + " ) a  where a.name not in (select labelname from dzpz_dm_bq )";
    println(sql);
    var ds = newDataStore("", sql);
    var n = ds.retrieve();
    for (var i = 0; i < n; i++) {
        var gguid = newGUID();
        var t = " insert into dzpz_dm_bq (id, gguid, billno , billdate , userid, username , labelname) values ('${id}' , '${id}','${id}', '${billdate}',1,'管理员' ,'${labelname}' )";
        t = freemarker(t, { id: gguid, billdate: date2yyyymmdd(newDate()), labelname: ds.getString(i, "name") });
        println(t);
        runSQL("", t, true);
    }

}


id: 60c9fca09932d177d8ac61aa
pid: 60c9bce19932d177d8ac5e09
name: 凭证号前缀
code: getPZHPrefix
namepath: /凭证数字化/设置相关
codepath: 60b71f5a5db22398a379d9ec.60c9bce19932d177d8ac5e09
fullname: /凭证数字化/设置相关/凭证号前缀
fullcode: 60b71f5a5db22398a379d9ec.60c9bce19932d177d8ac5e09.getPZHPrefix
nodetype: leaf
createdate: 2021.06.16 22:00:23.000
lastmodifieddate: 2024.09.18 14:40:48.679
value:
function main(arg)
{
    var p= JSON.parse(arg);
    var corpid= p.corpid;
    var ym= ''+ p.ym;
    var y= ym.substring(0,4);
    var m= ym.substring(4,6);

    var t =  getStringFromSQL(" select pzh_prefix  from basic_corp where code='"+ corpid+"' ");
    if( t=='') return t; 
    if( t.indexOf("{yy}")>=0)  t=t.replace(/[{]yy[}]/g , y.substring(2,4) );
    if( t.indexOf("{yyyy}")>=0)  t=t.replace(/[{]yyyy[}]/g , y  );
    if( t.indexOf("{mm}")>=0)  t=t.replace(/[{]mm[}]/g , m  );

    var m2= ''+ parseInt(m); // 把 01 转成 1 
    if( t.indexOf("{m}")>=0)  t=t.replace(/[{]m[}]/g , m2  );  // 1-9月直接用数字 ，而不要补0 
    
    return t; 
}


id: 60d0840b0c749ebb22855746
pid: 6181e0bcc76eefddf45ea027
name: 单个凭证图片打包PDF
code: pz_image2pdf
namepath: /凭证数字化/打包下载
codepath: 60b71f5a5db22398a379d9ec.6181e0bcc76eefddf45ea027
fullname: /凭证数字化/打包下载/单个凭证图片打包PDF
fullcode: 60b71f5a5db22398a379d9ec.6181e0bcc76eefddf45ea027.pz_image2pdf
nodetype: leaf
createdate: 2021.06.21 20:34:35.000
lastmodifieddate: 2024.09.18 14:40:49.036
value:
function main(arg) {
    println(arg );
    var p = JSON.parse(arg);
    var id = p.id;
    var overwrite = p.overwrite;

    // info2 是手工调整顺序后的序号 ，如果没有手工调整顺序，那么info2应该都是null , 
    // 这样，如果手工调整了顺序，那么以手工调整后的顺序来排序，
    //否则以(groupname优先排序，它通常是“凭证”，“附件”) 凭证排在前，附件排在后 ，同类型（groupname）文件的按原始日期来排序，

    var tds = newDataStore("", "select pzh , corpid from dzpz_pz where id='" + id + "'");
    tds.retrieve();
    var pzh = tds.getString(0, "pzh");
    var corpid = tds.getString(0, "corpid");
    println("pzh="+ pzh);
    println("corpid="+ corpid);

    //避免出现一张凭证出现多条 app_archive记录的情况，导致后面压缩时，找不到pdf文件，如果有多条，只保留最后一条
    var tds2= newDataStore("","select * from app_archive where gguid='"+id+"' order by lastmodifieddate desc");
    tds2.setUpdateProperty("app_archive","id","*","id");
    var n=tds2.retrieve();
    println("archive count:"+n);
    if( n>1)
    {
        println('');
        for( var i= n-1 ; i>0; i--)
        {
            tds2.deleteRow(i);
        }
        if(!tds2.update(true)) println( tds2.getError().getMessage());
    }


    var url = getStringFromSQL("select url_img  from basic_corp_seal a , basic_corp b where a.gguid=b.gguid and a.groupname='电子印章' and b.code= '" + corpid + "' ");
    println( url);

    if( getIntFromSQL("select count(*) from dzpz_pzfj where gguid='"+id+"' ")==0)
    {
        return {sccess:false, message: "凭证归档信息丢失,禁止重新生成pdf "};
         
    }

    runTask("归档信息保存到文件中", {pzid: id} );

    //把附件打包成一个PDF ,生成pdf不要加水印，水印是在下载时临时加上去的
    return createArchive("dzpz", 
         id,
        "info2 asc , groupname , info1 asc ",  //附件排序规则
        overwrite, //是否强行重新生成
        '', //水印 。生成pdf不要加水印，水印是在下载时临时加上去的
        {
            left: 20,
            top: 20,
            url:  url
        },  //左上角加一个印章图片
        pzh //右上角把凭证号打上，便于查看
    );


}


id: 60d095db993254220bd8519f
pid: templateScriptOnServer
name: templateScriptOnServer-60d095db993254220bd8519f
fullname: /templateScriptOnServer-60d095db993254220bd8519f
fullcode: 60d095db993254220bd8519f
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:49.037
value:
//后端导入excel数据包
function backend_importExcelData(excelData) {
    var ret = {
        'success': false,
        'message': ''
    }
    // return { success: false, message: excelData }
    var dsn = '';
    var masterTable = 'pzdj';
    var tableName = 'pzdjex';
    //ret.message="select id,userid,verifiername from pzdj where gguid='" + currentGUID() + "'";
    //return ret;

    println("1111");
    runSQL("", "alter table  pzdjex   modify  bz  varchar(4000) ");
    runSQL("", "alter table  pzdjex   modify  rkdh  varchar(1000) ");


    var ds = newDataStore(dsn, "select id,userid,verifiername ,corpid from pzdj where gguid='" + currentGUID() + "'");
    ds.setOnceRetrieveCount(1);
    ds.retrieve('');
    if (ds.getRowCount() == 0) {
        ret.message = '请保存单据后再操作此功能!';
        return ret;
    }

    var corpid = ds.getString(0, "corpid");

    // if (ds.getString(0, "userid") != currentUserId()) {
    //     ret.message = '由于您不是制单人，不允许对当前单据做导入操作!';
    //     return ret;
    // }
    if (ds.getString(0, "verifiername") != '') {
        ret.message = '单据已审核，不允许导入操作!';
        return ret;
    }

    runSQL(dsn, "delete from " + tableName + " where gguid='" + currentGUID() + "'");

    //**********************************************
    //导入的标准功能
    var colLabel2ColName = {
        "年度": "y",
        "调整期间": "m",
        "期间": "m",
        "凭证号": "pzh",
        "调整凭证号": "pzh",
        "会计凭证号": "pzh",
        "凭证日期": "pzrq",
        "会计科目代码": "kmdm",
        "会计科目名称": "kmmc",
        "核算账号编码": "code",
        "借方金额": "jfje",
        "贷方金额": "dfje",
        "财会支出明细编码": "ckzcmxdm",
        "财会支出明细名称": "ckzcmxmc",
        "预会支出明细编码": "ykzcmxdm",
        "预会支出明细名称": "ykzcmxmc",
        "入库单号": "rkdh",
        "是否已过账": "posted",
        "摘要": "bz",
        "制单人": "zdr",
        "经办人": "jbr"
    }

    "年度\t调整期间\t凭证号\t凭证日期\t会计科目代码\t会计科目名称\t财会支出明细编码\t财会支出明细名称\t预会支出明细编码\t预会支出明细名称\t核算账号编码\t入库单号\t是否已过账\t摘要\t制单人";


    //var excelSheet;
    //for (var p in excelData) {
    //    excelSheet = excelData[p];
    //}

    var excelSheet = excelData;

    //分析字段对应关系
    var excelColIndex2ColName = {}; //excel 中的列号对应的中文题头
    var excelColName2ColIndex = {}; //中文题头对应的excel中的列号
    // var colLabel2ColName = {}; //中文题头对应到表的字段名


    var duplicateLabelCount = {};
    var colCount = 50; //最多几个列

    var headRow = 0; //题头在第几行
    var dataStartRow = 1; // 数据行从第几行开始
    //有时可能表头有多行合并，所以要检测一下
    for (var i = 0; i < colCount; i++) {
        var v = trim(sys_excelSafeValue(excelSheet, headRow, i));
        if (v == '')
            continue;
        if (duplicateLabelCount[v] == undefined) {
            duplicateLabelCount[v] = 0;
        }
        duplicateLabelCount[v] = duplicateLabelCount[v] + 1;

        if (duplicateLabelCount[v] > 1)
            v = v + duplicateLabelCount[v];
        //拼上后缀

        excelColIndex2ColName['' + i] = v;
        excelColName2ColIndex[v] = '' + i;
    }

    println(JSON.toString(excelColName2ColIndex));
    println(JSON.toString(excelColIndex2ColName));




    var RC = excelSheet.length;

    println("excel数据行数：" + RC);
    var data = [];
    for (var row = dataStartRow; row < RC; row++) {
        // if (sys_excelSafeValue(excelSheet, row, 3) == null) break; //空行，直接结束
        var oneRowData = {};
        data.push(oneRowData);
        for (var label in excelColName2ColIndex) {
            var excelCol = excelColName2ColIndex[label];
            var dbCol = colLabel2ColName[label];
            if (dbCol != null) {
                oneRowData[dbCol] = sys_excelSafeValue(excelSheet, row, excelCol);
            }
        }

    }
    //println(JSON.toString(data));

    pushMessage("dr_info", "开始导入...", currentUserId());

    var gguid = currentGUID();
    var userid = currentUserId();
    var username = currentUserName();
    var lastmodifieddate = newDate();
    // println('import_ph:' + import_ph);



    var ds = newDataStore(dsn, "select * from " + tableName);
    ds.setUpdateProperty(tableName, "id", "*", "id");
    for (var i = 0; i < data.length; i++) {
        var row = ds.insertRow(9999999);
        pushMessage("dr_info", "导入进度：" + (i + 1) + "/" + data.length, currentUserId());

        var rowData = data[i];
        for (var col in rowData) {
            var value = rowData[col];
            ds.setValue(row, col, value);
        }
        ds.setValue(row, "id", newGuid());
        ds.setValue(row, "gguid", gguid);
        ds.setValue(row, "userid", userid);
        ds.setValue(row, "username", username);
        ds.setValue(row, "lastmodifieddate", lastmodifieddate);
        ds.setValue(row, "corpid", corpid);

        if (ds.getRowCount() == 1000) {
            if (!ds.update(true)) {
                var errInfo = ds.getError().getMessage();
                println(errInfo);
                pushMessage("dr_info", "异常：" + errInfo, currentUserId());
                return;
            }
            ds.reset();
        }
    }

    pushMessage("dr_info", "正在写入数据库...", currentUserId());

    ds.update(true);
    // $alert('导入完成');
    ret.success = true;
    ret.message = ds.getString(0, "userid");

    //更新起始记账期和截止记账期
    var master_ds = newDataStore(dsn, "select * from " + masterTable);
    master_ds.setUpdateProperty(masterTable, "id", "*", "id");
    master_ds.retrieve("gguid='" + currentGUID() + "'");
    master_ds.setValue(0, "jzq_start", getStringFromSQL2(dsn, "select min(y*100+m) as t from pzdjex where gguid='" + currentGUID() + "'"));
    master_ds.setValue(0, "jzq_end", getStringFromSQL2(dsn, "select max(y*100+m) as t from pzdjex where gguid='" + currentGUID() + "'"));
    master_ds.update(true)

    pushMessage('dr_info', 'over', currentUserId());

    return ret;
}

function sys_excelSafeValue(sheet, row, col) {
    if (row > sheet.length - 1) return null;
    var dataRow = sheet[row];
    if (dataRow == null) return null;
    if (col > dataRow.length - 1) return null;
    return dataRow[col];

}


id: 60d0a25f0c74a046decf1aaa
pid: 60c1bec59932e1a17db2e3ce
name: 测试多个文件压缩后下载
code: testZIPdownload
namepath: /凭证数字化/其它
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce
fullname: /凭证数字化/其它/测试多个文件压缩后下载
fullcode: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.testZIPdownload
nodetype: leaf
createdate: 2021.06.21 22:39:02.000
lastmodifieddate: 2024.09.18 14:40:49.037
value:
function main(arg)
{
    var t1=  createArchive("dzpz", '60c9b874993292baa316b7cc' , false);
    println( JSON.stringify(t1));

    var t2=  createArchive("dzpz", '60c9b874993292baa316b7c6' , false);
    println( JSON.stringify(t2));
    
    var source=[];
    source.push( t1.data);
    source.push(t2.data);

    println( JSON.stringify(source));

    return createZipFileWith("测试压缩.zip" ,source);

}


id: 60d0a2b8993254220bd859aa
pid: 60d095db993254220bd8519f
name: functionGroup
code: 60d0a2b8993254220bd859aa
namepath: /templateScriptOnServer-60d095db993254220bd8519f
codepath: 60d095db993254220bd8519f
fullname: /templateScriptOnServer-60d095db993254220bd8519f/functionGroup
fullcode: 60d095db993254220bd8519f.60d0a2b8993254220bd859aa
nodetype: column
createdate: 2021.06.21 22:47:04.000
lastmodifieddate: 2024.09.18 14:40:49.038
value:
{"全局函数":[{"source":"function backend_importExcelData(excelData)","comment":"","group":"","caption":"","needRightControl":"","func":"backend_importExcelData","funcTitle":"function backend_importExcelData","index":0},{"source":"function sys_excelSafeValue(sheet, row, col)","comment":"","group":"","caption":"","needRightControl":"","func":"sys_excelSafeValue","funcTitle":"function sys_excelSafeValue","index":1}]}


id: 60d1732d99326f9120345714
pid: 6181e0bcc76eefddf45ea027
name: 打包下载
code: 打包下载
namepath: /凭证数字化/打包下载
codepath: 60b71f5a5db22398a379d9ec.6181e0bcc76eefddf45ea027
fullname: /凭证数字化/打包下载/打包下载
fullcode: 60b71f5a5db22398a379d9ec.6181e0bcc76eefddf45ea027.打包下载
nodetype: leaf
createdate: 2021.06.21 22:39:02.000
lastmodifieddate: 2024.09.18 14:40:49.405
value:
function main(arg) {

    println(arg);
    var p = JSON.parse(arg);
    var watermark = p.watermark; //水印
    var ids = p.ids;
    var gguid=p.gguid;
    var topic = "打包下载" + gguid;

    var exists={};
    var source = [];
    for (var i = 0; i < ids.length; i++) {
        println((i + 1) + "  " + ids[i]);
        var t = "*完成" + ((i + 1) * 100.0 / ids.length) + "%";
        println(t);
        pushMessage( topic , {actoin:'info', info: t}, -1);
        delay(10);
        if( exists[ ids[i]]!=undefined) continue; // 凭证重复了，忽略
        exists[ ids[i]]=1;
        var t = createArchive("dzpz", ids[i], "",false);//把没有归档的归档一下，已经归档的不要重复归档
        println(JSON.stringify(t));
        source.push(t.data);
    }


    println(JSON.stringify(source));
    pushMessage( topic , {actoin:'info', info:  "*正在压缩"}, -1);
    
    var ret = createZipFileWith(p.fileName, source, watermark);

    pushMessage( topic , {actoin:'over' }, -1);
    println(JSON.stringify(ret));
    return ret;

}


id: 60fa600f9932563b7c99baff
pid: templateScriptOnServer
name: templateScriptOnServer-60fa600f9932563b7c99baff
code: 60fa600f9932563b7c99baff
fullname: /templateScriptOnServer-60fa600f9932563b7c99baff
fullcode: 60fa600f9932563b7c99baff
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:49.406
value:
/**
 * 单据点击保存，前端所有的操作被转译成3种操作:insert , delete , update ,
 *  并且可以在  beforeBillSaveOnServer 中返回一些SQL语句，可以在afterBillSaveOnServer中返回一些SQL语句
 *
 * 系统分别在需要的数据库连接中执行这些语句 ， 当所有语句执行成功后，事件被提交。一些细节如下 ：
 *
 * 1 如果单据中的表，属于不同的数据库连接，那么所有的SQL语句会以连接为单位，对语句进行批量执行
 * 2 这些语句的执行顺序是：对同一个数据库连接中的语句， 先执行 beforeBillSaveOnServer 中返回的SQL语句，再执行单据操作转译得到的SQL语句，
 *   再执行 afterBillSaveOnServer 中返回的SQL语句， 当多个（或一个）数据库连接执行完这些语句，且没有错误时，所有的数据库连接做提交，否则全部回滚
 * 3 不要在 beforeBillSaveOnServer 或 afterBillSaveOnServer 中直接执行数据库操作，而是返回SQL语句，让系统批量执行它们，并控制好事务
 * 4 当执行成功后，系统再执行事件函数  afterBillSaveSuccessfulOnServer 。 此事件中可以执行任意操作，它与单据保存事件结束后才被触发执行，
 *   与单据保存并不在一个事务中。
 *
 *
 * @param gguid  要删除记录的gguid ，等同于主表的id
 * @param session  一个JSON对象，用于在整个单据保存过程中的各个事件之间传递数据。本事件做为单据保存的最后一个事件，session对象在使用后将被丢弃
 *
 *
 * @return 本函数不需要返回值
 *
 */
function afterBillSaveSuccessfulOnServer(gguid, session) {

    var corpid = getStringFromSQL("select corpid from dzpz_dy where id='" + gguid + "'");
    //2022.08.11优化，理论上不应该存在重复号码的凭证，但是加上max肯定没错，避免数据异常导致更新失败
    var sqls = ["update dzpz_dymx  set bz=null,pz_id= (select max(id) from dzpz_pz where dzpz_pz.pzh= dzpz_dymx.pzh and dzpz_pz.corpid='" + corpid + "' ) where gguid='" + gguid + "' ",
    "update dzpz_dymx  set bz='凭证号不存在' where  gguid='" + gguid + "' and not exists (select dzpz_pz.id from dzpz_pz where  dzpz_pz.pzh= dzpz_dymx.pzh  and dzpz_pz.corpid='" + corpid + "')  "

    ];

    runSQL("", sqls, true);
    println("----检测凭证是否存在完成---------")
}


/**
 * 用户任务提交后
 * @param flow 流程定义
 * @param node 开始节点
 * @param gguid 单据的gguid

 */

//@comment (group=工作流事件,caption=用户任务提交后)
function onUserTaskSubmitted(flow, userTask, gguid) {
    // println( flow.id) ; //流程定义的ID
    // println( userTask.name);
    println(JSON.stringify(userTask));
    println(gguid);
    if (userTask.id == 'id_60b3b08f27644fc18af35ba20ecd2bac') {
        var ds = newDataStore("", "select * from dzpz_dy where id='" + gguid + "'");
        ds.retrieve();

        if (ds.getInt(0, 'pass') == 0) {
            println("拒绝调阅，强制结束");
            runTask("autoOverRejectedFlow" ,{gguid:gguid} , 3000);
        }


        var moreData = ds.getString(0, "moredata");
        try {
            moreData = JSON.parse(moreData);
            //起草后，递交后调用OA的接口回写数据
            if (moreData.form_id) {
                var pass = ds.getInt(0, "pass");
                var reason = ds.getString(0, "rejectreason");
                runTask('oa_callback', { requestid: moreData.form_id, pass: pass, reason: reason });
            }
        } catch (err) {

        }

    }

    if (userTask.id == 'id_6655df8bedc641aa9bacf1720d13ce2d') //领导审批通过后，就开始打包
    {
        //领导审批通过后，就开始打包
        //2023.07.13 不要自动打包，等oa调用接口在打包，不然，oa没有通知就打包并发送邮件就不对了
        //   do_package(gguid);
    }

    println(gguid + " " + userTask.name + " 提交完成")


}

//后台打包
function do_package(gguid) {
    if (getIntFromSQL("select pass from dzpz_dy where id='" + gguid + "' ") == 0) return { success: false, message: "调阅被拒绝，禁止下载" }
    var ret = JSON.parse(runTask("package", { gguid: gguid }));
    return ret;
}



function back_urlShare(url, d, t) {
    var ret = urlShare(url, d, "day", t);
    return ret.url;
}


id: 60fa608c9932563b7c99bba5
pid: templateScriptOnServer
name: templateScriptOnServer-60fa608c9932563b7c99bba5
code: 60fa608c9932563b7c99bba5
fullname: /templateScriptOnServer-60fa608c9932563b7c99bba5
fullcode: 60fa608c9932563b7c99bba5
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:49.406
value:
function back_flow_over(gguid)
{

    //自动递交给调阅步骤
    var moduleid = 'dy';//模块ID
    var t = taskInfoForWork('dy', gguid);

    if (t.taskList == null) return { success: false, message: 'id 对应的调阅申请不存在' };

    //递交结束
    while (true) {
        if (t.taskList.length == 0) break;
        //将任务递交下去，如果任务需要签收，则先签收     
        for (var i = 0; i < t.taskList.length; i++) {
            var task = t.taskList[i];

            //可以递交，那么递交下去
            if (task.canSubmit) println(submitWork(moduleid, gguid, task.taskId));
            //需要先签收 ，那么以第一个候选人签收它
            if (task.canClaim) claimWork(moduleid, gguid, task.taskId, task.candidateUserList[0].userId);

        }
        t = taskInfoForWork('dy', gguid);

    }

}


id: 60fe08039932563b7c99c33c
pid: 60fa600f9932563b7c99baff
name: functionGroup
code: 60fe08039932563b7c99c33c
namepath: /templateScriptOnServer-60fa600f9932563b7c99baff
codepath: 60fa600f9932563b7c99baff
fullname: /templateScriptOnServer-60fa600f9932563b7c99baff/functionGroup
fullcode: 60fa600f9932563b7c99baff.60fe08039932563b7c99c33c
nodetype: column
createdate: 2021.07.26 09:02:10.000
lastmodifieddate: 2024.09.18 14:40:49.407
value:
{"全局函数":[{"source":"function afterBillSaveSuccessfulOnServer(gguid, session)","comment":"","group":"","caption":"","needRightControl":"","func":"afterBillSaveSuccessfulOnServer","funcTitle":"function afterBillSaveSuccessfulOnServer","index":0},{"source":"function do_package(gguid)","comment":"","group":"","caption":"","needRightControl":"","func":"do_package","funcTitle":"function do_package","index":2},{"source":"function back_urlShare(url, d, t)","comment":"","group":"","caption":"","needRightControl":"","func":"back_urlShare","funcTitle":"function back_urlShare","index":3}],"工作流事件":[{"source":"//@comment (group=工作流事件,caption=用户任务提交后)\nfunction onUserTaskSubmitted(flow, userTask, gguid)","comment":"//@comment (group=工作流事件,caption=用户任务提交后)","group":"工作流事件","caption":"用户任务提交后","needRightControl":"","func":"onUserTaskSubmitted","funcTitle":"function onUserTaskSubmitted","index":1}]}


id: 6151765d99326278b943fb93
pid: 60aaff095db2f37491f99012
name: functionGroup
code: 6151765d99326278b943fb93
namepath: /templateScriptOnServer-60aaff095db2f37491f99012
codepath: 60aaff095db2f37491f99012
fullname: /templateScriptOnServer-60aaff095db2f37491f99012/functionGroup
fullcode: 60aaff095db2f37491f99012.6151765d99326278b943fb93
nodetype: column
createdate: 2021.09.27 15:49:26.000
lastmodifieddate: 2024.09.18 14:40:49.407
value:
{"全局函数":[{"source":"function afterBillVerified(","comment":"","group":"","caption":"","needRightControl":"","func":"afterBillVerified","funcTitle":"function afterBillVerified","index":0},{"source":"function afterBillUnVerified(","comment":"","group":"","caption":"","needRightControl":"","func":"afterBillUnVerified","funcTitle":"function afterBillUnVerified","index":1}]}


id: 6151765d99326278b943fbc5
pid: 60aaff145db2f37491f990b8
name: functionGroup
code: 6151765d99326278b943fbc5
namepath: /templateScriptOnServer-60aaff145db2f37491f990b8
codepath: 60aaff145db2f37491f990b8
fullname: /templateScriptOnServer-60aaff145db2f37491f990b8/functionGroup
fullcode: 60aaff145db2f37491f990b8.6151765d99326278b943fbc5
nodetype: column
createdate: 2021.09.27 16:25:08.000
lastmodifieddate: 2024.09.18 14:40:49.773
value:
{"全局函数":[{"source":"function backend_import_list(","comment":"","group":"","caption":"","needRightControl":"","func":"backend_import_list","funcTitle":"function backend_import_list","index":0}]}


id: 617cc6bb99328c3820c0b3a3
pid: templateScriptOnServer
name: templateScriptOnServer-617cc6bb99328c3820c0b3a3
code: 617cc6bb99328c3820c0b3a3
fullname: /templateScriptOnServer-617cc6bb99328c3820c0b3a3
fullcode: 617cc6bb99328c3820c0b3a3
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:49.774
value:
//@comment (group=,caption=构建凭证附件清单,needRightControl=false)
function getPZFJ(id) {
    var ds = newDataStore("", "select id , url_img , url_thumbnail ,groupname , info1 from  dzpz_pzfj where  gguid='" + id + "'  order by groupname , info1 asc ");
    var n = ds.retrieve();
    var ret = [];
    for (var i = 0; i < n; i++) {
        ret.push(JSON.parse(ds.getJSONRow(i, true)));
    }
    return ret;

}


function   corpid_sync()
{
    runSQL("","update  pzdjex set  corpid= (select corpid from pzdj where pzdj.gguid= pzdjex.gguid)  where corpid is null or corpid='' " ,true);
}


id: 617f55cd99328c3820c0bf5a
pid: 617cc6bb99328c3820c0b3a3
name: functionGroup
code: 617f55cd99328c3820c0bf5a
namepath: /templateScriptOnServer-617cc6bb99328c3820c0b3a3
codepath: 617cc6bb99328c3820c0b3a3
fullname: /templateScriptOnServer-617cc6bb99328c3820c0b3a3/functionGroup
fullcode: 617cc6bb99328c3820c0b3a3.617f55cd99328c3820c0bf5a
nodetype: column
createdate: 2021.11.01 11:03:43.000
lastmodifieddate: 2024.09.18 14:40:49.774
value:
{"全局函数":[{"source":"//@comment (group=,caption=构建凭证附件清单,needRightControl=false)\r\nfunction getPZFJ(","comment":"//@comment (group=,caption=构建凭证附件清单,needRightControl=false)","group":"","caption":"构建凭证附件清单","needRightControl":"false","func":"getPZFJ","funcTitle":"function getPZFJ","index":0},{"source":"function   corpid_sync(","comment":"","group":"","caption":"","needRightControl":"","func":"corpid_sync","funcTitle":"function   corpid_sync","index":1}]}


id: 617f9bba99328c3820c0c07e
pid: 617f9bba99328c3820c0c072
name: chat
code: chat
namepath: /凭证数字化/TEMP
codepath: 60b71f5a5db22398a379d9ec.617f9bba99328c3820c0c072
fullname: /凭证数字化/TEMP/chat
fullcode: 60b71f5a5db22398a379d9ec.617f9bba99328c3820c0c072.chat
nodetype: leaf
createdate: 2021.11.01 16:12:09.000
lastmodifieddate: 2024.09.18 14:40:49.774
value:
function main()
{

   // chatWith( 1 , "工工工工工工工工工" ) ;

  // var gguid='6181e1dac76ee5afc5389218';
 
 //var topic = "打包下载" + gguid;
     
   // pushMessage(topic,  {action:"info", info:  newDate()  }, -1);

   popupInfo( -1, "系统更新，请暂停使用，请在10分钟后再继续" ); 
}


id: 6181e49ac76eefddf45ea05a
pid: 6181e4b9c76eefddf45ea0b9
name: 后台打包
code: 后台打包
namepath: /后台打包
codepath: 6181e4b9c76eefddf45ea0b9
fullname: /后台打包/后台打包
fullcode: 6181e4b9c76eefddf45ea0b9.后台打包
nodetype: leaf
createdate: 2021.11.03 09:23:58.000
lastmodifieddate: 2024.09.18 14:40:49.776
value:
function main(arg) {

    println(arg);
    var p = JSON.parse(arg);
    var watermark = p.watermark; //水印
    var ids = p.ids;
    var gguid = p.gguid;
    var mergePDF = p.mergePDF;

    var topic = "打包下载" + gguid;


    var source = [];
    //封面
    var bf = runTask("createBookFace", { id: gguid });
     println("封面");
     println(bf);
 //   source.push(JSON.parse(bf));

    //针对 每一个凭证，检查一下归档是不是已经生成， 已经生成的，不要重复再生成，没有生成的，那么就先生成它
    for (var i = 0; i < ids.length; i++) {
        println((i + 1) + "  " + ids[i].id);
        var t = "*凭证归档检测。完成" + ((i + 1) * 100.0 / ids.length) + "%";
        println(t);
        pushMessage(topic, { action: "info", info: t }, -1);
        delay(10);

        var t = runTask("pz_image2pdf", {
            id: ids[i].id,
            overwrite: false  //如果已存在，不要重新生成
        });
        println(t);

        if (mergePDF) {
            var pzhfm = runTask("createNo", { pzh:  ids[i].filenameprefix + getStringFromSQL("select pzh from dzpz_pz where id='" + ids[i].id + "'") });

            //每个凭证号加一个小封面
  //          source.push(JSON.parse(pzhfm));
        }

        var oneSource= JSON.parse(t).data;
        oneSource.filenameprefix = ids[i].filenameprefix;  
        source.push( oneSource);
    }


    //source中存放的是每个归档pdf文件的下载地址。在服务器上直接下载，走的是文件服务器下载接口，不是FileServer的http
    // 接口，所以不会自动加上水印
    println(JSON.stringify(source));
    pushMessage(topic, { action: "info", info: "*正在压缩" }, -1);
    var ret = createZipFileTask(p.fileName,
        source,
        watermark,
        500, //每个压缩文件的源文件大小合计不超过 mb 数 
        3,  //放到第3个文件服务器下
        "调阅打包/" + formatDate(newDate(), "yyyy/MM/dd"),//存放子目录
        "后台打包中",
        "后台打包完成",
        "后台打包异常",
        mergePDF, //pdf是否合并 
        {
            table: "dzpz_dy",
            gguid: gguid,

        }
    );


    println(JSON.stringify(ret));
    return ret;

}


id: 6181e7a7c76eefddf45ea191
pid: 6181e4b9c76eefddf45ea0b9
name: 后台打包中
code: 后台打包中
namepath: /后台打包
codepath: 6181e4b9c76eefddf45ea0b9
fullname: /后台打包/后台打包中
fullcode: 6181e4b9c76eefddf45ea0b9.后台打包中
nodetype: leaf
createdate: 2021.11.03 09:46:41.000
lastmodifieddate: 2024.09.18 14:40:50.141
value:
function main(arg) {

    println(arg);
    var p = JSON.parse(arg);
   
    var gguid = p.gguid;
    var topic = "打包下载" + gguid;
     
   var pc= round( parseFloat(p.currentActionPercent),0);
   if( pc==null) pc=1;
    pushMessage(topic,  {action:"info", info: p.currentAction+":"+ pc +"%"}, -1);
}


id: 6181ea0bc76eefddf45ea1e5
pid: 6181e4b9c76eefddf45ea0b9
name: 后台打包完成
code: 后台打包完成
namepath: /后台打包
codepath: 6181e4b9c76eefddf45ea0b9
fullname: /后台打包/后台打包完成
fullcode: 6181e4b9c76eefddf45ea0b9.后台打包完成
nodetype: leaf
createdate: 2021.11.03 09:47:04.000
lastmodifieddate: 2024.09.18 14:40:50.143
value:
function main(arg) {

    println(arg);
    var p = JSON.parse(arg);

    var gguid = p.gguid;
    var topic = "打包下载" + gguid;

    var ds = newDataStore("", "select * from dzpz_dy");
    ds.setUpdateProperty("dzpz_dy", "id", "*", "id");
    ds.retrieve(" id='" + gguid + "'");
    ds.setValue(0, "ziptaskid", "");
    ds.setValue(0, "zipresult", JSON.stringify(p.zipFiles));
    if(!ds.update(true)) println( ds.getError().getMessage());

    pushMessage(topic, { action: "gameOver", result: p }, -1);

   println(ds.getJSONRow(0, true).replace(/,/g , '<br>'));
   var action_after_pack = ds.getString(0, "action_after_pack");
   var email = ds.getString(0, "email");
    println( "action_after_pack="+ action_after_pack);
    println("email="+ email);

    // 因为打包是异步的，所以打包后续动作放在这里处理
    if (action_after_pack !='' || email!='') {
        println('发送邮件');
        runTask("action_after_pack", { gguid: gguid });
    }else{
        println("打包完成，无需后续操作");

    }

    //发送消息给申请人
    var html = [];
    html.push("调阅申请已审批通过，点击链接下载：<br><ul>");
    for (var i = 0; i < p.zipFiles.length; i++) {
        var url = '' + p.zipFiles[i].url;
        url = url.replace(/&action=view/g, '&action=download');
        html.push('<li><a href="' + url + '" target="_blank">' + p.zipFiles[i].fileName + '</a></li>');
    }
    html.push('</ul>');
    var userid = ds.getInt(0, "userid");
    println(html.join(''));
    chatWith(userid, html.join(''));



}


id: 6181ea0bc76eefddf45ea231
pid: 6181e4b9c76eefddf45ea0b9
name: 后台打包异常
code: 后台打包异常
namepath: /后台打包
codepath: 6181e4b9c76eefddf45ea0b9
fullname: /后台打包/后台打包异常
fullcode: 6181e4b9c76eefddf45ea0b9.后台打包异常
nodetype: leaf
createdate: 2021.11.03 09:47:19.000
lastmodifieddate: 2024.09.18 14:40:50.144
value:
function main(arg) {

    println(arg);
    var p = JSON.parse(arg);
   
    var gguid = p.gguid;
    var topic = "打包下载" + gguid;
     
    pushMessage(topic,  {action:"error",  info: p.message }, -1);
    
}


id: 6183205499328c3820c0c8d9
pid: templateScriptOnServer
name: templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046
code: 6183205499328c3820c0c8d9
fullname: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046
fullcode: 6183205499328c3820c0c8d9
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:50.506
value:
//@comment (group=,caption=构建凭证附件清单,needRightControl=false)
function getPZFJ(id) {
    var ds = newDataStore("", "select id , url_img , url_thumbnail ,groupname , info1 from  dzpz_pzfj where  gguid='" + id + "'  order by info2 asc,groupname , info1 asc ");
    var n = ds.retrieve();
    println(ds.getSelectLastRetrieved());
    var ret = [];
    for (var i = 0; i < n; i++) {
        var one = JSON.parse(ds.getJSONRow(i, true));
        one.url_img = one.url_img + "&imageForceWatermark=false"
        ret.push(one);
    }
    return ret;

}




//@comment (group=,caption=凭证号前缀,needRightControl=false)
function getPZHPrefix(corpid, ym) {
    return runTask("getPZHPrefix", { corpid: corpid, ym: ym });

}
//@comment (group=,caption=凭证号长度,needRightControl=false)
function getPZHLen(corpid) {
    return parseInt(runTask("getPZHLen", { corpid: corpid }));
}



//@comment (group=,caption=凭证审核或取消审核,needRightControl=false)
function do_sh(id, sh) {


    //if (!isRoleGrantedToUser(currentUserId(), "60c81b135db2d209d074b697")) return { success: false, message: "没有审核权限" };



    var dzpz_ds = newDataStore("", "select * from dzpz_pz where id='" + id + "'");
    dzpz_ds.setUpdateProperty("dzpz_pz", "id", "*", "id");
    dzpz_ds.retrieve();
    if (dzpz_ds.getRowCount() == 0) {
        return { success: false, message: "凭证不存在" };
    }
    if (sh) //做审核
    {
        var verifierid = dzpz_ds.getInt(0, "verifierid");
        if (verifierid != 0) return {
            success: true, verifierid: verifierid,
            verifiername: dzpz_ds.getString(0, "verifiername"),
            verifieddate: dzpz_ds.getString(0, "verifieddate"), message: "凭证已审核，不需要重复审核"
        };
        dzpz_ds.setValue(0, "verifierid", currentUserId());
        dzpz_ds.setValue(0, "verifiername", currentUserShowName());
        dzpz_ds.setValue(0, "verifieddate", newDate());

        if (!dzpz_ds.update(true)) return { success: false, message: dzpz_ds.getError().getMessage() };

        //审核后，归档
        runTask("pz_image2pdf", {
            id: id,
            overwrite: true  //如果已存在，删除并重新生成
        });

        return {
            success: true,
            verifierid: dzpz_ds.getString(0, "verifierid"),
            verifiername: dzpz_ds.getString(0, "verifiername"),
            verifieddate: dzpz_ds.getString(0, "verifieddate")
        };

    } else {
        var verifierid = dzpz_ds.getInt(0, "verifierid");
        println(verifierid);
        if (verifierid == 0) return { success: true, message: "凭证尚未审核，不需要取消审核" };
        if (verifierid != currentUserId()) {
            if (!isRoleGrantedToUser(currentUserId(), "60c81b135db2d209d074b6a7")) {

                return { success: false, message: "必须由审核人或超级审核员来取消审核" };
            }
        }
        dzpz_ds.setValue(0, "verifierid", null);
        dzpz_ds.setValue(0, "verifiername", null);
        dzpz_ds.setValue(0, "verifieddate", null);

        if (!dzpz_ds.update(true)) return { success: false, message: dzpz_ds.getError().getMessage() };
        return { success: true };
    }

}

function beWhere_code(st_code) {
    return "pzh in(select pzh from pzdjex where code='" + st_code + "')"
}


id: 6183205699328c3820c0cbef
pid: 6183205499328c3820c0c8d9
name: functionGroup
code: 60c7e1005db2f19751803b5320211104075046
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046
codepath: 6183205499328c3820c0c8d9
fullname: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046/functionGroup
fullcode: 6183205499328c3820c0c8d9.60c7e1005db2f19751803b5320211104075046
nodetype: column
createdate: 2021.06.15 07:06:40.000
lastmodifieddate: 2024.09.18 14:40:50.506
value:
{"全局函数":[{"source":"//@comment (group=,caption=构建凭证附件清单,needRightControl=false)\nfunction getPZFJ(","comment":"//@comment (group=,caption=构建凭证附件清单,needRightControl=false)","group":"","caption":"构建凭证附件清单","needRightControl":"false","func":"getPZFJ","funcTitle":"function getPZFJ","index":0},{"source":"//@comment (group=,caption=凭证号前缀,needRightControl=false)\nfunction getPZHPrefix(","comment":"//@comment (group=,caption=凭证号前缀,needRightControl=false)","group":"","caption":"凭证号前缀","needRightControl":"false","func":"getPZHPrefix","funcTitle":"function getPZHPrefix","index":1},{"source":"//@comment (group=,caption=凭证号长度,needRightControl=false)\nfunction getPZHLen(","comment":"//@comment (group=,caption=凭证号长度,needRightControl=false)","group":"","caption":"凭证号长度","needRightControl":"false","func":"getPZHLen","funcTitle":"function getPZHLen","index":2},{"source":"//@comment (group=,caption=凭证审核或取消审核,needRightControl=false)\nfunction do_sh(","comment":"//@comment (group=,caption=凭证审核或取消审核,needRightControl=false)","group":"","caption":"凭证审核或取消审核","needRightControl":"false","func":"do_sh","funcTitle":"function do_sh","index":3},{"source":"function beWhere_code(","comment":"","group":"","caption":"","needRightControl":"","func":"beWhere_code","funcTitle":"function beWhere_code","index":4}]}


id: 6183205699328c3820c0cbf7
pid: 6183205499328c3820c0c8d9
name: group_4S6ZH2ECWLSY3D7EXSNOLBUF5GB2R2FHSLUITMQ=
code: 60c815e85db2d209d074b66620211104075046
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046
codepath: 6183205499328c3820c0c8d9
fullcode: 6183205499328c3820c0c8d9.60c815e85db2d209d074b66620211104075046
nodetype: column
value: false
createdate: 2021.06.15 11:05:42.000
lastmodifieddate: 2024.09.18 14:40:50.506
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046/group_4S6ZH2ECWLSY3D7EXSNOLBUF5GB2R2FHSLUITMQ=


id: 61838c34f80e9a6b4ee38de3
pid: 6181e4b9c76eefddf45ea0b9
name: 终止打包
code: 终止打包
namepath: /后台打包
codepath: 6181e4b9c76eefddf45ea0b9
fullname: /后台打包/终止打包
fullcode: 6181e4b9c76eefddf45ea0b9.终止打包
nodetype: leaf
createdate: 2021.11.04 15:58:21.000
lastmodifieddate: 2024.09.18 14:40:50.507
value:
function main(arg)
{
    var p= JSON.parse(arg);
    var taskid= p.id;
    cancelCreateZipFileTask( taskid);
    return {success:true};
    
}


id: 6188ead59932f1a68ca6b9a3
pid: 6188ead59932f1a68ca6b997
name: 缩小图片大小
code: imageResize
namepath: /凭证数字化/调整尺寸
codepath: 60b71f5a5db22398a379d9ec.6188ead59932f1a68ca6b997
fullname: /凭证数字化/调整尺寸/缩小图片大小
fullcode: 60b71f5a5db22398a379d9ec.6188ead59932f1a68ca6b997.imageResize
nodetype: leaf
createdate: 2021.11.08 21:13:03.000
lastmodifieddate: 2024.09.18 14:40:50.509
value:
function main(arg)
{

    var targetSize =2538;

    var ym='202001';
    //注意， 不是宿主机的目录，是docker容器中的目录
    var root="D:/appFileRoot/FileServer/电子凭证/";

    //找出这个月，上传的图片在哪些目录中
    var ds1= newDataStore("","select    distinct    left ( objectname ,  LENGTH(objectname) - INSTR(REVERSE( objectname),'/')) as path  from dzpz_pzfj where gguid in ( select gguid from  dzpz_pz where ym="+ym+ " )   ");
    var n=ds1.retrieve();

    var ds2= newDataStore("", " select objectname from dzpz_pzfj where gguid in (select id from dzpz_pz where ym="+ym+" ) ");

    println( ym+"的文件分布在"+n+"个目录中");
    for( var i=0;i<n;i++)
    {
        var objectPath= ds1.getString(i,'path');
        
        var m= ds2.retrieve("  left ( objectname ,  LENGTH(objectname) - INSTR(REVERSE( objectname),'/'))  = '"+objectPath+"' ");
        println( (i+1)+": "+objectPath +" 中，"+ym+"月的有"+m+"张图片");

        var bakPath= root+ objectPath+"/bak";
        mkDirs( bakPath);
        println("创建备份目录："+ bakPath);
        for( j =0;j<m;j++)
        {
            println( (i+1)+"/"+ m ); 
            var objectName=  ''+ ds2.getString(j,"objectname");
            var sourceFile = root+objectName;
            var onlyName= objectName.substr( objectName.lastIndexOf("/")+1);
            var bakFileName= bakPath + '/'+ onlyName; 
            if( ! fileExists( bakFileName ) )
            {
                println("备份文件："+ onlyName+" 到 "+ bakFileName);
                fileCopy( sourceFile, bakFileName , false); 
            }else{
                println("备份文件"+ bakFileName+" 已存在，把备份文件复制回来，重新resize");
                fileCopy( bakFileName, sourceFile , true) ;
            }

            var err=imageResize( sourceFile , targetSize) ;
           //如果resize后文件还变大了，那么还是字节使用原来的文件吧
           var os= fileSize( bakFileName) ;
           var ns =  fileSize(sourceFile) ;
           println('原来文件大小为'+os +' , 缩放后大小为：'+ns);
           if( os <ns )
           {
               println(' resize 后文件变大，放弃，还原为原来的文件');
                fileCopy( bakFileName, sourceFile , true) ;
           }
          
            
        }
    }

    println( 'over');
    return 'over';

}


id: 618b531c9932fda9010e7047
pid: 618b531c9932fda9010e703a
name: 索引
code: createIndex
namepath: /系统管理
codepath: 618b531c9932fda9010e703a
fullname: /系统管理/索引
fullcode: 618b531c9932fda9010e703a.createIndex
nodetype: leaf
createdate: 2021.11.10 13:38:51.000
lastmodifieddate: 2024.09.18 14:40:50.878
value:
function main() {
    runSQL('', " create index di_dzpz_pzfj_gguid_groupname_info1 on dzpz_pzfj ( gguid, groupname, info1) ", "");

    runSQL('', " create index i_dzpz_pz_gguid on dzpz_pz  ( gguid  )", true);
    runSQL('', " create index di_pz_corp_ym on dzpz_pz  ( corpid, ym )", true);
    runSQL('', " create index di_dzpz_corpid_pzh on dzpz_pz  ( corpid, pzh  )", true);


    runSQL("", "SET GLOBAL  tmp_table_size =1024*1024*1024 ", true);

    runSQL("", "SET GLOBAL innodb_buffer_pool_size=67108864 ", true);

}


id: 618b5aec9932fda9010e707a
pid: 618b531c9932fda9010e7047
name: functionGroup
code: 618b5aec9932fda9010e707a
namepath: /系统管理/索引
codepath: 618b531c9932fda9010e703a.createIndex
fullname: /系统管理/索引/functionGroup
fullcode: 618b531c9932fda9010e703a.createIndex.618b5aec9932fda9010e707a
nodetype: column
createdate: 2021.11.10 13:39:22.000
lastmodifieddate: 2024.09.18 14:40:50.878
value:
{"全局函数":[{"source":"function main()","comment":"","group":"","caption":"","needRightControl":"","func":"main","funcTitle":"function main","index":0}]}


id: 61987c6799324840d69f7f72
pid: 6197664a99324840d69f7f22
name: functionGroup
code: 61987c6799324840d69f7f72
namepath: /凭证数字化/其它/客户端日志
codepath: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.remoteLog
fullname: /凭证数字化/其它/客户端日志/functionGroup
fullcode: 60b71f5a5db22398a379d9ec.60c1bec59932e1a17db2e3ce.remoteLog.61987c6799324840d69f7f72
nodetype: column
createdate: 2021.11.20 12:41:53.000
lastmodifieddate: 2024.09.18 14:40:51.272
value:
{"全局函数":[{"source":"function  main(","comment":"","group":"","caption":"","needRightControl":"","func":"main","funcTitle":"function  main","index":0}]}


id: 619a5454993208680e522973
pid: templateScriptOnServer
name: templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
code: 619a5454993208680e522973
fullname: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
fullcode: 619a5454993208680e522973
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:51.273
value:
//@comment (group=,caption=构建凭证附件清单,needRightControl=false)
function getPZFJ(id) {
    var ds = newDataStore("", "select id , url_img , url_thumbnail ,groupname , info1 from  dzpz_pzfj where  gguid='" + id + "'  order by info2 asc,groupname , info1 asc ");
    var n = ds.retrieve();
    println( ds.getSelectLastRetrieved());
    var ret = [];
    for (var i = 0; i < n; i++) {
        var one= JSON.parse(ds.getJSONRow(i, true));
        one.url_img = one.url_img+"&imageForceWatermark=false"
        ret.push(one);
    }
    return ret;

}




//@comment (group=,caption=凭证号前缀,needRightControl=false)
function  getPZHPrefix(corpid,ym)
{
    return runTask("getPZHPrefix" ,{corpid:corpid, ym:ym});
    
}
//@comment (group=,caption=凭证号长度,needRightControl=false)
function getPZHLen(corpid)
{
    return  parseInt( runTask("getPZHLen",{corpid:corpid}));
}



//@comment (group=,caption=凭证审核或取消审核,needRightControl=false)
function do_sh(id, sh) {


    //if (!isRoleGrantedToUser(currentUserId(), "60c81b135db2d209d074b697")) return { success: false, message: "没有审核权限" };



    var dzpz_ds = newDataStore("", "select * from dzpz_pz where id='" + id + "'");
    dzpz_ds.setUpdateProperty("dzpz_pz", "id", "*", "id");
    dzpz_ds.retrieve();
    if (dzpz_ds.getRowCount() == 0) {
        return { success: false, message: "凭证不存在" };
    }
    if (sh) //做审核
    {
        var verifierid = dzpz_ds.getInt(0, "verifierid");
        if (verifierid != 0) return {
            success: true, verifierid: verifierid,
            verifiername: dzpz_ds.getString(0, "verifiername"),
            verifieddate: dzpz_ds.getString(0, "verifieddate"), message: "凭证已审核，不需要重复审核"
        };
        dzpz_ds.setValue(0, "verifierid", currentUserId());
        dzpz_ds.setValue(0, "verifiername", currentUserShowName());
        dzpz_ds.setValue(0, "verifieddate", newDate());

        if (!dzpz_ds.update(true)) return { success: false, message: dzpz_ds.getError().getMessage() };

        //审核后，归档
        runTask("pz_image2pdf" ,{id:id , 
            overwrite:true  //如果已存在，删除并重新生成
            });
            
        return {
            success: true,
            verifierid: dzpz_ds.getString(0, "verifierid"),
            verifiername: dzpz_ds.getString(0, "verifiername"),
            verifieddate: dzpz_ds.getString(0, "verifieddate")
        };

    } else {
        var verifierid = dzpz_ds.getInt(0, "verifierid");
        println(verifierid);
        if (verifierid == 0) return { success: true, message: "凭证尚未审核，不需要取消审核" };
        if (verifierid != currentUserId()) {
            if (!isRoleGrantedToUser(currentUserId(), "60c81b135db2d209d074b6a7")) {

                return { success: false, message: "必须由审核人或超级审核员来取消审核" };
            }
        }
        dzpz_ds.setValue(0, "verifierid", null);
        dzpz_ds.setValue(0, "verifiername", null);
        dzpz_ds.setValue(0, "verifieddate", null);

        if (!dzpz_ds.update(true)) return { success: false, message: dzpz_ds.getError().getMessage() };
        return { success: true };
    }

}


id: 619a5456993208680e522c01
pid: 619a5454993208680e522973
name: deletelogafter
code: 60c7d6795db2f19751803b472021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c7d6795db2f19751803b472021110407504620211121221446
nodetype: column
value: 7
createdate: 2021.06.15 07:06:27.000
lastmodifieddate: 2024.09.18 14:40:51.273
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/deletelogafter


id: 619a5456993208680e522c19
pid: 619a5454993208680e522973
name: functioncheckpoint
code: 60c7e1015db21cf8308160072021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c7e1015db21cf8308160072021110407504620211121221446
nodetype: column
value: {}
createdate: 2021.06.15 07:06:42.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/functioncheckpoint


id: 619a5456993208680e522c1d
pid: 619a5454993208680e522973
name: functionGroup
code: 60c7e1005db2f19751803b532021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c7e1005db2f19751803b532021110407504620211121221446
nodetype: column
createdate: 2021.06.15 07:06:40.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/functionGroup

value:
{"全局函数":[{"source":"//@comment (group=,caption=构建凭证附件清单,needRightControl=false)\nfunction getPZFJ(","comment":"//@comment (group=,caption=构建凭证附件清单,needRightControl=false)","group":"","caption":"构建凭证附件清单","needRightControl":"false","func":"getPZFJ","funcTitle":"function getPZFJ","index":0},{"source":"//@comment (group=,caption=凭证号前缀,needRightControl=false)\nfunction  getPZHPrefix(","comment":"//@comment (group=,caption=凭证号前缀,needRightControl=false)","group":"","caption":"凭证号前缀","needRightControl":"false","func":"getPZHPrefix","funcTitle":"function  getPZHPrefix","index":1},{"source":"//@comment (group=,caption=凭证号长度,needRightControl=false)\nfunction getPZHLen(","comment":"//@comment (group=,caption=凭证号长度,needRightControl=false)","group":"","caption":"凭证号长度","needRightControl":"false","func":"getPZHLen","funcTitle":"function getPZHLen","index":2},{"source":"//@comment (group=,caption=凭证审核或取消审核,needRightControl=false)\nfunction do_sh(","comment":"//@comment (group=,caption=凭证审核或取消审核,needRightControl=false)","group":"","caption":"凭证审核或取消审核","needRightControl":"false","func":"do_sh","funcTitle":"function do_sh","index":3}]}


id: 619a5456993208680e522c25
pid: 619a5454993208680e522973
name: group_4S6ZH2ECWLSY3D7EXSNOLBUF5GB2R2FHSLUITMQ=
code: 60c815e85db2d209d074b6662021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c815e85db2d209d074b6662021110407504620211121221446
nodetype: column
value: false
createdate: 2021.06.15 11:05:42.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/group_4S6ZH2ECWLSY3D7EXSNOLBUF5GB2R2FHSLUITMQ=


id: 619a5456993208680e522c29
pid: 619a5454993208680e522973
name: group_4W6IBZMPSHUKPEXIRGZA====
code: 60c815e85db2d209d074b6632021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c815e85db2d209d074b6632021110407504620211121221446
nodetype: column
value: false
createdate: 2021.06.15 11:05:41.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/group_4W6IBZMPSHUKPEXIRGZA====


id: 619a5456993208680e522c2d
pid: 619a5454993208680e522973
name: group_AAAAAAA=
code: 60c815e85db2d209d074b65d2021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c815e85db2d209d074b65d2021110407504620211121221446
nodetype: column
value: false
createdate: 2021.06.15 11:05:40.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/group_AAAAAAA=


id: 619a5456993208680e522c31
pid: 619a5454993208680e522973
name: maxactivethreadcount
code: 60c7d6795db2f19751803b492021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c7d6795db2f19751803b492021110407504620211121221446
nodetype: column
value: 100
createdate: 2021.06.15 07:06:27.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/maxactivethreadcount


id: 619a5456993208680e522c3d
pid: 619a5454993208680e522973
name: role-5fffc49c9932a2f576bbc87e
code: 60c815e85db2d209d074b6642021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c815e85db2d209d074b6642021110407504620211121221446
nodetype: column
value: false
createdate: 2021.06.15 11:05:42.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/role-5fffc49c9932a2f576bbc87e


id: 619a5456993208680e522c41
pid: 619a5454993208680e522973
name: role-5fffc49c9932a2f576bbc8ab
code: 60c815e85db2d209d074b6652021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c815e85db2d209d074b6652021110407504620211121221446
nodetype: column
value: false
createdate: 2021.06.15 11:05:42.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/role-5fffc49c9932a2f576bbc8ab


id: 619a5456993208680e522c45
pid: 619a5454993208680e522973
name: role-601109b09932445fcc3950e7
code: 60c815e85db2d209d074b6602021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c815e85db2d209d074b6602021110407504620211121221446
nodetype: column
value: false
createdate: 2021.06.15 11:05:41.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/role-601109b09932445fcc3950e7


id: 619a5456993208680e522c49
pid: 619a5454993208680e522973
name: role-608682ac993231a6fef4f736
code: 60c815e85db2d209d074b65e2021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c815e85db2d209d074b65e2021110407504620211121221446
nodetype: column
value: false
createdate: 2021.06.15 11:05:40.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/role-608682ac993231a6fef4f736


id: 619a5456993208680e522c4d
pid: 619a5454993208680e522973
name: role-60b727a299327aec523a283e
code: 60c815e85db2d209d074b6612021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c815e85db2d209d074b6612021110407504620211121221446
nodetype: column
value: false
createdate: 2021.06.15 11:05:41.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/role-60b727a299327aec523a283e


id: 619a5456993208680e522c51
pid: 619a5454993208680e522973
name: role-60b7489699327aec523a2ce1
code: 60c815e85db2d209d074b6672021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c815e85db2d209d074b6672021110407504620211121221446
nodetype: column
value: false
createdate: 2021.06.15 11:05:42.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/role-60b7489699327aec523a2ce1


id: 619a5456993208680e522c55
pid: 619a5454993208680e522973
name: role-60b7489699327aec523a2cf1
code: 60c815e85db2d209d074b6682021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c815e85db2d209d074b6682021110407504620211121221446
nodetype: column
value: false
createdate: 2021.06.15 11:05:42.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/role-60b7489699327aec523a2cf1


id: 619a5456993208680e522c59
pid: 619a5454993208680e522973
name: role-60b83c5999327aec523a2d01
code: 60c815e85db2d209d074b6622021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c815e85db2d209d074b6622021110407504620211121221446
nodetype: column
value: false
createdate: 2021.06.15 11:05:41.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/role-60b83c5999327aec523a2d01


id: 619a5456993208680e522c5d
pid: 619a5454993208680e522973
name: role-60bb95269932a3ac306d0316
code: 60c815e85db2d209d074b6692021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c815e85db2d209d074b6692021110407504620211121221446
nodetype: column
value: false
createdate: 2021.06.15 11:05:43.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/role-60bb95269932a3ac306d0316


id: 619a5456993208680e522c61
pid: 619a5454993208680e522973
name: role-60bb95269932a3ac306d0326
code: 60c815e85db2d209d074b66a2021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c815e85db2d209d074b66a2021110407504620211121221446
nodetype: column
value: false
createdate: 2021.06.15 11:05:43.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/role-60bb95269932a3ac306d0326


id: 619a5456993208680e522c65
pid: 619a5454993208680e522973
name: role-60bb95269932a3ac306d0336
code: 60c815e85db2d209d074b66b2021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c815e85db2d209d074b66b2021110407504620211121221446
nodetype: column
value: false
createdate: 2021.06.15 11:05:43.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/role-60bb95269932a3ac306d0336


id: 619a5456993208680e522c69
pid: 619a5454993208680e522973
name: role-60bb95889932a3ac306d035a
code: 60c815e85db2d209d074b66c2021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c815e85db2d209d074b66c2021110407504620211121221446
nodetype: column
value: false
createdate: 2021.06.15 11:05:43.000
lastmodifieddate: 2024.09.18 14:40:51.274
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/role-60bb95889932a3ac306d035a


id: 619a5456993208680e522c89
pid: 619a5454993208680e522973
name: writeCallingLog
code: 60c7d6795db2f19751803b452021110407504620211121221446
namepath: /templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446
codepath: 619a5454993208680e522973
fullcode: 619a5454993208680e522973.60c7d6795db2f19751803b452021110407504620211121221446
nodetype: column
value: true
createdate: 2021.06.15 07:06:26.000
lastmodifieddate: 2024.09.18 14:40:51.275
fullname:
/templateScriptOnServer-60c4bd735db2478f9c5a1118clone20211104075046clone20211121221446/writeCallingLog


id: 619e193003748a0409f52e4d
pid: 617f9bba99328c3820c0c072
name: 测试生成pdf
code: test-createpdf
namepath: /凭证数字化/TEMP
codepath: 60b71f5a5db22398a379d9ec.617f9bba99328c3820c0c072
fullname: /凭证数字化/TEMP/测试生成pdf
fullcode: 60b71f5a5db22398a379d9ec.617f9bba99328c3820c0c072.test-createpdf
nodetype: leaf
createdate: 2021.11.24 18:51:29.000
lastmodifieddate: 2024.09.18 14:40:51.638
value:
function main()
{
     var  s=  getProperty( '/凭证调阅封面' ,'');

     return app.fo2pdf(s , "aaa.pdf", 1 , "fo2pdf");




}


id: 61a89a3f14106903676b97fa
pid: 6181e4b9c76eefddf45ea0b9
name: 生成调阅封面
code: createBookFace
namepath: /后台打包
codepath: 6181e4b9c76eefddf45ea0b9
fullname: /后台打包/生成调阅封面
fullcode: 6181e4b9c76eefddf45ea0b9.createBookFace
nodetype: leaf
createdate: 2021.12.02 18:19:31.000
lastmodifieddate: 2024.09.18 14:40:51.639
value:
function main(arg)
{

    var p=JSON.parse(arg);
    var id= p.id || '619da5140374348f72330eff--' ;

    var ds=newDataStore("","select billdate , billno , reader , leaderid , '' as leader, summary  from  dzpz_dy  where id='"+id+"'");
    ds.retrieve();
    if( ds.getRowCount()==0) ds.insertRow(0);
    
    var param= ds.getJSON(0,true,false,false,true).toString() ;
    param=JSON.parse(param);
    param.billdate=  (''+param.billdate).substring(0,10);
    param.leader =  getUserInfoById (  param.leaderid).showname;  

    var mb= getProperty( "/凭证调阅封面", '') ;
   
    var source=  freemarker( mb, param ) ;
   

    var url= getServiceHomeURL( "fop" )+"/fo2pdf?serverIndex=1&subPath=dzpz_dy_bookface&fileName=封面.pdf";
    url= safeURL(url) ;
    var ret= httpPost( url ,{body: source} );
    println(ret.response); 
    return  ret.response; 

}


id: 61a971b1db74f189cff63e41
pid: 6181e4b9c76eefddf45ea0b9
name: 生成凭证号页面
code: createNO
namepath: /后台打包
codepath: 6181e4b9c76eefddf45ea0b9
fullname: /后台打包/生成凭证号页面
fullcode: 6181e4b9c76eefddf45ea0b9.createNO
nodetype: leaf
createdate: 2021.12.02 18:19:31.000
lastmodifieddate: 2024.09.18 14:40:51.641
value:
function main(arg)
{

    var p=JSON.parse(arg);
    var pzh= p.pzh||'test0001'; 
 
    var mb= getProperty( "/凭证调阅凭证号页", '') ;
   
    var source=  freemarker( mb, {pzh:pzh} ) ;
    
    var url= getServiceHomeURL( "fop" )+"/fo2pdf?serverIndex=1&subPath=dzpz_dy_bookface&fileName="+pzh+".pdf";
    url= safeURL(url) ;
    var ret= httpPost( url ,{body: source} );
    println(ret.response); 
    return  ret.response; 

}


id: 631994449932f19609c86899
pid: 609d3f3f5db2b0a331d6bced
name: useinparam
code: 631994449932f19609c86899
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/useinparam
nodetype: column
value: false
createdate: 2022.09.08 15:11:25.000
lastmodifieddate: 2024.09.18 14:40:52.004
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.631994449932f19609c86899


id: 631994449932f19609c8689a
pid: 609d3f3f5db2b0a331d6bced
name: useoutparam
code: 631994449932f19609c8689a
namepath: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息
codepath: 60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf
fullname: /凭证数字化/由Electron调用的接口/Electron调用本接口向自已推送消息/useoutparam
nodetype: column
value: false
createdate: 2022.09.08 15:11:25.000
lastmodifieddate: 2024.09.18 14:40:52.004
fullcode:
60b71f5a5db22398a379d9ec.609d3f3f5db2b0a331d6bce1.electronPushMessageToSelf.631994449932f19609c8689a


id: 6371e8229932b5d98a4a2e1b
pid: 6371e8229932b5d98a4a2e0f
name: 导入凭证信息与归档信息的互更
code: updateForReport
namepath: /统计准备
codepath: 6371e8229932b5d98a4a2e0f
fullname: /统计准备/导入凭证信息与归档信息的互更
fullcode: 6371e8229932b5d98a4a2e0f.updateForReport
nodetype: leaf
createdate: 2022.11.14 15:39:43.000
lastmodifieddate: 2024.09.18 14:40:52.365
value:
/**
 *   导入凭证信息需要更新它有没有被影像化
 * 
 *    影像归档需要更新有没有对应的导入信息 
 *    这里直接更新到各自的字段中，便于统计分析 
 *
 */
function main(arg) {


    runSQL("", " alter table  pzdjex add  pzsl_pic int null ",false);  // 1 表示已经影像化
    runSQL("", " alter table  pzdjex add  pic_pz int null ",false);  // 对应的凭证图片张数
    runSQL("", " alter table  pzdjex add  pic_fj int null ",false);  //对应的附件图片张数
    runSQL("", " alter table  pzdjex add  dzpz_id  varchar(40)  null ",false);  //对应的影像化记录的ID
    runSQL("", "alter table dzpz_pz  add pzdj_exist int null ",false); //  1 表示有对应的导入的凭证信息， 0 表示没有
    println("=========================");
    runSQL("", "update pzdjex  set pic_pz=0 where pic_pz is null ",true);
    runSQL("", "update pzdjex  set pic_fj=0 where pic_fj is null ",true);

    runSQL("","create index  i_pzdjex_4 on pzdjex ( y,m,corpid,pzh) ",true);
    runSQL("","create index  i_pzdjex_pzh on pzdjex (pzh) ",true);
    

    var p= JSON.parse(arg);
    var y=0;
    var m=0;
    var ym='';
    if( p.y !=undefined) 
    {
        y=p.y;
        m=p.m;
        ym= ''+    (y*100  + m) ; 
    }
    println("y,m = "+ y+","+m );

    println("ym = "+ ym );

    runSQL("", " update pzdjex  set    dzpz_id= null,   pic_pz =0  ,   pic_fj= 0 where "+ 
         (( y==0)? "" : "  pzdjex.y ="+y+"  and  pzdjex.m = "+ m+ " and "   ) + 
         " not exists ( select id from  dzpz_pz c   where  (  pzdjex.corpid = c.corpid and pzdjex.pzh = c.pzh  ) ) " ,true);
  						
	runSQL("", "update pzdjex  join pzdj on ( pzdjex.corpid is null  and "+
                (( y==0)? "" : "  pzdjex.y ="+y+"  and  pzdjex.m = "+ m+ " and "   ) + 
                "  pzdjex.gguid= pzdj.gguid)   set  pzdjex.corpid = pzdj.corpid ",true);
						 

    runSQL("",  " update pzdjex  " + 
             " inner join  dzpz_pz c   on ( "+
              (( y==0)? "" : "  pzdjex.y ="+y+"  and  pzdjex.m = "+ m+ " and "   ) + 
             " pzdjex.corpid = c.corpid and pzdjex.pzh = c.pzh  ) "+
            " set   pzdjex.dzpz_id= c.id,  pzdjex.pic_pz =1 ,  pzdjex.pic_pz = c.pz , pzdjex.pic_fj= c.fj  " 
            , true);



   
    runSQL("", " update dzpz_pz set pzdj_exist=0  where  	pzdj_exist is null  ",true);

    runSQL(""," update dzpz_pz set pzdj_exist=0 where "+
         (( y==0)? "" : "   dzpz_pz.ym = "+ ym +"   and "   ) + 
        " not exists(  select  b.id from  pzdjex b  where   dzpz_pz.corpid = b.corpid  and dzpz_pz.pzh = b.pzh  ) "
       , true);


    runSQL("",  "  update dzpz_pz set pzdj_exist=1 where "+
        (( y==0)? "" : "    dzpz_pz.ym  = "+ ym +"   and "   ) + 
        "  exists(  select   b.id  from  pzdjex b where   dzpz_pz.corpid = b.corpid  and dzpz_pz.pzh = b.pzh    )"   , true);

    

}


id: 649a906999329f5ca7253b6b
pid: 64dd8fe899328fedff349e8b
name: 课题号与凭证列表的合法性校验
code: check_vouchers
namepath: /接口
fullname: /接口/课题号与凭证列表的合法性校验
nodetype: leaf
createdate: 2023.06.27 15:36:54.000
lastmodifieddate: 2024.09.18 14:40:52.722
value:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg) {
    println(arg);
    var param = JSON.parse(arg);


    var ktbh = param.ktbh || '';
    ktbh= ktbh.split(',');
    ktbh="('" + ktbh.join("','")+"')" ;

    if (!param.pzh) return { success: false, message: '没有提供凭证号' };

    var tmpTableName = "t_" + newGUID();
    runSQL("", `drop table  ${tmpTableName}`);
    runSQL("", `create table  ${tmpTableName} ( pzh varchar(40) not null , primary key(pzh)) `);


    for (var i = 0; i < param.pzh.length; i++) {
        var pzh = param.pzh[i];
        runSQL("", `insert into  ${tmpTableName}  ( pzh)  values  ('${pzh}') `);
    }

    try {
        var ds = newDataStore("", `select pzh from ${tmpTableName} a  where not exists ( select b.pzh from pzdjex b  where b.pzh = a.pzh and b.code in  ${ktbh} ) `);
        ds.retrieve();
        if (ds.getRowCount() == 0) {
            ds = newDataStore("", `select pzh from ${tmpTableName} a  where not exists ( select b.pzh from  dzpz_pz b  where b.pzh = a.pzh  ) `);
            ds.retrieve();
            if (ds.getRowCount() == 0) {
                return { success: true, code:'0', messager: `所有凭证号合法，且已影像化` };
            } else {
                var pzhs = [];
                for (var i = 0; i < ds.getRowCount(); i++) {
                    pzhs.push(ds.getString(i, "pzh"));
                }
                runSQL("", `drop table  ${tmpTableName}`);
                return { success: false, code:'1', message: `凭证号合法，但系统中不存在如下凭证的影像资料：${pzhs.join(',')}` };

            }
        }


        var pzhs = [];
        for (var i = 0; i < ds.getRowCount(); i++) {
            pzhs.push(ds.getString(i, "pzh"));
        }
        runSQL("", `drop table  ${tmpTableName}`);
        return { success: false, code:'2'  , message: `系统中不存在课题号为 ${ktbh} 的凭证：${pzhs.join(',')}` };


    }
    catch (err) {

    } finally {
        runSQL("", `drop table  ${tmpTableName}`);
    }


}


id: 649aa52d99329f5ca7253c1c
pid: 64dd8fe899328fedff349e8b
name: 发起调阅流程
code: create_task
namepath: /接口
fullname: /接口/发起调阅流程
nodetype: leaf
createdate: 2023.06.27 17:15:39.000
lastmodifieddate: 2024.09.18 14:40:52.723
value:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg) {
    println(arg);
    var param = JSON.parse(arg);
    var gguid = newGUID();
    var moduleid = 'dy';//模块ID
    var username = getProperty( "/API创建调阅流程的起草人",  param.creator || "api");
    println( username);
    var userid = getIntFromSQL("select id from app_user where showname='"+username+"'");
    println(userid);
    var leaderid= 18; //审核人ID
    var billno = newBillNo('', 'dzpz_dy', 'billno', '{11111111}', 'billdate', newDate(), "");
    var dzpz_dy_ds = newDataStore("", "select * from  dzpz_dy");
    dzpz_dy_ds.setUpdateProperty("dzpz_dy", "id", "*", "id");
    dzpz_dy_ds.insertRow(0);
    dzpz_dy_ds.setValue(0, {
        id: gguid, gguid: gguid, userid: userid, username: username , 
        billdate: newDate(), billno: billno,
        reader: param.dyr, 
        leaderid: leaderid , 
        summary: param.dyyy, corpid: '00',
        needwatermark: 0,//不打水印 
        filetype: 'zip', // 
        email: param.email,
        moredata: JSON.stringify(param.callback_param),
        action_after_pack:'sendMail'
    });

    var dzpz_dymx_ds = newDataStore("", "select * from dzpz_dymx");
    dzpz_dymx_ds.setUpdateProperty('dzpz_dymx', 'id', '*', "id");
    var pzh = param.pzh  ;
    if( pzh==undefined) pzh =[];
    for (var i = 0; i < pzh.length; i++) {
        var row = dzpz_dymx_ds.insertRow(9999999);
       // var code= getStringFromSQL("select code from pzdjex b  where  pzh = '"+pzh[i]+"'");
        dzpz_dymx_ds.setValue(row, { id: newGUID(), gguid: gguid, inner_xh: i + 1, pzh: pzh[i]    });
    }

    var err = updateAll(dzpz_dy_ds, dzpz_dymx_ds);
    if (err != '') return { success: false, messager: err };


    var corpid = getStringFromSQL("select corpid from dzpz_dy where id='" + gguid + "'");
    
    runSQL(""," update dzpz_dymx  set   code= ( select min(b.code) as code  from pzdjex b  where  b.pzh =dzpz_dymx.pzh ) where  dzpz_dymx.gguid='" + gguid + "' ",true );
    var sqls = ["update dzpz_dymx  set bz=null,pz_id= (select max(id) from dzpz_pz where dzpz_pz.pzh= dzpz_dymx.pzh and dzpz_pz.corpid='" + corpid + "' ) where gguid='" + gguid + "' ",
                "update dzpz_dymx  set bz='凭证号不存在' where  gguid='" + gguid + "' and not exists (select dzpz_pz.id from dzpz_pz where  dzpz_pz.pzh= dzpz_dymx.pzh  and dzpz_pz.corpid='" + corpid + "')  " 
             
    ];
    runSQL("", sqls); 


    var config = {
        moduleid: moduleid,//凭证调阅模块代码或ID,
        gguid: gguid,
        flow: 'dy', //工作流的代码或ID
        userid: userid, //发起人ID
        subject: `${param.dyr || ''}因 [${param.dyyy || ''}] 调阅凭证`


    };

    var ret = newWork(config);

    if (!ret.success) return ret;

    //自动递交给初审
/*
    var t = taskInfoForWork('dy', gguid);

    //将任务递交下去，如果任务需要签收，则先签收     
    for (var i = 0; i < t.taskList.length; i++) {
        var task = t.taskList[i];

        //可以递交，那么递交下去
        if (task.canSubmit) println(submitWork(moduleid, gguid, task.taskId));
        //需要先签收 ，那么以第一个候选人签收它
        if (task.canClaim) claimWork(moduleid, gguid, task.taskId, task.candidateUserList[0].userId);

    }
*/

    ret.id = gguid;
    ret.billno= billno;
    return {success:true , id: gguid , content:{billno:billno}  };


}


id: 649bccb89932ee4d0f7f5577
pid: 6181e4b9c76eefddf45ea0b9
name: 后台打包入口
code: package
namepath: /后台打包
fullname: /后台打包/后台打包入口
nodetype: leaf
createdate: 2023.06.28 14:17:41.000
lastmodifieddate: 2024.09.18 14:40:53.076
value:
//后台打包
function main( arg) {
    var param=  JSON.parse(arg);
    var gguid= param.gguid; 
    

    var ids = [];
    //2022.08.11 优化， 有可能存在重复的，所能加上 distinct 去重
    var $dzpz_dymx_ds = newDataStore("", "select  pz_id ,pzh , max(filenameprefix) as filenameprefix from  dzpz_dymx where gguid='" + gguid + "' group by pz_id, pzh  order by pzh  ");
    $dzpz_dymx_ds.retrieve();
    println($dzpz_dymx_ds.getSelectLastRetrieved());

    for (var i = 0; i < $dzpz_dymx_ds.getRowCount(); i++) {
        var pz_id = '' + $dzpz_dymx_ds.getString(i, "pz_id");
        var filenameprefix = $dzpz_dymx_ds.getString(i, "filenameprefix");
        if (pz_id == '') continue;
        if (ids.contains(pz_id)) continue;
        ids.push({ id:pz_id , filenameprefix: filenameprefix} );
    }

    if (ids.length == 0) {
        println("没有凭证清单");
        return {success:false, message:"没有凭证清单"};
    }

    println(ids.length + "张凭证需要打包");

    var $dzpz_dy_ds = newDataStore("", "select * from  dzpz_dy where gguid='" + gguid + "'");
    $dzpz_dy_ds.setUpdateProperty("dzpz_dy", "id", "*", "id");
    $dzpz_dy_ds.retrieve();

    var fileName = $dzpz_dy_ds.getString(0, "reader") + formatDate(newDate(), "yyyy.MM.dd") + "因"+$dzpz_dy_ds.getString(0, "summary") + "调阅凭证.zip";

    var ret = runTask("后台打包", {
        gguid: gguid,
        fileName: fileName,
        ids: ids,
        watermark: $dzpz_dy_ds.getInt(0, "needwatermark") == 0 ? "" : (formatDate($dzpz_dy_ds.getValue(0, "billdate"), "yyyy.MM.dd HH:mm") + "\n" + $dzpz_dy_ds.getString(0, "watermark")+"    "),
        mergePDF: $dzpz_dy_ds.getString(0, "filetype") == 'pdf' //是否合并成一个pdf文件

    });

    println(ret);
    ret = JSON.parse(ret);

    if (ret.success) {
        $dzpz_dy_ds.setValue(0, "ziptaskid", ret.zipTaskId);
        $dzpz_dy_ds.update(true);
    }
    return ret;
}


id: 649bd0a39932ee4d0f7f55d3
pid: 649bccb89932ee4d0f7f5577
name: functionGroup
namepath: /后台打包/后台打包入口
fullname: /后台打包/后台打包入口/functionGroup
nodetype: column
createdate: 2023.06.28 14:25:21.000
lastmodifieddate: 2024.09.18 14:40:53.077
value:
{"全局函数":[{"source":"function main( arg)","comment":"","group":"","caption":"","needRightControl":"","func":"main","funcTitle":"function main","index":0}]}


id: 649bdd0c9932ee4d0f7f571f
pid: 64dd8fe899328fedff349e8b
name: 打包完成后的后续动作
code: action_after_pack
namepath: /接口
fullname: /接口/打包完成后的后续动作
nodetype: leaf
createdate: 2023.06.28 15:40:12.000
lastmodifieddate: 2024.09.18 14:40:53.077
value:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg) {
    println(arg);
    var param = JSON.parse(arg);
    var gguid = param.gguid || '963132457484690360';
    println(" gguid=" + gguid);

    var home = getServiceHomeURL('app');
    var ds = newDataStore("", "select * from dzpz_dy");
    ds.setUpdateProperty("dzpz_dy", "id", "*", "id");
    ds.retrieve(" id='" + gguid + "'");


    var zipResult = ds.getString(0, "zipresult");

    zipResult = zipResult.replace(/&action=view/g, '&action=download');
    zipResult = JSON.parse(zipResult);
    var share = [];
    for (var i = 0; i < zipResult.length; i++) {
        var one = zipResult[i];
        var url = one.url;
        url = home + url;
        var d = 7;  // 7天有效
        var t = 3;  // 3 次下载 
        var shareRet = urlShare(url, d, 'day', t);
        if (!shareRet.success) {
            println(shareRet.message);
        } else {
            share.push('<li>' + shareRet.url + "  " + one.filename + "</li>");
        }

    }

    var action = ds.getString(0, "action_after_pack");
    println(action);

    if (action == 'sendMail') {

        var config = {
            from: { userid: 1 },
            to: { mailAccount: ds.getString(0, "email") },
            mail: {
                subject: ds.getString(0, "flow_instance_subject"),
                body: share.join("<br>")

            }
        };

        var ret = sendMail(config);

        var userid = ds.getInt(0, "userid");

        chatWith(userid, ds.getString(0, "flow_instance_subject") + " 邮件发送结果：" + JSON.stringify(ret));


        return ret;


    }

}


id: 64a53ef18b10ede23ae607f1
pid: 64dd8fe899328fedff349e8b
name: 回调OA
code: oa_callback
namepath: /接口
fullname: /接口/回调OA
nodetype: leaf
createdate: 2023.07.07 10:21:57.000
lastmodifieddate: 2024.09.18 14:40:53.078
value:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg) {
    println(arg);
    var param = JSON.parse(arg);
    var requestid= param.requestid ;
    var pass= param.pass==1?"true":"false";
    var reason = param.reason; 
    
    var url = "https://oa.cemps.ac.cn/services/FzzwsOAHdService?wsdl";
    reason= reason.replace(/[<>]/g ,'');


    var content = `
    <?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"  
    xmlns:web="webservices.fzzwsoahd.weaver.com.cn">
   <soapenv:Header/>
   <soapenv:Body>
      <web:ObtainOAinformation>
         <web:in0>${requestid}</web:in0>
         <web:in1>${pass}</web:in1>
         <web:in2>${reason}</web:in2>         
      </web:ObtainOAinformation>
   </soapenv:Body>
</soapenv:Envelope>
`


    var ret = httpPost(url, {
        header: { 'Content-Type': 'application/soap+xml;charset=utf-8' },
        body: content
    });

    return ret.response;

}


id: 64ddc98299328fedff349ed9
pid: 64dd8fe899328fedff349e8b
name: 审批通过并打包且把地址分享
code: execute_task
namepath: /接口
fullname: /接口/审批通过并打包且把地址分享
nodetype: leaf
createdate: 2023.08.17 15:19:07.000
lastmodifieddate: 2024.09.18 14:40:53.425
value:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg) {
    println(arg);
    var param = JSON.parse(arg);
    var gguid = param.id;
    var action = param.action;

    if (gguid == '') return { success: false, message: 'id不能为空' };

    //自动递交给调阅步骤
    var moduleid = 'dy';//模块ID
    var t = taskInfoForWork('dy', gguid);

    if (t.taskList == null) return { success: false, message: 'id 对应的调阅申请不存在' };

    //递交结束
    while (true) {
        if (t.taskList.length == 0) break;
        //将任务递交下去，如果任务需要签收，则先签收     
        for (var i = 0; i < t.taskList.length; i++) {
            var task = t.taskList[i];

            //可以递交，那么递交下去
            if (task.canSubmit) println(submitWork(moduleid, gguid, task.taskId));
            //需要先签收 ，那么以第一个候选人签收它
            if (task.canClaim) claimWork(moduleid, gguid, task.taskId, task.candidateUserList[0].userId);

        }
        t = taskInfoForWork('dy', gguid);

    }


    //打包分享

    var $dzpz_dy_ds = newDataStore("", "select * from dzpz_dy");
    $dzpz_dy_ds.setUpdateProperty("dzpz_dy", "id", "*", "id");

    $dzpz_dy_ds.retrieve(" id='" + gguid + "'");

    $dzpz_dy_ds.setValue(0, "action_after_pack", action);
    $dzpz_dy_ds.update(true);

    var ziptaskid = $dzpz_dy_ds.getString(0, "ziptaskid");
    if (ziptaskid != '') {
        return { success: true, message: "正在打包压缩中...，请稍候" };
    }

    var zipResult = $dzpz_dy_ds.getString(0, "zipresult");
    if (zipResult == '') {

        println("开始打包");

        var ret = JSON.parse(runTask("package", { gguid: gguid, action: action }));
        if (!ret.success) {
            println("打包异常：" + ret.message);
            return ret;
        }
        return ret;

    }

    println('发送邮件');
    runTask("action_after_pack", { gguid: gguid });

    return { success: true, message: '打包完成' };




}


id: 64e313d199328fedff349fe4
pid: 64e313d199328fedff349f95
name: finalscript
nodetype: column
createdate: 2023.08.21 15:37:12.000
lastmodifieddate: 2024.09.18 14:40:53.574
value:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg) {
    println(arg);
    var param = JSON.parse(arg);
    var gguid = param.gguid;

    var ds = newDataStore("", "select * from dzpz_dy where id='" + gguid + "'");
    ds.retrieve();

    if (ds.getInt(0, 'pass') == 0) {
        println("拒绝调阅，强制结束");

        //递交结束
        var loopCount = 0;
        while (loopCount < 10) {
            loopCount++;
            println(gguid);
            var t = taskInfoForWork('dy', gguid);
            println(JSON.stringify(t));
            if (t.taskList.length == 0) break;
            //将任务递交下去，如果任务需要签收，则先签收     
            for (var i = 0; i < t.taskList.length; i++) {
                var task = t.taskList[i];

                //可以递交，那么递交下去
                if (task.canSubmit) println(submitWork('dy', gguid, task.taskId));
                //需要先签收 ，那么以第一个候选人签收它
                if (task.canClaim) claimWork('dy', gguid, task.taskId, task.candidateUserList[0].userId);

            }


        }

    }

    return 'over';


}


id: 6503be1e99328fedff34a22e
pid: 60fa608c9932563b7c99bba5
name: functionGroup
nodetype: column
createdate: 2023.09.15 10:28:21.000
lastmodifieddate: 2024.09.18 14:40:53.574
value:
{"全局函数":[{"source":"function back_flow_over(gguid)","comment":"","group":"","caption":"","needRightControl":"","func":"back_flow_over","funcTitle":"function back_flow_over","index":0}]}


id: 650666139932de686bb62112
pid: 650666139932de686bb62106
name: 未命名4739
code: test1
namepath: /temp
fullname: /temp/未命名4739
nodetype: leaf
createdate: 2023.09.17 10:47:39.000
lastmodifieddate: 2024.09.18 14:40:53.574
value:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg)
{

// runSQL('', `alter table pz_yjd_pzh alter column lastmodifieddate set default =DATE_FORMAT(NOW(), '%Y-%m-%d %H:%i:%s')`  ) 
    // return getListFromSQL2( '',  ` SELECT 
    // max(b.corpid) as corpid,  max(a.ny) as ny, max(a.pzh) as pzh,   CONCAT(a.ny, a.pzh) AS ny_pzh,
    // case 
    //     when a.billtype ='交办' and b.flow_instance_state='0' then '交办中'
    //     when a.billtype ='交办' and b.flow_instance_state='1' and a.billtype ='交回' and b.flow_instance_state='0' then '交办没有交回' 
    // else end as jbzt
    // from pz_yjd_pzh a left join pz_yjd b on a.gguid=b.gguid  where a.billtype='交办'
    // group by ny_pzh` ) 
    
    // return getListFromSQL2( '',  `  select  a.lastmodifieddate, a.corpid_ny_pzh, a.ny,  a.pzh, a.corpid, a.flow_instance_state,a.flow_instance_status
    // from (
    //     select a1.pzh, a1.ny, b1.lastmodifieddate, b1.corpid, b1.flow_instance_state,b1.flow_instance_status,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
    //     from ( select * from pz_yjd_pzh where billtype='交办'  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  
    //     ) a 
    //     inner  join  (
    //         select max(lastmodifieddate) as lastmodifieddate, corpid_ny_pzh from (select b1.lastmodifieddate, b1.corpid,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
    //     from ( select * from pz_yjd_pzh where billtype='交办'  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  ) aa group by corpid_ny_pzh  
    //     ) b on a.corpid_ny_pzh=b.corpid_ny_pzh and a.lastmodifieddate=b.lastmodifieddate      ` ) 


return getListFromSQL(`select jb.* , jh.state ,jy.state,gh.state
    , case when jb.state='0' then '交办申请中' 
      when jb.state='-1' then '交办退回' 
      when jb.state='1' and jh.state='0' then '交回申请中' 
      when jb.state='1' and jh.state='-1' then '交回退回' 
      when jb.state='1' and jh.state='1' then '交办且已交回' 
      when jb.state='1'  then '交办没有交回' 
     else '' end as jb_state

    , case when jy.state='0'  then '借阅申请中' 
      when jy.state='-1' then '借阅退回' 
      when jy.state='1' and gh.state='0'  then '归还申请中' 
      when jy.state='1' and gh.state=-1 then '归还退回' 
      when jy.state='1' and gh.state='1' then '借阅且已归还' 
      when jy.state='1' then '借阅没有归还' 
     else '' end as jy_state
    
     from (
        select  a.lastmodifieddate, a.corpid_ny_pzh, a.ny, a.state, a.pzh, a.corpid, a.flow_instance_state,a.flow_instance_status
    from (
        select a1.pzh, a1.ny, a1.state, b1.lastmodifieddate, b1.corpid, b1.flow_instance_state,b1.flow_instance_status,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='交办' and state not in (-99) )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  
        ) a 
        inner  join  (
            select max(lastmodifieddate) as lastmodifieddate, corpid_ny_pzh from (select b1.lastmodifieddate, b1.corpid,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='交办' and state not in (-99)  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  ) aa group by corpid_ny_pzh  
        ) b on a.corpid_ny_pzh=b.corpid_ny_pzh and a.lastmodifieddate=b.lastmodifieddate 
    ) jb 
    left join (
        select  a.lastmodifieddate, a.corpid_ny_pzh, a.ny,  a.state, a.pzh, a.corpid, a.flow_instance_state,a.flow_instance_status
    from (
        select a1.pzh, a1.ny, a1.state, b1.lastmodifieddate, b1.corpid, b1.flow_instance_state, b1.flow_instance_status, CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='交回' and state not in (-99)  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  
        ) a 
        inner  join  (
            select max(lastmodifieddate) as lastmodifieddate, corpid_ny_pzh from (select b1.lastmodifieddate, b1.corpid,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='交回' and state not in (-99)  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  ) aa group by corpid_ny_pzh  
        ) b on a.corpid_ny_pzh=b.corpid_ny_pzh and a.lastmodifieddate=b.lastmodifieddate 
    ) jh on jb.corpid_ny_pzh=jh.corpid_ny_pzh
    left join (
        select  a.lastmodifieddate, a.corpid_ny_pzh, a.ny, a.state,  a.pzh, a.corpid, a.flow_instance_state,a.flow_instance_status
    from (
        select a1.pzh, a1.ny, a1.state, b1.lastmodifieddate, b1.corpid, b1.flow_instance_state, b1.flow_instance_status, CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='借阅' and state not in (-99)  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  
        ) a 
        inner  join  (
            select max(lastmodifieddate) as lastmodifieddate, corpid_ny_pzh from (select b1.lastmodifieddate, b1.corpid,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='借阅' and state not in (-99)  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  ) aa group by corpid_ny_pzh  
        ) b on a.corpid_ny_pzh=b.corpid_ny_pzh and a.lastmodifieddate=b.lastmodifieddate 
    ) jy on jb.corpid_ny_pzh=jy.corpid_ny_pzh
    left join (
        select  a.lastmodifieddate, a.corpid_ny_pzh, a.ny, a.state,  a.pzh, a.corpid, a.flow_instance_state,a.flow_instance_status
    from (
        select a1.pzh, a1.ny, a1.state, b1.lastmodifieddate, b1.corpid, b1.flow_instance_state, b1.flow_instance_status, CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='归还' and state not in (-99)  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  
        ) a 
        inner  join  (
            select max(lastmodifieddate) as lastmodifieddate, corpid_ny_pzh from (select b1.lastmodifieddate, b1.corpid,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='归还' and state not in (-99)  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  ) aa group by corpid_ny_pzh  
        ) b on a.corpid_ny_pzh=b.corpid_ny_pzh and a.lastmodifieddate=b.lastmodifieddate 
    ) gh  on jb.corpid_ny_pzh=gh.corpid_ny_pzh
    
    order by jb.lastmodifieddate desc`) 

// runSQL('', `delete from pz_yjd`  ) 
// runSQL('', `delete from pz_yjd_pzh`  ) 
// runSQL('', `delete from pz_yjdex`  ) 


    
    return getListFromSQL2( '',  ` select jb.* 
    , case when jb.flow_instance_state='0' and jb.flow_instance_status is not null then '交办申请中' 
      when jb.flow_instance_state='1' and jh.flow_instance_state is null then '交办没有交回' 
      when jb.flow_instance_state='1' and jh.flow_instance_state='0' and jh.flow_instance_status is not null then '交回申请中' 
      when jb.flow_instance_state='1' and jh.flow_instance_state='1' then '交办且已交回' 
     else '' end as jb_state

    , case when jy.flow_instance_state='0' and jy.flow_instance_status is not null then '借阅申请中' 
      when jy.flow_instance_state='1' and gh.flow_instance_state is null then '借阅没有归还' 
      when jy.flow_instance_state='1' and gh.flow_instance_state='0' and gh.flow_instance_status is not null then '归还申请中' 
      when jy.flow_instance_state='1' and gh.flow_instance_state='1' then '借阅且已归还' 
     else '' end as jy_state
    
     from (
        select  a.lastmodifieddate, a.corpid_ny_pzh, a.ny,  a.pzh, a.corpid, a.flow_instance_state,a.flow_instance_status
    from (
        select a1.pzh, a1.ny, b1.lastmodifieddate, b1.corpid, b1.flow_instance_state,b1.flow_instance_status,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='交办'  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  
        ) a 
        inner  join  (
            select max(lastmodifieddate) as lastmodifieddate, corpid_ny_pzh from (select b1.lastmodifieddate, b1.corpid,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='交办'  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  ) aa group by corpid_ny_pzh  
        ) b on a.corpid_ny_pzh=b.corpid_ny_pzh and a.lastmodifieddate=b.lastmodifieddate 
    ) jb 
    left join (
        select  a.lastmodifieddate, a.corpid_ny_pzh, a.ny,  a.pzh, a.corpid, a.flow_instance_state,a.flow_instance_status
    from (
        select a1.pzh, a1.ny, b1.lastmodifieddate, b1.corpid, b1.flow_instance_state, b1.flow_instance_status, CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='交回'  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  
        ) a 
        inner  join  (
            select max(lastmodifieddate) as lastmodifieddate, corpid_ny_pzh from (select b1.lastmodifieddate, b1.corpid,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='交回'  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  ) aa group by corpid_ny_pzh  
        ) b on a.corpid_ny_pzh=b.corpid_ny_pzh and a.lastmodifieddate=b.lastmodifieddate 
    ) jh on jb.corpid_ny_pzh=jh.corpid_ny_pzh
    left join (
        select  a.lastmodifieddate, a.corpid_ny_pzh, a.ny,  a.pzh, a.corpid, a.flow_instance_state,a.flow_instance_status
    from (
        select a1.pzh, a1.ny, b1.lastmodifieddate, b1.corpid, b1.flow_instance_state, b1.flow_instance_status, CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='借阅'  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  
        ) a 
        inner  join  (
            select max(lastmodifieddate) as lastmodifieddate, corpid_ny_pzh from (select b1.lastmodifieddate, b1.corpid,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='借阅'  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  ) aa group by corpid_ny_pzh  
        ) b on a.corpid_ny_pzh=b.corpid_ny_pzh and a.lastmodifieddate=b.lastmodifieddate 
    ) jy on jb.corpid_ny_pzh=jy.corpid_ny_pzh
    left join (
        select  a.lastmodifieddate, a.corpid_ny_pzh, a.ny,  a.pzh, a.corpid, a.flow_instance_state,a.flow_instance_status
    from (
        select a1.pzh, a1.ny, b1.lastmodifieddate, b1.corpid, b1.flow_instance_state, b1.flow_instance_status, CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='归还'  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  
        ) a 
        inner  join  (
            select max(lastmodifieddate) as lastmodifieddate, corpid_ny_pzh from (select b1.lastmodifieddate, b1.corpid,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='归还'  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  ) aa group by corpid_ny_pzh  
        ) b on a.corpid_ny_pzh=b.corpid_ny_pzh and a.lastmodifieddate=b.lastmodifieddate 
    ) gh  on jb.corpid_ny_pzh=gh.corpid_ny_pzh
    
    order by jb.lastmodifieddate desc` ) 
    
    // return getListFromSQL2( '',  ` select  max(a.lastmodifieddate) as lastmodifieddate, a.corpid_ny_pzh, max(a.ny) as ny,  max(a.pzh) as pzh, max(a.corpid) as corpid
    // from (select a1.pzh, a1.ny, b1.lastmodifieddate, b1.corpid,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
    //     from ( select * from pz_yjd_pzh where billtype='交办'  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  ) a 
    //     left join  (
    //         select max(lastmodifieddate) as lastmodifieddate, corpid_ny_pzh from (select b1.lastmodifieddate, b1.corpid,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
    //     from ( select * from pz_yjd_pzh where billtype='交办'  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  ) aa group by corpid_ny_pzh  
    //     ) b on a.corpid_ny_pzh=b.corpid_ny_pzh and a.lastmodifieddate=b.lastmodifieddate ` ) 
    
    
    // return getListFromSQL2( '',  ` select a1.pzh, a1.ny, b1.lastmodifieddate, b1.corpid,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
    //     from ( select * from pz_yjd_pzh where billtype='交办'  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  ` ) 
    
    return getListFromSQL2( '',  ` select max(lastmodifieddate) as lastmodifieddate, corpid_ny_pzh from (select b1.lastmodifieddate, b1.corpid,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
        from ( select * from pz_yjd_pzh where billtype='交办'  )  a1 left join pz_yjd b1 on a1.gguid=b1.gguid where  b1.corpid is not null  ) a group by corpid_ny_pzh   ` ) 


    
    // return getListFromSQL2( '',  ` SELECT 
    // max(b.corpid) as corpid,  max(a.ny) as ny, max(a.pzh) as pzh,   CONCAT( CONCAT(b.corpid, a.ny), a.pzh) AS corpid_ny_pzh, max(b.flow_instance_state) as flow_instance_state
    // from (select * from pz_yjd_pzh where billtype='交办') a 
    // left join (
    //     select a.* from pz_yjd a 
    //     left join ( select max(b1.lastmodifieddate) as lastmodifieddate, b1.corpid,  CONCAT( CONCAT(b1.corpid, a1.ny), a1.pzh) AS corpid_ny_pzh 
    //     from (select * from pz_yjd_pzh where billtype='交办')  a1 left join pz_yjd b1 on a1.gguid=b1.gguid   group by corpid_ny_pzh ) b 
    //     on b.lastmodifieddate=a.lastmodifieddate and a.corpid =b.corpid
    // ) b on a.gguid=b.gguid   
    // group by corpid_ny_pzh` ) 
    
    

    return false
    
   var t='2023-02-23 ';
var s= t.match(  /20[0-9]{2}-[0-9]{2}-[0-9]{2}/g);
return s;   
    
    return OCR ( { src:'fileServer?bucketName=电子凭证&objectName=dzpz_imgpool/2023/09/17/650665939932db10f02cebaf.jpg&fileName=p4.jpg&serverIndex=2&action=view' ,
             left:'50%' , top:'20%' ,height:'20%' ,width:'50%'} );


}


id: 6536a306993258e5b4747512
pid: 6536a306993258e5b4747506
name: 凭证号识别
code: pzh-ocr
namepath: /凭证数字化/OCR
fullname: /凭证数字化/OCR/凭证号识别
nodetype: leaf
createdate: 2023.10.24 10:45:23.000
lastmodifieddate: 2024.09.18 14:40:53.577
value:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg)
{
    
    var config= JSON.parse(arg);

 
    config.src = config.src.replace(/电子凭证/g, ''); //把其中的汉字去掉，这个引发一个异常
    pushMessage('pz_ocr', { action: 'info', message: config.src }, currentUserId());
    var ret = OCR(config);
    println(ret);
    var t = ret.text || '';
    if (t == '') return '';

    //下面的算法， 根据每家凭证号的特点需要定制
    t = t.replace(/\s/g, '');
    var n =  t.match(/[123][0-9]{8}/g);
    println(n);
    if( n && n.length>0)  return n[0]; 
    return '';  


}


id: 655a1eb99932174d03378091
pid: templateScriptOnServer
name: templateScriptOnServer-655a1eb99932174d03378091
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:53.932
value:
function create_pz(corpid, ym, pzh, archive_id) {
    var ds = newDataStore("", "select  * from  dzpz_pz");
    ds.setUpdateProperty("dzpz_pz", "id", "*", "id");
    ds.insertRow(0);
    var newid = newGuid();
    ds.setValue(0, {
        id: newid,
        gguid: newid,
        billno: newid,
        billdate: newDate(),
        userid: currentUserId(),
        username: currentUserShowName(),
        corpid: corpid,
        ym: ym,
        pzh: pzh
    }
    );

    ds.executeAfterUpdate(` update  app_archive set gguid='${newid}'  where id='${archive_id}' `);
    if(  ds.update(true)) return '';
    return ds.getErrorMessage();

} 


function pzh_exists(corpid, ym, pzh)
{
     return getStringFromSQL(`select id from  dzpz_pz where corpid='${corpid}'  and ym= ${ym} and pzh='${pzh}' `) != '';
}


id: 655b0a759932b95f42145ecd
pid: 650666139932de686bb62106
name: 日志测试
code: logTest
namepath: /temp
fullname: /temp/日志测试
nodetype: leaf
createdate: 2023.11.20 15:33:17.000
lastmodifieddate: 2024.09.18 14:40:53.932
value:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg)
{
    println( arg);
    var param= JSON.parse(arg);

for( var i=0;i<1000;i++)
{
    println(`1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890
1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890`);
}

return 'ok' ; 


}


id: 6566e3fe9932bfa1d16e4202
pid: 655a1eb99932174d03378091
name: functionGroup
nodetype: column
createdate: 2023.11.29 15:17:50.000
lastmodifieddate: 2024.09.18 14:40:53.934
value:
{"全局函数":[{"source":"function create_pz(corpid, ym, pzh, archive_id)","comment":"","group":"","caption":"","needRightControl":"","func":"create_pz","funcTitle":"function create_pz","index":0},{"source":"function pzh_exists(corpid, ym, pzh)","comment":"","group":"","caption":"","needRightControl":"","func":"pzh_exists","funcTitle":"function pzh_exists","index":1}]}


id: 662a47879932b5035f32efab
pid: templateScriptOnServer
name: templateScriptOnServer-662a47879932b5035f32efab
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:54.283
value:
//@comment (group=工作流事件,caption=提交时判断)
function sponsorGZL(gguid){

    var list = getListFromSQL2( "", `select * from pz_yjd_pzh where gguid='${gguid}' and state='-99' ` );
    var pzh_list = [];
    println( 'list  ' + JSON.stringify(list) ) 
    list.forEach(item=>{
        var pzh_if = back_pzh_if(item.ny, item.pzh);
        if(pzh_if) pzh_list.push(pzh_if);
    })

    if(pzh_list.length){
        return '以下凭证号不满足条件:<br/>'+pzh_list.join('<br/>') + '<br/>不能提交结束工作流！';
    }

    return '';
}



//@comment (group=工作流事件,caption=审核时判断)
function verifyGZL(gguid) {
    

    var count = getValueFromSQL2("", `select count(0) from pz_yjd_pzh where gguid='${gguid}' and state<>'1' and qsqx is not null and qsqx>0`);
    println('verifyGZL count  ' + count)


    return count > 0 ? '有凭证式延迟确认，不能提交结束工作流！' : ''
}



/**
 * 用户任务提交后
 * @param flow 流程定义
 * @param node 开始节点
 * @param gguid 单据的gguid

 */
//@comment (group=工作流事件,caption=用户任务提交后)
function onUserTaskSubmitted ( flow , userTask , gguid  ) {
    // println( flow.id) ; //流程定义的ID
    // println( userTask.name);
    runSQL("", ` update pz_yjd_pzh set state=0 where gguid='${gguid}' and  state=-99`);

}


/**
 * 在流程驳回后，触发本事件
 * 无需返回值
 * @param gguid 单据的gguid
 * @param rollbackToNodeId 被驳回到哪个节点的id
 * @param assignee 受理人
 * @param isRecover true 表示是主动撤回 ， false表示是被驳回
 *
 */
//@comment (group=工作流事件,caption=流程驳回后)
function afterWorkRollbacked ( gguid ,   rollbackToNodeId, assignee ,isRecover ) {

    runSQL("", ` update pz_yjd_pzh set state=-99 where gguid='${gguid}' `);

}




/**
 * 工作结束
 * @param flow 流程定义
 * @param node 开始节点
 * @param gguid 单据的gguid

 */
//@comment (group=工作流事件,caption=工作结束)
function onWorkFlowEnd(flow, node, gguid) {
    // println( flow.id) ; //流程定义的ID
    println(gguid + "工作结束了");

    runSQL("", ` update pz_yjd_pzh set state=1 where gguid='${gguid}' and  ifnull(state, 0)=0`);

    runSQL("", `UPDATE pzbmx a
            INNER JOIN  pz_yjdex b  inner join pz_yjd c on (b.gguid=c.gguid) 
             ON a.pzh  >= b.pzh1 and a.pzh<= b.pzh2 and b.gguid=${gguid}
            SET a.pos  = c.towhere , a.memo = c.summary , a.state_jb=0, a.state_jy=0   ` , true);
}


//@comment (group=判断凭证号是否能导入,caption=false)
function back_pzh_if(ny, pzh) {
    var newItem = getOneRowFromSQL2("", `select * from pz_yjd_pzh where ny='${ny}' and pzh='${pzh}' and state not in (-99,-1) order by lastmodifieddate desc`);
    var str = '';
    println( `newItem ===  ${JSON.stringify(newItem)}` ) 
    if (newItem.pzh / 1 && (newItem.state != '1' || (newItem.billtype != '交回' && newItem.state == '1'))) {
        str = `${pzh} ${newItem.billtype}${newItem.state == '1' ? `没有${newItem.billtype != '借阅' ? '交回' : '归还'}` : '申请中'}`;
    }

    return str;
}

//@comment (group=导入凭证号,caption=连续号导入)
function back_add_pzh(data) {
    var count = (data.pzh2 / 1) - (data.pzh1 / 1);

    var pzh_list = [];
    var gguid = currentGUID();
    for (var i = 0; i <= count; i++) {
        var newid = newGuid();
        var pzh = (data.pzh1 / 1) + i;
        
        var pzh_if = back_pzh_if(data.ny, pzh);
        if (pzh_if) {
            pzh_list.push(pzh_if);
        } else if (pzh_list.length) {

        } else {
            runSQL("", `insert into  pz_yjd_pzh (id, gguid, ny, pzh,state, billtype, lastmodifieddate) values ( ${newid} , ${gguid} , '${data.ny}', '${pzh}', -99, '交办', '${formatDate(currentDate(), "yyyy.MM.dd HH:mm:ss")}') `, true);
        }

    }

    back_build_sum();
    return { success: true, pzh_list: pzh_list };

}

//@comment (group=导入凭证号,caption=单号导入)
function back_import_pzh_data(data) {

    var t = data.pzh.split(/[\s]/);
    var pzh_list = [];
    for (var i = 0; i < t.length; i++) {
        var pzh = t[i].trim();
        if (pzh == '') continue;
        var newid = newGuid();
        var gguid = currentGUID();

        var pzh_if = back_pzh_if(data.ny, pzh);
        if (pzh_if) {
            pzh_list.push(pzh_if);
        } else if (pzh_list.length) {

        } else {
            runSQL("", `insert into  pz_yjd_pzh (id, gguid, ny, pzh,state, billtype, lastmodifieddate ) values ( ${newid} , ${gguid} , '${data.ny}' , '${pzh}', -99, '交办', '${formatDate(currentDate(), "yyyy.MM.dd HH:mm:ss")}') `, true);
        }
    }
    back_build_sum();
    return { success: true, pzh_list: pzh_list };
}


//@comment (group=根据凭证号清单生成凭证号汇总信息,caption=1)
function back_build_sum() {
    var gguid = currentGUID();
    $back_build_sum(gguid);
}


//@comment (group=根据凭证号清单生成凭证号汇总信息,caption=2)
function $back_build_sum(gguid) {


    var sql = `
            
        SELECT
            MAX( ny ) as ny , MIN( pzh ) as pzh1 ,   MAX( pzh )  AS  pzh2,
        COUNT(*) AS c 
        FROM
        (
            SELECT
            ny,
            pzh,
            CONCAT(ny, pzh) as ny_pzh,
            @group_id := IF( pzh  = @prev_number + 1, @group_id, @group_id + 1) AS group_id,
            @prev_number := pzh 
            FROM
            pz_yjd_pzh,
            (SELECT @group_id := 0, @prev_number := NULL) AS vars 
                    where  gguid= ${gguid}
            ORDER BY
            ny_pzh 
        ) AS subquery
        GROUP BY
        group_id;
            
    ` ;

    println(sql);
    var tds = newDataStore("", sql);
    var n = tds.retrieve();

    runSQL("", `delete from  pz_yjdex where gguid= ${gguid} `, true);

    var pz_yjdex_ds = newDataStore("", "select * from pz_yjdex");
    pz_yjdex_ds.setUpdateProperty('pz_yjdex', 'id', '*', 'id');
    for (var i = 0; i < n; i++) {
        var row = pz_yjdex_ds.insertRow(9999);
        pz_yjdex_ds.setValue(row, {
            id: newGuid(), gguid: gguid, inner_xh: row + 1,
            billtype: '交办',
            ny: tds.getString(i, 'ny'),
            pzh1: tds.getString(i, "pzh1"),
            pzh2: tds.getString(i, "pzh2"),
            pzs: tds.getInt(i, "c")


        });
    }

    //
    pz_yjdex_ds.executeAfterUpdate(`update  pz_yjd  set pzs= (select count(*) from  pz_yjd_pzh where gguid= ${gguid} ) where   id= ${gguid}  `);
    pz_yjdex_ds.update(true);


}


/**
 * 单据点击保存，前端所有的操作被转译成3种操作:insert , delete , update ,
 *  并且可以在  beforeBillSaveOnServer 中返回一些SQL语句，可以在afterBillSaveOnServer中返回一些SQL语句
 *
 * 系统分别在需要的数据库连接中执行这些语句 ， 当所有语句执行成功后，事件被提交。一些细节如下 ：
 *
 * 1 如果单据中的表，属于不同的数据库连接，那么所有的SQL语句会以连接为单位，对语句进行批量执行
 * 2 这些语句的执行顺序是：对同一个数据库连接中的语句， 先执行 beforeBillSaveOnServer 中返回的SQL语句，再执行单据操作转译得到的SQL语句，
 *   再执行 afterBillSaveOnServer 中返回的SQL语句， 当多个（或一个）数据库连接执行完这些语句，且没有错误时，所有的数据库连接做提交，否则全部回滚
 * 3 不要在 beforeBillSaveOnServer 或 afterBillSaveOnServer 中直接执行数据库操作，而是返回SQL语句，让系统批量执行它们，并控制好事务
 * 4 当执行成功后，系统再执行事件函数  afterBillSaveSuccessfulOnServer 。 此事件中可以执行任意操作，它与单据保存事件结束后才被触发执行，
 *   与单据保存并不在一个事务中。
 *
 *
 * @param gguid  要删除记录的gguid ，等同于主表的id
 * @param session  一个JSON对象，用于在整个单据保存过程中的各个事件之间传递数据。本事件做为单据保存的最后一个事件，session对象在使用后将被丢弃
 *
 *
 * @return 本函数不需要返回值
 *
 */
//@comment (group=单据保存,caption=单据保存成功后)
function afterBillSaveSuccessfulOnServer(gguid, session) {

    $back_build_sum(gguid);
}


id: 66382c259932a08a57e3e707
pid: templateScriptOnServer
name: templateScriptOnServer-66382c259932a08a57e3e707
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:54.283
value:
/**
 * 单据点击保存，前端所有的操作被转译成3种操作:insert , delete , update ,
 *  并且可以在  beforeBillSaveOnServer 中返回一些SQL语句，可以在afterBillSaveOnServer中返回一些SQL语句
 *
 * 系统分别在需要的数据库连接中执行这些语句 ， 当所有语句执行成功后，事件被提交。一些细节如下 ：
 *
 * 1 如果单据中的表，属于不同的数据库连接，那么所有的SQL语句会以连接为单位，对语句进行批量执行
 * 2 这些语句的执行顺序是：对同一个数据库连接中的语句， 先执行 beforeBillSaveOnServer 中返回的SQL语句，再执行单据操作转译得到的SQL语句，
 *   再执行 afterBillSaveOnServer 中返回的SQL语句， 当多个（或一个）数据库连接执行完这些语句，且没有错误时，所有的数据库连接做提交，否则全部回滚
 * 3 不要在 beforeBillSaveOnServer 或 afterBillSaveOnServer 中直接执行数据库操作，而是返回SQL语句，让系统批量执行它们，并控制好事务
 * 4 当执行成功后，系统再执行事件函数  afterBillSaveSuccessfulOnServer 。 此事件中可以执行任意操作，它与单据保存事件结束后才被触发执行，
 *   与单据保存并不在一个事务中。
 *
 *
 * @param gguid  要删除记录的gguid ，等同于主表的id
 * @param session  一个JSON对象，用于在整个单据保存过程中的各个事件之间传递数据。本事件做为单据保存的最后一个事件，session对象在使用后将被丢弃
 *
 *
 * @return 本函数不需要返回值
 *
 */
//@comment (group=单据保存,caption=单据保存成功后)
function afterBillSaveSuccessfulOnServer(gguid, session) {
    update_pzs(gguid);

}

function update_pzs(gguid) {
    runSQL("", ` update pzb set pzs= (select count(*) from pzbmx where pzbmx.gguid='${gguid}' ) where  gguid= '${gguid}' `, true);
}

function back_buildRange(pzh1, pzh2) {

    var pzh = [];
    var c = 0;

    var t = pzh1;
    while (t <= pzh2) {
        pzh.push(t);
        c++;
        if (c > 3000) return { success: false, message: '一次添加凭证号不能大于3000笔' }
        t = stringInc(t);

    }
    return { success: true, pzh: pzh };
}


function back_add_pzh(gguid, corpid, ym, pzhs) {
    var ds = newDataStore('', 'select * from pzbmx');
    ds.setUpdateProperty('pzbmx', 'id', '*', 'id');
    // create unique index  ui_pzbmx_pzh on  pzbmx ( corpid, ym ,pzh)
    var c = 0;
    for (var i = 0; i < pzhs.length; i++) {
        ds.reset();
        var row = ds.insertRow(0);
        var pzh = pzhs[i];
        ds.setValue(row, "id", corpid + '-' + ym + '-' + pzh);
        ds.setValue(row, "gguid", gguid);
        ds.setValue(row, "corpid", corpid);
        ds.setValue(row, "ym", ym);
        ds.setValue(row, "pzh", pzh);
        ds.setValue(row, "createdate", newDate());

        if (ds.update(true)) {
            c++; //如果存在，更新会失败，也没关系
        } else {
            println(ds.getErrorMessage());
        }

    }

    update_pzs(gguid);

    return { message: '本次成功添加 ' + c + ' 个凭证号' };

}




function back_delete_pzh(gguid, pzh1, pzh2) {
    println("===========");
    var c = getIntFromSQL(`select count(*) as c  from pzbmx where gguid='${gguid}'   and pzh>='${pzh1}' and pzh<='${pzh2}'  `);
    runSQL('', `delete from pzbmx where gguid='${gguid}'   and pzh>='${pzh1}' and pzh<='${pzh2}'  ` ,true)
    update_pzs(gguid);
    return { message: '本次成功删除 ' + c + ' 个凭证号' };

}


id: 663879c89932a08a57e3eacd
pid: 66382c259932a08a57e3e707
name: functionGroup
nodetype: column
createdate: 2024.05.07 22:20:37.000
lastmodifieddate: 2024.09.18 14:40:54.283
value:
{"单据保存":[{"source":"//@comment (group=单据保存,caption=单据保存成功后)\nfunction afterBillSaveSuccessfulOnServer(gguid, session)","comment":"//@comment (group=单据保存,caption=单据保存成功后)","group":"单据保存","caption":"单据保存成功后","needRightControl":"","func":"afterBillSaveSuccessfulOnServer","funcTitle":"function afterBillSaveSuccessfulOnServer","index":0}],"全局函数":[{"source":"function update_pzs(gguid)","comment":"","group":"","caption":"","needRightControl":"","func":"update_pzs","funcTitle":"function update_pzs","index":1},{"source":"function back_buildRange(pzh1, pzh2)","comment":"","group":"","caption":"","needRightControl":"","func":"back_buildRange","funcTitle":"function back_buildRange","index":2},{"source":"function back_add_pzh(gguid, corpid, ym, pzhs)","comment":"","group":"","caption":"","needRightControl":"","func":"back_add_pzh","funcTitle":"function back_add_pzh","index":3},{"source":"function back_delete_pzh(gguid, pzh1, pzh2)","comment":"","group":"","caption":"","needRightControl":"","func":"back_delete_pzh","funcTitle":"function back_delete_pzh","index":4}]}


id: 663a3aa59932a08a57e3eba1
pid: 663a3aa59932a08a57e3eb94
name: 自动生成及刷新清册
code: autoRebuildPZB
namepath: /凭证清册
fullname: /凭证清册/自动生成及刷新清册
nodetype: leaf
createdate: 2024.05.07 22:31:07.000
lastmodifieddate: 2024.09.18 14:40:54.283
value:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg)
{
    println( arg);
    var param= JSON.parse(arg);
    var corpid= param.corpid ||'';
    var ym = param.ym || ''; 

    var  minYM =  formatDate(  nextDate( newDate()  , -12 * 10 ,'month') , 'yyyyMM');
    
    var where=` and ym>= ${minYM} `;
    var moreUnion="";
    if( ym!='' ) 
    {

     where =  where  + ` and (corpid='${corpid}' and ym= ${ym} ) ` ;
     moreUnion =` union  select  '${corpid}-${ym}' as id , '${corpid}' as corpid ,  ${ym} as ym  from  dual  `;
     
    }
    //生成主记录

    var sql= ` select id , id as gguid , id as billno , 1 as userid , '管理员' as username , 0 as deleteflag ,
            corpid , ym  
            from (
                select distinct  concat( corpid , '-', ym ) as id , corpid , ym   from dzpz_pz   
            union 
                select distinct  concat ( corpid , '-' ,  y*100+ m ) as id , corpid ,   y*100+ m   as ym   from pzdjex 
            ${moreUnion}    
            ) a  
            where id is not null and corpid is not null  and ym is not null  ${where} 
            order by id 
        ` ; 

    dbTransfer('', sql, 'pzb', 'id',true, 1000, '','', '', 0, 0, -5) ;

    runSQL("","update pzb set billdate ='"+ date2yyyymmdd( newDate())+"' where  billdate is null ",true);

    //凭证记录

    sql= `
    select  * 
    from (
        select distinct  concat( corpid , '-', ym ,'-',pzh ) as id ,  concat( corpid , '-', ym   ) as gguid  , corpid , ym  , pzh  from dzpz_pz   
        union 
        select distinct  concat( corpid , '-' ,  y*100+ m ,'-',pzh ) as id ,  concat ( corpid , '-' ,  y*100+ m ) as gguid , corpid ,   y*100+ m   as ym  ,pzh  from pzdjex 
            where y is not null and m is not null and  corpid is not null 
        ) a  where id is not null and corpid is not null  and ym is not null ${where} 
    order by id 
    
    `

    dbTransfer('', sql, 'pzbmx', 'id',true, 1000, '','', '', 0, 0, -5) ;

    runSQL("",`update pzbmx set createdate ='${date2yyyymmdd( newDate())}' where  createdate is null   ${where}`,true);

    runSQL("" , `create index  di_pzbmx_corpid_ym on  pzbmx ( corpid, ym) ` ,true);
    
    runSQL("" , `create unique index  ui_pzbmx_pzh on  pzbmx ( corpid, ym ,pzh) ` ,true);
    

    runSQL("", `update pzb set pzs= (select count(*) from pzbmx where pzbmx.gguid= pzb.gguid  ) where   1=1  ${where}` ,true);
    

    return 'over' ;


}


id: 663b154d9932c7c2295b2bf5
pid: 662a47879932b5035f32efab
name: functionlist
nodetype: column
createdate: 2024.05.08 14:28:21.000
lastmodifieddate: 2024.09.18 14:40:54.634
value:
["afterBillSaveSuccessfulOnServer","$back_build_sum","back_build_sum","back_import_pzh_data","back_add_pzh","back_pzh_if","onWorkFlowEnd","afterWorkRollbacked","onUserTaskSubmitted","verifyGZL","sponsorGZL"]


id: 663b18b199327b97e92d7707
pid: 662a47879932b5035f32efab
name: functionGroup
nodetype: column
createdate: 2024.05.08 14:28:21.000
lastmodifieddate: 2024.09.18 14:40:54.634
value:
{"工作流事件":[{"source":"//@comment (group=工作流事件,caption=提交时判断)\nfunction sponsorGZL(gguid)","comment":"//@comment (group=工作流事件,caption=提交时判断)","group":"工作流事件","caption":"提交时判断","needRightControl":"","func":"sponsorGZL","funcTitle":"function sponsorGZL","index":0},{"source":"//@comment (group=工作流事件,caption=审核时判断)\nfunction verifyGZL(gguid)","comment":"//@comment (group=工作流事件,caption=审核时判断)","group":"工作流事件","caption":"审核时判断","needRightControl":"","func":"verifyGZL","funcTitle":"function verifyGZL","index":1},{"source":"//@comment (group=工作流事件,caption=用户任务提交后)\nfunction onUserTaskSubmitted ( flow , userTask , gguid  )","comment":"//@comment (group=工作流事件,caption=用户任务提交后)","group":"工作流事件","caption":"用户任务提交后","needRightControl":"","func":"onUserTaskSubmitted","funcTitle":"function onUserTaskSubmitted","index":2},{"source":"//@comment (group=工作流事件,caption=流程驳回后)\nfunction afterWorkRollbacked ( gguid ,   rollbackToNodeId, assignee ,isRecover )","comment":"//@comment (group=工作流事件,caption=流程驳回后)","group":"工作流事件","caption":"流程驳回后","needRightControl":"","func":"afterWorkRollbacked","funcTitle":"function afterWorkRollbacked","index":3},{"source":"//@comment (group=工作流事件,caption=工作结束)\nfunction onWorkFlowEnd(flow, node, gguid)","comment":"//@comment (group=工作流事件,caption=工作结束)","group":"工作流事件","caption":"工作结束","needRightControl":"","func":"onWorkFlowEnd","funcTitle":"function onWorkFlowEnd","index":4}],"判断凭证号是否能导入":[{"source":"//@comment (group=判断凭证号是否能导入,caption=false)\nfunction back_pzh_if(ny, pzh)","comment":"//@comment (group=判断凭证号是否能导入,caption=false)","group":"判断凭证号是否能导入","caption":"false","needRightControl":"","func":"back_pzh_if","funcTitle":"function back_pzh_if","index":5}],"导入凭证号":[{"source":"//@comment (group=导入凭证号,caption=连续号导入)\nfunction back_add_pzh(data)","comment":"//@comment (group=导入凭证号,caption=连续号导入)","group":"导入凭证号","caption":"连续号导入","needRightControl":"","func":"back_add_pzh","funcTitle":"function back_add_pzh","index":6},{"source":"//@comment (group=导入凭证号,caption=单号导入)\nfunction back_import_pzh_data(data)","comment":"//@comment (group=导入凭证号,caption=单号导入)","group":"导入凭证号","caption":"单号导入","needRightControl":"","func":"back_import_pzh_data","funcTitle":"function back_import_pzh_data","index":7}],"根据凭证号清单生成凭证号汇总信息":[{"source":"//@comment (group=根据凭证号清单生成凭证号汇总信息,caption=1)\nfunction back_build_sum()","comment":"//@comment (group=根据凭证号清单生成凭证号汇总信息,caption=1)","group":"根据凭证号清单生成凭证号汇总信息","caption":"1","needRightControl":"","func":"back_build_sum","funcTitle":"function back_build_sum","index":8}],"单据保存":[{"source":"//@comment (group=单据保存,caption=单据保存成功后)\nfunction afterBillSaveSuccessfulOnServer(gguid, session)","comment":"//@comment (group=单据保存,caption=单据保存成功后)","group":"单据保存","caption":"单据保存成功后","needRightControl":"","func":"afterBillSaveSuccessfulOnServer","funcTitle":"function afterBillSaveSuccessfulOnServer","index":9}]}


id: 66534a9199327550ff10da2c
pid: 60ab513d5db26b6db2c28a8c
name: 归档信息保存到文件中
code: 归档信息保存到文件中
namepath: /凭证数字化/归档相关
fullname: /凭证数字化/归档相关/归档信息保存到文件中
nodetype: leaf
createdate: 2024.05.26 23:09:27.000
lastmodifieddate: 2024.09.18 14:40:54.634
value:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg)
{
     

     println( arg);
    var p= JSON.parse(arg);
   
    var id= p.pzid;
     

    var  dzpz_pz_ds = newDataStore("", "select * from dzpz_pz ");  //凭证主记录
    dzpz_pz_ds.retrieve(" id='"+  id+"' ");

    var  dzpz_pzfj_ds = newDataStore("", "select * from dzpz_pzfj "); //凭证附件
    var n = dzpz_pzfj_ds.retrieve(" gguid='"+  id+"' "); 
    
 
    var corpid= dzpz_pz_ds.getValue(0,"corpid");
    var ym  = dzpz_pz_ds.getString(0,"ym");
    var pzh  = dzpz_pz_ds.getString(0,"pzh");

    var data={};
    data.dzpz_pz = JSON.parse(dzpz_pz_ds.getJSONRow( 0, true));
    data.dzpz_pzfj =[];
    for( var i=0;i< n;  i++)
    {
        data.dzpz_pzfj.push( JSON.parse( dzpz_pzfj_ds.getJSONRow(i,true) ));
    }

    var t= JSON.stringify(data);

    var file=`{appFileRoot}/FileServer/default/凭证号与附件关联/${corpid}/${ym}/${pzh}.json` ; 
    saveToFile( file, t ) ;

     

}


id: 669dc60c9932df22f60cad3b
pid: templateScriptOnServer
name: templateScriptOnServer-662a47879932b5035f32efabclone20240722103814
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:54.636
value:
//@comment (group=工作流事件,caption=提交时判断)
function sponsorGZL(gguid) {

    var list = getListFromSQL2("", `select * from pz_yjd_pzh where gguid='${gguid}' and state='-99' `);
    var pzh_list = [];
    println('list  ' + JSON.stringify(list))
    list.forEach(item => {
        var pzh_if = back_pzh_if(item.ny, item.pzh);
        if (pzh_if) pzh_list.push(pzh_if);
    })

    if (pzh_list.length) {
        return '以下凭证号不满足条件:<br/>' + pzh_list.join('<br/>') + '<br/>不能提交结束工作流！';
    }

    return '';
}

//@comment (group=工作流事件,caption=审核时判断)
function verifyGZL(gguid) {
    var count = getValueFromSQL2("", `select count(0) from pz_yjd_pzh where gguid='${gguid}' and state<>'1' and qsqx is not null and qsqx>0`);
    println('verifyGZL count  ' + count)

    return count > 0 ? '有凭证式延迟确认，不能提交结束工作流！' : ''
}



/**
 * 用户任务提交后
 * @param flow 流程定义
 * @param node 开始节点
 * @param gguid 单据的gguid

 */
//@comment (group=工作流事件,caption=用户任务提交后)
function onUserTaskSubmitted ( flow , userTask , gguid  ) {
    // println( flow.id) ; //流程定义的ID
    // println( userTask.name);
    runSQL("", ` update pz_yjd_pzh set state=0 where gguid='${gguid}' and  state=-99`);

}



/**
 * 在流程驳回后，触发本事件
 * 无需返回值
 * @param gguid 单据的gguid
 * @param rollbackToNodeId 被驳回到哪个节点的id
 * @param assignee 受理人
 * @param isRecover true 表示是主动撤回 ， false表示是被驳回
 *
 */
//@comment (group=工作流事件,caption=流程驳回后)
function afterWorkRollbacked ( gguid ,   rollbackToNodeId, assignee ,isRecover ) {

    runSQL("", ` update pz_yjd_pzh set state=-99 where gguid='${gguid}' `);

}


/**
 * 工作结束
 * @param flow 流程定义
 * @param node 开始节点
 * @param gguid 单据的gguid

 */
//@comment (group=工作流事件,caption=工作结束)
function onWorkFlowEnd(flow, node, gguid) {
    // println( flow.id) ; //流程定义的ID
    println(gguid + "工作结束了");
    runSQL("", ` update pz_yjd_pzh set state=1 where gguid='${gguid}' and  ifnull(state, 0)=0`);

    runSQL("", `UPDATE pzbmx a
            INNER JOIN  pz_yjdex b  inner join pz_yjd c on (b.gguid=c.gguid) 
             ON a.pzh  >= b.pzh1 and a.pzh<= b.pzh2 and b.gguid=${gguid}
            SET a.pos  = c.towhere , a.memo = c.summary, a.state_jb=1     ` , true);
}


function back_get_pzdj_gguid(from_id) {
    return getStringFromSQL2('', `select gguid from pzdj where from_id='${from_id}'`)
}


//@comment (group=判断凭证号是否能导入,caption=false)
function back_pzh_if(ny, pzh) {
    var newItem = getOneRowFromSQL2("", `select * from pz_yjd_pzh where ny='${ny}' and pzh='${pzh}' and state not in (-99,-1) order by lastmodifieddate desc`);
    var str = '';
    if (!(newItem.pzh / 1)) {
        newItem.billtype = '';
        newItem.state = '1';
    }
    println(`newItem ===  ${JSON.stringify(newItem)}`)
    if ((newItem.state != '1' || ((newItem.billtype != '交办' && newItem.billtype != '归还') && newItem.state == '1'))) {
        str = `${pzh} ${newItem.billtype}${newItem.state == '1' ? `没有${newItem.billtype != '借阅' ? '交办' : '归还'}` : '申请中'}`;
    }

    return str;
}

//@comment (group=导入凭证号,caption=连续号导入)
function back_add_pzh(data) {
    var count = (data.pzh2 / 1) - (data.pzh1 / 1);


    var gguid = currentGUID();
    var pzh_list = [];
    for (var i = 0; i <= count; i++) {
        var newid = newGuid();
        var pzh = (data.pzh1 / 1) + i;

        var pzh_if = back_pzh_if(data.ny, pzh);
        if (pzh_if) {
            pzh_list.push(pzh_if);
        } else if (pzh_list.length) {

        } else {
            runSQL("", `insert into  pz_yjd_pzh (id, gguid, ny, pzh,state, billtype, lastmodifieddate ) values ( ${newid} , ${gguid} , '${data.ny}' , '${pzh}', -99, '交回', '${formatDate(currentDate(), "yyyy.MM.dd HH:mm:ss")}') `, true);
        }
    }

    back_build_sum();
    return { success: true, pzh_list: pzh_list };

}

//@comment (group=导入凭证号,caption=单号导入)
function back_import_pzh_data(data) {

    var t = data.pzh.split(/[\s]/);
    var pzh_list = [];
    for (var i = 0; i < t.length; i++) {
        var pzh = t[i].trim();
        if (pzh == '') continue;
        var newid = newGuid();
        var gguid = currentGUID();

        var pzh_if = back_pzh_if(data.ny, pzh);
        if (pzh_if) {
            pzh_list.push(pzh_if);
        } else if (pzh_list.length) {

        } else {
            runSQL("", `insert into  pz_yjd_pzh (id, gguid, ny, pzh,state, billtype, lastmodifieddate ) values ( ${newid} , ${gguid} , '${data.ny}' , '${pzh}', -99, '交回', '${formatDate(currentDate(), "yyyy.MM.dd HH:mm:ss")}') `, true);
        }
    }
    back_build_sum();
    return { success: true, pzh_list: pzh_list };
}


//  根据凭证号清单生成凭证号汇总信息 
function back_build_sum() {
    var gguid = currentGUID();
    $back_build_sum(gguid);
}


function $back_build_sum(gguid) {


    var sql = `
            
        SELECT
            MAX( ny ) as ny , MIN( pzh ) as pzh1 ,   MAX( pzh )  AS  pzh2,
        COUNT(*) AS c 
        FROM
        (
            SELECT
            ny,
            pzh,
            CONCAT(ny, pzh) as ny_pzh,
            @group_id := IF( pzh  = @prev_number + 1, @group_id, @group_id + 1) AS group_id,
            @prev_number := pzh 
            FROM
            pz_yjd_pzh,
            (SELECT @group_id := 0, @prev_number := NULL) AS vars 
                    where  gguid= ${gguid}
            ORDER BY
            ny_pzh
        ) AS subquery
        GROUP BY
        group_id;
            
    ` ;

    println(sql);
    var tds = newDataStore("", sql);
    var n = tds.retrieve();

    runSQL("", `delete from  pz_yjdex where gguid= ${gguid} `, true);

    var pz_yjdex_ds = newDataStore("", "select * from pz_yjdex");
    pz_yjdex_ds.setUpdateProperty('pz_yjdex', 'id', '*', 'id');
    for (var i = 0; i < n; i++) {
        var row = pz_yjdex_ds.insertRow(9999);
        pz_yjdex_ds.setValue(row, {
            id: newGuid(), gguid: gguid, inner_xh: row + 1,
            billtype: '交回',
            ny: tds.getString(i, 'ny'),
            pzh1: tds.getString(i, "pzh1"),
            pzh2: tds.getString(i, "pzh2"),
            pzs: tds.getInt(i, "c")


        });
    }

    //
    pz_yjdex_ds.executeAfterUpdate(`update  pz_yjd  set pzs= (select count(*) from  pz_yjd_pzh where gguid= ${gguid} ) where   id= ${gguid}  `);
    pz_yjdex_ds.update(true);


}


/**
 * 单据点击保存，前端所有的操作被转译成3种操作:insert , delete , update ,
 *  并且可以在  beforeBillSaveOnServer 中返回一些SQL语句，可以在afterBillSaveOnServer中返回一些SQL语句
 *
 * 系统分别在需要的数据库连接中执行这些语句 ， 当所有语句执行成功后，事件被提交。一些细节如下 ：
 *
 * 1 如果单据中的表，属于不同的数据库连接，那么所有的SQL语句会以连接为单位，对语句进行批量执行
 * 2 这些语句的执行顺序是：对同一个数据库连接中的语句， 先执行 beforeBillSaveOnServer 中返回的SQL语句，再执行单据操作转译得到的SQL语句，
 *   再执行 afterBillSaveOnServer 中返回的SQL语句， 当多个（或一个）数据库连接执行完这些语句，且没有错误时，所有的数据库连接做提交，否则全部回滚
 * 3 不要在 beforeBillSaveOnServer 或 afterBillSaveOnServer 中直接执行数据库操作，而是返回SQL语句，让系统批量执行它们，并控制好事务
 * 4 当执行成功后，系统再执行事件函数  afterBillSaveSuccessfulOnServer 。 此事件中可以执行任意操作，它与单据保存事件结束后才被触发执行，
 *   与单据保存并不在一个事务中。
 *
 *
 * @param gguid  要删除记录的gguid ，等同于主表的id
 * @param session  一个JSON对象，用于在整个单据保存过程中的各个事件之间传递数据。本事件做为单据保存的最后一个事件，session对象在使用后将被丢弃
 *
 *
 * @return 本函数不需要返回值
 *
 */
//@comment (group=单据保存,caption=单据保存成功后)
function afterBillSaveSuccessfulOnServer(gguid, session) {

    $back_build_sum(gguid);
}


id: 669dc6169932df22f60cbf99
pid: 669dc60c9932df22f60cad3b
name: functionGroup
nodetype: column
createdate: 2024.05.08 14:28:21.000
lastmodifieddate: 2024.09.18 14:40:54.637
value:
{"工作流事件":[{"source":"//@comment (group=工作流事件,caption=提交时判断)\nfunction sponsorGZL(gguid)","comment":"//@comment (group=工作流事件,caption=提交时判断)","group":"工作流事件","caption":"提交时判断","needRightControl":"","func":"sponsorGZL","funcTitle":"function sponsorGZL","index":0},{"source":"//@comment (group=工作流事件,caption=审核时判断)\nfunction verifyGZL(gguid)","comment":"//@comment (group=工作流事件,caption=审核时判断)","group":"工作流事件","caption":"审核时判断","needRightControl":"","func":"verifyGZL","funcTitle":"function verifyGZL","index":1},{"source":"//@comment (group=工作流事件,caption=用户任务提交后)\nfunction onUserTaskSubmitted ( flow , userTask , gguid  )","comment":"//@comment (group=工作流事件,caption=用户任务提交后)","group":"工作流事件","caption":"用户任务提交后","needRightControl":"","func":"onUserTaskSubmitted","funcTitle":"function onUserTaskSubmitted","index":2},{"source":"//@comment (group=工作流事件,caption=流程驳回后)\nfunction afterWorkRollbacked ( gguid ,   rollbackToNodeId, assignee ,isRecover )","comment":"//@comment (group=工作流事件,caption=流程驳回后)","group":"工作流事件","caption":"流程驳回后","needRightControl":"","func":"afterWorkRollbacked","funcTitle":"function afterWorkRollbacked","index":3},{"source":"//@comment (group=工作流事件,caption=工作结束)\nfunction onWorkFlowEnd(flow, node, gguid)","comment":"//@comment (group=工作流事件,caption=工作结束)","group":"工作流事件","caption":"工作结束","needRightControl":"","func":"onWorkFlowEnd","funcTitle":"function onWorkFlowEnd","index":4}],"全局函数":[{"source":"function back_get_pzdj_gguid(from_id)","comment":"","group":"","caption":"","needRightControl":"","func":"back_get_pzdj_gguid","funcTitle":"function back_get_pzdj_gguid","index":5},{"source":"function back_build_sum()","comment":"","group":"","caption":"","needRightControl":"","func":"back_build_sum","funcTitle":"function back_build_sum","index":9}],"判断凭证号是否能导入":[{"source":"//@comment (group=判断凭证号是否能导入,caption=false)\nfunction back_pzh_if(ny, pzh)","comment":"//@comment (group=判断凭证号是否能导入,caption=false)","group":"判断凭证号是否能导入","caption":"false","needRightControl":"","func":"back_pzh_if","funcTitle":"function back_pzh_if","index":6}],"导入凭证号":[{"source":"//@comment (group=导入凭证号,caption=连续号导入)\nfunction back_add_pzh(data)","comment":"//@comment (group=导入凭证号,caption=连续号导入)","group":"导入凭证号","caption":"连续号导入","needRightControl":"","func":"back_add_pzh","funcTitle":"function back_add_pzh","index":7},{"source":"//@comment (group=导入凭证号,caption=单号导入)\nfunction back_import_pzh_data(data)","comment":"//@comment (group=导入凭证号,caption=单号导入)","group":"导入凭证号","caption":"单号导入","needRightControl":"","func":"back_import_pzh_data","funcTitle":"function back_import_pzh_data","index":8}],"单据保存":[{"source":"//@comment (group=单据保存,caption=单据保存成功后)\nfunction afterBillSaveSuccessfulOnServer(gguid, session)","comment":"//@comment (group=单据保存,caption=单据保存成功后)","group":"单据保存","caption":"单据保存成功后","needRightControl":"","func":"afterBillSaveSuccessfulOnServer","funcTitle":"function afterBillSaveSuccessfulOnServer","index":10}]}


id: 669dc6169932df22f60cbf9d
pid: 669dc60c9932df22f60cad3b
name: functionlist
nodetype: column
createdate: 2024.05.08 14:28:21.000
lastmodifieddate: 2024.09.18 14:40:54.637
value:
["afterBillSaveSuccessfulOnServer","$back_build_sum","back_build_sum","back_import_pzh_data","back_add_pzh","back_pzh_if","back_get_pzdj_gguid","onWorkFlowEnd","afterWorkRollbacked","onUserTaskSubmitted","verifyGZL","sponsorGZL"]


id: 669dc6249932df22f60cc8cf
pid: templateScriptOnServer
name: templateScriptOnServer-662a47879932b5035f32efabclone20240722103814clone20240722103838
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:55.001
value:
//@comment (group=工作流事件,caption=提交时判断)
function sponsorGZL(gguid) {

    var list = getListFromSQL2("", `select * from pz_yjd_pzh where gguid='${gguid}' and state='-99' `);
    var pzh_list = [];
    println('list  ' + JSON.stringify(list))
    list.forEach(item => {
        var pzh_if = back_pzh_if(item.ny, item.pzh);
        if (pzh_if) pzh_list.push(pzh_if);
    })

    if (pzh_list.length) {
        return '以下凭证号不满足条件:<br/>' + pzh_list.join('<br/>') + '<br/>不能提交结束工作流！';
    }

    return '';
}

function verifyGZL(gguid) {
    var count = getValueFromSQL2( "", `select count(0) from pz_yjd_pzh where gguid='${gguid}' and state<>'1' and qsqx is not null and qsqx>0`  );
    println( 'verifyGZL count  ' + count ) 

    return count>0?'有凭证式延迟确认，不能提交结束工作流！':''
}


/**
 * 用户任务提交后
 * @param flow 流程定义
 * @param node 开始节点
 * @param gguid 单据的gguid

 */
//@comment (group=工作流事件,caption=用户任务提交后)
function onUserTaskSubmitted ( flow , userTask , gguid  ) {
    // println( flow.id) ; //流程定义的ID
    // println( userTask.name);
    runSQL("", ` update pz_yjd_pzh set state=0 where gguid='${gguid}' and  state=-99`);

}



/**
 * 在流程驳回后，触发本事件
 * 无需返回值
 * @param gguid 单据的gguid
 * @param rollbackToNodeId 被驳回到哪个节点的id
 * @param assignee 受理人
 * @param isRecover true 表示是主动撤回 ， false表示是被驳回
 *
 */
//@comment (group=工作流事件,caption=流程驳回后)
function afterWorkRollbacked ( gguid ,   rollbackToNodeId, assignee ,isRecover ) {

    runSQL("", ` update pz_yjd_pzh set state=-99 where gguid='${gguid}' `);

}


/**
 * 工作结束
 * @param flow 流程定义
 * @param node 开始节点
 * @param gguid 单据的gguid

 */
//@comment (group=工作流事件,caption=工作结束)
function onWorkFlowEnd(flow, node, gguid) {
    // println( flow.id) ; //流程定义的ID
    println(gguid + "工作结束了");
    runSQL("", ` update pz_yjd_pzh set state=1 where gguid='${gguid}' and  ifnull(state, 0)=0`  );

    runSQL("", `UPDATE pzbmx a
            INNER JOIN  pz_yjdex b  inner join pz_yjd c on (b.gguid=c.gguid) 
             ON a.pzh  >= b.pzh1 and a.pzh<= b.pzh2 and b.gguid=${gguid}
            SET a.pos  = c.towhere , a.memo = c.summary, a.state_jy=1     ` , true);
}


//@comment (group=判断凭证号是否能导入,caption=false)
function back_pzh_if(ny, pzh) {
    var newItem = getOneRowFromSQL2("", `select * from pz_yjd_pzh where ny='${ny}' and pzh='${pzh}' and state not in (-99,-1) order by lastmodifieddate desc`);
    if (!(newItem.pzh / 1)) {
        newItem.billtype = '';
        newItem.state = '1';
    }
    var str = '';
    println( `newItem ===  ${JSON.stringify(newItem)}` ) 
        if ( (newItem.state != '1' || ( (newItem.billtype != '交办' && newItem.billtype != '归还') && newItem.state == '1'))) {
        str = `${pzh} ${newItem.billtype}${newItem.state == '1' ? `没有${newItem.billtype != '借阅' ? '交办' : '归还'}` : '申请中'}`;
    }

    return str;
}

//@comment (group=导入凭证号,caption=连续号导入)
function back_add_pzh(data) {
    var count = (data.pzh2 / 1) - (data.pzh1 / 1);


    var gguid = currentGUID();
    var pzh_list = [];
    for (var i = 0; i <= count; i++) {
        var newid = newGuid();
        var pzh = (data.pzh1 / 1) + i;

        var pzh_if = back_pzh_if(data.ny, pzh);
        if (pzh_if) {
            pzh_list.push(pzh_if);
        } else if (pzh_list.length) {

        } else {
            runSQL("", `insert into  pz_yjd_pzh (id, gguid, ny, pzh,state, billtype, lastmodifieddate ) values ( ${newid} , ${gguid} , '${data.ny}' , '${pzh}', -99, '借阅', '${formatDate(currentDate(), "yyyy.MM.dd HH:mm:ss")}') `, true);
        }
    }

    back_build_sum();
    return { success: true, pzh_list: pzh_list };

}

//@comment (group=导入凭证号,caption=单号导入)
function back_import_pzh_data(data){

    var t = data.pzh.split(/[\s]/);
    var pzh_list = [];
    for (var i = 0; i < t.length; i++) {
        var pzh = t[i].trim();
        if (pzh == '') continue;
        var newid = newGuid();
        var gguid = currentGUID();

        var pzh_if = back_pzh_if(data.ny, pzh);
        if (pzh_if) {
            pzh_list.push(pzh_if);
        } else if (pzh_list.length) {

        } else {
            runSQL("", `insert into  pz_yjd_pzh (id, gguid, ny, pzh,state, billtype, lastmodifieddate ) values ( ${newid} , ${gguid} , '${data.ny}' , '${pzh}', -99, '借阅', '${formatDate(currentDate(), "yyyy.MM.dd HH:mm:ss")}') `, true);
        }
    }
    back_build_sum();
    return { success: true, pzh_list: pzh_list };
}


//  根据凭证号清单生成凭证号汇总信息 
function back_build_sum() {
    var gguid = currentGUID();
    $back_build_sum(gguid);
}


function $back_build_sum(gguid) {


    var sql = `
            
        SELECT
            MAX( ny ) as ny , MIN( pzh ) as pzh1 ,   MAX( pzh )  AS  pzh2,
        COUNT(*) AS c 
        FROM
        (
            SELECT
            ny,
            pzh,
            CONCAT(ny, pzh) as ny_pzh,
            @group_id := IF( pzh  = @prev_number + 1, @group_id, @group_id + 1) AS group_id,
            @prev_number := pzh 
            FROM
            pz_yjd_pzh,
            (SELECT @group_id := 0, @prev_number := NULL) AS vars 
                    where  gguid= ${gguid}
            ORDER BY
            ny_pzh
        ) AS subquery
        GROUP BY
        group_id;
            
    ` ;

    println(sql);
    var tds = newDataStore("", sql);
    var n = tds.retrieve();

    runSQL("", `delete from  pz_yjdex where gguid= ${gguid} `, true);

    var pz_yjdex_ds = newDataStore("", "select * from pz_yjdex");
    pz_yjdex_ds.setUpdateProperty('pz_yjdex', 'id', '*', 'id');
    for (var i = 0; i < n; i++) {
        var row = pz_yjdex_ds.insertRow(9999);
        pz_yjdex_ds.setValue(row, {
            id: newGuid(), gguid: gguid, inner_xh: row + 1,
            billtype: '借阅',
            ny: tds.getString(i, 'ny'),
            pzh1: tds.getString(i, "pzh1"),
            pzh2: tds.getString(i, "pzh2"),
            pzs: tds.getInt(i, "c")


        });
    }

    //
    pz_yjdex_ds.executeAfterUpdate(`update  pz_yjd  set pzs= (select count(*) from  pz_yjd_pzh where gguid= ${gguid} ) where   id= ${gguid}  `);
    pz_yjdex_ds.update(true);


}


/**
 * 单据点击保存，前端所有的操作被转译成3种操作:insert , delete , update ,
 *  并且可以在  beforeBillSaveOnServer 中返回一些SQL语句，可以在afterBillSaveOnServer中返回一些SQL语句
 *
 * 系统分别在需要的数据库连接中执行这些语句 ， 当所有语句执行成功后，事件被提交。一些细节如下 ：
 *
 * 1 如果单据中的表，属于不同的数据库连接，那么所有的SQL语句会以连接为单位，对语句进行批量执行
 * 2 这些语句的执行顺序是：对同一个数据库连接中的语句， 先执行 beforeBillSaveOnServer 中返回的SQL语句，再执行单据操作转译得到的SQL语句，
 *   再执行 afterBillSaveOnServer 中返回的SQL语句， 当多个（或一个）数据库连接执行完这些语句，且没有错误时，所有的数据库连接做提交，否则全部回滚
 * 3 不要在 beforeBillSaveOnServer 或 afterBillSaveOnServer 中直接执行数据库操作，而是返回SQL语句，让系统批量执行它们，并控制好事务
 * 4 当执行成功后，系统再执行事件函数  afterBillSaveSuccessfulOnServer 。 此事件中可以执行任意操作，它与单据保存事件结束后才被触发执行，
 *   与单据保存并不在一个事务中。
 *
 *
 * @param gguid  要删除记录的gguid ，等同于主表的id
 * @param session  一个JSON对象，用于在整个单据保存过程中的各个事件之间传递数据。本事件做为单据保存的最后一个事件，session对象在使用后将被丢弃
 *
 *
 * @return 本函数不需要返回值
 *
 */
//@comment (group=单据保存,caption=单据保存成功后)
function afterBillSaveSuccessfulOnServer(gguid, session) {

    $back_build_sum(gguid);
}


id: 669dc62e9932df22f60cdb2d
pid: 669dc6249932df22f60cc8cf
name: functionGroup
nodetype: column
createdate: 2024.05.08 14:28:21.000
lastmodifieddate: 2024.09.18 14:40:55.001
value:
{"工作流事件":[{"source":"//@comment (group=工作流事件,caption=提交时判断)\nfunction sponsorGZL(gguid)","comment":"//@comment (group=工作流事件,caption=提交时判断)","group":"工作流事件","caption":"提交时判断","needRightControl":"","func":"sponsorGZL","funcTitle":"function sponsorGZL","index":0},{"source":"//@comment (group=工作流事件,caption=用户任务提交后)\nfunction onUserTaskSubmitted ( flow , userTask , gguid  )","comment":"//@comment (group=工作流事件,caption=用户任务提交后)","group":"工作流事件","caption":"用户任务提交后","needRightControl":"","func":"onUserTaskSubmitted","funcTitle":"function onUserTaskSubmitted","index":2},{"source":"//@comment (group=工作流事件,caption=流程驳回后)\nfunction afterWorkRollbacked ( gguid ,   rollbackToNodeId, assignee ,isRecover )","comment":"//@comment (group=工作流事件,caption=流程驳回后)","group":"工作流事件","caption":"流程驳回后","needRightControl":"","func":"afterWorkRollbacked","funcTitle":"function afterWorkRollbacked","index":3},{"source":"//@comment (group=工作流事件,caption=工作结束)\nfunction onWorkFlowEnd(flow, node, gguid)","comment":"//@comment (group=工作流事件,caption=工作结束)","group":"工作流事件","caption":"工作结束","needRightControl":"","func":"onWorkFlowEnd","funcTitle":"function onWorkFlowEnd","index":4}],"全局函数":[{"source":"function verifyGZL(gguid)","comment":"","group":"","caption":"","needRightControl":"","func":"verifyGZL","funcTitle":"function verifyGZL","index":1},{"source":"function back_build_sum()","comment":"","group":"","caption":"","needRightControl":"","func":"back_build_sum","funcTitle":"function back_build_sum","index":8}],"判断凭证号是否能导入":[{"source":"//@comment (group=判断凭证号是否能导入,caption=false)\nfunction back_pzh_if(ny, pzh)","comment":"//@comment (group=判断凭证号是否能导入,caption=false)","group":"判断凭证号是否能导入","caption":"false","needRightControl":"","func":"back_pzh_if","funcTitle":"function back_pzh_if","index":5}],"导入凭证号":[{"source":"//@comment (group=导入凭证号,caption=连续号导入)\nfunction back_add_pzh(data)","comment":"//@comment (group=导入凭证号,caption=连续号导入)","group":"导入凭证号","caption":"连续号导入","needRightControl":"","func":"back_add_pzh","funcTitle":"function back_add_pzh","index":6},{"source":"//@comment (group=导入凭证号,caption=单号导入)\nfunction back_import_pzh_data(data)","comment":"//@comment (group=导入凭证号,caption=单号导入)","group":"导入凭证号","caption":"单号导入","needRightControl":"","func":"back_import_pzh_data","funcTitle":"function back_import_pzh_data","index":7}],"单据保存":[{"source":"//@comment (group=单据保存,caption=单据保存成功后)\nfunction afterBillSaveSuccessfulOnServer(gguid, session)","comment":"//@comment (group=单据保存,caption=单据保存成功后)","group":"单据保存","caption":"单据保存成功后","needRightControl":"","func":"afterBillSaveSuccessfulOnServer","funcTitle":"function afterBillSaveSuccessfulOnServer","index":9}]}


id: 669dc6399932df22f60ce463
pid: templateScriptOnServer
nodetype: leaf
lastmodifieddate: 2024.09.18 14:40:55.001
name:
templateScriptOnServer-662a47879932b5035f32efabclone20240722103814clone20240722103838clone20240722103859

value:
//@comment (group=工作流事件,caption=提交时判断)
function sponsorGZL(gguid) {

    var list = getListFromSQL2("", `select * from pz_yjd_pzh where gguid='${gguid}' and state='-99' `);
    var pzh_list = [];
    println('list  ' + JSON.stringify(list))
    list.forEach(item => {
        var pzh_if = back_pzh_if(item.ny, item.pzh);
        if (pzh_if) pzh_list.push(pzh_if);
    })

    if (pzh_list.length) {
        return '以下凭证号不满足条件:<br/>' + pzh_list.join('<br/>') + '<br/>不能提交结束工作流！';
    }

    return '';
}

function verifyGZL(gguid) {
    var count = getValueFromSQL2("", `select count(0) from pz_yjd_pzh where gguid='${gguid}' and state<>'1' and qsqx is not null and qsqx>0`);
    println('verifyGZL count  ' + count)

    return count > 0 ? '有凭证式延迟确认，不能提交结束工作流！' : ''
}


/**
 * 用户任务提交后
 * @param flow 流程定义
 * @param node 开始节点
 * @param gguid 单据的gguid

 */
//@comment (group=工作流事件,caption=用户任务提交后)
function onUserTaskSubmitted(flow, userTask, gguid) {
    // println( flow.id) ; //流程定义的ID
    // println( JSON.stringify(flow) );
    runSQL("", ` update pz_yjd_pzh set state=0 where gguid='${gguid}' and  state=-99`);

}

/**
 * 在流程驳回后，触发本事件
 * 无需返回值
 * @param gguid 单据的gguid
 * @param rollbackToNodeId 被驳回到哪个节点的id
 * @param assignee 受理人
 * @param isRecover true 表示是主动撤回 ， false表示是被驳回
 *
 */
//@comment (group=工作流事件,caption=流程驳回后)
function afterWorkRollbacked ( gguid ,   rollbackToNodeId, assignee ,isRecover ) {

    runSQL("", ` update pz_yjd_pzh set state=-99 where gguid='${gguid}' `);

}





/**
 * 工作结束
 * @param flow 流程定义
 * @param node 开始节点
 * @param gguid 单据的gguid

 */
//@comment (group=工作流事件,caption=工作结束)
function onWorkFlowEnd(flow, node, gguid) {
    // println( flow.id) ; //流程定义的ID
    println(gguid + "工作结束了");
    runSQL("", ` update pz_yjd_pzh set state=1 where gguid='${gguid}' and  ifnull(state, 0)=0`);

    runSQL("", `UPDATE pzbmx a
            INNER JOIN  pz_yjdex b  inner join pz_yjd c on (b.gguid=c.gguid) 
             ON a.pzh  >= b.pzh1 and a.pzh<= b.pzh2 and b.gguid=${gguid}
            SET a.pos  = c.towhere , a.memo = c.summary , a.state_jy=0    ` , true);
}


//@comment (group=判断凭证号是否能导入,caption=false)
function back_pzh_if(ny, pzh) {
    var newItem = getOneRowFromSQL2("", `select * from pz_yjd_pzh where ny='${ny}' and pzh='${pzh}' and state not in (-99,-1) order by lastmodifieddate desc`);
    if (!(newItem.pzh / 1)) {
        newItem.billtype = '';
        newItem.state = '1';
    }
    var str = '';
    println(`newItem ===  ${JSON.stringify(newItem)}`)
    if ( (newItem.state != '1' || ((newItem.billtype != '借阅') && newItem.state == '1'))) {
        str = `${pzh} ${newItem.billtype}${newItem.billtype == ''?'没有交办':newItem.state == '1' ? `没有借阅` : '申请中'}`;
    }

    return str;
}

//@comment (group=导入凭证号,caption=连续号导入)
function back_add_pzh(data) {
    var count = (data.pzh2 / 1) - (data.pzh1 / 1);


    var gguid = currentGUID();
    var pzh_list = [];
    for (var i = 0; i <= count; i++) {
        var newid = newGuid();
        var pzh = (data.pzh1 / 1) + i;

        var pzh_if = back_pzh_if(data.ny, pzh);
        if (pzh_if) {
            pzh_list.push(pzh_if);
        } else if (pzh_list.length) {

        } else {
            runSQL("", `insert into  pz_yjd_pzh (id, gguid, ny, pzh,state, billtype, is_change, lastmodifieddate ) values ( ${newid} , ${gguid} , '${data.ny}' , '${pzh}', -99, '归还', 1, '${formatDate(currentDate(), "yyyy.MM.dd HH:mm:ss")}') `, true);
        }
    }

    back_build_sum();
    return { success: true, pzh_list: pzh_list };

}

//@comment (group=导入凭证号,caption=单号导入)
function back_import_pzh_data(data) {

    var t = data.pzh.split(/[\s]/);
    var pzh_list = [];
    for (var i = 0; i < t.length; i++) {
        var pzh = t[i].trim();
        if (pzh == '') continue;
        var newid = newGuid();
        var gguid = currentGUID();


        var pzh_if = back_pzh_if(data.ny, pzh);
        if (pzh_if) {
            pzh_list.push(pzh_if);
        } else if (pzh_list.length) {

        } else {
            runSQL("", `insert into  pz_yjd_pzh (id, gguid, ny, pzh,state, billtype, is_change, lastmodifieddate ) values ( ${newid} , ${gguid} , '${data.ny}' , '${pzh}', -99, '归还', 1, '${formatDate(currentDate(), "yyyy.MM.dd HH:mm:ss")}') `, true);
        }
    }
    back_build_sum();
    return { success: true, pzh_list: pzh_list };
}


//  根据凭证号清单生成凭证号汇总信息 
function back_build_sum() {
    var gguid = currentGUID();
    $back_build_sum(gguid);
}


function $back_build_sum(gguid) {


    var sql = `
            
        SELECT
            MAX( ny ) as ny , MIN( pzh ) as pzh1 ,   MAX( pzh )  AS  pzh2,
        COUNT(*) AS c 
        FROM
        (
            SELECT
            ny,
            pzh,
            CONCAT(ny, pzh) as ny_pzh,
            @group_id := IF( pzh  = @prev_number + 1, @group_id, @group_id + 1) AS group_id,
            @prev_number := pzh 
            FROM
            pz_yjd_pzh,
            (SELECT @group_id := 0, @prev_number := NULL) AS vars 
                    where  gguid= ${gguid}
            ORDER BY
            ny_pzh
        ) AS subquery
        GROUP BY
        group_id;
            
    ` ;

    println(sql);
    var tds = newDataStore("", sql);
    var n = tds.retrieve();

    runSQL("", `delete from  pz_yjdex where gguid= ${gguid} `, true);

    var pz_yjdex_ds = newDataStore("", "select * from pz_yjdex");
    pz_yjdex_ds.setUpdateProperty('pz_yjdex', 'id', '*', 'id');
    for (var i = 0; i < n; i++) {
        var row = pz_yjdex_ds.insertRow(9999);
        pz_yjdex_ds.setValue(row, {
            id: newGuid(), gguid: gguid, inner_xh: row + 1,
            billtype: '归还',
            ny: tds.getString(i, 'ny'),
            pzh1: tds.getString(i, "pzh1"),
            pzh2: tds.getString(i, "pzh2"),
            pzs: tds.getInt(i, "c")


        });
    }

    //
    pz_yjdex_ds.executeAfterUpdate(`update  pz_yjd  set pzs= (select count(*) from  pz_yjd_pzh where gguid= ${gguid} ) where   id= ${gguid}  `);
    pz_yjdex_ds.update(true);


}


/**
 * 单据点击保存，前端所有的操作被转译成3种操作:insert , delete , update ,
 *  并且可以在  beforeBillSaveOnServer 中返回一些SQL语句，可以在afterBillSaveOnServer中返回一些SQL语句
 *
 * 系统分别在需要的数据库连接中执行这些语句 ， 当所有语句执行成功后，事件被提交。一些细节如下 ：
 *
 * 1 如果单据中的表，属于不同的数据库连接，那么所有的SQL语句会以连接为单位，对语句进行批量执行
 * 2 这些语句的执行顺序是：对同一个数据库连接中的语句， 先执行 beforeBillSaveOnServer 中返回的SQL语句，再执行单据操作转译得到的SQL语句，
 *   再执行 afterBillSaveOnServer 中返回的SQL语句， 当多个（或一个）数据库连接执行完这些语句，且没有错误时，所有的数据库连接做提交，否则全部回滚
 * 3 不要在 beforeBillSaveOnServer 或 afterBillSaveOnServer 中直接执行数据库操作，而是返回SQL语句，让系统批量执行它们，并控制好事务
 * 4 当执行成功后，系统再执行事件函数  afterBillSaveSuccessfulOnServer 。 此事件中可以执行任意操作，它与单据保存事件结束后才被触发执行，
 *   与单据保存并不在一个事务中。
 *
 *
 * @param gguid  要删除记录的gguid ，等同于主表的id
 * @param session  一个JSON对象，用于在整个单据保存过程中的各个事件之间传递数据。本事件做为单据保存的最后一个事件，session对象在使用后将被丢弃
 *
 *
 * @return 本函数不需要返回值
 *
 */
//@comment (group=单据保存,caption=单据保存成功后)
function afterBillSaveSuccessfulOnServer(gguid, session) {

    $back_build_sum(gguid);
}


id: 669dc6439932df22f60cf6c1
pid: 669dc6399932df22f60ce463
name: functionGroup
nodetype: column
createdate: 2024.05.08 14:28:21.000
lastmodifieddate: 2024.09.18 14:40:55.002
value:
{"工作流事件":[{"source":"//@comment (group=工作流事件,caption=提交时判断)\nfunction sponsorGZL(gguid)","comment":"//@comment (group=工作流事件,caption=提交时判断)","group":"工作流事件","caption":"提交时判断","needRightControl":"","func":"sponsorGZL","funcTitle":"function sponsorGZL","index":0},{"source":"//@comment (group=工作流事件,caption=用户任务提交后)\nfunction onUserTaskSubmitted(flow, userTask, gguid)","comment":"//@comment (group=工作流事件,caption=用户任务提交后)","group":"工作流事件","caption":"用户任务提交后","needRightControl":"","func":"onUserTaskSubmitted","funcTitle":"function onUserTaskSubmitted","index":2},{"source":"//@comment (group=工作流事件,caption=流程驳回后)\nfunction afterWorkRollbacked ( gguid ,   rollbackToNodeId, assignee ,isRecover )","comment":"//@comment (group=工作流事件,caption=流程驳回后)","group":"工作流事件","caption":"流程驳回后","needRightControl":"","func":"afterWorkRollbacked","funcTitle":"function afterWorkRollbacked","index":3},{"source":"//@comment (group=工作流事件,caption=工作结束)\nfunction onWorkFlowEnd(flow, node, gguid)","comment":"//@comment (group=工作流事件,caption=工作结束)","group":"工作流事件","caption":"工作结束","needRightControl":"","func":"onWorkFlowEnd","funcTitle":"function onWorkFlowEnd","index":4}],"全局函数":[{"source":"function verifyGZL(gguid)","comment":"","group":"","caption":"","needRightControl":"","func":"verifyGZL","funcTitle":"function verifyGZL","index":1},{"source":"function back_build_sum()","comment":"","group":"","caption":"","needRightControl":"","func":"back_build_sum","funcTitle":"function back_build_sum","index":8}],"判断凭证号是否能导入":[{"source":"//@comment (group=判断凭证号是否能导入,caption=false)\nfunction back_pzh_if(ny, pzh)","comment":"//@comment (group=判断凭证号是否能导入,caption=false)","group":"判断凭证号是否能导入","caption":"false","needRightControl":"","func":"back_pzh_if","funcTitle":"function back_pzh_if","index":5}],"导入凭证号":[{"source":"//@comment (group=导入凭证号,caption=连续号导入)\nfunction back_add_pzh(data)","comment":"//@comment (group=导入凭证号,caption=连续号导入)","group":"导入凭证号","caption":"连续号导入","needRightControl":"","func":"back_add_pzh","funcTitle":"function back_add_pzh","index":6},{"source":"//@comment (group=导入凭证号,caption=单号导入)\nfunction back_import_pzh_data(data)","comment":"//@comment (group=导入凭证号,caption=单号导入)","group":"导入凭证号","caption":"单号导入","needRightControl":"","func":"back_import_pzh_data","funcTitle":"function back_import_pzh_data","index":7}],"单据保存":[{"source":"//@comment (group=单据保存,caption=单据保存成功后)\nfunction afterBillSaveSuccessfulOnServer(gguid, session)","comment":"//@comment (group=单据保存,caption=单据保存成功后)","group":"单据保存","caption":"单据保存成功后","needRightControl":"","func":"afterBillSaveSuccessfulOnServer","funcTitle":"function afterBillSaveSuccessfulOnServer","index":9}]}


id: 66bb02cf993294a6b3485671
pid: 66bb02cf993294a6b3485667
name: 凭证自动确认
code: autoConfirmPZH
namepath: /凭证交接
fullname: /凭证交接/凭证自动确认
nodetype: leaf
createdate: 2024.08.13 14:55:54.000
lastmodifieddate: 2024.09.18 14:40:55.003
value:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg) {
    println(arg);
    var param = JSON.parse(arg);

    var dsn = "";
    var sql = `select a.*, b.flow_instance_starttime, b.qsqx as qsqx2 from pz_yjd_pzh a left join pz_yjd b on a.gguid=b.gguid where b.flow_instance_state = 0 and b.flow_instance_starttime is not null and ifnull(a.state, 0)=0`;
    // var list = getListFromSQL2( dsn, sql);


    // var list = getListFromSQL2( '', `select * from  pz_yjd `) 
    // var list = getListFromSQL2( '', `select gguid, sum(case when ifnull(state,0)=0 then 1 else 0 end) as count from  pz_yjd_pzh  group by gguid`) 

    // return list

    var ds = newDataStore(dsn, sql);
    ds.retrieve();
    println("select : " + ds.getSelectLastRetrieved())
    var count = ds.getRowCount();
    println('count: ' + count)
    for (var i = 0; i < count; i++) {
        var item = JSON.parse(ds.getJSONRow(i));
        var dayArr = item.flow_instance_starttime.replace(/ /g, '-').replace(/:/g, '-').replace(/\./g, '-').split('-');
        // println( 'item.flow_instance_starttime  ' + JSON.stringify(item.flow_instance_starttime) ) 

        var confirmTime = createDate2(dayArr[0], dayArr[1], dayArr[2], dayArr[3], dayArr[4], dayArr[5]);
        var nowTime = currentDate();
        println( 'confirmTime ' + confirmTime ) 
        println( 'nowTime ' + nowTime ) 
        
        // 开始时间和结束时间相差多少天
        var day_count = daysBetween((nowTime), (confirmTime));
        // println("day_count: " + day_count)
        // println("item.qsqx: " + (item.qsqx/1 > '0' ? item.qsqx : item.qsqx2 )  )

        var confirm_day = (item.qsqx/1 > '0' ? ( (item.qsqx/1)+ (item.qsqx2 /1) ) : item.qsqx2 );
    println( "confirm_day  " + confirm_day ) 

        if ( confirm_day <= day_count) {
            // println('  item.id ' + item.id)
            runSQL(dsn, `update pz_yjd_pzh set state=1 where id='${item.id}'`);
        }
    }


    var list = getListFromSQL2('', `select * from  pz_yjd a left join (select gguid, sum(case when ifnull(state,0)=0 then 1 else 0 end) as count from  pz_yjd_pzh  group by gguid) b on a.gguid=b.gguid where  a.flow_instance_state = 0 and b.count=0 `)

    // return list

    list.forEach(item => {
        println("延长确认，自动确认");
        var gguid = item.gguid, workid = item.open_bill_with_url.split('&workspaceid=')[0].split('&id=')[1].split('&billtype=')[0];

        println("workid  " + workid)
        println("gguid  " + gguid)

        //递交结束
        var loopCount = 0;
        while (loopCount < 10) {
            loopCount++;
            // println(gguid);
            var t = taskInfoForWork(workid, gguid);
            println(JSON.stringify(t));
            if (t.taskList.length == 0) break;
            //将任务递交下去，如果任务需要签收，则先签收     
            for (var i = 0; i < t.taskList.length; i++) {
                var task = t.taskList[i];

                //可以递交，那么递交下去
                if (task.canSubmit) println(submitWork(workid, gguid, task.taskId));
                //需要先签收 ，那么以第一个候选人签收它
                if (task.canClaim) claimWork(workid, gguid, task.taskId, task.candidateUserList[0].userId);

            }


        }

    })
    // return list

    return 'over';

}


