private bool assignFreight() { bool bOK = true; this.Cursor = Cursors.WaitCursor; try { //Create station freight assignments foreach (TsortDataset.StationFreightAssignmentTableRow row in this.mAssignmentsDS.StationFreightAssignmentTable.Rows) { Workstation station = new Workstation(); station.WorkStationID = row.WorkStationID; station.Number = row.StationNumber; bool created = false; try { created = TsortGateway.CreateStationAssignment(station, this.mShipment, row.SortTypeID, "Assigned"); } catch (ApplicationException ex) { App.ReportError(ex, true, LogLevel.Error); } if (!created) { bOK = false; } row.Result = (!created) ? EX_RESULT_FAILED : EX_RESULT_OK; this.grdAssignments.Refresh(); Application.DoEvents(); } } catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); } return(bOK); }
public static bool CreateStationAssignment(Workstation station, InboundShipment shipment, int sortTypeID, string initials) { // bool created = false; FreightAssignServiceClient client = new FreightAssignServiceClient(); try { created = client.CreateStationAssignment(shipment.TerminalID, station.WorkStationID, shipment.FreightID, sortTypeID); client.Close(); //Add to station assignment history _AssignmentHistory.FreightAssignmentHistoryTable.AddFreightAssignmentHistoryTableRow(DateTime.Today, shipment.TDSNumber, shipment.ClientNumber + "-" + shipment.ClientName, station.Number, DateTime.Now, initials); if (AssignmentHistoryChanged != null) { AssignmentHistoryChanged(null, EventArgs.Empty); } RefreshStationAssignments(); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <TsortFault> dfe) { client.Abort(); throw new ApplicationException(dfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(created); }
protected void OnAssignment(object sender, CommandEventArgs e) { // try { switch (e.CommandName) { case "Add": if (this.cboSortType.SelectedValue.Trim().Length > 0 && this.cboStation.SelectedValue.Trim().Length > 0) { Argix.Freight.Workstation station = new Argix.Freight.Workstation(); station.WorkStationID = this.cboStation.SelectedValue; Argix.Freight.InboundShipment shipment = new Argix.Freight.InboundShipment(); shipment.TerminalID = int.Parse(this.cboTerminal.SelectedValue); shipment.FreightID = this.odsStations.SelectParameters["freightID"].DefaultValue; int sortTypeID = int.Parse(this.cboSortType.SelectedValue); bool added = new Argix.Freight.TsortGateway().CreateStationAssignment(station, shipment, sortTypeID); this.lsvAssignments.DataBind(); } break; case "Unassign": Argix.Freight.StationAssignment assignment = new Argix.Freight.StationAssignment(); assignment.SortStation = new Argix.Freight.Workstation(); assignment.SortStation.WorkStationID = e.CommandArgument.ToString().Split(new char[] { ',' })[0]; assignment.InboundFreight = new Argix.Freight.InboundShipment(); assignment.InboundFreight.TerminalID = int.Parse(this.cboTerminal.SelectedValue); assignment.InboundFreight.FreightID = e.CommandArgument.ToString().Split(new char[] { ',' })[1]; assignment.SortTypeID = int.Parse(e.CommandArgument.ToString().Split(new char[] { ',' })[2]); bool removed = new Argix.Freight.TsortGateway().DeleteStationAssignment(assignment); this.lsvAssignments.DataBind(); break; } } catch (Exception ex) { Master.ReportError(ex); } }
public static StationAssignment GetAssignment(string stationNumber, string tripNumber) { //Get a station assignment StationAssignment assignment = null; int cartonCount = 0; string carrier = "", trailerNumber = ""; try { //Merge from collection (dataset) DataRow[] rows = _Assignments.BwareStationTripTable.Select("StationNumber='" + stationNumber + "' AND TripNumber='" + tripNumber + "'"); if (rows.Length > 0) { //Existing assignment BearwareDS.BwareStationTripTableRow row = (BearwareDS.BwareStationTripTableRow)rows[0]; cartonCount = row.CartonCount; carrier = row.Carrier; trailerNumber = row.TrailerNumber; } else { //New assignment cartonCount = 0; carrier = trailerNumber = ""; } Workstation station = new Workstation(stationNumber); BearwareTrip trip = new BearwareTrip(tripNumber, cartonCount, carrier, trailerNumber); assignment = new StationAssignment("", station, trip); assignment.Changed += new EventHandler(OnAssignmentChanged); } catch (Exception ex) { throw ex; } return(assignment); }
private bool unassignFreight() { //Unassign one or more station assignments bool bOK=true; this.Cursor = Cursors.WaitCursor; try { foreach(FreightAssignDS.StationFreightAssignmentTableRow row in this.mAssignmentsDS.StationFreightAssignmentTable.Rows) { WorkstationDS.WorkstationTableRow ws = new WorkstationDS().WorkstationTable.NewWorkstationTableRow(); ws.WorkStationID = row.WorkStationID; ws.Number = row.StationNumber; Workstation station = new Workstation(ws); InboundFreightDS.InboundFreightTableRow ibf = new InboundFreightDS().InboundFreightTable.NewInboundFreightTableRow(); ibf.FreightID = row.FreightID; ibf.TDSNumber = row.TDSNumber; ibf.ClientNumber = ibf.ClientName = row.Client; IBShipment shipment = new IBShipment(ibf); StationAssignment assignment = new StationAssignment(station,shipment,row.SortTypeID); bool deleted=false; try { deleted = FreightFactory.DeleteAssignment(assignment, "Unassigned"); } catch(ApplicationException ex) { App.ReportError(ex, true, LogLevel.Error); } catch(Exception ex) { App.ReportError(new ApplicationException("Failed to unassign freight " + row.FreightID + " from station " + row.WorkStationID + " (sorttypeID= " + row.SortTypeID.ToString() + ").", ex), true, LogLevel.Error); } if(!deleted) bOK = false; row.Result = (!deleted) ? EX_RESULT_FAILED : EX_RESULT_OK; this.grdAssignments.Refresh(); Application.DoEvents(); } } catch(Exception ex) { App.ReportError(ex, true, LogLevel.Error); } return bOK; }
protected void OnCommand(object sender, CommandEventArgs e) { // try { switch (e.CommandName) { case "Assign": if (this.cboSortType.SelectedValue.Trim().Length > 0 && this.cboStation.SelectedValue.Trim().Length > 0) { Argix.Freight.Workstation station = new Argix.Freight.Workstation(); station.WorkStationID = this.cboStation.SelectedValue; Argix.Freight.InboundShipment shipment = new Argix.Freight.InboundShipment(); shipment.TerminalID = int.Parse(Request.QueryString["terminalID"]); shipment.FreightID = Request.QueryString["freightID"]; int sortTypeID = int.Parse(this.cboSortType.SelectedValue); bool added = new Argix.Freight.TsortGateway().CreateStationAssignment(station, shipment, sortTypeID); if (added) { Response.Redirect("~/Stations.aspx"); } } break; case "Cancel": Response.Redirect("~/Default.aspx"); break; } } catch (Exception ex) { Master.ReportError(ex); } }
//Interface public StationOperator() { //Constructor try { //Get station configuration and current freight assignment this.mStation = FreightService.GetWorkstation(Environment.MachineName); } catch (Exception ex) { throw new ApplicationException("Unexpected error while creating new Station Operator instance.", ex); } }
public StationAssignment(Workstation sortStation, InboundShipment inboundFreight, int sortTypeID) { //Constructor try { this.mWorkStation = sortStation; this.mInboundFreight = inboundFreight; this.mSortTypeID = sortTypeID; } catch (Exception ex) { throw new ApplicationException("Could not create a new station assignment.", ex); } }
public StationAssignment(string assignmentID, Workstation sortStation, BearwareTrip inboundFreight) { //Constructor try { //Configure this assignment from the assignment configuration information this.mAssignmentID = assignmentID; this.mStation = sortStation; this.mFreight = inboundFreight; } catch (Exception ex) { throw new ApplicationException("Unexpected error while creating new StationAssignment instance.", ex); } }
public static Workstation GetStation(string machinName) { //Get a view of TLs for the specified terminal Workstation workstation = null; try { workstation = _Client.GetStation(machinName); } catch (TimeoutException te) { _Client.Abort(); } catch (System.ServiceModel.CommunicationException ce) { _Client.Abort(); } return(workstation); }
public Carton(string scan, BearwareTrip shipment, Client client, Store store, ClientVendor shipper, Zone zone, Workstation workstation) { //Constructor try { this.mScanData = scan; this.mInboundFreight = shipment; this.mClient = client; this.mStore = store; this.mClientVendor = shipper; this.mZone = zone; this.mWorkstation = workstation; } catch (Exception ex) { throw new ApplicationException("Unexpected error creating new Carton instance.", ex); } }
public bool CreateStationAssignment(Workstation station, InboundShipment shipment, int sortTypeID) { // bool created = false; FreightAssignServiceClient client = new FreightAssignServiceClient(); try { created = client.CreateStationAssignment(shipment.TerminalID, station.WorkStationID, shipment.FreightID, sortTypeID); client.Close(); } catch (TimeoutException te) { client.Abort(); throw new ApplicationException(te.Message); } catch (FaultException <TsortFault> dfe) { client.Abort(); throw new ApplicationException(dfe.Detail.Message); } catch (FaultException fe) { client.Abort(); throw new ApplicationException(fe.Message); } catch (CommunicationException ce) { client.Abort(); throw new ApplicationException(ce.Message); } return(created); }
private void OnFormLoad(object sender, System.EventArgs e) { //Load conditions this.Cursor = Cursors.WaitCursor; try { //Initialize controls Splash.Close(); this.Visible = true; Application.DoEvents(); //Set control defaults Workstation w = FreightProxy.GetStation("JAST001"); this.Text += w.Number; this.mAssignmentDS.Merge(FreightProxy.GetFreightAssignments(w.WorkStationID)); } catch (Exception ex) { App.ReportError(ex, true); } finally { setUserServices(); this.Cursor = Cursors.Default; } }
public StationAssignment(FreightDataset.StationFreightAssignmentTableRow assignment) { //Constructor this.mWorkStation = new Workstation(); this.mWorkStation.WorkStationID = assignment.WorkStationID; this.mWorkStation.Number = assignment.StationNumber; this.mInboundFreight = new InboundShipment(); this.mInboundFreight.FreightID = assignment.FreightID; this.mInboundFreight.FreightType = assignment.FreightType; this.mInboundFreight.TDSNumber = assignment.TDSNumber; this.mInboundFreight.TrailerNumber = assignment.TrailerNumber; this.mInboundFreight.ClientNumber = assignment.Client; this.mInboundFreight.ShipperNumber = assignment.Shipper; this.mInboundFreight.Pickup = assignment.Pickup; this.mInboundFreight.TerminalID = assignment.TerminalID; this.mSortTypeID = assignment.SortTypeID; this.mSortType = assignment.SortType; }
private bool unassignFreight() { //Unassign one or more station assignments bool bOK = true; this.Cursor = Cursors.WaitCursor; try { foreach (TsortDataset.StationFreightAssignmentTableRow row in this.mAssignmentsDS.StationFreightAssignmentTable.Rows) { Workstation station = new Workstation(); station.TerminalID = row.TerminalID; station.WorkStationID = row.WorkStationID; station.Number = row.StationNumber; InboundShipment shipment = new InboundShipment(); shipment.TerminalID = row.TerminalID; shipment.FreightID = row.FreightID; shipment.TDSNumber = row.TDSNumber; shipment.ClientNumber = shipment.ClientName = row.Client; StationAssignment assignment = new StationAssignment(); assignment.SortStation = station; assignment.InboundFreight = shipment; assignment.SortTypeID = row.SortTypeID; bool deleted = false; try { deleted = TsortGateway.DeleteStationAssignment(assignment, "Unassigned"); } catch (ApplicationException ex) { App.ReportError(ex, true, LogLevel.Error); } catch (Exception ex) { App.ReportError(new ApplicationException("Failed to unassign freight " + row.FreightID + " from station " + row.WorkStationID + " (sorttypeID= " + row.SortTypeID.ToString() + ").", ex), true, LogLevel.Error); } if (!deleted) { bOK = false; } row.Result = (!deleted) ? EX_RESULT_FAILED : EX_RESULT_OK; this.grdAssignments.Refresh(); Application.DoEvents(); } } catch (Exception ex) { App.ReportError(ex, true, LogLevel.Error); } return(bOK); }
public static StationAssignment CreateAssignment(Workstation workstation, IBShipment freight, int sortTypeID, string initials) { //Assign this freight to the specified sort station StationAssignment assignment = null; try { //Create the station assignment App.Mediator.ExecuteNonQuery(USP_ASSIGNMENTCREATE, new object[] { workstation.WorkStationID, freight.FreightID, sortTypeID }); assignment = new StationAssignment(workstation, freight, sortTypeID); try { RefreshStationAssignments(); } catch { } //Add to station assignment history _AssignmentHistory.FreightAssignmentHistoryTable.AddFreightAssignmentHistoryTableRow(DateTime.Today, freight.TDSNumber, freight.ClientNumber + "-" + freight.ClientName, workstation.Number, DateTime.Now, initials); if (AssignmentHistoryChanged != null) { AssignmentHistoryChanged(null, EventArgs.Empty); } } catch (Exception ex) { throw new ApplicationException("Failed to assign freight TDS#" + freight.TDSNumber + " to station " + workstation.Number + " (sorttypeID= " + sortTypeID.ToString() + ").", ex); } return(assignment); }
public static Workstation GetWorkstation(string machineName) { //Create a workstation that has an ILabelPrinter printer and IScale scale Workstation station = null; try { DataSet ds = App.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]); } } catch (ApplicationException ex) { throw ex; } catch (Exception ex) { throw new ApplicationException("Unexpected error getting the workstation.", ex); } return(station); }
private bool assignFreight() { bool bOK=true; this.Cursor = Cursors.WaitCursor; try { //Create station freight assignments foreach(FreightAssignDS.StationFreightAssignmentTableRow row in this.mAssignmentsDS.StationFreightAssignmentTable.Rows) { WorkstationDS.WorkstationTableRow ws = new WorkstationDS().WorkstationTable.NewWorkstationTableRow(); ws.WorkStationID = row.WorkStationID; ws.Number = row.StationNumber; Workstation station = new Workstation(ws); bool created = false; try { created = (FreightFactory.CreateAssignment(station, this.mShipment, row.SortTypeID, "Assigned") != null); } catch(ApplicationException ex) { App.ReportError(ex, true, LogLevel.Error); } if(!created) bOK = false; row.Result = (!created) ? EX_RESULT_FAILED : EX_RESULT_OK; this.grdAssignments.Refresh(); Application.DoEvents(); } } catch(Exception ex) { App.ReportError(ex, true, LogLevel.Error); } return bOK; }