From 8818f234b5e4563aac5e629c04e37d81c932e4f9 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期四, 14 十二月 2023 22:17:59 +0800
Subject: [PATCH] 	modified:   src/api/quality/finishedProduct.js 	modified:   src/api/quality/processInspect.js 	modified:   src/api/quality/rawMaterial.js 	modified:   src/views/product/workbench/taskinfo-pane.vue 	modified:   src/views/quality/Packaging_ledger/pack-from.vue 	modified:   src/views/quality/finishedProductInspection/finishedProduct-form.vue 	modified:   src/views/quality/packageinspect/packageInspect-form.vue 	modified:   src/views/quality/processInspect/index.vue 	modified:   src/views/quality/processInspect/processInspect-form.vue 	modified:   src/views/quality/rawMaterial/rawMaterial-form.vue

---
 src/views/product/workbench/taskinfo-pane.vue                        |    4 -
 src/views/quality/rawMaterial/rawMaterial-form.vue                   |   88 +++++++++++++++------
 src/api/quality/processInspect.js                                    |    2 
 src/views/quality/Packaging_ledger/pack-from.vue                     |    2 
 src/views/quality/packageinspect/packageInspect-form.vue             |    3 
 src/api/quality/finishedProduct.js                                   |    2 
 src/api/quality/rawMaterial.js                                       |    2 
 src/views/quality/finishedProductInspection/finishedProduct-form.vue |   40 ++++++++-
 src/views/quality/processInspect/index.vue                           |    5 
 src/views/quality/processInspect/processInspect-form.vue             |   72 ++++++++++++++---
 10 files changed, 162 insertions(+), 58 deletions(-)

