新增库位绑定Feign接口与合并采购销售订单

This commit is contained in:
潘荣晟
2026-01-30 11:11:01 +08:00
parent de66bd6b12
commit 499da0a9b2
15 changed files with 209 additions and 26 deletions

View File

@@ -0,0 +1,29 @@
package com.zt.plat.module.erp.api;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.erp.api.dto.internalWarehouse.InternalWarehouseDTO;
import com.zt.plat.module.erp.enums.ApiConstants;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@FeignClient(name = ApiConstants.NAME)
@Tag(name = "RPC 服务 - ERP")
public interface InternalWarehouseApi {
String PREFIX = ApiConstants.PREFIX + "/internal-warehouse";
/**
* 根据工厂代码和仓库代码获取仓库列表
*
* @param factoryCode 工厂代码
* @param warehouseCode 仓库代码
* @return 仓库列表
*/
@GetMapping(PREFIX + "/list-by-factory-code-and-warehouse-code")
@Operation(summary = "根据工厂代码和仓库代码获取仓库列表", description = "根据工厂代码和仓库代码获取仓库列表;factoryCode是工厂编码,warehouseCode是仓库编码,mmsiType是业务类型,operationType是操作类型")
CommonResult<List<InternalWarehouseDTO>> getInternalWarehouseListByFactoryCodeAndWarehouseCode(@RequestParam(value = "factoryCode") String factoryCode, @RequestParam(value = "warehouseCode") String warehouseCode, @RequestParam(value = "mmsiType", required = false) String mmsiType, @RequestParam(value = "operationType", required = false) String operationType);
}

View File

@@ -0,0 +1,55 @@
package com.zt.plat.module.erp.api.dto.internalWarehouse;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "内部仓库DTO")
@Data
public class InternalWarehouseDTO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5015")
private Long id;
@Schema(description = "公司名称")
private String companyNameCustom;
@Schema(description = "公司编码")
private String companyIdCustom;
@Schema(description = "操作类型", example = "2")
private String operationType;
@Schema(description = "业务类型", example = "2")
private String mmsiType;
@Schema(description = "erp源工厂名称", example = "赵六")
private String erpSourceFactoryName;
@Schema(description = "erp源工厂编码")
private String erpSourceFactoryNumber;
@Schema(description = "erp源库位名称", example = "赵六")
private String erpSourceWarehouseName;
@Schema(description = "erp源库位编码")
private String erpSourceWarehouseNumber;
@Schema(description = "erp目标工厂名称", example = "赵六")
private String erpTargetFactoryName;
@Schema(description = "erp目标工厂编码")
private String erpTargetFactoryNumber;
@Schema(description = "erp目标库位名称", example = "ZT")
private String erpTargetWarehouseName;
@Schema(description = "erp目标库位编码")
private String erpTargetWarehouseNumber;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
@Schema(description = "主库位ID")
private Long mainWarehouseId;
}

View File

@@ -0,0 +1,39 @@
package com.zt.plat.module.erp.api;
import cn.hutool.core.bean.BeanUtil;
import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.module.erp.api.dto.internalWarehouse.InternalWarehouseDTO;
import com.zt.plat.module.erp.controller.admin.erp.internalwarehouse.vo.InternalWarehouseRespVO;
import com.zt.plat.module.erp.controller.admin.erp.vo.WarehouseFactoryRespVO;
import com.zt.plat.module.erp.dal.dataobject.erp.internalwarehouse.InternalWarehouseDO;
import com.zt.plat.module.erp.service.erp.WarehouseFactoryService;
import com.zt.plat.module.erp.service.erp.internalwarehouse.InternalWarehouseService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import static com.zt.plat.framework.common.pojo.CommonResult.success;
@RestController
@Validated
@Slf4j
public class InternalWarehouseImpl implements InternalWarehouseApi {
@Resource
private InternalWarehouseService internalWarehouseService;
@Resource
private WarehouseFactoryService warehouseFactoryService;
@Override
public CommonResult<List<InternalWarehouseDTO>>getInternalWarehouseListByFactoryCodeAndWarehouseCode(String factoryCode, String warehouseCode, String mmsiType,String operationType) {
InternalWarehouseDO internalWarehouse = internalWarehouseService.getInternalWarehouseByFactoryCodeAndWarehouseCode(factoryCode, warehouseCode);
if (internalWarehouse == null){
return success(new ArrayList<>());
}
List<WarehouseFactoryRespVO> warehouseFactoryByParams = warehouseFactoryService.getWarehouseFactoryByParams(internalWarehouse.getId(), mmsiType, operationType);
return success(BeanUtil.copyToList(warehouseFactoryByParams, InternalWarehouseDTO.class));
}
}

View File

@@ -70,4 +70,6 @@ public interface WarehouseFactoryService {
*/
List<WarehouseFactoryRespVO> getWarehouseFactoryByMainId(String mainId);
List<WarehouseFactoryRespVO> getWarehouseFactoryByParams(Long id, String mmsiType, String operationType);
}

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.module.erp.controller.admin.erp.vo.WarehouseFactoryPageReqVO;
import com.zt.plat.module.erp.controller.admin.erp.vo.WarehouseFactoryRespVO;
import com.zt.plat.module.erp.controller.admin.erp.vo.WarehouseFactorySaveReqVO;
@@ -59,12 +60,12 @@ public class WarehouseFactoryServiceImpl implements WarehouseFactoryService {
}
@Override
public void deleteWarehouseFactoryListByIds(List<Long> ids) {
public void deleteWarehouseFactoryListByIds(List<Long> ids) {
// 校验存在
validateWarehouseFactoryExists(ids);
// 删除
warehouseFactoryMapper.deleteByIds(ids);
}
}
private void validateWarehouseFactoryExists(List<Long> ids) {
List<WarehouseFactoryDO> list = warehouseFactoryMapper.selectByIds(ids);
@@ -92,7 +93,7 @@ public class WarehouseFactoryServiceImpl implements WarehouseFactoryService {
@Override
public List<WarehouseFactoryRespVO> getWarehouseFactoryByMainId(String mainId) {
List<WarehouseFactoryDO> warehouseFactoryDOS = warehouseFactoryMapper.selectList(WarehouseFactoryDO::getMainWarehouseId, mainId);
List<WarehouseFactoryRespVO> warehouseFactoryRespVOS=new ArrayList<>();
List<WarehouseFactoryRespVO> warehouseFactoryRespVOS = new ArrayList<>();
for (WarehouseFactoryDO warehouseFactoryDO : warehouseFactoryDOS) {
WarehouseFactoryRespVO bean = BeanUtils.toBean(warehouseFactoryDO, WarehouseFactoryRespVO.class);
bean.setMmsiType(warehouseFactoryDO.getMmsiType());
@@ -101,4 +102,14 @@ public class WarehouseFactoryServiceImpl implements WarehouseFactoryService {
return warehouseFactoryRespVOS;
}
@Override
public List<WarehouseFactoryRespVO> getWarehouseFactoryByParams(Long mainId, String mmsiType, String operationType) {
return BeanUtils.toBean(
warehouseFactoryMapper.selectList(new LambdaQueryWrapperX<WarehouseFactoryDO>()
.eq(WarehouseFactoryDO::getMainWarehouseId, mainId)
.eqIfPresent(WarehouseFactoryDO::getMmsiType, mmsiType)
.eqIfPresent(WarehouseFactoryDO::getOperationType, operationType)),
WarehouseFactoryRespVO.class);
}
}

View File

@@ -136,4 +136,5 @@ public class InternalWarehouseServiceImpl implements InternalWarehouseService {
);
}
}