# app_db

id: 67662aa599326bd179e4ee8e
pid: 676599b099326bd179e4ee62
name: dynamicwhere2
nodetype: column
createdate: 2024.12.21 10:40:37.252
lastmodifieddate: 2024.12.23 15:41:29.450
value:
"corpid='"+ st_corpid+"' "
iif( shzt==1, " verifierid is not null" , iif ( shzt==2, "verifierid is null ", ""))
"ym="+ym
"pzh like  '%"+pzh +"%' "


id: 67662aa599326bd179e4ee8f
pid: 676599b099326bd179e4ee62
name: dynamicwhere2_tokens
nodetype: column
createdate: 2024.12.21 10:40:37.256
lastmodifieddate: 2024.12.23 15:41:29.450
value:
{
    "\"corpid='\"+ st_corpid+\"' \"": "st_corpid",
    "iif( shzt==1, \" verifierid is not null\" , iif ( shzt==2, \"verifierid is null \", \"\"))": "shzt",
    "\"ym=\"+ym": "ym",
    "\"pzh like  '%\"+pzh +\"%' \"": "pzh"
}


id: 67662aa599326bd179e4ee8b
pid: 676599b099326bd179e4ee62
name: sql
nodetype: column
createdate: 2024.12.21 10:40:37.240
lastmodifieddate: 2024.12.23 15:41:29.451
value:
select
  dzpz_pz.*,
  1 as selected,
  '' as md5,
  '' as md5_client,
  0 as state,
  '' as info ,
  '' as filesize, 
  case when verifierid is null then  0  else 1  end as verified ,
  b.url_img  as url 
from
  dzpz_pz  left join app_archive b on ( dzpz_pz.gguid= b.gguid) 
where  
  dzpz_pz.corpid = ':st_corpid{00}'
  and  ym = :ym{202001}  
  and  isnull(deleteflag, 0) = 0
order by
  ym,
  pzh


# app_script

id: 676529ee9932b892918ce88c
pid: 6765298b9932b892918ce849
name: finalscript
namepath: /影像按月备份/客户机同步完一个文件后通知服务器的回调
fullname: /影像按月备份/客户机同步完一个文件后通知服务器的回调/finalscript
nodetype: column
createdate: 2024.12.20 16:27:25.140
lastmodifieddate: 2024.12.23 15:41:30.689
value:
function main(arg)
{
    var  p = JSON.parse(arg);
    println(p);

    
    pushMessage( "客户端同步文件进度", p  , p.userid ); 
    return 'over';
     

}


id: 6765245e9932b892918ce7b9
pid: 6765245e9932b892918ce7af
name: 获取上线的应用助手
code: getOnlinePrintAgents
namepath: /影像按月备份
fullname: /影像按月备份/获取上线的应用助手
nodetype: leaf
createdate: 2024.12.20 16:22:42.603
lastmodifieddate: 2024.12.23 15:41:30.689
value:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg)
{
    println( arg);
    var param= JSON.parse(arg);

    var list= getOnlinePrintAgents();
    var ret=[];
    for( var i=0;i<list.length;i++)
    {
        ret.push( list[i].name);
    }
    return ret.join('\n');
     

}


id: 6765245e9932b892918ce7f9
pid: 6765245e9932b892918ce7b9
name: functionGroup
nodetype: column
createdate: 2024.12.20 16:23:39.600
lastmodifieddate: 2024.12.23 15:41:30.692
value:
{"全局函数":[{"source":"function main(arg)","comment":"","group":"","caption":"","needRightControl":"","func":"main","funcTitle":"function main","index":0}]}


id: 6765298b9932b892918ce804
pid: 6765245e9932b892918ce7af
name: 得到客户端的指定目录的某个文件的MD5后的回调
code: callback_getFilesInfoInClientPath
namepath: /影像按月备份
fullname: /影像按月备份/得到客户端的指定目录的某个文件的MD5后的回调
nodetype: leaf
createdate: 2024.12.20 16:24:52.575
lastmodifieddate: 2024.12.23 15:41:30.692
value:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg)
{
    println( arg);
    var p= JSON.parse(arg);


    pushMessage( "客户端影像版本检查", p  , p.userid ); 
    return 'over';

}


id: 67662b5899326bd179e4ef79
pid: 6765976699326bd179e4ed85
name: functionGroup
nodetype: column
createdate: 2024.12.21 10:45:11.538
lastmodifieddate: 2024.12.23 15:41:31.246
value:
{"全局函数":[{"source":"function 影像主文档名称()","comment":"","group":"","caption":"","needRightControl":"","func":"影像主文档名称","funcTitle":"function 影像主文档名称","index":0},{"source":"function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path)","comment":"","group":"","caption":"","needRightControl":"","func":"获取客户机上指定目录下文件的哈希值","funcTitle":"function 获取客户机上指定目录下文件的哈希值","index":1},{"source":"function 获取服务器上文件的哈希值(corpid, ym, pz)","comment":"","group":"","caption":"","needRightControl":"","func":"获取服务器上文件的哈希值","funcTitle":"function 获取服务器上文件的哈希值","index":2},{"source":"function 同步(corpid, ym, clientName, path, data)","comment":"","group":"","caption":"","needRightControl":"","func":"同步","funcTitle":"function 同步","index":3},{"source":"function sizeFormat(bytesize)","comment":"","group":"","caption":"","needRightControl":"","func":"sizeFormat","funcTitle":"function sizeFormat","index":4},{"source":"function toFixed(number, n)","comment":"","group":"","caption":"","needRightControl":"","func":"toFixed","funcTitle":"function toFixed","index":5}]}


id: 6765976699326bd179e4ed85
pid: templateScriptOnServer
name: templateScriptOnServer-6765976699326bd179e4ed85
nodetype: leaf
lastmodifieddate: 2024.12.23 15:41:31.246
value:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println(ret);
            item.md5 = ret.MD5;
            item.fileSize = sizeFormat(ret.fileSize);
            println(item);

        }, function () {
            //pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function 同步(corpid, ym, clientName, path, data) {

    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    //通知客户端开始同步文件
    noticeClientToGetFiles(clientName,
        path,
        data,
        3,
        "callback_downloadedOneFile",
        {
            corpid: corpid,
            ym: ym,
            userid: currentUserId()
        }
    );

}

function sizeFormat(bytesize) {

    println('=====' + bytesize);

    var i = 0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while (bytesize >= 1024) {
        bytesize = bytesize / 1024;
        i++;
        if (i == 4) break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；
    println(bytesize);
    var units = ["Bytes", "KB", "MB", "GB", "TB"];
    var newsize = toFixed(bytesize, 2); // 日了狗了， round 不正常  //round( bytesize,2);
    println(newsize);
    return `${newsize}${units[i]}`;

}




function toFixed(number, n) {

    if (n > 32 || n < 0) {

        throw new RangeError('toFixed() digits argument must be between 0 and 32');

    }



    if (isNaN(number) || number >= Math.pow(10, 21)) {
        println('not number or  >>>> ');
        return number.toString();

    }


    //如果数字比保留的小数位还要小10倍，那么直接返回 0
    // 比如  0.001 保留2位小数，则直接就返回 0.00
    // 这个主要是解决，一些足够小的数被科学计数后，可能引起异常，
    // 比如  (-7400.00+ 7396.74 + 3.26) 结果是 -2.184918912462308e-13  , 会被本函数处理成 -2.18 ,这个就错大了
    // 科学计数法在下面转换时出现异常，所以对于足够小的数据 ，直接就返回 0



    if (Math.abs(number) < 1 / Math.pow(10, n + 1)) {
        if (n == 0) return '0';
        return '0.' + '0000000000000000000'.substring(0, n);
    }

    if (typeof (n) == 'undefined' || n == 0) {

        return (Math.round(number)).toString();

    }



    var bigThenZero = number > 0;

    var result = number.toString();

    var arr = result.split('.');



    // 整数的情况

    if (arr.length < 2) {

        result += '.';

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

            result += '0';

        }

        return result;

    }


    var integer = arr[0];

    var decimal = arr[1];

    if (decimal.length == n) {

        return result;

    }

    if (decimal.length < n) {

        for (var i = 0; i < n - decimal.length; i += 1) {

            result += '0';

        }

        return result;

    }

    result = integer + '.' + decimal.substr(0, n);

    var last = decimal.substr(n, 1);


    // 四舍五入，转换为整数再处理，避免浮点数精度的损失

    if (parseInt(last, 10) >= 5) {

        var x = Math.pow(10, n);

        result = (Math.round((parseFloat(result) * x)) + (bigThenZero ? 1 : -1)) / x;

        result = toFixed(result, n);

    }

    return result;

}


# app_script_history

id: 6765298b9932b892918ce7ff
scriptid: 6765245e9932b892918ce7b9
tablename: app_script
clientip: 61.164.47.194
username: sa
createdate: 2024.12.20 16:23:40.746
script:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg)
{
    println( arg);
    var param= JSON.parse(arg);

    return getOnlinePrintAgents();

}


