예제 #1
0
파일: brain.cs 프로젝트: jpheary/Argix08
        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)); }
        }
예제 #2
0
        public void RefreshCache()
        {
            //Refresh cached data
            try {
                //Validate operator state
                if (!this.mOperatorWorking)
                {
                    throw new ApplicationException("Station Operator not started for work; call StartWork() before RefreshCache().");
                }

                //Refresh all factory caches
                SortedItem.ErrorLabelTemplate = SortFactory.CreateOBLabelTemplate(this.mErrorLabelNumber, this.Station.PrinterType);
                EnterpriseFactory.RefreshCache();
                FreightFactory.RefreshCache();
                SortFactory.RefreshCache();
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while refreshing the factory caches.", ex); }
        }
예제 #3
0
 public void StartWork()
 {
     //
     try {
         //Apply configuration parameters and update object model
         FreightFactory.DefaultIBLabelID = AppLib.Config.IBLabelDefault;
         Brain.UPSAllowed                = AppLib.Config.UPSAllowed;
         Brain.ShipOverride              = AppLib.Config.ShipOverride;
         SortedItems.MaxItems            = AppLib.Config.SortedItemsLength;
         SortedItems.DuplicateCheckCount = AppLib.Config.SortedItemsCheckDuplicatesLength;
         this.mSortedItems               = new SortedItems();
         SortedItem.WeightMax            = AppLib.Config.WeightMax;
         SortedItem.LanePrefix           = AppLib.Config.LanePrefix;
         this.mErrorLabelNumber          = AppLib.Config.OBLabelError;
         //this.mStation = SortFactory.CreateWorkstation(Environment.MachineName);
         SortedItem.ErrorLabelTemplate = SortFactory.CreateOBLabelTemplate(this.mErrorLabelNumber, this.Station.PrinterType);
         this.mOperatorWorking         = true;
         RefreshCache();
     }
     catch (ApplicationException ex) { throw ex; }
     catch (Exception ex) { throw new ApplicationException("Unexpected error when starting Station Operator.", ex); }
 }