From a1fbe330635fb2f223f48fa5b1377ad0bc74f254 Mon Sep 17 00:00:00 2001 From: gaoqr <13665037151@163.com> Date: Fri, 29 May 2026 10:30:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=BB=93=E6=9E=9C=E4=BF=9D?= =?UTF-8?q?=E5=AD=98mycat=E4=B8=8D=E6=94=AF=E6=8C=81update=20limit?= =?UTF-8?q?=E6=9A=82=E6=97=B6=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../optimizeplan/OptimizePlanServiceImpl.java | 61 ++----------------- .../resources/mapper/plate/PlateMapper.xml | 6 -- 2 files changed, 6 insertions(+), 61 deletions(-) diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanServiceImpl.java index ee0b7752c..25bd75274 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanServiceImpl.java @@ -1787,22 +1787,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService { * @param orderIds */ private void resetPlanPlateOptimizeStatus(Long planId, List 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() @@ -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() .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 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) ); } } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/PlateMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/PlateMapper.xml index 67bca7499..216f3e53b 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/PlateMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/plate/PlateMapper.xml @@ -1491,8 +1491,6 @@ #{plateNo} - ORDER BY op.id - LIMIT 1000; @@ -1509,8 +1507,6 @@ #{plateNo} - ORDER BY op.id - LIMIT 1000; @@ -1523,8 +1519,6 @@ #{orderId} AND op.plan_id = #{planId} - ORDER BY op.id - LIMIT 1000;