Ejemplo n.º 1
0
        public RunEvent GetPlanRunEventsDRToModelDTToList(DataRow dr)
        {
            RunEvent model = new RunEvent();

            if (dr != null)
            {
                model.strRunEventGUID    = ObjectConvertClass.static_ext_string(dr["strRunEventGUID"]);
                model.strTrainPlanGUID   = ObjectConvertClass.static_ext_string(dr["strTrainPlanGUID"]);
                model.nEventID           = ObjectConvertClass.static_ext_int(dr["nEventID"]);
                model.strEventName       = GetRunEventTypeName.GetRunEventTypeNamebyID(model.nEventID);
                model.dtEventTime        = ObjectConvertClass.static_ext_date(dr["dtEventTime"]);
                model.strTrainNo         = ObjectConvertClass.static_ext_string(dr["strTrainNo"]);
                model.strTrainTypeName   = ObjectConvertClass.static_ext_string(dr["strTrainTypeName"]);
                model.strTrainNumber     = ObjectConvertClass.static_ext_string(dr["strTrainNumber"]);
                model.nTMIS              = ObjectConvertClass.static_ext_string(dr["nTMIS"]);
                model.strGroupGUID       = ObjectConvertClass.static_ext_string(dr["strGroupGUID"]);
                model.strTrainmanNumber1 = ObjectConvertClass.static_ext_string(dr["strTrainmanNumber1"]);
                model.strTrainmanNumber2 = ObjectConvertClass.static_ext_string(dr["strTrainmanNumber2"]);
                model.dtCreateTime       = ObjectConvertClass.static_ext_date(dr["dtCreateTime"]);
                model.nID              = ObjectConvertClass.static_ext_int(dr["nID"]);
                model.nResultID        = ObjectConvertClass.static_ext_int(dr["nResult"]);
                model.strResult        = ObjectConvertClass.static_ext_string(dr["strResult"]);
                model.strFlowID        = ObjectConvertClass.static_ext_string(dr["strFlowID"]);
                model.strStationName   = ObjectConvertClass.static_ext_string(dr["strStationName"]);
                model.strWorkShopGUID1 = ObjectConvertClass.static_ext_string(dr["strWorkShopGUID1"]);
                model.strWorkShopGUID2 = ObjectConvertClass.static_ext_string(dr["strWorkShopGUID2"]);
                model.nKehuoID         = ObjectConvertClass.static_ext_int(dr["nKehuoID"]);
                model.nKehuo           = ObjectConvertClass.static_ext_int(dr["nKeHuo"]);
            }
            return(model);
        }
Ejemplo n.º 2
0
        private Boolean AddRunEvent(RunEvent Rec, TrainmanPlan plan, string eventGUID,
                                    ref string ErrInfo, ref int ErrCode)
        {
            ErrCode = 0;
            ErrInfo = "";

            RsRunEvent rsEvent = new RsRunEvent();

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

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

            bool bHasEvent = GetRunEventOfPlan(plan.trainPlan.planID, Rec.nEventID, rsEvent);

            if ((bHasEvent) && (rsEvent.dtEventTime == Rec.dtEventTime))
            {
                ErrCode = 4;
                ErrInfo = "记录重复";
                return(false);
            }

            rsEvent.JiaoLuAndnStationNo = Rec.JiaoLuAndnStationNo;
            rsEvent.strRunEventGUID     = eventGUID;
            rsEvent.nEventID            = Rec.nEventID;
            rsEvent.strTrainPlanGUID    = plan.trainPlan.planID;
            rsEvent.dtEventTime         = Rec.dtEventTime;
            rsEvent.nTMIS              = Rec.strStationName;
            rsEvent.strGroupGUID       = plan.trainPlan.planID;
            rsEvent.strTrainmanNumber1 = Rec.strTrainmanNumber1;
            rsEvent.strTrainmanNumber2 = Rec.strTrainmanNumber2;
            rsEvent.nResultID          = Rec.nResultID;
            rsEvent.strTrainNo         = Rec.strTrainNo;
            rsEvent.strTrainNumber     = Rec.strTrainNumber;
            rsEvent.strTrainTypeName   = Rec.strTrainTypeName;
            rsEvent.strResult          = Rec.strResult;
            AddRunEvent(rsEvent);
            return(true);
        }
