/// <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) { Session session = CurrentSession; ActivityCommonImpl utl = ActivityCommonImpl.Instance; IMB parentMB = utl.IsNull<IMB>(session, Session.SessionKeys.MB); IList<String> sbSNList = session.GetValue(ExtendSession.SessionKeys.SmallBoardSNList) as IList<string>; if (sbSNList == null || sbSNList.Count == 0) { return base.DoExecute(executionContext); } IList<String> smallBoardPartNoList = utl.IsNull <IList<String>>(session, ExtendSession.SessionKeys.SmallBoardPartNoList) as IList<string>; IList<String> smallBoardECRList = utl.IsNull <IList<String>>(session, ExtendSession.SessionKeys.SmallBoardECRList) as IList<string>; string moNo = parentMB.SMTMO; string custSn = string.Empty; string custVer = string.Empty; string cvsn = parentMB.Sn; string uuid = string.Empty; string mac = string.Empty; 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 sbMBList = new List<IMB>(); session.AddValue(ExtendSession.SessionKeys.SmallBoardMBList, sbMBList); IMBRepository mbRep = utl.mbRep; IPrintLogRepository LogRep = RepositoryFactory.GetInstance().GetRepository<IPrintLogRepository, PrintLog>(); int index=0; foreach (string sn in sbSNList) { string model = smallBoardPartNoList[index]; string[] ecrList = smallBoardECRList[index].Split(GlobalConstName.SlashChar); string ecr = ecrList[0]; string iecVer = ecrList[1]; string[] sbSN = sn.Split(GlobalConstName.SlashChar); MB mb = new MB(sbSN[0], moNo, custSn, model, dateCode, mac, uuid, ecr, iecVer, custVer, cvsn, DateTime.Now, DateTime.Now); MBStatus mbStatus = new MBStatus(sbSN[0], this.Station, MBStatusEnum.Pass, this.Editor, this.Line, DateTime.Now, DateTime.Now); mb.MBStatus = mbStatus; MBLog newLog = new MBLog(0, mb.Sn, mb.Model, Station, 1, Line, Editor, DateTime.Now); mb.AddLog(newLog); if (this.IsSplitMB) { mb.SetExtendedProperty(ConstName.PCBInfo.ChildMBSN, sbSN[1], this.Editor); } else { mb.SetExtendedProperty(ConstName.PCBInfo.ChildMBSN, parentMB.Sn, this.Editor); } mb.SetExtendedProperty(ConstName.PCBInfo.ParentMBSN, parentMB.Sn, this.Editor); mb.SetExtendedProperty(ConstName.PCBInfo.IsSmallBoard, ConstName.Letter.Y, this.Editor); mbRep.Add(mb, session.UnitOfWork); sbMBList.Add(mb); var item = new PrintLog { Name = PrintLogName, BeginNo = sn, EndNo = sn, Station = this.Station, Cdt = DateTime.Now, LabelTemplate = string.Empty, Descr =string.Format(PrintLogDescr,mb.Sn, sbSN[1], sbSN[0]) , Editor = this.Editor }; LogRep.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; parentMB.AddMBInfo(items); index++; } return base.DoExecute(executionContext); }