예제 #1
0
파일: Uti.cs 프로젝트: wra222/testgit
 static public bool CheckCPUOnBoard(HierarchicalBOM bom)
 {
     string mbcode = "";
     string mbFamily = "";
     if (bom.FirstLevelNodes != null)
     {
         for (int i = 0; i < bom.FirstLevelNodes.Count; i++)
         {
             if (bom.FirstLevelNodes.ElementAt(i).Part.BOMNodeType.Equals("MB"))
             {
                 foreach (PartInfo pi in bom.FirstLevelNodes.ElementAt(i).Part.Attributes)
                 {
                     if ("MB".Equals(pi.InfoType))
                     {
                         mbcode = pi.InfoValue;
                         break;
                     }
                 }
                 mbFamily = bom.FirstLevelNodes.ElementAt(i).Part.Descr;
                 break;
             }
         }
     }
     return
          mbcode != "" && Uti.CheckCPUOnBoard("MBCode", mbcode)|| 
          mbFamily != "" && Uti.CheckCPUOnBoard("Family", mbFamily);
  }
예제 #2
0
        private IHierarchicalBOM GetHierarchicalBOMByModel_DB(string model)
        {
            try
            {
                IHierarchicalBOM ret = null;

                //IPart rootPart = PrtRepository.Find(model);
                IPart rootPart = null;

                IBOMNode root = new BOMNode(rootPart, 1);
                ret = new HierarchicalBOM(root);
                IDictionary<int, IList<IPart>> allPartList = new Dictionary<int, IList<IPart>>();
                IList<IBOMNode> allNodes = new List<IBOMNode>();
                ret.Nodes = allNodes;
                ret.Model = model;
                //IList<MoBOMInfo> rootChildren = GetChildrenInModelBOM(model);
                IList<ModelBOM> modelBOMList = GetModelBOM(model);
                var rootChildren = modelBOMList.Where(x => x.Level == 1 && x.Flag == 1).ToList();
                if (rootChildren != null && rootChildren.Count > 0)
                {
                    var partNoList = rootChildren.Select(x => x.Component).Distinct().ToList();
                    IList<IPart> rootPartList = PrtRepository.FindPart(partNoList);
                    allPartList.Add(1, rootPartList);
                    foreach (ModelBOM childItem in rootChildren)
                    {
                        //IPart nodePart = PrtRepository.Find(childItem.Component);
                        IPart nodePart = rootPartList.Where(x => x != null && x.PN == childItem.Component).FirstOrDefault();
                        if (nodePart != null)
                        {
                            IBOMNode newNode = new BOMNode(nodePart, int.Parse(childItem.Quantity), childItem.Alternative_item_group);
                            root.AddChild(newNode);
                            allNodes.Add(newNode);

                            int iDeepLimit = 20;
                            try
                            {
                                RecursivelyConstructHierarchicalBOM(newNode, childItem, allNodes, modelBOMList, iDeepLimit - 1, 2, allPartList);
                            }
                            catch (FisException fex)
                            {
                                if (fex.mErrcode == "BOML01")
                                {
                                    throw new FisException("BOML01", new string[] { iDeepLimit.ToString(), model });
                                }
                            }

                        }
                    }
                }

                return ret;
            }
            catch (Exception)
            {
                throw;
            }
        }