// Added end public void AddErrorGroups(object[] errorCodeGroups) { //Amoi,Laws Lu,2005/08/02,修改 显示不良代码组名称 code + " " + name for (int i = 0; i < errorCodeGroups.Length; i++) { ErrorCodeGroupA errorGroup = ((ErrorCodeGroupA)errorCodeGroups[i]); cbxErrorGroup.AddItem(errorGroup.ErrorCodeGroup + " " + errorGroup.ErrorCodeGroupDescription, errorGroup.ErrorCodeGroup); } cbxErrorGroup.SelectedIndex = 0; //EndAmoi }
protected override object GetEditObject() { // this.ValidateInput(); if (_facade == null) { _facade = new TSModelFacadeFactory(base.DataProvider).CreateTSModelFacade(); } ErrorCodeGroupA ErrorCodeGroupA = this._facade.CreateNewErrorCodeGroup(); ErrorCodeGroupA.ErrorCodeGroup = FormatHelper.CleanString(FormatHelper.PKCapitalFormat(this.txtErrorCodeGroupEdit.Text), 40); ErrorCodeGroupA.ErrorCodeGroupDescription = FormatHelper.CleanString(this.txtErrorCodeGroupDescriptionEdit.Text, 100); ErrorCodeGroupA.MaintainUser = this.GetUserCode(); return(ErrorCodeGroupA); }
public override Messages Action(object act) { Messages msg = new Messages(); BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null; if (act == null) { return(msg); } IDCTClient client = act as IDCTClient; 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; } if (string.Compare(data, BaseDCTDriver.FINERROR, true) != 0) //结束的标志 { msg = CheckData(data, domainProvider); if (msg.IsSuccess()) { if (_currInputStep.StepType == InputStepType.ErrorCode) //一次完整的ErrorCode 与 Error Location的输入完成 { if (errorCodesHT == null) { errorCodesHT = new Hashtable(); } string key = _currInputStep.ErrorCode + "&" + _currInputStep.ErrorLoc; bool bExist = false; if (!errorCodesHT.ContainsKey(key)) { errorCodesHT.Add(key, key); } else { bExist = true; } if (bExist == false) { //msg.Add(new UserControl.Message(MessageType.Succes,data)); // Removed by Icyer 2007/01/09 避免重复输出 } else { msg.Add(new UserControl.Message(MessageType.Success, "$ErrorCodeCollected")); } this.Status = ActionStatus.PrepareData; return(msg); } else { this.Status = ActionStatus.PrepareData; return(msg); } } else { this.Status = ActionStatus.PrepareData; return(msg); } } 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 (errorCodesHT == null) { msg.Add(new UserControl.Message(UserControl.MessageType.Error, "$ErrorCode_Not_Exist")); } if (msg.IsSuccess()) { #region 得到用户输入的 Error Code和Error Location BenQGuru.eMES.Domain.TS.TSErrorCode2Location[] errorInfo = new BenQGuru.eMES.Domain.TS.TSErrorCode2Location[errorCodesHT.Count]; TSModel.TSModelFacade tsFacade = new TSModelFacade(domainProvider); int i = 0; foreach (DictionaryEntry dic in errorCodesHT) { string[] keys = dic.Key.ToString().Split('&'); if (keys.Length > 1) { //没有Location if (keys[1].Contains(NoLoc)) { object[] objs = tsFacade.GetErrorCodeGroupByErrorCodeCode(keys[0]); errorInfo[i] = new BenQGuru.eMES.Domain.TS.TSErrorCode2Location(); if (objs != null && objs.Length > 0) { ErrorCodeGroupA errorgroup = (ErrorCodeGroupA)objs[0]; errorInfo[i].ErrorCode = keys[0]; errorInfo[i].ErrorCodeGroup = errorgroup.ErrorCodeGroup; errorInfo[i].ErrorLocation = string.Empty; errorInfo[i].AB = ItemLocationSide.ItemLocationSide_AB; } } else //有location { object[] objs = tsFacade.GetErrorCodeGroupByErrorCodeCode(keys[0]); errorInfo[i] = new BenQGuru.eMES.Domain.TS.TSErrorCode2Location(); if (objs != null && objs.Length > 0) { ErrorCodeGroupA errorgroup = (ErrorCodeGroupA)objs[0]; errorInfo[i].ErrorCode = keys[0]; errorInfo[i].ErrorCodeGroup = errorgroup.ErrorCodeGroup; errorInfo[i].ErrorLocation = keys[1]; errorInfo[i].AB = ItemLocationSide.ItemLocationSide_AB; } } } else //没有Location { object[] objs = tsFacade.GetErrorCodeGroupByErrorCodeCode(keys[0]); errorInfo[i] = new BenQGuru.eMES.Domain.TS.TSErrorCode2Location(); if (objs != null && objs.Length > 0) { ErrorCodeGroupA errorgroup = (ErrorCodeGroupA)objs[0]; errorInfo[i].ErrorCode = keys[0]; errorInfo[i].ErrorCodeGroup = errorgroup.ErrorCodeGroup; errorInfo[i].ErrorLocation = string.Empty; errorInfo[i].AB = ItemLocationSide.ItemLocationSide_AB; } } i++; } #endregion /* * string[] errorcs = new string[errorCodesHT.Count]; * int i=0; * foreach( DictionaryEntry dic in errorCodesHT ) * { * errorcs[i] = dic.Key.ToString(); * i++; * } * */ /* Removed by Icyer 2007/03/15 允许自动归属工单 * //Laws Lu,2006/06/22 modify fix the bug that system alert object not set an instance when the product.LastSimulation is null * if(product.LastSimulation == null) * { * msg.Add(new UserControl.Message(UserControl.MessageType.Error,"$NoSimulation")); * } */ /* * object[] errorcodes = null; * if(msg.IsSuccess()) * { * //errorcodes = tsmodelFacade.QueryECG2ECByECAndModelCode(errorcs, product.LastSimulation.ModelCode); * string strModelCode = this.GetModelCodeFromProduct(product, this.moWillGo, domainProvider); * if (strModelCode != "") * { * errorcodes = tsmodelFacade.QueryECG2ECByECAndModelCode(errorcs, strModelCode); * } * * if( errorcodes==null || errorcodes.Length==0 ) * { * msg.Add(new UserControl.Message(UserControl.MessageType.Error,"$ErrorCode_Not_BelongTo_ModelCode")); * base.Action (act); * ActionCollectSMTNG actionCollectNG = this; * actionCollectNG.IsTopAction = false; * this.NextAction = actionCollectNG; * this.Status = ActionStatus.PrepareData; * return msg; * } * } */ if (msg.IsSuccess()) { IAction dataCollectModule = new BenQGuru.eMES.DataCollect.Action.ActionFactory(domainProvider).CreateAction(ActionType.DataCollectAction_NG); //((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.OpenConnection(); domainProvider.BeginTransaction(); try { //IDCTClient client = act as IDCTClient; ActionCheckStatus actionCheckStatus = new ActionCheckStatus(); msg.AddMessages(((IActionWithStatus)dataCollectModule).Execute( new TSActionEventArgs(ActionType.DataCollectAction_SMTNG, args.RunningCard, client.LoginedUser, client.ResourceCode, product, errorInfo, ""), actionCheckStatus)); if (msg.IsSuccess()) { domainProvider.CommitTransaction(); msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_NGSUCCESS"))); } else { domainProvider.RollbackTransaction(); } } catch (Exception ex) { domainProvider.RollbackTransaction(); msg.Add(new UserControl.Message(ex)); } finally { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection(); } } } } } //if((act as IDCTClient).CachedAction is ActionCollectSMTNG) //{ // if(this.Status == BenQGuru.eMES.Common.DCT.Core.ActionStatus.Working) // { // this.ObjectState = null; // if(this.errorCodesHT != null) // { // this.errorCodesHT.Clear(); // } // } // this.Status = BenQGuru.eMES.Common.DCT.Core.ActionStatus.PrepareData; // (act as IDCTClient).CachedAction = this; //} if (this.errorCodesHT == null) { msg.ClearMessages(); } if (msg.IsSuccess() || this.errorCodesHT == null) { base.Action(act); } else { msg.Add(new UserControl.Message(MessageType.Normal, "$DCT_NG_Please_Input_NG_SN")); this.Status = ActionStatus.PrepareData; this.FlowDirect = FlowDirect.WaitingInput; } currentProductInfo = null; moWillGo = null; this.ObjectState = null; if (this.errorCodesHT != null) { this.errorCodesHT.Clear(); } return(msg); }