修改稽查
parent
01d86b9c2b
commit
245dd584c4
|
@ -16,6 +16,13 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace IRaCIS.Core.Infra.EFCore.Common
|
||||
{
|
||||
public static class AuditOpt
|
||||
{
|
||||
public static readonly string Add = "Add";
|
||||
public static readonly string Update = "Update";
|
||||
public static readonly string Deleted = "Deleted";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加稽查稽查数据
|
||||
/// </summary>
|
||||
|
@ -52,16 +59,16 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
// 修改
|
||||
await InsertAddEntitys(
|
||||
entitys.Where(x => x.State == EntityState.Modified &&
|
||||
(!typeof(ISoftDelete).IsAssignableFrom(x.Entity.GetType()) || !(bool)x.Entity.GetType().GetProperty("IsDeleted").GetValue(x.Entity) || NodeleteTableTypes.Contains(x.Entity.GetType()))
|
||||
).ToList(), "Update");
|
||||
(!typeof(ISoftDelete).IsAssignableFrom(x.Entity.GetType()) || !(bool)x.Entity.GetType().GetProperty(nameof(ISoftDelete.IsDeleted)).GetValue(x.Entity) || NodeleteTableTypes.Contains(x.Entity.GetType()))
|
||||
).ToList(), AuditOpt.Update);
|
||||
|
||||
// 新增
|
||||
await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Added).ToList(), "Add");
|
||||
await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Added).ToList(), AuditOpt.Add);
|
||||
|
||||
// 删除
|
||||
await InsertAddEntitys(entitys.Where(x => x.State == EntityState.Deleted
|
||||
|| (typeof(ISoftDelete).IsAssignableFrom(x.Entity.GetType()) && (bool)x.Entity.GetType().GetProperty("IsDeleted").GetValue(x.Entity) && x.State == EntityState.Modified && !NodeleteTableTypes.Contains(x.Entity.GetType()))
|
||||
).ToList(), "Deleted");
|
||||
|| (typeof(ISoftDelete).IsAssignableFrom(x.Entity.GetType()) && (bool)x.Entity.GetType().GetProperty(nameof(ISoftDelete.IsDeleted)).GetValue(x.Entity) && x.State == EntityState.Modified && !NodeleteTableTypes.Contains(x.Entity.GetType()))
|
||||
).ToList(), AuditOpt.Deleted);
|
||||
|
||||
|
||||
}
|
||||
|
@ -875,7 +882,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
}
|
||||
|
||||
|
||||
inspection.Identification = await GetInspectionRecordIdentificationAsync(entityObj,type);
|
||||
inspection.Identification = await GetInspectionRecordIdentificationAsync(entityObj, type);
|
||||
|
||||
//将实体对象属性 映射到稽查实体
|
||||
MapEntityPropertyToAuditEntity(entityObj, inspection);
|
||||
|
@ -906,16 +913,19 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
inspection.IsSign = true;
|
||||
}
|
||||
|
||||
var inspectionData = new InspectionJsonDetail()
|
||||
|
||||
inspection.JsonDetail = new InspectionJsonDetail
|
||||
{
|
||||
//稽查实体,加上扩充的信息
|
||||
//稽查实体,加上扩充的信息
|
||||
Data = AddJsonItem(entityObj, otherItem),
|
||||
|
||||
//通用信息
|
||||
Inspection = generalData
|
||||
};
|
||||
inspection.JsonDetail = inspectionData.ToJsonStr();
|
||||
//通用信息 每条稽查必须记录的
|
||||
CommonData = generalData
|
||||
|
||||
}.ToJsonStr();
|
||||
|
||||
inspection.BatchId = _userInfo.BatchId.Value;
|
||||
|
||||
await _dbContext.DataInspection.AddAsync(inspection);
|
||||
|
||||
|
||||
|
@ -1250,7 +1260,7 @@ namespace IRaCIS.Core.Infra.EFCore.Common
|
|||
Data = AddJsonItem(data, otherItem),
|
||||
|
||||
//通用信息
|
||||
Inspection = generalData
|
||||
CommonData = generalData
|
||||
};
|
||||
add.JsonDetail = inspectionData.ToJsonStr();
|
||||
add.BatchId = _userInfo.BatchId.Value;
|
||||
|
|
|
@ -88,9 +88,9 @@ namespace IRaCIS.Core.Infra.EFCore.Common.Dto
|
|||
/// </summary>
|
||||
public class InspectionJsonDetail
|
||||
{
|
||||
public dynamic Data { get; set; }
|
||||
public object Data { get; set; }
|
||||
|
||||
public InspectionGeneralData Inspection { get; set; }
|
||||
public InspectionGeneralData CommonData { get; set; }
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue