Exemple #1
0
        /// <summary>
        /// 向QCStatus寫入記錄
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

            IProduct product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);

            ProductQCStatus status = new ProductQCStatus(-1, product.ProId, Type, product.Status.Line, product.Model, Convert.ToString(Status, 16).ToUpper(), Editor, DateTime.Now, DateTime.Now);
            status.Remark = Remark;

            product.AddQCStatus(status);

            IProductRepository ipr = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();


            ipr.Update(product, CurrentSession.UnitOfWork);

            //Add by Benson

            if (!string.IsNullOrEmpty(ProductAttrName))
            {
                product.SetAttributeValue(ProductAttrName, Convert.ToString(Status, 16).ToUpper(), Editor, Station, "");

            }
            else if (!string.IsNullOrEmpty(Type))
            {
                product.SetAttributeValue(Type+"_QCStatus", Convert.ToString(Status, 16).ToUpper(), Editor, Station, "");
               
            }


            //Add by Benson

            return base.DoExecute(executionContext);
        }
Exemple #2
0
        /// <summary>
        /// 向QCStatus寫入記錄
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            IPartRepository ipartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
            IFamilyRepository famliyRep = RepositoryFactory.GetInstance().GetRepository<IFamilyRepository, Family>();
           
            IList<string> setList =new List<string>();
            string paqcStation = "PAQCStation";
            IProduct product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);

            #region Check PAQC Station Rule  by FamilyInfo.Category or BSam Model
            if ((string)CurrentSession.GetValue(ExtendSession.SessionKeys.IsBSamModel) == "Y")
            {
                paqcStation = "BSam" + paqcStation;
            }
            else
            {
                string family = product.Family;
                FamilyInfoDef fcond = new FamilyInfoDef();
                fcond.family = family;
                fcond.name = "Category";
                IList<FamilyInfoDef> famValList = famliyRep.GetExistFamilyInfo(fcond);
                if (famValList.Count > 0)
                {
                    paqcStation = famValList[0].value.Trim() + paqcStation;
                }
            }
            #endregion

            setList = ipartRepository.GetValueFromSysSettingByName(paqcStation);
      //     setList= ipartRepository.GetValueFromSysSettingByName("PAQCStation");;

            IList<string> siteList = ipartRepository.GetValueFromSysSettingByName("Site");
            string site = (siteList != null && siteList.Count > 0 && !string.IsNullOrEmpty(siteList[0])) ? siteList[0].Trim() : "IPC";
            
            try
            {
              
                if (setList.Count > 0 && setList[0].Trim() == CurrentSession.Station.Trim())
                {
                    //IProduct product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
                    string writeStatus;
                    string remark = "";
                    int qcRatio = 0;
                    string lastQCStatus = "";                    
                    //string specialRuleQCStatus = "";
                    bool isQC = false;
                    CurrentSession.AddValue(Session.SessionKeys.QCStatus, false);
                    if (site != "ICC")
                    {
                        isQC = CalQCStatus(site, product, out qcRatio, out lastQCStatus);
                        if (isQC)
                        {
                            if (string.IsNullOrEmpty(lastQCStatus))
                            {
                                writeStatus = this.QCStatus;
                            }
                            else
                            {
                                writeStatus = lastQCStatus;
                            }

                            remark = this.Remark.Trim();
                        }
                        ////else if( site=="ICC" && qcRatio>0  && CalQCStatusForICC(product)){
                        //else if (site == "ICC" && qcRatio > 0 && CalQCStatusForICCSpecialRule(product, out specialRuleQCStatus))
                        //{
                        //    //writeStatus = string.IsNullOrEmpty(this.QCSpecialStatus)?this.QCStatus: this.QCSpecialStatus ;
                        //    writeStatus = specialRuleQCStatus;
                        //    remark = this.Remark.Trim();
                        //    isQC = true;
                        //}
                        else
                        {
                            writeStatus = this.NotQCStatus;
                        }
                    }
                    else  //for ICC Site
                    {
                        bool bByModel=false;
                        bool bByFamily =false;
                       isQC= CheckReworkQCStatusAndRatio(product, out qcRatio, out lastQCStatus, out bByModel, out bByFamily);
                       if (isQC)
                       {
                           if (string.IsNullOrEmpty(lastQCStatus))
                           {
                               writeStatus = this.QCStatus;
                           }
                           else
                           {
                               writeStatus = lastQCStatus;
                           }
                           remark = this.Remark.Trim();
                       }
                       else if (qcRatio == 0) //禁止抽檢
                       {
                           isQC = false;
                           writeStatus = this.NotQCStatus;
                       }
                       else
                       {
                           isQC = CalQCStatusForICCSP(product, bByModel, bByFamily, qcRatio, out writeStatus);
                       }


                    }

                    CurrentSession.AddValue(Session.SessionKeys.QCStatus, isQC);

                  
                    ProductQCStatus status = new ProductQCStatus(-1,
                                                                                                product.ProId,
                                                                                                Type,
                                                                                                string.IsNullOrEmpty(this.Line) ? product.Status.Line : this.Line,
                                                                                                product.Model,
                                                                                                writeStatus,
                                                                                                Editor,
                                                                                                DateTime.Now,
                                                                                                DateTime.Now);
                    status.Remark = remark;
                    product.AddQCStatus(status);


                    if (!string.IsNullOrEmpty(ProductAttrName))
                    {
                        product.SetAttributeValue(ProductAttrName, writeStatus, Editor, this.Station, remark);
                    }
                    else if (!string.IsNullOrEmpty(Type))
                    {
                        product.SetAttributeValue(Type + "_QCStatus", writeStatus, Editor, this.Station, remark);
                    }
                   

                    if (IsWriteProductLog && isQC)
                    {
                        WriteProductLog(product);
                    }

                    IProductRepository prodRep = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
                    prodRep.Update(product, CurrentSession.UnitOfWork);
                
                }
            }
             catch (FisException fe)
            {
                fe.stopWF = IsStopWF;
                throw fe;
              
            }
            return base.DoExecute(executionContext);
        }
