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 void Merge(IFlatBOM bom) { foreach (var flatBOMItem in bom.BomItems) { _bomItems.Add(flatBOMItem); } }
public void Check(PartUnit pu, IPartOwner owner, string station, IFlatBOM bom) { if (PartPolicy != null) { PartPolicy.Check(pu, this, owner, station, bom); } }
private void ReplaceOldOfficeCD(IFlatBOM bom, IProduct prod ) { IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); if (prod != null) { try { bool bFindOldPartNo = false; string imgPartNo = ((string)prod.GetExtendedProperty("IMG")).Trim(); IList<ConstValueInfo> valueList = partRep.GetConstValueListByType("OfficeCD"); var partNo = (from p in valueList where p.name == imgPartNo select p).ToList(); if (partNo != null && partNo.Count > 0 && !string.IsNullOrEmpty(partNo[0].value) && !string.IsNullOrEmpty(partNo[0].description)) { string[] oldPartNo = partNo[0].value.Split(new char[] { '~' }); string newPartNo = partNo[0].description.Trim(); foreach (FlatBOMItem item in bom.BomItems) { var oldPart = (from p in item.AlterParts where oldPartNo.Contains(p.PN) select p).ToList(); if (oldPart != null && oldPart.Count > 0) { bFindOldPartNo = true; IPart newPart = GetNewOfficePart(newPartNo, item); if (newPart != null) { item.AlterParts.Clear(); item.AlterParts.Add(newPart); } } if (bFindOldPartNo) break; } } } catch { } } }