From 1a2e9c7cbab7096222b0b75ada21590877db2cf0 Mon Sep 17 00:00:00 2001
From: liulijun <liulijun@hnkhzn.com>
Date: 星期五, 27 三月 2026 14:34:56 +0800
Subject: [PATCH] 修复出库详情的状态显示异常

---
 项目代码/WMS/WMSClient/src/views/Home.vue |  147 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 110 insertions(+), 37 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/views/Home.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/views/Home.vue"
index 07854b1..a863757 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/views/Home.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WMSClient/src/views/Home.vue"
@@ -65,10 +65,15 @@
             <div class="roadway-section">
               <h2 class="roadway-title">{{ Area.roadwayNo }} 绗�1宸烽亾绗�1鎺�(涓滈潰:鍖�>鍗�)</h2>
               <div class="row" v-for="(item, index) in locationData.row1" :key="'row1-' + index">
-                <div class="location-cell" :style="{ 'background-color': GetBgColor(column) }"
-                  v-for="(column, colIndex) in item.locationObj" :key="'row1-' + item.layer + '-' + colIndex"
-                  @mouseenter="showTooltip(column, $event)" @mouseleave="hideTooltip">
-                  {{ getRoadwayNo(column) }}-{{ column.column }}-{{ column.layer }}
+                <div 
+                  class="location-cell" 
+                  :class="{ 'empty-cell': column.location_lock === -1 }"
+                  :style="{ 'background-color': column.location_lock === -1 ? 'transparent' : GetBgColor(column) }"
+                  v-for="(column, colIndex) in item.locationObj" 
+                  :key="'row1-' + item.layer + '-' + colIndex"
+                  @mouseenter="column.location_lock !== -1 && showTooltip(column, $event)" 
+                  @mouseleave="hideTooltip">
+                  <span v-if="column.location_lock !== -1">{{ getRoadwayNo(column) }}-{{ column.column }}-{{ column.layer }}</span>
                 </div>
               </div>
             </div>
@@ -77,10 +82,15 @@
             <div class="roadway-section">
               <h2 class="roadway-title">{{ Area.roadwayNo }} 绗�1宸烽亾绗�2鎺�(瑗块潰:鍖�>鍗�)</h2>
               <div class="row" v-for="(item, index) in locationData.row2" :key="'row2-' + index">
-                <div class="location-cell" :style="{ 'background-color': GetBgColor(column) }"
-                  v-for="(column, colIndex) in item.locationObj" :key="'row2-' + item.layer + '-' + colIndex"
-                  @mouseenter="showTooltip(column, $event)" @mouseleave="hideTooltip">
-                  {{ getRoadwayNo(column) }}-{{ column.column }}-{{ column.layer }}
+                <div 
+                  class="location-cell" 
+                  :class="{ 'empty-cell': column.location_lock === -1 }"
+                  :style="{ 'background-color': column.location_lock === -1 ? 'transparent' : GetBgColor(column) }"
+                  v-for="(column, colIndex) in item.locationObj" 
+                  :key="'row2-' + item.layer + '-' + colIndex"
+                  @mouseenter="column.location_lock !== -1 && showTooltip(column, $event)" 
+                  @mouseleave="hideTooltip">
+                  <span v-if="column.location_lock !== -1">{{ getRoadwayNo(column) }}-{{ column.column }}-{{ column.layer }}</span>
                 </div>
               </div>
             </div>
@@ -97,7 +107,7 @@
               <!-- 鍘熸枡搴撴樉绀哄唴瀹� -->
               <div v-if="Area.warehouse === '鍘熸枡搴�'">
                 <p><strong>绾稿嵎:</strong><span>{{ currentLocation.paperRoll || "鏃�" }}</span></p>
