Beispiel #1
0
        private UserControl.Messages CheckData(object[] parserObjs)
        {
            UserControl.Messages returnMsg = new Messages();

            if (parserObjs != null && parserObjs.Length > 0)
            {
                foreach (object obj in parserObjs)
                {
                    ICTData ictData = obj as ICTData;

                    //抽检结果
                    if (ictData.RESULT == string.Empty)
                    {
                        returnMsg.Add(new UserControl.Message(UserControl.MessageType.Error, "ICT HAS NO RESULT!"));
                    }

                    //用户检查
                    if (ictData.USER == string.Empty)
                    {
                        returnMsg.Add(new UserControl.Message(UserControl.MessageType.Error, "USERNAME IS EMPTY!"));
                    }

                    //资源检查
                    if (ictData.RESOURCE == string.Empty)
                    {
                        returnMsg.Add(new UserControl.Message(UserControl.MessageType.Error, "RESOURECODE IS EMPTY!"));
                    }
                }
            }

            return(returnMsg);
        }
Beispiel #2
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);
        }
Beispiel #3
0
        private object[] GetErrorInfor(ICTData ictData)
        {
            string[]  errorList  = ictData.ERRORCODES.Split('|');
            ArrayList ecg2ecList = new ArrayList();

            for (int i = 0; i < errorList.Length; i++)
            {
                if (errorList[i].Trim() == string.Empty)
                {
                    continue;
                }

                bool     hasShort = false;              //是否有短路不良
                bool     hasOpen  = false;              //是否有开路不良
                string[] deError  = errorList[i].Split(';');
                if (deError != null && deError.Length > 0)
                {
                    for (int j = 0; j < deError.Length; j++)
                    {
                        if (deError[j].Trim() == string.Empty)
                        {
                            continue;
                        }

                        string[]             ldeErrorInfo = deError[j].Split(',');
                        TSErrorCode2Location tsinfo       = new TSErrorCode2Location();
                        object[]             ecg2ec       = this.QueryECG2ECByECode(ldeErrorInfo[0]);
                        tsinfo.ErrorCode = ldeErrorInfo[0];

                        if (tsinfo.ErrorCode.IndexOf("PVIB") > -1)
                        {
                            //OPEN Error
                            if (hasShort)
                            {
                                continue;
                            }
                        }
                        else if (tsinfo.ErrorCode.IndexOf("PVIA") > -1)
                        {
                            //Short Error
                            if (hasOpen)
                            {
                                continue;
                            }
                        }


                        tsinfo.ErrorLocation = getErrorLocation(ldeErrorInfo[1]);
                        tsinfo.AB            = "A";
                        if (ecg2ec != null && ecg2ec.Length > 0)
                        {
                            tsinfo.ErrorCodeGroup = ((ErrorCodeGroup2ErrorCode)ecg2ec[0]).ErrorCodeGroup;
                        }
                        else
                        {
                            tsinfo.ErrorCodeGroup = ldeErrorInfo[0] + "GROUP";                                  //如果没有不良代码组,填入默认值
                        }

                        ecg2ecList.Add(tsinfo);
                        if (tsinfo.ErrorCode.IndexOf("PVIB") > -1)
                        {
                            //OPEN Error
                            hasShort = true;
                        }
                        else if (tsinfo.ErrorCode.IndexOf("PVIA") > -1)
                        {
                            //Short Error
                            hasOpen = true;
                        }
                    }
                }
            }

            return((TSErrorCode2Location[])ecg2ecList.ToArray(typeof(TSErrorCode2Location)));
        }