| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.asrs.common.domain.CodeRes; |
| | | import com.zy.asrs.common.domain.entity.LocInPrintMatExcel; |
| | | import com.zy.asrs.common.domain.entity.MatExcel; |
| | | import com.zy.asrs.common.domain.entity.MatPrint; |
| | | import com.zy.asrs.common.utils.*; |
| | |
| | | return R.ok("成功同步"+listener.getTotal()+"条商品数据"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * excel导入模板下载 |
| | | */ |
| | | @RequestMapping(value = "/out/loc/box/excel/import/mould") |
| | | public void outLocBoxExcelImportMould(HttpServletResponse response) throws IOException { |
| | | List<LocInPrintMatExcel> excels = new ArrayList<>(); |
| | | 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(), LocInPrintMatExcel.class) |
| | | .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) |
| | | .sheet("待打印物料模板") |
| | | .doWrite(excels); |
| | | } |
| | | |
| | | // excel导入 |
| | | @PostMapping(value = "/out/loc/box/excel/import/auth") |
| | | @ManagerAuth(memo = "导入待打印物料模板") |
| | | @Transactional |
| | | public R outLocBoxExcelImport(MultipartFile file) throws IOException { |
| | | LocInPrintMatExcelListener listener = new LocInPrintMatExcelListener(getUserId(), getHostId()); |
| | | EasyExcel.read(file.getInputStream(), LocInPrintMatExcel.class, listener).sheet().doRead(); |
| | | return R.ok("成功导入"+listener.getTotal()[0]+"种待打印物料信息,共生成"+listener.getTotal()[1]+"条待打印条码!"); |
| | | } |
| | | |
| | | } |