id: 676529ee9932b892918ce88f
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 61.164.47.194
username: sa
createdate: 2024.12.20 16:27:25.454
script:
function main(arg)
{
    var p =JSON.parse(arg);
    if( p.progress!=undefined )  return p.progress; 


    var  one =  getFileMD5InFileServer('formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100004%28v6%29.pdf&fileName=190100004.pdf&serverIndex=1&action=view');
    one.url= getServiceHomeURL( 'app')+ '/'+one.url;
    one.name="190100004.pdf";

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67652ce19932557d565d651b
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 61.164.47.194
username: sa
createdate: 2024.12.20 16:40:39.143
script:
function main(arg)
{
    var p =JSON.parse(arg);
    if( p.progress!=undefined )  return p.progress; 


    var  one =  getFileMD5InFileServer('formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100004%28v6%29.pdf&fileName=190100004.pdf&serverIndex=1&action=view');
    one.url= getServiceHomeURL( 'app')+ '/'+one.url;
    one.name="190100004.pdf";

return url; 
    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67652ce19932557d565d6521
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 61.164.47.194
username: sa
createdate: 2024.12.20 16:40:53.356
script:
function main(arg)
{
    var p =JSON.parse(arg);
    if( p.progress!=undefined )  return p.progress; 


    var  one =  getFileMD5InFileServer('formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100004%28v6%29.pdf&fileName=190100004.pdf&serverIndex=1&action=view');
    one.url= getServiceHomeURL( 'app')+ '/'+one.url;
    one.name="190100004.pdf";

return one;

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67652ce19932557d565d6527
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 61.164.47.194
username: sa
createdate: 2024.12.20 16:41:25.861
script:
function main(arg)
{
    var p =JSON.parse(arg);
    if( p.progress!=undefined )  return p.progress; 


    var  one =  getFileMD5InFileServer('https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=view');
    one.url= getServiceHomeURL( 'app')+ '/'+one.url;
    one.name="190100004.pdf";

return one;

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67652ce19932557d565d652d
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 61.164.47.194
username: sa
createdate: 2024.12.20 16:41:46.038
script:
function main(arg)
{
    var p =JSON.parse(arg);
    if( p.progress!=undefined )  return p.progress; 


    var  one =  getFileMD5InFileServer('https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=view');
    
    return one; 
    one.url= getServiceHomeURL( 'app')+ '/'+one.url;
    one.name="190100004.pdf";

return one;

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67652ce19932557d565d6533
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 61.164.47.194
username: sa
createdate: 2024.12.20 16:42:23.470
script:
function main(arg)
{
    var p =JSON.parse(arg);
    if( p.progress!=undefined )  return p.progress; 


    var  one =  getFileMD5InFileServer('https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=view');
    
    
    one.url=  "https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=view";
    one.name="190100004.pdf";

 

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67663fe29932c867f3c25d2c
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 12:29:59.941
script:
function   影像主文档名称()
{
    return  getProperty( '/影像名称/主文档名称', '凭证') ;
}

function 获取客户机上指定目录下文件的哈希值(clientName , path)
{
    return getFilesInfoInClientPath(clientName, path , 3,
             10*60*1000 , 
             'callback_getFilesInfoInClientPath',
             {currentUserId: currentUserId( ) }
             );

}


id: 67652ce19932557d565d6541
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 122.233.206.66
username: sa
createdate: 2024.12.20 21:17:40.755
script:
function main(arg)
{
    var p =JSON.parse(arg);
    if( p.progress!=undefined )  return p.progress; 


    var  one =  getFileMD5InFileServer('https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=view');
    
    return one; 
    
    one.url=  "https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=view";
    one.name="190100004.pdf";

 

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67652ce19932557d565d6547
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 122.233.206.66
username: sa
createdate: 2024.12.20 21:19:29.741
script:
function main(arg)
{
    var p =JSON.parse(arg);
    if( p.progress!=undefined )  return p.progress; 


    var  one =  getFileMD5InFileServer('https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=download');
    
    return one; 

    one.url=  "https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=view";
    one.name="190100004.pdf";

 

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67657d879932947ff2d715c4
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 122.233.206.66
username: sa
createdate: 2024.12.20 22:38:01.643
script:
function main(arg)
{
    var p =JSON.parse(arg);
    if( p.progress!=undefined )  return p.progress; 

 

    var  cfg=  getFilesInfoInClientPath("EA92", "c:/temp", 3, null );

    return cfg; 
    



    var  one =  getFileMD5InFileServer('https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=download');
    
    return one; 

    one.url=  "https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=view";
    one.name="190100004.pdf";

 

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67657d879932947ff2d715d2
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 122.233.206.66
username: sa
createdate: 2024.12.20 22:39:25.356
script:
function main(arg)
{
    var p =JSON.parse(arg);
    if( p.progress!=undefined )  return p.progress; 

 

    var  cfg=  getFilesInfoInClientPath("EA92", "c:/temp", 3, null );

    println ( cfg ); 



    var  one =  getFileMD5InFileServer('https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=download');
    
    return one; 

    one.url=  "https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=view";
    one.name="190100004.pdf";

 

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67657d879932947ff2d715d8
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 122.233.206.66
username: sa
createdate: 2024.12.20 22:40:06.953
script:
function main(arg)
{
    var p =JSON.parse(arg);
    if( p.progress!=undefined )  return p.progress; 

 

    var  cfg=  getFilesInfoInClientPath("EA92", "c:/temp", 3, null );

    println ( cfg ); 



    var  one =  getFileMD5InFileServer('https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=download');
    
    return one; 

     
    one.name="190100004.pdf";

 

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67657d879932947ff2d715de
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 122.233.206.66
username: sa
createdate: 2024.12.20 22:40:34.344
script:
function main(arg)
{
    var p =JSON.parse(arg);
    if( p.progress!=undefined )  return p.progress; 

 

    var  cfg=  getFilesInfoInClientPath("EA92", "c:/temp", 3, null );

    println ( cfg ); 



    var  one =  getFileMD5InFileServer('https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=download');
    
       
    one.name="190100004.pdf";

 

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67657d879932947ff2d715e4
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 122.233.206.66
username: sa
createdate: 2024.12.20 22:41:24.552
script:
function main(arg)
{
    var p =JSON.parse(arg);
    if( p.progress!=undefined )  return p.progress; 

 

    var  cfg=  getFilesInfoInClientPath("EA92", "c:/temp", 3, null );

    println ( cfg ); 



    var  one =  getFileMD5InFileServer('https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=download');
    
       
    one.name="190100004.pdf";

   println( one);

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67658ffb9932e80a393cc3ef
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 122.233.206.66
username: sa
createdate: 2024.12.20 23:52:59.040
script:
function main(arg)
{
    var p =JSON.parse(arg);
    if( p.progress!=undefined )  return p.progress; 

 

    var  cfg=  getFilesInfoInClientPath("EA92", "c:/temp", 3, null );

    println ( cfg ); 
    



    var  one =  getFileMD5InFileServer('https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=download');
    
       
    one.name="190100004.pdf";

    println( one);
    return one; 

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67663fe29932c867f3c25d32
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 12:31:10.752
script:
function   影像主文档名称()
{
    return  getProperty( '/影像名称/主文档名称', '凭证') ;
}

function 获取客户机上指定目录下文件的哈希值(clientName , path)
{
    return getFilesInfoInClientPath(clientName, path , 3,
             10*60*1000 , 
             'callback_getFilesInfoInClientPath',
             { userid: currentUserId( ) }
             );

}


id: 67658ffb9932e80a393cc3f9
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 122.233.206.66
username: sa
createdate: 2024.12.20 23:55:16.337
script:
function main(arg)
{
    var p =JSON.parse(arg);
    if( p.progress!=undefined )  return p.progress; 

 

   // var  cfg=  getFilesInfoInClientPath("EA92", "c:/temp", 3, null );

   // println ( cfg ); 
    



    var  one =  getFileMD5InFileServer('https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=download');
    
       
    one.name="190100004.pdf";

    println( one);
    return one; 

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67658ffb9932e80a393cc3ff
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 122.233.206.66
username: sa
createdate: 2024.12.20 23:55:23.954
script:
function main(arg)
{
  

 

   // var  cfg=  getFilesInfoInClientPath("EA92", "c:/temp", 3, null );

   // println ( cfg ); 
    



    var  one =  getFileMD5InFileServer('https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=download');
    
       
    one.name="190100004.pdf";

    println( one);
    return one; 

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 6765976699326bd179e4ed66
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 122.233.206.66
username: sa
createdate: 2024.12.21 00:14:25.356
script:
function main(arg)
{
  

 

   var  cfg=  getFilesInfoInClientPath("EA92", "c:/temp", 3, null );

    println ( cfg ); 
    



    var  one =  getFileMD5InFileServer('https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=download');
    
       
    one.name="190100004.pdf";

    println( one);
    return one; 

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 676599b099326bd179e4ee56
scriptid: 6765298b9932b892918ce849
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 10:33:17.949
script:
function main(arg)
{
  

 

   var  cfg=  getFilesInfoInClientPath("EA92", "c:/temp", 3, null );

    println ( cfg ); 
    
 

    var  one =  getFileMD5InFileServer('https://archive.wiccloud.cn/formEngine/fileServer?bucketName=default&objectName=%E5%87%AD%E8%AF%81%E5%BD%92%E6%A1%A3%2F00%2F201901%2F190100003%28v5%29.pdf&fileName=190100003.pdf&serverIndex=1&action=download');
    
       
    one.name="190100004.pdf";

    println( one);
     

    noticeClientToGetFiles( "EA92", "c:/temp",   [one] , 1 , "downloadOver");

    return 'over';

}


id: 67662b5899326bd179e4ef70
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 10:44:50.897
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) { 
        book.sheet0.cells('archiveTypeName').setValue(v); 
        
        gs_archiveTypeName=v ; 
        });
}


id: 676633e399326bd179e4f103
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 11:33:09.945
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) { 
        book.sheet0.cells('archiveTypeName').setValue(v); 
        
        gs_archiveTypeName=v ; 
        });
}



function  cb_check_onClick()
{
    if( book.sheet0.cells('clientName')).getValueString()==''))
    {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false; 
    }

    if( book.sheet0.cells('path')).getValueString()==''))
    {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false; 
    }
    
}


id: 676633e399326bd179e4f107
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 11:33:32.733
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) { 
        book.sheet0.cells('archiveTypeName').setValue(v); 
        
        gs_archiveTypeName=v ; 
        });
}



function  cb_check_onClick()
{
    if( book.sheet0.cells('clientName').getValueString()=='')
    {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false; 
    }

    if( book.sheet0.cells('path').getValueString()=='')
    {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false; 
    }
    
}


id: 676633e399326bd179e4f10b
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 11:36:05.221
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) { 
        book.sheet0.cells('archiveTypeName').setValue(v); 
        
        gs_archiveTypeName=v ; 
        });
}



function  cb_check_onClick()
{
    let clientName= book.sheet0.cells('clientName').getValueString();
    if( clientName =='')
    {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false; 
    }

    let path=  book.sheet0.cells('path').getValueString();
    if( path =='')
    {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false; 
    }

    
    获取客户机上指定目录下文件的哈希值( clientName , path , function(ret)
    {
        
    });
}


id: 676638a899326bd179e4f13a
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 11:40:25.156
script:
function   影像主文档名称()
{
    return  getProperty( '/影像名称/主文档名称', '凭证') ;
}

function 获取客户机上指定目录下文件的哈希值(clientName , path)
{
    getFilesInfoInClientPath(clientName, path , 3, 10*60*1000 , 'callback_getFilesInfoInClientPath');
    
}


id: 676638a899326bd179e4f140
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 11:40:47.253
script:
function   影像主文档名称()
{
    return  getProperty( '/影像名称/主文档名称', '凭证') ;
}

function 获取客户机上指定目录下文件的哈希值(clientName , path)
{
    return getFilesInfoInClientPath(clientName, path , 3, 10*60*1000 , 'callback_getFilesInfoInClientPath');

}


id: 676638a899326bd179e4f149
scriptid: 6765298b9932b892918ce804
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 12:03:57.660
script:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg)
{
    println( arg);
    var param= JSON.parse(arg);

    pushMessage( "客户端影像版本检查", param , -1); 

}


id: 67663fe29932c867f3c25d38
scriptid: 6765298b9932b892918ce804
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 12:31:18.266
script:
/**
 * 脚本中心的脚本，以 main函数为执行入口，相关的参数放在arg中，它是一个JSON字符串化后的数据
 *
 */
function main(arg)
{
    println( arg);
    var p= JSON.parse(arg);


    pushMessage( "客户端影像版本检查", p.file , p.userid ); 

}


id: 67663fe29932c867f3c25d3d
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 12:31:56.346
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) { 
        book.sheet0.cells('archiveTypeName').setValue(v); 
        
        gs_archiveTypeName=v ; 
        });

    onPushMessage( '客户端影像版本检查' , function(p)
    {
        console.dir(p);
    } ) ;    
}



function  cb_check_onClick()
{
    let clientName= book.sheet0.cells('clientName').getValueString();
    if( clientName =='')
    {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false; 
    }

    let path=  book.sheet0.cells('path').getValueString();
    if( path =='')
    {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false; 
    }

    
    获取客户机上指定目录下文件的哈希值( clientName , path , function(ret)
    {
        
    });
}


id: 67663fe29932c867f3c25d41
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 12:32:09.189
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) { 
        book.sheet0.cells('archiveTypeName').setValue(v); 
        
        gs_archiveTypeName=v ; 
        });

    onPushMessage( '客户端影像版本检查' , function(p)
    {
        console.dir(p);
    } ) ;    
}



function  cb_check_onClick()
{
    let clientName= book.sheet0.cells('clientName').getValueString();
    if( clientName =='')
    {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false; 
    }

    let path=  book.sheet0.cells('path').getValueString();
    if( path =='')
    {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false; 
    }

    
    获取客户机上指定目录下文件的哈希值( clientName , path , function(ret)
    {
        console.dir( ret);
    });
}


id: 67666bbb9932c2606d83859b
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 15:32:03.739
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) { 
        book.sheet0.cells('archiveTypeName').setValue(v); 
        
        gs_archiveTypeName=v ; 
        });

    onPushMessage( '客户端影像版本检查' , function(p)
    {
        console.dir(p);
    } ) ;    
}



function  cb_check_onClick()
{
    let corpid= book.shee0.cells("corpid").getValueString();
    if( corpid =='')
    {
        toastr.error("请选择帐套");
        return false; 
    }

    let ym= book.shee0.cells("ym").getValueString();
    if( ym =='')
    {
        toastr.error("请选择年月");
        return false; 
    }
    

    let clientName= book.sheet0.cells('clientName').getValueString();
    if( clientName =='')
    {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false; 
    }

    let path=  book.sheet0.cells('path').getValueString();
    if( path =='')
    {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false; 
    }

    
    获取客户机上指定目录下文件的哈希值( corpid, ym, clientName , path , function(ret)
    {
        console.dir( ret);
    });
}


id: 67666bbb9932c2606d8385a4
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 15:33:53.439
script:
function   影像主文档名称()
{
    return  getProperty( '/影像名称/主文档名称', '凭证') ;
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName , path)
{
    if( ! path.endsWidth('/') && ! path.endsWith('\\')) path= path+"/";
    path=path+corid+"/"+ym; 
    
    return getFilesInfoInClientPath(clientName, path , 3,
             10*60*1000 , 
             'callback_getFilesInfoInClientPath',
             { userid: currentUserId( ) , 
             coprid:corpid,
              ym:ym  }
             );

}


id: 67666bbb9932c2606d8385ae
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 15:35:44.656
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) { 
        book.sheet0.cells('archiveTypeName').setValue(v); 
        
        gs_archiveTypeName=v ; 
        });

    onPushMessage( '客户端影像版本检查' , function(p)
    {
        console.dir(p);
    } ) ;    
}



function  cb_check_onClick()
{
    let corpid= book.sheet0.cells("corpid").getValueString();
    if( corpid =='')
    {
        toastr.error("请选择帐套");
        return false; 
    }

    let ym= book.sheet0.cells("ym").getValueString();
    if( ym =='')
    {
        toastr.error("请选择年月");
        return false; 
    }
    

    let clientName= book.sheet0.cells('clientName').getValueString();
    if( clientName =='')
    {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false; 
    }

    let path=  book.sheet0.cells('path').getValueString();
    if( path =='')
    {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false; 
    }

    
    获取客户机上指定目录下文件的哈希值( corpid, ym, clientName , path , function(ret)
    {
        console.dir( ret);
    });
}


