From 6156331374cefbe908c5aeaebda911646c1d5f10 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期四, 14 十一月 2024 10:35:48 +0800
Subject: [PATCH] 1.递交

---
 src/views/produce/productWarehouse.vue |  375 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 210 insertions(+), 165 deletions(-)

diff --git a/src/views/produce/productWarehouse.vue b/src/views/produce/productWarehouse.vue
index 174b187..02b766d 100644
--- a/src/views/produce/productWarehouse.vue
+++ b/src/views/produce/productWarehouse.vue
@@ -32,6 +32,24 @@
         >
           <div class="elForm" style="display: flex;flex-direction: column;justify-content: flex-start">
             <div style="display: flex">
+              <el-form-item label="鍏ュ簱閮ㄩ棬" required style="display: flex;">
+                <el-select
+                  v-model="form.deptno"
+                  :popper-append-to-body="false"
+                  filterable
+                  style="width: 200px"
+                  placeholder="璇烽�夋嫨"
+                >
+                  <!--                  @change="getProductInHouseOrderSearch"-->
+                  <el-option
+                    v-for="item in departmentArr"
+                    :key="item.code"
+                    :label="item.name"
+                    :value="item.code"
+                  />
+                </el-select>
+              </el-form-item>
+
               <el-form-item label="鐢熶骇杞﹂棿" style=" display: flex;">
                 <el-select
                   v-model="form.wkshopcode"
@@ -68,6 +86,10 @@
                   style="width: 200px"
                 />
               </el-form-item>
+
+            </div>
+
+            <div style="display: flex">
               <el-form-item
                 label="閿�鍞鍗�"
                 style="display: flex;"
@@ -78,9 +100,6 @@
                   style="width: 200px"
                 />
               </el-form-item>
-            </div>
-
-            <div style="display: flex">
               <el-form-item label="浜у搧缂栫爜" style=" display: flex;">
                 <el-input v-model="form.partcode" placeholder="璇疯緭鍏�" style="width: 200px" />
               </el-form-item>
@@ -120,7 +139,7 @@
           <div class="elForm" style="justify-content: flex-start">
             <el-form-item label="鍗曟嵁鏃ユ湡" style=" display: flex;">
               <el-date-picker
-                v-model="form.lm_date"
+                v-model="form.hbdate"
                 style="width: 200px"
                 readonly
                 type="date"
@@ -130,10 +149,11 @@
             <el-form-item label="鍗曟嵁缂栧彿" style=" display: flex;">
               <el-input
                 v-model="form.hbillno"
-                readonly
+
                 placeholder="璇疯緭鍏�"
                 style="width: 200px"
               />
+              <!--              readonly-->
             </el-form-item>
 
             <el-form-item label="鍏ュ簱浠撳簱" required style=" display: flex;">
@@ -218,39 +238,6 @@
                     label="搴忓彿"
                   />
 
-                  <!--                  <el-table-column-->
-                  <!--                    prop="stockcode"-->
-                  <!--                    label="浠撳簱"-->
-                  <!--                    width="160"-->
-                  <!--                    show-tooltip-when-overflow-->
-                  <!--                  >-->
-                  <!--                    <template slot-scope="{row}">-->
-                  <!--                      <div>{{ row.stockcode ? stockcodeArr.find(i => i.code === row.stockcode).name : '/' }}</div>-->
-                  <!--                      &lt;!&ndash;                      <div&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                        v-if="!(row.index === tabClickIndex && tabClickLabel === '浠撳簱')"&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                      >&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                        {{ row.stockcode ? stockcodeArr.find(i => i.code === row.stockcode).name : '/' }}&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                      </div>&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                      <el-select&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                        v-if="row.index === tabClickIndex && tabClickLabel === '浠撳簱'"&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                        v-model="row.stockcode"&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                        placeholder="璇烽�夋嫨"&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                      >&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                        <el-option&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                          v-for="item in stockcodeArr"&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                          :key="item.code"&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                          :label="item.name"&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                          :value="item.code"&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                        />&ndash;&gt;-->
-                  <!--                      &lt;!&ndash;                      </el-select>&ndash;&gt;-->
-                  <!--                    </template>-->
-                  <!--                  </el-table-column>-->
-                  <!--                  <el-table-column-->
-                  <!--                    prop="inbarcode"-->
-                  <!--                    label="鍏ュ簱鏉$爜"-->
-                  <!--                    width="160"-->
-                  <!--                    show-tooltip-when-overflow-->
-                  <!--                  />-->
                   <el-table-column
                     prop="stockcode"
                     label="鍏ュ簱浠撳簱"
