Kaynağa Gözat

修复入库工序的时候会检验首件两检

695593266@qq.com 5 ay önce
ebeveyn
işleme
bb1617e1a3
2 değiştirilmiş dosya ile 154 ekleme ve 39 silme
  1. 127 32
      src/views/produce/index.vue
  2. 27 7
      src/views/produceOrder/workReport.vue

+ 127 - 32
src/views/produce/index.vue

@@ -1737,8 +1737,6 @@
 
       /* ================== job ================== */
       async handleJob() {
-        // const resultValue = await this.getFirstArticleConfig();
-
         if (this.activeName == '1') {
           return this.handleTaskJob();
         }
@@ -1747,32 +1745,53 @@
       },
 
       async handleTaskJob() {
-        if (!this.taskData) {
-          this.isFinalCheckProduction = false;
-          return this.$message.warning('请选择一条任务单进行报工');
-        }
+        this.isFinalCheckProduction = false;
 
-        if (this.taskData.disposalStatus == '0') {
-          return this.$message.warning('请先接收任务再做首件两检');
-        }
+        const row = this.taskData;
+        if (!this.checkTaskJob(row)) return;
+
+        this.isFinalCheckProduction = true;
+
+        const currentRow = this.buildCurrentRow(row);
+        const form = this.buildForm(row);
+
+        this.$nextTick(() => {
+          this.$refs.taskReportRef.open('repoort', currentRow, form);
+        });
+      },
 
