流程细节优化 接口注释优化,增加历史任务相关接口

This commit is contained in:
徐晨晨 2021-12-03 10:06:11 +08:00
parent 37a7a69861
commit 4ddb2b35fb
19 changed files with 291 additions and 25 deletions

View File

@ -10,6 +10,7 @@ import com.mt.wms.empty.params.CurrTaskQueryParam;
import com.mt.wms.empty.params.TaskCreateParam;
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.vo.CurrTaskQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -35,13 +36,17 @@ public class CurrTaskController extends BaseController {
private CurrTaskService currTaskService;
@Autowired
private CurrTaskDetService currTaskDetService;
@Autowired
private OrderInfoService orderInfoService;
@PostMapping(value = "createProcessTask")
@ApiOperation(value = "创建一个加工任务至任务队列")
@ApiOperation(value = "订单加工-创建一个加工任务至任务队列")
public R<String> createProcessTask(@Validated @RequestBody TaskCreateParam param) {
//验证标识卡号正确无误
orderInfoService.verifyTaskInfoByIdenCardNum(param.getDetParams());
R<IdVo> mainTask = currTaskService.createProcessTask(param);
currTaskDetService.createProcessTaskDet(param.getDetParams(), mainTask.getData().getId());
return successful("创建成功");
return successful("创建成功,任务添加至等待执行队列");
}
@ -52,13 +57,13 @@ public class CurrTaskController extends BaseController {
}
@PostMapping(value = "completeTask")
@ApiOperation(value = "完成执行任务")
@ApiOperation(value = "执行任务完成仅wms不通知apms")
public R<String> completeTask(@Validated @RequestBody IdParam param) {
return currTaskService.completeTask(param);
}
@PostMapping(value = "deleteBySheetNo")
@ApiOperation(value = "通过生产单编号删除生产单(APMS)")
@ApiOperation(value = "人工通过生产单编号删除未正式开始的生产单(通知APMS)")
public R<String> deleteBySheetNo(@Validated @RequestBody String sheetNo) {
return currTaskService.deleteBySheetNo(sheetNo);
}

View File

@ -12,7 +12,10 @@ import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author xcc
@ -28,7 +31,7 @@ public class CurrTaskDetController extends BaseController {
CurrTaskDetService currTaskDetService;
@PostMapping(value = "getTaskDet")
@ApiOperation(value = "查看主任务的详情任务列表")
@ApiOperation(value = "当前执行任务-查看详情")
public R<PageVo<CurrTaskDetVo>> getTaskDetailsPage(@Validated@RequestBody CurrTaskDetQueryParam currTaskId){
return currTaskDetService.getTaskDetailsPage(currTaskId);
}

View File

@ -35,7 +35,7 @@ public class OrderInfoController extends BaseController {
private OrderInfoService orderInfoService;
@PostMapping(value = "page")
@ApiOperation(value = "获取分页订单基础信息")
@ApiOperation(value = "订单加工管理-获取分页订单信息")
private R<PageVo<OrderInfoVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody OrderInfoBasePageParam orderBaseParam) {
return orderInfoService.page(orderBaseParam);
}
@ -50,20 +50,20 @@ public class OrderInfoController extends BaseController {
return orderInfoService.personCreateOrder(orderInfoPersonCreateParam);
}
@PostMapping(value = "get")
@ApiOperation(value = "当前订单查看详情")
@PostMapping(value = "getDet")
@ApiOperation(value = "当前订单列表-查看详情")
private R<OrderInfoVo> get(@Validated @RequestBody IdParam idParam) {
return orderInfoService.getOne(idParam);
}
@PostMapping(value = "getTaskInfo")
@ApiOperation(value = "当前订单任务详情")
@ApiOperation(value = "当前订单列表-查看任务详情")
private R<PageVo<OrderInfoTaskDetVo>> getTaskInfo(@Validated @RequestBody OrderInfoTaskDetParam orderInfoTaskDetParam) {
return orderInfoService.getTaskInfo(orderInfoTaskDetParam);
}
@GetMapping(value = "getTaskInfoByIdenCardNum")
@ApiOperation(value = "根据标识卡获取信息")
@ApiOperation(value = "订单加工-填写时根据标识卡获取信息")
private R<OrderInfoVo> getTaskInfoByIdenCardNum(@Validated @RequestParam String idenCardNum) {
return orderInfoService.getTaskInfoByIdenCardNum(idenCardNum);
}

View File

@ -37,19 +37,19 @@ public class OrderInfoHisController extends BaseController {
private OrderInfoHisService orderInfoHisService;
@PostMapping(value = "page")
@ApiOperation(value = "获取分页订单基础信息")
@ApiOperation(value = "获取分页订单历史信息")
private R<PageVo<OrderInfoVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody OrderInfoBasePageParam orderBaseParam) {
return orderInfoHisService.page(orderBaseParam);
}
@PostMapping(value = "get")
@ApiOperation(value = "订单历史查看详情")
@PostMapping(value = "getDet")
@ApiOperation(value = "订单历史-查看详情")
private R<OrderInfoVo> get(@Validated @RequestBody IdParam idParam) {
return orderInfoHisService.getOne(idParam);
}
@PostMapping(value = "getTaskInfo")
@ApiOperation(value = "订单历史任务详情")
@ApiOperation(value = "订单历史-查看任务详情")
private R<PageVo<OrderInfoTaskDetVo>> getTaskInfo(@Validated @RequestBody OrderInfoTaskDetParam orderInfoTaskDetParam) {
return orderInfoHisService.getTaskInfo(orderInfoTaskDetParam);
}

View File

@ -2,10 +2,18 @@ package com.mt.wms.empty.controller;
import com.mt.wms.core.base.BaseController;
import com.mt.wms.core.constants.CommonConstant;
import com.mt.wms.empty.service.CurrTaskDetService;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.CurrTaskDetQueryParam;
import com.mt.wms.empty.service.TaskDetHisService;
import com.mt.wms.empty.vo.TaskHisDetVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -20,6 +28,11 @@ import org.springframework.web.bind.annotation.RestController;
@Api(value = "任务详情历史", tags = "任务详情历史管理", hidden = false)
public class TaskDetHisController extends BaseController {
@Autowired
CurrTaskDetService currTaskDetService;
TaskDetHisService taskDetHisService;
@PostMapping(value = "getTaskDet")
@ApiOperation(value = "历史执行任务-查看详情")
public R<PageVo<TaskHisDetVo>> getTaskDetailsPage(@Validated @RequestBody CurrTaskDetQueryParam currTaskId) {
return taskDetHisService.getTaskDetailsPage(currTaskId);
}
}

View File

@ -2,10 +2,18 @@ package com.mt.wms.empty.controller;
import com.mt.wms.core.base.BaseController;
import com.mt.wms.core.constants.CommonConstant;
import com.mt.wms.empty.service.CurrTaskService;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.TaskHisQueryParam;
import com.mt.wms.empty.service.TaskHisService;
import com.mt.wms.empty.vo.TaskHisQueryVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -20,5 +28,11 @@ import org.springframework.web.bind.annotation.RestController;
@Api(value = "任务历史管理", tags = "任务历史管理", hidden = false)
public class TaskHisController extends BaseController {
@Autowired
private CurrTaskService currTaskService;
private TaskHisService taskHisService;
@PostMapping(value = "taskHis")
@ApiOperation(value = "获取历史执行的任务 (车辆名称传id)")
public R<PageVo<TaskHisQueryVo>> currentTask(@Validated @RequestBody TaskHisQueryParam param) {
return taskHisService.taskHisPage(param);
}
}

View File

@ -20,8 +20,6 @@ public class CurrTaskQueryParam extends BasePageParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "标识卡号",required = false)
private String idenCardNum;
@ApiModelProperty(value = "车辆id")
private String vehicleId;

View File

@ -1,6 +1,5 @@
package com.mt.wms.empty.params;
import com.mt.wms.core.base.BaseParam;
import com.mt.wms.core.params.BasePageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -24,13 +23,13 @@ public class OrderInfoBasePageParam extends BasePageParam {
/**
* 订单号APMS系统获取
*/
@ApiModelProperty(value = "订单号", required = false)
@ApiModelProperty(value = "订单号", required = true)
private String orderNo;
/**
* 标识卡号APMS系统获取
*/
@ApiModelProperty(value = "标识卡号", required = false)
@ApiModelProperty(value = "标识卡号", required = true)
private String idenCardNum;

View File

@ -0,0 +1,31 @@
package com.mt.wms.empty.params;
import com.mt.wms.core.params.BasePageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
/**
* @author xcc
* @date 2021年11月9日
* @since 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "获取任务信息", description = "获取任务信息")
public class TaskHisQueryParam extends BasePageParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "车辆id")
private String vehicleId;
@ApiModelProperty(value = "开始时间")
private LocalDateTime startTime;
@ApiModelProperty(value = "开始时间")
private LocalDateTime endTime;
}

View File

@ -61,7 +61,7 @@ public interface CurrTaskDetService {
List<CurrTaskDet> getTaskDetailsByIdenCardNum(String idenCardNum);
/**
* 查询某个标识卡号的详细任务列表
* 通过生产单删除某个生产单
*
* @param currTaskId 生产单号
* @return 结果

View File

@ -7,6 +7,8 @@ import com.mt.wms.empty.params.*;
import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
import com.mt.wms.empty.vo.OrderInfoVo;
import java.util.List;
/**
* 订单相关服务
*
@ -61,6 +63,13 @@ public interface OrderInfoService {
*/
R<OrderInfoVo> getTaskInfoByIdenCardNum(String idenCardNum);
/**
* 验证传入的详细订单标识卡正确
*
* @param detParams 详细订单
*/
void verifyTaskInfoByIdenCardNum(List<TaskCreateDetParam> detParams);
/**
* 完成订单
*

View File

@ -3,8 +3,10 @@ package com.mt.wms.empty.service;
import com.mt.wms.core.dal.entity.TaskDetHis;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.CurrTaskDetQueryParam;
import com.mt.wms.empty.params.OrderInfoTaskDetParam;
import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
import com.mt.wms.empty.vo.TaskHisDetVo;
import java.util.HashMap;
import java.util.List;
@ -48,4 +50,12 @@ public interface TaskDetHisService {
* @return 结果
*/
HashMap<String, Double> getSumByIdCard(String idCard);
/**
* 查询历史加工的详细任务信息
*
* @param currTaskId 详细任务信息
* @return 结果
*/
R<PageVo<TaskHisDetVo>> getTaskDetailsPage(CurrTaskDetQueryParam currTaskId);
}

View File

@ -3,8 +3,11 @@ package com.mt.wms.empty.service;
import com.mt.wms.core.dal.entity.TaskHis;
import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.vo.IdVo;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.TaskHisQueryParam;
import com.mt.wms.empty.vo.CurrTaskVo;
import com.mt.wms.empty.vo.TaskHisQueryVo;
/**
* 主任务历史相关服务
@ -30,4 +33,13 @@ public interface TaskHisService {
* @return 结果
*/
CurrTaskVo getById(IdParam id);
/**
* 查询分页信息
*
* @param param 查询参数
* @return 结果
*/
R<PageVo<TaskHisQueryVo>> taskHisPage(TaskHisQueryParam param);
}

