Ejemplo n.º 1
0
        public Object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;

            FlatBOMItem flatBomItem = (FlatBOMItem)bomItem;
                if (flatBomItem.ValueType.Trim() == subject.Trim())
                {

                    ret = new PartUnit(flatBomItem.PartNoItem,  //Client 檢查FlatBomItem.PartNoItem 
                                                subject,
                                                flatBomItem.Descr,
                                                flatBomItem.Tp,  //Client 檢查flatBomItem.Tp
                                                "",
                                                "",
                                                flatBomItem.CheckItemType);

                }
            return ret;
        }
Ejemplo n.º 2
0
 public object Match(string subject, object bomItem, string station)
 {
     if (subject == null)
     {
         throw new ArgumentNullException();
     }
     if (bomItem == null)
     {
         throw new ArgumentNullException();
     }
     PartUnit ret = null;
     IList<IPart> flat_bom_items = ((IFlatBOMItem)bomItem).AlterParts;
     IPart part = null;
     if (flat_bom_items != null)
     {
         part = flat_bom_items.ElementAt(0);
     }
     
     //长度为10,且以'P' 开头,(前9位为真正的2nd Pizza ID)
     if (subject.Length == 10)
     {
         if (subject[0] == 'P')
         {
             if (part != null)
             {
                 ret = new PartUnit(part.PN, subject.Trim(), part.BOMNodeType, part.Type, string.Empty, part.CustPn, ((IFlatBOMItem)bomItem).CheckItemType);
             }
         }
     }
     return ret;
 }
Ejemplo n.º 3
0
        public Object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;
            if (subject.Length == 14)
            {               
                IList<IPart> flat_bom_items = ((IFlatBOMItem) bomItem).AlterParts;
                IList<KPVendorCode> kpVCList = (IList<KPVendorCode>)((IFlatBOMItem)bomItem).Tag;
                if (kpVCList == null || kpVCList.Count == 0)
                {
                    return ret;
                }
                ICOAStatusRepository coa_repository =
                    RepositoryFactory.GetInstance().GetRepository<ICOAStatusRepository, COAStatus>();
                COAStatus coa_status = coa_repository.GetCoaStatus(subject.Trim());
                //长14
                //在IMES_PAK..COAStatus (COASN)表中不存在
                //前5位与Vendor Code 相同
                //是Office COA
                if (coa_status == null)
                {
                    foreach (IPart flat_bom_item in flat_bom_items)
                    {
                        if (kpVCList.Any(x => x.PartNo == flat_bom_item.PN &&
                                                                                         x.VendorCode.IndexOf(subject.Substring(0, 5)) == 0))
                        {
                            ret = new PartUnit(flat_bom_item.PN, subject.Trim(), flat_bom_item.BOMNodeType, flat_bom_item.Type, string.Empty, flat_bom_item.CustPn, ((IFlatBOMItem)bomItem).CheckItemType);
                            break;
                        }

                        //IList<PartInfo> part_infos = flat_bom_item.Attributes;
                        //foreach (PartInfo part_info in part_infos)
                        //{
                        //    if (part_info.InfoType.Equals("VendorCode"))
                        //    {
                        //        //对于Vendor CT,则遍历Part List 找到存在Vendor Code 属性的记录.
                        //        if (part_info.InfoValue.IndexOf(subject.Substring(0, 5)) == 0)
                        //        {
                        //            ret = new PartUnit(flat_bom_item.PN, subject.Trim(), flat_bom_item.BOMNodeType,flat_bom_item.Type, string.Empty, flat_bom_item.CustPn,((IFlatBOMItem) bomItem).CheckItemType);
                        //            break;
                        //        }
                        //    }
                        //}
                        //if (ret != null)
                        //{
                        //    break;
                        //}
                    }

                }
            }
            return ret;
        }
Ejemplo n.º 4
0
        public Object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;
           // 1)长14
           //2)第一码是“6”

            if (subject.Trim().Length == 14 && subject.Trim().StartsWith("6"))
            {
                IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;

                if (parts != null && parts.Count > 0)
                {
                    IPart part = parts[0];
                   
                    ret = new PartUnit(part.PN, subject.Trim(), part.BOMNodeType, part.Type,
                                                        string.Empty, part.CustPn,
                                                             ((FlatBOMItem)bomItem).CheckItemType);
                  
                }
           
            }
            return ret;
        }