-                <p><strong>闂ㄥ箙:</strong><span>{{ currentLocation.width ? currentLocation.width + "m" : "鏃�" }}</span></p>
+                <p><strong>闂ㄥ箙:</strong><span>{{ currentLocation.width ? currentLocation.width : "鏃�" }}</span></p>
                 <p><strong>鏉$爜:</strong><span>{{ currentLocation.barcode || "鏃�" }}</span></p>
                 <p><strong>RFID:</strong><span>{{ currentLocation.rfid || "鏃�" }}</span></p>
               </div>
@@ -150,9 +160,9 @@
       infoMsg: [
         { bgcolor: "#f0f0f0", msg: "绌洪棽", state: 0 },
         { bgcolor: "#90ee90", msg: "鏈夎揣", state: 100 },
+        { bgcolor: "#2BB3D5", msg: "閿佸畾", state: 1 },
         { bgcolor: "#a0a0a0", msg: "绌洪棽閿佸畾", state: 20 },
         { bgcolor: "#228b22", msg: "鏈夎揣閿佸畾", state: 10 },
-        { bgcolor: "#2BB3D5", msg: "涓撶敤璐т綅", state: 3 },
       ],
       locationData: [],
       showTooltipFlag: false,
@@ -170,6 +180,9 @@
           case 0: //绌洪棽
             bgColor = "#f0f0f0"; //寰堟祬鐏�
             break;
+          case 1: //閿佸畾
+            bgColor = "#2BB3D5"; //钃濊壊
+            break;
           case 20: //绌洪棽閿佸畾
             bgColor = "#a0a0a0"; //娣辩伆
             break;
@@ -178,9 +191,6 @@
             break;
           case 10: //鏈夎揣閿佸畾
             bgColor = "#228b22"; //娣辩豢
-            break;
-          case 3: //涓撶敤搴撲綅
-            bgColor = "#2BB3D5"; //钃濊壊(涓嶅彉)
             break;
           default:
             bgColor = "#f0f0f0"; //榛樿寰堟祬鐏�
