Added alarm notes
WIP Fanuc tool table WIP Siemens Active program fix
This commit is contained in:
@@ -41,7 +41,6 @@ namespace Step.Database.Controllers
|
||||
return lastMaintenances;
|
||||
}
|
||||
|
||||
|
||||
public PerformedMaintenanceModel PerformeMaintenance(uint counterValue, int maintenanceId, int userId)
|
||||
{
|
||||
PerformedMaintenanceModel performed = new PerformedMaintenanceModel()
|
||||
@@ -52,8 +51,8 @@ namespace Step.Database.Controllers
|
||||
MaintainerId = userId
|
||||
};
|
||||
|
||||
dbCtx.PerformedMaintenances.Add(performed);
|
||||
|
||||
dbCtx.PerformedMaintenances.Add(performed);
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
|
||||
@@ -113,14 +112,14 @@ namespace Step.Database.Controllers
|
||||
{
|
||||
MaintenanceModel dbMaint = FindById(maintenanceId);
|
||||
|
||||
if(dbMaint != null)
|
||||
if (dbMaint != null)
|
||||
{
|
||||
dbMaint.Title = newMaint.Title;
|
||||
dbMaint.Description = newMaint.Description;
|
||||
dbMaint.Deadline = newMaint.Deadline;
|
||||
dbMaint.Interval = newMaint.Interval;
|
||||
dbMaint.UnitOfMeasure = newMaint.UnitOfMeasure;
|
||||
|
||||
|
||||
// Commit changes
|
||||
dbCtx.SaveChanges();
|
||||
}
|
||||
@@ -147,7 +146,7 @@ namespace Step.Database.Controllers
|
||||
.ToList();
|
||||
|
||||
// Find database rows that has to be deleted
|
||||
List<MaintenanceModel> toDeleteMaint = dbMaintenances.Where(x => x.UserId == null &&
|
||||
List<MaintenanceModel> toDeleteMaint = dbMaintenances.Where(x => x.UserId == null &&
|
||||
!MaintenancesConfig.Select(y => y.Id).Contains(x.MaintenanceId)
|
||||
).ToList();
|
||||
|
||||
@@ -175,7 +174,7 @@ namespace Step.Database.Controllers
|
||||
old.MaintenanceId = x.Id;
|
||||
old.Deadline = x.Deadline;
|
||||
old.Interval = x.Intervall.TotalMinutes;
|
||||
old.Type = (MAINTENANCE_TYPE) Enum.Parse(typeof(MAINTENANCE_TYPE), x.Type);
|
||||
old.Type = (MAINTENANCE_TYPE)Enum.Parse(typeof(MAINTENANCE_TYPE), x.Type);
|
||||
old.CounterId = x.CouterId;
|
||||
old.UnitOfMeasure = (MAINTENANCE_UNIT_OF_MEASURE)Enum.Parse(typeof(MAINTENANCE_UNIT_OF_MEASURE), x.UnitOfMeasure);
|
||||
return old;
|
||||
@@ -195,7 +194,7 @@ namespace Step.Database.Controllers
|
||||
Type = (MAINTENANCE_TYPE)Enum.Parse(typeof(MAINTENANCE_TYPE), x.Type),
|
||||
CounterId = x.CouterId,
|
||||
CreationDate = DateTime.Now,
|
||||
UnitOfMeasure = (MAINTENANCE_UNIT_OF_MEASURE) Enum.Parse(typeof(MAINTENANCE_UNIT_OF_MEASURE),x.UnitOfMeasure),
|
||||
UnitOfMeasure = (MAINTENANCE_UNIT_OF_MEASURE)Enum.Parse(typeof(MAINTENANCE_UNIT_OF_MEASURE), x.UnitOfMeasure),
|
||||
UserId = null,
|
||||
LastExpirationDate = null
|
||||
})
|
||||
@@ -237,7 +236,7 @@ namespace Step.Database.Controllers
|
||||
.MaintenancesNotes
|
||||
.ToList();
|
||||
}
|
||||
|
||||
|
||||
public List<DTOMaintenanceNoteModel> GetNotesByMaintId(int maintenanceId)
|
||||
{
|
||||
return dbCtx
|
||||
@@ -255,7 +254,7 @@ namespace Step.Database.Controllers
|
||||
LastName = x.User.LastName,
|
||||
Username = x.User.Username
|
||||
}
|
||||
})
|
||||
})
|
||||
.ToList();
|
||||
}
|
||||
|
||||
@@ -288,7 +287,7 @@ namespace Step.Database.Controllers
|
||||
return (DTOMaintenanceNoteModel)note;
|
||||
}
|
||||
|
||||
public void DeleteMessage(int noteId)
|
||||
public void DeleteNote(int noteId)
|
||||
{
|
||||
MaintenanceNoteModel note = FindNoteById(noteId);
|
||||
dbCtx.MaintenancesNotes.Remove(note);
|
||||
@@ -296,6 +295,10 @@ namespace Step.Database.Controllers
|
||||
dbCtx.SaveChanges();
|
||||
}
|
||||
|
||||
#endregion Notes
|
||||
|
||||
#region Attachment
|
||||
|
||||
public List<MaintenanceFileModel> FindAttachmentByMaintenance(int maintenanceId)
|
||||
{
|
||||
return dbCtx
|
||||
@@ -312,7 +315,7 @@ namespace Step.Database.Controllers
|
||||
.FirstOrDefault();
|
||||
}
|
||||
|
||||
public MaintenanceFileModel AddAttachment(string fileName, string localFileName ,int maintenanceId, int userId)
|
||||
public MaintenanceFileModel AddAttachment(string fileName, string localFileName, int maintenanceId, int userId)
|
||||
{
|
||||
MaintenanceFileModel file = new MaintenanceFileModel()
|
||||
{
|
||||
@@ -345,10 +348,11 @@ namespace Step.Database.Controllers
|
||||
dbCtx.MaintenanceFiles.Remove(attachment);
|
||||
|
||||
dbCtx.SaveChanges();
|
||||
|
||||
|
||||
if (File.Exists(MAINTENANCE_ATTACHMENT_PATH + attachment.LocalFileName))
|
||||
File.Delete(MAINTENANCE_ATTACHMENT_PATH + attachment.LocalFileName);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#endregion Attachment
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user