Example #1
0
        /// <summary>
        /// Dequeue a batch of noItemPerCarton of elements from this Matching Queue, by sequence Dequeue from each sub queue, with index 0, 1, 2, 3, ... NoSubQueue-1 (Comfort with: Zero base index)
        /// </summary>
        /// <returns></returns>
        public BarcodeQueue <TBarcodeDTO> Dequeueset()
        {
            if ((((decimal)this.ItemPerSet / (decimal)this.NoSubQueue) % 1) == 0) //CHECK FOR AN Integer RESULT
            {
                BarcodeQueue <TBarcodeDTO> barcodesetQueue = new BarcodeQueue <TBarcodeDTO>(this.HasLabel, this.NoSubQueue, this.ItemPerSet / this.NoSubQueue, false)
                {
                    ItemPerSet = this.ItemPerSet
                };

                foreach (List <TBarcodeDTO> subQueue in this.list2DBarcode)
                {
                    int nullIndex = this.FindNullIndex(subQueue);
                    //There is not enough element in this sub queue to dequeue. //IF LastsetProcessing: TO ALLOW TO MAKE A PARTILAL SET. IT MEANS: THE PENDING Item IS LESS THAN THE ItemPerSet, OTHERWISE: return empty
                    if (this.LastsetProcessing && nullIndex != -1)
                    {
                        this.LastsetProcessing = false; return(barcodesetQueue);
                    }                                                                                                          //LastsetProcessing: MUST HAVE NO NULL Code OR LABEL
                    if (!this.LastsetProcessing && (barcodesetQueue.itemPerSubQueue > subQueue.Count || (nullIndex != -1 && barcodesetQueue.itemPerSubQueue > nullIndex)))
                    {
                        return(barcodesetQueue);
                    }
                }


                foreach (List <TBarcodeDTO> subQueue in this.list2DBarcode)
                {
                    for (int i = 0; i < barcodesetQueue.itemPerSubQueue; i++)
                    {   //THE MAXIMUM ITEM PER EACH subQueue IS itemPerSubQueue (FULL SET).
                        //LATER: WHEN LastsetProcessing => WE CAN MODIFY HERE (ONLY HERE) TO ALLOW: THE MAXIMUM ITEM PER EACH subQueue IS GREATER THAN THE STANDARD itemPerSubQueue. TO DO THIS: FIRST WE HAVE TO ADD A NEW PROPERTY pauseStatus (SET TO TRUE) TO PAUSE THE PROCCESS OF MakePackset/ MakeCartonset BY ScannerController, THEN TURN LastsetProcessing TO true IN ORDER TO RELEASE pauseStatus (SET TO FALSE), FINALLY: MODIFY THIS CONDITION: i < barcodesetQueue.itemPerSubQueue

                        //HERE WE CHECK subQueue.Count > 0 => WHEN LastsetProcessing: SOME subQueue OF THE SET MAY NOT IS FULL
                        if (subQueue.Count > 0)
                        {
                            barcodesetQueue.Enqueue(subQueue.ElementAt(0)); subQueue.RemoveAt(0);
                        }                                                                                                //Check subQueue.Count > 0 just for sure, however, we check it already at the begining of this method
                    }
                }

                if (barcodesetQueue.Count > 0)
                {
                    this.LastsetProcessing = false;                            //AFTER SUCCESS Dequeueset => WE CLEAR LastsetProcessing
                }
                return(barcodesetQueue);
            }
            else
            {
                throw new Exception("Số chai/ carton không phù hợp!");
            }
        }
Example #2
0
        public FillingData()
        {
            this.settingDate = DateTime.Now;

            this.CartontoZebraQueue = new BarcodeQueue <CartonDTO>(this.HasCartonLabel);
        }