| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | return R.ok(sum); |
| | | } |
| | | |
| | | // @RequestMapping(value = "/locDetl/statis/export") |
| | | // public void statisExport(HttpServletResponse response) throws IOException { |
| | | // List<AgvLocDetl> excel = agvLocDetlService.getStockStatisExcel(); |
| | | // for (AgvLocDetl locDetl : excel) { |
| | | // Mat mat = matService.selectByMatnr(locDetl.getMatnr()); |
| | | // if (mat != null) { |
| | | // locDetl.sync(mat); |
| | | // } |
| | | // } |
| | | // response.setContentType("application/vnd.ms-excel"); |
| | | // response.setCharacterEncoding("utf-8"); |
| | | // String fileName = URLEncoder.encode("库存明细统计报表", "UTF-8"); |
| | | // response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | // EasyExcel.write(response.getOutputStream(), AgvLocDetl.class) |
| | | // .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
| | | // .sheet("表1") |
| | | // .doWrite(excel); |
| | | // } |
| | | |
| | | |
| | | @RequestMapping(value = "/locDetl/statis/export") |
| | | public void statisExport(HttpServletResponse response) throws IOException { |
| | | List<AgvLocDetl> excel = agvLocDetlService.getStockStatisExcel(); |
| | | for (AgvLocDetl locDetl : excel) { |
| | | Mat mat = matService.selectByMatnr(locDetl.getMatnr()); |
| | | if (mat != null) { |
| | | locDetl.sync(mat); |
| | | } |
| | | } |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String fileName = URLEncoder.encode("库存明细统计报表", "UTF-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | EasyExcel.write(response.getOutputStream(), AgvLocDetl.class) |
| | | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
| | | .sheet("表1") |
| | | .doWrite(excel); |
| | | @ManagerAuth(memo = "库位明细导出") |
| | | public synchronized R statisExport(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | List<AgvLocDetl> stockStatisExcel = agvLocDetlService.getStockStatisExcel(); |
| | | return R.ok(exportSupport(stockStatisExcel, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locDetl/export/auth") |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.net.URLEncoder; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | |
| | | @Autowired |
| | | private LocDetlMapper LocDetlMapper; |
| | | |
| | | // @RequestMapping(value = "/locDetl/statis/export") |
| | | //// @ManagerAuth |
| | | // public void statisExport(HttpServletResponse response) throws IOException { |
| | | // List<LocDetl> excel = LocDetlMapper.getStockStatisExcel(); |
| | | // for (LocDetl locDetl : excel) { |
| | | // Mat mat = matService.selectByMatnr(locDetl.getMatnr()); |
| | | // if (mat != null) { |
| | | // locDetl.sync(mat); |
| | | // } |
| | | // } |
| | | // response.setContentType("application/vnd.ms-excel"); |
| | | // response.setCharacterEncoding("utf-8"); |
| | | // String fileName = URLEncoder.encode("库存明细统计报表", "UTF-8"); |
| | | // response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | // EasyExcel.write(response.getOutputStream(), LocDetl.class) |
| | | // .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
| | | // .sheet("表1") |
| | | // .doWrite(excel); |
| | | // } |
| | | |
| | | @RequestMapping(value = "/locDetl/statis/export") |
| | | // @ManagerAuth |
| | | public void statisExport(HttpServletResponse response) throws IOException { |
| | | List<LocDetl> excel = LocDetlMapper.getStockStatisExcel(); |
| | | for (LocDetl locDetl : excel) { |
| | | Mat mat = matService.selectByMatnr(locDetl.getMatnr()); |
| | | if (mat != null) { |
| | | locDetl.sync(mat); |
| | | } |
| | | } |
| | | response.setContentType("application/vnd.ms-excel"); |
| | | response.setCharacterEncoding("utf-8"); |
| | | String fileName = URLEncoder.encode("库存明细统计报表", "UTF-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); |
| | | EasyExcel.write(response.getOutputStream(), LocDetl.class) |
| | | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
| | | .sheet("表1") |
| | | .doWrite(excel); |
| | | @ManagerAuth(memo = "库位明细导出") |
| | | public synchronized R statisExport(@RequestBody JSONObject param){ |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | List<LocDetl> stockStatisExcel = LocDetlMapper.getStockStatisExcel(); |
| | | return R.ok(exportSupport(stockStatisExcel, fields)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Select("select\n" + |
| | | " ROW_NUMBER() over (order by sum(a.anfme) desc) as row\n" + |
| | | " , a.matnr\n" + |
| | | " , a.maktx, a.specs, a.model\n " + |
| | | " , sum(a.anfme) as anfme\n" + |
| | | " from agv_loc_detl a\n" + |
| | | " where 1=1\n" + |
| | | " group by a.matnr") |
| | | " group by a.matnr, a.maktx, a.specs, a.model") |
| | | List<AgvLocDetl> getStockStatisExcel(); |
| | | |
| | | @Select("SELECT SUM(anfme) FROM agv_loc_detl WHERE loc_no = #{locNo}") |
| | |
| | | ROW_NUMBER() over (order by sum(a.anfme) desc) as row |
| | | , a.matnr |
| | | , sum(a.anfme) as anfme |
| | | , a.maktx |
| | | , a.specs |
| | | , model |
| | | from asr_loc_detl a |
| | | where 1=1 |
| | | group by a.matnr |
| | | group by a.matnr,a.maktx,a.specs,model |
| | | </select> |
| | | |
| | | <select id="selectPakoutByRule" resultMap="BaseResultMap"> |
| | |
| | | var checkStatus = table.checkStatus(obj.config.id); |
| | | switch(obj.event) { |
| | | case 'exportAll': |
| | | layer.closeAll(); |
| | | layer.load(1, {shade: [0.1,'#fff']}); |
| | | location.href = baseUrl + "/agv/locDetl/statis/export"; |
| | | layer.closeAll('loading'); |
| | | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | | var titles=[]; |
| | | var fields=[]; |
| | | obj.config.cols[0].map(function (col) { |
| | | if (col.type === 'normal' && col.hide === false && col.toolbar == null) { |
| | | titles.push(col.title); |
| | | fields.push(col.field); |
| | | } |
| | | }); |
| | | var exportData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | exportData[this.name] = this.value; |
| | | }); |
| | | var param = { |
| | | 'locDetl': exportData, |
| | | 'fields': fields |
| | | }; |
| | | var loadIndex = layer.msg('正在导出...', {icon: 16, shade: 0.01, time: false}); |
| | | $.ajax({ |
| | | url: baseUrl+"/agv/locDetl/statis/export", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | dataType:'json', |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | layer.closeAll(); |
| | | if (res.code === 200) { |
| | | table.exportFile(titles,res.data,'xls'); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | break; |
| | | case 'exportData': |
| | | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | |
| | | var checkStatus = table.checkStatus(obj.config.id); |
| | | switch(obj.event) { |
| | | case 'exportAll': |
| | | layer.closeAll(); |
| | | layer.load(1, {shade: [0.1,'#fff']}); |
| | | location.href = baseUrl + "/locDetl/statis/export"; |
| | | layer.closeAll('loading'); |
| | | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |
| | | var titles=[]; |
| | | var fields=[]; |
| | | obj.config.cols[0].map(function (col) { |
| | | if (col.type === 'normal' && col.hide === false && col.toolbar == null) { |
| | | titles.push(col.title); |
| | | fields.push(col.field); |
| | | } |
| | | }); |
| | | var exportData = {}; |
| | | $.each($('#search-box [name]').serializeArray(), function() { |
| | | exportData[this.name] = this.value; |
| | | }); |
| | | var param = { |
| | | 'locDetl': exportData, |
| | | 'fields': fields |
| | | }; |
| | | var loadIndex = layer.msg('正在导出...', {icon: 16, shade: 0.01, time: false}); |
| | | $.ajax({ |
| | | url: baseUrl+"/locDetl/statis/export", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: JSON.stringify(param), |
| | | dataType:'json', |
| | | contentType:'application/json;charset=UTF-8', |
| | | method: 'POST', |
| | | success: function (res) { |
| | | layer.close(loadIndex); |
| | | layer.closeAll(); |
| | | if (res.code === 200) { |
| | | table.exportFile(titles,res.data,'xls'); |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl+"/"; |
| | | } else { |
| | | layer.msg(res.msg) |
| | | } |
| | | } |
| | | }); |
| | | }); |
| | | break; |
| | | case 'exportData': |
| | | layer.confirm('确定导出Excel吗', {shadeClose: true}, function(){ |