Commit d2c2380a authored by 21471731's avatar 21471731

租赁物导入调整06

parent 00638cf4
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: SC
$Date: 2022年11月23日20:40:09
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="query">
<bm:query-sql><![CDATA[
SELECT t1.*
FROM (SELECT li.line_id,
li.error_message,
li.status,
li.header_id,
li.line_number,
hd.created_by,
li.source_table,
li.attribute_1,
li.attribute_2,
li.attribute_3,
li.attribute_4,
li.attribute_5,
li.attribute_6,
li.attribute_7,
li.attribute_8,
li.attribute_9,
li.attribute_10,
li.attribute_11,
li.attribute_12,
li.attribute_13,
li.attribute_14,
li.attribute_15,
li.attribute_16,
li.attribute_17,
li.attribute_18,
li.attribute_19,
li.attribute_20,
li.attribute_21,
li.attribute_22,
li.attribute_23,
li.attribute_24,
li.attribute_25,
li.attribute_26
FROM fnd_interface_headers hd,
fnd_interface_lines li
WHERE hd.header_id = li.header_id
AND hd.template_code = 'PRJ_LEASE'
AND li.line_number >0
AND HD.CREATED_BY = ${/session/@user_id}
) t1
#WHERE_CLAUSE#
order by t1.line_number
]]></bm:query-sql>
</bm:operation>
<bm:operation name="insert">
<bm:update-sql><![CDATA[
begin
prj_project_lease_import_pkg.prj_lease_item_list_import(p_header_id =>${/parameter/@header_id},
p_user_id =>${/session/@user_id},
p_lease_item_id=>${@lease_item_id},
p_project_lease_item_id=>${@project_lease_item_id});
end;
]]></bm:update-sql>
</bm:operation>
<bm:operation name="update">
<bm:update-sql><![CDATA[
begin
prj_project_lease_import_pkg.prj_lease_item_import_check(p_header_id => ${/model/header/record/@header_id},
p_user_id => ${/session/@user_id},
p_set_number=>${/parameter/@set_number});
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
<bm:query-fields>
<bm:query-field name="header_id" queryExpression="t1.header_id=${@header_id}"/>
</bm:query-fields>
</bm:model>
......@@ -19,7 +19,7 @@
end;
]]></bm:update-sql>
</bm:operation>
<bm:operation name="update">
<bm:operation name="execute">
<bm:update-sql><![CDATA[
begin
prj_project_lease_import_pkg.insert_lease_item_list(
......@@ -29,5 +29,25 @@
end;
]]></bm:update-sql>
</bm:operation>
<bm:operation name="update">
<bm:update-sql><![CDATA[
begin
prj_project_lease_import_pkg.update_lease_item_data_temp(
p_prj_lease_item_list_id=>${@prj_lease_item_list_id},
p_asset_name=>${@asset_name},
p_specification=>${@specification},
p_asset_num=>${@asset_num},
p_asset_type=>${@asset_type},
p_posted_date=>${@posted_date},
p_price=>${@price},
p_manufacturer=>${@manufacturer},
p_set_number=>${@set_number},
p_lease_num=>${@lease_num}
);
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: SC
$Date: 2022年12月6日19:08:18
$Revision: 1.0
$Purpose:
-->
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm" needAccessControl="false">
<bm:operations>
<bm:operation name="update">
<bm:update-sql><![CDATA[
begin
prj_project_lease_import_pkg.delete_lease_item_data_temp(
p_prj_lease_item_list_id=>${@prj_lease_item_list_id}
);
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
......@@ -10,70 +10,95 @@
<a:model-query model="acr.acr_get_sys_import_head_id" rootPath="header"/>
<a:import-excel header_id="${/model/header/record/@header_id}" separator="," status_field="/parameter/@ImportSuccess" template_code="PRJ_LEASE" user_id="${/session/@user_id}"/>
<a:model-query defaultWhereClause="header_id=${/model/header/record/@header_id} and TEMPLATE_CODE = &apos;PRJ_LEASE&apos;" model="acp.ACP518.acp_import_get_status" rootPath="status"/>
<a:model-update model="prj.PRJ500N.prj_project_lease_import_list"/>
</a:init-procedure>
<a:view>
<a:link id="get_layout_code_link_id" model="cont.CON500.con_contract_get_layout_code"
modelaction="update"/>
<a:link id="prj501N_lease_import_link" url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_lease_import_details.lview"/>
<a:link id="prj501N_lease_import_save_data_link" model="prj.PRJ500N.prj_project_lease_import_temp" modelaction="insert"/>
<a:link id="import_prj_lease_item_list_link_id" model="prj.PRJ500N.prj_project_lease_import_list" modelaction="insert"/>
<script><![CDATA[
function loadComplete() {
if ('${/model/status/record/@status}' == 'NEW') {
var param = {};
param['header_id'] = '${/model/header/record/@header_id}';
param['user_id'] = '${/session/@user_id}';
param['set_number'] = '${/parameter/@set_number}';
param['lease_item_id'] = '${/parameter/@lease_item_id}';
param['project_lease_item_id'] = '${/parameter/@project_lease_item_id}';
param['function_code'] = 'PRJ501INC';
param['function_usage'] = 'QUERY';
param['winid'] = '501N_lease_prj_win_id';
Leaf.request({
url: $('prj501N_lease_import_save_data_link').getUrl(),
para: param,
success: function() {
Leaf.SideBar.show({
msg: '操作成功',
duration: 2000
});
hls_doc_get_layout_code('get_layout_code_link_id',param,'prj501N_lease_import_link', null,null,'${/parameter/@winid}','Y');
},
error: function() {
},
failure: function() {},
scope: this
function exit() {
window.location = '${/request/@context_path}/modules/prj/PRJ501N/prj_project_lease_import_details.lview?function_code=PRJ501INC&function_usage=QUERY&project_lease_item_id='+'${/parameter/@project_lease_item_id}';
}
var import_flag=0;
function import_btn() {
var ds = $('prj_lease_item_list_improt_ds');
var record = ds.getAll();
if(import_flag==0){
for (var i = 0;i < record.length;i++) {
if (record[i].get('status') == 'ERROR') {
Leaf.showMessage('${l:PROMPT}', '导入的数据存在错误,请查看错误信息!');
return;
}
}
Leaf.showConfirm('提示', '确定要导入信息吗?', function() {
Leaf.request({
url: $('import_prj_lease_item_list_link_id').getUrl(),
para: {
batch_id: '${/parameter/@batch_id}',
header_id: '${/model/header/record/@header_id}',
lease_item_id:'${/parameter/@lease_item_id}',
project_lease_item_id:'${/parameter/@project_lease_item_id}'
},
scope: this,
success: function () {
import_flag = import_flag + 1;
Leaf.SideBar.show({
msg: '操作成功',
duration: 2000
});
backBtn();
}
});
});
} else {
Ext.get('success_form').setStyle('display', 'none');
Ext.get('failure_form').setStyle('visibility', 'visible');
}else{
Leaf.showMessage('${l:PROMPT}', '数据已导入不能重复导入!');
return;
}
}
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
<a:dataSets>
<a:dataSet id="error_ds">
<a:dataSet id="prj_lease_item_list_improt_ds" autoQuery="true" fetchAll="true" model="prj.PRJ500N.prj_project_lease_import_list" queryUrl="${/request/@context_path}/autocrud/prj.PRJ500N.prj_project_lease_import_list/query?header_id=${/model/header/record/@header_id}">
<a:fields>
<a:field name="import_field_1" prompt="import_field_1"/>
<a:field name="import_field_2" prompt="import_field_2"/>
<a:field name="import_field_3" prompt="import_field_3"/>
<a:field name="error_message" readOnly="true"/>
<a:field name="attribute_1" readOnly="true"/>
<a:field name="attribute_2" readOnly="true"/>
<a:field name="attribute_3" readOnly="true"/>
<a:field name="attribute_4" readOnly="true"/>
<a:field name="attribute_5" readOnly="true"/>
<a:field name="attribute_6" readOnly="true"/>
<a:field name="attribute_7" readOnly="true"/>
<a:field name="attribute_8" readOnly="true"/>
</a:fields>
</a:dataSet>
</a:dataSets>
<a:screenBody>
<a:form id="failure_form" height="400" style="visibility:hidden" title="ERROR_MESSAGE" width="980">
<a:grid bindTarget="error_ds" height="340" navBar="true" width="980">
<a:form id="success_form" height="400" title="THE_IMPORTED_DATA" width="980">
<a:screenTopToolbar>
<a:gridButton click="exit" text="退出"/>
<a:gridButton click="import_btn" text="导入"/>
</a:screenTopToolbar>
<a:grid id="grid_ds_id" bindTarget="prj_lease_item_list_improt_ds" height="340" navBar="true" width="980">
<a:columns>
<a:column name="import_field_1"/>
<a:column name="import_field_2"/>
<a:column name="import_field_3"/>
<a:column name="attribute_1" prompt="序号" width="80"/>
<a:column name="attribute_2" prompt="租赁物名称" width="80"/>
<a:column name="attribute_3" prompt="型号" width="80"/>
<a:column name="attribute_4" prompt="设备编号" width="80"/>
<a:column name="attribute_5" prompt="设备类型" width="80"/>
<a:column name="attribute_6" prompt="出厂日期" width="80"/>
<a:column name="attribute_7" prompt="设备单价(总)" width="80"/>
<a:column name="attribute_8" prompt="制造商(全称)" width="80"/>
<a:column name="error_message" editor="textArea_e" prompt="错误信息" width="120"/>
</a:columns>
<a:editors>
<a:textArea id="textArea_e" height="50" width="240"/>
</a:editors>
</a:grid>
</a:form>
</a:screenBody>
<script><![CDATA[
loadComplete();
]]></script>
</a:view>
</a:screen>
......@@ -7,8 +7,11 @@
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" dynamiccreateenabled="true" trace="true">
<a:view>
<a:link id="prj501N_lease_item_list_save_link" model="prj.PRJ500N.prj_project_lease_import_temp" modelaction="update"/>
<a:link id="prj501N_lease_item_list_update_link" model="prj.PRJ500N.prj_project_lease_import_temp" modelaction="batch_update"/>
<a:link id="prj501N_lease_item_temp_batch_update_link" model="prj.PRJ500N.prj_project_lease_update_temp" modelaction="batch_update"/>
<a:link id="prj501N_lease_item_list_save_link" model="prj.PRJ500N.prj_project_lease_import_temp" modelaction="execute"/>
<a:link id="prj501N_lease_import_upload_link" url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_lease_import_upload.lview"/>
<a:link id="prj501N_lease_exit_link" url="${/request/@context_path}/modules/prj/PRJ501N/prj_project_maintain.lview"/>
<script><![CDATA[
//导入
......@@ -20,13 +23,15 @@
params: {
set_number: '${/parameter/@set_number}',
lease_item_id:'${/parameter/@lease_item_id}',
project_lease_item_id:'${/parameter/@project_lease_item_id}'
project_lease_item_id:'${/parameter/@project_lease_item_id}',
winid:'prj_lease_detail_winid'
},
width: 430,
height: 350
});
};
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_load'] = function (ds, record, config_records, bp_seq) {
if(record!=''){
record.getField('asset_num').setReadOnly(false);
......@@ -39,7 +44,6 @@
}
}
//加载时调用(grid,table,gridBox)
window['${/parameter/@bp_seq}${/parameter/@layout_code}_on_layout_dynamic_grid_query'] = function(ds, qpara, bp_seq) {
var gridId= ds.bindname+'_ds';
......@@ -48,7 +52,7 @@
//删除
window['${/parameter/@layout_code}_user_button2_layout_dynamic_click'] = function() {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_data_temp');
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'prj_project_lease_item_list');
var record = $(ds_id);
var records = record.getSelected();
var len = records.length;
......@@ -57,25 +61,42 @@
return;
}
Leaf.showConfirm('提示', '您确认删除吗', function() {
for (var i = 0;i < records.length;i++) {
$(ds_id).remove(records[i]);
var param_list = [];
var param = {};
for (var i = 0; i < records.length; i++) {
param = records[i].data;
param['_status'] = 'update';
param_list.push(param);
}
Leaf.request({
url: $('prj501N_lease_item_temp_batch_update_link').getUrl(),
para:param_list,
success: function() {
Leaf.SideBar.show({
msg: '操作成功',
duration: 2000
});
$(ds_id).query();
},
error: function() {
},
failure: function() {},
scope: this
});
});
};
//保存submitsuccess调用
window['${/parameter/@layout_code}_on_layout_dynamic_submitsuccess'] = function(ds, record, res, bp_seq) {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'],'prj_project_lease_data_temp');
var record=$(ds_id).getAt(0);
var records = $(ds_id).getAll();
//保存
window['${/parameter/@layout_code}_user_button4_layout_dynamic_click'] = function() {
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'],'prj_project_lease_item_list');
debugger;
var set_number='${/parameter/@set_number}';
var lease_num=record.get('lease_num');
if (set_number!=lease_num){
Leaf.showMessage('${l:PROMPT}','保存数量与台数不一致!');
return;
var records = $(ds_id).getAll();
var record= $(ds_id).getAt(0);
if(record==null){
Leaf.showMessage('${l:PROMPT}','您还没有导入数据,请导入!');
return false;
}
var lease_num=record.get('lease_num');
//设备编号不能重复
for (var a = 0; a < records.length; a++) {
var record_a = records[a];
......@@ -91,6 +112,37 @@
}
}
}
if($(ds_id).validate()){
var param_list = [];
var param = {};
for (var i = 0; i < records.length; i++) {
param = records[i].data;
param['set_number'] = '${/parameter/@set_number}';
param['lease_num'] = lease_num;
param['_status'] = 'update';
param_list.push(param);
}
Leaf.request({
url: $('prj501N_lease_item_list_update_link').getUrl(),
para: param_list,
success: function () {
Leaf.SideBar.show({
msg: '操作成功',
duration: 2000
});
submit_success_lease();
},
error: function () {
},
failure: function () {
},
scope: this
});
}
};
function submit_success_lease(){
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'],'prj_project_lease_item_list');
var param = {};
param['session_id'] = '${/session/@session_id}';
param['user_id'] = '${/session/@user_id}';
......@@ -109,8 +161,6 @@
});
}
}
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
</a:view>
......
......@@ -10,16 +10,31 @@
<script type="text/javascript"><![CDATA[
function saveClick(){
if (document.getElementById('importFile').value){
debugger;
var fileName = document.getElementById('importFile').value;
var fileType = fileName.substr(fileName.lastIndexOf("."));
if (fileType != '.xls' && fileType != '.xlsx' && fileType != '.xlsm') {
alert('请选择正确的导入文件!');
} else {
document.getElementById('importForm').submit();
doSubmit();
}
}
}
var _input_window;
function doSubmit() {
_input_window = new $L.Window({
title: '${l:HLS.IMPORT}',
fullScreen: true
});
new Ext.Template('<iframe id ="_input_window" name="_input_window" border="0" frameborder="0" height="100%" width="100%" style="border:none;padding:0px;margin:0px;"></iframe>').insertFirst(_input_window.body.dom, {}, true);
var form = document.getElementById('importForm');
var url = '${/request/@context_path}/modules/prj/PRJ501N/prj_project_lease_import.lview?set_number=${/parameter/@set_number}&lease_item_id=${/parameter/@lease_item_id}&project_lease_item_id=${/parameter/@project_lease_item_id}&winid=${/parameter/@winid}&_csrf=${/session/@_csrf.token}';
form.action = url;
form.submit();
$('${/parameter/@winid}').close();
}
]]></script>
......@@ -42,7 +57,7 @@
<a:label name="label6" bindTarget="label_ds" style="color:#055A78;font-weight:bold;margin-left:10px;" width="380"/>
</a:fieldSet>
<a:fieldSet style="margin-left:10px;margin-top:10px;" title="导入文件" width="400">
<form name="upload" id="importForm" action="prj_project_lease_import.lview?set_number=${/parameter/@set_number}&amp;project_lease_item_id=${/parameter/@project_lease_item_id}&amp;lease_item_id=${/parameter/@lease_item_id}&amp;_csrf=${/session/@_csrf.token}" enctype="multipart/form-data" method="post">
<form name="upload" id="importForm" enctype="multipart/form-data" method="post">
<label style="margin-left:10px;margin-top:10px;"><![CDATA[请选择文件:]]></label>
<input name="CONTENT" id="importFile" style="margin-bottom:4px;width:160px;height:22px;" type="file"/>
<input onclick="saveClick()" style="margin-left:50px;margin-top:10px;width:60px;" type="button" value="导入"/>
......
......@@ -449,11 +449,12 @@
param['project_lease_item_id'] = record.get('project_lease_item_id');
param['lease_item_id'] = record.get('lease_item_id');
param['set_number'] = record.get('set_number');
param['document_id'] = record.get('project_id');
param['function_code'] = 'PRJ501INC';
param['function_usage'] = 'UPDATE';
param['winid'] = '${/parameter/@layout_code}_project_number_win_id';
param['url_title'] = '租赁物清单';
hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, '${/parameter/@layout_code}lease_number_query_link', record.ds.id, '${/parameter/@layout_code}');
hls_doc_get_layout_code('${/parameter/@layout_code}_get_layout_code_link_id', param, '${/parameter/@layout_code}lease_number_query_link','PROJECT_CREATE_NP_F_QUOTATION_N_prj_quotation_ds', '${/parameter/@layout_code}','${/parameter/@winid}','Y');
}
//超链接渲染
......
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