Exemple #1
0
        public UserControl.Messages GoodCollect(object[] parserObjs)
        {
            UserControl.Messages returnMsg = new UserControl.Messages();
            try
            {
                foreach (object obj in parserObjs)
                {
                    ICTData ictData = obj as ICTData;

                    if (ictData.RESULT.Trim().ToUpper() == "PASS")
                    {
                        ActionOnLineHelper onLine = new ActionOnLineHelper(this._domainDataProvider);

                        ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.AutoCloseConnection = false;
                        ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.OpenConnection();
                        Messages messages = onLine.GetIDInfo(ictData.RCARD.Trim().ToUpper());
                        try
                        {
                            ProductInfo product = (ProductInfo)messages.GetData().Values[0];
                            this._domainDataProvider.BeginTransaction();

                            if (AgentInfo.AllowGoToMO == true)
                            {
                                string moCode = this.getMOCode(ictData.RCARD.Trim().ToUpper());

                                if (System.Configuration.ConfigurationSettings.AppSettings["MOPREFIXSTRING"] != null)
                                {
                                    string moPrefix = System.Configuration.ConfigurationSettings.AppSettings["MOPREFIXSTRING"].Trim();
                                    //首字符串检查
                                    if (moCode.Length < moPrefix.Length || moCode.Substring(0, moPrefix.Length) != moPrefix)
                                    {
                                        returnMsg.Add(new UserControl.Message(MessageType.Error
                                                                              , "$CS_Before_Card_FLetter_NotCompare $CS_Param_ID: " + ictData.RCARD.Trim().ToUpper()));
                                    }
                                }
                                if (System.Configuration.ConfigurationSettings.AppSettings["SNLENGTH"] != null)
                                {
                                    try
                                    {
                                        int snLength = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["SNLENGTH"].Trim());
                                        //长度检查
                                        if (ictData.RCARD.Trim().ToUpper().Length != snLength)
                                        {
                                            returnMsg.Add(new UserControl.Message(MessageType.Error,
                                                                                  "$CS_Before_Card_Length_FLetter_NotCompare $CS_Param_ID: " + ictData.RCARD.Trim().ToUpper()));
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        returnMsg.Add(new UserControl.Message(ex));
                                    }
                                }

                                if (returnMsg.IsSuccess())
                                {
                                    IAction dataCollectMO = new ActionFactory(this._domainDataProvider).CreateAction(ActionType.DataCollectAction_GoMO);
                                    messages.AddMessages(((IActionWithStatus)dataCollectMO).Execute(
                                                             new GoToMOActionEventArgs(ActionType.DataCollectAction_GoMO,
                                                                                       ictData.RCARD.Trim().ToUpper(),
                                                                                       ictData.USER.Trim().ToUpper(),
                                                                                       AgentHelp.getResCode(ictData.RESOURCE.Trim().ToUpper()),
                                                                                       product, moCode)));


                                    if (messages.IsSuccess())
                                    {
                                        returnMsg.Add(new UserControl.Message(UserControl.MessageType.Success, string.Format("{0} $CS_GOMO_CollectSuccess", ictData.RCARD.ToUpper())));
                                    }
                                    else
                                    {
                                        returnMsg.Add(new UserControl.Message(UserControl.MessageType.Error, AgentHelp.GetErrorMessage(messages)));
                                    }
                                }

                                messages.ClearMessages();
                            }

                            string goodResult = string.Empty;
                            //GOOD采集
                            messages = onLine.GetIDInfo(ictData.RCARD.Trim().ToUpper());
                            product  = (ProductInfo)messages.GetData().Values[0];
                            BenQGuru.eMES.DataCollect.DataCollectFacade dcFacade = new BenQGuru.eMES.DataCollect.DataCollectFacade(this._domainDataProvider);
                            goodResult = dcFacade.ActionCollectGood(ictData.RCARD.ToUpper(), ictData.USER.ToUpper(), AgentHelp.getResCode(ictData.RESOURCE.ToUpper()));
                            if (goodResult == "OK")
                            {
                                this._domainDataProvider.CommitTransaction();

                                returnMsg.Add(new UserControl.Message(UserControl.MessageType.Success, string.Format("{0} $CS_GOOD_CollectSuccess", ictData.RCARD.ToUpper())));
                                returnMsg.Add(new UserControl.Message(" "));
                                BenQGuru.eMES.Common.Log.Info(string.Format("{0} $CS_GOOD_CollectSuccess: {1}", ictData.RCARD.Trim().ToUpper(), "OK"));
                                messages.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOODSUCCESS,$CS_Param_ID:{0}", ictData.RCARD.ToUpper())));
                            }
                            else
                            {
                                this._domainDataProvider.RollbackTransaction();

                                string errorMsg = string.Format("{0} $CS_GOOD_CollectFail : {1}", ictData.RCARD.Trim().ToUpper(), goodResult);
                                returnMsg.Add(new UserControl.Message(UserControl.MessageType.Error, errorMsg));
                                returnMsg.Add(new UserControl.Message(" "));
                                BenQGuru.eMES.Common.Log.Info(errorMsg);
                            }
                        }
                        catch (Exception ex)
                        {
                            this._domainDataProvider.RollbackTransaction();
                            BenQGuru.eMES.Common.Log.Info(AgentHelp.GetErrorMessage(messages), ex);
                        }
                        finally
                        {
//							((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.CloseConnection();
//							((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.AutoCloseConnection = true;
                        }
                    }
                }
            }
            catch
            {}

            return(returnMsg);
        }
