TaskFinishServiceImpl.java 2.14 KB
package com.huaheng.api.wcs.service.taskFinish;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.huaheng.api.wcs.domain.TaskFinishDomain;
import com.huaheng.api.wcs.service.emptyOutHandle.EmptyOutHandleService;
import com.huaheng.api.wcs.service.overrideHandle.OverrideHandleService;
import com.huaheng.common.support.Convert;
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 TaskFinishServiceImpl implements TaskFinishService {

    @Autowired
    private TaskHeaderService taskHeaderService;
    @Autowired
    private EmptyOutHandleService emptyOutHandleService;
    @Autowired
    private OverrideHandleService overrideHandleService;

    //任务完成
    @Override
    public AjaxResult completeTaskByWCS(TaskFinishDomain taskFinishDomain) {
        AjaxResult ajaxResult=new AjaxResult();
        if(StringUtils.isEmpty(taskFinishDomain.getTaskNo())){
            return AjaxResult.error("任务号为空");
        }

        //1、空出处理
        if(taskFinishDomain.getIsEmptyOut() == 1){
            ajaxResult = emptyOutHandleService.EmptyOutHandle(taskFinishDomain.getTaskNo());
        }

        //2、重入处理
        if(taskFinishDomain.getIsDoubleIn() == 1){
            ajaxResult = overrideHandleService.OverrideHandle(taskFinishDomain);
        }

        //3、取货错
        if(taskFinishDomain.getIsForkError() == 1){

        }

        if (StringUtils.isEmpty(taskFinishDomain.getWeight())) {
            return AjaxResult.error("重量为空");
        }
        //任务完成
        try{
            ajaxResult=taskHeaderService.completeTaskByWMS(Convert.toIntArray(taskFinishDomain.getTaskNo()), Convert.toStrArray(taskFinishDomain.getWeight()));
        } catch (Exception e) {
            e.printStackTrace();
        }
        return ajaxResult;
    }
}