Ejemplo n.º 5
0
        public object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;
            //刷入的AST=Product_Part.PartSN
            //在Product_Part表中找到此Part和Product结合的PartSN(Product_Part.PartID=PartNo and Product_Part.ProductID=ProductID# and Product_Part.BomNodeType='AT')。后半句不属于Filter.

            if (subject.Length == 14)
            {
                IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;
                foreach (IPart part in parts)
                {
                    if (part.PN.Trim().Equals(subject.Trim()))
                    {
                        ret = new PartUnit(part.PN, subject.Trim(), part.BOMNodeType, part.Type, string.Empty, part.CustPn, ((FlatBOMItem)bomItem).CheckItemType);
                    }
                }
            }
            return ret;
        }
Ejemplo n.º 6
0
        public void BindTo(PartUnit part, IPartOwner owner, string station, string editor, string key)
        {
#if DEBUG
            ISaveModule saver = (ISaveModule)GetInstance(_saveModule, typeof(ISaveModule));
#else
            ISaveModule saver = PartSpecialCodeContainer.GetInstance.GetSaveModule(_saveModule);
#endif
            if (saver != null)
            {
                saver.Save(part, owner, station, key);
            }

            if (NeedCommonSave)
            {
                IProductPart newPart = new ProductPart();
                newPart.PartSn = part.Sn;        //sn
                newPart.PartID = part.Pn;       //pn
                newPart.BomNodeType = part.Type; //BomNodeType
                newPart.PartType = part.ValueType; //part.Type
                newPart.CheckItemType = part.ItemType; //CheckItemType
                newPart.CustomerPn = part.CustPn??string.Empty;
                newPart.Iecpn = part.IECPn??string.Empty;
                newPart.Station = station;
                newPart.Editor = editor;
                owner.AddPart(newPart);
            }
        }
Ejemplo n.º 7
0
        public object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;
            
            IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;
			if (parts != null)
			{
				foreach (IPart part in parts)
				{
					if (part.PN.Trim().Equals(subject.Trim()))
					{
						ret = new PartUnit(part.PN, subject.Trim(), part.BOMNodeType, part.Type,string.Empty, part.CustPn,((FlatBOMItem) bomItem).CheckItemType);
						break;
					}
				}
			}
			
            return ret;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 5码 = VendorCode
        /// </summary>
        /// <param name="subject"></param>
        /// <param name="bomItem"></param>
        /// <param name="station"></param>
        /// <returns></returns>
        public object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;

            if (subject.Length != 5)
            {
                return null;
            }
            IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;
            if (parts == null)
            {
                return null;
            }
            foreach (IPart part in parts)
            {
                var vendorCode = part.GetAttribute("VendorCode");
                if (string.Compare(vendorCode, subject) == 0)
                {
                    ret = new PartUnit(part.PN, subject.Trim(), part.BOMNodeType, part.Type, string.Empty, part.CustPn, ((FlatBOMItem)bomItem).CheckItemType);
                    break;
                }
            }
            return ret;
        }
Ejemplo n.º 9
0
        public object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;
            //14码或15码,前5位等于VC
            string vendor_code = "";
            if (subject.Length == 13 || subject.Length == 14 || subject.Length == 15 || subject.Length == 17 || subject.Length == 18 || subject.Length == 23)
            {
                vendor_code = subject;
            }

            if (vendor_code.Length == 13||vendor_code.Length == 14 || vendor_code.Length == 15 || vendor_code.Length == 17 || vendor_code.Length == 18 ||vendor_code.Length==23)
            {
                if (vendor_code.Length == 17)
                {
                    if (vendor_code.Substring(0, 2).CompareTo("SN") == 0)
                    {
                        vendor_code = vendor_code.Substring(2);
                    }
                    else
                    {
                        return null;
                    }
                }
                IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;
                if (parts != null)
                {
                    foreach (IPart part in parts)
                    {
                        IList<PartInfo> part_infos = part.Attributes;
                        if (part_infos != null)
                        {
                            foreach (PartInfo part_info in part_infos)
                            {
                                if (part_info.InfoType.Equals("VendorCode"))
                                {
                                    if (part_info.InfoValue.Trim().Equals(vendor_code.Trim().Substring(0, 5)))
                                    {
                                        ret = new PartUnit(part.PN, vendor_code.Trim(), part.BOMNodeType, part.Type,string.Empty, part.CustPn,((FlatBOMItem) bomItem).CheckItemType);
                                        break;
                                    }
                                }
                            }
                        }
                        if (ret != null)
                        {
                            break;
                        }
                    }
                }
            }
            return ret;
        }
