Beispiel #1
0
        public void onWaySelect()
        {
            try
            {
                loadVagForSending();
                //view.clearVagToSendSelection();
                view.clearStationsTo(StationUtils.GetInstance().CbNonSelected);
                view.setTrainNum(0);
                view.clearSide(SideUtils.GetInstance().CbNonSelected);
                view.clearGF(GruzFrontUtils.GetInstance().CbNonSelected);
                view.clearShop(ShopUtils.GetInstance().CbNonSelected);
                view.clearLocoms(LocomotiveUtils.GetInstance().CbNonSelected);
                view.loadGF(gruzFrontDB.getGruzFronts(main.selectedStation), GruzFrontUtils.GetInstance().CbDisplay, GruzFrontUtils.GetInstance().CbValue, GruzFrontUtils.GetInstance().CbNonSelected);
                view.loadShops(shopDB.getShops(main.selectedStation), ShopUtils.GetInstance().CbDisplay, ShopUtils.GetInstance().CbValue, ShopUtils.GetInstance().CbNonSelected);
                loadVagToSend();

                view.changeColumnsPositions(getFirstVagCondName() == "для отправки на УЗ");
            }
            catch (Exception ex)
            {
                main.showErrorMessage(ex.Message);
            }

            try
            {
                main.wayIdxToSelect = view.listWays.IndexOf(view.selectedWay);
            }
            catch (ArgumentOutOfRangeException) { }
        }
Beispiel #2
0
        public void onStatAcceptSelect()
        {
            try
            {
                if (main.selectedStation == view.selectedStatAccept)
                {
                    view.loadGF(gruzFrontDB.getGruzFronts(main.selectedStation), GruzFrontUtils.GetInstance().CbDisplay, GruzFrontUtils.GetInstance().CbValue, GruzFrontUtils.GetInstance().CbNonSelected);
                    view.loadShops(shopDB.getShops(main.selectedStation), ShopUtils.GetInstance().CbDisplay, ShopUtils.GetInstance().CbValue, ShopUtils.GetInstance().CbNonSelected);
                }
                else
                {
                    view.setSide(neighbourStationsDB.getSendSide(main.selectedStation, view.selectedStatAccept));

                    view.deleteGfItems();
                    view.clearGF(GruzFrontUtils.GetInstance().CbNonSelected);
                    view.deleteShopItems();
                    view.clearShop(ShopUtils.GetInstance().CbNonSelected);
                }

                addListToSend();
            }
            catch (Exception ex)
            {
                main.showErrorMessage(ex.Message);
            }
        }
Beispiel #3
0
 public void onShopTextChanged()
 {
     try
     {
         view.clearShop(ShopUtils.GetInstance().CbNonSelected);
         view.loadGF(gruzFrontDB.getGruzFronts(main.selectedStation), GruzFrontUtils.GetInstance().CbDisplay, GruzFrontUtils.GetInstance().CbValue, GruzFrontUtils.GetInstance().CbNonSelected);
         view.clearStationsTo(StationUtils.GetInstance().CbNonSelected);
     }
     catch (Exception ex)
     {
         main.showErrorMessage(ex.Message);
     }
 }
Beispiel #4
0
 public void onGfSelect()
 {
     try
     {
         //view.setStatAcceptByName(main.selectedStation.Name);
         addListToSend();
         view.deleteShopItems(); // добавление невозможности выбрать еще и цех
         view.clearShop(ShopUtils.GetInstance().CbNonSelected);
     }
     catch (Exception ex)
     {
         main.showErrorMessage(ex.Message);
     }
 }
Beispiel #5
0
        public void cancelAllToSend()
        {
            try
            {
                if (vagSendOthStDB.cancelToSend(view.selectedWay))
                {
                    view.clearColorAndDtFromWayMultipleVag();

                    view.clearVagToSend();
                    view.clearStationsTo(StationUtils.GetInstance().CbNonSelected);
                    view.setTrainNum(0);
                    view.clearSide(SideUtils.GetInstance().CbNonSelected);
                    view.clearGF(GruzFrontUtils.GetInstance().CbNonSelected);
                    view.clearShop(ShopUtils.GetInstance().CbNonSelected);
                    view.clearLocoms(LocomotiveUtils.GetInstance().CbNonSelected);
                    view.clearVagForSendSelection();
                }
            }
            catch (Exception ex)
            {
                main.showErrorMessage(ex.Message);
            }
        }
