y_ys79
2024-01-11 a0007e7a8529d2388f96309af791dc8b997785db
整理代码
已修改4个文件
471 ■■■■■ 文件已修改
mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/MachiningData.java 407 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/listener/MdcListener.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/statistic/MdcStatisticThread.java 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/utils/TimestampUtil.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/domain/MachiningData.java
@@ -44,726 +44,327 @@
    /**
     * operation mode(JOG:0<=X<100;MDA:100<=X<200;AUTO:200<=X<300;REF:300<=X<400;other:9000<=X<=9999)
     */
    //@Column(name = "op_mode")
    private Integer opMode;
    /**
     * 主轴转速
     */
    //@Column(name = "spindle_speed")
    private Integer spindleSpeed;
    /**
     * 主轴倍率
     */
    //@Column(name = "spindle_override")
    private Integer spindleOverride;
    /**
     * 主轴负载
     */
    //@Column(name = "spindle_load")
    private Integer spindleLoad;
    /**
     * 进给倍率
     */
    //@Column(name = "feedrate_override")
    private Integer feedrateOverride;
    /**
     * 进给率
     */
    //@Column(name = "feed_rate")
    private Integer feedRate;
    /**
     * 快速进给倍率 G00的倍率
     */
    //@Column(name = "rapid_feed_override")
    private Integer rapidFeedOverride;
    /**
     * 快速进给
     */
    //@Column(name = "rapid_feed")
    private Integer rapidFeed;
    /**
     * 程序名称
     */
    //@Column(name = "prog_name")
    private String progName;
    /**
     * program block
     */
    //@Column(name = "prog_block")
    private String progBlock;
    /**
     * 报警编号
     */
    //@Column(name = "alarm_no")
    private String alarmNo;
    /**
     * alarm message
     */
   // @Column(name = "alarm_msg")
    private String alarmMsg;
    /**
     * 刀具编号
     */
    //@Column(name = "tool_no")
    private Integer toolNo;
    /**
     * 刀具名称
     */
    //@Column(name = "tool_name")
    private String toolName;
    /**
     * operation id
     */
    //@Column(name = "oper_id")
    private Integer operId;
    /**
     * axis names
     */
    //@Column(name = "axis_names")
    private String axisNames;
    /**
     * 轴 绝对坐标
     */
    //@Column(name = "axis_absolute")
    private String axisAbsolute;
    /**
     * 轴 相对坐标
     */
    //@Column(name = "axis_relative")
    private String axisRelative;
    /**
     * 轴伺服负载
     */
    //@Column(name = "axis_servoloads")
    private String axisServoloads;
    /**
     * is maintain: 1/0
     */
    //@Column(name = "is_maintain")
    private Boolean isMaintain;
    /**
     * is part complete
     */
    //@Column(name = "is_part_complete")
    private Boolean isPartComplete;
    private static final long serialVersionUID = 1L;
    /**
     * 获取primary key
     *
     * @return id - primary key
     */
    public Long getId() {
        return id;
    }
    /**
     * 设置primary key
     *
     * @param id primary key
     */
    public void setId(Long id) {
        this.id = id;
    }
    /**
     * 获取machine id
     *
     * @return machine_id - machine id
     */
    public Integer getMachineId() {
        return machineId;
    }
    /**
     * 设置machine id
     *
     * @param machineId machine id
     */
    public void setMachineId(Integer machineId) {
        this.machineId = machineId;
    }
    /**
     * 获取mdc time
     *
     * @return mdc_time - mdc time
     */
    public Integer getMdcTime() {
        return mdcTime;
    }
    /**
     * 设置mdc time
     *
     * @param mdcTime mdc time
     */
    public void setMdcTime(Integer mdcTime) {
        this.mdcTime = mdcTime;
    }
    /**
     * 获取update time
     *
     * @return update_time - update time
     */
    public Integer getUpdateTime() {
        return updateTime;
    }
    /**
     * 设置update time
     *
     * @param updateTime update time
     */
    public void setUpdateTime(Integer updateTime) {
        this.updateTime = updateTime;
    }
    /**
     * 获取machine state
     *
     * @return state - machine state
     */
    public String getState() {
        return state;
    }
    /**
     * 设置machine state
     *
     * @param state machine state
     */
    public void setState(String state) {
        this.state = state;
    }
    /**
     * 获取machine mode: auto/manual
     *
     * @return mode - machine mode: auto/manual
     */
    public String getMode() {
        return mode;
    }
    /**
     * 设置machine mode: auto/manual
     *
     * @param mode machine mode: auto/manual
     */
    public void setMode(String mode) {
        this.mode = mode;
    }
    /**
     * 获取operation mode(JOG:0<=X<100;MDA:100<=X<200;AUTO:200<=X<300;REF:300<=X<400;other:9000<=X<=9999)
     *
     * @return op_mode - operation mode(JOG:0<=X<100;MDA:100<=X<200;AUTO:200<=X<300;REF:300<=X<400;other:9000<=X<=9999)
     */
    public Integer getOpMode() {
        return opMode;
    }
    /**
     * 设置operation mode(JOG:0<=X<100;MDA:100<=X<200;AUTO:200<=X<300;REF:300<=X<400;other:9000<=X<=9999)
     *
     * @param opMode operation mode(JOG:0<=X<100;MDA:100<=X<200;AUTO:200<=X<300;REF:300<=X<400;other:9000<=X<=9999)
     */
    public void setOpMode(Integer opMode) {
        this.opMode = opMode;
    }
    /**
     * 获取spindle speed
     *
     * @return spindle_speed - spindle speed
     */
    public Integer getSpindleSpeed() {
        return spindleSpeed;
    }
    /**
     * 设置spindle speed
     *
     * @param spindleSpeed spindle speed
     */
    public void setSpindleSpeed(Integer spindleSpeed) {
        this.spindleSpeed = spindleSpeed;
    }
    /**
     * 获取spindle override
     *
     * @return spindle_override - spindle override
     */
    public Integer getSpindleOverride() {
        return spindleOverride;
    }
    /**
     * 设置spindle override
     *
     * @param spindleOverride spindle override
     */
    public void setSpindleOverride(Integer spindleOverride) {
        this.spindleOverride = spindleOverride;
    }
    /**
     * 获取spindle load
     *
     * @return spindle_load - spindle load
     */
    public Integer getSpindleLoad() {
        return spindleLoad;
    }
    /**
     * 设置spindle load
     *
     * @param spindleLoad spindle load
     */
    public void setSpindleLoad(Integer spindleLoad) {
        this.spindleLoad = spindleLoad;
    }
    /**
     * 获取feedrate override
     *
     * @return feedrate_override - feedrate override
     */
    public Integer getFeedrateOverride() {
        return feedrateOverride;
    }
    /**
     * 设置feedrate override
     *
     * @param feedrateOverride feedrate override
     */
    public void setFeedrateOverride(Integer feedrateOverride) {
        this.feedrateOverride = feedrateOverride;
    }
    /**
     * 获取feed rate
     *
     * @return feed_rate - feed rate
     */
    public Integer getFeedRate() {
        return feedRate;
    }
    /**
     * 设置feed rate
     *
     * @param feedRate feed rate
     */
    public void setFeedRate(Integer feedRate) {
        this.feedRate = feedRate;
    }
    /**
     * 获取rapid feed override
     *
     * @return rapid_feed_override - rapid feed override
     */
    public Integer getRapidFeedOverride() {
        return rapidFeedOverride;
    }
    /**
     * 设置rapid feed override
     *
     * @param rapidFeedOverride rapid feed override
     */
    public void setRapidFeedOverride(Integer rapidFeedOverride) {
        this.rapidFeedOverride = rapidFeedOverride;
    }
    /**
     * 获取rapid feed
     *
     * @return rapid_feed - rapid feed
     */
    public Integer getRapidFeed() {
        return rapidFeed;
    }
    /**
     * 设置rapid feed
     *
     * @param rapidFeed rapid feed
     */
    public void setRapidFeed(Integer rapidFeed) {
        this.rapidFeed = rapidFeed;
    }
    /**
     * 获取program name
     *
     * @return prog_name - program name
     */
    public String getProgName() {
        return progName;
    }
    /**
     * 设置program name
     *
     * @param progName program name
     */
    public void setProgName(String progName) {
        this.progName = progName;
    }
    /**
     * 获取program block
     *
     * @return prog_block - program block
     */
    public String getProgBlock() {
        return progBlock;
    }
    /**
     * 设置program block
     *
     * @param progBlock program block
     */
    public void setProgBlock(String progBlock) {
        this.progBlock = progBlock;
    }
    /**
     * 获取alarm number
     *
     * @return alarm_no - alarm number
     */
    public String getAlarmNo() {
        return alarmNo;
    }
    /**
     * 设置alarm number
     *
     * @param alarmNo alarm number
     */
    public void setAlarmNo(String alarmNo) {
        this.alarmNo = alarmNo;
    }
    /**
     * 获取alarm message
     *
     * @return alarm_msg - alarm message
     */
    public String getAlarmMsg() {
        return alarmMsg;
    }
    /**
     * 设置alarm message
     *
     * @param alarmMsg alarm message
     */
    public void setAlarmMsg(String alarmMsg) {
        this.alarmMsg = alarmMsg;
    }
    /**
     * 获取tool number
     *
     * @return tool_no - tool number
     */
    public Integer getToolNo() {
        return toolNo;
    }
    /**
     * 设置tool number
     *
     * @param toolNo tool number
     */
    public void setToolNo(Integer toolNo) {
        this.toolNo = toolNo;
    }
    /**
     * 获取tool name
     *
     * @return tool_name - tool name
     */
    public String getToolName() {
        return toolName;
    }
    /**
     * 设置tool name
     *
     * @param toolName tool name
     */
    public void setToolName(String toolName) {
        this.toolName = toolName;
    }
    /**
     * 获取operation id
     *
     * @return oper_id - operation id
     */
    public Integer getOperId() {
        return operId;
    }
    /**
     * 设置operation id
     *
     * @param operId operation id
     */
    public void setOperId(Integer operId) {
        this.operId = operId;
    }
    /**
     * 获取axis names
     *
     * @return axis_names - axis names
     */
    public String getAxisNames() {
        return axisNames;
    }
    /**
     * 设置axis names
     *
     * @param axisNames axis names
     */
    public void setAxisNames(String axisNames) {
        this.axisNames = axisNames;
    }
    /**
     * 获取axis absolute
     *
     * @return axis_absolute - axis absolute
     */
    public String getAxisAbsolute() {
        return axisAbsolute;
    }
    /**
     * 设置axis absolute
     *
     * @param axisAbsolute axis absolute
     */
    public void setAxisAbsolute(String axisAbsolute) {
        this.axisAbsolute = axisAbsolute;
    }
    /**
     * 获取axis relative
     *
     * @return axis_relative - axis relative
     */
    public String getAxisRelative() {
        return axisRelative;
    }
    /**
     * 设置axis relative
     *
     * @param axisRelative axis relative
     */
    public void setAxisRelative(String axisRelative) {
        this.axisRelative = axisRelative;
    }
    /**
     * 获取axis servoloads
     *
     * @return axis_servoloads - axis servoloads
     */
    public String getAxisServoloads() {
        return axisServoloads;
    }
    /**
     * 设置axis servoloads
     *
     * @param axisServoloads axis servoloads
     */
    public void setAxisServoloads(String axisServoloads) {
        this.axisServoloads = axisServoloads;
    }
    /**
     * 获取is maintain: 1/0
     *
     * @return is_maintain - is maintain: 1/0
     */
    public Boolean getIsMaintain() {
        return isMaintain;
    }
    /**
     * 设置is maintain: 1/0
     *
     * @param isMaintain is maintain: 1/0
     */
    public void setIsMaintain(Boolean isMaintain) {
        this.isMaintain = isMaintain;
    }
    /**
     * 获取is part complete
     *
     * @return isPartComplete - is part complete
     */
    public Boolean getIsPartComplete() {
        return isPartComplete;
    }
    /**
     * 设置is part complete
     *
     * @param isPartComplete is part complete
     */
    public void setIsPartComplete(Boolean isPartComplete) {
        this.isPartComplete = isPartComplete;
    }
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", machineId=").append(machineId);
        sb.append(", mdcTime=").append(mdcTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", state=").append(state);
        sb.append(", mode=").append(mode);
        sb.append(", opMode=").append(opMode);
        sb.append(", spindleSpeed=").append(spindleSpeed);
        sb.append(", spindleOverride=").append(spindleOverride);
        sb.append(", spindleLoad=").append(spindleLoad);
        sb.append(", feedrateOverride=").append(feedrateOverride);
        sb.append(", feedRate=").append(feedRate);
        sb.append(", rapidFeedOverride=").append(rapidFeedOverride);
        sb.append(", rapidFeed=").append(rapidFeed);
        sb.append(", progName=").append(progName);
        sb.append(", progBlock=").append(progBlock);
        sb.append(", alarmNo=").append(alarmNo);
        sb.append(", alarmMsg=").append(alarmMsg);
        sb.append(", toolNo=").append(toolNo);
        sb.append(", toolName=").append(toolName);
        sb.append(", operId=").append(operId);
        sb.append(", axisNames=").append(axisNames);
        sb.append(", axisAbsolute=").append(axisAbsolute);
        sb.append(", axisRelative=").append(axisRelative);
        sb.append(", axisServoloads=").append(axisServoloads);
        sb.append(", isMaintain=").append(isMaintain);
        sb.append(", isPartComplete=").append(isPartComplete);
        sb.append("]");
        return sb.toString();
    }
    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        MachiningData other = (MachiningData) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getMachineId() == null ? other.getMachineId() == null : this.getMachineId().equals(other.getMachineId()))
            && (this.getMdcTime() == null ? other.getMdcTime() == null : this.getMdcTime().equals(other.getMdcTime()))
