|
@ -1,8 +1,17 @@ |
|
|
package com.win.module.wms.controller.inventoryinitRecord; |
|
|
package com.win.module.wms.controller.inventoryinitRecord; |
|
|
|
|
|
|
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
|
|
|
import com.win.framework.dict.core.util.DictFrameworkUtils; |
|
|
import com.win.module.system.api.user.AdminUserApi; |
|
|
import com.win.module.system.api.user.AdminUserApi; |
|
|
import com.win.module.system.api.user.dto.AdminUserRespDTO; |
|
|
import com.win.module.system.api.user.dto.AdminUserRespDTO; |
|
|
|
|
|
import com.win.module.wms.controller.purchasereceiptRequest.vo.PurchasereceiptRequestMainExcelVO; |
|
|
|
|
|
import com.win.module.wms.convert.purchasereceiptRequest.PurchasereceiptRequestMainConvert; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.inventoryinitRecord.InventoryinitRecordDetailDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.inventoryinitRequest.InventoryinitRequestDetailDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.purchasereceiptRequest.PurchasereceiptRequestDetailDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.purchasereceiptRequest.PurchasereceiptRequestMainDO; |
|
|
|
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
|
|
|
import com.win.module.wms.service.inventoryinitRecord.InventoryinitRecordDetailService; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import org.springframework.validation.annotation.Validated; |
|
|
import org.springframework.validation.annotation.Validated; |
|
@ -39,6 +48,8 @@ public class InventoryinitRecordMainController { |
|
|
@Resource |
|
|
@Resource |
|
|
private InventoryinitRecordMainService inventoryinitRecordMainService; |
|
|
private InventoryinitRecordMainService inventoryinitRecordMainService; |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
private InventoryinitRecordDetailService inventoryinitRecordDetailService; |
|
|
@Resource |
|
|
@Resource |
|
|
private AdminUserApi userApi; |
|
|
private AdminUserApi userApi; |
|
|
|
|
|
|
|
@ -108,17 +119,65 @@ public class InventoryinitRecordMainController { |
|
|
@Operation(summary = "导出库存初始化记录主 Excel") |
|
|
@Operation(summary = "导出库存初始化记录主 Excel") |
|
|
@PreAuthorize("@ss.hasPermission('wms:inventoryinit-record-main:export')") |
|
|
@PreAuthorize("@ss.hasPermission('wms:inventoryinit-record-main:export')") |
|
|
@OperateLog(type = EXPORT) |
|
|
@OperateLog(type = EXPORT) |
|
|
public void exportInventoryinitRecordMainExcel(@Valid InventoryinitRecordMainExportReqVO exportReqVO, |
|
|
public void exportInventoryinitRecordMainExcel(@Valid InventoryinitRecordMainExportReqVO exportReqVO, HttpServletResponse response) throws IOException { |
|
|
HttpServletResponse response) throws IOException { |
|
|
|
|
|
List<InventoryinitRecordMainDO> list = inventoryinitRecordMainService.getInventoryinitRecordMainList(exportReqVO); |
|
|
List<InventoryinitRecordMainDO> list = inventoryinitRecordMainService.getInventoryinitRecordMainList(exportReqVO); |
|
|
// 导出 Excel
|
|
|
// 导出 Excel
|
|
|
List<InventoryinitRecordMainExcelVO> datas = InventoryinitRecordMainConvert.INSTANCE.convertList02(list); |
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
for(InventoryinitRecordMainExcelVO vo : datas) { |
|
|
List<InventoryinitRecordMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
// 导出 Excel
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
ExcelUtils.write(response, "库存初始化记录主.xls", "数据", InventoryinitRecordMainExcelVO.class, resultList, mapDropDown); |
|
|
vo.setCreator(user.getNickname()); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private List<InventoryinitRecordMainExcelVO> getExcelVo(List<InventoryinitRecordMainDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
|
|
|
String[] outTransactionType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.LOCATION_TYPE); |
|
|
|
|
|
mapDropDown.put(3, outTransactionType); |
|
|
|
|
|
String[] inTransactionType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.LOCATION_TYPE); |
|
|
|
|
|
mapDropDown.put(4, inTransactionType); |
|
|
|
|
|
String[] interfaceType = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.INTERFACE_TYPE); |
|
|
|
|
|
mapDropDown.put(10, interfaceType); |
|
|
|
|
|
String[] available = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
|
|
|
mapDropDown.put(16, available); |
|
|
|
|
|
String[] inventoryStatus = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.INVENTORY_STATUS); |
|
|
|
|
|
mapDropDown.put(25, inventoryStatus); |
|
|
|
|
|
String[] stdPackUnit = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
|
|
|
mapDropDown.put(30, stdPackUnit); |
|
|
|
|
|
String[] uom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
|
|
|
mapDropDown.put(38, uom); |
|
|
|
|
|
List<InventoryinitRecordMainExcelVO> resultList = new ArrayList<>(); |
|
|
|
|
|
// 导出
|
|
|
|
|
|
for(InventoryinitRecordMainDO mainDO : list) { |
|
|
|
|
|
List<InventoryinitRecordDetailDO> subList = inventoryinitRecordDetailService.selectList(mainDO.getId()); |
|
|
|
|
|
for(InventoryinitRecordDetailDO detailDO : subList) { |
|
|
|
|
|
InventoryinitRecordMainExcelVO vo = InventoryinitRecordMainConvert.INSTANCE.convert(mainDO, detailDO); |
|
|
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(mainDO.getCreator())); |
|
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
|
|
resultList.add(vo); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
ExcelUtils.write(response, "库存初始化记录主.xls", "数据", InventoryinitRecordMainExcelVO.class, datas); |
|
|
return resultList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping("/export-excel-senior") |
|
|
|
|
|
@Operation(summary = "导出采购收货申请主 Excel") |
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('wms:inventoryinit-request-main:export')") |
|
|
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
|
|
public void exportInventoryinitRequestMainSeniorExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException { |
|
|
|
|
|
List<InventoryinitRecordMainDO> list = inventoryinitRecordMainService.getInventoryinitRecordSeniorMainList(conditions); |
|
|
|
|
|
//组装vo
|
|
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
|
|
List<InventoryinitRecordMainExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
|
|
// 导出 Excel
|
|
|
|
|
|
ExcelUtils.write(response, "采购收货申请主.xlsx", "采购收货申请数据", InventoryinitRecordMainExcelVO.class, resultList, mapDropDown); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|