Esempio n. 1
0
        public void Test_SUD_RC_Gruzs()
        {
            RC_Gruzs gruz = new RC_Gruzs();
            GRUZS    w1   = new GRUZS()
            {
                id_gruz = 0, name = "тест1", name_full = "full_test1", id_ora = 0, id_ora2 = 0,
            };
            int id_new = gruz.SaveGruzs(w1);

            Test_RC_Gruzs(id_new);
            GRUZS w2 = new GRUZS()
            {
                id_gruz   = id_new,
                name      = "тест2",
                name_full = "full_test2",
                id_ora    = null,
                id_ora2   = null,
            };
            int id_ch = gruz.SaveGruzs(w2);

            Test_RC_Gruzs(id_ch);
            GRUZS del = gruz.DeleteGruzs(id_ch);

            WL(del);
        }
Esempio n. 2
0
        /// <summary>
        /// Определить Id груза (если id нет в системе RailCars создать из данных КИС)
        /// </summary>
        /// <param name="id_gruz_prom_kis"></param>
        /// <param name="id_gruz_vag_kis"></param>
        /// <returns></returns>
        public int?DefinitionIDGruzs(int?id_gruz_prom_kis, int?id_gruz_vag_kis)
        {
            int?id_gruz = rs_gr.GetIDGruzs(id_gruz_prom_kis, id_gruz_vag_kis);

            if (id_gruz == null)
            {
                if (id_gruz_prom_kis != null & id_gruz_vag_kis == null)
                {
                    PromGruzSP pg = pc.GetGruzSP((int)id_gruz_prom_kis);
                    if (pg != null)
                    {
                        int res = rs_gr.SaveGruzs(new GRUZS()
                        {
                            id_gruz   = 0,
                            name      = pg.ABREV_GR.Trim(),
                            name_full = pg.NAME_GR.Trim(),
                            id_ora    = id_gruz_prom_kis,
                            id_ora2   = null,
                            ETSNG     = pg.TAR_GR,
                        });
                        if (res > 0)
                        {
                            id_gruz = res;
                        }
                    }
                }
                // отправляемые грузы
                if (id_gruz_vag_kis != null & id_gruz_prom_kis == null)
                {
                    NumVagStpr1Gr nvgr = vc.GetSTPR1GR((int)id_gruz_vag_kis);
                    if (nvgr != null)
                    {
                        int res = rs_gr.SaveGruzs(new GRUZS()
                        {
                            id_gruz   = 0,
                            name      = nvgr.GR.Trim(),
                            name_full = nvgr.GR.Trim(),
                            id_ora    = null,
                            id_ora2   = id_gruz_vag_kis,
                            ETSNG     = null
                        });
                        if (res > 0)
                        {
                            id_gruz = res;
                        }
                    }
                }
            }
            return(id_gruz);
        }