From 0b0899370f271793f7156144b4b912438aebdf73 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期一, 24 十一月 2025 08:41:56 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu

---
 项目代码/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue |  189 ++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 163 insertions(+), 26 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
index 2fbaa74..b976153 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/inbound/extend/Pallet.vue"
@@ -12,13 +12,38 @@
   >
   <div class="barcode-scanner-container">
       
+      <!-- 浠撳簱閫夋嫨 - 绱у噾甯冨眬 -->
+      <div class="location-section compact">
+        <el-form :model="form" :rules="rules" ref="locationForm" class="compact-form">
+          <el-form-item label="浠撳簱" prop="warehouseType" class="location-select compact-item">
+            <el-select
+              v-model="form.warehouseType"
+              placeholder="璇烽�夋嫨浠撳簱"
+              clearable
+              filterable
+              @change="handleWarehouseChange"
+              style="width: 100%"
+              :loading="warehouseLoading"
+              size="medium"
+            >
+              <el-option
+                v-for="item in warehouseTypes"
+                :key="item.warehouseType"
+                :label="item.warehouseTypeDesc"
+                :value="item.warehouseType"
+              />
+            </el-select>
+          </el-form-item>
+        </el-form>
+      </div>
+
       <!-- 浠撳簱鍖哄煙閫夋嫨 - 绱у噾甯冨眬 -->
       <div class="location-section compact">
         <el-form :model="form" :rules="rules" ref="locationForm" class="compact-form">
           <el-form-item label="浠撳簱鍖哄煙" prop="locationType" class="location-select compact-item">
             <el-select
               v-model="form.locationType"
-              placeholder="璇烽�夋嫨浠撳簱鍖哄煙"
+              placeholder="璇峰厛閫夋嫨浠撳簱"
               clearable
               filterable
               @change="handleLocationChange"
@@ -40,6 +65,9 @@
       <!-- 鎵樼洏淇℃伅鏄剧ず - 绱у噾甯冨眬 -->
       <div class="tray-info compact" v-if="trayBarcode">
         <i class="el-icon-s-management"></i> 褰撳墠鏂欑: {{ trayBarcode }}
+        <span class="location-info" v-if="form.warehouseType">
+          | 浠撳簱: {{ currentWarehouseName  }}
+        </span>
         <span class="location-info" v-if="form.locationType">
           | 浠撳簱鍖哄煙: {{ currentLocationDesc }}
         </span>
@@ -52,7 +80,7 @@
             <span><i class="el-icon-scanner"></i> 鎵爜鍖哄煙</span>
             <span class="scan-status">
               <span class="scan-indicator"></span>
-              {{ form.locationType ? '鎵爜灏辩华' : '璇峰厛閫夋嫨浠撳簱鍖哄煙' }}
+              {{ form.locationType && form.warehouseType ? '鎵爜灏辩华' : '璇峰厛閫夋嫨浠撳簱鍜屼粨搴撳尯鍩�' }}
             </span>
           </div>
           
@@ -64,7 +92,7 @@
               v-model="trayBarcode"
               placeholder="璇锋壂鎻忔垨杈撳叆鏂欑鐮佸悗鎸夊洖杞﹂敭"
               clearable
-              :disabled="!form.locationType"
+              :disabled="!form.locationType || !form.warehouseType"
               @keyup.enter.native="handleTraySubmit"
               @clear="handleTrayClear"
               @input="handleTrayInput"
@@ -76,7 +104,7 @@
                   @click="handleTraySubmit"
                   type="primary"
                   icon="el-icon-position"
-                  :disabled="!form.locationType || !trayBarcode"
+                  :disabled="!form.locationType || !trayBarcode || !form.warehouseType"
                   size="medium"
                 >
                   纭
@@ -93,7 +121,7 @@
               v-model="barcode"
               placeholder="璇锋壂鎻忔垨杈撳叆鐗╂枡鏉$爜鍚庢寜鍥炶溅閿�"
               clearable
-              :disabled="!form.locationType || !trayBarcode"
+              :disabled="!form.locationType || !trayBarcode || !form.warehouseType"
               @keyup.enter.native="handleBarcodeSubmit"
               @clear="handleClear"
               @input="handleBarcodeInput"
@@ -106,7 +134,7 @@
                   @click="handleBarcodeSubmit"
                   type="primary"
                   icon="el-icon-search"
-                  :disabled="!form.locationType || !trayBarcode || !barcode"
+                  :disabled="!form.locationType || !trayBarcode || !barcode || !from.warehouseType"
                   size="medium"
                 >
                   {{ loading ? '鏌ヨ涓�...' : '鏌ヨ' }}
@@ -116,9 +144,10 @@
           </div>
           
           <div class="input-tips compact-tips">