View File

@ -2,6 +2,7 @@ package com.mt.wms.empty.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mt.wms.core.api.Assert;
import com.mt.wms.core.base.BaseService;
import com.mt.wms.core.dal.entity.CurrTask;
import com.mt.wms.core.dal.entity.CurrTaskDet;
@ -67,6 +68,7 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
@Override
public R<IdVo> createProcessTask(TaskCreateParam param) {
Assert.notNull("错误,加工类型不可为空!", param.getProcessType());
CurrTask currTask = new CurrTask();
BeanUtils.copyProperties(param, currTask);
currTask.setTaskType(TaskTypeEnum.WTK.getValue());

View File

@ -167,6 +167,7 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
QueryWrapper<OrderInfo> wrapper = new QueryWrapper<>();
wrapper.eq(OrderInfo.IDEN_CARD_NUM, idenCardNum).eq(OrderInfo.VALID, 1);
OrderInfo one = orderInfoService.getOne(wrapper);
Assert.notNull("未找到该标识卡信息!", one);
OrderInfoVo build = OrderInfoVo.builder().build();
BeanUtils.copyProperties(one, build);
//查询历史任务表当前任务表拉取加工完成 创建任务未加工 计算剩余数量
@ -183,6 +184,17 @@ public class OrderInfoServiceImpl extends BaseService implements OrderInfoServic
return successful(build);
}
@Override
public void verifyTaskInfoByIdenCardNum(List<TaskCreateDetParam> detParams) {
for (TaskCreateDetParam detParam : detParams)
{
QueryWrapper<OrderInfo> wrapper = new QueryWrapper<>();
wrapper.eq(OrderInfo.IDEN_CARD_NUM, detParam.getIdenCardNum()).eq(OrderInfo.VALID, 1);
OrderInfo one = orderInfoService.getOne(wrapper);
Assert.notNull("错误,标识卡号" + detParam.getIdenCardNum() + "在订单中不存在!", one);
}
}
@Override
public R<String> completeOrder(IdParam idParam) {
OrderInfo byId = orderInfoService.getById(idParam.getId());

View File

@ -8,11 +8,13 @@ import com.mt.wms.core.dal.service.TaskDetHisServiceBiz;
import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.CurrTaskDetQueryParam;
import com.mt.wms.empty.params.OrderInfoTaskDetParam;
import com.mt.wms.empty.service.TaskDetHisService;
import com.mt.wms.empty.service.TaskHisService;
import com.mt.wms.empty.vo.CurrTaskVo;
import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
import com.mt.wms.empty.vo.TaskHisDetVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -80,4 +82,13 @@ public class TaskDetHisServiceImpl extends BaseService implements TaskDetHisServ
result.put("quantity", sumQuantity);
return result;
}
@Override
public R<PageVo<TaskHisDetVo>> getTaskDetailsPage(CurrTaskDetQueryParam currTaskId) {
QueryWrapper<TaskDetHis> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(TaskDetHis.TASK_ID, currTaskId.getCurrTaskId())
.eq(TaskDetHis.VALID, 1);
Page<TaskDetHis> page = taskDetHisServiceBiz.page(new Page<>(currTaskId.getCurrent(), currTaskId.getSize()), queryWrapper);
return successful(new PageVo<>(page, TaskHisDetVo.class));
}
}

