Exemplo n.º 1
0
        private void QueryEvent(object sender, EventArgs e)
        {
            int BeginDate = FormatHelper.TODateInt(this.txtBeginDate.Text);
            int EndDate   = FormatHelper.TODateInt(this.txtEndDate.Text);

            BenQGuru.eMES.TS.TSFacade tsfacade = new BenQGuru.eMES.TS.TSFacade(base.DataProvider);
            (e as WebQueryEventArgs).GridDataSource =
                tsfacade.QuerySimulationReport(
                    FormatHelper.CleanString(this.txtConditionMo.Text).ToUpper(),
                    FormatHelper.CleanString(this.txtConditionItem.Text).ToUpper(),
                    FormatHelper.CleanString(this.txtStartSnQuery.Text),
                    FormatHelper.CleanString(this.txtEndSnQuery.Text),
                    BeginDate,
                    EndDate,
                    (e as WebQueryEventArgs).StartRow,
                    (e as WebQueryEventArgs).EndRow);

            (e as WebQueryEventArgs).RowCount =
                tsfacade.QuerySimulationReportCount(
                    FormatHelper.CleanString(this.txtConditionMo.Text).ToUpper(),
                    FormatHelper.CleanString(this.txtConditionItem.Text).ToUpper(),
                    FormatHelper.CleanString(this.txtStartSnQuery.Text),
                    FormatHelper.CleanString(this.txtEndSnQuery.Text),
                    BeginDate,
                    EndDate);
        }
Exemplo n.º 2
0
 protected override object[] LoadDataSource(int inclusive, int exclusive)
 {
     if (_facade == null)
     {
         _facade = new TSFacade(this.DataProvider);
     }
     object[] objs = this._facade.QueryErrorCodeSmartTS(this.txtErrorCodeQuery.Text);
     if (objs != null)
     {
         this.gridHelper.PagerToolBar.RowCount = objs.Length;
     }
     return(objs);
 }
