Exemplo n.º 1
0
        public static void Load()
        {
            SQL_Query       sQL             = new SQL_Query();
            List <Contract> readInContracts = new List <Contract>();

            sQL.OpenConnection();
            List <string>[] downCMP = sQL.Select_Contracts();
            sQL.CloseConnection();

            for (int i = 0; i < downCMP[0].Count; i++)
            {
                Contract current = new Contract();

                current.client_Name = downCMP[0][i];
                current.job_Type    = int.Parse(downCMP[1][i]);
                current.quantity    = int.Parse(downCMP[2][i]);
                current.origin      = downCMP[3][i];
                current.destination = downCMP[4][i];
                current.van_Type    = int.Parse(downCMP[5][i]);

                readInContracts.Add(current);
            }

            PlannerSQL plannerSQL = new PlannerSQL();

            plannerSQL.Open();
            plannerSQL.PushLocalContracts(readInContracts);
            plannerSQL.Close();
        }
Exemplo n.º 2
0
        // This function represents the planner's ability to simulate the passage of time by 1 day
        // This will calculate where each active truck is after 24h: which is convoluted by the
        // amount of time between stops and time spent at each stop.

        // METHOD HEADER COMMENT -------------------------------------------------------------------------------

        /**
         *	\fn			static void IncrementDay()
         *	\brief		This method will be used to simulate the passage of time.
         *	\details	The data from each of the current trip tickets and their Route Data will be read from the data base.
         *	            The time that each ticket has been alive will be used to determine the current location of the truck. This data will be saved back into the database.
         *	\param[in]	null
         *	\param[out]	null
         *	\exception	null
         *	\see		na
         *	\return		void
         *
         * ---------------------------------------------------------------------------------------------------- */
        public static void IncrementDay(Trip_Ticket inTicket)
        {
            inTicket.Days_Passed += 1;
            double DriveTime = inTicket.Days_Passed * 8;
            double StopTime  = inTicket.Days_Passed * 12;

            //load the route stops from data base
            PlannerSQL sql = new PlannerSQL();

            sql.Open();
            List <RouteData> stops      = sql.PullRouteDataByTicket(inTicket.TicketID);
            Truck            localTruck = sql.ReadFromTrucksByID(inTicket.TruckID);

            sql.Close();


            int       i = 0;
            RouteData current;

            // Calculate how much distance is left for the truck's delivery.
            while (true)
            {
                current = stops[i];

                DriveTime -= current.PickupTime;
                StopTime  -= current.PickupTime;

                DriveTime -= current.DrivenTime;

                DriveTime -= current.LtlTime;
                StopTime  -= current.LtlTime;

                DriveTime -= current.DropoffTime;
                StopTime  -= current.DropoffTime;

                if (DriveTime <= 0 || StopTime <= 0)
                {
                    break;
                }

                i++;
            }

            sql.Open();
            sql.UpdateTruckLocation(inTicket.TruckID, current.CityA); //the city a thing is wrong, change it at some point.
            sql.UpdateTicket(inTicket);
            sql.Close();
        }
Exemplo n.º 3
0
            // Receive_Customer_Order_From_Buyer METHOD HEADER COMMENT -------------------------------------------------------------------------------

            /**
             *	\fn			int Receive_Customer_Order_From_Buyer()
             *	\brief		This method will read the contracts that the buy has set aside.
             *	\details	The method will read from the data base. The buy will have flagged orders and nominated carries for each.
             *	            First the method will determine which carrier is the best option. It will then use the Mapping Class to determine the trip the trucks will take.
             *	            All of this data will be saved into the data base after.
             *
             *	\param[in]	null
             *	\param[out]	null
             *	\exception	null
             *	\see		MappingClass
             *	\return		None
             *
             * ---------------------------------------------------------------------------------------------------- */
            public int Receive_Customer_Order_From_Buyer()
            {
                PlannerSQL sql = new PlannerSQL();

                sql.Open();
                List <Noninated_Contract> noninated_Contracts = new List <Noninated_Contract>();

                noninated_Contracts = sql.LoadNominatedContracts();

                List <CompleteNomination> completeNominations = new List <CompleteNomination>();

                completeNominations = sql.AddCarriersToNominatedContracts(noninated_Contracts);


                sql.Close();

                MappingClass map = new MappingClass();

                List <RouteData> TripRoutes = new List <RouteData>();



                Contract NewContract = null; //from the database

                //List<Carrier> NominatedCarriers = new List<Carrier>(); //from the database


                //List<Trip_Ticket> tickets = Select_Carriers_From_Nominations(NominatedCarriers, NewContract);

                //List<Trip_Ticket_Line> trip_Ticket_Lines = new List<Trip_Ticket_Line>();

                //foreach (Trip_Ticket trip_Ticket in tickets)
                //{
                //    Trip_Ticket_Line line = new Trip_Ticket_Line();
                //    line.Date_Added = DateTime.Now;
                //    line.order = Incoming_Order;
                //    line.ticket = trip_Ticket;

                //    trip_Ticket_Lines.Add(line);
                //}



                //so now all the new tickets that were made are in a list "tickets"
                //and the data that connects them to a customer order is stored in "trip_Ticket_Lines"

                return(0);
            }