Ejemplo n.º 10
0
        public object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;
            //14码,前5位等于VC
            if (subject.Length == 14 || subject.Length == 18)
            {
                FlatBOMItem item = (FlatBOMItem)bomItem;
                if (item.PartNoItem.Equals(subject.Trim().Substring(0, 5)))
                {
                    if (!item.ValueType.Equals(subject.Trim()))
                    {
                        //need change error Code
                        throw new FisException("FIL005", new string[] { subject });
                    }
                    IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;
                    if (parts != null && parts.Count>0)
                    {
                        ret = new PartUnit(parts[0].PN, subject.Trim(), parts[0].BOMNodeType, parts[0].Type,
                                                          string.Empty, parts[0].CustPn,
                                                          ((FlatBOMItem)bomItem).CheckItemType);
                    }

                } 
            }
            return ret;
        }
Ejemplo n.º 11
0
        public object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }

            if (subject.Trim().Length!=10)
            {           
                return null;
            }

           PartUnit ret = null; 

            IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;
            string  SPSNo = ((FlatBOMItem)bomItem).PartNoItem;
            if (parts != null && parts.Count>0)
            {
                IPart part = parts[0];
                if (SPSNo.Contains (subject.Trim()))
                {
                    ret = new PartUnit(part.PN, subject.Trim(), part.BOMNodeType, part.Type,
                                                    string.Empty, part.CustPn,
                                                         ((FlatBOMItem)bomItem).CheckItemType);
                }
            }
       
            return ret;
        }
Ejemplo n.º 12
0
        public object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }

            if (Is10CharSn(subject) || Is11CharSn(subject))
            {

            }
            else
            {
                return null;
            }

            PartUnit ret = null;
            //MBCode match   MBSNO的前两码
            //if (subject != null)
            //{
                IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;
                if (parts != null)
                {
                    foreach (IPart part in parts)
                    {
                        if (part.BOMNodeType.Trim().Equals("MB"))
                        {
                            IList<PartInfo> part_infos = part.Attributes;
                            if (part_infos != null)
                            {
                                foreach (PartInfo part_info in part_infos)
                                {
                                    if (part_info.InfoType.Trim().Equals("MB"))
                                    {
                                        string mbCode = part_info.InfoValue.Trim();
                                        if (!string.IsNullOrEmpty(mbCode)
                                            && string.Compare(mbCode, 0, subject.Trim(), 0, mbCode.Length) == 0)
                                        {
                                            ret = new PartUnit(part.PN, subject.Trim(), part.BOMNodeType, part.Type,
                                                               string.Empty, part.CustPn,
                                                               ((FlatBOMItem) bomItem).CheckItemType);
                                            break;
                                        }
                                    }
                                }
                            }
                            if (ret != null)
                            {
                                break;
                            }
                        }
                    }
                }
            //}
            return ret;
        }
Ejemplo n.º 13
0
        public object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }

            if (subject.Trim().Length!=10)
            {           
                return null;
            }

           PartUnit ret = null;

           FlatBOMItem flatBomItem = (FlatBOMItem)bomItem;
           string SPSNo = flatBomItem.ValueType;
           if (SPSNo.Contains(subject.Trim()))
           {
               ret = new PartUnit(flatBomItem.PartNoItem,  //Client 檢查FlatBomItem.PartNoItem 
                                           subject,
                                           flatBomItem.Descr,
                                           flatBomItem.Tp,  //Client 檢查flatBomItem.Tp
                                           "",
                                           "",
                                           flatBomItem.CheckItemType);
           }
            return ret;
        }