//            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getState() == null ? other.getState() == null : this.getState().equals(other.getState()))
            && (this.getMode() == null ? other.getMode() == null : this.getMode().equals(other.getMode()))
            && (this.getOpMode() == null ? other.getOpMode() == null : this.getOpMode().equals(other.getOpMode()))
            && (this.getSpindleSpeed() == null ? other.getSpindleSpeed() == null : this.getSpindleSpeed().equals(other.getSpindleSpeed()))
            && (this.getSpindleOverride() == null ? other.getSpindleOverride() == null : this.getSpindleOverride().equals(other.getSpindleOverride()))
            && (this.getSpindleLoad() == null ? other.getSpindleLoad() == null : this.getSpindleLoad().equals(other.getSpindleLoad()))
            && (this.getFeedrateOverride() == null ? other.getFeedrateOverride() == null : this.getFeedrateOverride().equals(other.getFeedrateOverride()))
            && (this.getFeedRate() == null ? other.getFeedRate() == null : this.getFeedRate().equals(other.getFeedRate()))
            && (this.getRapidFeedOverride() == null ? other.getRapidFeedOverride() == null : this.getRapidFeedOverride().equals(other.getRapidFeedOverride()))
            && (this.getRapidFeed() == null ? other.getRapidFeed() == null : this.getRapidFeed().equals(other.getRapidFeed()))
            && (this.getProgName() == null ? other.getProgName() == null : this.getProgName().equals(other.getProgName()))
            && (this.getProgBlock() == null ? other.getProgBlock() == null : this.getProgBlock().equals(other.getProgBlock()))
            && (this.getAlarmNo() == null ? other.getAlarmNo() == null : this.getAlarmNo().equals(other.getAlarmNo()))
            && (this.getAlarmMsg() == null ? other.getAlarmMsg() == null : this.getAlarmMsg().equals(other.getAlarmMsg()))
            && (this.getToolNo() == null ? other.getToolNo() == null : this.getToolNo().equals(other.getToolNo()))
            && (this.getToolName() == null ? other.getToolName() == null : this.getToolName().equals(other.getToolName()))
            && (this.getOperId() == null ? other.getOperId() == null : this.getOperId().equals(other.getOperId()))
            && (this.getAxisNames() == null ? other.getAxisNames() == null : this.getAxisNames().equals(other.getAxisNames()))
            && (this.getAxisAbsolute() == null ? other.getAxisAbsolute() == null : this.getAxisAbsolute().equals(other.getAxisAbsolute()))
            && (this.getAxisRelative() == null ? other.getAxisRelative() == null : this.getAxisRelative().equals(other.getAxisRelative()))
            && (this.getAxisServoloads() == null ? other.getAxisServoloads() == null : this.getAxisServoloads().equals(other.getAxisServoloads()))
            && (this.getIsMaintain() == null ? other.getIsMaintain() == null : this.getIsMaintain().equals(other.getIsMaintain()))
            && (this.getIsPartComplete() == null ? other.getIsPartComplete() == null : this.getIsPartComplete().equals(other.getIsPartComplete()));
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getMachineId() == null) ? 0 : getMachineId().hashCode());
        result = prime * result + ((getMdcTime() == null) ? 0 : getMdcTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getState() == null) ? 0 : getState().hashCode());
        result = prime * result + ((getMode() == null) ? 0 : getMode().hashCode());
        result = prime * result + ((getOpMode() == null) ? 0 : getOpMode().hashCode());
        result = prime * result + ((getSpindleSpeed() == null) ? 0 : getSpindleSpeed().hashCode());
        result = prime * result + ((getSpindleOverride() == null) ? 0 : getSpindleOverride().hashCode());
        result = prime * result + ((getSpindleLoad() == null) ? 0 : getSpindleLoad().hashCode());
        result = prime * result + ((getFeedrateOverride() == null) ? 0 : getFeedrateOverride().hashCode());
        result = prime * result + ((getFeedRate() == null) ? 0 : getFeedRate().hashCode());
        result = prime * result + ((getRapidFeedOverride() == null) ? 0 : getRapidFeedOverride().hashCode());
        result = prime * result + ((getRapidFeed() == null) ? 0 : getRapidFeed().hashCode());
        result = prime * result + ((getProgName() == null) ? 0 : getProgName().hashCode());
        result = prime * result + ((getProgBlock() == null) ? 0 : getProgBlock().hashCode());
        result = prime * result + ((getAlarmNo() == null) ? 0 : getAlarmNo().hashCode());
        result = prime * result + ((getAlarmMsg() == null) ? 0 : getAlarmMsg().hashCode());
        result = prime * result + ((getToolNo() == null) ? 0 : getToolNo().hashCode());
        result = prime * result + ((getToolName() == null) ? 0 : getToolName().hashCode());
        result = prime * result + ((getOperId() == null) ? 0 : getOperId().hashCode());
        result = prime * result + ((getAxisNames() == null) ? 0 : getAxisNames().hashCode());
        result = prime * result + ((getAxisAbsolute() == null) ? 0 : getAxisAbsolute().hashCode());
        result = prime * result + ((getAxisRelative() == null) ? 0 : getAxisRelative().hashCode());
        result = prime * result + ((getAxisServoloads() == null) ? 0 : getAxisServoloads().hashCode());
        result = prime * result + ((getIsMaintain() == null) ? 0 : getIsMaintain().hashCode());
        result = prime * result + ((getIsPartComplete() == null) ? 0 : getIsPartComplete().hashCode());
        return result;
    }
}
mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/listener/MdcListener.java
@@ -21,6 +21,7 @@
/**
 * @author y_ys79
 * 为每一台机床启动一个线程用来统计数据
 */
