From 666d4f6ad00b7cad1bd03c24b256ed77c56e3aa2 Mon Sep 17 00:00:00 2001
From: loulijun2021 <1694218219@qq.com>
Date: 星期二, 06 六月 2023 09:04:02 +0800
Subject: [PATCH] 1.生产入库实现70%

---
 src/views/produceManager/productWarehouse.vue |  180 ++++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 104 insertions(+), 76 deletions(-)

diff --git a/src/views/produceManager/productWarehouse.vue b/src/views/produceManager/productWarehouse.vue
index 6de1dca..c0aa363 100644
--- a/src/views/produceManager/productWarehouse.vue
+++ b/src/views/produceManager/productWarehouse.vue
@@ -206,12 +206,18 @@
               <el-date-picker
                 v-model="form.lm_date"
                 style="width: 200px"
+                readonly
                 type="date"
                 placeholder="閫夋嫨鏃ユ湡"
               />
             </el-form-item>
             <el-form-item label="鍗曟嵁缂栧彿" style=" display: flex;">
-              <el-input v-model="form.OrgName" placeholder="璇疯緭鍏�" style="width: 200px" />
+              <el-input
+                v-model="form.hbillno"
+                readonly
+                placeholder="璇疯緭鍏�"
+                style="width: 200px"
+              />
             </el-form-item>
 
             <el-form-item label="鍏ュ簱浠撳簱" style=" display: flex;">
@@ -237,7 +243,13 @@
             class="bodySearchReset"
             :style="{marginLeft:$store.state.app.sidebar.opened? $store.state.settings.menuIsHorizontal?'15%':'3%':'10%'}"
           >
-            <el-button v-waves type="primary" icon="el-icon-s-promotion" @click="submit">鍏ュ簱鎻愪氦</el-button>
+            <el-button
+              v-waves
+              type="primary"
+              icon="el-icon-s-promotion"
+
+              @click="submit"
+            >鍏ュ簱鎻愪氦</el-button>
             <!--            <el-button v-waves type="info" icon="el-icon-refresh" @click="reset">閲嶇疆</el-button>-->
           </div>
         </el-form>
@@ -703,7 +715,7 @@
         orderdate: '', // 宸ュ崟鏃ユ湡
 
         saleOrderCode: '', // 閿�鍞鍗�
-        lm_date: '', // 鍗曟嵁鏃ユ湡
+        lm_date: new Date(), // 鍗曟嵁鏃ユ湡
         stockcode: '' // 鍏ュ簱浠撳簱
 
       },
@@ -839,6 +851,8 @@
       this.form.orderdate = ''
 
       this.tableDataDetail = []
+      this.tableDataSummary = []
+      this.multipleSelection = []
     },
 
     // 琛ㄦ牸鍗曞厓鏍煎弻鍑�
@@ -972,90 +986,104 @@
     },
 
     // 鍏ュ簱鎻愪氦
