Ejemplo n.º 1
0
        private bool splitRoute(GENERIC_SYSTEM_PARAMETERS.ROUTES.ROUTE route)
        {
            if (null == route)
            {
                return(false);
            }
            int startSigID = route.Origin_Signal_ID;
            List <GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK> blkList = new List <GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK>();
            List <int> dstSigIDs = new List <int>();

            dstSigIDs.AddRange(route.Spacing_Signal_ID_List.Signal_ID.Cast <int>());
            dstSigIDs.Add(route.Destination_Signal_ID);
            foreach (int blkID in route.Block_ID_List.Block_ID)
            {
                var blk = (GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK)Sys.GetNode(blkID, Sydb.blockInfoList.Cast <Node>().ToList());

                int dstSigID = SyDB.GetSigIDInBlock(blkID, dstSigIDs);
                if (0 < dstSigID && dstSigIDs.Exists(x => x == dstSigID))
                {
                    List <GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK> newBlkList = new List <GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK>();
                    newBlkList.AddRange(blkList);
                    newBlkList.Add(blk);
                    try
                    {
                        RouteSegment split_rs = new RouteSegment(startSigID, dstSigID, newBlkList, route);

                        //update info for new split route
                        {
                            blkList.Clear();
                            dstSigIDs.Remove(dstSigID);
                            startSigID = dstSigID;
                        }

                        if (route.Origin_Signal_ID == split_rs.m_OrgSig.ID)//route_spacing signal route
                        {
                            AddNewRoute(false, split_rs);
                        }
                        else//spacing signal route
                        {
                            AddNewRoute(true, split_rs);
                        }
                    }
                    catch (Exception ex)
                    {
                        TraceMethod.RecordInfo(ex.Message);
                    }
                }
                else
                {
                    blkList.Add(blk);
                }
            }//end of foreach (int blkID in route.BlockIDList)
            if (0 != dstSigIDs.Count)
            {
                TraceMethod.RecordInfo($"route {route.Info} split error, some signal can't get splited route, such as signalID[{dstSigIDs[0]}]\n");
                return(false);
            }
            return(true);
        }
