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: 在 StockService 的组盘、换盘、拆盘操作中正确调用 MES 电芯绑定/解绑接口,并将 MES 调用纳入 WMS 事务内。
Architecture: 修改 StockService 三个方法,将 _mesService.BindContainer() / _mesService.UnBindContainer() 正确地用 await 调用并检查返回结果,MES 失败则事务回滚。
Tech Stack: ASP.NET Core 6.0, SqlSugar, IMesService
| 任务 | 方法 | 操作 |
|---|---|---|
| Task 1 | GroupPalletAsync |
修复 _mesService.BindContainer() 缺少 await 和结果检查 |
| Task 2 | ChangePalletAsync |
添加解绑源托盘 + 绑定目标托盘 |
| Task 3 | SplitPalletAsync |
添加解绑电芯 |
Files:
- Modify: WIDESEA_StockService/StockSerivce.cs:132-176
读取 StockSerivce.cs 第 132-176 行,确认 bindRequest 对象的构建和 _mesService.BindContainer() 调用的位置。
将第 166 行:csharp _mesService.BindContainer()
修改为:csharp var mesResult = await _mesService.BindContainer(bindRequest); if (mesResult == null || !mesResult.Success) { return content.Error($"组盘成功,但MES绑定失败: {mesResult?.Message ?? "未知错误"}"); }
cd WIDESEA_WMSServer && dotnet build WIDESEA_StockService/WIDESEA_StockService.csproj
确认无编译错误。
git add WIDESEA_StockService/StockSerivce.cs
git commit -m "fix(StockService): GroupPalletAsync正确await MES BindContainer调用并检查结果"
Files:
- Modify: WIDESEA_StockService/StockSerivce.cs:181-240
读取 StockSerivce.cs 第 181-240 行,确认:
- detailEntities 变量定义位置(包含要换盘的电芯明细)
- targetStock.Id 赋值位置
- return content.OK("换盘成功") 之前的逻辑
在第 231 行 var result = await StockInfoDetailService.Repository.UpdateDataAsync(detailEntities); 之前添加:
// 调用MES解绑源托盘电芯
var unbindRequest = new UnBindContainerRequest
{
EquipmentCode = "STK-GROUP-001",
ResourceCode = "STK-GROUP-001",
LocalTime = DateTime.Now,
ContainCode = stock.SourcePalletNo,
SfcList = detailEntities.Select(d => d.SerialNumber).ToList()
};
var unbindResult = await _mesService.UnBindContainer(unbindRequest);
if (unbindResult == null || !unbindResult.Success)
{
return content.Error($"换盘成功,但MES解绑失败: {unbindResult?.Message ?? "未知错误"}");
}
在第 231 行之后、return content.OK("换盘成功"); 之前添加:
// 调用MES绑定目标托盘电芯
var bindRequest = new BindContainerRequest
{
ContainerCode = stock.TargetPalletNo,
EquipmentCode = "STK-GROUP-001",
ResourceCode = "STK-GROUP-001",
LocalTime = DateTime.Now,
OperationType = 0,
ContainerSfcList = detailEntities.Select(d => new ContainerSfcItem
{
Sfc = d.SerialNumber,
Location = d.InboundOrderRowNo.ToString()
}).ToList()
};
var bindResult = await _mesService.BindContainer(bindRequest);
if (bindResult == null || !bindResult.Success)
{
return content.Error($"换盘成功,但MES绑定失败: {bindResult?.Message ?? "未知错误"}");
}
cd WIDESEA_WMSServer && dotnet build WIDESEA_StockService/WIDESEA_StockService.csproj
确认无编译错误。
git add WIDESEA_StockService/StockSerivce.cs
git commit -m "feat(StockService): ChangePalletAsync添加MES解绑和绑定调用"
Files:
- Modify: WIDESEA_StockService/StockSerivce.cs:245-286
读取 StockSerivce.cs 第 245-286 行,确认:
- detailEntities 变量定义和包含的电芯列表
- return content.OK("拆盘成功"); 之前的逻辑
在第 277 行 var result = await StockInfoDetailService.Repository.DeleteDataAsync(detailEntities); 之前添加:
// 调用MES解绑电芯
var unbindRequest = new UnBindContainerRequest
{
EquipmentCode = "STK-GROUP-001",
ResourceCode = "STK-GROUP-001",
LocalTime = DateTime.Now,
ContainCode = stock.SourcePalletNo,
SfcList = detailEntities.Select(d => d.SerialNumber).ToList()
};
var unbindResult = await _mesService.UnBindContainer(unbindRequest);
if (unbindResult == null || !unbindResult.Success)
{
return content.Error($"拆盘成功,但MES解绑失败: {unbindResult?.Message ?? "未知错误"}");
}
cd WIDESEA_WMSServer && dotnet build WIDESEA_StockService/WIDESEA_StockService.csproj
确认无编译错误。
git add WIDESEA_StockService/StockSerivce.cs
git commit -m "feat(StockService): SplitPalletAsync添加MES解绑调用"
cd WIDESEA_WMSServer && dotnet build WIDESEA_WMSServer.sln
确认无编译错误、无警告。
如果之前没有合并提交,在此执行最终提交。
GroupPalletAsync 中 await _mesService.BindContainer() 正确 awaitChangePalletAsync 中先 UnBind 再 Bind,顺序正确SplitPalletAsync 中 UnBind 在 Delete 之前Success 属性"{操作}成功,但MES{操作}失败: {错误信息}"