@@ -411,131 +398,94 @@
 
               </div>
             </el-tab-pane>
-            <el-tab-pane label="姹囨��">
-              <div class="elTableDiv" style="margin: 0 auto 10px;">
-                <el-table
-                  ref="tableDataRef"
-                  class="tableFixed"
-                  :data="tableDataSummary"
-                  :height="(tableHeight-25)+'px'"
-                  border
-                  :row-class-name="tableRowClassName2"
-                  :style="{width: 100+'%',height:(tableHeight-25)+'px',}"
-                  highlight-current-row
-                  :header-cell-style="this.$headerCellStyle"
-                  :cell-style="this.$cellStyle"
-                >
-                  <el-table-column
-                    type="index"
-                    width="50"
-                    fixed
-                    label="搴忓彿"
-                  />
-                  <!--                  <el-table-column-->
-                  <!--                    prop="stockcode"-->
-                  <!--                    label="浠撳簱"-->
-                  <!--                    width="110"-->
-                  <!--                  >-->
-                  <!--                    <template slot-scope="{row}">-->
-                  <!--                      <div>{{ stockcodeArr.find(i => i.code === row.stockcode).name }}</div>-->
-                  <!--                    </template>-->
-                  <!--                  </el-table-column>-->
-                  <!--                    <template slot-scope="{row}">-->
-                  <!--                      <div v-if="row.stockname">{{ row.stockname }}</div>-->
-                  <!--                      <div v-else>/</div>-->
-                  <!--                    </template>-->
+            <!--            <el-tab-pane label="姹囨��">-->
+            <!--              <div class="elTableDiv" style="margin: 0 auto 10px;">-->
+            <!--                <el-table-->
+            <!--                  ref="tableDataRef"-->
+            <!--                  class="tableFixed"-->
+            <!--                  :data="tableDataSummary"-->
+            <!--                  :height="(tableHeight-25)+'px'"-->
+            <!--                  border-->
+            <!--                  :row-class-name="tableRowClassName2"-->
+            <!--                  :style="{width: 100+'%',height:(tableHeight-25)+'px',}"-->
+            <!--                  highlight-current-row-->
+            <!--                  :header-cell-style="this.$headerCellStyle"-->
+            <!--                  :cell-style="this.$cellStyle"-->
+            <!--                >-->
+            <!--                  <el-table-column-->
+            <!--                    type="index"-->
+            <!--                    width="50"-->
+            <!--                    fixed-->
+            <!--                    label="搴忓彿"-->
+            <!--                  />-->
 
-                  <!--                  </el-table-column>-->
-                  <!--                  <el-table-column-->
-                  <!--                    prop="inbarcode"-->
-                  <!--                    label="鍏ュ簱鏉$爜"-->
-                  <!--                    width="160"-->
-                  <!--                    show-tooltip-when-overflow-->
-                  <!--                  />-->
-                  <!--                  <el-table-column-->
-                  <!--                    prop="m_po"-->
-                  <!--                    label="璁㈠崟缂栧彿"-->
-                  <!--                    width="160"-->
-                  <!--                    show-tooltip-when-overflow-->
-                  <!--                  >-->
-                  <!--                    <template slot-scope="{row}">-->
-                  <!--                      <div v-if="row.m_po">{{ row.m_po }}</div>-->
-                  <!--                      <div v-else>/</div>-->
-                  <!--                    </template>-->
-                  <!--                  </el-table-column>-->
-                  <!--                  <el-table-column-->
-                  <!--                    prop="wo_code"-->
-                  <!--                    label="宸ュ崟缂栧彿"-->
-                  <!--                    width="160"-->
-                  <!--                    show-tooltip-when-overflow-->
-                  <!--                  />-->
-                  <el-table-column
-                    prop="partcode"
-                    label="浜у搧缂栫爜"
-                    min-width="160"
-                    show-tooltip-when-overflow
-                  />
-                  <el-table-column
-                    prop="partname"
-                    label="浜у搧鍚嶇О"
-                    min-width="160"
-                    show-tooltip-when-overflow
-                  />
-                  <el-table-column
-                    prop="partspec"
-                    label="浜у搧瑙勬牸"
-                    min-width="160"
-                    show-tooltip-when-overflow
-                  >
-                    <template slot-scope="{row}">
-                      <div v-if="row.stockname">{{ row.stockname }}</div>
-                      <div v-else>/</div>
-                    </template>
-                  </el-table-column>
+            <!--                  <el-table-column-->
+            <!--                    prop="partcode"-->
+            <!--                    label="浜у搧缂栫爜"-->
+            <!--                    min-width="160"-->
+            <!--                    show-tooltip-when-overflow-->
+            <!--                  />-->
+            <!--                  <el-table-column-->
+            <!--                    prop="partname"-->
+            <!--                    label="浜у搧鍚嶇О"-->
+            <!--                    min-width="160"-->
+            <!--                    show-tooltip-when-overflow-->
+            <!--                  />-->
+            <!--                  <el-table-column-->
+            <!--                    prop="partspec"-->
+            <!--                    label="浜у搧瑙勬牸"-->
+            <!--                    min-width="160"-->
+            <!--                    show-tooltip-when-overflow-->
+            <!--                  >-->
+            <!--                    <template slot-scope="{row}">-->
+            <!--                      <div v-if="row.stockname">{{ row.stockname }}</div>-->
+            <!--                      <div v-else>/</div>-->
+            <!--                    </template>-->
+            <!--                  </el-table-column>-->
 
