gaoluyang
5 天以前 8e4eee5ad4d74e1a4e6ab4de3a9c28000700dce0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package cn.iocoder.yudao.module.erp.controller.admin.stock;
 
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.mes.api.wms.stock.WmsStockApi;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
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 java.math.BigDecimal;
 
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
 
/**
 * ERP 库存兼容接口
 *
 * 库存数据已统一由 MES(mes_wm_material_stock)维护,本接口仅保留前端采购/销售单据明细
 * 使用的 {@code /erp/stock/get-count} 调用路径,内部转调 MES 库存 API。
 */
@Tag(name = "管理后台 - ERP 库存(兼容)")
@RestController
@RequestMapping("/erp/stock")
@Validated
public class ErpStockCompatController {
 
    @Resource
    private WmsStockApi wmsStockApi;
 
    @GetMapping("/get-count")
    @Operation(summary = "获得产品库存数量(数据来自 MES 库存)")
    @Parameter(name = "productId", description = "产品编号", required = true, example = "1024")
    @Parameter(name = "warehouseId", description = "仓库编号,不传则统计全部仓库", example = "2048")
    public CommonResult<BigDecimal> getStockCount(@RequestParam("productId") Long productId,
                                                  @RequestParam(value = "warehouseId", required = false) Long warehouseId) {
        return success(wmsStockApi.getStockQuantity(productId, warehouseId));
    }
 
}