From 0005d58f6888dd3e4524784d1b6f103f9b1c588e Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 30 三月 2026 18:33:22 +0800
Subject: [PATCH] 合并

---
 Code/WMS/docs/superpowers/plans/2026-03-30-stock-chat-implementation-plan.md |  314 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 314 insertions(+), 0 deletions(-)

diff --git a/Code/WMS/docs/superpowers/plans/2026-03-30-stock-chat-implementation-plan.md b/Code/WMS/docs/superpowers/plans/2026-03-30-stock-chat-implementation-plan.md
new file mode 100644
index 0000000..7cddf9c
--- /dev/null
+++ b/Code/WMS/docs/superpowers/plans/2026-03-30-stock-chat-implementation-plan.md
@@ -0,0 +1,314 @@
+# 搴撳瓨3D鏌ョ湅鍣� Implementation Plan
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task.
+
+**Goal:** 瀹炵幇搴撳瓨3D鏌ョ湅鍣紝鐢ㄦ埛鍙湪 Three.js 3D 鍦烘櫙涓贰瑙嗕粨搴撱�佺偣鍑昏揣浣嶆煡鐪嬪簱瀛樿鎯�
+
+**Architecture:** 鍓嶇 Vue 3 + Element Plus + Three.js锛屽悗绔� ASP.NET Core 6 Web API + SignalR 瀹炴椂鎺ㄩ��
+
+**Tech Stack:** Three.js, @microsoft/signalr, Element Plus, Vue 3 Composition API
+
+---
+
+## 鏂囦欢缁撴瀯
+
+```
+鍚庣 (WIDESEA_WMSServer)
+鈹溾攢鈹� WIDESEA_DTO/Stock/Stock3DLayoutDTO.cs      # 3D甯冨眬鍝嶅簲DTO [鏂板缓]
+鈹溾攢鈹� WIDESEA_IStockService/IStockInfoService.cs  # 娣诲姞Get3DLayoutAsync鏂规硶绛惧悕 [淇敼]
+鈹溾攢鈹� WIDESEA_StockService/StockInfoService.cs    # 瀹炵幇Get3DLayoutAsync [淇敼]
+鈹溾攢鈹� WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs  # 娣诲姞Get3DLayout绔偣 [淇敼]
+鈹斺攢鈹� WIDESEA_WMSServer/Hubs/StockHub.cs         # SignalR Hub [鏂板缓]
+
+鍓嶇 (WIDESEA_WMSClient)
+鈹溾攢鈹� package.json                                # 娣诲姞three渚濊禆 [淇敼]
+鈹溾攢鈹� src/router/viewGird.js                      # 娉ㄥ唽璺敱 [淇敼]
+鈹溾攢鈹� src/views/stock/stockChat.vue               # 涓婚〉闈㈢粍浠� [鏂板缓]
+鈹斺攢鈹� src/extension/stock/stockChat.js            # 鎵╁睍閰嶇疆 [鏂板缓]
+```
+
+---
+
+## 瀹炵幇浠诲姟
+
+### Task 1: 鍚庣 - 鍒涘缓 Stock3DLayoutDTO
+
+**Files:**
+- Create: `WIDESEA_WMSServer/WIDESEA_DTO/Stock/Stock3DLayoutDTO.cs`
+
+**璇︾粏瑙勮寖锛�**
+
+鍒涘缓涓や釜 DTO 绫伙細
+1. `Stock3DLayoutDTO` - 鍖呭惈浠撳簱鍩烘湰淇℃伅銆佸昂瀵搞�佺瓫閫夊垪琛ㄣ�佽揣浣嶆暟缁�
+2. `Location3DItemDTO` - 鍖呭惈鍗曚釜璐т綅鐨勬墍鏈�3D娓叉煋鎵�闇�鏁版嵁
+
+**楠屾敹鏍囧噯锛�**
+- DTO 鍖呭惈鎵�鏈� spec 涓畾涔夌殑瀛楁
+- 鍛藉悕绌洪棿姝g‘
+- 鍙互琚� Service 灞傛纭紩鐢�
+
+```csharp
+namespace WIDESEA_DTO.Stock
+{
+    /// <summary>
+    /// 浠撳簱3D甯冨眬鍝嶅簲DTO
+    /// </summary>
+    public class Stock3DLayoutDTO
+    {
+        public int WarehouseId { get; set; }
+        public string WarehouseName { get; set; }
+        public int MaxRow { get; set; }
+        public int MaxColumn { get; set; }
+        public int MaxLayer { get; set; }
+        public List<string> MaterielCodeList { get; set; } = new();
+        public List<string> BatchNoList { get; set; } = new();
+        public List<Location3DItemDTO> Locations { get; set; } = new();
+    }
+
+    /// <summary>
+    /// 璐т綅3D鏁版嵁椤�
+    /// </summary>
+    public class Location3DItemDTO
+    {
+        public int LocationId { get; set; }
+        public string LocationCode { get; set; }
+        public int Row { get; set; }
+        public int Column { get; set; }
+        public int Layer { get; set; }
+        public int LocationStatus { get; set; } // 0=绌�, 1=鍗犵敤, 2=閿佸畾, 3=绂佺敤
+        public int StockStatus { get; set; } // 0=鏃犺揣, 1=鏈夎揣, 2=搴撳瓨绱у紶, 3=宸叉弧
+        public float StockQuantity { get; set; }
+        public float MaxCapacity { get; set; }
+        public string? PalletCode { get; set; }
+        public string? MaterielCode { get; set; }
+        public string? MaterielName { get; set; }
+        public string? BatchNo { get; set; }
+    }
+}
+```
+
+---
+
+### Task 2: 鍚庣 - 鏇存柊 IStockInfoService 鎺ュ彛
+
+**Files:**
+- Modify: `WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoService.cs`
+
+**璇︾粏瑙勮寖锛�**
+
+鍦ㄦ帴鍙d腑娣诲姞鏂规硶绛惧悕锛�
+```csharp
+/// <summary>
+/// 鑾峰彇浠撳簱3D甯冨眬鏁版嵁
+/// </summary>
+/// <param name="warehouseId">浠撳簱ID</param>
+/// <returns>3D甯冨眬DTO</returns>
+Task<Stock3DLayoutDTO> Get3DLayoutAsync(int warehouseId);
+```
+
+**楠屾敹鏍囧噯锛�**
+- 鏂规硶绛惧悕姝g‘
+- 娣诲姞浜嗘枃妗f敞閲�
+- 寮曠敤浜� Stock3DLayoutDTO
+
+---
+
+### Task 3: 鍚庣 - 瀹炵幇 Get3DLayoutAsync
+
+**Files:**
+- Modify: `WIDESEA_WMSServer/WIDESEA_StockService/StockInfoService.cs`
+
+**璇︾粏瑙勮寖锛�**
+
+瀹炵幇 Get3DLayoutAsync 鏂规硶锛�
+1. 鏌ヨ浠撳簱淇℃伅
+2. 鏌ヨ璇ヤ粨搴撴墍鏈夎揣浣�
+3. 鏌ヨ搴撳瓨淇℃伅锛堝寘鍚槑缁嗭級
+4. 鎻愬彇鐗╂枡缂栧彿鍜屾壒娆″彿鍒楄〃
+5. 鏄犲皠鍒� Location3DItemDTO
+6. 璁$畻浠撳簱灏哄
+
+**楠屾敹鏍囧噯锛�**
+- 鏂规硶鑳芥纭繑鍥� Stock3DLayoutDTO
+- 鎵�鏈� locationStatus 鍜� stockStatus 鍊兼纭槧灏�
+- 鎬ц兘閫傚悎涓瀷浠撳簱锛�1000-5000璐т綅锛�
+
+---
+
+### Task 4: 鍚庣 - 娣诲姞 API 绔偣
+
+**Files:**
+- Modify: `WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoController.cs`
+
+**璇︾粏瑙勮寖锛�**
+
+娣诲姞绔偣锛�
+```csharp
+/// <summary>
+/// 鑾峰彇浠撳簱3D甯冨眬
+/// </summary>
+/// <param name="warehouseId">浠撳簱ID</param>
+/// <returns>3D甯冨眬鏁版嵁</returns>
+[HttpGet("Get3DLayout")]
+public async Task<WebResponseContent> Get3DLayout(int warehouseId)
+{
+    var result = await Service.Get3DLayoutAsync(warehouseId);
+    return WebResponseContent.Instance.OK(result);
+}
+```
+
+**楠屾敹鏍囧噯锛�**
+- 璺敱姝g‘锛欸ET /api/StockInfo/Get3DLayout?warehouseId={id}
+- 杩斿洖鏍煎紡绗﹀悎 WebResponseContent 瑙勮寖
+
+---
+
+### Task 5: 鍚庣 - 鍒涘缓 SignalR Hub
+
+**Files:**
+- Create: `WIDESEA_WMSServer/WIDESEA_WMSServer/Hubs/StockHub.cs`
+- Modify: `WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs`
+
+**璇︾粏瑙勮寖锛�**
+
+1. 鍒涘缓 StockHub 绫伙紝缁ф壙 Microsoft.AspNetCore.SignalR.Hub
+2. 娣诲姞 SendStockUpdate 鏂规硶渚涘閮ㄨ皟鐢�
+3. 鍦� Program.cs 涓敞鍐� SignalR 鏈嶅姟骞舵槧灏� Hub
+
+**楠屾敹鏍囧噯锛�**
+- Hub 鍙鍓嶇杩炴帴
+- SendStockUpdate 鏂规硶瀛樺湪涓斿彲琚皟鐢�
+
+---
+
+### Task 6: 鍓嶇 - 瀹夎 Three.js 渚濊禆
+
+**Files:**
+- Modify: `WIDESEA_WMSClient/package.json`
+
+**璇︾粏瑙勮寖锛�**
+
+娣诲姞 three 渚濊禆鍒� package.json锛�
+```json
+"three": "^0.160.0"
+```
+
+**楠屾敹鏍囧噯锛�**
+- package.json 鍖呭惈 three 渚濊禆
+- 鐗堟湰鍙峰悎鐞嗭紙^0.160.0 鎴栨洿鏂扮ǔ瀹氱増锛�
+
+---
+
+### Task 7: 鍓嶇 - 娉ㄥ唽璺敱
+
+**Files:**
+- Modify: `WIDESEA_WMSClient/src/router/viewGird.js`
+
+**璇︾粏瑙勮寖锛�**
+
+鍦� stockView 璺敱鍚庢坊鍔狅細
+```javascript
+{
+  path: '/stockChat',
+  name: 'stockChat',
+  component: () => import('@/views/stock/stockChat.vue')
+}
+```
+
+**楠屾敹鏍囧噯锛�**
+- 璺敱娉ㄥ唽姝g‘
+- 涓庡叾浠栬矾鐢辨牸寮忎竴鑷�
+
+---
+
+### Task 8: 鍓嶇 - 鍒涘缓 stockChat.vue 涓荤粍浠�
+
+**Files:**
+- Create: `WIDESEA_WMSClient/src/views/stock/stockChat.vue`
+
+**璇︾粏瑙勮寖锛�**
+
+缁勪欢蹇呴』鍖呭惈锛�
+1. 浠撳簱 Tabs锛坋l-tabs锛�
+2. 宸ュ叿鏍忥紙绛涢�� + 閲嶇疆瑙嗚鎸夐挳锛�
+3. 3D Canvas 瀹瑰櫒
+4. 鐘舵�佸浘渚�
+5. 璇︽儏寮圭獥锛坋l-dialog fullscreen锛�
+
+Three.js 鍦烘櫙锛�
+1. 鍦烘櫙鍒濆鍖栵紙鑳屾櫙鑹� 0x1a1a2e锛�
+2. 閫忚鐩告満
+3. WebGLRenderer
+4. OrbitControls锛堥樆灏煎惎鐢ㄧ殑杞ㄩ亾鎺у埗鍣級
+5. 鐜鍏� + 瀹氬悜鍏�
+6. 鍦伴潰锛圥laneGeometry锛岀綉鏍硷級
+7. InstancedMesh 鎵归噺娓叉煋璐т綅
+8. Raycaster 鐐瑰嚮鎷惧彇
+9. 鐩告満 lerp 鑱氱劍鍔ㄧ敾
+
+棰滆壊缂栫爜锛堝墠绔疄鐜帮級锛�
+- DISABLED(3): 0x2d2d2d
+- LOCKED(2): 0xF56C6C
+- EMPTY(0/鏃犺揣): 0x4a4a4a
+- HAS_STOCK(1): 0x409EFF
+- LOW_STOCK(2): 0xE6A23C
+- FULL(3): 0x67C23A
+
+**楠屾敹鏍囧噯锛�**
+- 椤甸潰鍙互姝e父鍔犺浇
+- Three.js 鍦烘櫙姝g‘鍒濆鍖�
+- 鐐瑰嚮璐т綅鑳芥樉绀鸿鎯呭脊绐�
+- 棰滆壊缂栫爜姝g‘
+
+---
+
+### Task 9: 鍓嶇 - 鍒涘缓鎵╁睍閰嶇疆鏂囦欢
+
+**Files:**
+- Create: `WIDESEA_WMSClient/src/extension/stock/stockChat.js`
+
+**璇︾粏瑙勮寖锛�**
+
+鍒涘缓鏍囧噯鎵╁睍鏂囦欢鏍煎紡锛�
+```javascript
+let extension = {
+  components: {
+    gridHeader: '',
+    gridBody: '',
+    gridFooter: '',
+    modelHeader: '',
+    modelBody: '',
+    modelFooter: ''
+  },
+  tableAction: '',
+  buttons: { view: [], box: [], detail: [] },
+  methods: {
+    onInit() {},
+    onInited() {}
+  }
+};
+export default extension;
+```
+
+**楠屾敹鏍囧噯锛�**
+- 绗﹀悎椤圭洰鐜版湁鎵╁睍鏂囦欢妯″紡
+
+---
+
+### Task 10: 鍓嶇 - 闆嗘垚 SignalR 瀹炴椂鏇存柊
+
+**Files:**
+- Modify: `WIDESEA_WMSClient/src/views/stock/stockChat.vue`
+
+**璇︾粏瑙勮寖锛�**
+
+1. 鍦� onMounted 涓垵濮嬪寲 SignalR 杩炴帴
+2. 杩炴帴 /stockHub
+3. 鐩戝惉 StockUpdated 浜嬩欢
+4. 鏇存柊瀵瑰簲璐т綅鐨� stockQuantity 鍜� stockStatus
+5. 鍔ㄦ�佹洿鏂拌揣浣嶉鑹�
+6. 鍦� onUnmounted 涓柇寮�杩炴帴
+
+**楠屾敹鏍囧噯锛�**
+- SignalR 杩炴帴姝e父寤虹珛
+- 鏀跺埌鏇存柊鏃惰揣浣嶉鑹茶兘鍔ㄦ�佸彉鍖�

--
Gitblit v1.9.3