当前位置: 首页>>代码示例>>C#>>正文


C# Session.SetInstance方法代码示例

本文整理汇总了C#中Session.SetInstance方法的典型用法代码示例。如果您正苦于以下问题:C# Session.SetInstance方法的具体用法?C# Session.SetInstance怎么用?C# Session.SetInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Session的用法示例。


在下文中一共展示了Session.SetInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InvokeWF

        public static Session InvokeWF(string sessionKey,
                                                       string station,
                                                       string pdLine,
                                                       string customer,
                                                       string editor,
                                                       Session.SessionType sessionType,
                                                       string wfName,
                                                       string wfRule,
                                                       Dictionary<string, object> sessionKeyValue)
        {
            Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, sessionType);
            if (currentSession == null)
            {
                currentSession = new Session(sessionKey, sessionType, editor, station, pdLine, customer);
                Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                wfArguments.Add(Constant.Key, sessionKey);
                wfArguments.Add(Constant.Station, station);
                wfArguments.Add(Constant.CurrentFlowSession, currentSession);
                wfArguments.Add(Constant.Editor, editor);
                wfArguments.Add(Constant.PdLine, pdLine);
                wfArguments.Add(Constant.Customer, customer);
                wfArguments.Add(Constant.SessionType, sessionType);
                RouteManagementUtils.GetWorkflow(station, wfName, wfRule, out wfName, out wfRule);
                WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, wfRule, wfArguments);
                //Add Current Session key/value
                if (sessionKeyValue != null)
                {
                    foreach (KeyValuePair<string, object> item in sessionKeyValue)
                    {
                        currentSession.AddValue(item.Key, item.Value);
                    }
                }

                currentSession.SetInstance(instance);

                if (!SessionManager.GetInstance.AddSession(currentSession))
                {
                    currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                    throw new FisException("CHK020", new List<string> { sessionKey });
                }
                currentSession.WorkflowInstance.Start();
                currentSession.SetHostWaitOne();
            }
            else
            {
                throw new FisException("CHK020", new List<string> { sessionKey });
            }

            if (currentSession.Exception != null)
            {
                //Check Workflow Terminate Event will resume workflow event
                if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                {
                    currentSession.ResumeWorkFlow();
                }
                throw currentSession.Exception;
            }
            return currentSession;

        }
开发者ID:wra222,项目名称:testgit,代码行数:60,代码来源:WorkflowUtility.cs

示例2: UnpackDNByDN

        ///<summary>
        /// 根据指定的DeliveryNo解除绑定
        /// 使用工作流070UnpackDNByDN.xoml
        /// </summary>
        public void UnpackDNByDN(string deliveryNo, bool bSuperUI, string line, string editor, string station, string customer)
        {
            if (bSuperUI)
            {
                logger.Debug("(UnpackDNByDN[Super])Unpack start, deliveryNo:" + deliveryNo + "line:" + line + "editor:" + editor + "station:" + station + "customer:" + customer);
            }
            else
            {
                logger.Debug("(UnpackDNByDN)Unpack start, deliveryNo:" + deliveryNo + "line:" + line + "editor:" + editor + "station:" + station + "customer:" + customer);
            }

            FisException ex;
            List<string> erpara = new List<string>();


            try
            {
                var currentDelivery = RepositoryFactory.GetInstance().GetRepository<IDeliveryRepository, IMES.FisObject.PAK.DN.Delivery>().Find(deliveryNo);
                
                if (null == currentDelivery)
                {
                    throw new FisException("CHK190", new string[] { deliveryNo });//DN不存在
                }

                if (!bSuperUI && "98" == currentDelivery.Status)
                {
                    throw new FisException("CHK290", new string[] { deliveryNo });//DN已上传
                }
                if (currentDelivery.ModelName.Substring(0, 2) == "PC")
                {
                    throw new FisException("PAK166", new string[] { deliveryNo });//请使用整机的Unpack DN by DN!”
                }
                string sessionKey = currentDelivery.DeliveryNo;


                //station = "80";

                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, ProductSessionType);

                if (currentSession == null)
                {
                    currentSession = new Session(sessionKey, ProductSessionType, editor, station, line, customer);


                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", line);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", ProductSessionType);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("UnpackDNByDNForRCTO.xoml", "", wfArguments);

                    currentSession.AddValue(Session.SessionKeys.DeliveryNo, currentDelivery.DeliveryNo);
                    currentSession.AddValue(Session.SessionKeys.Delivery, currentDelivery);
                    currentSession.SetInstance(instance);

                    if (!SessionManager.GetInstance.AddSession(currentSession))
                    {
                        currentSession.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK192", erpara);
                        throw ex;
                    }

                    currentSession.WorkflowInstance.Start();
                    currentSession.SetHostWaitOne();
                }
                else
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK193", erpara);
                    throw ex;
                }


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

                    throw currentSession.Exception;
                }

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
//.........这里部分代码省略.........
开发者ID:wra222,项目名称:testgit,代码行数:101,代码来源:UnpackImplForRCTO.cs