-            <p>鎻愮ず锛氳鍏堥�夋嫨浠撳簱鍖哄煙锛岀劧鍚庤緭鍏ユ枡绠辩爜锛屾渶鍚庤緭鍏ョ墿鏂欐潯鐮�</p>
-            <p v-if="!form.locationType" class="warning-text">鈿狅笍 璇峰厛閫夋嫨浠撳簱鍖哄煙</p>
-            <p v-if="form.locationType && !trayBarcode" class="warning-text">鈿狅笍 璇峰厛杈撳叆鏂欑鐮�</p>
+            <p>鎻愮ず锛氳鍏堥�夋嫨浠撳簱 鈫� 閫夋嫨浠撳簱鍖哄煙 鈫� 杈撳叆鏂欑鐮� 鈫� 杈撳叆鐗╂枡鏉$爜</p>
+            <p v-if="!form.warehouseType" class="warning-text">鈿狅笍 璇峰厛閫夋嫨浠撳簱</p>
+            <p v-if="!form.locationType && !form.warehouseType" class="warning-text">鈿狅笍 璇峰厛閫夋嫨浠撳簱鍖哄煙</p>
+            <p v-if="form.warehouseType && form.locationType && !trayBarcode" class="warning-text">鈿狅笍 璇峰厛杈撳叆鏂欑鐮�</p>
           </div>
         
         </el-card>
@@ -151,12 +180,14 @@
               <el-tag type="primary" size="small">鏈粍鐩� {{ totalStockCount }}</el-tag>
               <el-tag type="primary" size="small">鏈叆搴撴暟閲� {{ totalStockSum }}{{ uniqueUnit }}</el-tag>
               <el-tag v-if="trayBarcode" type="success" size="small">鎵樼洏: {{ trayBarcode }}</el-tag>
+              <el-tag v-if="form.warehouseType" type="info" size="small">浠撳簱: {{ currentWarehouseName }}</el-tag>
               <el-tag v-if="form.locationType" type="info" size="small">鍖哄煙: {{ currentLocationDesc }}</el-tag>
             </span>
           </div>
           
           <div v-if="materials.length === 0" class="empty-state compact">
             <i class="el-icon-document"></i>
+            <p v-if="!form.warehouseType">璇峰厛閫夋嫨浠撳簱</p>
             <p v-if="!form.locationType">璇峰厛閫夋嫨浠撳簱鍖哄煙</p>
             <p v-else-if="!trayBarcode">璇峰厛杈撳叆鏂欑鏉$爜</p>
             <p v-else>鏆傛棤鐗╂枡鏁版嵁锛岃鎵弿鎴栬緭鍏ョ墿鏂欐潯鐮�</p>
@@ -177,7 +208,7 @@
               <el-table-column prop="stockQuantity" label="鏁伴噺" min-width="130" align="right"></el-table-column>
               <el-table-column prop="unit" label="鍗曚綅" width="80" align="center"></el-table-column>
               <el-table-column prop="supplyCode" label="渚涘簲鍟�" min-width="130" show-overflow-tooltip></el-table-column>
-              <el-table-column prop="warehouseCode" label="浠撳簱" min-width="120" show-overflow-tooltip></el-table-column>
+              <el-table-column prop="warehouseType" label="浠撳簱" min-width="120" show-overflow-tooltip></el-table-column>
             </el-table>
           </div>
         </el-card>
@@ -217,7 +248,7 @@
           loading: false,
           error: '',
           debugMode: false,
-          currentFocus: 'tray',
+          currentFocus: 'warehouse',
           
           // 鎵爜鏋浉鍏冲彉閲�
           scanCode: '',
@@ -234,11 +265,14 @@
           uniqueUnit: '',
           sumLoading: false,
           sumError: '',
-
+        // 浠撳簱鐩稿叧鍙橀噺
+          warehouseTypes: [], 
+          warehouseLoading: false, 
         // 浠撳簱鍖哄煙鐩稿叧鍙橀噺
         locationTypes: [],
         locationLoading: false,
         form: {
+            warehouseType: null,
             locationType: null
         },
     rules: {
@@ -247,8 +281,14 @@
           validator: this.validateLocationType, 
           trigger: 'change' 
         }
-      ]
-    }
+      ],
+      warehouseType: [
+          { 
+            massage:'璇烽�夋嫨浠撳簱',
+            trigger: 'change'
+          }
+        ]
+      }
     }
   },
   computed: {
@@ -257,6 +297,11 @@
       set(newVal) { this.$emit('update:visible', newVal); }
     },
     currentDocNo() { return this.docNo; },
