//Laws Lu,2005/12/28,比对版本 private Messages CheckSoftVersion(object vc, string strVer, SoftwareActionEventArgs e, ProductInfo product) { Messages msg = new Messages(); if (e.CurrentMO == null) { e.CurrentMO = (new MOModel.MOFacade(DataProvider)).GetMO(product.LastSimulation.MOCode) as Domain.MOModel.MO; } if (e.CurrentMO.MOBIOSVersion != strVer) { msg.Add(new UserControl.Message(MessageType.Error, "$CS_VERSION_COMPARE_NOT_PASS $CS_MO_VERSION=" + e.CurrentMO.MOBIOSVersion + " $CS_CURRENT_VERSION=" + strVer)); DataCollectFacade dcf = new DataCollectFacade(DataProvider); Domain.DataCollect.VersionError ve = dcf.CreateNewVersionError(); ve.PKID = System.Guid.NewGuid().ToString(); ve.MoVersionInfo = e.CurrentMO.MOBIOSVersion; ve.Mocode = e.CurrentMO.MOCode; ve.Rcard = e.RunningCard; ve.VersionInfo = strVer; //Laws Lu,2006/11/13 uniform system collect date DBDateTime dbDateTime; dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); ve.MDate = dbDateTime.DBDate; ve.MTime = dbDateTime.DBTime; ve.MUser = e.UserCode; DataProvider.BeginTransaction(); try { dcf.AddVersionError(ve); dcf.DeleteVersionCollect(vc as Domain.DataCollect.VersionCollect); DataProvider.CommitTransaction(); } catch (Exception E) { msg.Add(new UserControl.Message(E)); DataProvider.RollbackTransaction(); } finally { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); } } return(msg); }
//执行Action private void doAction(object vc) { Messages messages = this._helper.GetIDInfo(Convert.ToString(this.inputBuffer[0])); if (messages.IsSuccess()) { ProductInfo product = (ProductInfo)messages.GetData().Values[0]; if (product == null || (product != null && product.LastSimulation == null)) { messages.Add(new UserControl.Message(MessageType.Error, "$NoSimulation")); } //初始化参数 SoftwareActionEventArgs args = new SoftwareActionEventArgs( ActionType.DataCollectAction_SoftINFO, this.inputBuffer[0].ToString(), ApplicationService.Current().UserCode, ApplicationService.Current().ResourceCode, (vc == null ? this.inputBuffer[2].ToString() : (vc as Domain.DataCollect.VersionCollect).VersionInfo) /* * this.inputBuffer[2].ToString()*/, this.inputBuffer[1].ToString()); if (messages.IsSuccess()) { if (args.CurrentMO == null) { args.CurrentMO = (new MOModel.MOFacade(DataProvider)).GetMO(product.LastSimulation.MOCode) as Domain.MOModel.MO; } if (chkAutoGetVersion.Checked == true && vc != null) { //是否需要比对工单版本 if (args.CurrentMO.IsCompareSoft == 1) { Messages msgs = CheckSoftVersion(vc, (vc as Domain.DataCollect.VersionCollect).VersionInfo.Trim().ToUpper(), args, product); if (msgs.IsSuccess()) { this.ucMessage.Add(new UserControl.Message(MessageType.Success, "$CS_SOFT_CHECK_SUCCESS")); } else { this.ucMessage.Add(msgs); } } } if (chkAutoGetVersion.Checked == false) { //是否需要比对工单版本 if (args.CurrentMO.IsCompareSoft == 1) { if (this.inputBuffer[2].ToString().Trim().ToUpper() == args.CurrentMO.MOBIOSVersion) { this.ucMessage.Add(new UserControl.Message(MessageType.Success, "$CS_SOFT_CHECK_SUCCESS")); } else { this.ucMessage.Add(new UserControl.Message(MessageType.Error, "$CS_VERSION_COMPARE_NOT_PASS $CS_MO_VERSION=" + args.CurrentMO.MOBIOSVersion + " $CS_CURRENT_VERSION=" + this.inputBuffer[2].ToString().Trim().ToUpper())); DataCollectFacade dcf = new DataCollectFacade(DataProvider); Domain.DataCollect.VersionError ve = dcf.CreateNewVersionError(); ve.PKID = System.Guid.NewGuid().ToString(); ve.MoVersionInfo = args.CurrentMO.MOBIOSVersion; ve.Mocode = args.CurrentMO.MOCode; ve.Rcard = args.RunningCard; ve.VersionInfo = this.inputBuffer[2].ToString().Trim().ToUpper(); //Laws Lu,2006/11/13 uniform system collect date DBDateTime dbDateTime; dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); ve.MDate = dbDateTime.DBDate; ve.MTime = dbDateTime.DBTime; ve.MUser = args.UserCode; DataProvider.BeginTransaction(); try { dcf.AddVersionError(ve); //dcf.DeleteVersionCollect(vc as Domain.DataCollect.VersionCollect); DataProvider.CommitTransaction(); } catch (Exception E) { this.ucMessage.Add(new UserControl.Message(E)); DataProvider.RollbackTransaction(); } finally { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); } } } } IAction action = new ActionFactory(this.DataProvider).CreateAction(ActionType.DataCollectAction_SoftINFO); ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection(); this.DataProvider.BeginTransaction(); try { messages.AddMessages(action.Execute(args)); this.ucMessage.Add(CheckConfig(args, product)); if (messages.IsSuccess()) { this.DataProvider.CommitTransaction(); // if(chkConfig.Checked == true) // { // this.ucMessage.Add(new UserControl.Message(MessageType.Success,"$CS_CONFIG_CHECK_SUCCESS")); //配置比对成功 // } this.ucMessage.Add(new UserControl.Message(MessageType.Success, "$CS_Soft_CollectSuccess")); //软件版本采集成功 } else { this.DataProvider.RollbackTransaction(); } } catch (Exception ex) { this.DataProvider.RollbackTransaction(); messages.Add(new UserControl.Message(ex)); } finally { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); } } } this.ucMessage.Add(messages); ucMessage.Add(">>$CS_Please_Input_RunningCard "); ucLEInput.Value = String.Empty; this.inputBuffer.Clear(); ucLEInput.TextFocus(false, true); }
//Laws Lu,2006/01/20,比对配置信息 private Messages CheckConfig(SoftwareActionEventArgs e, ProductInfo product) { Messages msg = new Messages(); if (chkConfig.Checked == false) { return(msg); } if (e.CurrentMO == null) { e.CurrentMO = (new MOModel.MOFacade(DataProvider)).GetMO(product.LastSimulation.MOCode) as Domain.MOModel.MO; } // if(e.CurrentMO.MOBIOSVersion != strVer) // { // msg.Add(new UserControl.Message(MessageType.Error,"$CS_VERSION_COMPARE_NOT_PASS $CS_MO_VERSION=" // + e.CurrentMO.MOBIOSVersion + " $CS_CURRENT_VERSION=" + strVer)); DataCollectFacade dcf = new DataCollectFacade(DataProvider); MOModel.ItemFacade icf = new BenQGuru.eMES.MOModel.ItemFacade(DataProvider); object[] configInfos = dcf.GetConfigInfo(e.RunningCard); object[] itemChecks = icf.GetItem2Config(e.CurrentMO.ItemCode); //DataProvider.BeginTransaction(); try { if (configInfos == null || itemChecks == null) { throw new Exception("$CS_CONFIG_NOT_EXIST"); } int iPass = 0; foreach (Domain.DataCollect.ConfigInfo ci in configInfos) { dcf.DeleteConfigInfo(ci); foreach (Domain.MOModel.Item2Config ic in itemChecks) { if (ic.NeedCheck == "1" && ic.ConfigCode == ci.CheckItemCode && ic.ParentCode == ci.CatergoryCode) { if (ic.ConfigValue != ci.CheckItemVlaue) { Domain.DataCollect.OnWipConfigCollect onwipConfigCollect = new BenQGuru.eMES.Domain.DataCollect.OnWipConfigCollect(); onwipConfigCollect.PKID = System.Guid.NewGuid().ToString(); onwipConfigCollect.RunningCard = e.ProductInfo.NowSimulation.RunningCard; onwipConfigCollect.RunningCardSequence = e.ProductInfo.NowSimulation.RunningCardSequence; onwipConfigCollect.ItemCode = e.CurrentMO.ItemCode; onwipConfigCollect.MoCode = e.CurrentMO.MOCode; onwipConfigCollect.ModelCode = e.ProductInfo.NowSimulation.ModelCode; onwipConfigCollect.SegmnetCode = e.ProductInfo.NowSimulationReport.SegmentCode; onwipConfigCollect.RouteCode = e.ProductInfo.NowSimulation.RouteCode; onwipConfigCollect.StepSequenceCode = e.ProductInfo.NowSimulationReport.StepSequenceCode; onwipConfigCollect.OPCode = e.ProductInfo.NowSimulation.OPCode; onwipConfigCollect.ResourceCode = e.ProductInfo.NowSimulation.ResourceCode; onwipConfigCollect.ShiftTypeCode = e.ProductInfo.NowSimulationReport.ShiftTypeCode; onwipConfigCollect.ShiftCode = e.ProductInfo.NowSimulationReport.ShiftCode; onwipConfigCollect.TimePeriodCode = e.ProductInfo.NowSimulationReport.TimePeriodCode; onwipConfigCollect.MaintainUser = e.ProductInfo.NowSimulation.MaintainUser; onwipConfigCollect.MaintainDate = e.ProductInfo.NowSimulation.MaintainDate; onwipConfigCollect.MaintainTime = e.ProductInfo.NowSimulation.MaintainTime; onwipConfigCollect.EAttribute1 = e.ProductInfo.NowSimulation.EAttribute1; onwipConfigCollect.ActValue = ci.CheckItemVlaue; onwipConfigCollect.CheckItemVlaue = ic.ConfigValue; onwipConfigCollect.ItemConfig = ic.ItemConfigration; onwipConfigCollect.CatergoryCode = ci.CatergoryCode; onwipConfigCollect.ParentCode = ic.ParentCode; onwipConfigCollect.CheckItemCode = ci.CheckItemCode; dcf.AddOnWipConfigCollect(onwipConfigCollect); msg.Add(new UserControl.Message(MessageType.Error, "$CS_CONFIG_CHECK_FAILURE " + ic.ConfigName + "=" + ic.ConfigValue + " $CS_Param_Action=" + ci.CheckItemVlaue)); } else { iPass++; } } } } //DataProvider.CommitTransaction(); if (msg.IsSuccess() && iPass != 0) { msg.Add(new UserControl.Message(MessageType.Success, "$CS_CONFIG_CHECK_SUCCESS $CS_CONFIG_CHECK_COUNT =" + iPass.ToString())); } } catch (Exception E) { msg.Add(new UserControl.Message(E)); //DataProvider.RollbackTransaction(); } // finally // { // ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); // } //Domain.MOModel.Item2Config[] configInfos = mfc.getitem(e.RunningCard); //Domain.MOModel.Item2Config[] itemConfigs = dcf.ge // ve.PKID = System.Guid.NewGuid().ToString(); // ve.MoVersionInfo = e.CurrentMO.MOBIOSVersion; // ve.Mocode = e.CurrentMO.MOCode; // ve.Rcard = e.RunningCard; // ve.VersionInfo = strVer; // ve.MDate = FormatHelper.TODateInt(DateTime.Now); // ve.MTime = FormatHelper.TOTimeInt(DateTime.Now); // ve.MUser = e.UserCode; // // DataProvider.BeginTransaction(); // try // { // dcf.AddVersionError(ve); // dcf.DeleteVersionCollect(vc as Domain.DataCollect.VersionCollect); // // DataProvider.CommitTransaction(); // } // catch(Exception E) // { // msg.Add(new UserControl.Message(E)); // DataProvider.RollbackTransaction(); // } // finally // { // ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); // } // } return(msg); }