| | |
| | | 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.time.LocalDate; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | @RequestParam(required = false)String orderByType, |
| | | @RequestParam(required = false)String condition, |
| | | @RequestParam Map<String, Object> param, |
| | | @RequestParam(required = false)Boolean unreason){ |
| | | @RequestParam(required = false)Boolean unreason, |
| | | @RequestParam(required = false)Boolean expired){ |
| | | if (!Cools.isEmpty(unreason) && unreason) { |
| | | |
| | | return R.ok(agvLocDetlService.selectPage(new Page<>(curr, limit), new EntityWrapper<AgvLocDetl>() |
| | | .where(" DATALENGTH( batch ) != 11 or\n" + |
| | | " batch LIKE '%[a-z]%'"))); |
| | | } |
| | | if (!Cools.isEmpty(expired) && expired) { |
| | | return R.ok(agvLocDetlService.selectPage( |
| | | new Page<>(curr, limit), |
| | | new EntityWrapper<AgvLocDetl>() |
| | | .where("deadline < {0}", LocalDate.now()) // 新增的过期判断 |
| | | )); |
| | | } |
| | | param.remove("unreason"); |
| | | param.remove("expired"); |
| | | String row = ""; |
| | | EntityWrapper<AgvLocDetl> wrapper = new EntityWrapper<>(); |
| | | if (param.get("row") != null) { |
| | |
| | | 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(), 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<AgvLocDetl> stockStatisExcel = agvLocDetlService.getStockStatisExcel(); |
| | | return R.ok(exportSupport(stockStatisExcel, fields)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/locDetl/export/auth") |