private void ReconcileInHouseContaminationDefects(LotDTO oldLot, Lot newLot)
            {
                string description = null;

                switch (oldLot.LotStat)
                {
                case LotStat.See_Desc:
                    description = string.IsNullOrEmpty(oldLot.Notes) ? "Reason Unspecified" : oldLot.Notes;
                    break;

                case LotStat.Dark_Specs:
                case LotStat.Smoke_Cont:
                case LotStat.Hard_BBs:
                case LotStat.Soft_BBs:
                    description = _lotStatusDescriptions[oldLot.LotStat.Value];
                    break;
                }

                if (description != null)
                {
                    LotMother.AddRead(EntityTypes.LotDefect);
                    if (!newLot.LotDefects.Any(d => d.DefectType == DefectTypeEnum.InHouseContamination && d.Resolution == null && d.Description == description))
                    {
                        newLot.AddNewDefect(DefectTypeEnum.InHouseContamination, description);
                    }
                }
            }
            private void CreateOrUpdateOpenAttributeDefect(Lot lot, AttributeName attribute, double value, IAttributeRange range, ref List <LotAttributeDefect> lotAttributeDefects)
            {
                var nameKey         = attribute.ToAttributeNameKey();
                var attributeDefect = lotAttributeDefects.FirstOrDefault(d => d.LotDefect.Resolution == null && nameKey.Equals(d));

                if (attributeDefect == null)
                {
                    var newDefect = lot.AddNewDefect(attribute.DefectType, attribute.Name);
                    attributeDefect = new LotAttributeDefect
                    {
                        LotDateCreated     = lot.LotDateCreated,
                        LotDateSequence    = lot.LotDateSequence,
                        LotTypeId          = lot.LotTypeId,
                        DefectId           = newDefect.DefectId,
                        LotDefect          = newDefect,
                        AttributeShortName = nameKey.AttributeNameKey_ShortName
                    };
                    lotAttributeDefects.Add(attributeDefect);
                }

                attributeDefect.OriginalAttributeValue    = value;
                attributeDefect.OriginalAttributeMinLimit = range.RangeMin;
                attributeDefect.OriginalAttributeMaxLimit = range.RangeMax;

                CloseOpenAttributeDefects(nameKey, lotAttributeDefects.Where(a => a != attributeDefect));
            }
 private void AddInHouseContaminationDefect(LotDTO oldLot, Lot newLot)
 {
     if (oldLot.LotStat.IsInHouseContamination())
     {
         LotMother.AddRead(EntityTypes.LotDefect);
         newLot.AddNewDefect(DefectTypeEnum.InHouseContamination, _lotStatusDescriptions[oldLot.LotStat.Value]);
     }
 }
示例#4
0
        protected Lot CreateLot(out List <LotAttributeDefect> lotAttributeDefects, Defects defects = null, Attributes attributes = null)
        {
            lotAttributeDefects = new List <LotAttributeDefect>();
            var lot = new Lot
            {
                LotDefects = new List <LotDefect>(),
                Attributes = (attributes ?? new Attributes()).Where(a => a.Value != null).Select(a => new LotAttribute
                {
                    AttributeShortName = a.NameKey.AttributeNameKey_ShortName,
                    AttributeValue     = a.Value.Value
                }).ToList()
            };

            foreach (var defect in defects ?? new Defects())
            {
                LotDefect lotDefect;
                if (defect.Name != null)
                {
                    lotDefect = lot.AddNewDefect(defect.Name.DefectType, defect.Name.Name);
                    lotAttributeDefects.Add(new LotAttributeDefect
                    {
                        AttributeShortName        = defect.Name.ShortName,
                        DefectId                  = lotDefect.DefectId,
                        OriginalAttributeValue    = defect.Value,
                        OriginalAttributeMinLimit = defect.Min,
                        OriginalAttributeMaxLimit = defect.Max
                    });
                }
                else
                {
                    lotDefect = lot.AddNewDefect(defect.DefectType, defect.Description);
                }

                if (defect.Resolution)
                {
                    lotDefect.Resolution = new LotDefectResolution
                    {
                        ResolutionType = ResolutionTypeEnum.DataEntryCorrection,
                        Description    = "resolution"
                    };
                }
            }

            return(lot);
        }
            private void AddLotAttributeDefects(Lot newLot, ChileProduct chileProduct, DefectTypeEnum defectType, ref List <LotAttributeDefect> lotAttributeDefects)
            {
                var defectAttributes  = LotMother.AttributeNames.Values.Where(a => a.DefectType == defectType);
                var chileProductSpecs = chileProduct.ProductAttributeRanges.Join(defectAttributes,
                                                                                 r => r.AttributeShortName,
                                                                                 a => a.ShortName,
                                                                                 (r, a) => new { Range = r, Attribute = a }).ToList();

                foreach (var productSpec in chileProductSpecs)
                {
                    var attributeRange = productSpec.Range;
                    var attribute      = productSpec.Attribute;
                    var lotAttribute   = newLot.Attributes.FirstOrDefault(a => a.AttributeShortName == attributeRange.AttributeShortName);
                    if (lotAttribute != null)
                    {
                        if (attributeRange.ValueOutOfRange(lotAttribute.AttributeValue))
                        {
                            LotMother.AddRead(EntityTypes.LotDefect);
                            LotMother.AddRead(EntityTypes.LotAttributeDefect);

                            var lotDefect = newLot.AddNewDefect(defectType, attribute.Name);

                            var lotAttributeDefect = new LotAttributeDefect
                            {
                                LotDateCreated            = lotDefect.LotDateCreated,
                                LotDateSequence           = lotDefect.LotDateSequence,
                                LotTypeId                 = lotDefect.LotTypeId,
                                DefectId                  = lotDefect.DefectId,
                                AttributeShortName        = attribute.ShortName,
                                LotDefect                 = lotDefect,
                                OriginalAttributeValue    = lotAttribute.AttributeValue,
                                OriginalAttributeMinLimit = attributeRange.RangeMin,
                                OriginalAttributeMaxLimit = attributeRange.RangeMax
                            };

                            lotAttributeDefects.Add(lotAttributeDefect);
                        }
                    }
                }
            }