695593266@qq.com 1 tydzień temu
rodzic
commit
218ac3feb4

+ 9 - 0
src/api/mainData/index.js

@@ -104,6 +104,15 @@ export async function taskSave(data) {
   return Promise.reject(new Error(res.data.message));
 }
 
+// 派单前检查布点是否冲突
+export async function checkAssignSourceType(data) {
+  const res = await request.post('/aps/assign/checkAssignSourceType', data);
+  if (res.data.code == 0) {
+    return res.data.data;
+  }
+  return Promise.reject(new Error(res.data.message));
+}
+
 // 派单任务撤销
 export async function taskRevoked(data) {
   const res = await request.post('/aps/assign/assign/revoked', data);

+ 8 - 1
src/views/productionPlan/components/gantt/project-gantt.utils.js

@@ -233,7 +233,14 @@ export function buildTooltipHtml(
     },
     {
       label: '批次号',
-      value: planMeta.batchNo || ''
+      value:
+        task.batchNo ||
+        task.batchNumber ||
+        task.batchCode ||
+        planMeta.batchNo ||
+        planMeta.batchNumber ||
+        planMeta.batchCode ||
+        ''
     },
     ...resourceRows,
     ...(resourceLabelMode === 'order'

+ 2 - 2
src/views/productionPlan/components/newFactoryProductionScheduling.vue

@@ -2882,7 +2882,7 @@
                 matchedPlanInfo.routingName ||
                 matchedPlanInfo.produceRoutingName ||
                 '',
-              batchNo: matchedPlanInfo.batchNo || '',
+              batchNo: matchedPlanInfo.batchNo || period.batchNo || '',
               specification: matchedPlanInfo.specification || '',
               modeType: matchedPlanInfo.modeType || '',
               workstationName:
@@ -2928,7 +2928,7 @@
                 taskLabel,
                 childDisplayOrderCode,
                 matchedPlanInfo.productName,
-                matchedPlanInfo.batchNo
+                matchedPlanInfo.batchNo || period.batchNo
               ]
                 .filter(Boolean)
                 .join(' / '),

+ 83 - 4
src/views/productionPlan/components/newFactoryProductionScheduling/TaskConfigPanel.vue

@@ -669,6 +669,7 @@
   import chooseStation from '@/views/workOrder/components/chooseStation.vue';
   import {
     checkAssignConfirm,
+    checkAssignSourceType,
     listAssign,
     listByPlanIdAndTaskId,
     parameterGetByCode,
@@ -687,16 +688,14 @@
     'teamId',
     'firstTaskTeamId',
     'firstTeamId',
-    'teamIds',
-    'executionTeamId'
+    'teamIds'
   ];
   const DISPATCH_TEAM_NAME_KEYS = [
     'dispatchTeamName',
     'teamName',
     'firstTaskTeamName',
     'firstTeamName',
-    'teamNames',
-    'executionTeamName'
+    'teamNames'
   ];
 
   export default {
@@ -2311,6 +2310,18 @@
           assignees: this.buildDispatchAssignees(rows)
         };
       },