Ejemplo n.º 14
0
     public object Match(string subject, object bomItem, string station)
     {
         if (subject == null)
         {
             throw new ArgumentNullException();
         }
         if (bomItem == null)
         {
             throw new ArgumentNullException();
         }
         PartUnit ret = null;
         //14码,前5位等于VC
         
         string vendor_code = "";
       //  if (subject.Length == 14)
       // {
             vendor_code = subject;
    //    }
             if (vendor_code.Length < 6)
             {
                 return ret;
             }
 //    if (vendor_code.Length == 14)
    //   {
             IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;
             if (parts != null)
             {
                 foreach (IPart part in parts)
                 {
                     IList<PartInfo> part_infos = part.Attributes;
                     if (part_infos != null)
                     {
                         foreach (PartInfo part_info in part_infos)
                         {
                             if (part_info.InfoType.Equals("VendorCode") && !string.IsNullOrEmpty(part_info.InfoValue))
                             {
                                 int len = part_info.InfoValue.Length;
                                // if (part_info.InfoValue.Trim().Equals(vendor_code.Trim().Substring(0, 5)))
                                 if (vendor_code.Trim().Length>=len && part_info.InfoValue.Trim().Equals(vendor_code.Trim().Substring(0, len)))
                                
                                 {
                                     ret = new PartUnit(part.PN, vendor_code.Trim(), part.BOMNodeType, part.Type, string.Empty, part.CustPn, ((FlatBOMItem)bomItem).CheckItemType);
                                     break;
                                 }
                             }
                         }
                         if (ret != null)
                         {
                             break;
                         }
                     }
                 }
             }
      //  }
             if (ret == null)
             {
                 ret = (PartUnit)MatchPartNo(subject, bomItem, station);
             }
        return ret;
     }
Ejemplo n.º 15
0
        /// <summary>
        /// 12码,由’0123456789ABCDEF’组成
        /// </summary>
        /// <param name="subject">value to be matched</param>
        /// <param name="bomItem">bomItem</param>
        /// <param name="station">station</param>
        /// <returns></returns>
        public object Match(string subject, object bomItem, string station)
        {
            PartUnit ret = null;
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }

            //12码
            if ((subject.Length < 12))
            {
                return null;
            }
            else
            {
                subject = subject.Substring(0, 12);
            }
            //由’123456789ABCDEF’组成
            foreach (char c in subject)
            {
                if(!Pattern.Contains(c.ToString()))
                {
                    return null;
                }
            }

            ret = new PartUnit(((FlatBOMItem)bomItem).PartNoItem, subject.Trim(), "MAC", "MAC",
                               string.Empty, string.Empty,
                               ((FlatBOMItem)bomItem).CheckItemType);
            return ret;
        }
Ejemplo n.º 16
0
 public Object Match(string subject, object bomItem, string station)
 {
     if (subject == null)
     {
         throw new ArgumentNullException();
     }
     if (bomItem == null)
     {
         throw new ArgumentNullException();
     }
     PartUnit ret = null;
     IList<IPart> flat_bom_items = ((IFlatBOMItem)bomItem).AlterParts;
     if (flat_bom_items != null)
     {
         foreach (IPart flat_bom_item in flat_bom_items)
         {
             if (flat_bom_item.PN.Trim().Equals(subject.Trim()))
             {
                 ret = new PartUnit(subject.Trim(), string.Empty, flat_bom_item.BOMNodeType, flat_bom_item.Type,
                                    "", flat_bom_item.CustPn, ((IFlatBOMItem)bomItem).CheckItemType);
             }
         }
     }
     return ret;
 }
Ejemplo n.º 17
0
        public object Match(string subject, object bomItem, string station)
        {
            //Input=Pn
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;
            IList<IPart> flat_bom_items = ((IFlatBOMItem)bomItem).AlterParts;

            if (12 == subject.Trim().Length)
            {
                if (subject.Substring(0,2).Equals("CN") || subject.Substring(0,2).Equals("7E"))
                {
                    IPart part = null;
                    if (flat_bom_items != null)
                    {
                        part = flat_bom_items.ElementAt(0);
                    }
                    if (part != null)
                    {
                        ret = new PartUnit(part.PN, subject.Trim(), part.BOMNodeType, part.Type, string.Empty, part.CustPn, ((IFlatBOMItem)bomItem).CheckItemType);    
                    }
                }
            }

            return ret;
        }
