Esempio n. 1
0
 private static bool TryParseBlankMarking(string numericValue, out BlankMarking marking)
 {
     try
     {
         var markingShort = short.Parse(numericValue);
         var values       = (short[])Enum.GetValues(typeof(BlankMarking));
         foreach (var value in values.Where(value => markingShort == value))
         {
             marking = (BlankMarking)value;
             return(true);
         }
     }
     catch
     {
     }
     marking = BlankMarking.DropWithoutMark;
     return(false);
 }
 private static bool TryParseBlankMarking(string numericValue, out BlankMarking marking)
 {
     try
     {
         var markingShort = short.Parse(numericValue);
         var values = (short[])Enum.GetValues(typeof (BlankMarking));
         foreach (var value in values.Where(value => markingShort == value))
         {
             marking = (BlankMarking) value;
             return true;
         }
     }
     catch
     {
     }
     marking = BlankMarking.DropWithoutMark;
     return false;
 }
Esempio n. 3
0
 public void SheetDroped(IScanner scanner, BlankMarking marking, DropResult result)
 {
     Logger.LogInfo(Message.ScannerManagerSheetDroped, marking, result);
     try
     {
         var lastVotingResult = _votingResultManager.LastVotingResult;
         if (marking == BlankMarking.Reverse && result == DropResult.Dropped)
         {
             result = DropResult.ProbablyDropped;
             Logger.LogInfo(Message.ScannerManagerSheetDropedResultAdjusted, result);
         }
         else if (result == DropResult.Timeout)
         {
             switch (marking)
             {
                 case BlankMarking.DropWithoutMark:
                 case BlankMarking.DropAndMarkType1:
                 case BlankMarking.DropAndMarkType2:
                 case BlankMarking.DropLongWithoutMark:
                 case BlankMarking.DropLongAndMarkType1:
                 case BlankMarking.DropLongAndMarkType2:
                 case BlankMarking.DropWithoutMarkNew:
                     result = DropResult.Dropped;
                     break;
                 case BlankMarking.Reverse:
                     result = DropResult.Reversed;
                     break;
             }
             Logger.LogInfo(Message.ScannerManagerSheetDropedResultAdjusted, result);
         }
         CloseSheetProcessingSession(lastVotingResult, result);
     }
     catch (Exception ex)
     {
         Logger.LogError(Message.ScannerManagerSheetDropError, ex);
     }
     finally
     {
         Logger.LogVerbose(Message.Common_DebugReturn);
     }
 }
Esempio n. 4
0
 public DropResult DropSheet(BlankMarking marking)
 {
     Logger.LogVerbose(Message.ScannerManagerDropSheet, (short)marking);
     try
     {
         return _scanner.Drop(marking);
     }
     catch (Exception ex)
     {
         Logger.LogError(Message.ScannerManagerDropSheetFailed, ex, (short)marking);
         throw;
     }
 }
Esempio n. 5
0
 public DropResult Drop(BlankMarking marking)
 {
     _sheetScanning = false;
     var data = new[] { (byte)((byte)marking & 0xFF), (byte)((byte)marking >> 8) };
     var um = SendAndWaitAnswer(Command.umDrop, data, Command.umSheetDroped, TIMEOUT * 5, true);
     if (um == null)
     {
         _eventHandler.SheetDroped(this, marking, DropResult.Timeout);
         return DropResult.Timeout;
     }
     var dropResult = DropResult.Dropped;
     if ((_currentConfiguration.Options & HardwareOptions.EnhancedDrop) > 0)
     {
         var result = (short)(um.Data[0] | um.Data[1] << 8);
         if (result == 1)
         {
             dropResult = DropResult.Reversed;
         }
     }
     _eventHandler.SheetDroped(this, marking, dropResult);
     return dropResult;
 }
Esempio n. 6
0
 public void SetBlankMarking(BlankType blankType, BlankMarking marking)
 {
     var blankConfig = _config.Blanks.Get(blankType, SheetType.Normal);
     if (blankConfig == null)
         return;
     var oldValue = blankConfig.Marking;
     blankConfig.Marking = marking;
     RaiseConfigUpdatedEvent(
         new ConfigUpdatedEventArgs(Name, blankType + "BlankMarking", oldValue, marking));
 }