From 490a7de26a2283b8e238ceee4bfaf4e0210d8620 Mon Sep 17 00:00:00 2001
From: 小小儁爺 <1694218219@qq.com>
Date: 星期五, 25 十月 2024 16:21:12 +0800
Subject: [PATCH] 1.生产入库实现13%

---
 src/api/WorkOrder.js                   |   26 ++++++++
 src/views/produce/productWarehouse.vue |   97 ++++++++++++++++++++++++++++++-
 2 files changed, 118 insertions(+), 5 deletions(-)

diff --git a/src/api/WorkOrder.js b/src/api/WorkOrder.js
index 6f78103..e362259 100644
--- a/src/api/WorkOrder.js
+++ b/src/api/WorkOrder.js
@@ -304,3 +304,29 @@
   })
 }
 
+// 鐢熶骇鍏ュ簱鑾峰彇閮ㄩ棬淇℃伅
+export function DeptSelectData() {
+  return request({
+    url: 'WorkOrder/DeptSelectData',
+    method: 'get'
+  })
+}
+
+// 鐢熶骇鍏ュ簱鑾峰彇鍗曟嵁鍙�
+export function ProductInHouseOrderCodeSearch(data) {
+  return request({
+    url: 'WorkOrder/ProductInHouseOrderCodeSearch',
+    method: 'post',
+    params: data
+  })
+}
+
+// 閫氭槗T8鐢熶骇鍏ュ簱鎻愪氦
+export function ProductInHouseOrderSeave(data) {
+  return request({
+    url: 'WorkOrder/ProductInHouseOrderSeave',
+    method: 'post',
+    data
+  })
+}
+
diff --git a/src/views/produce/productWarehouse.vue b/src/views/produce/productWarehouse.vue
index 174b187..f6ec5a7 100644
--- a/src/views/produce/productWarehouse.vue
+++ b/src/views/produce/productWarehouse.vue
@@ -120,7 +120,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"
@@ -147,6 +147,23 @@
               >
                 <el-option
                   v-for="item in stockcodeArr"
+                  :key="item.code"
+                  :label="item.name"
+                  :value="item.code"
+                />
+              </el-select>
+            </el-form-item>
+
+            <el-form-item label="鍏ュ簱閮ㄩ棬" required style=" display: flex;">
+              <el-select
+                v-model="form.deptno"
+                :popper-append-to-body="false"
+                filterable
+                style="width: 200px"
+                placeholder="璇烽�夋嫨"
+              >
+                <el-option
+                  v-for="item in departmentArr"
                   :key="item.code"
                   :label="item.name"
                   :value="item.code"
@@ -549,8 +566,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 +584,8 @@
       tableHeight: 0,
       form: {
         hbillno: '', // 鍏ュ簱鍗曞彿
-        // incbit: '', // 娴佹按鍙�
-        documentType: 'Y', // 鍗曟嵁绫诲瀷
+        incbit: '', // 娴佹按鍙�
+        hbdate: new Date(), // 鍏ュ簱鍗曟棩鏈�
 
         saleordercode: '', // 閿�鍞崟鍙�
         wkshopcode: '', // 鐢熶骇杞﹂棿
@@ -572,6 +595,7 @@
         partname: '', // 浜у搧鍚嶇О
         partspec: '', // 瑙勬牸鍨嬪彿
 
+        deptno: '', // 鍏ュ簱閮ㄩ棬
         saleOrderCode: '', // 閿�鍞鍗�
         stockcode: '' // 鍏ュ簱浠撳簱
 
@@ -581,6 +605,7 @@
       multipleSelection: [],
       stockcodeArr: [], // 鍏ュ簱浠撳簱鏁扮粍
       WorkShopArr: [], // 鐢熶骇杞﹂棿鏁扮粍
+      departmentArr: [], // 鍏ュ簱閮ㄩ棬
 
       tabClickIndex: null, // 鐐瑰嚮鐨勫崟鍏冩牸
       tabClickLabel: '', // 褰撳墠鐐瑰嚮鐨勫垪鍚�
@@ -598,10 +623,23 @@
 
     this.getPrentOrganizationNoCompany()
     this.getTSecLocaTree()
+    this.getProductInHouseOrderCodeSearch()
+    this.getDeptSelectData()
 
     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()
@@ -641,8 +679,57 @@
 
     },
     // 閫掍氦
-    submit() {
+    async  submit() {
+      // usercode
+      // console.log(localStorage.getItem('username'))
+      const TableDetailData = []
+      this.tableDataDetail.forEach((i, index) => {
+        TableDetailData.push({
+          'hbillno': this.form.hbillno, // 鍏ュ簱鍗曞彿
+          'rownumber': i.sbid.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(), // 鍏ュ簱鏁伴噺
+          '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// 琛ㄤ綋
+        ]
+      }
 
+      console.log(JSON.stringify(data))
+
+      const res = await ProductInHouseOrderSeave(data)
+      console.log(res)
     },
     // 閲嶇疆
     reset() {

--
Gitblit v1.9.3