/// <summary> /// 用于LCMRepair时新增/更新Defect信息。 /// </summary> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { try { bool bAdd = (bool)CurrentSession.GetValue("isAdd"); IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); RepairDefect defect = (RepairDefect)CurrentSession.GetValue(Session.SessionKeys.CurrentRepairdefect); if (bAdd) { KeyPartRepairInfo cond = new KeyPartRepairInfo(); cond.productID = this.Key; cond.status = 0; IList<KeyPartRepairInfo> repList = partRepository.GetKPRepairList(cond); if (repList.Count > 0) { defect.RepairID = repList[0].id; } defect.Type = "LCM"; defect.MTAID = ""; defect.ReturnStation = ""; partRepository.AddKPRepairDefect(defect); } else { RepairDefect cond = new RepairDefect(); cond.ID = defect.ID; defect.ID = int.MinValue; partRepository.UpdateKPRepairDefect(defect, cond); } KeyPartRepairInfo cond1 = new KeyPartRepairInfo(); cond1.productID = this.Key; cond1.status = 1; CurrentSession.AddValue(Session.SessionKeys.RepairTimes, partRepository.GetCountOfKpRepairCount(cond1)); return base.DoExecute(executionContext); } catch (Exception e) { FisException ee = new FisException(e.Message); ee.stopWF = false; throw ee; } }
private RepairDefect getOQCRepairDefect(RepairInfo repairLogInfo) { RepairDefect defect = new RepairDefect(); defect.ID = string.IsNullOrEmpty(repairLogInfo.id) ? 0 : int.Parse(repairLogInfo.id); defect._4M = repairLogInfo._4M; defect.Action = repairLogInfo.action; defect.Cause = repairLogInfo.cause; defect.Cdt = repairLogInfo.cdt; defect.Component = repairLogInfo.component; defect.Cover = repairLogInfo.cover; defect.DefectCodeID = repairLogInfo.defectCodeID; defect.Distribution = repairLogInfo.distribution; defect.Editor = repairLogInfo.editor; defect.IsManual = (!string.IsNullOrEmpty(repairLogInfo.isManual) && repairLogInfo.isManual.Equals("1")) ? true : false; defect.MajorPart = repairLogInfo.majorPart; defect.Manufacture = repairLogInfo.manufacture; defect.Mark = repairLogInfo.mark; defect.NewPart = repairLogInfo.newPart; defect.NewPartSno = repairLogInfo.newPartSno; defect.Obligation = repairLogInfo.obligation; defect.OldPart = repairLogInfo.oldPart; defect.OldPartSno = repairLogInfo.oldPartSno; defect.PartType = repairLogInfo.partType; defect.PIAStation = repairLogInfo.piaStation; defect.Remark = repairLogInfo.remark; defect.RepairID = string.IsNullOrEmpty(repairLogInfo.repairID) ? 0 : int.Parse(repairLogInfo.repairID); defect.Responsibility = repairLogInfo.responsibility; defect.ReturnSign = repairLogInfo.returnSign; defect.Site = repairLogInfo.site; defect.SubDefect = repairLogInfo.subDefect; defect.TrackingStatus = repairLogInfo.trackingStatus; defect.Type = repairLogInfo.type; defect.Udt = repairLogInfo.udt; defect.Uncover = repairLogInfo.uncover; defect.VendorCT = repairLogInfo.vendorCT; defect.VersionA = repairLogInfo.versionA; defect.VersionB = repairLogInfo.versionB; defect.NewPartDateCode = repairLogInfo.newPartDateCode; //2012-5-4 defect.Location = repairLogInfo.location; defect.MTAID = repairLogInfo.mtaID; return defect; }
private IPart checkOldSNForKP(IList<IProductPart> partList, RepairDefect defect, string type) { bool typeFlag = false; IPartRepository ipr = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); //PartType partType = null; IPart part = null; string oldSN = defect.OldPartSno; bool isHaveCheckBit = defect.OldPartSno.Trim().Length >= 14; bool isInProductPart = false; //old sn check foreach (IProductPart temp in partList) { if (isHaveCheckBit) { isInProductPart = (temp.PartSn.Equals(oldSN.Substring(0, 13)) || temp.PartSn.Equals(oldSN)); } else { isInProductPart = temp.PartSn.Equals(oldSN); } if (isInProductPart) { part = ipr.Find(temp.PartID); if (part != null) { typeFlag = true; break; } } } if (!typeFlag) { List<string> errpara = new List<string>(); FisException ex = new FisException("CHK829", errpara); ex.stopWF = false; throw ex; } return part; }
/// <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); }
/// <summary> /// MB成退 /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { try { IRepairTarget repairTarget = GetRepairTarget(); IProduct product = (IProduct)repairTarget; Repair currentRepair = repairTarget.GetCurrentRepair(); IMBRepository imr = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); IList<RepairDefect> repairDefects = new List<RepairDefect>(); RepairDefect defect = (RepairDefect)CurrentSession.GetValue(Session.SessionKeys.CurrentRepairdefect); IMiscRepository miscRpst = RepositoryFactory.GetInstance().GetRepository<IMiscRepository>(); //Insert a Repair to PCB IMB oldMB = (IMB)CurrentSession.GetValue(Session.SessionKeys.MB); Repair repair = null; RepairDefect repairDefect = new RepairDefect(0, 0, oldMB.ModelObj == null ? string.Empty : oldMB.ModelObj.Type, defect.DefectCodeID, 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, this.Editor, DateTime.Now, DateTime.Now); repairDefects.Add(repairDefect); //Update by Dean 20110615 由23-->18(SARepair Station),TSB為23,E-Book為18 repair = new Repair(0, oldMB.Sn, oldMB.Model, oldMB.ModelObj == null ? string.Empty : oldMB.ModelObj.Type, this.Line, "18", IMES.FisObject.Common.Repair.Repair.RepairStatus.NotFinished, repairDefects, this.Editor, null, DateTime.Now, DateTime.Now); oldMB.AddRepair(repair); imr.Update(oldMB, CurrentSession.UnitOfWork); //Insert Record To ReturnRepair Table ReturnRepair returnRepair = new ReturnRepair(); //ITC-1122-0188 Tong.Zhi-Yong 2010-03-05 CurrentSession.UnitOfWork.RegisterSetterBetween(new IMES.Infrastructure.UnitOfWork.SetterBetween(defect, "RepairID", returnRepair, "setter_ProductRepairID")); if (defect.ID == 0) //Add { CurrentSession.UnitOfWork.RegisterSetterBetween(new IMES.Infrastructure.UnitOfWork.SetterBetween(defect, "ID", returnRepair, "setter_ProductRepairDefectID")); } else { returnRepair.ProductRepairDefectID = defect.ID; } CurrentSession.UnitOfWork.RegisterSetterBetween(new IMES.Infrastructure.UnitOfWork.SetterBetween(repair, "ID", returnRepair, "setter_PCBRepairID")); miscRpst.AddReturnRepairDefered(CurrentSession.UnitOfWork, returnRepair); return base.DoExecute(executionContext); } catch (FisException ex) { throw; } catch (Exception ex) { throw; } }
private bool isKeyPartFail(RepairDefect defect) { IDefectInfoRepository defectRepository = RepositoryFactory.GetInstance().GetRepository<IDefectInfoRepository, IMES.FisObject.Common.Defect.DefectInfo>(); IList<CauseInfo> causeList = defectRepository.GetCauseList(Customer, this.RepairStationType); string keyPartFail = "Key Part Fail"; if (causeList != null && causeList.Count != 0) { foreach (CauseInfo item in causeList) { if (item.id.Equals(defect.Cause) && string.Compare(item.friendlyName, keyPartFail, true) == 0) { return true; } } } return false; }
private IPart checkOldSNForME(IList<IProductPart> partList, RepairDefect defect, string type) { bool typeFlag = false; IPartRepository ipr = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); PartType partType = null; IPart part = null; //old sn check foreach (IProductPart temp in partList) { if (temp.Value.Equals(defect.OldPartSno)) { part = ipr.Find(temp.PartID); if (part != null) { partType = ipr.GetPartType(part.Type); if (partType == null) { break; } else if (string.Compare(partType.PartTypeGroup, defect.PartType, true) == 0) { typeFlag = true; break; } } } } if (!typeFlag) { BOM bom = (BOM)CurrentSession.GetValue(BOMSessionKey); part = bom.Match(defect.OldPartSno, this.Station); if (part != null) { partType = ipr.GetPartType(part.Type); if (partType == null) { } else if (string.Compare(partType.PartTypeGroup, defect.PartType, true) == 0) { typeFlag = true; } } if (!typeFlag) { List<string> errpara = new List<string>(); errpara.Add(defect.OldPartSno); FisException ex = new FisException("CHK053", errpara); ex.stopWF = false; throw ex; } } return part; }
private RepairDefect GetMBRepairDefect(RepairInfo repairLogInfo) { RepairDefect defect = new RepairDefect(); defect.ID = string.IsNullOrEmpty(repairLogInfo.id) ? 0 : int.Parse(repairLogInfo.id); defect._4M = repairLogInfo._4M; defect.Action = repairLogInfo.action; defect.Cause = repairLogInfo.cause; defect.Cdt = repairLogInfo.cdt; defect.Component = repairLogInfo.component; defect.Cover = repairLogInfo.cover; defect.DefectCodeID = repairLogInfo.defectCodeID; defect.Distribution = repairLogInfo.distribution; defect.Editor = repairLogInfo.editor; defect.IsManual = (!string.IsNullOrEmpty(repairLogInfo.isManual) && repairLogInfo.isManual.Equals("1")); defect.MajorPart = repairLogInfo.majorPart; defect.Manufacture = repairLogInfo.manufacture; defect.Mark = repairLogInfo.mark; defect.NewPart = repairLogInfo.newPart; defect.NewPartSno = repairLogInfo.newPartSno; defect.Obligation = repairLogInfo.obligation; defect.OldPart = repairLogInfo.oldPart; defect.OldPartSno = repairLogInfo.oldPartSno; defect.PartType = repairLogInfo.partType; defect.PIAStation = repairLogInfo.piaStation; defect.Remark = repairLogInfo.remark; defect.RepairID = string.IsNullOrEmpty(repairLogInfo.repairID) ? 0 : int.Parse(repairLogInfo.repairID); defect.Responsibility = repairLogInfo.responsibility; defect.ReturnSign = repairLogInfo.returnSign; defect.Site = repairLogInfo.site; defect.SubDefect = repairLogInfo.subDefect; defect.TrackingStatus = repairLogInfo.trackingStatus; defect.Type = repairLogInfo.type; defect.Udt = repairLogInfo.udt; defect.Uncover = repairLogInfo.uncover; defect.VendorCT = repairLogInfo.vendorCT; defect.VersionA = repairLogInfo.versionA; defect.VersionB = repairLogInfo.versionB; defect.NewPartDateCode = repairLogInfo.newPartDateCode; //ITC-1103-0143 Tong.Zhi-Yong 2010-01-31 //defect.Location = repairLogInfo.component + repairLogInfo.site; /* * Answer to: ITC-1414-0155,ITC-1414-0156 * Description: UC updated. */ defect.Location = (repairLogInfo.majorPart + " ").Substring(0, 3) + (repairLogInfo.component + " ").Substring(0, 2) + repairLogInfo.site.TrimEnd(); defect.Side = repairLogInfo.side; return defect; }
internal void UpdateRepairDefect(RepairDefect repdfct) { if (repdfct == null) return; lock (_syncObj_defects) { object naught = this.Defects; if (this._defects == null) return; int idx = 0; bool find = false; foreach (RepairDefect dfct in this._defects) { if (dfct.Key.Equals(repdfct.Key)) { find = true; break; } idx++; } if (find) { this._defects[idx] = repdfct; this._tracker.MarkAsModified(this._defects[idx]); this._tracker.MarkAsModified(this); } } }
private IPart checkOldSN(IList<IProductPart> partList, RepairDefect defect, string type) { if (type.Equals("ME")) { return checkOldSNForME(partList, defect, type); } else { return checkOldSNForKP(partList, defect, type); } }
internal void AddRepairDefect(RepairDefect repdfct) { if (repdfct == null) return; lock (_syncObj_defects) { //if (this._defects == null) // this._defects = new List<RepairDefect>(); object naught = this.Defects; if (this._defects.Contains(repdfct)) return; repdfct.Tracker = this._tracker.Merge(repdfct.Tracker); this._defects.Add(repdfct); this._tracker.MarkAsAdded(repdfct); this._tracker.MarkAsModified(this); } }
/// <summary> /// Generate repair list of KP. /// </summary> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { IDefectRepository defectRepository = RepositoryFactory.GetInstance().GetRepository<IDefectRepository>(); IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); IList<IqcCause1Info> iqcList = new List<IqcCause1Info>(); IqcCause1Info cond1 = new IqcCause1Info(); cond1.ctLabel = Key; IqcCause1Info cond_neq = new IqcCause1Info(); cond_neq.status = "1"; iqcList = defectRepository.GetIqcCause1InfoList(cond1, cond_neq); if (iqcList.Count <= 0) { FisException ex; List<string> erpara = new List<string>(); erpara.Add(Key); ex = new FisException("CHK233", erpara); //CT:XXX没有不良记录. throw ex; } KeyPartRepairInfo cond2 = new KeyPartRepairInfo(); cond2.productID = Key; cond2.status = 0; if (partRepository.GetCountOfKpRepairCount(cond2) <= 0) { KeyPartRepairInfo kprInfo = new KeyPartRepairInfo(); kprInfo.productID = this.Key; kprInfo.model = ""; kprInfo.type = "KP"; kprInfo.line = ""; kprInfo.station = ""; kprInfo.status = 0; kprInfo.testLogID = 0; kprInfo.logID = 0; kprInfo.editor = Editor; kprInfo.cdt = DateTime.Now; kprInfo.udt = DateTime.Now; partRepository.AddKPRepair(kprInfo); foreach (IqcCause1Info tmp in iqcList) { RepairDefect defect = new RepairDefect(); defect.RepairID = kprInfo.id; defect.Type = "KP"; defect.DefectCodeID = tmp.mpDefect; defect.Mark = "0"; defect.IsManual = false; defect.Editor = Editor; defect.Cdt = DateTime.Now; defect.Udt = DateTime.Now; defect.Cause = ""; defect.Obligation = ""; defect.Component = ""; defect.Site = ""; defect.Location = ""; defect.MajorPart = ""; defect.Remark = ""; defect.VendorCT = ""; defect.PartType = ""; defect.OldPart = ""; defect.OldPartSno = ""; defect.NewPart = ""; defect.NewPartSno = ""; defect.Manufacture = ""; defect.VersionA = ""; defect.VersionB = ""; defect.SubDefect = ""; defect.PIAStation = ""; defect.Distribution = ""; defect._4M = ""; defect.Responsibility = ""; defect.Action = ""; defect.Cover = ""; defect.Uncover = ""; defect.TrackingStatus = ""; defect.MTAID = ""; defect.ReturnStation = ""; defect.ReturnSign = ""; partRepository.AddKPRepairDefect(defect); } } return base.DoExecute(executionContext); }
/// <summary> /// 为指定Repair更新一个RepairDefect /// </summary> /// <param name="repairId">指定Repair的Id</param> /// <param name="defect">指定RepairDefect</param> public void UpdateRepairDefect(int repairId, RepairDefect defect) { lock (_syncObj_repairs) { object naught = Repairs; if (_repairs != null && defect != null) { foreach (Repair rp in _repairs) { if (rp.Key.Equals(repairId)) { rp.UpdateRepairDefect(defect); rp.Tracker.MarkAsModified(rp); _tracker.MarkAsModified(this); break; } } } } }
/// <summary> /// 用于初次进入Repair时,根据TestLog创建Repair信息。 /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { try { IRepairTarget repairTarget = GetRepairTarget(); TestLog testLog = null; //IList<TestLog> testLogs = repairTarget.GetTestLog(); //Dean 20110315 performance Issue IList<TestLogDefect> testLogDefects = null; IStationRepository stationRepository = RepositoryFactory.GetInstance().GetRepository<IStationRepository, IStation>(); IStation station = stationRepository.Find(Station); string OQCStation = ""; IProduct product = null; if (string.Compare(RepairStationType, "FA", true) == 0) { //Update Dean 20110315 product = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product); IList<ProductInfo> productinfos = product.ProductInfoes; foreach (ProductInfo info in productinfos) { if (info.InfoType == ExtendSession.SessionKeys.OQCRepairStation && info.InfoValue != "") { OQCStation = info.InfoValue; break; } } } //Update Dean 20110315 if (OQCStation == "") //Update Dean 20110315 { //if (testLogs != null && testLogs.Count != 0) //{ Repair repair = null; RepairDefect repairDefect = null; IList<RepairDefect> repairDefects = new List<RepairDefect>(); testLog = repairTarget.LatestTestLog;//抓取latestTestLog by PreStation if (testLog == null) { List<string> errpara = new List<string>(); errpara.Add(Key); throw new FisException("CHK025", errpara); } if (testLog.Status == TestLog.TestLogStatus.Pass) { List<string> errpara = new List<string>(); throw new FisException("CHK024", errpara); } testLogDefects = testLog.Defects; if (testLogDefects != null && testLogDefects.Count != 0) { //if (station.StationType == StationType.SARepair) if (string.Compare(RepairStationType, "SA", true) == 0) { foreach (TestLogDefect defectItem in testLogDefects) { //ITC-1103-0134 Tong.Zhi-Yong 2010-01-26 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, testLog.Editor, DateTime.Now, DateTime.Now); repairDefects.Add(repairDefect); } } //else if (station.StationType == StationType.FARepair) 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, testLog.Editor, DateTime.Now, DateTime.Now); repairDefects.Add(repairDefect); } } else if (string.Compare(RepairStationType, "PAQC", true) == 0) { foreach (TestLogDefect defectItem in testLogDefects) { //ITC-1155-0109 Tong.Zhi-Yong 2010-05-17 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, 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, testLog.Editor, DateTime.Now, DateTime.Now); repairDefects.Add(repairDefect); } } } repair = new Repair(0, testLog.Sn, repairTarget.RepairTargetModel, testLog.Type, testLog.Line, testLog.Station, IMES.FisObject.Common.Repair.Repair.RepairStatus.NotFinished, repairDefects, testLog.Editor, testLog.ID.ToString(), DateTime.Now, DateTime.Now); repairTarget.AddRepair(repair); UpdateRepairTarget(repairTarget); CurrentSession.AddValue(ExtendSession.SessionKeys.IsOQCRepair, false); //Update Dean 20110315 //CurrentSession.AddValue(ExtendSession.SessionKeys.TestLog, testLog); //CurrentSession.AddValue(ExtendSession.SessionKeys.RepairDefect, repairDefects); //} /*else { List<string> errpara = new List<string>(); errpara.Add(Key); throw new FisException("CHK025", errpara); }*/ } else // get and copy repair info from OQC repair station Update Dean 20110316 { IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>(); product.SetExtendedProperty(ExtendSession.SessionKeys.OQCRepairStation, "", Editor); productRepository.Update(product, CurrentSession.UnitOfWork); } return base.DoExecute(executionContext); } catch (FisException ex) { throw; } catch (Exception ex) { throw; } finally { } }
private IPart checkOldSNForKP(IList<IProductPart> partList, RepairDefect defect, string type) { bool typeFlag = false; IPartRepository ipr = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); PartType partType = null; IPart part = null; string oldSN = defect.OldPartSno; bool isHaveCheckBit = defect.OldPartSno.Trim().Length >= 14; bool isInProductPart = false; //old sn check foreach (IProductPart temp in partList) { if (isHaveCheckBit) { isInProductPart = (temp.Value.Equals(oldSN.Substring(0, 13)) || temp.Value.Equals(oldSN)); } else { isInProductPart = temp.Value.Equals(oldSN); } if (isInProductPart) { part = ipr.Find(temp.PartID); if (part != null) { partType = ipr.GetPartType(part.Type); if (partType == null) { break; } else if (string.Compare(partType.PartTypeGroup, defect.PartType, true) == 0) { typeFlag = true; break; } } } } if (!typeFlag) { BOM bom = (BOM)CurrentSession.GetValue(BOMSessionKey); part = bom.Match(defect.OldPartSno, this.Station); if (part != null) { partType = ipr.GetPartType(part.Type); if (partType == null) { } else if (string.Compare(partType.PartTypeGroup, defect.PartType, true) == 0) { typeFlag = true; } } if (!typeFlag) { //ITC-1122-0202 Tong.Zhi-Yong 2010-03-08 List<string> errpara = new List<string>(); errpara.Add(defect.OldPartSno); FisException ex = new FisException("CHK053", errpara); ex.stopWF = false; throw ex; } } return part; }
/// <summary> /// 为指定Repair增加一个RepairDefect /// </summary> /// <param name="repairId">指定Repair的Id</param> /// <param name="defect"></param> public void AddRepairDefect(int repairId, RepairDefect defect) { lock (_syncObj_repair) { object naught = this.Repairs; if (this._repair != null && defect != null) { foreach (Repair rp in this._repair) { if (rp.Key.Equals(repairId)) { rp.AddRepairDefect(defect); rp.Tracker.MarkAsModified(rp); this._tracker.MarkAsModified(this); break; } } } } }
/// <summary> /// MB成退 /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { try { IRepairTarget repairTarget = GetRepairTarget(); IProduct product = (IProduct)repairTarget; Repair currentRepair = repairTarget.GetCurrentRepair(); IMBRepository imr = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); IList<RepairDefect> repairDefects = new List<RepairDefect>(); RepairDefect defect = (RepairDefect)CurrentSession.GetValue(Session.SessionKeys.CurrentRepairdefect); IMiscRepository miscRpst = RepositoryFactory.GetInstance().GetRepository<IMiscRepository>(); //Insert a Repair to PCB IMB oldMB = (IMB)CurrentSession.GetValue(Session.SessionKeys.MB); Repair repair = null; RepairDefect repairDefect = new RepairDefect(0, 0, oldMB.ModelObj == null ? string.Empty : oldMB.ModelObj.Type, defect.DefectCodeID, 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,this.Editor, DateTime.Now, DateTime.Now); repairDefects.Add(repairDefect); //[2012-7-25]:PCBRepair.LogID(PCBLog.ID from PCBLog where PCBNo=#OldMB order by Cdt desc) //MBLog oldlog = (MBLog)CurrentSession.GetValue(Session.SessionKeys.MBLog); //if (oldlog != null) //{ // repair = new Repair(0, oldMB.Sn, oldMB.Model, oldMB.ModelObj == null ? string.Empty : oldMB.ModelObj.Type, this.Line, "33", IMES.FisObject.Common.Repair.Repair.RepairStatus.NotFinished, repairDefects, this.Editor, null, oldlog.ID, DateTime.Now, DateTime.Now); //} //else //{ // repair = new Repair(0, oldMB.Sn, oldMB.Model, oldMB.ModelObj == null ? string.Empty : oldMB.ModelObj.Type, this.Line, "33", IMES.FisObject.Common.Repair.Repair.RepairStatus.NotFinished, repairDefects, this.Editor, null, 0, DateTime.Now, DateTime.Now); //} //CurrentSession.UnitOfWork.RegisterSetterBetween(new IMES.Infrastructure.UnitOfWork.SetterBetween(oldlog, "ID", repair, "LogId")); //将记录保存到PCBRepair(Line是FA Line,Station是PCA Station=33) repair = new Repair(0, oldMB.Sn, oldMB.Model, oldMB.ModelObj == null ? string.Empty : oldMB.ModelObj.Type, this.Line, "33", IMES.FisObject.Common.Repair.Repair.RepairStatus.NotFinished, repairDefects, this.Editor, null, 0, DateTime.Now, DateTime.Now); MBLog log = (MBLog) CurrentSession.GetValue(Session.SessionKeys.MBLog); if (log != null) { CurrentSession.UnitOfWork.RegisterSetterBetween(new IMES.Infrastructure.UnitOfWork.SetterBetween(log, "ID", repair, "setter_LogId")); imr.AddPcbRepairDefered(CurrentSession.UnitOfWork, repair); CurrentSession.UnitOfWork.RegisterSetterBetween(new IMES.Infrastructure.UnitOfWork.SetterBetween(repair, "ID", repairDefect, "setter_RepairId")); imr.AddPcbRepairDefectDefered(CurrentSession.UnitOfWork, repairDefect); } //oldMB.AddRepair(repair); //imr.Update(oldMB, CurrentSession.UnitOfWork); //Insert Record To ReturnRepair Table ReturnRepair returnRepair = new ReturnRepair(); //ITC-1122-0188 Tong.Zhi-Yong 2010-03-05 CurrentSession.UnitOfWork.RegisterSetterBetween(new IMES.Infrastructure.UnitOfWork.SetterBetween(defect, "RepairID", returnRepair, "setter_ProductRepairID")); if (defect.ID == 0) //Add { CurrentSession.UnitOfWork.RegisterSetterBetween(new IMES.Infrastructure.UnitOfWork.SetterBetween(defect, "ID", returnRepair, "setter_ProductRepairDefectID")); } else { returnRepair.ProductRepairDefectID = defect.ID; } CurrentSession.UnitOfWork.RegisterSetterBetween(new IMES.Infrastructure.UnitOfWork.SetterBetween(repair, "ID", returnRepair, "setter_PCBRepairID")); miscRpst.AddReturnRepairDefered(CurrentSession.UnitOfWork, returnRepair); return base.DoExecute(executionContext); } catch (FisException ex) { throw ex; } catch (Exception ex) { throw ex; } }
/// <summary> /// /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { /*IRepairTarget repairTarget=null; repairTarget =(IRepairTarget)CurrentSession.GetValue(ExtendSession.SessionKeys.ProductRepair); Repair repair=new Repair();*/ //IRepairTarget repairTarget = GetRepairTarget(); //TestLog testLog = (TestLog)CurrentSession.GetValue(ExtendSession.SessionKeys.TestLog); //IList<RepairDefect> repairDefects=(IList<RepairDefect>)CurrentSession.GetValue(ExtendSession.SessionKeys.RepairDefect); //Repair repair = new Repair(0,testLog.Sn, repairTarget.RepairTargetModel, testLog.Type, testLog.Line, Station, IMES.FisObject.Common.Repair.Repair.RepairStatus.NotFinished, repairDefects, testLog.Editor, testLog.ID.ToString(), DateTime.Now, DateTime.Now); IProductRepository productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository>(); var currentProduct = (IProduct)CurrentSession.GetValue(Session.SessionKeys.Product); //Repair currentRepair =currentProduct.GetCurrentRepair(); //int ProductRepairID = currentRepair.ID; //IList<RepairDefect> currentRepairDefects =currentRepair.Defects; //TestLog OQCTestLog = new TestLog(0, testLog.Sn, testLog.Line, testLog.FixtureId, Station, testLog.Status, testLog.JoinID, Editor, testLog.Type, DateTime.Now); //currentProduct.SetExtendedProperty(ExtendSession.SessionKeys.ProductRepairID, ProductRepairID.ToString(), Editor); //Project.ProductInfo insert/update currentProduct.SetExtendedProperty(ExtendSession.SessionKeys.OQCRepairStation, Station, Editor); productRepository.Update(currentProduct, CurrentSession.UnitOfWork); Repair OQCRepair = currentProduct.GetCurrentRepair(); /*SELECT t1.ID,t1.ProductID,t1.Model,t1.Type,t1.Line,t1.Station,t1.TestLogID,t1.Status,t1.Editor,t1.Cdt,t1.Udt, t2.ID,t2.ProductRepairID,t2.Type,t2.DefectCode,t2.Cause,t2.Obligation,t2.Component,t2.Site,t2.Location,t2.MajorPart,t2.Remark,t2.VendorCT,t2.PartType,t2.OldPart,t2.OldPartSno,t2.NewPart,t2.NewPartSno,t2.Manufacture,t2.VersionA,t2.VersionB,t2.ReturnSign,t2.Mark,t2.SubDefect,t2.PIAStation,t2.Distribution,t2.[4M],t2.Responsibility,t2.Action,t2.Cover,t2.Uncover,t2.TrackingStatus,t2.IsManual,t2.MTAID,t2.Editor,t2.Cdt,t2.Udt FROM ProductRepair t1,ProductRepair_DefectInfo t2 WHERE t1.ID=t2.ProductRepairID AND t1.ProductID='T01237475' AND t1.Status= 0 order by t2.Cdt desc*/ RepairDefect repairDefect = null; IList<RepairDefect> repairDefects = new List<RepairDefect>(); if (OQCRepair == null) { throw new FisException(); } else { foreach (RepairDefect item in OQCRepair.Defects) { /* item.ID = 0; item.RepairID = 0; item.Cdt = DateTime.Now; item.Udt = DateTime.Now;*/ /*repairDefect = new RepairDefect(0, 0, item.Type,item.DefectCodeID, 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, item.Editor, DateTime.Now, DateTime.Now);*/ repairDefect = new RepairDefect(0, 0, item.Type, item.DefectCodeID, item.Cause, item.Obligation, item.Component, item.Site, item.Location, item.MajorPart, item.Remark, item.VendorCT, item.PartType, item.OldPart, item.OldPartSno,item.NewPart, item.NewPartSno, item.NewPartDateCode,item.IsManual,item.Manufacture,item.VersionA, item.VersionB, item.ReturnSign, item.Side, item.Mark, item.SubDefect, item.PIAStation, item.Distribution, item._4M, item.Responsibility, item.Action, item.Cover, item.Uncover, item.TrackingStatus, item.MTAID, null, CurrentSession.Editor, DateTime.Now, DateTime.Now); repairDefects.Add(repairDefect); } Repair repair = new Repair(0, OQCRepair.Sn, OQCRepair.Model, OQCRepair.Type, OQCRepair.LineID, Station, IMES.FisObject.Common.Repair.Repair.RepairStatus.NotFinished, //OQCRepair.Defects, repairDefects, //OQCRepair.Editor, CurrentSession.Editor, OQCRepair.TestLogID, OQCRepair.LogId, DateTime.Now, DateTime.Now); //currentProduct.Repairs.Add(repair); currentProduct.AddRepair(repair); productRepository.Update(currentProduct, CurrentSession.UnitOfWork); //this.UpdateMainObject(currentProduct); } return base.DoExecute(executionContext); //CurrentSession.AddValue(Session.SessionKeys.Product, currentProduct); }
/// <summary> /// Generate repair list of LCM. /// </summary> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { IPartRepository partRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>(); //StepA: 若KeyPartRepair存在未维修完成(Count>0; Condition KeyPartRepair.ProductID=[ProductID] and KeyPartRepair.Status=‘0’)的记录,则不执行Step B //StepB: 检查是否存在需要提取的Log,若存在,则基于Test Log生成 Repair Record KeyPartRepairInfo cond = new KeyPartRepairInfo(); cond.productID = Key; cond.status = 0; if (partRepository.GetCountOfKpRepairCount(cond) <= 0) { bool bHasDefect = false; IProduct curProduct = CurrentSession.GetValue(Session.SessionKeys.Product) as IProduct; IList<TestLog> tLogs = curProduct.TestLog; foreach (TestLog ele in tLogs) { if (ele.Station == curProduct.Status.StationId && ele.Type == "PRD" && ele.Status == TestLog.TestLogStatus.Fail) //0 { bHasDefect = true; KeyPartRepairInfo kprInfo = new KeyPartRepairInfo(); kprInfo.productID = this.Key; kprInfo.model = curProduct.Model; kprInfo.type = "LCM"; kprInfo.line = ele.Line; kprInfo.station = ele.Station; kprInfo.status = 0; kprInfo.testLogID = ele.ID; ProductLog latestLog = null; foreach (ProductLog tmp in curProduct.ProductLogs) { if (tmp.Status == IMES.FisObject.Common.Station.StationStatus.Fail) //0 { if (latestLog == null || tmp.Cdt > latestLog.Cdt) { latestLog = tmp; } } } kprInfo.logID = (latestLog == null ? 0 : latestLog.Id); kprInfo.editor = Editor; kprInfo.cdt = DateTime.Now; kprInfo.udt = DateTime.Now; partRepository.AddKPRepair(kprInfo); foreach (TestLogDefect tmp in ele.Defects) { RepairDefect defect = new RepairDefect(); defect.RepairID = kprInfo.id; defect.Type = "LCM"; defect.DefectCodeID = tmp.DefectCode; defect.Mark = "0"; defect.IsManual = false; defect.Editor = Editor; defect.Cdt = DateTime.Now; defect.Udt = DateTime.Now; defect.Cause = ""; defect.Obligation = ""; defect.Component = ""; defect.Site = ""; defect.Location = ""; defect.MajorPart = ""; defect.Remark = ""; defect.VendorCT = ""; defect.PartType = ""; defect.OldPart = ""; defect.OldPartSno = ""; defect.NewPart = ""; defect.NewPartSno = ""; defect.Manufacture = ""; defect.VersionA = ""; defect.VersionB = ""; defect.SubDefect = ""; defect.PIAStation = ""; defect.Distribution = ""; defect._4M = ""; defect.Responsibility = ""; defect.Action = ""; defect.Cover = ""; defect.Uncover = ""; defect.TrackingStatus = ""; defect.MTAID = ""; defect.ReturnStation = ""; defect.ReturnSign = ""; partRepository.AddKPRepairDefect(defect); } break; } } if (!bHasDefect) { string ctno = CurrentSession.GetValue("CTNO") as string; throw new FisException("CHK233", new string[] { ctno }); //CT:XXX没有不良记录. } } return base.DoExecute(executionContext); }