Blame view

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

import com.huaheng.api.wcs.domain.WcsTask;
4
import com.huaheng.common.constant.QuantityConstant;
pengcheng authored
5
6
import com.huaheng.common.utils.StringUtils;
import com.huaheng.framework.web.domain.AjaxResult;
pengcheng authored
7
8
9
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
10
import org.springframework.stereotype.Service;
pengcheng authored
11
import org.springframework.transaction.annotation.Transactional;
pengcheng authored
12
13
14
15

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

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

        //1、判断非空字段
mahuandong authored
33
        if(StringUtils.isEmpty(taskNo)){
pengcheng authored
34
35
36
            return AjaxResult.error("任务号为空");
        }
pengcheng authored
37
        //2、根据任务号查找任务
mahuandong authored
38
        TaskHeader taskHeader = taskHeaderService.getById(Integer.valueOf(taskNo));
39
        if(taskHeader == null) {
pengcheng authored
40
41
            return AjaxResult.error("任务号错误,没有找到该任务");
        }
42
43

        if(taskHeader.getStatus().intValue() == QuantityConstant.TASK_STATUS_COMPLETED){
44
45
            return AjaxResult.error("任务已完成");
        }
pengcheng authored
46
pengcheng authored
47
        //3、修改该任务为空出,过后处理
48
        taskHeader.setExceptionCode("空出处理");
49
        taskHeader.setIsEmptyOut(QuantityConstant.EMPTY_OUT);
pengcheng authored
50
        Boolean flag = taskHeaderService.updateById(taskHeader);
51
        if(flag == false) {
pengcheng authored
52
53
54
            return AjaxResult.error("修改任务失败,空出处理失败");
        }
        return AjaxResult.success("空出处理成功");
pengcheng authored
55
56
    }
}