From d7fe8ae3888c8e2b1eea3c1e3769be0d42a21cc9 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 16 十月 2023 09:03:47 +0800
Subject: [PATCH] Merge branch '1.0.3' of http://139.186.142.91:10010/r/productDev/dmMes into 1.0.3

---
 h5_standard/src/views/needToBeDealtWith/addWarehousing.vue |  128 +++++++++++++++++++++++++++++++++++-------
 1 files changed, 107 insertions(+), 21 deletions(-)

diff --git a/h5_standard/src/views/needToBeDealtWith/addWarehousing.vue b/h5_standard/src/views/needToBeDealtWith/addWarehousing.vue
index 55b20d0..1d9ab0b 100644
--- a/h5_standard/src/views/needToBeDealtWith/addWarehousing.vue
+++ b/h5_standard/src/views/needToBeDealtWith/addWarehousing.vue
@@ -29,7 +29,7 @@
             </div>
             <van-swipe-cell v-for="(item, index) in list" :key="index">
                 <div class="rework_qd_list">
-                    <div class="rework_qd_item" @click="openL(index)">
+                    <div class="rework_qd_item" @click="openL(index)" v-if="location">
                         <span><b>*</b>鍏ュ簱璐т綅</span>
                         <div class="rework_qd_item_right">
                             <span :class="item.locationName ? 'black' : ''">{{item.locationName ? item.locationName : '璇烽�夋嫨'}}</span>
@@ -43,13 +43,15 @@
                             <van-icon name="arrow" size="20" color="#999999" />
                         </div>
                     </div>
-                    <!-- <div class="rework_qd_item" v-if="form.type != 25">
-                        <span>鐢熶骇宸ュ簭</span>
-                        <div class="rework_qd_item_right">
-                            <span :class="item.procedureName ? 'black' : ''">{{item.procedureName ? item.procedureName : '璇烽�夋嫨'}}</span>
-                            <van-icon name="arrow" size="20" color="#999999" />
+                    <template v-if="form.type !== 25">
+                        <div class="rework_qd_item" v-if="item.hasBom !== 0" @click="openGX(index)">
+                            <span>鐢熶骇宸ュ簭</span>
+                            <div class="rework_qd_item_right">
+                                <span :class="item.procedureName ? 'black' : ''">{{item.procedureName ? item.procedureName : '璇烽�夋嫨'}}</span>
+                                <van-icon name="arrow" size="20" color="#999999" />
+                            </div>
                         </div>
-                    </div> -->
+                    </template>
                     <div class="rework_qd_item" @click="openQ(index)">
                         <span><b>*</b>璐ㄩ噺灞炴��</span>
                         <div class="rework_qd_item_right">
@@ -87,8 +89,10 @@
         <Quality :show="qualityShow" @close="close2" @value="getValue2" />
         <!-- 閫夋嫨璐т綅 -->
         <Location :show="locationShow" :list="locationList" @close="close3" @value="getValue3" />
+        <!-- 宸ュ簭 -->
+        <ProductionProcess :show="productionShow" :list="productionList" @close="close4" @value="getValue4" />
         <!-- 鍗曟嵁绫诲瀷 -->
-        <van-popup v-model:show="typeShow" position="bottom" :style="{ height: '50%' }">
+        <van-popup v-model:show="typeShow" round position="bottom" :style="{ height: '50%' }">
             <van-picker
                 :columns="columns"
                 @confirm="onConfirm1"
@@ -103,11 +107,13 @@
     import { onMounted, ref, reactive } from 'vue'
     import { useRouter } from 'vue-router'
     import { Toast } from 'vant'
-    import { createForStandard, getListByWarehouseId, wOutBoundForStockUp } from '@/apis/WorkOrderAPI'
+    import { getListByWarehouseId, wOutBoundForStockUp } from '@/apis/WorkOrderAPI'
+    import { getListByMaterialId } from '@/apis/ExWarehouse'
     import Warehouse from '@/components/common/Warehouse.vue'
     import Material from '@/components/newCom/Material.vue'
     import Quality from '@/components/newCom/quality.vue'
     import Location from '@/components/newCom/location.vue'