View File

@ -1,18 +1,26 @@
package com.mt.wms.empty.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mt.wms.core.base.BaseService;
import com.mt.wms.core.dal.entity.TaskHis;
import com.mt.wms.core.dal.service.TaskHisServiceBiz;
import com.mt.wms.core.params.IdParam;
import com.mt.wms.core.vo.IdVo;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.TaskHisQueryParam;
import com.mt.wms.empty.service.TaskHisService;
import com.mt.wms.empty.vo.CurrTaskVo;
import com.mt.wms.empty.vo.TaskHisQueryVo;
import jodd.util.StringUtil;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Objects;
/**
* 服务实现类
*
@ -41,4 +49,14 @@ public class TaskHisServiceImpl extends BaseService implements TaskHisService {
BeanUtils.copyProperties(byId, build);
return build;
}
@Override
public R<PageVo<TaskHisQueryVo>> taskHisPage(TaskHisQueryParam param) {
QueryWrapper<TaskHis> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(StringUtil.isNotBlank(param.getVehicleId()), TaskHis.VEHICLE_ID, param.getVehicleId())
.between(Objects.nonNull(param.getStartTime()) && Objects.nonNull(param.getEndTime()), TaskHis.CREATE_TIME, param.getStartTime(), param.getEndTime())
.eq(TaskHis.VALID, 1).orderByDesc(TaskHis.CREATE_TIME);
Page<TaskHis> page = taskHisService.page(new Page<>(param.getCurrent(), param.getSize()), queryWrapper);
return successful(new PageVo<>(page, TaskHisQueryVo.class));
}
}

View File

@ -0,0 +1,60 @@
package com.mt.wms.empty.vo;
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;
/**
* @author xcc
* @date 2021年11月8日
* @since 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Builder
@ApiModel(value = "任务详细信息", description = "用于返回任务详细信息")
public class TaskHisDetVo extends BaseVo implements PageVo.ConvertVo {
@ApiModelProperty(value = "id")
private Long id;
/**
* 修改时间更具修改时间来判断下次执行顺序第一次修改时间和新增时间相同
*/
@ApiModelProperty("修改时间")
private LocalDateTime updateTime;
/**
* 状态 0等待执行
*/
@ApiModelProperty("状态")
private Integer status;
/**
* 任务编码
*/
@ApiModelProperty("任务编码")
private String taskCode;
/**
* 历史任务id关联当前任务表t_task_his
*/
@ApiModelProperty("历史任务id")
private Long taskId;
/**
* 重量手动输入
*/
@ApiModelProperty("重量")
private Float weight;
/**
* 数量手动输入
*/
@ApiModelProperty("数量")
private Float quantity;
}

