From f8ea0c93a2c35e84d77d737301bb36f50b8aeebb Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期六, 06 九月 2025 18:06:13 +0800
Subject: [PATCH] art: 物料出库

---
 src/views/lsw/modules/LswMaterialInboundForm.vue |   96 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 64 insertions(+), 32 deletions(-)

diff --git a/src/views/lsw/modules/LswMaterialInboundForm.vue b/src/views/lsw/modules/LswMaterialInboundForm.vue
index 15c5f74..a20e449 100644
--- a/src/views/lsw/modules/LswMaterialInboundForm.vue
+++ b/src/views/lsw/modules/LswMaterialInboundForm.vue
@@ -4,8 +4,15 @@
       <a-form-model ref="form" :model="model" :rules="validatorRules" slot="detail">
         <a-row>
           <a-col :span="12">
-            <a-form-model-item label="鏉ユ簮缂栫爜" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="originalCode">
+            <a-form-model-item label="鏉ユ簮缂栫爜" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="originalCode"
+                               v-if="model.inboundCategory !== 'MATERIAL_INNER_TRANSFER'">
               <a-input v-model="model.originalCode" placeholder="璇疯緭鍏ユ潵婧愮紪鐮�"></a-input>
+            </a-form-model-item>
+            <a-form-model-item label="鏉ユ簮绾胯竟搴�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="originalCode"
+                               v-else>
+              <j-search-select-tag v-model="model.originalCode" placeholder="璇烽�夋嫨绾胯竟搴�"
+                                   :dict-options="originalCodeDictOptions"
+                                   @change="originalCodeSelectChange"></j-search-select-tag>
             </a-form-model-item>
           </a-col>
           <a-col :span="12">
@@ -16,12 +23,14 @@
           <a-col :span="12">
             <a-form-model-item label="绾胯竟搴�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="warehouseId">
               <j-search-select-tag v-model="model.warehouseId" placeholder="璇烽�夋嫨绾胯竟搴�"
-                                   :dict-options="warehouseDictOptions" @change="warehouseSelectChange"></j-search-select-tag>
+                                   :dict-options="warehouseDictOptions"
+                                   @change="warehouseSelectChange"></j-search-select-tag>
             </a-form-model-item>
           </a-col>
           <a-col :span="12">
             <a-form-model-item label="鐗╂枡缂栫爜" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="materialNumber">
-              <j-search-select-tag :dict-options="materialDictOptions" v-model="model.materialNumber" placeholder="璇烽�夋嫨鐗╂枡缂栫爜" @change="materialSelectChange"></j-search-select-tag>
+              <j-search-select-tag :dict-options="materialDictOptions" v-model="model.materialNumber"
+                                   placeholder="璇烽�夋嫨鐗╂枡缂栫爜" @change="materialSelectChange"></j-search-select-tag>
             </a-form-model-item>
           </a-col>
           <a-col :span="12">
@@ -47,7 +56,8 @@
           </a-col>
           <a-col :span="12">
             <a-form-model-item label="鍏ュ簱绫诲瀷" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="inboundCategory">
-              <j-search-select-tag v-model="model.inboundCategory" dict="material_inbound_category"></j-search-select-tag>
+              <j-search-select-tag v-model="model.inboundCategory"
+                                   dict="material_inbound_category"></j-search-select-tag>
             </a-form-model-item>
           </a-col>
         </a-row>