Exemplo n.º 3
0
        private Messages SetReworkInformation(Messages messages, object[] Simulations, OQCRejectEventArgs actionEventArgs, ActionOnLineHelper dataCollect, ReworkFacade reworkFacade)
        {
            Messages newMessages = new Messages();

            BenQGuru.eMES.TS.TSFacade tsFacade = new BenQGuru.eMES.TS.TSFacade(this.DataProvider);
            DataCollectFacade         dcf      = new DataCollectFacade(this._domainDataProvider);
            //ProductInfo preProduct =null;
            int i = 0;

            ActionCheckStatus actionCheckStatus = new ActionCheckStatus();

            if (Resource == null)
            {
                BenQGuru.eMES.BaseSetting.BaseModelFacade dataModel = new BenQGuru.eMES.BaseSetting.BaseModelFacade(this.DataProvider);
                Resource = (Domain.BaseSetting.Resource)dataModel.GetResource(actionEventArgs.ResourceCode);
            }

            while (i < Simulations.Length)
            {
                try
                {
                    #region 保存WIP
                    ProductInfo productionInf = dataCollect.GetIDInfoBySimulation((Simulation)Simulations[i]);

                    if (actionEventArgs.listActionCheckStatus.ContainsKey(productionInf.LastSimulation.MOCode))
                    {
                        actionCheckStatus = (ActionCheckStatus)actionEventArgs.listActionCheckStatus[productionInf.LastSimulation.MOCode];

                        actionCheckStatus.ProductInfo = productionInf;

                        actionCheckStatus.ProductInfo.Resource = Resource;

                        //					lastSimulation =  productionInf.LastSimulation;
                        actionCheckStatus.ActionList = new ArrayList();
                    }
                    else
                    {
                        //actionCheckStatus.NeedUpdateSimulation = false;
                        //actionCheckStatus.NeedFillReport = true;
                        actionEventArgs.listActionCheckStatus.Add(productionInf.LastSimulation.MOCode, actionCheckStatus);
                    }

                    OQCRejectEventArgs oqcRejectEventArgs = new OQCRejectEventArgs(
                        ActionType.DataCollectAction_OQCReject, ((Simulation)Simulations[i]).RunningCard,
                        actionEventArgs.UserCode, actionEventArgs.ResourceCode, actionEventArgs.OQCLotNO, productionInf);

                    newMessages.AddMessages(dataCollect.CheckID(oqcRejectEventArgs, actionCheckStatus));
                    //					if (preProduct != null)
                    //					{
                    //						if (dataCollect.CompareSimulationCheck(preProduct.LastSimulation,oqcRejectEventArgs.ProductInfo.LastSimulation))
                    //						{
                    //							dataCollect.CopyProduct(preProduct,oqcRejectEventArgs.ProductInfo);
                    //							dcf.WriteSimulationCheckOnlineOP(oqcRejectEventArgs.RunningCard,oqcRejectEventArgs.ActionType,oqcRejectEventArgs.ResourceCode,
                    //								oqcRejectEventArgs.UserCode,oqcRejectEventArgs.ProductInfo);
                    //							needCheck=false;
                    //						}
                    //					}
                    //					if (needCheck)
                    //						newMessages.AddMessages(dataCollect.CheckID(oqcRejectEventArgs));
                    if (!newMessages.IsSuccess())
                    {
                        return(newMessages);
                    }
                    #region TS
                    //Laws Lu,需要修改	曾经走过TS处理,没有考虑多次TS的情况,MOCode和Sequence也应该作为关键参数,
                    BenQGuru.eMES.Domain.TS.TS ts = (BenQGuru.eMES.Domain.TS.TS)tsFacade.GetCardLastTSRecord(oqcRejectEventArgs.RunningCard);
                    if (ActionType.DataCollectAction_OQCReject == oqcRejectEventArgs.ActionType &&
                        ts != null &&
                        ts.FromInputType == TS.TSFacade.TSSource_OnWIP
                        )
                    {
                        //Laws Lu,2006/07/07 修复在OQC前工序NG回流后,SN后仍然留在PK站
                        dcf.AdjustRouteOPOnline(oqcRejectEventArgs.RunningCard
                                                , ActionType.DataCollectAction_OQCReject
                                                , oqcRejectEventArgs.ResourceCode
                                                , oqcRejectEventArgs.UserCode
                                                , oqcRejectEventArgs.ProductInfo);


                        //oqcRejectEventArgs.ProductInfo.NowSimulation.OPCode = op.OPCode;

                        dcf.WriteSimulation(
                            oqcRejectEventArgs.RunningCard
                            , ActionType.DataCollectAction_OQCReject
                            , oqcRejectEventArgs.ResourceCode
                            , oqcRejectEventArgs.UserCode
                            , oqcRejectEventArgs.ProductInfo);
                    }
                    #endregion
                    //Laws Lu,2006/07/07 fix op
                    if (oqcRejectEventArgs.ProductInfo.CurrentItemRoute2OP != null)
                    {
                        oqcRejectEventArgs.ProductInfo.NowSimulation.OPCode = oqcRejectEventArgs.ProductInfo.CurrentItemRoute2OP.OPCode;
                    }
                    else
                    {
                        object objNextOP = (new BaseModelFacade(DataProvider)).GetNextOperationOfRoute(oqcRejectEventArgs.ProductInfo.LastSimulation.RouteCode, oqcRejectEventArgs.ProductInfo.LastSimulation.OPCode);
                        if (objNextOP != null)
                        {
                            oqcRejectEventArgs.ProductInfo.NowSimulation.OPCode = (objNextOP as Operation).OPCode;
                        }
                    }

                    oqcRejectEventArgs.ProductInfo.NowSimulation.ProductStatus = ProductStatus.Reject;
                    if (actionCheckStatus.NeedUpdateSimulation == true)
                    {
                        //把资源暂时替换成onwip需要正确资源
                        string resCode = oqcRejectEventArgs.ResourceCode;
                        oqcRejectEventArgs.ResourceCode = actionEventArgs.rightResource;
                        newMessages.AddMessages(dataCollect.Execute(oqcRejectEventArgs));
                        //转换回原来的资源
                        oqcRejectEventArgs.ResourceCode = resCode;
                    }
                    #endregion
                    if (newMessages.IsSuccess())
                    {
                        if (oqcRejectEventArgs.ProductInfo.NowSimulation == null)
                        {
                            throw new Exception("$System_Error");
                        }


                        #region reject
                        Reject reject = reworkFacade.CreateNewReject();
                        reject.ItemCode              = oqcRejectEventArgs.ProductInfo.NowSimulation.ItemCode;
                        reject.LOTNO                 = oqcRejectEventArgs.OQCLotNO;
                        reject.MaintainUser          = oqcRejectEventArgs.UserCode;
                        reject.MOCode                = oqcRejectEventArgs.ProductInfo.NowSimulation.MOCode;
                        reject.ModelCode             = oqcRejectEventArgs.ProductInfo.NowSimulation.ModelCode;
                        reject.OPCode                = oqcRejectEventArgs.ProductInfo.NowSimulation.OPCode;
                        reject.RejectDate            = oqcRejectEventArgs.ProductInfo.NowSimulation.MaintainDate;
                        reject.RejectStatus          = RejectStatus.Reject;
                        reject.RejectTime            = oqcRejectEventArgs.ProductInfo.NowSimulation.MaintainTime;
                        reject.RejectUser            = oqcRejectEventArgs.UserCode;
                        reject.ResourceCode          = oqcRejectEventArgs.ResourceCode;
                        reject.RouteCode             = oqcRejectEventArgs.ProductInfo.NowSimulation.RouteCode;
                        reject.RunningCard           = oqcRejectEventArgs.RunningCard;
                        reject.RunningCardSequence   = oqcRejectEventArgs.ProductInfo.NowSimulation.RunningCardSequence;
                        reject.SegmentCode           = oqcRejectEventArgs.ProductInfo.NowSimulationReport.SegmentCode;
                        reject.SourceCard            = oqcRejectEventArgs.ProductInfo.NowSimulation.SourceCard;
                        reject.SourceCardSequence    = oqcRejectEventArgs.ProductInfo.NowSimulation.SourceCardSequence;
                        reject.StepSequenceCode      = oqcRejectEventArgs.ProductInfo.NowSimulationReport.StepSequenceCode;
                        reject.TranslateCard         = oqcRejectEventArgs.ProductInfo.NowSimulation.TranslateCard;
                        reject.TranslateCardSequence = oqcRejectEventArgs.ProductInfo.NowSimulation.TranslateCardSequence;
                        reject.MOSeq                 = oqcRejectEventArgs.ProductInfo.NowSimulation.MOSeq; // Added by Icyer 2007/07/02
                        reworkFacade.AddReject(reject);
                        #endregion
                    }

                    //Laws Lu,2005/08/25,新增
                    //样本如果有若干个已经经过“送修确认”转为“待修”状态(或者在维修中),那么批退不可以继续
                    //TSFacade tsFacade = new TSFacade(this._domainDataProvider);
                    //Laws Lu,2005/08/25,新增	删除TS中的记录
                    //Laws Lu,2005/08/31,修改	只有FQC工序送修才能够被删除
                    if (oqcRejectEventArgs.ActionType == ActionType.DataCollectAction_OQCReject &&
                        ts != null &&
                        ts.FromInputType == TS.TSFacade.TSSource_OnWIP &&
                        ts.TSStatus == BenQGuru.eMES.Web.Helper.TSStatus.TSStatus_New)
                    {
                        if (ts.FromRouteCode == oqcRejectEventArgs.ProductInfo.LastSimulation.RouteCode &&
                            ts.FromOPCode == oqcRejectEventArgs.ProductInfo.LastSimulation.OPCode &&
                            ts.MOCode == oqcRejectEventArgs.ProductInfo.LastSimulation.MOCode &&
                            ts.RunningCardSequence == oqcRejectEventArgs.ProductInfo.LastSimulation.RunningCardSequence &&
                            ts.RunningCard == oqcRejectEventArgs.ProductInfo.LastSimulation.RunningCard)
                        {
                            tsFacade.DeleteCardInTS(
                                oqcRejectEventArgs.ProductInfo.LastSimulation.MOCode
                                , oqcRejectEventArgs.ProductInfo.LastSimulation.RunningCard
                                , oqcRejectEventArgs.ProductInfo.LastSimulation.RunningCardSequence.ToString());
                        }
                    }
                }
                catch (Exception ex)
                {
                    newMessages.Add(new Message(ex));
                }

                //preProduct=oqcRejectEventArgs.ProductInfo;
                i = i + 1;
            }

            //Laws Lu,2006/03/20 填写资源报表
            //Laws Lu,2006/03/21 支持混单
            Hashtable htOutput = new Hashtable();

            foreach (Simulation sim in Simulations)
            {
                Simulation tmpSim = null;
                foreach (Simulation x in htOutput.Keys)
                {
                    if (sim.MOCode == x.MOCode)
                    {
                        tmpSim = x;
                        break;
                    }
                }
                if (tmpSim != null)
                {
                    htOutput[tmpSim] = Convert.ToInt32(htOutput[tmpSim]) + 1;
                }
                else
                {
                    htOutput.Add(sim, 1);
                }
            }


            foreach (Simulation sim in htOutput.Keys)
            {
                ProductInfo product = null;

                Messages msgs = dataCollect.GetIDInfo(sim.RunningCard);
                if (msgs.IsSuccess())
                {
                    product = msgs.GetData().Values[0] as ProductInfo;
                }
                DBDateTime dbDateTime;

                dbDateTime = FormatHelper.GetNowDBDateTime(DataProvider);

                //				dcf.AdjustRouteOPOnline(
                //					product.LastSimulation.RunningCard,
                //					actionEventArgs.ActionType,
                //					actionEventArgs.ResourceCode,
                //					actionEventArgs.UserCode,
                //					product);

                product.NowSimulation.MaintainUser  = actionEventArgs.UserCode;
                product.NowSimulation.MaintainDate  = dbDateTime.DBDate;
                product.NowSimulation.MaintainTime  = dbDateTime.DBTime;
                product.NowSimulation.LastAction    = actionEventArgs.ActionType;
                product.NowSimulation.ProductStatus = ProductStatus.GOOD;
                product.NowSimulation.ResourceCode  = Resource.ResourceCode;

                (new DataCollectFacade(DataProvider)).WriteSimulation(
                    product.LastSimulation.RunningCard
                    , ActionType.DataCollectAction_OQCPass
                    , actionEventArgs.ResourceCode
                    , actionEventArgs.UserCode
                    , product);


                product.NowSimulation.RouteCode = product.LastSimulation.RouteCode;
                product.NowSimulation.OPCode    = product.LastSimulation.OPCode;;

                product.NowSimulationReport = dataCollect.FillSimulationReport(product);
                //dataCollect.FillOnWip(pro);

                //newMessages.AddMessages((new ReportHelper(DataProvider)).SetReportResQuanMaster(
                //    DataProvider
                //    , actionEventArgs.ActionType
                //    , product
                //    , 0
                //    , Convert.ToInt32(htOutput[sim])
                //    , Convert.ToInt32(htOutput[sim])));
            }

            return(newMessages);
        }