【批量替代BOM】新增功能

This commit is contained in:
10001392 2024-10-09 23:31:11 +08:00
parent a536808643
commit bad832b9dc
1 changed files with 47 additions and 0 deletions

View File

@ -0,0 +1,47 @@
package com.nflg.product.bomnew.api.user;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.nflg.product.base.core.api.BaseApi;
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
import com.nflg.product.bomnew.service.MaterialMainService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import nflg.product.common.vo.ResultVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Collections;
import java.util.List;
/**
* 批量替代BOM
*
* @author makejava
* @since 2023-11-17 16:55:08
*/
@Api(tags = "批量替代BOM接口")
@RestController
@RequestMapping("bom/new/batchBom")
public class BatchBomApi extends BaseApi {
@Resource
private MaterialMainService materialMainService;
@GetMapping("getMaterialInfo")
@ApiOperation("查询物料信息")
public ResultVO<BaseMaterialVO> getMaterialInfo(@RequestParam String materialNo) {
if (ObjectUtil.isEmpty(materialNo)) {
return ResultVO.error("物料编码不能为空");
}
List<BaseMaterialVO> materialBaseInfo = materialMainService.getMaterialBaseInfo(Collections.singletonList(materialNo));
if (CollectionUtil.isEmpty(materialBaseInfo)) {
return ResultVO.error("物料编码不存在");
}
return ResultVO.success(materialBaseInfo.get(0));
}
}