|
@ -9,10 +9,13 @@ 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.bom.vo.*; |
|
|
import com.win.module.wms.controller.bom.vo.*; |
|
|
|
|
|
import com.win.module.wms.controller.itembasic.vo.ItembasicExcelVO; |
|
|
import com.win.module.wms.controller.itempackaging.vo.ItempackagingRespVO; |
|
|
import com.win.module.wms.controller.itempackaging.vo.ItempackagingRespVO; |
|
|
import com.win.module.wms.convert.bom.BomConvert; |
|
|
import com.win.module.wms.convert.bom.BomConvert; |
|
|
|
|
|
import com.win.module.wms.convert.itembasic.ItembasicConvert; |
|
|
import com.win.module.wms.convert.itempackaging.ItempackagingConvert; |
|
|
import com.win.module.wms.convert.itempackaging.ItempackagingConvert; |
|
|
import com.win.module.wms.dal.dataobject.bom.BomDO; |
|
|
import com.win.module.wms.dal.dataobject.bom.BomDO; |
|
|
|
|
|
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO; |
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
import com.win.module.wms.enums.DictTypeConstants; |
|
|
import com.win.module.wms.service.bom.BomService; |
|
|
import com.win.module.wms.service.bom.BomService; |
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
|
import io.swagger.v3.oas.annotations.Operation; |
|
@ -80,14 +83,6 @@ public class BomController { |
|
|
return success(BomConvert.INSTANCE.convert(bom)); |
|
|
return success(BomConvert.INSTANCE.convert(bom)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@GetMapping("/list") |
|
|
|
|
|
@Operation(summary = "获得物料清单列表") |
|
|
|
|
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") |
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('wms:bom:query')") |
|
|
|
|
|
public CommonResult<List<BomRespVO>> getBomList(@RequestParam("ids") Collection<Long> ids) { |
|
|
|
|
|
List<BomDO> list = bomService.getBomList(ids); |
|
|
|
|
|
return success(BomConvert.INSTANCE.convertList(list)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/page") |
|
|
@GetMapping("/page") |
|
|
@Operation(summary = "获得物料清单分页") |
|
|
@Operation(summary = "获得物料清单分页") |
|
@ -125,21 +120,34 @@ public class BomController { |
|
|
public void exportBomExcel(@Valid BomExportReqVO exportReqVO, |
|
|
public void exportBomExcel(@Valid BomExportReqVO exportReqVO, |
|
|
HttpServletResponse response) throws IOException { |
|
|
HttpServletResponse response) throws IOException { |
|
|
List<BomDO> list = bomService.getBomList(exportReqVO); |
|
|
List<BomDO> list = bomService.getBomList(exportReqVO); |
|
|
// 导出 Excel
|
|
|
|
|
|
List<BomExcelVO> datas = BomConvert.INSTANCE.convertList02(list); |
|
|
|
|
|
for(BomExcelVO vo : datas) { |
|
|
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
|
|
} |
|
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
|
|
List<BomExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
|
|
ExcelUtils.write(response, "物品基本信息.xlsx", "数据", BomExcelVO.class, resultList, mapDropDown); |
|
|
|
|
|
} |
|
|
|
|
|
@PostMapping("/export-excel-senior") |
|
|
|
|
|
@Operation(summary = "导出物料清单 Excel") |
|
|
|
|
|
@PreAuthorize("@ss.hasPermission('wms:bom:export')") |
|
|
|
|
|
@OperateLog(type = EXPORT) |
|
|
|
|
|
public void exportBomExcel(@Valid @RequestBody CustomConditions conditions, HttpServletResponse response) throws IOException { |
|
|
|
|
|
List<BomDO> list = bomService.getBomList(conditions); |
|
|
|
|
|
Map<Integer, String[]> mapDropDown = new HashMap<>(); |
|
|
|
|
|
List<BomExcelVO> resultList = this.getExcelVo(list, mapDropDown); |
|
|
|
|
|
ExcelUtils.write(response, "物料清单.xlsx", "数据", BomExcelVO.class, resultList, mapDropDown); |
|
|
|
|
|
} |
|
|
|
|
|
private List<BomExcelVO> getExcelVo(List<BomDO> list, Map<Integer, String[]> mapDropDown) { |
|
|
String[] componentUom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
String[] componentUom = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.UOM); |
|
|
mapDropDown.put(2, componentUom); |
|
|
mapDropDown.put(2, componentUom); |
|
|
String[] available = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
String[] available = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.TRUE_FALSE); |
|
|
mapDropDown.put(7, available); |
|
|
mapDropDown.put(7, available); |
|
|
ExcelUtils.write(response, "物料清单.xls", "数据", BomExcelVO.class, datas,mapDropDown); |
|
|
// 导出 Excel
|
|
|
|
|
|
List<BomExcelVO> resultList = BomConvert.INSTANCE.convertList02(list); |
|
|
|
|
|
for(BomExcelVO vo : resultList) { |
|
|
|
|
|
AdminUserRespDTO user = userApi.getUser(Long.valueOf(vo.getCreator())); |
|
|
|
|
|
//后端创建个字段作为前端展示的虚拟字段
|
|
|
|
|
|
vo.setCreator(user.getNickname()); |
|
|
|
|
|
} |
|
|
|
|
|
return resultList; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@GetMapping("/get-import-template") |
|
|
@GetMapping("/get-import-template") |
|
|
@Operation(summary = "获得导入物料清单模板") |
|
|
@Operation(summary = "获得导入物料清单模板") |
|
|
public void importTemplate(HttpServletResponse response) throws IOException { |
|
|
public void importTemplate(HttpServletResponse response) throws IOException { |
|
|