示例3: CheckAndGetMBInfo

        /// <summary>
        /// </summary>                
        public ArrayList CheckAndGetMBInfo(string mbsn, string line, string editor, string station, string customer)
        {
            logger.Debug("(PCAOQCCosmeticImpl)CheckAndGetMBInfo Start:" + mbsn);

            ArrayList retValue = new ArrayList();
            string currentSessionKey = mbsn;

            try
            {
                Session currentSession = SessionManager.GetInstance.GetSession(currentSessionKey, Session.SessionType.MB);
                if (currentSession == null)
                {
                    currentSession = new Session(currentSessionKey, Session.SessionType.MB, 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.MB);

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

                    currentSession.AddValue(Session.SessionKeys.MB, mbsn);


                    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;
                }

                string stationDesc = (string)currentSession.GetValue(Session.SessionKeys.StationDescr);
                string lotNo = (string)currentSession.GetValue(Session.SessionKeys.LotNo);
                string lineDesc = (string)currentSession.GetValue(Session.SessionKeys.LineCode);

                string remark = (string)currentSession.GetValue(Session.SessionKeys.Remark);
                int id = (int)currentSession.GetValue(Session.SessionKeys.RepairDefectID);

                IList<string> defectLst = (IList<string>)currentSession.GetValue("DefectLst");
                IList<string> descLst = (IList<string>)currentSession.GetValue("DescLst");
                
                retValue.Add(stationDesc);
                retValue.Add(lotNo);
                retValue.Add(lineDesc);
                retValue.Add(remark);
                retValue.Add(id.ToString());
                retValue.Add(defectLst);
                retValue.Add(descLst);
                return retValue;
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(PCAOQCCosmeticImpl)CheckAndGetMBInfo End:" + mbsn);
            }
        }
开发者ID:wra222,项目名称:testgit,代码行数:96,代码来源:PCAOQCCosmeticForDocking.cs

示例4: InputPallet_CQ

        public ArrayList InputPallet_CQ(string inputID, decimal acturalWeight, string type,
                        string line, string editor, string station, string customer)
        {
            logger.Debug("(PalletWeight)InputPallet Start,"
                + " [pallletNo/UCCID]:" + inputID
                + " [line]:" + line
                + " [editor]:" + editor
                + " [station]:" + station
                + " [customer]:" + customer);


            //当20 位长的时候,视为UCC ID,否则,视为PalletNo 
            try
            {
                string plt = "";
                ArrayList retList = new ArrayList();
                List<string> erpara = new List<string>();

                if (inputID.Length == 20)
                {
                    string strSQL = "select rtrim(PalletNo) from Pallet where [email protected]";
                    SqlParameter paraName = new SqlParameter("@palletId", SqlDbType.VarChar, 32);
                    paraName.Direction = ParameterDirection.Input;
                    paraName.Value = inputID;

                    object obj = SqlHelper.ExecuteScalar(SqlHelper.ConnectionString_GetData, System.Data.CommandType.Text, strSQL, paraName);

                    if (obj == null)
                    {
                        FisException e;
                        erpara.Add(inputID);
                        e = new FisException("PAK092", erpara);
                        throw e;
                    }

                    plt = obj.ToString();
                }
                else
                {
                    plt = inputID;
                }

                string sessionKey = plt;
                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, currentSessionType);

                if (currentSession == null)
                {
                    currentSession = new Session(sessionKey, currentSessionType, editor, station, line, customer);

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

                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(station, "044PalletWeight.xoml", "044PalletWeight.rules", out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);
                    currentSession.AddValue(Session.SessionKeys.PalletNo, plt);
                    //currentSession.AddValue(Session.SessionKeys.PrintItems, printItems);
                    currentSession.AddValue(Session.SessionKeys.ActuralWeight, acturalWeight);
                    //currentSession.AddValue("PalletType", type);
                    currentSession.SetInstance(instance);

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

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


                if (currentSession.Exception != null)
                {
                    if (currentSession.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        currentSession.ResumeWorkFlow();
                    }
                    throw currentSession.Exception;
                }
                //=============================================================
                Pallet curPallet = (Pallet)currentSession.GetValue(Session.SessionKeys.Pallet);
//.........这里部分代码省略.........
开发者ID:wra222,项目名称:testgit,代码行数:101,代码来源:044PalletWeight.cs

示例5: ReprintPalletWeightLabel


//.........这里部分代码省略.........

                var repository = RepositoryFactory.GetInstance().GetRepository<IMES.FisObject.FA.Product.IProductRepository, IMES.FisObject.FA.Product.IProduct>();
                /*IList<ProductLog> logList = repository.GetProductLogs(currentProduct.ProId,station);
                
                if (logList.Count==0)
                {
                    FisException ex;
                    List<string> erpara = new List<string>();
                    erpara.Add(plt);                  
                    ex = new FisException("CHK860", erpara);//此Product没有打印过,无需重印
                    throw ex;
                } */
                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, currentSessionType);

                if (currentSession == null)
                {
                    currentSession = new Session(sessionKey, currentSessionType, editor, station, line, customer);

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

                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("044PalletWeightReprint.xoml", "", wfArguments);
                    currentSession.AddValue(Session.SessionKeys.Pallet, CurrentPallet);

                    currentSession.AddValue(Session.SessionKeys.PrintLogBegNo, currentProduct.ProId);
                    currentSession.AddValue(Session.SessionKeys.PrintLogEndNo, currentProduct.ProId);
                    currentSession.AddValue(Session.SessionKeys.PrintLogName, currentProduct.ProId);
                    currentSession.AddValue(Session.SessionKeys.PrintLogDescr, "PalletWeight");
                    currentSession.AddValue(Session.SessionKeys.Reason, reason);
                    currentSession.AddValue(Session.SessionKeys.PrintItems, printItems);
                    currentSession.SetInstance(instance);


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

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

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

                    throw currentSession.Exception;
                }

                IList<PrintItem> printList = (IList<PrintItem>)currentSession.GetValue(Session.SessionKeys.PrintItems);

                retList.Add(printList);
                retList.Add(CurrentPallet.PalletNo);
                retList.Add(CurrentPallet.Weight);

                return retList;

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg);
                throw e;
            }
            catch (Exception e)
            {
                logger.Error(e.Message);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(PalletWeight)ReprintLabel End,"
                                + " [custSN]:" + custSN
                                + " [line]:" + line
                                + " [editor]:" + editor
                                + " [station]:" + station
                                + " [customer]:" + customer);
            }
        }