@@ -62,8 +72,7 @@
 
 export default {
   name: 'LswMaterialInboundForm',
-  components: {
-  },
+  components: {},
   props: {
     //琛ㄥ崟绂佺敤
     disabled: {
@@ -107,20 +116,27 @@
         ],
         quantity: [
           { required: true, message: '鍏ュ簱鏁伴噺鏄繀閫夐」', trigger: 'change' }
-        ],
+        ]
       },
       url: {
         add: '/lsw/materialInbound/add',
         edit: '/lsw/materialInbound/edit',
         queryById: '/lsw/materialInbound/queryById',
         queryByProductionType: '/base/lineSideWarehouse/queryByProductionType',
-        queryByMaterialCategory: '/lsw/lswMaterial/queryByMaterialCategory',
+        queryByMaterialCategory: '/lsw/lswMaterial/queryByMaterialCategory'
       }
     }
   },
   computed: {
     formDisabled() {
       return this.disabled
+    },
+    originalCodeDictOptions() {
+      return this.warehouseDictOptions.map(warehouse => ({
+        ...warehouse,
+        value: warehouse.warehouseCode,
+        text: warehouse.warehouseName + '(' + warehouse.warehouseCode + ')'
+      }))
     }
   },
   created() {
@@ -129,19 +145,19 @@
   },
   methods: {
     add(inboundCategory) {
-      this.warehouseDictOptions = [];
-      this.materialDictOptions = [];
-      if(inboundCategory === 'HEAT_TREATMENT_INBOUND') {
-        this.loadWarehouseDictOptions('OUTERFLANGE,INNERFLANGE');
-        this.loadMaterialDictOptions('BLANK');
-      }else if(inboundCategory === 'SMALL_INNER_RING') {
-        this.loadWarehouseDictOptions('ASSEMBLE');
-        this.loadMaterialDictOptions('SMALL_INNER_RING');
-      } else if(inboundCategory === 'MATERIAL_INNER_TRANSFER') {
-        this.loadWarehouseDictOptions('ASSEMBLE');
-        this.loadMaterialDictOptions('STEEL_BALL');
+      this.warehouseDictOptions = []
+      this.materialDictOptions = []
+      if (inboundCategory === 'HEAT_TREATMENT_INBOUND') {
+        this.loadWarehouseDictOptions('OUTERFLANGE,INNERFLANGE')
+        this.loadMaterialDictOptions('BLANK')
+      } else if (inboundCategory === 'SMALL_INNER_RING') {
+        this.loadWarehouseDictOptions('ASSEMBLE')
+        this.loadMaterialDictOptions('SMALL_INNER_RING')
+      } else if (inboundCategory === 'MATERIAL_INNER_TRANSFER') {
+        this.loadWarehouseDictOptions('ASSEMBLE,OUTERFLANGE,INNERFLANG,HEATTREATMENT')
+        this.loadMaterialDictOptions('OUTER_FLANGE,INNER_FLANGE,STEEL_BALL,BLANK,COMPONENTS')
       }
-      this.modelDefault.inboundCategory = inboundCategory;
+      this.modelDefault.inboundCategory = inboundCategory
       this.edit(this.modelDefault)
     },
     edit(record) {
@@ -178,35 +194,51 @@
       })
     },
     loadWarehouseDictOptions(productionType) {
-      let params = {productionType : productionType}
+      let params = { productionType: productionType }
       getAction(this.url.queryByProductionType, params).then(res => {
-        if(res.success) {
-          this.warehouseDictOptions = res.result.map(warehouse => ({...warehouse, value : warehouse.id, text: warehouse.warehouseName + '(' + warehouse.warehouseCode+')'}));
+        if (res.success) {
+          this.warehouseDictOptions = res.result.map(warehouse => ({
+            ...warehouse,
+            value: warehouse.id,
+            text: warehouse.warehouseName + '(' + warehouse.warehouseCode + ')'
+          }))
         }
       })
     },
     loadMaterialDictOptions(materialCategory) {
-      let params = {materialCategory : materialCategory}
+      let params = { materialCategory: materialCategory }
       getAction(this.url.queryByMaterialCategory, params).then(res => {
-        if(res.success) {
-          this.materialDictOptions = res.result.map(material => ({...material, value : material.materialNumber, text: material.materialNumber}));
+        if (res.success) {
+          this.materialDictOptions = res.result.map(material => ({
+            ...material,
+            value: material.materialNumber,
+            text: material.materialNumber + '(' + material.materialName + ')'
+          }))
         }
       })
     },
     warehouseSelectChange(value) {
       let warehouse = this.warehouseDictOptions.find(option => option.value === value)
-      if(warehouse) {
+      if (warehouse) {
         this.model.factoryId = warehouse.factoryId
-      }else {
-        this.model.factoryId = undefined;
+      } else {
+        this.model.factoryId = undefined
       }
     },
     materialSelectChange(value) {
       let material = this.materialDictOptions.find(option => option.value === value)
-      if(material) {
+      if (material) {
         this.model.materialName = material.materialName
-      }else {
-        this.model.materialName = undefined;
+      } else {
+        this.model.materialName = undefined
+      }
+    },
+    originalCodeSelectChange(value) {
+      let warehouse = this.originalCodeDictOptions.find(option => option.value === value)
+      if (warehouse) {
+        this.model.originalName = warehouse.warehouseName
+      } else {
+        this.model.originalName = undefined
       }
     }
   }

--
Gitblit v1.9.3