Ejemplo n.º 18
0
        public Object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;
            IList<IPart> flat_bom_items = ((IFlatBOMItem)bomItem).AlterParts;
            //3.	若@Data 长度为14位,以'HPNB' 开头,则用户刷入的数据为CN Card No – 即前文的Home Card

            if (14 == subject.Trim().Length)
            {
                if (subject.Contains("HPNB") && subject.IndexOf("HPNB") == 0)
                {
                    IPart part = null;
                    if (flat_bom_items != null)
                    {
                        part = flat_bom_items.ElementAt(0);
                    }
                    if (part != null)
                    {
                        ret = new PartUnit(part.PN.Trim(), subject.Trim(), part.BOMNodeType, part.Type, string.Empty, part.CustPn, ((IFlatBOMItem)bomItem).CheckItemType);    
                    }
                }
            }

            return ret;
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 长14,前5位与Vendor Code 相同
        /// </summary>
        /// <param name="subject">value to be matched</param>
        /// <param name="bomItem">bomItem</param>
        /// <param name="station">station</param>
        /// <returns></returns>
        public object Match(string subject, object bomItem, string station)
        {
            PartUnit ret = null;
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }

            if (!string.IsNullOrEmpty(subject)
                && subject.Length == 14)
            {
            }
            else
            {
                return null;
            }
            string prefix = subject.Substring(0, 5);

            IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;
            if (parts == null)
            {
                return null;
            }

            IList<KPVendorCode> kpVCList = (IList<KPVendorCode>)((IFlatBOMItem)bomItem).Tag;
            if (kpVCList == null)
            {
                return ret;
            }

            foreach (IPart part in parts)
            {
                //string vcString = part.GetAttribute(VendorCodePropertyName);
                string vcString = kpVCList.Where(x => x.PartNo == part.PN)
                                                        .Select(x=>x.VendorCode)
                                                        .FirstOrDefault();
                if (string.IsNullOrEmpty(vcString))
                {
                    continue;
                }

                string[] vendorCodes = vcString.Split(',');
                foreach (string vc in vendorCodes)
                {
                    if (string.Compare(vc, prefix) == 0)
                    {
                        ret = new PartUnit(part.PN, subject.Trim(), part.BOMNodeType, part.Type,
                                           string.Empty, part.CustPn,
                                           ((FlatBOMItem)bomItem).CheckItemType);
                        return ret;
                    }
                }
            }
            return null;
        }
Ejemplo n.º 20
0
        public object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;
            string vendor_code = "";
            //            1)如为14码,前5位等于VC
            //2)如大于90码  从77码开始取14码,取得的14吗的前5位等于VC
            if (subject.Length == 14 || subject.Length == 18)
            {
                vendor_code = subject;
            }
            if (subject.Length > 90)
            {
                vendor_code = subject.Substring(76,14);
            }
            if (subject.Length > 50 && subject.Length <90)//总长度60位.CT码从27位开始截取14码 
            {
                vendor_code = subject.Substring(26, 14);
            }

            if (vendor_code.Length == 14 || vendor_code.Length == 18)
            {
                IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;
                if (parts != null)
                {
                    foreach (IPart part in parts)
                    {
                        IList<PartInfo> part_infos = part.Attributes;
                        if (part_infos != null)
                        {
                            foreach (PartInfo part_info in part_infos)
                            {
                                if (part_info.InfoType.Equals("VendorCode"))
                                {
                                    if (part_info.InfoValue.Trim().Contains(vendor_code.Trim().Substring(0, 5)))
                                    {
                                        ret = new PartUnit(part.PN, vendor_code.Trim(), part.BOMNodeType, part.Type,string.Empty, part.CustPn,((FlatBOMItem) bomItem).CheckItemType);
                                        break;
                                    }
                                }
                            }
                        }
                        if (ret != null)
                        {
                            break;
                        }
                    }
                }
            }
            return ret;
        }
Ejemplo n.º 21
0
        public Object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
        
            List<string> pnLst = new List<string>();
            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            IProduct partProduct=null;
            PartUnit ret = null;
            partProduct = productRepository.Find(subject);
       
            if (partProduct == null)
            { return ret; }
            var bomRepository = RepositoryFactory.GetInstance().GetRepository<IBOMRepository>();
            IHierarchicalBOM hirBom=  bomRepository.GetHierarchicalBOMByModel(partProduct.Model);
           if (hirBom.FirstLevelNodes != null)
          {
              for (int i = 0; i < hirBom.FirstLevelNodes.Count; i++)
              {

                  IPart part = ((BOMNode)hirBom.FirstLevelNodes.ElementAt(i)).Part;
                  if (part.BOMNodeType == "PL" && part.Descr.Equals("Clean Room"))
                  { pnLst.Add(part.PN); }
              }
          
          }
          else
        { return ret; }
         if (pnLst.Count > 0)
          {
              IList<IPart> flat_bom_items = ((IFlatBOMItem)bomItem).AlterParts;
              if (partProduct != null && flat_bom_items != null)
              {
                  foreach (IPart flat_bom_item in flat_bom_items)
                  {
                      if (pnLst.Contains(flat_bom_item.PN.Trim()))
                      {
                          ret = new PartUnit(flat_bom_item.PN.Trim(), subject.Trim(), flat_bom_item.BOMNodeType, flat_bom_item.Type,
                                             "", "", ((IFlatBOMItem)bomItem).CheckItemType);
                      }
                  }
              }
          
          }
          
            //if (ret == null && partProduct!=null)
            //{
            //    throw new FisException("CHK1016", new string[] { subject, partProduct.Model });
            //}
            return ret;
        }
