Example #1
0
        /// <summary>
        /// ** 功能描述:	上料采集,包括INNO和KEYPARTS上料
        ///							集成上料号,必须存在且对应于RESOURCE
        ///							KEYPARTS料的检查在前台已经做完
        ///							事务必须在外面处理
        /// ** 作 者:		Mark Lee
        /// ** 日 期:		2005-06-01
        /// ** 修 改:
        /// ** 日 期:
        /// </summary>
        /// <param name="actionEventArgs"></param>
        /// <returns></returns>
        public Messages Execute(ActionEventArgs actionEventArgs)
        {
            Messages         messages         = new Messages();
            DataCollectDebug dataCollectDebug = new DataCollectDebug(this.GetType().ToString() + "Collect");

            dataCollectDebug.WhenFunctionIn(messages);
            Messages msgAutoGoMO = new Messages();              // Added by Icyer 2007/03/09

            try
            {
                // Added by Icyer 2007/03/09
                // 检测自动归属工单
                ActionGoToMO actionGoToMO = new ActionGoToMO(this.DataProvider);
                msgAutoGoMO = actionGoToMO.AutoGoMO(actionEventArgs);
                // Added end

                ActionOnLineHelper dataCollect = new ActionOnLineHelper(this.DataProvider);
                //填写SIMULATION 检查工单、ID、途程、操作
                messages.AddMessages(dataCollect.CheckID(actionEventArgs));
                if (messages.IsSuccess())
                {
                    //上料检查  分INNO、KEYPARTS TODO
                    //if (actionEventArgs.ActionType ==ActionType.DataCollectAction_CollectINNO)


                    messages.AddMessages(dataCollect.Execute(actionEventArgs));
                    if (messages.IsSuccess())
                    {
                        DataCollectFacade dataCollectFacade = new DataCollectFacade(this.DataProvider);

                        #region 填写上料信息表  分INNO、KEYPARTS TODO
                        if (actionEventArgs.ActionType == ActionType.DataCollectAction_CollectINNO)
                        {
                            InsertINNOOnWipItem(actionEventArgs, dataCollectFacade);
                        }
                        #endregion

                        // Added by Icyer 2005/08/16
                        // 上料扣库存
                        // 暂时屏蔽 FOR 夏新P3版本 MARK LEE 2005/08/22
                        // 取消屏蔽 Icyer 2005/08/23
                        //Laws Lu,2005/10/20,新增	使用配置文件来控制物料模块是否使用
                        if (System.Configuration.ConfigurationSettings.AppSettings["NeedMaterialModule"].Trim() == "1")
                        {
                            BenQGuru.eMES.Material.WarehouseFacade wfacade = new WarehouseFacade(this.DataProvider);
                            wfacade.CollectMaterialStock(actionEventArgs.ProductInfo.NowSimulation.LotCode, actionEventArgs.ProductInfo.NowSimulation.LotSeq.ToString(), actionEventArgs.ProductInfo.NowSimulation.MOCode);
                        }
                        // Added end
                    }
                }
            }
            catch (Exception e)
            {
                messages.Add(new Message(e));
            }
            dataCollectDebug.WhenFunctionOut(messages);
            //return messages;
            if (msgAutoGoMO.Count() < 1 || (msgAutoGoMO.IsSuccess() == true && messages.IsSuccess() == false))
            {
                return(messages);
            }
            else
            {
                msgAutoGoMO.IgnoreError();
                msgAutoGoMO.AddMessages(messages);
                return(msgAutoGoMO);
            }
        }