订单相关的内容 apms推送订单,订单详情,人工订单等

This commit is contained in:
徐晨晨 2021-11-09 10:57:01 +08:00
parent c94c5d1c98
commit 42789b0d58
10 changed files with 782 additions and 0 deletions

View File

@ -0,0 +1,65 @@
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.params.IdParam;
import com.mt.wms.core.validator.groups.PageGroup;
import com.mt.wms.core.vo.PageVo;
import com.mt.wms.core.vo.R;
import com.mt.wms.empty.params.OrderParamForApms;
import com.mt.wms.empty.params.OrderInfoBasePageParam;
import com.mt.wms.empty.params.OrderInfoPersonCreateParam;
import com.mt.wms.empty.params.OrderInfoTaskDetParam;
import com.mt.wms.empty.service.OrderInfoService;
import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
import com.mt.wms.empty.vo.OrderInfoVo;
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.*;
import javax.validation.groups.Default;
/**
* @author xcc
* @date 2021年11月8日
* @since 1.0
*/
@RestController
@RequestMapping(CommonConstant.API_MODULE_BASE + "orderInfo")
@Slf4j
@Api(value = "订单管理", tags = "订单管理", hidden = false)
public class OrderInfoController extends BaseController {
@Autowired
private OrderInfoService orderInfoService;
@PostMapping(value = "apmsPostOrder")
@ApiOperation(value = "接收apms推送订单信息")
private R apmsPostOrder(@Validated @RequestBody OrderParamForApms apmsPostOrderParam) {
return orderInfoService.apmsPostOrder(apmsPostOrderParam);
}
@PostMapping(value = "page")
@ApiOperation(value = "获取分页报警基础信息")
private R<PageVo<OrderInfoVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody OrderInfoBasePageParam orderBaseParam) {
return orderInfoService.page(orderBaseParam);
}
@PostMapping(value = "personCreateOrder")
@ApiOperation(value = "人工创建订单信息")
private R personCreateOrder(@Validated({Default.class}) @RequestBody OrderInfoPersonCreateParam orderInfoPersonCreateParam) {
return orderInfoService.personCreateOrder(orderInfoPersonCreateParam);
}
@PostMapping(value = "get")
@ApiOperation(value = "当前订单查看详情")
private R<OrderInfoVo> get(@Validated @RequestBody IdParam idParam) {
return orderInfoService.getOne(idParam);
}
@PostMapping(value = "getTaskInfo")
@ApiOperation(value = "当前订单任务详情")
private R<PageVo<OrderInfoTaskDetVo>> getTaskInfo(@Validated @RequestBody OrderInfoTaskDetParam orderInfoTaskDetParam) {
return orderInfoService.getTaskInfo(orderInfoTaskDetParam);
}
}

View File

@ -0,0 +1,63 @@
/*
* 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 OrderSourceEnum implements IEnum<Integer> {
/**
* APMS
*/
APMS(1, "APMS"),
/**
* 人工
*/
PERSON(2, "人工");
private final Integer value;
private final String label;
private final String remark;
OrderSourceEnum(final Integer value, final String label) {
this(value, label, null);
}
OrderSourceEnum(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,37 @@
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月8日
* @since 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "order查询列表", description = "order查询列表")
public class OrderInfoBasePageParam extends BasePageParam {
private static final long serialVersionUID = 1L;
/**
* 订单号APMS系统获取
*/
@ApiModelProperty(value = "订单号", required = false)
private String orderNo;
/**
* 标识卡号APMS系统获取
*/
@ApiModelProperty(value = "标识卡号", required = false)
private String idenCardNum;
}

View File

