Пример #1
0
        //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);
        }
Пример #2
0
        //执行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);
        }