Exemple #1
0
        internal override void DetermineDestinationAndRounting(SortedItem sortedItem, InboundLabel label)
        {
            //
            string sanNumber = label.GetElementValue("SAN").Substring(0, 6);

            sanNumber           += Helper.CheckDigitMod11(sanNumber);
            sortedItem.SANNUmber = sanNumber;
            //sortedItem.CartonNumber = label.GetElementValue("CARTON");
            sortedItem.PONumber = label.GetElementValue("PO");
            string shipOverride = (ShipOverride.Length > 0 ? ShipOverride : label.GetElementValue("OSOVERRIDE"));

            try {
                sortedItem.SpecialAgent = SortFactory.CreateSpecialAgent(sortedItem.Client.Number, sortedItem.Client.Division, shipOverride);
                ArgixTrace.WriteLine(new TraceMessage("Special Agent: " + sortedItem.SpecialAgent.Type, AppLib.EVENTLOGNAME, LogLevel.Debug, "Brain    "));
                sortedItem.DestinationRouting = SortFactory.CreateSANDestinationRouting(sortedItem.Client.Number, sortedItem.Client.Division, sortedItem.Freight.Shipper.NUMBER, Self.Station.TerminalID.ToString().PadLeft(2, '0'), sanNumber, sortedItem.SpecialAgent.ZONE_CODE.Trim(), sortedItem.CartonNumber, !label.IsDuplicateElementAllowed("CARTON"));
                if (sortedItem.SpecialAgent.IsDefault)
                {
                    sortedItem.SpecialAgent = SortFactory.CreateSpecialAgentByZone(sortedItem.Client.Number, sortedItem.Client.Division, sortedItem.DestinationRouting.ZoneCode.Trim());
                }
                ArgixTrace.WriteLine(new TraceMessage("Special Agent: " + sortedItem.SpecialAgent.Type, AppLib.EVENTLOGNAME, LogLevel.Debug, "Brain    "));
                if (!UPSAllowed && sortedItem.SpecialAgent.Type == "UPSSpecialAgent")
                {
                    sortedItem.SpecialAgent = null;
                    throw new ApplicationException("UPS processing disabled.");
                }
                sortedItem.TrackingNumber = sortedItem.SpecialAgent.MakeTrackingNumber(sortedItem.DestinationRouting.OSSequence);
                sortedItem.LabelTemplate  = SortFactory.CreateOBLabelTemplate(sortedItem.DestinationRouting.OutboundLabelType, Self.Station.PrinterType);
            }
            catch (Exception ex) { sortedItem.ThrowException(new DestinationRoutingException(ex)); }
        }
