From 75e035a10a0faeff6b2ec4b9fcbf98d1536274f2 Mon Sep 17 00:00:00 2001
From: 王震 <10952869+daywangzhen@user.noreply.gitee.com>
Date: 星期四, 07 十二月 2023 10:57:15 +0800
Subject: [PATCH] Merge branch 'master' of http://114.132.189.42:9002/r/mes-ocea-before

---
 src/views/product/workbench/batchproductout-form-new.vue |  283 +++++++++++++++++++++++++++++++++++---------------------
 1 files changed, 177 insertions(+), 106 deletions(-)

diff --git a/src/views/product/workbench/batchproductout-form-new.vue b/src/views/product/workbench/batchproductout-form-new.vue
index eae3304..11f7e1a 100644
--- a/src/views/product/workbench/batchproductout-form-new.vue
+++ b/src/views/product/workbench/batchproductout-form-new.vue
@@ -8,17 +8,17 @@
 -->
 <template>
   <el-dialog
-    width="95%"
-    title="鎵归噺浜у嚭"
+    width="90%"
+    title="姹囨姤浜у嚭"
     :visible.sync="innerVisible"
     append-to-body
-    @close="$emit('update:currshowlist', false)"
+    @close="handleClose"
     :show="currshowlist"
     :close-on-click-modal="false"
     class="batch-product-out-form"
   >
     <div
-      style="float: left;width: 15%;box-sizing: border-box;padding-right: 34px;position: relative"
+      style="float: left;width: 20%;box-sizing: border-box;padding-right: 34px;position: relative"
     >
       <el-table
         stripe
@@ -48,7 +48,7 @@
         style="position: absolute;top:0px;right: 0px;height: 100%;width: 34px;border-left: 1px solid #f4f2ea;border-right: 1px solid #f4f2ea;"
       ></div>
     </div>
-    <div style="float: left;width: 85%">
+    <div style="float: left;width: 80%">
       <el-row style="">
         <el-col :span="1" class="batch-product-out-form-header-col"
           ><span>搴忓彿</span></el-col
@@ -57,10 +57,10 @@
         ><el-col :span="2" class="batch-product-out-form-header-col"
           ><span>闆朵欢鍚嶇О</span></el-col
         >
-        <el-col :span="4" class="batch-product-out-form-header-col"
-          ><span>SN鍙�</span></el-col
-        >
-        <el-col :span="2" class="batch-product-out-form-header-col"
+        <!-- <el-col :span="4" class="batch-product-out-form-header-col"
+          ><span>搴忓垪鍙�</span></el-col
+        > -->
+        <!-- <el-col :span="2" class="batch-product-out-form-header-col"
           ><span>杞藉叿缂栧彿</span></el-col
         >
         <el-col :span="1" class="batch-product-out-form-header-col"
@@ -68,34 +68,40 @@
         >
         <el-col :span="1" class="batch-product-out-form-header-col"
           ><span>姣忕洏浜ч噺</span></el-col
-        >
-        <el-col :span="1" class="batch-product-out-form-header-col"
+        > -->
+        <!-- <el-col :span="1" class="batch-product-out-form-header-col"
           ><span>璧峰绫虫爣</span></el-col
         >
         <el-col :span="1" class="batch-product-out-form-header-col"
           ><span>鎴绫虫爣</span></el-col
-        >
+        > -->
         <el-col :span="1" class="batch-product-out-form-header-col"
           ><span>鍗曚綅</span></el-col
         >
-        <el-col :span="1" class="batch-product-out-form-header-col"
+        <!-- <el-col :span="2" class="batch-product-out-form-header-col"
+          ><span>WDR鍙�</span></el-col
+        > -->
+        <!-- <el-col :span="1" class="batch-product-out-form-header-col"
           ><span>鍒嗘鎻忚堪</span></el-col
-        >
-        <el-col :span="1" class="batch-product-out-form-header-col"
+        > -->
+				<el-col :span="2" class="batch-product-out-form-header-col"
+				  ><span>鐢熶骇鏁伴噺</span></el-col
+				>
+        <el-col :span="2" class="batch-product-out-form-header-col"
           ><span>鎶ュ簾鏁伴噺</span></el-col
         >
-        <el-col :span="1" class="batch-product-out-form-header-col"
+        <!-- <el-col :span="1" class="batch-product-out-form-header-col"
           ><span>鐩樺叿閲嶉噺</span></el-col
