Exemple #1
0
        public string ZzSubmit_Bcsignal(string json1)
        {
            try
            {
                JObject item = (JObject)JsonConvert.DeserializeObject(json1);

                CTimerTimeout timeout_job = new CTimerTimeout();
                timeout_job.CreateTime   = DateTime.Now;
                timeout_job.for_using    = TIMER_USING.FOR_SYSTEM;
                timeout_job.mission_name = "";
                timeout_job.status       = TM_STATUS.TM_STATUS_ACTIVE;
                timeout_job.SetActionForWF("INVILID");
                timeout_job.AttachWFEntityID = Convert.ToInt32(item["wfe_id"]);
                timeout_job.CustomAction     = "http://localhost/CallBack/testCallBack";
                timeout_job.EventName        = "PqAessess";
                timeout_job.SetTriggerTiming("0 0 0 20 * ?");
                //保存该定时任务,并将其添加到激活任务列表
                timeout_job.Save();
                int m_timerMissionID = timeout_job.ID;
                CTimerManage.AppendMissionToActiveList(timeout_job);


                //  A5dot1Tab1 a5dot1Tab1 = new A5dot1Tab1();
                DateTime my     = DateTime.Now;
                int      cjid   = Em.getEA_parentid(Convert.ToInt32(item["Zz_Id"]));
                string   cjname = Eam.getEa_namebyId(cjid);

                A5dot2Tab1 new_5dot2 = new A5dot2Tab1();
                new_5dot2.cjName             = cjname;
                new_5dot2.zzName             = item["Zz_Name"].ToString();
                new_5dot2.sbGyCode           = item["Equip_GyCode"].ToString();
                new_5dot2.sbCode             = item["Equip_Code"].ToString();
                new_5dot2.sbType             = item["Equip_Type"].ToString();
                new_5dot2.zyType             = item["Zy_Type"].ToString();
                new_5dot2.problemDescription = item["problemDescription"].ToString();
                new_5dot2.jxSubmitTime       = DateTime.Now;
                new_5dot2.jxUserName         = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                new_5dot2.isRectified        = 0;
                new_5dot2.state = 0;
                new_5dot2.temp2 = item["wfe_id"].ToString();
                new_5dot2.temp3 = m_timerMissionID.ToString();
                bool res = Sx.AddSxItem(new_5dot2);

                string wfe_id = item["wfe_id"].ToString();
                //paras
                Dictionary <string, string> signal = new Dictionary <string, string>();
                signal["ZzSubmit_done"] = "true";

                //record
                Dictionary <string, string> record = new Dictionary <string, string>();
                record["username"] = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                record["time"]     = DateTime.Now.ToString();
                //submit
                CWFEngine.SubmitSignal(Convert.ToInt32(wfe_id), signal, record);
            }
            catch (Exception e)
            {
                return("");
            }
            return("/A5dot2/Index");
        }
