|
@ -8,13 +8,9 @@ import com.win.framework.excel.core.util.ExcelUtils; |
|
|
import com.win.framework.operatelog.core.annotations.OperateLog; |
|
|
import com.win.framework.operatelog.core.annotations.OperateLog; |
|
|
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.areabasic.vo.AreabasicRespVO; |
|
|
import com.win.module.wms.controller.bom.vo.BomImportErrorVO; |
|
|
import com.win.module.wms.controller.itembasic.vo.ItembasicExcelVO; |
|
|
|
|
|
import com.win.module.wms.controller.locationgroup.vo.*; |
|
|
import com.win.module.wms.controller.locationgroup.vo.*; |
|
|
import com.win.module.wms.convert.areabasic.AreabasicConvert; |
|
|
|
|
|
import com.win.module.wms.convert.itembasic.ItembasicConvert; |
|
|
|
|
|
import com.win.module.wms.convert.locationgroup.LocationgroupConvert; |
|
|
import com.win.module.wms.convert.locationgroup.LocationgroupConvert; |
|
|
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.locationgroup.LocationgroupDO; |
|
|
import com.win.module.wms.dal.dataobject.locationgroup.LocationgroupDO; |
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
import com.win.module.wms.service.locationgroup.LocationgroupService; |
|
|
import com.win.module.wms.service.locationgroup.LocationgroupService; |
|
@ -139,11 +135,7 @@ public class LocationgroupController { |
|
|
ExcelUtils.write(response, "库位组.xlsx", "数据", LocationgroupExcelVO.class, resultList, mapDropDown); |
|
|
ExcelUtils.write(response, "库位组.xlsx", "数据", LocationgroupExcelVO.class, resultList, mapDropDown); |
|
|
} |
|
|
} |
|
|
private List<LocationgroupExcelVO> getExcelVo(List<LocationgroupDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
private List<LocationgroupExcelVO> getExcelVo(List<LocationgroupDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
String[] warehouseCode = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.WAREHOUSE_TYPE); |
|
|
String[] available = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
mapDropDown.put(3, warehouseCode); |
|
|
|
|
|
String[] areaCode = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.AREA_TYPE); |
|
|
|
|
|
mapDropDown.put(4, areaCode); |
|
|
|
|
|
String[] available = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.PACK_UNIT); |
|
|
|
|
|
mapDropDown.put(5, available);; |
|
|
mapDropDown.put(5, available);; |
|
|
// 导出 Excel
|
|
|
// 导出 Excel
|
|
|
List<LocationgroupExcelVO> resultList = LocationgroupConvert.INSTANCE.convertList02(list); |
|
|
List<LocationgroupExcelVO> resultList = LocationgroupConvert.INSTANCE.convertList02(list); |
|
@ -161,11 +153,7 @@ public class LocationgroupController { |
|
|
// 手动创建导出 demo
|
|
|
// 手动创建导出 demo
|
|
|
List<LocationGroupImportExcelVO> list = Arrays.asList(); |
|
|
List<LocationGroupImportExcelVO> list = Arrays.asList(); |
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
String[] warehouseCode = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.WAREHOUSE_TYPE); |
|
|
String[] available = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
mapDropDown.put(3, warehouseCode); |
|
|
|
|
|
String[] areaCode = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.AREA_TYPE); |
|
|
|
|
|
mapDropDown.put(4, areaCode); |
|
|
|
|
|
String[] available = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.PACK_UNIT); |
|
|
|
|
|
mapDropDown.put(5, available);; |
|
|
mapDropDown.put(5, available);; |
|
|
// 输出
|
|
|
// 输出
|
|
|
ExcelUtils.write(response, "库位组导入模板.xls", "库位组列表", LocationGroupImportExcelVO.class, list,mapDropDown); |
|
|
ExcelUtils.write(response, "库位组导入模板.xls", "库位组列表", LocationGroupImportExcelVO.class, list,mapDropDown); |
|
@ -179,17 +167,18 @@ public class LocationgroupController { |
|
|
@Parameter(name = "updatePart", description = "部分更新,默认为 true", example = "true") |
|
|
@Parameter(name = "updatePart", description = "部分更新,默认为 true", example = "true") |
|
|
}) |
|
|
}) |
|
|
@PreAuthorize("@ss.hasPermission('wms:location:import')") |
|
|
@PreAuthorize("@ss.hasPermission('wms:location:import')") |
|
|
public void importExcel(HttpServletResponse response, |
|
|
public CommonResult<Map<String, Object>> importExcel(HttpServletResponse response, |
|
|
@RequestParam("file") MultipartFile file, |
|
|
@RequestParam("file") MultipartFile file, |
|
|
@RequestParam(value = "mode") Integer mode, |
|
|
@RequestParam(value = "mode") Integer mode, |
|
|
@RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception { |
|
|
@RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception { |
|
|
List<LocationGroupImportExcelVO> list = ExcelUtils.read(file, LocationGroupImportExcelVO.class); |
|
|
List<LocationGroupImportExcelVO> list = ExcelUtils.read(file, LocationGroupImportExcelVO.class); |
|
|
List<LocationGroupImportExcelVO> errorList = locationgroupService.importLocationGroupList(list, mode, updatePart); |
|
|
List<LocationGroupImportErrorVO> errorList = locationgroupService.importLocationGroupList(list, mode, updatePart); |
|
|
Map<String, Object> returnMap = new HashMap<>(); |
|
|
Map<String, Object> returnMap = new HashMap<>(); |
|
|
returnMap.put("errorCount", errorList.size()); |
|
|
returnMap.put("errorCount", errorList.size()); |
|
|
if(!errorList.isEmpty()) { |
|
|
if(!errorList.isEmpty()) { |
|
|
String url = ExcelUtils.writeLocalFile("库位导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xls", "错误列表", errorList); |
|
|
String url = ExcelUtils.writeLocalFile("库位导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xls", "错误列表", errorList); |
|
|
returnMap.put("errorFile", url); |
|
|
returnMap.put("errorFile", url); |
|
|
} |
|
|
} |
|
|
|
|
|
return success(returnMap); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|