Ejemplo n.º 1
0
        /**************************************************************************************
         * Function name:                   SortCartonArray
         *
         * What this Function Does:         Sorts the CartonInfo object by size, in ascending order
         *
         * update needed:                  none
         *
         * Variables passed in:             Boxes- the carton info object array
         *                                 BoxCnt- the number of boxes, used to loop through the array
         *
         * Variables Declared :            temp: a temp carton info object to hold the info while we sort
         *
         * returns :                        boxes
         * **************************************************************************************/
        public CartonInfo[] SortCartonArray(CartonInfo[] Boxes, int BoxCnt)
        {
            CartonInfo temp = new CartonInfo();

            for (int i = 0; i < Boxes[1].BoxCnt; i++)
            {
                // Console.WriteLine(Boxes[i].GetName());
                //  Console.WriteLine(Boxes[i].GetMaxVolume());
                for (int j = 0; j < i; j++)
                {
                    if (Boxes[i].GetMaxVolume() > Boxes[j].GetMaxVolume())
                    {
                        temp     = Boxes[j];
                        Boxes[j] = Boxes[i];
                        Boxes[i] = temp;
                    }
                }
            }
            return(Boxes);
        }
Ejemplo n.º 2
0
        /**************************************************************************************
         * Function name:                   GetCartonMast
         * What this Function Does:         Populates the carton info objuct with the approate info
         * update needed:                  add part of this to the cartonInfo object
         * Variables passed in:             None
         * Variables Declared :             Boxcnt-number of different type of boxes
         *                                 boxes- the carton info object
         * returns :                        boxes
         * **************************************************************************************/
        public CartonInfo[] GetCartonMast()
        {
            try
            {
                int BoxCnt = 0;


                CartonInfo[] boxes = new CartonInfo[10];


                using (WMSEntities wms = new WMSEntities())
                {
                    var data = from CartonMaster in wms.CARTON_MASTER select CartonMaster;
                    BoxCnt = (from CartonMaster in wms.CARTON_MASTER select CartonMaster).Count();
                    int i = 0;
                    // Log.Write("Number of box types: " + BoxCnt);
                    // Log.Write("\n");
                    foreach (var box in data)
                    {
                        boxes[i] = new CartonInfo(box.CARTON_TYPE, box.DESCRIPTION, box.LENGTH, box.WIDTH, box.HEIGHT, box.UCB_PERCENT, box.LCB_PERCENT, box.MAX_WEIGHT,
                                                  box.DUNNAGE_WEIGHT, box.CONVEYABLE_IND, BoxCnt);
                        i++;
                    }
                }
                boxes = SortCartonArray(boxes, BoxCnt);
                return(boxes);
            }
            catch (Exception e)
            {
                if (e.Source != null)
                {
                    Log.Write("Error in :" + System.Reflection.MethodBase.GetCurrentMethod().Name);
                }
                Log.Write("Error Message: " + e.Message);
                Log.Write("Stack Trace: " + e.StackTrace);
                Log.Write("Target Site: " + e.TargetSite);
                Log.Write("Exiting Program");
                UpdateThreads(0);
                return(null);
            }
        }