diff --git a/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridService.cs b/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridService.cs index 673b4176..e1dfc0cc 100644 --- a/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridService.cs +++ b/Src/Dlhis.Basic/WorkGrids/Services/Implements/WorkGridService.cs @@ -113,8 +113,14 @@ public class WorkGridService : IWorkGridService var entity = await _dbContext.Queryable().Where(x => x.Id == request.Id).SingleAsync(); entity.ThrowIfNull("网格不存在"); - updateGrids.Add($"{entity.Name}->{request.Name},排版用户数{entity.MaxUserTipCount}->{request.MaxUserTipCount},连续排班天数:{entity.MaxConsecutiveTipCount}->{request.MaxConsecutiveTipCount}"); + if (request.LeaderUserCode != entity.LeaderUserCode) + { + await ChangeAsync(entity.LeaderUserCode, request.LeaderUserCode); + } + + updateGrids.Add($"{entity.Name}->{request.Name},排班用户数{entity.MaxUserTipCount}->{request.MaxUserTipCount},连续排班天数:{entity.MaxConsecutiveTipCount}->{request.MaxConsecutiveTipCount}"); request.Adapt(entity); + entity.LeaderUserCode = request.LeaderUserCode; await _dbContext.UpdateAsync(entity); } @@ -156,7 +162,7 @@ public class WorkGridService : IWorkGridService public async Task ChangeAsync(string from, string to) { var workGrid = await _dbContext.Queryable().Where(x => x.LeaderUserCode == from).SingleAsync(); - workGrid.ThrowIfNull("网格不存在"); + workGrid.ThrowIfNull($"{from}管理的网格不存在"); var beforeGainfo = await _dbContext.Queryable().Where(x => x.Code == from).SingleAsync(); beforeGainfo.ThrowIfNull($"{from}人员不存在");