| | |
| | | import com.core.common.R; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.OrderDomainParam; |
| | | import com.zy.asrs.entity.param.PakOutExcelExportParam; |
| | | import com.zy.asrs.entity.result.PakoutExcelVo; |
| | | import com.zy.asrs.entity.result.PakoutVo; |
| | | import com.zy.asrs.service.*; |
| | |
| | | .doWrite(newPakOutExcelVos); |
| | | } |
| | | |
| | | @PostMapping (value = "/pakOut/excelExport3/auth") |
| | | @ManagerAuth |
| | | public void export(HttpServletResponse response, @RequestBody PakOutExcelExportParam pakOutExcelExportParam) throws IOException { |
| | | |
| | | EntityWrapper<Pakout> entityWrapper = new EntityWrapper<>(); |
| | | |
| | | if ("all".equals(pakOutExcelExportParam.getType())) { |
| | | PakOutExcelExportParam.QueryWhere queryWhere = pakOutExcelExportParam.getQueryWhere(); |
| | | if (!Cools.isEmpty(queryWhere.getCust_name())) { |
| | | entityWrapper.eq("cust_name", queryWhere.getCust_name()); |
| | | } |
| | | if (!Cools.isEmpty(queryWhere.getDoc_num())) { |
| | | entityWrapper.eq("doc_num", queryWhere.getDoc_num()); |
| | | } |
| | | if (queryWhere.getCreate_time().contains(RANGE_TIME_LINK)) { |
| | | String[] dates = queryWhere.getCreate_time().split(RANGE_TIME_LINK); |
| | | entityWrapper.ge("create_time", DateUtils.convert(dates[0])); |
| | | entityWrapper.le("create_time", DateUtils.convert(dates[1])); |
| | | } |
| | | |
| | | // 限制销售角色只能看自己创建的单子(销售角色id固定21,不能随意修改) |
| | | User user = getUser(); |
| | | if (user.getRoleId() != 2 && user.getRoleId() != 24) { |
| | | entityWrapper.eq("create_by", user.getId()); |
| | | } |
| | | } else { |
| | | entityWrapper.in("doc_num", pakOutExcelExportParam.getDocNumList()); |
| | | } |
| | | |
| | | List<Pakout> list = pakoutService.selectList(entityWrapper); |
| | | List<PakoutVo> pakOutVoList = new ArrayList<>(); |
| | | |
| | | for (Pakout pakOut : list) { |
| | | Pla pla = plaService.selectOne(new EntityWrapper<Pla>() |
| | | .eq("batch", pakOut.getBatch()) |
| | | .eq("package_no", pakOut.getBarcode()) |
| | | .eq("brand", pakOut.getMaktx())); |
| | | if (pla != null) { |
| | | PakoutVo pakOutVo = new PakoutVo(); |
| | | BeanUtils.copyProperties(pla, pakOutVo); |
| | | BeanUtils.copyProperties(pakOut, pakOutVo); |
| | | pakOutVoList.add(pakOutVo); |
| | | } |
| | | } |
| | | |
| | | 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(), PakoutVo.class) |
| | | .sheet("表1") |
| | | .doWrite(pakOutVoList); |
| | | } |
| | | |
| | | } |