TaskFinishController.java 1.63 KB
package com.huaheng.api.wcs.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.*;

import com.huaheng.api.wcs.domain.TaskFinishDomain;
import com.huaheng.api.wcs.service.taskFinish.TaskFinishService;
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.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.framework.web.service.ConcurrentLockService;

import io.swagger.annotations.ApiOperation;

/**
 * 任务完成
 * wcs向wms传递数据
 * @author ricard
 * @date   2019/10/11
 */

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

    @Resource
    private TaskFinishService taskFinishService;
    @Resource
    private ConcurrentLockService lockService;

    @Log(title = "wcs任务完成", action = BusinessType.INSERT)
    @PostMapping("/complete")
    @ApiOperation("wcs任务完成")
    @ResponseBody
    @ApiLogger(apiName = "wcs任务完成", from = "wcs")
    public AjaxResult complete(@RequestBody TaskFinishDomain taskFinishDomain) {
        AjaxResult ajaxResult =
            lockService.handleMultiProcessLock("completeTaskByWCS", taskFinishDomain.getTaskNo(), new ConcurrentLockService.MultiProcessListener() {
                @Override
                public AjaxResult doProcess() {
                    return taskFinishService.completeTaskByWCS(taskFinishDomain);
                }
            });
        return ajaxResult;
    }

}