TracingDB synchronized with Production-Monitoring project.
This commit is contained in:
+59
-7
@@ -179,7 +179,7 @@ namespace TracingDB
|
||||
{
|
||||
/// Read all already existing reference records with Code==pcbNumber, referenceRecords[0] will be the most recent one
|
||||
var referenceRecords = session.QueryOver<ReferenceRecord>()
|
||||
.Where(rr => (rr.Code == pcbNumber))
|
||||
.Where(rr => (rr.Code == pcbNumber && rr.Result == 0))
|
||||
.OrderBy(rr => rr.TimeStamp).Desc
|
||||
.List();
|
||||
|
||||
@@ -194,6 +194,60 @@ namespace TracingDB
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Updates processes, processDictionary and workstepsDictionary
|
||||
/// </summary>
|
||||
/// <param name="session">DB session</param>
|
||||
public static IList<Process> ReadWorkflowsFromDB(ISession session,
|
||||
string thisWorkstepName,
|
||||
out Dictionary<int, Process> workflowDict,
|
||||
out Dictionary<int, IList<Workstep>> workflowStepsDict,
|
||||
out Dictionary<int, TracingDB.ScanVerificationInfo> verifInfos,
|
||||
bool readDeactivatedWorkflows = false)
|
||||
{
|
||||
IList<Process> workflows;
|
||||
if (readDeactivatedWorkflows)
|
||||
{
|
||||
workflows = session.QueryOver<Process>().Where(pr => ((pr.ReleaseStatus == ReleaseStatus.Released) ||
|
||||
(pr.ReleaseStatus == ReleaseStatus.ReleasedActive) ||
|
||||
(pr.ReleaseStatus == ReleaseStatus.ToBeApproved) ||
|
||||
(pr.ReleaseStatus == ReleaseStatus.Deactivated)
|
||||
)).List();
|
||||
}
|
||||
else
|
||||
{
|
||||
workflows = session.QueryOver<Process>().Where(pr => ((pr.ReleaseStatus == ReleaseStatus.Released) ||
|
||||
(pr.ReleaseStatus == ReleaseStatus.ReleasedActive) ||
|
||||
(pr.ReleaseStatus == ReleaseStatus.ToBeApproved)
|
||||
)).List();
|
||||
}
|
||||
|
||||
workflowDict = new Dictionary<int, Process>();
|
||||
workflowStepsDict = new Dictionary<int, IList<Workstep>>();
|
||||
verifInfos = new Dictionary<int, TracingDB.ScanVerificationInfo>();
|
||||
|
||||
foreach (var wf in workflows)
|
||||
{
|
||||
IList<Workstep> steps = session.QueryOver<Workstep>()
|
||||
.Where(ws => ((ws.Process == wf) && (ws.Name == thisWorkstepName)))
|
||||
.List();
|
||||
workflowDict.Add(wf.Id, wf);
|
||||
workflowStepsDict.Add(wf.Id, steps);
|
||||
|
||||
Workstep step;
|
||||
bool verifyRefPart;
|
||||
Part verifiedPart;
|
||||
if (steps.Count == 1 && TracingDB.DB.AnalyzeProcess(session, wf, steps[0], out step, out verifyRefPart, out verifiedPart))
|
||||
{
|
||||
verifInfos.Add(wf.Id, new ScanVerificationInfo(step, verifyRefPart, verifiedPart));
|
||||
log.WarnFormat("Workflow {0} :: Verified step={1} part={2} verify ref. part={3}", wf, step, verifiedPart, verifyRefPart);
|
||||
}
|
||||
}
|
||||
|
||||
return workflows;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Finds a workstep and a part to be verified (typically a previous workstep and one of its parts).
|
||||
/// Updates this.verifiedWorkstep, this.verifiedPart and this.verifyReferencePart.
|
||||
@@ -342,15 +396,13 @@ namespace TracingDB
|
||||
/// <summary>
|
||||
/// Obsolete, use WorkplaceRegistration class instead
|
||||
/// </summary>
|
||||
public static bool UnregisterWorkplace(ISession session, string workplace)
|
||||
public static bool UnregisterWorkplaceObsolete(ISession session, string workplace)
|
||||
{
|
||||
try
|
||||
{
|
||||
IList<WorkplaceRegistration> wpRegs = session
|
||||
.QueryOver<WorkplaceRegistration>()
|
||||
.Where(x => (x.Workplace == workplace))
|
||||
.List();
|
||||
|
||||
IList<WorkplaceRegistration> wpRegs = session.QueryOver<WorkplaceRegistration>()
|
||||
.Where(x => (x.Workplace == workplace))
|
||||
.List();
|
||||
if (wpRegs.Count == 1)
|
||||
{
|
||||
WorkplaceRegistration wpReg = wpRegs[0];
|
||||
|
||||
Reference in New Issue
Block a user