Commit f02599d0 authored by 王炜's avatar 王炜

I-19408【建机运维】系统自动回传的电子合同打不开修复

parent 5c22f954
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: wangwei5743
$Date: 2024-5-31 上午10:38:31
$Revision: 1.0
$Purpose: 电子签约附件大小错误更新
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:fields>
<bm:field name="attachment_id"/>
<bm:field name="source_pk_value"/>
<bm:field name="file_path"/>
<bm:field name="file_size"/>
</bm:fields>
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
select F.ATTACHMENT_ID,F.SOURCE_PK_VALUE,F.FILE_PATH,F.FILE_SIZE
from fnd_atm_attachment f where f.creation_date>sysdate-1/24
and f.File_Path like substr(${@ele_con_file_path},1,2) || '%'
]]></bm:query-sql>
</bm:operation>
<bm:operation name="update">
<bm:update-sql><![CDATA[
BEGIN
UPDATE fnd_atm_attachment f
set f.file_size=${@file_size},
f.last_update_date=sysdate,
f.last_updated_by= nvl(${/session/@user_id},1)
where f.attachment_id=${@attachment_id}
and f.source_pk_value=${@source_pk_value};
COMMIT;
END;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: wangwei5743
$Date: 2024-5-31 上午10:38:31
$Revision: 1.0
$Purpose: 电子签约附件大小错误更新
-->
<a:service xmlns:s="leaf.plugin.script" xmlns:a="http://www.leaf-framework.org/application" trace="true">
<a:init-procedure>
<s:server-script><![CDATA[
importPackage(java.io);
//系统参数获取
function info_query(parameter_code) {
var info = new Object();
var data = null;
var parameter_map = $bm('wx.WX100.sys_parameter_value').queryAsMap({
parameter_code:parameter_code
});
var data = parameter_map.getChildren();
info.code_value = data[0].code_value;
return info;
}
var ele_con_file_path = info_query('HL_ELE_FILE_PATH').code_value;
function fileSizeFixed() {
var parameter_map = $bm('wx.WX100.con_ele_file_size_fixed').queryAsMap({
ele_con_file_path:ele_con_file_path
});
var data = parameter_map.getChildren();
var fixed_size_bm = $bm('wx.WX100.con_ele_file_size_fixed');
for (var i = 0; i < data.length; i++) {
var file_path = data[i].file_path;
var file_size =data[i].file_size;
var now_file_size=get_file_length(file_path);
if(file_size!=now_file_size){
fixed_size_bm.update({
file_size: now_file_size,
attachment_id: data[i].attachment_id,
source_pk_value: data[i].source_pk_value
})
}
}
}
//获取文件长度
function get_file_length(path){
var file=new File(String(path));
if (file.exists() && file.isFile()){
length=file.length();
return length;
} else{
return 0;
}
}
fileSizeFixed();
]]></s:server-script>
</a:init-procedure>
<a:service-output/>
</a:service>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment