// Added by Icyer 2006/12/15 // 检查工单 private Messages CheckMO(object act) { Messages msgs = new Messages(); 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; } MOFacade moFacade = new MOFacade(domainProvider); MO mo = (MO)moFacade.GetMO(act.ToString().ToUpper()); if (mo == null) { msgs.Add(new UserControl.Message(MessageType.Error, "$CS_MO_NOT_EXIST")); ProcessBeforeReturn(this.Status, msgs); return(msgs); } if (mo.MOStatus != BenQGuru.eMES.Web.Helper.MOManufactureStatus.MOSTATUS_RELEASE && mo.MOStatus != BenQGuru.eMES.Web.Helper.MOManufactureStatus.MOSTATUS_OPEN) { msgs.Add(new UserControl.Message(MessageType.Error, "$Error_CS_MO_Should_be_Release_or_Open")); ProcessBeforeReturn(this.Status, msgs); return(msgs); } MO2Route route = (MO2Route)moFacade.GetMONormalRouteByMOCode(mo.MOCode); if (route == null) { msgs.Add(new UserControl.Message(MessageType.Error, "$CS_MOnotNormalRoute")); ProcessBeforeReturn(this.Status, msgs); return(msgs); } DataCollectFacade dataCollectFacade = new DataCollectFacade(domainProvider); ItemRoute2OP op = dataCollectFacade.GetMORouteFirstOP(mo.MOCode, route.RouteCode); BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider); if (dataModel.GetOperation2Resource(op.OPCode, (act as IDCTClient).ResourceCode) == null) { msgs.Add(new UserControl.Message(MessageType.Error, "$CS_Route_Failed_FirstOP $Domain_MO =" + mo.MOCode)); ProcessBeforeReturn(this.Status, msgs); return(msgs); } ProcessBeforeReturn(this.Status, msgs); return(msgs); }
public Messages CheckProduct(string rcard, object act) { currentProductInfo = null; moWillGo = null; Messages msg = new Messages(); 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); msg = _helper.GetIDInfo(rcard); if (msg.IsSuccess()) { IDCTClient client = (IDCTClient)act; ProductInfo product = (ProductInfo)msg.GetData().Values[0]; bool bNeedCheckMO = false; if (product == null || product.LastSimulation == null) { /* 需要再检查是否归属工单 * msg.Add(new UserControl.Message(UserControl.MessageType.Error,"$NoSimulation")); * return msg; */ bNeedCheckMO = true; } else { // 如果完工,并且当前资源不属于Simulation的当前工序,则需要检查归属工单 if (product.LastSimulation.IsComplete == "1") { BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider); if (dataModel.GetOperation2Resource(product.LastSimulation.OPCode, client.ResourceCode) == null) { bNeedCheckMO = true; } } } Messages msgChkErr = new Messages(); if (bNeedCheckMO == true) { ActionGoToMO actionGoMO = new ActionGoToMO(domainProvider); Messages msgMo = actionGoMO.GetItemCodeFromGoMoRCard(client.ResourceCode, rcard); if (msgMo.IsSuccess() == false) // 如果有错误,表示需要归属工单,但是解析工单或查询工单发生错误 { msgChkErr.AddMessages(msgMo); } else // 返回成功,有两种情况:需要归属工单并且返回正确的工单信息;不需要归属工单 { UserControl.Message msgMoData = msgMo.GetData(); if (msgMoData != null && msgMoData.Values.Length > 0) // 有DATA数据,表示需要归属工单 { this.moWillGo = (MO)msgMoData.Values[0]; } else // 如果没有DATA数据,表示不需要归属工单,则调用以前的代码:如果LastSimulation为空,则报没有序列号 { if (product.LastSimulation == null) { msgChkErr.Add(new UserControl.Message(UserControl.MessageType.Error, "$NoSimulation")); } } } } if (msgChkErr.IsSuccess() == false) { return(msgChkErr); } if (product.LastSimulation != null) // 只有在序列号存在的情况下才检查途程 { msg = _helper.CheckID(new TSActionEventArgs(ActionType.DataCollectAction_NG, rcard, client.LoginedUser, client.ResourceCode, product, new object[] {}, null, "")); } if (product.LastSimulation == null || msg.IsSuccess() == true) { currentProductInfo = product; } else if (product.LastSimulation.LastAction == ActionType.DataCollectAction_GOOD || product.LastSimulation.LastAction == ActionType.DataCollectAction_NG || product.LastSimulation.LastAction == ActionType.DataCollectAction_OutLineGood || product.LastSimulation.LastAction == ActionType.DataCollectAction_OutLineNG) // 允许测试站重复采集 { BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(domainProvider); if (dataModel.GetOperation2Resource(product.LastSimulation.OPCode, (act as IDCTClient).ResourceCode) != null) { msg.ClearMessages(); currentProductInfo = product; } } } return(msg); }