Exemple #1
0
        public void Test_MTContent_GetListToNatur()
        {
            MTContent mt  = new MTContent();
            MTList    lst = mt.GetListToNatur(4839, 67923441, DateTime.Parse("2016-01-06 13:55:00"), 15);

            //string sw = "60662830;65383853;67660423;74021965;65046567;56560055;24534372;50546159;57517948;55977870;55763296;55320519;63627558;65206062;67751354;67794347;64083868;66522079;65009771;66495458;67288738;65125502;65710154;66399379;65469769;62823661;65438236;55063119;53777959;60832383;56765530;56138001;53436556;52749769;56936644;56969702;52876307;53551669;60091303;55119531;55118251;61246328;59717553;57411928;60267812;52965274;55139851;52733540;53569752;66680547;65483307;60261211;56982416;54122338;61243358;60806072;62034137;59785881;";
            //Console.WriteLine("id sostav = {0}", mt.GetIDSostavToWagons(sw));
        }
Exemple #2
0
        public void Test_MTContent_MTList()
        {
            ArrivalSostav aso = new ArrivalSostav();
            MTContent     mt  = new MTContent();

            foreach (Oracle_ArrivalSostav oas in aso.Get_ArrivalSostavNoClose().Where(a => a.ListWagons != null))
            {
                Console.WriteLine("natur {0}, count = {1}", oas.NaturNum, mt.GetIDSostavToWagons(oas.ListWagons, oas.DateTime).Count());
            }

            //string sw = "60662830;65383853;67660423;74021965;65046567;56560055;24534372;50546159;57517948;55977870;55763296;55320519;63627558;65206062;67751354;67794347;64083868;66522079;65009771;66495458;67288738;65125502;65710154;66399379;65469769;62823661;65438236;55063119;53777959;60832383;56765530;56138001;53436556;52749769;56936644;56969702;52876307;53551669;60091303;55119531;55118251;61246328;59717553;57411928;60267812;52965274;55139851;52733540;53569752;66680547;65483307;60261211;56982416;54122338;61243358;60806072;62034137;59785881;";
            //Console.WriteLine("id sostav = {0}", mt.GetIDSostavToWagons(sw));
        }
Exemple #3
0
        public void Test_MT_Helpers_MT_ArrivalToRailWayAll()
        {
            MT        mts = new MT();
            MTContent mt  = new MTContent();

            foreach (MTSostav sos in mt.Get_MTSostav())
            {
                int v = mts.ArrivalToRailWay(sos.IDMTSostav);
                if (v > 0)
                {
                    Console.WriteLine("Состав {0} - вагонов {1}", sos.CompositionIndex, v);
                }
            }
        }
Exemple #4
0
        public void Test_SUD_MTContent_MTConsignee()
        {
            MTContent   mt      = new MTContent();
            MTConsignee mtc3437 = new MTConsignee()
            {
                Code            = 3437,
                CodeDescription = "основной код ПАО АМКР",
                Consignee       = (int)tMTConsignee.AMKR
            };

            mt.SaveMTConsignee(mtc3437);
            MTConsignee mtc6302 = new MTConsignee()
            {
                Code            = 6302,
                CodeDescription = "вспомогательный код при отправке досылочных грузов (добавлен в регламент)",
                Consignee       = (int)tMTConsignee.AMKR
            };

            mt.SaveMTConsignee(mtc6302);
            MTConsignee mtc9999 = new MTConsignee()
            {
                Code            = 9999,
                CodeDescription = "вспомогательный код при отправке досылочных грузов (добавлен в регламент)",
                Consignee       = (int)tMTConsignee.AMKR
            };

            mt.SaveMTConsignee(mtc9999);
            MTConsignee mtc0 = new MTConsignee()
            {
                Code            = 0,
                CodeDescription = "0",
                Consignee       = (int)tMTConsignee.AMKR
            };
            int         mtc0_add = mt.SaveMTConsignee(mtc0);
            MTConsignee mtc1     = new MTConsignee()
            {
                Code            = mtc0_add,
                CodeDescription = "1",
                Consignee       = (int)tMTConsignee.AMKR
            };
            int del = mt.SaveMTConsignee(mtc1);

            MTConsignee mtc_del = mt.DeleteMTConsignee(del);
        }
