// Added by Icyer 2006/12/15 // 检查产品 private Messages CheckProduct(object act, string runningCard) { // 查询产品信息 BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null; 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; } try { //为改善性能 ((SQLDomainDataProvider)domainProvider).PersistBroker.AutoCloseConnection = false; ((SQLDomainDataProvider)domainProvider).PersistBroker.OpenConnection(); ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider); // Added by Icyer 2007/03/16 如果归属工单,则做归属工单检查,否则做序列号途程检查 UserControl.Messages msgProduct = _helper.GetIDInfo(runningCard); ProductInfo product = (ProductInfo)msgProduct.GetData().Values[0]; MO moWillGo = null; ActionGoToMO actionGoMO = new ActionGoToMO(domainProvider); Messages msgMo = actionGoMO.GetItemCodeFromGoMoRCard(((IDCTClient)act).ResourceCode, runningCard); if (msgMo.IsSuccess() == false) // 如果有错误,表示需要归属工单,但是解析工单或查询工单发生错误 { return(msgMo); } if (msgMo.GetData() != null) // 需要归属工单,做归属工单检查 { product.NowSimulation = new BenQGuru.eMES.Domain.DataCollect.Simulation(); UserControl.Message msgMoData = msgMo.GetData(); moWillGo = (MO)msgMoData.Values[0]; moCode = moWillGo.MOCode; ActionGoToMO goToMO = new ActionGoToMO(domainProvider); GoToMOActionEventArgs MOActionEventArgs = new GoToMOActionEventArgs( ActionType.DataCollectAction_GoMO, runningCard, ((IDCTClient)act).LoginedUser, ((IDCTClient)act).ResourceCode, product, moWillGo.MOCode); msgMo = goToMO.CheckIn(MOActionEventArgs); if (!MOActionEventArgs.PassCheck) { msgMo = _helper.CheckID(new CKeypartsActionEventArgs( ActionType.DataCollectAction_CollectINNO, runningCard, ((IDCTClient)act).LoginedUser, ((IDCTClient)act).ResourceCode, product, null, null)); } } else // 不需要归属工单,检查序列号途程 { if (product == null || product.LastSimulation == null) { msgProduct.ClearMessages(); msgProduct.Add(new UserControl.Message(MessageType.Error, "$NoSimulation")); return(msgProduct); } msgMo = _helper.CheckID(new CKeypartsActionEventArgs( ActionType.DataCollectAction_CollectINNO, runningCard, ((IDCTClient)act).LoginedUser, ((IDCTClient)act).ResourceCode, product, null, null)); } if (msgMo.IsSuccess() == false) { return(msgMo); } // Added end keypartsHT = new Hashtable(); keypartsHT.Add("ProdcutInfo", product); keypartsHT.Add("MOWillGo", moWillGo); IDCTClient client = act as IDCTClient; OPBOMFacade opBOMFacade = new OPBOMFacade(domainProvider); MOFacade moFacade = new MOFacade(domainProvider); object[] objBomDetail = null; Messages messages1 = new Messages(); if (moWillGo == null) { // 检查途程 messages1 = _helper.CheckID( new CKeypartsActionEventArgs( ActionType.DataCollectAction_CollectINNO, product.LastSimulation.RunningCard, client.LoginedUser, client.ResourceCode, product, null, null)); } if (messages1.IsSuccess() == true) { //objBomDetail = opBOMFacade.GetOPBOMDetails( // product.NowSimulation.MOCode, // product.NowSimulation.RouteCode, // product.NowSimulation.OPCode); //Miodified by Scott MO moNew = (MO)moFacade.GetMO(product.NowSimulation.MOCode); objBomDetail = opBOMFacade.QueryOPBOMDetail(product.NowSimulation.ItemCode, string.Empty, string.Empty, moNew.BOMVersion, product.NowSimulation.RouteCode, product.NowSimulation.OPCode, (int)MaterialType.CollectMaterial, int.MinValue, int.MaxValue, moNew.OrganizationID, true); if (objBomDetail == null) { messages1.Add(new UserControl.Message(MessageType.Error, "$CS_OPBOM_NotFound")); } } else { return(messages1); } //object mo = moFacade.GetMO( product.LastSimulation.MOCode ); object mo = moWillGo; if (moWillGo == null) { mo = moFacade.GetMO(product.LastSimulation.MOCode); } //OPBomKeyparts opBomKeyparts = new OPBomKeyparts(objBomDetail, Convert.ToInt32(((MO)mo).IDMergeRule), domainProvider); // 查询OPBOM if (objBomDetail == null) { msgProduct.Add(new Message(MessageType.Error, "$CS_NOOPBomInfo $CS_Param_MOCode=" + product.NowSimulation.MOCode + " $CS_Param_RouteCode=" + product.NowSimulation.RouteCode + " $CS_Param_OPCode =" + product.NowSimulation.OPCode)); return(msgProduct); } else { this.filterOpBomDetail(ref objBomDetail); if (objBomDetail == null || objBomDetail.Length <= 0) { msgProduct.Add(new Message(MessageType.Error, "$CS_OPBOM_NotFound")); return(msgProduct); } for (int i = 0; i < objBomDetail.Length; i++) { if (((OPBOMDetail)objBomDetail[i]).OPBOMItemControlType == "item_control_lot") { opBomDetailCount += 1; } else { opBomDetailCount += Convert.ToInt32(((OPBOMDetail)objBomDetail[i]).OPBOMItemQty); } } for (int i = 0; i < objBomDetail.Length; i++) { if (((OPBOMDetail)objBomDetail[i]).OPBOMItemControlType == "item_control_lot") { opBomDetailList.Add(objBomDetail[i]); } else { int number = Convert.ToInt32(((OPBOMDetail)objBomDetail[i]).OPBOMItemQty); for (int j = 0; j < number; j++) { opBomDetailList.Add(objBomDetail[i]); } } } if (((OPBOMDetail)objBomDetail[0]).OPBOMItemControlType == BOMItemControlType.ITEM_CONTROL_LOT) { msgProduct.Add(new UserControl.Message(MessageType.Normal, ">>$DCT_PLEASE_INPUT_Lot " + ((OPBOMDetail)objBomDetail[0]).OPBOMSourceItemCode)); } else { msgProduct.Add(new UserControl.Message(MessageType.Normal, ">>$DCT_PLEASE_INPUT_Keyparts " + ((OPBOMDetail)objBomDetail[0]).OPBOMSourceItemCode)); } // keypartsHT.Add("KeypartsInfo", opBomKeyparts); keypartsHT.Add("Opbomdetail", objBomDetail); } return(msgProduct); } catch (Exception ex) { throw ex; } finally { ((SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection(); ((SQLDomainDataProvider)domainProvider).PersistBroker.AutoCloseConnection = true; } }
/// <summary> /// 工单归属采集 /// </summary> /// <returns></returns> private Messages RunGOMO(ActionCheckStatus actionCheckStatus) { Messages messages = new Messages(); //Add By Bernard @ 2010-11-03 DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider); string sourceRCard = dataCollectFacade.GetSourceCard(txtRunningCard.Value.Trim().ToUpper(), string.Empty); //end //Laws Lu,新建数据采集Action ActionOnLineHelper onLine = new ActionOnLineHelper(this.DataProvider); //IAction dataCollectModule = (new ActionFactory(this.DataProvider)).CreateAction(ActionType.DataCollectAction_GoMO); //Laws Lu,2005/09/14,新增 工单不能为空 if (txtGOMO.Checked == true && txtGOMO.Value.Trim() != String.Empty) { actionCheckStatus.ProductInfo = product; //产品序列号长度检查 if (bRCardLenULE.Checked && bRCardLenULE.Value.Trim() != string.Empty) { int len = 0; try { len = int.Parse(bRCardLenULE.Value.Trim()); if (txtRunningCard.Value.Trim().Length != len) { messages.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_Length_FLetter_NotCompare $CS_Param_ID:" + txtRunningCard.Value.Trim())); } } catch { messages.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_Length_FLetter_NotCompare $CS_Param_ID:" + txtRunningCard.Value.Trim())); } } //产品序列号首字符串检查 if (bRCardLetterULE.Checked && bRCardLetterULE.Value.Trim() != string.Empty) { int index = -1; if (bRCardLetterULE.Value.Trim().Length <= txtRunningCard.Value.Trim().Length) { index = txtRunningCard.Value.IndexOf(bRCardLetterULE.Value.Trim()); } if (index == -1) { messages.Add(new UserControl.Message(MessageType.Error, "$CS_Before_Card_FLetter_NotCompare $CS_Param_ID:" + txtRunningCard.Value.Trim())); } } //add by hiro 08/11/05 检查序列号内容为字母,数字和空格 string pattern = @"^([A-Za-z0-9]+[ ]*)*[A-Za-z0-9]+$"; string rcard = this.txtRunningCard.Value.Trim().ToString(); Regex rex = new Regex(pattern, RegexOptions.IgnoreCase); Match match = rex.Match(rcard); ItemFacade itemfacade = new ItemFacade(this.DataProvider); object obj = itemfacade.GetItem2SNCheck(this.txtItem.Value.Trim().ToString(), ItemCheckType.ItemCheckType_SERIAL); if (obj != null) { if (((Item2SNCheck)obj).SNContentCheck == SNContentCheckStatus.SNContentCheckStatus_Need) { if (!match.Success) { messages.Add(new UserControl.Message(MessageType.Error, "$CS_SNContent_CheckWrong $CS_Param_RunSeq:" + this.txtRunningCard.Value.Trim().ToString())); } } } //end by hiro //Laws Lu,参数定义 GoToMOActionEventArgs args = new GoToMOActionEventArgs(ActionType.DataCollectAction_GoMO, sourceRCard.Trim(), ApplicationService.Current().UserCode, ApplicationService.Current().ResourceCode, product, txtGOMO.Value); //actionCheckStatus.NeedUpdateSimulation = false; //Laws Lu,执行工单采集并收集返回信息 if (messages.IsSuccess()) { messages.AddMessages(onLine.Action(args, actionCheckStatus)); } } if (messages.IsSuccess()) { messages.Add(new UserControl.Message(MessageType.Success, "$CS_GOMOSUCCESS $CS_Param_ID:" + this.txtRunningCard.Value.Trim().ToString())); txtRunningCard.TextFocus(false, true); } return(messages); }
// Added by Icyer 2006/12/15 // 检查产品 private Messages CheckProduct(object act, string runningCard) { // 查询产品信息 BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null; 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; } ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider); /* Removed by Icyer 2007/03/16 * UserControl.Messages msgProduct = _helper.GetIDInfo( runningCard ) ; * ProductInfo product= (ProductInfo)msgProduct.GetData().Values[0]; * if (product == null || product.LastSimulation == null) * { * msgProduct.ClearMessages(); * msgProduct.Add(new UserControl.Message(MessageType.Error, "$NoSimulation")); * return msgProduct; * } */ // Added by Icyer 2007/03/16 如果归属工单,则做归属工单检查,否则做序列号途程检查 UserControl.Messages msgProduct = _helper.GetIDInfo(runningCard); ProductInfo product = (ProductInfo)msgProduct.GetData().Values[0]; MO moWillGo = null; ActionGoToMO actionGoMO = new ActionGoToMO(domainProvider); Messages msgMo = actionGoMO.GetItemCodeFromGoMoRCard(((IDCTClient)act).ResourceCode, runningCard); if (msgMo.IsSuccess() == false) // 如果有错误,表示需要归属工单,但是解析工单或查询工单发生错误 { return(msgMo); } if (msgMo.GetData() != null) // 需要归属工单,做归属工单检查 { product.NowSimulation = new BenQGuru.eMES.Domain.DataCollect.Simulation(); UserControl.Message msgMoData = msgMo.GetData(); moWillGo = (MO)msgMoData.Values[0]; ActionGoToMO goToMO = new ActionGoToMO(domainProvider); GoToMOActionEventArgs MOActionEventArgs = new GoToMOActionEventArgs( ActionType.DataCollectAction_GoMO, runningCard, ((IDCTClient)act).LoginedUser, ((IDCTClient)act).ResourceCode, product, moWillGo.MOCode); msgMo = goToMO.CheckIn(MOActionEventArgs); if (!MOActionEventArgs.PassCheck) { msgMo = _helper.CheckID(new CKeypartsActionEventArgs( ActionType.DataCollectAction_CollectKeyParts, runningCard, ((IDCTClient)act).LoginedUser, ((IDCTClient)act).ResourceCode, product, null, null)); } } else // 不需要归属工单,检查序列号途程 { if (product == null || product.LastSimulation == null) { msgProduct.ClearMessages(); msgProduct.Add(new UserControl.Message(MessageType.Error, "$NoSimulation")); return(msgProduct); } msgMo = _helper.CheckID(new CKeypartsActionEventArgs( ActionType.DataCollectAction_CollectKeyParts, runningCard, ((IDCTClient)act).LoginedUser, ((IDCTClient)act).ResourceCode, product, null, null)); } if (msgMo.IsSuccess() == false) { return(msgMo); } // Added end keypartsHT = new Hashtable(); keypartsHT.Add("ProdcutInfo", msgProduct); keypartsHT.Add("MOWillGo", moWillGo); IDCTClient client = act as IDCTClient; OPBOMFacade opBOMFacade = new OPBOMFacade(domainProvider); object[] objBomDetail = null; Messages messages1 = new Messages(); if (moWillGo == null) { // 检查途程 messages1 = _helper.CheckID( new CKeypartsActionEventArgs( ActionType.DataCollectAction_CollectKeyParts, product.LastSimulation.RunningCard, client.LoginedUser, client.ResourceCode, product, null, null)); } if (messages1.IsSuccess() == true) { objBomDetail = opBOMFacade.GetOPBOMDetails( product.NowSimulation.MOCode, product.NowSimulation.RouteCode, product.NowSimulation.OPCode); } else { return(messages1); } MOFacade moFacade = new MOFacade(domainProvider); //object mo = moFacade.GetMO( product.LastSimulation.MOCode ); object mo = moWillGo; if (moWillGo == null) { mo = moFacade.GetMO(product.LastSimulation.MOCode); } // 查询OPBOM OPBomKeyparts opBomKeyparts = new OPBomKeyparts(objBomDetail, Convert.ToInt32(((MO)mo).IDMergeRule), domainProvider); if (opBomKeyparts.Count == 0) { msgProduct.Add(new Message(MessageType.Error, "$CS_NOOPBomInfo $CS_Param_MOCode=" + product.NowSimulation.MOCode + " $CS_Param_RouteCode=" + product.NowSimulation.RouteCode + " $CS_Param_OPCode =" + product.NowSimulation.OPCode)); return(msgProduct); } else { this.OutMesssage = new UserControl.Message(MessageType.Normal, "$DCT_PLEASE_INPUT_Keyparts " + (opBomKeyparts.GetbomKeypartCount() + 1).ToString() + "/" + opBomKeyparts.Count.ToString()); keypartsHT.Add("KeypartsInfo", opBomKeyparts); } return(msgProduct); }
public override Messages Action(object act) { Messages msg = new Messages(); if (act == 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(); //工单代码 msg = CheckData(data); if (msg.IsSuccess()) { base.Action(act); //检查序列号 ActionOnLineHelper _helper = new ActionOnLineHelper(Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()); //msg.AddMessages( _helper.GetIDInfo( args.RunningCard ) ); msg = _helper.GetIDInfo(args.RunningCard); if (msg.IsSuccess()) { ProductInfo product = (ProductInfo)msg.GetData().Values[0]; GoToMOActionEventArgs gotoMOArgs = new GoToMOActionEventArgs( ActionType.DataCollectAction_GoMO, args.RunningCard, args.UserCode, args.ResourceCode, product, data); IAction action = new BenQGuru.eMES.DataCollect.Action.ActionFactory(Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()).CreateAction(ActionType.DataCollectAction_GoMO); ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()).PersistBroker.OpenConnection(); Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider().BeginTransaction(); try { msg = ((IActionWithStatus)action).Execute(gotoMOArgs); if (msg.IsSuccess()) { Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider().CommitTransaction(); msg.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOMO_CollectSuccess"))); } else { Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider().RollbackTransaction(); } } catch (Exception ex) { Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider().RollbackTransaction(); msg.Add(new UserControl.Message(ex)); } finally { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)Common.DomainDataProvider.DomainDataProviderManager.DomainDataProvider()).PersistBroker.CloseConnection(); } } } ActionRCard actRcard = new ActionRCard(); NextAction = actRcard; return(msg); }
private void ucBtnOK_Click(object sender, System.EventArgs e) { if (this.ucLEMOCode.Value.Trim() == string.Empty) { this.ucMessage.Add(">>$CS_Please_Input_MOCode"); ucLEMOCode.TextFocus(false, true); return; } if (this.ucLERunningCard.Value.Trim() == string.Empty) { this.ucMessage.Add(">>$CS_Please_Input_RunningCard"); return; } if (this._moCode == string.Empty) { if (!this.displayMOInfo()) { return; } } string runningCard = this.ucLERunningCard.Value.Trim().ToUpper(); this.ucMessage.Add("<< " + runningCard); Messages messages = this._helper.GetIDInfo(runningCard); if (messages.IsSuccess()) { ProductInfo product = (ProductInfo)messages.GetData().Values[0]; // Added by Icyer 2005/10/28 if (Resource == null) { BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider); Resource = (Domain.BaseSetting.Resource)dataModel.GetResource(ApplicationService.Current().ResourceCode); } // Added end ActionCheckStatus actionCheckStatus = new ActionCheckStatus(); if (listActionCheckStatus.ContainsKey(_moCode)) { actionCheckStatus = (ActionCheckStatus)listActionCheckStatus[_moCode]; actionCheckStatus.ProductInfo = null; actionCheckStatus.ActionList = new ArrayList(); } else { listActionCheckStatus.Add(_moCode, actionCheckStatus); } GoToMOActionEventArgs args = new GoToMOActionEventArgs( ActionType.DataCollectAction_GoMO, runningCard, ApplicationService.Current().UserCode, ApplicationService.Current().ResourceCode, product, this._moCode); IAction action = new ActionFactory(this.DataProvider).CreateAction(ActionType.DataCollectAction_GoMO); //Laws Lu,2005/10/19,新增 缓解性能问题 ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.OpenConnection(); DataProvider.BeginTransaction(); try { messages.AddMessages(((IActionWithStatus)action).Execute(args, actionCheckStatus)); if (messages.IsSuccess()) { this.DataProvider.CommitTransaction(); messages.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOMO_CollectSuccess $MOCode={0}", this._moCode))); actionCheckStatus.MO.MOInputQty += actionCheckStatus.MO.IDMergeRule; this.displayMOInfo(); } else { this.DataProvider.RollbackTransaction(); } } catch (Exception ex) { this.DataProvider.RollbackTransaction(); messages.Add(new UserControl.Message(ex)); } finally { //Laws Lu,2005/10/19,新增 缓解性能问题 ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); } } this.ucMessage.Add(messages); this.ucMessage.Add(">>$CS_Please_Input_RunningCard"); this.ucLERunningCard.Value = ""; this.ucLERunningCard.TextFocus(false, true); }
private Messages DoAction(string rcard, int iRow) { Messages msg = new Messages(); if ((chkNeedMemo.Checked == true && CurrentSequence <= dsMo.MultiMo.Rows.Count) || chkNeedMemo.Checked == false) { msg.AddMessages(MatchMo(rcard, iRow)); } if (!msg.IsSuccess()) { ucMessage.Add(msg); } else { if (chkNeedMemo.Checked == true && CurrentSequence > dsMo.MultiMo.Rows.Count) { Memo = rcard; } else { //更新RunningCard UpdateListRCard(iRow); } #region 业务处理 //如果为最后一次,则提交更新 if ((CurrentSequence == dsMo.MultiMo.Rows.Count && chkNeedMemo.Checked == false) || ((CurrentSequence > dsMo.MultiMo.Rows.Count && chkNeedMemo.Checked == true && Memo != String.Empty))) { ActionOnLineHelper _helper = new ActionOnLineHelper(this.DataProvider); DataProvider.BeginTransaction(); try { #region 循环完成归属工单 foreach (DataRow dr in dsMo.MultiMo) { string runningCard = Convert.ToString(dr["产品序列号"]); string moCode = Convert.ToString(dr["工单"]); msg.AddMessages(_helper.GetIDInfo(runningCard)); if (msg.IsSuccess()) { ProductInfo product = (ProductInfo)msg.GetData().Values[0]; GoToMOActionEventArgs args = new GoToMOActionEventArgs( ActionType.DataCollectAction_GoMO, runningCard, ApplicationService.Current().UserCode, ApplicationService.Current().ResourceCode, product, moCode); args.Memo = Memo; IAction action = new ActionFactory(this.DataProvider).CreateAction(ActionType.DataCollectAction_GoMO); msg.AddMessages(action.Execute(args)); } } if (msg.IsSuccess()) { this.DataProvider.CommitTransaction(); UpdateCollectQty(); Memo = String.Empty; msg.Add(new UserControl.Message(MessageType.Success, "$CS_GOMO_CollectSuccess $CS_GONEXT_BILL")); } else { ClearListRCard(); this.DataProvider.RollbackTransaction(); } #endregion } catch (Exception E) { ClearListRCard(); this.DataProvider.RollbackTransaction(); msg.Add(new UserControl.Message(E)); } finally { //Laws Lu,2005/10/19,新增 缓解性能问题 ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); //ucMessage.Add( msg ); if (MoCodes != null && MoCodes.Length > 0) { UpdateList(MoCodes); } //CurrentSequence = 1; //dsMo.MultiMo.AcceptChanges(); } } else { CurrentSequence++; } #endregion } return(msg); }
private void txtRCard_TxtboxKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == '\r') { UserControl.Messages msg = new UserControl.Messages(); string rcard = Web.Helper.FormatHelper.CleanString(txtRCard.Value.Trim().ToUpper()); //检查产品序列号格式 msg.AddMessages(MatchMo(rcard, CurrentSequence - 1)); if (!msg.IsSuccess()) { ucMessage.Add(msg); this.txtMoCode.TextFocus(false, true); return; } else { #region 业务处理 //如果为最后一次,则提交更新 if (CurrentSequence == dsMo.MultiMo.Rows.Count) { //更新RunningCard UpdateListRCard(CurrentSequence - 1); ActionOnLineHelper _helper = new ActionOnLineHelper(this.DataProvider); DataProvider.BeginTransaction(); try { #region 循环完成归属工单 foreach (DataRow dr in dsMo.MultiMo) { string runningCard = Convert.ToString(dr["产品序列号"]); string moCode = Convert.ToString(dr["工单"]); msg.AddMessages(_helper.GetIDInfo(runningCard)); if (msg.IsSuccess()) { ProductInfo product = (ProductInfo)msg.GetData().Values[0]; GoToMOActionEventArgs args = new GoToMOActionEventArgs( ActionType.DataCollectAction_GoMO, runningCard, ApplicationService.Current().UserCode, ApplicationService.Current().ResourceCode, product, moCode); IAction action = new ActionFactory(this.DataProvider).CreateAction(ActionType.DataCollectAction_GoMO); msg.AddMessages(action.Execute(args)); } if (msg.IsSuccess()) { this.DataProvider.CommitTransaction(); UpdateCollectQty(); msg.Add(new UserControl.Message(MessageType.Success, "$CS_GOMO_CollectSuccess $CS_GONEXT_BILL")); } else { ClearListRCard(); this.DataProvider.RollbackTransaction(); break; } } #endregion } catch (Exception E) { ClearListRCard(); this.DataProvider.RollbackTransaction(); msg.Add(new UserControl.Message(E)); } finally { //Laws Lu,2005/10/19,新增 缓解性能问题 ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)DataProvider).PersistBroker.CloseConnection(); ucMessage.Add(msg); if (MoCodes != null && MoCodes.Length > 0) { UpdateList(MoCodes); } //CurrentSequence = 1; //dsMo.MultiMo.AcceptChanges(); } } else { //更新RunningCard UpdateListRCard(CurrentSequence - 1); CurrentSequence++; } #endregion } //提示用户继续输入产品序列号 ucMessage.Add(">>$CS_Please_Input_RunningCard " + CurrentSequence.ToString() + "/" + dsMo.MultiMo.Rows.Count.ToString()); txtRCard.Value = ""; txtRCard.TextFocus(false, true); } }
// Added end public override Messages Action(object act) { Messages msgs = new Messages(); BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider domainProvider = null; if (act == null) { return(msgs); } 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();//产品序列号 args.RunningCard = data; //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); // Removed by Icyer 2006/12/15 msgs = CheckSN(this._moCode, args.RunningCard, domainProvider); //add by hiro 08/11/05 if (msgs.IsSuccess()) { msgs = this.CheckSNContent(this._moCode, args.RunningCard, domainProvider); } //end by hiro if (msgs.IsSuccess()) { //检查序列号 ActionOnLineHelper _helper = new ActionOnLineHelper(domainProvider); //msg.AddMessages( _helper.GetIDInfo( args.RunningCard ) ); msgs = _helper.GetIDInfoByMoCodeAndId(_moCode, args.RunningCard); if (msgs.IsSuccess()) { IDCTClient client = act as IDCTClient; ProductInfo product = (ProductInfo)msgs.GetData().Values[0]; GoToMOActionEventArgs gotoMOArgs = new GoToMOActionEventArgs( ActionType.DataCollectAction_GoMO, args.RunningCard, client.LoginedUser, client.ResourceCode, product, _moCode); IAction action = new BenQGuru.eMES.DataCollect.Action.ActionFactory(domainProvider).CreateAction(ActionType.DataCollectAction_GoMO); //((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.OpenConnection(); domainProvider.BeginTransaction(); try { msgs = ((IActionWithStatus)action).Execute(gotoMOArgs); if (msgs.IsSuccess()) { domainProvider.CommitTransaction(); msgs.Add(new UserControl.Message(MessageType.Success, string.Format("$CS_GOMO_CollectSuccess"))); } else { if (msgs.OutPut().IndexOf("$CS_ID_Has_Already_Belong_To_This_MO") == 0) { msgs.ClearMessages(); msgs.Add(new UserControl.Message(UserControl.MessageType.Error, "$CS_ID_Has_Already_Belong_To_This_MO")); } domainProvider.RollbackTransaction(); } } catch (Exception ex) { domainProvider.RollbackTransaction(); msgs.Add(new UserControl.Message(ex)); } finally { ((BenQGuru.eMES.Common.DomainDataProvider.SQLDomainDataProvider)domainProvider).PersistBroker.CloseConnection(); } } } if (msgs.IsSuccess()) { base.Action(act); } this.ObjectState = null; ProcessBeforeReturn(this.Status, msgs); return(msgs); }