Exemplo n.º 1
0
        public ErrorCodeGroup2ErrorCode[] GetSelectedErrorCodes()
        {
            ErrorCodeGroup2ErrorCode[] results = new ErrorCodeGroup2ErrorCode[lstSelected.Items.Count];
            string str = null;

            for (int i = 0; i <= lstSelected.Items.Count - 1; i++)
            {
                ErrorCodeGroup2ErrorCode errorGroup2Code = new ErrorCodeGroup2ErrorCode();
                str = lstSelected.Items[i].ToString();
                errorGroup2Code.ErrorCodeGroup = str.Substring(0, str.IndexOf(":", 0, str.Length));

                string errorcode = String.Empty;
                //if(str.Split(new char[]{' '}).Length > 1)
                //{
                //    string tmpString = str.Split(new char[]{' '})[0];
                //    errorcode = tmpString.Substring(tmpString.IndexOf(":",0,tmpString.Length)+1,tmpString.Length-tmpString.IndexOf(":",0,tmpString.Length)-1);
                //}
                //else
                {
                    errorcode = str.Substring(str.IndexOf(":", 0, str.Length) + 1, str.Length - str.IndexOf(":", 0, str.Length) - 1);
                }
                errorGroup2Code.ErrorCode = errorcode;
                results[i] = errorGroup2Code;
            }
            return(results);
        }
Exemplo n.º 2
0
        //Laws Lu,2006/01/10,获取不良代码组、不良代码
        public static string ParseECG2Errs(object[] errorInfo, string actType)
        {
            string strReturn = String.Empty;

            if (errorInfo == null)
            {
                return(strReturn);
            }
            for (int i = 0; i < errorInfo.Length; i++)
            {
                if (actType == ActionType.DataCollectAction_SMTNG)
                {
                    TSErrorCode2Location tsLoc = ((TSErrorCode2Location)errorInfo[i]);
                    //Laws Lu,2006/06/06
                    string eg2er = tsLoc.ErrorCodeGroup + ":" + tsLoc.ErrorCode + ";";
                    if (strReturn.IndexOf(eg2er) < 0)
                    {
                        strReturn += tsLoc.ErrorCodeGroup + ":" + tsLoc.ErrorCode + ";";
                    }
                }
                if (actType == ActionType.DataCollectAction_NG || actType == ActionType.DataCollectAction_OutLineNG)
                {
                    ErrorCodeGroup2ErrorCode tsLoc = ((ErrorCodeGroup2ErrorCode)errorInfo[i]);
                    strReturn += tsLoc.ErrorCodeGroup + ":" + tsLoc.ErrorCode + ";";
                }
            }

            return(strReturn);
        }
