package com.zy.asrs.entity;
|
|
import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId;
|
import com.baomidou.mybatisplus.enums.IdType;
|
import com.baomidou.mybatisplus.annotations.TableField;
|
import java.text.SimpleDateFormat;
|
import java.util.Date;
|
|
import com.zy.core.enums.CommandType;
|
import org.springframework.format.annotation.DateTimeFormat;
|
|
import io.swagger.annotations.ApiModelProperty;
|
import lombok.Data;
|
import com.baomidou.mybatisplus.annotations.TableName;
|
import java.io.Serializable;
|
|
@Data
|
@TableName("\"SOURCE\".\"wcs_command_info\"")
|
public class CommandInfo implements Serializable {
|
|
private static final long serialVersionUID = 1L;
|
|
@ApiModelProperty(value= "")
|
@TableId(value = "ID", type = IdType.AUTO)
|
private Integer id;
|
|
/**
|
* 工作号
|
*/
|
@ApiModelProperty(value= "工作号")
|
@TableField("WRK_NO")
|
private Integer wrkNo;
|
|
/**
|
* WMS任务号
|
*/
|
@ApiModelProperty(value= "任务号")
|
@TableField("TASK_NO")
|
private String taskNo;
|
|
/**
|
* 指令类型{1:创建,2:执行,3:完成}
|
*/
|
@ApiModelProperty(value= "指令状态")
|
@TableField("COMMAND_STATUS")
|
private Integer commandStatus;
|
|
/**
|
* 开始时间
|
*/
|
@ApiModelProperty(value= "开始时间")
|
@TableField("START_TIME")
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
private Date startTime;
|
|
/**
|
* 指令类型
|
*/
|
@ApiModelProperty(value= "指令类型")
|
@TableField("COMMAND_TYPE")
|
private Integer commandType;
|
|
/**
|
* 设备
|
*/
|
@ApiModelProperty(value= "设备")
|
@TableField("DEVICE")
|
private String device;
|
|
/**
|
* 设备执行信息
|
*/
|
@ApiModelProperty(value= "设备执行信息")
|
@TableField("DEVICE_LOG")
|
private String deviceLog;
|
|
/**
|
* 命令描述
|
*/
|
@ApiModelProperty(value= "命令描述")
|
@TableField("COMMAND_DESC")
|
private String commandDesc;
|
|
/**
|
* 命令JSON
|
*/
|
@ApiModelProperty(value= "命令JSON")
|
@TableField("COMMAND")
|
private String command;
|
|
/**
|
* 执行时间
|
*/
|
@ApiModelProperty(value= "执行时间")
|
@TableField("EXECUTE_TIME")
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
private Date executeTime;
|
|
/**
|
* 完成时间
|
*/
|
@ApiModelProperty(value= "完成时间")
|
@TableField("COMPLETE_TIME")
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
private Date completeTime;
|
|
public CommandInfo() {}
|
|
public CommandInfo(Integer id, Integer wrkNo, String taskNo, Integer commandStatus, Date startTime, Integer commandType, String device, String deviceLog, String commandDesc, String command, Date executeTime, Date completeTime) {
|
this.id = id;
|
this.wrkNo = wrkNo;
|
this.taskNo = taskNo;
|
this.commandStatus = commandStatus;
|
this.startTime = startTime;
|
this.commandType = commandType;
|
this.device = device;
|
this.deviceLog = deviceLog;
|
this.commandDesc = commandDesc;
|
this.command = command;
|
this.executeTime = executeTime;
|
this.completeTime = completeTime;
|
}
|
|
public String getStartTime$(){
|
if (Cools.isEmpty(this.startTime)){
|
return "";
|
}
|
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.startTime);
|
}
|
|
public String getExecuteTime$(){
|
if (Cools.isEmpty(this.executeTime)){
|
return "";
|
}
|
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.executeTime);
|
}
|
|
public String getCompleteTime$(){
|
if (Cools.isEmpty(this.completeTime)){
|
return "";
|
}
|
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.completeTime);
|
}
|
|
/**
|
* 获取持续时间
|
*/
|
public String getDurationTime() {
|
if (Cools.isEmpty(this.startTime)) {
|
return "";
|
}
|
|
Date endDate = new Date();
|
if (!Cools.isEmpty(this.completeTime)) {
|
endDate = this.completeTime;
|
}
|
|
//用来获取两个时间相差的毫秒数
|
long l = this.startTime.getTime() - endDate.getTime();
|
|
//分别计算相差的天、小时、分、秒
|
long day = l / (24 * 60 * 60 * 1000);
|
long hour = (l / (60 * 60 * 1000) - day * 24);
|
long min = ((l / (60 * 1000)) - day * 24 * 60 - hour * 60);
|
long s = (l / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60);
|
|
return Math.abs(day) + "天" + Math.abs(hour) + "小时" + Math.abs(min) + "分" + Math.abs(s) + "秒";
|
}
|
|
public String getCommandStatus$() {
|
if (Cools.isEmpty(this.commandStatus)) {
|
return "";
|
}
|
|
switch (this.commandStatus) {
|
case 1:
|
return "创建";
|
case 2:
|
return "执行";
|
case 3:
|
return "完成";
|
default:
|
return "";
|
}
|
}
|
|
public String getCommandType$() {
|
if (Cools.isEmpty(this.commandType)) {
|
return "";
|
}
|
return CommandType.get(this.commandType).desc;
|
}
|
|
|
}
|