Exemple #2
0
        public SortedItem ProcessInputs(string[] inputs, decimal weight)
        {
            //Process the first input scan
            SortedItem sortedItem = null;

            try {
                //Create a sorted item and re-initialize the inbound label template
                if (this.mSetup.ScaleType == dlgStationSetup.SCALETYPE_CONSTANT)
                {
                    weight = this.mSetup.ConstantWeight;
                }
                int w = decimal.ToInt32(decimal.Round(weight + 0.5m, 0));
                ArgixTrace.WriteLine(new TraceMessage("Weight rounded from " + weight.ToString() + " to " + w.ToString() + "...", AppLib.EVENTLOGNAME, LogLevel.Debug, "SortOperator"));
                sortedItem = this.mBrain.CreateSortedItem(inputs, w);
                if (this.SortedItemCreated != null)
                {
                    this.SortedItemCreated(this, new SortedItemEventArgs(sortedItem));
                }

                //Determine elapsed & down times for this sorted item
                int duration = this.mStation.SortStatistics.CalcDuration();
                sortedItem.ElapsedSeconds = (duration < Statistics.DOWN_TIME_MAX ? duration : Statistics.DOWN_TIME_MAX);
                sortedItem.DownSeconds    = (duration < Statistics.DOWN_TIME_MAX ? 0 : duration - Statistics.DOWN_TIME_MAX);
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while processing carton inputs.", ex); }
            return(sortedItem);
        }
Exemple #3
0
 internal bool IsDuplicateCarton(SortedItem sortedItem)
 {
     //Check if the specified sortedItem is a duplicate of this sorted item
     return(!this.IsError() && !sortedItem.IsError() &&
            this.CartonNumber == sortedItem.CartonNumber &&
            this.Client.Number == sortedItem.Client.Number &&
            this.Freight.Shipper.NUMBER == sortedItem.Freight.Shipper.NUMBER);
 }
Exemple #4
0
        internal SortedItem NewSortedItem()
        {
            //Get a new sorted item from the collection
            SortedItem sortedItem = new SortedItem(this.mStation);

            this.mSortedItems.Add(sortedItem);
            return(sortedItem);
        }
Exemple #5
0
 internal void DuplicateCartonValidation(SortedItem sortedItem)
 {
     //Determine if this is a duplicate carton
     if (this.mSortedItems.IsDuplicateCarton(sortedItem))
     {
         sortedItem.ThrowException(new DuplicateCartonException());
     }
 }
Exemple #6
0
        public override SortedItem CreateSortedItem(string[] inputs, int weight)
        {
            //
            SortedItem sortedItem = Self.NewSortedItem();

            sortedItem.ThrowException(new NoAssignmentException());
            sortedItem.ApplyOutboundLabel();
            return(sortedItem);
        }
Exemple #7
0
        public bool StoreSortedItem(string labelSeqNumber)
        {
            //Save the sorted item and remove from the collection
            SortedItem sortedItem = this.mSortedItems.Item(labelSeqNumber);

            if (sortedItem == null)
            {
                throw new SavingException("Error saving sorted item (not in sorted items list) " + labelSeqNumber);
            }
            return(StoreSortedItem(sortedItem));
        }
Exemple #8
0
        public SortedItem Item(string labelSeqNumber)
        {
            //Get an existing sorted item from the collection
            SortedItem item = null;

            try {
                item = (SortedItem)this.mSortedList[labelSeqNumber];
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while getting sorted item from the collection.", ex); }
            return(item);
        }
Exemple #9
0
 protected virtual void DetermineAssignment(string[] inputs, SortedItem sortedItem)
 {
     //Default implementation to determine the current freight assignment-
     //typically a station has one assignment
     try {
         //Associate freight and sort information
         sortedItem.Freight     = Self.Assignments.Item(0).InboundFreight;
         sortedItem.SortProfile = Self.Assignments.Item(0).SortProfile;
     }
     catch (ApplicationException ex) { throw ex; }
     catch (Exception ex) { throw new ApplicationException("Unexpected error while determining the current freight assignment.", ex); }
 }
Exemple #10
0
        public static bool SaveSortedItem(SortedItem item)
        {
            //Save this sorted item to database
            bool result = false;

            try {
                //Save to database
                if (item.Freight.IsReturns)
                {
                    result = Mediator.ExecuteNonQuery(USP_CARTON_NEW, new object[] { item.LabelSeqNumber,
                                                                                     item.Freight.Client.Number, item.Freight.Client.Division,
                                                                                     item.Freight.Shipper.NUMBER, item.DestinationRouting.DestinationNumber,
                                                                                     item.Freight.TerminalID.ToString().PadLeft(2, '0'), item.DamageCode,
                                                                                     item.Freight.PickupDate, item.Freight.PickupNumber,
                                                                                     item.DestinationRouting.DestinationNumber, item.DestinationRouting.ZoneCode, item.DestinationRouting.ZoneTL,
                                                                                     item.ItemType, item.Weight,
                                                                                     item.Freight.VendorKey, item.CartonNumber,
                                                                                     "Y", item.ReturnNumber,
                                                                                     item.DestinationRouting.ShiftNumber, item.DestinationRouting.ShiftDate,
                                                                                     DateTime.Now, null,
                                                                                     item.SortStation.Number, item.Cube, DateTime.Today,
                                                                                     item.SANNUmber,
                                                                                     item.ElapsedSeconds, item.DownSeconds,
                                                                                     item.PONumber, item.TrackingNumber, item.SpecialAgent.ID,
                                                                                     null, item.InboundLabel.Inputs[0].InputData, item.SortProfile.SortTypeID,
                                                                                     Environment.UserName, item.Freight.FreightID, false });
                }
                else
                {
                    result = Mediator.ExecuteNonQuery(USP_CARTON_NEW, new object[] { item.LabelSeqNumber,
                                                                                     item.Freight.Client.Number, item.Freight.Client.Division,
                                                                                     "9999", item.Freight.Shipper.NUMBER,
                                                                                     item.Freight.TerminalID.ToString().PadLeft(2, '0'), item.DamageCode,
                                                                                     item.Freight.PickupDate, item.Freight.PickupNumber,
                                                                                     item.DestinationRouting.DestinationNumber, item.DestinationRouting.ZoneCode, item.DestinationRouting.ZoneTL,
                                                                                     item.ItemType, item.Weight,
                                                                                     item.Freight.VendorKey, item.CartonNumber,
                                                                                     "N", "",
                                                                                     item.DestinationRouting.ShiftNumber, item.DestinationRouting.ShiftDate,
                                                                                     DateTime.Now, null,
                                                                                     item.SortStation.Number, item.Cube, DateTime.Today,
                                                                                     item.SANNUmber,
                                                                                     item.ElapsedSeconds, item.DownSeconds,
                                                                                     item.PONumber, item.TrackingNumber, item.SpecialAgent.ID,
                                                                                     null, item.InboundLabel.Inputs[0].InputData, item.SortProfile.SortTypeID,
                                                                                     Environment.UserName, item.Freight.FreightID, false });
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while saving sorted item to database.", ex); }
            return(result);
        }
Exemple #11
0
 public void Add(SortedItem sortedItem)
 {
     //Add a new sorted item to the collection
     try {
         //Manage collection size; then add new item
         if (this.mSortedList.Count == MaxItems)
         {
             this.mSortedList.RemoveAt(0);
             ArgixTrace.WriteLine(new TraceMessage("SORTED ITEMS PURGE: " + this.mSortedList.Count.ToString() + "...", AppLib.EVENTLOGNAME, LogLevel.Debug, "SortedItems"));
         }
         this.mSortedList.Add(sortedItem.LabelSeqNumber, sortedItem);
     }
     catch (Exception ex) { throw new ApplicationException("Unexpected error while adding new sorted item to the collection.", ex); }
 }
Exemple #12
0
        private InboundLabel getInboundLabelWithData(SortedItem sortedItem, string[] inputs)
        {
            //Create a copy of the inbound label for the current assignment
            InboundLabel label = sortedItem.SortProfile.InboundLabel.Copy();

            sortedItem.InboundLabel  = label;
            label.HasDataChanged    += new LabelDataEventHandler(OnHasDataChanged);
            label.InputReceived     += new LabelDataEventHandler(OnInputReceived);
            label.AllInputsReceived += new EventHandler(OnAllInputsReceived);
            label.ClearData();

            //Map the inputs to the inbound label and complete sorted item processing
            try { label.DetermineInputs(inputs); }
            catch (Exception ex) { sortedItem.ThrowException(new InboundLabelException(ex)); }
            return(label);
        }
Exemple #13
0
        public bool IsDuplicateCarton(SortedItem sortedItem)
        {
            //Check last DuplicateCheckCount number of Cartons for duplicate, ignore error cartons
            //			int i=0, cartonsToCheck=DuplicateCheckCount;
            bool isDuplicate = false;

            try {
                //Validate if this carton is not already in an error condition
                if (!sortedItem.IsError())
                {
                    //while((i++ < cartonsToCheck) && !isDuplicate && (this.mSortedList.Count - i > 0)) {
                    //	SortedItem item = (SortedItem)this.mSortedList[this.mSortedList.Count - i];
                    //	if(item.IsError())
                    //		cartonsToCheck++;
                    //	else
                    //		isDuplicate = sortedItem.IsDuplicateCarton(item);
                    //}

                    //Work backwards through the list starting with previous sorted item (last in the list is the current sorted item)
                    if (this.mSortedList.Count > 1)
                    {
                        //At least 2 sorted items exist; determine how many to check
                        int itemsToCheck = (DuplicateCheckCount < this.mSortedList.Count) ? DuplicateCheckCount : this.mSortedList.Count - 1;
                        for (int j = 1; j <= itemsToCheck; j++)
                        {
                            //Get a previous sorted item and check as duplicate
                            SortedItem item = (SortedItem)this.mSortedList.GetByIndex(this.mSortedList.Count - j - 1);
                            if (!item.IsError())
                            {
                                isDuplicate = sortedItem.IsDuplicateCarton(item);
                            }
                            if (isDuplicate)
                            {
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while checking for duplicate carton in the collection.", ex); }
            return(isDuplicate);
        }
Exemple #14
0
 public bool StoreSortedItem(SortedItem sortedItem)
 {
     //
     if (sortedItem.IsError())
     {
         throw new SavingException("Item was marked as error during processing - saving stopped " + sortedItem.LabelNumber);
     }
     try {
         SortFactory.SaveSortedItem(sortedItem);
         this.mStation.SortStatistics.AddSortedCarton();
         //02/18/08 (jph): leave this sorted item in the collection for duplicate carton checks
         //this.mSortedItems.Remove(sortedItem.LabelSeqNumber);
     }
     catch (Exception ex) { throw new SavingException("Error saving sorted item " + sortedItem.LabelNumber, ex); }
     finally { if (this.SortedItemComplete != null)
               {
                   this.SortedItemComplete(this, new SortedItemEventArgs(sortedItem));
               }
     }
     return(true);
 }
Exemple #15
0
        protected override void DetermineAssignment(string[] inputs, SortedItem sortedItem)
        {
            //Override the default implementation to determine the correct assignment
            //dynamically; if station has only one assignment, default implementation is OK
            try {
                if (Self.Assignments.Count == 1)
                {
                    //One assignment: use base implementation
                    base.DetermineAssignment(inputs, sortedItem);
                }
                else
                {
                    //Multiple assignments: determine assignment by associating the assignment
                    //with the client who has a store with the input SAN number
                    //Create a default SAN label (for the purpose of extracting the SAN number only)
                    //and determine the SAN number from the inputs
                    InboundLabel label = FreightFactory.DefaultSanInboundLabel.Copy();
                    label.ClearData();
                    try { label.DetermineInputs(inputs); }
                    catch (Exception ex) { sortedItem.ThrowException(new InboundLabelException(ex)); }
                    string sanNumber = label.GetElementValue("SAN").Substring(0, 6);
                    sanNumber += Helper.CheckDigitMod11(sanNumber);

                    //Determine the client for this SAN number and associate with an assignment
                    Client            client     = EnterpriseFactory.CreateClientForStoreSAN(Self.Assignments.Item(0).InboundFreight.Client.Division, sanNumber);
                    StationAssignment assignment = Self.Assignments.Item(client);
                    if (assignment == null)
                    {
                        sortedItem.ThrowException(new ClientForSanException());
                    }

                    //Associate freight and sort information
                    sortedItem.Freight     = assignment.InboundFreight;
                    sortedItem.SortProfile = assignment.SortProfile;
                }
            }
            catch (InboundLabelException ex) { throw ex; }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while determining freight assignment for multiple SAN freight assignments.", ex); }
        }
Exemple #16
0
        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);
        }
Exemple #17
0
 internal override DestinationRouting CreateDestinationRoutingManifest(SortedItem sortedItem, string inputString, bool checkForDuplicates)
 {
     //Polymorphic calls to SortFactory.CreateDestinationRouting???()
     return(SortFactory.CreateDestinationRoutingMultiManifestX(sortedItem.Client.Number, sortedItem.Client.Division, sortedItem.Freight.Shipper.NUMBER, Self.Station.TerminalID.ToString().PadLeft(2, '0'), sortedItem.Freight.FreightID, inputString, sortedItem.SpecialAgent.ZONE_CODE.Trim(), sortedItem.CartonNumber, checkForDuplicates));
 }
Exemple #18
0
        public PandaDS ProcessLabelDataRequest(string[] inputs, decimal weight)
        {
            //Create a new carton
            string cartonID = "", zpl = "";
            int    statusCode        = STATUS_NONE;
            ApplicationException aex = null;
            PandaDS ds = new PandaDS();

            //Validate for non-carton requests (scanner tripped)
            bool   hasInputData = false;
            string _inputs      = "";

            for (int i = 0; i < inputs.Length; i++)
            {
                if (inputs[i].Trim().Length > 0)
                {
                    hasInputData = true;
                }
                _inputs += (i + 1).ToString() + "=" + inputs[i] + "; ";
            }
            ArgixTrace.WriteLine(new TraceMessage("LABEL DATA REQUEST: " + _inputs + "weight=" + weight.ToString(), App.EventLogName, LogLevel.Information, "PandaSvc"));
            if (!hasInputData && weight == 0)
            {
                ArgixTrace.WriteLine(new TraceMessage("LABEL DATA RESPONSE: no inputs; no weight; processing aborted...", App.EventLogName, LogLevel.Information, "PandaSvc"));
                return(ds);
            }
            try {
                //Begin processing a new message request
                //if(this.LabelDataRequest != null) this.LabelDataRequest(null,EventArgs.Empty);
                try {
                    //Create a default carton identifier
                    DateTime dt  = DateTime.Now;
                    int      sec = ((3600 * dt.Hour) + (60 * dt.Minute) + dt.Second);
                    cartonID = dt.ToString("yyyy").Substring(3, 1) + dt.ToString("MM") + dt.ToString("dd") + sec.ToString("00000") + "0000";

                    //Get an outbound label for this carton
                    SortedItem sortedItem = this.mOperator.ProcessInputs(inputs, weight);
                    if (sortedItem != null)
                    {
                        try {
                            cartonID = sortedItem.LabelNumber;
                            zpl      = sortedItem.LabelFormat;
                            sortedItem.ThrowException();
                            statusCode = STATUS_CARTON_OK;
                            ArgixTrace.WriteLine(new TraceMessage("Carton processing successful [label data]...", App.EventLogName, LogLevel.Debug, "PandaSvc"));
                        }
                        catch (Tsort.InboundLabelException ex) {
                            //Test for various inbound label exceptions
                            bool allInvalid = true;
                            for (int i = 0; i < inputs.Length; i++)
                            {
                                if (inputs[i].Trim().Length > 0)
                                {
                                    allInvalid = false; break;
                                }
                            }
                            if (allInvalid)
                            {
                                statusCode = STATUS_SCANERROR_NODATA;
                                ArgixTrace.WriteLine(new TraceMessage("Message data validation failed [no data from scanner]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                            }
                            allInvalid = true;
                            for (int i = 0; i < inputs.Length; i++)
                            {
                                if (inputs[i].Replace("?", "").Trim().Length > 0)
                                {
                                    allInvalid = false; break;
                                }
                            }
                            if (allInvalid && statusCode == STATUS_NONE)
                            {
                                statusCode = STATUS_SCANERROR_NOREAD;
                                ArgixTrace.WriteLine(new TraceMessage("Message data validation failed [no read: ?]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                            }
                            allInvalid = true;
                            for (int i = 0; i < inputs.Length; i++)
                            {
                                if (inputs[i].Replace("#", "").Trim().Length > 0)
                                {
                                    allInvalid = false; break;
                                }
                            }
                            if (allInvalid && statusCode == STATUS_NONE)
                            {
                                statusCode = STATUS_SCANERROR_CONFLICT;
                                ArgixTrace.WriteLine(new TraceMessage("Message data validation failed [label conflict: #]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                            }
                            if (statusCode == STATUS_NONE)
                            {
                                statusCode = STATUS_SCANERROR_LABELFAILED;
                                ArgixTrace.WriteLine(new TraceMessage("Message data validation failed [inbound label exception]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                            }
                        }
                        catch (Tsort.ZeroWeightException ex) {
                            statusCode = STATUS_SCANERROR_WEIGHTBAD;
                            ArgixTrace.WriteLine(new TraceMessage("Message data validation failed [zero weight exception]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                        }
                        catch (Tsort.OverWeightException ex) {
                            statusCode = STATUS_SCANERROR_WEIGHTBAD;
                            ArgixTrace.WriteLine(new TraceMessage("Message data validation failed [over weight exception]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                        }
                        catch (Tsort.DestinationRoutingException ex) {
                            statusCode = STATUS_SCANERROR_LABELFAILED;
                            ArgixTrace.WriteLine(new TraceMessage("Sorted item processing failed [destination/routing exception]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                        }
                        catch (Exception ex) {
                            statusCode = STATUS_SCANERROR_LABELFAILED;
                            ArgixTrace.WriteLine(new TraceMessage("Sorted item processing failed [unexpected exception]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                        }
                        zpl = zpl.Replace(Tsort.Labels.TokenLibrary.STATUSCODE, statusCode.ToString());
                    }
                    else
                    {
                        aex        = new ApplicationException("Carton processing failed [no sorted item]...");
                        statusCode = STATUS_SCANERROR_LABELFAILED;
                        zpl        = createErrorLabelFormat(STATUS_SCANERROR_LABELFAILED, aex);
                        ArgixTrace.WriteLine(new TraceMessage(aex.Message, App.EventLogName, LogLevel.Warning, "PandaSvc"));
                    }
                }
                catch (Exception ex) {
                    aex        = new ApplicationException("Carton processing failed [sorted item processing threw an exception]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", ex);
                    statusCode = STATUS_SCANERROR_LABELFAILED;
                    zpl        = createErrorLabelFormat(STATUS_SCANERROR_LABELFAILED, ex);
                    ArgixTrace.WriteLine(new TraceMessage(aex.Message, App.EventLogName, LogLevel.Warning, "PandaSvc"));
                }
                ds.PandaTable.AddPandaTableRow(cartonID, statusCode, zpl);
                ds.AcceptChanges();
            }
            catch (Exception ex) {
                aex        = new ApplicationException("Carton processing failed [unexpected exception]-->" + ex.Message + (ex.InnerException != null?"-->" + ex.InnerException.Message:"") + "...", ex);
                statusCode = STATUS_ERROR_UNKNOWN;
                zpl        = createErrorLabelFormat(STATUS_ERROR_UNKNOWN, ex);
                ds.PandaTable.AddPandaTableRow(cartonID, statusCode, zpl);
                ds.AcceptChanges();
                ArgixTrace.WriteLine(new TraceMessage(aex.Message, App.EventLogName, LogLevel.Warning, "PandaSvc"));
            }
            finally {
                ArgixTrace.WriteLine(new TraceMessage("LABEL DATA RESPONSE: " + cartonID + "; " + statusCode.ToString(), App.EventLogName, LogLevel.Information, "PandaSvc"));
                //    if(this.LabelDataRequestComplete != null) {
                //        PandaDS _ds = new PandaDS();
                //        _ds.CartonTable.AddCartonTableRow(cartonID,(inputs.Length>0?inputs[0]:""),(inputs.Length>1?inputs[1]:""),(inputs.Length>2?inputs[2]:""),(inputs.Length>3?inputs[3]:""),(inputs.Length>4?inputs[4]:""),(inputs.Length>5?inputs[5]:""),weight,statusCode,zpl,"",(aex!=null?aex.Message:""),"");
                //        this.LabelDataRequestComplete(this,new PandaLabelDataEventArgs(_ds.CartonTable[0]));
                //    }
            }
            return(ds);
        }
Exemple #19
0
 internal virtual void DetermineDestinationAndRounting(SortedItem sortedItem, InboundLabel label)
 {
 }
Exemple #20
0
        public string ProcessVerifyLabelRequest(string cartonID, string verifyCode)
        {
            //Verify the requested carton
            string verifyFlag        = VERIFY_NO;
            ApplicationException aex = null;

            try {
                //Begin processing a new message request
                ArgixTrace.WriteLine(new TraceMessage("VERIFY LABEL REQUEST: ID=" + cartonID + "; verify code=" + verifyCode, App.EventLogName, LogLevel.Information, "PandaSvc"));

                //Validate
                if (!(cartonID.Length == 14 || cartonID.Length == 24))
                {
                    throw new ApplicationException("Invalid cartonID length (" + cartonID.Length.ToString() + "; must be 14 0r 24)...");
                }

                //Find the carton
                SortedItem item = this.mOperator.GetSortedItem(cartonID.Length == 24 ? cartonID.Substring(10, 13) : cartonID.Substring(0, 13));
                if (item != null)
                {
                    //Item found
                    if (verifyCode == VERIFY_PASS)
                    {
                        //Pass: Save carton
                        try {
                            this.mOperator.StoreSortedItem(item);
                            verifyFlag = VERIFY_YES;
                            ArgixTrace.WriteLine(new TraceMessage("Carton save succeeded...", App.EventLogName, LogLevel.Information, "PandaSvc"));
                        }
                        catch (Exception ex) {
                            verifyFlag = VERIFY_NO;
                            aex        = new ApplicationException("Carton save failed...-->" + ex.Message, ex);
                            ArgixTrace.WriteLine(new TraceMessage(aex.Message, App.EventLogName, LogLevel.Error, "PandaSvc"));
                        }
                    }
                    else if (verifyCode == VERIFY_FAIL || verifyCode == VERIFY_NOREAD)
                    {
                        //Fail, No Read: Cancel carton
                        verifyFlag = VERIFY_NO;
                        this.mOperator.CancelSortedItem(item.LabelSeqNumber);
                        ArgixTrace.WriteLine(new TraceMessage("Verify flag was fail or no read; carton cancelled...", App.EventLogName, LogLevel.Information, "PandaSvc"));
                    }
                    else
                    {
                        //Fail, No Read: Cancel carton
                        verifyFlag = VERIFY_NO;
                        this.mOperator.CancelSortedItem(item.LabelSeqNumber);
                        ArgixTrace.WriteLine(new TraceMessage("Verify flag was unknown; carton cancelled...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                    }
                }
                else
                {
                    //Carton not found
                    verifyFlag = VERIFY_NO;
                    ArgixTrace.WriteLine(new TraceMessage("Carton not found...", App.EventLogName, LogLevel.Warning, "PandaSvc"));
                }
            }
            catch (ApplicationException ex) {
                verifyFlag = VERIFY_NO;
                aex        = ex;
                ArgixTrace.WriteLine(new TraceMessage(ex.Message, App.EventLogName, LogLevel.Error, "PandaSvc"));
            }
            catch (Exception ex) {
                verifyFlag = VERIFY_NO;
                aex        = new ApplicationException("An unexpected error occurred while processing verify label request-->" + ex.Message + "...", ex);
                ArgixTrace.WriteLine(new TraceMessage("An unexpected error occurred while processing verify label request-->" + ex.Message + "...", App.EventLogName, LogLevel.Error, "PandaSvc"));
            }
            finally {
                ArgixTrace.WriteLine(new TraceMessage("VERIFY LABEL RESPONSE: " + cartonID + "; " + verifyFlag, App.EventLogName, LogLevel.Information, "PandaSvc"));
                //    if(this.VerifyLabelRequestComplete != null) this.VerifyLabelRequestComplete(this,new PandaVerifyLabelEventArgs(cartonID,verifyFlag,aex));
            }
            return(verifyFlag);
        }