View File

@ -0,0 +1,69 @@
package com.mt.wms.empty.vo;
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;
/**
* @author xcc
* @date 2021年11月8日
* @since 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Builder
@ApiModel(value = "历史任务信息", description = "历史任务信息")
public class TaskHisQueryVo extends BaseVo implements PageVo.ConvertVo {
@ApiModelProperty(value = "id")
private Long id;
/**
* 任务编码, 查看任务编码规则
*/
@ApiModelProperty("任务编码")
private String taskCode;
/**
* 发起任务时间
*/
@ApiModelProperty("发起时间")
private LocalDateTime createTime;
/**
* 任务来源, 暂时只有人工
*/
@ApiModelProperty("任务来源")
private String taskSource;
/**
* 状态 0等待执行1执行中2执行完成3追加后完成追加后就按完成来算
*/
@ApiModelProperty("状态")
private Integer status;
/**
* 任务类型0:入库到窑炉1:入库到缓存区2出库到 窑炉到缓存区3缓存区出库
*/
@ApiModelProperty("任务类型")
private Integer taskType;
/**
* 开始位置
*/
@ApiModelProperty("开始位置")
private String startPosition;
/**
* 目标位置指的是窑炉的位置
*/
@ApiModelProperty("窑炉位置")
private String targetPosition;
/**
* 车辆名称关联车辆表t_vehicle_info
*/
@ApiModelProperty("车辆名称")
private String vehicleName;
}