예제 #1
0
        public static StationAssignments GetStationAssignments(Workstation workstation)
        {
            //Return a collection of current freight assignments for the specified workstation
            StationAssignments assignments = null;

            try {
                if (workstation == null)
                {
                    throw new ApplicationException("Workstation is null.");
                }

                assignments = new StationAssignments();
                StationAssignmentDS dsAssignments = new StationAssignmentDS();
                dsAssignments.Merge(Mediator.FillDataset(USP_FREIGHTCLIENTSHIPPER, TBL_FREIGHTCLIENTSHIPPER, new object[] { workstation.WorkStationID }));
                foreach (StationAssignmentDS.FreightClientShipperTableRow row in dsAssignments.FreightClientShipperTable)
                {
                    Client         client   = EnterpriseFactory.CreateClient(row.ClientNumber, row.ClientDivision, row.Client, row.ClientAddressLine1, row.ClientAddressLine2, row.ClientAddressCity, row.ClientAddressState, row.ClientAddressZip);
                    Shipper        shipper  = EnterpriseFactory.CreateShipper(row.FreightType, row.ShipperNumber, row.Shipper, row.ShipperAddressLine1, row.ShipperAddressLine2, row.ShipperAddressCity, row.ShipperAddressState, row.ShipperAddressZip, row.ShipperUserData);
                    InboundFreight shipment = FreightFactory.CreateInboundFreight(row.TerminalID, row.FreightID, row.FreightType, row.TDSNumber, row.VendorKey, row.TrailerNumber, row.PickupDate, row.PickupNumber, row.CubeRatio, client, shipper);
                    SortProfile    profile  = CreateSortProfile(shipment, row.SortTypeID, row.SortType, row.LabelID, row.ExcLocation);
                    assignments.Add(new StationAssignment("", workstation, shipment, profile));
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Unexpected error while getting station assignments (freight-client-shipper).", ex); }
            return(assignments);
        }