StatusUpdateServiceImpl.java 1.28 KB
package com.huaheng.api.wcs.service.statusUpdate;


import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class StatusUpdateServiceImpl implements StatusUpdateService {


    @Autowired
    private TaskHeaderService taskHeaderService;

    @Override
    public AjaxResult statusUpdate(String taskNo) {
        if(StringUtils.isEmpty(taskNo)){
            return AjaxResult.error("任务号为空");
        }

        //TaskHeader taskHeader = taskHeaderService.selectEntityById(Integer.valueOf(taskNo));
        TaskHeader taskHeader = taskHeaderService.getById(Integer.valueOf(taskNo));

        if(taskHeader == null){
            return AjaxResult.error("wms找不到该任务号");
        }

        if(taskHeader.getStatus().intValue() == 100){
            return AjaxResult.error("wms该任务已完成");
        }

        taskHeader.setStatus(50);
        //taskHeader.setLastStatus((short)50);
        taskHeaderService.updateById(taskHeader);
        return AjaxResult.success("修改成功");
    }
}