示例#1
0
        public void SubmitInOutRoomEvent(SubmitInOutRoom Rec, int EventID)
        {
            int    tmindex;
            int    ErrCode   = 0;
            string ErrInfo   = "";
            string eventGUID = Guid.NewGuid().ToString();

            TrainmanPlan plan     = new TrainmanPlan();
            Trainman     trainman = new Trainman();



            if (DBPlan.GetTrainPlanBriefByRange(Rec.tmid, Rec.etime, plan, out tmindex))
            {
                if (DBDictionary.GetTrainman(Rec.tmid, trainman))
                {
                    SubmitTrainmanEvent(Rec, EventID, plan, tmindex, ref ErrInfo, ref ErrCode, ref eventGUID);

                    SubmitInOutRoomRecord(plan.trainPlan.planID, Rec, tmindex, EventID, trainman);
                }
                else
                {
                    ErrCode = 1;
                    ErrInfo = string.Format("没有找到工号为[{0}]的乘务员!", Rec.tmid);
                }
            }
            else
            {
                ErrCode = 1;
                ErrInfo = "没有指定乘务员的计划或机组信息";
            }


            if (ErrCode == 0)
            {
                ErrInfo = "添加成功";
            }



            EventParam eventParam = new EventParam();

            eventParam.eventGUID    = eventGUID;
            eventParam.eventID      = EventID;
            eventParam.ntmis        = Convert.ToInt32(Rec.stmis);
            eventParam.submitRemark = ErrInfo;
            eventParam.submitResult = ErrCode;
            eventParam.strResult    = Rec.strResult.ResultToString();
            eventParam.nresult      = Rec.nresult;
            eventParam.tmid         = Rec.tmid;
            eventParam.etime        = Rec.etime;

            eventParam.strTrainType    = Rec.strTrainType;
            eventParam.strTrainNum     = Rec.strTrainNum;
            eventParam.strCheCi        = Rec.strCheCi;
            eventParam.nLoginType      = Rec.nLoginType;
            eventParam.PhotoID         = Rec.PhotoID;
            eventParam.IsLackOfRest    = Rec.IsLackOfRest;
            eventParam.LackReason      = Rec.LackReason;
            eventParam.ShenHeNumber    = Rec.ShenHeNumber;
            eventParam.ShenHeName      = Rec.ShenHeName;
            eventParam.ShenHeLoginType = Rec.ShenHeLoginType;
            eventParam.ShenHePhotoID   = Rec.ShenHePhotoID;
            eventParam.InRoomTime      = Rec.strResult.InRoomTime;

            //向TAB_Plan_RunEvent_Site中插入数据
            SubmitEventLog(eventParam);
        }
示例#2
0
        public static void InsertDrinkRecord(SubmitDrinkRec Rec, SqlTransaction trans)
        {
            string placeName = DBDictionary.GetDutyPlaceID(Rec.stmis);

            Trainman trainman = new Trainman();

            DBDictionary.GetTrainman(Rec.tmid, trainman);


            #region 添加测酒记录
            MDDrink MDDr = new MDDrink();
            TF.Runsafty.Plan.DB.DBDrink DBDr = new Runsafty.Plan.DB.DBDrink();
            //职位信息----- 开始----------
            DBDrinkLogic dbdl = new DBDrinkLogic();
            MDDrinkLogic mddl = new MDDrinkLogic();
            mddl = dbdl.GetDrinkCadreEntity(Rec.tmid);
            if (mddl != null)
            {
                MDDr.strDepartmentID   = mddl.strDepartmentID;
                MDDr.strDepartmentName = mddl.strDepartmentName;
                MDDr.nCadreTypeID      = mddl.nCadreTypeID;
                MDDr.strCadreTypeName  = mddl.strCadreTypeName;
            }
            //职位信息----- 结束----------

            //是否是本段
            MDDr.nLocalAreaTrainman = 0;
            MDDr.trainmanID         = trainman.tmGUID;
            MDDr.createTime         = DateTime.Now.ToString();
            MDDr.verifyID           = 0;
            MDDr.oPlaceId           = "";
            MDDr.strGuid            = Guid.NewGuid().ToString();
            MDDr.drinkResult        = Rec.nresult.ToString();
            MDDr.strAreaGUID        = "";
            MDDr.dutyUserID         = "";
            MDDr.strTrainmanName    = trainman.tmname;
            MDDr.strTrainmanNumber  = Rec.tmid;
            MDDr.strTrainNo         = "";
            MDDr.strTrainNumber     = "";
            MDDr.strTrainTypeName   = "";
            MDDr.strWorkShopGUID    = trainman.workShopID;
            MDDr.strWorkShopName    = trainman.workShopName;
            MDDr.strPlaceID         = Rec.stmis;
            MDDr.strPlaceName       = placeName;
            MDDr.strSiteGUID        = "";
            MDDr.strSiteName        = "";
            MDDr.dwAlcoholicity     = "";
            MDDr.strWorkID          = "";
            MDDr.nWorkTypeID        = Rec.workType;//工作类型为退勤
            MDDr.imagePath          = CreateImgPath(Rec);
            SqlTrans sqltrans = new SqlTrans();
            sqltrans.Begin();
            try
            {
                DBDr.SubmitDrink(MDDr, sqltrans.trans);
                sqltrans.Commit();
            }
            catch (Exception ex)
            {
                sqltrans.RollBack();
                throw ex;
            }
            #endregion
        }