Ejemplo n.º 1
0
        /// <summary>
        /// 添加事件
        /// </summary>
        /// <param name="rsEvent"></param>
        private void AddRunEvent(RsRunEvent rsEvent)
        {
            string sql = @"insert into TAB_Plan_RunEvent (strRunEventGUID,strTrainPlanGUID, 
         nEventID,dtEventTime,strTrainNo,strTrainTypeName,strTrainNumber,nTMIS, 
         nKeHuo,strGroupGUID,strTrainmanNumber1,strTrainmanNumber2,dtCreateTime,nResult,strResult) 
         values (@strRunEventGUID,@strTrainPlanGUID,@nEventID,@dtEventTime,@strTrainNo, 
         @strTrainTypeName,@strTrainNumber,@nTMIS,@nKeHuo,@strGroupGUID,@strTrainmanNumber1,
         @strTrainmanNumber2,getdate(),@nResult,@strResult)";

            SqlParameter[] sqlParams =
            {
                new SqlParameter("@strRunEventGUID",    rsEvent.strRunEventGUID),
                new SqlParameter("@strTrainPlanGUID",   rsEvent.strTrainPlanGUID),
                new SqlParameter("@nEventID",           rsEvent.nEventID),
                new SqlParameter("@dtEventTime",        rsEvent.dtEventTime),
                new SqlParameter("@strTrainNo",         rsEvent.strTrainNo),
                new SqlParameter("@strTrainTypeName",   rsEvent.strTrainTypeName),
                new SqlParameter("@strTrainNumber",     rsEvent.strTrainNumber),
                new SqlParameter("@nTMIS",              rsEvent.nTMIS),
                new SqlParameter("@nKeHuo",             rsEvent.nKehuo),
                new SqlParameter("@strGroupGUID",       rsEvent.strGroupGUID),
                new SqlParameter("@strTrainmanNumber1", rsEvent.strTrainmanNumber1),
                new SqlParameter("@strTrainmanNumber2", rsEvent.strTrainmanNumber2),
                new SqlParameter("@nResult",            rsEvent.nEventID),
                new SqlParameter("@strResult",          rsEvent.strResult)
            };

            SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, sql, sqlParams);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///获取指定计划的指定事件类型的最后一个事件
        /// </summary>
        /// <param name="planGUID"></param>
        /// <param name="EventID"></param>
        /// <param name="rsEvent"></param>
        /// <returns></returns>
        private Boolean GetRunEventOfPlan(string planGUID, int EventID, RsRunEvent rsEvent)
        {
            string sql = "select top 1 * from TAB_Plan_RunEvent where strTrainPlanGUID = @planGUID and nEventID = @eventID order by dtEventTime desc  ";

            SqlParameter[] sqlParams =
            {
                new SqlParameter("@planGUID", planGUID),
                new SqlParameter("@eventID",  EventID)
            };

            DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, sql, sqlParams).Tables[0];

            if (dt.Rows.Count == 0)
            {
                return(false);
            }
            else
            {
                DataRow dr = dt.Rows[0];

                rsEvent.strRunEventGUID    = dr["strRunEventGUID"].ToString();
                rsEvent.strTrainPlanGUID   = dr["strTrainPlanGUID"].ToString();
                rsEvent.nEventID           = Convert.ToInt32(dr["nEventID"]);
                rsEvent.dtEventTime        = Convert.ToDateTime(dr["dtEventTime"]);
                rsEvent.strTrainNo         = dr["strTrainNo"].ToString();
                rsEvent.strTrainTypeName   = dr["strTrainTypeName"].ToString();
                rsEvent.strTrainNumber     = dr["strTrainNumber"].ToString();
                rsEvent.nTMIS              = Convert.ToInt32(dr["nTMIS"]);
                rsEvent.strGroupGUID       = dr["strGroupGUID"].ToString();
                rsEvent.strTrainmanNumber1 = dr["strTrainmanNumber1"].ToString();
                rsEvent.strTrainmanNumber2 = dr["strTrainmanNumber2"].ToString();
                rsEvent.dtCreateTime       = Convert.ToDateTime(dr["dtCreateTime"]);
                rsEvent.nResultID          = Convert.ToInt32(dr["nResult"]);
                rsEvent.strResult          = dr["strResult"].ToString();
                return(true);
            }
        }
Ejemplo n.º 3
0
        private Boolean SubmitTrainmanEvent(SubmitInOutRoom Rec, int EventID, TrainmanPlan plan, int tmindex,
                                            ref string ErrInfo, ref int ErrCode, ref string eventGUID)
        {
            ErrCode = 0;
            ErrInfo = "";

            RsRunEvent rsEvent = new RsRunEvent();

            if (Rec.tmid == string.Empty)
            {
                ErrCode = 1;
                return(false);
            }

            if (Rec.etime > plan.trainPlan.lastArriveTime)
            {
                ErrCode = 3;
                ErrInfo = "超时被丢弃";
                return(false);
            }

            string tmid1;
            string tmid2;

            //如果已经存在对应计划的事件,则更新事件人员
            if (GetRunEventOfPlan(plan.trainPlan.planID, eteOutRoom, rsEvent))
            {
                tmid1 = rsEvent.strTrainmanNumber1;

                tmid2 = rsEvent.strTrainmanNumber2;

                eventGUID = rsEvent.strRunEventGUID;

                DateTime tempTime = rsEvent.dtEventTime;

                if (Rec.etime > tempTime)
                {
                    tempTime = Rec.etime;
                }

                if (tmindex == 1)
                {
                    tmid1 = Rec.tmid;
                }
                if (tmindex == 2)
                {
                    tmid2 = Rec.tmid;
                }


                UpdateEventTrainman(rsEvent.strRunEventGUID, tmid1, tmid2, tempTime, Rec.strResult.ResultToString());
                return(true);
            }
            else
            {
                tmid1 = "";
                tmid2 = "";

                if (tmindex == 1)
                {
                    tmid1 = Rec.tmid;
                }
                if (tmindex == 2)
                {
                    tmid2 = Rec.tmid;
                }


                rsEvent.strRunEventGUID    = eventGUID;
                rsEvent.nEventID           = EventID;
                rsEvent.strTrainPlanGUID   = plan.trainPlan.planID;
                rsEvent.dtEventTime        = Rec.etime;
                rsEvent.nTMIS              = Convert.ToInt32(Rec.stmis);
                rsEvent.strGroupGUID       = plan.trainPlan.planID;
                rsEvent.strTrainmanNumber1 = tmid1;
                rsEvent.strTrainmanNumber2 = tmid2;
                rsEvent.nResultID          = Rec.nresult;
                rsEvent.strResult          = Rec.strResult.ResultToString();



                AddRunEvent(rsEvent);

                return(true);
            }
        }