Пример #1
0
        public StationAssignment Item(string stationID, int sortTypeID, string freightID)
        {
            StationAssignment assignment = null;

            for (int i = 0; i < base.Count; i++)
            {
                StationAssignment a = (StationAssignment)base.List[i];
                if (a.SortStation.WorkStationID == stationID && a.SortProfile.SortTypeID == sortTypeID && a.InboundFreight.FreightID == freightID)
                {
                    assignment = a;
                    break;
                }
            }
            return(assignment);
        }
Пример #2
0
        public StationAssignment Item(Tsort.Enterprise.Client aClient)
        {
            StationAssignment assignment = null;

            for (int i = 0; i < base.Count; i++)
            {
                StationAssignment a = (StationAssignment)base.List[i];
                if (a.InboundFreight.Client.IsSameAs(aClient))
                {
                    assignment = a;
                    break;
                }
            }
            return(assignment);
        }
Пример #3
0
        public DataSet ToDataSet()
        {
            //Custom ToString() method
            StationAssignmentDS ds = null;

            try {
                //
                ds = new StationAssignmentDS();
                for (int i = 0; i < base.InnerList.Count; i++)
                {
                    StationAssignment a = (StationAssignment)base.InnerList[i];
                    ds.Merge(a.ToDataSet());
                }
            }
            catch (Exception) { }
            return(ds);
        }
Пример #4
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); }
        }
Пример #5
0
 public void Add(StationAssignment assignment)
 {
     base.InnerList.Add(assignment);
 }