From 412dbd04d45d7bcce7d8d16b97d8a47a2086e791 Mon Sep 17 00:00:00 2001 From: LGH <1746689524@qq.com> Date: Thu, 1 Sep 2022 14:53:12 +0800 Subject: [PATCH] =?UTF-8?q?update:=20currTask=E5=88=97=E8=A1=A8=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../empty/controller/CurrTaskController.java | 11 ++- .../mt/wms/empty/service/CurrTaskService.java | 10 +++ .../service/impl/CurrTaskServiceImpl.java | 70 ++++++++++++++-- .../com/mt/wms/empty/task/RunTaskUtils.java | 1 + .../com/mt/wms/empty/vo/CurrTaskInfoVo.java | 83 +++++++++++++++++++ 5 files changed, 164 insertions(+), 11 deletions(-) create mode 100644 6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/CurrTaskInfoVo.java diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java index 0cae7a2..439493b 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/controller/CurrTaskController.java @@ -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> currentTaskInfo(@Validated @RequestBody CurrTaskQueryParam param) { + return currTaskService.currentTaskInfoPage(param); + } + @PostMapping(value = "completeTask") @ApiOperation(value = "执行任务完成(仅wms,不通知apms)") public R completeTask(@Validated @RequestBody IdParam param) { diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java index aca4f0a..6fd1028 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/CurrTaskService.java @@ -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> currentTaskPage(CurrTaskQueryParam param); + /** + * 查询分页信息 + * + * @param param 查询参数 + * @return 结果 + */ + R> currentTaskInfoPage(CurrTaskQueryParam param); + /** * 完成执行任务 不会物理删除,会将删除值置为0,同时在历史表复制一份记录 方便在订单未完成时查询任务详情 * diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java index 9b115d0..6462888 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/service/impl/CurrTaskServiceImpl.java @@ -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> currentTaskInfoPage(CurrTaskQueryParam param) { + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(CurrTask.VALID, 1); + wrapper.in(CurrTask.STATUS,0,1); + List currTaskList = currTaskServiceBiz.list(wrapper); + List 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 currTasks = currTaskServiceBiz + .list(new QueryWrapper() + .eq(CurrTask.AUTO_EXE_TASK_ID, currTask.getAutoExeTaskId()) + .orderByAsc(CurrTask.ID)); + List 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 currTaskDetList = currTaskDetServiceBiz.list(new QueryWrapper().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 completeTask(IdParam param) { CurrTask byId = currTaskServiceBiz.getById(param.getId()); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java index c1452f7..ea17d02 100644 --- a/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/task/RunTaskUtils.java @@ -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); diff --git a/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/CurrTaskInfoVo.java b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/CurrTaskInfoVo.java new file mode 100644 index 0000000..d6b365e --- /dev/null +++ b/6.program/wms-empty/src/main/java/com/mt/wms/empty/vo/CurrTaskInfoVo.java @@ -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 currTaskDetVoList; + /** + * 任务步骤详情 + */ + @ApiModelProperty("任务步骤详情") + private List currTaskVoList; +}