예제 #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

            CurrentSession.AddValue(Session.SessionKeys.InfoValue, 0);
            ASTInfo info = new ASTInfo();
            info = (ASTInfo)CurrentSession.GetValue(Session.SessionKeys.ASTInfoList);

            if (info.ASTType == "ATSN3" || info.ASTType == "ATSN5" || info.ASTType == "ATSN7")
            {
                IModelRepository modelRep = RepositoryFactory.GetInstance().GetRepository<IModelRepository, Model>();
                string model = (string)CurrentSession.GetValue(Session.SessionKeys.Model2);
                IList<IMES.FisObject.Common.Model.ModelInfo> infos = new List<IMES.FisObject.Common.Model.ModelInfo>();
                infos = modelRep.GetModelInfoByModelAndName(model, "ATSNAV");
                bool bFind = false;
                foreach (IMES.FisObject.Common.Model.ModelInfo temp in infos)
                {
                    if (temp.Value != "")
                    {
                        bFind = true;
                        break;
                    }
                }

                if (bFind == false)
                {
                    CurrentSession.AddValue(Session.SessionKeys.InfoValue, 1);
                }
            }

            return base.DoExecute(executionContext);
        }
예제 #2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="executionContext"></param>
        /// <returns></returns>
        protected internal override ActivityExecutionStatus DoExecute(ActivityExecutionContext executionContext)
        {

            //从Session里取得Product对象
            Product currentProduct = (Product)CurrentSession.GetValue(Session.SessionKeys.Product);
            var productRepository = RepositoryFactory.GetInstance().GetRepository<IProductRepository, IProduct>();

            //获取Product_Part所有AST信息( Product_Part.BomNodeType = ’AT’)
            IList<ProductPart> list = new List<ProductPart>();
            ProductPart cond = new ProductPart();
            cond.ProductID = currentProduct.ProId;
            cond.BomNodeType = "AT";
            list = productRepository.GetProductPartList(cond);

            IList<ASTInfo> infos = new List<ASTInfo>();

            foreach (ProductPart temp in list)
            {
                ASTInfo item = new ASTInfo();
                item.ASTType = temp.PartType;
                item.PartNo = temp.PartID;
                item.PartSn = temp.PartSn;

                infos.Add(item);
            }
            CurrentSession.AddValue(Session.SessionKeys.ProductPartList, infos);

            
            return base.DoExecute(executionContext);
        }
예제 #3
0
파일: ChangeAST.cs 프로젝트: wra222/testgit
        public ArrayList Change(string line, string editor, string station, string customer, 
                                    string prod1, string prod2, string model1, string model2,
                                    string ASTType, string PartNo, string PartSn, IList<PrintItem> printItemLst)
        {
            logger.Debug("ChangeAST-Change Start:" + line + "," + prod1 + "," + prod2 + ","
                        + model1 + "," + model2 + "," + ASTType + "," + PartNo + "," + PartSn);

            ArrayList retValue = new ArrayList();
            string currentSessionKey = Guid.NewGuid().ToString();

            try
            {
                Session currentSession = SessionManager.GetInstance.GetSession(currentSessionKey, Session.SessionType.Common);
                if (currentSession == null)
                {
                    currentSession = new Session(currentSessionKey, Session.SessionType.Common, editor, station, line, customer);

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", currentSessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", line);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", Session.SessionType.Common);

                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("ChangeAST_Change.xoml", "ChangeAST_Change.rules", wfArguments);

                    ASTInfo info = new ASTInfo();
                    info.ASTType = ASTType;
                    info.PartNo = PartNo;
                    info.PartSn = PartSn;
                    
                    currentSession.AddValue(Session.SessionKeys.Model1, model1);
                    currentSession.AddValue(Session.SessionKeys.Model2, model2);
                    currentSession.AddValue(Session.SessionKeys.ASTInfoList, info);
                    currentSession.AddValue(Session.SessionKeys.Prod2, prod2);
                    currentSession.AddValue(Session.SessionKeys.Prod1, prod1);

                    currentSession.AddValue(Session.SessionKeys.PrintLogName, "ChangeAST");
                    currentSession.AddValue(Session.SessionKeys.PrintLogBegNo, prod1);
                    currentSession.AddValue(Session.SessionKeys.PrintLogEndNo, prod2);
                    currentSession.AddValue(Session.SessionKeys.PrintLogDescr, PartSn);

                    currentSession.AddValue(Session.SessionKeys.PrintItems, printItemLst);

                    currentSession.SetInstance(instance);

                    if (!SessionManager.GetInstance.AddSession(currentSession))
                    {
                        currentSession.WorkflowInstance.Terminate("Session:" + currentSessionKey + " Exists.");
                        FisException ex;
                        List<string> erpara = new List<string>();
                        erpara.Add(currentSessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }

                    currentSession.WorkflowInstance.Start();
                    currentSession.SetHostWaitOne();
                }
                else
                {
                    FisException ex;
                    List<string> erpara = new List<string>();
                    erpara.Add(currentSessionKey);
                    ex = new FisException("CHK020", erpara);
                    throw ex;
                }


                if (currentSession.Exception != null)
                {
                    if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        currentSession.ResumeWorkFlow();
                    }
                    throw currentSession.Exception;
                }

                int isPrint = (int)currentSession.GetValue(Session.SessionKeys.InfoValue);
                IList<PrintItem> pList = (IList<PrintItem>)currentSession.GetValue(Session.SessionKeys.PrintItems);

                retValue.Add(isPrint.ToString());
                retValue.Add(pList);
                retValue.Add(prod2);

                return retValue;
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("ChangeAST-Change End:" + line + "," + prod1 + "," + prod2 + ","
                        + model1 + "," + model2 + "," + ASTType + "," + PartNo + "," + PartSn);

            }
        }