This commit is contained in:
qianhao.xu 2024-08-26 17:34:50 +08:00
parent e68c340962
commit 8136e95a5d
2 changed files with 32 additions and 1 deletions

View File

@ -54,6 +54,36 @@ namespace DOAN.Service.huate_group.Recipe
/// <returns></returns>
public Recipee AddRecipe(Recipee model)
{
// 根据设备id 填充 company workshop line
BaseDeviceAccount account = Context.Queryable<BaseDeviceAccount>().Where(x => x.Id == model.FkDeviceId).First();
model.DeviceName = account.DeviceName;
if (account != null)
{
BaseProductionLine line = Context.Queryable<BaseProductionLine>()
.Where(it => it.Id == account.FkLineId).First();
if (line != null)
{
model.FkLineId = line.Id;
model.ProductlineName = line.LineName;
BaseWorkshop baseWorkshop = Context.Queryable<BaseWorkshop>().Where(it => it.Id == line.FkWorkshopId).First();
if (baseWorkshop != null)
{
model.FkWorkshopId = baseWorkshop.Id;
model.WorkshopName = baseWorkshop.WorkshopName;
BaseCompany company = Context.Queryable<BaseCompany>().Where(it => it.Id == baseWorkshop.FkCompanyId).First();
if (company != null)
{
model.FkCompanyId = company.Id;
model.CompanyName = company.CompanyName;
}
}
}
}
return Insertable(model).ExecuteReturnEntity();
}

View File

@ -13,11 +13,12 @@ namespace Infrastructure
var types = source?.GetType();
if (types == null || context == null) return source;
BindingFlags flag = BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.Instance;
types.GetProperty("CreateTime", flag)?.SetValue(source, DateTime.Now, null);
types.GetProperty("CREATED_TIME", flag)?.SetValue(source, DateTime.Now, null);
types.GetProperty("CreatedTime", flag)?.SetValue(source, DateTime.Now, null);
types.GetProperty("AddTime", flag)?.SetValue(source, DateTime.Now, null);
types.GetProperty("CreateBy", flag)?.SetValue(source, context.GetName(), null);
types.GetProperty("CreatedBy", flag)?.SetValue(source, context.GetName(), null);
types.GetProperty("CREATED_BY", flag)?.SetValue(source, context.GetName(), null);
types.GetProperty("Create_by", flag)?.SetValue(source, context.GetName(), null);
//types.GetProperty("UserId", flag)?.SetValue(source, context.GetUId(), null);