Exemple #3
0
        /// <summary>
        /// 更新QCStatus記錄(按照Cdt倒排序找到ProductID对应的最新纪录)
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override System.Workflow.ComponentModel.ActivityExecutionStatus DoExecute(System.Workflow.ComponentModel.ActivityExecutionContext executionContext)
        {
            IProduct product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);
            IList<ProductQCStatus> QCStatusList = product.QCStatus;

            if (QCStatusList != null && QCStatusList.Count > 0)
            {
                ProductQCStatus qcStatus = QCStatusList[0];

                if (Type == "PAQC")
                {
                    qcStatus = QCStatusList.FirstOrDefault(status => status.Type == Type && status.Status == "8");
                }
                if (qcStatus == null)
                {
                    throw new FisException("CHK041", new string[]{});
                }

                ProductQCStatus updateQCStatusObj = new ProductQCStatus(qcStatus.ID, qcStatus.ProductID, qcStatus.Type, qcStatus.Line, qcStatus.Model, Convert.ToString(Status, 16).ToUpper(), qcStatus.Editor, qcStatus.Cdt, DateTime.Now);
                if (Type == "EPIA")
                    updateQCStatusObj.Remark = "1";
                else
                    updateQCStatusObj.Remark = qcStatus.Remark;
                
                if(Type =="EPIAOutputForDocking")
                        updateQCStatusObj.Type="PIA";

                product.UpdateQCStatus(updateQCStatusObj);
                //Add by Benson
        
                if (!string.IsNullOrEmpty(ProductAttrName))
                {
                   product.SetAttributeValue(ProductAttrName, Convert.ToString(Status, 16).ToUpper(), Editor, Station, "");

                }
                else if (!string.IsNullOrEmpty(Type))
                {
                    product.SetAttributeValue(Type + "_QCStatus", Convert.ToString(Status, 16).ToUpper(), Editor, Station, "");

                }
            
                //Add by Benson

                IProductRepository ipr = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();
                ipr.Update(product, CurrentSession.UnitOfWork);
            }
            else
            {
                throw new FisException("CHK041", new string[] { });
            }

            return base.DoExecute(executionContext);
        }
Exemple #4
0
        /// <summary>
        /// 更新QCStatus
        /// </summary>
        /// <param name="status">status</param>
        public void UpdateQCStatus(ProductQCStatus status)
        {
            if (status == null)
                return;

            lock (_syncObj_qcStatus)
            {
                object naught = QCStatus;
                // classic finding process
                for (int i = 0; i < _qcStatus.Count; ++i)
                {
                    if (_qcStatus[i].ID == status.ID)
                    {
                        _qcStatus[i] = status;
                        _tracker.MarkAsModified(status);
                        _tracker.MarkAsModified(this);

                        break;
                    }
                }
            }
        }
Exemple #5
0
        ///<summary>
        /// 添加QCStatus
        ///</summary>
        ///<param name="status">QCStatus</param>
        public void AddQCStatus(ProductQCStatus status)
        {
            if (status == null)
                return;

            lock (_syncObj_qcStatus)
            {
                object naught = QCStatus;
                if (_qcStatus.Contains(status))
                    return;

                status.Tracker = _tracker.Merge(status.Tracker);
                _qcStatus.Add(status);
                //QCStatus.Add(status);
                _tracker.MarkAsAdded(status);
                _tracker.MarkAsModified(this);
            }
        }