创建加工任务,查询加工任务以及详细任务内容相关文件

This commit is contained in:
徐晨晨 2021-11-10 09:36:30 +08:00
parent 2fbb3b337e
commit 2e5f6dab8e
14 changed files with 591 additions and 9 deletions

View File

@ -2,11 +2,23 @@ package com.mt.wms.empty.controller;
import com.mt.wms.core.base.BaseController;
import com.mt.wms.core.constants.CommonConstant;
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.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.vo.CurrTaskQueryVo;
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.web.bind.annotation.*;
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;
/**
* @author xcc
@ -16,10 +28,27 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping(CommonConstant.API_MODULE_BASE + "currTask")
@Slf4j
@Api(value = "当前任务管理", tags = "任务管理", hidden = false)
@Api(value = "任务管理", tags = "当前任务管理", hidden = false)
public class CurrTaskController extends BaseController {
@Autowired
private CurrTaskService currTaskService;
@Autowired
private CurrTaskDetService currTaskDetService;
@PostMapping(value = "createTask")
@ApiOperation(value = "进入工业炉加工(首次加工)")
public R createFirstTask(@Validated @RequestBody TaskCreateParam param){
R<IdVo> mainTask = currTaskService.createFirstTask(param);
currTaskDetService.createFirstTaskDet(param.getDetParams(),mainTask.getData().getId());
//任务发起后判断去窑炉或者去缓存位不由此处判断
//todo 调用后续的处理接口
return successful("创建成功。");
}
@PostMapping(value = "currentTaskNow")
@ApiOperation(value = "获取当前执行的任务")
public R<PageVo<CurrTaskQueryVo>> currentTask(@Validated @RequestBody CurrTaskQueryParam param){
return currTaskService.currentTaskPage(param);
}
}

View File

@ -2,12 +2,17 @@ package com.mt.wms.empty.controller;
import com.mt.wms.core.base.BaseController;
import com.mt.wms.core.constants.CommonConstant;
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.CurrTaskDetService;
import com.mt.wms.empty.vo.CurrTaskDetVo;
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* @author xcc
@ -17,10 +22,14 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(CommonConstant.API_MODULE_BASE + "currTaskDet")
@Slf4j
@Api(value = "当前任务详情管理", tags = "任务详情管理", hidden = false)
@Api(value = "任务详情管理", tags = "当前任务详情管理", hidden = false)
public class CurrTaskDetController extends BaseController {
@Autowired
CurrTaskDetService currTaskDetService;
@PostMapping(value = "getTaskDet")
@ApiOperation(value = "查看主任务的详情任务列表")
public R<PageVo<CurrTaskDetVo>> getTaskDetailsPage(@Validated@RequestBody CurrTaskDetQueryParam currTaskId){
return currTaskDetService.getTaskDetailsPage(currTaskId);
}
}

View File

@ -0,0 +1,70 @@
/*
* Copyright (c) 2018.
* http://www.ulabcare.com
*/
package com.mt.wms.empty.enums;
import com.mt.wms.core.base.IEnum;
/**
* 订单来源信息 1.APMS 2.人工
*
* @author xcc
* @date 2021/6/17 15:44
*/
public enum TaskTypeEnum implements IEnum<Integer> {
/**
* 入库到窑炉
*/
WTK(0, "入库到窑炉"),
/**
* 入库到缓存
*/
WTC(1, "入库到缓存"),
/**
* 出库到窑炉到缓存区
*/
KTC(2, "出库到窑炉到缓存区"),
/**
* 缓存区出库
*/
CTS(3, "缓存区出库");
private final Integer value;
private final String label;
private final String remark;
TaskTypeEnum(final Integer value, final String label) {
this(value, label, null);
}
TaskTypeEnum(final Integer value, final String label, final String remark) {
this.value = value;
this.label = label;
this.remark = remark;
}
/**
* @return 数据值
*/
@Override
public Integer getValue() {
return value;
}
/**
* @return 标签名
*/
@Override
public String getLabel() {
return label;
}
/**
* @return 备注
*/
@Override
public String getRemark() {
return remark;
}
}

View File

@ -0,0 +1,26 @@
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;
/**
* @author xcc
* @date 2021年11月9日
* @since 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "获取任务信息", description = "获取任务信息")
public class CurrTaskDetQueryParam extends BasePageParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主任务id",required = true)
private Long currTaskId;
}

View File

@ -0,0 +1,28 @@
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;
/**
* @author xcc
* @date 2021年11月9日
* @since 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "获取任务信息", description = "获取任务信息")
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

@ -0,0 +1,73 @@
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;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* @author xcc
* @date 2021年11月9日
* @since 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "订单详细信息", description = "新建一个订单的详细信息")
public class TaskCreateDetParam extends BaseParam {
private static final long serialVersionUID = 1L;
/**
* 标识卡号
*/
@ApiModelProperty(value = "标识卡号", required = true)
private String idenCardNum;
/**
* 订单号APMS系统获取
*/
@ApiModelProperty(value = "订单号", required = false)
private String orderNo;
/**
* 客户名称
*/
@ApiModelProperty(value = "客户名称")
private String customerName;
/**
* 产品名称
*/
@ApiModelProperty(value = "产品名称")
private String productName;
/**
* 材料牌号 APMS系统获取
*/
@ApiModelProperty(value = "材料牌号")
private String materialDes;
/**
* 单位
*/
@ApiModelProperty(value = "单位")
private String unit;
/**
* 重量
*/
@ApiModelProperty(value = "重量",required = true)
private Float weight;
/**
* 数量
*/
@ApiModelProperty(value = "数量",required = true)
private Float quantity;
}