Exemplo n.º 3
0
        private object[] GetErrorInfor(AOIData aoiData)
        {
            string[]  errorList  = aoiData.ERRORCODES.Split('|');
            ArrayList ecg2ecList = new ArrayList();
            string    defaultECG = "DefaultECGCode";
            string    defaultEC  = "DefaultECCode";

            /*
             * for (int i=0 ; i<errorList.Length; i++)
             * {
             *      TSErrorCode2Location tsinfo = new TSErrorCode2Location();
             *      if(errorList[i].Split(',')[0].Trim() == string.Empty)continue;
             *      tsinfo.ErrorLocation = errorList[i].Split(',')[0];
             *      object[] ecg2ec = this.QueryECG2EC(errorList[i].Split(',')[2]);
             *      if(ecg2ec != null && ecg2ec.Length>0)
             *      {
             *              tsinfo.ErrorCode = ((ErrorCodeGroup2ErrorCode)ecg2ec[0]).ErrorCode;
             *              tsinfo.ErrorCodeGroup = ((ErrorCodeGroup2ErrorCode)ecg2ec[0]).ErrorCodeGroup;
             *      }
             *      else
             *      {
             *              tsinfo.ErrorCode = defaultEC;
             *              tsinfo.ErrorCodeGroup = defaultECG;
             *      }
             *      tsinfo.ErrorLocation = string.Empty;
             *      tsinfo.AB = "A";
             *
             *      ecg2ecList.Add(tsinfo);
             * }
             *
             * return (TSErrorCode2Location[])ecg2ecList.ToArray(typeof(TSErrorCode2Location));
             */
            for (int i = 0; i < errorList.Length; i++)
            {
                ErrorCodeGroup2ErrorCode tsinfo = new ErrorCodeGroup2ErrorCode();
                object[] ecg2ec = this.QueryECG2EC(errorList[i]);
                if (ecg2ec != null && ecg2ec.Length > 0)
                {
                    tsinfo.ErrorCode      = ((ErrorCodeGroup2ErrorCode)ecg2ec[0]).ErrorCode;
                    tsinfo.ErrorCodeGroup = ((ErrorCodeGroup2ErrorCode)ecg2ec[0]).ErrorCodeGroup;
                }
                else
                {
                    tsinfo.ErrorCode      = defaultEC;
                    tsinfo.ErrorCodeGroup = defaultECG;
                }

                ecg2ecList.Add(tsinfo);
            }

            return((ErrorCodeGroup2ErrorCode[])ecg2ecList.ToArray(typeof(ErrorCodeGroup2ErrorCode)));
        }
Exemplo n.º 4
0
        protected override object GetEditObject(GridRecord row)
        {
            if (_facade == null)
            {
                _facade = new TSModelFacadeFactory(base.DataProvider).CreateTSModelFacade();
            }
            ErrorCodeGroup2ErrorCode relation = _facade.CreateNewErrorCodeGroup2ErrorCode();

            relation.ErrorCodeGroup = this.txtErrorCodeGroupCodeQuery.Text.Trim();
            relation.ErrorCode      = row.Items.FindItemByKey("AssErrorCode").Text;
            relation.MaintainUser   = this.GetUserCode();

            return(relation);
        }
Exemplo n.º 5
0
        public UCErrorCodeSelect()
        {
            // 该调用是 Windows.Forms 窗体设计器所必需的。
            InitializeComponent();

            this.txtEndChar.Value = ClipOK;

            cbxErrorGroup.Clear();
            lstSelect.Items.Clear();
            lstSelected.Items.Clear();
            errorCodeGroup2ErrorCode = new ErrorCodeGroup2ErrorCode();

            cbxErrorGroup.ComboBoxData.DropDownStyle  = ComboBoxStyle.DropDownList;
            this.cbxErrorGroup.ComboBoxData.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.cbxErrorGroup_KeyPress);
        }
Exemplo n.º 6
0
        //Laws Lu,2006/01/10,获取不良代码组、不良代码
        public static string ParseECG2Errs(object[] errorInfo, string actType)
        {
            string strReturn = String.Empty;

            if (errorInfo == null)
            {
                return(strReturn);
            }
            for (int i = 0; i < errorInfo.Length; i++)
            {
                if (actType == ActionType.DataCollectAction_NG || actType == ActionType.DataCollectAction_OutLineNG)
                {
                    ErrorCodeGroup2ErrorCode tsLoc = ((ErrorCodeGroup2ErrorCode)errorInfo[i]);
                    strReturn += tsLoc.ErrorCodeGroup + ":" + tsLoc.ErrorCode + ";";
                }
            }

            return(strReturn);
        }
Exemplo n.º 7
0
        public object[] GetSelectedErrorCodeList()
        {
            ArrayList errorCodeList = new ArrayList();
            ErrorCodeGroup2ErrorCode tsErrorCode;

            foreach (DataRow row in this.m_ErrorList.Tables["ErrorCode"].Rows)
            {
                if (string.Compare(Convert.ToString(row["Checked"]), "true", true) == 0)
                {
                    tsErrorCode = new ErrorCodeGroup2ErrorCode();
                    tsErrorCode.ErrorCodeGroup = Convert.ToString(row["ErrorGroupCode"]);
                    tsErrorCode.ErrorCode      = Convert.ToString(row["ErrorCodeCode"]);

                    errorCodeList.Add(tsErrorCode);
                }
            }

            return(errorCodeList.ToArray());
        }