Ejemplo n.º 3
0
        public int SubmitRunEvent(RunEvent model)
        {
            int    ErrCode   = 0;
            string ErrInfo   = "";
            string eventGUID = Guid.NewGuid().ToString();

            TrainmanPlan plan = new TrainmanPlan();


            if (DBPlan.GetTrainPlanBriefByRange(model.strTrainmanNumber1, model.dtEventTime, plan))
            {
                AddRunEvent(model, plan, eventGUID, ref ErrInfo, ref ErrCode);
                ErrCode = 0;
            }
            else
            {
                ErrCode = 0;
                ErrInfo = "没有指定乘务员的计划或机组信息";
            }


            Plan_RunEvent_TrainDetail eventParam = new Plan_RunEvent_TrainDetail();

            eventParam.strRunEventGUID    = eventGUID;
            eventParam.dtEventTime        = model.dtEventTime;
            eventParam.strTrainmanNumber1 = model.strTrainmanNumber1;
            eventParam.strTrainmanNumber2 = model.strTrainmanNumber2;
            eventParam.nTMIS = model.strStationName;
            eventParam.JiaoLuAndnStationNo = model.JiaoLuAndnStationNo;
            eventParam.nKeHuo           = model.nKehuo;
            eventParam.strTrainNo       = model.strTrainNo;
            eventParam.strTrainTypeName = model.strTrainTypeName;
            eventParam.strTrainNumber   = model.strTrainNumber;
            eventParam.dtCreateTime     = DateTime.Now;
            eventParam.nResultID        = model.nResultID;
            eventParam.strResult        = model.strResult;
            eventParam.nEventID         = model.nEventID;
            eventParam.strGUID          = Guid.NewGuid().ToString();

            ////向TAB_Plan_RunEvent_Site中插入数据
            SubmitEventLog(eventParam);
            return(ErrCode);
        }
Ejemplo n.º 4
0
        public int AddRunEvent(RunEvent model, TrainmanPlan plan, ref string ErrInfo, ref int ErrCode)
        {
            string    strSql = "select dbo.CovnertTrainType('" + model.strTrainTypeName + "') as TrainTypeName,dbo.CovnertTrainNumber('" + model.strTrainNumber + "') as TrainNumber";
            DataTable dt     = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql.ToString()).Tables[0];

            if (dt.Rows.Count > 0)
            {
                model.strTrainTypeName = dt.Rows[0]["TrainTypeName"].ToString();
                model.strTrainNumber   = dt.Rows[0]["TrainNumber"].ToString();

                string strUpSql = "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[] sqlParameters = new SqlParameter[]
                {
                    new SqlParameter("strRunEventGUID", model.strRunEventGUID),
                    new SqlParameter("strTrainPlanGUID", model.strTrainPlanGUID),
                    new SqlParameter("nEventID", model.nEventID),
                    new SqlParameter("dtEventTime", model.dtEventTime),
                    new SqlParameter("strTrainNo", model.strTrainNo),
                    new SqlParameter("strTrainTypeName", model.strTrainTypeName),
                    new SqlParameter("strTrainNumber", model.strTrainNumber),
                    new SqlParameter("nTMIS", model.nTMIS),
                    new SqlParameter("nKeHuo", model.nKehuo),
                    new SqlParameter("strGroupGUID", model.strGroupGUID),
                    new SqlParameter("strTrainmanNumber1", model.strTrainmanNumber1),
                    new SqlParameter("strTrainmanNumber2", model.strTrainmanNumber2),
                    new SqlParameter("nResult", model.nResultID),
                    new SqlParameter("strResult", model.strResult)
                };

                return(SqlHelper.ExecuteNonQuery(SqlHelper.ConnString, CommandType.Text, strUpSql.ToString(), sqlParameters));
            }
            else
            {
                return(0);
            }
        }