开发者ID:wra222,项目名称:testgit,代码行数:101,代码来源:044PalletWeight.cs

示例6: PrintTCWithProductIDForBN

        /// <summary>
        /// 
        /// </summary>
        /// <param name="pdLine"></param>
        /// <param name="mo"></param>
        /// <param name="qty"></param>
        /// <param name="IsNextMonth"></param>
        /// <param name="editor"></param>
        /// <param name="station"></param>
        /// <param name="customer"></param>
        /// <param name="prouctIdList"></param>
        /// <param name="printItems"></param>
        /// <param name="battery"></param>
        /// <param name="lcm"></param>
        /// <param name="deliveryDate"></param>
        /// <param name="bomremark"></param>
        /// <param name="remark"></param>
        /// <param name="exception"></param>
        /// <returns></returns>
        public IList<PrintItem> PrintTCWithProductIDForBN(string pdLine, string model, string mo,
                                          int qty, bool IsNextMonth, string editor,
                                          string station, string customer,
                                          out IList<string> prouctIdList, IList<PrintItem> printItems,
                                          out string battery, out string lcm,
                                          string deliveryDate, string bomremark, string remark, string exception)
        {
            logger.Debug(" PrintTCWithProductID start, mo:" + mo + " ,pdLine:" + pdLine + " ,qty:" + qty.ToString());
            string currentSessionKey = mo;           
            try
            {
                Session currentCommonSession = SessionManager.GetInstance.GetSession(currentSessionKey, Session.SessionType.Common);

                if (currentCommonSession == null)
                {
                    currentCommonSession = new Session(currentSessionKey, Session.SessionType.Common, editor, station, pdLine, customer);
                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", currentSessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentCommonSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", pdLine);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", Session.SessionType.Common);
                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(station, "TravelCardPrint_excel.xoml", "", out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);

                    currentCommonSession.AddValue(Session.SessionKeys.MONO, mo);
                    currentCommonSession.AddValue(Session.SessionKeys.Qty, qty);
                    currentCommonSession.AddValue(Session.SessionKeys.IsNextMonth, IsNextMonth);
                    currentCommonSession.AddValue(Session.SessionKeys.PrintItems, printItems);
                    currentCommonSession.AddValue(ExtendSession.SessionKeys.DeliveryDate, deliveryDate);
                    currentCommonSession.AddValue(Session.SessionKeys.ModelName, model);

                    currentCommonSession.SetInstance(instance);
                    if (!SessionManager.GetInstance.AddSession(currentCommonSession))
                    {
                        currentCommonSession.WorkflowInstance.Terminate("Session:" + currentSessionKey + " Exists.");
                        FisException ex;
                        List<string> erpara = new List<string>();
                        erpara.Add(currentSessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }
                    currentCommonSession.AddValue("BomRemark", bomremark);
                    currentCommonSession.AddValue("Remark", remark);
                    currentCommonSession.AddValue("Exception", exception);
                    IList<string> valueList = PartRepository.GetValueFromSysSettingByName("Site");
                    if (valueList.Count == 0)
                    {
                        throw new Exception("Error:尚未設定Site...");
                    }
                    else
                    {
                        if (valueList[0] == "ICC")
                        {
                            currentCommonSession.AddValue("CityType", "cq");
                        }
                        else
                        {
                            currentCommonSession.AddValue("CityType", "sh");
                        }
                    }
                   // currentCommonSession.AddValue("CityType", "cq");

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


                if (currentCommonSession.Exception != null)
                {
//.........这里部分代码省略.........
开发者ID:wra222,项目名称:testgit,代码行数:101,代码来源:TravelCardPrint_excel.cs

示例7: InputPizzaCheckSNforSorting

        public ArrayList InputPizzaCheckSNforSorting(string custSN, string line, string curStation,
                                                                 string editor, string station, string customer)
        {
            logger.Debug("(InputPizzaCheckSNforSorting)InputSN start, custSn:" + custSN
                + "Station:" + curStation);

            try
            {
                ArrayList retLst = new ArrayList();

                var currentProduct = CommonImpl.GetProductByInput(custSN, CommonImpl.InputTypeEnum.CustSN);
                if (currentProduct == null)
                {
                    List<string> errpara = new List<string>();

                    errpara.Add(custSN);
                    throw new FisException("SFC002", errpara);
                }
                string sessionKey = currentProduct.ProId;
                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, SessionType);

                //用ProductID启动工作流,将Product放入工作流中
                if (currentSession == null)
                {
                    currentSession = new Session(sessionKey, SessionType, editor, station, line, customer);

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", curStation);
                    wfArguments.Add("CurrentFlowSession", currentSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", currentProduct.Status.Line.Trim());
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", SessionType);
                    currentSession.AddValue(Session.SessionKeys.ReturnStation, station);
                    currentSession.AddValue("ForceNWCPreStation", currentProduct.Status.StationId.Trim());
                    //Session.SessionKeys.ReturnStation
                    //Add by Benson for Mantis 0001633
                    IPartRepository ipartRepository = RepositoryFactory.GetInstance().GetRepository<IPartRepository, IPart>();
                    IList<string> sttingLst = new List<string>();
                    sttingLst = ipartRepository.GetValueFromSysSettingByName("BatteryCtCheck");
                    if (sttingLst.Count > 0 && sttingLst[0].ToString().ToUpper().Trim() == "Y")
                    { currentSession.AddValue("EnableBatteryCtCheck", true); }
                    else
                    { currentSession.AddValue("EnableBatteryCtCheck", false); }
                    IList<string> sttingLst2 = new List<string>(); //OnlyCheckOneBattery
                    sttingLst2 = ipartRepository.GetValueFromSysSettingByName("OnlyCheckOneBattery");
                    if (sttingLst2.Count > 0 && sttingLst2[0].ToString().ToUpper().Trim() == "Y")
                    { currentSession.AddValue("OnlyCheckOneBattery", true); }
                    else
                    { currentSession.AddValue("OnlyCheckOneBattery", false); }

                    //Add by Benson for Mantis 0001633 a


                    string wfName, rlName;

                    RouteManagementUtils.GetWorkflow(station, "PAKReviewSorting.xoml", "PAKReviewSorting.rules", out wfName, out rlName);

                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);

                    currentSession.AddValue(Session.SessionKeys.IsComplete, false);
                    currentSession.SetInstance(instance);

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

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

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

                    throw currentSession.Exception;
                }

                //============================================================================

                //get product data for UI
                Product curProduct = (Product)currentSession.GetValue(Session.SessionKeys.Product);
//.........这里部分代码省略.........
开发者ID:wra222,项目名称:testgit,代码行数:101,代码来源:PizzaKitting.cs

示例8: Save

        public void Save(string partNo, string begNo, string endNo, string station, string editor, string pdline, string customer)
        {
            logger.Debug("CNCardReceive Save:" + partNo + "," + begNo + "," + endNo);
            IList<string> result = new List<string>();
            string currentSessionKey = Guid.NewGuid().ToString();
           
            
            try
            {
                logger.Debug("CNCardReceive save start!");
                if (partNo == "")
                {
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("CHK812", erpara);
                    throw ex;
                }
                if (begNo == "" || endNo == "")
                {
                    List<string> erpara = new List<string>();
                    FisException ex;
                    ex = new FisException("CHK813", erpara);
                    throw ex;
                }
                
                Session currentCommonSession = SessionManager.GetInstance.GetSession(currentSessionKey, Session.SessionType.Common);

                if (currentCommonSession == null)
                {
                    currentCommonSession = new Session(currentSessionKey, Session.SessionType.Common, editor, station, pdline, customer);

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", currentSessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentCommonSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", pdline);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", Session.SessionType.Common);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("CNCardReceive.xoml", "", wfArguments);

                    currentCommonSession.SetInstance(instance);

                    currentCommonSession.AddValue(Session.SessionKeys.PartNo, partNo);
                    currentCommonSession.AddValue("BegNo", begNo);
                    currentCommonSession.AddValue("EndNo", endNo);
                    currentCommonSession.AddValue(Session.SessionKeys.PrintLogName, "CNCard");
                    currentCommonSession.AddValue(Session.SessionKeys.PrintLogBegNo, begNo);
                    currentCommonSession.AddValue(Session.SessionKeys.PrintLogEndNo, endNo);
                    //ITC-1360-139
                    currentCommonSession.AddValue(Session.SessionKeys.PrintLogDescr, partNo);

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

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


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

                    throw currentCommonSession.Exception;
                }                
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("CNCardReceive save end!");
            }
        }
开发者ID:wra222,项目名称:testgit,代码行数:98,代码来源:CNCardReceive.cs

示例9: InputMBSn

        public void InputMBSn(string pdLine,
            string dCode,
            string MB_SNo,
            string editor, string stationId, string customerId,string no1397)
        {
            logger.Debug("(PCAShippingLabel)InputMBSn start, pdLine:" + pdLine + " dCode:" + dCode + " MB_SNo:" + MB_SNo + " editor:" + editor + " stationId:" + stationId + " customerId:" + customerId);

            FisException ex;
            List<string> erpara = new List<string>();
            string sessionKey = MB_SNo;
            try
            {
                Session Session = SessionManager.GetInstance.GetSession(sessionKey, TheType);

                if (Session == null)
                {
                    Session = new Session(sessionKey, TheType, editor, stationId, pdLine, customerId);

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    //一个MB_SNo对应一个workflow
                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", stationId);
                    wfArguments.Add("CurrentFlowSession", Session);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", pdLine);
                    wfArguments.Add("Customer", customerId);
                    wfArguments.Add("SessionType", TheType);
                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(stationId, "011PCAShippingLabel.xoml", "011PCAShippingLabel.rules", out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);

                    Session.AddValue(Session.SessionKeys.IsComplete, false);
                    Session.AddValue(Session.SessionKeys._1397No, no1397);

                    Session.SetInstance(instance);


                    if (!SessionManager.GetInstance.AddSession(Session))
                    {
                        Session.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }

                    Session.WorkflowInstance.Start();
                    Session.SetHostWaitOne();

                }
                else
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK020", erpara);
                    throw ex;
                }

                //Session.SwitchToWorkFlow();

                //check workflow exception
                if (Session.Exception != null)
                {
                    if (Session.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        Session.ResumeWorkFlow();
                    }
                    throw Session.Exception;
                }

            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(PCAShippingLabel)InputMBSn end, pdLine:" + pdLine + " dCode:" + dCode + " MB_SNo:" + MB_SNo + " editor:" + editor + " stationId:" + stationId + " customerId:" + customerId);
            }
        }
开发者ID:wra222,项目名称:testgit,代码行数:82,代码来源:011PCAShippingLabel.cs

示例10: Reprint

        public IList<PrintItem> Reprint(
            string pdLine,
            string dCode,
            string MB_SNo,
            string editor, string stationId, string customerId, IList<PrintItem> printItems, string reason, out string wcode)
        {
            logger.Debug("(PCAShippingLabel)Reprint start, pdLine:" + pdLine + " dCode:" + dCode + " MB_SNo:" + MB_SNo + " editor:" + editor + " stationId:" + stationId + " customerId:" + customerId);

            FisException ex;
            List<string> erpara = new List<string>();
            string sessionKey = MB_SNo;
            IList<PrintItem> printList;
            try
            {
                Session Session = SessionManager.GetInstance.GetSession(sessionKey, TheType);

                if (Session == null)
                {
                    Session = new Session(sessionKey, TheType, editor, stationId, pdLine, customerId);

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    //一个MB_SNo对应一个workflow
                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", stationId);
                    wfArguments.Add("CurrentFlowSession", Session);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", pdLine);
                    wfArguments.Add("Customer", customerId);
                    wfArguments.Add("SessionType", TheType);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("011ReprintPCAShippingLabel.xoml", null, wfArguments);
                    Session.AddValue(Session.SessionKeys.PrintLogBegNo, MB_SNo);
                    Session.AddValue(Session.SessionKeys.PrintLogEndNo, MB_SNo);
                    Session.AddValue(Session.SessionKeys.PrintLogDescr, "");
                    Session.AddValue(Session.SessionKeys.PrintItems, printItems);
                    Session.AddValue(Session.SessionKeys.Reason, reason);
                    Session.AddValue(Session.SessionKeys.SelectedWarrantyRuleID, int.Parse(dCode));

                    Session.SetInstance(instance);

                    if (!SessionManager.GetInstance.AddSession(Session))
                    {
                        Session.WorkflowInstance.Terminate("Session:" + sessionKey + " Exists.");
                        erpara.Add(sessionKey);
                        ex = new FisException("CHK020", erpara);
                        throw ex;
                    }
                    Session.WorkflowInstance.Start();
                    Session.SetHostWaitOne();
                }
                else
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK020", erpara);
                    throw ex;
                }

                //check workflow exception
                if (Session.Exception != null)
                {
                    if (Session.GetValue(Session.SessionKeys.WFTerminated) != null)
                    {
                        Session.ResumeWorkFlow();
                    }
                    throw Session.Exception;
                }
                //Warranty wrty = RepositoryFactory.GetInstance().GetRepository<IWarrantyRepository, Warranty>().Find(int.Parse(dCode));
                //wcode = wrty.WarrantyCode;
                wcode = (string)Session.GetValue(Session.SessionKeys.DCode);
                return (IList<PrintItem>)Session.GetValue(Session.SessionKeys.PrintItems);

            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(PCAShippingLabel)Reprint end, pdLine:" + pdLine + " dCode:" + dCode + " MB_SNo:" + MB_SNo + " editor:" + editor + " stationId:" + stationId + " customerId:" + customerId);
            }
        }
开发者ID:wra222,项目名称:testgit,代码行数:84,代码来源:011PCAShippingLabel.cs

示例11: UnpackCartonForFRU

        ///<summary>
        /// 解除绑定
        /// 使用工作流UnpackCartonForFRU.xoml
        /// </summary>
        public void UnpackCartonForFRU(string cartonNo, string line, string editor, string station, string customer)
        {
            logger.Debug("(UnpackCartonForFRU)Unpack start, cartonNo:" + cartonNo + "line:" + line + "editor:" + editor + "station:" + station + "customer:" + customer);
            //tet
         
            //tet
            FisException ex;
            List<string> erpara = new List<string>();
            carton.ICartonSSCCRepository cartRep = RepositoryFactory.GetInstance().GetRepository<carton.ICartonSSCCRepository, IMES.FisObject.PAK.CartonSSCC.CartonSSCC>();


            try
            {

                string sessionKey = cartonNo;
                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, ProductSessionType);

                if (currentSession == null)
                {
                    currentSession = new Session(sessionKey, ProductSessionType, editor, station, line, customer);


                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", line);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", ProductSessionType);
                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(station, "UnpackCartonForFRU.xoml", "UnpackCartonForFRU.rules", out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);

                    if (sessionKey.Length == 9)
                    { currentSession.AddValue(Session.SessionKeys.CartonSN, sessionKey); }
                    else
                    { currentSession.AddValue(Session.SessionKeys.DeliveryNo, sessionKey); }

                    currentSession.SetInstance(instance);

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

                    currentSession.WorkflowInstance.Start();
                    currentSession.SetHostWaitOne();
                }
                else
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK020", erpara);
                    throw ex;
                }


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

                    throw currentSession.Exception;
                }

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(UnpackCarton)Unpack end,  cartonNo:" + cartonNo + "line:" + line + "editor:" + editor + "station:" + station + "customer:" + customer);
            }
        }
