update:
currTask列表修改
This commit is contained in:
		@@ -23,10 +23,7 @@ import com.mt.wms.empty.service.CurrTaskDetService;
 | 
			
		||||
import com.mt.wms.empty.service.CurrTaskService;
 | 
			
		||||
import com.mt.wms.empty.service.OrderInfoService;
 | 
			
		||||
import com.mt.wms.empty.task.TaskDistanceUtils;
 | 
			
		||||
import com.mt.wms.empty.vo.ApmsCreateProcessSheetVo;
 | 
			
		||||
import com.mt.wms.empty.vo.ApmsStoveVo;
 | 
			
		||||
import com.mt.wms.empty.vo.CurrTaskMainQueryVo;
 | 
			
		||||
import com.mt.wms.empty.vo.CurrTaskQueryVo;
 | 
			
		||||
import com.mt.wms.empty.vo.*;
 | 
			
		||||
import io.swagger.annotations.Api;
 | 
			
		||||
import io.swagger.annotations.ApiOperation;
 | 
			
		||||
import lombok.extern.slf4j.Slf4j;
 | 
			
		||||
@@ -274,6 +271,12 @@ public class CurrTaskController extends BaseController {
 | 
			
		||||
        return currTaskService.currentTaskPage(param);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "currentTaskInfo")
 | 
			
		||||
    @ApiOperation(value = "获取当前任务列表以及详情")
 | 
			
		||||
    public R<List<CurrTaskInfoVo>> currentTaskInfo(@Validated @RequestBody CurrTaskQueryParam param) {
 | 
			
		||||
        return currTaskService.currentTaskInfoPage(param);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @PostMapping(value = "completeTask")
 | 
			
		||||
    @ApiOperation(value = "执行任务完成(仅wms,不通知apms)")
 | 
			
		||||
    public R<String> completeTask(@Validated @RequestBody IdParam param) {
 | 
			
		||||
 
 | 
			
		||||
@@ -9,11 +9,13 @@ import com.mt.wms.core.vo.R;
 | 
			
		||||
import com.mt.wms.empty.params.AutoCurrTaskParam;
 | 
			
		||||
import com.mt.wms.empty.params.CurrTaskQueryParam;
 | 
			
		||||
import com.mt.wms.empty.params.TaskCreateParam;
 | 
			
		||||
import com.mt.wms.empty.vo.CurrTaskInfoVo;
 | 
			
		||||
import com.mt.wms.empty.vo.CurrTaskMainQueryVo;
 | 
			
		||||
import com.mt.wms.empty.vo.CurrTaskQueryVo;
 | 
			
		||||
import com.mt.wms.empty.vo.CurrTaskVo;
 | 
			
		||||
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 拆分任务相关服务
 | 
			
		||||
@@ -63,6 +65,14 @@ public interface CurrTaskService {
 | 
			
		||||
     */
 | 
			
		||||
    R<PageVo<CurrTaskQueryVo>> currentTaskPage(CurrTaskQueryParam param);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 查询分页信息
 | 
			
		||||
     *
 | 
			
		||||
     * @param param 查询参数
 | 
			
		||||
     * @return 结果
 | 
			
		||||
     */
 | 
			
		||||
    R<List<CurrTaskInfoVo>> currentTaskInfoPage(CurrTaskQueryParam param);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 完成执行任务 不会物理删除,会将删除值置为0,同时在历史表复制一份记录 方便在订单未完成时查询任务详情
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,5 @@
 | 
			
		||||
package com.mt.wms.empty.service.impl;
 | 
			
		||||
 | 
			
		||||
import com.alibaba.fastjson.JSON;
 | 
			
		||||
import com.alibaba.fastjson.JSONObject;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 | 
			
		||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 | 
			
		||||
import com.mt.wms.core.api.Assert;
 | 
			
		||||
@@ -10,7 +8,6 @@ import com.mt.wms.core.dal.entity.*;
 | 
			
		||||
import com.mt.wms.core.dal.service.*;
 | 
			
		||||
import com.mt.wms.core.params.BasePageParam;
 | 
			
		||||
import com.mt.wms.core.params.IdParam;
 | 
			
		||||
import com.mt.wms.core.utils.HttpClient;
 | 
			
		||||
import com.mt.wms.core.utils.IDGenerator;
 | 
			
		||||
import com.mt.wms.core.vo.IdVo;
 | 
			
		||||
import com.mt.wms.core.vo.PageVo;
 | 
			
		||||
@@ -23,10 +20,7 @@ import com.mt.wms.empty.params.TaskCreateParam;
 | 
			
		||||
import com.mt.wms.empty.service.*;
 | 
			
		||||
import com.mt.wms.empty.task.RunTaskUtils;
 | 
			
		||||
import com.mt.wms.empty.task.TaskDistanceUtils;
 | 
			
		||||
import com.mt.wms.empty.vo.ApmsEndProcessVo;
 | 
			
		||||
import com.mt.wms.empty.vo.CurrTaskMainQueryVo;
 | 
			
		||||
import com.mt.wms.empty.vo.CurrTaskQueryVo;
 | 
			
		||||
import com.mt.wms.empty.vo.CurrTaskVo;
 | 
			
		||||
import com.mt.wms.empty.vo.*;
 | 
			
		||||
import org.slf4j.Logger;
 | 
			
		||||
import org.slf4j.LoggerFactory;
 | 
			
		||||
import org.springframework.beans.BeanUtils;
 | 
			
		||||
@@ -37,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.util.*;
 | 
			
		||||
import java.util.stream.Collectors;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 服务实现类
 | 
			
		||||
@@ -136,6 +131,67 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
 | 
			
		||||
        return successful(new PageVo<>(page, CurrTaskQueryVo.class));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<List<CurrTaskInfoVo>> currentTaskInfoPage(CurrTaskQueryParam param) {
 | 
			
		||||
        QueryWrapper<CurrTask> wrapper = new QueryWrapper<>();
 | 
			
		||||
        wrapper.eq(CurrTask.VALID, 1);
 | 
			
		||||
        wrapper.in(CurrTask.STATUS,0,1);
 | 
			
		||||
        List<CurrTask> currTaskList = currTaskServiceBiz.list(wrapper);
 | 
			
		||||
        List<CurrTaskInfoVo> list=new ArrayList<>();
 | 
			
		||||
        for (CurrTask currTask:currTaskList
 | 
			
		||||
             ) {
 | 
			
		||||
            CurrTaskInfoVo currTaskInfoVo=CurrTaskInfoVo.builder().build();
 | 
			
		||||
            //是否多步骤任务
 | 
			
		||||
            currTaskInfoVo.setIsAuto(currTask.getIsAuto());
 | 
			
		||||
            //任务状态
 | 
			
		||||
            if (currTask.getStatus()==1){
 | 
			
		||||
                currTaskInfoVo.setStatus(currTask.getStatus());
 | 
			
		||||
            }else if (currTask.getIsCache()==1){
 | 
			
		||||
                currTaskInfoVo.setStatus(2);
 | 
			
		||||
            }
 | 
			
		||||
            //生产单号
 | 
			
		||||
            if (currTask.getSheetNo()!=null){
 | 
			
		||||
                currTaskInfoVo.setSheetNo(currTask.getSheetNo());
 | 
			
		||||
            }
 | 
			
		||||
            currTaskInfoVo.setCreateTime(currTask.getCreateTime());
 | 
			
		||||
            //开始位置
 | 
			
		||||
            currTaskInfoVo.setStartPosition(currTask.getStartPosition());
 | 
			
		||||
            //currTask
 | 
			
		||||
            if (currTask.getIsAuto()==1){
 | 
			
		||||
                List<CurrTask> currTasks = currTaskServiceBiz
 | 
			
		||||
                        .list(new QueryWrapper<CurrTask>()
 | 
			
		||||
                                .eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId())
 | 
			
		||||
                                .orderByAsc(CurrTask.ID));
 | 
			
		||||
                List<CurrTaskVo> currTaskVos = com.mt.wms.core.utils.BeanUtils.copyList(currTasks, CurrTaskVo.class);
 | 
			
		||||
                currTaskInfoVo.setCurrTaskVoList(currTaskVos);
 | 
			
		||||
                String allStep="液压台";
 | 
			
		||||
                String nowStep="";
 | 
			
		||||
                for (CurrTask currTask1:currTasks
 | 
			
		||||
                     ) {
 | 
			
		||||
                    if (currTask1.getStatus()==1){
 | 
			
		||||
                        nowStep=currTask1.getTargetPosition();
 | 
			
		||||
                    }else if (currTask1.getIsCache()==1){
 | 
			
		||||
                        nowStep=currTask.getLocationName();
 | 
			
		||||
                    }
 | 
			
		||||
                    allStep=allStep.concat("->").concat(currTask1.getTargetPosition());
 | 
			
		||||
                }
 | 
			
		||||
                //
 | 
			
		||||
                currTaskInfoVo.setAllStep(allStep);
 | 
			
		||||
                currTaskInfoVo.setNowStep(nowStep);
 | 
			
		||||
            }
 | 
			
		||||
            //currTaskDet
 | 
			
		||||
            List<CurrTaskDet> currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper<CurrTaskDet>().eq(CurrTaskDet.CURR_TASK_ID, currTask.getId()));
 | 
			
		||||
            currTaskInfoVo.setCurrTaskDetVoList(com.mt.wms.core.utils.BeanUtils.copyList(currTaskDetList,CurrTaskDetVo.class));
 | 
			
		||||
            list.add(currTaskInfoVo);
 | 
			
		||||
        }
 | 
			
		||||
        list = list.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(CurrTaskInfoVo :: getAutoExeTaskId))), ArrayList::new));
 | 
			
		||||
 | 
			
		||||
        return successful(list);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public R<String> completeTask(IdParam param) {
 | 
			
		||||
        CurrTask byId = currTaskServiceBiz.getById(param.getId());
 | 
			
		||||
 
 | 
			
		||||
@@ -177,6 +177,7 @@ public class RunTaskUtils {
 | 
			
		||||
                currTask.setCacheSatatus(1);
 | 
			
		||||
                currTask.setUpdateTime(LocalDateTime.now());
 | 
			
		||||
                currTask.setLocationId(location.getId());
 | 
			
		||||
                currTask.setLocationName(location.getLocationName());
 | 
			
		||||
                currTaskServiceBiz.updateById(currTask);
 | 
			
		||||
                //异步调用车辆
 | 
			
		||||
                asynRunTaskService.asynRunTaskToWarehouse(currTask.getId(),vehicleId,location);
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,83 @@
 | 
			
		||||
package com.mt.wms.empty.vo;
 | 
			
		||||
 | 
			
		||||
import com.baomidou.mybatisplus.annotation.TableField;
 | 
			
		||||
import com.mt.wms.core.base.BaseVo;
 | 
			
		||||
import com.mt.wms.core.vo.PageVo;
 | 
			
		||||
import io.swagger.annotations.ApiModel;
 | 
			
		||||
import io.swagger.annotations.ApiModelProperty;
 | 
			
		||||
import lombok.Builder;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import lombok.EqualsAndHashCode;
 | 
			
		||||
import lombok.experimental.Accessors;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @Author: LGH
 | 
			
		||||
 * @Date: 2022/9/1
 | 
			
		||||
 */
 | 
			
		||||
@Data
 | 
			
		||||
@EqualsAndHashCode(callSuper = false)
 | 
			
		||||
@Accessors(chain = true)
 | 
			
		||||
@Builder
 | 
			
		||||
@ApiModel(value = "当前任务详细信息", description = "当前任务详细信息")
 | 
			
		||||
public class CurrTaskInfoVo extends BaseVo implements PageVo.ConvertVo{
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 状态:0等待执行,1执行中,2缓存中
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty("状态:0等待执行,1执行中,2缓存中")
 | 
			
		||||
    private Integer status;
 | 
			
		||||
    /**
 | 
			
		||||
     * 生产单号
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty("生产单号")
 | 
			
		||||
    private String sheetNo;
 | 
			
		||||
    /**
 | 
			
		||||
     * auto_Curr_Task_id
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty("auto_id")
 | 
			
		||||
    private Long autoExeTaskId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 发起任务时间
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty("创建时间")
 | 
			
		||||
    private LocalDateTime createTime;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 开始位置
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty("开始位置")
 | 
			
		||||
    private String startPosition;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 所有步骤
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty("所有步骤")
 | 
			
		||||
    private String allStep;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 是否多步骤任务
 | 
			
		||||
     */
 | 
			
		||||
    @TableField("is_auto")
 | 
			
		||||
    private Integer isAuto;
 | 
			
		||||
    /**
 | 
			
		||||
     * 当前步骤,炉名或者缓存库位
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty("当前步骤,炉名或者缓存库位")
 | 
			
		||||
    private String nowStep;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 标识卡详情列表
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty("标识卡详情列表")
 | 
			
		||||
    private List<CurrTaskDetVo> currTaskDetVoList;
 | 
			
		||||
    /**
 | 
			
		||||
     * 任务步骤详情
 | 
			
		||||
     */
 | 
			
		||||
    @ApiModelProperty("任务步骤详情")
 | 
			
		||||
    private  List<CurrTaskVo> currTaskVoList;
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user