From 4145ca00acb8f5ff36fdfc8460110d553b5a5cd1 Mon Sep 17 00:00:00 2001 From: zhaoxuebing <1291173720@qq.com> Date: Thu, 28 Dec 2023 09:54:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=99=A8=E5=85=B7=E8=A7=A3=E7=BB=91=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E8=AE=B0=E5=BD=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ContainerUnbindRecordMainController.java | 15 +++- .../vo/ContainerUnbindRecordMainExcelVO.java | 79 ++++++------------- .../ContainerUnbindRecordMainService.java | 3 +- .../ContainerUnbindRecordMainServiceImpl.java | 39 ++++++++- 4 files changed, 75 insertions(+), 61 deletions(-) diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerUnbind/ContainerUnbindRecordMainController.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerUnbind/ContainerUnbindRecordMainController.java index 24f89f83..4106c167 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerUnbind/ContainerUnbindRecordMainController.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerUnbind/ContainerUnbindRecordMainController.java @@ -2,11 +2,14 @@ package com.win.module.wms.controller.containerUnbind; import com.win.framework.common.pojo.CommonResult; import com.win.framework.common.pojo.PageResult; +import com.win.framework.dict.core.util.DictFrameworkUtils; import com.win.framework.excel.core.util.ExcelUtils; import com.win.framework.operatelog.core.annotations.OperateLog; +import com.win.module.wms.controller.containerBind.vo.ContainerBindRecordMainExcelVO; import com.win.module.wms.controller.containerUnbind.vo.*; import com.win.module.wms.convert.containerUnbind.ContainerUnbindRecordMainConvert; import com.win.module.wms.dal.dataobject.containerUnbind.ContainerUnbindRecordMainDO; +import com.win.module.wms.enums.DictTypeConstants; import com.win.module.wms.service.containerUnbind.ContainerUnbindRecordMainService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -93,10 +96,16 @@ public class ContainerUnbindRecordMainController { @OperateLog(type = EXPORT) public void exportContainerUnbindRecordMainExcel(@Valid ContainerUnbindRecordMainExportReqVO exportReqVO, HttpServletResponse response) throws IOException { - List list = containerUnbindRecordMainService.getContainerUnbindRecordMainList(exportReqVO); + Map mapDropDown = new HashMap<>(); + String[] componentContainerContentType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.CONTAINER_CONTENT_TYPE); + mapDropDown.put(3, componentContainerContentType); + String[] componentInventoryStatus = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.INVENTORY_STATUS); + mapDropDown.put(7, componentInventoryStatus); + String[] componentUom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); + mapDropDown.put(8, componentUom); + List list = containerUnbindRecordMainService.getContainerUnbindRecordMainList(exportReqVO); // 导出 Excel - List datas = ContainerUnbindRecordMainConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "器具解绑记录主.xls", "数据", ContainerUnbindRecordMainExcelVO.class, datas); + ExcelUtils.write(response, "器具解绑记录主.xls", "数据", ContainerUnbindRecordMainExcelVO.class, list,mapDropDown); } @GetMapping("/get-import-template") diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerUnbind/vo/ContainerUnbindRecordMainExcelVO.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerUnbind/vo/ContainerUnbindRecordMainExcelVO.java index f4dec678..370d0a01 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerUnbind/vo/ContainerUnbindRecordMainExcelVO.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/controller/containerUnbind/vo/ContainerUnbindRecordMainExcelVO.java @@ -1,8 +1,12 @@ package com.win.module.wms.controller.containerUnbind.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; /** @@ -13,8 +17,6 @@ import java.time.LocalDateTime; @Data public class ContainerUnbindRecordMainExcelVO { - @ExcelProperty("id") - private Long id; @ExcelProperty("单据号") private String number; @@ -22,70 +24,37 @@ public class ContainerUnbindRecordMainExcelVO { @ExcelProperty("器具号") private String containerNumber; - @ExcelProperty("从仓库代码") + @ExcelProperty("仓库代码") private String fromWarehouseCode; - @ExcelProperty("到仓库代码") - private String toWarehouseCode; + @ExcelProperty(value = "内容物类型",converter = DictConvert.class) + @DictFormat(DictTypeConstants.CONTAINER_CONTENT_TYPE) + private String containerContentType; - @ExcelProperty("出库事务类型") - private String outTransactionType; + @ExcelProperty("内容物号") + private String contentNumber; - @ExcelProperty("入库事务类型") - private String inTransactionType; + @ExcelProperty("物料代码") + private String itemCode; - @ExcelProperty("执行时间") - private LocalDateTime executeTime; + @ExcelProperty("批次") + private String batch; - @ExcelProperty("生效日期") - private LocalDateTime activeDate; + @ExcelProperty(value = "库存状态",converter = DictConvert.class) + @DictFormat(DictTypeConstants.INVENTORY_STATUS) + private String inventoryStatus; - @ExcelProperty("是否可用") - private String available; + @ExcelProperty(value = "计量单位",converter = DictConvert.class) + @DictFormat(DictTypeConstants.UOM) + private String uom; - @ExcelProperty("申请时间") - private LocalDateTime requestTime; - - @ExcelProperty("截止时间") - private LocalDateTime dueTime; - - @ExcelProperty("部门") - private String departmentCode; - - @ExcelProperty("用户组") - private String userGroupCode; - - @ExcelProperty("接口类型") - private String interfaceType; - - @ExcelProperty("业务类型") - private String businessType; - - @ExcelProperty("备注") - private String remark; + @ExcelProperty("数量") + private BigDecimal qty; @ExcelProperty("创建时间") private LocalDateTime createTime; - @ExcelProperty("扩展属性") - private String extraProperties; - - @ExcelProperty("地点ID") - private String siteId; - - @ExcelProperty("代码") - private String code; - - @ExcelProperty("从库位类型范围") - private String fromLocationTypes; - - @ExcelProperty("到库位类型范围") - private String toLocationTypes; - - @ExcelProperty("从库区代码范围") - private String fromAreaCodes; - - @ExcelProperty("到库区代码范围") - private String toAreaCodes; + @ExcelProperty("备注") + private String remark; } diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/containerUnbind/ContainerUnbindRecordMainService.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/containerUnbind/ContainerUnbindRecordMainService.java index 86100245..f3da1332 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/containerUnbind/ContainerUnbindRecordMainService.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/containerUnbind/ContainerUnbindRecordMainService.java @@ -1,6 +1,7 @@ package com.win.module.wms.service.containerUnbind; import com.win.framework.common.pojo.PageResult; +import com.win.module.wms.controller.containerBind.vo.ContainerBindRecordMainExcelVO; import com.win.module.wms.controller.containerUnbind.vo.*; import com.win.module.wms.dal.dataobject.containerUnbind.ContainerUnbindRecordMainDO; @@ -67,7 +68,7 @@ public interface ContainerUnbindRecordMainService { * @param exportReqVO 查询条件 * @return 器具解绑记录主列表 */ - List getContainerUnbindRecordMainList(ContainerUnbindRecordMainExportReqVO exportReqVO); + List getContainerUnbindRecordMainList(ContainerUnbindRecordMainExportReqVO exportReqVO); /** * 导入器具解绑记录主主信息 diff --git a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/containerUnbind/ContainerUnbindRecordMainServiceImpl.java b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/containerUnbind/ContainerUnbindRecordMainServiceImpl.java index 5737f393..2f38a7e8 100644 --- a/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/containerUnbind/ContainerUnbindRecordMainServiceImpl.java +++ b/win-module-wms/win-module-wms-biz/src/main/java/com/win/module/wms/service/containerUnbind/ContainerUnbindRecordMainServiceImpl.java @@ -2,10 +2,21 @@ package com.win.module.wms.service.containerUnbind; import cn.hutool.core.collection.CollUtil; import com.win.framework.common.pojo.PageResult; +import com.win.module.wms.controller.containerBind.vo.ContainerBindRecordDetailExportReqVO; +import com.win.module.wms.controller.containerBind.vo.ContainerBindRecordMainExcelVO; import com.win.module.wms.controller.containerUnbind.vo.*; +import com.win.module.wms.controller.containerinit.vo.ContainerInitRecordDetailExportReqVO; +import com.win.module.wms.controller.containerinit.vo.ContainerInitRecordMainExcelVO; import com.win.module.wms.convert.containerUnbind.ContainerUnbindRecordMainConvert; +import com.win.module.wms.dal.dataobject.containerBind.ContainerBindRecordDetailDO; +import com.win.module.wms.dal.dataobject.containerBind.ContainerBindRecordMainDO; +import com.win.module.wms.dal.dataobject.containerUnbind.ContainerUnbindRecordDetailDO; import com.win.module.wms.dal.dataobject.containerUnbind.ContainerUnbindRecordMainDO; +import com.win.module.wms.dal.dataobject.containerinit.ContainerInitRecordDetailDO; +import com.win.module.wms.dal.dataobject.containerinit.ContainerInitRecordMainDO; +import com.win.module.wms.dal.mysql.containerUnbind.ContainerUnbindRecordDetailMapper; import com.win.module.wms.dal.mysql.containerUnbind.ContainerUnbindRecordMainMapper; +import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; @@ -13,6 +24,8 @@ import javax.annotation.Resource; import java.util.ArrayList; import java.util.Collection; import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.win.module.wms.enums.ErrorCodeConstants.CONTAINER_UNBIND_RECORD_MAIN_IMPORT_LIST_IS_EMPTY; @@ -29,6 +42,8 @@ public class ContainerUnbindRecordMainServiceImpl implements ContainerUnbindReco @Resource private ContainerUnbindRecordMainMapper containerUnbindRecordMainMapper; + @Resource + private ContainerUnbindRecordDetailMapper containerUnbindRecordDetailMapper; @Override public Long createContainerUnbindRecordMain(ContainerUnbindRecordMainCreateReqVO createReqVO) { @@ -78,8 +93,28 @@ public class ContainerUnbindRecordMainServiceImpl implements ContainerUnbindReco } @Override - public List getContainerUnbindRecordMainList(ContainerUnbindRecordMainExportReqVO exportReqVO) { - return containerUnbindRecordMainMapper.selectList(exportReqVO); + public List getContainerUnbindRecordMainList(ContainerUnbindRecordMainExportReqVO exportReqVO) { + List excelVOList = new ArrayList<>(); + List mainDOList = containerUnbindRecordMainMapper.selectList(exportReqVO); + if(mainDOList != null && mainDOList.size() > 0){ + ContainerUnbindRecordDetailExportReqVO reqVO = new ContainerUnbindRecordDetailExportReqVO(); + BeanUtils.copyProperties(exportReqVO,reqVO); + List detailDOList = containerUnbindRecordDetailMapper.selectList(reqVO); + Map> groupMasterIdMap = detailDOList.stream().collect(Collectors.groupingBy(ContainerUnbindRecordDetailDO::getMasterId)); + for(ContainerUnbindRecordMainDO mainDO:mainDOList){ + Long id = mainDO.getId(); + List detailChildList = groupMasterIdMap.get(id); + if(detailChildList != null && detailChildList.size() > 0){ + for(ContainerUnbindRecordDetailDO detailDO:detailChildList){ + ContainerUnbindRecordMainExcelVO containerUnbindRecordMainExcelVO = new ContainerUnbindRecordMainExcelVO(); + BeanUtils.copyProperties(mainDO,containerUnbindRecordMainExcelVO); + BeanUtils.copyProperties(detailDO,containerUnbindRecordMainExcelVO); + excelVOList.add(containerUnbindRecordMainExcelVO); + } + } + } + } + return excelVOList; } @Override