fix 编辑中增加网格长修改

This commit is contained in:
2025-03-26 15:59:26 +08:00
parent fe807d609b
commit f89699daf0

View File

@@ -113,8 +113,14 @@ public class WorkGridService : IWorkGridService
var entity = await _dbContext.Queryable<WorkGridEntity>().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<WorkGridEntity>().Where(x => x.LeaderUserCode == from).SingleAsync();
workGrid.ThrowIfNull("网格不存在");
workGrid.ThrowIfNull($"{from}管理的网格不存在");
var beforeGainfo = await _dbContext.Queryable<GainfoEntity>().Where(x => x.Code == from).SingleAsync();
beforeGainfo.ThrowIfNull($"{from}人员不存在");