MesController.java 3.14 KB
package com.huaheng.api.mes.controller;

import com.huaheng.api.mes.service.MesService;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/API/WMS/v2")
public class MesController extends BaseController {

    @Resource
    private MesService mesService;

    /**
     * 查询库存
     */
    @PostMapping("/searchInventory")
    @ApiOperation("查询库存")
    @ApiLogger(apiName = "查询库存", from = "MES")
    public AjaxResult searchInventory(@RequestBody Map<String, String> map) {
        String area = map.get("area");
        String materialCode = map.get("materialCode");
        return handleMultiProcess(() -> mesService.searchInventory(materialCode, area));
    }


    /**
     * 查询单据状态
     */
    @PostMapping("/returnQuery")
    @ApiOperation("查询单据状态")
    @ApiLogger(apiName = "查询单据状态", from = "MES")
    public AjaxResult returnQuery(@RequestBody Map<String, String> map) {
        String referCode = map.get("referCode");
        String referType = map.get("referType");
        return handleMultiProcess(() -> mesService.returnQuery(referCode, referType));
    }

    /**
     * 查询库位
     */
    @PostMapping("/searchLocations")
    @ApiOperation("查询库位")
    @ApiLogger(apiName = "查询库位", from = "MES")
    public AjaxResult searchLocations(@RequestBody Map<String, String> map) {
        String area = map.get("area");
        String locationCode = map.get("locationCode");
        return handleMultiProcess(() -> mesService.searchLocations(area, locationCode));
    }

    /**
     * 查询仓库
     */
    @PostMapping("/searchWarehouse")
    @ApiOperation("查询仓库")
    @ApiLogger(apiName = "查询仓库", from = "MES")
    public AjaxResult searchWarehouse() {
        return handleMultiProcess(() -> mesService.searchWarehouse());
    }

    /**
     * 查询容器
     */
    @PostMapping("/searchContainer")
    @ApiOperation("查询容器")
    @ApiLogger(apiName = "查询容器", from = "MES")
    public AjaxResult searchContainer() {
        return handleMultiProcess(() -> mesService.searchContainer());
    }


    /**
     * 查询容器
     */
    @PostMapping("/searchMaterialWarning")
    @ApiOperation("查询物料预警")
    @ApiLogger(apiName = "查询物料预警", from = "MES")
    public AjaxResult searchMaterialWarning() {
        return handleMultiProcess(() -> mesService.searchMaterialWarning());
    }

    /**
     * 查询容器
     */
    @PostMapping("/searchZone")
    @ApiOperation("查询库区")
    @ApiLogger(apiName = "查询库区", from = "MES")
    public AjaxResult searchZone() {
        return handleMultiProcess(() -> mesService.searchZone());
    }

}