Exemplo n.º 8
0
        private Messages SetRCardReflowByErrorCode(ActionEventArgs actionEventArgs)
        {
            Messages messages  = new Messages();
            string   routeCode = "";
            string   opCode    = "";

            System.Collections.Generic.List <string> listErrorCode = new System.Collections.Generic.List <string>();

            if (((TSActionEventArgs)actionEventArgs).ErrorCodes != null)
            {
                ErrorCodeGroup2ErrorCode[] error = new ErrorCodeGroup2ErrorCode[((TSActionEventArgs)actionEventArgs).ErrorCodes.Length];
                ((TSActionEventArgs)actionEventArgs).ErrorCodes.CopyTo(error, 0);
                for (int i = 0; i < error.Length; i++)
                {
                    if (error[i].ErrorCode != "" && listErrorCode.Contains(error[i].ErrorCode) == false)
                    {
                        listErrorCode.Add(error[i].ErrorCode);
                    }
                }
            }
            if (listErrorCode.Count == 0)
            {
                return(messages);
            }

            // 查询不良代码和产品对应的返工途程
            TSModel.TSModelFacade tsmodelFacade = new BenQGuru.eMES.TSModel.TSModelFacade(this.DataProvider);
            object objErrorCode2OPRework        = tsmodelFacade.GetErrorCode2OPRework(actionEventArgs.ProductInfo.NowSimulation.OPCode,
                                                                                      listErrorCode[0], GlobalVariables.CurrentOrganizations.First().OrganizationID);

            object             tempOPRework;
            ErrorCode2OPRework tempErrorCode2OPRework;

            if (objErrorCode2OPRework == null)
            {
                for (int i = 1; i < listErrorCode.Count; i++)
                {
                    tempOPRework = tsmodelFacade.GetErrorCode2OPRework(actionEventArgs.ProductInfo.NowSimulation.OPCode,
                                                                       listErrorCode[i], GlobalVariables.CurrentOrganizations.First().OrganizationID);
                    if (tempOPRework != null)
                    {
                        messages.Add(new Message(MessageType.Error, "$Error_ErrorCodeHaveMoreThanOneRoute"));
                        return(messages);
                    }
                }
                return(messages);
            }
            else
            {
                ErrorCode2OPRework firstErrorCode2OPRework = objErrorCode2OPRework as ErrorCode2OPRework;
                for (int i = 1; i < listErrorCode.Count; i++)
                {
                    tempOPRework = tsmodelFacade.GetErrorCode2OPRework(actionEventArgs.ProductInfo.NowSimulation.OPCode,
                                                                       listErrorCode[i], GlobalVariables.CurrentOrganizations.First().OrganizationID);

                    if (tempOPRework == null)
                    {
                        messages.Add(new Message(MessageType.Error, "$Error_ErrorCodeHaveMoreThanOneRoute"));
                        return(messages);
                    }
                    else
                    {
                        tempErrorCode2OPRework = tempOPRework as ErrorCode2OPRework;
                        if (tempErrorCode2OPRework.RouteCode != firstErrorCode2OPRework.RouteCode ||
                            tempErrorCode2OPRework.ToOPCode != firstErrorCode2OPRework.ToOPCode)
                        {
                            messages.Add(new Message(MessageType.Error, "$Error_ErrorCodeHaveMoreThanOneRoute"));
                            return(messages);
                        }
                    }
                }

                opCode    = firstErrorCode2OPRework.ToOPCode;
                routeCode = firstErrorCode2OPRework.RouteCode;
                if (string.Compare(opCode, "TS", true) == 0)
                {
                    return(messages);
                }
            }

            if (routeCode.Trim().Length == 0)  // 如果途程等于空,则将当前序列号的途程作为返工途程
            {
                routeCode = actionEventArgs.ProductInfo.NowSimulation.RouteCode;
            }

            // 检查产品与途程的对应
            ItemFacade   itemFacade = new ItemFacade(this.DataProvider);
            ItemRoute2OP op         = (ItemRoute2OP)itemFacade.GetItemRoute2Operation(actionEventArgs.ProductInfo.NowSimulation.ItemCode, routeCode, opCode);

            if (op == null)
            {
                messages.Add(new Message(MessageType.Error, "$Error_ReworkRouteNotBelongToItem [" + routeCode + "]"));
                return(messages);
            }

            // 将TS的状态改成维修中
            TSFacade tsFacade = new TSFacade(this.DataProvider);
            object   obj      = tsFacade.GetCardLastTSRecord(actionEventArgs.LotCode);

            if (obj != null)
            {
                Domain.TS.TS ts = (Domain.TS.TS)obj;
                ts.ConfirmResourceCode = actionEventArgs.ResourceCode;
                ts.ConfirmUser         = actionEventArgs.UserCode;
                ts.ConfirmDate         = actionEventArgs.ProductInfo.NowSimulation.BeginDate;
                ts.ConfirmTime         = actionEventArgs.ProductInfo.NowSimulation.BeginTime;
                ts.TSStatus            = TSStatus.TSStatus_TS;
                tsFacade.UpdateTS(ts);
            }
            else
            {
                return(messages);
            }

            // 开始设置回流
            ActionFactory     actionFactory     = new ActionFactory(this.DataProvider);
            IAction           actionTSComplete  = actionFactory.CreateAction(ActionType.DataCollectAction_TSComplete);
            TSActionEventArgs tsactionEventArgs = new TSActionEventArgs(
                ActionType.DataCollectAction_TSComplete,
                actionEventArgs.LotCode,
                actionEventArgs.UserCode,
                actionEventArgs.ResourceCode,
                TSStatus.TSStatus_Reflow,
                actionEventArgs.ProductInfo.NowSimulation.MOCode,
                actionEventArgs.ProductInfo.NowSimulation.ItemCode,
                routeCode,
                op.OPCode,
                actionEventArgs.UserCode,
                null);

            tsactionEventArgs.RouteCode            = routeCode;
            tsactionEventArgs.IgnoreResourceInOPTS = true;

            messages.AddMessages(actionTSComplete.Execute(tsactionEventArgs));

            return(messages);
        }
