From 6208ba6872cc54ccbd2b2ff3b67a1a2f054af41d Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 19 九月 2023 14:52:15 +0800
Subject: [PATCH] 1.生产入库实现

---
 src/views/scgl/sckbg.vue |   62 ++++++++++++++++++++++++++++--
 1 files changed, 57 insertions(+), 5 deletions(-)

diff --git a/src/views/scgl/sckbg.vue b/src/views/scgl/sckbg.vue
index a58e108..905a31d 100644
--- a/src/views/scgl/sckbg.vue
+++ b/src/views/scgl/sckbg.vue
@@ -1173,6 +1173,7 @@
 import QRCode from 'qrcodejs2'
 import { getCookie } from '@/utils/auth'
 import { handleDatetime2 } from '@/utils/global'
+import { LabelBarCode } from '@/api/xtsz'
 
 const SER_HZ = /^[\u4e00-\u9fa5]+$/
 export default {
@@ -1266,6 +1267,8 @@
         reportuser: '', // 鎶ュ伐浜哄憳
 
         startqtySum: '', // 涓嶈兘瓒呰繃鐨勬暟鍊�
+
+        inbarcode: '',
 
         operation: getCookie('navTabId'), // 鎶ュ伐浜猴紙鏀舵枡浜猴級
         remarks: ''// 澶囨敞
@@ -1699,7 +1702,7 @@
         this.dialogForm.startqty = obj.noreportqty
 
         this.dialogForm.nextstepname = obj.nextstepname
-        this.dialogForm.nextstepcode = obj.nextstepcode ? obj.nextstepcode : obj.stepcode
+        this.dialogForm.nextstepcode = obj.nextstepcode
 
         this.dialogForm.startqtySum = obj.noreportqty
       })
@@ -1760,7 +1763,7 @@
         this.dialogForm.stepcode = obj.stepcode
 
         this.dialogForm.nextstepname = obj.nextstepname
-        this.dialogForm.nextstepcode = obj.nextstepcode ? obj.nextstepcode : obj.stepcode
+        this.dialogForm.nextstepcode = obj.nextstepcode
 
         this.dialogForm.noputqty = obj.noputqty
         this.dialogForm.stepseq = obj.seq
@@ -1900,6 +1903,7 @@
     },
     // 瀵硅瘽妗嗗叧闂簨浠�
     handleClose() {
+      this.dialogForm.inbarcode = ''
       this.judgeIsScanningArr = []
       this.form.orderstepqrcode = ''
       this.WXform.orderstepqrcode = ''
@@ -1953,7 +1957,7 @@
     },
     // 瀵硅瘽妗嗙‘璁�
     dialogVisibleConfirm() {
-      this.$refs.dialogForm.validate(valid => {
+      this.$refs.dialogForm.validate(async valid => {
         if (valid) {
           // this.$store.state.app.buttonIsDisabled = true
           if (this.dialogTitle === '澶栧崗鍙戞枡') {
@@ -1993,6 +1997,19 @@
                 return this.$message.info('璇烽�夋嫨涓嶈壇鍘熷洜锛�')
               }
             }
+            this.dialogForm.inbarcode = ''
+            if (this.dialogForm.nextstepcode === '') {
+              const D = {
+                rightcode: '1078',
+                partcode: this.dialogForm.partcode,
+                qty: this.dialogForm.sqty,
+                onelabqty: this.dialogForm.sqty
+              }
+              const r = await LabelBarCode(D)
+              this.dialogForm.inbarcode = r.data[0].labcode
+
+              this.qrForm.partspec = this.dialogForm.partspec
+            }
 
             const data = {
               mesordercode: this.dialogForm.wo_code, // 宸ュ崟缂栧彿
@@ -2004,6 +2021,9 @@
               taskqty: this.dialogForm.planqty, // 浠诲姟鏁伴噺
               sqty: this.dialogForm.sqty, // 鏀舵枡鏁伴噺
               remarks: this.dialogForm.remarks, // 澶囨敞
+
+              inbarcode: this.dialogForm.inbarcode, // 鐢熶骇鍏ュ簱鏉$爜
+
               ngqty: this.dialogForm.noputqty === '' ? 0 : this.dialogForm.noputqty, // 涓嶈壇鏁伴噺
               badcode: this.dialogForm.badcode.length < 1 ? '' : this.dialogForm.badcode.join(';')// 涓嶈壇鍘熷洜
             }
@@ -2066,6 +2086,23 @@
             this.userTableData = this.userTableData.filter((currentValue, currentIndex, selfArr) => {
               return selfArr.findIndex(item => item.usercode === currentValue.usercode) === currentIndex
             })
+
+            this.dialogForm.inbarcode = ''
+
+            // 褰撲负鏈亾鐨勬椂鍊�
+            if (this.dialogForm.nextstepcode === '') {
+              const D = {
+                rightcode: '1073',
+                partcode: this.dialogForm.partcode,
+                qty: this.dialogForm.startqty,
+                onelabqty: this.dialogForm.startqty
+              }
+              const r = await LabelBarCode(D)
+              this.dialogForm.inbarcode = r.data[0].labcode
+
+              this.qrForm.partspec = this.dialogForm.partspec
+            }
+
             // console.log(this.userTableData, 1)
             const reportuser = this.userTableData.map(item => item.usercode).join(';')
             const data = {
@@ -2082,6 +2119,9 @@
               // reportqty: this.dialogForm.reportqty, // 鎶ュ伐鏁伴噺
               reportqty: this.dialogForm.startqty, // 鎶ュ伐鏁伴噺
               remarks: this.dialogForm.remarks, // 澶囨敞
+
+              inbarcode: this.dialogForm.inbarcode, // 鐢熶骇鍏ュ簱鏉$爜
+
               ngqty: this.dialogForm.noputqty === '' ? 0 : this.dialogForm.noputqty, // 涓嶈壇鏁伴噺
               badcode: this.dialogForm.badcode.length < 1 ? '' : this.dialogForm.badcode.join(';')// 涓嶈壇鍘熷洜
             }
@@ -2118,7 +2158,13 @@
       })
     },
     ZZprint2(username) {
-      this.qrForm.qrvalue = this.dialogForm.wo_code + ';' + this.dialogForm.nextstepcode
+      if (this.dialogForm.nextstepcode !== '') {
+        this.qrForm.qrvalue = this.dialogForm.wo_code + ';' + this.dialogForm.nextstepcode
+      } else {
+        this.qrForm.qrvalue = this.dialogForm.inbarcode
+      }
+
+      // this.qrForm.qrvalue = this.dialogForm.wo_code + ';' + this.dialogForm.nextstepcode
       this.qrForm.startqty = this.dialogForm.startqty
       this.qrForm.wo_code = this.dialogForm.wo_code
       this.qrForm.partcode = this.dialogForm.partcode
@@ -2131,7 +2177,13 @@
       })
     },
     WXprint2(username) {
-      this.qrForm.qrvalue = this.dialogForm.wo_code + ';' + this.dialogForm.nextstepcode
+      if (this.dialogForm.nextstepcode !== '') {
+        this.qrForm.qrvalue = this.dialogForm.wo_code + ';' + this.dialogForm.nextstepcode
+      } else {
+        this.qrForm.qrvalue = this.dialogForm.inbarcode
+      }
+
+      // this.qrForm.qrvalue = this.dialogForm.wo_code + ';' + this.dialogForm.nextstepcode
       this.qrForm.startqty = this.dialogForm.sqty
       this.qrForm.wo_code = this.dialogForm.wo_code
       this.qrForm.partcode = this.dialogForm.partcode

--
Gitblit v1.9.3