Esempio n. 1
0
		//Interface
		public dlgAssignmentDetail(DialogActionEnum eDialogAction, IBShipment shipment, string workstationID) {
			//Constructor
			try {
				//Required for Windows Form Designer support
				InitializeComponent();
				this.cmdCancel.Text = CMD_CANCEL;
				this.cmdBack.Text = CMD_BACK;
				this.cmdNext.Text = CMD_NEXT;
				this.mShipment = shipment;
				switch(this.mDialogAction = eDialogAction) {
					case DialogActionEnum.DialogActionAssign:		
						this.Text = "Assign Freight To Sort Stations"; 
						this.mAssignmentsDS.Clear();
						break;
					case DialogActionEnum.DialogActionUnassignAny:	
						this.Text = "Unassign Freight From Sort Stations"; 
						this.mAssignmentsDS.Merge(FreightFactory.GetAssignments(this.mShipment.FreightID, ""));
						break;
					case DialogActionEnum.DialogActionUnassign:		
						this.Text = "Unassign Freight From Sort Station"; 
						this.mAssignmentsDS.Merge(FreightFactory.GetAssignments(this.mShipment.FreightID, workstationID));
						break;
				}
			}
			catch(Exception ex) { throw new ApplicationException("Could not crate new Assignment Detail dialog.", ex); }
		}
Esempio n. 2
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;
		}
Esempio n. 3
0
 public StationAssignment(Workstation sortStation, IBShipment inboundFreight, int sortTypeID)
 {
     //Constructor
     try {
         //Configure this assignment from the assignment configuration information
         this.mWorkStation    = sortStation;
         this.mInboundFreight = inboundFreight;
         this.mSortTypeID     = sortTypeID;
     }
     catch (Exception ex) { throw new ApplicationException("Could not create a new station assignment.", ex); }
 }
Esempio n. 4
0
        public static bool DeleteShipment(IBShipment shipment)
        {
            //Delete an inbound shipment from the local LAN database
            bool bVal = false;

            try {
                bVal = App.Mediator.ExecuteNonQuery(USP_SHIPMENTDELETE, new object[] { shipment.FreightID });
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Failed to delete freight ID#" + shipment.FreightID + " from the local LAN database.", ex); }
            return(bVal);
        }
Esempio n. 5
0
        public static bool StopSort(IBShipment shipment)
        {
            //Set stop sort date and status for this shipment
            bool ret = false;

            try {
                ret = App.Mediator.ExecuteNonQuery(USP_SHIPMENTUPDATESTOP, new object[] { shipment.FreightID, DateTime.Now.ToString("yyyyMMdd"), DateTime.Now.ToString("HHmmss") });
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Failed to stop sort for freight ID#" + shipment.FreightID + ".", ex); }
            return(ret);
        }
Esempio n. 6
0
        public static IBShipment GetShipment(string freightID)
        {
            //Return an existing shipment from the inbound freight collection
            IBShipment shipment = null;

            try {
                //Merge from collection (dataset)
                InboundFreightDS.InboundFreightTableRow row = (InboundFreightDS.InboundFreightTableRow)_InboundFreight.InboundFreightTable.Select("FreightID='" + freightID + "'")[0];
                shipment = new IBShipment(row);
            }
            catch (Exception ex) { throw new ApplicationException("Failed to get shipment.", ex); }
            return(shipment);
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
0
        public static bool IsSortStopped(IBShipment shipment)
        {
            //Determine if a shipment has completed sort
            DataSet ds  = null;
            bool    ret = false;

            try {
                ds = App.Mediator.FillDataset(USP_SHIPMENTREAD, TBL_SHIPMENTREAD, new object[] { shipment.FreightID });
                if (ds.Tables[TBL_SHIPMENTREAD].Rows.Count > 0)
                {
                    if (ds.Tables[TBL_SHIPMENTREAD].Rows[0]["StopSortDate"] != null)
                    {
                        ret = (ds.Tables[TBL_SHIPMENTREAD].Rows[0]["StopSortDate"].ToString().Trim() != "");
                    }
                }
                else
                {
                    throw new ApplicationException("Failed to determine if sort was stopped for freight ID#" + shipment.FreightID + " because the freight was not found.");
                }
            }
            catch (ApplicationException ex) { throw ex; }
            catch (Exception ex) { throw new ApplicationException("Failed to determine if sort was stopped for freight ID#" + shipment.FreightID + ".", ex); }
            return(ret);
        }