Exemple #5
0
 private int ArrivalToRailWay(int id_sostav)
 {
     try
     {
         KIS_RC_Transfer  rc_transfer = new KIS_RC_Transfer(); // Перенос в системе RailCars
         KIS_RW_Transfer  rw_transfer = new KIS_RW_Transfer(); // Перенос в системе RailWay
         MTContent        mtc         = new MTContent();
         ReferenceRailway refRW       = new ReferenceRailway();
         SAP_Transfer     saptr       = new SAP_Transfer();
         // Определим класс данных состав
         MTSostav sost = mtc.Get_MTSostav(id_sostav);
         // Определим код станции по справочникам
         int?codecs_in   = refRW.GetCodeCSStations(int.Parse(sost.CompositionIndex.Substring(9, 4)) * 10);
         int?codecs_from = refRW.GetCodeCSStations(int.Parse(sost.CompositionIndex.Substring(0, 4)) * 10);
         // Определим класс данных вагоны
         List <trWagon> list_wag = new List <trWagon>();
         list_wag = GetListWagonInArrival(mtc.Get_MTListToSostav(id_sostav), codecs_in, mtc.GetMTConsignee(tMTConsignee.AMKR));
         trSostav sostav = new trSostav()
         {
             id = sost.IDMTSostav,
             codecs_in_station   = codecs_in,
             codecs_from_station = codecs_from,
             //FileName = sost.FileName,
             //CompositionIndex = sost.CompositionIndex,
             DateTime_from = sost.DateTime,
             //Operation = sost.Operation,
             //Create = sost.Create,
             //Close = sost.Close,
             ParentID = sost.ParentID,
             Wagons   = list_wag != null?list_wag.ToArray() : null,
         };
         // Поставим вагоны в систему RailCars
         int res_arc;
         try
         {
             //res_arc = rc_transfer.PutInArrival(sostav);
             res_arc = saptr.PutInSapIncomingSupply(sostav);
             if (res_arc < 0)
             {
                 //LogRW.LogError(String.Format("[MT.ArrivalToRailWay] :Ошибка переноса состава в прибытие системы RailCars, состав: {0}, код ошибки: {1}.", sostav.id, res_arc), this.eventID);
             }
         }
         catch (Exception e)
         {
             //LogRW.LogError(String.Format("[MT.ArrivalToRailWay] :Ошибка переноса состава в прибытие системы RailCars, состав: {0}. Подробно: (источник: {1}, № {2}, описание:  {3})", sostav.id, e.Source, e.HResult, e.Message), this.eventID);
             res_arc = -1;
         }
         // Поставим вагоны в систему RailWay
         // TODO: Выполнить код постановки вагонов в систему RailWay (прибытие из КР)
         // ..................
     }
     catch (AggregateException agex)
     {
         agex.Handle(ex =>
         {
             //LogRW.LogError(String.Format("[MT.ArrivalToRailWay]: Общая ошибка переноса состава в прибытие системы RailWay (источник: {0}, № {1}, описание:  {2})", ex.Source, ex.HResult, ex.Message), this.eventID);
             return(true);
         });
         return(-1);
     }
     return(0);//TODO: исправить возврат
 }
