Ejemplo n.º 1
0
 /// <summary>
 /// UpdateMTAMark
 /// </summary>
 /// <param name="executionContext"></param>
 /// <returns></returns>
 protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
 {
     IMB currentMB = CurrentSession.GetValue(Session.SessionKeys.MB) as IMB;
     string mbSNo = this.Key;
     IMBRepository currentMBRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();
     IList<int> repIdLst = (IList<int>)currentMBRepository.GetPcbRepairDefectInfoIdListWithDefect(mbSNo);
     foreach (var r in repIdLst)
     {
         MtaMarkInfo setValue = new MtaMarkInfo();
         MtaMarkInfo condition = new MtaMarkInfo();
         setValue.mark = "1";
         condition.rep_Id = r;
         currentMBRepository.UpdateMtaMarkInfoDefered(CurrentSession.UnitOfWork, setValue, condition);
     }
     
     return base.DoExecute(executionContext);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 用于初次进入Repair时,根据TestLog创建Repair信息。
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {
            IRepairTarget repairTarget = GetRepairTarget();
            IList<RepairDefect> repairDefects = new List<RepairDefect>();

            TestLog testLog;
            //2012-01-10
            //There maybe "PCA Repair Input" staion in SA process before "PCA Repair", 
            //so MBStatus.Station is not necessorily a test station. Therefor we get 
            //latestTestlog for SA in a different way than we have done for FA and PAQC.
            //For SA we get the latest test FAIL log, while for others we get the latest
            //log and check whether it's pass or fail.
            if (string.Compare(RepairStationType, "SA", true) == 0)
            {
                testLog = repairTarget.LatestFailTestLog;
                if (testLog == null)
                {
                    var errpara = new List<string> { Key };
                    throw new FisException("CHK025", errpara);
                }
            }
            else
            {
                testLog = repairTarget.LatestTestLog;
                if (testLog == null)
                {
                    var errpara = new List<string> { Key };
                    throw new FisException("CHK025", errpara);
                }
                if (testLog.Status == TestLog.TestLogStatus.Pass)
                {
                    var errpara = new List<string>();
                    throw new FisException("CHK024", errpara);
                }
            }
            
            //get Latest fail log id
            int logId = 0;
            
            if (string.Compare(RepairStationType, "SA", true) == 0)
            {
                MBLog log = ((IMB) repairTarget).GetLatestFailLog();
                if (log != null)
                {
                    logId = log.ID;
                }
            }
            else
            {
                ProductLog log = ((IProduct)repairTarget).GetLatestFailLog();
                if (log != null)
                {
                    logId = log.Id;
                }
            }

            IList<TestLogDefect> testLogDefects = testLog.Defects;
            if (testLogDefects != null && testLogDefects.Count != 0)
            {
                RepairDefect repairDefect;
                if (string.Compare(RepairStationType, "SA", true) == 0)
                {
                    foreach (TestLogDefect defectItem in testLogDefects)
                    {
                        repairDefect = new RepairDefect(0, 0, testLog.Type, defectItem.DefectCode, null, null, null, null, null,
                                                        null, null, null, null, null, null, null, null, null, false, null,
                                                        null, null, string.Empty, null, "0", null, null, null, null, null, null, null,
                                                        null, null, null, null,testLog.Editor, DateTime.Now, DateTime.Now);
                        var mta = new MtaMarkInfo {mark = "0", rep_Id = 0};
                        repairDefect.Remark = testLog.Descr.Length > 1024 ? testLog.Descr.Substring(0, 1024) : testLog.Descr;
                        repairDefect.MTAMark = mta;
                        repairDefects.Add(repairDefect);
                    }
                }
                else if (string.Compare(RepairStationType, "FA", true) == 0)
                {
                    foreach (TestLogDefect defectItem in testLogDefects)
                    {
                        repairDefect = new RepairDefect(0, 0, testLog.Type, defectItem.DefectCode, null, null, null, null, null,
                                                        null, null, null, null, null, null, null, null, null, false, null,
                                                        null, null, "0", null, "0", null, null, null, null, null, null, null,
                                                        null, null, null, null, testLog.Editor, DateTime.Now, DateTime.Now);
                        //Add Return Station:
                        var stationRepository = RepositoryFactory.GetInstance().GetRepository<IMES.FisObject.Common.Station.IStationRepository, IMES.FisObject.Common.Station.IStation>();
                        IProduct productObj = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product);                        
                        
                        if(productObj == null)
                        {
                            List<string> errpara = new List<string>();
                            errpara.Add(this.Key);                            
                            throw new FisException("SFC002", errpara);
                        }
                        else
                        {
                            /*DefectCodeStationInfo cond = new DefectCodeStationInfo();
                            IList<DefectCodeStationInfo> info = null;
                            cond.defect = defectItem.DefectCode;
                            cond.pre_stn = productObj.Status.StationId;
                            cond.crt_stn = this.Station;
                            info = stationRepository.GetDefectCodeStationList(cond);
                            if (info != null && info.Count > 0)
                            {
                                repairDefect.ReturnStation = info[0].nxt_stn;
                            }
                            else
                            {
                                List<string> errpara = new List<string>();
                                FisException e = new FisException("CHK830", errpara);
                                throw e;                                
                            }*/
                        }
                        repairDefects.Add(repairDefect);
                    }
                }
                else if (string.Compare(RepairStationType, "PAQC", true) == 0)
                {
                    foreach (TestLogDefect defectItem in testLogDefects)
                    {
                        repairDefect = new RepairDefect(0, 0, testLog.Type, defectItem.DefectCode, null, null, null, null, null,
                                                        null, null, null, null, null, null, null, null, null, false, null,
                                                        null, null, "0", null, "0", null, null, null, null, null, null, null,
                                                        null, null, null, null, testLog.Editor, DateTime.Now, DateTime.Now);

                        repairDefects.Add(repairDefect);
                    }
                }
                else
                {
                    foreach (TestLogDefect defectItem in testLogDefects)
                    {
                        repairDefect = new RepairDefect(0, 0, testLog.Type, defectItem.DefectCode, null, null, null, null, null,
                                                        null, null, null, null, null, null, null, null, null, false, null,
                                                        null, null, string.Empty, null, "0", null, null, null, null, null, null, null,
                                                        null, null, null, null, testLog.Editor, DateTime.Now, DateTime.Now);

                        repairDefects.Add(repairDefect);
                    }
                }
            }

            var repair = new Repair(0, testLog.Sn, repairTarget.RepairTargetModel, testLog.Type, testLog.Line, testLog.Station, Repair.RepairStatus.NotFinished, repairDefects, testLog.Editor, testLog.ID.ToString(), logId, DateTime.Now, DateTime.Now);
            repairTarget.AddRepair(repair);
            UpdateRepairTarget(repairTarget);
            CurrentSession.AddValue(ExtendSession.SessionKeys.IsOQCRepair, false);

            return base.DoExecute(executionContext);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// If WC='33' Insert [MTA_Mark]
 /// </summary>
 /// <param name="executionContext"></param>
 /// <returns></returns>
 protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
 {
     /*
      * Answer to: ITC-1360-0198
      * Description: Insert MTA Mark table if WC=33.
      */
     IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>();
     IMB mb = (IMB)CurrentSession.GetValue(Session.SessionKeys.MB);
     if (mb.MBStatus.Station == "33")
     {
         IList<Repair> repairList = mb.Repairs;
         foreach (Repair ele in repairList)
         {
             if (ele.Station == "33")
             {
                 IList<RepairDefect> defectList = ele.Defects;
                 foreach (RepairDefect tmp in defectList)
                 {
                     MtaMarkInfo item = new MtaMarkInfo();
                     item.rep_Id = tmp.ID;
                     item.mark = "0";
                     mbRepository.InsertMtaMarkInfoDefered(CurrentSession.UnitOfWork, item);
                 }
             }
         }
     }
     return base.DoExecute(executionContext);
 }