Beispiel #1
0
		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;
		}
Beispiel #2
0
        public DataSet ToDataSet()
        {
            //Return a dataset containing values for this workstation
            WorkstationDS ds = null;

            try {
                ds = new WorkstationDS();
                WorkstationDS.WorkstationDetailTableRow workstation = ds.WorkstationDetailTable.NewWorkstationDetailTableRow();
                workstation.WorkStationID = this.mWorkStationID;
                workstation.Name          = this.mName;
                workstation.TerminalID    = this.mTerminalID;
                workstation.Number        = this.mNumber;
                workstation.Description   = this.mDescription;
                workstation.ScaleType     = this.mScaleType;
                workstation.ScalePort     = this.mScalePort;
                workstation.PrinterType   = this.mPrinterType;
                workstation.PrinterPort   = this.mPrinterPort;
                workstation.Trace         = this.mTrace;
                workstation.IsActive      = this.mIsActive;
                ds.WorkstationDetailTable.AddWorkstationDetailTableRow(workstation);
                ds.AcceptChanges();
            }
            catch (Exception) { }
            return(ds);
        }
Beispiel #3
0
        public static WorkstationDS GetUnassignedStations()
        {
            //Returns a list of sort stations that are available for station assignments
            WorkstationDS workstations = null;

            try {
                workstations = new WorkstationDS();
                DataSet ds = App.Mediator.FillDataset(USP_STATIONSUNASSIGNED, TBL_STATIONS, null);
                if (ds != null)
                {
                    workstations.Merge(ds);
                }
            }
            catch (Exception ex) { throw ex; }
            return(workstations);
        }
Beispiel #4
0
        //Interface
        public dlgAssignment(WorkstationDS selectedStations)
        {
            //Constructor
            try {
                //Required for Windows Form Designer support
                InitializeComponent();
                #region Set command button identities (used for onclick handler)
                this.btnCancel.Text = CMD_CANCEL;
                this.btnOK.Text     = CMD_OK;
                #endregion

                //Set services
                this.mSelectedStations   = selectedStations;
                this.mUnassignedStations = FreightFactory.GetUnassignedStations();
            }
            catch (Exception ex) { throw ex; }
        }
Beispiel #5
0
        public static WorkstationDS GetAssignableSortStations(string freightID, int sortTypeID)
        {
            //Get a list of assignable sort stations (stations without assignments) for the
            //specified freight and sort type; if sortTypeID = SAN, all those stations that
            //are sorting SAN for a different client are eligible
            WorkstationDS workstations = null;

            try {
                workstations = new WorkstationDS();
                DataSet ds = App.Mediator.FillDataset(USP_SORTSTATIONS, TBL_SORTSTATIONS, new object[] { freightID, App.Mediator.TerminalID, sortTypeID });
                if (ds != null)
                {
                    workstations.Merge(ds, false, MissingSchemaAction.Ignore);
                }
            }
            catch (Exception ex) { throw new ApplicationException("Failed to get assignable sort stations.", ex); }
            return(workstations);
        }
Beispiel #6
0
        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);
        }
Beispiel #7
0
		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;
		}