Exemple #6
0
        public void Read_List()
        {
            // Arrange - create the mock repository
            mock_mt.Setup(m => m.MTList).Returns(new MTList[] {
                new MTList()
                {
                    IDMTList         = 1,
                    IDMTSostav       = 1,
                    Position         = 1,
                    CarriageNumber   = 60490943,
                    CountryCode      = 221,
                    Weight           = 57,
                    IDCargo          = 17101,
                    Cargo            = "sss",
                    IDStation        = 46600,
                    Station          = "НИКОПОЛЬ",
                    Consignee        = 3925,
                    Operation        = "ТСП",
                    CompositionIndex = "3540-097-4670",
                    DateOperation    = DateTime.Parse("2016-08-22 11:40:00.000"),
                    TrainNumber      = 1402,
                    NaturList        = null
                },
                new MTList()
                {
                    IDMTList         = 2,
                    IDMTSostav       = 1,
                    Position         = 2,
                    CarriageNumber   = 60490944,
                    CountryCode      = 221,
                    Weight           = 50,
                    IDCargo          = 17101,
                    Cargo            = "sss",
                    IDStation        = 46600,
                    Station          = "НИКОПОЛЬ",
                    Consignee        = 3925,
                    Operation        = "ТСП",
                    CompositionIndex = "3540-097-4670",
                    DateOperation    = DateTime.Parse("2016-08-22 11:40:00.000"),
                    TrainNumber      = 1402,
                    NaturList        = null
                },
                new MTList()
                {
                    IDMTList         = 3,
                    IDMTSostav       = 2,
                    Position         = 1,
                    CarriageNumber   = 33490944,
                    CountryCode      = 222,
                    Weight           = 60,
                    IDCargo          = 17100,
                    Cargo            = "sss",
                    IDStation        = 46600,
                    Station          = "Кривой Рог",
                    Consignee        = 3925,
                    Operation        = "ПРИБ",
                    CompositionIndex = "3540-055-4670",
                    DateOperation    = DateTime.Parse("2016-08-22 11:40:00.000"),
                    TrainNumber      = 1402,
                    NaturList        = null
                },
            }.AsQueryable());



            // Arrange - create the controller
            MTContent target = new MTContent(mock_mt.Object);

            // Act
            // Проверка
            MTList        mtl         = target.Get_MTList(1);
            MTList        mtl_null    = target.Get_MTList(0);
            List <MTList> list_ws     = target.Get_MTListToSostav(1).ToList();
            List <MTList> list_all    = target.Get_MTList().ToList();
            int?          tn          = target.GetTrainNumberToSostav(1);
            int?          tn_null     = target.GetTrainNumberToSostav(0);
            bool          exlist      = target.IsMTListToMTSostsv(1);
            bool          exlist_null = target.IsMTListToMTSostsv(0);

            //bool sostav_exist = target.IsExistSostav("regl_8701-058-4670_2016082212353.xml");
            //bool sostav_not_exist = target.IsExistSostav("1regl_8701-058-4670_2016082212353.xml");

            //MTSostav mts_notClose = target.Get_NoCloseMTSostav("8701-058-4670", DateTime.Parse("2016-08-23 12:35:00.000"));
            //MTSostav mts_notClose_null = target.Get_NoCloseMTSostav("8701-058-4670", DateTime.Parse("2016-08-21 12:35:00.000"));
            // Assert
            //

            Assert.AreEqual(null, mtl_null);
            Assert.AreEqual(60490943, mtl.CarriageNumber);
            Assert.AreEqual(DateTime.Parse("2016-08-22 11:40:00.000"), mtl.DateOperation);
            Assert.AreEqual(1, mtl.Position);

            Assert.AreEqual(2, list_ws.Count());
            Assert.AreEqual(1, list_ws[0].IDMTList);
            Assert.AreEqual(2, list_ws[1].IDMTList);
            Assert.AreEqual(3, list_all.Count());
            Assert.AreEqual(1402, tn);
            Assert.AreEqual(null, tn_null);
            Assert.AreEqual(true, exlist);
            Assert.AreEqual(false, exlist_null);
            //Assert.AreEqual(true, sostav_exist);
            //Assert.AreEqual(false, sostav_not_exist);

            //Assert.AreEqual(2, mts_notClose.IDMTSostav);
            //Assert.AreEqual(null, mts_notClose_null);
        }
