MesController.java 4.77 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.*;

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("查询库存")
    @ResponseBody
    @ApiLogger(apiName = "查询库存", from="MES")
    public AjaxResult searchInventory (@RequestBody Map<String, String> map) {
        String area = map.get("area");
        String materialCode = map.get("materialCode");
        AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
            @Override
            public AjaxResult doProcess() {
                AjaxResult ajaxResult = mesService.searchInventory(materialCode,area);
                return ajaxResult;
            }
        });
        return ajaxResult;
    }


    /**
     * 回传查询
     */
    @PostMapping("/returnQuery")
    //@ApiOperation("回传查询")
    @ResponseBody
    //@ApiLogger(apiName = "回传查询", from="ERP")
    public AjaxResult returnQuery (@RequestBody Map<String, String> map) {
        String referCode = map.get("referCode");
        String referType = map.get("referType");
        AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
            @Override
            public AjaxResult doProcess() {
                AjaxResult ajaxResult = mesService.returnQuery(referCode,referType);
                return ajaxResult;
            }
        });
        return ajaxResult;
    }

    /**
     * 查询库位
     */
    @PostMapping("/searchLocations")
    @ApiOperation("查询库位")
    @ResponseBody
    @ApiLogger(apiName = "查询库位", from="MES")
    public AjaxResult searchLocations (@RequestBody Map<String, String> map) {
        String area = map.get("area");
        String locationCode = map.get("locationCode");
//        if(area == null || "".equals(area)){
//            return AjaxResult.error("查询库位 库区不能为空");
//        }
        AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
            @Override
            public AjaxResult doProcess() {
                AjaxResult ajaxResult = mesService.searchLocations(area,locationCode);
                return ajaxResult;
            }
        });
        return ajaxResult;
    }

    /**
     * 查询仓库
     */
    @PostMapping("/searchWarehouse")
    @ApiOperation("查询仓库")
    @ResponseBody
    @ApiLogger(apiName = "查询仓库", from="MES")
    public AjaxResult searchWarehouse () {
        AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
            @Override
            public AjaxResult doProcess() {
                AjaxResult ajaxResult = mesService.searchWarehouse();
                return ajaxResult;
            }
        });
        return ajaxResult;
    }

    /**
     * 查询容器
     */
    @PostMapping("/searchContainer")
    @ApiOperation("查询容器")
    @ResponseBody
    @ApiLogger(apiName = "查询容器", from="MES")
    public AjaxResult searchContainer () {
        AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
            @Override
            public AjaxResult doProcess() {
                AjaxResult ajaxResult = mesService.searchContainer();
                return ajaxResult;
            }
        });
        return ajaxResult;
    }


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

    /**
     * 查询容器
     */
    @PostMapping("/searchZone")
    @ApiOperation("查询库区")
    @ResponseBody
    @ApiLogger(apiName = "查询库区", from="MES")
    public AjaxResult searchZone () {
        AjaxResult ajaxResult = handleMultiProcess(new MultiProcessListener() {
            @Override
            public AjaxResult doProcess() {
                AjaxResult ajaxResult = mesService.searchZone();
                return ajaxResult;
            }
        });
        return ajaxResult;
    }

}