Exemple #2
0
        public string ZzSubmit_Bcsignal(string json1)
        {
            try
            {
                JObject item = (JObject)JsonConvert.DeserializeObject(json1);



                CTimerTimeout timeout_job = new CTimerTimeout();
                timeout_job.CreateTime   = DateTime.Now;
                timeout_job.for_using    = TIMER_USING.FOR_SYSTEM;
                timeout_job.mission_name = "";
                timeout_job.status       = TM_STATUS.TM_STATUS_ACTIVE;
                timeout_job.SetActionForWF("INVILID");
                timeout_job.AttachWFEntityID = Convert.ToInt32(item["wfe_id"]);
                timeout_job.CustomAction     = "http://localhost/CallBack/testCallBack";
                timeout_job.EventName        = "PqAessess";
                timeout_job.SetTriggerTiming("0 0 0 20 * ?");
                //保存该定时任务,并将其添加到激活任务列表
                timeout_job.Save();
                int m_timerMissionID = timeout_job.ID;
                CTimerManage.AppendMissionToActiveList(timeout_job);


                string[]   notgood    = item["Incomplete_content"].ToString().Split('|');
                A5dot1Tab1 a5dot1Tab1 = new A5dot1Tab1();
                DateTime   my         = DateTime.Now;
                string     yearmonth  = "";
                int        cjid       = Em.getEA_parentid(Convert.ToInt32(item["Zz_Id"]));
                string     cjname     = Eam.getEa_namebyId(cjid);
                string     Username   = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                if (my.Day >= 15)
                {
                    yearmonth = my.Year.ToString() + my.AddMonths(1).Month.ToString();
                }
                else
                {
                    yearmonth = my.Year.ToString() + my.Month.ToString();
                }

                if (notgood[notgood.Count() - 1] == "")
                {
                    for (int i = 0; i < notgood.Count() - 1; i++)
                    {
                        a5dot1Tab1.cjName                = cjname;
                        a5dot1Tab1.zzName                = item["Zz_Name"].ToString();
                        a5dot1Tab1.sbGyCode              = item["Equip_GyCode"].ToString();
                        a5dot1Tab1.sbCode                = item["Equip_Code"].ToString();
                        a5dot1Tab1.sbType                = item["Equip_Type"].ToString();
                        a5dot1Tab1.zyType                = item["Zy_Type"].ToString();
                        a5dot1Tab1.notGoodContent        = notgood[i];
                        a5dot1Tab1.isRectified           = 0;
                        a5dot1Tab1.zzSubmitTime          = DateTime.Now;
                        a5dot1Tab1.zzUserName            = Username;
                        a5dot1Tab1.yearMonthForStatistic = yearmonth;
                        a5dot1Tab1.temp3 = m_timerMissionID.ToString();
                        if (item["wfe_id"].ToString() != "")
                        {
                            a5dot1Tab1.dataSource = item["wfe_id"].ToString();
                        }
                        if (a5dot1Tab1.cjName == "消防队" || a5dot1Tab1.cjName == "计量站")
                        {
                            a5dot1Tab1.pqName = a5dot1Tab1.cjName;
                        }
                        else
                        {
                            a5dot1Tab1.pqName = pm.Get_PqnamebyCjname(a5dot1Tab1.cjName.ToString());
                        }
                        tm.Zzsubmit(a5dot1Tab1);
                    }
                }
                else
                {
                    for (int i = 0; i < notgood.Count(); i++)
                    {
                        a5dot1Tab1.cjName                = cjname;
                        a5dot1Tab1.zzName                = item["Zz_Name"].ToString();
                        a5dot1Tab1.sbGyCode              = item["Equip_GyCode"].ToString();
                        a5dot1Tab1.sbCode                = item["Equip_Code"].ToString();
                        a5dot1Tab1.sbType                = item["Equip_Type"].ToString();
                        a5dot1Tab1.zyType                = item["Zy_Type"].ToString();
                        a5dot1Tab1.notGoodContent        = notgood[i];
                        a5dot1Tab1.isRectified           = 0;
                        a5dot1Tab1.zzSubmitTime          = DateTime.Now;
                        a5dot1Tab1.zzUserName            = Username;
                        a5dot1Tab1.yearMonthForStatistic = yearmonth;
                        a5dot1Tab1.temp3 = m_timerMissionID.ToString();
                        if (item["wfe_id"].ToString() != "")
                        {
                            a5dot1Tab1.dataSource = item["wfe_id"].ToString();
                        }
                        if (a5dot1Tab1.cjName == "消防队" || a5dot1Tab1.cjName == "计量站")
                        {
                            a5dot1Tab1.pqName = a5dot1Tab1.cjName;
                        }
                        else
                        {
                            a5dot1Tab1.pqName = pm.Get_PqnamebyCjname(a5dot1Tab1.cjName.ToString());
                        }
                        tm.Zzsubmit(a5dot1Tab1);
                    }
                }
                string wfe_id = item["wfe_id"].ToString();
                //paras
                Dictionary <string, string> signal = new Dictionary <string, string>();
                signal["ZzSubmit_done"] = "true";

                //record
                Dictionary <string, string> record = new Dictionary <string, string>();
                record["username"] = (Session["User"] as EquipModel.Entities.Person_Info).Person_Name;
                record["time"]     = DateTime.Now.ToString();
                //submit
                CWFEngine.SubmitSignal(Convert.ToInt32(wfe_id), signal, record);
            }
            catch (Exception e)
            {
                return("");
            }
            return("/A5dot1/Index");
        }
Exemple #3
0
        /// <summary>
        /// 注册到Timer管理器
        /// </summary>
        /// <param name="bCreateWF">是否为创建工作流时刻</param>
        public void RegTimeoutTimer(bool bCreateWF)
        {
            //如果含义无效,直接返回
            if (!IsEnable())
            {
                return;
            }

            CTimerTimeout timeout_job = new CTimerTimeout();

            timeout_job.CreateTime   = DateTime.Now;
            timeout_job.for_using    = TIMER_USING.FOR_SYSTEM;
            timeout_job.mission_name = string.Format("{0}:{1}", Parent.Parent.name, Parent.name);
            timeout_job.status       = TM_STATUS.TM_STATUS_ACTIVE;
            timeout_job.SetActionForWF(m_action);
            timeout_job.AttachWFEntityID = Parent.Parent.EntityID;
            timeout_job.CustomAction     = CallbackUrl;
            timeout_job.EventName        = Parent.name;


            string strCorn = "";

            //如果该函数是调用于工作流创建时刻,但是偏移时间的起始不是TIME_START.TIME_WF_CREATE 则注册失败, 直接返回
            if (bCreateWF)
            {
                if ((m_ExactTime == null) && (m_startTime != TIME_START.TIME_WF_CREATE))
                {
                    return;
                }
            }
            else //如果该函数是调用于进入Event时刻,但是偏移时间的起始不是TIME_START.TIME_WF_CREATE 则注册失败, 直接返回
            {
                if (m_ExactTime != null || m_startTime != TIME_START.TIME_EVENT_ENTER)
                {
                    return;
                }
            }

            if (m_ExactTime != null)
            {
                strCorn = string.Format("{0} {1} {2} {3} {4} {5} {6}",
                                        m_ExactTime.Value.Second,
                                        m_ExactTime.Value.Minute,
                                        m_ExactTime.Value.Hour,
                                        m_ExactTime.Value.Day,
                                        m_ExactTime.Value.Month,
                                        "?",
                                        m_ExactTime.Value.Year);
                timeout_job.SetTriggerTiming(strCorn);
            }
            else
            {
                DateTime run_time = DateTime.Now + m_timeOffset.Value;
                strCorn = string.Format("{0} {1} {2} {3} {4} {5} {6}",
                                        run_time.Second,
                                        run_time.Minute,
                                        run_time.Hour,
                                        run_time.Day,
                                        run_time.Month,
                                        "?",
                                        run_time.Year);
                timeout_job.SetTriggerTiming(strCorn);
            }

            //保存该定时任务,并将其添加到激活任务列表
            timeout_job.Save();
            m_timerMissionID = timeout_job.ID;
            CTimerManage.AppendMissionToActiveList(timeout_job);
        }