id: 67666bbb9932c2606d8385b4
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 15:39:27.252
script:
function   影像主文档名称()
{
    return  getProperty( '/影像名称/主文档名称', '凭证') ;
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName , path)
{
    if( ! path.endsWith('/') && ! path.endsWith('\\')) path= path+"/";
    path=path+corid+"/"+ym; 
    
    return getFilesInfoInClientPath(clientName, path , 3,
             10*60*1000 , 
             'callback_getFilesInfoInClientPath',
             { userid: currentUserId( ) , 
             coprid:corpid,
              ym:ym  }
             );

}


id: 67666bbb9932c2606d8385c0
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 15:40:44.762
script:
function   影像主文档名称()
{
    return  getProperty( '/影像名称/主文档名称', '凭证') ;
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName , path)
{
    if( ! path.endsWith('/') && ! path.endsWith('\\')) path= path+"/";
    path=path+corpid+"/"+ym; 
    
    return getFilesInfoInClientPath(clientName, path , 3,
             10*60*1000 , 
             'callback_getFilesInfoInClientPath',
             { userid: currentUserId( ) , 
             coprid:corpid,
              ym:ym  }
             );

}


id: 67666bbb9932c2606d8385c4
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 15:41:56.907
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) { 
        book.sheet0.cells('archiveTypeName').setValue(v); 
        
        gs_archiveTypeName=v ; 
        });

    onPushMessage( '客户端影像版本检查' , function(p)
    {
        console.dir(p);
    } ) ;    
}



function  cb_check_onClick()
{
    let corpid= book.sheet0.cells("corpid").getValueString();
    if( corpid =='')
    {
        toastr.error("请选择帐套");
        return false; 
    }

    let ym= book.sheet0.cells("ym").getValueString();
    if( ym =='')
    {
        toastr.error("请选择年月");
        return false; 
    }
    

    let clientName= book.sheet0.cells('clientName').getValueString();
    if( clientName =='')
    {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false; 
    }

    let path=  book.sheet0.cells('path').getValueString();
    if( path =='')
    {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false; 
    }

    
    获取客户机上指定目录下文件的哈希值( corpid, ym, clientName , path , function(ret)
    {
        console.dir( ret);
        toastr.success("检测完成");
    });
}


id: 67666bbb9932c2606d8385c8
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 15:46:19.631
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) { 
        book.sheet0.cells('archiveTypeName').setValue(v); 
        
        gs_archiveTypeName=v ; 
        });

    onPushMessage( '客户端影像版本检查' , function(p)
    {
        console.dir(p);

    } ) ;    
}



function  cb_check_onClick()
{
    let corpid= book.sheet0.cells("corpid").getValueString();
    if( corpid =='')
    {
        toastr.error("请选择帐套");
        return false; 
    }

    let ym= book.sheet0.cells("ym").getValueString();
    if( ym =='')
    {
        toastr.error("请选择年月");
        return false; 
    }
    

    let clientName= book.sheet0.cells('clientName').getValueString();
    if( clientName =='')
    {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false; 
    }

    let path=  book.sheet0.cells('path').getValueString();
    if( path =='')
    {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false; 
    }

    
    获取客户机上指定目录下文件的哈希值( corpid, ym, clientName , path , function(ret)
    {
        console.dir( ret);
        book.sheet1.paintPermit=false;
        for( let i=0;i< $dzpz_pz_ds.rowCount;i++)
        {
            if( $dzpz_pz_ds.getInt(i,"")==0) 
            {
                if( $dzpz_pz_ds.getInt(i,"varified")==1)
                { 
                    $dzpz_pz_ds.setValue(i,"state",2);
                }else{
                    $dzpz_pz_ds.setValue(i,"state",4);
                }

        }

        book.sheet1.paintPermit=true; 
        toastr.success("检测完成");
    });
}


id: 67666bbb9932c2606d8385cc
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 15:46:25.398
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) { 
        book.sheet0.cells('archiveTypeName').setValue(v); 
        
        gs_archiveTypeName=v ; 
        });

    onPushMessage( '客户端影像版本检查' , function(p)
    {
        console.dir(p);

    } ) ;    
}



function  cb_check_onClick()
{
    let corpid= book.sheet0.cells("corpid").getValueString();
    if( corpid =='')
    {
        toastr.error("请选择帐套");
        return false; 
    }

    let ym= book.sheet0.cells("ym").getValueString();
    if( ym =='')
    {
        toastr.error("请选择年月");
        return false; 
    }
    

    let clientName= book.sheet0.cells('clientName').getValueString();
    if( clientName =='')
    {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false; 
    }

    let path=  book.sheet0.cells('path').getValueString();
    if( path =='')
    {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false; 
    }

    
    获取客户机上指定目录下文件的哈希值( corpid, ym, clientName , path , function(ret)
    {
        console.dir( ret);
        book.sheet1.paintPermit=false;
        for( let i=0;i< $dzpz_pz_ds.rowCount;i++)
        {
            if( $dzpz_pz_ds.getInt(i,"")==0) 
            {
                if( $dzpz_pz_ds.getInt(i,"varified")==1)
                { 
                    $dzpz_pz_ds.setValue(i,"state",2);
                }else{
                    $dzpz_pz_ds.setValue(i,"state",4);
                }
            }

        }

        book.sheet1.paintPermit=true; 
        toastr.success("检测完成");
    });
}


id: 67666bbb9932c2606d8385d0
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 15:46:34.528
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) { 
        book.sheet0.cells('archiveTypeName').setValue(v); 
        
        gs_archiveTypeName=v ; 
        });

    onPushMessage( '客户端影像版本检查' , function(p)
    {
        console.dir(p);

    } ) ;    
}



function  cb_check_onClick()
{
    let corpid= book.sheet0.cells("corpid").getValueString();
    if( corpid =='')
    {
        toastr.error("请选择帐套");
        return false; 
    }

    let ym= book.sheet0.cells("ym").getValueString();
    if( ym =='')
    {
        toastr.error("请选择年月");
        return false; 
    }
    

    let clientName= book.sheet0.cells('clientName').getValueString();
    if( clientName =='')
    {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false; 
    }

    let path=  book.sheet0.cells('path').getValueString();
    if( path =='')
    {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false; 
    }

    
    获取客户机上指定目录下文件的哈希值( corpid, ym, clientName , path , function(ret)
    {
        console.dir( ret);
        book.sheet1.paintPermit=false;
        for( let i=0;i< $dzpz_pz_ds.rowCount;i++)
        {
            if( $dzpz_pz_ds.getInt(i,"state")==0) 
            {
                if( $dzpz_pz_ds.getInt(i,"varified")==1)
                { 
                    $dzpz_pz_ds.setValue(i,"state",2);
                }else{
                    $dzpz_pz_ds.setValue(i,"state",4);
                }
            }

        }

        book.sheet1.paintPermit=true; 
        toastr.success("检测完成");
    });
}


id: 676673509932c2606d83861b
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 15:52:29.263
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) { 
        book.sheet0.cells('archiveTypeName').setValue(v); 
        
        gs_archiveTypeName=v ; 
        });

    onPushMessage( '客户端影像版本检查' , function(p)
    {
        console.dir(p);

    } ) ;    
}



function  cb_check_onClick(  )
{
    stateCheck();
}


function stateCheck( afterCheck)
{
    let corpid= book.sheet0.cells("corpid").getValueString();
    if( corpid =='')
    {
        toastr.error("请选择帐套");
        return false; 
    }

    let ym= book.sheet0.cells("ym").getValueString();
    if( ym =='')
    {
        toastr.error("请选择年月");
        return false; 
    }
    

    let clientName= book.sheet0.cells('clientName').getValueString();
    if( clientName =='')
    {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false; 
    }

    let path=  book.sheet0.cells('path').getValueString();
    if( path =='')
    {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false; 
    }

    
    获取客户机上指定目录下文件的哈希值( corpid, ym, clientName , path , function(ret)
    {
        console.dir( ret);
        book.sheet1.paintPermit=false;
        for( let i=0;i< $dzpz_pz_ds.rowCount;i++)
        {
            if( $dzpz_pz_ds.getInt(i,"state")==0) 
            {
                if( $dzpz_pz_ds.getInt(i,"varified")==1)
                { 
                    $dzpz_pz_ds.setValue(i,"state",2);
                }else{
                    $dzpz_pz_ds.setValue(i,"state",4);
                }
            }

        }

        book.sheet1.paintPermit=true; 
        toastr.success("检测完成");
        if( afterCheck) afterCheck();
    });
}


id: 676673509932c2606d838631
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 16:06:19.101
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });
}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient =   new Promise( (resolve, reject) => {
   

        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                if ($dzpz_pz_ds.getInt(i, "state") == 0) {
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                        $dzpz_pz_ds.setValue(i, "state", 2);
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }

            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            resolve(0);
        });
    });


}


function cb_sync_onClick() {

    stateCheck(doSync);
}

function doSync() {
    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {

    });

}


id: 676679e19932c2606d83870b
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 16:25:23.285
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });
}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                if ($dzpz_pz_ds.getInt(i, "state") == 0) {
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                        $dzpz_pz_ds.setValue(i, "state", 2);
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pzh = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pzh.push({
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url_img")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pzh, function (ret) {

        });

    });


}


function cb_sync_onClick() {

    stateCheck(doSync);
}

function doSync() {
    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {

    });

}


id: 676679e19932c2606d838711
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 16:25:44.336
script:
function   影像主文档名称()
{
    return  getProperty( '/影像名称/主文档名称', '凭证') ;
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName , path)
{
    if( ! path.endsWith('/') && ! path.endsWith('\\')) path= path+"/";
    path=path+corpid+"/"+ym; 
    
    return getFilesInfoInClientPath(clientName, path , 3,
             10*60*1000 , 
             'callback_getFilesInfoInClientPath',
             { userid: currentUserId( ) , 
             coprid:corpid,
              ym:ym  }
             );

}


function 获取服务器上文件的哈希值(corpid, ym, pz)
{

}


id: 67667b939932c2606d838715
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 16:25:55.183
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });
}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                if ($dzpz_pz_ds.getInt(i, "state") == 0) {
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                        $dzpz_pz_ds.setValue(i, "state", 2);
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz  = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url_img")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pzh, function (ret) {

        });

    });


}


function cb_sync_onClick() {

    stateCheck(doSync);
}

function doSync() {
    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {

    });

}


id: 67667b939932c2606d838719
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 16:26:03.205
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });
}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                if ($dzpz_pz_ds.getInt(i, "state") == 0) {
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                        $dzpz_pz_ds.setValue(i, "state", 2);
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz  = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url_img")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz , function (ret) {

        });

    });


}


function cb_sync_onClick() {

    stateCheck(doSync);
}

function doSync() {
    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {

    });

}


id: 67667b939932c2606d83871d
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 16:27:36.058
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });
}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                if ($dzpz_pz_ds.getInt(i, "state") == 0) {
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                        $dzpz_pz_ds.setValue(i, "state", 2);
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz  = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url_img")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz , function (ret) {

        });

    });


}


function cb_sync_onClick() {

    stateCheck(doSync);
}

function doSync() {
    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {

    });

}


id: 67667b939932c2606d838723
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 16:35:04.141
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            item.md5 = ret.md5;

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


id: 67667b939932c2606d838729
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 16:35:19.153
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println(ret);
            item.md5 = ret.md5;

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


id: 67667b939932c2606d83872d
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 16:37:55.120
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg=JSON.parse(jsg);
        if( msg.action=='info')  showInfoPane( msg.message) ;
        if( msg.action='over')  hideInfoPane(   ) ;
    });



}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                if ($dzpz_pz_ds.getInt(i, "state") == 0) {
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                        $dzpz_pz_ds.setValue(i, "state", 2);
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url_img")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {

        });

    });


}


function cb_sync_onClick() {

    stateCheck(doSync);
}

function doSync() {
    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {

    });

}


id: 67667b939932c2606d838731
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 16:39:15.889
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg=JSON.parse(jsg);
        if( msg.action=='info')  showInfoPane( msg.message) ;
        if( msg.action='over')  hideInfoPane(   ) ;
    });



}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                if ($dzpz_pz_ds.getInt(i, "state") == 0) {
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                        $dzpz_pz_ds.setValue(i, "state", 2);
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url_img")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for( let i=0;i< ret.length;i++)
            {
                let one = ret[i];
                $dzpz_pz_ds.setValue( one.row , 'md5' , one.md5 );
            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });


}


