新增库位绑定
This commit is contained in:
@@ -65,7 +65,7 @@ public class ErpExternalApiImpl implements ErpExternalApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommonResult<ErpWarehouseDTO> getErpWarehouse(Long id) {
|
public CommonResult<ErpWarehouseDTO> getErpWarehouse(Long id) {
|
||||||
ErpWarehouseDO erpWarehouse = erpWarehouseService.getErpWarehouse(id);
|
ErpWarehouseDO erpWarehouse = erpWarehouseService.getErpWarehouse(id.toString());
|
||||||
return success(BeanUtils.toBean(erpWarehouse, ErpWarehouseDTO.class));
|
return success(BeanUtils.toBean(erpWarehouse, ErpWarehouseDTO.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,16 +76,16 @@ public class ErpWarehouseController {
|
|||||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
@PreAuthorize("@ss.hasPermission('sply:erp-warehouse:query')")
|
@PreAuthorize("@ss.hasPermission('sply:erp-warehouse:query')")
|
||||||
public CommonResult<ErpWarehouseRespVO> getErpWarehouse(@RequestParam("id") Long id) {
|
public CommonResult<ErpWarehouseRespVO> getErpWarehouse(@RequestParam("id") Long id) {
|
||||||
ErpWarehouseDO erpWarehouse = erpWarehouseService.getErpWarehouse(id);
|
ErpWarehouseRespVO erpWarehouse = erpWarehouseService.getErpWarehouse(id);
|
||||||
return success(BeanUtils.toBean(erpWarehouse, ErpWarehouseRespVO.class));
|
return success(erpWarehouse);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得ERP库位分页")
|
@Operation(summary = "获得ERP库位分页")
|
||||||
@PreAuthorize("@ss.hasPermission('sply:erp-warehouse:query')")
|
@PreAuthorize("@ss.hasPermission('sply:erp-warehouse:query')")
|
||||||
public CommonResult<PageResult<ErpWarehouseRespVO>> getErpWarehousePage(@Valid ErpWarehousePageReqVO pageReqVO) {
|
public CommonResult<PageResult<ErpWarehouseRespVO>> getErpWarehousePage(@Valid ErpWarehousePageReqVO pageReqVO) {
|
||||||
PageResult<ErpWarehouseDO> pageResult = erpWarehouseService.getErpWarehousePage(pageReqVO);
|
PageResult<ErpWarehouseRespVO> pageResult = erpWarehouseService.getErpWarehousePage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, ErpWarehouseRespVO.class));
|
return success(pageResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@@ -95,7 +95,7 @@ public class ErpWarehouseController {
|
|||||||
public void exportErpWarehouseExcel(@Valid ErpWarehousePageReqVO pageReqVO,
|
public void exportErpWarehouseExcel(@Valid ErpWarehousePageReqVO pageReqVO,
|
||||||
HttpServletResponse response) throws IOException {
|
HttpServletResponse response) throws IOException {
|
||||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
List<ErpWarehouseDO> list = erpWarehouseService.getErpWarehousePage(pageReqVO).getList();
|
List<ErpWarehouseDO> list = BeanUtils.toBean(erpWarehouseService.getErpWarehousePage(pageReqVO).getList(), ErpWarehouseDO.class);
|
||||||
// 导出 Excel
|
// 导出 Excel
|
||||||
ExcelUtils.write(response, "ERP库位.xls", "数据", ErpWarehouseRespVO.class,
|
ExcelUtils.write(response, "ERP库位.xls", "数据", ErpWarehouseRespVO.class,
|
||||||
BeanUtils.toBean(list, ErpWarehouseRespVO.class));
|
BeanUtils.toBean(list, ErpWarehouseRespVO.class));
|
||||||
|
|||||||
@@ -102,4 +102,11 @@ public class WarehouseFactoryController implements BusinessControllerMarker {
|
|||||||
BeanUtils.toBean(list, WarehouseFactoryRespVO.class));
|
BeanUtils.toBean(list, WarehouseFactoryRespVO.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//通过主库位Id查询库位
|
||||||
|
@GetMapping("/warehouse-factory-list-mainId")
|
||||||
|
@Operation(summary = "通过主库位Id查询库位")
|
||||||
|
public CommonResult<List<WarehouseFactoryRespVO>> getWarehouseFactoryListByMainId(@RequestParam("mainId") String mainId) {
|
||||||
|
return success(warehouseFactoryService.getWarehouseFactoryByMainId(mainId));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - ERP库位 Response VO")
|
@Schema(description = "管理后台 - ERP库位 Response VO")
|
||||||
@Data
|
@Data
|
||||||
@ExcelIgnoreUnannotated
|
@ExcelIgnoreUnannotated
|
||||||
@@ -47,4 +49,7 @@ public class ErpWarehouseRespVO {
|
|||||||
@Schema(description = "公司编号")
|
@Schema(description = "公司编号")
|
||||||
private String companyIdCustom;
|
private String companyIdCustom;
|
||||||
|
|
||||||
|
@Schema(description = "子物料列表")
|
||||||
|
private List<WarehouseFactoryRespVO> warehouseFactories;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -49,6 +49,9 @@ public class WarehouseFactoryPageReqVO extends PageParam {
|
|||||||
@Schema(description = "erp目标库位编码")
|
@Schema(description = "erp目标库位编码")
|
||||||
private String erpTargetWarehouseNumber;
|
private String erpTargetWarehouseNumber;
|
||||||
|
|
||||||
|
@Schema(description = "主库位ID")
|
||||||
|
private Long mainWarehouseId;
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
private LocalDateTime[] createTime;
|
private LocalDateTime[] createTime;
|
||||||
|
|||||||
@@ -67,5 +67,7 @@ public class WarehouseFactoryRespVO {
|
|||||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@ExcelProperty("创建时间")
|
@ExcelProperty("创建时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
@Schema(description = "主库位ID")
|
||||||
|
private Long mainWarehouseId;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
package com.zt.plat.module.erp.controller.admin.erp.vo;
|
package com.zt.plat.module.erp.controller.admin.erp.vo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 仓库工厂关系新增/修改 Request VO")
|
@Schema(description = "管理后台 - 仓库工厂关系新增/修改 Request VO")
|
||||||
@Data
|
@Data
|
||||||
|
@Validated
|
||||||
public class WarehouseFactorySaveReqVO {
|
public class WarehouseFactorySaveReqVO {
|
||||||
|
|
||||||
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5015")
|
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5015")
|
||||||
@@ -46,4 +50,8 @@ public class WarehouseFactorySaveReqVO {
|
|||||||
@Schema(description = "erp目标库位编码")
|
@Schema(description = "erp目标库位编码")
|
||||||
private String erpTargetWarehouseNumber;
|
private String erpTargetWarehouseNumber;
|
||||||
|
|
||||||
|
@Schema(description = "主库位ID")
|
||||||
|
@NotNull(message = "主库位ID不能为空")
|
||||||
|
private Long mainWarehouseId;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -90,4 +90,7 @@ public class WarehouseFactoryDO extends BusinessBaseDO {
|
|||||||
@TableField("ERP_TGT_WRH_NUM")
|
@TableField("ERP_TGT_WRH_NUM")
|
||||||
private String erpTargetWarehouseNumber;
|
private String erpTargetWarehouseNumber;
|
||||||
|
|
||||||
|
@TableField("MAIN_WRH_ID")
|
||||||
|
private Long mainWarehouseId;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -51,15 +51,16 @@ public interface ErpWarehouseService {
|
|||||||
* @param id 编号
|
* @param id 编号
|
||||||
* @return ERP库位
|
* @return ERP库位
|
||||||
*/
|
*/
|
||||||
ErpWarehouseDO getErpWarehouse(Long id);
|
ErpWarehouseRespVO getErpWarehouse(Long id);
|
||||||
|
|
||||||
|
ErpWarehouseDO getErpWarehouse(String id);
|
||||||
/**
|
/**
|
||||||
* 获得ERP库位分页
|
* 获得ERP库位分页
|
||||||
*
|
*
|
||||||
* @param pageReqVO 分页查询
|
* @param pageReqVO 分页查询
|
||||||
* @return ERP库位分页
|
* @return ERP库位分页
|
||||||
*/
|
*/
|
||||||
PageResult<ErpWarehouseDO> getErpWarehousePage(ErpWarehousePageReqVO pageReqVO);
|
PageResult<ErpWarehouseRespVO> getErpWarehousePage(ErpWarehousePageReqVO pageReqVO);
|
||||||
|
|
||||||
void callErpRfcInterface();
|
void callErpRfcInterface();
|
||||||
|
|
||||||
|
|||||||
@@ -46,6 +46,9 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
|||||||
@Resource
|
@Resource
|
||||||
private ErpConfig erpConfig;
|
private ErpConfig erpConfig;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WarehouseFactoryService warehouseFactoryService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ErpWarehouseRespVO createErpWarehouse(ErpWarehouseSaveReqVO createReqVO) {
|
public ErpWarehouseRespVO createErpWarehouse(ErpWarehouseSaveReqVO createReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
@@ -125,7 +128,14 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ErpWarehouseDO getErpWarehouse(Long id) {
|
public ErpWarehouseRespVO getErpWarehouse(Long id) {
|
||||||
|
ErpWarehouseRespVO erpWarehouseRespVO = BeanUtils.toBean(erpWarehouseMapper.selectById(id), ErpWarehouseRespVO.class);
|
||||||
|
setWarehouseFactoryInfo(erpWarehouseRespVO);
|
||||||
|
return erpWarehouseRespVO;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ErpWarehouseDO getErpWarehouse(String id) {
|
||||||
return erpWarehouseMapper.selectById(id);
|
return erpWarehouseMapper.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,8 +150,13 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ErpWarehouseDO> getErpWarehousePage(ErpWarehousePageReqVO pageReqVO) {
|
public PageResult<ErpWarehouseRespVO> getErpWarehousePage(ErpWarehousePageReqVO pageReqVO) {
|
||||||
return erpWarehouseMapper.selectPage(pageReqVO);
|
PageResult<ErpWarehouseRespVO> erpWarehouseRespVOPageResult = BeanUtils.toBean(erpWarehouseMapper.selectPage(pageReqVO), ErpWarehouseRespVO.class);
|
||||||
|
if (erpWarehouseRespVOPageResult.getList() == null) {
|
||||||
|
return erpWarehouseRespVOPageResult;
|
||||||
|
}
|
||||||
|
erpWarehouseRespVOPageResult.getList().forEach(this::setWarehouseFactoryInfo);
|
||||||
|
return erpWarehouseRespVOPageResult;
|
||||||
// // 获取分页数据
|
// // 获取分页数据
|
||||||
// List<ErpWarehouseDO> list = erpWarehouseMapper.getPageByReq(pageReqVO);
|
// List<ErpWarehouseDO> list = erpWarehouseMapper.getPageByReq(pageReqVO);
|
||||||
// if (list == null) {
|
// if (list == null) {
|
||||||
@@ -163,6 +178,15 @@ public class ErpWarehouseServiceImpl implements ErpWarehouseService {
|
|||||||
// return new PageResult<>(pageList, (long) total);
|
// return new PageResult<>(pageList, (long) total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 设置主物料信息
|
||||||
|
public void setWarehouseFactoryInfo(ErpWarehouseRespVO warehouse) {
|
||||||
|
if (warehouse == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
warehouse.setWarehouseFactories(warehouseFactoryService.getWarehouseFactoryByMainId(warehouse.getId().toString()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
@XxlJob("getErpWarehouseTask")
|
@XxlJob("getErpWarehouseTask")
|
||||||
|
|||||||
@@ -61,4 +61,13 @@ public interface WarehouseFactoryService {
|
|||||||
*/
|
*/
|
||||||
PageResult<WarehouseFactoryDO> getWarehouseFactoryPage(WarehouseFactoryPageReqVO pageReqVO);
|
PageResult<WarehouseFactoryDO> getWarehouseFactoryPage(WarehouseFactoryPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过主库位查询子库位
|
||||||
|
*
|
||||||
|
* @param mainId 主库位Id
|
||||||
|
* @return WarehouseFactoryRespVO
|
||||||
|
*/
|
||||||
|
List<WarehouseFactoryRespVO> getWarehouseFactoryByMainId(String mainId);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -88,4 +88,9 @@ public class WarehouseFactoryServiceImpl implements WarehouseFactoryService {
|
|||||||
return warehouseFactoryMapper.selectPage(pageReqVO);
|
return warehouseFactoryMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WarehouseFactoryRespVO> getWarehouseFactoryByMainId(String mainId) {
|
||||||
|
return BeanUtils.toBean(warehouseFactoryMapper.selectList(WarehouseFactoryDO::getMainWarehouseId, mainId), WarehouseFactoryRespVO.class);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user