Exemplo n.º 1
0
 /// <summary>
 /// 通过设备编号获得轨迹,也就是说有几个加锁记录,查询就有几条记录
 /// </summary>
 /// <param name="sbbh"></param>
 /// <param name="jssj"></param>
 /// <returns></returns>
 public string GetGJStr(string sbbh, string jssj)
 {
     try
     {
         string    sql = string.Format("select * from FDS_GJB t where t.sbbh='{0}' and t.dwsj >= to_date('{1}','yyyy/mm/dd hh24:mi:ss') order by t.dwsj", sbbh, jssj);
         List <GJ> gjs = gjDal.Select(sql);
         int       num = gjs.Count;
         if (num == 0)
         {
             throw new Exception("轨迹表里无记录!");
         }
         string ret = "";
         for (int i = 0; i < num; i++)
         {
             GJ gj = gjs[i];
             ret += gj.DWSJ + ',' + gj.JD + ',' + gj.WD;
             if (i != num - 1)
             {
                 ret += ';';
             }
         }
         return(ret);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// 插入已load的gj点,若空则是已load
 /// </summary>
 /// <returns></returns>
 public void Insert(GJ gj)
 {
     try
     {
         string sql = string.Format("insert into FDS_GJB(ID,DWSJ,DWDD,JD,WD,DWZT,DY,SBBH) values('{0}',to_date('{1}','yyyy/mm/dd hh24:mi:ss'),'{2}','{3}','{4}','{5}','{6}','{7}')",
                                    gj.ID, gj.DWSJ, gj.DWDDID, gj.JD, gj.WD, gj.DWZT, gj.DY, gj.SBBH);
         gjDal.Insert(sql);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 3
0
        private GJ LoadEntity(DataRow dr)
        {
            GJ gj = new GJ();

            gj.ID   = dr["ID"].ToString();
            gj.DWSJ = dr["DWSJ"].ToString();
            gj.JD   = dr["JD"].ToString();
            gj.WD   = dr["WD"].ToString();

            gj.DWZT   = dr["DWZT"].ToString();
            gj.DWDDID = dr["DWDD"].ToString();
            gj.DY     = dr["DY"].ToString();
            gj.SBBH   = dr["SBBH"].ToString();

            return(gj);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 拿最新轨迹点去更新加锁表(注意预加锁状态不更新状态...),根据锁号来查询的
        /// </summary>
        /// <param name="gj"></param>
        /// <returns></returns>
        public void UpdateByGJAndGetJS2(GJ gj, ref string preZTBJ, ref JS js)
        {
            /*
             * zxjd jd
             * zxwd wd
             * zxsj dwsj
             * zxdy dy
             * zxdd dwdd
             * ztbj dwzt
             */
            try
            {
                js = SelectBySBBH(gj.SBBH);

                preZTBJ = js.ZTBJ;

                #region 如果处于预加锁状态,不更新状态
                string jsState;
                if (preZTBJ == JS.yjs)
                {
                    jsState = preZTBJ;
                }
                else
                {
                    jsState = GJStateToJSState(gj.DWZT);
                }
                #endregion

                string sql = string.Format("update FDSGLXT_JSJLB set zxjd='{0}',zxwd='{1}',zxsj=to_date('{2}','yyyy/mm/dd hh24:mi:ss'),zxdd='{3}',zxddid='{4}',ztbj='{5}',zxdy='{6}' where sbbh='{7}'",
                                           gj.JD, gj.WD, gj.DWSJ, gj.DWDD, gj.DWDDID, jsState, gj.DY, gj.SBBH);

                jsDal.Update(sql);

                //更新js状态
                js.ZTBJ   = jsState;
                js.ZXJD   = gj.JD;
                js.ZXWD   = gj.WD;
                js.ZXSJ   = gj.DWSJ;
                js.ZXDD   = gj.DWDD;
                js.ZXDDID = gj.DWDDID;
                js.ZXDY   = gj.DY;
            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 5
0
 public GJ LoadGJ(string str)
 {
     try
     {
         string[] strs = str.Split(' ');
         GJ       gj   = new GJ();
         gj.ID   = Guid.NewGuid().ToString();
         gj.SBBH = strs[0];
         gj.DWZT = strs[1];
         gj.DWSJ = strs[2] + " " + strs[3];
         gj.JD   = strs[4];
         gj.WD   = strs[5];
         gj.DY   = "5";
         //gj.DWDD = positionService.GetNear(Convert.ToDouble(gj.JD), Convert.ToDouble(gj.WD));
         return(gj);
     }
     catch (Exception e)
     {
         throw new Exception(e.Message + " 载入轨迹点失败!");
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// 通过设备编号获得轨迹,也就是说有几个加锁记录,查询就有几条记录
 /// </summary>
 /// <param name="sbbh"></param>
 /// <param name="jssj"></param>
 /// <returns></returns>
 public string GetGJStr(string sbbh, string jssj)
 {
     try
     {
         List <GJ> gjs = GetGJS(sbbh, jssj);
         int       num = gjs.Count;
         string    ret = "";
         for (int i = 0; i < num; i++)
         {
             GJ gj = gjs[i];
             ret += gj.DWSJ + ',' + gj.JD + ',' + gj.WD;
             if (i != num - 1)
             {
                 ret += ';';
             }
         }
         return(ret);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 7
0
        public void Oper(string sp = "")
        {
            try
            {
#if debug
                GJ gj = new GJ();
                gj.JD   = "100";
                gj.WD   = "100";
                gj.ID   = Guid.NewGuid().ToString();
                gj.SBBH = "sbbh";
                gj.DWSJ = DateTime.Now.ToString();
                gj.DWZT = GJ.gjState.j.ToString();
                gj.DY   = "dy";
#else
                GJ gj = gjService.LoadGJ(sp);
#endif
                //插入解析数据于数据库
                gj.DWDDID = positionService.GetNear(Convert.ToDouble(gj.JD), Convert.ToDouble(gj.WD));
                gjService.Insert(gj);

                //根据轨迹点更新加锁表. 注意:加锁表需要存在
                JS     js      = null;
                string preZTBJ = null;
#if debug
#else
                jsService.UpdateByGJAndGetJS2(gj, ref preZTBJ, ref js);
#endif
                //加锁
                if (gj.DWZT == GJ.js)
                {
                    //获得id
                    //给手机sjh,发送: sh已经加在ch上
                    //调用发出外网...再短信服务...
                    //string sjh = czryService.GetSJHFromID(js.HQHYYID);
                    //string sh = js.SH;
                    //string ch = js.CH;
                    //string str = sjh + " " + sh + " " + ch + " 加锁";
                    //LogService.Mess(str, @"c:\IntranetService");
                    //dxService.Insert(js.HQHYYID, gj.DWSJ, str, DX.js);
                }
                // 破锁,未预先确认破锁就破了
                else if (preZTBJ != JS.cs && gj.DWZT == GJ.ps)
                {
                    //string sjh1 = czryService.GetSJHFromID(js.CZID);
                    //string sjh2 = czryService.GetSJHFromID(js.HYZRID);
                    string sh = js.SH;
                    string ch = js.CH;

                    //string str = sjh1 + " " + sh + " " + ch + " 破锁";
                    //LogService.Mess(str, @"c:\IntranetService");
                    //dxService.Insert(js.CZID, gj.DWSJ, str, DX.ps);
                    //str = sjh2 + " " + sh + " " + ch + " 破锁";
                    //LogService.Mess(str, @"c:\IntranetService");
                    //dxService.Insert(js.HYZRID, gj.DWSJ, str, DX.ps);

                    //取出轨迹点,组合成历史记录...

                    string gjStr = gjService.GetGJStr(js.SBBH, js.JSSJ);

                    //更新将其跟新为一个新的历史记录...

                    jslsService.Insert(js, gjStr);

                    //将破锁信息存储...补封操作更新新锁号信息,状态标记为加锁

                    //psService.Insert(gj.DWSJ, gj.DWDDID);
                }
                //确认拆锁
                else if (preZTBJ == JS.cs && gj.DWZT == GJ.ps)
                {
                    //取出轨迹点,组合成历史记录...

                    string gjStr = gjService.GetGJStr(js.SBBH, js.JSSJ);

                    //更新将其跟新为一个新的历史记录...

                    jslsService.Insert(js, gjStr);

                    // 直接删了...
                    jsService.XiaoHao(js.SBBH);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                LogService.Mess(e.Message, @"c:\fwException");
            }
        }
Exemplo n.º 8
0
    void Update()
    {
        if (Input.GetMouseButtonDown(0) && !but0Pressed)
        {
            but0Pressed = true;

            if (selectedObject != null)
            {
                selectedObject.GetComponent <Renderer>().material.color = Color.white;
            }

            selectedObject = null;

            Vector3 mp = getAbsMousePos();

            Vector3 relPos = new Vector3(0, 0, 0);

            if (VirusPlayer)
            {
                foreach (GameObject GJ in GameObject.FindGameObjectsWithTag("Virus"))
                {
                    relPos = mp - GJ.transform.position;
                    if (Math.Abs(relPos.x) < selectingDistance && Math.Abs(relPos.z) < selectingDistance)
                    {
                        selectedObject = GJ;
                        GJ.GetComponent <Renderer>().material.color = Color.red;
                        break;
                    }
                }
            }
            else
            {
                foreach (GameObject GJ in GameObject.FindGameObjectsWithTag("WBC"))
                {
                    relPos = mp - GJ.transform.position;
                    if (Math.Abs(relPos.x) < selectingDistance && Math.Abs(relPos.z) < selectingDistance)
                    {
                        selectedObject = GJ;
                        GJ.GetComponent <Renderer>().material.color = Color.red;
                        break;
                    }
                }
            }
        }
        else
        {
            but0Pressed = false;
        }

        if (Input.GetMouseButtonDown(1) && selectedObject != null)
        {
            /*bool found = false;
             * for (int i = 0; i < movements.Count; i++)
             * {
             *  if (movements[i].GJ == selectedObject)
             *  {
             *      Vector3 mousePos = getAbsMousePos();
             *
             *      movements[i] = new Movement(mousePos, movements[i].GJ, movements[i].speed);
             *      NC.messages.Add(new ClickOrder(1, mousePos.x, mousePos.z));
             *      found = true;
             *      break;
             *  }
             * }
             *
             * if (!found && selectedObject != null)
             * {
             *  Vector3 mousePos = getAbsMousePos();
             *
             *  movements.Add(new Movement(mousePos, selectedObject, moveSpeed));
             *  NC.messages.Add(new ClickOrder(1, mousePos.x, mousePos.z));
             * }*/

            Vector3 mousePos = getAbsMousePos();
            foreach (Dictionary <int, CellGJ> dict in GameObject.Find("Spawner").GetComponent <NetworkConnection>().CellList)
            {
                foreach (KeyValuePair <int, CellGJ> entry in dict)
                {
                    if (GameObject.ReferenceEquals(entry.Value.GJ, selectedObject))
                    {
                        GameObject.Find("Spawner").GetComponent <NetworkConnection>().messages.Add(new ClickOrder(entry.Value.id, mousePos.x, mousePos.z));
                    }
                }
            }
        }
    }