优化结果保存mycat不支持update limit暂时修复

This commit is contained in:
gaoqr
2026-05-29 10:30:22 +08:00
parent 0853339838
commit a1fbe33063
2 changed files with 6 additions and 61 deletions
@@ -1787,22 +1787,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
* @param orderIds
*/
private void resetPlanPlateOptimizeStatus(Long planId, List<Long> orderIds) {
int updatedCount;
do {
// 执行批量更新,每次最多更新1000条
updatedCount = plateMapper.resetPlanPlateOptimizeStatus(planId, orderIds);
// 如果本次有更新,则继续下一轮
if (updatedCount > 0) {
try {
// 100毫秒延迟
Thread.sleep(100);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException("轮询更新被中断", e);
}
}
} while (updatedCount > 0); // 当返回0时表示没有更多记录需要更新
plateMapper.resetPlanPlateOptimizeStatus(planId, orderIds);
// 重置排单的已优化数量
planMapper.update(new LambdaUpdateWrapper<PlanDO>()
@@ -1839,30 +1824,13 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
int boardCount = layoutResultSummary.stream().mapToInt(BoardLayoutResultSummary::getBoardCount).sum();
// 更新参与优化的板材的优化状态
int updatedCount;
int optimizedCount = 0;
do {
// 执行批量更新,每次最多更新1000条
updatedCount = plateMapper.updatePlanPlateOptimizeStatus(planId, orderIds, optimizatePlateNoList);
optimizedCount += updatedCount;
int updatedCount = plateMapper.updatePlanPlateOptimizeStatus(planId, orderIds, optimizatePlateNoList);;
// 如果本次有更新,则继续下一轮
if (updatedCount > 0) {
try {
// 100毫秒延迟
Thread.sleep(100);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException("轮询更新被中断", e);
}
}
} while (updatedCount > 0); // 当返回0时表示没有更多记录需要更新
if (optimizedCount > 0) {
if (updatedCount > 0) {
planMapper.update(new LambdaUpdateWrapper<PlanDO>()
.eq(PlanDO::getId, planId)
.eq(PlanDO::getDeleted, DeletedCodeEnum.NOT_DELETED.getStatus())
.set(PlanDO::getOptimizedPlateNum, optimizedCount)
.set(PlanDO::getOptimizedPlateNum, updatedCount)
.set(PlanDO::getScheduledBoardNum, boardCount)
);
}
@@ -1903,24 +1871,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
int endCutBoardCount = layoutResultSummary.stream().mapToInt(BoardLayoutResultSummary::getEndCutBoardCount).sum();
// 更新开料状态
int updatedCount;
int cuttedCount = 0;
do {
// 执行批量更新,每次最多更新1000条
updatedCount = plateMapper.updatePlanPlateCutStatus(planId, orderIds, optimizatePlateNoList);
cuttedCount += updatedCount;
// 如果本次有更新,则继续下一轮
if (updatedCount > 0) {
try {
// 100毫秒延迟
Thread.sleep(100);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new RuntimeException("轮询更新被中断", e);
}
}
} while (updatedCount > 0); // 当返回0时表示没有更多记录需要更新
int updatedCount = plateMapper.updatePlanPlateCutStatus(planId, orderIds, optimizatePlateNoList);
// 查询已全部开料的订单号
List<Long> allCuttedOrderIdList = plateMapper.selectPlanAllCuttedOrderIdList(planId);
@@ -1946,7 +1897,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
.set(PlanDO::getStatus, PlanStatusEnum.OPENED.getStatus())
.set(PlanDO::getProduceTime, LocalDateTime.now())
.set(PlanDO::getCuttedBoardNum, endCutBoardCount)
.set(PlanDO::getCuttedPlateNum, cuttedCount)
.set(PlanDO::getCuttedPlateNum, updatedCount)
);
}
}
@@ -1491,8 +1491,6 @@
<foreach collection="plateNos" item="plateNo" open="(" close=")" separator=",">
#{plateNo}
</foreach>
ORDER BY op.id
LIMIT 1000;
</update>
<update id="updatePlanPlateCutStatus">
@@ -1509,8 +1507,6 @@
<foreach collection="plateNos" item="plateNo" open="(" close=")" separator=",">
#{plateNo}
</foreach>
ORDER BY op.id
LIMIT 1000;
</update>
<update id="resetPlanPlateOptimizeStatus">
@@ -1523,8 +1519,6 @@
#{orderId}
</foreach>
AND op.plan_id = #{planId}
ORDER BY op.id
LIMIT 1000;
</update>
<select id="selectPlanAllCuttedOrderIdList" resultType="java.lang.Long">