自动化立体仓库 - WCS系统
#
Junjie
2023-11-27 d8cef0a05401284e18fefcfcf51ebc1b0f6da702
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.zy.asrs.service.impl;
 
import com.core.common.Cools;
import com.core.exception.CoolException;
import com.zy.asrs.domain.enums.TaskStatusType;
import com.zy.asrs.entity.TaskWrk;
import com.zy.asrs.entity.param.taskCreateParam;
import com.zy.asrs.service.OpenService;
import com.zy.asrs.service.TaskWrkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.Date;
 
@Service
public class OpenServiceImpl implements OpenService {
 
    @Autowired
    private TaskWrkService taskWrkService;
 
    @Override
    public void taskCreate(taskCreateParam param) {
        TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo());
        if (taskWrk != null) {
            throw new CoolException(param.getTaskNo() + "任务已存在,请勿重复提交");
        }
        if (param.getIoType().equals(0)){
            throw new CoolException("生成任务失败,任务类型不存在!");
        }
 
        Date now = new Date();
        taskWrk = new TaskWrk();
        taskWrk.setTaskNo(param.getTaskNo());//任务号
        taskWrk.setStatus(TaskStatusType.RECEIVE.id);//任务状态:接收
        taskWrk.setCreateTime(now);
        taskWrk.setIoType(param.getIoType());//任务类型
        taskWrk.setIoPri(param.getTaskPriority());//优先级
        taskWrk.setBarcode(param.getBarcode());//条码
        taskWrk.setWrkSts(11);
        if (!Cools.isEmpty(param.getStartPoint())) {
            taskWrk.setStartPoint(param.getStartPoint());//起点
        }
        if (!Cools.isEmpty(param.getTargetPoint())) {
            taskWrk.setTargetPoint(param.getTargetPoint());//终点
        }
        if (!Cools.isEmpty(param.getMemo())) {
            taskWrk.setMemo(param.getMemo());//备注
        }
 
        if (!taskWrkService.insert(taskWrk)) {
            throw new CoolException("生成任务失败,请联系管理员");
        }
    }
}