+    import ProductionProcess from '@/components/newCom/productionProcess.vue'
 
     const router = useRouter()
     // 琛ㄥ崟鏁版嵁
@@ -119,6 +125,8 @@
     })
 
     let locationList: any = ref([])
+    let location: any = ref(true)
+    let productionList: any = ref([])
 
     let i = ref(0)
 
@@ -133,10 +141,12 @@
         {
             batch: '',
             locationId: '',
+            locationIdLabel: '',
             locationName: '',
             materialId: '',
             materialName: '',
             num: '',
+            hasBom: '',
             procedureId: '',
             procedureName: '',
             qualityType: '',
@@ -150,6 +160,7 @@
     let qualityShow = ref<boolean>(false)
     let locationShow = ref<boolean>(false)
     let typeShow = ref<boolean>(false)
+    let productionShow = ref<boolean>(false)
 
     // 鎵撳紑閫夋嫨鐗╂枡
     const openMaterial = (index: number) => {
@@ -158,8 +169,17 @@
     }
     // 鎵撳紑閫夋嫨鐗╂枡
     const openQ = (index: number) => {
+        if (list.value[index].locationIdLabel == 'APPLIANCE_ONTEST' || list.value[index].locationIdLabel == 'APPLIANCE_OFFTEST' || list.value[index].locationIdLabel == 'APPLIANCE_USELESS') {
+            return
+        }
         i.value = index
         qualityShow.value = true
+    }
+    // 鎵撳紑宸ュ簭
+    const openGX = (index: number) => {
+        if (!list.value[index].materialId) return Toast('璇峰厛閫夋嫨鍏ュ簱鐗╂枡')
+        i.value = index
+        productionShow.value = true
     }
     // 鎵撳紑閫夋嫨璐т綅
     const openL = (index: number) => {
@@ -168,18 +188,20 @@
         locationShow.value = true
     }
     const addItem = () => {
-        // if (!form.warehouseId) return Toast('璇烽�夋嫨鍏ュ簱浠撳簱')
+        if (!form.warehouseId) return Toast('璇烽�夋嫨鍏ュ簱浠撳簱')
         list.value.push({
             batch: '',
-            locationId: '',
-            locationName: '',
+            locationId: list.value[list.value.length - 1].locationId,
+            locationName: list.value[list.value.length - 1].locationName,
+            locationIdLabel: list.value[list.value.length - 1].locationIdLabel,
             materialId: '',
             materialName: '',
             num: '',
+            hasBom: '',
             procedureId: '',
             procedureName: '',
-            qualityType: '',
-            qualityTypeName: '',
+            qualityType: list.value[list.value.length - 1].qualityType,
+            qualityTypeName: list.value[list.value.length - 1].qualityTypeName,
             unitId: '',
             unitName: ''
         })
@@ -188,6 +210,12 @@
     const onConfirm1 = (value: any) => {
         form.typeName = value.name
         form.type = value.id
+        if (value.id == 25) {
+            list.value.forEach(item => {
+                item.procedureId = ''
+                item.procedureName = ''
+            })
+        }
         typeShow.value = false
     };
     const onCancel = () => {
@@ -212,7 +240,7 @@
             if (!list.value[i].locationId) return Toast(`绗�${i+1}椤瑰叆搴撹揣浣嶄笉鑳戒负绌篳)
             if (!list.value[i].materialId) return Toast(`绗�${i+1}椤瑰叆搴撶墿鏂欎笉鑳戒负绌篳)
             if (!list.value[i].qualityType) return Toast(`绗�${i+1}椤硅川閲忓睘鎬т笉鑳戒负绌篳)
-            if (!list.value[i].num || list.value[i].num == '' || list.value[i].num == 0) {
+            if (list.value[i].num <= 0) {
                 return Toast(`绗�${i + 1}椤瑰叆搴撴暟閲忓繀椤诲ぇ浜�0`)
             }
         }
@@ -244,7 +272,8 @@
     // 鍒犻櫎
     const dele = (index: any) => {
         if (list.value.length === 1) {
-            Toast('鑷冲皯淇濈暀涓�鏉″伐瑁呬俊鎭�')
+        //    Toast('鑷冲皯淇濈暀涓�鏉″伐瑁呬俊鎭�')
+            Toast('鑷冲皯淇濈暀涓�鏉$墿娴佹竻鍗曚俊鎭�')
             return
         }
         list.value.splice(index, 1)
@@ -265,6 +294,10 @@
     const close3 = (): void => {
         locationShow.value = false
     }
+    // 鍏抽棴璐т綅閫夋嫨寮规
+    const close4 = (): void => {
+        productionShow.value = false
+    }
     // 閫夋嫨浠撳簱鍥炶皟
     const getValue = (item: any): void => {
         form.warehouseName = item.name
@@ -273,21 +306,55 @@
             .then(res => {
                 if (res.code === 200) {
                     locationList.value = res.data
-                    list.value.forEach(item => {
-                        item.locationId = ''
-                        item.locationName = ''
-                    })
+                    if (res.data.length === 1) {
+                        location.value = false
+                        list.value.forEach(item => {
+                            item.locationId = res.data[0].id
+                            item.locationName = res.data[0].unionName
+                        })
+                        list.value[i.value].locationIdLabel = res.data[0].label
+                        if (res.data[0].label === 'APPLIANCE_ONTEST') {
+                            list.value[i.value].qualityType = '0'
+                            list.value[i.value].qualityTypeName = '鍚堟牸'
+                        } else if (res.data[0].label === 'APPLIANCE_OFFTEST') {
+                            list.value[i.value].qualityType = '1'
+                            list.value[i.value].qualityTypeName = '涓嶈壇'
+                        } else if (res.data[0].label === 'APPLIANCE_USELESS') {
+                            list.value[i.value].qualityType = '2'
+                            list.value[i.value].qualityTypeName = '鎶ュ簾'
+                        }
+                    } else {
+                        location.value = true
+                        list.value.forEach(item => {
+                            item.locationId = res.data[0].id
+                            item.locationName = res.data[0].unionName
+                        })
+                        // list.value.forEach(item => {
+                        //     item.locationId = ''
+                        //     item.locationName = ''
+                        // })
+                    }
                 }
             })
         warehouseShow.value = false
     }
     // 閫夋嫨鐗╂枡
     const getValue1 = (item: any): void => {
-        console.log(item)
         list.value[i.value].materialName = item.mmodelUnionName
         list.value[i.value].materialId = item.id
         list.value[i.value].unitId = item.unitId
+        list.value[i.value].hasBom = item.hasBom
         list.value[i.value].unitName = item.umodelName
+        // 鑾峰彇鐗╂枡涓嬪伐搴�
+        getListByMaterialId({
+            materialId: item.id
+        }).then(res => {
+            if (res.code === 200) {
+                productionList.value = res.data
+                list.value[i.value].procedureId = ''
+                list.value[i.value].procedureName = ''
+            }
+        })
         materialsShow.value = false
     }
     // 閫夋嫨璐ㄩ噺灞炴��
@@ -300,8 +367,27 @@
     const getValue3 = (item: any): void => {
         list.value[i.value].locationId = item.id
         list.value[i.value].locationName = item.unionName
+        list.value[i.value].qualityType = ''
+        list.value[i.value].qualityTypeName = ''
+        list.value[i.value].locationIdLabel = item.label
+        if (item.label === 'APPLIANCE_ONTEST') {
+            list.value[i.value].qualityType = '0'
+            list.value[i.value].qualityTypeName = '鍚堟牸'
+        } else if (item.label === 'APPLIANCE_OFFTEST') {
+            list.value[i.value].qualityType = '1'
+            list.value[i.value].qualityTypeName = '涓嶈壇'
+        } else if (item.label === 'APPLIANCE_USELESS') {
+            list.value[i.value].qualityType = '2'
+            list.value[i.value].qualityTypeName = '鎶ュ簾'
+        }
         locationShow.value = false
     }
+    // 閫夋嫨宸ュ簭
+    const getValue4 = (item: any): void => {
+        list.value[i.value].procedureId = item.id
+        list.value[i.value].procedureName = item.name
+        productionShow.value = false
+    }
     onMounted(() => {
         // 鑾峰彇宸ヨ淇℃伅
         // getLKInfo(route.query.id as string)

--
Gitblit v1.9.3