Bladeren bron

fix(productionPlan): 仅最后一道工序执行结束时间晚于计划结束时标红

工序数量不固定,改为按当前工序列表最后一条动态判断,避免非末道工序超期误标红
lihaiting 3 dagen geleden
bovenliggende
commit
6cf12df948

+ 19 - 0
src/views/productionPlan/components/newFactoryProductionScheduling.vue

@@ -2003,9 +2003,28 @@
           isTimeAfterDeliveryDate(row.executionEndTime, deadline)
         );
       },
+      /** 是否为最后一道工序(工序数量不固定,按当前任务列表顺序判断) */
+      isLastPlanTask(row) {
+        const list = this.taskList || [];
+        if (!row || !list.length) {
+          return false;
+        }
+        const lastTask = list[list.length - 1];
+        if (row === lastTask) {
+          return true;
+        }
+        // 班组排程下同一道工序会有多条工位行,按工序分组比较
+        if (!this.isOrderScheduling) {
+          return false;
+        }
+        const lastKey = this.getTaskSequenceGroupKey(lastTask);
+        return !!lastKey && this.getTaskSequenceGroupKey(row) === lastKey;
+      },
+      /** 仅最后一道工序执行结束时间晚于计划结束时间时标红 */
       isExecutionEndOverPlanEnd(row) {
         const planEnd = this.currentPlan?.endTime;
         return (
+          this.isLastPlanTask(row) &&
           !!planEnd &&
           !!row?.executionEndTime &&
           isEndAfterPlanEnd(row.executionEndTime, planEnd)

+ 3 - 1
src/views/productionPlan/components/planDotLine.vue

@@ -803,12 +803,14 @@
         );
       },
 
-      /** 执行结束时间晚于计划结束时间(任意工序行标红,可保存) */
+      /** 仅最后一道工序执行结束时间晚于计划结束时间时标红(工序数量不固定) */
       isExecutionEndOverPlanEnd(row) {
         const planEnd = this.currentPlan?.endTime;
+        const lastTask = this.taskList[this.taskList.length - 1];
         return (
           !!planEnd &&
           !!row?.executionEndTime &&
+          row === lastTask &&
           isEndAfterPlanEnd(row.executionEndTime, planEnd)
         );
       },