|
@@ -9,8 +9,16 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotcargolocation.vo.IotCargoLocationPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotcargolocation.vo.IotCargoLocationPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotcargolocation.vo.IotCargoLocationRespVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotcargolocation.vo.IotCargoLocationRespVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotcargolocation.vo.IotCargoLocationSaveReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotcargolocation.vo.IotCargoLocationSaveReqVO;
|
|
|
|
+import cn.iocoder.yudao.module.pms.convert.cargolocation.IotCargoLocationConvert;
|
|
|
|
+import cn.iocoder.yudao.module.pms.convert.shelves.IotShelvesConvert;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotcargolocation.IotCargoLocationDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotcargolocation.IotCargoLocationDO;
|
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotshelves.IotShelvesDO;
|
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotstoragearea.IotStorageAreaDO;
|
|
import cn.iocoder.yudao.module.pms.service.iotcargolocation.IotCargoLocationService;
|
|
import cn.iocoder.yudao.module.pms.service.iotcargolocation.IotCargoLocationService;
|
|
|
|
+import cn.iocoder.yudao.module.pms.service.iotshelves.IotShelvesService;
|
|
|
|
+import cn.iocoder.yudao.module.pms.service.iotstoragearea.IotStorageAreaService;
|
|
|
|
+import cn.iocoder.yudao.module.system.api.saporg.SapOrgApi;
|
|
|
|
+import cn.iocoder.yudao.module.system.api.saporg.dto.SapOrgRespDTO;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
@@ -23,9 +31,11 @@ import javax.servlet.http.HttpServletResponse;
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
+import java.util.Map;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
|
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
|
|
|
|
|
@Tag(name = "管理后台 - PMS 货位")
|
|
@Tag(name = "管理后台 - PMS 货位")
|
|
@RestController
|
|
@RestController
|
|
@@ -35,6 +45,12 @@ public class IotCargoLocationController {
|
|
|
|
|
|
@Resource
|
|
@Resource
|
|
private IotCargoLocationService iotCargoLocationService;
|
|
private IotCargoLocationService iotCargoLocationService;
|
|
|
|
+ @Resource
|
|
|
|
+ private SapOrgApi sapOrgApi;
|
|
|
|
+ @Resource
|
|
|
|
+ private IotStorageAreaService iotStorageAreaService;
|
|
|
|
+ @Resource
|
|
|
|
+ private IotShelvesService iotShelvesService;
|
|
|
|
|
|
@PostMapping("/create")
|
|
@PostMapping("/create")
|
|
@Operation(summary = "创建PMS 货位")
|
|
@Operation(summary = "创建PMS 货位")
|
|
@@ -74,7 +90,18 @@ public class IotCargoLocationController {
|
|
@PreAuthorize("@ss.hasPermission('pms:iot-cargo-location:query')")
|
|
@PreAuthorize("@ss.hasPermission('pms:iot-cargo-location:query')")
|
|
public CommonResult<PageResult<IotCargoLocationRespVO>> getIotCargoLocationPage(@Valid IotCargoLocationPageReqVO pageReqVO) {
|
|
public CommonResult<PageResult<IotCargoLocationRespVO>> getIotCargoLocationPage(@Valid IotCargoLocationPageReqVO pageReqVO) {
|
|
PageResult<IotCargoLocationDO> pageResult = iotCargoLocationService.getIotCargoLocationPage(pageReqVO);
|
|
PageResult<IotCargoLocationDO> pageResult = iotCargoLocationService.getIotCargoLocationPage(pageReqVO);
|
|
- return success(BeanUtils.toBean(pageResult, IotCargoLocationRespVO.class));
|
|
|
|
|
|
+ // 组装 库存地点 库区 货架 信息
|
|
|
|
+ // 拼接库存地点数据
|
|
|
|
+ Map<Long, SapOrgRespDTO> storageLocationMap = sapOrgApi.getSapOrgMap(
|
|
|
|
+ convertList(pageResult.getList(), IotCargoLocationDO::getStorageLocationId));
|
|
|
|
+ // 拼接库区数据
|
|
|
|
+ Map<Long, IotStorageAreaDO> storageAreaMap = iotStorageAreaService.getStorageAreaMap(
|
|
|
|
+ convertList(pageResult.getList(), IotCargoLocationDO::getStorageAreaId));
|
|
|
|
+ // 拼接货架数据
|
|
|
|
+ Map<Long, IotShelvesDO> shelvesMap = iotShelvesService.getShelvesMap(
|
|
|
|
+ convertList(pageResult.getList(), IotCargoLocationDO::getShelvesId));
|
|
|
|
+ return success(new PageResult<>(IotCargoLocationConvert.INSTANCE.convertList(pageResult.getList(),
|
|
|
|
+ storageLocationMap, storageAreaMap, shelvesMap), pageResult.getTotal()));
|
|
}
|
|
}
|
|
|
|
|
|
@GetMapping("/export-excel")
|
|
@GetMapping("/export-excel")
|