This commit is contained in:
2025-03-26 21:08:46 +08:00
parent f89699daf0
commit f6b04b6ee1

View File

@@ -238,7 +238,12 @@ public class WorkGridService : IWorkGridService
.SingleAsync();
myWorkGrid.ThrowIfNull("工作网格尚未配置,请联系管理员");
var existsAssigned = await _dbContext.Queryable<WorkGridUserEntity>()
.Where(x => request.UserCodes.Contains(x.UserCode))
.AnyAsync();
existsAssigned.ThrowIfTrue("存在已经分配人员,操作失败!");
//检查配置的人员
var count = await _dbContext.Queryable<GainfoEntity>()
.Where(x => x.Factory == currentFactory)
@@ -247,11 +252,6 @@ public class WorkGridService : IWorkGridService
(count != request.UserCodes.Count).ThrowIfTrue("存在非当前厂区人员,请检查");
var existsAssigned = await _dbContext.Queryable<WorkGridUserEntity>()
.Where(x => request.UserCodes.Contains(x.UserCode))
.AnyAsync();
existsAssigned.ThrowIfTrue("存在已经分配人员,操作失败!");
var dataToInserts = request.UserCodes.Select(x => new WorkGridUserEntity
{
WorkGridCode = myWorkGrid.Code,