Commit 50fbc82f authored by liyuan.chen's avatar liyuan.chen

[feat]合同变更文本,收款导入的匹配

parent ad586c05
Pipeline #6829 canceled with stages
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: gaoyang
$Date: 2013-4-15 下午01:13:07
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:s="leaf.plugin.script" xmlns:bm="http://www.leaf-framework.org/schema/bm" xmlns:f="leaf.database.features" alias="t1" baseTable="csh_transaction_bp_temp" needAccessControl="false">
<bm:fields>
<bm:field name="bp_id" databaseType="NUMBER" datatype="java.lang.Long" physicalName="BP_ID" prompt="HLS_BP_MASTER_V.BP_ID"/>
<bm:field name="bp_code" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="80" forDisplay="true" forQuery="true" physicalName="BP_CODE" prompt="HLS.BP_TITLE"/>
<bm:field name="bp_name" databaseType="VARCHAR2" datatype="java.lang.String" displayWidth="160" forDisplay="true" forQuery="true" physicalName="BP_NAME" prompt="HLS.BP_NAME_SHORT"/>
<bm:field name="bp_category" databaseType="VARCHAR2" datatype="java.lang.String" physicalName="BP_CATEGORY"/>
<bm:field name="bp_category_name" expression= "(SELECT h.description FROM hls_bp_category h where h.bp_category = t1.bp_category )" prompt="商业伙伴类型"/>
</bm:fields>
<bm:features>
<f:standard-who/>
<s:bm-script><![CDATA[
var cx = Packages.leaf.javascript.Context.getCurrentContext();
Packages.leaf.plugin.script.engine.ScriptImportor.defineExternScript(cx, this, $ctx.getData(), "aut_authority_bm_validate.js");
]]></s:bm-script>
</bm:features>
<bm:query-fields>
<bm:query-field field="bp_id" queryOperator="="/>
<bm:query-field field="bp_code" queryOperator="like"/>
<bm:query-field field="bp_name" queryExpression="t1.bp_name like &apos;%&apos;||${@bp_name}||&apos;%&apos;"/>
<!-- <bm:query-field field="bp_category" queryOperator="="/> -->
<bm:query-field field="bp_category" queryExpression="(t1.bp_category = ${@bp_category} or exists(select 1 from hls_bp_master_role br where br.bp_id = t1.bp_id and br.bp_category = ${@bp_category} and br.bp_type = ${@bp_category}))"/>
<bm:query-field name = "bp_category_name" queryExpression="(t1.bp_category_name like &apos;%&apos;||${@bp_category_name}||&apos;%&apos;)"/>
<!-- <bm:query-field name="contract_bp_flag" queryExpression="(exists (select 1 from con_contract_bp b where b.contract_id in (${:@contract_id}) and b.bp_id = t1.bp_id and b.bp_category in (&apos;VENDER&apos;,&apos;TENANT&apos;,&apos;TENANT_SEC&apos;) )or nvl(${@contract_bp_flag},&apos;N&apos;) != &apos;Y&apos; )"/> -->
</bm:query-fields>
<bm:data-filters>
<bm:data-filter name="query" expression="(t1.temp_id = ${@temp_id})"/>
</bm:data-filters>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: gaoyang
$Date: 2013-9-27 上午09:52:30
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="update">
<bm:update-sql><![CDATA[
begin
hl_con_contract_content_pkg.content_create_for_change(
p_contract_id =>${@contract_id},
p_content_id =>${@content_id},
p_user_id =>${/session/@user_id},
p_templet_usage =>${@templet_usage},
p_content_type =>${@content_type},
p_ccr_document_type => ${@ccr_document_type}
);
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
......@@ -19,7 +19,7 @@
t1.payment_deduction
from con_contract t1
where
t1.contract_status in ('INCEPT','NEW','ETING','REPURSING')
t1.contract_status in ('INCEPT','NEW','ETING','REPURING')
and t1.data_class = 'NORMAL'
and t1.company_id in ((
select company_id
......
......@@ -455,7 +455,7 @@
</a:hBox>
</a:form>
<a:grid id="acr515_invoiceVatDs_grid" bindTarget="acr515_invoiceVatDs" marginWidth="80" navBar="true" height="300">
<a:grid id="acr515_invoiceVatDs_grid" bindTarget="acr515_invoiceVatDs" marginWidth="80" navBar="true" marginHeight="200">
<a:columns>
<a:column name="contract_number" width="120"/>
<a:column name="document_number" lock="true" width="120" renderer="acr512_document_number_render"/>
......
......@@ -138,7 +138,7 @@
if (name == 'bs_link') {
return '<a href="javascript:open_bs_Window(\'' + record.id + '\',\'' + record.ds.id + '\')">明细</a>';
}
if(record.get('contract_status') == 'TERMINATE'){
if(record.get('contract_status') == 'TERMINATE' || record.get('contract_status') == 'INCEPT' || record.get('contract_status') == 'TERMINATING'){
if(name == 'con_seal_link'){
return '<a href="javascript:open_seal_win(\'' + record.id + '\',\'' + record.ds.id + '\')">用印信息</a>';
}
......
<?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-query fetchAll="true" model="cont.CON500.con_contract_get_guid_file_name" rootPath="guid_file_name_path"/>
<a:model-query fetchAll="true" model="cont.CON500.con_contract_get_guid_file_name"
rootPath="guid_file_name_path"/>
<!--<a:model-query fetchAll="true" model="cont.CON500.con_doc_file_templet_get_atm" rootPath="file_templet_get_atm_path"/>-->
<s:server-script import="contract_print_path.js"><![CDATA[
importPackage(java.io);
......@@ -112,7 +113,7 @@
} catch (e) {
raise_app_error(e);
}
if (record_data.templet_code == 'FINANCE_LEASE_CONTRACT'||record_data.templet_code == 'BUSINESS_CONTRACT'||record_data.templet_code == 'BUSINESS_CONTRACT_XJ'||record_data.templet_code=='LEASE_EXCHANGE'||record_data.templet_code=='LEASE_EXCHANGE_GN'||record_data.templet_code=='FINANCE_LEASE_CONTRACT_EX'||record_data.templet_code=='BUSINESS_CONTRACT_GK') {
if (record_data.templet_code == 'FINANCE_LEASE_CONTRACT'||record_data.templet_code == 'FINANCE_LEASE_CONTRACT_A4'||record_data.templet_code == 'BUSINESS_CONTRACT'||record_data.templet_code == 'BUSINESS_CONTRACT_XJ'||record_data.templet_code=='LEASE_EXCHANGE'||record_data.templet_code=='LEASE_EXCHANGE_GN'||record_data.templet_code=='FINANCE_LEASE_CONTRACT_EX'||record_data.templet_code=='BUSINESS_CONTRACT_GK') {
// word转pdf
var pdf_file_path=datePath+guid_file_name_tables[0].guid_file_name + 'con_' + record_data.content_id;
......
......@@ -20,6 +20,8 @@
url="${/request/@context_path}/modules/cont/CON701/con_contract_et_print.lsc"/>
<a:link id="assignment_agreement_print_link"
url="${/request/@context_path}/modules/cont/CON732/hls_ccr_modify_assignment_agreement_print.lsc"/>
<a:link id="hls_crr_query_print_link_id"
url="${/request/@context_path}/modules/cont/CON732/hls_crr_query_print_word_detail.lview"/>
<script type="text/javascript"><![CDATA[
function open_contract_win(ds_id, record_id) {
var record = $(ds_id).findById(record_id);
......@@ -72,7 +74,64 @@
height: '400'
});
}
//选择事件(grid,attach,gridbox,table)
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_select'] = function (ds, record, bp_seq) {
if(record.get('req_status') != 'APPROVED' || record.get('ccr_document_type') == 'ACC_CHAG' || record.get('ccr_document_type') == 'CUT_CHAG'){
document.getElementById("${/parameter/@layout_code}_user_button3").style.display = "none";
}else{
document.getElementById("${/parameter/@layout_code}_user_button3").style.display = "";
}
};
/*//取消选择事件(grid,attach,gridbox,table)
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_unselect'] = function (ds, record, bp_seq) {
document.getElementById("CON734_user_button3").style.display = "";
};*/
//文本生成
window['${/parameter/@layout_code}_user_button3_layout_dynamic_click'] = function () {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
var prj_project_result_ds = $(ds_id);
var records = prj_project_result_ds.getSelected();
if (records.length != 1) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.SELECT_RECORD}');
return false;
}
var record = records[0];
var ccr_document_type = record.get('ccr_document_type');
//var req_status = record.get('req_status');
var contract_id = record.get('change_req_id');
new Leaf.Window({
id: 'open_print_detail_win',
params: {
contract_id: contract_id,
ccr_document_type: ccr_document_type,
document_category: record.get('document_category'),
business_type : record.get('business_type'),
content_type : 'NORMAL',
winid: 'open_print_detail_win'
},
url: $('hls_crr_query_print_link_id').getUrl(),
title: '${l:CON505.CON_CONTENT_PRINT}',
width: 1000,
height: 450
});
/*if (req_status != 'APPROVED') {
Leaf.showMessage('${l:PROMPT}', '只有审批通过的合同才能打印!');
return false;
}*/
// ACC_CHAG 回款账户变更 LEASE_CHAG 承租人变更 CUT_CHAG 租金计划变更
/*if (ccr_document_type == 'LEASE_CHAG') {
var templet_code = 'ASSIGNMENT_AGREEMENT';
var url = $('assignment_agreement_print_link').getUrl() + '?contract_id=' + contract_id + '&templet_code=' + templet_code;
window.open(url, '_self');
}
if(ccr_document_type == 'ACC_CHAG'){
}*/
};
window['${/parameter/@layout_code}_dynamic_link_renderer'] = function (value, record, name, config_record) {
// if (name == 'contract_number' && value) {
// return '<a href="javascript:open_contract_win(\'' + record.ds.id + '\',\'' + record.id + '\')">' + value + '</a>';
......
<?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-query fetchAll="true" model="cont.CON500.con_contract_get_guid_file_name"
rootPath="guid_file_name_path"/>
<!--<a:model-query fetchAll="true" model="cont.CON500.con_doc_file_templet_get_atm" rootPath="file_templet_get_atm_path"/>-->
<s:server-script import="contract_print_path.js"><![CDATA[
importPackage(java.io);
importPackage(Packages.hls.plugin.docx4j);
importPackage(Packages.leaf.plugin.word2pdf);
importPackage(Packages.org.apache.commons.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 deleteFile(filePath) {
var file = new File(filePath);
if (file.exists()) {
file.delete();
}
}
//生成pdf
function wordToPdf(word_file_path,pdf_file_path) {
// word转pdf
var pdf_file_path_new = pdf_file_path + '.pdf';
var wordToPdf = new WordToPdf($instance('uncertain.ocm.IObjectRegistry'), "jacob-1.18-x64.dll");
wordToPdf.word2pdf(word_file_path, pdf_file_path_new);
//删除word文件
// deleteFile(word_file_path);
return pdf_file_path_new;
}
//生成pdf openoffice
function doc2pdf(word_file_path,pdf_file_path) {
// word转pdf
var pdf_file_path_new = pdf_file_path + '.pdf';
var wordToPdf = new doc2pdf2();
wordToPdf.doc2pdf2("C:/Program Files (x86)/OpenOffice 4",word_file_path, pdf_file_path_new);
//删除word文件
deleteFile(word_file_path);
return pdf_file_path_new;
}
//生成pdf
function AsposeWordToPDF(word_file_path,pdf_file_path) {
// word转pdf
var pdf_file_path_new = pdf_file_path + '.pdf';
var wordToPdf = new AsposeUtil();
wordToPdf.trans(word_file_path, pdf_file_path_new,"word");
//删除word文件
deleteFile(word_file_path);
return pdf_file_path_new;
}
//按日期创建目录
function getDatePath() {
set_parameter_file_path();
var file_path = $ctx.parameter.pdf_path; //file_path = c:/hls_test_files/content_files/
var now = new Date()
y = now.getFullYear()
m = now.getMonth() + 1
m = m < 10 ? "0" + m : m
var datePath = file_path + y + "/" + m + "/";
return datePath; //datePath = d:/hls_test_files/fileupload/2018/04/
}
//第一步生成合同文本
$bm('cont.CON732.con_contract_create_content').update({
contract_id: $ctx.parameter.contract_id,
ccr_document_type: $ctx.parameter.ccr_document_type,
content_type:'NORMAL'
});
var datePath = getDatePath();
FileUtils.forceMkdir(new File(datePath)); //根据日期创建目录
var from_file_data_map=$bm('cont.CON500.con_doc_file_templet_get_atm').queryAsMap({
contract_id:$ctx.parameter.contract_id,
batch_flag:$ctx.parameter.batch_flag
});
var from_file_data = from_file_data_map.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];
if (record_data.file_exists_flag != 'Y') {
var to_file_name = record_data.to_file_name + '.' + record_data.file_type_code || 'doc';
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 + 'con' + record_data.content_id+ '.' + record_data.file_type_code || 'doc';
copyFile(from_file_path, to_file_path);
try {
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);
} catch (e) {
raise_app_error(e);
}
// if (record_data.templet_code == 'FINANCE_LEASE_CONTRACT'||record_data.templet_code == 'FINANCE_LEASE_CONTRACT_A4'||record_data.templet_code == 'BUSINESS_CONTRACT'||record_data.templet_code == 'BUSINESS_CONTRACT_XJ'||record_data.templet_code=='LEASE_EXCHANGE'||record_data.templet_code=='LEASE_EXCHANGE_GN'||record_data.templet_code=='FINANCE_LEASE_CONTRACT_EX'||record_data.templet_code=='BUSINESS_CONTRACT_GK') {
// word转pdf
var pdf_file_path=datePath+guid_file_name_tables[0].guid_file_name + 'con_' + record_data.content_id;
var outputfilepath = wordToPdf(to_file_path,pdf_file_path);
var outputfilename= record_data.to_file_name +'.pdf';
var pdf_file = new File(outputfilepath);
var file_size = 0;
if (pdf_file.exists()) {
file_size = pdf_file.length();
}
//保存文本名及路径
$bm('cont.CON500.con_file_content_copy_update').execute({
table_name: 'CON_CONTRACT_CONTENT',
content_id: record_data.content_id,
file_name: outputfilename.toString(),
file_path: outputfilepath.toString(),
file_size: file_size,
file_type_code: 'pdf',
mime_type: 'application/pdf',
user_id: $ctx.parameter.user_id
});
// }
// else{
// $bm('cont.CON500.con_file_content_copy_update').update({
// table_name: 'CON_CONTRACT_CONTENT',
// content_id: record_data.content_id,
// file_name: to_file_name.toString(),
// file_path: to_file_path.toString()
// });
// }
}
}
]]></s:server-script>
</a:init-procedure>
</a:service>
\ No newline at end of file
......@@ -114,6 +114,14 @@
}
}
function indexchange_data(ds, record) {
if(record.get('exists_flag') == 'Y'){
var field = record.getField('bp_name');
field.setLovService('basic.csh_transaction_bp_temp_for_lov');
field.setLovPara('temp_id', record.get('temp_id'));
}
}
]]></script>
<a:dataSets>
......@@ -153,6 +161,7 @@
</a:fields>
<a:events>
<a:event name="update" handler="update_import_data"/>
<a:event name="indexchange" handler="indexchange_data" />
</a:events>
</a:dataSet>
</a:dataSets>
......
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