+        // 褰撳墠閫夋嫨鐨勪粨搴撳悕绉�
+    currentWarehouseName() {
+      const warehouse = this.warehouseTypes.find(item => item.warehouseType === this.form.warehouseType);
+      return warehouse ? warehouse.warehouseTypeDesc : '';
+    },
         // 褰撳墠閫夋嫨鐨勪粨搴撳尯鍩熸弿杩�
     currentLocationDesc() {
         const location = this.locationTypes.find(item => item.locationType === this.form.locationType)
@@ -274,7 +319,8 @@
       this.$nextTick(() => {
         setTimeout(() => {
          // this.focusTrayInput();
-            this.initLocationTypes(); // 鍒濆鍖栦粨搴撳尯鍩�
+          this.initwarehouseTypes(); // 鍒濆鍖栦粨搴�
+          this.initLocationTypes(); // 鍒濆鍖栦粨搴撳尯鍩�
           this.fetchStockStatistics(); // 鍔犺浇缁熻鏁版嵁
         }, 300);
       });
@@ -298,6 +344,13 @@
       }
     }
   },
+  'form.warehouseType'(newVal) {
+      if (newVal) {
+        this.form.locationType = null; 
+      } else {
+        this.locationTypes = []; 
+      }
+    },
 
  mounted() {
  
@@ -322,10 +375,11 @@
    */
   validateLocationType(rule, value, callback) {
     // 妫�鏌ュ�兼槸鍚︿负null銆乽ndefined鎴栫┖瀛楃涓诧紝浣嗗厑璁告暟瀛�0
-    if (value === null || value === undefined || value === '') {
+    if (!this.form.warehouseType) {
+      callback(new Error('璇峰厛閫夋嫨浠撳簱'));
+    } else if (value === null || value === undefined || value === '') {
       callback(new Error('璇烽�夋嫨浠撳簱鍖哄煙'));
     } else {
-      // 鍊间负0鎴栧叾浠栨湁鏁堝�奸兘閫氳繃楠岃瘉
       callback();
     }
   },
@@ -358,6 +412,36 @@
             }
         },
 
+        /**
+         * 鍒濆鍖栦粨搴撴暟鎹�
+         */
+        async initwarehouseTypes() {
+            this.warehouseLoading = true;
+            this.error = '';
+            
+            try {
+                const response = await http.post('/api/Warehouse/GetwarehouseTypes');
+                
+                if (response.status && Array.isArray(response.data)) {
+                    this.warehouseTypes = response.data;
+                    if (this.warehouseTypes.length === 0) {
+                        this.error = '鏈幏鍙栧埌浠撳簱鏁版嵁';
+                    } else {
+                        // 濡傛灉鏈夐粯璁ゅ尯鍩燂紝鍙互鍦ㄨ繖閲岃缃�
+                        // this.form.locationType = this.locationTypes[0].locationType;
+                    }
+                } else {
+                    this.error = '鑾峰彇浠撳簱鏁版嵁澶辫触';
+                }
+            } catch (error) {
+                console.error('鑾峰彇浠撳簱澶辫触:', error);
+                this.error = `鑾峰彇浠撳簱澶辫触: ${error.message || '缃戠粶閿欒'}`;
+            } finally {
+                this.warehouseLoading = false;
+            }
+        },
+
+
  /**
  * 浠撳簱鍖哄煙鍙樻洿澶勭悊
  */
@@ -379,14 +463,42 @@
             if (!errorMsg && (value === 0 || value)) {
               console.log('浠撳簱鍖哄煙楠岃瘉閫氳繃:', value);
               // 鍖哄煙閫夋嫨鍚庯紝鑷姩鑱氱劍鍒版墭鐩樿緭鍏ユ
-              this.focusTrayInput();
+              this.focusLocationSelect();
             }
           });
         }, 100);
     }
   });
 },
-        // 鏂板锛氭煡璇㈠悗绔簱瀛樼粺璁℃暟鎹紙璋冪敤涔嬪墠鐨� SumQuantity 鎺ュ彛锛�
+
+/**
+ * 浠撳簱鍙樻洿澶勭悊
+ */
+handleWarehouseChange(value) {
+ console.log('閫夋嫨浠撳簱:', value, '绫诲瀷:', typeof value, this.currentWarehouseName);
+  
+    // 绔嬪嵆娓呴櫎閿欒淇℃伅
+    this.error = '';
+    
+    // 鎵嬪姩瑙﹀彂琛ㄥ崟楠岃瘉鏇存柊
+    this.$nextTick(() => {
+      if (this.$refs.locationForm) {
+        // 娓呴櫎璇ュ瓧娈电殑楠岃瘉鐘舵�侊紝鐒跺悗閲嶆柊楠岃瘉
+        this.$refs.locationForm.clearValidate('warehouseType');
+        
+        // 鐭殏寤惰繜鍚庨噸鏂伴獙璇侊紝纭繚DOM宸叉洿鏂�
+        setTimeout(() => {
+          this.$refs.locationForm.validateField('warehouseType', (errorMsg) => {
+            if (!errorMsg && (value === 0 || value)) {
+              console.log('浠撳簱楠岃瘉閫氳繃:', value);
+              this.focusLocationSelect();
+            }
+          });
+        }, 100);
+    }
+  });
+},
+        
     async fetchStockStatistics() {
       // 鍗曟嵁鍙蜂负绌烘椂涓嶆煡璇�
       if (!this.docNo) {
@@ -435,7 +547,10 @@
         resolve(true);
       } else {
         // 鎵嬪姩妫�鏌ocationType锛屾纭鐞嗗�间负0鐨勬儏鍐�
-        if (this.form.locationType === null || this.form.locationType === undefined || this.form.locationType === '') {
+        if(!this.from.warehouseType){
+          this.error='璇峰厛閫夋嫨浠撳簱';
+        }
+        else if(this.form.locationType === null || this.form.locationType === undefined || this.form.locationType === '') {
           this.error = '璇峰厛閫夋嫨浠撳簱鍖哄煙';
           //this.$message.warning('璇峰厛閫夋嫨浠撳簱鍖哄煙');
         } else {
@@ -447,10 +562,19 @@
     });
   });
 },