@WebListener
public class MdcListener implements ServletContextListener {
@@ -50,8 +51,8 @@
        //监听所有设备,这里是否是采集程序需要的,而不是展示程序?
        List<Machine> machines = mdcMachineMapper.selectList(null);
        if ((machines == null) || machines.size() == 0) {
            logger.debug("no machine");
        if (machines.isEmpty()) {
            logger.debug("没有要监控的机床");
            return;
        }
mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/service/statistic/MdcStatisticThread.java
@@ -1,23 +1,23 @@
package com.qianwen.mdc.service.statistic;
import org.apache.ibatis.session.RowBounds;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.qianwen.mdc.domain.*;
import com.qianwen.mdc.mapper.MachiningDataMapper;
import com.qianwen.mdc.mapper.MachiningDataNcMapper;
import com.qianwen.mdc.mapper.MachineStatusMapper;
import com.qianwen.mdc.utils.TimestampUtil;
import com.qianwen.mdc.utils.redis.RedisUtil;
import java.util.List;
import java.util.Map;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.qianwen.mdc.domain.Machine;
import com.qianwen.mdc.domain.MachineStatus;
import com.qianwen.mdc.domain.MachiningData;
import com.qianwen.mdc.domain.MachiningDataNc;
import com.qianwen.mdc.mapper.MachineStatusMapper;
import com.qianwen.mdc.mapper.MachiningDataMapper;
import com.qianwen.mdc.mapper.MachiningDataNcMapper;
import com.qianwen.mdc.utils.TimestampUtil;
import com.qianwen.mdc.utils.redis.RedisUtil;
/**
 * 执行一台机床的数据统计
 * 执行一台机床的数据统计,在mdcListener中启动本线程
 */
public class MdcStatisticThread implements Runnable {
    
@@ -61,12 +61,11 @@
    }
    /**
     * 从machining——data中提取最新的一条数据,放入machine_status中
     *
     * 从machining_data中提取最新的一条数据,放入machine_status中
     */
    @Override
    public void run() {
        initMdcMachineStatus();
        initMachineStatus();
        initMdcDataNc();
        while (true) {
@@ -124,7 +123,10 @@
        }
    }
    private void initMdcMachineStatus() {
    /**
     * 初始化机床状态表数据
     */
    private void initMachineStatus() {
        dayStart = (int) TimestampUtil.getShiftDayStartTimestamp();
        /*
        Example statusExample = new Example(MdcMachineStatus.class);
@@ -135,9 +137,9 @@
        List<MdcMachineStatus> machineStatus = mdcMachineStatusMapper
                .selectByExampleAndRowBounds(statusExample, rowBounds);
                */
        List<MachineStatus> machineStatus = mdcMachineStatusMapper.machineLastListByTime(mdcMachine.getId(),dayStart);
        if ((machineStatus != null) && (machineStatus.size() != 0)) {
            mdcMachineStatus = machineStatus.get(0);
        List<MachineStatus> machineStatusList = mdcMachineStatusMapper.machineLastListByTime(mdcMachine.getId(),dayStart);//当前班的最新一条数据
        if (!machineStatusList.isEmpty()) {
            mdcMachineStatus = machineStatusList.get(0);
        } else {
            mdcMachineStatus = new MachineStatus();
            mdcMachineStatus.setMachineId(mdcMachine.getId());
@@ -150,7 +152,7 @@
            mdcMachineStatus.setVar5("0");
            mdcMachineStatus.setAxisServoloads("0");
            MachiningData lastDayMdcData = getLastDayMdcData();
            MachiningData lastDayMdcData = getShiftLastMachiningData();
            if (lastDayMdcData != null) {
                mdcMachineStatus.setStatus(lastDayMdcData.getState());
            } else {
@@ -186,7 +188,7 @@
            mdcDataNc = new MachiningDataNc();
            mdcDataNc.setMachineId(mdcMachine.getId());
            MachiningData lastDayMdcData = getLastDayMdcData();
            MachiningData lastDayMdcData = getShiftLastMachiningData();
            if (lastDayMdcData != null) {
                mdcDataNc.setState(lastDayMdcData.getState());
                mdcDataNc.setStartTime(lastDayMdcData.getMdcTime());
@@ -202,7 +204,12 @@
        }
    }
    private MachiningData getLastDayMdcData() {
    /**
     * 获取当前班最新一条采集的加工数据
     * @return
     */
    //private MachiningData getLastDayMdcData() {
    private MachiningData getShiftLastMachiningData() {
        /*
        Example mdcDataExample = new Example(MachiningData.class);
        mdcDataExample.setOrderByClause("mdc_time desc");
@@ -213,7 +220,7 @@
        List<MachiningData> mdcDatas = mdcDataMapper.selectByExampleAndRowBounds(mdcDataExample, rowBounds);
        */
        List<MachiningData> mdcDatas =mdcDataMapper.machineLastDataBeforeTime(mdcMachine.getId(),dayStart);
        if ((mdcDatas != null) && (mdcDatas.size() > 0)) {
        if (!mdcDatas.isEmpty()) {
            return mdcDatas.get(0);
        } else {
            return null;
mdc-parent/mdc-show/src/main/java/com/qianwen/mdc/utils/TimestampUtil.java
@@ -44,7 +44,7 @@
    }
    /**
     * 获取当天早8点距离1970/1/1的秒数。早于8点,计为头一天的
     * 获取今日起始上班时间(当天早8点距离1970/1/1的秒数。如果早于8点,从头一天开始计算)
     * @return
     */
    public static long getShiftDayStartTimestamp() {