@ -0,0 +1,96 @@
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月8日
* @since 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "order人工创建", description = "order人工创建")
public class OrderInfoPersonCreateParam extends BaseParam {
private static final long serialVersionUID = 1L;
/**
* 编码人工创建
*/
@ApiModelProperty(value = "编码")
private String code;
/**
* 订单号人工创建
*/
@ApiModelProperty(value = "订单号", required = true)
private String orderNo;
/**
* 标识卡号人工创建
*/
@ApiModelProperty(value = "标识卡号", required = true)
private String idenCardNum;
/**
* 客户编码 人工创建
*/
@ApiModelProperty(value = "客户编码")
private String customerNo;
/**
* 客户名称 人工创建
*/
@ApiModelProperty(value = "客户名称")
private String customerName;
/**
* 产品名称 人工创建
*/
@ApiModelProperty(value = "产品名称")
private String productName;
/**
* 产品型号 人工创建
*/
@ApiModelProperty(value = "产品型号")
private String productModel;
/**
* 材料牌号 人工创建
*/
@ApiModelProperty(value = "材料牌号")
private String materialDes;
/**
* 工艺要求 人工创建
*/
@ApiModelProperty(value = "工艺要求")
private String craftIll;
/**
* 单位
*/
@ApiModelProperty(value = "单位")
private String unit;
/**
* 重量
*/
@ApiModelProperty(value = "重量")
private Float weight;
/**
* 数量
*/
@ApiModelProperty(value = "数量")
private Float quantity;
}

View File

@ -0,0 +1,35 @@
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月8日
* @since 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "当前任务订单详情", description = "当前任务订单详情")
public class OrderInfoTaskDetParam extends BasePageParam {
private static final long serialVersionUID = 1L;
/**
* 订单号
*/
@ApiModelProperty(value = "订单号", required = true)
private String orderNo;
/**
* 标识卡号
*/
@ApiModelProperty(value = "标识卡号", required = true)
private String idenCardNum;
}

View File

@ -0,0 +1,70 @@
package com.mt.wms.empty.params;
import com.mt.wms.core.base.BaseParam;
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月8日
* @since 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "apms订单对象", description = "用于推送新的订单信息")
public class OrderParamForApms extends BaseParam {
private static final long serialVersionUID = 1L;
/**
* 订单号APMS系统获取
*/
@ApiModelProperty(value = "订单号", required = true)
private String orderNo;
/**
* 标识卡号APMS系统获取
*/
@ApiModelProperty(value = "标识卡号", required = true)
private String idenCardNum;
/**
* 客户编码 APMS系统获取
*/
@ApiModelProperty(value = "客户编码")
private String customerNo;
/**
* 客户名称 APMS系统获取
*/
@ApiModelProperty(value = "客户名称")
private String customerName;
/**
* 产品名称 APMS系统获取
*/
@ApiModelProperty(value = "产品名称")
private String productName;
/**
* 产品型号 APMS系统获取
*/
@ApiModelProperty(value = "产品型号")
private String productModel;
/**
* 材料牌号 APMS系统获取
*/
@ApiModelProperty(value = "材料牌号")
private String materialDes;
/**
* 工艺要求 APMS系统获取
*/
@ApiModelProperty(value = "工艺要求")
private String craftIll;
}

View File

@ -0,0 +1,56 @@
package com.mt.wms.empty.service;
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.OrderParamForApms;
import com.mt.wms.empty.params.OrderInfoBasePageParam;
import com.mt.wms.empty.params.OrderInfoPersonCreateParam;
import com.mt.wms.empty.params.OrderInfoTaskDetParam;
import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
import com.mt.wms.empty.vo.OrderInfoVo;
/**
* 订单相关服务
*
* @author xcc
* @date 2021年11月8日
* @since 1.0
*/
public interface OrderInfoService {
/**
* APMS推送订单
*
* @param apmsPostOrderParam 订单参数
* @return 操作结果
*/
R apmsPostOrder(OrderParamForApms apmsPostOrderParam);
/**
* 查询当前订单列表
*
* @param orderInfoBasePageParam 查询参数
* @return 分页结果集
*/
R<PageVo<OrderInfoVo>> page(OrderInfoBasePageParam orderInfoBasePageParam);
/**
* 人工创建订单
*
* @param orderInfoPersonCreateParam 人工订单参数
* @return 结果
*/
R personCreateOrder(OrderInfoPersonCreateParam orderInfoPersonCreateParam);
/**
* 获取详细单条信息
*
* @param idParam id主键
* @return 结果
*/
R<OrderInfoVo> getOne(IdParam idParam);
/**
*
* @param orderInfoTaskDetParam 标识卡号与订单号
* @return 结果
*/
R<PageVo<OrderInfoTaskDetVo>> getTaskInfo(OrderInfoTaskDetParam orderInfoTaskDetParam);
}

View File