Ejemplo n.º 2
0
        public JsonResult tbtype()
        {
            SyDB db    = new SyDB();
            var  query = db.TypeList
                         .Select(p => new { p.TypID, p.TypName });

            return(Json(new { aaData = query }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public JsonResult Tlist()
        {
            SyDB db    = new SyDB();
            var  query = db.ItmList.Where(x => x.ItmType == 1 && x.IsActive == true)
                         .Select(p => new { p.ItemID, p.ItmName, p.ItmPrice });

            return(Json(new { aaData = query }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 4
0
        public JsonResult syrianmfunk()
        {
            SyDB db    = new SyDB();
            var  query = db.OrdList.Where(x => x.SyianM == true)
                         .Select(p => new { p.OrdID, p.GuestName, p.Address, p.TelNum, p.Mob });

            return(Json(new { aaData = query }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 5
0
        public UpstreamPointConfig(BEACON beacon, string dir, int len, SyDB sydb)
        {
            this.Beacon = beacon;
            this.Dir    = dir;

            //BMGR-0037  MAX_TRAIN_LENGTH + beacon.BeaconTolID
            this.Length = len + this.GetBeaconPTDistance(beacon.m_layoutInfo.BeaconTolID);
            this.Sydb   = sydb;
        }
Ejemplo n.º 6
0
        public JsonResult Totfuc(int?id)
        {
            SyDB db    = new SyDB();
            var  query = db.orditm
                         .Where(p => p.createdate == DateTime.Today)
                         .Sum(c => (decimal?)c.totval) ?? 0;

            return(Json(query, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 7
0
        public JsonResult Ordpk()
        {
            SyDB db = new SyDB();
            var  m  = db.OrdList.ToList().LastOrDefault().OrdID;

            //var query = db.OrdList.Where(x => x.OrdID == m )
            //    .Select(s => s.GuestName);
            return(Json(m, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 8
0
        public JsonResult eddguest(int?id)
        {
            SyDB db = new SyDB();

            var query = db.vOrdList.Where(z => z.shitfk == id)
                        .Select(q => new { q.OrdID, q.OrderFk, q.GuestName, q.IsActive });

            return(Json(new { aaData = query }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 9
0
        public JsonResult Totfuck(int?id)
        {
            SyDB db    = new SyDB();
            var  query = db.orditm
                         .Where(p => p.ordfk == id)
                         .Sum(c => (decimal?)c.totval) ?? 0;

            return(Json(query, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 10
0
        public JsonResult ORDmob()
        {
            SyDB db    = new SyDB();
            var  m     = db.OrdList.ToList().LastOrDefault().OrdID;
            var  query = db.OrdList.Where(x => x.OrdID == m)
                         .Select(s => s.Mob);

            return(Json(query, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 11
0
        public JsonResult cashrpt(int?id)
        {
            SyDB db = new SyDB();

            var query = db.vcashrp.Where(z => z.shid == id).
                        Select(q => new { q.itmid, q.ItmName, q.totval });

            return(Json(new { aaData = query }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 12
0
        /// <summary>
        /// get the distance of beacon and nearest sddb in beacon direction
        /// unit: cm( sydb kp data is cm)
        /// </summary>
        /// <param name="beacon"></param>
        /// <returns></returns>
        private int CalBeacon2SDDB(BEACON beacon)
        {
            GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK beaconBlk = SyDB.GetLocatedBlock(beacon.m_layoutInfo.kp, beacon.m_layoutInfo.TrackID);

            if (null == beaconBlk)
            {
                TraceMethod.Record(TraceMethod.TraceKind.ERROR, $"Beacon {beacon.Info} type={beacon.m_ibbmInfo.GetBeaconType()} find beacon located block get null, can't get BMB_SDDB_distance");
                return(0);
            }
            //calculate length from beacon to beacon located Blk end
            string dir    = beacon.m_ibbmInfo.Direction;
            int    length = Sys.GetSDDBLenOfLocatedBlock(beacon.m_layoutInfo.kp, beaconBlk, dir);

            if (Sys.GetSDDBPosInLocatedBlock(beaconBlk, dir) == Sys.SddbInBlock.end)
            {
                return(length);
            }

            //calculate length from beaconBlk end to SDDB //only sddb and beacon in different blk will do this
            int nextBlkID = -1;

            GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK curBlk = beaconBlk;
            while (true)
            {
                if (curBlk.Is_Direction_Opposite.Equals(true))
                {
                    dir = SyDB.GetReverseDir(dir);
                }
                nextBlkID = SyDB.GetNextBlkID(curBlk, dir);
                if (nextBlkID == -1)
                {
                    TraceMethod.RecordInfo($"{curBlk.Info} search next block in {dir} occer convergent point,Error:Beacon {beacon.Info} type={beacon.m_ibbmInfo.GetBeaconType()} can't get BMB_SDDB_distance.");
                    return(0);
                }
                var nextBlk = (GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK)Sys.GetNode(nextBlkID, sydb.blockInfoList.Cast <Node>().ToList());
                if (null == nextBlk)
                {
                    TraceMethod.RecordInfo($"{curBlk.Info} search next block in {dir} get null,Error:Beacon {beacon.Info} type={beacon.m_ibbmInfo.GetBeaconType()} can't get BMB_SDDB_distance");
                    return(0);
                }

                Sys.SddbInBlock sddbInWalk = Sys.SddbWalkThroughBlock(nextBlk, dir);
                if (Sys.SddbInBlock.none != sddbInWalk)
                {
                    if (Sys.SddbInBlock.end == sddbInWalk)
                    {
                        length += nextBlk.GetBlockLen();
                    }
                    break;
                }

                length += nextBlk.GetBlockLen();
                curBlk  = nextBlk;
            }
            return(length);
        }
Ejemplo n.º 13
0
        public JsonResult Totfuc(int?id)
        {
            SyDB db = new SyDB();
            var  mx = db.Shft
                      .Count();
            var query = db.vOrdList
                        .Where(p => p.shitfk == mx && p.IsActive == true)
                        .Sum(c => (decimal?)c.totval) ?? 0;

            return(Json(query, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 14
0
        public JsonResult adacount(string expnme)
        {
            SyDB    db = new SyDB();
            var     ca = db.ExpList.ToList().LastOrDefault().ExpID + 1;
            ExpList bi = new ExpList();

            bi.ExpID    = ca;
            bi.ExpName  = expnme;
            bi.IsActive = true;
            db.ExpList.Add(bi);
            db.SaveChanges();
            return(Json(new { Success = true }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 15
0
        public JsonResult addexp(int idexp, DateTime exdate, decimal expval, string remrk)
        {
            SyDB     db = new SyDB();
            var      ca = db.ExpDaily.ToList().LastOrDefault().Ser + 1;
            ExpDaily bi = new ExpDaily();

            bi.Ser     = ca;
            bi.ExpID   = idexp;
            bi.ExpVal  = expval;
            bi.ExpDate = exdate;
            bi.Remark  = remrk;
            db.ExpDaily.Add(bi);
            db.SaveChanges();
            return(Json(new { Success = true }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 16
0
        protected override bool AuthorizeCore(HttpContextBase httpContext)
        {
            bool authorize = false;

            using (SyDB db = new SyDB())
            {
                CoreManager UM = new CoreManager();
                foreach (var roles in userAssignedRoles)
                {
                    authorize = UM.IsUserInRole(httpContext.User.Identity.Name.Split('|')[0], roles);
                    if (authorize)
                    {
                        return(authorize);
                    }
                }
            }
            return(authorize);
        }
Ejemplo n.º 17
0
        public JsonResult ordp(int?id)
        {
            SyDB db = new SyDB();

            if (id == null)
            {
                // id = db.OrdList.LastOrDefault().OrdID ;
                var h = db.OrdList.Max(b => (int?)b.OrdID);

                var query = db.orditm.Where(x => x.ordfk == h)
                            .Select(p => new { p.ser, p.ItmList.ItmName, p.price, p.qty, p.totval });
                return(Json(new { aaData = query }, JsonRequestBehavior.AllowGet));
            }
            {
                var query = db.orditm.Where(x => x.ordfk == id)
                            .Select(p => new { p.ser, p.ItmList.ItmName, p.price, p.qty, p.totval });
                return(Json(new { aaData = query }, JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 18
0
        public JsonResult aditm(int itmfk, int ordfk, decimal pr, int shi, int cby)
        {
            SyDB db = new SyDB();
            var  ca = db.orditm.ToList().LastOrDefault().ser + 1;
            //     var dk = db.OrdList.Where(x => x.shitfk == shvt).s + 1;
            //var ddd = db.OrdList.Where(x => x.shitfk == shvt).Max(b => (int?)b.OrderFk) + 1 ?? 1;
            orditm bi = new orditm();

            bi.ser        = ca;
            bi.ordfk      = ordfk;
            bi.itemfk     = itmfk;
            bi.price      = pr;
            bi.qty        = 1;
            bi.totval     = pr * 1;
            bi.createdate = DateTime.Now;
            bi.shid       = shi;
            bi.createby   = cby;
            db.orditm.Add(bi);
            db.SaveChanges();
            return(Json(new { Success = true }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 19
0
        public JsonResult adORD(string gsname, int shvt, string address, string tel, string mob, bool?syrim)
        {
            SyDB    db  = new SyDB();
            var     ca  = db.OrdList.ToList().LastOrDefault().OrdID + 1;
            var     ddd = db.OrdList.Where(x => x.shitfk == shvt).Max(b => (int?)b.OrderFk) + 1 ?? 1;
            OrdList bi  = new OrdList();

            bi.OrdID     = ca;
            bi.shitfk    = shvt;
            bi.GuestName = gsname;
            bi.OrdDate   = DateTime.Now;
            bi.OrderFk   = ddd;
            bi.IsActive  = true;
            bi.Address   = address;
            bi.TelNum    = tel;
            bi.Mob       = mob;
            bi.SyianM    = syrim;
            db.OrdList.Add(bi);
            db.SaveChanges();
            return(Json(new { Success = true }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 20
0
        public JsonResult adORD(string gsname, int shvt)
        {
            SyDB db = new SyDB();
            var  ca = db.OrdList.ToList().LastOrDefault().OrdID + 1;
            //     var dk = db.OrdList.Where(x => x.shitfk == shvt).s + 1;
            var ddd = db.OrdList.Where(x => x.shitfk == shvt).Max(b => (int?)b.OrderFk) + 1 ?? 1;



            OrdList bi = new OrdList();

            bi.OrdID     = ca;
            bi.shitfk    = shvt;
            bi.GuestName = gsname;
            bi.OrdDate   = DateTime.Now;
            bi.OrderFk   = ddd;
            bi.IsActive  = true;
            db.OrdList.Add(bi);
            db.SaveChanges();
            return(Json(new { Success = true }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 21
0
        private void Generate()
        {
            try
            {
                beaconList.Clear();
                leuList.Clear();
                SyDB.GetInstance().clear();

                if (false == clearOutputDir())
                {
                    return;
                }
                //log is updating
                {
                    IDataGen.toolVer = this.Text;
                    GENERIC_SYSTEM_PARAMETERS sydb = FileLoader.Load <GENERIC_SYSTEM_PARAMETERS>(this.textBoxSyDB.Text);
                    SyDB.GetInstance().LoadData(sydb);

                    IDataGen.sydbFile = this.textBoxSyDB.Text;//todo will delete
                }

                {
                    IDataGen gen         = null;
                    string   compilepath = currentRunDir + "\\compiler\\CompilerBaliseV4000\\main\\compile.exe";
                    gen = new BFGen(this.textBoxLayout.Text, this.textBoxBoundaryBeacon.Text, compilepath, this.radioButtoniTC.Checked, this.checkBoxGenBin.Checked);
                    ((BFGen)gen).genPro += new BFGen.GenProess(GenProess);
                    if (false == gen.Generate(this.textBoxOutput.Text))
                    {
                        return;
                    }
                }

                {
                    IDataGen gen = null;
                    gen = new BMVFGen(this.radioButtoniTC.Checked && this.Upstream_path_considered.Checked,
                                      ref beaconList,
                                      ref leuList,
                                      this.textBox_UpstreamFile.Text);

                    if (false == gen.Generate(this.textBoxOutput.Text))
                    {
                        return;
                    }
                }

                {
                    IDataGen gen = null;
                    gen = new LEURFGen(ref beaconList, ref leuList);
                    if (false == gen.Generate(this.textBoxOutput.Text))
                    {
                        return;
                    }
                }

                {
                    IDataGen gen       = null;
                    string   LEURFFile = this.textBoxOutput.Text + "\\LEU\\LEU_Result_Filtered_Values.xml";

                    gen = new LEUXmlGen(leuList, LEURFFile, currentRunDir, this.radioButtoniTC.Checked, this.checkBoxGenBin.Checked);
                    ((LEUXmlGen)gen).genPro += new LEUXmlGen.GenProess(GenProess);
                    if (false == gen.Generate(this.textBoxOutput.Text))
                    {
                        return;
                    }
                }
            }
            finally
            {
                IsBusy = false;
            }
        }
Ejemplo n.º 22
0
 public RouteSegConfig(SyDB sydb)
 {
     this.Sydb = sydb;
     m_RouteSpacing_routeLst = new List <RouteSegment>();
     m_Spacing_routeLst      = new List <RouteSegment>();
 }