WmsApiController.java 2.78 KB
package com.huaheng.api.general.controller;


import com.huaheng.api.general.domain.TaskDomain;
import com.huaheng.api.general.domain.TaskOffDomain;
import com.huaheng.api.general.service.TaskService;
import com.huaheng.common.exception.service.ServiceException;
import com.huaheng.framework.aspectj.lang.annotation.ApiLogger;
import com.huaheng.framework.aspectj.lang.annotation.Log;
import com.huaheng.framework.aspectj.lang.constant.BusinessType;
import com.huaheng.framework.web.domain.AjaxResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;



@RestController
@RequestMapping("/api")
@Api(tags = {"任务下发接口"}, value = "task")

public class WmsApiController {

    @Resource
    private TaskService taskService;

    @Log(title = "任务下发至立库", action = BusinessType.INSERT)
    @PostMapping("/WisJobSend")
    @ApiOperation("任务下发至立库")
    @ResponseBody
    @ApiLogger(apiName = "任务下发至立库", from = "ERP")
    public AjaxResult WisJobSend(@RequestBody TaskDomain taskDomain) {

        AjaxResult ajaxResult=new AjaxResult();
        switch (Integer.valueOf(taskDomain.getTaskType()))
        {
            case 1:
                ajaxResult=taskService.taskAllreceipt(taskDomain);
                break;
            case 2:
                ajaxResult=taskService.lssueTask(taskDomain);
                break;
            case 3:;
                ajaxResult=taskService.lssueTask(taskDomain);
                break;
            case 4:
                ajaxResult=taskService.airflare(taskDomain);
            break;
        }

        return ajaxResult;
    }



    @Log(title = "任务取消", action = BusinessType.INSERT)
    @PostMapping("/Taskcancellation")
    @ApiOperation("任务取消")
    @ResponseBody
    @Transactional
    @ApiLogger(apiName = "任务取消", from = "ERP")
    public AjaxResult Taskcancellation(@RequestBody TaskOffDomain taskDomain) {
        if (taskDomain == null) {
            throw new ServiceException("wms下发任务为空");
        }
        //1、判断必填字段是否满足
        if(taskDomain.getReqID() == null){
            throw new ServiceException("wms任务号Id为空");
        }
        if(taskDomain.getContainerCode() == null){
            throw new ServiceException("wms任务容器为空");
        }
        if(taskDomain.getTaskNo() == null){
            throw new ServiceException("wms任务号为空");
        }
        if(taskDomain.getRequestTime() == null){
            throw new ServiceException("wms任务时间为空");
        }

        AjaxResult ajaxResult=taskService.taskOff(taskDomain);
        return ajaxResult;
    }


}