-    async  submit() {
-      await this.tabClick()
-      if (this.multipleSelection.find(i => !i.stockcode)) {
-        return this.$message('鏄庣粏閲岄潰鏈変骇鍝佹湭濉啓浠撳簱锛�')
-      }
-      this.multipleSelection.forEach(i => {
-        i.stockname = this.stockcodeArr.find(j => j.code === i.stockcode).name
-        i.id = this.stockcodeArr.find(j => j.code === i.stockcode).id
-      })
+    submit() {
+      this.tabClick()
 
-      const head = {
-        rightcode: '2064',
-        hbillno: this.form.hbillno,
-        incbit: this.form.incbit,
-        wkshpcode: this.form.wkshopcode,
-        sourceVoucherId: this.form.documentType === 'Y' ? this.tableDataDetail[0].mpoid : '',
-        sourceVoucherCode: this.form.documentType === 'Y' ? this.tableDataDetail[0].m_po : this.tableDataDetail[0].wo_code,
-        saleOrderId: this.tableDataDetail[0].saleOrderid,
-        saleOrderCode: this.tableDataDetail[0].saleOrderCode,
-        rdDirectionFlag: 1,
-        makerid: this.userArr.find(i => i.name === getCookie('username')).id,
-        maker: getCookie('username'),
-        accountingyear: new Date().getFullYear(),
-        VoucherYear: new Date().getFullYear(),
-        VoucherPeriod: new Date().getMonth() + 1,
-        ManufactureOrderCode: this.form.documentType === 'Y' ? this.tableDataDetail[0].m_po : this.tableDataDetail[0].wo_code,
-        idbusitype: '03',
-        iddepartment: this.WorkShopArr.find(i => i.code === this.form.wkshopcode).id,
-        idrdstyle: 21,
-        idwarehouse: '',
-        voucherState: 181,
-        idvouchertype: 15,
-        voucherdate: handleDatetime(new Date().getTime()),
-        madedate: handleDatetime(new Date().getTime()),
-        createdtime: handleDatetime2(new Date().getTime()),
-        DataSource: '56133',
-        idsourcevouchertype: 69
-      }
+      this.$confirm('鏄惁纭鎻愪氦?', '鎻愮ず', {
+        confirmButtonText: '纭畾',
+        cancelButtonText: '鍙栨秷',
+        type: 'warning'
+      }).then(() => {
+        if (this.multipleSelection.length === 0) {
+          return this.$message.error('鏈�夋嫨浜у搧锛�')
+        }
+        if (this.multipleSelection.find(i => !i.stockcode)) {
+          return this.$message.error('鏄庣粏閲岄潰鏈変骇鍝佹湭濉啓浠撳簱锛�')
+        }
+        this.multipleSelection.forEach(i => {
+          i.stockname = this.stockcodeArr.find(j => j.code === i.stockcode).name
+          i.id = this.stockcodeArr.find(j => j.code === i.stockcode).id
+        })
 
-      const subsum = []
-      this.tableDataSummary.forEach((i, index) => {
-        subsum.push({
-          code: index.toString().padStart(4, '0'),
-          rownumber: index + 1,
-          arrivalQuantity: i.qty,
-          quantity: i.stinhouseqty,
-          compositionQuantity: i.stinhouseqty + i.unitname,
-          baseQuantity: i.stinhouseqty,
+        const head = {
+          rightcode: '2064',
+          hbillno: this.form.hbillno,
+          incbit: this.form.incbit,
+          wkshpcode: this.form.wkshopcode,
           sourceVoucherId: this.form.documentType === 'Y' ? this.tableDataDetail[0].mpoid : '',
           sourceVoucherCode: this.form.documentType === 'Y' ? this.tableDataDetail[0].m_po : this.tableDataDetail[0].wo_code,
-          sourceVoucherDetailId: i.sourceVoucherDetailId,
-          idsourcevouchertype: 69,
           saleOrderId: this.tableDataDetail[0].saleOrderid,
           saleOrderCode: this.tableDataDetail[0].saleOrderCode,
-          saleOrderDetailId: i.saleOrderDetailId,
-          ManufactureOrderId: this.form.documentType === 'Y' ? this.tableDataDetail[0].mpoid : '',
+          rdDirectionFlag: 1,
+          makerid: this.userArr.find(i => i.name === getCookie('username')).id,
+          maker: getCookie('username'),
+          accountingyear: new Date().getFullYear(),
+          VoucherYear: new Date().getFullYear(),
+          VoucherPeriod: new Date().getMonth() + 1,
           ManufactureOrderCode: this.form.documentType === 'Y' ? this.tableDataDetail[0].m_po : this.tableDataDetail[0].wo_code,
-          ManufactureOrderDetailId: i.ManufactureOrderDetailId,
-          idbusiTypeByMergedFlow: 3,
-          idinventory: i.materiel_id,
-          idbaseunit: i.unitid,
-          idunit: i.unitid,
-          idwarehouse: i.stck_id,
-          SourceVoucherIdByMergedFlow: this.tableDataDetail[0].mpoid,
-          SourceVoucherCodeByMergedFlow: this.tableDataDetail[0].m_po,
-          SourceVoucherDetailIdByMergedFlow: i.SourceVoucherDetailIdByMergedFlow,
-          idsourceVoucherTypeByMergedFlow: 69,
+          idbusitype: '03',
+          iddepartment: this.WorkShopArr.find(i => i.code === this.form.wkshopcode).id,
+          idrdstyle: 21,
+          idwarehouse: '',
+          voucherState: 181,
+          idvouchertype: 15,
+          voucherdate: handleDatetime(new Date().getTime()),
+          madedate: handleDatetime(new Date().getTime()),
           createdtime: handleDatetime2(new Date().getTime()),
           DataSource: '56133',
-          materiel_code: i.materiel_code,
-          warehouse: i.warehouse
+          idsourcevouchertype: 69
+        }
+
+        const subsum = []
+        this.tableDataSummary.forEach((i, index) => {
+          subsum.push({
+            code: index.toString().padStart(4, '0'),
+            rownumber: index + 1,
+            arrivalQuantity: i.qty,
+            quantity: i.stinhouseqty,
+            compositionQuantity: i.stinhouseqty + i.unitname,
+            baseQuantity: i.stinhouseqty,
+            sourceVoucherId: this.form.documentType === 'Y' ? this.tableDataDetail[0].mpoid : '',
+            sourceVoucherCode: this.form.documentType === 'Y' ? this.tableDataDetail[0].m_po : this.tableDataDetail[0].wo_code,
+            sourceVoucherDetailId: i.sourceVoucherDetailId,
+            idsourcevouchertype: 69,
+            saleOrderId: this.tableDataDetail[0].saleOrderid,
+            saleOrderCode: this.tableDataDetail[0].saleOrderCode,
+            saleOrderDetailId: i.saleOrderDetailId,
+            ManufactureOrderId: this.form.documentType === 'Y' ? this.tableDataDetail[0].mpoid : '',
+            ManufactureOrderCode: this.form.documentType === 'Y' ? this.tableDataDetail[0].m_po : this.tableDataDetail[0].wo_code,
+            ManufactureOrderDetailId: i.ManufactureOrderDetailId,
+            idbusiTypeByMergedFlow: 3,
+            idinventory: i.materiel_id,
+            idbaseunit: i.unitid,
+            idunit: i.unitid,
+            idwarehouse: i.stck_id,
+            SourceVoucherIdByMergedFlow: this.tableDataDetail[0].mpoid,
+            SourceVoucherCodeByMergedFlow: this.tableDataDetail[0].m_po,
+            SourceVoucherDetailIdByMergedFlow: i.SourceVoucherDetailIdByMergedFlow,
+            idsourceVoucherTypeByMergedFlow: 69,
+            createdtime: handleDatetime2(new Date().getTime()),
+            DataSource: '56133',
+            materiel_code: i.materiel_code,
+            warehouse: i.warehouse
+          })
+        })
+
+        const data = {
+          head, sub: this.multipleSelection, subsum
+        }
+
+        ProductInHouseOrderSeave(data).then(res => {
+          if (res.code === '200') {
+            this.$message.success('鍏ュ簱鎻愪氦鎴愬姛锛�')
+            this.getProductInHouseOrderCodeSearch()
+            this.wkshopcodeChange(this.form.wkshopcode)
+            this.tableDataDetail = []
+            this.tableDataSummary = []
+            this.multipleSelection = []
+          }
         })
       })
-
-      const data = {
-        head, sub: this.multipleSelection, subsum
-      }
-
-      // console.log(JSON.stringify(data))
-
-      const res = await ProductInHouseOrderSeave(data)
-      if (res.code === '200') {
-        this.$message.success('鍏ュ簱鎻愪氦鎴愬姛锛�')
-      }
     },
     // 鑾峰彇椤甸潰楂樺害
     getHeight() {

--
Gitblit v1.9.3