Exemple #2
0
        public UserControl.Messages GoodCollect(object[] parserObjs)
        {
            UserControl.Messages returnMsg = new UserControl.Messages();
            try
            {
                foreach (object obj in parserObjs)
                {
                    PIDAOIData aoiData = obj as PIDAOIData;

                    if (aoiData.RESULT == "PASS")
                    {
                        ActionOnLineHelper onLine   = new ActionOnLineHelper(this._domainDataProvider);
                        Messages           messages = onLine.GetIDInfo(aoiData.RCARD.Trim().ToUpper());
                        try
                        {
                            ProductInfo product = (ProductInfo)messages.GetData().Values[0];
                            this._domainDataProvider.BeginTransaction();
//							//归属工单采集
//							IAction dataCollectMO = new ActionFactory(this._domainDataProvider).CreateAction(ActionType.DataCollectAction_GoMO);
//							messages.AddMessages(((IActionWithStatus)dataCollectMO).Execute(
//								new GoToMOActionEventArgs(ActionType.DataCollectAction_GoMO,
//								aoiData.RCARD.Trim().ToUpper(),
//								aoiData.USER.Trim().ToUpper(),
//								AgentHelp.getResCode(aoiData.RESOURCE.Trim().ToUpper()),
//								product,this.getMOCode(aoiData.RCARD.Trim().ToUpper()))));
//
                            string goodResult = string.Empty;
//							if(messages.IsSuccess())
//							{
//								returnMsg.Add( new UserControl.Message(UserControl.MessageType.Succes,string.Format("{0} $CS_GOMO_CollectSuccess",aoiData.RCARD.ToUpper())) );
//							}
//							else
//							{
//								returnMsg.Add( new UserControl.Message(UserControl.MessageType.Error,AgentHelp.GetErrorMessage(messages)));
//							}
//							messages.ClearMessages();

                            //GOOD采集
                            messages = onLine.GetIDInfo(aoiData.RCARD.Trim().ToUpper());
                            product  = (ProductInfo)messages.GetData().Values[0];
                            BenQGuru.eMES.DataCollect.DataCollectFacade dcFacade = new BenQGuru.eMES.DataCollect.DataCollectFacade(this._domainDataProvider);
                            goodResult = dcFacade.ActionCollectGood(aoiData.RCARD.ToUpper(), aoiData.USER.ToUpper(), AgentHelp.getResCode(aoiData.RESOURCE.ToUpper()));
                            if (goodResult == "OK")
                            {
                                this._domainDataProvider.CommitTransaction();

                                returnMsg.Add(new UserControl.Message(UserControl.MessageType.Success, string.Format("{0} $CS_GOOD_CollectSuccess", aoiData.RCARD.ToUpper())));
                                returnMsg.Add(new UserControl.Message(" "));
                                BenQGuru.eMES.Common.Log.Info(string.Format("{0} $CS_GOOD_CollectSuccess: {1}", aoiData.RCARD.Trim().ToUpper(), "OK"));
                                messages.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOODSUCCESS,$CS_Param_ID:{0}", aoiData.RCARD.ToUpper())));
                            }
                            else
                            {
                                this._domainDataProvider.RollbackTransaction();

                                string errorMsg = string.Format("{0} $CS_GOOD_CollectFail : {1}", aoiData.RCARD.Trim().ToUpper(), goodResult);
                                returnMsg.Add(new UserControl.Message(UserControl.MessageType.Error, errorMsg));
                                returnMsg.Add(new UserControl.Message(" "));
                                BenQGuru.eMES.Common.Log.Info(errorMsg);
                            }
                        }
                        catch (Exception ex)
                        {
                            this._domainDataProvider.RollbackTransaction();
                            BenQGuru.eMES.Common.Log.Info(AgentHelp.GetErrorMessage(messages), ex);
                        }
                        finally
                        {
                            ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.CloseConnection();
                        }
                    }
                }
            }
            catch
            {}
            return(returnMsg);
        }