function cb_sync_onClick() {

    stateCheck(doSync);
}

function doSync() {
    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {

    });

}


id: 67667b939932c2606d838735
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 16:44:41.711
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(jsg);
        if (msg.action == 'info') showInfoPane(msg.message);
        if (msg.action = 'over') hideInfoPane();
    });



}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url_img")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer]).then(function () {
        book.sheet1.paintPermit = false;
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
  
            if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                    if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                        $dzpz_pz_ds.setValue(i, "state", 1);
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 2);
                    }
                } else {
                    $dzpz_pz_ds.setValue(i, "state", 4);
                }
            }
        }

        book.sheet1.paintPermit = true;
        toastr.success("客户端检测完成");
    });


}


function cb_sync_onClick() {

    stateCheck(doSync);
}

function doSync() {
    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {

    });

}


id: 67667b939932c2606d838739
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 16:48:41.318
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(jsg);
        if (msg.action == 'info') showInfoPane(msg.message);
        if (msg.action = 'over') hideInfoPane();
    });



}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url_img")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck();
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync() {

    //把等待同步的影像整理出来 ，开始同步
    let pz=[];
     for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

                  pz.push({
                    row: i, //行号记录下来
                    name: $dzpz_pz_ds.getString(i, "pzh")+".pdf",
                    url: $dzpz_pz_ds.getString(i, "url_img")
                }
                }
     }

}


id: 67667b939932c2606d83873d
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 16:57:52.513
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(jsg);
        if (msg.action == 'info') showInfoPane(msg.message);
        if (msg.action = 'over') hideInfoPane();
    });



}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url_img")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck();
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync() {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: $dzpz_pz_ds.getString(i, "url_img")
            });
        }
    }

}


id: 67667b939932c2606d838741
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 16:59:27.909
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        
        if (msg.action == 'info') showInfoPane(msg.message);
        if (msg.action = 'over') hideInfoPane();
    });



}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url_img")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck();
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync() {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: $dzpz_pz_ds.getString(i, "url_img")
            });
        }
    }

}


id: 67667b939932c2606d838745
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 17:00:58.542
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        
        if (msg.action == 'info') showInfoPane(msg.message);
        if (msg.action = 'over') hideInfoPane();
    });



}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 2) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url_img")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck();
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync() {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: $dzpz_pz_ds.getString(i, "url_img")
            });
        }
    }

}


id: 6766847e9932c2606d8387b6
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 17:04:14.956
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        
        if (msg.action == 'info') showInfoPane(msg.message);
        if (msg.action = 'over') hideInfoPane();
    });



}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck();
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync() {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: $dzpz_pz_ds.getString(i, "url_img")
            });
        }
    }

}


id: 6766847e9932c2606d8387bc
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 17:10:47.049
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println(ret);
            item.md5 = ret.MD5;
            item.fileSize = formatBytes( ret.fileSize) 

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}



function formatBytes(bytes) {
    const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
    if (bytes === 0) return '0 Bytes';
    const i = Math.floor(Math.log(bytes) / Math.log(1024));
    return parseFloat((bytes / Math.pow(1024, i)).toFixed(2)) + ' ' + sizes[i];
}


id: 676686339932c2606d83880a
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 17:11:44.150
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        
        if (msg.action == 'info') showInfoPane(msg.message);
        if (msg.action = 'over') hideInfoPane();
    });



}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);
                
            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck();
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync() {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: $dzpz_pz_ds.getString(i, "url_img")
            });
        }
    }

}


id: 676686339932c2606d838810
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 17:15:25.546
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println(ret);
            item.md5 = ret.MD5;
            item.fileSize = formatBytes( ret.fileSize) ;

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}



function formatBytes(bytes) {
    const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
    if (bytes === 0) return '0 Bytes';
    const i = Math.floor(Math.log(bytes) / Math.log(1024));
    return parseFloat((bytes / Math.pow(1024, i)).toFixed(2)) + ' ' + sizes[i];
}


id: 676686339932c2606d838816
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 17:15:42.991
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
           
            item.md5 = ret.MD5;
            item.fileSize = formatBytes( ret.fileSize) ;
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}



function formatBytes(bytes) {
    const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
    if (bytes === 0) return '0 Bytes';
    const i = Math.floor(Math.log(bytes) / Math.log(1024));
    return parseFloat((bytes / Math.pow(1024, i)).toFixed(2)) + ' ' + sizes[i];
}


id: 676686339932c2606d83881c
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 17:18:12.133
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
           
            item.md5 = ret.MD5;
            item.fileSize = formatBytes( ret.fileSize) ;
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}



function formatBytes(bytes) {
    var sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
    if (bytes === 0) return '0 Bytes';
    var i = Math.floor(Math.log(bytes) / Math.log(1024));
    return parseFloat((bytes / Math.pow(1024, i)).toFixed(2)) + ' ' + sizes[i];
}


id: 676686339932c2606d838822
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 17:22:51.049
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
           
            item.md5 = ret.MD5;
            item.fileSize = formatBytes( ret.fileSize) ;
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function sizeFormat( bytesize){
    var i=0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while(  bytesize >=1024){       
         bytesize= bytesize/1024;
         i++;
        if( i==4)break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；

    var units= [  "Bytes","KB","MB","GB","TB" ];
    var newsize= round( bytesize,2);
    return  `${newsize}${units[i]}` ;

}


id: 676686339932c2606d838828
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 17:22:56.555
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
           
            item.md5 = ret.MD5;
            item.fileSize = sizeFormat( ret.fileSize) ;
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function sizeFormat( bytesize){
    var i=0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while(  bytesize >=1024){       
         bytesize= bytesize/1024;
         i++;
        if( i==4)break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；

    var units= [  "Bytes","KB","MB","GB","TB" ];
    var newsize= round( bytesize,2);
    return  `${newsize}${units[i]}` ;

}


id: 676686339932c2606d83882e
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 17:25:13.386
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
           println( ret);
            item.md5 = ret.MD5;
            item.fileSize = sizeFormat( ret.fileSize) ;
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function sizeFormat( bytesize){
    var i=0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while(  bytesize >=1024){       
         bytesize= bytesize/1024;
         i++;
        if( i==4)break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；

    var units= [  "Bytes","KB","MB","GB","TB" ];
    var newsize= round( bytesize,2);
    return  `${newsize}${units[i]}` ;

}


id: 676686339932c2606d838834
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 17:26:36.235
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println( ret);
            item.md5 = ret.MD5;
            item.fileSize = sizeFormat( ret.fileSize ) ;
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function sizeFormat( bytesize){

    println('=====' +  bytesize);
    
    var i=0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while(  bytesize >=1024){       
         bytesize= bytesize/1024;
         i++;
        if( i==4)break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；

    var units= [  "Bytes","KB","MB","GB","TB" ];
    var newsize= round( bytesize,2);
    return  `${newsize}${units[i]}` ;

}


id: 676686339932c2606d83883a
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 17:28:00.639
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println( ret);
            item.md5 = ret.MD5;
            item.fileSize = sizeFormat( ret.fileSize ) ;
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function sizeFormat( bytesize){

    println('=====' +  bytesize);

    var i=0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while(  bytesize >=1024){       
         bytesize= bytesize/1024;
         i++;
        if( i==4)break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；
   println( bytesize);
    var units= [  "Bytes","KB","MB","GB","TB" ];
    var newsize= round( bytesize,2);
    return  `${newsize}${units[i]}` ;

}


id: 67668a329932c2606d838840
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 17:28:19.149
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println( ret);
            item.md5 = ret.MD5;
            item.fileSize = sizeFormat( ret.fileSize ) ;
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function sizeFormat( bytesize){

    println('=====' +  bytesize);

    var i=0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while(  bytesize >=1024){       
         bytesize= bytesize/1024;
         i++;
        if( i==4)break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；
   println( bytesize);
    var units= [  "Bytes","KB","MB","GB","TB" ];
    var newsize= round( bytesize,2);
    println( newsize);
    return  `${newsize}${units[i]}` ;

}


id: 67668fa19932c2606d8388fc
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:11:25.840
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println( ret);
            item.md5 = ret.MD5;
            item.fileSize = sizeFormat( ret.fileSize ) ;
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function sizeFormat( bytesize){

    println('=====' +  bytesize);

    var i=0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while(  bytesize >=1024){       
         bytesize= bytesize/1024;
         i++;
        if( i==4)break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；
   println( bytesize);
    var units= [  "Bytes","KB","MB","GB","TB" ];
    var newsize=  toFixed( bytesize,2); // 日了狗了， round 不正常  //round( bytesize,2);
    println( newsize);
    return  `${newsize}${units[i]}` ;

} 




function toFixed  (number, n) {

    if (n > 32 || n < 0) {

        throw new RangeError('toFixed() digits argument must be between 0 and 32');

    }



    if (isNaN(number) || number >= Math.pow(10, 21)) {
        println( 'not number or  >>>> ');
        return number.toString();

    }


    //如果数字比保留的小数位还要小10倍，那么直接返回 0
    // 比如  0.001 保留2位小数，则直接就返回 0.00
    // 这个主要是解决，一些足够小的数被科学计数后，可能引起异常，
    // 比如  (-7400.00+ 7396.74 + 3.26) 结果是 -2.184918912462308e-13  , 会被本函数处理成 -2.18 ,这个就错大了
    // 科学计数法在下面转换时出现异常，所以对于足够小的数据 ，直接就返回 0



    if( Math.abs(number)< 1/ Math.pow(10,n+1))
    {
        if( n==0) return '0';
        return '0.' + '0000000000000000000'.substring(0,n);
    }

    if (typeof (n) == 'undefined' || n == 0) {

        return (Math.round(number)).toString();

    }



    var bigThenZero= number>0;

    var result = number.toString();

    var arr = result.split('.');



    // 整数的情况

    if (arr.length < 2) {

        result += '.';

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

            result += '0';

        }

        return result;

    }


    var integer = arr[0];

    var decimal = arr[1];

    if (decimal.length == n) {

        return result;

    }

    if (decimal.length < n) {

        for (var i = 0; i < n - decimal.length; i += 1) {

            result += '0';

        }

        return result;

    }

    result = integer + '.' + decimal.substr(0, n);

    var last = decimal.substr(n, 1);
 

    // 四舍五入，转换为整数再处理，避免浮点数精度的损失

    if (parseInt(last, 10) >= 5) {

        var x = Math.pow(10, n);

        result = (Math.round((parseFloat(result) * x)) +  (bigThenZero?1:-1)) / x;

        result =  toFixed ( result , n);

    }

    return result;

}


id: 676694e19932c2606d838930
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:18:05.213
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg= JSON.parse(msg);
        if (msg.action == 'info') showInfoPane(msg.message);
        if (msg.action = 'over') hideInfoPane();
    });



}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);
                
            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck();
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync() {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: $dzpz_pz_ds.getString(i, "url_img")
            });
        }
    }

}


id: 676694e19932c2606d838934
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:19:29.907
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg= JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });



}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);
                
            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck();
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync() {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: $dzpz_pz_ds.getString(i, "url_img")
            });
        }
    }

}


id: 676694e19932c2606d838938
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:21:59.389
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg= JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });



}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);
                
            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck( corpid, ym );
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym ) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: $dzpz_pz_ds.getString(i, "url_img")
            });
        }
    }

    同步(corpid, ym , function(ret)
    {

            toastr.info("同步完成");
    });

}


id: 676694e19932c2606d838960
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:31:24.528
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg= JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg= JSON.parse(msg);
        console.dir(msg);
    });



 

}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);
                
            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck( corpid, ym );
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym ) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: $dzpz_pz_ds.getString(i, "url_img")
            });
        }
    }

    同步(corpid, ym , function(ret)
    {

            toastr.info("同步完成");
    });

}


id: 676694e19932c2606d838966
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:33:10.109
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println( ret);
            item.md5 = ret.MD5;
            item.fileSize = sizeFormat( ret.fileSize ) ;
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function 同步( corpid, ym, clientName , path , data )
{
    noticeClientToGetFiles( "EA92", "c:/temp", data  , 3 , "callback_downloadedOneFile" , {corpid:cropid, ym:ym , userid, currentUserId() });
    
}

