WcsStackingController.java 3.48 KB
package com.huaheng.api.wcs.controller;

import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import com.huaheng.api.wcs.service.wcsInteract.WcsStackingService;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
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;

/**
 *
 * wcs码垛接口
 * @author xcq
 */
@RestController
@RequestMapping("/API/WMS/v2")
public class WcsStackingController {
    @Resource
    private WcsStackingService wcsStackingService;

    @PostMapping("/cartonsWhetherRelease")
    @ApiOperation(value="是否放行", notes="是否放行", httpMethod = "POST")
    @ResponseBody
    @ApiLogger(apiName = "是否放行", from="WCS")
    public AjaxResult cartonsWhetherRelease(@RequestBody String barcode){
        return wcsStackingService.cartonsWhetherRelease(barcode);
    }

    @PostMapping("/stackingDestination")
    @ApiOperation(value="码垛去向", notes="码垛去向", httpMethod = "POST")
    @ResponseBody
    @ApiLogger(apiName = "码垛去向", from="WCS")
    public AjaxResult stackingDestination(@RequestBody String json){
        if (StringUtils.isEmpty(json)){
            return AjaxResult.error("请勿提交空数据!");
        }
        JSONObject object = JSONObject.parseObject(json);
        String barcode = object.getString("barcode");
        return wcsStackingService.manipulatorStackingPort(barcode);
    }

//    @PostMapping("/manipulatorStackingPort")
//    @ApiOperation(value="机械手码垛接口", notes="机械手码垛接口", httpMethod = "POST")
//    @ResponseBody
//    @ApiLogger(apiName = "机械手码垛接口", from="WCS")
//    public AjaxResult manipulatorStackingPort(@RequestBody String json){
//        if (StringUtils.isEmpty(json)){
//            return AjaxResult.error("请勿提交空数据!");
//        }
//        JSONObject object = JSONObject.parseObject(json);
//        String barcode = object.getString("barcode");
//        return wcsStackingService.manipulatorStackingPort(barcode);
//    }

    @PostMapping("/manipulatorStackingResult")
    @ApiOperation(value="机械手码垛结果", notes="机械手码垛结果", httpMethod = "POST")
    @ResponseBody
    @ApiLogger(apiName = "机械手码垛结果", from="WCS")
    public AjaxResult manipulatorStackingResult(@RequestBody String json){
        return wcsStackingService.manipulatorStackingResult(json);
    }

    @PostMapping("/queryStackingContainer")
    @ApiOperation(value="查询码垛位托盘", notes="查询码垛位托盘", httpMethod = "POST")
    @ResponseBody
    @ApiLogger(apiName = "查询码垛位托盘", from="WCS")
    public AjaxResult queryStackingContainer(@RequestBody String port){
        return AjaxResult.success(wcsStackingService.queryStackingContainer(port));
    }


    @PostMapping("/getLastBox")
    @ApiOperation(value="是否为最后一箱", notes="是否为最后一箱", httpMethod = "POST")
    @ResponseBody
    @ApiLogger(apiName = "是否为最后一箱", from="WCS")
    public AjaxResult getLastBox(@RequestBody String json){
        if (StringUtils.isEmpty(json)){
            return AjaxResult.error("请勿提交空数据!");
        }
        JSONObject object = JSONObject.parseObject(json);
        String barcode = object.getString("barcode");
        return wcsStackingService.getLastBoxServer(barcode);
    }
}