wanshenmean
2026-03-30 63d0a623484d720923201d647bac6ea99f88bb62
fix(StockService): 调整ChangePalletAsync的MES解绑顺序为换出前

Per spec: "解绑在换出前" - UnBind应在StockId更新到目标托盘之前调用,
确保MES侧先解除源托盘绑定,再更新WMS库存记录。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
已修改1个文件
3 ■■■■ 文件已修改
Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockSerivce.cs
@@ -232,8 +232,6 @@
                    if (await StockInfo_HtyService.Repository.AddDataAsync(CreateStockHistory(new[] { sourceStock, targetStock }, "换盘")) <= 0)
                        return content.Error("换盘历史记录保存失败");
                    detailEntities.ForEach(d => d.StockId = targetStock.Id);
                    // 调用MES解绑源托盘电芯
                    var unbindRequest = new UnBindContainerRequest
                    {
@@ -249,6 +247,7 @@
                        return content.Error($"换盘成功,但MES解绑失败: {unbindResult?.Data?.Msg ?? unbindResult?.ErrorMessage ?? "未知错误"}");
                    }
                    detailEntities.ForEach(d => d.StockId = targetStock.Id);
                    var result = await StockInfoDetailService.Repository.UpdateDataAsync(detailEntities);
                    if (!result) return content.Error("换盘失败");