/// <summary> /// /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { Session session = CurrentSession; var CurrentMB = (MB)session.GetValue(Session.SessionKeys.MB); string moNo = CurrentMB.SMTMO; string model = CurrentMB.Model; string custSn = string.Empty; string custVer = string.Empty; string cvsn = string.Empty; string uuid = string.Empty; bool IsRCTO = false; if (session.GetValue(Session.SessionKeys.IsRCTO) != null) { IsRCTO = (bool)session.GetValue(Session.SessionKeys.IsRCTO); } string CheckCode = session.GetValue(Session.SessionKeys.CheckCode) as string; string dateCode = session.GetValue(Session.SessionKeys.DCode) as string; string ecr = session.GetValue(Session.SessionKeys.ECR) as string; string iecVer = session.GetValue(Session.SessionKeys.IECVersion) as string; var MACList = (IList<string>)session.GetValue(Session.SessionKeys.MACList); var MBCTList = (IList<string>)session.GetValue(Session.SessionKeys.MBCTList); var EEPList = (IList<string>)session.GetValue(Session.SessionKeys.EEPList); var NewMBSnList = session.GetValue(Session.SessionKeys.MBNOList) as List<string>; var MBNOList = session.GetValue(Session.SessionKeys.MBNOList) as List<string>; if (IsRCTO && CheckCode !="R") { MBNOList = session.GetValue(Session.SessionKeys.RCTOChildMBSnList) as List<string>; } var MBObjectList = new List<IMB>(); session.AddValue(Session.SessionKeys.MBList, MBObjectList); IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); IPrintLogRepository LogRepository = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>(); bool hasPCBVer = false; if (session.GetValue(ExtendSession.SessionKeys.HasPCBVer) != null) { hasPCBVer = (bool)session.GetValue(ExtendSession.SessionKeys.HasPCBVer); if (hasPCBVer) { custVer = (string)session.GetValue(ExtendSession.SessionKeys.PCBVer); } } for (int i = 0; i < MBNOList.Count; i++) { string mac = string.Empty; if (MACList != null) { mac = MACList[i]; } MB mb = new MB(MBNOList[i], moNo, custSn, model, dateCode, mac, uuid, ecr, iecVer, custVer, cvsn, DateTime.Now, DateTime.Now); MBStatus mbStatus = new MBStatus(MBNOList[i], this.Station, MBStatusEnum.Pass, this.Editor, this.Line, DateTime.Now, DateTime.Now); mb.MBStatus = mbStatus; if (IsRCTO && CheckCode != "R") { IMES.FisObject.PCA.MB.MBInfo RCTOChangeInfo = new IMES.FisObject.PCA.MB.MBInfo(0, mb.Sn, "RCTOChange", NewMBSnList[i], Editor, DateTime.Now, DateTime.Now); mb.AddMBInfo(RCTOChangeInfo); } if (EEPList != null) { IMES.FisObject.PCA.MB.MBInfo eepInfo = new IMES.FisObject.PCA.MB.MBInfo(0, mb.Sn, "EEPROM", EEPList[i], Editor, DateTime.Now, DateTime.Now); mb.AddMBInfo(eepInfo); } if (MBCTList != null) { IMES.FisObject.PCA.MB.MBInfo mbctInfo = new IMES.FisObject.PCA.MB.MBInfo(0, mb.Sn, "MBCT", MBCTList[i], Editor, DateTime.Now, DateTime.Now); mb.AddMBInfo(mbctInfo); FruDetInfo newFruDet = new FruDetInfo(); newFruDet.sno = MBCTList[i]; newFruDet.snoId = mb.Sn; newFruDet.tp = "VC"; newFruDet.editor = Editor; newFruDet.cdt = DateTime.Now; newFruDet.udt = newFruDet.cdt; mbRepository.InsertFruDetInfoDefered(session.UnitOfWork, newFruDet); MBLog newCTLog = new MBLog(0, mb.Sn, mb.Model, "SH", 1, "SA SHIPPING LABEL", Editor, DateTime.Now); mb.AddLog(newCTLog); } if (session.GetValue("IsPilotMOCheck") != null && (bool)session.GetValue("IsPilotMOCheck")) { string pilotmo = (string)session.GetValue(Session.SessionKeys.PilotMoNo); mb.SetExtendedProperty(ConstName.PCBInfo.PilotMo, pilotmo, this.Editor); } mb.SetExtendedProperty(ConstName.PCBInfo.ParentMBSN, mb.Sn, this.Editor); MBLog newLog = new MBLog(0, mb.Sn, mb.Model, Station, 1, Line, Editor, DateTime.Now); mb.AddLog(newLog); mbRepository.Add(mb, session.UnitOfWork); MBObjectList.Add(mb); var item = new PrintLog { Name = session.GetValue(Session.SessionKeys.PrintLogName).ToString(), BeginNo = MBNOList[i], EndNo = MBNOList[i], Descr = session.GetValue(Session.SessionKeys.PrintLogDescr).ToString(), Editor = this.Editor }; LogRepository.Add(item, session.UnitOfWork); IMES.FisObject.PCA.MB.MBInfo items = new IMES.FisObject.PCA.MB.MBInfo(); items.InfoType = ConstName.PCBInfo.ChildMBSN; items.InfoValue = mb.Sn; items.Editor = this.Editor; CurrentMB.AddMBInfo(items); } return base.DoExecute(executionContext); }
/// <summary> /// /// </summary> /// <param name="executionContext"></param> /// <returns></returns> protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext) { var CurrentMB = (MB)CurrentSession.GetValue(Session.SessionKeys.MB); string ecr = CurrentSession.GetValue(Session.SessionKeys.ECR) as string; string iecVer = CurrentSession.GetValue(Session.SessionKeys.IECVersion) as string; CurrentMB.ECR = ecr; CurrentMB.IECVER = iecVer; string mac = CurrentSession.GetValue(Session.SessionKeys.MAC) as string; if (!string.IsNullOrEmpty(mac)) { CurrentMB.MAC = mac; } string dateCode = CurrentSession.GetValue(Session.SessionKeys.DCode) as string; if (!string.IsNullOrEmpty(dateCode)) { CurrentMB.DateCode = dateCode; } IMBRepository mbRepository = RepositoryFactory.GetInstance().GetRepository<IMBRepository, IMB>(); string eep = CurrentSession.GetValue(Session.SessionKeys.EEP) as string; if (!string.IsNullOrEmpty(eep)) { IMES.FisObject.PCA.MB.MBInfo eepInfo = new IMES.FisObject.PCA.MB.MBInfo(0, CurrentMB.Sn, "EEPROM", eep, Editor, DateTime.Now, DateTime.Now); CurrentMB.AddMBInfo(eepInfo); } string mbct = CurrentSession.GetValue(Session.SessionKeys.MBCT) as string; if (!string.IsNullOrEmpty(mbct)) { IMES.FisObject.PCA.MB.MBInfo mbctInfo = new IMES.FisObject.PCA.MB.MBInfo(0, CurrentMB.Sn, "MBCT", mbct, Editor, DateTime.Now, DateTime.Now); CurrentMB.AddMBInfo(mbctInfo); FruDetInfo newFruDet = new FruDetInfo(); newFruDet.sno = mbct; newFruDet.snoId = CurrentMB.Sn; newFruDet.tp = "VC"; newFruDet.editor = Editor; newFruDet.cdt = DateTime.Now; newFruDet.udt = newFruDet.cdt; mbRepository.InsertFruDetInfoDefered(CurrentSession.UnitOfWork, newFruDet); MBLog newCTLog = new MBLog(0, CurrentMB.Sn, CurrentMB.Model, "SH", 1, "SA SHIPPING LABEL", Editor, DateTime.Now); CurrentMB.AddLog(newCTLog); } mbRepository.Update(CurrentMB, CurrentSession.UnitOfWork); return base.DoExecute(executionContext); }