function sizeFormat( bytesize){

    println('=====' +  bytesize);

    var i=0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while(  bytesize >=1024){       
         bytesize= bytesize/1024;
         i++;
        if( i==4)break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；
   println( bytesize);
    var units= [  "Bytes","KB","MB","GB","TB" ];
    var newsize=  toFixed( bytesize,2); // 日了狗了， round 不正常  //round( bytesize,2);
    println( newsize);
    return  `${newsize}${units[i]}` ;

} 




function toFixed  (number, n) {

    if (n > 32 || n < 0) {

        throw new RangeError('toFixed() digits argument must be between 0 and 32');

    }



    if (isNaN(number) || number >= Math.pow(10, 21)) {
        println( 'not number or  >>>> ');
        return number.toString();

    }


    //如果数字比保留的小数位还要小10倍，那么直接返回 0
    // 比如  0.001 保留2位小数，则直接就返回 0.00
    // 这个主要是解决，一些足够小的数被科学计数后，可能引起异常，
    // 比如  (-7400.00+ 7396.74 + 3.26) 结果是 -2.184918912462308e-13  , 会被本函数处理成 -2.18 ,这个就错大了
    // 科学计数法在下面转换时出现异常，所以对于足够小的数据 ，直接就返回 0



    if( Math.abs(number)< 1/ Math.pow(10,n+1))
    {
        if( n==0) return '0';
        return '0.' + '0000000000000000000'.substring(0,n);
    }

    if (typeof (n) == 'undefined' || n == 0) {

        return (Math.round(number)).toString();

    }



    var bigThenZero= number>0;

    var result = number.toString();

    var arr = result.split('.');



    // 整数的情况

    if (arr.length < 2) {

        result += '.';

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

            result += '0';

        }

        return result;

    }


    var integer = arr[0];

    var decimal = arr[1];

    if (decimal.length == n) {

        return result;

    }

    if (decimal.length < n) {

        for (var i = 0; i < n - decimal.length; i += 1) {

            result += '0';

        }

        return result;

    }

    result = integer + '.' + decimal.substr(0, n);

    var last = decimal.substr(n, 1);
 

    // 四舍五入，转换为整数再处理，避免浮点数精度的损失

    if (parseInt(last, 10) >= 5) {

        var x = Math.pow(10, n);

        result = (Math.round((parseFloat(result) * x)) +  (bigThenZero?1:-1)) / x;

        result =  toFixed ( result , n);

    }

    return result;

}


id: 6766998a9932c2606d83896c
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:33:46.247
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println( ret);
            item.md5 = ret.MD5;
            item.fileSize = sizeFormat( ret.fileSize ) ;
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function 同步( corpid, ym, clientName , path , data )
{
    noticeClientToGetFiles( clientName, path, data  , 3 , "callback_downloadedOneFile" , {corpid:corpid, ym:ym , userid, currentUserId() });

}

function sizeFormat( bytesize){

    println('=====' +  bytesize);

    var i=0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while(  bytesize >=1024){       
         bytesize= bytesize/1024;
         i++;
        if( i==4)break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；
   println( bytesize);
    var units= [  "Bytes","KB","MB","GB","TB" ];
    var newsize=  toFixed( bytesize,2); // 日了狗了， round 不正常  //round( bytesize,2);
    println( newsize);
    return  `${newsize}${units[i]}` ;

} 




function toFixed  (number, n) {

    if (n > 32 || n < 0) {

        throw new RangeError('toFixed() digits argument must be between 0 and 32');

    }



    if (isNaN(number) || number >= Math.pow(10, 21)) {
        println( 'not number or  >>>> ');
        return number.toString();

    }


    //如果数字比保留的小数位还要小10倍，那么直接返回 0
    // 比如  0.001 保留2位小数，则直接就返回 0.00
    // 这个主要是解决，一些足够小的数被科学计数后，可能引起异常，
    // 比如  (-7400.00+ 7396.74 + 3.26) 结果是 -2.184918912462308e-13  , 会被本函数处理成 -2.18 ,这个就错大了
    // 科学计数法在下面转换时出现异常，所以对于足够小的数据 ，直接就返回 0



    if( Math.abs(number)< 1/ Math.pow(10,n+1))
    {
        if( n==0) return '0';
        return '0.' + '0000000000000000000'.substring(0,n);
    }

    if (typeof (n) == 'undefined' || n == 0) {

        return (Math.round(number)).toString();

    }



    var bigThenZero= number>0;

    var result = number.toString();

    var arr = result.split('.');



    // 整数的情况

    if (arr.length < 2) {

        result += '.';

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

            result += '0';

        }

        return result;

    }


    var integer = arr[0];

    var decimal = arr[1];

    if (decimal.length == n) {

        return result;

    }

    if (decimal.length < n) {

        for (var i = 0; i < n - decimal.length; i += 1) {

            result += '0';

        }

        return result;

    }

    result = integer + '.' + decimal.substr(0, n);

    var last = decimal.substr(n, 1);
 

    // 四舍五入，转换为整数再处理，避免浮点数精度的损失

    if (parseInt(last, 10) >= 5) {

        var x = Math.pow(10, n);

        result = (Math.round((parseFloat(result) * x)) +  (bigThenZero?1:-1)) / x;

        result =  toFixed ( result , n);

    }

    return result;

}


id: 6766998a9932c2606d838972
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:34:25.984
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println( ret);
            item.md5 = ret.MD5;
            item.fileSize = sizeFormat( ret.fileSize ) ;
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function 同步( corpid, ym, clientName , path , data )
{
    noticeClientToGetFiles(clientName, path, data  , 3 , "callback_downloadedOneFile" , {corpid:corpid, ym:ym , userid, currentUserId() });

}

function sizeFormat( bytesize){

    println('=====' +  bytesize);

    var i=0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while(  bytesize >=1024){       
         bytesize= bytesize/1024;
         i++;
        if( i==4)break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；
   println( bytesize);
    var units= [  "Bytes","KB","MB","GB","TB" ];
    var newsize=  toFixed( bytesize,2); // 日了狗了， round 不正常  //round( bytesize,2);
    println( newsize);
    return  `${newsize}${units[i]}` ;

} 




function toFixed  (number, n) {

    if (n > 32 || n < 0) {

        throw new RangeError('toFixed() digits argument must be between 0 and 32');

    }



    if (isNaN(number) || number >= Math.pow(10, 21)) {
        println( 'not number or  >>>> ');
        return number.toString();

    }


    //如果数字比保留的小数位还要小10倍，那么直接返回 0
    // 比如  0.001 保留2位小数，则直接就返回 0.00
    // 这个主要是解决，一些足够小的数被科学计数后，可能引起异常，
    // 比如  (-7400.00+ 7396.74 + 3.26) 结果是 -2.184918912462308e-13  , 会被本函数处理成 -2.18 ,这个就错大了
    // 科学计数法在下面转换时出现异常，所以对于足够小的数据 ，直接就返回 0



    if( Math.abs(number)< 1/ Math.pow(10,n+1))
    {
        if( n==0) return '0';
        return '0.' + '0000000000000000000'.substring(0,n);
    }

    if (typeof (n) == 'undefined' || n == 0) {

        return (Math.round(number)).toString();

    }



    var bigThenZero= number>0;

    var result = number.toString();

    var arr = result.split('.');



    // 整数的情况

    if (arr.length < 2) {

        result += '.';

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

            result += '0';

        }

        return result;

    }


    var integer = arr[0];

    var decimal = arr[1];

    if (decimal.length == n) {

        return result;

    }

    if (decimal.length < n) {

        for (var i = 0; i < n - decimal.length; i += 1) {

            result += '0';

        }

        return result;

    }

    result = integer + '.' + decimal.substr(0, n);

    var last = decimal.substr(n, 1);
 

    // 四舍五入，转换为整数再处理，避免浮点数精度的损失

    if (parseInt(last, 10) >= 5) {

        var x = Math.pow(10, n);

        result = (Math.round((parseFloat(result) * x)) +  (bigThenZero?1:-1)) / x;

        result =  toFixed ( result , n);

    }

    return result;

}


id: 6766998a9932c2606d838978
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:34:37.040
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println( ret);
            item.md5 = ret.MD5;
            item.fileSize = sizeFormat( ret.fileSize ) ;
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function 同步( corpid, ym, clientName , path , data )
{
  
  
    noticeClientToGetFiles(clientName, path, data  , 3 , "callback_downloadedOneFile" , {corpid:corpid, ym:ym , userid, currentUserId() });

}

function sizeFormat( bytesize){

    println('=====' +  bytesize);

    var i=0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while(  bytesize >=1024){       
         bytesize= bytesize/1024;
         i++;
        if( i==4)break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；
   println( bytesize);
    var units= [  "Bytes","KB","MB","GB","TB" ];
    var newsize=  toFixed( bytesize,2); // 日了狗了， round 不正常  //round( bytesize,2);
    println( newsize);
    return  `${newsize}${units[i]}` ;

} 




function toFixed  (number, n) {

    if (n > 32 || n < 0) {

        throw new RangeError('toFixed() digits argument must be between 0 and 32');

    }



    if (isNaN(number) || number >= Math.pow(10, 21)) {
        println( 'not number or  >>>> ');
        return number.toString();

    }


    //如果数字比保留的小数位还要小10倍，那么直接返回 0
    // 比如  0.001 保留2位小数，则直接就返回 0.00
    // 这个主要是解决，一些足够小的数被科学计数后，可能引起异常，
    // 比如  (-7400.00+ 7396.74 + 3.26) 结果是 -2.184918912462308e-13  , 会被本函数处理成 -2.18 ,这个就错大了
    // 科学计数法在下面转换时出现异常，所以对于足够小的数据 ，直接就返回 0



    if( Math.abs(number)< 1/ Math.pow(10,n+1))
    {
        if( n==0) return '0';
        return '0.' + '0000000000000000000'.substring(0,n);
    }

    if (typeof (n) == 'undefined' || n == 0) {

        return (Math.round(number)).toString();

    }



    var bigThenZero= number>0;

    var result = number.toString();

    var arr = result.split('.');



    // 整数的情况

    if (arr.length < 2) {

        result += '.';

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

            result += '0';

        }

        return result;

    }


    var integer = arr[0];

    var decimal = arr[1];

    if (decimal.length == n) {

        return result;

    }

    if (decimal.length < n) {

        for (var i = 0; i < n - decimal.length; i += 1) {

            result += '0';

        }

        return result;

    }

    result = integer + '.' + decimal.substr(0, n);

    var last = decimal.substr(n, 1);
 

    // 四舍五入，转换为整数再处理，避免浮点数精度的损失

    if (parseInt(last, 10) >= 5) {

        var x = Math.pow(10, n);

        result = (Math.round((parseFloat(result) * x)) +  (bigThenZero?1:-1)) / x;

        result =  toFixed ( result , n);

    }

    return result;

}


id: 6766998a9932c2606d83897e
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:34:49.814
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println( ret);
            item.md5 = ret.MD5;
            item.fileSize = sizeFormat( ret.fileSize ) ;
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function 同步( corpid, ym, clientName , path , data )
{
  
  
    noticeClientToGetFiles();
     clientName, path, data  , 3 , "callback_downloadedOneFile" , {corpid:corpid, ym:ym , userid, currentUserId() });

}

function sizeFormat( bytesize){

    println('=====' +  bytesize);

    var i=0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while(  bytesize >=1024){       
         bytesize= bytesize/1024;
         i++;
        if( i==4)break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；
   println( bytesize);
    var units= [  "Bytes","KB","MB","GB","TB" ];
    var newsize=  toFixed( bytesize,2); // 日了狗了， round 不正常  //round( bytesize,2);
    println( newsize);
    return  `${newsize}${units[i]}` ;

} 




function toFixed  (number, n) {

    if (n > 32 || n < 0) {

        throw new RangeError('toFixed() digits argument must be between 0 and 32');

    }



    if (isNaN(number) || number >= Math.pow(10, 21)) {
        println( 'not number or  >>>> ');
        return number.toString();

    }


    //如果数字比保留的小数位还要小10倍，那么直接返回 0
    // 比如  0.001 保留2位小数，则直接就返回 0.00
    // 这个主要是解决，一些足够小的数被科学计数后，可能引起异常，
    // 比如  (-7400.00+ 7396.74 + 3.26) 结果是 -2.184918912462308e-13  , 会被本函数处理成 -2.18 ,这个就错大了
    // 科学计数法在下面转换时出现异常，所以对于足够小的数据 ，直接就返回 0



    if( Math.abs(number)< 1/ Math.pow(10,n+1))
    {
        if( n==0) return '0';
        return '0.' + '0000000000000000000'.substring(0,n);
    }

    if (typeof (n) == 'undefined' || n == 0) {

        return (Math.round(number)).toString();

    }



    var bigThenZero= number>0;

    var result = number.toString();

    var arr = result.split('.');



    // 整数的情况

    if (arr.length < 2) {

        result += '.';

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

            result += '0';

        }

        return result;

    }


    var integer = arr[0];

    var decimal = arr[1];

    if (decimal.length == n) {

        return result;

    }

    if (decimal.length < n) {

        for (var i = 0; i < n - decimal.length; i += 1) {

            result += '0';

        }

        return result;

    }

    result = integer + '.' + decimal.substr(0, n);

    var last = decimal.substr(n, 1);
 

    // 四舍五入，转换为整数再处理，避免浮点数精度的损失

    if (parseInt(last, 10) >= 5) {

        var x = Math.pow(10, n);

        result = (Math.round((parseFloat(result) * x)) +  (bigThenZero?1:-1)) / x;

        result =  toFixed ( result , n);

    }

    return result;

}