-        >
-        <el-col :span="1" class="batch-product-out-form-header-col"
+        > -->
+        <!-- <el-col :span="1" class="batch-product-out-form-header-col"
           ><span>姣涢噸</span></el-col
-        >
+        > -->
         <!--<el-col :span="1" class="batch-product-out-form-header-col"
           ><span>IFS鎵规鍙�</span></el-col
         >-->
-        <el-col :span="2" class="batch-product-out-form-header-col"
+        <el-col :span="3" class="batch-product-out-form-header-col"
           ><span>鐢熶骇浜哄憳</span></el-col
-        ><el-col :span="1" class="batch-product-out-form-header-col"
+        ><el-col :span="2" class="batch-product-out-form-header-col"
           ><span>澶囨敞</span></el-col
         >
         <el-col :span="1" class="batch-product-out-form-header-col"
@@ -127,24 +133,12 @@
               <span class="inline-el-hidden">{{ item.partName }}</span>
             </el-tooltip>
           </el-col>
-          <el-col :span="4" class="batch-product-out-form-body-col">
-            <span v-show="!item.batchNoEdit">{{ item.outBatchNo }}</span>
-            <!--<el-input v-show="item.batchNoEdit" v-model="item.outBatchNo">
-              <i
-                slot="prefix"
-                class="el-input__icon el-icon-search"
-                style="cursor:pointer"
-                @click="openOutPutBatch(item)"
-              ></i>
-              <i
-                slot="suffix"
-                class="el-input__icon el-icon-circle-close"
-                style="cursor:pointer"
-                @click="cleanOutBatchNo(item)"
-              ></i>
-            </el-input>-->
-          </el-col>
-          <el-col :span="2" class="batch-product-out-form-body-col l-mes">
+          <!-- <el-col :span="4" class="batch-product-out-form-body-col l-mes"> -->
+            <!-- <span>{{ item.outBatchNo }}</span> -->
+            <!-- <el-input v-model="item.outBatchNo">
+            </el-input>
+          </el-col> -->
+          <!-- <el-col :span="2" class="batch-product-out-form-body-col l-mes">
             <el-input v-model="item.reelNumber"></el-input>
           </el-col>
           <el-col :span="1" class="batch-product-out-form-body-col l-mes">
@@ -152,32 +146,43 @@
           </el-col>
           <el-col :span="1" class="batch-product-out-form-body-col l-mes">
             <span>{{ item.productQty }}</span>
-          </el-col>
-          <el-col :span="1" class="batch-product-out-form-body-col l-mes">
+          </el-col> -->
+          <!-- <el-col :span="1" class="batch-product-out-form-body-col l-mes">
             <el-input v-model="item.startMeterMark"></el-input>
           </el-col>
           <el-col :span="1" class="batch-product-out-form-body-col l-mes">
             <el-input v-model="item.endMeterMark"></el-input>
-          </el-col>
+          </el-col> -->
           <el-col :span="1" class="batch-product-out-form-body-col">
             <span>{{ item.unit }}</span>
           </el-col>
-          <el-col :span="1" class="batch-product-out-form-body-col l-mes">
+          <!-- <el-col :span="2" class="batch-product-out-form-body-col l-mes">
+            <el-input v-model="item.wdr"></el-input>
+          </el-col> -->
+          <!-- <el-col :span="1" class="batch-product-out-form-body-col l-mes">
             <el-input v-model="item.segmentDesc"></el-input>
+          </el-col> -->
+					<el-col :span="2" class="batch-product-out-form-body-col l-mes">
+					  <span v-text="item.outNum"></span>
+					</el-col>
+          <el-col :span="2" class="batch-product-out-form-body-col l-mes">
+            <el-select v-model="item.scrapQty">
+              <el-option label="0" value="0">
+              </el-option>
+              <el-option label="1" value="1">
+              </el-option>
+            </el-select>
           </el-col>
-          <el-col :span="1" class="batch-product-out-form-body-col l-mes">
-            <el-input v-model="item.scrapQty"></el-input>
-          </el-col>
-          <el-col :span="1" class="batch-product-out-form-body-col l-mes">
+          <!-- <el-col :span="1" class="batch-product-out-form-body-col l-mes">
             <el-input v-model="item.reelWeight"></el-input>
-          </el-col>
-          <el-col :span="1" class="batch-product-out-form-body-col l-mes">
+          </el-col> -->
+          <!-- <el-col :span="1" class="batch-product-out-form-body-col l-mes">
             <el-input v-model="item.grossWeight"></el-input>
