浏览代码

班组排程的功能编写

695593266@qq.com 2 周之前
父节点
当前提交
97c3a9e981

+ 14 - 0
src/api/productionPlan/index.js

@@ -500,6 +500,20 @@ export async function teamSchedulingGanttChart(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
+/**
+ * 班组排程工位/设备/人员甘特图
+ */
+export async function workstationSchedulingGanttChart(data) {
+  const res = await request.post(
+    '/aps/scheduling/workstationSchedulingGanttChart',
+    data
+  );
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 /**
  * 生产计划工厂排程
  */

+ 1 - 1
src/views/productionPlan/components/gantt/components/CalendarTable.vue

@@ -75,7 +75,7 @@
                   class="calendar-day-entry"
                 >
                   <span class="calendar-day-entry__code">
-                    {{ entry.planCode }}
+                    {{ entry.displayCode || entry.planCode }}
                   </span>
                   <span class="calendar-day-entry__qty">
                     {{ entry.qty }}

+ 64 - 14
src/views/productionPlan/components/gantt/project-gantt.utils.js

@@ -88,11 +88,16 @@ export function buildCalendarTooltipHtml(entries) {
       const rows = [
         { label: '产品名称', value: entry.productName || '' },
         { label: '工艺路线', value: entry.routingName || '' },
-        { label: '计划编码', value: entry.planCode || '' },
+        {
+          label: entry.productionOrderNumber ? '生产订单号' : '计划编码',
+          value: entry.productionOrderNumber || entry.planCode || ''
+        },
         { label: '产品编码', value: entry.productCode || '' },
         { label: '数量', value: entry.qty },
         { label: '规格', value: entry.specification || '' },
-        { label: '型号', value: entry.modeType || '' }
+        { label: '型号', value: entry.modeType || '' },
+        { label: '工位', value: entry.resourceName || '' },
+        { label: '编码', value: entry.resourceCode || '' }
       ].filter(
         (item) =>
           item.value !== '' && item.value !== null && item.value !== undefined
@@ -134,7 +139,12 @@ export function buildCalendarTooltipHtml(entries) {
   `;
 }
 
-export function buildTooltipHtml(task, planMetaByCode = {}, activeTab = '') {
+export function buildTooltipHtml(
+  task,
+  planMetaByCode = {},
+  activeTab = '',
+  resourceLabelMode = 'plan'
+) {
   const planMeta = planMetaByCode[task.code] || {};
   const quantityText = [
     task.qty ?? task.productNum ?? planMeta.productNum,
@@ -142,12 +152,42 @@ export function buildTooltipHtml(task, planMetaByCode = {}, activeTab = '') {
   ]
     .filter((item) => item !== '' && item !== null && item !== undefined)
     .join('');
-  const title =
-    [task.title, task.name || task.text || planMeta.productName]
-      .filter(Boolean)
-      .join(':') ||
+  const isOrderSchedulingTooltip = resourceLabelMode === 'order';
+  const orderTitleValue =
+    task.productionOrderNumber ||
+    task.apsWorkOrderCode ||
+    task.workOrderCode ||
+    task.productionOrderCode ||
+    planMeta.productionOrderNumber ||
+    planMeta.apsWorkOrderCode ||
+    planMeta.workOrderCode ||
+    task.planCode ||
+    planMeta.planCode ||
+    planMeta.code ||
     task.code ||
-    '任务信息';
+    planMeta.productName ||
+    task.productName ||
+    '';
+  const title = isOrderSchedulingTooltip
+    ? ['订单', orderTitleValue].filter(Boolean).join(':') || '订单信息'
+    : [task.title, task.name || task.text || planMeta.productName]
+        .filter(Boolean)
+        .join(':') ||
+      task.code ||
+      '任务信息';
+  const resourceRows =
+    activeTab === 'team'
+      ? [
+          {
+            label: '工位',
+            value: task.resourceName || ''
+          },
+          {
+            label: '编码',
+            value: task.resourceCode || ''
+          }
+        ]
+      : [];
   const rows = [
     {
       label: '计划编号',
@@ -163,7 +203,9 @@ export function buildTooltipHtml(task, planMetaByCode = {}, activeTab = '') {
     },
     {
       label: '产品名称',
-      value: planMeta.productName || task.text || task.name || ''
+      value: isOrderSchedulingTooltip
+        ? planMeta.productName || task.productName || ''
+        : planMeta.productName || task.text || task.name || ''
     },
     {
       label: '数量',
@@ -189,11 +231,19 @@ export function buildTooltipHtml(task, planMetaByCode = {}, activeTab = '') {
       label: '批次号',
       value: planMeta.batchNo || ''
     },
-    {
-      label: activeTab === 'factory' ? '工厂' : '班组',
-      value:
-        task.teamName || planMeta.teamName || planMeta.executionTeamName || ''
-    }
+    ...resourceRows,
+    ...(resourceLabelMode === 'order'
+      ? []
+      : [
+          {
+            label: activeTab === 'factory' ? '工厂' : '班组',
+            value:
+              task.teamName ||
+              planMeta.teamName ||
+              planMeta.executionTeamName ||
+              ''
+          }
+        ])
   ].filter((item) => item.value);
   return `
     <div class="gantt-tooltip-card">

+ 148 - 21
src/views/productionPlan/components/gantt/project-gantt.vue

@@ -84,7 +84,12 @@
   import GanttFilterBar from './components/GanttFilterBar.vue';
   import ResourcePanel from './components/ResourcePanel.vue';
   import 'dhtmlx-gantt/codebase/dhtmlxgantt.css';
-  import { DAY_MS, RESOURCE_TABS, WEEK_MAP } from './project-gantt.constants';
+  import {
+    DAY_MS,
+    PLAN_COLOR_PALETTE,
+    RESOURCE_TABS,
+    WEEK_MAP
+  } from './project-gantt.constants';
   import {
     buildCalendarTooltipHtml,
     buildTooltipHtml,
@@ -200,14 +205,9 @@
           : RESOURCE_TABS;
       },
       resourceList() {
-        const source =
-          this.activeTab === 'line'
-            ? this.ganttTasks
-                .map((item) => this.getLineResourceName(item))
-                .filter(Boolean)
-            : this.ganttTasks
-                .map((item) => this.getTeamResourceName(item))
-                .filter(Boolean);
+        const source = this.ganttTasks
+          .map((item) => this.getActiveResourceName(item))
+          .filter(Boolean);
         const result = [];
         const cache = new Set();
         source.forEach((name, index) => {
@@ -248,6 +248,39 @@
           return result;
         }, {});
       },
+      orderPlanColorMap() {
+        if (this.resourceLabelMode !== 'order') {
+          return {};
+        }
+        const result = {};
+        const planKeys = [];
+        const assignColor = (primaryKey, aliases = []) => {
+          if (!primaryKey) {
+            return;
+          }
+          const existingKey = [primaryKey, ...aliases].find(
+            (key) => key && result[key]
+          );
+          const color =
+            (existingKey && result[existingKey]) ||
+            PLAN_COLOR_PALETTE[planKeys.length % PLAN_COLOR_PALETTE.length];
+          if (!existingKey) {
+            planKeys.push(primaryKey);
+          }
+          [primaryKey, ...aliases].forEach((key) => {
+            if (key) {
+              result[key] = color;
+            }
+          });
+        };
+        this.ganttTasks.forEach((item) => {
+          assignColor(item.planId || item.planCode, [
+            item.planId,
+            item.planCode
+          ]);
+        });
+        return result;
+      },
       calendarTaskSource() {
         if (
           Array.isArray(this.calendarSourceData) &&
@@ -258,12 +291,19 @@
               const resourceList = Array.isArray(item.resourceList)
                 ? item.resourceList
                 : [];
+              const resourceName = item.resourceName || item.name || '';
+              const resourceCode = item.resourceCode || item.code || '';
               const dayEntryMap = {};
               const periodDates = [];
               const searchEntries = [];
               resourceList.forEach((resourceItem, resourceIndex) => {
                 searchEntries.push({
                   planCode: resourceItem.planCode || '',
+                  productionOrderNumber:
+                    resourceItem.productionOrderNumber ||
+                    resourceItem.apsWorkOrderCode ||
+                    resourceItem.workOrderCode ||
+                    '',
                   productName: resourceItem.productName || '',
                   routingName:
                     resourceItem.routingName ||
@@ -295,6 +335,18 @@
                     planId: resourceItem.planId || '',
                     planCode:
                       resourceItem.planCode || resourceItem.productCode || '',
+                    productionOrderNumber:
+                      resourceItem.productionOrderNumber ||
+                      resourceItem.apsWorkOrderCode ||
+                      resourceItem.workOrderCode ||
+                      '',
+                    displayCode:
+                      resourceItem.productionOrderNumber ||
+                      resourceItem.apsWorkOrderCode ||
+                      resourceItem.workOrderCode ||
+                      resourceItem.planCode ||
+                      resourceItem.productCode ||
+                      '',
                     qty: period.todayRequiredFormingNum ?? '',
                     productName: resourceItem.productName || '',
                     routingName:
@@ -304,7 +356,9 @@
                     productCode: resourceItem.productCode || '',
                     specification: resourceItem.specification || '',
                     batchNo: resourceItem.batchNo || '',
-                    modeType: resourceItem.modeType || ''
+                    modeType: resourceItem.modeType || '',
+                    resourceName,
+                    resourceCode
                   });
                 });
               });
@@ -315,7 +369,7 @@
               return {
                 id: `${item.resourceId || 'resource'}-${item.taskId || index}`,
                 code: item.taskId || item.sourceTaskId || '',
-                groupLabel: this.getCalendarTeamGroupName(item),
+                groupLabel: this.getActiveCalendarGroupName(item),
                 productionLineName:
                   this.getCalendarProductionLineName(item, resourceList) ||
                   this.getPlanProductionLineName(resourceList[0]?.planCode) ||
@@ -352,7 +406,11 @@
             return {
               id: item.id || `${item.code || 'task'}-${index}`,
               code: item.code || '',
-              groupLabel: item.teamName || planMeta.teamName || '未分组',
+              groupLabel:
+                this.getActiveResourceName(item) ||
+                item.teamName ||
+                planMeta.teamName ||
+                '未分组',
               productionLineName:
                 item.productionLineName || planMeta.productionLineName || '',
               factoryName: planMeta.factoryName || '',
@@ -521,7 +579,9 @@
         return result;
       },
       calendarGroupLabel() {
-        const tab = this.resourceTabs.find((item) => item.key === this.activeTab);
+        const tab = this.resourceTabs.find(
+          (item) => item.key === this.activeTab
+        );
         return tab?.label ? `${tab.label}名称` : '资源名称';
       }
     },
@@ -569,12 +629,18 @@
         if (!this.selectedResource) {
           return true;
         }
-        const currentLabel =
-          this.activeTab === 'line'
-            ? this.getLineResourceName(item)
-            : this.getTeamResourceName(item);
+        const currentLabel = this.getActiveResourceName(item);
         return String(currentLabel || '').trim() === this.selectedResource;
       },
+      resolveGanttPlanColor(planKey) {
+        if (
+          this.resourceLabelMode === 'order' &&
+          this.orderPlanColorMap[planKey]
+        ) {
+          return this.orderPlanColorMap[planKey];
+        }
+        return resolvePlanColor(planKey);
+      },
       matchesCalendarResourceFilter(item) {
         if (!this.selectedResource) {
           return true;
@@ -585,6 +651,12 @@
             : item.groupLabel || item.teamName || '';
         return String(currentLabel || '').trim() === this.selectedResource;
       },
+      getActiveCalendarGroupName(item) {
+        if (this.activeTab === 'person') {
+          return this.getCalendarPersonGroupName(item);
+        }
+        return this.getCalendarTeamGroupName(item);
+      },
       getCalendarTeamGroupName(item) {
         if (this.resourceLabelMode === 'order') {
           return (
@@ -601,6 +673,12 @@
         }
         return item.name || item.teamName || '未分组';
       },
+      getCalendarPersonGroupName(item) {
+        if (this.resourceLabelMode === 'order') {
+          return this.getTaskPersonName(item) || '未分组';
+        }
+        return this.getTaskPersonName(item) || '未分组';
+      },
       getCalendarProductionLineName(item, resourceList = []) {
         if (this.resourceLabelMode === 'order') {
           return (
@@ -647,18 +725,56 @@
         return String(
           item.equipmentName ||
             item.deviceName ||
+            item.deviceCode ||
             item.assetName ||
             item.machineName ||
             item.productionLineName ||
             ''
         ).trim();
       },
+      getTaskPersonName(item) {
+        const directValue = String(
+          item.executionObjectType === 'person'
+            ? item.executionObjectName || ''
+            : ''
+        ).trim();
+        const name =
+          directValue ||
+          item.assigneeUserName ||
+          item.assigneeUser?.[0]?.userName ||
+          item.assigneeUser?.[0]?.name ||
+          item.executionUserName ||
+          item.executionAssigneeName ||
+          item.assigneeName ||
+          item.operatorName ||
+          item.userName ||
+          item.executionTeamLeader ||
+          item.leaderUserName ||
+          '';
+        return String(name || '')
+          .replace(/^人员[::]/, '')
+          .trim();
+      },
+      getActiveResourceName(item) {
+        if (this.activeTab === 'line') {
+          return this.getLineResourceName(item);
+        }
+        if (this.activeTab === 'person') {
+          return this.getPersonResourceName(item);
+        }
+        return this.getTeamResourceName(item);
+      },
       getTeamResourceName(item) {
         if (this.resourceLabelMode === 'order') {
-          return this.getTaskWorkstationName(item) || this.getTaskTeamName(item);
+          return (
+            this.getTaskWorkstationName(item) || this.getTaskTeamName(item)
+          );
         }
         return this.getTaskTeamName(item);
       },
+      getPersonResourceName(item) {
+        return this.getTaskPersonName(item);
+      },
       getLineResourceName(item) {
         if (this.resourceLabelMode === 'order') {
           return (
@@ -715,7 +831,12 @@
         }
         this.hoverTooltip = {
           visible: true,
-          content: buildTooltipHtml(task, this.planMetaByCode, this.activeTab),
+          content: buildTooltipHtml(
+            task,
+            this.planMetaByCode,
+            this.activeTab,
+            this.resourceLabelMode
+          ),
           style: {
             left: `${event.clientX + 16}px`,
             top: `${event.clientY + 16}px`
@@ -797,6 +918,7 @@
             '',
           productName: entry.productName || planMeta.productName || '',
           planCode:
+            entry.productionOrderNumber ||
             entry.planCode ||
             entry.code ||
             planMeta.code ||
@@ -1032,7 +1154,12 @@
         });
         // 自定义tooltip内容
         gantt.templates.tooltip_text = function (start, end, task) {
-          return buildTooltipHtml(task, _this.planMetaByCode, _this.activeTab);
+          return buildTooltipHtml(
+            task,
+            _this.planMetaByCode,
+            _this.activeTab,
+            _this.resourceLabelMode
+          );
         };
         gantt.attachEvent('onTaskClick', function (id, e) {
           let box = document.querySelector('.gantt_tooltip');
@@ -1119,7 +1246,7 @@
                 mergedCurrent.code ||
                 mergedCurrent.id;
               newObj = Object.assign({}, mergedCurrent, {
-                color: resolvePlanColor(planKey),
+                color: this.resolveGanttPlanColor(planKey),
                 title: mergedCurrent.title || '任务',
                 customClass: 'task-child-plan'
               });

文件差异内容过多而无法显示
+ 575 - 150
src/views/productionPlan/components/newFactoryProductionScheduling.vue


+ 56 - 7
src/views/productionPlan/components/newFactoryProductionScheduling/PlanRoutePanel.vue

@@ -1,5 +1,5 @@
 <template>
-  <div>
+  <div :class="['route-panel-wrap', { compact }]">
     <div class="plan-time-bar">
       <span class="plan-time-item">
         <span class="plan-time-label">计划开始时间:</span>
@@ -14,7 +14,7 @@
         <span class="plan-time-value">{{ planNumDisplay }}</span>
       </span>
     </div>
-    <div class="top-route">
+    <div :class="['top-route', { 'is-empty-route': taskList.length === 0 }]">
       <div class="panel-title">工艺路线</div>
       <el-empty
         v-if="taskList.length === 0"
@@ -71,6 +71,10 @@
         type: Function,
         default: (item, index) =>
           item.taskTypeName || item.taskName || item.name || `工艺${index + 1}`
+      },
+      compact: {
+        type: Boolean,
+        default: false
       }
     }
   };
@@ -89,6 +93,30 @@
     overflow: visible;
   }
 
+  .top-route.is-empty-route {
+    min-height: 156px;
+    padding-bottom: 10px;
+  }
+
+  .top-route.is-empty-route ::v-deep {
+    .el-empty {
+      padding: 12px 0 14px;
+    }
+
+    .el-empty__image {
+      width: 92px;
+      height: 68px;
+    }
+
+    .el-empty__description {
+      margin-top: 8px;
+    }
+
+    .el-empty__description p {
+      font-size: 13px;
+    }
+  }
+
   .panel-title {
     font-size: 14px;
     font-weight: 600;
@@ -116,6 +144,27 @@
     font-size: 14px;
   }
 
+  .route-panel-wrap.compact {
+    .plan-time-bar {
+      gap: 8px 18px;
+      margin-bottom: 8px;
+      padding: 8px 10px;
+      font-size: 13px;
+    }
+
+    .top-route {
+      padding: 10px 10px 8px;
+    }
+
+    .panel-title {
+      margin-bottom: 6px;
+    }
+
+    .route-steps {
+      padding-bottom: 2px;
+    }
+  }
+
   .plan-time-item {
     display: inline-flex;
     align-items: baseline;
@@ -144,7 +193,7 @@
     }
 
     .el-step__title {
-      font-size: clamp(16px, 2.2vw, 16px);
+      font-size: 15px;
       line-height: 1.35;
       max-width: 8em;
       margin-left: auto;
@@ -159,7 +208,7 @@
     }
 
     .el-step__line {
-      top: 14px;
+      top: 12px;
     }
 
     .el-step__head.is-success {
@@ -184,12 +233,12 @@
     }
 
     .el-step__icon {
-      width: 30px;
-      height: 30px;
+      width: 26px;
+      height: 26px;
     }
 
     .el-step__main {
-      padding-top: 8px;
+      padding-top: 5px;
       margin-top: 0;
     }
 

文件差异内容过多而无法显示
+ 1761 - 168
src/views/productionPlan/components/newFactoryProductionScheduling/TaskConfigPanel.vue


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

@@ -583,12 +583,94 @@
         );
       },
 
+      getTaskLabel(item, index) {
+        return (
+          item?.taskTypeName ||
+          item?.taskName ||
+          item?.name ||
+          (typeof index === 'number' ? `工艺${index + 1}` : '当前工艺')
+        );
+      },
+
+      compareTaskTime(start, end) {
+        if (!start || !end) return false;
+        const startTime = new Date(start).getTime();
+        const endTime = new Date(end).getTime();
+        return (
+          !Number.isNaN(startTime) &&
+          !Number.isNaN(endTime) &&
+          startTime < endTime
+        );
+      },
+
+      validateTaskSequence(row, options = {}) {
+        const index = this.taskList.findIndex((item) => item === row);
+        if (index < 0) {
+          return true;
+        }
+        const prev = this.taskList[index - 1];
+        const next = this.taskList[index + 1];
+        const resetKey = options.resetKey;
+        const checkPrev = !resetKey || resetKey === 'executionStartTime';
+        const checkNext = !resetKey || resetKey === 'executionEndTime';
+
+        if (
+          checkPrev &&
+          prev?.executionEndTime &&
+          row.executionStartTime &&
+          this.compareTaskTime(row.executionStartTime, prev.executionEndTime)
+        ) {
+          this.routeErrorIndex = index;
+          this.$message.warning(
+            `${this.getTaskLabel(
+              row,
+              index
+            )}执行开始时间不能小于上一道工序${this.getTaskLabel(
+              prev,
+              index - 1
+            )}的执行结束时间`
+          );
+          if (resetKey) {
+            this.$set(row, resetKey, '');
+          }
+          return false;
+        }
+
+        if (
+          checkNext &&
+          next?.executionStartTime &&
+          row.executionEndTime &&
+          this.compareTaskTime(next.executionStartTime, row.executionEndTime)
+        ) {
+          this.routeErrorIndex = index + 1;
+          this.$message.warning(
+            `下一道工序${this.getTaskLabel(
+              next,
+              index + 1
+            )}的执行开始时间不能小于上一道工序${this.getTaskLabel(
+              row,
+              index
+            )}的执行结束时间`
+          );
+          if (resetKey) {
+            this.$set(row, resetKey, '');
+          }
+          return false;
+        }
+
+        return true;
+      },
+
       handleTimeChange(row, changeKey) {
         if (isEndBeforeStart(row.executionStartTime, row.executionEndTime)) {
           this.$message.warning('执行结束时间不能小于执行开始时间');
           this.$set(row, changeKey, '');
           return;
         }
+        if (!this.validateTaskSequence(row, { resetKey: changeKey })) {
+          return;
+        }
+        this.routeErrorIndex = -1;
         const deadline = this.currentPlan?.planDeliveryTime;
         if (
           changeKey === 'executionStartTime' &&
@@ -646,7 +728,8 @@
       },
 
       validateTaskList() {
-        const label = (t) => t.taskName || t.name || '当前工艺';
+        this.routeErrorIndex = -1;
+        const label = (t) => this.getTaskLabel(t);
 
         for (const item of this.taskList) {
           const execType = toSafeNumber(item.executionType);
@@ -720,6 +803,11 @@
               return false;
           }
         }
+        for (const item of this.taskList) {
+          if (!this.validateTaskSequence(item)) {
+            return false;
+          }
+        }
         return true;
       },
 

+ 3 - 0
src/views/productionPlan/index.vue

@@ -1526,6 +1526,9 @@
             `计划编码【${codes || '未知'}】没有定义BOM,请先添加BOM!`
           );
         }
+        // 工厂排程入口:
+        // 只传生产计划 selectedPlans/allPlans,不传 mode。
+        // 排程弹窗会保持默认 plan 模式,沿用工厂排程原有班组、产线和甘特逻辑。
         this.$refs.newFactoryProductionSchedulingRef.open({
           selectedPlans: this.selection,
           allPlans: this.allPlanTableData

+ 3 - 1
src/views/requirementListPlan/details.vue

@@ -102,7 +102,7 @@
           下料申请
         </el-button>
 
-        <el-button type="primary" size="mini" @click="pickOrder(1)">
+        <el-button type="primary" size="mini" @click="inventoryQuery">
           库存查询
         </el-button>
 
@@ -526,6 +526,8 @@
         this.$refs.borrowListRef.open(this.form);
       },
 
+      inventoryQuery() {},
+
       materialReturn() {
         if (!this.selection.length) {
           this.$message.warning('请选择一条数据');

+ 135 - 8
src/views/workOrder/index.vue

@@ -331,6 +331,7 @@
         columns: [],
         stationList: [],
         teamsList: [],
+        orderSchedulingTeamMap: {},
         crewList: [],
         current: null,
         cacheKeyUrl: '3cbbdff9-aps-workOrder-index',
@@ -341,6 +342,7 @@
         detailsVisible: false,
         tabMixinsInit: false,
         tabValue: '1',
+        currentOrderListWhere: {},
         treeId: [],
         tableHeight: 'calc(100vh - 345px)',
         userWorkCenter: this.$store.state.user.info.workCenterIds,
@@ -863,8 +865,124 @@
 
         this.$refs.batchRef.open(list);
       },
-      openFactoryScheduling() {
-        const list = Object.values(this.selectionMap);
+      getCurrentMonthCreateTimeRange() {
+        const now = new Date();
+        const year = now.getFullYear();
+        const month = String(now.getMonth() + 1).padStart(2, '0');
+        const lastDay = String(
+          new Date(year, now.getMonth() + 1, 0).getDate()
+        ).padStart(2, '0');
+        return {
+          createTimeStart: `${year}-${month}-01 00:00:00`,
+          createTimeEnd: `${year}-${month}-${lastDay} 23:59:59`
+        };
+      },
+      getOrderCreateTimeRange(dateRange) {
+        if (!Array.isArray(dateRange) || dateRange.length !== 2) {
+          return this.getCurrentMonthCreateTimeRange();
+        }
+        const [startDate, endDate] = dateRange;
+        if (!startDate || !endDate) {
+          return this.getCurrentMonthCreateTimeRange();
+        }
+        const start = String(startDate).slice(0, 10);
+        const end = String(endDate).slice(0, 10);
+        return {
+          createTimeStart: `${start} 00:00:00`,
+          createTimeEnd: `${end} 23:59:59`
+        };
+      },
+      buildCurrentMonthOrderWhere(dateRange) {
+        const createTimeRange = this.getOrderCreateTimeRange(dateRange);
+        const where = {
+          ...(this.currentOrderListWhere || {})
+        };
+        delete where.createTime;
+        delete where.createTimeStart;
+        delete where.createTimeEnd;
+        Object.assign(where, createTimeRange);
+        if (where.status) {
+          where.statusList = [where.status];
+          delete where.status;
+        }
+        return where;
+      },
+      getSingleTeamId(value = this.teamId) {
+        if (Array.isArray(value)) {
+          return value.length ? this.getSingleTeamId(value[0]) : '';
+        }
+        if (value === null || value === undefined) {
+          return '';
+        }
+        const text = String(value).trim();
+        return text.includes(',') ? text.split(',')[0].trim() : text;
+      },
+      async getDefaultTeamByWorkCenter(workCenterId) {
+        if (!workCenterId) {
+          return null;
+        }
+        const key = String(workCenterId);
+        if (this.orderSchedulingTeamMap[key] !== undefined) {
+          return this.orderSchedulingTeamMap[key];
+        }
+        try {
+          const list = await listByWorkCenterId(workCenterId);
+          const teams = Array.isArray(list) ? list : [];
+          const userTeamId = this.getSingleTeamId();
+          const matchedTeam = teams.find(
+            (item) => String(item.id) === String(userTeamId)
+          );
+          const team = matchedTeam || teams[0] || null;
+          this.$set(this.orderSchedulingTeamMap, key, team);
+          return team;
+        } catch {
+          this.$set(this.orderSchedulingTeamMap, key, null);
+          return null;
+        }
+      },
+      async fillOrderSchedulingTeamInfo(list = []) {
+        const rows = Array.isArray(list) ? list : [];
+        const result = await Promise.all(
+          rows.map(async (row) => {
+            if (row.teamId && row.teamName) {
+              return row;
+            }
+            const team = await this.getDefaultTeamByWorkCenter(
+              row.workCenterId
+            );
+            if (!team) {
+              return row;
+            }
+            return {
+              ...row,
+              teamId: row.teamId || team.id,
+              teamName: row.teamName || team.name
+            };
+          })
+        );
+        return result;
+      },
+      async loadCurrentMonthOrderList(dateRange) {
+        const URL = this.tabValue == '1' ? getList : getListStop;
+        const data = await URL({
+          pageNum: 1,
+          size: -1,
+          ...this.buildCurrentMonthOrderWhere(dateRange),
+          ...this.sort
+        });
+        return this.fillOrderSchedulingTeamInfo(data?.list || []);
+      },
+      async openFactoryScheduling() {
+        const loading = this.$loading({ text: '加载当月订单数据中...' });
+        let list = [];
+        try {
+          list = await this.loadCurrentMonthOrderList();
+        } catch (e) {
+          this.$message.error(e.message || '获取当月订单数据失败');
+          return;
+        } finally {
+          loading.close();
+        }
         const ids = Array.from(
           new Set(
             list
@@ -872,11 +990,17 @@
               .filter((id) => id !== null && id !== undefined && id !== '')
           )
         );
+        // 班组排程入口:
+        // 显式传 mode = order,让排程弹窗切换到工单表格、工位/设备页签,
+        // 并启用“工序配置按任务派单逻辑筛选工位”的专属处理。
+        // 订单表格不再取勾选缓存,统一使用订单列表接口返回的当月订单数据。
         this.$refs.newFactoryProductionSchedulingRef.open({
           ids,
           readonly: true,
           mode: 'order',
-          selectedWorkOrders: list
+          selectedWorkOrders: list,
+          orderListLoader: (dateRange) =>
+            this.loadCurrentMonthOrderList(dateRange)
         });
       },
 
@@ -897,16 +1021,18 @@
       /* 表格数据源 */
       datasource({ page, limit, where }) {
         this.selectionMap = {};
-        if (where.status) {
-          where.statusList = [];
-          where.statusList.push(where.status);
-          delete where.status;
+        const requestWhere = { ...(where || {}) };
+        this.currentOrderListWhere = { ...requestWhere };
+        if (requestWhere.status) {
+          requestWhere.statusList = [];
+          requestWhere.statusList.push(requestWhere.status);
+          delete requestWhere.status;
         }
         const URL = this.tabValue == '1' ? getList : getListStop;
         return URL({
           pageNum: page,
           size: limit,
-          ...where,
+          ...requestWhere,
           ...this.sort
         });
       },
@@ -1013,6 +1139,7 @@
 
       /* 刷新表格 */
       reload(where) {
+        this.currentOrderListWhere = { ...(where || {}) };
         this.$nextTick(() => {
           this.$refs.table.reload({ page: 1, where });
         });

部分文件因为文件数量过多而无法显示