Ejemplo n.º 22
0
        public object Match(string subject, object bomItem, string station)
        {

            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;
			
			if (subject.Length >= 90)
			{
                // 取第77位(含)後的13位
                subject = subject.Substring(76, 13);
			}
			
            //前5位等于VC
            if (subject.Length == 13 || subject.Length == 12 || subject.Length == 14)
            {
                IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;
                if (parts != null)
                {
                    foreach (IPart part in parts)
                    {
                        //IList<PartInfo> part_infos = part.Attributes;
                        //if (part_infos != null)
                        //{
                            //foreach (PartInfo part_info in part_infos)
                            //{
                                //if (part_info.InfoType.Equals("VendorCode"))
                                //{
                                //    if (part_info.InfoValue.Trim().Equals(subject.Trim().Substring(0, 5)))
                                //    {
                                        ret = new PartUnit(part.PN, subject.Trim(), part.BOMNodeType, part.Type,
                                                           string.Empty, part.CustPn,
                                                           ((FlatBOMItem)bomItem).CheckItemType);
                                        break;
                                //    }
                                //}
                            //}
                        //}
                        //if (ret != null)
                        //{
                        //    break;
                        //}
                    }
                }
            }
            return ret;
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 10/11码,第5码为’M’,刷入数据的前2码为MBCode
        /// </summary>
        /// <param name="subject">value to be matched</param>
        /// <param name="bomItem">bomItem</param>
        /// <param name="station">station</param>
        /// <returns></returns>
        public object Match(string subject, object bomItem, string station)
        {
            PartUnit ret = null;
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }

            //10/11码,第5码为’M’,刷入数据的前2码为MBCode;
            //支持11码不带校验位的MB, 第6码为’M’,刷入数据的前3码为MBCode            
            if (Is10CharSn(subject) || Is11CharSn(subject))
            {
                
            }
            else
            {
                return null;
            }


            //刷入数据的前2/3码为MBCode
            IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;
            if (parts != null)
            {
                IList<KPVendorCode> kpVCList = (IList<KPVendorCode>)((IFlatBOMItem)bomItem).Tag;
                if (kpVCList == null)
                {
                    return ret;
                }
                foreach (IPart part in parts)
                {
                    if (part.BOMNodeType.Trim().Equals("MB"))
                    {
                        //string mbCode = part.GetAttribute("MB");
                        string mbCode = kpVCList.Where(x => x.PartNo == part.PN)
                                                                .Select(x => x.VendorCode).FirstOrDefault();
                        if (MatchMBCode(subject, mbCode))
                        {
                            ret = new PartUnit(part.PN, subject.Trim(), 
                                                part.BOMNodeType, part.Type,
                                                string.Empty, part.CustPn,
                                                ((FlatBOMItem)bomItem).CheckItemType);
                            break;
                        }
                    }
                }
            }
            return ret;
        }
Ejemplo n.º 24
0
        public Object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;
            FlatBOMItem flatBomItem = (FlatBOMItem)bomItem;
            if (flatBomItem.CheckItemTypeRuleList != null &&
                flatBomItem.CheckItemTypeRuleList.Count > 0)
            {
                CheckItemTypeRuleDef ruleInfo = flatBomItem.CheckItemTypeRuleList[0];

                UtilityCommonImpl utl = UtilityCommonImpl.GetInstance();
                var filterMatchRule = utl.FilterMatchRule;
                if (string.IsNullOrEmpty(ruleInfo.MatchRule))
                {
                    if (subject == flatBomItem.ValueType)
                    {
                        ret = new PartUnit(flatBomItem.PartNoItem,  //Client 檢查FlatBomItem.PartNoItem 
                                                              subject,
                                                              flatBomItem.Descr,
                                                              flatBomItem.Tp,  //Client 檢查flatBomItem.Tp
                                                              string.Empty,
                                                              string.Empty,
                                                              flatBomItem.CheckItemType);
                    }
                }              
                else
                {
                    if (filterMatchRule.CheckSubjectByRegexGroup(ruleInfo, subject, flatBomItem.ValueType,
                                                                   ruleInfo.MatchRuleGroupNames==null || ruleInfo.MatchRuleGroupNames.Count == 0 ? null : ruleInfo.MatchRuleGroupNames.First().Key))
                    {
                        ret = new PartUnit(flatBomItem.PartNoItem,  //Client 檢查FlatBomItem.PartNoItem 
                                                               subject,
                                                               flatBomItem.Descr,
                                                               flatBomItem.Tp,  //Client 檢查flatBomItem.Tp
                                                               string.Empty,
                                                               string.Empty,
                                                               flatBomItem.CheckItemType);
                    }
                }
            }
            return ret;
        }