@ -0,0 +1,106 @@
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.OrderInfo;
import com.mt.wms.core.dal.service.OrderInfoServiceBiz;
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.enums.OrderSourceEnum;
import com.mt.wms.empty.params.OrderParamForApms;
import com.mt.wms.empty.params.OrderInfoBasePageParam;
import com.mt.wms.empty.params.OrderInfoPersonCreateParam;
import com.mt.wms.empty.params.OrderInfoTaskDetParam;
import com.mt.wms.empty.service.CurrTaskDetService;
import com.mt.wms.empty.service.OrderInfoService;
import com.mt.wms.empty.vo.OrderInfoTaskDetVo;
import com.mt.wms.empty.vo.OrderInfoVo;
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;
/**
* xx服务实现类
*
* @author xcc
* @date 2021年11月8日
* @since 1.0
*/
@Service
@Transactional
public class OrderInfoServiceImpl extends BaseService implements OrderInfoService {
@Autowired
OrderInfoServiceBiz orderInfoService;
@Autowired
CurrTaskDetService currTaskDetService;
@Override
public R apmsPostOrder(OrderParamForApms apmsPostOrderParam) {
OrderInfo orderInfo = new OrderInfo();
BeanUtils.copyProperties(apmsPostOrderParam,orderInfo);
setCommonField(orderInfo);
//设定来源信息为apms
orderInfo.setOrderSource(OrderSourceEnum.APMS.getValue());
orderInfo.setInterCode("APMS"+System.currentTimeMillis());
orderInfoService.save(orderInfo);
//todo 记录通讯日志信息
return successful("Wms接收Apms订单成功。");
}
@Override
public R<PageVo<OrderInfoVo>> page(OrderInfoBasePageParam param) {
QueryWrapper<OrderInfo> wrapper=new QueryWrapper<>();
wrapper.like(StringUtils.isNotBlank(param.getIdenCardNum()),OrderInfo.IDEN_CARD_NUM, param.getIdenCardNum())
.like(StringUtils.isNotBlank(param.getOrderNo()),OrderInfo.ORDER_NO, param.getOrderNo())
.eq(OrderInfo.VALID,1)
.orderByDesc(OrderInfo.CREATE_TIME);
Page<OrderInfo> page = orderInfoService.page(new Page<>(param.getCurrent(), param.getSize()), wrapper);
return successful(new PageVo<>(page,OrderInfoVo.class));
}
@Override
public R personCreateOrder(OrderInfoPersonCreateParam orderInfoPersonCreateParam) {
OrderInfo orderInfo = new OrderInfo();
BeanUtils.copyProperties(orderInfoPersonCreateParam,orderInfo);
setCommonField(orderInfo);
//设定来源信息为人工
orderInfo.setOrderSource(OrderSourceEnum.PERSON.getValue());
orderInfo.setInterCode("PERSONAL"+System.currentTimeMillis());
orderInfoService.save(orderInfo);
return successful("人工创建订单成功。");
}
@Override
public R<OrderInfoVo> getOne(IdParam idParam) {
OrderInfo byId = orderInfoService.getById(idParam.getId());
OrderInfoVo build = OrderInfoVo.builder().build();
BeanUtils.copyProperties(byId,build);
return successful(build);
}
/**
* todo 获取详细的拆分任务信息
*/
@Override
public R<PageVo<OrderInfoTaskDetVo>> getTaskInfo(OrderInfoTaskDetParam param) {
//从任务详细中获取该标识卡和订单的所有订单
PageVo<OrderInfoTaskDetVo> currOrderCurrTask = currTaskDetService.getCurrOrderCurrTask(param);
//获取车辆信息
//获取库位信息
//获取窑炉信息
currOrderCurrTask.getRecords().forEach(orderInfo ->
{
}
);
return null;
}
}

View File

