public Messages AutoGoMO(ActionEventArgs actionEventArgs, ActionCheckStatus actionCheckStatus) { Messages msg = new Messages(); // 如果当前序列号是在制品,则不会做归属工单 if (actionEventArgs.ProductInfo != null && actionEventArgs.ProductInfo.LastSimulation != null && actionEventArgs.ProductInfo.LastSimulation.IsComplete != "1") { return(msg); } DBDateTime dbDateTime; dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider); string strResCode = actionEventArgs.ResourceCode; string strRCard = actionEventArgs.LotCode; // 根据资源检查是否需要归属工单 Resource2MO res2mo = GetResource2MOByResource(strResCode, dbDateTime); if (res2mo == null) // 如果没有设置,表示不用归属工单,直接返回 { return(msg); } // 检查序列号格式 msg.AddMessages(CheckRCardFormatByResource2MO(res2mo, actionEventArgs.LotCode, actionEventArgs)); if (msg.IsSuccess() == false) { return(msg); } // 解析工单 string strMOCode = BuildMOCodeByResource2MO(res2mo, actionEventArgs.LotCode, actionEventArgs, dbDateTime); // 执行归属工单的操作 GoToMOActionEventArgs gomoArg = new GoToMOActionEventArgs(ActionType.DataCollectAction_GoMO, actionEventArgs.LotCode, actionEventArgs.UserCode, actionEventArgs.ResourceCode, actionEventArgs.ProductInfo, strMOCode); IAction gomoAction = new ActionFactory(this.DataProvider).CreateAction(ActionType.DataCollectAction_GoMO); try { if (actionCheckStatus != null) { msg.AddMessages(((IActionWithStatus)gomoAction).Execute(gomoArg, actionCheckStatus)); } else { msg.AddMessages(gomoAction.Execute(gomoArg)); } } catch (Exception e) { msg.Add(new Message(e)); } if (msg.IsSuccess() == true) { msg.Add(new UserControl.Message(MessageType.Success, "$CS_GOMOSUCCESS")); if (actionCheckStatus == null || actionCheckStatus.NeedUpdateSimulation == true) { ActionOnLineHelper onLine = new ActionOnLineHelper(this.DataProvider); Messages msgProduct = onLine.GetIDInfo(actionEventArgs.LotCode); actionEventArgs.ProductInfo = (ProductInfo)msgProduct.GetData().Values[0]; } else { actionEventArgs.ProductInfo.LastSimulation = new ExtendSimulation(gomoArg.ProductInfo.NowSimulation); actionCheckStatus.ProductInfo.LastSimulation = actionEventArgs.ProductInfo.LastSimulation; } } return(msg); }
private object GetEditObject() { if (this.ValidateInput()) { if (_moFacade == null) { _moFacade = new MOFacade(this.DataProvider); } Resource2MO res2mo = this._moFacade.CreateNewResource2MO(); if (this.txtSequenceEdit.Text != "") { try { res2mo.Sequence = decimal.Parse(this.txtSequenceEdit.Text); } catch {} } res2mo.ResourceCode = this.txtResourceCodeEdit.Text.ToUpper().Trim(); res2mo.StartDate = FormatHelper.TODateInt(this.dateStartDateEdit.Text); if (res2mo.StartDate > 0) { res2mo.StartTime = FormatHelper.TOTimeInt(this.dateStartTimeEdit.Text); } res2mo.EndDate = FormatHelper.TODateInt(this.dateEndDateEdit.Text); if (res2mo.EndDate > 0) { res2mo.EndTime = FormatHelper.TOTimeInt(this.dateEndTimeEdit.Text); if (res2mo.EndTime == 0) { res2mo.EndTime = 235959; } } res2mo.MOGetType = this.drpMOGetTypeEdit.SelectedValue; if (res2mo.MOGetType == Resource2MOGetType.Static) { res2mo.StaticMOCode = this.txtMOCodeEdit.Text.ToUpper().Trim(); } else if (res2mo.MOGetType == Resource2MOGetType.GetFromRCard) { res2mo.MOCodeRunningCardStartIndex = decimal.Parse(this.txtMORCardStartIndexEdit.Text); res2mo.MOCodeLength = decimal.Parse(this.txtMOLendthEdit.Text); res2mo.MOCodePrefix = this.txtMOCodePrefix.Text.ToUpper().Trim(); res2mo.MOCodePostfix = this.txtMOCodePostfix.Text.ToUpper().Trim(); } res2mo.CheckRunningCardFormat = FormatHelper.BooleanToString(this.chkCheckRCardFormatEdit.Checked); if (this.chkCheckRCardFormatEdit.Checked == true) { res2mo.RunningCardPrefix = this.txtRCardPrefixEdit.Text.ToUpper().Trim(); if (this.txtRCardLengthEdit.Text != "") { try { res2mo.RunningCardLength = decimal.Parse(this.txtRCardLengthEdit.Text); } catch {} } } res2mo.MaintainUser = this.GetUserCode(); return(res2mo); } else { return(null); } }