fix 自动创建出差分组

This commit is contained in:
2024-07-04 18:19:20 +08:00
parent 52fc52a586
commit 870b848203
2 changed files with 24 additions and 1 deletions

View File

@@ -61,6 +61,12 @@ public class DeviceGroupEntity : SugarBaseEntity, ITenantId, ISoftDeleted
[SugarColumn(ColumnDataType = "bit", DefaultValue = "0")]
public bool AsAppointment { get; set; } = false;
/// <summary>
/// 是否为出差分组
/// </summary>
[SugarColumn(ColumnDataType = "bit", DefaultValue = "0")]
public bool IsBusinessTrip { get; set; } = false;
public string TenantId { get; set; }

View File

@@ -117,10 +117,11 @@ public class CreateDefinitelyGroupJob : BaseJob
var factoryName = $"*{type.GetDescription()}厂区系统组({factory.Name})";
if (!await DbContext.Queryable<DeviceGroupEntity>().Where(x => x.PCode == workplaceGrp.Code).AnyAsync(x => x.Name == factoryName))
{
var currentCode = Guid.NewGuid();
await DbContext.InsertAsync(new DeviceGroupEntity
{
PCode = workplaceGrp.Code,
Code = Guid.NewGuid(),
Code = currentCode,
Type = type,
Name = factoryName,
Editable = false,
@@ -129,6 +130,22 @@ public class CreateDefinitelyGroupJob : BaseJob
TenantId = factory.Code,
});
if (type == DeviceTypeEnumType.Door)
{
await DbContext.InsertAsync(new DeviceGroupEntity
{
PCode = currentCode,
Code = currentCode,
Type = type,
Name = "出差组",
Editable = false,
AbleSetNext = false,
Remark = _remark,
IsBusinessTrip = true,
TenantId = factory.Code
});
}
}
}
}