public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); IFlatBOM ret = null; try { IProduct product = GetProduct(main_object); if (!string.IsNullOrEmpty(product.DeliveryNo)) { string deliveryNo = product.DeliveryNo; IDeliveryRepository dnRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>(); string flag = dnRep.GetDeliveryInfoValue(deliveryNo, "Flag"); if (flag == "N") //自動單 { string boxId = (string)product.GetExtendedProperty("BoxId"); if (string.IsNullOrEmpty(boxId)) { boxId= (string)product.GetExtendedProperty("UCC"); } if (string.IsNullOrEmpty(boxId)) { throw new FisException("PAK034", new string[] { }); //此机器无BoxId!请返回Ship To Label 确认!; } string virtualPN="BoxID" + "/" + boxId; string descr = "Check BoxID"; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = descr, Descr2 = "", Type = part_check_type, Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = virtualPN; flat_bom_item.Tp = part_check_type; flat_bom_item.Descr = descr; flat_bom_item.ValueType = boxId; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } catch (Exception e) { throw; } return ret; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); IFlatBOM ret = null; if (hierarchical_bom == null) { throw new ArgumentNullException(); } HierarchicalBOM bom = (HierarchicalBOM)hierarchical_bom; try { if (bom.FirstLevelNodes != null) { IList<IBOMNode> bomNodeList = bom.FirstLevelNodes; var masterLabelPart =( from p in bomNodeList where p.Part.PN == "60NOMSTLBL01" select new { Qty = p.Qty, PartNo = p.Part.PN }).FirstOrDefault(); if (masterLabelPart != null) { IProduct product=GetProduct(main_object); IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository>(); IList<IMES.FisObject.Common.Model.ModelInfo> pcid = modelRep.GetModelInfoByModelAndName(product.Model, "PCID"); IPart part = new Part() { PN = masterLabelPart.PartNo+"/"+pcid[0].Value, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = "Master Label", Descr2 = "", Type = "MasterLabel", Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(masterLabelPart.Qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = masterLabelPart.PartNo + "/" + pcid[0].Value; flat_bom_item.Tp = "MasterLabel"; flat_bom_item.Descr = "Check Master Label"; flat_bom_item.ValueType = pcid[0].Value; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } catch (Exception e) { throw; } return ret; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); Hashtable share_parts_set = new Hashtable(); Hashtable share_part_no_set = new Hashtable(); Hashtable qty_share_parts_set = new Hashtable(); Hashtable descr_parts_set = new Hashtable(); IFlatBOM ret = null; if (hierarchical_bom == null) { throw new ArgumentNullException(); } var bom = (HierarchicalBOM)hierarchical_bom; try { string CountryCode = string.Empty; IProduct product = GetProduct(main_object); string SN = product.CUSTSN; if (product.Model.Length > 11) { CountryCode = product.Model.Substring(9, 2); } if (((CountryCode == "29") || (CountryCode == "39")) && !string.IsNullOrEmpty(SN)) { string virtualPN = "JapanSN" + "/" + SN; string descr = "Check JapanSN"; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = descr, Descr2 = "", Type = part_check_type, Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = virtualPN; flat_bom_item.Tp = part_check_type; flat_bom_item.Descr = descr; flat_bom_item.ValueType = "SN*" + SN; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } catch (Exception e) { throw; } return ret; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); IFlatBOM ret = null; try { IProduct product = GetProduct(main_object); if (!string.IsNullOrEmpty(product.DeliveryNo)) { string deliveryNo = product.DeliveryNo; IDeliveryRepository dnRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>(); string configID = dnRep.GetDeliveryInfoValue(deliveryNo, "ConfigID"); if (!string.IsNullOrEmpty(configID)) //船務有configID { string virtualPN = "ConfigID" + "/" + configID; string descr = "Check ConfigID"; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr =descr, Descr2 = "", Type = part_check_type, Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = virtualPN; flat_bom_item.Tp = part_check_type; flat_bom_item.Descr = descr; flat_bom_item.ValueType = configID; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } catch (Exception e) { throw; } return ret; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); IFlatBOM ret = null; try { IProduct product = Uti.GetProduct(main_object, part_check_type); if (string.IsNullOrEmpty(product.CUSTSN)) { throw new FisException("Product.CustomSN is empty in " + part_check_type + " module"); } string HiddenCode = GetCheckCode(product); string virtualPN = "HiddenSN000000-000"; string descr = "Check PizzaCustomSN"; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = descr, Descr2 = "", Type = part_check_type, Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = virtualPN; flat_bom_item.Tp = part_check_type; flat_bom_item.Descr = descr; flat_bom_item.ValueType = HiddenCode.Trim()+product.CUSTSN; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } catch (Exception e) { throw; } return ret; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); IFlatBOM ret = null; try { IProduct product = GetProduct(main_object); string SleeveCT = (string)product.GetExtendedProperty("SleeveCT"); if (!string.IsNullOrEmpty(SleeveCT)) { string virtualPN = "SleeveCT" + "/" + SleeveCT; string descr = "Check SleeveCT"; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = descr, Descr2 = "", Type = part_check_type, Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = virtualPN; flat_bom_item.Tp = part_check_type; flat_bom_item.Descr = descr; flat_bom_item.ValueType = SleeveCT; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } catch (Exception e) { throw; } return ret; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); IFlatBOM ret = null; try { IProduct product = Uti.GetProduct(main_object, part_check_type); bool needCheckCRC= Uti.CheckModelByProcReg(product.Model, new List<string>{"SKU"}); if (needCheckCRC) { string virtualPN = "ProductID" + "/" + product.ProId; string descr = "Check ProductID CRC"; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = descr, Descr2 = "", Type = part_check_type, Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = virtualPN; flat_bom_item.Tp = part_check_type; flat_bom_item.Descr = descr; flat_bom_item.ValueType = getCRC(product.ProId) + product.ProId; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } catch (Exception) { throw; } return ret; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); IFlatBOM ret = null; if (hierarchical_bom == null) { throw new ArgumentNullException(); } HierarchicalBOM bom = (HierarchicalBOM)hierarchical_bom; try { if (bom.FirstLevelNodes != null) { IList<IBOMNode> bomNodeLst = bom.FirstLevelNodes; foreach (IBOMNode ibomnode in bomNodeLst) { IPart currentPart = ibomnode.Part; //if (currentPart.Descr == "China label" || currentPart.Descr == "TAIWAN Label") if (currentPart.Descr == "China label") { IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>(); IProduct prod = GetProduct(main_object); IList<IMES.FisObject.Common.Model.ModelInfo> rmnList = modelRep.GetModelInfoByModelAndName(prod.Model, "RMN"); if (rmnList!=null && rmnList.Count > 0 && !string.IsNullOrEmpty(rmnList[0].Value) ) { string rmn = rmnList[0].Value.Trim(); string virtualPN = "RMN" + "/" + rmn; string descr = "Check RMN"; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = descr, Descr2 = "", Type = part_check_type, Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = virtualPN; flat_bom_item.Tp = part_check_type; flat_bom_item.Descr = descr; flat_bom_item.ValueType = rmn; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } else { throw new FisException("CQCHK1069", new string[] { prod.ProId, currentPart.Descr }); } break; } } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } } catch (Exception e) { throw; } return ret; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); Hashtable share_parts_set = new Hashtable(); Hashtable share_part_no_set = new Hashtable(); Hashtable qty_share_parts_set = new Hashtable(); Hashtable descr_parts_set = new Hashtable(); IFlatBOM ret = null; Boolean wwanCheck = false; if (hierarchical_bom == null) { throw new ArgumentNullException(); } var bom = (HierarchicalBOM)hierarchical_bom; try { string CountryCode = string.Empty; IProduct product = GetProduct(main_object); string SN = product.CUSTSN; if (product.Model.Length > 11) { CountryCode = product.Model.Substring(9, 2); } if (((CountryCode == "29") || (CountryCode == "39"))&& !string.IsNullOrEmpty(SN)) { string virtualPN = "JapanSN" + "/" + SN; string descr = "Check JapanSN"; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = descr, Descr2 = "", Type = part_check_type, Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = virtualPN; flat_bom_item.Tp = part_check_type; flat_bom_item.Descr = descr; flat_bom_item.ValueType = "SN*" + SN; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } if (bom.FirstLevelNodes != null) { IList<IBOMNode> bomNodeList = bom.FirstLevelNodes; foreach (IBOMNode bomNode in bomNodeList) { if (bomNode.Part.BOMNodeType == "PL") { if (bomNode.Part.Descr.Length >= 4) { if (bomNode.Part.Descr.ToUpper().Substring(0, 4) == "WWAN") { wwanCheck = true; } } } } } if (wwanCheck) { string imei = (string)product.GetExtendedProperty("IMEI"); string meid = (string)product.GetExtendedProperty("MEID"); string esn = (string)product.GetExtendedProperty("ESN"); string str = imei + ";" + meid + ";" + esn; string virtualPN = "WWANCheck" + "/" + str; string descr = "WWANCheck"; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = descr, Descr2 = "", Type = part_check_type, Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = virtualPN; flat_bom_item.Tp = part_check_type; flat_bom_item.Descr = descr; flat_bom_item.ValueType = str; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } catch (Exception e) { throw; } return ret; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); IFlatBOM ret = null; bool NeedCheckContent = false; HierarchicalBOM bom = (HierarchicalBOM)hierarchical_bom; try { IProduct product = GetProduct(main_object); string CustSN = product.CUSTSN; if (bom.FirstLevelNodes != null) { IList<IBOMNode> NodeLst = bom.FirstLevelNodes; if (NodeLst != null && NodeLst.Count > 0 ) { foreach (IBOMNode ibomnode in NodeLst) { IPart currentPart = ibomnode.Part; if (currentPart.BOMNodeType == "PR" && currentPart.Descr == "Warranty Card") { NeedCheckContent = true; break; } } } } if (NeedCheckContent) { string virtualPN = "WarrantySN" + "/" + CustSN; string descr = "Check WarrantySN"; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = descr, Descr2 = "", Type = part_check_type, Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = virtualPN; flat_bom_item.Tp = part_check_type; flat_bom_item.Descr = descr; flat_bom_item.ValueType = "SN*"+CustSN; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } catch (Exception e) { throw; } return ret; }
/// <summary> /// Model:Product.Model ///Model直接下阶MB阶(ModelBOM.Material=[Model] and Component=Part.PartNo and Part.BomNodeType=’MB’),取得所有MB为共用料;获取MB阶MB属性@MBCode (PartInfo.InfoType=’MB’ and PartInfo.PartNo=[PartNo]) ///若上述信息不存在,则取Model的MB属性@MBCode(ModelInfo.Model=[Model] and Name=’MB’) ///若以上信息都不存在,则报错:“Model:XXX组建错误,没有MBCode” /// </summary> /// <param name="hierarchicalBom"></param> /// <param name="station"></param> /// <param name="mainObject"></param> /// <returns></returns> public object FilterBOM(object hierarchicalBom, string station, object mainObject) { //根据Model展1阶,得到第一阶是MB的part [BomNodeType=MB]的MBCode[PartInfo.InfoValue(InfoType='MB')], IFlatBOM ret = null; if (hierarchicalBom == null) { throw new ArgumentNullException(); } Model modelObj = null; if (mainObject == null) { var repository = RepositoryFactory.GetInstance().GetRepository<IModelRepository, IMES.FisObject.Common.Model.Model>(); string model = ((IHierarchicalBOM)hierarchicalBom).Model; modelObj = repository.Find(model); } else { modelObj = ((Product) mainObject).ModelObj; } var parts = new List<IPart>(); IList<KPVendorCode> kpVCList = new List<KPVendorCode>(); String mbCodeString = string.Empty; var bom = (HierarchicalBOM)hierarchicalBom; IList<IBOMNode> mbNodes = bom.GetFirstLevelNodesByNodeType(MBBomNodeType); if (mbNodes != null && mbNodes.Count > 0) { foreach (IBOMNode bomNode in mbNodes) { IList<string> mbCodeList = new List<string>(); string mbCode = this.GetMBCode(bomNode); if (string.IsNullOrEmpty(mbCode)) { string modelMbCodeString = string.Empty; mbCodeList = this.GetModelMBCode(modelObj); foreach (string code in mbCodeList) { if (string.IsNullOrEmpty(modelMbCodeString)) { modelMbCodeString = code; } else { modelMbCodeString += "," + code; } } if (!string.IsNullOrEmpty(modelMbCodeString)) { //PartInfo mbPartInfo = new PartInfo(0, bomNode.Part.PN, MBCodeAttributeName, modelMbCodeString, "", DateTime.Now, DateTime.Now); //bomNode.Part.AddAttribute(mbPartInfo); kpVCList.Add(new KPVendorCode { PartNo = bomNode.Part.PN, VendorCode = modelMbCodeString }); } } else { mbCodeList.Add(mbCode); kpVCList.Add(new KPVendorCode { PartNo = bomNode.Part.PN, VendorCode = mbCode }); } if (mbCodeList.Count == 0) { //若以上信息都不存在,则报错:“Model:XXX组建错误,没有MBCode” throw new FisException("PAK081", new string[0]); } foreach (string code in mbCodeList) { if (string.IsNullOrEmpty(mbCodeString)) { mbCodeString = code; } else { if (!mbCodeString.Contains(code)) { mbCodeString += "," + code; } } } parts.Add(bomNode.Part); } } else //BOM中不存在MB类型节点 { Model model = modelObj; string modelMbCodeString = string.Empty; IList<string> mbCodeList = this.GetModelMBCode(model); if (mbCodeList.Count == 0) { return null; } foreach (string code in mbCodeList) { if (string.IsNullOrEmpty(modelMbCodeString)) { modelMbCodeString = code; } else { modelMbCodeString += "," + code; } } IPart modelPart = new Part(model.ModelName, "MB", "MB", model.CustPN, model.ModelName, string.Empty, string.Empty, string.Empty, DateTime.Now, DateTime.Now, string.Empty); if (!string.IsNullOrEmpty(modelMbCodeString)) { //var mbPartInfo = new PartInfo(0, modelPart.PN, MBCodeAttributeName, modelMbCodeString, "", DateTime.Now, DateTime.Now); // modelPart.AddAttribute(mbPartInfo); kpVCList.Add(new KPVendorCode { PartNo = modelPart.PN, VendorCode = modelMbCodeString }); } parts.Add(modelPart); mbCodeString = modelMbCodeString; } if (parts.Count > 0) { var flatBOMItem = new FlatBOMItem(1, PartCheckType, parts); flatBOMItem.Tag = kpVCList; flatBOMItem.Descr = parts.ElementAt(0).Descr; flatBOMItem.PartNoItem = mbCodeString; IList<IFlatBOMItem> flatBOMItems = new List<IFlatBOMItem>(); flatBOMItems.Add(flatBOMItem); ret = new FlatBOM(flatBOMItems); } return ret; }
/// <summary> /// /// </summary> /// <param name="product"></param> /// <param name="mb"></param> /// <param name="delivery"></param> /// <param name="part"></param> /// <param name="name"></param> /// <param name="spliter"></param> /// <returns></returns> public static string GetValue(IProduct product, IMB mb, Delivery delivery, Part part, string name, char spliter) { int index = name.IndexOf(spliter); if (index < 1) { throw new Exception("wrong method name : " + name); } string objName = name.Substring(0, index).ToUpper(); string objMethod = name.Substring(index + 1).Trim(); if (objName == GlobalConstName.ResolveValue.PRODUCTINFO) { if (product == null) { throw new FisException("CQCHK0006", new List<string> { "Product" }); } if (product.ProductInfoes == null || !product.ProductInfoes.Any(x => x.InfoType == objMethod)) { throw new FisException("CHK1036", new List<string> { product.ProId, name }); } return product.ProductInfoes .Where(x => x.InfoType == objMethod) .Select(y => y.InfoValue).FirstOrDefault().Trim(); } if (objName == GlobalConstName.ResolveValue.PRODUCTATTR) { if (product == null) { throw new FisException("CQCHK0006", new List<string> { "Product" }); } if (product.ProductAttributes == null || !product.ProductAttributes.Any(x => x.AttributeName == objMethod)) { throw new FisException("CHK1036", new List<string> { product.ProId, name }); } return product.ProductAttributes .Where(x => x.AttributeName == objMethod) .Select(y => y.AttributeValue).FirstOrDefault().Trim(); } if (objName == GlobalConstName.ResolveValue.MODELINFO) { if (product == null) { throw new FisException("CQCHK0006", new List<string> { "Product" }); } if (product.ModelObj ==null|| product.ModelObj.Attributes == null || !product.ModelObj.Attributes.Any(x => x.Name == objMethod)) { throw new FisException("CHK1036", new List<string> { product.Model, name }); } return product.ModelObj.Attributes .Where(x => x.Name == objMethod) .Select(y => y.Value).FirstOrDefault().Trim(); } if (objName == GlobalConstName.ResolveValue.FAMILYINFO) { if (product == null) { throw new FisException("CQCHK0006", new List<string> { "Product" }); } string family = product.Family; //IFamilyRepository familyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository>(); IList<FamilyInfoDef> familyInfoList = familyRep.GetExistFamilyInfo(new FamilyInfoDef { family = family, name = objMethod }); if (familyInfoList == null || familyInfoList.Count == 0) { throw new FisException("CHK1036", new List<string> { family, name }); } return familyInfoList[0].value.Trim(); } if (objName == GlobalConstName.ResolveValue.PRODUCT) { if (product == null) { throw new FisException("CQCHK0006", new List<string> { "Product" }); } string value = (string)product.GetProperty(objMethod); if (string.IsNullOrEmpty(value)) { throw new FisException("not exists property name:" + name); } return value.Trim(); } if (objName == GlobalConstName.ResolveValue.PCB) { if (mb == null) { throw new FisException("CQCHK0006", new List<string> { "PCB" }); } string value = (string)mb.GetProperty(objMethod); if (string.IsNullOrEmpty(value)) { throw new FisException("not exists property name:" + name); } return value.Trim(); } if (objName == GlobalConstName.ResolveValue.PCBINFO) { if (mb == null) { throw new FisException("CQCHK0006", new List<string> { "PCB" }); } if (mb.MBInfos==null || !mb.MBInfos.Any(x => x.InfoType == objMethod)) { throw new FisException("CHK1036", new List<string> { mb.Sn, name }); } return mb.MBInfos .Where(x => x.InfoType == objMethod) .Select(y => y.InfoValue).FirstOrDefault().Trim(); } if (objName == GlobalConstName.ResolveValue.DELIVERY) { if (delivery == null) { throw new FisException("CQCHK0006", new List<string> { "Delivery" }); } string value = (string)delivery.GetProperty(objMethod); if (string.IsNullOrEmpty(value)) { throw new FisException("not exists property name:" + name); } return value.Trim(); } if (objName == GlobalConstName.ResolveValue.DELIVERYINFO) { if (delivery == null) { throw new FisException("CQCHK0006", new List<string> { "Delivery" }); } if (delivery.DeliveryInfoes==null|| !delivery.DeliveryInfoes.Any(x => x.InfoType == objMethod)) { throw new FisException("CHK1036", new List<string> { delivery.DeliveryNo, name }); } return delivery.DeliveryInfoes .Where(x => x.InfoType == objMethod) .Select(y => y.InfoValue).FirstOrDefault().Trim(); } if (objName == GlobalConstName.ResolveValue.PART) { if (part == null) { throw new FisException("CQCHK0006", new List<string> { "Part" }); } string value = (string)part.GetProperty(objMethod); if (string.IsNullOrEmpty(value)) { throw new FisException("not exists property name:" + name); } return value.Trim(); } if (objName == GlobalConstName.ResolveValue.PCBINFO) { if (part == null) { throw new FisException("CQCHK0006", new List<string> { "Part" }); } if (part.Attributes==null || !part.Attributes.Any(x => x.InfoType == objMethod)) { throw new FisException("CHK1036", new List<string> { part.PN, name }); } return part.Attributes .Where(x => x.InfoType == objMethod) .Select(y => y.InfoValue).FirstOrDefault().Trim(); } throw new Exception("not support resolve name:" + name); }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { #region check input parameter //main_object 需要是IProduct IProduct prod = (IProduct)main_object; if (prod == null) { throw new FisException("FIL001", new string[] { part_check_type,"Product" }); } if (hierarchical_bom == null ) { throw new FisException("FIL001", new string[] { part_check_type, "BOM" }); } var bom = (HierarchicalBOM)hierarchical_bom; if (bom.FirstLevelNodes == null || bom.FirstLevelNodes.Count==0) { throw new FisException("FIL001", new string[] { part_check_type, "BOM" }); } #endregion IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); //根据Model展1阶,得到第一阶是MB的part [BomNodeType=MB]的MBCode[PartInfo.InfoValue(InfoType='MB')], #region Check Bom structure & Filter Part if (CheckIsWIN8(bom)) { return null; } IFlatBOM ret = null; String mb_info_value_string = ""; var parts = new List<IPart>(); // parts.Add(partRep.Find(osWin.BomZmode)); _qty = 1; var matchMBBom = (from item in bom.FirstLevelNodes where ((BOMNode)item).Part.BOMNodeType.Equals("MB") && this.CheckCondition(item) select ((BOMNode)item).Part).ToList(); foreach (IPart item in matchMBBom) { IList<PartInfo> part_infos = item.Attributes; var partInfos = (from p in part_infos where p.InfoType == "FRUNO" select p).ToList(); if (partInfos == null || part_infos.Count == 0 || string.IsNullOrEmpty(partInfos[0].InfoValue)) { throw new FisException("FIL002", new string[] { part_check_type, "BOM", item.PN, "FRUNO" }); } string spsNo = partInfos[0].InfoValue; if (mb_info_value_string.Length == 0) { mb_info_value_string = spsNo; } else { if (!mb_info_value_string.Contains(spsNo)) { mb_info_value_string += "," + spsNo; } } } #endregion #region Generate FlatBom with filter Part for return if (!string.IsNullOrEmpty(mb_info_value_string)) { string virtualPN = "Win7SPS" + "/" + mb_info_value_string; string descr = "Check Win7SPS"; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = descr, Descr2 = "", Type = part_check_type, Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(_qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = virtualPN; flat_bom_item.Tp = part_check_type; flat_bom_item.Descr = descr; flat_bom_item.ValueType = mb_info_value_string; //存放Part match時檢查的值 IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); flat_bom_items.Add(flat_bom_item); ret = new FlatBOM(flat_bom_items); } #endregion return ret; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); IFlatBOM ret = null; if (hierarchical_bom == null) { throw new ArgumentNullException(); } HierarchicalBOM bom = (HierarchicalBOM)hierarchical_bom; Hashtable hQtyPNofSC = new Hashtable(); try { if (bom.FirstLevelNodes != null) { IList<IBOMNode> bomNodeList = bom.FirstLevelNodes; var smartCardPartList = from p in bomNodeList where p.Part.Attributes.Any(x => x.InfoType == "Descr" && x.InfoValue.ToUpper() == "SMART CARD") select new { Qty = p.Qty, PartNo = p.Part.PN }; foreach (var item in smartCardPartList) { if (hQtyPNofSC.Contains(item.Qty)) { hQtyPNofSC[item.Qty] = (string)hQtyPNofSC[item.Qty] + "," + item.PartNo; } else { hQtyPNofSC.Add(item.Qty, item.PartNo); } } foreach (DictionaryEntry de in hQtyPNofSC) { IPart part = new Part() { PN = (string)de.Value, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = "Smart Card Reader", Descr2 = "", Type = "SmartCard", Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem((int)de.Key, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = (string)de.Value; flat_bom_item.Tp = "SmartCard"; flat_bom_item.Descr = "Check Smart Card Reader"; flat_bom_item.ValueType = (string)de.Value; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } catch (Exception e) { throw; } return ret; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); IFlatBOM ret = null; if (hierarchical_bom == null) { throw new ArgumentNullException(); } HierarchicalBOM bom = (HierarchicalBOM)hierarchical_bom; try { if (bom.FirstLevelNodes != null) { string[] strArray = new string[] { "WIN8 BOX LABEL", "WIND8 Box Label" }; IList<IPart> win8PartList = (from x in bom.FirstLevelNodes where strArray.Contains(x.Part.Descr) select x.Part).ToList(); // IList<string> win8PartList = (from x in bom.FirstLevelNodes // where strArray.Contains(x.Part.Descr) // select x.Part.Attributes.Where(attr => attr.InfoType == "Descr").Select(attr => attr.InfoValue).FirstOrDefault()).ToList(); if (win8PartList != null && win8PartList.Count > 0) { string win8PartNo = win8PartList[0].Attributes.Where(attr => attr.InfoType == "Descr").Select(attr => attr.InfoValue).FirstOrDefault(); if (String.IsNullOrEmpty(win8PartNo)) { throw new FisException("CQCHK1059", new string[] { bom.Model +" WIN8BOX Remark" }); } // string win8PartNo = win8PartList[0].Trim(); if (!string.IsNullOrEmpty(win8PartNo)) { string virtualPN = "Win8Label" + "/" + win8PartNo; string descr = "Check Win8Label"; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = descr, Descr2 = "", Type = part_check_type, Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = virtualPN; flat_bom_item.Tp = part_check_type; flat_bom_item.Descr = descr; flat_bom_item.ValueType = win8PartNo; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } } catch (Exception e) { throw; } return ret; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>(); IFlatBOM ret = null; bool NeedCheckContent = false; string mn = ""; string pn = ""; string warranty = ""; try { IProduct product = GetProduct(main_object); IList<ConstValueTypeInfo> lstConstValueType = partRep.GetConstValueTypeList("CheckCarveSN"); if (null != lstConstValueType && lstConstValueType.Count > 0) { foreach (ConstValueTypeInfo cvt in lstConstValueType) { if (cvt.value == product.Family) { NeedCheckContent = true; break; } } } if (NeedCheckContent) { IList<IMES.FisObject.Common.Model.ModelInfo> rmnList = modelRep.GetModelInfoByModelAndName(product.Model, "MN1"); if (rmnList != null && rmnList.Count > 0) { mn = rmnList[0].Value.Trim(); } IList<IMES.FisObject.Common.Model.ModelInfo> pnList = modelRep.GetModelInfoByModelAndName(product.Model, "PN"); if (pnList != null && pnList.Count > 0) { pn = pnList[0].Value.Trim(); } IList<IMES.FisObject.Common.Model.ModelInfo> warrantyList = modelRep.GetModelInfoByModelAndName(product.Model, "WARRANTY"); if (warrantyList != null && warrantyList.Count > 0) { warranty = warrantyList[0].Value.Trim()+","; } string carveSn = product.CUSTSN+"," + mn+"," + pn+"," + warranty.Replace(",", "y"); string virtualPN = product.CUSTSN; // string virtualPN = product.CUSTSN + mn + pn + warranty.Replace(",", "y"); string descr = "Check CarveSN"; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = descr, Descr2 = "", Type = part_check_type, Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = virtualPN; flat_bom_item.Tp = part_check_type; flat_bom_item.Descr = descr; flat_bom_item.ValueType = carveSn.ToUpper(); //存放Part match時檢查的值 //flat_bom_item.ValueType = "5CG505000BHPDESKTOPMINIDVD-WRITERODDMODULE801433-0021Y1Y0Y"; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } catch (Exception e) { throw; } return ret; }
private FlatBOMItem createFlatBOMItem(string virtualPN, string descr, string checkItemType, string valueType, CheckItemTypeRuleDef ruleDefine) { DateTime now = DateTime.Now; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = string.Empty, Remark = string.Empty, Descr = descr, Descr2 = string.Empty, Type = checkItemType, Udt = now, Cdt = now }; FlatBOMItem flat_bom_item = new FlatBOMItem(qty, checkItemType, new List<IPart>() { part }); flat_bom_item.PartNoItem = part.PN; flat_bom_item.Tp = checkItemType; flat_bom_item.Descr = descr; flat_bom_item.ValueType = valueType; //存放Part match時檢查的值 if (ruleDefine != null) { flat_bom_item.CheckItemTypeRuleList = new List<CheckItemTypeRuleDef> { ruleDefine }; } return flat_bom_item; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); Hashtable share_parts_set = new Hashtable(); Hashtable share_part_no_set = new Hashtable(); Hashtable qty_share_parts_set = new Hashtable(); Hashtable descr_parts_set = new Hashtable(); IFlatBOM ret = null; Boolean imeicheck = false; if (hierarchical_bom == null) { throw new ArgumentNullException(); } var bom = (HierarchicalBOM)hierarchical_bom; try { IProduct product = GetProduct(main_object); if (bom.FirstLevelNodes != null) { IList<IBOMNode> bomNodeList = bom.FirstLevelNodes; foreach (IBOMNode bomNode in bomNodeList) { if (bomNode.Part.PN == "6060BWWAN001") { imeicheck = true; } } } if (imeicheck) { var mb_repository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); IMB mb = mb_repository.Find(product.PCBID); if (mb == null) { throw new FisException("CHK862", new string[] { }); } string imei = (string)mb.GetExtendedProperty("IMEI"); if (string.IsNullOrEmpty(imei)) { imei = (string)product.GetExtendedProperty("IMEI"); } if (string.IsNullOrEmpty(imei)) { throw new FisException("CQCHK50119", new string[] { }); } string virtualPN = "IMEICheck" + "/" + imei; string descr = "IMEICheck"; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = descr, Descr2 = "", Type = part_check_type, Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = virtualPN; flat_bom_item.Tp = part_check_type; flat_bom_item.Descr = descr; flat_bom_item.ValueType = imei; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } catch (Exception e) { throw; } return ret; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { _lstChkItemRule = null; _station = station; SetSession(main_object); SetCheckItemTypeRule(); IFlatBOM ret = null; try { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); var product = _currentSession.GetValue(Session.SessionKeys.Product) as IProduct; if (product == null) { throw new FisException("Product in session is null in CheckItemModule.CheckCT.Filter"); } string _rgx=""; if(_lstChkItemRule.Count==0) { throw new FisException("CheckItemTypeRule is null in CheckItemModule.CheckCT.Filter"); } IList<IProductPart> lstPrdPart = product.ProductParts; foreach (IProductPart productPart in lstPrdPart) { foreach (CheckItemTypeRuleDef chk in _lstChkItemRule) { _rgx = chk.PartType; Regex rgx = new Regex(_rgx); if (rgx.IsMatch(productPart.CheckItemType)) { IList<IPart> share_parts = new List<IPart>(); IPart part = new Part(productPart.PartID, productPart.BomNodeType, productPart.PartType , string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, DateTime.Now, DateTime.Now, string.Empty); kpVCList.Add(new KPVendorCode { PartNo = productPart.PartID, VendorCode = productPart.PartSn }); //part.AddAttribute(new PartInfo(1, productPart.PartID, "CT_KEY", productPart.PartSn, "", DateTime.Now, DateTime.Now)); share_parts.Add(part); var kp_flat_bom_item = new FlatBOMItem(1, part_check_type, share_parts); kp_flat_bom_item.Tag = kpVCList; kp_flat_bom_item.PartNoItem = productPart.PartID; kp_flat_bom_item.Descr = productPart.PartType; flat_bom_items.Add(kp_flat_bom_item); } } } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } catch (Exception e) { throw; } return ret; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); IList<AstRuleInfo> share_parts_set = new List<AstRuleInfo>(); IFlatBOM ret = null; if (hierarchical_bom == null) { throw new ArgumentNullException(); } HierarchicalBOM bom = (HierarchicalBOM)hierarchical_bom; try { if (bom.FirstLevelNodes != null) { IList<string> astCategoryList = new List<string> { "AT", "PP" }; List<astItemRule> astItemRuleList = new List<astItemRule>(); var atPartList = (from p in bom.FirstLevelNodes where astCategoryList.Contains(p.Part.BOMNodeType) select p.Part); foreach (IPart part in atPartList) { var avPart = (from p in part.Attributes where p.InfoType == "AV" select p.InfoValue).FirstOrDefault(); if (!string.IsNullOrEmpty(avPart)) { astItemRuleList.Add(new astItemRule { Code =part.Descr, AVPartNo = avPart, Part = part }); } } IProduct product=GetProduct(main_object); IProductRepository prodRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); foreach (astItemRule item in astItemRuleList) { IList<AstRuleInfo> astruleList = prodRep.GetAstRuleByCodeAndStationAndCust(item.Code, station, item.AVPartNo); if (astruleList.Count > 0) { foreach (AstRuleInfo rule in astruleList) { AstRuleInfo info = CheckAstRule(rule, product, item.Part); if (info != null) { share_parts_set.Add(info); } } } else //料號找不到後再找CustName為空白 { astruleList = prodRep.GetAstRuleByCodeAndStationAndCust(item.Code, station, ""); foreach (AstRuleInfo rule in astruleList) { AstRuleInfo info = CheckAstRule(rule, product, item.Part); if (info != null) { share_parts_set.Add(info); } } } } } if (share_parts_set.Count > 0) { foreach (AstRuleInfo ruleInfo in share_parts_set) { IPart part = new Part() { PN = ruleInfo.code + "/" + ruleInfo.custName, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = ruleInfo.custName, Remark="", Descr = ruleInfo.custName + "/" + ruleInfo.checkItem, Descr2="", Type = ruleInfo.code, Udt= DateTime.Now, Cdt=DateTime.Now }; var flat_bom_item = new FlatBOMItem(qty, part_check_type, new List<IPart>(){part}); flat_bom_item.PartNoItem = ruleInfo.code + "/" + ruleInfo.custName; flat_bom_item.Tp = ruleInfo.code; flat_bom_item.Descr = ruleInfo.custName + "/" + ruleInfo.checkItem; flat_bom_item.ValueType = ruleInfo.remark; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } catch (Exception e) { throw; } return ret; }
public object FilterBOM(object hierarchical_bom, string station, object main_object) { IList<IFlatBOMItem> flat_bom_items = new List<IFlatBOMItem>(); IFlatBOM ret = null; bool NeedCheckContent = false; HierarchicalBOM bom = (HierarchicalBOM)hierarchical_bom; try { IProduct product = GetProduct(main_object); string CustSN = product.CUSTSN; if (!string.IsNullOrEmpty(product.DeliveryNo)) { string deliveryNo = product.DeliveryNo; IDeliveryRepository dnRep = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, Delivery>(); // string configID = dnRep.GetDeliveryInfoValue(deliveryNo, "ConfigID"); string reg = dnRep.GetDeliveryInfoValue(deliveryNo, "RegId"); if (reg != null && reg.Length == 3) { reg = reg.Substring(1, 2); } else { reg = ""; } string tp = dnRep.GetDeliveryInfoValue(deliveryNo, "ShipTp"); if ((CheckDomesticDN(reg)) && (tp == "CTO")) { NeedCheckContent = true; } } IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); IList<ConstValueTypeInfo> lstConst = partRep.GetConstValueTypeList("PrintContentPartNoList"); if (bom.FirstLevelNodes != null) { IList<IBOMNode> NodeLst = bom.FirstLevelNodes; if (NodeLst != null && NodeLst.Count > 0 && lstConst != null && lstConst.Count > 0) { foreach (IBOMNode ibomnode in NodeLst) { var partLabelList = (from p in lstConst where p.value == ibomnode.Part.PN select p.value).ToList(); if (partLabelList != null && partLabelList.Count > 0) { NeedCheckContent = true; break; } } } } if (NeedCheckContent) { string virtualPN = "WarrantyContent" + "/" + CustSN; string descr = "Check WarrantyContent"; IPart part = new Part() { PN = virtualPN, //PN要跟 flat_bom_item.PartNoItem值一樣 CustPn = "", Remark = "", Descr = descr, Descr2 = "", Type = part_check_type, Udt = DateTime.Now, Cdt = DateTime.Now }; var flat_bom_item = new FlatBOMItem(qty, part_check_type, new List<IPart>() { part }); flat_bom_item.PartNoItem = virtualPN; flat_bom_item.Tp = part_check_type; flat_bom_item.Descr = descr; flat_bom_item.ValueType = "W"+CustSN; //存放Part match時檢查的值 flat_bom_items.Add(flat_bom_item); } if (flat_bom_items.Count > 0) { ret = new FlatBOM(flat_bom_items); } } catch (Exception e) { throw; } return ret; }