Exemplo n.º 9
0
        public override Messages Action(object act)
        {
            Messages msg = new Messages();

            BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null;

            if (act == null)
            {
                return(msg);
            }

            if (currentProductInfo == null)
            {
                return(msg);
            }

            DataCollect.Action.ActionEventArgs args;
            if (ObjectState == null)
            {
                args = new BenQGuru.eMES.DataCollect.Action.ActionEventArgs();
            }
            else
            {
                args = ObjectState as DataCollect.Action.ActionEventArgs;
            }

            string data = act.ToString().ToUpper().Trim();//Errorcode

            //Laws Lu,2006/06/03	添加	获取已有连接
            if ((act as IDCTClient).DBConnection != null)
            {
                domainProvider = (act as IDCTClient).DBConnection as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
            }
            else
            {
                domainProvider = Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()
                                 as BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider;
                (act as IDCTClient).DBConnection = domainProvider;
            }

            //msg = CheckData(data, domainProvider);


            if (msg.IsSuccess())
            {
                //检查序列号

                ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider);
                msg = _helper.GetIDInfo(args.RunningCard);

                if (msg.IsSuccess())
                {
                    ProductInfo product = (ProductInfo)msg.GetData().Values[0];

                    TSModelFacade tsmodelFacade = new TSModelFacade(domainProvider);

                    if (msg.IsSuccess())
                    {
                        SystemSettingFacade systemSettingFacade = new SystemSettingFacade(domainProvider);
                        object parameter = systemSettingFacade.GetParameter("DEFAULTERRORCODE", "NGCOLLECTDEFAULTERRORCODE");
                        if (parameter == null)
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$Error_NoDefaultErrorCode"));
                            msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN"));
                            this.Status     = ActionStatus.PrepareData;
                            this.FlowDirect = FlowDirect.WaitingInput;
                            //base.Action(act);
                            return(msg);
                        }
                        Parameter errorCodeParameter = parameter as Parameter;
                        object    errorCode          = tsmodelFacade.GetErrorCode(errorCodeParameter.ParameterAlias);
                        if (errorCode == null)
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$ErrorCode_Not_Exist"));
                            msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN"));
                            this.Status     = ActionStatus.PrepareData;
                            this.FlowDirect = FlowDirect.WaitingInput;
                            return(msg);
                        }

                        object[] ecgObjects = tsmodelFacade.GetErrorCodeGroupByErrorCodeCode(((ErrorCodeA)errorCode).ErrorCode);
                        if (ecgObjects == null || ecgObjects.Length == 0)
                        {
                            msg.Add(new UserControl.Message(MessageType.Error, "$Error_ErrorCodeNoErrorGroup"));
                            msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN"));
                            this.Status     = ActionStatus.PrepareData;
                            this.FlowDirect = FlowDirect.WaitingInput;
                            return(msg);
                        }

                        ErrorCodeGroup2ErrorCode ecg2ec = (ErrorCodeGroup2ErrorCode)tsmodelFacade.GetErrorCodeGroup2ErrorCodeByecCode(((ErrorCodeA)errorCode).ErrorCode);

                        object[] errorcodes = new object[] { ecg2ec };
                        //if (msg.IsSuccess())
                        //{
                        //    string strModelCode = this.GetModelCodeFromProduct(product, this.moWillGo, domainProvider);
                        //    if (strModelCode != "")
                        //    {
                        //        errorcodes = tsmodelFacade.QueryECG2ECByECAndModelCode(new string[] { ((ErrorCodeA)errorCode).ErrorCode }, strModelCode);
                        //    }

                        //    if (errorcodes == null || errorcodes.Length == 0)
                        //    {
                        //        msg.Add(new UserControl.Message(UserControl.MessageType.Error, "$ErrorCode_Not_BelongTo_ModelCode"));
                        //        base.Action(act);
                        //        ActionRCard actRcard = new ActionRCard();
                        //        this.NextAction = actRcard;
                        //        return msg;
                        //    }
                        //}

                        if (msg.IsSuccess())
                        {
                            IAction dataCollectModule
                                = new BenQGuru.eMES.DataCollect.Action.ActionFactory(domainProvider).CreateAction(ActionType.DataCollectAction_NG);
                            domainProvider.BeginTransaction();
                            try
                            {
                                IDCTClient client = act as IDCTClient;

                                msg.AddMessages(((IActionWithStatus)dataCollectModule).Execute(
                                                    new TSActionEventArgs(ActionType.DataCollectAction_NG,
                                                                          args.RunningCard,
                                                                          client.LoginedUser,
                                                                          client.ResourceCode,
                                                                          product,
                                                                          errorcodes,
                                                                          null,
                                                                          "")));

                                if (msg.IsSuccess())
                                {
                                    domainProvider.CommitTransaction();
                                    base.Action(act);
                                    msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_NGSUCCESS")));
                                    return(msg);
                                }
                                else
                                {
                                    domainProvider.RollbackTransaction();
                                }
                            }
                            catch (Exception ex)
                            {
                                domainProvider.RollbackTransaction();
                                msg.Add(new UserControl.Message(ex));
                            }
                            finally
                            {
                                ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection();
                            }
                        }
                    }
                }
            }
            if (msg.IsSuccess())
            {
                base.Action(act);
            }
            else
            {
                msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN"));
                this.FlowDirect = FlowDirect.WaitingInput;
            }
            return(msg);
        }