MesEmptyContainerController.java 2.67 KB
package com.huaheng.api.mes.controller;

import com.huaheng.api.mes.service.mesEmptyContainerService.EmptyContainerService;
import com.huaheng.common.exception.service.ServiceException;
import com.huaheng.common.utils.StringUtils;
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.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


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

    @Resource
    private EmptyContainerService emptyContainerService;

    /**
     * 生成空托盘入库任务
     * @return
     */
    @PostMapping("/receiptEmptyContainer")
    @Transactional(rollbackFor = Exception.class)
    @ApiOperation("MES下发空托盘入库")
    @ApiLogger(apiName = "MES下发空托盘入库", from="MES")
    public AjaxResult receiptEmptyContainer(String taskNo,String containerCode,String vehicleNo,String vehicleSpec){
        if(StringUtils.isEmpty(taskNo)){
            throw new ServiceException("任务号不能为空!");
        }
        if(StringUtils.isEmpty(containerCode)){
            throw new ServiceException("容器号不能为空!");
        }
        if(StringUtils.isEmpty(vehicleNo)){
            throw new ServiceException("载具编码不能为空!");
        }
        if(StringUtils.isEmpty(vehicleSpec)){
            throw new ServiceException("载具规格不能为空!");
        }
        return emptyContainerService.createEmptyIn(taskNo,containerCode,vehicleNo,vehicleSpec);
    }

    /**
     * 生成空托盘出库任务
     * @return
     */
    @PostMapping("/shipmentEmptyContainer")
    @Transactional(rollbackFor = Exception.class)
    @ApiOperation("MES下发空托盘出库")
    @ApiLogger(apiName = "MES下发空托盘出库", from="MES")
    public AjaxResult shipmentEmptyContainer(String taskNo,String vehicleSpec,String toPort){
        if(StringUtils.isEmpty(taskNo)){
            throw new ServiceException("任务号不能为空!");
        }
        if(StringUtils.isEmpty(vehicleSpec)){
            throw new ServiceException("载具规格不能为空!");
        }
        if(StringUtils.isEmpty(toPort)){
            throw new ServiceException("出库口不能为空!");
        }
        return emptyContainerService.createEmptyOut(taskNo,vehicleSpec,toPort);
    }

}