id: 6766998a9932c2606d838984
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:35:42.202
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println(ret);
            item.md5 = ret.MD5;
            item.fileSize = sizeFormat(ret.fileSize);
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function 同步(corpid, ym, clientName, path, data) {


    noticeClientToGetFiles(clientName,
        path,
        data,
        3,
        "callback_downloadedOneFile",
        {
            corpid: corpid,
            ym: ym,
            userid: currentUserId()
        }
    );

}

function sizeFormat(bytesize) {

    println('=====' + bytesize);

    var i = 0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while (bytesize >= 1024) {
        bytesize = bytesize / 1024;
        i++;
        if (i == 4) break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；
    println(bytesize);
    var units = ["Bytes", "KB", "MB", "GB", "TB"];
    var newsize = toFixed(bytesize, 2); // 日了狗了， round 不正常  //round( bytesize,2);
    println(newsize);
    return `${newsize}${units[i]}`;

}




function toFixed(number, n) {

    if (n > 32 || n < 0) {

        throw new RangeError('toFixed() digits argument must be between 0 and 32');

    }



    if (isNaN(number) || number >= Math.pow(10, 21)) {
        println('not number or  >>>> ');
        return number.toString();

    }


    //如果数字比保留的小数位还要小10倍，那么直接返回 0
    // 比如  0.001 保留2位小数，则直接就返回 0.00
    // 这个主要是解决，一些足够小的数被科学计数后，可能引起异常，
    // 比如  (-7400.00+ 7396.74 + 3.26) 结果是 -2.184918912462308e-13  , 会被本函数处理成 -2.18 ,这个就错大了
    // 科学计数法在下面转换时出现异常，所以对于足够小的数据 ，直接就返回 0



    if (Math.abs(number) < 1 / Math.pow(10, n + 1)) {
        if (n == 0) return '0';
        return '0.' + '0000000000000000000'.substring(0, n);
    }

    if (typeof (n) == 'undefined' || n == 0) {

        return (Math.round(number)).toString();

    }



    var bigThenZero = number > 0;

    var result = number.toString();

    var arr = result.split('.');



    // 整数的情况

    if (arr.length < 2) {

        result += '.';

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

            result += '0';

        }

        return result;

    }


    var integer = arr[0];

    var decimal = arr[1];

    if (decimal.length == n) {

        return result;

    }

    if (decimal.length < n) {

        for (var i = 0; i < n - decimal.length; i += 1) {

            result += '0';

        }

        return result;

    }

    result = integer + '.' + decimal.substr(0, n);

    var last = decimal.substr(n, 1);


    // 四舍五入，转换为整数再处理，避免浮点数精度的损失

    if (parseInt(last, 10) >= 5) {

        var x = Math.pow(10, n);

        result = (Math.round((parseFloat(result) * x)) + (bigThenZero ? 1 : -1)) / x;

        result = toFixed(result, n);

    }

    return result;

}


id: 6766998a9932c2606d83898a
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:36:03.343
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println(ret);
            item.md5 = ret.MD5;
            item.fileSize = sizeFormat(ret.fileSize);
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function 同步(corpid, ym, clientName, path, data) {

    //通知客户端开始同步文件
    noticeClientToGetFiles(clientName,
        path,
        data,
        3,
        "callback_downloadedOneFile",
        {
            corpid: corpid,
            ym: ym,
            userid: currentUserId()
        }
    );

}

function sizeFormat(bytesize) {

    println('=====' + bytesize);

    var i = 0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while (bytesize >= 1024) {
        bytesize = bytesize / 1024;
        i++;
        if (i == 4) break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；
    println(bytesize);
    var units = ["Bytes", "KB", "MB", "GB", "TB"];
    var newsize = toFixed(bytesize, 2); // 日了狗了， round 不正常  //round( bytesize,2);
    println(newsize);
    return `${newsize}${units[i]}`;

}




function toFixed(number, n) {

    if (n > 32 || n < 0) {

        throw new RangeError('toFixed() digits argument must be between 0 and 32');

    }



    if (isNaN(number) || number >= Math.pow(10, 21)) {
        println('not number or  >>>> ');
        return number.toString();

    }


    //如果数字比保留的小数位还要小10倍，那么直接返回 0
    // 比如  0.001 保留2位小数，则直接就返回 0.00
    // 这个主要是解决，一些足够小的数被科学计数后，可能引起异常，
    // 比如  (-7400.00+ 7396.74 + 3.26) 结果是 -2.184918912462308e-13  , 会被本函数处理成 -2.18 ,这个就错大了
    // 科学计数法在下面转换时出现异常，所以对于足够小的数据 ，直接就返回 0



    if (Math.abs(number) < 1 / Math.pow(10, n + 1)) {
        if (n == 0) return '0';
        return '0.' + '0000000000000000000'.substring(0, n);
    }

    if (typeof (n) == 'undefined' || n == 0) {

        return (Math.round(number)).toString();

    }



    var bigThenZero = number > 0;

    var result = number.toString();

    var arr = result.split('.');



    // 整数的情况

    if (arr.length < 2) {

        result += '.';

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

            result += '0';

        }

        return result;

    }


    var integer = arr[0];

    var decimal = arr[1];

    if (decimal.length == n) {

        return result;

    }

    if (decimal.length < n) {

        for (var i = 0; i < n - decimal.length; i += 1) {

            result += '0';

        }

        return result;

    }

    result = integer + '.' + decimal.substr(0, n);

    var last = decimal.substr(n, 1);


    // 四舍五入，转换为整数再处理，避免浮点数精度的损失

    if (parseInt(last, 10) >= 5) {

        var x = Math.pow(10, n);

        result = (Math.round((parseFloat(result) * x)) + (bigThenZero ? 1 : -1)) / x;

        result = toFixed(result, n);

    }

    return result;

}


id: 6766998a9932c2606d83898e
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:37:09.285
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: $dzpz_pz_ds.getString(i, "url_img")
            });
        }
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {

        toastr.info("同步完成");
    });

}


id: 6766998a9932c2606d838992
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:37:14.562
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: $dzpz_pz_ds.getString(i, "url_img")
            });
        }
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {

       
    });

}


id: 6766998a9932c2606d838996
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:38:16.898
script:
var gs_archiveTypeName = '';
function formOpen() {

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym,clientName , path ) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: $dzpz_pz_ds.getString(i, "url_img")
            });
        }
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {

       
    });

}


id: 6766998a9932c2606d83899a
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:52:12.046
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + '/'+ $dzpz_pz_ds.getString(i, "url")
            });
        }
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766998a9932c2606d83899e
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:52:59.192
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row= msg.source.row;
        $dzpz_pz_ds.setValue(row,"info", "同步完成");
    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + '/'+ $dzpz_pz_ds.getString(i, "url")
            });
        }
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766998a9932c2606d8389a4
scriptid: 6765976699326bd179e4ed85
tablename: app_script
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:53:35.650
script:
function 影像主文档名称() {
    return getProperty('/影像名称/主文档名称', '凭证');
}

function 获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path) {
    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    return getFilesInfoInClientPath(clientName, path, 3,
        10 * 60 * 1000,
        'callback_getFilesInfoInClientPath',
        {
            userid: currentUserId(),
            coprid: corpid,
            ym: ym
        }
    );

}

//pz是一个数组 ， 每个元素是： { row: 行号 ， pzh：凭证号 , url: pdf文件地址 }
function 获取服务器上文件的哈希值(corpid, ym, pz) {

    asyncPool(3,  // 最多3个并发执行
        pz, //需要处理的数据数组，每个元素可以是任意类型的数据
        function (item, array, i) // item表示当前处理的对象， array就是整个数据数组
        {
            pushMessage("获取服务器上文件的哈希值", { action: 'info', message: item.pzh }, currentUserId());
            var ret = getFileMD5InFileServer(item.url);
            println(ret);
            item.md5 = ret.MD5;
            item.fileSize = sizeFormat(ret.fileSize);
            println(item);

        }, function () {
            pushMessage("获取服务器上文件的哈希值", { action: 'over' }, currentUserId());

        });

    return pz;


}


function 同步(corpid, ym, clientName, path, data) {

    if (!path.endsWith('/') && !path.endsWith('\\')) path = path + "/";
    path = path + corpid + "/" + ym;

    //通知客户端开始同步文件
    noticeClientToGetFiles(clientName,
        path,
        data,
        3,
        "callback_downloadedOneFile",
        {
            corpid: corpid,
            ym: ym,
            userid: currentUserId()
        }
    );

}

function sizeFormat(bytesize) {

    println('=====' + bytesize);

    var i = 0;

    //当$bytesize 大于是1024字节时，开始循环，当循环到第4次时跳出；
    while (bytesize >= 1024) {
        bytesize = bytesize / 1024;
        i++;
        if (i == 4) break;
    }

    //将Bytes,KB,MB,GB,TB定义成一维数组；
    println(bytesize);
    var units = ["Bytes", "KB", "MB", "GB", "TB"];
    var newsize = toFixed(bytesize, 2); // 日了狗了， round 不正常  //round( bytesize,2);
    println(newsize);
    return `${newsize}${units[i]}`;

}




function toFixed(number, n) {

    if (n > 32 || n < 0) {

        throw new RangeError('toFixed() digits argument must be between 0 and 32');

    }



    if (isNaN(number) || number >= Math.pow(10, 21)) {
        println('not number or  >>>> ');
        return number.toString();

    }


    //如果数字比保留的小数位还要小10倍，那么直接返回 0
    // 比如  0.001 保留2位小数，则直接就返回 0.00
    // 这个主要是解决，一些足够小的数被科学计数后，可能引起异常，
    // 比如  (-7400.00+ 7396.74 + 3.26) 结果是 -2.184918912462308e-13  , 会被本函数处理成 -2.18 ,这个就错大了
    // 科学计数法在下面转换时出现异常，所以对于足够小的数据 ，直接就返回 0



    if (Math.abs(number) < 1 / Math.pow(10, n + 1)) {
        if (n == 0) return '0';
        return '0.' + '0000000000000000000'.substring(0, n);
    }

    if (typeof (n) == 'undefined' || n == 0) {

        return (Math.round(number)).toString();

    }



    var bigThenZero = number > 0;

    var result = number.toString();

    var arr = result.split('.');



    // 整数的情况

    if (arr.length < 2) {

        result += '.';

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

            result += '0';

        }

        return result;

    }


    var integer = arr[0];

    var decimal = arr[1];

    if (decimal.length == n) {

        return result;

    }

    if (decimal.length < n) {

        for (var i = 0; i < n - decimal.length; i += 1) {

            result += '0';

        }

        return result;

    }

    result = integer + '.' + decimal.substr(0, n);

    var last = decimal.substr(n, 1);


    // 四舍五入，转换为整数再处理，避免浮点数精度的损失

    if (parseInt(last, 10) >= 5) {

        var x = Math.pow(10, n);

        result = (Math.round((parseFloat(result) * x)) + (bigThenZero ? 1 : -1)) / x;

        result = toFixed(result, n);

    }

    return result;

}