+       focusWarehouseSelect() {
+            if (this.$refs.locationForm) {
+                const selectEl = this.$el.querySelector('.location-select:first-child .el-input__inner');
+                if (selectEl) {
+                    selectEl.focus();
+                    this.currentFocus = 'warehouse';
+                }
+            }
+        },
         // 鑱氱劍鍒颁粨搴撳尯鍩熼�夋嫨
         focusLocationSelect() {
             if (this.$refs.locationForm) {
-                const selectEl = this.$el.querySelector('.el-select .el-input__inner');
+                const selectEl = this.$el.querySelector('.location-select:nth-child(2) .el-input__inner');
                 if (selectEl) {
                     selectEl.focus();
                     this.currentFocus = 'location';
@@ -492,14 +616,19 @@
       this.lastKeyTime = null;
       this.isManualInput = false;
       this.isScanning = false;
-      this.currentFocus = 'location';
+      this.currentFocus = 'warehouse';
       this.scanTarget = 'tray';
       this.clearAllTimers();
       this.totalStockSum = 0;
       this.totalStockCount = 0;
       this.sumLoading = false;
       this.sumError = '';
-        this.form.locationType = null;
+        this.form={
+          warehouseType:null,
+          locationType:null
+        }
+      this.warehouseTypes=[];
+      this.locationTypes=[];  
           // 娓呴櫎琛ㄥ崟楠岃瘉鐘舵��
   this.$nextTick(() => {
     if (this.$refs.locationForm) {
@@ -527,14 +656,15 @@
       // 浣跨敤setTimeout纭繚DOM瀹屽叏娓叉煋鍚庡啀鑱氱劍
       this.$nextTick(() => {
         setTimeout(() => {
+            this.initwarehouseTypes();
             this.initLocationTypes(); // 鍒濆鍖栦粨搴撳尯鍩�
              // 纭繚琛ㄥ崟寮曠敤瀛樺湪鍚庡啀鑱氱劍
       if (this.$refs.locationForm) {
-        this.focusLocationSelect();
+        this.focusWarehouseSelect();
       } else {
         // 濡傛灉琛ㄥ崟寮曠敤杩樹笉瀛樺湪锛岀◢鍚庨噸璇�
         setTimeout(() => {
-          this.focusLocationSelect();
+          this.focusWarehouseSelect();
         }, 500);
       }
         }, 300);
@@ -567,6 +697,8 @@
       }
       
       const result = {
+        warehouseType:this.form.warehouseType,
+        warehouseName:this.currentWarehouseName,
         locationType: this.form.locationType,
         locationDesc: this.currentLocationDesc,
         trayBarcode: this.trayBarcode,
@@ -615,6 +747,10 @@
        // 澶勭悊鎵樼洏鏉$爜鎻愪氦
 async handleTraySubmit() {
   // 鍏堢洿鎺ユ鏌ocationType锛岄伩鍏嶈〃鍗曢獙璇佺殑寮傛闂
+  if (!this.form.warehouseType) {
+    this.error = '璇峰厛閫夋嫨浠撳簱';
+    return;
+  }
   if (!this.form.locationType) {
     this.error = '璇峰厛閫夋嫨浠撳簱鍖哄煙';
     //this.$message.warning('璇峰厛閫夋嫨浠撳簱鍖哄煙');
@@ -755,7 +891,8 @@
             orderNo: this.docNo,
             barcodes: barcode,
             locationTypeDesc:  this.currentLocationDesc,
-                    locationType: this.form.locationType // 娣诲姞浠撳簱鍖哄煙淇℃伅
+            locationType: this.form.locationType, // 娣诲姞浠撳簱鍖哄煙淇℃伅
+            warehouseType:this.form.warehouseType
           } 
         );
         

--
Gitblit v1.9.3