自动化立体仓库 - WCS系统
#
LSH
2023-12-22 7381c3f093f3b98d169f5f75b05bb8f01a9e799a
src/main/java/com/zy/asrs/entity/CommandInfoLog.java
@@ -5,6 +5,8 @@
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 java.text.SimpleDateFormat;
import java.util.Date;
@@ -187,5 +189,37 @@
        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 getCommandType$() {
        if (Cools.isEmpty(this.commandType)) {
            return "";
        }
        return CommandType.get(this.commandType).desc;
    }
}