Commit 32824af2 authored by 25484's avatar 25484

[feat]提起结清与会回购文本打印

parent c6c46a0d
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
<a:link id="con_et_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/> <a:link id="con_et_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
<a:link id="con_et_change_link" url="${/request/@context_path}/modules/cont/CON_ET001/con_early_termination_et_detail.lview"/> <a:link id="con_et_change_link" url="${/request/@context_path}/modules/cont/CON_ET001/con_early_termination_et_detail.lview"/>
<a:link id="con_et_create_change_link" model="cont.CON_ET001.create_change_req" modelaction="execute"/> <a:link id="con_et_create_change_link" model="cont.CON_ET001.create_change_req" modelaction="execute"/>
<a:link id="con_grant_deduct_print_link" url="${/request/@context_path}/modules/cont/CON732/hls_ccr_modify_assignment_agreement_print.lsc"/>
<script type="text/javascript"><![CDATA[ <script type="text/javascript"><![CDATA[
function contractQueryScreen_query() { function contractQueryScreen_query() {
$('contractQueryScreen_mainDs').query(); $('contractQueryScreen_mainDs').query();
...@@ -34,6 +35,22 @@ ...@@ -34,6 +35,22 @@
} }
return value; return value;
} }
//提前结清文本打印
function con_gur_np_pint(){debugger;
var prj_project_result_ds = $('contractQueryScreen_mainDs');
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 contract_id = record.get('contract_id');
var templet_code = 'CON_GUR_NP';
var url = $('con_grant_deduct_print_link').getUrl() + '?contract_id=' + contract_id + '&templet_code=' + templet_code;
window.open(url, '_self');
}
function open_change_req_detail(change_req_id,contract_id) { function open_change_req_detail(change_req_id,contract_id) {
var param = {}; var param = {};
param['change_req_id'] = change_req_id; param['change_req_id'] = change_req_id;
...@@ -124,6 +141,7 @@ ...@@ -124,6 +141,7 @@
<a:screenTitle/> <a:screenTitle/>
<a:gridButton click="contractQueryScreen_query" text="HLS.QUERY"/> <a:gridButton click="contractQueryScreen_query" text="HLS.QUERY"/>
<a:gridButton click="contractQueryScreen_reset" text="HLS.RESET"/> <a:gridButton click="contractQueryScreen_reset" text="HLS.RESET"/>
<a:gridButton click="con_gur_np_pint" text="提前结清补充协议"/>
</a:screenTopToolbar> </a:screenTopToolbar>
<a:form column="4" labelWidth="100" marginWidth="40" title="HLS.QUERY_TITLE"> <a:form column="4" labelWidth="100" marginWidth="40" title="HLS.QUERY_TITLE">
<a:textField name="change_req_number" bindTarget="contractQueryScreen_paraDs" prompt="合同变更编号"/> <a:textField name="change_req_number" bindTarget="contractQueryScreen_paraDs" prompt="合同变更编号"/>
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/> <a:link id="con_contract_get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code" modelaction="update"/>
<a:link id="con_contract_repo_modify_link" url="${/request/@context_path}/modules/cont/CON501N/con_contract_modify.lview"/> <a:link id="con_contract_repo_modify_link" url="${/request/@context_path}/modules/cont/CON501N/con_contract_modify.lview"/>
<a:link id="con_contract_repo_change_link" url="${/request/@context_path}/modules/cont/CON_REPO001/con_contract_change_repo_detail.lview"/> <a:link id="con_contract_repo_change_link" url="${/request/@context_path}/modules/cont/CON_REPO001/con_contract_change_repo_detail.lview"/>
<a:link id="con_grant_deduct_print_link" url="${/request/@context_path}/modules/cont/CON732/hls_ccr_modify_assignment_agreement_print.lsc"/>
<script type="text/javascript"><![CDATA[ <script type="text/javascript"><![CDATA[
function open_contract_win(ds_id, record_id) { function open_contract_win(ds_id, record_id) {
var record = $(ds_id).findById(record_id); var record = $(ds_id).findById(record_id);
...@@ -21,7 +22,7 @@ ...@@ -21,7 +22,7 @@
param['url_title'] = '${l:CON301.CONTRACT_DETAIL}'; param['url_title'] = '${l:CON301.CONTRACT_DETAIL}';
hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_repo_modify_link', ds_id); hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_repo_modify_link', ds_id);
} }
function open_change_detail(ds_id, record_id) { function open_change_detail(ds_id, record_id) {
var record = $(ds_id).findById(record_id); var record = $(ds_id).findById(record_id);
var param = record.data; var param = record.data;
...@@ -40,17 +41,18 @@ ...@@ -40,17 +41,18 @@
} }
return value; return value;
}; };
window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() { window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function() {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
var prj_project_result_ds = $(ds_id); var prj_project_result_ds = $(ds_id);
var records = prj_project_result_ds.getSelected(); var records = prj_project_result_ds.getSelected();
if (records.length != 1) { if (records.length != 1) {
Leaf.showMessage('${l:PROMPT}', '${l:HLS.SELECT_RECORD}'); Leaf.showMessage('${l:PROMPT}', '${l:HLS.SELECT_RECORD}');
return; return;
} }
var record = records[0]; var record = records[0];
var req_status = record.get('req_status'); var req_status = record.get('req_status');
var param = record.data; var param = record.data;
var req_status = record.get('req_status'); var req_status = record.get('req_status');
...@@ -70,7 +72,23 @@ ...@@ -70,7 +72,23 @@
hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_repo_change_link', ds_id); hls_doc_get_layout_code('con_contract_get_layout_code_link_id', param, 'con_contract_repo_change_link', ds_id);
}; };
//回购解除协议打印
window['${/parameter/@layout_code}_user_button2_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 contract_id = record.get('contract_id');
var templet_code = 'CON_GRANT_DEDUCT';
var url = $('con_grant_deduct_print_link').getUrl() + '?contract_id=' + contract_id + '&templet_code=' + templet_code;
window.open(url, '_self');
};
window['${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) { //查询权限 window['${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) { //查询权限
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract'); var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract');
// if (ds == $(ds_id)) { // if (ds == $(ds_id)) {
......
<?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[
importPackage(java.io);
importPackage(Packages.hls.plugin.docx4j)
importPackage(Packages.org.apache.commons.io);
function RandomString(length) {   
var str = '';   
for (;str.length < length;str += Math.random().toString(36).substr(2));   
return str.substr(0, length); 
}
//删除文件
function deleteFile(filePath) {
var file = new File(filePath);
if (file.exists()) {
file.delete();
}
}
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 getDatePath() {
set_parameter_file_path();
var file_path = $ctx.parameter.file_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/
}
function write_os_to_file(file, os) {
var fis = new FileInputStream(file);
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();
}
function download_file(file_path, file_name) {
$ctx["__request_type__"] = 'file';
var resp = $ctx['_instance.javax.servlet.http.HttpServletResponse'];
resp.setHeader("Pragma", "No-cache");
resp.setHeader("Cache-Control", "no-cache, must-revalidate");
resp.setHeader("Content-disposition", "attachment; filename=" + encodeURI(file_name, 'utf-8'));
resp.setDateHeader("Expires", 0);
resp.setContentType("application/x-msdownload");
try {
var os = resp.getOutputStream();
write_os_to_file(file_path, os);
//write_os_to_file(file_path+file_name, os);
os.flush();
} catch (e) {
$logger("server-script").severe(e.message);
}
}
function collection_create_content() {
try {
//第一步生成合同文本
$bm('cont.CON620.create_content_for_collection').update({
contract_id: $ctx.parameter.contract_id,
templet_code: $ctx.parameter.templet_code
});
//获取日期目录
set_parameter_file_path();
var datePath = getDatePath();
$ctx.parameter.batch_flag='Y';
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 = datePath + guid_file_name_tables[0].guid_file_name + 'con' + record_data.content_id;
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);
}
$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()
});
var test=new File(to_file_path);
var test1=new File('D:'+to_file_path);
download_file(to_file_path.toString(),to_file_name.toString());
}
}
$ctx.parameter.return_status = 'S';
$ctx.parameter.return_message = '执行成功';
} catch (e) {
$ctx.success = "true";
$ctx.parameter.return_status = 'E';
$ctx.parameter.return_message = $ctx.get('/error/@message') || String(e);
raise_app_error(e);
}
var result = {
result: $ctx.parameter.return_status,
message: $ctx.parameter.return_message
};
$ctx.parameter.json = JSON.stringify(result);
}
if ($ctx.parameter.return_status != 'E' && $ctx.parameter.return_status != 'TIMEOUT') {
collection_create_content();
}
]]></s:server-script>
</a:init-procedure>
<a:service-output/>
</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