Exemple #1
0
        /// <summary>
        /// Bind part to owner
        /// 1.Update COAStatus, Status=A1
        ///2.记录COALOG
        ///3.Product.COAID=Code
        /// </summary>
        /// <param name="part">part</param>
        /// <param name="owner">owner</param>
        public override void BindTo(IProductPart part, IPartOwner owner)
        {
//            if (!part.ValueType.Equals(("SN")))
//            {
//                base.BindTo(part, owner);
//                return;
//            }

            var product = (IProduct)owner;
            Session session = SessionManager.GetInstance.GetSession(product.ProId, Session.SessionType.Product);
            var productRepoistory = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            var coaRepository = RepositoryFactory.GetInstance().GetRepository<ICOAStatusRepository, COAStatus>();
            COAStatus coa = coaRepository.Find(part.Value);

            //1
            coa.Status = COAStatus.COAStatusConst.A1;

            //2
            var log = new COALog
                          {
                              COASN = coa.COASN,
                              StationID = session.Station,
                              LineID = session.Line,
                              Editor = session.Editor,
                              Cdt = DateTime.Now
                          };
            coa.addCOALog(log);

            //3
            product.COAID = part.Value;

            coaRepository.Update(coa, session.UnitOfWork);
            productRepoistory.Update(product, session.UnitOfWork);
        }
Exemple #2
0
        public void BindTo(PartUnit part, IPartOwner owner, string station, string editor, string key)
        {
#if DEBUG
            ISaveModule saver = (ISaveModule)GetInstance(_saveModule, typeof(ISaveModule));
#else
            ISaveModule saver = PartSpecialCodeContainer.GetInstance.GetSaveModule(_saveModule);
#endif
            if (saver != null)
            {
                saver.Save(part, owner, station, key);
            }

            if (NeedCommonSave)
            {
                IProductPart newPart = new ProductPart();
                newPart.PartSn = part.Sn;        //sn
                newPart.PartID = part.Pn;       //pn
                newPart.BomNodeType = part.Type; //BomNodeType
                newPart.PartType = part.ValueType; //part.Type
                newPart.CheckItemType = part.ItemType; //CheckItemType
                newPart.CustomerPn = part.CustPn??string.Empty;
                newPart.Iecpn = part.IECPn??string.Empty;
                newPart.Station = station;
                newPart.Editor = editor;
                owner.AddPart(newPart);
            }
        }
Exemple #3
0
 public override void BindTo(IProductPart part, IPartOwner owner)
 {
     var product = (IProduct)owner;
     Session session = SessionManager.GetInstance.GetSession(product.ProId, Session.SessionType.Product);
     var productRepoistory = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
     product.IMEI = part.Value;
     productRepoistory.Update(product, session.UnitOfWork); 
 
 }
Exemple #4
0
        /// <summary>
        /// Check Vendor CT是否有结合厂内CT:Table:TSB..KPDet_LCM  灯管 
        /// 唯一性检查:只能与一个ProId绑定
        /// </summary>
        /// <param name="part"></param>
        /// <param name="owner"></param>
        public override void Check(IMES.FisObject.Common.BOM.IBOMPart part, IPartOwner owner)
        {
            //Check Vendor CT是否有结合厂内CT:Table:TSB..KPDet_LCM  灯管 
            //todo: how to check
            int i; 

            //唯一性检查:只能与一个ProId绑定
            base.Check(part, owner);
        }
Exemple #5
0
        /// <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);
            }
        }
Exemple #6
0
        /// <summary>
        /// 将part绑定到Product/MB的默认实现,即直接绑定至owner
        /// </summary>
        /// <param name="part">part</param>
        /// <param name="owner">owner</param>
        public virtual void BindTo(IProductPart part, IPartOwner owner)
        {
            PartCheck checkSetting = this.GetPartCheckSettingData(part.ValueType);
            if (checkSetting == null)
            {
                string msg = string.Format("PartCheck data of {0} type does not exist.", part.PartType);
                Exception ex = new Exception(msg);
                throw ex;
            }

            part = ProductPart.PartSpecialDeal(part);

            if (checkSetting.NeedSave == 1)
            {
                owner.AddPart(part);
            }
        }
Exemple #7
0
 public void Save(IPartOwner owner, string station, string editor, string key)
 {
     foreach (PartUnit partUnit in CheckedPart)
     {
         Save(partUnit, owner, station, editor, key);
     }
 }
