diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerRecord/ContainerRecordMainController.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerRecord/ContainerRecordMainController.java index a5e036e08..b95380ab6 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerRecord/ContainerRecordMainController.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerRecord/ContainerRecordMainController.java @@ -118,6 +118,30 @@ public class ContainerRecordMainController { ExcelUtils.write(response, "器具管理记录主.xls", "数据", ContainerRecordMainExcelVO.class, datas ,mapDropDown); } + @GetMapping("/export-excel-init") + @Operation(summary = "导出器具管理记录主 Excel") + //@PreAuthorize("@ss.hasPermission('wms:container-record-main:export')") + @OperateLog(type = EXPORT) + public void exportContainerRecordInitMainExcel(@Valid ContainerRecordDetailPageReqVO pageVO, HttpServletResponse response) throws IOException { + pageVO.setPageSize(Integer.MAX_VALUE); + List list = containerRecordDetailService.getContainerRecordDetailPage(pageVO).getList(); + // 导出 Excel + List datas = this.getInitExcelVo(list); + Map mapDropDown = new HashMap<>(); + ExcelUtils.write(response, "器具初始化记录主.xls", "数据", ContainerRecordMainInitExcelVO.class, datas, mapDropDown); + } + @PostMapping("/export-excel-init-senior") + @Operation(summary = "导出器具管理记录主 Excel") + @OperateLog(type = EXPORT) + public void exportContainerRecordMainInitExcelSenior(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException { + conditions.setPageSize(Integer.MAX_VALUE); + List list = containerRecordDetailService.getContainerRecordDetailSenior(conditions).getList(); + // 导出 Excel + List datas = this.getInitExcelVo(list); + Map mapDropDown = new HashMap<>(); + ExcelUtils.write(response, "器具初始化记录主.xls", "数据", ContainerRecordMainInitExcelVO.class, datas ,mapDropDown); + } + private List getExcelVo(List detailList) { List resultList = new ArrayList<>(); if (!CollectionUtils.isEmpty(detailList)) { @@ -136,6 +160,24 @@ public class ContainerRecordMainController { return resultList; } + private List getInitExcelVo(List detailList) { + List resultList = new ArrayList<>(); + if (!CollectionUtils.isEmpty(detailList)) { + Set masterIdSet = new HashSet<>(); + for (ContainerRecordDetailDO detail : detailList) { + masterIdSet.add(detail.getMasterId()); + } + Map mainMap = containerRecordMainMapper.queryMainListToMap(masterIdSet); + for (ContainerRecordDetailDO detail : detailList) { + ContainerRecordMainDO mainDO = mainMap.get(detail.getMasterId()); + ContainerRecordMainInitExcelVO vo = ContainerMainRequestConvert.INSTANCE.convert03(mainDO, detail); + vo.setCreator(userApi.getUserNickname(vo.getCreator())); + resultList.add(vo); + } + } + return resultList; + } + @GetMapping("/get-import-template") @Operation(summary = "获得导入器具管理记录主模板") diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerRecord/vo/ContainerRecordMainInitExcelVO.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerRecord/vo/ContainerRecordMainInitExcelVO.java new file mode 100644 index 000000000..d986eae2a --- /dev/null +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerRecord/vo/ContainerRecordMainInitExcelVO.java @@ -0,0 +1,48 @@ +package com.win.module.wms.controller.containerRecord.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.win.framework.excel.core.annotations.DictFormat; +import com.win.framework.excel.core.convert.DictConvert; +import com.win.module.wms.enums.DictTypeConstants; +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDateTime; + +/** + * 器具管理记录主 Excel VO + * + * @author 超级管理员 + */ +@Data +public class ContainerRecordMainInitExcelVO { + + @ExcelProperty("单据号") + private String number; + + @ExcelProperty("申请单号") + private String requestNumber; + + @ExcelProperty(value = "类型", converter = DictConvert.class) + @DictFormat(DictTypeConstants.CONTAINER_CONTENT_TYPE) + private String type; + + @ExcelProperty("器具号") + private String containerNumber; + + @ExcelProperty("目标库位代码") + private String toLocationCode; + + @ExcelProperty("到数量") + private BigDecimal toQty; + + @ExcelProperty(value = "计量单位", converter = DictConvert.class) + @DictFormat(DictTypeConstants.UOM) + private String uom; + + @ExcelProperty("创建者") + private String creator; + + @ExcelProperty("创建时间") + private LocalDateTime createTime; +} diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/convert/containerRequest/ContainerMainRequestConvert.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/convert/containerRequest/ContainerMainRequestConvert.java index 5e8dead03..6d888f659 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/convert/containerRequest/ContainerMainRequestConvert.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/convert/containerRequest/ContainerMainRequestConvert.java @@ -3,6 +3,7 @@ package com.win.module.wms.convert.containerRequest; import com.win.framework.common.pojo.PageResult; import com.win.module.wms.controller.containerRecord.vo.ContainerRecordMainExcelVO; +import com.win.module.wms.controller.containerRecord.vo.ContainerRecordMainInitExcelVO; import com.win.module.wms.controller.containerRequest.vo.*; import com.win.module.wms.dal.dataobject.containerRecord.ContainerRecordDetailDO; import com.win.module.wms.dal.dataobject.containerRecord.ContainerRecordMainDO; @@ -59,4 +60,11 @@ public interface ContainerMainRequestConvert { @Mapping(source = "detail.creator", target = "creator"), }) ContainerRecordMainExcelVO convert02(ContainerRecordMainDO mainDO, ContainerRecordDetailDO detail); + + @Mappings({ + @Mapping(source = "detail.number", target = "number"), + @Mapping(source = "detail.createTime", target = "createTime"), + @Mapping(source = "detail.creator", target = "creator"), + }) + ContainerRecordMainInitExcelVO convert03(ContainerRecordMainDO mainDO, ContainerRecordDetailDO detail); }