新增库位绑定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,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 {
);
}
}