View File

@ -0,0 +1,38 @@
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;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.List;
/**
* @author xcc
* @date 2021年11月9日
* @since 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "新建一个订单信息", description = "新建一个订单信息")
public class TaskCreateParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "托盘号")
private String palletCode;
@ApiModelProperty(value = "起点",required = true)
private String startPosition;
@ApiModelProperty(value = "终点位置",required = true)
private String targetPosition;
@ApiModelProperty(value = "窑炉Id",required = true)
private Long kilnId;
@ApiModelProperty(value = "详细信息",required = true)
private List<TaskCreateDetParam> detParams;
}

View File

@ -1,7 +1,10 @@
package com.mt.wms.empty.service;
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.params.TaskCreateDetParam;
import com.mt.wms.empty.vo.CurrTaskDetVo;
import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
@ -20,6 +23,18 @@ public interface CurrTaskDetService {
* @param param 订单号 和标识卡
* @return 结果
*/
public PageVo<OrderInfoTaskDetVo> getCurrOrderCurrTask(OrderInfoTaskDetParam param);
PageVo<OrderInfoTaskDetVo> getCurrOrderCurrTask(OrderInfoTaskDetParam param);
/**
* 创建正常加工的详细任务信息
* @param taskDet 详细任务信息
* @param taskId 主任务id
*/
void createFirstTaskDet(List<TaskCreateDetParam> taskDet, Long taskId);
/**
* 查询正常加工的详细任务信息
* @param currTaskId 详细任务信息
* @return 结果
*/
R<PageVo<CurrTaskDetVo>> getTaskDetailsPage(CurrTaskDetQueryParam currTaskId);
}

View File

@ -1,5 +1,18 @@
package com.mt.wms.empty.service;
import com.mt.wms.core.dal.entity.CurrTaskDet;
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.CurrTaskQueryParam;
import com.mt.wms.empty.params.TaskCreateDetParam;
import com.mt.wms.empty.params.TaskCreateParam;
import com.mt.wms.empty.vo.CurrTaskQueryVo;
import com.mt.wms.empty.vo.CurrTaskVo;
import java.util.List;
/**
* 拆分任务相关服务
*
@ -9,4 +22,24 @@ package com.mt.wms.empty.service;
*/
public interface CurrTaskService {
/**
* 内部使用获取详情任务的关联任务
* @param idParam 任务id
* @return 任务实体
*/
CurrTaskVo getCurrTask(IdParam idParam);
/**
* 创建正常加工的主任务信息
* @param param 主任务信息
* @return 结果
*/
R<IdVo> createFirstTask(TaskCreateParam param);
/**
* 查询分页信息
* @param param 查询参数
* @return 结果
*/
R<PageVo<CurrTaskQueryVo>> currentTaskPage(CurrTaskQueryParam param);
}

View File

@ -5,8 +5,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mt.wms.core.base.BaseService;
import com.mt.wms.core.dal.entity.CurrTaskDet;
import com.mt.wms.core.dal.service.CurrTaskDetServiceBiz;
import com.mt.wms.core.utils.BeanUtils;
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.params.TaskCreateDetParam;
import com.mt.wms.empty.service.CurrTaskDetService;
import com.mt.wms.empty.vo.CurrTaskDetVo;
import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
@ -14,6 +18,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* xx服务实现类
*
@ -30,11 +37,30 @@ public class CurrTaskDetServiceImpl extends BaseService implements CurrTaskDetSe
@Override
public PageVo<OrderInfoTaskDetVo> getCurrOrderCurrTask(OrderInfoTaskDetParam param) {
QueryWrapper<CurrTaskDet> queryWrapper = new QueryWrapper<CurrTaskDet>();
QueryWrapper<CurrTaskDet> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(CurrTaskDet.IDEN_CARD_NUM,param.getIdenCardNum())
.eq(CurrTaskDet.ORDER_NO,param.getOrderNo())
.eq(CurrTaskDet.VALID,1);
Page<CurrTaskDet> page = currTaskDetServiceBiz.page(new Page<>(param.getCurrent(), param.getSize()), queryWrapper);
return new PageVo<>(page, OrderInfoTaskDetVo.class);
}
@Override
public void createFirstTaskDet(List<TaskCreateDetParam> taskDet, Long taskId) {
List<CurrTaskDet> params = BeanUtils.copyList(taskDet, CurrTaskDet.class);
params.forEach(param->{
param.setCurrTaskId(taskId);
setCommonField(param);
});
currTaskDetServiceBiz.saveBatch(params);
}
@Override
public R<PageVo<CurrTaskDetVo>> getTaskDetailsPage(CurrTaskDetQueryParam currTaskId) {
QueryWrapper<CurrTaskDet> queryWrapper = new QueryWrapper<>();
queryWrapper.eq(CurrTaskDet.CURR_TASK_ID,currTaskId.getCurrTaskId())
.eq(CurrTaskDet.VALID,1);
Page<CurrTaskDet> page = currTaskDetServiceBiz.page(new Page<>(currTaskId.getCurrent(), currTaskId.getSize()), queryWrapper);
return successful(new PageVo<>(page, CurrTaskDetVo.class));
}
}

