public void AddBomItem(IFlatBOMItem item) { IList<IMES.DataModel.CheckItemTypeRuleDef> checkItemTypeRuleList = item.CheckItemTypeRuleList; if (checkItemTypeRuleList != null && checkItemTypeRuleList.Count > 0) { item.NeedCheckUnique = checkItemTypeRuleList[0].NeedUniqueCheck == "Y"; item.NeedCommonSave = checkItemTypeRuleList[0].NeedCommonSave == "Y"; item.NeedSave = checkItemTypeRuleList[0].NeedSave == "Y"; } _bomItems.Add(item); }
public PartUnit Match(string subject, string station) { foreach (var item in _bomItems) { if (item.IsFull()) { continue; } var matchedPart = item.Match(subject, station); if (matchedPart != null) { _currentMatchedBomItem = item; return matchedPart; } } return null; }
public PartUnit Match(string subject, string station, bool allowReplaceMatch) { if (allowReplaceMatch) { foreach (var item in _bomItems) { var matchedPart = item.Match(subject, station); if (matchedPart != null) { _currentMatchedBomItem = item; return matchedPart; } } return null; } else { return Match(subject, station); } }
public void Check(PartUnit pu, IFlatBOMItem item, IPartOwner owner, string station, IFlatBOM bom) { #if DEBUG ICheckModule checker = (ICheckModule)GetInstance(_checkModule, typeof(ICheckModule)); #else ICheckModule checker = PartSpecialCodeContainer.GetInstance.GetCheckModule(_checkModule); #endif //已經Binded Part 檢查收集CT是否存在 if (item.HasBinded) { if (owner != null) { var partNoList = item.AlterParts.Select(x=>x.PN).ToList(); bool hasBinded = owner.CheckPartBinded(pu.ValueType, partNoList, pu.Type, pu.ItemType, pu.Sn); if (!hasBinded) { throw new FisException("MAT011", false, new string[] { pu.Sn, pu.Type, pu.ValueType, pu.ItemType }); } } else { throw new FisException("MAT012", false, new string[] { pu.Sn, pu.Type, pu.ValueType, pu.ItemType }); } } else { if (checker != null) { checker.Check(pu, item, station); } //if have value then replace _needUniqueCheck if (item.NeedCheckUnique.HasValue) { _needUniqueCheck = item.NeedCheckUnique.Value; } if (NeedUniqueCheck) { //do unique check //1.part been used on this product (mem) var checkedParts = bom.GetCheckedPart(); if (checkedParts != null) { foreach (PartUnit checkPu in checkedParts) { if (pu.Sn == checkPu.Sn) { throw new FisException("CHK084", new string[] { pu.Sn }); } } } //2.part been used on other product (db) if (owner != null) { owner.PartUniqueCheck(pu.Pn, pu.Sn); } //3.part been used on other product (mem) } } if (NeedPartForbidCheck) { IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); string noticeMsg = ""; if (partRep.CheckPartForbid(item.PartForbidList, pu.Type, pu.Sn, pu.Pn, out noticeMsg)) { throw new FisException("CHK1105", new string[] { pu.Type, pu.Pn, pu.Sn, noticeMsg??string.Empty}); } } if (_needDefectComponentCheck) { IMiscRepository miscRep = RepositoryFactory.GetInstance().GetRepository<IMiscRepository>(); IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); IList<IMES.DataModel.SysSettingInfo> SysSettingInfoList = partRep.GetSysSettingInfoes(new IMES.DataModel.SysSettingInfo { name = "DefectComponentPassStatus" }); if (SysSettingInfoList == null || SysSettingInfoList.Count == 0) { throw new FisException("PAK095", new string[] { "DefectComponentPassStatus" }); } string[] passStatus = SysSettingInfoList[0].value.Split(new char[] { '~', ',', ';' }); IList<IMES.DataModel.DefectComponentInfo> DefectComponentInfoList = miscRep.GetData<IMES.Infrastructure.Repository._Metas.DefectComponent, IMES.DataModel.DefectComponentInfo>(new IMES.DataModel.DefectComponentInfo { PartSn = pu.Sn }); if (DefectComponentInfoList != null && DefectComponentInfoList.Count > 0) { if (DefectComponentInfoList.Any(x => !passStatus.Contains(x.Status))) { throw new FisException("CQCHK1097", new string[] { pu.Sn, string.Join(",", DefectComponentInfoList.Select(x => x.Status).Distinct().ToArray()) }); } } } }
public PartUnit Match(string subject, IFlatBOMItem bomItem, string station) { PartUnit ret = null; #if DEBUG IMatchModule matcher = (IMatchModule)GetInstance(_matchModule, typeof(IMatchModule)); #else IMatchModule matcher = PartSpecialCodeContainer.GetInstance.GetMatchModule(_matchModule); #endif if (matcher != null) { ret = (PartUnit) matcher.Match(subject, bomItem, station); if (ret != null) { ret.GetType().GetField("_flatBomItemGuid", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(ret, bomItem.GUID); } } return ret; }
/// <summary> /// 根据Pn获取FlatBOMItem中该Part的VendorCode /// </summary> /// <param name="pn"></param> /// <param name="item"></param> /// <returns></returns> String GetVendorCodeOfCheckedPart(String pn, IFlatBOMItem item) { if (item.AlterParts != null) { foreach (IPart alterPart in item.AlterParts) { if (string.Compare(alterPart.PN, pn) == 0) { return alterPart.GetAttribute("Vendor"); } } } return string.Empty; }
private void BindPartsToPartOwner(IFlatBOMItem bomItem, BindToEnum bindTo) { switch (bindTo) { case BindToEnum.PCB: IMB CurrentMB = (IMB)CurrentSession.GetValue(Session.SessionKeys.MB); bomItem.Save(CurrentMB, Station, Editor, CurrentSession.Key); IMBRepository rep = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); rep.Update(CurrentMB, CurrentSession.UnitOfWork); break; case BindToEnum.Pizza: Pizza pizzaPartOwner = (Pizza)CurrentSession.GetValue(Session.SessionKeys.Pizza); if (pizzaPartOwner == null) { Product newProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product); pizzaPartOwner = newProduct.PizzaObj; } bomItem.Save(pizzaPartOwner, Station, Editor, CurrentSession.Key); IPizzaRepository repPizza = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository, Pizza>(); repPizza.Update(pizzaPartOwner, CurrentSession.UnitOfWork); break; case BindToEnum.Product: Product productPartOwner = (Product)CurrentSession.GetValue(Session.SessionKeys.Product); bomItem.Save(productPartOwner, Station, Editor, CurrentSession.Key); IProductRepository repProduct = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); repProduct.Update(productPartOwner, CurrentSession.UnitOfWork); break; } }