Commit 48a830ef authored by Darming's avatar Darming

[feat]租赁物GPS信息管理

parent 0018e840
......@@ -13,42 +13,33 @@
hd.created_by,
li.source_table,
li.attribute_1,
(select cc.contract_name
from con_contract cc
where cc.contract_number = li.attribute_1) contract_name,
li.attribute_2,
li.attribute_3,
li.attribute_4,
li.attribute_5,
(select cc.lease_start_date
from con_contract cc
where cc.contract_number = li.attribute_1) lease_start_date,
li.attribute_6,
li.attribute_7,
trim(to_char(round(li.attribute_8,1),'999999999999990.99')) attribute_8,
trim(to_char(round(li.attribute_8 /
to_char(last_day(sysdate), 'dd'),
1),
'999999999999990.99')) average_hour,
round(li.attribute_7,2) attribute_7,
round(li.attribute_8,2) attribute_8,
li.attribute_9,
li.attribute_10,
li.attribute_11,
li.attribute_12
li.attribute_12,
nvl((select 'Y' from dual where exists(select 1 from con_lease_item_gps cli,con_contract cc where period = to_char(to_date(li.ATTRIBUTE_6,'yyyy-mm'),'yyyy-mm')
and cli.contract_id = cc.contract_id and cc.contract_number = li.ATTRIBUTE_1)),'N') exists_flag
FROM fnd_interface_headers hd, fnd_interface_lines li
WHERE hd.header_id = li.header_id
AND hd.template_code = 'HLS_LEASE_ITEM_GPS_IMPORT'
AND li.line_number > 0
AND li.source_table = 'GPS'
AND HD.CREATED_BY = ${/session/@user_id}
AND hd.header_id=${/parameter/@header_id}) t1
order by t1.line_number
]]>
</bm:query-sql>
</bm:operation>
<bm:operation name="update">
<bm:operation name="execute">
<bm:update-sql><![CDATA[
begin
hls_lease_item_gps_import_pkg.gps_import_check(p_header_id => ${@header_id},
con_lease_item_gps_pkg.gps_import_check(p_header_id => ${/model/header/record/@header_id},
p_user_id => ${/session/@user_id});
end;
]]>
......@@ -57,22 +48,31 @@
<bm:operation name="insert">
<bm:update-sql><![CDATA[
BEGIN
hls_lease_item_gps_import_pkg.gps_import(
p_contract_number => ${@contract_number},
p_machine_model => ${@machine_model},
p_machine_number => ${@machine_number},
p_interval_date => ${@interval_date},
p_working_hours_latest=> ${@working_hours_latest},
p_working_hours_new_m => ${@working_hours_new_m},
p_working_hours_ave_m => ${@working_hours_ave_m},
p_machine_location => ${@machine_location},
p_note => ${@note},
p_attention => ${@attention},
p_machine_number_full=> ${@machine_number_full},
con_lease_item_gps_pkg.gps_import(
p_header_id => ${@header_id},
p_user_id => ${/session/@user_id});
END;
]]>
</bm:update-sql>
</bm:operation>
</bm:operations>
<bm:fields>
<bm:field name="error_message"/>
<bm:field name="status"/>
<bm:field name="header_id"/>
<bm:field name="line_number"/>
<bm:field name="attribute_1"/>
<bm:field name="attribute_2"/>
<bm:field name="attribute_3"/>
<bm:field name="attribute_4"/>
<bm:field name="attribute_5"/>
<bm:field name="attribute_6"/>
<bm:field name="attribute_7"/>
<bm:field name="attribute_8"/>
<bm:field name="attribute_9"/>
<bm:field name="attribute_10"/>
<bm:field name="attribute_11"/>
<bm:field name="attribute_12"/>
<bm:field name="exists_flag"/>
</bm:fields>
</bm:model>
var override_queryfields = [
{
name: 'period_from',
queryexpression: "t1.period >= ${@period_from} "
},
{
name: 'period_to',
queryexpression: "t1.period <= ${@period_to} "
}
];
var add_datafilters = [];
override();
add_datafilter();
var override_queryfields = [
{
name: 'period_from',
queryexpression: "t1.period >= ${@period_from} "
},
{
name: 'period_to',
queryexpression: "t1.period <= ${@period_to} "
}
];
var add_datafilters = [];
override();
add_datafilter();
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application" customizationEnabled="true" trace="true">
<a:init-procedure outputPath="/parameter">
<a:model-query model="basic.hls_fnd_attribute_sequence" rootPath="header"/>
......@@ -9,12 +8,40 @@
<a:model-query
defaultWhereClause="header_id=${/model/header/record/@header_id} and TEMPLATE_CODE = &apos;HLS_LEASE_ITEM_GPS_IMPORT&apos;"
model="basic.hls_fnd_attribute_status" rootPath="status"/>
<a:model-execute model="hls.HLS204N.hls_lease_item_gps_list_tmp"/>
</a:init-procedure>
<a:view>
<a:link id="save_import_hls_lease_item_gps_check_link_id" model="hls.HLS204N.hls_lease_item_gps_list_tmp"
modelaction="update"/>
<a:link id="save_import_hls_lease_item_gps_data_link_id" model="hls.HLS204N.hls_lease_item_gps_list_tmp"
modelaction="batch_update"/>
modelaction="insert"/>
<style>
.prompt-position {
float:right;
font-weight: bold;
margin-top:20px;
margin-left: 10px;
font-size: 10px;
}
.period-exists span::before{
content: ' ';
height: 10px;
position:relative;
width: 10px;
background:#FFE4C4;
display: inline-block;
bottom: -1px;
margin-right: 2px;
}
.import-error span::before{
content: ' ';
height: 10px;
position:relative;
width: 10px;
display: inline-block;
bottom: -1px;
margin-right: 2px;
background: #FC9492;
}
</style>
<script type="text/javascript"><![CDATA[
function backBtn() {
......@@ -22,7 +49,6 @@
}
function checkBtn() {
debugger;
var ds = $('hls_lease_item_gps_improt_ds');
var records = ds.getAll();
var header_id = records[0].get('header_id');
......@@ -44,59 +70,67 @@
}
var import_flag = 0;
var import_over_write_flag = 'N';
function importBtn() {debugger;
function importBtn() {
debugger;
var msg = '确定要导入信息吗';
var ds = $('hls_lease_item_gps_improt_ds');
var records = ds.getAll();
var saveData = [];
if (import_flag == 0) {
for (var i = 0; i < records.length; i++) {
var record = records[i];
if (record.get('status') == 'ERROR') {
//不将这条数据传递到数组中
continue;
import_flag = 1;
Leaf.showInfoMessage('提示', '导入数据存在错误,请核对并重新导入');
return;
}
if (record.get('exists_flag') == 'Y') {
import_over_write_flag = 'Y';
}
}
//否则的话添加必要的字段
record.set('contract_number', record.get('attribute_1'));
// record.set('bp_name', record.get('attribute_3'));
record.set('agent_name', record.get('attribute_3'));
record.set('machine_model', record.get('attribute_4'));
record.set('machine_number', record.get('attribute_5'));
record.set('interval_date', record.get('attribute_6'));
record.set('working_hours_latest', record.get('attribute_7'));
record.set('working_hours_new_m', record.get('attribute_8'));
record.set('working_hours_ave_m', record.get('average_hour'));
record.set('machine_location', record.get('attribute_9'));
record.set('note', record.get('attribute_10'));
record.set('attention', record.get('attribute_11'));
record.set('machine_number_full', record.get('attribute_12'));
record.set('_status', 'insert');
saveData.push(record.data);
if (import_over_write_flag == 'Y') {
msg = '租赁物存在已导入的期间,<font color="red">导入将覆盖该期间数据</font>,确定要导入信息吗'
}
//开始导入数据
Leaf.showConfirm('提示', '确定要导入信息吗,有错误信息的数据将不会被导入', function () {
// Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
if (import_flag == 0) {
//导入数据
Leaf.showConfirm('提示', msg, function () {
Leaf.Masker.mask(Ext.getBody(), '${l:HLS.EXECUTING}');
$('importBtn').disable();
Leaf.request({
url: $('save_import_hls_lease_item_gps_data_link_id').getUrl(),
para: saveData,
scope: this,
para: {
header_id: '${/model/header/record/@header_id}'
},
success: function () {
import_flag = import_flag + 1;
$('hls_lease_item_gps_improt_ds').query();
// Leaf.Masker.unmask(Ext.getBody());
Leaf.SideBar.show({
msg: '操作成功',
msg: '导入成功',
duration: 2000
});
//关闭该导入的界面
Leaf.Masker.unmask(Ext.getBody());
$('importBtn').enable();
backBtn();
}
},
failure: function () {
Leaf.Masker.unmask(Ext.getBody());
},
error: function () {
Leaf.Masker.unmask(Ext.getBody());
},
scope: this
});
});
} else {
Leaf.showMessage('${l:PROMPT}', '数据已导入不能重复导入!');
return false;
}
}
function change_background_color(record) {
if (record.get('status') == 'ERROR'){
return 'background-color:#FC9492';
}
if (record.get('exists_flag') == 'Y') {
return 'background-color:#FFE4C4';
}
}
......@@ -112,37 +146,35 @@
</a:dataSet>
</a:dataSets>
<a:screenBody>
<a:form id="success_form" height="400" title="THE_IMPORTED_DATA" width="980">
<a:screenTopToolbar>
<a:gridButton click="backBtn" text="取消"/>
<a:gridButton click="checkBtn" text="数据校验"/>
<a:gridButton click="importBtn" text="确认导入"/>
<!-- <a:gridButton click="checkBtn" text="数据校验"/>-->
<a:gridButton id="importBtn" click="importBtn" text="确认导入"/>
<div style="float:right;" class="prompt-position period-exists"><span>租赁物期间已存在</span></div>
<div style="float:right;" class="prompt-position import-error"><span>导入信息错误</span></div>
</a:screenTopToolbar>
<a:grid id="grid_ds_id" bindTarget="hls_lease_item_gps_improt_ds" height="340" navBar="true"
width="980">
<a:grid id="grid_ds_id" bindTarget="hls_lease_item_gps_improt_ds" height="480" navBar="true"
width="1050" rowRenderer="change_background_color">
<a:columns>
<a:column name="error_message" editor="textArea_e" prompt="错误信息" width="150"/>
<a:column name="attribute_6" prompt="期间" width="130"/>
<a:column name="error_message" editor="textArea_e" prompt="错误信息" width="180"/>
<a:column name="line_number" prompt="excel行号" width="80" align="right"/>
<a:column name="attribute_1" prompt="合同编号" width="130"/>
<a:column name="contract_name" prompt="合同名称" width="100"/>
<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="lease_start_date" prompt="租赁开始日" width="80"/>
<a:column name="attribute_7" prompt="最新工作小时数(总)" width="120"/>
<a:column name="attribute_8" prompt="本月工作小时数" width="120"/>
<a:column name="average_hour" prompt="本月平均工作小时数" width="120"/>
<a:column name="attribute_2" prompt="客户名称" width="120"/>
<a:column name="attribute_3" prompt="代理店" width="120"/>
<a:column name="attribute_4" prompt="机型" width="120" align="center"/>
<a:column name="attribute_5" prompt="机号" width="120" align="center"/>
<a:column name="attribute_6" prompt="期间" width="110" align="center"/>
<a:column name="attribute_7" prompt="最新工作小时数(总)" width="120" align="right"/>
<a:column name="attribute_8" prompt="本月工作小时数" width="120" align="right"/>
<a:column name="attribute_9" editor="textArea_e" prompt="机器位置(省市)" width="120"/>
<a:column name="attribute_10" prompt="备注" width="80"/>
<a:column name="attribute_10" prompt="备注" width="150"/>
<a:column name="attribute_11" prompt="要注意" width="80"/>
<a:column name="attribute_12" editor="textArea_e" prompt="完整机号" width="80"/>
<a:column name="attribute_12" editor="textArea_e" prompt="完整机号" width="140"/>
</a:columns>
<a:editors>
<a:textArea id="textArea_e" height="50" width="240"/>
<a:textArea id="textArea_e" readOnly="true" height="50" width="240"/>
</a:editors>
</a:grid>
</a:form>
</a:screenBody>
<script type="text/javascript"><![CDATA[
......
......@@ -10,7 +10,7 @@
var fileName = document.getElementById('importFile').value;
var fileType = fileName.substr(fileName.lastIndexOf("."));
if (fileType != '.xls' && fileType != '.xlsx' && fileType != '.xlsm') {
alert('${l:SELECT_CORRECT_IMPORT_FILE}');
Leaf.showInfoMessage('提示', '${l:SELECT_CORRECT_IMPORT_FILE}');
} else {
doSubmit();
}
......@@ -19,16 +19,16 @@
var _input_window;
function doSubmit() {debugger;
function doSubmit() {
_input_window = new $L.Window({
title: '${l:HLS.IMPORT}',
width: 1100,
height: 400
height: 600
});
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/hls/HLS204N/hls_lease_item_gps_excel_import.lview?session_id=${/parameter/@session_id}&winid=${/parameter/@winid}&batch_id=${/parameter/@batch_id}&_csrf=${/session/@_csrf.token}';
form.action = url;
//var url = '${/request/@context_path}/modules/hls/HLS204N/hls_lease_item_gps_excel_import.lview?session_id=${/parameter/@session_id}&winid=${/parameter/@winid}&batch_id=${/parameter/@batch_id}&_csrf=${/session/@_csrf.token}';
//form.action = url;
form.submit();
$('${/parameter/@winid}').close();
_input_window.on('close', function () {
......@@ -62,7 +62,7 @@
</a:fieldSet>
<a:fieldSet style="margin-left:10px;margin-top:10px;" title="TMPLT_IMPORT_FILE" width="400">
<form name="upload" id="importForm"
action="modules/hls/HLS204N/hls_lease_item_gps_excel_import.lview?session_id=${/parameter/@session_id}&amp;project_id=${/parameter/@project_id}&amp;parent_ds_id=${/parameter/@parent_ds_id}&amp;type=${/parameter/@type}&amp;_csrf=${/session/@_csrf.token}"
action="${/request/@context_path}/modules/hls/HLS204N/hls_lease_item_gps_excel_import.lview?session_id=${/parameter/@session_id}&amp;parent_ds_id=${/parameter/@parent_ds_id}&amp;_csrf=${/session/@_csrf.token}"
enctype="multipart/form-data" method="post" target="_input_window">
<label style="margin-left:10px;margin-top:10px;font-size:13px"><![CDATA[${l:PLEASE_SELECT_A_FILE}]]></label>
<input name="CONTENT" id="importFile" style="font-size:15px" type="file"/>
......
......@@ -9,12 +9,13 @@
<a:init-procedure/>
<a:view>
<a:link id="BmLink_MainScreen_functionHit" model="sys.sys_page_function_visit" modelaction="update"/>
<a:link id="hls_lease_item_gps_import_link" url="${/request/@context_path}/modules/hls/HLS204N/hls_lease_item_gps_import.lview"/>
<a:link id="hls_lease_item_gps_import_link"
url="${/request/@context_path}/modules/hls/HLS204N/hls_lease_item_gps_import.lview"/>
<script><![CDATA[
//导入按钮
window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {debugger;
window['${/parameter/@layout_code}_user_button1_layout_dynamic_click'] = function () {
var url_l = $('hls_lease_item_gps_import_link').getUrl();
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_contract_lease_item');
var ds_id = get_dsid_by_basetable(window['${/parameter/@layout_code}_layoutDataSetList'], 'con_lease_item_gps');
var win = new Leaf.Window({
id: 'hls_lease_item_gps_import_link_win',
url: url_l,
......@@ -25,12 +26,23 @@
},
title: '导入',
width: 420,
height: 390
height: 320
});
win.on('close', function () {
$(ds_id).query();
});
}
};
//加载事件
window['${/parameter/@layout_code}_on_layout_dynamic_form_add_and_load'] = function(ds, record, config_records, bp_seq) {
var ds_id = '${/parameter/@layout_code}_F_QUERY__ds';
debugger;
var r = $(ds_id).getAt(0);
r.set('period_from',new Date().format('yyyy-mm').toString());
r.set('period_from_n',new Date().format('yyyy-mm').toString());
r.set('period_to',new Date().format('yyyy-mm').toString());
r.set('period_to_n',new Date().format('yyyy-mm').toString());
};
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
......
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