id: 6766998a9932c2606d8389a8
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 18:59:06.221
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row= msg.source.row;
        $dzpz_pz_ds.setValue(row,"info", "同步完成");
    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + $dzpz_pz_ds.getString(i, "url")
            });
        }
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766998a9932c2606d8389ac
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 19:07:25.882
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row= msg.source.row;
        $dzpz_pz_ds.setValue(row,"info", "同步完成");
    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL( $dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766998a9932c2606d8389b0
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 19:12:54.532
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row= msg.source.row;
        $dzpz_pz_ds.setValue(row,"info", "同步完成");
    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row={};
             for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                 let key= $dzpz_pz_ds.getString(i,"pzh")+'.pdf';
                 pzh2row[key] = i; 
             }

             for( let i=0;i< ret.items.length;i++)
             {
                 let one= ret.items[i];
                 let row= pzh2row[one.name];
                 $dzpz_pz_ds.setValue( row,'md5_client' , one.md5);
             }

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL( $dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766998a9932c2606d8389b4
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 19:59:22.602
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row= msg.source.row;
        $dzpz_pz_ds.setValue(row,"info", "同步完成");
    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row={};
             for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                 let key= $dzpz_pz_ds.getString(i,"pzh")+'.pdf';
                 pzh2row[key] = i; 
             }

             for( let i=0;i< ret.items.length;i++)
             {
                 let one= ret.items[i];
                 let row= pzh2row[one.name];
                 if( row==unefined) continue;//客户端有的文件。这里也可能不存在
                 $dzpz_pz_ds.setValue( row,'md5_client' , one.md5);
             }

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL( $dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766998a9932c2606d8389b8
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 20:01:28.781
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row= msg.source.row;
        $dzpz_pz_ds.setValue(row,"info", "同步完成");
    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let checkOnClient = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row={};
             for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                 let key= $dzpz_pz_ds.getString(i,"pzh")+'.pdf';
                 pzh2row[key] = i; 
             }

             for( let i=0;i< ret.items.length;i++)
             {
                 let one= ret.items[i];
                 let row= pzh2row[one.name];
                 if( row==undefined ) continue;//客户端有的文件。这里也可能不存在
                 $dzpz_pz_ds.setValue( row,'md5_client' , one.md5);
             }

            resolve(0);
        });
    });

    let checkOnServer = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([checkOnClient, checkOnServer])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL( $dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766998a9932c2606d8389bc
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 20:24:08.758
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row= msg.source.row;
        $dzpz_pz_ds.setValue(row,"info", "同步完成");
    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row={};
             for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                 let key= $dzpz_pz_ds.getString(i,"pzh")+'.pdf';
                 pzh2row[key] = i; 
             }

             for( let i=0;i< ret.items.length;i++)
             {
                 let one= ret.items[i];
                 let row= pzh2row[one.name];
                 if( row==undefined ) continue;//客户端有的文件。这里也可能不存在
                 $dzpz_pz_ds.setValue( row,'md5_client' , one.md5);
             }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL( $dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766998a9932c2606d8389c0
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 20:25:47.788
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row= msg.source.row;
        $dzpz_pz_ds.setValue(row,"info", "同步完成");
    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row={};
             for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                 let key= $dzpz_pz_ds.getString(i,"pzh")+'.pdf';
                 pzh2row[key] = i; 
             }

             for( let i=0;i< ret.items.length;i++)
             {
                 let one= ret.items[i];
                 let row= pzh2row[one.name];
                 if( row==undefined ) continue;//客户端有的文件。这里也可能不存在
                 $dzpz_pz_ds.setValue( row,'md5_client' , one.md5);
             }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL( $dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if( pz.length==0)
    {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766998a9932c2606d8389c4
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 20:26:43.843
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row= msg.source.row;
        $dzpz_pz_ds.setValue(row,"info", "同步完成");
    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row={};
             for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                 let key= $dzpz_pz_ds.getString(i,"pzh")+'.pdf';
                 pzh2row[key] = i; 
             }

             for( let i=0;i< ret.items.length;i++)
             {
                 let one= ret.items[i];
                 let row= pzh2row[one.name];
                 if( row==undefined ) continue;//客户端有的文件。这里也可能不存在
                 $dzpz_pz_ds.setValue( row,'md5_client' , one.md5);
             }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL( $dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if( pz.length==0)
    {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766998a9932c2606d8389c8
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 20:28:55.501
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row= msg.source.row;
        $dzpz_pz_ds.setValue(row,"info", "同步完成");
        $dzpz_pz_ds.setValue(row,"md5_client",  msg.file.MD5);
        
    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row={};
             for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                 let key= $dzpz_pz_ds.getString(i,"pzh")+'.pdf';
                 pzh2row[key] = i; 
             }

             for( let i=0;i< ret.items.length;i++)
             {
                 let one= ret.items[i];
                 let row= pzh2row[one.name];
                 if( row==undefined ) continue;//客户端有的文件。这里也可能不存在
                 $dzpz_pz_ds.setValue( row,'md5_client' , one.md5);
             }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL( $dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if( pz.length==0)
    {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766998a9932c2606d8389cc
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 20:31:46.261
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row = msg.source.row;
        $dzpz_pz_ds.setValue(row, "info", "同步完成");
        $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);

    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

//先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');


    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) continue;//客户端有的文件。这里也可能不存在
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766b6859932c2606d8389d0
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 20:37:25.822
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row = msg.source.row;
        $dzpz_pz_ds.setValue(row, "info", "同步完成");
        $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);

    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);

    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) continue;//客户端有的文件。这里也可能不存在
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766b6859932c2606d8389d4
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 20:38:44.362
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row = msg.source.row;
        $dzpz_pz_ds.setValue(row, "info", "同步完成");
        $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);

    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);
        $dzpz_pz_ds.setValue(i, 'info', '');
        

    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) continue;//客户端有的文件。这里也可能不存在
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766b6859932c2606d8389d8
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 21:12:24.125
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row = msg.source.row;
        $dzpz_pz_ds.setValue(row, "info", "同步完成");
        $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);
        toastr.show( msg.file.name+"同步完成");

    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);
        $dzpz_pz_ds.setValue(i, 'info', '');
        

    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) continue;//客户端有的文件。这里也可能不存在
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "varified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "varified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766c1ff9932c2606d838a6f
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 21:27:08.957
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row = msg.source.row;
        $dzpz_pz_ds.setValue(row, "info", "同步完成");
        $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);
        toastr.show( msg.file.name+"同步完成");

    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);
        $dzpz_pz_ds.setValue(i, 'info', '');
        

    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) continue;//客户端有的文件。这里也可能不存在
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "verified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "verified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766c1ff9932c2606d838a73
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 21:29:13.563
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row = msg.source.row;
        $dzpz_pz_ds.setValue(row, "info", "同步完成");
        $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);
        toastr.success( msg.file.name+"同步完成");

    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);
        $dzpz_pz_ds.setValue(i, 'info', '');
        

    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) continue;//客户端有的文件。这里也可能不存在
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "verified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "verified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766c1ff9932c2606d838a77
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.21 21:30:46.799
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.success(msg.message);
       // if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row = msg.source.row;
        $dzpz_pz_ds.setValue(row, "info", "同步完成");
        $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);
        toastr.success( msg.file.name+"同步完成");

    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);
        $dzpz_pz_ds.setValue(i, 'info', '');
        

    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) continue;//客户端有的文件。这里也可能不存在
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "verified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "verified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 6766c1ff9932c2606d838a88
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.22 10:46:31.202
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);
        let row = msg.source.row;
        $dzpz_pz_ds.setValue(row, "info", "同步完成");
        $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);

        if( msg.action=='downloadInProgress')  toastr.show ( msg.file.name+ "同步进度 " + msg.percent+"%");
        if( msg.action=='downloadOver')  toastr.show ( msg.file.name+ "同步完成"  );
        if( msg.action=='downloadAllOver')  
        {
            toastr.hide (  );
            $.alert('同步完成');
        }
        
        

    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);
        $dzpz_pz_ds.setValue(i, 'info', '');
        

    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) continue;//客户端有的文件。这里也可能不存在
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "verified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "verified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 676785069932c2606d838aa0
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.22 11:18:35.763
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);

        if (msg.action == 'downloadInProgress') {
            toastr.show(msg.file.name + "同步进度 " + msg.percent + "%");
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", msg.percent + "%");

        }
        if (msg.action == 'downloadOver') {
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", "同步完成");
            $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);
        }


        if (msg.action == 'downloadAllOver') {
            toastr.hide();
            $.alert('同步完成');
        }



    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);
        $dzpz_pz_ds.setValue(i, 'info', '');


    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) continue;//客户端有的文件。这里也可能不存在
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "verified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "verified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 676785069932c2606d838aa4
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.22 11:55:59.355
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);

        if (msg.action == 'downloadInProgress') {
            toastr.show(msg.file.name + "同步进度 " + msg.percent + "%");
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", msg.percent + "%");

        }
        if (msg.action == 'downloadOver') {
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", "同步完成");
            $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);
        }


        if (msg.action == 'downloadAllOver') {
            toastr.hide();
            $.alert('同步完成');
        }



    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);
        $dzpz_pz_ds.setValue(i, 'info', '');


    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.info(  ret.items.length+"个文件");
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) 
                {
                    console.info( one.name+"  服务器上不存在");
                    continue;//客户端有的文件。这里也可能不存在
                }
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "verified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "verified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 676785069932c2606d838aa8
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.22 14:25:26.902
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
       // if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);

        if (msg.action == 'downloadInProgress') {
            toastr.show(msg.file.name + "同步进度 " + msg.percent + "%");
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", msg.percent + "%");

        }
        if (msg.action == 'downloadOver') {
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", "同步完成");
            $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);
        }


        if (msg.action == 'downloadAllOver') {
            toastr.hide();
            $.alert('同步完成');
        }



    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);
        $dzpz_pz_ds.setValue(i, 'info', '');


    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.info(  ret.items.length+"个文件");
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) 
                {
                    console.info( one.name+"  服务器上不存在");
                    continue;//客户端有的文件。这里也可能不存在
                }
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "verified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "verified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 676785069932c2606d838ab6
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.22 14:27:56.814
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);

        if (msg.action == 'downloadInProgress') {
            toastr.show(msg.file.name + "同步进度 " + msg.percent + "%");
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", msg.percent + "%");

        }
        if (msg.action == 'downloadOver') {
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", "同步完成");
            $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);
        }


        if (msg.action == 'downloadAllOver') {
            toastr.hide();
            $.alert('同步完成');
        }



    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);
        $dzpz_pz_ds.setValue(i, 'info', '');


    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.info(  ret.items.length+"个文件");
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) 
                {
                    console.info( one.name+"  服务器上不存在");
                    continue;//客户端有的文件。这里也可能不存在
                }
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "verified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "verified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            toastr.hide();
            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 676785069932c2606d838aba
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.22 14:29:05.143
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        //if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);

        if (msg.action == 'downloadInProgress') {
            toastr.show(msg.file.name + "同步进度 " + msg.percent + "%");
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", msg.percent + "%");

        }
        if (msg.action == 'downloadOver') {
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", "同步完成");
            $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);
        }


        if (msg.action == 'downloadAllOver') {
            toastr.hide();
            $.alert('同步完成');
        }



    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);
        $dzpz_pz_ds.setValue(i, 'info', '');


    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.info(  ret.items.length+"个文件");
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) 
                {
                    console.info( one.name+"  服务器上不存在");
                    continue;//客户端有的文件。这里也可能不存在
                }
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "verified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "verified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            toastr.hide();
            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}


id: 676785069932c2606d838abe
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.22 14:31:52.581
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        //if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);

        if (msg.action == 'downloadInProgress') {
            toastr.show(msg.file.name + "同步进度 " + msg.percent + "%");
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", msg.percent + "%");

        }
        if (msg.action == 'downloadOver') {
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", "同步完成");
            $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);
        }


        if (msg.action == 'downloadAllOver') {
            toastr.hide();
            $.alert('同步完成');
        }



    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);
        $dzpz_pz_ds.setValue(i, 'info', '');


    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.info(  ret.items.length+"个文件");
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) 
                {
                    console.info( one.name+"  服务器上不存在");
                    continue;//客户端有的文件。这里也可能不存在
                }
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "verified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "verified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            toastr.hide();
            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}

/**
 * 单元格的值发生了改变
 * @param sheet  所在的工作表
 * @param cell  单元格对象
 * @param oldValue  原先的值
 * @param newValue 变化后的值
 * @param innerRow   当单元格没有绑定数据库或绑定到单行数据库时，本参数无意义。如果绑定一个
 * 多行数据库，则表示该单元所绑定的字段的第 innerRow行发生变化
 */
function cellValueChanged(sheet, cell, oldValue, newValue, innerRow) {

    //如果是绑定了数据库的，强烈不建议使用本事件，换用结果集变化事件 itemChanged

    //通过别名来判断
    if (cell.alias == 'path') {

        let clientName = book.sheet0.cells('clientName').getValueString();
        if( clientName!='')   localStorage.setItem(  clientName+ '.lastPath', cell.getValueString() );

    }

    if( cell.alias=='clientName')
    {
        let clientName = book.sheet0.cells('clientName').getValueString();
        let v=  localStorage.getItem(  clientName+ '.lastPath' );
        book.sheet0.cells('path').setValue(v);
    }
     


}