Exemple #8
0
 public void Save(PartUnit pu, IPartOwner owner, string station, string editor, string key)
 {
     if (PartPolicy != null)
     {
         //Vincent add check customize need save
         //bool saveFlag = true;
         //if (_needSave.HasValue)
         //{
         //    saveFlag = _needSave.Value;
         //}
        
         //if (saveFlag)
         //{
         PartPolicy.BindTo(pu, owner, station, editor, key, _needCommonSave, _needSave);
         //}
     }
 }
Exemple #9
0
 public void Check(PartUnit pu, IPartOwner owner, string station, IFlatBOM bom)
 {
     if (PartPolicy != null)
     {
         PartPolicy.Check(pu, this, owner, station, bom);
     }
 }
Exemple #10
0
        public void Check(PartUnit pu, IPartOwner owner, string station)
        {
            if (CurrentMatchedBomItem.RelationBomItem != null)
            {
                int relationQty = CurrentMatchedBomItem.RelationBomItem.CheckedPart.Count;
                int checkedQty = CurrentMatchedBomItem.CheckedPart.Count;
                if (relationQty == 0 ||
                   checkedQty >= relationQty)
                {
                    throw new FisException("BOM002", new string[] { CurrentMatchedBomItem.RelationBomItem.Descr ?? string.Empty });
                }
            }

            CurrentMatchedBomItem.Check(pu, owner, station, this);
        }
Exemple #11
0
 /// <summary>
 /// Part检查,通常包括唯一性检查等
 /// </summary>
 /// <param name="owner">owner</param>
 /// <param name="station">station</param>
 public void Check(IPartOwner owner, string station)
 {
     this.PartStrategy.Check(this, owner, station);
 }
Exemple #12
0
        /// <summary>
        /// Bind pat to owner:
        /// A.Product.PCBID=mb sn#
        ///B.需要修改MB 的PCA..PCBStatus.Station = 32
        ///C.记录MB Log  Inert PCA..PCBLog
        ///D.将MB相关信息写入Product表:
        ///Product.PCBModel=PCA..PCB.PCBModelID
        ///Product. MAC =PCA..PCB. MAC
        ///Product. UUID =PCA..PCB. UUID
        ///Product. MBECR =PCA..PCB. ECR
        /// </summary>
        /// <param name="part">part</param>
        /// <param name="owner">owner</param>
        public override void BindTo(IProductPart part, IPartOwner owner)
        {
//            if (!part.ValueType.Equals(("SN")))
//            {
//                base.BindTo(part, owner);
//                return;
//            }

            var product = (IProduct)owner;
            Session session = SessionManager.GetInstance.GetSession(product.ProId, Session.SessionType.Product);
            var productRepoistory = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            var mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();
            var mb = mbRepository.Find(part.Value);

            string line = string.IsNullOrEmpty(session.Line) ? product.Status.Line : session.Line;

            //A
            product.PCBID = mb.Sn;

            //B
            var status = new MBStatus(mb.Key.ToString(), "32", MBStatusEnum.Pass , session.Editor, line, DateTime.Now, DateTime.Now);
            mb.MBStatus = status;

            //C
            var mbLog = new MBLog(
                0,
                mb.Sn,
                mb.Model,
                "32",
                1,
                line,
                session.Editor,
                DateTime.Now);

            mb.AddLog(mbLog);

            //D
            product.PCBModel = mb.Model;
            product.MAC = mb.MAC;
            product.UUID = mb.UUID;
            product.MBECR = mb.ECR;
            product.CVSN = mb.CVSN;

            mbRepository.Update(mb, session.UnitOfWork);
            productRepoistory.Update(product, session.UnitOfWork);
            
        }
Exemple #13
0
 /// <summary>
 /// update part owner
 /// </summary>
 /// <param name="owner"></param>
 protected void UpdatePartOwner(IPartOwner owner)
 {
     //PVS站需要通过Product找到Pizza,此时PartOwner和MainObject不再是同一个对象Product是MainObject,Pizza是PartOwner
     if (this.Station.Equals("8E") || this.Station.Equals("PZ"))   //PVS
     {
         IPizzaRepository repPizza = RepositoryFactory.GetInstance().GetRepository<IPizzaRepository, Pizza>();
         repPizza.Update((Pizza)owner, CurrentSession.UnitOfWork);
     }
     else
     {
         this.UpdateMainObject(owner);
     }
 }
Exemple #14
0
        /// <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;
            }
        }
Exemple #15
0
        /// <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

        }
Exemple #16
0
        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()) });
                    }
                }
            }
        }
Exemple #17
0
 public override void Check(IBOMPart part, IPartOwner owner, string station)
 {
     //1.在PartSN存在
     //2.唯一性检查:只能与一个ProId绑定
     base.Check(part, owner, station);
 }
Exemple #18
0
        /// <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);
        }