开发者ID:wra222,项目名称:testgit,代码行数:90,代码来源:UnpackImplForRCTO.cs

示例12: UnpackDummyPalletNo

        ///<summary>
        /// 根据指定的DummyPalletNo解除绑定
        /// 使用工作流UnpackDummyPalletNo.xoml
        /// </summary>
        public void UnpackDummyPalletNo(string DummyPalletNo, string line, string editor, string customer)
        {
            logger.Debug("(UnpackDummyPalletNo)Unpack DummyPalletNo start, DummyPalletNo:" + DummyPalletNo + "line:" + line + "editor:" + editor +  "customer:" + customer);

            FisException ex;
            List<string> erpara = new List<string>();

            try
            {
                IPalletRepository iPalletRepository = RepositoryFactory.GetInstance().GetRepository<IPalletRepository, Pallet>();

                Pallet CurrentPallet = iPalletRepository.Find(DummyPalletNo);
                if (CurrentPallet == null)
                {
                    erpara.Add(DummyPalletNo);
                    ex = new FisException("PAK049", erpara);    //此Dummy Pallet No 不存在!
                    throw ex;
                }
                PalletLogInfo condition = new PalletLogInfo();
                condition.palletNo = DummyPalletNo;
                condition.station = "9A";
               // condition = "Pass Pallet Verify_RCTO";
               
                IList<PalletLogInfo> lstPalletLog =  iPalletRepository.GetPalletLogInfoList( condition);

                if (lstPalletLog == null || lstPalletLog.Count <=0)
                {
                    erpara.Add(DummyPalletNo);
                    ex = new FisException("PAK119", erpara);    //此Dummy Pallet No %1  状态错误,不能解绑!
                    throw ex;
                }

                string sessionKey = DummyPalletNo;
                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, currentSessionType);

                if (currentSession == null)
                {
                    string station = "UD"; //UC 更新:本站站号:UD;
                    currentSession = new Session(sessionKey, currentSessionType, editor, station, line, customer);                  

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", line);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", currentSessionType);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("UnpackPalletNoForRCTO.xoml", "", wfArguments);

                    currentSession.AddValue(Session.SessionKeys.DummyPalletNo,DummyPalletNo);
                    currentSession.AddValue(Session.SessionKeys.Pallet, CurrentPallet);
                    currentSession.SetInstance(instance);

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

                    currentSession.WorkflowInstance.Start();
                    currentSession.SetHostWaitOne();
                }
                else
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK020", erpara);
                    throw ex;
                }


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

                    throw currentSession.Exception;
                }

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
//.........这里部分代码省略.........
开发者ID:wra222,项目名称:testgit,代码行数:101,代码来源:UnpackImplForRCTO.cs