diff --git a/src/api/quality/finishedProduct.js b/src/api/quality/finishedProduct.js
index ca65f6e..7d56c3c 100644
--- a/src/api/quality/finishedProduct.js
+++ b/src/api/quality/finishedProduct.js
@@ -64,7 +64,7 @@
 
 export function updateFinishedInspectById(obj) {
   return request({
-    url: '/mes/qualityFinishedInspect/updateFinishedInspectById',
+    url: '/mes/qualityFinishedInspect/updateFinishedInspectById2',
     method: 'post',
     params: obj
   })
diff --git a/src/api/quality/processInspect.js b/src/api/quality/processInspect.js
index acccc59..db18d8e 100644
--- a/src/api/quality/processInspect.js
+++ b/src/api/quality/processInspect.js
@@ -27,7 +27,7 @@
 
 export function updateProcessInspectsById(query) {
   return request({
-    url: '/mes/qualityProcessInspect/updateProcessInspectsById',
+    url: '/mes/qualityProcessInspect/updateProcessInspectsById2',
     method: 'post',
     params: query
   })
diff --git a/src/api/quality/rawMaterial.js b/src/api/quality/rawMaterial.js
index abf8b52..5f96d9d 100644
--- a/src/api/quality/rawMaterial.js
+++ b/src/api/quality/rawMaterial.js
@@ -56,7 +56,7 @@
 
 export function updateRawInspectsById(data) {
   return request({
-    url: '/mes/rawInspect/updateRawInspectsById/'+data.id,
+    url: '/mes/rawInspect/updateRawInspectsById2/'+data.id,
     method: 'post',
     params: data
   })
diff --git a/src/views/product/workbench/taskinfo-pane.vue b/src/views/product/workbench/taskinfo-pane.vue
index 443fda6..c81cf91 100644
--- a/src/views/product/workbench/taskinfo-pane.vue
+++ b/src/views/product/workbench/taskinfo-pane.vue
@@ -1891,10 +1891,6 @@
     currOperateTask: {
       handler(newValue, oldValue) {
         if (newValue.id) {
-          console.log(
-            'currOperateTask',
-            this.currOperateTask.routingOperationRemark
-          )
           this.opTask.statusDesc = newValue.statusDesc
           // 鏌ヨparamDatas
           this.getTechnologyRoutingParam(newValue)
diff --git a/src/views/quality/Packaging_ledger/pack-from.vue b/src/views/quality/Packaging_ledger/pack-from.vue
index e780818..0c6937c 100644
--- a/src/views/quality/Packaging_ledger/pack-from.vue
+++ b/src/views/quality/Packaging_ledger/pack-from.vue
@@ -140,7 +140,7 @@
     //   ...mapGetters(['permissions'])
     },
     created() {
-      this.getParamType()
+      // this.getParamType()
     },
     methods: {
          // 鑾峰彇鏁版嵁鍒楄〃
diff --git a/src/views/quality/finishedProductInspection/finishedProduct-form.vue b/src/views/quality/finishedProductInspection/finishedProduct-form.vue
index 7d3842e..fd45c92 100644
--- a/src/views/quality/finishedProductInspection/finishedProduct-form.vue
+++ b/src/views/quality/finishedProductInspection/finishedProduct-form.vue
@@ -341,6 +341,11 @@
                     pro+=arr.length
                 }
             })
+            let obj = {
+                id: this.processInspectVo.id,
+                number: 0,
+                result: this.inspectionResultForm[0].result
+            }
             if (pro > 0) {
                 this.$prompt('璇疯緭鍏ヤ笉鍚堟牸鏁伴噺', '涓嶅悎鏍兼暟閲�', {
                     confirmButtonText: '纭畾',
@@ -348,11 +353,8 @@
                     inputPattern: /^\d+$/,
                     inputErrorMessage: '璇疯緭鍏ユ纭暟瀛楁牸寮�'
                 }).then(({ value }) => {
-                    let data = {
-                    id: this.processInspectVo.id,
-                    number: value
-                    }
-                    updateFinishedInspectById(data).then(res => {
+                    obj.number = value
+                    updateFinishedInspectById(obj).then(res => {
                         if(res.data.data.indexOf("鎴愬姛") > 0){
                             this.$message.success("涓婃姤鎴愬姛");
                             this.checkTestState()
@@ -362,7 +364,7 @@
                     });
                 }).catch(() => {});
             }else{
-                updateFinishedInspectById({id:this.processInspectVo.id,number:0}).then(res => {
+                updateFinishedInspectById(obj).then(res => {
                     if(res.data.data.indexOf("鎴愬姛") > 0){
                             this.$message.success("涓婃姤鎴愬姛");
                             this.checkTestState()
@@ -558,12 +560,38 @@
                 }
             })
         },
+        changeRowResult(){
+            if(this.inspectionItems){
+                this.inspectionItems.forEach(e=>{
+                    if(e.children){
+                        e.children.forEach(i=>{
+                            if(i.empiricalValueAddss.length>1){
+                                let arr = i.inspectionValue.split(",")
+                                arr.splice((arr.length-1),1)
+                                let obj = {
+                                    devideId: i.eId,
+                                    fpid: row.iid,
+                                    inspectionValue: arr.join(","),
+                                    note : i.inote
+                                }
+                                updateFinishedInsProduct(obj).then(res => {
+                                    if (res.data.code == 0) {
+                                        this.init()
+                                    } 
+                                })
+                            }
+                        })
+                    }
+                })
+            }
+        },
         // 鍒犻櫎妫�楠屽�煎垪
         clickDeleteInspectionColumn() {
             if (this.empiricalValueAdd - 1 === 0) {
             } else {
                 if (this.empiricalValueAddMaxNumber != this.empiricalValueAdd - 1) {
                     this.empiricalValueAdd = this.empiricalValueAdd - 1;
+                    this.changeRowResult()
                     this.inspectionItems.forEach(i => {
                         i.empiricalValueAddss.splice(this.empiricalValueAdd, 1);
                     });
diff --git a/src/views/quality/packageinspect/packageInspect-form.vue b/src/views/quality/packageinspect/packageInspect-form.vue
index 53f333c..4f825f5 100644
--- a/src/views/quality/packageinspect/packageInspect-form.vue
+++ b/src/views/quality/packageinspect/packageInspect-form.vue
@@ -282,7 +282,6 @@
               _than.confirmSubmit(_than.submitData,true)
             }
           }).catch(error=>{
-            console.log("杈撳叆琛屽彿");
             _than.dialogVisible = true
           })
 
@@ -353,6 +352,7 @@
           })
           this.list[i].children.splice(childrenIndex,1)
         }
+        this.changeResult()
       },
       //淇濆瓨妫�鏌ラ」
       savePackIns(){
@@ -379,6 +379,7 @@
           updatePackageInsProduct(dataList).then(res=>{
             if(res.status===200){
               this.$message.success("淇濆瓨鎴愬姛")
+              this.init()
             }
           }).catch(error=>{
             console.log(error);
diff --git a/src/views/quality/processInspect/index.vue b/src/views/quality/processInspect/index.vue
index bc7e979..2fddf58 100644
--- a/src/views/quality/processInspect/index.vue
+++ b/src/views/quality/processInspect/index.vue
@@ -217,8 +217,9 @@
 			addOrUpdateHandle(row) {
 				this.$router.push({
 					name: 'processInspectForm',
-					query: { id: row == null ? null : row.id,resultVal : row == null ? null : row.result },
-				})
+					query: { id: row == null ? null : row.id },
+                    params: { resultVal : row == null ? null : row.result }
+                })
 			},
             formatResult(row, column, cellValue){
                 if(cellValue != undefined || cellValue != null){
diff --git a/src/views/quality/processInspect/processInspect-form.vue b/src/views/quality/processInspect/processInspect-form.vue
index 31f055e..239b2bc 100644
--- a/src/views/quality/processInspect/processInspect-form.vue
+++ b/src/views/quality/processInspect/processInspect-form.vue
@@ -264,11 +264,12 @@
     mounted() {
         this.getDeviceList()
         this.processInspectVo.id = this.$route.query.id
-        this.resultVal = this.$route.query.resultVal
+        this.resultVal = this.$route.params.resultVal
         if (this.resultVal == null) {
             let val = sessionStorage.getItem("process-resultVal-" + this.processInspectVo.id);
             val == undefined ? this.resultVal = null : this.resultVal = val
         }
+        console.log(this.resultVal);
         this.init()
     },
     methods: {
@@ -282,6 +283,11 @@
                     pro += arr.length
                 }
             })
+            let obj = {
+                id: this.processInspectVo.id,
+                number: 0,
+                result: this.inspectionResultForm[0].result
+            }
             if (pro > 0) {
                 this.$prompt('璇疯緭鍏ヤ笉鍚堟牸鏁伴噺', '涓嶅悎鏍兼暟閲�', {
                     confirmButtonText: '纭畾',
@@ -289,11 +295,8 @@
                     inputPattern: /^\d+$/,
                     inputErrorMessage: '璇疯緭鍏ユ纭暟瀛楁牸寮�'
                 }).then(({ value }) => {
-                    let data = {
-                        id: this.processInspectVo.id,
-                        number: value
-                    }
-                    updateProcessInspectsById(data).then(res => {
+                    obj.number = value
+                    updateProcessInspectsById(obj).then(res => {
                         let data = res.data.data
                         if (data) {
                             if (data.indexOf("鎴愬姛") > 0) {
@@ -307,7 +310,7 @@
                     });
                 }).catch(() => { });
             } else {
-                updateProcessInspectsById({ id: this.processInspectVo.id, number: 0 }).then(res => {
+                updateProcessInspectsById(obj).then(res => {
                     let data = res.data.data
                     if (data) {
                         if (data.indexOf("鎴愬姛") > 0) {
@@ -373,11 +376,21 @@
                         }
                     })
                     this.inspectionItems = result.children
+                    let rVal = '1'
+                    this.inspectionItems.forEach(item => {
+                        if (item.children) {
+                            item.children.forEach(obj => {
+                                if (obj.iresult == 0) {
+                                    rVal = '0'
+                                }
+                            })
+                        }
+                    })
                     this.inspectionResultForm = [{
                         materialCode: result.materialCode,
                         material: result.material,
                         userName: Array.from(new Set(userList)).join(","),
-                        result: this.resultVal == null ? '' : this.resultVal,
+                        result: this.resultVal == null ? rVal : this.resultVal,
                     }]
                 }).catch(error => {
                     console.log(error)
@@ -418,7 +431,6 @@
             this.technologyList = sample.children
         },
         changeState(row,isChecked) {
-            console.log(row);
             const _than = this
             if(isChecked){
                 let isNumber = true
@@ -443,7 +455,6 @@
                 if (str === undefined || str === '' || str === null) {
                     return
                 }
-
                 let obj = {
                     devideId: row.eId,
                     ppid: row.iid,
@@ -510,14 +521,45 @@
                 }
             })
         },
+        changeRowResult(){
+            if(this.inspectionItems){
+                this.inspectionItems.forEach(e=>{
+                    if(e.children){
+                        e.children.forEach(i=>{
+                            if(i.empiricalValueAddss.length>1){
+                                let arr = i.inspectionValue.split(",")
+                                arr.splice((arr.length-1),1)
+                                let obj = {
+                                    devideId: i.eId,
+                                    ppid: i.iid,
+                                    inspectionValue: arr.join(","),
+                                    note : i.inote
+                                }
+                                updateProcessInsProduct(obj).then(res => {
+                                    if (res.data.code == 0) {
+                                        this.init()
+                                    } 
+                                })
+                            }
+                        })
+                    }
+                })
+            }
+        },
         // 鍒犻櫎妫�楠屽�煎垪
         clickDeleteInspectionColumn() {
-            if (this.empiricalValueAdd - 1 === 0) {
+            const _than = this
+            if (_than.empiricalValueAdd - 1 === 0) {
             } else {
-                if (this.empiricalValueAddMaxNumber != this.empiricalValueAdd - 1) {
-                    this.empiricalValueAdd = this.empiricalValueAdd - 1;
-                    this.inspectionItems.forEach(i => {
-                        i.empiricalValueAddss.splice(this.empiricalValueAdd, 1);
+                if (_than.empiricalValueAddMaxNumber != _than.empiricalValueAdd - 1) {
+                    _than.empiricalValueAdd = _than.empiricalValueAdd - 1;
+                    _than.changeRowResult()
+                    _than.inspectionItems.forEach(i => {
+                        if(i.children){
+                            i.children.forEach(ele=>{
+                                ele.empiricalValueAddss.splice(_than.empiricalValueAdd, 1);
+                            })
+                        }
                     });
                 }
             }
diff --git a/src/views/quality/rawMaterial/rawMaterial-form.vue b/src/views/quality/rawMaterial/rawMaterial-form.vue
index 578e65c..93a3a20 100644
--- a/src/views/quality/rawMaterial/rawMaterial-form.vue
+++ b/src/views/quality/rawMaterial/rawMaterial-form.vue
@@ -170,10 +170,11 @@
                     <template slot-scope="scope">
                       <div v-if="!scope.row.children">
                       <el-tooltip :disabled="scope.row.deviceId != null" class="item" effect="dark" content="璇峰厛閫夋嫨璁惧锛�" placement="top-start">
-                          <el-select @blur="changeState(scope.row, index)" style="width:100%" allow-create filterable default-first-option
+                          <el-select style="width:100%" allow-create filterable default-first-option
                           :disabled="scope.row.deviceId == null ||  (dataForm.id!=null&&resultVal!=null)"
                           v-model="scope.row.testValueList[index]"
-                          placeholder="璇疯緭鍏ユ垨閫夋嫨妫�娴嬪��" @change="updateTestValue(scope.row,scope.$index)">
+                          placeholder="璇疯緭鍏ユ垨閫夋嫨妫�娴嬪��" 
+                          @change="changeState(scope.row,scope.$index)">
                             <el-option label="鏄�" value="鏄�"/>
                             <el-option label="鍚�" value="鍚�"/>
                           </el-select>
@@ -501,6 +502,7 @@
         let data = {
           id: this.dataForm.id,
           number: this.unqualifiedNum,
+          result: this.conclusionTable[0].testState
         }
         updateRawInspectsById(data).then(res => {
           if(res.data.code == 0 && (res.data.data=='1'|| res.data.data=='0')){
@@ -567,37 +569,45 @@
         }
 
       },
+      changeRowResult(){
+          if(this.list){
+              this.list.forEach(e=>{
+                  if(e.children){
+                      e.children.forEach(i=>{
+                          if(i.testValueList.length>1){
+                              let arr = i.testValue.split(",")
+                              arr.splice((arr.length-1),1)
+                              let obj = {
+                                deviceId: i.deviceId,
+                                rpId: i.rpId,
+                                testValue: arr.join(","),
+                                note: i.note
+                              }
+                              updateRawInsProduct(obj).then(res=>{
+                                if(res.data.code === 0){
+                                  this.init()
+                                }
+                              })
+                          }
+                      })
+                  }
+              })
+          }
+      },
       delTeatValueColumn(){
         if (this.empiricalValueAdd - 1 > 0) {
           if (this.empiricalValueAddMaxNumber != this.empiricalValueAdd - 1) {
             this.empiricalValueAdd = this.empiricalValueAdd - 1;
+            this.changeRowResult()
             this.list.forEach(i => {
-              i.testValueList.splice(this.empiricalValueAdd, 1);
+              if(i.children){
+                i.children.forEach(ele=>{
+                  ele.testValueList.splice(this.empiricalValueAdd, 1);
+                })
+              }
             });
           }
         }
-      },
-      updateTestValue(row,index){
-        if(row.rpId == null){
-          return
-        }
-        let val = row.testValueList.join(",");
-        let obj = {
-          deviceId: row.deviceId,
-          rpId: row.rpId,
-          testValue: val,
-          note: row.note
-        }
-        updateRawInsProduct(obj).then(res=>{
-          if(res.data.code === 0){
-            this.$message.success("鏇存柊鎴愬姛")
-            this.init()
-          }else{
-            this.$message.success("鏇存柊澶辫触")
-          }
-        }).catch(error=>{
-          this.$message.error(error)
-        })
       },
       init(){
         if(this.dataForm.id){
@@ -656,11 +666,21 @@
                     this.list.push(ele)
                 }}
             })
+            let rVal = '1'
+            this.list.forEach(item=>{
+                if(item.children){
+                  item.children.forEach(ele=>{
+                    if(ele.testState == 0){
+                      rVal = '0'
+                    }
+                  })
+                }
+            })
             this.conclusionTable = [{
               code: data.code,
               name: data.name,
               userName: Array.from(new Set(userNameList)).join(','),
-              testState: this.resultVal==null?null:this.resultVal
+              testState: this.resultVal==null?rVal:this.resultVal
             }]
           }).catch(error=>{
             this.$message.error("鑾峰彇澶辫触",error)
@@ -670,6 +690,22 @@
         }
       },
       changeState(row, index) {
+          if(row){
+            let isTrue = true
+            for(var i=0;i<row.testValueList.length;i++){
+              let val = row.testValueList[i]
+              let reg = /^[0-9]*[1-9][0-9]*$/
+              console.log(['鏄�','鍚�'].includes(val));
+              if(!reg.test(val) && !['鏄�','鍚�'].includes(val)){
+                this.$message.error("璇疯緭鍏ユ暟瀛楁垨閫夋嫨鏄惁")
+                row.testValueList[i] = null
+                isTrue = false
+              }
+            }
+            if(!isTrue){
+              return
+            }
+          }
           if (row.rpId != null && row.rpId != '') {
             let val = row.testValueList.join(",")
             if (val === undefined || val === '' || val === null) {

--
Gitblit v1.9.3