1
skyouc
昨天 10a43f2d14a1a161bc624b9fe2f70febc9776ac8
rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -23,6 +23,7 @@
import com.vincent.rsf.server.system.utils.SerialRuleUtils;
import com.vincent.rsf.server.system.utils.SystemAuthUtils;
import lombok.Synchronized;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -34,6 +35,7 @@
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
@Service("taskService")
public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements TaskService {
@@ -285,7 +287,7 @@
        if (Objects.isNull(deviceSite)) {
            throw new CoolException("站点不存在!!");
        }
        DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(Integer.valueOf(deviceSite.getSite())));
        DeviceBind deviceBind = deviceBindService.getById(LocUtils.getAreaType(deviceSite.getSite()));
        if (Cools.isEmpty(deviceBind)) {
            throw new CoolException("库位规则未知");
        }
@@ -406,22 +408,24 @@
     */
    @Synchronized
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void complateInTask(List<Task> tasks) throws Exception {
        Long loginUserId = SystemAuthUtils.getLoginUserId();
        for (Task task : tasks) {
            if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)) {
                //1.入库
                complateInstock(task, loginUserId);
            } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) {
                //53.拣料再入库
                //57.盘点再入库
                pickComplateInStock(task, loginUserId);
            } else if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
                //移库
                moveInStock(task, loginUserId);
            try {
                if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type)) {
                    //1.入库
                    complateInstock(task, loginUserId);
                } else if (task.getTaskType().equals(TaskType.TASK_TYPE_PICK_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_IN.type)) {
                    //53.拣料再入库
                    //57.盘点再入库
                    pickComplateInStock(task, loginUserId);
                } else if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type)) {
                    //移库
                    moveInStock(task, loginUserId);
                }
            } catch (Exception ex) {
                log.error(ex.getMessage(), ex);
            }
        }
    }
@@ -635,7 +639,6 @@
     */
    @Synchronized
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void completeTask(List<Task> tasks) {
        Long loginUserId = SystemAuthUtils.getLoginUserId();
        for (Task task : tasks) {
@@ -643,7 +646,8 @@
            try {
                complateOutStock(task, loginUserId);
            } catch (Exception e) {
                throw new CoolException(e.getMessage());
                log.error(e.getMessage(), e);
//                throw new CoolException(e.getMessage());
            }
        }
    }
@@ -970,7 +974,7 @@
                .setTaskStatus(TaskStsType.GENERATE_IN.id);
        TaskInParam param = new TaskInParam();
        param.setSourceStaNo(Integer.parseInt(task.getTargSite()))
        param.setSourceStaNo(task.getTargSite())
                .setIoType(type)
                .setLocType1(Integer.parseInt(loc.getType()));
        //获取新库位
@@ -979,7 +983,8 @@
        if (Objects.isNull(locInfo)) {
            throw new CoolException("获取库位失败!!");
        }
        task.setTargLoc(locInfo.getLocNo());
        task.setTargLoc(locInfo.getLocNo())
                .setOrgSite(task.getTargSite());
        if (!this.updateById(task)) {
            throw new CoolException("任务状态更新失败!!");