Exemplo n.º 1
0
        public int GetBatchNumber(IProductEntryDto tpoCProductRollDto)
        {
            int batchNumber = 0;

            if (tpoCProductRollDto.MasterRollID.HasValue)
            {
                TPOCProductRollDto masterRoll = Get(tpoCProductRollDto.MasterRollID.Value);
                return(masterRoll.BatchNumber);
            }
            else
            {
                bool               newBatch     = false;
                TPOBatchService    batchService = new TPOBatchService();
                List <TPOBatchDto> batch        = batchService.GetByLineID(tpoCProductRollDto.LineID);
                if (batch == null || batch.Count == 0)
                {
                    newBatch = true;
                }
                else
                {
                    batchNumber = batch[0].BatchNumber;
                }

                TPOFormulationLineProductDto formulationLineProduct = GetFormulationLineProduct(tpoCProductRollDto);
                newBatch = CheckNewBatchRequirements(tpoCProductRollDto, newBatch, batchService, batch, formulationLineProduct);

                if (newBatch)
                {
                    return(GetNewBatch(tpoCProductRollDto, ++batchNumber, formulationLineProduct.TPOFormulationID));
                }
                else
                {
                    return(batch[0].BatchNumber);
                }
            }
        }
Exemplo n.º 2
0
 private int GetScrimCountForBatch(TPOBatchService batchService, List <TPOBatchDto> batch)
 {
     return(batch.Count(s => s.IsScrim == true));
 }
Exemplo n.º 3
0
 private int GetRawMaterialCountForBatch(TPOBatchService batchService, List <TPOBatchDto> batch)
 {
     return(batch.Count(s => s.IsScrim == false));
 }
Exemplo n.º 4
0
        private bool CheckScrimRollCountsForBatch(IProductEntryDto tpoCProductRollDto, bool newBatch, TPOBatchService batchService, List <TPOBatchDto> batch)
        {
            int oldScrimCount = GetScrimCountForBatch(batchService, batch);
            int newScrimCount = GetTPOCurrentScrimCount(tpoCProductRollDto);

            if (oldScrimCount != newScrimCount)
            {
                newBatch = true;
            }
            return(newBatch);
        }
Exemplo n.º 5
0
        private bool CheckNewBatchRequirements(IProductEntryDto tpoCProductRollDto, bool newBatch, TPOBatchService batchService, List <TPOBatchDto> batch, TPOFormulationLineProductDto formulationLineProduct)
        {
            if (!newBatch)
            {
                newBatch = CheckFormulationForBatch(newBatch, batch, formulationLineProduct);
            }

            if (!newBatch)
            {
                newBatch = CheckScrimRollCountsForBatch(tpoCProductRollDto, newBatch, batchService, batch);
            }

            if (!newBatch)
            {
                newBatch = CheckScrimRollsForBatch(tpoCProductRollDto, newBatch);
            }

            if (!newBatch)
            {
                newBatch = CheckRawMaterialCountsForBatch(tpoCProductRollDto, newBatch, batchService, batch);
            }

            if (!newBatch)
            {
                newBatch = CheckRawMaterialsForBatch(tpoCProductRollDto, newBatch);
            }
            return(newBatch);
        }