コード例 #1
0
            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));
            }
コード例 #2
0
 public void AssertExpected(LotAttributeDefect defect)
 {
     Assert.AreEqual(Name.ShortName, defect.AttributeShortName);
     Assert.AreEqual(Value, defect.OriginalAttributeValue);
     Assert.AreEqual(Min, defect.OriginalAttributeMinLimit);
     Assert.AreEqual(Max, defect.OriginalAttributeMaxLimit);
     if (Resolution)
     {
         Assert.IsNotNull(defect.LotDefect.Resolution);
     }
     else
     {
         Assert.IsNull(defect.LotDefect.Resolution);
     }
 }
コード例 #3
0
        internal static LotAttributeDefect SetValues(this LotAttributeDefect defect, ILotKey lotKey = null, IAttributeNameKey attributeNameKey = null, DefectTypeEnum?defectType = null, double?value = null, double?rangeMin = null, double?rangeMax = null)
        {
            if (lotKey != null)
            {
                if (defect.LotDefect != null)
                {
                    defect.LotDefect.SetValues(lotKey);
                }

                defect.LotDateCreated  = lotKey.LotKey_DateCreated;
                defect.LotDateSequence = lotKey.LotKey_DateSequence;
                defect.LotTypeId       = lotKey.LotKey_LotTypeId;
            }

            if (attributeNameKey != null)
            {
                defect.AttributeName      = null;
                defect.AttributeShortName = attributeNameKey.AttributeNameKey_ShortName;
            }

            if (defectType != null)
            {
                defect.LotDefect.DefectType = (DefectTypeEnum)defectType;
            }

            if (value != null)
            {
                defect.OriginalAttributeValue = (double)value;
            }

            if (rangeMin != null)
            {
                defect.OriginalAttributeMinLimit = (double)rangeMin;
            }

            if (rangeMax != null)
            {
                defect.OriginalAttributeMaxLimit = (double)rangeMax;
            }

            return(defect);
        }
コード例 #4
0
            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);
                        }
                    }
                }
            }