fix(StockService): 调整ChangePalletAsync的MES解绑顺序为换出前
Per spec: "解绑在换出前" - UnBind应在StockId更新到目标托盘之前调用,
确保MES侧先解除源托盘绑定,再更新WMS库存记录。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| | |
| | | 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 |
| | | { |
| | |
| | | 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("换盘失败"); |
| | | |