Blame view

src/main/java/com/huaheng/api/wcs/service/emptyOutHandle/EmptyOutHandleServiceImpl.java 1.76 KB
pengcheng authored
1
2
3
4
5
package com.huaheng.api.wcs.service.emptyOutHandle;

import com.huaheng.api.wcs.domain.WcsTask;
import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.web.domain.AjaxResult;
pengcheng authored
6
7
8
import com.huaheng.pc.task.taskHeader.domain.TaskHeader;
import com.huaheng.pc.task.taskHeader.service.TaskHeaderService;
import org.springframework.beans.factory.annotation.Autowired;
pengcheng authored
9
import org.springframework.stereotype.Service;
pengcheng authored
10
import org.springframework.transaction.annotation.Transactional;
pengcheng authored
11
12
13
14

@Service
public class EmptyOutHandleServiceImpl implements EmptyOutHandleService {
pengcheng authored
15
16
17
18

    @Autowired
    private TaskHeaderService taskHeaderService;
pengcheng authored
19
20
21
    /**
     * 空出处理
     * 1、判断非空字段
pengcheng authored
22
23
     * 2、根据任务号查找任务
     * 3、修改该任务为空出,过后处理
pengcheng authored
24
25
26
27
     * @param wcsTask
     * @return
     */
    @Override
pengcheng authored
28
    @Transactional
pengcheng authored
29
30
31
32
33
34
35
    public AjaxResult EmptyOutHandle(WcsTask wcsTask) {

        //1、判断非空字段
        if(StringUtils.isEmpty(wcsTask.getTaskNo())){
            return AjaxResult.error("任务号为空");
        }
pengcheng authored
36
37
38
39
40
        //2、根据任务号查找任务
        TaskHeader taskHeader = taskHeaderService.getById(Integer.valueOf(wcsTask.getTaskNo()));
        if(taskHeader == null){
            return AjaxResult.error("任务号错误,没有找到该任务");
        }
41
42
43
        if(taskHeader.getStatus() == 100){
            return AjaxResult.error("任务已完成");
        }
pengcheng authored
44
pengcheng authored
45
        //3、修改该任务为空出,过后处理
pengcheng authored
46
        taskHeader.setExceptionCode("空托出库");
pengcheng authored
47
48
49
50
51
        Boolean flag = taskHeaderService.updateById(taskHeader);
        if(flag == false){
            return AjaxResult.error("修改任务失败,空出处理失败");
        }
        return AjaxResult.success("空出处理成功");
pengcheng authored
52
53
    }
}