Browse Source

WMS bug HL-6222:器具初始化记录,来源库位代码应去掉导出

hella_online_20241017
gaojs 4 months ago
parent
commit
a3a96c43b0
  1. 42
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerRecord/ContainerRecordMainController.java
  2. 48
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerRecord/vo/ContainerRecordMainInitExcelVO.java
  3. 8
      win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/convert/containerRequest/ContainerMainRequestConvert.java

42
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<ContainerRecordDetailDO> list = containerRecordDetailService.getContainerRecordDetailPage(pageVO).getList();
// 导出 Excel
List<ContainerRecordMainInitExcelVO> datas = this.getInitExcelVo(list);
Map<Integer, String[]> 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<ContainerRecordDetailDO> list = containerRecordDetailService.getContainerRecordDetailSenior(conditions).getList();
// 导出 Excel
List<ContainerRecordMainInitExcelVO> datas = this.getInitExcelVo(list);
Map<Integer, String[]> mapDropDown = new HashMap<>();
ExcelUtils.write(response, "器具初始化记录主.xls", "数据", ContainerRecordMainInitExcelVO.class, datas ,mapDropDown);
}
private List<ContainerRecordMainExcelVO> getExcelVo(List<ContainerRecordDetailDO> detailList) {
List<ContainerRecordMainExcelVO> resultList = new ArrayList<>();
if (!CollectionUtils.isEmpty(detailList)) {
@ -136,6 +160,24 @@ public class ContainerRecordMainController {
return resultList;
}
private List<ContainerRecordMainInitExcelVO> getInitExcelVo(List<ContainerRecordDetailDO> detailList) {
List<ContainerRecordMainInitExcelVO> resultList = new ArrayList<>();
if (!CollectionUtils.isEmpty(detailList)) {
Set<Long> masterIdSet = new HashSet<>();
for (ContainerRecordDetailDO detail : detailList) {
masterIdSet.add(detail.getMasterId());
}
Map<Long, ContainerRecordMainDO> 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 = "获得导入器具管理记录主模板")

48
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;
}

8
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);
}

Loading…
Cancel
Save