Commit 871d986f authored by niminmin's avatar niminmin

[feat]凭证模板导入逻辑调整

parent 637de337
package com.hand.hls.hlcm.importexcel.controllers;
import com.hand.hap.core.IRequest;
import com.hand.hap.system.controllers.BaseController;
import com.hand.hap.system.dto.ResponseData;
import com.hand.hls.hlcm.importexcel.service.ImportExcelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;
/**
* Copyright (C) Hand Business Consulting Services
* AllRights Reserved
*
* @Author: administrator
* @Date: 2021/4/29 11:11
* @Description:建机模板导入二开
*/
@Controller
public class ImportExcelController extends BaseController {
@Autowired
ImportExcelService importExcelService;
@RequestMapping(value = "/hls/importExcel/import")
@ResponseBody
public ResponseData importExcel(@RequestParam Map <String,String> map,@RequestParam(value = "content",required = false) MultipartFile importFile, HttpServletRequest request) throws Exception{
ResponseData responseData = new ResponseData();
String template_code=request.getParameter("template_code");
Assert.notNull(template_code,"templateCode为空");
IRequest requestContext = createRequestContext(request);
requestContext.setAttribute("template_code",template_code);
responseData=importExcelService.importExcel(requestContext,importFile);
return responseData;
}
}
package com.hand.hls.hlcm.importexcel.mapper;
import com.hand.hap.mybatis.common.BaseMapper;
import java.util.List;
import java.util.Map;
/**
* Copyright (C) Hand Business Consulting Services
* AllRights Reserved
*
* @Author: administrator
* @Date: 2021/4/30 11:26
* @Description:导入表
*/
public interface ImportExcelMapper {
/**
* 新增行表
* @param fieldValues
*/
void insertInterfaceLine(Map<String, List<Object>> fieldValues);
/**
* 新增头表
* @param map
*/
void insertInterfaceHead(Map map);
/**
* 获取headId
* @return
*/
Long getHeadId();
/**
* 更新数据
* @param map
*/
void updateJournalData(Map map);
}
package com.hand.hls.hlcm.importexcel.service;
import com.hand.hap.core.IRequest;
import com.hand.hap.system.dto.ResponseData;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
/**
* Copyright (C) Hand Business Consulting Services
* AllRights Reserved
*
* @Author: administrator
* @Date: 2021/4/29 13:19
* @Description:
*/
public interface ImportExcelService {
/**
*导入excel等文件
* @param iRequest
* @param file
* @return
* @throws Exception
*/
ResponseData importExcel(IRequest iRequest, MultipartFile file) throws Exception;
}
package com.hand.hls.hlcm.importexcel.service.impl;
import com.hand.hap.core.IRequest;
import com.hand.hap.system.dto.ResponseData;
import com.hand.hls.hlcm.importexcel.mapper.ImportExcelMapper;
import com.hand.hls.hlcm.importexcel.service.ImportExcelService;
import leaf.plugin.dataimport.ImportExcel;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.math.BigDecimal;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* Copyright (C) Hand Business Consulting Services
* AllRights Reserved
*
* @Author: administrator
* @Date: 2021/4/29 13:24
* @Description:
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class ImportExcelServiceImpl implements ImportExcelService {
public static final int TOTAL_CELL = 7;
FormulaEvaluator evaluator;
/**
* //public static final String XLS_KEY = ".xls";
* // public static final String XLSX_KEY = ".xlsx";
* //public static final String CSV_KEY = ".csv";
* //public static final String TXT_KEY = ".txt";
*/
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
ImportExcelMapper importExcelMapper;
@Override
public ResponseData importExcel(IRequest iRequest, MultipartFile file) throws Exception {
ResponseData responseData = new ResponseData();
String fileName;
fileName = file.getOriginalFilename();
logger.info(fileName);
String suffix = fileName.substring(fileName.lastIndexOf("."));
Workbook wb = null;
if (ImportExcel.XLS_KEY.equalsIgnoreCase(suffix)) {
wb = new HSSFWorkbook(file.getInputStream());
} else if (ImportExcel.XLSX_KEY.equalsIgnoreCase(suffix)) {
wb = new XSSFWorkbook(file.getInputStream());
}
if (wb != null) {
evaluator = wb.getCreationHelper().createFormulaEvaluator();
}
Sheet sheet = null;
Row row;
Cell cell;
if (wb != null && wb.getNumberOfSheets() > 1) {
responseData.setSuccess(false);
responseData.setMessage("sheet页数大于1,请检查模板!");
return responseData;
}
if (wb != null) {
sheet = wb.getSheetAt(0);
}
assert sheet != null;
int checkRow = sheet.getRow(0).getPhysicalNumberOfCells();
if (checkRow != TOTAL_CELL) {
responseData.setSuccess(false);
responseData.setMessage("模板列数不匹配,请检查模板!");
return responseData;
}
//获取头id
Long headId = importExcelMapper.getHeadId();
Map<String, Object> headMap = new HashMap<>(16);
headMap.put("headId", headId);
headMap.put("templateCode",iRequest.getAttribute("template_code"));
headMap.put("jobId", null);
headMap.put("status", "NEW");
headMap.put("userId", iRequest.getUserId());
headMap.put("attribute_5", "N");
headMap.put("file_name", fileName);
importExcelMapper.insertInterfaceHead(headMap);
//获取行
for (int i = 0; i <= sheet.getLastRowNum(); i++) {
Map<String, List<Object>> fieldValues = new HashMap<>(16);
List<Object> fields = new ArrayList<>();
List<Object> values = new ArrayList<>();
fields.add("HEADER_ID");
fields.add("LINE_NUMBER");
fields.add("CREATED_BY");
fields.add("CREATION_DATE");
fields.add("LAST_UPDATED_BY");
fields.add("LAST_UPDATE_DATE");
values.add(headId);
values.add(i);
values.add(iRequest.getUserId());
values.add(new Date());
values.add(iRequest.getUserId());
values.add(new Date());
row = sheet.getRow(i);
for (int j = 0; j < row.getLastCellNum(); j++) {
//获取列
cell = row.getCell(j);
fields.add("ATTRIBUTE_" + (j + 1));
String value;
if (cell != null) {
value = resetValue(cell);
values.add(value);
}
}
fieldValues.put("columns", fields);
fieldValues.put("values", values);
importExcelMapper.insertInterfaceLine(fieldValues);
}
Map<String, Object> journalMap = new HashMap<>(16);
journalMap.put("headId", headId);
journalMap.put("userId", iRequest.getUserId());
importExcelMapper.updateJournalData(journalMap);
responseData.setSuccess(true);
return responseData;
}
public String resetValue(Cell cell) {
CellValue cellValue = evaluator.evaluate(cell);
String value = null;
if (cellValue != null) {
switch (cellValue.getCellTypeEnum()) {
case BOOLEAN:
value = Boolean.toString(cellValue
.getBooleanValue());
break;
case NUMERIC:
if (DateUtil.isCellDateFormatted(cell)) {
if (cell.getDateCellValue() != null) {
value = df.format(cell.getDateCellValue());
}
} else {
value = BigDecimal
.valueOf(cellValue.getNumberValue())
.stripTrailingZeros().toPlainString();
}
break;
case STRING:
value = cellValue.getStringValue();
break;
case BLANK:
case ERROR:
case FORMULA:
break;
default:
}
}
if (value != null && !"".equalsIgnoreCase(value)) {
return value;
} else {
return "";
}
}
}
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.hand.hls.hlcm.importexcel.mapper.ImportExcelMapper">
<sql id="values">
<foreach item="item" collection="values" separator="," >
#{item}
</foreach>
</sql>
<insert id="insertInterfaceLine" parameterType="Map" >
insert into fnd_interface_lines (line_id,
<foreach collection="columns" item="listItem" separator=",">
${listItem}
</foreach>
)
values (fnd_interface_lines_s.nextval,<include refid="values"/> )
</insert>
<insert id="insertInterfaceHead" parameterType="Map" >
insert into fnd_interface_headers
(header_id,
template_code,
job_id,
status,
created_by,
creation_date,
last_updated_by,
last_update_date,
attribute_1,
attribute_2,
attribute_3,
attribute_4,
attribute_5,
file_name)
values
(#{headId},
#{templateCode},
#{jobId},
#{status},
#{userId},
sysdate,
#{userId},
sysdate,
#{attribute_1},
#{attribute_2},
#{attribute_3},
#{attribute_4},
#{attribute_5},
#{file_name})
</insert>
<select id="getHeadId" resultType="java.lang.Long">
select
fnd_interface_headers_s.nextval
from dual
</select>
<select id="updateJournalData" parameterType="Map" statementType="CALLABLE">
call hl_sbo_inf_pkg.update_hls_sbo_num(p_header_id => #{headId,mode=IN},p_user_id => #{userId,mode=IN})
</select>
</mapper>
\ No newline at end of file
......@@ -16,6 +16,7 @@
Where cc1.contract_id = t1.contract_id
And cc1.due_date <= Sysdate
And cc1.cf_item In (1, 8, 9)
and cc1.cf_status='RELEASE'
And cc1.write_off_flag <> 'FULL'
And cc1.due_date = t1.min_overdue_date) min_overdue_times
FROM (SELECT
......@@ -87,6 +88,7 @@
AND gwo.cf_item IN (1, 8, 250)
and gwo.cf_item = ccw.cf_item
and gwo.times = ccw.times
and ccw.cf_status='RELEASE'
and gwo.contract_id = ccw.contract_id
AND trunc(ccw.due_date) <= trunc(SYSDATE)), 0) account_due_amount,
......@@ -129,6 +131,7 @@
FROM con_contract_cashflow ccc
WHERE ccc.contract_id = cc.contract_id
AND ccc.due_amount > 0
and ccc.cf_status = 'RELEASE'
AND ccc.due_date <= sysdate
AND ccc.cf_item in (1, 8, 9)
AND ccc.write_off_flag <> 'FULL') min_overdue_date,
......@@ -137,12 +140,14 @@
(SELECT SUM(nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc
WHERE ccc.contract_id = cc.contract_id
and ccc.cf_status = 'RELEASE'
AND ccc.cf_item IN
(1, 8, 250)) business_received_amount,
--营业未收租金
(SELECT SUM(ccc.due_amount - nvl(ccc.received_amount, 0))
FROM con_contract_cashflow ccc
WHERE ccc.contract_id = cc.contract_id
and ccc.cf_status = 'RELEASE'
AND ccc.cf_item IN (1, 8, 250)
) business_unreceived_amount,
--会计已收租金
......@@ -273,10 +278,10 @@
<bm:query-field name="contract_number"
queryExpression="contract_number like &apos;%&apos;|| ${@contract_number} ||&apos;%&apos;"/>
<!--<bm:query-field name="bp_id_tenant" queryExpression="t1.bp_id_tenant = ${@bp_id_tenant}"/>-->
<bm:query-field name="bp_id_tenant_desc" queryExpression="t1.bp_id_tenant_desc like ${@bp_id_tenant_desc}"/>
<bm:query-field name="bp_id_tenant_desc" queryExpression="t1.bp_id_tenant_desc like &apos;%&apos;|| ${@bp_id_tenant_desc} ||&apos;%&apos;"/>
<!-- <bm:query-field name="contract_name" queryExpression="t1.contract_name like ${@contract_name} "/>-->
<bm:query-field name="project_number" queryExpression="t1.project_number like ${@project_number}"/>
<bm:query-field name="bp_id_agent_desc" queryExpression="t1.bp_id_agent_desc like ${@bp_id_agent_desc}"/>
<bm:query-field name="bp_id_agent_desc" queryExpression="t1.bp_id_agent_desc like &apos;%&apos;|| ${@bp_id_agent_desc}||&apos;%&apos;"/>
<!-- <bm:query-field name="lease_start_date_from" queryExpression="t1.inception_of_lease &gt;=to_date(${@lease_start_date_from},&apos;yyyy-mm-dd&apos;)"/>
<bm:query-field name="lease_start_date_to" queryExpression="t1.inception_of_lease &lt;=to_date(${@lease_start_date_to},&apos;yyyy-mm-dd&apos;)"/>
-->
......
......@@ -58,7 +58,7 @@
<!-- <bm:query-field name="due_date_to" queryExpression="t.due_date between nvl(to_date(${@due_date_from},'yyyy-mm-dd'),t.due_date) and to_date(${@due_date_to},'yyyy-mm-dd')"/>-->
<bm:query-field name="cf_item" queryExpression="t.cf_item = ${@cf_item}"/>
<bm:query-field name="deposit_flag"
queryExpression="((nvl(${@deposit_flag},'N') = 'Y' and cf_item in (1,8,9,200,11)) or (nvl(${@deposit_flag},'N') = 'N'))"/>
queryExpression="((nvl(${@deposit_flag},'N') = 'Y' and cf_item in (1,8,9,200,11,250)) or (nvl(${@deposit_flag},'N') = 'N'))"/>
<bm:query-field name="due_date_from"
queryExpression="due_date &gt;= to_date(${@due_date_from},&apos;yyyy-mm-dd&apos;)"/>
<bm:query-field name="due_date_to"
......
<?xml version="1.0" encoding="UTF-8"?>
<bm:model xmlns:bm="http://www.leaf-framework.org/schema/bm">
<bm:operations>
<bm:operation name="execute">
<bm:update-sql><![CDATA[
begin
hl_sbo_inf_pkg.update_hls_sbo_num(p_header_id =>${@header_id},
p_user_id =>${/session/@user_id});
end;
]]></bm:update-sql>
</bm:operation>
</bm:operations>
</bm:model>
......@@ -498,14 +498,16 @@
if(record.get('transaction_type') == 'ADVANCE_RECEIPT'||record.get('transaction_type') == 'DEPOSIT'){
header_id = record.get('source_csh_trx_id');
}
var url = $('transaction_downloadFile_id').getUrl() + '?table_name=CSH_TRANSACTION&header_id=' + header_id;
var win = new Leaf.Window({
url: url,
title: '${l:HLS.SUPPORTING_DOCUMENT}',
id: 'transaction_downFile_winid',
width: 850,
height: 400
});
if(header_id){
var url = $('transaction_downloadFile_id').getUrl() + '?table_name=CSH_TRANSACTION&header_id=' + header_id;
var win = new Leaf.Window({
url: url,
title: '${l:HLS.SUPPORTING_DOCUMENT}',
id: 'transaction_downFile_winid',
width: 850,
height: 400
});
}
// win.on('close', function () {
// window.location.href = $('csh_transaction_receipt_id').getUrl();
// // var url = $('csh_transaction_receipt_id').getUrl();
......@@ -518,7 +520,7 @@
}
function attachment_rendered() {
return '<a href="javascript:attachment_upload()"><span style="color:red;">附件上传</span></a>';
return '<a href="javascript:attachment_upload()"><span style="color:red;">附件查看</span></a>';
}
function csh531_add_fun(ds, record, index) {
......@@ -941,7 +943,7 @@
bindTarget="csh_transaction_receipt_write_off_detail_ds" readOnly="true"/>
</a:box>
<a:box column="3" labelWidth="100">
<a:label prompt="附件上传" colspan="2" bindTarget="csh_transaction_receipt_write_off_detail_ds"
<a:label prompt="附件查看" colspan="2" bindTarget="csh_transaction_receipt_write_off_detail_ds"
renderer="attachment_rendered" width="370"/>
<a:numberField name="for_allocate_amount" renderer="Leaf.formatMoney" prompt="剩余可分配金额" readOnly="true" bindTarget="csh_transaction_receipt_write_off_detail_ds" />
</a:box>
......
......@@ -142,7 +142,7 @@
fullScreen: true
});
win.on('close', function () {
ds.query(ds.currentPage);
$('csh_transaction_receipt_maintain_result_ds').query($('csh_transaction_receipt_maintain_result_ds').currentPage);
});
},
failure: function () {
......@@ -161,23 +161,48 @@
var ds = $('csh_transaction_receipt_maintain_result_ds');
var record = ds.findById(id);
var bp_category = record.get('bp_category');
var status = record.get('confirmed_flag');
var write_off_flag = record.get('write_off_flag');
var readOnly = 'N';
var interfaceQueryFlag = 'Y';
var paid_byother_flag = record.get('paid_byother_flag');
var transaction_type = record.get('transaction_type');
var depositDisplayFlag = 'N';
var advanceDisplayFlag = 'N';
var confirmed_flag = record.get('confirmed_flag');
var interfaceQueryFlag = 'N';
// if (bp_category == 'AGENT') {
// depositDisplayFlag = 'Y';
// }
if (confirmed_flag == 'WF_APPROVING') {
interfaceQueryFlag = 'Y';
}
var approval_flag = '${/model/result_position/record/@approval_enbale}' || 'N';
if (approval_flag == 'Y') {
readOnly = 'Y';
if (status == 'APPROVED') {
interfaceQueryFlag = 'N';
}
} else {
if (write_off_flag == 'FULL') {
readOnly = 'Y';
interfaceQueryFlag = 'N';
} else {
if (status == 'WF_APPROVING') {
readOnly = 'Y';
}
}
}
if (status != 'WF_APPROVING') {
approval_flag = 'N';
}
if (transaction_type != 'ADVANCE_RECEIPT' && transaction_type != 'DEPOSIT') {
advanceDisplayFlag = 'Y';
} else {
if (paid_byother_flag == 'Y') {
depositDisplayFlag = 'Y';
}
}
Leaf.Masker.mask(Ext.getBody(), '正在执行...');
Leaf.request({
url: $('check_csh_transaction_status_link_id').getUrl(),
para: {
contract_id: record.get('contract_id')
transaction_id: record.get('transaction_id')
},
success: function () {
Leaf.Masker.unmask(Ext.getBody());
......@@ -185,9 +210,9 @@
var win = new Leaf.Window({
id: 'csh_write_off_upload_window',
params: {
deposit_flag:'Y',
transaction_id: record.get('transaction_id'),
depositDisplayFlag: depositDisplayFlag,
advanceDisplayFlag: advanceDisplayFlag,
bank_slip_num: record.get('bank_slip_num'),
company_id: record.get('company_id'),
transaction_date: Leaf.formatDate(record.get('transaction_date')),
......@@ -196,9 +221,10 @@
bp_bank_account_num: record.get('bp_bank_account_num'),
bp_bank_account_name: record.get('bp_bank_account_name'),
bp_id: record.get('bp_id'),
advanceDisplayFlag: advanceDisplayFlag,
readOnly: readOnly,
approval_flag: approval_flag,
interfaceQueryFlag: interfaceQueryFlag,
approval_flag: approval_flag,
winid: 'csh_write_off_upload_window'
},
......@@ -207,7 +233,7 @@
fullScreen: true
});
win.on('close', function () {
ds.query(ds.currentPage);
$('csh_transaction_receipt_maintain_result_ds').query($('csh_transaction_receipt_maintain_result_ds').currentPage);
});
},
failure: function () {
......@@ -219,19 +245,12 @@
scope: this
});
}
function csh531n_detail_renderer(value, record, name) {
var text = '';
var status = record.get('confirmed_flag');
var write_off_flag = record.get('write_off_flag');
var readOnly = 'N';
if ((status == 'WF_APPROVING' || status == 'WF_APPROVED') && write_off_flag != 'FULL') {
readOnly = 'Y';
}
if (name == 'csh531n_detail') {
return '<a href="Javascript:csh531n_open_write_off_detail(' + record.id + ',\'' + readOnly + '\')">明细</a>';
} else if (name == 'transaction_num') {
if (name == 'transaction_num') {
return '<a href="Javascript:csh531n_open_write_off_detail(' + record.id + ',\'' + readOnly + '\')">' + value + '</a>';
}
}
......@@ -518,9 +537,9 @@
<a:button click="csh510_export" text="导出"/>
</a:toolBar>-->
<a:columns>
<a:column name="transaction_num" prompt="CSH510.CSH_TRANSACTION.CSH_TRANSACTION_NUM" width="110"
align="center"/>
<!--<a:column name="transaction_num" prompt="CSH510.CSH_TRANSACTION.CSH_TRANSACTION_NUM" renderer="csh531n_detail_renderer" width="110" align="center"/>-->
<!-- <a:column name="transaction_num" prompt="CSH510.CSH_TRANSACTION.CSH_TRANSACTION_NUM" width="110"-->
<!-- align="center"/>-->
<a:column name="transaction_num" prompt="CSH510.CSH_TRANSACTION.CSH_TRANSACTION_NUM" renderer="csh531n_detail_renderer" width="110" align="center"/>
<a:column name="bp_name" prompt="代理店/厂商" align="center"/>
<a:column name="bp_id_telnet_n" prompt="承租人" align="center"/>
<a:column name="contract_number" prompt="合同编号" align="center"/>
......
......@@ -22,6 +22,7 @@
<a:link id="hls301_send_data" url="${/request/@context_path}/modules/hls/HLS301/hls_journal_send.lsc"/>
<a:link id="hls301_send_data_splice_id" model="hls.HLS301.hls_journal_post_to_sbo" modelaction="update"/>
<a:link id="hls301_send_bp_to_sbo" model="hls.HLS301.hls_bp_post_to_sbo" modelaction="update"/>
<a:link id="hls301_improt_sbo_num_link" url="${/request/@context_path}/modules/hls/HLS301/hls_sbo_import_upload.lview"/>
<script><![CDATA[
function lock_current_window2(msg) {
Leaf.Masker.mask(Ext.getBody(), msg);
......@@ -373,6 +374,22 @@
}
return '';
}
function hls301_improt_sbo_num() {
var win = new Leaf.Window({
id: 'hls301_improt_sbo_num_window',
params: {
winid:'hls301_improt_sbo_num_window'
},
url: $('hls301_improt_sbo_num_link').getUrl(),
title: '导入替换凭单号',
width: 430,
height: 300
});
win.on('close', function() {
$('hls_journal_header_result_ds').query();
});
}
]]></script>
<a:screen-include screen="modules/cont/CON500/con_contract_get_layout_code.lview"/>
<a:dataSets>
......@@ -470,6 +487,7 @@
<a:toolbarButton click="hls301_journal_query" text="HLS.QUERY"/>
<a:toolbarButton click="hls301_journal_send" text="凭证传输"/>
<a:toolbarButton click="hls301_bp_send" text="商业伙伴传输"/>
<a:toolbarButton click="hls301_improt_sbo_num" text="导入替换凭单号"/>
<!--<a:toolbarButton click="hls301_journal_import" text="批量导入"/>
<a:toolbarButton click="hls301_sap_transafer" text="转换为SAP凭证"/>
<a:toolbarButton click="hls301_sap_send" text="发送SAP凭证"/> -->
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: lpc 9874
$Date: $
$Revision: 1.0 $
$Purpose:
-->
<a:service xmlns:a="http://www.leaf-framework.org/application" xmlns:s="leaf.plugin.script" xmlns:p="uncertain.proc" trace="true">
<a:init-procedure>
<p:echo></p:echo>
<a:model-query model="basic.hls_fnd_attribute_sequence" rootPath="header"/>
<!-- <a:import-excel header_id="${/model/header/record/@header_id}" separator="," status_field="/parameter/@ImportSuccess" template_code="HLCM_SBO_REPLACE" user_id="${/session/@user_id}"/>-->
<a:import-excel header_id="${/model/header/record/@header_id}" separator="," status_field="/parameter/@ImportSuccess" template_code="HLCM_SBO_REPLACE" user_id="${/session/@user_id}"/>
<a:model-query defaultWhereClause="header_id=${/model/header/record/@header_id} and TEMPLATE_CODE = &apos;HLCM_SBO_REPLACE&apos;" model="basic.hls_fnd_attribute_status" rootPath="status"/>
<!-- <s:server-script><![CDATA[-->
<!-- println($ctx.parameter.toXML());-->
<!-- println(${/model/header/record/@header_id});-->
<!-- var hls_sbo_import_update_bm = $bm('hls.HLS301.hls_sbo_import');-->
<!-- hls_sbo_import_update_bm.execute({-->
<!-- header_id: ${/model/header/record/@header_id}-->
<!-- });-->
<!-- ]]></s:server-script>-->
</a:init-procedure>
<a:service-output output="/parameter"/>
</a:service>
<?xml version="1.0" encoding="UTF-8"?>
<a:screen xmlns:a="http://www.leaf-framework.org/application">
<a:init-procedure>
</a:init-procedure>
<a:view>
<script><![CDATA[
var header = $jq('meta[name=_csrf_header]').attr('content');
var token = $jq('meta[name=_csrf]').attr('content');
$jq(document).ajaxSend(function (e, xhr, options) {
xhr.setRequestHeader(header, token);
});
function saveClick() {
if (document.getElementById('importFile').value) {
var fileName = document.getElementById('importFile').value;
var fileType = fileName.substr(fileName.lastIndexOf("."));
if (fileType != '.xls' && fileType != '.xlsx') {
alert('${l:SELECT_CORRECT_IMPORT_FILE}');
} else {
var formData = new FormData(document.getElementById('importForm'));
formData.append("session_id",${/session/@session_id});
formData.append("template_code", 'HLCM_SBO_REPLACE');
// var formData = new FormData(document.getElementById('importForm'));
Leaf.Masker.mask(Ext.getBody(), '正在导入模板。。。');
$jq.ajax({
url: '${/request/@context_path}/hls/importExcel/import',
type: 'post',
processData: false,
contentType: false,
data: formData,
success: function (res) {
Leaf.Masker.unmask(Ext.getBody());
// Leaf.Masker.unmask(Ext.getBody());
// $('${/parameter/@winid}').close();
if (res.success) {
// document.getElementById('importForm').submit();
Leaf.SideBar.show({
msg: '保存成功',
duration: 2000
});
$('${/parameter/@winid}').close();
} else {
Leaf.showErrorMessage('提示', res.error.message);
}
},
failure: function (res) {
Leaf.Masker.unmask(Ext.getBody());
Leaf.showErrorMessage('提示', res.message);
},
error: function (res) {
Leaf.Masker.unmask(Ext.getBody());
Leaf.showErrorMessage('提示', res.message);
}
});
}
} else {
Leaf.showMessage('${l:PROMPT}', '未上传数据导入文件!');
}
}
function reInput() {
//重置修改后的文件
var file = document.getElementById('importFile');
file.value = "";
}
]]></script>
<a:dataSets>
<a:dataSet id="label_ds" autoCreate="true">
<a:fields>
<a:field name="label2" defaultValue="${l:STRICT_IMPORTED_TEMPLATE_DATA}"/>
<a:field name="label3" defaultValue="${l:PRODUCT_MASTER_DATA_IMPORT}"/>
<a:field name="label4" defaultValue="${l:IMPORTER_ONLY_SUPPORTS}"/>
<a:field name="label5" defaultValue="${l:READ_THE_ABOVE_CAREFULLY}"/>
<a:field name="label6" defaultValue="${l:THE_IMPORT_IS_COMPLETE}"/>
</a:fields>
</a:dataSet>
</a:dataSets>
<a:fieldSet style="margin-left:10px;margin-top:10px;" title="IMPORT_CONSIDERATIONS" width="400">
<a:label name="label2" bindTarget="label_ds" style="margin-left:10px;" width="380"/>
<a:label name="label3" bindTarget="label_ds" style="margin-left:10px;" width="380"/>
<a:label name="label4" bindTarget="label_ds" style="margin-left:10px;" width="380"/>
<a:label name="label5" bindTarget="label_ds" style="color:#055A78;font-weight:bold;margin-left:10px;"
width="380"/>
<a:box column="2" row="1" style="margin-left:-3px;">
<a:label name="label6" bindTarget="label_ds" style="color:#055A78;font-weight:bold;margin-left:10px;"
width="266"/>
<!-- <input onclick="downloadTemp()" style="width:64px;" type="button" value="模板下载"/>-->
</a:box>
</a:fieldSet>
<a:fieldSet style="margin-left:10px;margin-top:10px;" title="TMPLT_IMPORT_FILE" width="400">
<form name="upload" id="importForm"
action="${/request/@context_path}/modules/hls/HLS301/hls_sbo_import_upload_info.lview?_csrf=${/session/@_csrf.token}"
enctype="multipart/form-data" method="post">
<label style="margin-left:10px;margin-top:10px"><![CDATA[${l:PLEASE_SELECT_A_FILE}]]></label>
<input name="content" id="importFile" style="margin-bottom:4px;width:160px;height:22px;" type="file"
onclick="reInput()"/>
<input id="hls301_upload_id" onclick="saveClick()" style="margin-left:50px;margin-top:10px;width:60px;"
type="button" value="导入"/>
<!--<input type="hidden" name="bp_id" value="" id="hiddenField" />-->
</form>
</a:fieldSet>
</a:view>
</a:screen>
<?xml version="1.0" encoding="UTF-8"?>
<!--
$Author: lara
$Date: 2019-1-1 下午3:48:04
$Revision: 1.0
$Purpose:
-->
<a:screen xmlns:a="http://www.leaf-framework.org/application" trace="true" xmlns:p="uncertain.proc">
<a:init-procedure>
<p:echo></p:echo>
<a:model-query model="basic.hls_fnd_attribute_sequence" rootPath="header"/>
<a:import-excel header_id="${/model/header/record/@header_id}" separator="," status_field="/parameter/@ImportSuccess" template_code="HLCM_SBO_REPLACE" user_id="${/session/@user_id}"/>
<!-- <a:import-excel header_id="" separator="," status_field="/parameter/@ImportSuccess" template_code="HLCM_SBO_REPLACE" user_id="${/session/@user_id}"/>-->
<a:model-query defaultWhereClause="header_id=${/model/header/record/@header_id} and TEMPLATE_CODE = &apos;HLCM_SBO_REPLACE&apos;" model="basic.hls_fnd_attribute_status" rootPath="status"/>
</a:init-procedure>
<a:view>
<a:link id="hls_sbo_save_data_link" model="hls.HLS301.hls_sbo_import" modelaction="execute"/>
<a:link id="hls_journal_query_link" url="${/request/@context_path}/modules/hls/HLS301/hls_journal_query.lview"/>
<script><![CDATA[
function success() {
Leaf.showInfoMessage('${l:HLS.PROMPT}', '导入成功', function callback() {
window.location.href =$('hls_journal_query_link').getUrl();
});
}
function loadComplete() {
if ('${/model/status/record/@status}' == 'NEW') {
Leaf.Masker.mask(Ext.get(document.documentElement), '正在更新数据。。。');
var param = {};
param['header_id'] = '${/model/header/record/@header_id}';
param['user_id'] = '${/session/@user_id}';
Leaf.request({
url: $('hls_sbo_save_data_link').getUrl(),
para: param,
success: function() {
Leaf.Masker.unmask(Ext.get(document.documentElement));
// Leaf.SideBar.show({
// msg: '导入成功!',
// duration: 2000
// });
success();
// window.location.href = $('hls_journal_query_link').getUrl();
},
error: function() {
},
failure: function() {},
scope: this
});
} else {
//Ext.get('success_form').setStyle('display', 'none');
Ext.get('failure_form').setStyle('visibility', 'visible');
}
}
]]></script>
<a:dataSets>
<a:dataSet id="error_ds">
<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: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:columns>
<a:column name="import_field_1"/>
<a:column name="import_field_2"/>
<a:column name="import_field_3"/>
</a:columns>
</a:grid>
</a:form>
</a:screenBody>
<script><![CDATA[
loadComplete();
]]></script>
</a:view>
</a:screen>
......@@ -3,7 +3,7 @@
<a:init-procedure>
<a:model-query fetchAll="true" model="rpt.RPT5014.rpt5014_six_month" rootPath="/model/day"/>
<a:model-query fetchAll="true" model="rpt.RPT5014.rpt5014_result_query" rootPath="/model/datasource"/>
<dr:excel-report enableTask="false" filename="${/parameter/@file_name}">
<dr:excel-report enableTask="true" filename="${/parameter/@file_name}">
<dr:styles>
<dr:cell-style name="cell1" align="ALIGN_CENTER" vertical="VERTICAL_CENTER">
<dr:font bold="false" fontName="Arial" height="10"/>
......
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