-                  <el-table-column
-                    prop="qty"
-                    label="璁㈠崟鏁伴噺"
-                    min-width="95"
+            <!--                  <el-table-column-->
+            <!--                    prop="qty"-->
+            <!--                    label="璁㈠崟鏁伴噺"-->
+            <!--                    min-width="95"-->
 
-                    show-tooltip-when-overflow
-                  >
-                    <template slot-scope="{row}">
-                      <div v-if="row.qty">{{ row.qty }}</div>
-                      <div v-else>/</div>
-                    </template>
-                  </el-table-column>
-                  <!--                  <el-table-column-->
-                  <!--                    prop="plan_qty"-->
-                  <!--                    label="宸ュ崟鏁伴噺"-->
-                  <!--                    min-width="95"-->
-                  <!--                    fixed="right"-->
-                  <!--                    show-tooltip-when-overflow-->
-                  <!--                  />-->
-                  <el-table-column
-                    prop="good_qty"
-                    label="瀹屽伐鏁伴噺"
-                    min-width="95"
+            <!--                    show-tooltip-when-overflow-->
+            <!--                  >-->
+            <!--                    <template slot-scope="{row}">-->
+            <!--                      <div v-if="row.qty">{{ row.qty }}</div>-->
+            <!--                      <div v-else>/</div>-->
+            <!--                    </template>-->
+            <!--                  </el-table-column>-->
+            <!--                  &lt;!&ndash;                  <el-table-column&ndash;&gt;-->
+            <!--                  &lt;!&ndash;                    prop="plan_qty"&ndash;&gt;-->
+            <!--                  &lt;!&ndash;                    label="宸ュ崟鏁伴噺"&ndash;&gt;-->
+            <!--                  &lt;!&ndash;                    min-width="95"&ndash;&gt;-->
+            <!--                  &lt;!&ndash;                    fixed="right"&ndash;&gt;-->
+            <!--                  &lt;!&ndash;                    show-tooltip-when-overflow&ndash;&gt;-->
+            <!--                  &lt;!&ndash;                  />&ndash;&gt;-->
+            <!--                  <el-table-column-->
+            <!--                    prop="good_qty"-->
+            <!--                    label="瀹屽伐鏁伴噺"-->
+            <!--                    min-width="95"-->
 
-                    show-tooltip-when-overflow
-                  />
-                  <el-table-column
-                    prop="inhouseqty"
-                    label="宸插叆搴撴暟閲�"
-                    min-width="95"
+            <!--                    show-tooltip-when-overflow-->
+            <!--                  />-->
+            <!--                  <el-table-column-->
+            <!--                    prop="inhouseqty"-->
+            <!--                    label="宸插叆搴撴暟閲�"-->
+            <!--                    min-width="95"-->
 
-                    show-tooltip-when-overflow
-                  />
-                  <el-table-column
-                    prop="stinhouseqty"
-                    label="鍙叆搴撴暟閲�"
-                    min-width="95"
+            <!--                    show-tooltip-when-overflow-->
+            <!--                  />-->
+            <!--                  <el-table-column-->
+            <!--                    prop="stinhouseqty"-->
+            <!--                    label="鍙叆搴撴暟閲�"-->
+            <!--                    min-width="95"-->
 