id: 676785069932c2606d838ac2
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.22 14:34:20.955
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        //if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);

        if (msg.action == 'downloadInProgress') {
            toastr.show(msg.file.name + "同步进度 " + msg.percent + "%");
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", msg.percent + "%");

        }
        if (msg.action == 'downloadOver') {
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", "同步完成");
            $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);
        }


        if (msg.action == 'downloadAllOver') {
            toastr.hide();
            $.alert('同步完成');
        }



    });





}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);
        $dzpz_pz_ds.setValue(i, 'info', '');


    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.info(  ret.items.length+"个文件");
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) 
                {
                    console.info( one.name+"  服务器上不存在");
                    continue;//客户端有的文件。这里也可能不存在
                }
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "verified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "verified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            toastr.hide();
            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}

/**
 * 单元格的值发生了改变
 * @param sheet  所在的工作表
 * @param cell  单元格对象
 * @param oldValue  原先的值
 * @param newValue 变化后的值
 * @param innerRow   当单元格没有绑定数据库或绑定到单行数据库时，本参数无意义。如果绑定一个
 * 多行数据库，则表示该单元所绑定的字段的第 innerRow行发生变化
 */
function cellValueChanged(sheet, cell, oldValue, newValue, innerRow) {

    //如果是绑定了数据库的，强烈不建议使用本事件，换用结果集变化事件 itemChanged

    //通过别名来判断
    if (cell.alias == 'path') {

        let clientName = book.sheet0.cells('clientName').getValueString();
        if( clientName!='')   localStorage.setItem(  clientName+ '.lastPath', cell.getValueString() );

    }

    if( cell.alias=='clientName')
    {
        let clientName = book.sheet0.cells('clientName').getValueString();
        let v=  localStorage.getItem(  clientName+ '.lastPath' );
        book.sheet0.cells('path').setValue(v);
    }
     
      if (cell.alias == 'ym') {

        let ym = book.sheet0.cells('ym').getValueString();
         localStorage.setItem(   '影像备份.年月', ym );

    }

     if (cell.alias == 'corpid') {

        let corpid = book.sheet0.cells('corpid').getValueString();
         localStorage.setItem(   '影像备份.帐套', corpid );

    }



}


id: 676785069932c2606d838ac6
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.22 14:35:44.512
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        //if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);

        if (msg.action == 'downloadInProgress') {
            toastr.show(msg.file.name + "同步进度 " + msg.percent + "%");
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", msg.percent + "%");

        }
        if (msg.action == 'downloadOver') {
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", "同步完成");
            $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);
        }


        if (msg.action == 'downloadAllOver') {
            toastr.hide();
            $.alert('同步完成');
        }



    });


    let ym = localStorage.getItem('影像备份.年月');
    book.sheet0.cells('ym').setValue(ym);

    let corpid = localStorage.getItem('影像备份.帐套');
    book.sheet0.cells('corpid').setValue(corpid);






}



function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);
        $dzpz_pz_ds.setValue(i, 'info', '');


    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.info(ret.items.length + "个文件");
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) {
                    console.info(one.name + "  服务器上不存在");
                    continue;//客户端有的文件。这里也可能不存在
                }
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "verified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "verified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            toastr.hide();
            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}

/**
 * 单元格的值发生了改变
 * @param sheet  所在的工作表
 * @param cell  单元格对象
 * @param oldValue  原先的值
 * @param newValue 变化后的值
 * @param innerRow   当单元格没有绑定数据库或绑定到单行数据库时，本参数无意义。如果绑定一个
 * 多行数据库，则表示该单元所绑定的字段的第 innerRow行发生变化
 */
function cellValueChanged(sheet, cell, oldValue, newValue, innerRow) {

    //如果是绑定了数据库的，强烈不建议使用本事件，换用结果集变化事件 itemChanged

    //通过别名来判断
    if (cell.alias == 'path') {

        let clientName = book.sheet0.cells('clientName').getValueString();
        if (clientName != '') localStorage.setItem(clientName + '.lastPath', cell.getValueString());

    }

    if (cell.alias == 'clientName') {
        let clientName = book.sheet0.cells('clientName').getValueString();
        let v = localStorage.getItem(clientName + '.lastPath');
        book.sheet0.cells('path').setValue(v);
    }

    if (cell.alias == 'ym') {

        let ym = book.sheet0.cells('ym').getValueString();
        localStorage.setItem('影像备份.年月', ym);

    }

    if (cell.alias == 'corpid') {

        let corpid = book.sheet0.cells('corpid').getValueString();
        localStorage.setItem('影像备份.帐套', corpid);

    }



}


id: 676785069932c2606d838aca
scriptid: 6765976699326bd179e4ed8a
tablename: app_template
clientip: 60.186.197.170
username: sa
createdate: 2024.12.22 14:37:14.996
script:
var gs_archiveTypeName = '';
var g_homeURL = "";
function formOpen() {

    g_homeURL = getServiceHomeURL('app');

    影像主文档名称(function (v) {
        book.sheet0.cells('archiveTypeName').setValue(v);

        gs_archiveTypeName = v;
    });

    onPushMessage('客户端影像版本检查', function (p) {
        console.dir(p);

    });

    onPushMessage('获取服务器上文件的哈希值', function (msg) {
        msg = JSON.parse(msg);
        if (msg.action == 'info') toastr.show(msg.message);
        //if (msg.action = 'over') toastr.hide();
    });


    onPushMessage('客户端同步文件进度', function (msg) {
        msg = JSON.parse(msg);
        console.dir(msg);

        if (msg.action == 'downloadInProgress') {
            toastr.show(msg.file.name + "同步进度 " + msg.percent + "%");
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", msg.percent + "%");

        }
        if (msg.action == 'downloadOver') {
            let row = msg.source.row;
            $dzpz_pz_ds.setValue(row, "info", "同步完成");
            $dzpz_pz_ds.setValue(row, "md5_client", msg.file.MD5);
        }


        if (msg.action == 'downloadAllOver') {
            toastr.hide();
            $.alert('同步完成');
        }



    });


    let ym = localStorage.getItem('影像备份.年月');
    book.sheet0.cells('ym').setValue(ym);

    let corpid = localStorage.getItem('影像备份.帐套');
    book.sheet0.cells('corpid').setValue(corpid);






}
/**
 * 结果集检索完成
 * @param dsname 结果集名称
 * @param rowCount  本次检索的数据条数
 * @param withLastSelect   boolean型  检索是否是使用上一次检索的SQL
 */
function retrieveEnd (dsname,rowCount, withLastSelect) {
    if ( dsname=='dzpz_pz') cb_check_onClick();
}




function cb_check_onClick() {
    stateCheck();
}


function stateCheck(afterCheck) {
    let corpid = book.sheet0.cells("corpid").getValueString();
    if (corpid == '') {
        toastr.error("请选择帐套");
        return false;
    }

    let ym = book.sheet0.cells("ym").getValueString();
    if (ym == '') {
        toastr.error("请选择年月");
        return false;
    }


    let clientName = book.sheet0.cells('clientName').getValueString();
    if (clientName == '') {
        toastr.error("请选择同步到哪里。如果没有可选项，请先在要同步到的电脑上安装“应用助手”并运行");
        return false;
    }

    let path = book.sheet0.cells('path').getValueString();
    if (path == '') {
        toastr.error("请输入同步到哪个目录，如果目录不存在，系统会自动创建");
        return false;
    }

    //先清除

    book.sheet1.paintPermit = false;
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        $dzpz_pz_ds.setValue(i, 'md5', '');
        $dzpz_pz_ds.setValue(i, 'md5_client', '');
        $dzpz_pz_ds.setValue(i, 'filesize', '');
        $dzpz_pz_ds.setValue(i, 'state', 0);
        $dzpz_pz_ds.setValue(i, 'info', '');


    }
    book.sheet1.paintPermit = true;


    let 客户端文件哈希检测 = new Promise(function (resolve, reject) {
        获取客户机上指定目录下文件的哈希值(corpid, ym, clientName, path, function (ret) {
            console.info(ret.items.length + "个文件");
            console.dir(ret);
            var pzh2row = {};
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {
                let key = $dzpz_pz_ds.getString(i, "pzh") + '.pdf';
                pzh2row[key] = i;
            }

            for (let i = 0; i < ret.items.length; i++) {
                let one = ret.items[i];
                let row = pzh2row[one.name];
                if (row == undefined) {
                    console.info(one.name + "  服务器上不存在");
                    continue;//客户端有的文件。这里也可能不存在
                }
                $dzpz_pz_ds.setValue(row, 'md5_client', one.md5);
            }

            resolve(1);
        });
    });

    let 服务端文件哈希检测 = new Promise(function (resolve, reject) {
        let pz = [];
        for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

            //校对过的文件，计算文件的MD5码
            if ($dzpz_pz_ds.getInt(i, "verified") == 1) {
                pz.push({
                    row: i, //行号记录下来
                    pzh: $dzpz_pz_ds.getString(i, "pzh"),
                    url: $dzpz_pz_ds.getString(i, "url")
                }
                );
            }
        }
        获取服务器上文件的哈希值(corpid, ym, pz, function (ret) {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < ret.length; i++) {
                let one = ret[i];
                $dzpz_pz_ds.setValue(one.row, 'md5', one.md5);
                $dzpz_pz_ds.setValue(one.row, 'filesize', one.fileSize);

            }
            book.sheet1.paintPermit = true;
            resolve(1);
        });

    });

    Promise.all([客户端文件哈希检测, 服务端文件哈希检测])
        .then(function () {
            book.sheet1.paintPermit = false;
            for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

                if ($dzpz_pz_ds.getInt(i, "state") == 0) {  //状态还没有设置，那么开始设置 
                    if ($dzpz_pz_ds.getInt(i, "verified") == 1) {  //如果没有审核，那么直接就是4，禁止同步
                        if ($dzpz_pz_ds.getInt(i, "c_tbzt") == 1) { //如果版本一至，那么就是1 ，无需同步，否则就是2 等待同步
                            $dzpz_pz_ds.setValue(i, "state", 1);
                        } else {
                            $dzpz_pz_ds.setValue(i, "state", 2);
                        }
                    } else {
                        $dzpz_pz_ds.setValue(i, "state", 4);
                    }
                }
            }

            toastr.hide();
            book.sheet1.paintPermit = true;
            toastr.success("客户端检测完成");
            if (afterCheck) afterCheck(corpid, ym, clientName, path);
        });


}


function cb_sync_onClick() {


    $confirm("提示", "确信要将整月的影像文件同步到指定电脑的指定目录中?<br>注意<ul><li>没有校对的不会同步</li><li>无需同步的不会同步</li></ul>", function () {
        stateCheck(doSync);
    });


}

function doSync(corpid, ym, clientName, path) {

    //把等待同步的影像整理出来 ，开始同步
    let pz = [];
    for (let i = 0; i < $dzpz_pz_ds.rowCount; i++) {

        if ($dzpz_pz_ds.getInt(i, "state") == 2) {  //状态是等待同步的

            pz.push({
                row: i, //行号记录下来
                name: $dzpz_pz_ds.getString(i, "pzh") + ".pdf",
                url: g_homeURL + safeURL($dzpz_pz_ds.getString(i, "url"))
            });
        }
    }

    if (pz.length == 0) {
        toastr.info("没有需要同步的影像文件");
        return;
    }

    同步(corpid, ym, clientName, path, pz, function (ret) {


    });

}

/**
 * 单元格的值发生了改变
 * @param sheet  所在的工作表
 * @param cell  单元格对象
 * @param oldValue  原先的值
 * @param newValue 变化后的值
 * @param innerRow   当单元格没有绑定数据库或绑定到单行数据库时，本参数无意义。如果绑定一个
 * 多行数据库，则表示该单元所绑定的字段的第 innerRow行发生变化
 */
function cellValueChanged(sheet, cell, oldValue, newValue, innerRow) {

    //如果是绑定了数据库的，强烈不建议使用本事件，换用结果集变化事件 itemChanged

    //通过别名来判断
    if (cell.alias == 'path') {

        let clientName = book.sheet0.cells('clientName').getValueString();
        if (clientName != '') localStorage.setItem(clientName + '.lastPath', cell.getValueString());

    }

    if (cell.alias == 'clientName') {
        let clientName = book.sheet0.cells('clientName').getValueString();
        let v = localStorage.getItem(clientName + '.lastPath');
        book.sheet0.cells('path').setValue(v);
    }

    if (cell.alias == 'ym') {

        let ym = book.sheet0.cells('ym').getValueString();
        localStorage.setItem('影像备份.年月', ym);

    }

    if (cell.alias == 'corpid') {

        let corpid = book.sheet0.cells('corpid').getValueString();
        localStorage.setItem('影像备份.帐套', corpid);

    }



}