Exemple #3
0
        public UserControl.Messages GoodCollect(object[] parserObjs)
        {
            UserControl.Messages returnMsg = new UserControl.Messages();
            try
            {
                foreach (object obj in parserObjs)
                {
                    AOIData aoiData    = obj as AOIData;
                    int     errorCount = 0;
                    try
                    {
                        errorCount = int.Parse(aoiData.ERRORCOUNT);
                    }
                    catch
                    {}
                    if (errorCount == 0)
                    {
                        ActionOnLineHelper onLine = new ActionOnLineHelper(this._domainDataProvider);

//						((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.AutoCloseConnection = false;
//						((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.OpenConnection();
                        Messages messages = onLine.GetIDInfo(aoiData.RCARD.Trim().ToUpper());
                        try
                        {
                            ProductInfo product = (ProductInfo)messages.GetData().Values[0];
                            // Added by Icyer 2006/08/03
                            // 只有当Simulation中没有数据时,才认为是第一次经过AOI站,才执行SMT上料
                            bool bExecuteSMTLoadItem = (product.LastSimulation == null);
                            // Added end
                            this._domainDataProvider.BeginTransaction();
                            string goodResult = string.Empty;
                            //归属工单采集
                            //Laws Lu,2006/08/10 归属工单时需要检查是否符合首字符串和长度检查

                            string moCode = this.getMOCode(aoiData.RCARD.Trim().ToUpper());

                            if (System.Configuration.ConfigurationSettings.AppSettings["MOPREFIXSTRING"] != null)
                            {
                                string moPrefix = System.Configuration.ConfigurationSettings.AppSettings["MOPREFIXSTRING"].Trim();
                                //首字符串检查
                                if (moCode.Length < moPrefix.Length || moCode.Substring(0, moPrefix.Length) != moPrefix)
                                {
                                    returnMsg.Add(new UserControl.Message(MessageType.Error
                                                                          , "$CS_Before_Card_FLetter_NotCompare $CS_Param_ID: " + aoiData.RCARD.Trim().ToUpper()));
                                }
                            }
                            if (System.Configuration.ConfigurationSettings.AppSettings["SNLENGTH"] != null)
                            {
                                try
                                {
                                    int snLength = int.Parse(System.Configuration.ConfigurationSettings.AppSettings["SNLENGTH"].Trim());
                                    //长度检查
                                    if (aoiData.RCARD.Trim().ToUpper().Length != snLength)
                                    {
                                        returnMsg.Add(new UserControl.Message(MessageType.Error,
                                                                              "$CS_Before_Card_Length_FLetter_NotCompare $CS_Param_ID: " + aoiData.RCARD.Trim().ToUpper()));
                                    }
                                }
                                catch (Exception ex)
                                {
                                    returnMsg.Add(new UserControl.Message(ex));
                                }
                            }

                            if (returnMsg.IsSuccess())
                            {
                                IAction dataCollectMO = new ActionFactory(this._domainDataProvider).CreateAction(ActionType.DataCollectAction_GoMO);
                                messages.AddMessages(((IActionWithStatus)dataCollectMO).Execute(
                                                         new GoToMOActionEventArgs(ActionType.DataCollectAction_GoMO,
                                                                                   aoiData.RCARD.Trim().ToUpper(),
                                                                                   aoiData.USER.Trim().ToUpper(),
                                                                                   AgentHelp.getResCode(aoiData.RESOURCE.Trim().ToUpper()),
                                                                                   product, moCode)));


                                if (messages.IsSuccess())
                                {
                                    returnMsg.Add(new UserControl.Message(UserControl.MessageType.Success, string.Format("{0} $CS_GOMO_CollectSuccess", aoiData.RCARD.ToUpper())));
                                }
                                else
                                {
                                    returnMsg.Add(new UserControl.Message(UserControl.MessageType.Error, AgentHelp.GetErrorMessage(messages)));
                                }
                            }
                            messages.ClearMessages();


                            //GOOD采集
                            messages = onLine.GetIDInfo(aoiData.RCARD.Trim().ToUpper());
                            product  = (ProductInfo)messages.GetData().Values[0];
                            BenQGuru.eMES.DataCollect.DataCollectFacade dcFacade = new BenQGuru.eMES.DataCollect.DataCollectFacade(this._domainDataProvider);
                            goodResult = dcFacade.ActionCollectGood(aoiData.RCARD.ToUpper(), aoiData.USER.ToUpper(), AgentHelp.getResCode(aoiData.RESOURCE.ToUpper()));
                            // Added by Icyer 2006/08/03
                            // SMT上料
                            if (returnMsg.IsSuccess() == true && bExecuteSMTLoadItem == true)
                            {
                                returnMsg.AddMessages(this.SMTLoadItem(aoiData.RCARD.ToUpper(), AgentHelp.getResCode(aoiData.RESOURCE.ToUpper()), aoiData.USER.ToUpper()));
                            }
                            // Added end
                            if (goodResult == "OK")
                            {
                                this._domainDataProvider.CommitTransaction();

                                returnMsg.Add(new UserControl.Message(UserControl.MessageType.Success, string.Format("{0} $CS_GOOD_CollectSuccess", aoiData.RCARD.ToUpper())));
                                returnMsg.Add(new UserControl.Message(" "));
                                BenQGuru.eMES.Common.Log.Info(string.Format("{0} $CS_GOOD_CollectSuccess: {1}", aoiData.RCARD.Trim().ToUpper(), "OK"));
                                messages.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOODSUCCESS,$CS_Param_ID:{0}", aoiData.RCARD.ToUpper())));
                            }
                            else
                            {
                                this._domainDataProvider.RollbackTransaction();

                                string errorMsg = string.Format("{0} $CS_GOOD_CollectFail : {1}", aoiData.RCARD.Trim().ToUpper(), goodResult);
                                returnMsg.Add(new UserControl.Message(UserControl.MessageType.Error, errorMsg));
                                returnMsg.Add(new UserControl.Message(" "));
                                BenQGuru.eMES.Common.Log.Info(errorMsg);
                            }
                        }
                        catch (Exception ex)
                        {
                            this._domainDataProvider.RollbackTransaction();
                            BenQGuru.eMES.Common.Log.Info(AgentHelp.GetErrorMessage(messages), ex);
                        }
                        finally
                        {
//							((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.CloseConnection();
//							((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)_domainDataProvider).PersistBroker.AutoCloseConnection = true;
                        }
                    }
                }
            }
            catch
            {}
            return(returnMsg);
        }