Exemple #1
0
        public IInstruction GetLastValidInstruction()
        {
            if (Instructions == null || !Instructions.Any())
            {
                return(null);
            }

            return(Instructions.LastOrDefault(i => !i.IsAborted));
        }
Exemple #2
0
 private void CheckInput()
 {
     if (Instructions.Any())
     {
         T first = Instructions.First();
         _firstIdx = Adapter.Index[first];
         long maxIdx = _firstIdx + Instructions.Count;
         for (int i = 0; i < Instructions.Count; i++)
         {
             T instr = Instructions[i];
             Debug.Assert(i == Adapter.Index[instr] - _firstIdx);
             Debug.Assert(Adapter.Preds[instr].All(pred => InRange(Adapter.Index[pred.Task], _firstIdx, maxIdx)));
             Debug.Assert(Adapter.Succs[instr].All(succ => InRange(Adapter.Index[succ.Task], _firstIdx, maxIdx)));
         }
     }
 }
Exemple #3
0
        public void SetInspection(Inspection inspection, User user)
        {
            if (Status == QualityControlStatus.Closed)
            {
                throw new Exception("Current status does not allow to add more instructions.");
            }

            if (Instructions.Any(i => i.Status == InstructionStatus.Pending))
            {
                throw new Exception("All instructions should be performed before final inspection.");
            }

            Status     = QualityControlStatus.Closed;
            Inspection = inspection;
            SetTraceabilityValues(user);
        }