示例13: UnpackAllBySNCheck

        ///<summary>
        /// 根据指定的sn or dn解除绑定
        /// 使用工作流070UnpackDNByall.xoml
        /// </summary>
        public void UnpackAllBySNCheck(string prodSn, string pdline, string editor, string station, string customer)
        {
            logger.Debug("(UnpackAllBySN)Unpack start, prodid:" + prodSn + "line:" + pdline + "editor:" + editor + "station:" + station + "customer:" + customer);

            string currentSessionKey = prodSn;
            try
            {
                station = "SP";
                Session currentCommonSession = SessionManager.GetInstance.GetSession(currentSessionKey, ProductSessionType);
                if (currentCommonSession == null)
                {
                    currentCommonSession = new Session(currentSessionKey, ProductSessionType, editor, station, pdline, customer);

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", currentSessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentCommonSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", pdline);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", Session.SessionType.Product);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("070UnpackAllBySN.xoml", "070unpackallbysn.rules", wfArguments);

                    currentCommonSession.AddValue(Session.SessionKeys.CN, "ALL");
                    currentCommonSession.AddValue(Session.SessionKeys.Pallet, false);
                    currentCommonSession.AddValue(Session.SessionKeys.IsComplete, false);
                    currentCommonSession.SetInstance(instance);

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

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


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

                    throw currentCommonSession.Exception;
                }

                return;
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(UnpackAllBySN)Unpack end,  prodid:" + prodSn + "line:" + pdline + "editor:" + editor + "station:" + station + "customer:" + customer);
            }

        }
