/// <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> /// 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; } }