View File

@ -1,8 +1,25 @@
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.service.CurrTaskServiceBiz;
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.enums.TaskTypeEnum;
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.vo.CurrTaskQueryVo;
import com.mt.wms.empty.vo.CurrTaskVo;
import org.apache.commons.codec.net.QCodec;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -21,4 +38,37 @@ public class CurrTaskServiceImpl extends BaseService implements CurrTaskService
@Autowired
CurrTaskServiceBiz currTaskServiceBiz;
@Autowired
CurrTaskDetService currTaskDetService;
@Override
public CurrTaskVo getCurrTask(IdParam idParam) {
CurrTask byId = currTaskServiceBiz.getById(idParam.getId());
CurrTaskVo build = CurrTaskVo.builder().build();
BeanUtils.copyProperties(byId,build);
return build;
}
@Override
public R<IdVo> createFirstTask(TaskCreateParam param) {
CurrTask currTask = new CurrTask();
currTask.setStartPosition(param.getStartPosition());
currTask.setTargetPosition(param.getTargetPosition());
currTask.setKilnId(param.getKilnId());
currTask.setTaskType(TaskTypeEnum.WTK.getValue());
currTask.setPalletCode(param.getPalletCode());
currTask.setTaskSource(0);
setCommonField(currTask);
currTaskServiceBiz.save(currTask);
return successful(IdVo.builder().id(currTask.getId()).build());
}
@Override
public R<PageVo<CurrTaskQueryVo>> currentTaskPage(CurrTaskQueryParam param) {
QueryWrapper<CurrTask> currTaskQueryWrapper= new QueryWrapper<>();
currTaskQueryWrapper.eq(StringUtils.isNotBlank(param.getVehicleId()),CurrTask.VEHICLE_ID,param.getVehicleId());
currTaskQueryWrapper.eq(CurrTask.VALID,1);
Page<CurrTask> page = currTaskServiceBiz.page(new Page<>(param.getCurrent(), param.getSize()), currTaskQueryWrapper);
return successful(new PageVo<>(page,CurrTaskQueryVo.class));
}
}

View File

@ -46,7 +46,7 @@ public class CurrTaskDetVo extends BaseVo implements PageVo.ConvertVo {
* 当前任务id关联当前任务表t_curr_task
*/
@ApiModelProperty("当前任务id")
private Integer currTaskId;
private Long currTaskId;
/**
* 重量手动输入
*/

View File

@ -0,0 +1,70 @@
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 CurrTaskQueryVo 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;
}

View File

@ -0,0 +1,115 @@
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 CurrTaskVo extends BaseVo implements PageVo.ConvertVo {
@ApiModelProperty(value = "id")
private Long id;
/**
* 状态 0等待执行1执行中2执行完成3追加后完成追加后就按完成来算
*/
@ApiModelProperty("状态")
private Integer status;
/**
* 内部编码系统自动生成
*/
@ApiModelProperty("内部编码")
private String interCode;
/**
* 任务编码, 查看任务编码规则
*/
@ApiModelProperty("任务编码")
private String taskCode;
/**
* 任务来源, 暂时只有人工
*/
@ApiModelProperty("任务来源")
private String taskSource;
/**
* 任务类型0:入库到窑炉1:入库到缓存区2出库到 窑炉到缓存区3缓存区出库
*/
@ApiModelProperty("任务类型")
private Integer taskType;
/**
* 托盘编码
*/
@ApiModelProperty("托盘编码")
private String palletCode;
/**
* 发起任务时间
*/
@ApiModelProperty("发起时间")
private LocalDateTime createTime;
/**
* 缓存前开始时间车辆开始执行
*/
@ApiModelProperty("任务开始")
private LocalDateTime aBeginTime;
/**
* 完成当前任务时间可能是到缓存区有可能直接到窑炉车辆放完货物到缓存区收到的时间
*/
@ApiModelProperty("任务结束")
private LocalDateTime aEndTime;
/**
* 开始位置
*/
@ApiModelProperty("开始位置")
private String startPosition;
/**
* 目标位置指的是窑炉的位置
*/
@ApiModelProperty("窑炉位置")
private String targetPosition;
/**
* 目标窑炉id
*/
@ApiModelProperty("目标窑炉id")
private Long kilnId;
/**
* 车辆id关联车辆表t_vehicle_info
*/
@ApiModelProperty("车辆id")
private Long vehicleId;
/**
* 库位id关联库位表t_location
*/
@ApiModelProperty("location_id")
private Integer locationId;
/**
* 库位名称
*/
@ApiModelProperty("location_name")
private String locationName;
}