Exemple #7
0
        public void Read_Sostav()
        {
            // Arrange - create the mock repository
            mock_mt.Setup(m => m.MTSostav).Returns(new MTSostav[] {
                new MTSostav()
                {
                    IDMTSostav       = 1,
                    FileName         = "regl_8701-058-4670_2016082212254.xml",
                    CompositionIndex = "8701-058-4670",
                    DateTime         = DateTime.Parse("2016-08-22 12:25:00.000"),
                    Operation        = 1,
                    Create           = DateTime.Parse("2016-09-07 15:07:45.000"),
                    Close            = DateTime.Parse("2016-09-07 15:07:45.697"),
                    ParentID         = null
                },
                new MTSostav()
                {
                    IDMTSostav       = 2,
                    FileName         = "regl_8701-058-4670_2016082212353.xml",
                    CompositionIndex = "8701-058-4670",
                    DateTime         = DateTime.Parse("2016-08-22 12:35:00.000"),
                    Operation        = 2,
                    Create           = DateTime.Parse("2016-09-07 15:07:45.000"),
                    Close            = null,
                    ParentID         = 1
                },
                new MTSostav()
                {
                    IDMTSostav       = 3,
                    FileName         = "regl_4670-731-4672_2016082214000.xml",
                    CompositionIndex = "4670-731-4672",
                    DateTime         = DateTime.Parse("2016-08-22 14:00:00.000"),
                    Operation        = 1,
                    Create           = DateTime.Parse("2016-09-07 15:07:46.000"),
                    Close            = null,
                    ParentID         = null
                },
            }.AsQueryable());

            // Arrange - create the controller
            MTContent target = new MTContent(mock_mt.Object);

            // Act
            // Проверка
            MTSostav        mts      = target.Get_MTSostav(1);
            MTSostav        mts_null = target.Get_MTSostav(0);
            List <MTSostav> list_ci  = target.Get_MTSostav("8701-058-4670").ToList();
            List <MTSostav> list_all = target.Get_MTSostav().ToList();

            bool sostav_exist     = target.IsExistSostav("regl_8701-058-4670_2016082212353.xml");
            bool sostav_not_exist = target.IsExistSostav("1regl_8701-058-4670_2016082212353.xml");

            MTSostav mts_notClose      = target.Get_NoCloseMTSostav("8701-058-4670", DateTime.Parse("2016-08-23 12:35:00.000"));
            MTSostav mts_notClose_null = target.Get_NoCloseMTSostav("8701-058-4670", DateTime.Parse("2016-08-21 12:35:00.000"));

            // Assert
            //
            Assert.AreEqual("regl_8701-058-4670_2016082212254.xml", mts.FileName);
            Assert.AreEqual("8701-058-4670", mts.CompositionIndex);
            Assert.AreEqual("2016-08-22 12:25:00.000", mts.DateTime.ToString("yyyy-MM-dd HH:mm:ss.000"));
            Assert.AreEqual(1, mts.Operation);
            Assert.AreEqual("2016-09-07 15:07:45.000", mts.Create.ToString("yyyy-MM-dd HH:mm:ss.000"));
            Assert.AreEqual("2016-09-07 15:07:45.697", ((DateTime)mts.Close).ToString("yyyy-MM-dd HH:mm:ss.697"));
            Assert.AreEqual(null, mts.ParentID);
            Assert.AreEqual(null, mts_null);

            Assert.AreEqual(2, list_ci.Count());
            Assert.AreEqual(1, list_ci[0].IDMTSostav);
            Assert.AreEqual(2, list_ci[1].IDMTSostav);
            Assert.AreEqual(3, list_all.Count());
            Assert.AreEqual(true, sostav_exist);
            Assert.AreEqual(false, sostav_not_exist);

            Assert.AreEqual(2, mts_notClose.IDMTSostav);
            Assert.AreEqual(null, mts_notClose_null);
        }
Exemple #8
0
 public void Test_MTContent_GetOperationMTSostavDestinct()
 {
     MTContent       mt   = new MTContent();
     List <MTSostav> list = mt.GetOperationMTSostavDestinct(6574);
 }