public IFlatBOM FilterBOM(IHierarchicalBOM hierarchicalBOM, string station, object mainObject) { IFlatBOM ret = null; #if DEBUG IFilterModule filter = (IFilterModule)GetInstance(_filterModule, typeof(IFilterModule)); #else IFilterModule filter = PartSpecialCodeContainer.GetInstance.GetFilterModule(_filterModule); #endif if (filter != null) { ret = (IFlatBOM) filter.FilterBOM(hierarchicalBOM, station, mainObject); } else { #if DEBUG IFilterModuleEx filterEx = (IFilterModuleEx)GetInstance(_filterModule, typeof(IFilterModuleEx)); #else IFilterModuleEx filterEx = PartSpecialCodeContainer.GetInstance.GetFilterModuleEx(_filterModule); #endif if (filterEx != null) { ret = (IFlatBOM)filterEx.FilterBOMEx(hierarchicalBOM, station, _partCheckType,mainObject); } } return ret; }
public List<PNQty> GetPNQty(string type, IHierarchicalBOM GivenBom) { List<PNQty> result = new List<PNQty>(); IList<IBOMNode> SearchBOMNodes = new List<IBOMNode>(); switch (type) { case "WWAN": SearchBOMNodes = GivenBom.FirstLevelNodes.Where(bomNode => BMP1KPType.Contains<string>(bomNode.Part.BOMNodeType) && bomNode.Part.Descr.StartsWith("WWAN")).ToList(); return GetPNQtyBMP1(SearchBOMNodes); case "WL": SearchBOMNodes = GivenBom.FirstLevelNodes.Where(bomNode => BMP1KPType.Contains<string>(bomNode.Part.BOMNodeType) && bomNode.Part.Descr.StartsWith("WIRELESS")).ToList(); return GetPNQtyBMP1(SearchBOMNodes); case "HDD": SearchBOMNodes = GivenBom.FirstLevelNodes.Where(bomNode => BMP1KPType.Contains<string>(bomNode.Part.BOMNodeType) && bomNode.Part.Descr.StartsWith("HDD")).ToList(); return GetPNQtyBMP1(SearchBOMNodes); case "DDR": SearchBOMNodes = GivenBom.FirstLevelNodes.Where(bomNode => BMP1KPType.Contains<string>(bomNode.Part.BOMNodeType) && (bomNode.Part.Descr.Contains("MEM") || bomNode.Part.Descr.Contains("RAM"))).ToList(); return GetPNQtyBMP1(SearchBOMNodes); case "CPU": SearchBOMNodes = GivenBom.FirstLevelNodes.Where(bomNode => bomNode.Part.BOMNodeType == "BM" && bomNode.Part.Descr.Contains("CPU")).ToList(); return GetPNQtyBM(SearchBOMNodes); case "LCM": SearchBOMNodes = GivenBom.FirstLevelNodes.Where(bomNode => BMP1KPType.Contains<string>(bomNode.Part.BOMNodeType) && bomNode.Part.Descr.StartsWith("LCM")).ToList(); return GetPNQtyBMP1(SearchBOMNodes); case "BAT": SearchBOMNodes = GivenBom.FirstLevelNodes.Where(bomNode => VKC4Type.Contains<string>(bomNode.Part.BOMNodeType)).ToList(); return GetPNQtyBAT(SearchBOMNodes); case "KB": SearchBOMNodes = GivenBom.FirstLevelNodes.Where(bomNode => BMP1KPType.Contains<string>(bomNode.Part.BOMNodeType) && (bomNode.Part.Descr.Contains("KB") || bomNode.Part.Descr.Contains("K/B"))).ToList(); return GetPNQtyBMP1(SearchBOMNodes); case "ODD": SearchBOMNodes = GivenBom.FirstLevelNodes.Where(bomNode => BMP1KPType.Contains<string>(bomNode.Part.BOMNodeType) && (bomNode.Part.Descr.StartsWith("DVD") || bomNode.Part.Descr.StartsWith("CD") || bomNode.Part.Descr.StartsWith("ODD") || bomNode.Part.Descr.StartsWith("COMBO") || bomNode.Part.Descr.StartsWith("VCD"))).ToList(); return GetPNQtyBMP1(SearchBOMNodes); case "Inverter": SearchBOMNodes = GivenBom.FirstLevelNodes.Where(bomNode => bomNode.Part.BOMNodeType == "PL" && bomNode.Part.Descr.Contains("Inverter")).ToList(); return GetPNQtyPL(SearchBOMNodes); case "TPDL": SearchBOMNodes = GivenBom.FirstLevelNodes.Where(bomNode => bomNode.Part.BOMNodeType == "PL" && bomNode.Part.Descr == "JGS" && bomNode.Part.GetAttribute("Descr") == "TPDL").ToList(); return GetPNQtyPL(SearchBOMNodes); case "BTDL": SearchBOMNodes = GivenBom.FirstLevelNodes.Where(bomNode => bomNode.Part.BOMNodeType == "PL" && bomNode.Part.Descr == "JGS" && bomNode.Part.GetAttribute("Descr") == "BTDL").ToList(); return GetPNQtyPL(SearchBOMNodes); case "TPCB": SearchBOMNodes = GivenBom.FirstLevelNodes.Where(bomNode => bomNode.Part.BOMNodeType == "PL" && bomNode.Part.Descr == "JGS" && bomNode.Part.GetAttribute("Descr") == "TPCB").ToList(); return GetPNQtyPL(SearchBOMNodes); case "BTCB": SearchBOMNodes = GivenBom.FirstLevelNodes.Where(bomNode => bomNode.Part.BOMNodeType == "PL" && bomNode.Part.Descr == "JGS" && bomNode.Part.GetAttribute("Descr") == "BTCB").ToList(); return GetPNQtyPL(SearchBOMNodes); case "TPCB2": SearchBOMNodes = GivenBom.FirstLevelNodes.Where(bomNode => bomNode.Part.BOMNodeType == "PL" && bomNode.Part.Descr == "JGS" && bomNode.Part.GetAttribute("Descr") == "TPCB2" && bomNode.Part.PN.StartsWith("151")).ToList(); return GetPNQtyPL(SearchBOMNodes); default: break; } return result; }
private string GetImageSrc(IHierarchicalBOM bom,string[] ASTDescr) { string imageUrl = ""; IList<string> PNList = new List<string>(); for (int i = 0; i < bom.FirstLevelNodes.Count; i++) { IPart part6 = ((BOMNode)bom.FirstLevelNodes.ElementAt(i)).Part; if ((part6.BOMNodeType == "PP") || ((part6.BOMNodeType == "AT") && (ASTDescr.Contains(part6.Descr)))) { PNList.Add(part6.PN); } } if ((PNList != null) || (PNList.Count == 0)) { for (int i = 1; i < PNList.Count; i++) { string t = PNList[i]; int j = i; while ((j > 0) && string.Compare(PNList[j - 1], t, false) > 0) { PNList[j] = PNList[j - 1]; --j; } PNList[j] = t; } } foreach (string pn2 in PNList) { imageUrl += pn2.Trim(); } return imageUrl; }
private IList<IBOMNode> GetBOMNodes(string[] bomNodeType, IHierarchicalBOM GivenBom) { return GivenBom.FirstLevelNodes.Where(bomNode => bomNodeType.Contains<string>(bomNode.Part.BOMNodeType)).ToList(); }
private bool checkCleanRoomModel(IHierarchicalBOM curBOM,string station) { bool ret = false; IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository>(); IList<string> domesticRegIdList = partRep.GetConstValueTypeList("NeedExceptCameraStation").Select(x => x.value).ToList(); if (domesticRegIdList != null && domesticRegIdList.Contains(station)) { IList<IBOMNode> bomNodeLst = curBOM.FirstLevelNodes; if (bomNodeLst != null && bomNodeLst.Count > 0) { var PartPLList = (from p in bomNodeLst where p.Part.BOMNodeType.ToUpper() == "PL" && p.Part.Attributes != null && p.Part.Attributes.Count > 0 select p.Part).ToList(); if (PartPLList != null && PartPLList.Count > 0) { foreach (IPart part in PartPLList) { var attrList = (from p in part.Attributes where !string.IsNullOrEmpty(p.InfoType) && p.InfoType == "TYPE" && !string.IsNullOrEmpty(p.InfoValue) && p.InfoValue.ToUpper().StartsWith("TOUCH") select p).ToList(); if (attrList != null && attrList.Count > 0) { ret = true; break; } } } } } return ret; }
public static bool CheckIsWIN8(IHierarchicalBOM bom) { string site = GetSite(); IList<IBOMNode> P1BomNodeList = bom.GetFirstLevelNodesByNodeType("P1"); bool bWIN8 = false; if (site == "IPC") { foreach (IBOMNode bomNode in P1BomNodeList) { if (bomNode.Part.Descr.StartsWith("ECOA")) { bWIN8 = true; break; } } } else { foreach (IBOMNode bomNode in P1BomNodeList) { if (bomNode.Part.Descr.ToUpper().Contains("COA (WIN8)") ) { bWIN8 = true; break; } } } return bWIN8; }
private IHierarchicalBOM getBOM() { if(_bom==null && !string.IsNullOrEmpty(_modelName)) { _bom = bomRep.GetHierarchicalBOMByModel(_modelName); } return _bom; }
/// <summary> /// Expand Bom to button level by BomNodeTypeRule/partType/partDescr/PartNo setting value /// </summary> /// <param name="bom">IHierarchicalBOM </param> /// <param name="bomNodeTypeRule">必要有值,範例:PL->KP</param> /// <param name="partType">最後階層BOM檢查條件,空白或是Null則不檢查,使用Regex</param> /// <param name="partDescr">最後階層BOM檢查條件,空白或是Null則不檢查,使用Regex</param> /// <param name="partNo">最後階層BOM檢查條件,空白或是Null則不檢查,使用Regex</param> /// <returns></returns> public static IList<IBOMNode> GetBom(IHierarchicalBOM bom, string bomNodeTypeRule, string partType, string partDescr, string partNo) { if (bom.FirstLevelNodes.Count > 0 && !string.IsNullOrEmpty(bomNodeTypeRule)) { int index = bomNodeTypeRule.IndexOf(GlobalConstName.ArrowStr); string bomNodeType = index < 0 ? bomNodeTypeRule : bomNodeTypeRule.Substring(0, index); string nextFilterBomNodeTypeRule = index <= 0 ? null : bomNodeTypeRule.Substring(index + 2); if (string.IsNullOrEmpty(nextFilterBomNodeTypeRule)) { return bom.FilterFirstLevelBomNodes(bomNodeType, partType, partDescr, partNo); } else // have next bomNode { IList<IBOMNode> ret = new List<IBOMNode>(); var bomNodeList = bom.FilterFirstLevelBomNodes(bomNodeType, null, null, null); if (bomNodeList != null && bomNodeList.Count > 0) { foreach (IBOMNode node in bomNodeList) { ret = ret.Concat(GetNextBom(nextFilterBomNodeTypeRule, partType, partDescr, partNo, node)).ToList(); } } return ret; } } else { return new List<IBOMNode>(); } }
public bool CheckIsWIN8(IHierarchicalBOM bom) { IList<IBOMNode> P1BomNodeList = bom.GetFirstLevelNodesByNodeType("P1"); bool bWIN8 = false; foreach (IBOMNode bomNode in P1BomNodeList) { if (bomNode.Part.Descr.ToUpper().Contains("COA (WIN8)")) { bWIN8 = true; break; } } return bWIN8; }
private bool CheckOA3Key(IHierarchicalBOM bom, IProduct p, string fkiPath, CredentialCache FKICredentialCache, string editor, UnitOfWork uow) { bool bWIN8 = false; IList<IBOMNode> P1BomNodeList = bom.GetFirstLevelNodesByNodeType("P1"); //foreach (IBOMNode bomNode in P1BomNodeList) //{ // if (bomNode.Part.Descr.StartsWith("ECOA")) // { // bWIN8 = true; // break; // } //} CommonImpl2 cm2 = new CommonImpl2(); bWIN8 = cm2.CheckIsWIN8(bom); if (!bWIN8) return true; if (fkiPath == "") return true; //Switch off checking by FKIServer. string thisURI = ""; if (fkiPath.EndsWith("/")) { thisURI = fkiPath + "UnitStatus"; } else { thisURI = fkiPath + "/UnitStatus"; } HttpWebRequest req = (HttpWebRequest)WebRequest.Create(thisURI); req.AllowAutoRedirect = true; req.CookieContainer = new CookieContainer(); req.ContentType = "application/plain; charset=utf-8"; req.Accept = "*/*"; req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"; req.KeepAlive = true; req.Method = "POST"; req.Credentials = FKICredentialCache.GetCredential(new Uri(fkiPath), "NTLM"); string XMLInputData = "<?xml version='1.0' encoding='utf-8' ?>"; XMLInputData += "<UnitStatusRequest xmlns='http://HP.ITTS.OA30/digitaldistribution/2011/08'>"; XMLInputData += "<HPSerialNumber>"; XMLInputData += p.CUSTSN; XMLInputData += "</HPSerialNumber>"; XMLInputData += "<ProductKeyID>"; XMLInputData += ""; XMLInputData += "</ProductKeyID>"; XMLInputData += "</UnitStatusRequest>"; Encoding encoding = Encoding.Default; byte[] buffer = encoding.GetBytes(XMLInputData); req.ContentLength = buffer.Length; req.GetRequestStream().Write(buffer, 0, buffer.Length); HttpWebResponse res = (HttpWebResponse)req.GetResponse(); XmlTextReader xmlr = new XmlTextReader(res.GetResponseStream()); string status = ""; string rc = ""; bool bError = false; bool bFound = false; StringBuilder str = new StringBuilder("Formatted Response:\n"); while (xmlr.Read()) { switch (xmlr.NodeType) { case XmlNodeType.Element: if (xmlr.IsEmptyElement) str.AppendFormat("<{0}/>", xmlr.Name); else str.AppendFormat("<{0}>", xmlr.Name); break; case XmlNodeType.Text: str.Append(xmlr.Value); break; case XmlNodeType.CDATA: str.AppendFormat("<![CDATA[{0}]]>", xmlr.Value); break; case XmlNodeType.ProcessingInstruction: str.AppendFormat("<?{0} {1}?>", xmlr.Name, xmlr.Value); break; case XmlNodeType.Comment: str.AppendFormat("<!--{0}-->", xmlr.Value); break; case XmlNodeType.XmlDeclaration: str.AppendFormat("<?xml version='1.0'?>"); break; case XmlNodeType.DocumentType: str.AppendFormat("<!DOCTYPE{0} [{1}]>", xmlr.Name, xmlr.Value); break; case XmlNodeType.EntityReference: str.Append(xmlr.Name); break; case XmlNodeType.EndElement: str.AppendFormat("</{0}>", xmlr.Name); break; case XmlNodeType.Whitespace: str.Append("\n"); break; } if (xmlr.NodeType == System.Xml.XmlNodeType.Element && xmlr.LocalName.Equals("ReturnCode")) { xmlr.Read(); str.Append(xmlr.Value); rc = xmlr.Value.Trim(); if (rc != "000") bError = true; continue; } if (xmlr.NodeType == System.Xml.XmlNodeType.Element && xmlr.LocalName.Equals("ReturnMessage")) { if (bError) { xmlr.Read(); str.Append(xmlr.Value); string msg = xmlr.Value; xmlr.Close(); throw new Exception("[" + rc + "]:" + msg); } } if (xmlr.NodeType == System.Xml.XmlNodeType.Element && xmlr.LocalName.Equals("ProductKeyStateName")) { xmlr.Read(); str.Append(xmlr.Value); status = xmlr.Value; // Marked this by Benson at 2013/3/8 // if (status == "NotifiedBound") if (status == "NotifiedBound" || status == "FKIErrorBound") { //只能有一行状态为"Bound"/"NotifiedBound"/"PendingBound" --OLD //只能有一行状态为"Bound"/"NotifiedBound"/"PendingBound/FKIErrorBound" --NEW add by Benson at 2013/3/8 if (bFound) { xmlr.Close(); return false; } bFound = true; continue; } if (status == "Bound" || status == "PendingBound") { //只能有一行状态为"Bound"/"NotifiedBound"/"PendingBound" if (bFound) { xmlr.Close(); return false; } bFound = true; //对于状态为Bound/PendingBound的Product需要记录到ProductInfo中 IMES.FisObject.FA.Product.ProductInfo item = new IMES.FisObject.FA.Product.ProductInfo(); item.ProductID = p.ProId; item.InfoType = "Win8KeyState"; item.InfoValue = status; item.Editor = editor; if (productRepository.CheckExistProductInfo(p.ProId, "Win8KeyState")) { IMES.FisObject.FA.Product.ProductInfo cond = new IMES.FisObject.FA.Product.ProductInfo(); cond.ProductID = p.ProId; cond.InfoType = "Win8KeyState"; productRepository.UpdateProductInfoDefered(uow, item, cond); } else { productRepository.InsertProductInfoDefered(uow, item); } continue; } //Returned 或PendingReturn或NotifiedReturned或FKIErrorReturn --Mantis0001691 // Marked this by Benson at 2013/3/8 // if (status != "Returned" && status != "NotifiedReturned" && status != "PendingReturn") if (status != "Returned" && status != "NotifiedReturned" && status != "PendingReturn" && status != "FKIErrorReturn") { xmlr.Close(); return false; } } } xmlr.Close(); Console.Write(str.ToString()); return bFound; }
private IList<string> GetWirelessAndFCCID(IHierarchicalBOM bom, IProduct p, string dn) { //Wireless:在Model BOM中按照Model取下阶,得到 //BomNodeType=’AV’ and PartInfo.InfoType=’Descr’ and PartInfo.InfoValue=’BLUETOOTH’ //的记录,Wireless=获取PartInfo.InfoType=’AV’对应的InfoValue值(只考虑得到一条)。 string ret1 = ""; string ret2 = ""; IList<IBOMNode> AVBomNodeList = bom.GetFirstLevelNodesByNodeType("AV"); foreach (IBOMNode bomNode in AVBomNodeList) { string attrDescr = getAttrValue(bomNode.Part, "Descr"); if (attrDescr != null && attrDescr == "BLUETOOTH") { string attrAV = getAttrValue(bomNode.Part, "AV"); if (attrAV != null && attrAV != "") { ret1 = attrAV; break; } } } //FCCID:当Wireless<>””时且该model在Model BOM中的下阶存在 //BomNodeType in('P1','BM','KP') and Part.Descr like ’BLUETOOTH%’ //时,才需要获取FCCID bool bNeedFCCID = false; for (int loop = 0; loop < 3; loop++) { if (bNeedFCCID) break; IList<IBOMNode> BomNodeList = new List<IBOMNode>(); if (loop == 0) BomNodeList = bom.GetFirstLevelNodesByNodeType("P1"); if (loop == 1) BomNodeList = bom.GetFirstLevelNodesByNodeType("BM"); if (loop == 2) BomNodeList = bom.GetFirstLevelNodesByNodeType("KP"); foreach (IBOMNode bomNode in BomNodeList) { if (bomNode.Part.Descr.StartsWith("BLUETOOTH")) { if (ret1 != "") { bNeedFCCID = true; } else { //UC Exception 7 throw new FisException("PAK116", new string[] { dn }); } break; } } } //FCCID获取方法: Model BOM从model展2阶,得到 //BomNodeType=’KP’ and Part.Descr like ’BLUETOOTH%’ and 该part对应的’FCC ID’不等于空 //的记录,FCCID=’FCC ID’对应的属性值 if (bNeedFCCID) { bool bFoundFCCID = false; IList<IBOMNode> L1BomNodeList = bom.FirstLevelNodes; //展1阶 foreach (IBOMNode bomNode in L1BomNodeList) { if (bFoundFCCID) break; IList<IBOMNode> L2BomNodeList = bomNode.Children; //展2阶 foreach (IBOMNode bomNode1 in L2BomNodeList) { if (bFoundFCCID) break; IPart tmpPart = bomNode1.Part; if (tmpPart.BOMNodeType == "KP" && tmpPart.Descr.StartsWith("BLUETOOTH")) { string val = getAttrValue(tmpPart, "FCC ID"); if (val != null && val != "") { ret2 = val; bFoundFCCID = true; } } } } //UC Exception 2 if (!bFoundFCCID) { throw new FisException("PAK112", new string[] { p.Model }); } } //注:只要FCCID=’’时,Wireless=’’ if (ret2 == "") ret1 = ""; //再来获取Wireless part:当Model BOM按照Model展下阶存在Part.Descr=’WIRELESS’时, //若获取Model下阶BomNodeType= ’AV’ and 其Descr属性值like ‘WIRELESS%’的part对应的AV属性值@wireless不等于””时, //作以下处理: bool bExistWLPart = false; string wlval = ""; foreach (IBOMNode bomNode in bom.FirstLevelNodes) { if (bomNode.Part.Descr == "WIRELESS") { bExistWLPart = true; break; } } if (bExistWLPart) { foreach (IBOMNode bomNode in AVBomNodeList) { string attrDescr = getAttrValue(bomNode.Part, "Descr"); if (attrDescr != null && attrDescr.StartsWith("WIRELESS")) { string attrAV = getAttrValue(bomNode.Part, "AV"); if (attrAV != null && attrAV != "") { wlval = attrAV; break; } //UC Exception 5 else { throw new FisException("PAK114", new string[] { dn }); } } } } if (wlval != "") { //If Wireless=’’ // Wireless=@wireless // FCCID=IMES_FA..Product_Part.PartNo对应的Part.BomNodeType=’KP’ and Part.Descr like ‘WIRELESS%’ and [FCC ID]属性值不等于空的part,得到其[FCC ID]属性值@fccid //Else // Wireless=Wireless+’\’+@wireless // FCCID=FCCID+’\’+@fccid string fccid = ""; bool bFoundFCCID = false; foreach (IProductPart part in p.ProductParts) { IPart tmp = partRepository.GetPartByPartNo(part.PartID); if (tmp.BOMNodeType == "KP" && tmp.Descr.StartsWith("WIRELESS")) { string attrFCCID = getAttrValue(tmp, "FCC ID"); if (attrFCCID != null && attrFCCID != "") { bFoundFCCID = true; fccid = attrFCCID; break; } //UC Exception 6 else { throw new FisException("PAK115", new string[] { dn }); } } } /* * Answer to: ITC-1360-0903 * Description: Throw fis exception if WIRELESS not empty but FCCID is null. */ //UC Exception 8 if (!bFoundFCCID) { throw new FisException("PAK117", new string[] { dn }); } if (ret1 == "") { ret1 = wlval; ret2 = fccid; } else { ret1 += "\\" + wlval; ret2 += "\\" + fccid; } } IList<string> ret = new List<string>(); ret.Add(ret1); ret.Add(ret2); return ret; }
private bool CheckCOACombine(IHierarchicalBOM bom, IProduct p, string dn) { bool bNeedCOA = false; string pnCOA = ""; IList<IBOMNode> P1BomNodeList = bom.GetFirstLevelNodesByNodeType("P1"); IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository>(); IList<SysSettingInfo> siteList = partRep.GetSysSettingInfoes(new SysSettingInfo() { name = "Site" }); string site = "IPC"; if (siteList != null && siteList.Count > 0) { site = siteList[0].value; } foreach (IBOMNode bomNode in P1BomNodeList) { //Vincent Change Check WIN7 or WIN8 log if (site == "IPC") { if (bomNode.Part.Descr.StartsWith("COA")) { bNeedCOA = true; pnCOA = bomNode.Part.PN; break; } } else { if (bomNode.Part.Descr.ToUpper().Contains("WIN7")) { bNeedCOA = true; pnCOA = bomNode.Part.PN; break; } } } if (!bNeedCOA) return true; if (partRepository.CheckExistInternalCOA(dn, "DN")) return true; if (partRepository.CheckExistInternalCOA(p.CUSTSN, "SN")) return true; foreach (IProductPart tmp in p.ProductParts) { if (tmp.PartID == pnCOA) return true; } return false; }
private string GetODD(IHierarchicalBOM bom, string dn) { //ODD:在Model BOM中按照Model取下阶,得到 //BomNodeType=’AV’ and PartInfo.InfoType=’Descr’ and PartInfo.InfoValue=’ODD’ //的记录,获取PartInfo.InfoType=’AV’对应的InfoValue值,当存在多条时,用’\’分割串起来 string ret = ""; IList<IBOMNode> AVBomNodeList = bom.GetFirstLevelNodesByNodeType("AV"); foreach (IBOMNode bomNode in AVBomNodeList) { /* * Answer to: ITC-1360-0907 */ string attrDescr = getAttrValue(bomNode.Part, "Descr"); if (attrDescr != null && attrDescr == "ODD") { string val = getAttrValue(bomNode.Part, "AV"); if (val != null && val != "") ret += val + "\\"; //UC Exception else if (!bomNode.Part.PN.StartsWith("ZM")) { throw new FisException("PAK113", new string[] { dn }); } } } if (ret.EndsWith("\\")) ret = ret.Remove(ret.Length - 1); return ret; }
private bool CheckOA3Key(IHierarchicalBOM bom, IProduct p, string fkiPath, CredentialCache FKICredentialCache) { bool bWIN8 = false; IList<IBOMNode> P1BomNodeList = bom.GetFirstLevelNodesByNodeType("P1"); foreach (IBOMNode bomNode in P1BomNodeList) { if (bomNode.Part.Descr.StartsWith("ECOA")) { bWIN8 = true; break; } } if (!bWIN8) return true; if (fkiPath == "") return true; //Switch off checking by FKIServer. string thisURI = ""; if (fkiPath.EndsWith("/")) { thisURI = fkiPath + "UnitStatus"; } else { thisURI = fkiPath + "/UnitStatus"; } HttpWebRequest req = (HttpWebRequest)WebRequest.Create(thisURI); req.AllowAutoRedirect = false; req.CookieContainer = new CookieContainer(); //req.Headers.Add("Content-Type", "application/plain; charset=utf-8"); req.Accept = "*/*"; req.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)"; req.KeepAlive = false; req.Method = "POST"; req.Credentials = FKICredentialCache; string XMLInputData = "<?xml version='1.0' encoding='utf-8' ?>"; XMLInputData += "<UnitStatusRequest xmlns='http://HP.ITTS.OA30/digitaldistribution/2011/08'>"; XMLInputData += "<HPSerialNumber>"; XMLInputData += p.CUSTSN; XMLInputData += "</HPSerialNumber>"; XMLInputData += "<ProductKeyID>"; XMLInputData += p.ProId; XMLInputData += "</ProductKeyID>"; XMLInputData += "</UnitStatusRequest>"; MemoryStream memoryStream = new MemoryStream(); StreamWriter writer = new StreamWriter(memoryStream); writer.Write(XMLInputData); using (Stream stream = req.GetRequestStream()) { memoryStream.WriteTo(stream); } HttpWebResponse res = (HttpWebResponse)req.GetResponse(); XmlTextReader xmlr = new XmlTextReader(res.GetResponseStream()); string status = ""; bool bFound = false; while (xmlr.Read()) { if (xmlr.NodeType == System.Xml.XmlNodeType.Element && xmlr.LocalName.Equals("ProductKeyStateName")) { xmlr.Read(); status = xmlr.Value; if (status == "Bound" || status == "NotifiedBound" || status == "PendingBound") { bFound = true; continue; } if (status != "Returned" && status != "NotifiedReturned" && status != "PendingReturn") { xmlr.Close(); return false; } } } xmlr.Close(); return bFound; }
private bool CheckCOACombine(IHierarchicalBOM bom, IProduct p, string dn) { bool bNeedCOA = false; string pnCOA = ""; IList<IBOMNode> P1BomNodeList = bom.GetFirstLevelNodesByNodeType("P1"); foreach (IBOMNode bomNode in P1BomNodeList) { if (bomNode.Part.Descr.StartsWith("COA")) { bNeedCOA = true; pnCOA = bomNode.Part.PN; break; } } if (!bNeedCOA) return true; if (partRepository.CheckExistInternalCOA(dn, "DN")) return true; if (partRepository.CheckExistInternalCOA(p.CUSTSN, "SN")) return true; foreach (IProductPart tmp in p.ProductParts) { if (tmp.PartID == pnCOA) return true; } return false; }
private bool CheckBomHaveCPU(IHierarchicalBOM curBOM) { bool havecpu=false ; IList<IBOMNode> bomNodeLst = curBOM.FirstLevelNodes; if (null != bomNodeLst) { foreach (IBOMNode bn in bomNodeLst) { IPart p = bn.Part; if (p.Descr != null && p.Descr.IndexOf("CPU") >= 0 ) { havecpu = true; break; } } } return havecpu; }