Esempio n. 1
0
        public static WagonInternalMovement SetStationWagon(this WagonInternalRoutes wir, int id_station, int id_way, DateTime date_start, int position, string note, string user, bool check_replay)
        {
            WagonInternalMovement wim_new = null;

            if (wir != null && wir.close == null)
            {
                // Получим последнее положение
                WagonInternalMovement wim = wir.GetLastMovement();
                // Исключим попытку поставить дублирования записи постановки на путь
                if (wim == null || (wim != null && (wim.id_station != id_station || wim.id_way != id_way || wim.position != position || wim.id_outer_way != null)))
                {
                    wim_new = new WagonInternalMovement()
                    {
                        id              = 0,
                        id_station      = id_station,
                        id_way          = id_way,
                        way_start       = date_start,
                        way_end         = null,
                        position        = position,
                        id_outer_way    = null,
                        outer_way_start = null,
                        outer_way_end   = null,
                        create          = DateTime.Now,
                        create_user     = user,
                        num_sostav      = null,
                        note            = note,
                        parent_id       = wim.CloseMovement(date_start, null, user),
                    };
                    wir.WagonInternalMovement.Add(wim_new);
                }
            }
            return(wim_new);
        }
Esempio n. 2
0
 //TODO: Удалить после удаления всех старых операций
 /// <summary>
 /// Установить вагон на станцию на путь
 /// </summary>
 /// <param name="wir"></param>
 /// <param name="id_station"></param>
 /// <param name="id_way"></param>
 /// <param name="date_start"></param>
 /// <param name="position"></param>
 /// <param name="note"></param>
 /// <param name="user"></param>
 /// <returns></returns>
 public static WagonInternalRoutes SetStationWagon_old(this WagonInternalRoutes wir, int id_station, int id_way, DateTime date_start, int position, string note, string user)
 {
     if (wir != null && wir.close == null)
     {
         WagonInternalMovement wim = wir.GetLastMovement();
         // Исключим попытку поставить дублирования записи постановки на путь
         if (wim == null || (wim != null && (wim.id_station != id_station || wim.id_way != id_way || wim.position != position)))
         {
             WagonInternalMovement wim_new = new WagonInternalMovement()
             {
                 id = 0,
                 //id_wagon_internal_routes = wir.id,
                 id_station = id_station,
                 //station_start = date_start,
                 id_way          = id_way,
                 way_start       = date_start,
                 id_outer_way    = null,
                 outer_way_start = null,
                 outer_way_end   = null,
                 position        = position,
                 create          = DateTime.Now,
                 create_user     = user,
                 note            = note,
                 parent_id       = wim.CloseMovement(date_start, null, user)
             };
             wir.WagonInternalMovement.Add(wim_new);
         }
     }
     return(wir);
 }
Esempio n. 3
0
 // TODO: Удалить
 /// <summary>
 /// Установить вагон на путь отправки
 /// </summary>
 /// <param name="wir"></param>
 /// <param name="id_outer_ways"></param>
 /// <param name="date_start"></param>
 /// <param name="position"></param>
 /// <param name="note"></param>
 /// <param name="user"></param>
 /// <returns></returns>
 public static WagonInternalRoutes SetSendingWagon_old(this WagonInternalRoutes wir, int id_outer_ways, DateTime date_start, int position, string note, string user)
 {
     if (wir != null && wir.close == null)
     {
         // Получим последнее положение
         WagonInternalMovement wim = wir.GetLastMovement();
         // Исключим попытку поставить дублирования записи постановки на путь
         if (wim != null && wim.id_outer_way != id_outer_ways)
         {
             WagonInternalMovement wim_new = new WagonInternalMovement()
             {
                 id              = 0,
                 id_station      = wim.id_station,
                 id_way          = wim.id_way,
                 way_start       = wim.way_start,
                 way_end         = wim.way_end == null ? date_start : wim.way_end,
                 id_outer_way    = (int?)id_outer_ways,
                 outer_way_start = date_start,
                 outer_way_end   = null,
                 position        = position,
                 create          = DateTime.Now,
                 create_user     = user,
                 note            = note,
                 parent_id       = wim.CloseMovement(date_start, null, user),
             };
             wir.WagonInternalMovement.Add(wim_new);
         }
     }
     return(wir);
 }