-          </el-col>
+          </el-col> -->
           <!--<el-col :span="1" class="batch-product-out-form-body-col l-mes">
             <el-input v-model="item.ifsBatchNo"></el-input>
           </el-col>-->
-          <el-col :span="2" class="batch-product-out-form-body-col">
+          <el-col :span="3" class="batch-product-out-form-body-col">
             <el-tooltip
               class="item"
               effect="dark"
@@ -190,8 +195,8 @@
           <!--<el-col :span="1" class="batch-product-out-form-body-col l-mes">
             <el-input v-model="item.remark"></el-input>
           </el-col>-->
-          <el-col :span="1" class="batch-product-out-form-body-col l-mes">
-            <el-input v-model="item.mainRemark"></el-input>
+          <el-col :span="2" class="batch-product-out-form-body-col l-mes">
+            <el-input v-model="item.remark"></el-input>
           </el-col>
           <el-col :span="1" class="batch-product-out-form-body-col">
             <span
@@ -205,19 +210,19 @@
       </div>
     </div>
     <div slot="footer" class="dialog-footer">
-      <div style="display: inline-block;width: 25%;float: left">
+      <!-- <div style="display: inline-block;width: 25%;float: left">
         <el-button
           style="margin-right: 34px"
           type="primary"
           @click="addProductOutForPerson"
           >娣诲姞</el-button
         >
-      </div>
+      </div> -->
       <el-button @click="innerVisible = false">鍙� 娑�</el-button>
       <el-button
         type="primary"
         :disabled="saveDisabled"
-        @click="saveProductOuts"
+        @click="saveProductOuts2"
         >纭� 瀹�</el-button
       >
     </div>
@@ -314,7 +319,8 @@
   batchSaveProductMain,
   getShiftProductOutByOpIdAndWsId,
   validateOverProduction,
-  validateOverFeed
+  validateOverFeed,
+	submitProductMain
 } from '@/api/product/personboard'
 import ElButton from '../../../../node_modules/element-ui/packages/button/src/button.vue'
 import OutPutBatch from './outputbatch.vue'
