695593266@qq.com 4 днів тому
батько
коміт
e4c5f89440

+ 5 - 0
src/views/produce/components/jobBooking/components/jobBom.vue

@@ -621,6 +621,9 @@
       .content_num {
         display: flex;
         align-items: center;
+        flex: 1 1 0;
+        width: auto;
+        min-width: 0;
         padding: 2px;
         --input-background-color: #f0f8f2;
       }
@@ -648,6 +651,7 @@
 
     .ww40 {
       width: 40%;
+      min-width: 0;
     }
 
     .ww30 {
@@ -688,6 +692,7 @@
 
   ::v-deep .content_num .el-input {
     width: 100%;
+    min-width: 0;
   }
 
   ::v-deep .content_num .el-input__inner {

+ 5 - 0
src/views/produce/components/jobBooking/components/jobDdBom.vue

@@ -628,6 +628,9 @@
       .content_num {
         display: flex;
         align-items: center;
+        flex: 1 1 0;
+        width: auto;
+        min-width: 0;
         padding: 2px;
         --input-background-color: #f0f8f2;
       }
@@ -655,6 +658,7 @@
 
     .ww40 {
       width: 40%;
+      min-width: 0;
     }
 
     .ww30 {
@@ -695,6 +699,7 @@
 
   ::v-deep .content_num .el-input {
     width: 100%;
+    min-width: 0;
   }
 
   ::v-deep .content_num .el-input__inner {

+ 110 - 1
src/views/produceOrder/workReport.vue

@@ -209,6 +209,9 @@
                 @footBtn="footBtn"
                 :type="type"
                 :singleReportInspection="singleReportInspection"
+                :qualityInspectionDisabled="qualityInspectionDisabled"
+                :qualityInspectionDisabledMsg="firstArticlePickFeedMsg"
+                :activeName="activeName"
                 style="background: rgba(223, 250, 222, 0.6); padding: 10px"
               ></footBtn>
             </el-tab-pane>
@@ -323,6 +326,7 @@
   import workOrderHandover from '@/views/produce/components/workOrderHandover/index.vue';
   import { checkProductionResult } from '@/api/producetaskrulerecord/index.js';
   import { getPlanDotLine } from '@/api/produceOrder/index.js';
+  import { checkFeedStatus } from '@/api/produce/feeding.js';
   import encodingDialog from '../produce/components/encodingDialog/index.vue';
 
   export default {
@@ -421,7 +425,10 @@
         isPleaseEntrust: false,
         workInfoList: {},
         drawerKey: 0,
-        planDotLineEnabled: false
+        planDotLineEnabled: false,
+        firstArticlePickFeedReady: true,
+        firstArticlePickFeedMsg: '',
+        firstArticlePickFeedCheckKey: ''
       };
     },
 
@@ -432,6 +439,16 @@
       info() {
         return this.$store.state.user.info;
       },
+      hasFirstArticleInspectionTarget() {
+        return this.activeName === '0' && this.workListIds.length > 0;
+      },
+      qualityInspectionDisabled() {
+        return (
+          this.info?.clientEnvironmentId == 9 &&
+          this.hasFirstArticleInspectionTarget &&
+          !this.firstArticlePickFeedReady
+        );
+      },
       rightShow() {
         return (type) => {};
       }
@@ -760,6 +777,7 @@
         this.workOrderInfo = row;
         this.routeObj.id = this.workOrderInfo.id;
         this.operationType = '';
+        this.resetFirstArticlePickFeedStatus();
         await this.getPlanDotLineConfig();
         // this.getTaskFn();
         this.drawer = true;
@@ -787,6 +805,7 @@
       feedSuccess() {
         this.getOrderData();
         this.getTaskFn();
+        this.refreshFirstArticlePickFeedStatus();
       },
 
       jobSuccess() {
@@ -896,6 +915,90 @@
         }
       },
 
+      resetFirstArticlePickFeedStatus() {
+        this.firstArticlePickFeedReady = true;
+        this.firstArticlePickFeedMsg = '';
+        this.firstArticlePickFeedCheckKey = '';
+      },
+
+      getFirstArticleWorkOrderId(row = {}) {
+        return row.id || row.workOrderId || row.mesWorkOrderId;
+      },
+
+      getFirstArticleInspectionRows() {
+        if (this.workOrderInfo && Object.keys(this.workOrderInfo).length) {
+          return [this.workOrderInfo];
+        }
+        return this.workListIds.map((id) => ({ id }));
+      },
+
+      async checkFirstArticlePickFeed(row) {
+        const workOrderId = this.getFirstArticleWorkOrderId(row);
+        const taskId = this.taskObj.id;
+        if (!workOrderId || !taskId) {
+          return true;
+        }
+
+        return checkFeedStatus({ taskId, workOrderId });
+      },
+
+      async refreshFirstArticlePickFeedStatus() {
+        if (this.info?.clientEnvironmentId != 9 || this.activeName !== '0') {
+          this.resetFirstArticlePickFeedStatus();
+          return true;
+        }
+
+        if (!this.hasFirstArticleInspectionTarget) {
+          this.resetFirstArticlePickFeedStatus();
+          return true;
+        }
+
+        const rows = this.getFirstArticleInspectionRows();
+        const checkKey = `${this.activeName}-${rows
+          .map(
+            (row) =>
+              `${this.taskObj.id}-${this.getFirstArticleWorkOrderId(row)}`
+          )
+          .join(',')}`;
+
+        this.firstArticlePickFeedCheckKey = checkKey;
+        this.firstArticlePickFeedReady = false;
+        this.firstArticlePickFeedMsg = '正在检查领料、投料状态';
+
+        try {
+          const needPromptList = await Promise.all(
+            rows.map((row) => this.checkFirstArticlePickFeed(row))
+          );
+
+          if (this.firstArticlePickFeedCheckKey !== checkKey) {
+            return this.firstArticlePickFeedReady;
+          }
+
+          const needPrompt = needPromptList.some(Boolean);
+          this.firstArticlePickFeedReady = !needPrompt;
+          this.firstArticlePickFeedMsg = needPrompt
+            ? '请先完成领料、投料后再进行首件两检'
+            : '';
+          return this.firstArticlePickFeedReady;
+        } catch (error) {
+          if (this.firstArticlePickFeedCheckKey === checkKey) {
+            this.firstArticlePickFeedReady = false;
+            this.firstArticlePickFeedMsg = '领料、投料状态检查失败,请稍后重试';
+          }
+          return false;
+        }
+      },
+
+      async validateFirstArticlePickFeedBeforeInspection() {
+        const ready = await this.refreshFirstArticlePickFeedStatus();
+        if (!ready) {
+          this.$message.warning(
+            this.firstArticlePickFeedMsg || '请先完成领料、投料后再进行首件两检'
+          );
+        }
+        return ready;
+      },
+
       async footBtn(t) {
         this.workPlanType = '';
         // this.operationType = t;
@@ -1117,6 +1220,10 @@
             return this.$message.warning('首件两检只能选择一个工单!');
           }
 
+          if (!(await this.validateFirstArticlePickFeedBeforeInspection())) {
+            return;
+          }
+
           const req = this.buildCraftFileReq(
             this.workOrderInfo,
             this.workOrderInfo.id
@@ -1174,6 +1281,7 @@
           this.newId = this.routeList[this.desIndex].taskId || '';
           this.getTaskName(this.workOrderInfo);
         }
+        this.refreshFirstArticlePickFeedStatus();
       },
 
       outsourcingAdd(type, activeName) {
@@ -1294,6 +1402,7 @@
           this.$nextTick(() => {
             this.$refs.pickListRef.getList(this.workListIds);
           });
+          this.refreshFirstArticlePickFeedStatus();
         }
         this.pickingShow = false;
       },