|
|
@ -3,13 +3,17 @@ package com.win.module.wms.controller.productputawayRecord; |
|
|
|
import com.win.framework.common.pojo.CommonResult; |
|
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
|
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.system.api.user.AdminUserApi; |
|
|
|
import com.win.module.system.api.user.dto.AdminUserRespDTO; |
|
|
|
import com.win.module.wms.controller.productputawayRecord.vo.*; |
|
|
|
import com.win.module.wms.convert.productputawayRecord.ProductputawayRecordMainConvert; |
|
|
|
import com.win.module.wms.dal.dataobject.productputawayRecord.ProductputawayRecordDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.productputawayRecord.ProductputawayRecordMainDO; |
|
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
|
import com.win.module.wms.service.productputawayRecord.ProductputawayRecordDetailService; |
|
|
|
import com.win.module.wms.service.productputawayRecord.ProductputawayRecordMainService; |
|
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
|
import io.swagger.v3.oas.annotations.Parameter; |
|
|
@ -22,8 +26,7 @@ import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
import javax.validation.Valid; |
|
|
|
import java.io.IOException; |
|
|
|
import java.util.Collection; |
|
|
|
import java.util.List; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import static com.win.framework.common.pojo.CommonResult.success; |
|
|
|
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
|
|
@ -34,6 +37,8 @@ import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
|
|
|
@Validated |
|
|
|
public class ProductputawayRecordMainController { |
|
|
|
|
|
|
|
@Resource |
|
|
|
private ProductputawayRecordDetailService productputawayRecordDetailService; |
|
|
|
@Resource |
|
|
|
private ProductputawayRecordMainService productputawayRecordMainService; |
|
|
|
|
|
|
@ -90,23 +95,6 @@ public class ProductputawayRecordMainController { |
|
|
|
return success(ProductputawayRecordMainConvert.INSTANCE.convertPage(pageResult)); |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/export-excel") |
|
|
|
@Operation(summary = "导出制品上架记录主 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:productputaway-record-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportProductputawayRecordMainExcel(@Valid ProductputawayRecordMainExportReqVO exportReqVO, |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
List<ProductputawayRecordMainDO> list = productputawayRecordMainService.getProductputawayRecordMainList(exportReqVO); |
|
|
|
// 导出 Excel
|
|
|
|
List<ProductputawayRecordMainExcelVO> datas = ProductputawayRecordMainConvert.INSTANCE.convertList02(list); |
|
|
|
for(ProductputawayRecordMainExcelVO vo : datas) { |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
} |
|
|
|
ExcelUtils.write(response, "制品上架记录主.xls", "数据", ProductputawayRecordMainExcelVO.class, datas); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/senior") |
|
|
|
@Operation(summary = "高级搜索获得制品上架记录主分页") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:productputaway-record-main:query')") |
|
|
@ -121,4 +109,57 @@ public class ProductputawayRecordMainController { |
|
|
|
return success(result); |
|
|
|
} |
|
|
|
|
|
|
|
private List<ProductputawayRecordMainExcelVO> getExcelVo(List<ProductputawayRecordMainDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
|
|
|
|
|
String[] locationType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.LOCATION_TYPE); |
|
|
|
mapDropDown.put(17, locationType); |
|
|
|
mapDropDown.put(20, locationType); |
|
|
|
String[] useOnTheWayLocation = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
|
mapDropDown.put(23, useOnTheWayLocation); |
|
|
|
String[] inventoryStatus = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.INVENTORY_STATUS); |
|
|
|
mapDropDown.put(32, inventoryStatus); |
|
|
|
String[] uom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
|
mapDropDown.put(49, uom); |
|
|
|
List<ProductputawayRecordMainExcelVO> resultList = new ArrayList<>(); |
|
|
|
// 导出
|
|
|
|
for(ProductputawayRecordMainDO mainDO : list) { |
|
|
|
List<ProductputawayRecordDetailDO> subList = productputawayRecordDetailService.selectList(mainDO.getId()); |
|
|
|
for(ProductputawayRecordDetailDO detailDO : subList) { |
|
|
|
ProductputawayRecordMainExcelVO vo = ProductputawayRecordMainConvert.INSTANCE.convert(mainDO, detailDO); |
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(mainDO.getCreator())); |
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
vo.setUpdater(user.getNickname()); |
|
|
|
resultList.add(vo); |
|
|
|
} |
|
|
|
} |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
|
|
|
|
@GetMapping("/export-excel") |
|
|
|
@Operation(summary = "导出制品上架记录 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:productputaway-record-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportProductputawayRecordMainExcel(@Valid ProductputawayRecordMainExportReqVO exportReqVO, |
|
|
|
HttpServletResponse response) throws IOException { |
|
|
|
List<ProductputawayRecordMainDO> list = productputawayRecordMainService.getProductputawayRecordMainList(exportReqVO); |
|
|
|
//组装vo
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<ProductputawayRecordMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
// 导出 Excel
|
|
|
|
ExcelUtils.write(response, "制品上架记录.xlsx", "制品上架记录", ProductputawayRecordMainExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
@PostMapping("/export-excel-senior") |
|
|
|
@Operation(summary = "导出制品上架记录 Excel") |
|
|
|
@PreAuthorize("@ss.hasPermission('wms:productputaway-record-main:export')") |
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
public void exportProductputawayRecordMainSeniorExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException { |
|
|
|
List<ProductputawayRecordMainDO> list = productputawayRecordMainService.getProductputawayRecordMainList(conditions); |
|
|
|
//组装vo
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
List<ProductputawayRecordMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
// 导出 Excel
|
|
|
|
ExcelUtils.write(response, "制品上架记录.xlsx", "制品上架记录", ProductputawayRecordMainExcelVO.class, resultList, mapDropDown); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|