/// <summary> /// 使用PartCheckMatch中定义的规则match /// </summary> /// <param name="target">需要匹配的字符串</param> /// <param name="part">part</param> /// <param name="containCheckBit">是否包含校验位</param> /// <returns></returns> public virtual bool Match(string target, IBOMPart part, string station, string valueType, out bool containCheckBit) { PartCheck checkSetting = this.GetPartCheckSettingData(valueType); if (checkSetting == null) { string msg = string.Format("PartCheck data of {0} type does not exist.", part.Type); Exception ex = new Exception(msg); throw ex; } return checkSetting.MatchRule.Match(target, part, out containCheckBit); }
/// <summary> /// 使用PartCheckMatch中定义的规则match /// </summary> /// <param name="target">需要匹配的字符串</param> /// <param name="part">part</param> /// <param name="containCheckBit">是否包含校验位</param> /// <returns></returns> public override bool Match(string target, IBOMPart part, string station, string valueType, out bool containCheckBit) { containCheckBit = false; if (!valueType.Equals(("SN"))) { return base.Match(target, part, station, valueType, out containCheckBit); } //match by length if (target.Length != 14) { return false; } //match by assembly code bool assMatched = false; string prefix = target.Substring(0, 6); foreach (var assCode in part.AssemblyCode) { if (prefix.Equals(assCode)) { assMatched = true; } } //确定是否带校验位 if (assMatched) { IPartSnRepository rep = RepositoryFactory.GetInstance().GetRepository<IPartSnRepository, PartSn>(); PartSn psn = rep.Find(target); if (psn != null) { //sn of new format: sn lenth = 14; no checkbit; containCheckBit = false; return true; } else { psn = rep.Find(target.Substring(0, 13)); if (psn != null) { //sn of old format: sn lenth=13; with checkbit on 14th; containCheckBit = true; return true; } } } return false; }
/// <summary> /// 1. 10码(去掉校验位) /// 2. VB SN#前两码=Part的MB属性 /// </summary> /// <param name="target">目标串</param> /// <param name="part">part</param> /// <returns>是否匹配</returns> public override bool Match(string target, IBOMPart part, string station, string valueType, out bool containCheckBit) { if (!valueType.Equals(("SN"))) { return base.Match(target, part, station, valueType, out containCheckBit); } //1.10码(去掉校验位) if (!base.Match(target, part, station, valueType, out containCheckBit)) { return false; } //match by length // switch (target.Length) // { // case 11: // containCheckBit = true; // break; // case 10: // containCheckBit = false; // break; // default: // return false; // } //2.MB SN在PCB表中对应记录的Model与当前Pn一致 string mbsn = target; if (containCheckBit) { mbsn = mbsn.Substring(0, mbsn.Length - 1); } IMBRepository rep = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); IMB mb = rep.Find(mbsn); if (mb == null) { return false; } if (!mb.Model.Equals(part.PN)) { return false; } return true; }
/// <summary> /// 默认的PartCheck实现,只进行唯一性检查 /// </summary> /// <param name="part">需要check的part</param> /// <param name="owner">PartOwner</param> public virtual void Check(IBOMPart part, IPartOwner owner, string station) { PartCheck checkSetting = this.GetPartCheckSettingData(part.ValueType); if (checkSetting == null) { string msg = string.Format("PartCheck data of {0} type does not exist.", part.Type); Exception ex = new Exception(msg); throw ex; } if (checkSetting.NeedCheck == 1) { string realSn = ProductPart.PartSpecialDeal(part.Type, part.ValueType, part.MatchedSn); owner.PartUniqueCheck(part.PN, realSn); } }
//2010-03-23 private void checkPartForbidden(IBOMPart part, IProduct thisProduct) { try { part.CheckHold(thisProduct.Family, thisProduct.Model); } catch (FisException ex) { ex.stopWF = false; throw ex; } catch (Exception ex) { throw ex; } }
public override bool Match(string target, IBOMPart part, string station, string valueType, out bool containCheckBit) { containCheckBit = false; return base.Match(target, part, station, valueType, out containCheckBit); }
public override void Check(IBOMPart part, IPartOwner owner, string station) { //1.在PartSN存在 //2.唯一性检查:只能与一个ProId绑定 base.Check(part, owner, station); }
/// <summary> /// 使用PartCheckMatch中定义的规则match /// 1. 14码 /// 2. Code=COAStatus.COASN; COAStatus.CustPN=BOM中的PartNo. /// </summary> /// <param name="target">需要匹配的字符串</param> /// <param name="part">part</param> /// <param name="containCheckBit">是否包含校验位</param> /// <returns></returns> public override bool Match(string target, IBOMPart part, string station, string valueType, out bool containCheckBit) { if (!valueType.Equals(("SN"))) { return base.Match(target, part, station, valueType, out containCheckBit); } if (!base.Match(target, part, station, valueType, out containCheckBit)) { return false; } // containCheckBit = false; // if (target.Length != 14) // { // return false; // } var coaRepository = RepositoryFactory.GetInstance().GetRepository<ICOAStatusRepository, COAStatus>(); COAStatus coa = coaRepository.Find(target); if (coa == null) { return false; } if (!coa.IECPN.Equals(part.PN)) { return false; } return true; }
/// <summary> /// 1.COA是可用状态(COAStatus.Status = P1 or A2 or A3) /// 注: /// 最后的实现按宋杰在Unit Label Print UC中的描述完成: /// COAStatus.COASN=code and COAStatus.Line=@PdLine and COAStatus.Status为P2或A2、A3 /// </summary> /// <param name="part">需要check的part</param> /// <param name="owner">PartOwner</param> public override void Check(IBOMPart part, IPartOwner owner, string station) { // if (!part.ValueType.Equals(("SN"))) // { // base.Check(part, owner, station); // return; // } Session session = SessionManager.GetInstance.GetSession(((IProduct)owner).ProId, Session.SessionType.Product); var coaRepository = RepositoryFactory.GetInstance().GetRepository<ICOAStatusRepository, COAStatus>(); COAStatus coa = coaRepository.Find(part.MatchedSn); if ( (!coa.Status.Equals(COAStatus.COAStatusConst.A2) && !coa.Status.Equals(COAStatus.COAStatusConst.A3) && !coa.Status.Equals(COAStatus.COAStatusConst.P2) ) || !coa.LineID.Equals(session.Line) ) { List<string> erpara = new List<string>(); erpara.Add(part.MatchedSn); var ex = new FisException("CHK046", erpara); throw ex; } }
/// <summary> /// Check part: ///A.Code(3) in ‘0123456789’ /// Code(4) in ‘0123456789ABC’ /// Code(5) in A:AOI (A面) /// M:MB (B面) /// V :VGA/B ///B.按照process定义来判断MB是否能与ProId进行绑定,可以进入32站 ///C.MB SN#前两码=TC阶model的MB属性 /// </summary> public override void Check(IBOMPart part, IPartOwner owner, string station) { // if (!part.ValueType.Equals(("SN"))) // { // base.Check(part, owner, station); // return; // } IProduct product = (IProduct)owner; //A. Check MB Sn format // const string code3Range = "0123456789"; // const string code4Range = "0123456789ABC"; // const string code5Range = "AMV"; // // if (!code3Range.Contains(part.MatchedSn.Substring(2, 1)) // || !code4Range.Contains(part.MatchedSn.Substring(3, 1)) // || !code5Range.Contains(part.MatchedSn.Substring(4, 1))) // { // List<string> erpara = new List<string>(); // erpara.Add(part.MatchedSn); // var ex = new FisException("CHK048", erpara); // throw ex; // } //B. Block station fo MB IProcessRepository processRepository = RepositoryFactory.GetInstance().GetRepository<IProcessRepository, Process>(); Session session = SessionManager.GetInstance.GetSession(product.ProId, Session.SessionType.Product); processRepository.SFC(session.Line, session.Customer, "32", part.MatchedSn, "MB"); //对于MB,不论在任何站与Product绑定,该站的站号都是32 //C.MB SN#前两码=TC阶model的MB属性 string vbCode = ((IProduct)owner).ModelObj.GetAttribute("MB"); // Vincent 2011-08-04 ModelInfo MB name have more than one MBCode value example MB=A7~A6 //if (part.MatchedSn.Substring(0, 2) != vbCode) if (!vbCode.Contains(part.MatchedSn.Substring(0, 2))) { List<string> erpara = new List<string>(); erpara.Add(part.MatchedSn); var ex = new FisException("CHK070", erpara); throw ex; } // Check the PCB has been used by other product IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>(); IList<IProduct> productList = productRepository.GetProductListByPCBID(part.MatchedSn); if (productList.Count > 0) { List<string> erpara = new List<string>(); erpara.Add("MB"); erpara.Add(part.MatchedSn); erpara.Add(""); var ex = new FisException("CHK009", erpara); throw ex; } // Check the PCB has been used by other product }
/// <summary> /// 唯一性检查:只能与一个ProId绑定 /// </summary> /// <param name="part"></param> /// <param name="owner"></param> public override void Check(IBOMPart part, IPartOwner owner, string station) { //1.在PartSN存在 // IPartSnRepository rep = RepositoryFactory.GetInstance().GetRepository<IPartSnRepository, PartSn>(); // PartSn psn = rep.Find(part.MatchedSn); // if (psn == null) // { // List<string> erpara = new List<string>(); // erpara.Add(part.MatchedSn); // var ex = new FisException("CHK047"); // throw ex; // } //2.唯一性检查:只能与一个ProId绑定 base.Check(part, owner, station); }