开发者ID:wra222,项目名称:testgit,代码行数:81,代码来源:UnpackImplForRCTO.cs

示例14: UnpackCarton

        ///<summary>
        /// 解除绑定
        /// 使用工作流070UnpackCarton.xoml
        /// </summary>
        public void UnpackCarton(string cartonNo, string line, string editor, string station, string customer)
        {
            logger.Debug("(UnpackCarton)Unpack start, cartonNo:" + cartonNo + "line:" + line + "editor:" + editor + "station:" + station + "customer:" + customer);

            FisException ex;
            List<string> erpara = new List<string>();
            carton.ICartonSSCCRepository cartRep = RepositoryFactory.GetInstance().GetRepository<carton.ICartonSSCCRepository, IMES.FisObject.PAK.CartonSSCC.CartonSSCC>();

         
            try
            {
                CartonStatusInfo condition = new CartonStatusInfo();
                condition.cartonNo = cartonNo;
                IList<CartonStatusInfo> CartonStatus = cartRep.GetCartonStatusInfo(condition);
                if (CartonStatus.Count == 0)
                {
                    //erpara.Add("Invalid Carton No!");
                    erpara.Add(cartonNo);
                    ex = new FisException("PAC001", erpara);
                    throw ex;
                }

                var currentProduct = CommonImpl.GetProductByInput(cartonNo, CommonImpl.InputTypeEnum.Carton);
                if (currentProduct == null)
                {
                    FisException fe = new FisException("CHK079", new string[] { cartonNo });
                    throw fe;
                }         

                string sessionKey = currentProduct.ProId;
                Session currentSession = SessionManager.GetInstance.GetSession(sessionKey, ProductSessionType);

                if (currentSession == null)
                {
                    currentSession = new Session(sessionKey, ProductSessionType, editor, station, line, customer);


                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", sessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", line);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", ProductSessionType);
                    string wfName, rlName;
                    RouteManagementUtils.GetWorkflow(station, "UnpackCartonForRCTO.xoml", "UnpackCartonForRCTO.rules", out wfName, out rlName);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow(wfName, rlName, wfArguments);

                   
                    currentSession.AddValue(Session.SessionKeys.Carton, cartonNo);
                    currentSession.AddValue(Session.SessionKeys.CustSN, currentProduct.CUSTSN);
                    currentSession.SetInstance(instance);

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

                    currentSession.WorkflowInstance.Start();
                    currentSession.SetHostWaitOne();
                }
                else
                {
                    erpara.Add(sessionKey);
                    ex = new FisException("CHK020", erpara);
                    throw ex;
                }


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

                    throw currentSession.Exception;
                }

            }
            catch (FisException e)
            {
                logger.Error(e.mErrmsg, e);
                throw new Exception(e.mErrmsg);
            }
            catch (Exception e)
            {
                logger.Error(e.Message, e);
                throw new SystemException(e.Message);
            }
            finally
            {
//.........这里部分代码省略.........
开发者ID:wra222,项目名称:testgit,代码行数:101,代码来源:UnpackImplForRCTO.cs

示例15: UnpackDNbySNCheck

        ///<summary>
        /// 根据指定的Custom Sn解除绑定
        /// 使用工作流070UnpackDNBySN.xoml
        /// </summary>
        public void UnpackDNbySNCheck(string prodSn, string pdline, string editor, string station, string customer)
        {
            logger.Debug("(UnpackDNbySNCheck)UnpackDNbySNCheck start, prodSn:" + prodSn + "line:" + pdline + "editor:" + editor + "station:" + station + "customer:" + customer);

            string currentSessionKey = prodSn;
            try
            {
                if (station == "91")
                {
                    station = "9U";
                }
                else
                {
                    station = "9P";
                }
                //Session currentCommonSession = SessionManager.GetInstance.GetSession(currentSessionKey, ProductSessionType);
                Session currentCommonSession = SessionManager.GetInstance.GetSession(currentSessionKey, ProductSessionType);


                if (currentCommonSession == null)
                {
                    //currentCommonSession = new Session(currentSessionKey, Session.SessionType.Common, editor, station, pdline, customer);
                    currentCommonSession = new Session(currentSessionKey, ProductSessionType, editor, station, pdline, customer);

                    Dictionary<string, object> wfArguments = new Dictionary<string, object>();
                    wfArguments.Add("Key", currentSessionKey);
                    wfArguments.Add("Station", station);
                    wfArguments.Add("CurrentFlowSession", currentCommonSession);
                    wfArguments.Add("Editor", editor);
                    wfArguments.Add("PdLine", pdline);
                    wfArguments.Add("Customer", customer);
                    wfArguments.Add("SessionType", Session.SessionType.Product);
                    WorkflowInstance instance = WorkflowRuntimeManager.getInstance.CreateXomlFisWorkflow("070UnpackDNBySN.xoml", "", wfArguments);

                    currentCommonSession.AddValue(Session.SessionKeys.CN, "DN");
                    currentCommonSession.AddValue(Session.SessionKeys.IsComplete, false);
                    currentCommonSession.SetInstance(instance);

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

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

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

                    throw currentCommonSession.Exception;
                }
            /*    
                Product newProduct = (Product)currentCommonSession.GetValue(Session.SessionKeys.Product);
                if (newProduct.PalletNo == null)
                {
                    FisException ex;
                    List<string> erpara = new List<string>();
                    erpara.Add("此机器尚未结合栈板,不能进行Unpack!");
                    ex = new FisException("CHK292", erpara);
                    throw ex;
                }
                currentCommonSession.AddValue(Session.SessionKeys.DeliveryNo, newProduct.DeliveryNo);
                */
               

                return ;
            }
            catch (FisException e)
            {
                throw e;
            }
            catch (Exception e)
            {
                throw new SystemException(e.Message);
            }
            finally
            {
                logger.Debug("(UnpackDNbySN)UnpackDNbySNCheck end,  cartonNo:" + prodSn + "line:" + pdline + "editor:" + editor + "station:" + station + "customer:" + customer);
//.........这里部分代码省略.........
开发者ID:wra222,项目名称:testgit,代码行数:101,代码来源:UnpackImplForRCTO.cs


注:本文中的Session.SetInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。