Ejemplo n.º 25
0
        public Object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;

            if (subject.Length >= 20)
                subject = subject.Substring(subject.Length - 14, 14);
            
            //前5位等于VC
            if (subject.Length >= 5)
            {
                IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;
                if (parts != null)
                {
                    foreach (IPart part in parts)
                    {
                        IList<PartInfo> part_infos = part.Attributes;
                        if (part_infos != null)
                        {
                            foreach (PartInfo part_info in part_infos)
                            {
                                if (part_info.InfoType.Equals("VendorCode"))
                                {
                                    if (part_info.InfoValue.Trim().Equals(subject.Trim().Substring(0, 5)))
                                    {
                                        ret = new PartUnit(part.PN, subject.Trim(), part.BOMNodeType, part.Type,
                                                           string.Empty, part.CustPn,
                                                           ((FlatBOMItem) bomItem).CheckItemType);
                                        break;
                                    }
                                }
                            }
                        }
                        if (ret != null)
                        {
                            break;
                        }
                    }
                }
            }
            return ret;
        }
Ejemplo n.º 26
0
 public object Match(string subject, object bomItem, string station)
 {
     if (subject == null)
     {
         throw new ArgumentNullException();
     }
     if (bomItem == null)
     {
         throw new ArgumentNullException();
     }
     PartUnit ret = null;
     //MBCode match   MBSNO的前两码
     //if (subject != null)
     //{
         IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;
         if (parts != null)
         {
             foreach (IPart part in parts)
             {
                 if (part.BOMNodeType.Trim().Equals("MB"))
                 {
                     IList<PartInfo> part_infos = part.Attributes;
                     if (part_infos != null)
                     {
                         foreach (PartInfo part_info in part_infos)
                         {
                             if (part_info.InfoType.Trim().Equals("MB"))
                             {
                                 if (part_info.InfoValue.Trim().Equals(subject.Trim().Substring(0,2)))
                                 {
                                     ret = new PartUnit(part.PN, subject.Trim(), part.BOMNodeType, part.Type,
                                                        string.Empty, part.CustPn,
                                                        ((FlatBOMItem) bomItem).CheckItemType);
                                     break;
                                 }
                             }
                         }
                     }
                     if (ret != null)
                     {
                         break;
                     }
                 }
             }
         //}
     }
     return ret;
 }
Ejemplo n.º 27
0
        public object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;
            string ct = "";
            IList<IPart> parts = ((FlatBOMItem)bomItem).AlterParts;
            if (parts != null)
            {
                IList<KPVendorCode> kpVCList = (IList<KPVendorCode>)((IFlatBOMItem)bomItem).Tag;
                if (kpVCList == null)
                {
                    return ret;
                }

                foreach (IPart part in parts)
                {
                    if (kpVCList.Any(x => x.PartNo == part.PN &&
                                                      x.VendorCode==subject))
                    {
                        ret = new PartUnit(part.PN, subject, part.BOMNodeType, part.Type, string.Empty, part.CustPn, ((FlatBOMItem)bomItem).CheckItemType);
                        break;
                    }

                  //IList<string> lstCtKey = part.Attributes.Where(x => x.InfoType == "CT_KEY").Select(x => x.InfoValue).ToList();
                  //if (lstCtKey.Count > 0 && lstCtKey[0].Equals(subject))
                  //{
                  //     ret = new PartUnit(part.PN, subject, part.BOMNodeType, part.Type, string.Empty, part.CustPn, ((FlatBOMItem)bomItem).CheckItemType);
                   
                  // }
                  //  if (ret != null)
                  //  {
                  //      break;
                  //  }
                }
            }


            return ret;
        }