@@ -358,6 +364,7 @@
   data() {
     return {
       innerVisible: false,
+      staffNameList: [],
       personSelection: [],
       saveDisabled: false,
       currDutyInitproducts: [], // 鐢ㄤ簬缂撳瓨椤甸潰涓師鏈夌殑staff浜у嚭璁板綍锛屽苟涓旀槸灞炰簬褰撳墠鐝涓嬬殑锛岀敤浜庡嬀閫変汉鍛樻椂浣滀负鍘熸暟鎹弬鐓�
@@ -373,6 +380,36 @@
     }
   },
   methods: {
+    initProductList(){
+      let val = this.personSelection
+      //鎸変汉鍛樻姤宸�
+      if(this.groupStatus){
+        this.products = []
+        this.addProductOutForPerson()
+      }else{
+        //鎸夌粍鎶ュ伐
+        let nameList = []
+        val.forEach(obj=>{
+          nameList.push(obj.staffName)
+        })
+        let staffName = Array.from(new Set(nameList)).join(",")
+        if(staffName!=''){
+          this.products = this.productList
+          this.products.forEach(item=>{
+            item.staffName = staffName
+            item.outNum=1
+          })
+        }else{
+          this.products = []
+        }
+      }
+    },
+    handleClose(){
+      this.$emit('update:currshowlist', false)
+      this.$nextTick(()=>{
+        this.$refs.productOutPersonList.clearSelection()
+      })
+    },
     isNumber(value) {
       var reg = /^[0-9]+(.[0-9]{1,4})?$/
       if (
@@ -418,6 +455,9 @@
       // 鍐嶅幓涓巔roducts(姝や负椤甸潰鐨勫疄鏃舵暟鎹紝鐢ㄦ埛鏈夋敼鍔ㄥ嵆鏇存柊)瀵规瘮锛屽皢鍏朵腑瀛樺湪鐨勭浉鍚屼汉鍛樼殑鐢熶骇鏁伴噺鍜岀敓浜ф壒娆″悓姝ヨ繃鏉ワ紝鑻roducts涓敓浜ф暟閲忔垨鐢熶骇鎵规涓嶅瓨鍦ㄥ�硷紝鍒欎笉杩涜鍚屾锛屾部鐢ㄥ師鏉ョ殑銆�
       // 鏈�鍚庯紝灏嗙粍瑁呭ソ鐨勯�変腑浜哄憳淇℃伅锛屾洿鏂板埌products(鎸夌収鐝杩涜)锛屾敞鎰忔洿鏂颁箣鍚庨�変腑浜哄憳淇℃伅鍦╬roducts浣嶇疆椤哄簭
       this.personSelection = val
+      if(this.currshowlist){
+        this.initProductList()
+      }
     },
     // 鏍规嵁閫変腑鐨勪汉鍛橈紝鐢熸垚浜哄憳浜у嚭淇℃伅锛屽苟涓旀斁鍦ㄥ彸杈瑰垪琛ㄧ殑鏈�鍓嶉潰
     addProductOutForPerson() {
@@ -444,7 +484,8 @@
           newProduct.partNo = this.parentInfo.partNo
           newProduct.partName = this.parentInfo.partName
           newProduct.outBatchNo = oriOutBatchNo
-          newProduct.productQty = 0
+          newProduct.productQty = 1
+          newProduct.outNum = 1
           newProduct.unit = this.parentInfo.unit
           newProduct.productStaffs = productStaffs
           newProduct.productStaffIds = productStaffIds
@@ -498,10 +539,40 @@
         // row.outBatchNo = null
       }
     },
+		saveProductOuts2() {
+			this.clickDateArr.push(new Date().getTime())
+			var productOutputList = []
+			this.products.forEach(a=>{
+				productOutputList.push({
+					partId: a.partId,
+					productQty: a.outNum,
+					outBatchNo: a.outBatchNo,
+					scrapQty: a.scrapQty,
+					remark: a.remark,
+				  wdr: a.wdr,
+					staffNo: a.staffNo,
+					staffName: a.staffName,
+					status: a.status,
+					dutyRecordId: a.dutyRecordId,
+					productStaffIds: a.productStaffIds,
+					productStaffs: a.productStaffs,
+					sortNo: a.sortNo
+				})
+			})
+			var productMains = {
+				productOutputList: productOutputList,
+				workstationId: this.parentInfo.workstationId,
+				operationTaskId: this.parentInfo.operationTaskId,
+			}
+			submitProductMain(productMains).then(res=>{
+				this.$emit('refreshProductOutputList', res.data.data)
+				this.innerVisible = false
+			})
+		},
     saveProductOuts() {
       var canClickFlag = true
       this.clickDateArr.push(new Date().getTime())
-      if (this.clickDateArr.length > 1) {
+      /* if (this.clickDateArr.length > 1) {
         if (
           this.clickDateArr[this.clickDateArr.length - 1] -
             this.clickDateArr[this.clickDateArr.length - 2] <
@@ -510,7 +581,7 @@
           // 灏忎簬2绉掑垯璁や负閲嶅鎻愪氦
           canClickFlag = false
         }
-      }
+      } */
 
       if (canClickFlag) {
         this.saveDisabled = true
@@ -538,56 +609,56 @@
             s_list = JSON.parse(JSON.stringify(p_list))
           }
 
-          if (s_list.length <= 0) {
+          /* if (s_list.length <= 0) {
             this.$message.error('鎶ュ伐锛岃濉啓鐩樻暟锛�')
             this.saveDisabled = false
             return
-          }
-          let totalDisNumber = 0
-          for (let i = 0; i < s_list.length; i++) {
-            // 鐩樻暟鏍¢獙
-            if (!this.isPositiveIntegerNumber(s_list[i].disNumber)) {
-              validateFlag = false
-              if (this.groupStatus) {
-                validateMsg =
-                  '浜哄憳锛�' +
-                  s_list[i].staffName +
-                  '锛屾墍鍦ㄨ锛屻�愮洏鏁般�戣杈撳叆姝f暣鏁帮紒'
-              } else {
-                validateMsg = '绗�' + (i + 1) + '琛岋紝銆愮洏鏁般�戣杈撳叆姝f暣鏁帮紒'
-              }
-              break
-            }
-            totalDisNumber += s_list[i].disNumber - 0
-            // 璧峰绫虫爣鏍¢獙
-            if (!this.isNumber(s_list[i].startMeterMark)) {
-              validateFlag = false
-              validateMsg =
-                '绗�' + (i + 1) + '琛岋紝銆愯捣濮嬬背鏍囥�戣杈撳叆闈炶礋鏁帮紝灏忔暟浣嶆渶澶�4浣嶏紒'
-              break
-            }
-            // 鎴绫虫爣鏍¢獙
-            if (!this.isNumber(s_list[i].endMeterMark)) {
-              validateFlag = false
-              validateMsg =
-                '绗�' + (i + 1) + '琛岋紝銆愭埅姝㈢背鏍囥�戣杈撳叆闈炶礋鏁帮紝灏忔暟浣嶆渶澶�4浣嶏紒'
-              break
-            }
-            // 鎴绫虫爣闇�澶т簬寮�濮嬬背鏍�
-            if (
-              Number(s_list[i].endMeterMark) < Number(s_list[i].startMeterMark)
-            ) {
-              validateFlag = false
-              validateMsg =
-                '绗�' + (i + 1) + '琛岋紝銆愭埅姝㈢背鏍囥�戦渶澶т簬銆愯捣濮嬬背鏍囥��'
-              break
-            }
-          }
-          const maxDisNumber = 2000 // 鏈�澶х洏鏁�
+          } */
+          // let totalDisNumber = 0
+          // for (let i = 0; i < s_list.length; i++) {
+          //   // 鐩樻暟鏍¢獙
+          //   /* if (!this.isPositiveIntegerNumber(s_list[i].disNumber)) {
+          //     validateFlag = false
+          //     if (this.groupStatus) {
+          //       validateMsg =
+          //         '浜哄憳锛�' +
+          //         s_list[i].staffName +
+          //         '锛屾墍鍦ㄨ锛屻�愮洏鏁般�戣杈撳叆姝f暣鏁帮紒'
+          //     } else {
+          //       validateMsg = '绗�' + (i + 1) + '琛岋紝銆愮洏鏁般�戣杈撳叆姝f暣鏁帮紒'
+          //     }
+          //     break
+          //   } */
+          //   totalDisNumber += s_list[i].disNumber - 0
+          //   // 璧峰绫虫爣鏍¢獙
+          //   if (!this.isNumber(s_list[i].startMeterMark)) {
+          //     validateFlag = false
+          //     validateMsg =
+          //       '绗�' + (i + 1) + '琛岋紝銆愯捣濮嬬背鏍囥�戣杈撳叆闈炶礋鏁帮紝灏忔暟浣嶆渶澶�4浣嶏紒'
+          //     break
+          //   }
+          //   // 鎴绫虫爣鏍¢獙
+          //   if (!this.isNumber(s_list[i].endMeterMark)) {
+          //     validateFlag = false
+          //     validateMsg =
+          //       '绗�' + (i + 1) + '琛岋紝銆愭埅姝㈢背鏍囥�戣杈撳叆闈炶礋鏁帮紝灏忔暟浣嶆渶澶�4浣嶏紒'
+          //     break
+          //   }
+          //   // 鎴绫虫爣闇�澶т簬寮�濮嬬背鏍�
+          //   if (
+          //     Number(s_list[i].endMeterMark) < Number(s_list[i].startMeterMark)
+          //   ) {
+          //     validateFlag = false
+          //     validateMsg =
+          //       '绗�' + (i + 1) + '琛岋紝銆愭埅姝㈢背鏍囥�戦渶澶т簬銆愯捣濮嬬背鏍囥��'
+          //     break
+          //   }
+          // }
+          /* const maxDisNumber = 2000 // 鏈�澶х洏鏁�
           if (totalDisNumber > maxDisNumber) {
             validateMsg = '鎬荤洏鏁颁笉鑳藉ぇ浜�' + maxDisNumber + '锛�'
             validateFlag = false
-          }
+          } */
           if (validateFlag) {
             if (this.parentInfo.productOutId == null) {
               // 褰撳墠鏄骇鍑虹殑鏂板
@@ -1025,14 +1096,14 @@
             this.products.push(this.productList[i])
           }
           this.$nextTick(() => {
-            this.$refs.productOutPersonList.clearSelection()
+            this.$refs.productOutPersonList.toggleAllSelection()
           })
         } else {
           for (let i = 0; i < this.productList.length; i++) {
             this.products.push(this.productList[i])
           }
           this.$nextTick(() => {
-            this.$refs.productOutPersonList.clearSelection()
+            this.$refs.productOutPersonList.toggleAllSelection()
           })
         }
       }

--
Gitblit v1.9.3