From f6488c33d3855647314b7799ae0b2f54227ee62f Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期二, 31 三月 2026 09:34:18 +0800
Subject: [PATCH] docs: 添加 TaskService 重构实施计划
---
Code/WMS/docs/superpowers/plans/2026-03-31-taskService-refactor-plan.md | 338 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 338 insertions(+), 0 deletions(-)
diff --git a/Code/WMS/docs/superpowers/plans/2026-03-31-taskService-refactor-plan.md b/Code/WMS/docs/superpowers/plans/2026-03-31-taskService-refactor-plan.md
new file mode 100644
index 0000000..2167ab2
--- /dev/null
+++ b/Code/WMS/docs/superpowers/plans/2026-03-31-taskService-refactor-plan.md
@@ -0,0 +1,338 @@
+# TaskService.cs 閲嶆瀯瀹炴柦璁″垝
+
+> **For agentic workers:** REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
+
+**Goal:** 灏� 1500+ 琛岀殑 `TaskService.cs` 鎷嗗垎涓� 4 涓� partial class 鏂囦欢锛屼繚鎸佷笟鍔¢�昏緫涓嶅彉锛屾帶鍒跺櫒璋冪敤鏂瑰紡涓嶅彉銆�
+
+**Architecture:** 浣跨敤 C# partial class 鐗规�э紝灏� TaskService 鎸夊姛鑳芥ā鍧楁媶鍒嗕负 WCS銆丄GV銆佸垎瀹规煖涓変釜鐙珛鏂囦欢锛屼富鏂囦欢淇濈暀瀛楁鍜屾瀯閫犲嚱鏁般�傜紪璇戝悗鍚堝苟涓哄崟涓�绫诲瀷锛屽鎺у埗鍣ㄥ畬鍏ㄩ�忔槑銆�
+
+**Tech Stack:** C# / ASP.NET Core 6.0 / partial class
+
+---
+
+## 鏂囦欢缁撴瀯
+
+```
+WIDESEA_TaskInfoService/
+鈹溾攢鈹� TaskService.cs # 绮剧畝鍚� ~100琛岋細瀛楁銆佹瀯閫犲嚱鏁�
+鈹溾攢鈹� TaskService_WCS.cs # ~550琛岋細WCS閫昏緫澶勭悊
+鈹溾攢鈹� TaskService_AGV.cs # ~280琛岋細鏋佸嵎搴揂GV浠诲姟
+鈹斺攢鈹� TaskService_GradingMachine.cs # ~140琛岋細鍒嗗鏌滄帴鍙�
+```
+
+---
+
+## Task 1: 鍒涘缓 TaskService_WCS.cs
+
+**Files:**
+- Create: `WIDESEA_TaskInfoService/TaskService_WCS.cs`
+- Modify: `WIDESEA_TaskInfoService/TaskService.cs`锛堝垹闄ゅ凡杩佺Щ鏂规硶锛�
+
+- [ ] **Step 1: 鍒涘缓 TaskService_WCS.cs partial class 鏂囦欢**
+
+```csharp
+using Mapster;
+using MapsterMapper;
+using Microsoft.Extensions.Configuration;
+using SqlSugar;
+using System.DirectoryServices.Protocols;
+using System.Text.Json;
+using WIDESEA_Common.LocationEnum;
+using WIDESEA_Common.StockEnum;
+using WIDESEA_Common.TaskEnum;
+using WIDESEA_Common.WareHouseEnum;
+using WIDESEA_Core;
+using WIDESEA_Core.BaseRepository;
+using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Core;
+using WIDESEA_Core.Enums;
+using WIDESEA_Core.Helper;
+using WIDESEA_DTO.GradingMachine;
+using WIDESEA_DTO.MES;
+using WIDESEA_DTO.Stock;
+using WIDESEA_DTO.Task;
+using WIDESEA_IBasicService;
+using WIDESEA_IStockService;
+using WIDESEA_ITaskInfoService;
+using WIDESEA_Model.Models;
+
+namespace WIDESEA_TaskInfoService
+{
+ public partial class TaskService
+ {
+ #region WCS閫昏緫澶勭悊
+
+ /// <summary>
+ /// 鍒涘缓浠诲姟锛堢粍鐩樺叆搴撲换鍔°�佺┖鎵樼洏鍥炲簱浠诲姟锛�
+ /// </summary>
+ public async Task<WebResponseContent> CreateTaskInboundAsync(CreateTaskDto taskDto)
+ {
+ // ... 淇濇寔鍘熸湁瀹炵幇涓嶅彉
+ }
+
+ /// <summary>
+ /// 鏍规嵁鎸囧畾鐨勪换鍔¤鎯呭紓姝ュ垱寤烘柊鐨勫嚭搴撲换鍔�
+ /// </summary>
+ public async Task<WebResponseContent> CreateTaskOutboundAsync(CreateTaskDto taskDto)
+ {
+ // ... 淇濇寔鍘熸湁瀹炵幇涓嶅彉
+ }
+
+ // ... 鍏朵粬 WCS 鐩稿叧鏂规硶锛堣鍘熸枃浠� 82-939 琛岋級
+ // GetTasksLocationAsync
+ // InboundFinishTaskAsync
+ // OutboundFinishTaskAsync
+ // RelocationFinishTaskAsync
+ // CreateTaskInboundTrayAsync
+ // InboundFinishTaskTrayAsync
+ // GetOutBoundTrayTaskAsync
+ // OutboundFinishTaskTrayAsync
+ // UpdateTaskByStatusAsync
+ // CreateAutoOutboundTasksAsync
+ // CreateRobotGroupPalletTaskAsync
+ // CreateRobotChangePalletTaskAsync
+ // CreateRobotSplitPalletTaskAsync
+ // CreateRobotPalletTaskAsync
+ // GetTaskByPalletCodeAsync (private, 澶嶅埗鍒版鏂囦欢)
+ // CompleteTaskAsync (private, 澶嶅埗鍒版鏂囦欢)
+ // DetermineTargetAddress (private, 澶嶅埗鍒版鏂囦欢)
+
+ #endregion WCS閫昏緫澶勭悊
+ }
+}
+```
+
+- [ ] **Step 2: 楠岃瘉缂栬瘧**
+
+Run: `dotnet build WIDESEA_WMSServer.sln`
+Expected: 鏃犵紪璇戦敊璇紙WCS 鏂规硶鏆傛椂閲嶅瀹氫箟锛屼笅涓�姝ュ垹闄ゅ師鏂囦欢涓殑瀹炵幇锛�
+
+---
+
+## Task 2: 鍒涘缓 TaskService_AGV.cs
+
+**Files:**
+- Create: `WIDESEA_TaskInfoService/TaskService_AGV.cs`
+
+- [ ] **Step 1: 鍒涘缓 TaskService_AGV.cs partial class 鏂囦欢**
+
+```csharp
+using Mapster;
+using MapsterMapper;
+using Microsoft.Extensions.Configuration;
+using SqlSugar;
+using System.DirectoryServices.Protocols;
+using System.Text.Json;
+using WIDESEA_Common.LocationEnum;
+using WIDESEA_Common.StockEnum;
+using WIDESEA_Common.TaskEnum;
+using WIDESEA_Common.WareHouseEnum;
+using WIDESEA_Core;
+// ... 鍏朵粬 using 涓庡師鏂囦欢涓�鑷�
+
+namespace WIDESEA_TaskInfoService
+{
+ public partial class TaskService
+ {
+ #region 鏋佸嵎搴撲换鍔℃ā鍧�
+
+ /// <summary>
+ /// 鍑哄叆搴撶敵璇�
+ /// </summary>
+ public async Task<AGVResponse> ApplyInOutAsync(ApplyInOutDto applyInOutDto)
+ {
+ // ... 淇濇寔鍘熸湁瀹炵幇涓嶅彉锛堣鍘熸枃浠� 1132-1245 琛岋級
+ }
+
+ /// <summary>
+ /// 鎵嬪姩鍑哄簱瀹屾垚鍙嶉缁橝GV
+ /// </summary>
+ public async Task<WebResponseContent> OutTaskComplete(OutTaskCompleteDto outTaskCompleteDto)
+ {
+ // ... 淇濇寔鍘熸湁瀹炵幇涓嶅彉锛堣鍘熸枃浠� 1252-1306 琛岋級
+ }
+
+ /// <summary>
+ /// 杈撻�佺嚎鐢宠杩涘叆
+ /// </summary>
+ public async Task<AGVResponse> ApplyEnterAsync(ApplyEnterDto applyEnterDto)
+ {
+ // ... 淇濇寔鍘熸湁瀹炵幇涓嶅彉锛堣鍘熸枃浠� 1339-1383 琛岋級
+ }
+
+ /// <summary>
+ /// 鍙栨斁璐у畬鎴�
+ /// </summary>
+ public async Task<AGVResponse> TaskCompleteAsync(TaskCompleteDto taskCompleteDto)
+ {
+ // ... 淇濇寔鍘熸湁瀹炵幇涓嶅彉锛堣鍘熸枃浠� 1390-1463 琛岋級
+ }
+
+ /// <summary>
+ /// 浠诲姟鍙栨秷
+ /// </summary>
+ public async Task<AGVResponse> TaskCancelAsync(TaskCancelDto taskCancelDto)
+ {
+ // ... 淇濇寔鍘熸湁瀹炵幇涓嶅彉锛堣鍘熸枃浠� 1470-1519 琛岋級
+ }
+
+ #endregion 鏋佸嵎搴撲换鍔℃ā鍧�
+ }
+}
+```
+
+- [ ] **Step 2: 楠岃瘉缂栬瘧**
+
+Run: `dotnet build WIDESEA_WMSServer.sln`
+Expected: 鏃犵紪璇戦敊璇�
+
+---
+
+## Task 3: 鍒涘缓 TaskService_GradingMachine.cs
+
+**Files:**
+- Create: `WIDESEA_TaskInfoService/TaskService_GradingMachine.cs`
+
+- [ ] **Step 1: 鍒涘缓 TaskService_GradingMachine.cs partial class 鏂囦欢**
+
+```csharp
+using Mapster;
+using MapsterMapper;
+using Microsoft.Extensions.Configuration;
+using SqlSugar;
+using System.DirectoryServices.Protocols;
+using System.Text.Json;
+using WIDESEA_Common.LocationEnum;
+// ... 鍏朵粬 using 涓庡師鏂囦欢涓�鑷�
+
+namespace WIDESEA_TaskInfoService
+{
+ public partial class TaskService
+ {
+ #region 鍒嗗鏌滄帴鍙�
+
+ /// <summary>
+ /// 鍫嗗灈鏈哄彇鏀捐揣瀹屾垚鍚庣墿娴侀�氱煡鍖栨垚鍒嗗鏌滃畬鎴愪俊鍙�
+ /// </summary>
+ public async Task<WebResponseContent> InOrOutCompletedAsync(GradingMachineInputDto input)
+ {
+ // ... 淇濇寔鍘熸湁瀹炵幇涓嶅彉锛堣鍘熸枃浠� 948-986 琛岋級
+ }
+
+ /// <summary>
+ /// 鍖栨垚鍒嗗鏌滃畾鏃跺悜鐗╂祦鏇存柊鍒嗗鏌滅姸鎬佷俊鎭�
+ /// </summary>
+ public async Task<WebResponseContent> SendLocationStatusAsync(GradingMachineInputDto input)
+ {
+ // ... 淇濇寔鍘熸湁瀹炵幇涓嶅彉锛堣鍘熸枃浠� 993-1023 琛岋級
+ }
+
+ /// <summary>
+ /// 鍒嗗鏌滃伐浣滃畬鎴愬悗璋冪敤姝ゆ帴鍙i�氱煡鐗╂祦鍑哄簱
+ /// </summary>
+ public async Task<WebResponseContent> RequestOutboundAsync(GradingMachineInputDto input)
+ {
+ // ... 淇濇寔鍘熸湁瀹炵幇涓嶅彉锛堣鍘熸枃浠� 1030-1082 琛岋級
+ }
+
+ /// <summary>
+ /// 鍏ュ簱瀹屾垚鍒嗗璋冪敤鑾峰彇鎵樼洏涓婃瘡涓�氶亾鐢佃姱
+ /// </summary>
+ public async Task<WebResponseContent> GetPalletCodeCellAsync(GradingMachineInputDto input)
+ {
+ // ... 淇濇寔鍘熸湁瀹炵幇涓嶅彉锛堣鍘熸枃浠� 1089-1118 琛岋級
+ }
+
+ #endregion 鍒嗗鏌滄帴鍙�
+ }
+}
+```
+
+- [ ] **Step 2: 楠岃瘉缂栬瘧**
+
+Run: `dotnet build WIDESEA_WMSServer.sln`
+Expected: 鏃犵紪璇戦敊璇�
+
+---
+
+## Task 4: 绮剧畝 TaskService.cs
+
+**Files:**
+- Modify: `WIDESEA_TaskInfoService/TaskService.cs`
+
+- [ ] **Step 1: 鍒犻櫎宸茶縼绉诲埌 partial 鏂囦欢鐨勬柟娉曞疄鐜�**
+
+淇濈暀鍐呭锛�
+- 鎵�鏈� using 璇彞
+- namespace 澹版槑
+- partial class 澹版槑
+- 瀛楁瀹氫箟锛坃mapper, _stockInfoService 绛夛級
+- 鏋勯�犲嚱鏁�
+- Repository 灞炴��
+- TaskTypes / TaskOutboundTypes 灞炴��
+- AGV_OutTaskComplete / WCS_ReceiveTask 閰嶇疆瀛楁
+
+鍒犻櫎鍐呭锛�
+- 鎵�鏈� #region WCS閫昏緫澶勭悊 鐨勬柟娉曞疄鐜�
+- 鎵�鏈� #region 鍒嗗鏌滄帴鍙� 鐨勬柟娉曞疄鐜�
+- 鎵�鏈� #region 鏋佸嵎搴撲换鍔℃ā鍧� 鐨勬柟娉曞疄鐜�
+- CompleteTaskAsync銆丟etTaskByPalletCodeAsync銆丏etermineTargetAddress 绉佹湁鏂规硶
+
+鍒犻櫎鍚庢枃浠剁粨鏋勶細
+```csharp
+using Mapster;
+using MapsterMapper;
+// ... 鎵�鏈� using
+
+namespace WIDESEA_TaskInfoService
+{
+ public partial class TaskService : ServiceBase<Dt_Task, IRepository<Dt_Task>>, ITaskService
+ {
+ // 瀛楁 (~10琛�)
+ // 鏋勯�犲嚱鏁� (~15琛�)
+ // Repository 灞炴�� (1琛�)
+ // TaskTypes 灞炴�� (2琛�)
+ // AGV 閰嶇疆瀛楁 (2琛�)
+
+ // 娉ㄦ剰锛氬師鏈夌殑 #region WCS閫昏緫澶勭悊銆佸垎瀹规煖鎺ュ彛銆佹瀬鍗峰簱浠诲姟妯″潡 region 鍧楀叏閮ㄥ垹闄�
+ // 瀵瑰簲鐨勬柟娉曞疄鐜板凡杩佺Щ鍒� partial class 鏂囦欢
+ }
+}
+```
+
+- [ ] **Step 2: 楠岃瘉缂栬瘧**
+
+Run: `dotnet build WIDESEA_WMSServer.sln`
+Expected: 鏃犵紪璇戦敊璇紝鎵�鏈夋帶鍒跺櫒绔偣姝e父
+
+---
+
+## Task 5: 鏈�缁堥獙璇�
+
+- [ ] **Step 1: 瀹屾暣缂栬瘧**
+
+Run: `dotnet build WIDESEA_WMSServer.sln`
+Expected: SUCCESS锛屾棤璀﹀憡
+
+- [ ] **Step 2: 妫�鏌ユ枃浠惰鏁�**
+
+Run: `wc -l WIDESEA_TaskInfoService/TaskService*.cs`
+Expected:
+- TaskService.cs: ~100琛�
+- TaskService_WCS.cs: ~550琛�
+- TaskService_AGV.cs: ~280琛�
+- TaskService_GradingMachine.cs: ~140琛�
+
+- [ ] **Step 3: 鎻愪氦浠g爜**
+
+```bash
+git add WIDESEA_TaskInfoService/TaskService*.cs
+git commit -m "refactor(TaskService): 鎷嗗垎涓簆artial class妯″潡鍖�
+
+- TaskService_WCS.cs: WCS閫昏緫澶勭悊锛堝叆搴�/鍑哄簱/绉诲簱/鏈烘鎵�/鑷姩鍑哄簱锛�
+- TaskService_AGV.cs: 鏋佸嵎搴揂GV浠诲姟妯″潡
+- TaskService_GradingMachine.cs: 鍒嗗鏌滄帴鍙�
+- TaskService.cs: 淇濈暀瀛楁/鏋勯�犲嚱鏁�/鎺ュ彛澹版槑
+
+Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>"
+```
--
Gitblit v1.9.3