Ejemplo n.º 1
0
        private void ReadOrderGroups(string workShopGUID, List <NpCommon> npCommons)
        {
            //获取所有的轮乘交路名牌
            string strSql = string.Format(@"select * from VIEW_Nameplate_TrainmanJiaolu_Order where strTrainmanJiaoluGUID in 
            (select strTrainmanJiaoluGUID from tab_base_jiaolurelation where strTrainJiaoluGUID in

            (select strTrainJiaoluGUID from TAB_Base_TrainJiaolu where strWorkShopGUID=@strWorkShopGUID))
            order by strTrainmanJiaoluGUID,GroupState,dtLastArriveTime");

            SqlParameter[] sqlParamsOrder =
            {
                new SqlParameter("strWorkShopGUID", workShopGUID)
            };
            DataTable tabOrder = SqlHelper.ExecuteDataset(SqlHelper.ConnString, CommandType.Text, strSql, sqlParamsOrder).Tables[0];


            NpCommon npCommon = null;

            foreach (DataRow dr in tabOrder.Rows)
            {
                GetNpCommon(dr, ref npCommon, npCommons);

                NpGroup grp = new NpGroup();
                grp.order = DBObjToInt(dr["nOrder"]);
                DBRowToGroup(dr, grp);
                npCommon.dataArray.Add(grp);
            }
        }
Ejemplo n.º 2
0
 private void DBRowToGroup(DataRow dr, NpGroup group)
 {
     group.grpId = dr["strGroupGUID"].ToString();
     group.state = 2;
     if (dr["GroupState"].ToString() != "")
     {
         group.state = 3;
         if (int.Parse(dr["GroupState"].ToString()) == 7)
         {
             group.state = 6;
         }
     }
     if (dr["strTrainmanGUID1"].ToString() != "")
     {
         group.tm1          = new NpTrainman();
         group.tm1.tmName   = dr["strTrainmanName1"].ToString();
         group.tm1.tmNumber = dr["strTrainmanNumber1"].ToString();
         group.tm1.tmPost   = 1;
         if (dr["nPost1"].ToString() != "")
         {
             group.tm1.tmPost = int.Parse(dr["nPost1"].ToString());
         }
     }
     if (dr["strTrainmanGUID2"].ToString() != "")
     {
         group.tm2          = new NpTrainman();
         group.tm2.tmName   = dr["strTrainmanName2"].ToString();
         group.tm2.tmNumber = dr["strTrainmanNumber2"].ToString();
         group.tm2.tmPost   = 1;
         if (dr["nPost2"].ToString() != "")
         {
             group.tm2.tmPost = int.Parse(dr["nPost2"].ToString());
         }
     }
     if (dr["strTrainmanGUID3"].ToString() != "")
     {
         group.tm3          = new NpTrainman();
         group.tm3.tmName   = dr["strTrainmanName3"].ToString();
         group.tm3.tmNumber = dr["strTrainmanNumber3"].ToString();
         group.tm3.tmPost   = 1;
         if (dr["nPost3"].ToString() != "")
         {
             group.tm3.tmPost = int.Parse(dr["nPost3"].ToString());
         }
     }
     if (dr["strTrainmanGUID4"].ToString() != "")
     {
         group.tm4          = new NpTrainman();
         group.tm4.tmName   = dr["strTrainmanName4"].ToString();
         group.tm4.tmNumber = dr["strTrainmanNumber4"].ToString();
         group.tm4.tmPost   = 1;
         if (dr["nPost4"].ToString() != "")
         {
             group.tm4.tmPost = int.Parse(dr["nPost4"].ToString());
         }
     }
 }