From 3f0a6c2564ed7e7facdae0c3b45ffc73f9b17525 Mon Sep 17 00:00:00 2001 From: tongfei <244188119@qq.com> Date: Thu, 21 Mar 2024 15:09:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/WMS.Web.Domain/Services/BackRecordService.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/WMS.Web.Domain/Services/BackRecordService.cs b/src/WMS.Web.Domain/Services/BackRecordService.cs index 42471ca9..2b9a0ed8 100644 --- a/src/WMS.Web.Domain/Services/BackRecordService.cs +++ b/src/WMS.Web.Domain/Services/BackRecordService.cs @@ -73,8 +73,13 @@ namespace WMS.Web.Domain.Services //回退上下架:不能扫同样的箱,按箱入库时候 if (dto.Details != null && dto.Details.Count != 0 && dto.Method== (int)InventoryInOutMethod.Box) { - if (dto.Details.Select(x => x.BoxId).Distinct().Count() != dto.Details.Select(x => x.BoxId).Count()) - return Result.ReFailure(ResultCodes.BoxOutStockTaskBoxError); + var mIds = dto.Details.GroupBy(g => g.MaterialNumber).Select(s => s.Key).ToList(); + foreach (var m in mIds) + { + var d_boxIds = dto.Details.Where(w => w.MaterialNumber == m).Select(s => s.BoxId); + if (d_boxIds.Distinct().Count() != d_boxIds.Count()) + return Result.ReFailure(ResultCodes.BoxOutStockTaskBoxError); + } } IDbContextTransaction _transaction = _basicsRepositories.GetTransaction(); bool isRollback = false;