+      async validateDispatchSourceConflict(payload, type) {
+        if (!this.orderDispatchStyle || (type !== 1 && type !== 3)) {
+          return true;
+        }
+        const checked = await checkAssignSourceType(payload);
+        if (checked && checked.result === true) {
+          this.$message.warning(
+            checked.message || '当前派单数据存在冲突,请调整后再操作'
+          );
+        }
+        return true;
+      },
       validateFirstTaskConfirmReportType() {
         if (this.reportTypeValue === 0 || this.reportTypeValue === 1) {
           return true;
@@ -2444,6 +2455,9 @@
           type === 1 ? taskAssignment : type === 2 ? taskRevoked : taskSave;
         this.dispatchToolbarLoading = true;
         try {
+          if (!(await this.validateDispatchSourceConflict(data, type))) {
+            return;
+          }
           await api(data);
           await this.loadDispatchAssignData();
           this.$message.success('操作成功');
@@ -2581,6 +2595,70 @@
           String(this.dispatchObjectRowKey(row) || '')
         );
       },
+      ensureDispatchTeamSnapshot(task) {
+        if (!task) {
+          return;
+        }
+        const snapshot = {};
+        if (!task.dispatchTeamId) {
+          const teamId = this.pickDispatchTeamId([
+            {
+              source: task,
+              keys: [
+                'teamId',
+                'firstTaskTeamId',
+                'firstTeamId',
+                'teamIds',
+                'executionTeamId'
+              ]
+            },
+            { source: this.currentPlan || {}, keys: DISPATCH_TEAM_ID_KEYS }
+          ]);
+          if (teamId) {
+            snapshot.dispatchTeamId = teamId;
+          }
+        }
+        if (!task.dispatchTeamName) {
+          const teamName = this.pickDispatchSingleValue([
+            {
+              source: task,
+              keys: [
+                'teamName',
+                'firstTaskTeamName',
+                'firstTeamName',
+                'teamNames',
+                'executionTeamName'
+              ]
+            },
+            { source: this.currentPlan || {}, keys: DISPATCH_TEAM_NAME_KEYS }
+          ]);
+          if (teamName) {
+            snapshot.dispatchTeamName = teamName;
+          }
+        }
+        if (!task.dispatchTeamLeaderId) {
+          const leaderId = this.pickDispatchSingleValue([
+            {
+              source: task,
+              keys: [
+                'teamLeaderUserId',
+                'leaderUserId',
+                'executionTeamLeaderId'
+              ]
+            },
+            {
+              source: this.currentPlan || {},
+              keys: ['dispatchTeamLeaderId', 'teamLeaderUserId', 'leaderUserId']
+            }
+          ]);
+          if (leaderId) {
+            snapshot.dispatchTeamLeaderId = leaderId;
+          }
+        }
+        Object.keys(snapshot).forEach((key) => {
+          this.$set(task, key, snapshot[key]);
+        });
+      },
       isSelectedDispatchObject(row) {
         const task = this.getDispatchRowTask(row);
         return !!task;
@@ -2590,6 +2668,7 @@
         if (!task || !row) {
           return;
         }
+        this.ensureDispatchTeamSnapshot(task);
         this.$set(task, 'executionType', this.execType.HOMEMADE);
         this.$set(task, 'executionTeamId', this.dispatchObjectRowKey(row));
         this.$set(task, 'rawExecutionTeamId', row.rawId);

+ 29 - 1
src/views/workOrder/mixins/planDotLineRelease.js

@@ -9,6 +9,7 @@ import {
   taskAssignment,
   listAssign,
   checkAssignConfirm,
+  checkAssignSourceType,
   resetAssignee,
   listByRoutingIds,
   listByFactoryId,
@@ -622,7 +623,7 @@ export default {
       return isFlag;
     },
     // 派单
-    dispatch(row, type) {
+    async dispatch(row, type) {
       console.log(row, 'row 333');
       console.log(type, 'type');
       if (row.selection.length == 0) {
@@ -710,6 +711,16 @@ export default {
         }
       }
       this.toolbarLoading = true;
+      try {
+        if (!(await this.validateDispatchSourceConflict(data, type))) {
+          this.toolbarLoading = false;
+          return;
+        }
+      } catch (err) {
+        this.toolbarLoading = false;
+        this.$message.error(err.message);
+        return;
+      }
       const api =
         type == 1 ? taskAssignment : type == 2 ? taskRevoked : taskSave;
       api(data)
@@ -820,6 +831,23 @@ export default {
       this.$message.warning('请先选择报工类型');
       return false;
     },
+    async validateDispatchSourceConflict(data, type) {
+      const actionType = Number(type);
+      if (actionType !== 1 && actionType !== 3) {
+        return true;
+      }
+      const checked = await checkAssignSourceType(data);
+      const checkedResult =
+        checked && typeof checked === 'object' ? checked.result : checked;
+      const checkedMessage =
+        checked && typeof checked === 'object' ? checked.message : '';
+      if (checkedResult === true) {
+        this.$message.warning(
+          checkedMessage || '当前派单数据存在冲突,请调整后再操作'
+        );
+      }
+      return true;
+    },
     // 最后提交
     async confirm() {
       let flag = this.singleReportRadio();

+ 29 - 1
src/views/workOrder/mixins/release.js

@@ -9,6 +9,7 @@ import {
   taskAssignment,
   listAssign,
   checkAssignConfirm,
+  checkAssignSourceType,
   resetAssignee,
   listByRoutingIds,
   listByFactoryId,
@@ -450,7 +451,7 @@ export default {
       return isFlag;
     },
     // 派单
-    dispatch(row, type) {
+    async dispatch(row, type) {
       console.log(row, 'row 333');
       console.log(type, 'type');
       if (row.selection.length == 0) {
@@ -538,6 +539,16 @@ export default {
         }
       }
       this.toolbarLoading = true;
+      try {
+        if (!(await this.validateDispatchSourceConflict(data, type))) {
+          this.toolbarLoading = false;
+          return;
+        }
+      } catch (err) {
+        this.toolbarLoading = false;
+        this.$message.error(err.message);
+        return;
+      }
       const api =
         type == 1 ? taskAssignment : type == 2 ? taskRevoked : taskSave;
       api(data)
@@ -646,6 +657,23 @@ export default {
       this.$message.warning('请先选择报工类型');
       return false;
     },
+    async validateDispatchSourceConflict(data, type) {
+      const actionType = Number(type);
+      if (actionType !== 1 && actionType !== 3) {
+        return true;
+      }
+      const checked = await checkAssignSourceType(data);
+      const checkedResult =
+        checked && typeof checked === 'object' ? checked.result : checked;
+      const checkedMessage =
+        checked && typeof checked === 'object' ? checked.message : '';
+      if (checkedResult === true) {
+        this.$message.warning(
+          checkedMessage || '当前派单数据存在冲突,请调整后再操作'
+        );
+      }
+      return true;
+    },
     // 最后提交
     async confirm() {
       let flag = this.singleReportRadio();

+ 2 - 2
vue.config.js

@@ -35,14 +35,14 @@ module.exports = {
         // target: 'http://192.168.1.103:18086',
         // target: 'http://192.168.1.158:18086',
         // target: 'http://192.168.158:18086',
-        target: 'http://192.168.1.251:18086',
+        // target: 'http://192.168.1.251:18086',
         // target: 'http://192.168.1.144:18086',
         // target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.211:18086',
         // target: 'http://192.168.1.251:18186',
         // target: 'http://192.168.1.102:18086',
         // target: 'http://aiot.zoomwin.com.cn:51001/api',
-        // target: 'http://192.168.1.125:18086',
+        target: 'http://192.168.1.125:18086',
 
         // target: 'http://192.168.1.116:18086',