@ -0,0 +1,94 @@
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 OrderInfoTaskDetVo extends BaseVo implements PageVo.ConvertVo {
/**
* 主键自增
*/
@ApiModelProperty(value = "主键")
private Long id;
/**
* 任务编码, 查看任务编码规则
*/
@ApiModelProperty(value = "任务编码")
private String taskCode;
/**
* 缓存前开始时间车辆开始执行
*/
@ApiModelProperty(value = "缓存前开始时间")
private LocalDateTime aBeginTime;
/**
* 完成当前任务时间可能是到缓存区有可能直接到窑炉车辆放完货物到缓存区收到的时间
*/
@ApiModelProperty(value = "完成当前任务时间")
private LocalDateTime aEndTime;
/**
* 任务类型0:入库到窑炉1:入库到缓存区2出库到窑炉到缓存区3缓存区出库
*/
@ApiModelProperty(value = "任务类型")
private Integer taskType;
/**
* 状态 0等待执行1执行中2执行完成3追加后完成追加后就按完成来算
*/
@ApiModelProperty(value = "状态")
private Integer status;
/**
* 开始位置
*/
@ApiModelProperty(value = "开始位置")
private String startPosition;
/**
* 目标位置
*/
@ApiModelProperty(value = "目标位置")
private String targetPosition;
/**
* 车辆名称
*/
@ApiModelProperty(value = "车辆名称")
private String vehicleName;
/**
* 加工炉名称
*/
@ApiModelProperty(value = "加工炉名称")
private String kilnName;
/**
* 加工数量
*/
@ApiModelProperty(value = "加工数量")
private Float quantity;
/**
* 重量
*/
@ApiModelProperty(value = "重量")
private Float weight;
}

View File

@ -0,0 +1,160 @@
package com.mt.wms.empty.vo;
import com.baomidou.mybatisplus.annotation.*;
import com.mt.wms.core.base.BaseVo;
import com.mt.wms.core.base.ITree;
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 javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;
/**
*
* @author xcc
* @date 2021年11月8日
* @since 1.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Builder
@ApiModel(value = "订单视图对象", description = "用于返回订单信息")
public class OrderInfoVo extends BaseVo implements PageVo.ConvertVo {
/**
* 主键自增
*/
@ApiModelProperty(value = "主键")
private Long id;
/**
* 来源1.APMS 2.人工输入
*/
@ApiModelProperty(value = "订单来源")
private Integer orderSource;
/**
* 删除标志是否有效:1 可用 0不可用2停止
*/
@ApiModelProperty(value = "删除标志")
private Integer valid;
/**
* 添加时间每次修改记录要更新记录新增时间
*/
@ApiModelProperty(value = "添加时间")
private LocalDateTime createTime;
/**
* 创建人id
*/
@ApiModelProperty(value = "创建人id")
private Integer creatorId;
/**
* 更新人id
*/
@ApiModelProperty(value = "更新人id")
private Integer updaterId;
/**
* 修改时间更具修改时间来判断下次执行顺序第一次修改时间和新增时间相同
*/
@ApiModelProperty(value = "修改时间")
private LocalDateTime updateTime;
/**
* 版本号 默认为 1
*/
@ApiModelProperty(value = "版本号")
@Version
private String version;
/**
* 状态 0等待执行1执行中2执行完成3追加后完成追加后就按完成来算
*/
@ApiModelProperty(value = "状态")
private Integer status;
/**
* 内部编码系统自动生成
*/
@ApiModelProperty(value = "内部编码")
private String interCode;
/**
* 编码
*/
@ApiModelProperty(value = "编码")
private String code;
/**
* 订单号APMS系统获取
*/
@ApiModelProperty(value = "订单号")
private String orderNo;
/**
* 标识卡号APMS系统获取
*/
@ApiModelProperty(value = "标识卡号")
private String idenCardNum;
/**
* 客户编码 APMS系统获取
*/
@ApiModelProperty(value = "客户编码")
private String customerNo;
/**
* 客户名称 APMS系统获取
*/
@ApiModelProperty(value = "客户名称")
private String customerName;
/**
* 产品名称 APMS系统获取
*/
@ApiModelProperty(value = "产品名称")
private String productName;
/**
* 产品型号 APMS系统获取
*/
@ApiModelProperty(value = "产品型号")
private String productModel;
/**
* 材料牌号 APMS系统获取
*/
@ApiModelProperty(value = "材料牌号")
private String materialDes;
/**
* 工艺要求 APMS系统获取
*/
@ApiModelProperty(value = "工艺要求")
private String craftIll;
/**
* 单位
*/
@ApiModelProperty(value = "单位")
private String unit;
/**
* 重量
*/
@ApiModelProperty(value = "重量")
private Float weight;
/**
* 数量
*/
@ApiModelProperty(value = "数量")
private Float quantity;
}