-                    show-tooltip-when-overflow
-                  />
-                </el-table>
-              </div>
-            </el-tab-pane>
+            <!--                    show-tooltip-when-overflow-->
+            <!--                  />-->
+            <!--                </el-table>-->
+            <!--              </div>-->
+            <!--            </el-tab-pane>-->
           </el-tabs>
         </div>
 
@@ -549,8 +499,14 @@
 <script>
 
 import { PrentOrganizationNoCompany } from '@/api/GeneralBasicData'
-import { ProductInHouseOrderSearch } from '@/api/WorkOrder'
+import {
+  DeptSelectData,
+  ProductInHouseOrderCodeSearch,
+  ProductInHouseOrderSearch,
+  ProductInHouseOrderSeave
+} from '@/api/WorkOrder'
 import { TSecLocaTree } from '@/api/basicSettings'
+import { handleDatetime, handleDatetime2 } from '@/utils/global'
 
 export default {
   name: 'ProductWarehouse',
@@ -561,8 +517,8 @@
       tableHeight: 0,
       form: {
         hbillno: '', // 鍏ュ簱鍗曞彿
-        // incbit: '', // 娴佹按鍙�
-        documentType: 'Y', // 鍗曟嵁绫诲瀷
+        incbit: '', // 娴佹按鍙�
+        hbdate: new Date(), // 鍏ュ簱鍗曟棩鏈�
 
         saleordercode: '', // 閿�鍞崟鍙�
         wkshopcode: '', // 鐢熶骇杞﹂棿
@@ -572,6 +528,7 @@
         partname: '', // 浜у搧鍚嶇О
         partspec: '', // 瑙勬牸鍨嬪彿
 
+        deptno: '', // 鍏ュ簱閮ㄩ棬
         saleOrderCode: '', // 閿�鍞鍗�
         stockcode: '' // 鍏ュ簱浠撳簱
 
@@ -581,6 +538,7 @@
       multipleSelection: [],
       stockcodeArr: [], // 鍏ュ簱浠撳簱鏁扮粍
       WorkShopArr: [], // 鐢熶骇杞﹂棿鏁扮粍
+      departmentArr: [], // 鍏ュ簱閮ㄩ棬
 
       tabClickIndex: null, // 鐐瑰嚮鐨勫崟鍏冩牸
       tabClickLabel: '', // 褰撳墠鐐瑰嚮鐨勫垪鍚�
@@ -598,10 +556,23 @@
 
     this.getPrentOrganizationNoCompany()
     this.getTSecLocaTree()
+    this.getProductInHouseOrderCodeSearch()
+    this.getDeptSelectData()
 
-    this.getProductInHouseOrderSearch()
+    // this.getProductInHouseOrderSearch()
   },
   methods: {
+    // 鑾峰彇鍏ュ簱閮ㄩ棬
+    async getDeptSelectData() {
+      const { data: res } = await DeptSelectData()
+      this.departmentArr = res
+    },
+    // 鑾峰彇鍗曟嵁缂栧彿(鍏ュ簱鍗曞彿)銆佹祦姘村彿
+    async getProductInHouseOrderCodeSearch() {
+      const { data: res } = await ProductInHouseOrderCodeSearch({ rightcode: '0604' })
+      this.form.hbillno = res[0]
+      this.form.incbit = res[1]
+    },
     // 鑾峰彇浠撳簱淇℃伅
     async getTSecLocaTree() {
       const { data: res } = await TSecLocaTree()
@@ -614,6 +585,9 @@
     },
     // 鑾峰彇澶у垪琛ㄦ煡璇�
     async getProductInHouseOrderSearch() {
+      if (this.form.deptno === '') {
+        return this.$message.info('鍏ュ簱閮ㄩ棬涓嶈兘涓虹┖锛�')
+      }
       const data = {
         saleordercode: this.form.saleordercode, // 閿�鍞崟鍙�
         wkshopcode: this.form.wkshopcode, // 鐢熶骇杞﹂棿
@@ -621,7 +595,8 @@
         mesordercode: this.form.mesordercode, // 宸ュ崟缂栧彿
         partcode: this.form.partcode, // 浜у搧缂栫爜
         partname: this.form.partname, // 浜у搧鍚嶇О
-        partspec: this.form.partspec // 瑙勬牸鍨嬪彿
+        partspec: this.form.partspec, // 瑙勬牸鍨嬪彿
+        deptno: this.form.deptno// 鍏ュ簱閮ㄩ棬
 
       }
       const { data: res } = await ProductInHouseOrderSearch(data)
@@ -637,12 +612,80 @@
 
     },
     // 澶嶉�夋鍒囨崲
-    handleSelectionChange() {
-
+    handleSelectionChange(val) {
+      this.multipleSelection = val
     },
     // 閫掍氦
-    submit() {
+    async  submit() {
+      // usercode
+      // console.log(localStorage.getItem('username'))
 
+      if (this.multipleSelection.length === 0) {
+        return this.$message.info('璇峰厛鍕鹃�夊崟鎹紒')
+      }
+      if (this.form.stockcode === '') {
+        return this.$message.info('鍏ュ簱浠撳簱涓嶈兘涓虹┖锛�')
+      }
+      if (this.form.deptno === '') {
+        return this.$message.info('鍏ュ簱閮ㄩ棬涓嶈兘涓虹┖锛�')
+      }
+
+      const TableDetailData = []
+      this.multipleSelection.forEach((i, index) => {
+        TableDetailData.push({
+          'hbillno': this.form.hbillno, // 鍏ュ簱鍗曞彿
+          'rownumber': (index + 1).toString(), // 琛屽彿
+          'inbarcode': i.inbarcode, // 鍏ュ簱鏉$爜
+          'mo_id': i.sbid.toString(), // 璁㈠崟id(琛屽彿)
+          'mo_no': i.m_po, // 璁㈠崟鍙�
+          'wocode': i.wo_code, // 宸ュ崟鍙�
+          'partcode': i.partcode, // 浜у搧缂栫爜
+          'unitcode': i.unitcode, // 鍗曚綅缂栫爜
+          'unit_rate': '1', // 鍗曚綅鎹㈢畻鐜�
+          'stockcode': i.stockcode, // 浠撳簱缂栫爜
+          // 'qty': i.qty.toString(), // 鍏ュ簱鏁伴噺
+          'qty': i.good_qty.toString(), // 鍏ュ簱鏁伴噺
+          'price': '0', // 鍏ュ簱鍗曚环
+          'saleid': i.saleOrderDetailId.toString(), // 閿�鍞崟id(琛屽彿)
+          'salecode': i.saleOrderCode, // 閿�鍞崟鍙�
+          'status': '0', // 鍏ュ簱鍗曠姸鎬侊細0(鏈鏍�) 1(宸插鏍�)
+          'stepcode': i.step_code, // 宸ュ簭缂栫爜
+          'style': i.style// 鎶ュ伐绫诲瀷锛欱(鑷埗) S(澶栧崗)
+        })
+      })
+      const data = {
+        'rightcode': '0604', // 鍔熻兘缂栧彿
+        'incbit': this.form.incbit, // 娴佹按鍙�
+        'TableData': [
+          [
+            {
+              'hbillno': this.form.hbillno, // 鍏ュ簱鍗曞彿
+              'hbdate': handleDatetime(this.form.hbdate),
+              'deptno': this.form.deptno, // 鍏ュ簱閮ㄩ棬
+              'storehouse_code': this.form.stockcode, // 浠撳簱缂栫爜
+              'status': '0', // 鍏ュ簱鍗曠姸鎬侊細0(鏈鏍�) 1(宸插鏍�)
+              'remark': '', // 澶囨敞
+              'create_user': localStorage.getItem('username'), // 鍒涘缓浜哄憳
+              'create_date': handleDatetime2(new Date()),
+              'check_user': '', // 瀹℃牳浜哄憳
+              'check_date': ''// 瀹℃牳鏃堕棿
+            }
+          ],
+          TableDetailData// 琛ㄤ綋
+        ]
+      }
+      this.$store.state.app.buttonIsDisabled = true
+      const res = await ProductInHouseOrderSeave(data)
+      this.$store.state.app.buttonIsDisabled = false
+      if (res.code === '200') {
+        this.$message.success('鍏ュ簱鎴愬姛锛�')
+        this.multipleSelection = []
+        // this.form.deptno = ''
+        // this.form.stockcode = ''
+        // await this.getProductInHouseOrderSearch()
+        this.reset()
+        await this.getProductInHouseOrderCodeSearch()
+      }
     },
     // 閲嶇疆
     reset() {
@@ -653,6 +696,8 @@
       this.form.partcode = ''// 浜у搧缂栫爜
       this.form.partname = '' // 浜у搧鍚嶇О
       this.form.partspec = '' // 瑙勬牸鍨嬪彿
+      this.form.deptno = '' // 瑙勬牸鍨嬪彿
+      this.tableDataDetail = []
     },
     // 鑾峰彇椤甸潰楂樺害
     getHeight() {

--
Gitblit v1.9.3