diff --git a/erp-modular/src/main/java/com/skyeye/controller/SalesOutLetController.java b/erp-modular/src/main/java/com/skyeye/controller/SalesOutLetController.java index a709c2f8..d6def6c3 100644 --- a/erp-modular/src/main/java/com/skyeye/controller/SalesOutLetController.java +++ b/erp-modular/src/main/java/com/skyeye/controller/SalesOutLetController.java @@ -68,4 +68,16 @@ public class SalesOutLetController { salesOutLetService.editSalesOutLetMationById(inputObject, outputObject); } + /** + * 导出Excel + * @param inputObject + * @param outputObject + * @throws Exception + */ + @RequestMapping("/post/SalesOutLetController/queryMationToExcel") + @ResponseBody + public void queryMationToExcel(InputObject inputObject, OutputObject outputObject) throws Exception{ + salesOutLetService.queryMationToExcel(inputObject, outputObject); + } + } diff --git a/erp-modular/src/main/java/com/skyeye/dao/SalesOutLetDao.java b/erp-modular/src/main/java/com/skyeye/dao/SalesOutLetDao.java index 694cf3e3..84287364 100644 --- a/erp-modular/src/main/java/com/skyeye/dao/SalesOutLetDao.java +++ b/erp-modular/src/main/java/com/skyeye/dao/SalesOutLetDao.java @@ -25,4 +25,6 @@ public interface SalesOutLetDao { public List> querySalesManUserInfoById(Map bean) throws Exception; + public List> queryMationToExcel(Map params) throws Exception; + } diff --git a/erp-modular/src/main/java/com/skyeye/service/SalesOutLetService.java b/erp-modular/src/main/java/com/skyeye/service/SalesOutLetService.java index 0665b877..6677f35b 100644 --- a/erp-modular/src/main/java/com/skyeye/service/SalesOutLetService.java +++ b/erp-modular/src/main/java/com/skyeye/service/SalesOutLetService.java @@ -13,4 +13,6 @@ public interface SalesOutLetService { public void editSalesOutLetMationById(InputObject inputObject, OutputObject outputObject) throws Exception; + public void queryMationToExcel(InputObject inputObject, OutputObject outputObject) throws Exception; + } diff --git a/erp-modular/src/main/java/com/skyeye/service/impl/SalesOutLetServiceImpl.java b/erp-modular/src/main/java/com/skyeye/service/impl/SalesOutLetServiceImpl.java index 69f55549..a90a385c 100644 --- a/erp-modular/src/main/java/com/skyeye/service/impl/SalesOutLetServiceImpl.java +++ b/erp-modular/src/main/java/com/skyeye/service/impl/SalesOutLetServiceImpl.java @@ -14,6 +14,7 @@ import com.github.miemiedev.mybatis.paginator.domain.PageBounds; import com.github.miemiedev.mybatis.paginator.domain.PageList; import com.skyeye.common.object.InputObject; import com.skyeye.common.object.OutputObject; +import com.skyeye.common.util.ExcelUtil; import com.skyeye.common.util.ToolUtil; import com.skyeye.dao.SalesOutLetDao; import com.skyeye.erp.util.ErpConstants; @@ -263,5 +264,39 @@ public class SalesOutLetServiceImpl implements SalesOutLetService{ outputObject.setreturnMessage("数据格式错误"); } } + + /** + * 导出Excel + * @param inputObject + * @param outputObject + * @throws Exception + */ + @SuppressWarnings("static-access") + @Override + public void queryMationToExcel(InputObject inputObject, OutputObject outputObject) throws Exception { + Map params = inputObject.getParams(); + params.put("userId", inputObject.getLogParams().get("id")); + List> beans = salesOutLetDao.queryMationToExcel(params); + String defaultNumber, linkNumber, status; + for(Map bean : beans){ + defaultNumber = bean.get("defaultNumber").toString(); + linkNumber = bean.get("linkNumber").toString(); + status = bean.get("status").toString(); + if(!ToolUtil.isBlank(linkNumber)){ + defaultNumber += "[转]"; + if("2".equals(status)){ + defaultNumber += "[正常]"; + }else{ + defaultNumber += "[预警]"; + } + } + bean.put("defaultNumber", defaultNumber); + } + String[] key = new String[]{"defaultNumber", "supplierName", "materialNames", "totalPrice", "taxMoney", "discountLastMoney", "changeAmount", "operPersonName", "operTime"}; + String[] column = new String[]{"单据编号", "客户", "关联产品", "合计金额", "含税合计", "优惠后金额", "收款", "操作人", "单据日期"}; + String[] dataType = new String[]{"", "data", "data", "data", "data", "data", "data", "data", "data"}; + //采购销售出库信息导出 + ExcelUtil.createWorkBook("销售出库单", "销售出库单详细", beans, key, column, dataType, inputObject.getResponse()); + } } diff --git a/erp-modular/src/main/resources/dbmapper/erp/SalesOutLetMapper.xml b/erp-modular/src/main/resources/dbmapper/erp/SalesOutLetMapper.xml index d9874c73..c7216940 100644 --- a/erp-modular/src/main/resources/dbmapper/erp/SalesOutLetMapper.xml +++ b/erp-modular/src/main/resources/dbmapper/erp/SalesOutLetMapper.xml @@ -191,4 +191,39 @@ INSTR(CONCAT(',', #{salesMan}, ','), CONCAT(',', a.user_id, ',')) + + \ No newline at end of file diff --git a/erp-modular/src/main/resources/mapping/erp-wei.xml b/erp-modular/src/main/resources/mapping/erp-wei.xml index 2fbf7215..6dea44ae 100644 --- a/erp-modular/src/main/resources/mapping/erp-wei.xml +++ b/erp-modular/src/main/resources/mapping/erp-wei.xml @@ -484,6 +484,12 @@ + + + + + + diff --git a/erp-modular/src/main/resources/template/js/salesoutlet/salesoutletlist.js b/erp-modular/src/main/resources/template/js/salesoutlet/salesoutletlist.js index 434a107a..caf7b34f 100644 --- a/erp-modular/src/main/resources/template/js/salesoutlet/salesoutletlist.js +++ b/erp-modular/src/main/resources/template/js/salesoutlet/salesoutletlist.js @@ -15,7 +15,8 @@ layui.config({ form = layui.form, laydate = layui.laydate, table = layui.table; - authBtn('1571813632546'); + authBtn('1571813632546');//添加 + authBtn('1572231503534');//导出 laydate.render({ elem: '#operTime', //指定元素 @@ -173,6 +174,22 @@ layui.config({ } table.reload("messageTable", {page: {curr: 1}, where:{defaultNumber: $("#defaultNumber").val(), material: $("#material").val(), startTime: startTime, endTime: endTime}}) } + + //导出excel + $("body").on("click", "#downloadExcel", function () { + if(isNull($("#operTime").val())){//一定要记得,当createTime为空时 + startTime = ""; + endTime = ""; + }else { + startTime = $("#operTime").val().split('~')[0].trim() + ' 00:00:00'; + endTime = $("#operTime").val().split('~')[1].trim() + ' 23:59:59'; + } + postDownLoadFile({ + url : reqBasePath + 'salesoutlet005?userToken=' + getCookie('userToken') + '&loginPCIp=' + returnCitySN["cip"], + params: {defaultNumber: $("#defaultNumber").val(), material: $("#material").val(), startTime: startTime, endTime: endTime}, + method : 'post' + }); + }); exports('salesoutletlist', {}); }); diff --git a/erp-modular/src/main/resources/template/tpl/salesoutlet/salesoutletlist.html b/erp-modular/src/main/resources/template/tpl/salesoutlet/salesoutletlist.html index c886c82c..f9e32d1f 100644 --- a/erp-modular/src/main/resources/template/tpl/salesoutlet/salesoutletlist.html +++ b/erp-modular/src/main/resources/template/tpl/salesoutlet/salesoutletlist.html @@ -34,6 +34,7 @@
+