fix(mill): 修复换辊记录查询逻辑

- 修正了MesRollChangeMapper.xml中的查询条件,添加del_flag = 0过滤已删除记录
- 修改了排序规则,从change_id改为change_time优先排序,确保获取最新的换辊记录
- 注释掉了服务层中统计信息的相关代码,避免不必要的数据加载和计算
- 确保查询能够返回正确的最新换辊记录,提高数据准确性
This commit is contained in:
2026-06-09 16:40:21 +08:00
parent 1d0fda5956
commit 1f1397b116
2 changed files with 8 additions and 9 deletions

View File

@@ -149,12 +149,12 @@ public class MesRollChangeServiceImpl implements IMesRollChangeService
if (rec != null) { if (rec != null) {
cell.put("rollNo", getRollNoByPos(rec, posType)); cell.put("rollNo", getRollNoByPos(rec, posType));
cell.put("onlineTime", rec.getChangeTime()); cell.put("onlineTime", rec.getChangeTime());
Map<String, Object> stats = mesRollChangeMapper.selectCoilStats(rec.getChangeTime(), null); // Map<String, Object> stats = mesRollChangeMapper.selectCoilStats(rec.getChangeTime(), null);
MesRollChangeVo tmp = new MesRollChangeVo(); // MesRollChangeVo tmp = new MesRollChangeVo();
fillStatsToVo(tmp, stats); // fillStatsToVo(tmp, stats);
cell.put("workLength", tmp.getWorkLength()); // cell.put("workLength", tmp.getWorkLength());
cell.put("coilCount", tmp.getCoilCount()); // cell.put("coilCount", tmp.getCoilCount());
cell.put("totalWeight", tmp.getTotalWeight()); // cell.put("totalWeight", tmp.getTotalWeight());
} }
byStand.put(standNo, cell); byStand.put(standNo, cell);
} }

View File

@@ -168,15 +168,14 @@
<!-- 查询指定机架+辊位的最新换辊记录 --> <!-- 查询指定机架+辊位的最新换辊记录 -->
<select id="selectLatestByStandAndPosition" resultMap="MesRollChangeResult"> <select id="selectLatestByStandAndPosition" resultMap="MesRollChangeResult">
<include refid="selectMesRollChangeVo"/> <include refid="selectMesRollChangeVo"/>
FROM mes_roll_change WHERE line_id = #{lineId} AND stand_no = #{standNo} AND del_flag = 0
WHERE line_id = #{lineId} AND stand_no = #{standNo}
AND ( AND (
(#{posType} = 'upperWr' AND upper_wr_no IS NOT NULL) (#{posType} = 'upperWr' AND upper_wr_no IS NOT NULL)
OR (#{posType} = 'lowerWr' AND lower_wr_no IS NOT NULL) OR (#{posType} = 'lowerWr' AND lower_wr_no IS NOT NULL)
OR (#{posType} = 'upperBr' AND upper_br_no IS NOT NULL) OR (#{posType} = 'upperBr' AND upper_br_no IS NOT NULL)
OR (#{posType} = 'lowerBr' AND lower_br_no IS NOT NULL) OR (#{posType} = 'lowerBr' AND lower_br_no IS NOT NULL)
) )
ORDER BY change_id DESC ORDER BY change_time DESC, change_id DESC
LIMIT 1 LIMIT 1
</select> </select>