public override SortedItem CreateSortedItem(string[] inputs, int weight) { // SortedItem sortedItem = Self.NewSortedItem(); sortedItem.ThrowException(new NoAssignmentException()); sortedItem.ApplyOutboundLabel(); return(sortedItem); }
public virtual SortedItem CreateSortedItem(string[] inputs, int weight) { // SortedItem sortedItem = Self.NewSortedItem(); try { ArgixTrace.WriteLine(new TraceMessage("Determine assignment...", AppLib.EVENTLOGNAME, LogLevel.Debug, "Brain ")); DetermineAssignment(inputs, sortedItem); ArgixTrace.WriteLine(new TraceMessage("Get inbound label with data...", AppLib.EVENTLOGNAME, LogLevel.Debug, "Brain ")); InboundLabel label = getInboundLabelWithData(sortedItem, inputs); sortedItem.CartonNumber = label.GetElementValue("CARTON"); if (!label.IsDuplicateElementAllowed("CARTON")) { Self.DuplicateCartonValidation(sortedItem); } ArgixTrace.WriteLine(new TraceMessage("Determine destination and rounting...", AppLib.EVENTLOGNAME, LogLevel.Debug, "Brain ")); DetermineDestinationAndRounting(sortedItem, label); if (weight == 0) { sortedItem.ThrowException(new ZeroWeightException()); } if (weight > SortedItem.WeightMax) { sortedItem.ThrowException(new OverWeightException(weight)); } sortedItem.Weight = weight; sortedItem.ApplyOutboundLabel(); } catch (Exception ex) { if (!sortedItem.IsError()) { sortedItem.SortException = new HaveNoIdeaWhatItIsException(ex); } sortedItem.ApplyOutboundLabel(); //Apply error label } return(sortedItem); }