# app_script

id: 665350b299327550ff10da91
pid: 66534a9199327550ff10da2c
name: functionGroup
nodetype: column
createdate: 2024.05.26 23:25:55.000
lastmodifieddate: 2024.12.18 10:08:37.379
value:
{"全局函数":[{"source":"function main(arg)","comment":"","group":"","caption":"","needRightControl":"","func":"main","funcTitle":"function main","index":0}]}


id: 665350b299327550ff10da94
pid: 66534a9199327550ff10da2c
name: finalscript
nodetype: column
createdate: 2024.05.26 23:25:56.000
lastmodifieddate: 2024.12.18 10:08:37.379
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 ) ;

     

}


# app_script_history

id: 665350b299327550ff10da97
scriptid: 66534a9199327550ff10da2c
tablename: app_script
clientip: 60.177.72.27
username: sa
createdate: 2024.05.26 23:25:57.000
script:
/**
 * 脚本中心的脚本，以 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 = 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: 6653549299327550ff10dae3
scriptid: 66534a9199327550ff10da2c
tablename: app_script
clientip: 60.177.72.27
username: sa
createdate: 2024.05.26 23:32:06.000
script:
/**
 * 脚本中心的脚本，以 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 = 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 ) ;

     

}


