Пример #1
0
        public void RefreshStationAssignments()
        {
            //Refresh current station assignments
            try {
                //Validate operator state
                if (!this.mOperatorWorking)
                {
                    throw new ApplicationException("Station Operator not started for work; call StartWork() before RefreshStationAssignments().");
                }

                //Clear assignment info
                SortFactory.CreateBrain(null);
                this.mAssignments.Clear();

                //Refresh station assignments; select first assignment as current and select the appropriate Brain
                this.mAssignments = SortFactory.GetStationAssignments(this.mStation);
                ArgixTrace.WriteLine(new TraceMessage("Assignments changed... " + this.mAssignments.Count.ToString() + " new assignments...", AppLib.EVENTLOGNAME, LogLevel.Warning, "SortOperator"));
                if (this.mAssignments.Count > 0)
                {
                    this.mBrain         = SortFactory.CreateBrain(this.mAssignments.Item(0).SortProfile);
                    CurrentInboundLabel = this.mAssignments.Item(0).SortProfile.InboundLabel;
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while refreshing station assignments.", ex); }
            finally { if (this.StationAssignmentsChanged != null)
                      {
                          this.StationAssignmentsChanged(this, EventArgs.Empty);
                      }
            }
        }
Пример #2
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)); }
        }
Пример #3
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); }
        }
Пример #4
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);
 }
Пример #5
0
        public StationOperator(string connectionString, bool useConnectionState)
        {
            //Constructor - this is done for dll purposes, NEED to think more, maybe move to config file, but will need dll start up
            try {
                //Init this object
                Config._ConnectionString          = connectionString;
                Config._WebSvcUrl                 = "";
                Config._UseWebSvc                 = false;
                Config._UseConnState              = useConnectionState;
                AppLib.Mediator.DataStatusUpdate += new DataStatusHandler(OnDataStatusUpdate);
                EnterpriseFactory.Mediator        = FreightFactory.Mediator = SortFactory.Mediator = AppLib.Mediator;

                Brain.Self  = this;
                this.mBrain = SortFactory.CreateBrain(null);
                //this.mStation = SortFactory.CreateWorkstation("");
                this.mStation     = SortFactory.CreateWorkstation(Environment.MachineName);
                this.mAssignments = new StationAssignments();
                this.mSortedItems = new SortedItems();
                this.mSetup       = new dlgStationSetup(dlgStationSetup.SCALETYPE_AUTOMATIC);
            }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while creating Station Operator instance.", ex); }
        }
Пример #6
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); }
 }
Пример #7
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));
 }