public static Workstation CreateWorkstation(string machineName) { //Create a workstation that has an ILabelPrinter printer and IScale scale Workstation station = null; try { if (machineName.Length > 0) { DataSet ds = Mediator.FillDataset(USP_STATION_CONFIG, TBL_STATION_CONFIG, new object[] { machineName }); if (ds.Tables[TBL_STATION_CONFIG].Rows.Count == 0) { throw new ApplicationException("Station for " + machineName + " not found."); } else { WorkstationDS stationDS = new WorkstationDS(); stationDS.Merge(ds); station = new Workstation(stationDS.WorkstationDetailTable[0]); } } else { station = new Workstation(null); } } catch (ApplicationException ex) { throw ex; } catch (Exception ex) { throw new ApplicationException("Unexpected error while creating workstation.", ex); } return(station); }
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); }
public SortedItem(Workstation station) { //Constructor try { ArgixTrace.WriteLine(new TraceMessage("New sorted item...", AppLib.EVENTLOGNAME, LogLevel.Debug, "SortedItem")); this.mSortStation = station; this.mLabelSeqNumber = CreateLabelSequenceNumber(this.mSortStation.Number); } catch (Exception ex) { this.mException = ex; } }
public StationAssignment(string assignmentID, Workstation sortStation, InboundFreight inboundFreight, SortProfile sortProfile) { //Constructor try { //Configure this assignment from the assignment configuration information this.mAssignmentID = assignmentID; this.mStation = sortStation; this.mFreight = inboundFreight; this.mProfile = sortProfile; } catch (Exception ex) { throw new ApplicationException("Unexpected error while creating new Station Assignment instance.", ex); } }
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); } }