Ejemplo n.º 28
0
        public Object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;
            if (subject.Length == 14)
            {
                IList<IPart> flat_bom_items = ((IFlatBOMItem)bomItem).AlterParts;
                if (flat_bom_items != null)
                {
                    foreach (IPart flat_bom_item in flat_bom_items)
                    {
                        IList<PartInfo> part_infos = flat_bom_item.Attributes;
                        foreach (PartInfo part_info in part_infos)
                        {
                            if (part_info.InfoType.Equals("VendorCode"))
                            {
                                //对于Vendor CT,则遍历Part List 找到存在Vendor Code 属性的记录.
                                if (part_info.InfoValue.IndexOf(subject.Substring(0, 5)) == 0)
                                {
                                    ret = new PartUnit(flat_bom_item.PN, subject.Trim(), flat_bom_item.BOMNodeType, flat_bom_item.Type, string.Empty, flat_bom_item.CustPn, ((IFlatBOMItem)bomItem).CheckItemType);
                                    break;
                                }
                            }
                        }
                        if (ret != null)
                        {
                            break;
                        }
                    }

                }
            }
            if (ret == null)
            {
                ret = (PartUnit)MatchPartNo(subject, bomItem, station);
            }
           return ret;
        }
Ejemplo n.º 29
0
        public Object Match(string subject, object bomItem, string station)
        {
            if (subject == null)
            {
                throw new ArgumentNullException();
            }
            if (bomItem == null)
            {
                throw new ArgumentNullException();
            }
            PartUnit ret = null;
            IList<IPart> flat_bom_items = ((IFlatBOMItem)bomItem).AlterParts;
            IPart part = null;
            if (flat_bom_items != null)
            {
                part = flat_bom_items.ElementAt(0);    
            }
            
            //若@Data 长度为10位,并且第7位是字符'V' |'W' | 'X' | 'Y' | 'Z',则用户刷入的为Docking S/N
            if (10 == subject.Length)
            {
                if (subject[6] == 'V' || subject[6] == 'W' || subject[6] == 'X' || subject[6] == 'Y' || subject[6] == 'Z')
                {
                    if (part != null)
                    {
                        //Copy 上海0002244: Combine Pizza页面修改(結合多個 Docking Case)

                        IProductRepository productRepository =
                       RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

                        DataTable tb2 = productRepository.ExecSpForQuery(SqlHelper.ConnectionString_PAK, "PC_CombinePizzaforCheckDockingSn",
                                                                                                        new[] { new SqlParameter("DockingSn", subject), 
                                                                                                                   new SqlParameter("DockingPn", part.PN) });
                        if (tb2 != null && tb2.Rows.Count > 0)
                        {
                            ret = new PartUnit(part.PN, subject.Trim(), part.BOMNodeType, part.Type, string.Empty, part.CustPn, ((IFlatBOMItem)bomItem).CheckItemType);
                        }

                        //ret = new PartUnit(part.PN, subject.Trim(), part.BOMNodeType, part.Type, string.Empty, part.CustPn, ((IFlatBOMItem)bomItem).CheckItemType);
                    }
                }
            }

            return ret;
        }
Ejemplo n.º 30
0
 public Object Match(string subject, object bomItem, string station)
 {
     if (subject == null)
     {
         throw new ArgumentNullException();
     }
     if (bomItem == null)
     {
         throw new ArgumentNullException();
     }
     PartUnit ret = null;
     if (subject.Length == 13)
     {
              IList<IPart> flat_bom_items = ((IFlatBOMItem) bomItem).AlterParts;
              foreach (IPart flat_bom_item in flat_bom_items)
              {
                  if (flat_bom_item.BOMNodeType.Equals("P1"))
                  {
                      IList<PartInfo> part_infos = flat_bom_item.Attributes;
                      if (part_infos != null)
                      {
                          foreach (PartInfo part_info in part_infos)
                          {
                              if (part_info.InfoType.Trim().Equals("DESC"))
                              {
                                  if (part_info.InfoValue.Trim().Equals("OOB"))
                                  {
                                      foreach (PartInfo part_infoiec in part_infos)
                                          if (part_infoiec.InfoType.Trim().Equals("IEC") && part_infoiec.InfoValue.Trim() == subject.Trim())
                                      {
                                          ret = new PartUnit(flat_bom_item.PN, subject.Trim(), flat_bom_item.BOMNodeType, flat_bom_item.Type,
                                                                            string.Empty, flat_bom_item.CustPn, ((IFlatBOMItem)bomItem).CheckItemType);
                                          break;
                                      }
                                  }
                              }
                          }//foreach (PartInfo part_info in part_infos)
                      }// if (part_infos != null)
                  }
              }     
         }
      
     return ret;
 }