Beispiel #6
0
        public void loadVagSendOthStTab()
        {
            try
            {
                view.setStatLabel(main.selectedStation.Name);
                if (view.dgvForSendColumnsCount == 0)
                {
                    view.makeDgvForSendColumns();
                }
                if (view.dgvToSendColumnsCount == 0)
                {
                    view.makeDgvToSendColumns();
                }

                loadWays();

                view.loadSides(SideUtils.GetInstance().CbItems, SideUtils.GetInstance().CbNonSelected);

                List <GruzFront> gfList = gruzFrontDB.getGruzFronts(main.selectedStation);
                view.loadGF(gfList, GruzFrontUtils.GetInstance().CbDisplay, GruzFrontUtils.GetInstance().CbValue, GruzFrontUtils.GetInstance().CbNonSelected);
                List <Shop> shopList = shopDB.getShops(main.selectedStation);
                view.loadShops(shopList, ShopUtils.GetInstance().CbDisplay, ShopUtils.GetInstance().CbValue, ShopUtils.GetInstance().CbNonSelected);
                view.showHideGfAndShopsOnForm(gfList.Count > 0, shopList.Count > 0);

                view.loadStationsTo(stationDB.getStations(main.selectedStation), StationUtils.GetInstance().CbDisplay, StationUtils.GetInstance().CbValue, StationUtils.GetInstance().CbNonSelected);
                loadLocomotives();

                loadVagForSending();
                loadVagToSend();

                view.changeColumnsPositions(getFirstVagCondName() == "для отправки на УЗ");
            }
            catch (Exception ex)
            {
                main.showErrorMessage(ex.Message);
            }
        }
Beispiel #7
0
        /// <summary>
        /// Отправим вагоны на другую станцию
        /// </summary>
        public void performSending()
        {
            try
            {
                if (view.selectedStatAccept == null && view.selectedGF == null && view.selectedShop == null)
                {
                    main.showErrorMessage(StationUtils.GetInstance().CbNonSelected + "!");
                    return;
                }
                if (view.selectedSide == Side.Empty && view.selectedGF == null && view.selectedShop == null)
                {
                    main.showErrorMessage(SideUtils.GetInstance().CbNonSelected + "!");
                    return;
                }
                if (view.listToSend.Count == 0)
                {
                    main.showErrorMessage("Выберите вагоны для отправки!");
                    return;
                }
                DateTime?dt_from_stat = DateTime.Now;

                if (view.selectedGF != null || view.selectedShop != null)
                {
                    if (!checkVagOrder())
                    {
                        return;
                    }
                }
                string mess_send = String.Format("Пользователь отправил состав со станции {0}, пути {1}, на станцию {2}", main.selectedStation.Name, view.selectedWay.NumName, view.selectedStatAccept != null ? view.selectedStatAccept.Name : view.selectedGF != null ? "Вагоноопрокид : " + view.selectedGF.Name : view.selectedShop != null ? "Цех:" + view.selectedShop.Name :  "?");
                string status    = "";
                //TODO: RW-ОПЕРАЦИИ Включил логирование rw-операций отправки на другие станции
                rwoperation.DispatchCars(view.listToSend.Select(s => (int)s.num_vag).ToArray(), main.selectedStation.ID, view.selectedWay.ID, (view.selectedStatAccept != null ?  (int?)view.selectedStatAccept.ID : null),
                                         view.selectedGF != null ? (int?)view.listToSend[0].St_gruz_front : null,
                                         view.selectedShop != null ? (int?)view.listToSend[0].St_shop : null,
                                         new int[] { view.listToSend[0].St_lock_locom1, view.listToSend[0].St_lock_locom2 });
                foreach (VagSendOthSt item in view.listToSend)
                {
                    if (view.selectedGF != null || view.selectedShop != null)
                    {
                        bool isShop = false;
                        if (view.selectedShop != null)
                        {
                            isShop = true;
                        }
                        dt_from_stat = item.dt_from_stat;
                        mainPresenter.changeLoadCond(item, isShop);
                    }
                    mainPresenter.changeConditionWayAfter(item, view.selectedWay);
                    vagSendOthStDB.send(item.id_oper, item.cond.Id, dt_from_stat, DateTime.Now);
                    status += String.Format("[состав:{0}, №:{1}, дата АМКР:{2}]; ", item.id_sostav, item.num_vag, item.dt_amkr);
                }
                mess_send.SaveLogEvents(status, service.DesktopRailCars);
                changeVagNumsWayFrom();             // изменить нумерацию вагонов на пути изъятия

                changeVagAmountOnWayAfterSending(); //  изменить кол-во вагонов на путях после отправки

                //CommitTransaction / Rollback
                view.clearVagToSend();
                view.clearStationsTo(StationUtils.GetInstance().CbNonSelected);
                view.setTrainNum(0);
                view.clearSide(SideUtils.GetInstance().CbNonSelected);
                view.loadGF(gruzFrontDB.getGruzFronts(main.selectedStation), GruzFrontUtils.GetInstance().CbDisplay, GruzFrontUtils.GetInstance().CbValue, GruzFrontUtils.GetInstance().CbNonSelected);
                view.loadShops(shopDB.getShops(main.selectedStation), ShopUtils.GetInstance().CbDisplay, ShopUtils.GetInstance().CbValue, ShopUtils.GetInstance().CbNonSelected);
                view.clearGF(GruzFrontUtils.GetInstance().CbNonSelected);
                view.clearShop(ShopUtils.GetInstance().CbNonSelected);
                view.clearLocoms(LocomotiveUtils.GetInstance().CbNonSelected);
                loadVagForSending();
            }
            catch (Exception ex)
            {
                main.showErrorMessage(ex.Message);
            }
        }
