Commit 4023c35a authored by 18083's avatar 18083

非银企直连流程附件处理

parent 0aa22002
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: trd
$Date: 2023-12-26 下午03:17:55
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="execute">
<bm:update-sql><![CDATA[
BEGIN
CSH_PAYMENT_JE_PKG.insert_fnd_atm(
p_table_name =>${@table_name},
p_table_pk_value =>${@journal_id},
p_file_name =>${@file_name},
p_file_path =>${@file_path},
p_user_id =>nvl(${/session/@user_id},${@user_id}),
p_file_size =>${@file_size}
);
END;
]]></bm:update-sql>
</bm:operation>
<bm:operation name="query">
<bm:query-sql><![CDATA[
SELECT
faa.file_name,
faa.file_path,
faa.file_type_code,
m.table_name,
hd.payment_req_number||'_'||faa.file_name to_file_name
FROM fnd_atm_attachment faa,
fnd_atm_attachment_multi m,
csh_payment_req_hd hd
WHERE faa.attachment_id = m.attachment_id
AND m.table_name in ('INVOICE', 'OTHERS', 'PAYMENT_REQUEST_LETTER')
AND m.table_pk_value = hd.payment_req_id
and hd.payment_req_id = ${@payment_req_id}
]]></bm:query-sql>
</bm:operation>
</bm:operations>
<bm:fields>
<bm:field name="file_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_NAME"/>
<bm:field name="file_path" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_PATH"/>
<bm:field name="table_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TABLE_NAME"/>
<bm:field name="file_type_code" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="FILE_TYPE_CODE"/>
<bm:field name="to_file_name" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="TO_FILE_NAME"/>
</bm:fields>
</bm:model>
......@@ -15,9 +15,9 @@
IF ${@payment_req_number} IS NULL THEN
v_payment_req_number :=csh_payment_req_pkg.get_payment_req_number( p_document_type =>${@document_type}, p_transaction_date =>${@req_date}, p_company_id =>NVL(${@company_id},${/session/@company_id}), p_user_id =>${/session/@user_id}, p_document_category =>${@document_category});
csh_payment_req_pkg.update_payment_req_number(p_payment_req_id=>${@payment_req_id},p_payment_req_number=>v_payment_req_number);
csh_payment_req_pkg.create_cdd(p_payment_req_id =>${@payment_req_id},
p_user_id =>${/session/@user_id},
p_cdd_list_id =>${@cdd_list_id});
csh_payment_req_pkg.create_payment_cdd(p_payment_req_id =>${@payment_req_id},
p_user_id =>${/session/@user_id}
);
${@payment_req_number}:= v_payment_req_number;
END IF;
aut_document_authority_pkg.insert_trx_user_authority
......
......@@ -130,7 +130,7 @@
hls_doc_file_templet_pkg.init_hls_doc_file_content(
p_document_id =>${/parameter/@document_id},
p_document_table =>${/parameter/@document_table},
p_user_id =>${/session/@user_id});
p_user_id =>nvl(${/session/@user_id},${/parameter/@user_id}));
end;
]]></bm:update-sql>
</bm:operation>
......
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
<a:init-procedure>
<s:server-script import="con_print_path.js"><![CDATA[
set_parameter_file_path();
]]></s:server-script>
<s:server-script><![CDATA[
importPackage(java.io);
importPackage(Packages.hls.plugin.docx4j);
function copyFile(fOld, fNew) {
var fis = new java.io.FileInputStream(fOld);
var fos = new java.io.FileOutputStream(fNew);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 4);
var len = -1;
while ((len = fis.read(b)) != -1) {
fos.write(b, 0, len);
}
fis.close();
fos.close();
}
//获取文件长度
function get_file_length(path){
var file=new File(String(path));
if(file.exists() && file.isFile()){
length=file.length();
return length;
}else{
return 0 ;
}
}
//获取原文件信息
var file_templet_get_atm_path = $bm('csh.CSH501.csh_journal_get_atm').queryAsMap({
payment_req_id: $ctx.parameter.payment_req_id,
user_id :$ctx.parameter.user_id
});
var from_file_data = file_templet_get_atm_path.getChildren();
for (var i = 0;i < from_file_data.length;i++) {
var to_file_path = $ctx.parameter.file_path;
var record_data = from_file_data[i];
var to_file_name = record_data.to_file_name;
var from_file_path = record_data.file_path;
println(table_name);
var guid_file_name_path = $bm('cont.CON500.con_contract_get_guid_file_name').queryAsMap();
var guid_file_name_tables = guid_file_name_path.getChildren();
to_file_path = to_file_path + guid_file_name_tables[0].guid_file_name;
copyFile(from_file_path, to_file_path);
//得到生成的pdf文件的大小
var file_size=get_file_length(to_file_path.toString());
var table_name = record_data.table_name;
$bm('csh.CSH501.csh_journal_get_atm').execute({
table_name: table_name,
journal_id: $ctx.parameter.journal_id,
file_name: to_file_name.toString(),
file_path: to_file_path.toString(),
file_size: file_size,
user_id :$ctx.parameter.user_id
});
}
]]></s:server-script>
</a:init-procedure>
</a:service>
......@@ -36,6 +36,8 @@
<!-- 生成Excel文件-->
<a:link id="tre_loan_con_print_excel_link_id"
url="${/request/@context_path}/modules/csh/CSH501/csh_payment_contract_export.lsc"/>
<a:link id="csh_uploadFile_id" url="${/request/@context_path}/uploadFile.lview"/>
<a:link id="csh_downloadFile_id" url="${/request/@context_path}/downloadFile.lview"/>
<script type="text/javascript"><![CDATA[
jQuery.noConflict();
var con_business_type='${/parameter/@con_business_type}'||'${/model/loan_flag_path/record/@business_type}'||'LEASE';
......@@ -103,10 +105,36 @@
dirty_flag = 'Y';
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var lnds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
hd_ds = $(hdds_id);
var hdrecord = hd_ds.getCurrentRecord();
var bank_account_name = hdrecord.get('third_bp_id_n');
var vender_bank_account_id = hdrecord.get('t_bank_account_id');
var bank_account_num = hdrecord.get('t_bank_account_num');
var hd_ds, ln_ds, lineRecords, currency_code, currency_name;
if (hdds_id) {
hd_ds = $(hdds_id);
hdrecord = hd_ds.getCurrentRecord();
if((name == 't_bank_account_name'||name == 't_bank_account_name_n') && !Ext.isEmpty(hdrecord.get('t_bank_account_name_n')) && !Ext.isEmpty(hdrecord.get('third_bp_id_n'))){
var records = $(lnds_id).getAll();
for (var i = 0; i < records.length; i++) {
records[i].set('vender_bank_account_number', bank_account_num);
records[i].set('vender_bank_account_number_n', bank_account_num);
records[i].set('vender_bank_account_name', bank_account_name);
records[i].set('vender_bank_account_id', vender_bank_account_id);
records[i].getField('vender_bank_account_number').setReadOnly(true);
records[i].getField('vender_bank_account_number_n').setReadOnly(true);
}
}
if((name == 'third_bp_id'||name == 'third_bp_id_n') && (Leaf.isEmpty(record.get('document_number_t')) || bank_account_name=='')){
var records = $(lnds_id).getAll();
hdrecord.set('t_bank_account_num',null);
hdrecord.set('t_bank_branch_name',null);
hdrecord.set('t_bank_full_name',null);
hdrecord.set('t_bank_account_id',null);
for (var i = 0; i < records.length; i++) {
records[i].getField('vender_bank_account_number').setReadOnly(false);
records[i].getField('vender_bank_account_number_n').setReadOnly(false);
}
}
}
if (lnds_id && $L.CmpManager.get(lnds_id)) {
ln_ds = $(lnds_id);
......@@ -164,13 +192,29 @@
};
window['${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function (ds, record, config_records, bp_seq) {
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
debugger;
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var hd_ds, lineRecords, currency_code;
if (hdds_id) {
hd_ds = $(hdds_id);
hdrecord = hd_ds.getCurrentRecord();
}
if (ds.id == ds_id) {
var handrecord = $(hdds_id).getCurrentRecord();
if (!Ext.isEmpty(handrecord)) {
var bank_account_name = handrecord.get('third_bp_id_n');
if (!Ext.isEmpty(hdrecord.get('third_bp_id_n'))) {
var records = $(ds_id).getAll();
for (var i = 0; i < records.length; i++) {
records[i].getField('vender_bank_account_number').setReadOnly(true);
records[i].getField('vender_bank_account_number_n').setReadOnly(true);
}
}
}
}
if (record) {
if ('${/parameter/@function_code}' == 'CSH502D') {
record.getField('pay_amount').setReadOnly(false);
......@@ -188,8 +232,15 @@
}
}
var lnds_records = $(ds_id).getAll();
if (con_business_type == 'LEASEBACK'){
debugger
if (ds.id == ds_id) {
for (var i = 0; i < lnds_records.length; i++) {
if (lnds_records[i].get('division') == '70' || lnds_records[i].get('division') == '92') {
lnds_records[i].getField('tenant_bank_account_number').setRequired(false);
lnds_records[i].getField('tenant_bank_account_number_n').setRequired(false);
}
}
}
if (con_business_type == 'LEASEBACK'){
if ('${/parameter/@division}' ==91||'${/parameter/@division}' =='神钢建机'){
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var records = $(ds_id).getAll();
......@@ -220,15 +271,6 @@
}
}
}
var lnds_records = $(ds_id).getAll();
if (ds.id == ds_id) {
for (var i = 0; i < lnds_records.length; i++) {
if (lnds_records[i].get('division') == '70' || lnds_records[i].get('division') == '92') {
lnds_records[i].getField('tenant_bank_account_number').setRequired(false);
lnds_records[i].getField('tenant_bank_account_number_n').setRequired(false);
}
}
}
//非虚拟店 应付承租人金额非必填且未只读
if(is_constru_unit != 'Y'){
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
......@@ -273,8 +315,7 @@
}
}
}
if ('${/parameter/@division}' ==91||'${/parameter/@division}' =='神钢建机'||'${/parameter/@division}' ==92||'${/parameter/@division}' =='北京卡家' ){
debugger
if ('${/parameter/@division}' ==91||'${/parameter/@division}' =='神钢建机'||'${/parameter/@division}' ==92||'${/parameter/@division}' =='北京心诚' ){
if (con_business_type == 'LEASEBACK'){
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var records = $(ds_id).getAll();
......@@ -375,7 +416,6 @@
//打印
function csh501_print() {
var hdds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_hd');
var hd_record = $(hdds_id).getCurrentRecord();
......@@ -424,6 +464,13 @@
var head_record = $(ds_id).getAt(0);
//高空作业车个数
var gk_contract_num = 0;
if(!Ext.isEmpty(head_record.get('t_bank_account_id'))){
for (var i = 0; i < line_datas.length; i++) {
var line_data = line_datas[i];
line_data.set('vender_bank_account_id',head_record.get('t_bank_account_id'));
}
}
for (var i = 0; i < line_datas.length; i++) {
var line_data = line_datas[i];
//应付我司金额
......@@ -479,16 +526,12 @@
}
} else if (con_business_type == 'LEASEBACK') {
var entrusted_amount = get_current_amount(line_data.get('entrusted_amount'));
if (plus(plus(amount_agent, amount_vender),repur_con_ddct_amt) != entrusted_amount && is_constru_unit =!= 'Y') {
$L.showErrorMessage("提示", '应付代理店金额、应付厂商金额、回购租金抵冲金额合计不等于合同签约时承租人所填写委托付款金额,请重新填写!',null,500,300);
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return false;
}
if (plus(plus(plus(plus(amount_agent, amount_vender), other_payment2), repur_con_ddct_amt), amount_tenant) != due_amount) {
$L.showErrorMessage("提示", '应付我司金额,委托付款金额,应付承租人金额,首付款抵冲金额和回购租金抵冲金额之和应等于应付金额!',null,500,300);
window['${/parameter/@layout_code}_unlock_layout_dynamic_window']();
return false;
}
//add by 18938
if(is_constru_unit == 'Y'){
if(plus(plus(plus(other_payment2, amount_tenant), amount_vender), repur_con_ddct_amt) != lease_item_amount){
......@@ -597,6 +640,7 @@
record.set('contract_id', '${/parameter/@contract_id}');
}
}
var head_record = $(hdds_id).getAt(0);
if (hdds_id == ds.id) {
if ('${/parameter/@function_usage}' == 'READONLY') {
......@@ -608,6 +652,34 @@
record.getField('las_compensatory_amount').setReadOnly(true);
}
}
if(head_record.get('con_division') == '30' || head_record.get('con_division') == '50'||'${/parameter/@division}' == '50' || '${/parameter/@division}' == '30'){
// record.getField('third_bp_id').setRequired(true);
// record.getField('third_bp_id_n').setRequired(true);
// record.getField('t_bank_account_name').setRequired(true);
//record.getField('t_bank_account_name_n').setRequired(true);
}else{
if(document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_THIRD_BP_ID')){
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_THIRD_BP_ID_prompt').style.display = 'none';
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_THIRD_BP_ID').style.display = 'none';
}
if(document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_ACCOUNT_NAME')){
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_ACCOUNT_NAME_prompt').style.display = 'none';
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_ACCOUNT_NAME').style.display = 'none';
}
if(document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_ACCOUNT_NUM')){
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_ACCOUNT_NUM_prompt').style.display = 'none';
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_ACCOUNT_NUM').style.display = 'none';
}
if(document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_FULL_NAME')){
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_FULL_NAME_prompt').style.display = 'none';
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_FULL_NAME').style.display = 'none';
}
if(document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_BRANCH_NAME')){
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_BRANCH_NAME_prompt').style.display = 'none';
document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_T_BANK_BRANCH_NAME').style.display = 'none';
}
}
//add by 18938
if(is_constru_unit == 'Y'){
if(document.getElementById('CSH501D_PAYMENT_REQ_HD_CSH_PAYMENT_REQ_HD_THIRD_BP_ID')){
......@@ -639,7 +711,7 @@
var payment_req_id = hd_record.get('payment_req_id');
//获得相应的行信息
var lnds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'csh_payment_req_ln');
var cdd_file_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'hl_cm_cdd_file_list');
$(lnds_id).setQueryUrl('${/request/@context_path}/autocrud/csh.CSH501.csh_payment_req_ln_query_after_save/query');
......@@ -668,6 +740,9 @@
$(lnds_id).setQueryParameter('payment_req_id', payment_req_id);
$(lnds_id).query();
//保存成功,刷新附件数据 18083 2023/12/28
$(cdd_file_id).setQueryParameter('payment_req_id', payment_req_id);
$(cdd_file_id).query();
} else {
Leaf.showMessage('${l:PROMPT}', '请先保存数据');
......@@ -700,11 +775,59 @@
hls_doc_get_layout_code('csh501d_get_layout_code_link_id', param, 'con_rd_wfl_link', '', '${/parameter/@layout_code}');
}
window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record, bp_seq) {
function upload_file(id,name,record_id,item_code) {
var record = window['${/parameter/@layout_code}_hls_link_render_record'][id + '---' + name];
if (item_code=='INVOICE') {
var url = $('csh_uploadFile_id').getUrl() + '?table_name=INVOICE&header_id=' + record_id;
}else if(item_code=='PAYMENT_REQUEST_LETTER'){
var url = $('csh_uploadFile_id').getUrl() + '?table_name=PAYMENT_REQUEST_LETTER&header_id=' + record_id;
}else if(item_code=='OTHERS'){
var url = $('csh_uploadFile_id').getUrl() + '?table_name=OTHERS&header_id=' + record_id;
}
var win = new Leaf.Window({
url: url,
title: '${l:HLS.SUPPORTING_DOCUMENT}',
id: 'csh_attachment_uploadFile_id',
width: 850,
height: 400
});
win.on('close', function () {
record.ds.query();
});
}
window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record, bp_seq) {
var link_function = '';
window['${/parameter/@layout_code}_hls_link_render_record'][record.id + '---' + name] = record;
if (name == 'contract_number' && value) {
return '<a href="javascript:open_con_contract_readonly_win(\'' + record.id + '\',\'' + record.ds.id + '\')">' + value + '</a>';
}else if (name == 'attachment'){
return '<a href=javascript:upload_file(\''+record.id+'\',\''+ name + '\',\'' +record.get('payment_req_id')+'\',\'' + record.get('item_code')+'\')>附件上传</a>';
} else if (name == 'attach_file_name') {
if (value != null) {
var link = '${/request/@context_path}/atm_download.lsc?attachment_id=';
var str = value.split(';;');
var url = '';
for (var i = 0; i < str.length; i++) {
var temp = str[i].split('--');
if (!Leaf.isEmpty(temp[0])) {
var file_name = temp[0].toUpperCase();
var file_suffix = temp[0].substr(temp[0].lastIndexOf('.') + 1).toUpperCase();
if (file_name.indexOf('.PDF') >= 0) {
url = url + '<a href=javascript:view_pdf(\'' + temp[1] + '\')>' + temp[0] + '</a>' + ',';
} else if (file_suffix == 'BMP' || file_suffix == 'JPG' || file_suffix == 'JPEG' || file_suffix == 'PNG' || file_suffix == 'GIF') {
url = url + '<a href=' + link + temp[1] + ' ref="img">' + temp[0] + '</a>' + ',';
} else {
url = url + '<a href=' + link + temp[1] + '>' + temp[0] + '</a>' + ',';
}
}
}
return url;
}
}
};
window['${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function (ds, qpara, bp_seq) {
......@@ -716,6 +839,7 @@
}
]]></script>
<a:link id="${/parameter/@layout_code}csh511_csh_payment_req_hd_query" model="csh.CSH511.csh_payment_req_hd"
modelaction="query"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
<a:init-procedure>
<a:model-update model="hls.HLS811.hls_doc_file_templet_get_atm"/>
<s:server-script import="con_print_path.js"><![CDATA[
importPackage(Packages.hls.plugin.docx4j);
importPackage(Packages.com.hand.hls.hlcm.util);
importPackage(java.io);
function copyFile(fOld, fNew) {
var fis = new java.io.FileInputStream(fOld);
var fos = new java.io.FileOutputStream(fNew);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 4);
var len = -1;
while ((len = fis.read(b)) != -1) {
fos.write(b, 0, len);
}
fis.close();
fos.close();
}
function transfer(file_path, os) {
println(file_path);
var fis = new FileInputStream(file_path);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 64);
var len = -1;
while ((len = fis.read(b)) != -1) {
os.write(b, 0, len);
}
fis.close();
}
var attachment_batch_dl = $bm('hls.HLS811.hls_doc_file_templet_get_atm');
var result = attachment_batch_dl.queryAsMap({
document_id: $ctx.parameter.document_id,
document_table: $ctx.parameter.document_table,
batch_flag: $ctx.parameter.batch_flag,
content_id: $ctx.parameter.content_id
});
var from_file_data = result.getChildren();
for (var i = 0;i < from_file_data.length;i++) {
if (!$ctx.parameter.file_path) {
set_parameter_file_path();
}
var to_file_path = $ctx.parameter.file_path;
var record_data = from_file_data[i];
var to_file_name = record_data.to_file_name;
var from_file_path = record_data.file_path;
var guid_file_name_path = $bm('cont.CON500.con_contract_get_guid_file_name').queryAsMap();
var guid_file_name_tables = guid_file_name_path.getChildren();
to_file_path = to_file_path + guid_file_name_tables[0].guid_file_name + 'doc' + record_data.content_id;
copyFile(from_file_path, to_file_path);
$bm('hls.HLS811.hls_file_content_copy_update').update({
table_name: 'PAYMENT_APPROVAL_PROCESS',
content_id: $ctx.parameter.journal_id,
file_name: to_file_name.toString(),
file_path: to_file_path.toString(),
source_type: $ctx.parameter.source_type
});
try {
$bm('csh.CSH501.csh_transaction_return_print').update({
document_id: $ctx.parameter.document_id,
document_table: $ctx.parameter.document_table
});
var brwt = new BookmarksReplaceWithText($instance('leaf.database.service.IDatabaseServiceFactory'), $instance('uncertain.ocm.IObjectRegistry'), $ctx.getData());
brwt.replaceBookmarkFromContent(to_file_path.toString(), record_data.content_id.toString(), 'COMMON');
var resp = $ctx['_instance.javax.servlet.http.HttpServletResponse'];
} catch (e) {
raise_app_error(e);
}
}
]]></s:server-script>
</a:init-procedure>
</a:service>
<?xml version="1.0" encoding="UTF-8"?>
<a:service xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" trace="true">
<a:init-procedure>
<a:model-update model="hls.HLS811.hls_doc_file_templet_get_atm"/>
<s:server-script import="con_print_path.js"><![CDATA[
importPackage(Packages.hls.plugin.docx4j);
importPackage(java.io);
function copyFile(fOld, fNew) {
var fis = new java.io.FileInputStream(fOld);
var fos = new java.io.FileOutputStream(fNew);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 4);
var len = -1;
while ((len = fis.read(b)) != -1) {
fos.write(b, 0, len);
}
fis.close();
fos.close();
}
function transfer(file_path, os) {
println(file_path);
var fis = new FileInputStream(file_path);
var b = new java.lang.reflect.Array.newInstance(java.lang.Byte.TYPE, 1024 * 64);
var len = -1;
while ((len = fis.read(b)) != -1) {
os.write(b, 0, len);
}
fis.close();
}
var attachment_batch_dl = $bm('hls.HLS811.hls_doc_file_templet_get_atm');
var result = attachment_batch_dl.queryAsMap({
document_id: $ctx.parameter.document_id,
document_table: $ctx.parameter.document_table,
batch_flag: $ctx.parameter.batch_flag,
content_id: $ctx.parameter.content_id
});
var from_file_data = result.getChildren();
for (var i = 0;i < from_file_data.length;i++) {
if (!$ctx.parameter.file_path) {
set_parameter_file_path();
}
var to_file_path = $ctx.parameter.file_path;
var record_data = from_file_data[i];
var to_file_name = record_data.to_file_name;
var from_file_path = record_data.file_path;
var guid_file_name_path = $bm('cont.CON500.con_contract_get_guid_file_name').queryAsMap();
var guid_file_name_tables = guid_file_name_path.getChildren();
to_file_path = to_file_path + guid_file_name_tables[0].guid_file_name + 'doc' + record_data.content_id;
copyFile(from_file_path, to_file_path);
$bm('hls.HLS811.hls_file_content_copy_update').update({
table_name: 'PAYMENT_APPROVAL_PROCESS',
content_id: $ctx.parameter.journal_id,
file_name: to_file_name.toString(),
file_path: to_file_path.toString(),
source_type: $ctx.parameter.source_type
});
try {
$bm('csh.CSH501.csh_transaction_return_print').update({
document_id: $ctx.parameter.document_id,
document_table: $ctx.parameter.document_table
});
var brwt = new BookmarksReplaceWithText($instance('leaf.database.service.IDatabaseServiceFactory'), $instance('uncertain.ocm.IObjectRegistry'), $ctx.getData());
brwt.replaceBookmarkFromContent(to_file_path.toString(), record_data.content_id.toString(), 'COMMON');
} catch (e) {
raise_app_error(e);
}
}
]]></s:server-script>
</a:init-procedure>
</a:service>
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