-        if (this.taskData.disposalStatus == '2') {
-          return this.$message.warning('该任务单已被拒绝');
+      checkTaskJob(row) {
+        if (!row) {
+          this.$message.warning('请选择一条任务单进行报工');
+          return false;
         }
 
-        const row = this.taskData;
+        // 任务状态校验
+        const statusMessageMap = {
+          0: '请先接收任务再做首件两检',
+          2: '该任务单已被拒绝'
+        };
 
+        if (statusMessageMap[row.disposalStatus]) {
+          this.$message.warning(statusMessageMap[row.disposalStatus]);
+          return false;
+        }
+
+        // 首件两检校验
         if (
+          this.taskObj.id != '-1' &&
           row.hasFirstArticleDualInspection == '1' &&
           row.totalFirstArticleDualInspectionStatus != '2'
         ) {
-          this.isFinalCheckProduction = false;
-          return this.$message.warning('请先完成首件两检再报工');
+          this.$message.warning('请先完成首件两检再报工');
+          return false;
         }
 
-        this.isFinalCheckProduction = true;
+        return true;
+      },
 
-        const currentRow = {
+      buildCurrentRow(row) {
+        return {
           assignCode: row.assignCode,
           mesWorkOrderCode: row.mesWorkOrderCode,
           workOrderCode: row.workOrderCode,
@@ -1784,8 +1803,8 @@
           planStartTime: row.planStartTime,
           planCompleteTime: row.planCompleteTime,
           startTime: row.startTime,
-          firstTaskId: row.firstTaskId,
           endTime: row.endTime,
+          firstTaskId: row.firstTaskId,
           taskName: row.taskName,
           firstTaskName: row.firstTaskName,
           assigneeType: row.assigneeType?.desc || '',
@@ -1801,31 +1820,107 @@
           newWeightUnit: row.newWeightUnit,
           measuringUnit: row.measuringUnit
         };
+      },
 
-        const form = {
-          realEndTime: row.realEndTime,
+      buildForm(row) {
+        return {
           realStartTime: row.realStartTime,
-          unqualifiedWeight: row.unqualifiedWeight,
-          unqualifiedQuantity: row.unqualifiedQuantity,
-          qualifiedWeight: row.qualifiedWeight,
-          remark: row.assigneeRemark,
+          realEndTime: row.realEndTime,
           qualifiedQuantity: row.qualifiedQuantity,
+          qualifiedWeight: row.qualifiedWeight,
+          unqualifiedQuantity: row.unqualifiedQuantity,
+          unqualifiedWeight: row.unqualifiedWeight,
           reportQuantity: row.reportQuantity,
-          lossQuantity: row.lossQuantity
+          lossQuantity: row.lossQuantity,
+          remark: row.assigneeRemark
         };
-
-        this.$nextTick(() => {
-          this.$refs.taskReportRef.open('repoort', currentRow, form);
-        });
       },
 
+      // async handleTaskJob() {
+      //   if (!this.taskData) {
+      //     this.isFinalCheckProduction = false;
+      //     return this.$message.warning('请选择一条任务单进行报工');
+      //   }
+
+      //   if (this.taskData.disposalStatus == '0') {
+      //     this.isFinalCheckProduction = false;
+      //     return this.$message.warning('请先接收任务再做首件两检');
+      //   }
+
+      //   if (this.taskData.disposalStatus == '2') {
+      //     this.isFinalCheckProduction = false;
+      //     return this.$message.warning('该任务单已被拒绝');
+      //   }
+
+      //   const row = this.taskData;
+      //   this.isFinalCheckProduction = false;
+      //   if (this.taskObj.id != '-1') {
+      //     if (
+      //       row.hasFirstArticleDualInspection == '1' &&
+      //       row.totalFirstArticleDualInspectionStatus != '2'
+      //     ) {
+      //       return this.$message.warning('请先完成首件两检再报工');
+      //     }
+      //   }
+
+      //   this.isFinalCheckProduction = true;
+
+      //   const currentRow = {
+      //     assignCode: row.assignCode,
+      //     mesWorkOrderCode: row.mesWorkOrderCode,
+      //     workOrderCode: row.workOrderCode,
+      //     productionPlanCode: row.productionPlanCode,
+      //     produceRoutingName: row.produceRoutingName,
+      //     formingNum: row.formingNum,
+      //     assignTeamName: row.assignTeamName,
+      //     formingWeight: row.formingWeight,
+      //     planStartTime: row.planStartTime,
+      //     planCompleteTime: row.planCompleteTime,
+      //     startTime: row.startTime,
+      //     firstTaskId: row.firstTaskId,
+      //     endTime: row.endTime,
+      //     taskName: row.taskName,
+      //     firstTaskName: row.firstTaskName,
+      //     assigneeType: row.assigneeType?.desc || '',
+      //     assigneeName: row.assigneeName,
+      //     weight: row.weight,
+      //     quantity: row.quantity,
+      //     durationText: row.durationText,
+      //     apsAssigneeId: row.id,
+      //     batchNo: row.batchNo,
+      //     productCode: row.productCode,
+      //     productName: row.productName,
+      //     specification: row.specification,
+      //     newWeightUnit: row.newWeightUnit,
+      //     measuringUnit: row.measuringUnit
+      //   };
+
+      //   const form = {
+      //     realEndTime: row.realEndTime,
+      //     realStartTime: row.realStartTime,
+      //     unqualifiedWeight: row.unqualifiedWeight,
+      //     unqualifiedQuantity: row.unqualifiedQuantity,
+      //     qualifiedWeight: row.qualifiedWeight,
+      //     remark: row.assigneeRemark,
+      //     qualifiedQuantity: row.qualifiedQuantity,
+      //     reportQuantity: row.reportQuantity,
+      //     lossQuantity: row.lossQuantity
+      //   };
+
+      //   this.$nextTick(() => {
+      //     this.$refs.taskReportRef.open('repoort', currentRow, form);
+      //   });
+      // },
+
       async handleWorkOrderJob() {
         if (!this.checkWorkOrder({ min: 1 })) return;
 
-        const result = await this.checkQualityResult();
-        if (!result?.firstArticleDualInspectionResult) {
-          this.isFinalCheckProduction = false;
-          return this.$message.warning('请完成首件两检再报工!');
+        this.isFinalCheckProduction = false;
+        if (this.taskObj.id != '-1') {
+          const result = await this.checkQualityResult();
+          if (!result?.firstArticleDualInspectionResult) {
+            return this.$message.warning('请完成首件两检再报工!');
+          }
         }
 
         this.isFinalCheckProduction = true;

+ 27 - 7
src/views/produceOrder/workReport.vue

@@ -813,18 +813,38 @@
           // });
 
           // if (resultValue == '1') {
-          const result = await this.checkQualityResult();
+          // this.isFinalCheckProduction = false;
+          // if (this.taskObj.id != '-1') {
+          //   const result = await this.checkQualityResult();
+          //   if (!result) return;
+
+          //   const firstArticleResult =
+          //     result.firstArticleDualInspectionResult ?? true;
+
+          //   this.isFinalCheckProduction = firstArticleResult;
+
+          //   if (!firstArticleResult) {
+          //     return this.$message.warning('请完成首件两检再报工!');
+          //   }
+          // }
+
+          // this.isFinalCheckProduction = true;
           this.isFinalCheckProduction = false;
-          if (!result) return;
 
-          const firstArticleResult =
-            result.firstArticleDualInspectionResult ?? true;
+          if (this.taskObj.id != '-1') {
+            const result = await this.checkQualityResult();
+            if (!result) return;
 
-          this.isFinalCheckProduction = firstArticleResult;
+            const firstArticleResult =
+              result.firstArticleDualInspectionResult ?? true;
 
-          if (!firstArticleResult) {
-            return this.$message.warning('请完成首件两检再报工!');
+            if (!firstArticleResult) {
+              this.$message.warning('请完成首件两检再报工!');
+              return;
+            }
           }
+
+          this.isFinalCheckProduction = true;
           // }
 
           // const isWorkCenter =