Beispiel #8
0
        /// <summary>
        /// сформировать и вернуть список поездов (List<Train>) в прибытии
        /// </summary>
        /// <param name="stat"></param>
        /// <param name="sp"></param>
        /// <returns></returns>
        public List <Train> getTrains(Station stat, SendingPoint sp)
        {
            DataTable table = getTrainsTable(stat, sp); // Получить список поездов для снятия

            List <Train> list = new List <Train>();

            foreach (DataRow row in table.Rows)
            {
                Train train = new Train();
                train.Num = Int32.Parse(row["st_lock_train"].ToString());
                //train.StationFrom = new Station(Int32.Parse(row["id_stat"].ToString()), "ст. "+row["stat"].ToString().Trim());
                //train.StationFrom.PointName = StationUtils.GetInstance().ClassName;
                if (row["st_gruz_front"] != DBNull.Value && Int32.Parse(row["st_gruz_front"].ToString()) != -1)
                {
                    GruzFront gf = new GruzFront();
                    gf.PointName = GruzFrontUtils.GetInstance().ClassName;
                    gf.ID        = Int32.Parse(row["st_gruz_front"].ToString());
                    gf.Name      = row["gruz_front_name"].ToString();
                    //gf.Stat = train.StationFrom;
                    train.SendingPoint = gf;
                }
                else
                if (row["st_shop"] != DBNull.Value && Int32.Parse(row["st_shop"].ToString()) != -1)
                {
                    Shop shop = new Shop();
                    shop.PointName = ShopUtils.GetInstance().ClassName;
                    shop.ID        = Int32.Parse(row["st_shop"].ToString());
                    shop.Name      = row["shop_name"].ToString();
                    //train.Shop.Stat = train.StationFrom;
                    train.SendingPoint = shop;
                }
                else
                {
                    Station stationFrom = new Station();
                    stationFrom.PointName = StationUtils.GetInstance().ClassName;
                    stationFrom.ID        = Int32.Parse(row["id_stat"].ToString());
                    stationFrom.Name      = "ст. " + row["stat"].ToString().Trim();
                    train.SendingPoint    = stationFrom;
                }
                train.StationTo = stat;
                if (!sp.GetType().IsAssignableFrom(typeof(Station)))
                {
                    train.DateFromStat = DateTime.Parse(row["dt_from_way"].ToString());
                }
                else
                {
                    train.DateFromStat = DateTime.Parse(row["dt_from_stat"].ToString());
                }
                train.Vag_amount = Int32.Parse(row["vag_amount"].ToString());
                if (row["st_lock_locom1"] != DBNull.Value)
                {
                    train.St_lock_locom1 = Int32.Parse(row["st_lock_locom1"].ToString());
                }
                if (row["st_lock_locom2"] != DBNull.Value)
                {
                    train.St_lock_locom2 = Int32.Parse(row["st_lock_locom2"].ToString());
                }
                //if (row["id_ora_23_temp"] != DBNull.Value)
                //{
                //    train.id_ora_23_temp = Int32.Parse(row["id_ora_23_temp"].ToString());//TODO:
                //}
                //if (row["id_oracle"] != DBNull.Value)
                //{
                //    train.id_oracle = Int32.Parse(row["id_oracle"].ToString());             //TODO:
                //}
                list.Add(train);
            }

            return(list);
        }