示例#1
0
        public void UpdateMaterialByCtList(IList<string> ctList,string stage,string editor,string station,string action,string line)
        {
            try
            {
                IMaterialRepository MaterialRepository = RepositoryFactory.GetInstance().GetRepository<IMaterialRepository, Material>();
                IUnitOfWork uow = new UnitOfWork();
                foreach (string ct in ctList)  // For Mantis0000539
                {
                  Material m=MaterialRepository.Find(ct);
                  MaterialLog mLog = new MaterialLog();
                  mLog.Status="Collect";
                  mLog.Line="";
                  mLog.Stage=stage;
                  mLog.Editor=editor;
                  mLog.PreStatus = m.Status;
                  mLog.Action = "Combine Lot";
                  m.AddMaterialLog(mLog);
                  MaterialRepository.Update(m, uow);
                }

                //MaterialRepository.AddMultiMaterialCurStatusLogDefered
                //    (uow, ctList, action, stage, line, station, "", editor);
                 
                 MaterialRepository.UpdateMultiMaterialCurStatusDefered(uow, ctList, station, editor);
                 uow.Commit();
            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw e;
            }
            finally
            {
                logger.Debug("(CollectionMaterialLot)UpdateMaterialByCtList ");
            }
        
        }
示例#2
0
        public void Save(object part_unit, object part_owner, string station, string key)
        {
            //return;
            if (part_unit == null)
            {
                throw new ArgumentNullException();
            }
            if (part_owner == null)
            {
                throw new ArgumentNullException();
            }
            //if (part_unit != null)
            //{
            var product = (Product)part_owner;
            Session session = SessionManager.GetInstance.GetSession(product.ProId, Session.SessionType.Product);
            if (session == null)
            {
                throw new InstanceNotFoundException("Can not get Session instance from SessionManager!");
            }

            string snCpu = ((PartUnit)part_unit).Sn;

            string CheckMaterialStatus = session.GetValue("CheckMaterialCpuStatus") as string;
            if ("Y".Equals(CheckMaterialStatus))
            {
                IMaterialRepository MaterialRepository = RepositoryFactory.GetInstance().GetRepository<IMaterialRepository, Material>();
                Material mat = session.GetValue("MaterialCpu") as Material;

                MaterialLog mlog = new MaterialLog();
                mlog.Action = "Combine Key Parts";
                mlog.Cdt = DateTime.Now;
                mlog.Comment = "";
                mlog.Editor = session.Editor;
                mlog.Line = session.Line;
                mlog.MaterialCT = snCpu;
                mlog.PreStatus = mat.Status;
                mlog.Stage = "FA";
                mlog.Status = "Assembly";

                mat.AddMaterialLog(mlog);

                mat.PreStatus = mat.Status;
                mat.Status = "Assembly";
                mat.Udt = DateTime.Now;
                MaterialRepository.Update(mat, session.UnitOfWork);

            }

            session.AddValue("OldCVSN", product.CVSN);
            product.CVSN = snCpu;
            //    var product_part = new ProductPart();
            //    product_part.BomNodeType = ((PartUnit)part_unit).Type;
            //    product_part.Iecpn = ((PartUnit)part_unit).IECPn;
            //    product_part.PartSn = ((PartUnit)part_unit).Sn;
            //    product_part.PartType = ((PartUnit)part_unit).ValueType;
            //    product_part.Station = station;
            //    product_part.CustomerPn = ((PartUnit)part_unit).CustPn;
            //    product_part.Editor = session.Editor;
            //    product_part.ValueType = ((PartUnit)part_unit).ValueType;
            //    product_part.ProductID = ((PartUnit)part_unit).ProductId;
            //    product_part.PartID = ((PartUnit)part_unit).Pn;

            //    product.AddPart(product_part);

            IProductRepository product_repository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
            product_repository.Update(product, session.UnitOfWork);

            ////}
            ////else
            ////{
            ////    throw new FisException("CHK174", new string[] { "IMES.CheckItemModule.CPU.Filter.SaveModule.Save" });
            ////}
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            MB currentMB = (MB)CurrentSession.GetValue(Session.SessionKeys.MB);
            string cvsn = (string)CurrentSession.GetValue(Session.SessionKeys.CPUVendorSn);
            IPartRepository partRep = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            string valCheckMaterialStatus = "";
            IList<ConstValueInfo> valueList = partRep.GetConstValueListByType("CheckMaterialStatus");
            if (null != valueList)
            {
                var valueListCpu = (from p in valueList
                                    where p.name == "SACPU"
                                    select p).ToList();
                if (valueListCpu != null && valueListCpu.Count > 0)
                    valCheckMaterialStatus = valueListCpu[0].value;
            }
            if ("Y" != valCheckMaterialStatus && "N" != valCheckMaterialStatus)
            {
                // 请联系IE维护是否需要检查CPU状态
                throw new FisException("CQCHK0050", new string[] { });
            }

            bool needCheckMaterialStatus = false;
            if ("Y" == valCheckMaterialStatus)
            {
                needCheckMaterialStatus = true;

                IList<ConstValueTypeInfo> lstConstValueType = partRep.GetConstValueTypeList("NoCheckOnBoardCPUStatus_SA");
                if (null != lstConstValueType)
                {
                    foreach (ConstValueTypeInfo cvt in lstConstValueType)
                    {
                        if (cvt.value == currentMB.Family)
                        {
                            needCheckMaterialStatus = false;
                            break;
                        }
                    }
                }
            }
            if (needCheckMaterialStatus)
            {
                IMaterialRepository MaterialRepository = RepositoryFactory.GetInstance().GetRepository<IMaterialRepository, Material>();

                IList<string> lst = new List<string>();
                lst.Add(cvsn);
                IList<Material> lstMaterials = MaterialRepository.GetMaterialByMultiCT(lst);
                if (null == lstMaterials || lstMaterials.Count == 0)
                {
                    // 此CPU:@CPUCT未收集
                    FisException fex = new FisException("CQCHK0051", new string[] { cvsn });
                    fex.stopWF = false;
                    throw fex;
                }

                Material mat = lstMaterials[0];
                if ("Collect" != mat.Status && "Dismantle" != mat.Status)
                {
                    // 此CPU:@CPUCT为不可结合状态
                    FisException fex = new FisException("CQCHK0052", new string[] { cvsn });
                    fex.stopWF = false;
                    throw fex;
                }


                MaterialLog mlog = new MaterialLog();
                mlog.Action = "SA CombineCPU";
                mlog.Cdt = DateTime.Now;
                mlog.Comment = "";
                mlog.Editor = this.Editor;
                mlog.Line = this.Line;
                mlog.MaterialCT = cvsn;
                mlog.PreStatus = mat.Status;
                mlog.Stage = "SA";
                mlog.Status = "Assembly";

                mat.AddMaterialLog(mlog);

                mat.PreStatus = mat.Status;
                mat.Status = "Assembly";
                mat.Udt = DateTime.Now;
                MaterialRepository.Update(mat, CurrentSession.UnitOfWork);

            }
            

            return base.DoExecute(executionContext);
        }