コード例 #1
0
        private void UpdateScrimUsageEntryForContractorRoll(TPOCProductRollDto tpoCProductRollDto, double divisor)
        {
            DateTime        now   = DateTime.Now;
            TPOBatch        batch = _repository.Repository <TPOBatch>().GetAllBy(b => b.BatchNumber == tpoCProductRollDto.BatchNumber && b.IsScrim == true).FirstOrDefault();
            ScrimRoll       roll  = _repository.Repository <ScrimRoll>().GetById(batch.ScrimRollID);
            ScrimActionType type  = _repository.Repository <ScrimActionType>().GetAllBy(t => t.Code == "PR" && t.PlantID == tpoCProductRollDto.PlantID).FirstOrDefault();

            double actionLength = (double)ConvertUoM(tpoCProductRollDto.Length, tpoCProductRollDto.LengthUoMID, roll.LengthUoMID) / divisor;
            double actionWeight = (double)ConvertUoM(tpoCProductRollDto.Weight, tpoCProductRollDto.WeightUoMID, roll.WeightUoMID) / divisor;

            ScrimAction action = new ScrimAction()
            {
                ActionDate       = now,
                ActionLength     = actionLength,
                ActionReasonText = "Production Entry",
                ActionWeight     = actionWeight,
                DateEntered      = now,
                EndLength        = roll.Length - actionLength,
                EndWeight        = roll.Weight - actionWeight,
                EnteredBy        = tpoCProductRollDto.ModifiedBy,
                FleeceProd       = false,
                LastModified     = now,
                LineID           = tpoCProductRollDto.LineID,
                ModifiedBy       = tpoCProductRollDto.ModifiedBy,
                PlantID          = tpoCProductRollDto.PlantID,
                ReasonID         = null,
                RollID           = null,
                ScrimRollID      = roll.ID,
                ShiftID          = tpoCProductRollDto.ShiftID,
                StartLength      = roll.Length,
                StartWeight      = roll.Weight,
                TypeID           = type.ID
            };

            _repository.Repository <ScrimAction>().Insert(action);
        }
コード例 #2
0
        private int GetNewBatch(IProductEntryDto tpoCProductRollDto, int batchNumber, int formulationID)
        {
            List <TPOCurrentRawMaterial> rmList = _repository.Repository <TPOCurrentRawMaterial>().GetAllBy(r => r.LineID == tpoCProductRollDto.LineID).ToList();

            DateTime now = DateTime.Now;

            foreach (TPOCurrentRawMaterial rm in rmList)
            {
                TPOBatch batch = new TPOBatch()
                {
                    BatchNumber           = batchNumber,
                    DateEntered           = now,
                    EnteredBy             = tpoCProductRollDto.ModifiedBy,
                    FormulationID         = formulationID,
                    IsScrim               = false,
                    LastModified          = now,
                    LineID                = tpoCProductRollDto.LineID,
                    ModifiedBy            = tpoCProductRollDto.ModifiedBy,
                    PlantID               = tpoCProductRollDto.PlantID,
                    RawMaterialID         = rm.RawMaterialReceived.RawMaterialID,
                    RawMaterialReceivedID = rm.RawMaterialReceivedID.Value,
                    ScrimRollID           = null
                };
                _repository.Repository <TPOBatch>().Insert(batch);
            }

            List <TPOCurrentScrim> scrimList = _repository.Repository <TPOCurrentScrim>().GetAllBy(s => s.ProdLineID == tpoCProductRollDto.LineID && s.ScrimPos != "NA").ToList();

            foreach (TPOCurrentScrim scrim in scrimList)
            {
                if (scrim.Scrim1RollID != null)
                {
                    TPOBatch batch = new TPOBatch()
                    {
                        BatchNumber           = batchNumber,
                        DateEntered           = now,
                        EnteredBy             = tpoCProductRollDto.ModifiedBy,
                        FormulationID         = formulationID,
                        IsScrim               = true,
                        LastModified          = now,
                        LineID                = tpoCProductRollDto.LineID,
                        ModifiedBy            = tpoCProductRollDto.ModifiedBy,
                        PlantID               = tpoCProductRollDto.PlantID,
                        ScrimRollID           = scrim.Scrim1RollID.Value,
                        RawMaterialID         = null,
                        RawMaterialReceivedID = null
                    };
                    _repository.Repository <TPOBatch>().Insert(batch);
                }
                if (scrim.Scrim2RollID != null)
                {
                    TPOBatch batch = new TPOBatch()
                    {
                        BatchNumber           = batchNumber,
                        DateEntered           = now,
                        EnteredBy             = tpoCProductRollDto.ModifiedBy,
                        FormulationID         = formulationID,
                        IsScrim               = true,
                        LastModified          = now,
                        LineID                = tpoCProductRollDto.LineID,
                        ModifiedBy            = tpoCProductRollDto.ModifiedBy,
                        PlantID               = tpoCProductRollDto.PlantID,
                        ScrimRollID           = scrim.Scrim2RollID.Value,
                        RawMaterialID         = null,
                        RawMaterialReceivedID = null
                    };
                    _repository.Repository <TPOBatch>().Insert(batch);
                }
            }
            return(batchNumber);
        }