@@ -317,37 +327,71 @@
           if (x.data) {
             this.locationData = x.data;
 
-            // 瀵圭1鎺掓暟鎹繘琛屾帓搴�
-            if (this.locationData.row1) {
+            // 纭繚璐т綅鎸夊垪鍙锋帓搴忓苟璁$畻鏈�澶у垪鏁帮紝鐢ㄤ簬瀵归綈
+            const ensureColumnsAlignment = (rowData) => {
+              if (!rowData || rowData.length === 0) return;
+              
               // 鎸夊眰鍙蜂粠楂樺埌浣庢帓搴�
-              this.locationData.row1.sort((a, b) => parseInt(b.layer) - parseInt(a.layer));
-
-              // 瀵规瘡灞傚唴鐨勮揣浣嶆寜鍒楀彿浠庡寳鍒板崡鎺掑簭锛�01-64锛�
-              this.locationData.row1.forEach(layer => {
+              rowData.sort((a, b) => parseInt(b.layer) - parseInt(a.layer));
+              
+              // 纭畾鏈�澶у垪鏁帮紙鍋囪鏄�64鍒楋紝浠�01-64锛�
+              const maxColumns = 64;
+              
+              // 澶勭悊姣忓眰鏁版嵁
+              rowData.forEach(layer => {
+                // 瀵规瘡灞傚唴鐨勮揣浣嶆寜鍒楀彿浠庡寳鍒板崡鎺掑簭锛�01-64锛�
                 layer.locationObj.sort((a, b) => {
                   // 纭繚鍒楀彿鎸夋暟瀛楅『搴忔帓鍒�
                   const colA = parseInt(a.column);
                   const colB = parseInt(b.column);
                   return colA - colB;
                 });
-              });
-            }
-
-            // 瀵圭2鎺掓暟鎹繘琛屽悓鏍风殑鎺掑簭
-            if (this.locationData.row2) {
-              // 鎸夊眰鍙蜂粠楂樺埌浣庢帓搴�
-              this.locationData.row2.sort((a, b) => parseInt(b.layer) - parseInt(a.layer));
-
-              // 瀵规瘡灞傚唴鐨勮揣浣嶆寜鍒楀彿浠庡寳鍒板崡鎺掑簭锛�01-64锛�
-              this.locationData.row2.forEach(layer => {
-                layer.locationObj.sort((a, b) => {
-                  // 纭繚鍒楀彿鎸夋暟瀛楅『搴忔帓鍒�
-                  const colA = parseInt(a.column);
-                  const colB = parseInt(b.column);
-                  return colA - colB;
+                
+                // 鍒涘缓瀹屾暣鐨勫垪鏁扮粍
+                const completeColumns = [];
+                
+                // 褰撳墠宸叉湁鐨勮揣浣嶏紝鎸夊垪鍙锋槧灏�
+                const existingLocations = {};
+                layer.locationObj.forEach(loc => {
+                  existingLocations[parseInt(loc.column)] = loc;
                 });
+                
+                // 閬嶅巻鎵�鏈夊彲鑳界殑鍒楀彿锛�1-64锛�
+                for (let col = 1; col <= maxColumns; col++) {
+                  if (existingLocations[col]) {
+                    // 濡傛灉璇ュ垪鏈夎揣浣嶆暟鎹紝鐩存帴浣跨敤
+                    completeColumns.push(existingLocations[col]);
+                  } else {
+                    // 濡傛灉璇ュ垪娌℃湁璐т綅鏁版嵁锛屾坊鍔犵┖鍗犱綅绗�
+                    completeColumns.push({
+                      locationCode: `empty-${layer.row}-${String(col).padStart(2, '0')}-${layer.layer}`,
+                      row: layer.row,
+                      column: String(col).padStart(2, '0'),
+                      layer: layer.layer,
+                      location_lock: -1, // 鐗规畩鏍囪锛岀敤浜庤〃绀虹┖鍗犱綅绗�
+                      paperRoll: '',
+                      productName: '',
+                      width: 0,
+                      quantity: 0,
+                      barcode: '',
+                      rfid: '',
+                      rfidCode: '',
+                      inDate: null,
+                      warehouseId: layer.warehouseId || 0
+                    });
+                  }
+                }
+                
+                // 鏇存柊璇ュ眰鐨勮揣浣嶆暟鎹负瀹屾暣鍒�
+                layer.locationObj = completeColumns;
               });
-            }
+            };
+            
+            // 澶勭悊绗�1鎺掓暟鎹�
+            ensureColumnsAlignment(this.locationData.row1);
+            
+            // 澶勭悊绗�2鎺掓暟鎹�
+            ensureColumnsAlignment(this.locationData.row2);
           }
 
           // 鎻愬彇鎵�鏈夎揣浣嶇紪鍙�
@@ -667,12 +711,13 @@
   margin-bottom: 8px;
   cursor: pointer;
   flex-wrap: nowrap;
+  width: 100%;
+  min-width: max-content;
 }
 
 .location-cell {
-  width: 120px;
+  flex: 0 0 120px;
   height: 50px;
-  margin: 5px;
   text-align: center;
   font-size: 16px;
   border-radius: 4px;
@@ -680,6 +725,34 @@
   box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
   border: 1px solid #ccc;
   background-color: #f9f9f9;
+  margin: 0 5px;
+}
+
+/* 绌哄崰浣嶇鏍峰紡 */
+.location-cell.empty-cell {
+  background-color: transparent;
+  border: none;
+  box-shadow: none;
+  cursor: default;
+}
+
+/* 娣诲姞璐т綅缃戞牸瀹瑰櫒鏍峰紡锛岀‘淇濇墍鏈夎瀵归綈 */
+.roadway-section {
+  overflow-x: auto;
+  overflow-y: hidden;
+}
+
+.location-cell {
+  width: 120px;
+  height: 50px;
+  text-align: center;
+  font-size: 16px;
+  border-radius: 4px;
+  line-height: 50px;
+  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
+  border: 1px solid #ccc;
+  background-color: #f9f9f9;
+  margin: 0;
 }
 
 /* 宸烽亾鍖哄煙鏍峰紡 */

--
Gitblit v1.9.3