Example #1
0
    private void setText(WellInfo well, WellInfo newWell)
    {
        string WellNumber = string.Format("{0:0000}", 1000 * UnityEngine.Random.value);

        if (well.gasNum)
        {
            well.gasNum.text = string.Format("{0:0,0}", newWell.gas);
        }
        if (well.oilNum)
        {
            well.oilNum.text = string.Format("{0:0,0}", newWell.oil);
        }
        if (well.waterNum)
        {
            well.waterNum.text = string.Format("{0:0,0}", newWell.water);
        }
        if (well.wellNam)
        {
            well.wellNam.text = string.Format("WELL HB{0}", WellNumber);
        }
        if (well.wellDepth)
        {
            well.wellDepth.text = decimal.Parse(newWell.depth).ToString("N") + " mts";
        }
    }
Example #2
0
        public WellInfo[] GetWells(string areaName)
        {
            var wells = new List <WellInfo>();

            for (var ii = 0; ii < s_WellUIDs.Length; ii++)
            {
                var well = new WellInfo {
                    Id   = s_WellUIDs[ii],
                    Name = s_WellUIDs[ii]
                };

                if (s_WellNames.Length > ii)
                {
                    var index = s_WellNames[ii].LastIndexOf('/');

                    if (index >= 0)
                    {
                        if (s_WellNames[ii].Substring(0, index) == areaName)
                        {
                            well.Name = s_WellNames[ii].Substring(index + 1);
                            wells.Add(well);
                        }
                    }
                }
            }

            return(wells.ToArray());
        }
        private void PrintWellInfo(WellInfo wi)
        {
            var entryText = $"Well: {wi.WellName}, File Number: {wi.FileNumber}";

            if (wi.ParentWell != null)
            {
                entryText += $", Parent Well = {wi.ParentWell.WellName}";
            }
            PrintInfo(entryText);
            foreach (var pvi in wi.PlanVersionList)
            {
                var planText =
                    $"\tPlan: {pvi.PlanName}, Version: {pvi.VersionName}, Date: {pvi.CreationDate.ToShortDateString()}, {ReplaceNewlines(pvi.Comment," ")}";

                if (pvi.IsDefinitivePlan)
                {
                    planText += " (Definitive Plan)";
                }
                if (pvi.IsCurrentPlan)
                {
                    planText += " (Current Plan)";
                }
                PrintInfo(planText);
            }
        }
Example #4
0
        /// <summary>
        /// 修改人井信息
        /// </summary>
        public int UpdateWellInfo(WellInfo wellInfo)
        {
            DynamicParameters parm = new DynamicParameters();

            parm.Add("@Name", wellInfo.Name);
            parm.Add("@Longitude", wellInfo.Longitude);
            parm.Add("@Latitude", wellInfo.Latitude);
            parm.Add("@Place", wellInfo.Place);
            parm.Add("@Operator_ID", wellInfo.Operator_ID);
            parm.Add("@Terminal_Phone", wellInfo.Terminal_Phone);
            parm.Add("@Terminal_ID", wellInfo.Terminal_ID);
            using (Conn)
            {
                return(Conn.Execute(update_WellInfo_Terminal_ID, parm));
            }
        }
Example #5
0
    public void ShowPanel(EnumWellType wellType, WellInfo wellInfo)
    {
        if (!canShow)
        {
            return;
        }

        switch (wellType)
        {
        case EnumWellType.None:
            break;

        case EnumWellType.Default:
            setPosition(defaultPanel.gameObject, wellInfo.gameObject);
            setText(defaultPanel, wellInfo);
            defaultPanel.gameObject.SetActive(true);
            break;

        case EnumWellType.Drilling:
            setPosition(drillPanel.gameObject, wellInfo.gameObject);
            setText(drillPanel, wellInfo);
            drillPanel.gameObject.SetActive(true);
            break;

        case EnumWellType.WorkOver:
            setPosition(workoverPanel.gameObject, wellInfo.gameObject);
            setText(workoverPanel, wellInfo);
            workoverPanel.gameObject.SetActive(true);
            break;

        case EnumWellType.Abandoned:
            setPosition(abandonedPanel.gameObject, wellInfo.gameObject);
            setText(abandonedPanel, wellInfo);
            abandonedPanel.gameObject.SetActive(true);
            break;
        }
    }
Example #6
0
        /// <summary>
        /// EditWellInfoForm
        /// </summary>
        /// <param name="terminal_ID">人井编号</param>
        /// <param name="isInsert">是否是添加</param>
        /// <param name="isaddMaker">是否是在地图上添加</param>
        /// <param name="menuPositon">在地图上添加时经纬度</param>
        public EditWellInfoForm(string terminal_ID, bool isInsert, bool isaddMaker, string menuPositon)
        {
            InitializeComponent();
            wellInfo.Terminal_ID = terminal_ID;
            _isInsert            = isInsert;

            cbState.DataSource    = wellStateService.GetWellStateInfo();
            cbOperator.DataSource = userService.GetOperator();
            if (isInsert)
            {
                if (isaddMaker)
                {
                    txtLongitude.Text = menuPositon.Split(',')[0];
                    txtLatitude.Text  = menuPositon.Split(',')[1];
                }
                this.Text = "添加数据";
                this.Icon = new Icon("resource/images/add.ico");
            }
            else
            {
                this.Text = "更新数据";
                this.Icon = new Icon("resource/images/update.ico");
                txtTerminal_ID.Enabled = false;
                wellInfo = wellInfoService.GetWellInfoByTerminal_ID(wellInfo.Terminal_ID);

                txtTerminal_ID.Text    = wellInfo.Terminal_ID;
                txtName.Text           = wellInfo.Name;
                txtLongitude.Text      = wellInfo.Longitude;
                txtLatitude.Text       = wellInfo.Latitude;
                txtPlace.Text          = wellInfo.Place;
                txtTerminal_Phone.Text = wellInfo.Terminal_Phone;
                cbState.Text           = wellInfo.WellStateInfo.State;
                cbOperator.Text        = wellInfo.OperatorInfo.RealName;
                tbReportInterval.Text  = wellInfo.ReportNumInfo.ReportInterval.ToString();
            }
        }
Example #7
0
 public static void GetSMSHandle()
 {
     Task.Run(() =>
     {
         while (true)
         {
             if (CDMASMS.queue.Count > 0)
             {
                 int num    = CDMASMS.queue.Dequeue();
                 string sms = CDMASMS.ReadMsgByIndex(num);
                 if (sms != null)
                 {
                     string[] str = sms.Split(';');
                     wellCurrentStateInfo.Report_Time = DateTime.ParseExact(str[1].Trim(), "yyyyMMddHHmmss", CultureInfo.CurrentCulture).ToString("yyyy/MM/dd HH:mm:ss");
                     SMSAnalysis.MsgResult(str[2].Trim());
                     if (SMSAnalysis.isInvalid == true)
                     {
                         Process.GetCurrentProcess().CloseMainWindow();
                         return;
                     }
                     if (SMSAnalysis.isInvalid == false)
                     {
                         Process.GetCurrentProcess().CloseMainWindow();
                         return;
                     }
                     else
                     {
                         wellInfo = wellInfoService.GetWellInfoByPhone(str[0].Trim());
                         if (wellInfo.WellCurrentStateInfo.Well_State_ID == 6)
                         {
                             LogHelper.WriteLog("人井维护。ID:" + wellInfo.Terminal_ID);
                             return;
                         }
                         else
                         {
                             ShowMessageForm.ShowForm();
                             //人井打开
                             if (SMSAnalysis.IsOpen)
                             {
                                 wellCurrentStateInfo.Well_State_ID = 2;
                                 UpdateWellCurrentState();
                                 UpdateAlarmInfo();
                                 if (getSMSDelegate != null)
                                 {
                                     getSMSDelegate();
                                 }
                             }
                             else//人井关闭
                             {
                                 //终端低电量报警
                                 if (SMSAnalysis.IsElectricityAlarm)
                                 {
                                     wellCurrentStateInfo.Well_State_ID = 3;
                                     UpdateWellCurrentState();
                                     UpdateAlarmInfo();
                                     if (getSMSDelegate != null)
                                     {
                                         getSMSDelegate();
                                     }
                                 }
                                 //烟感报警
                                 if (SMSAnalysis.IsSmokeAlarm)
                                 {
                                     wellCurrentStateInfo.Well_State_ID = 4;
                                     UpdateWellCurrentState();
                                     UpdateAlarmInfo();
                                     if (getSMSDelegate != null)
                                     {
                                         getSMSDelegate();
                                     }
                                 }
                                 //烟感电量报警
                                 if (SMSAnalysis.IsSmoke_PowerAlarm)
                                 {
                                     wellCurrentStateInfo.Well_State_ID = 5;
                                     UpdateWellCurrentState();
                                     UpdateAlarmInfo();
                                     if (getSMSDelegate != null)
                                     {
                                         getSMSDelegate();
                                     }
                                 }
                                 else
                                 {
                                     wellCurrentStateInfo.Well_State_ID = 1;
                                     UpdateWellCurrentState();
                                 }
                             }
                             InsertSystemLogInfo();
                             UpdateMap(wellInfo.Terminal_ID);
                             UpdateReportNum();
                         }
                     }
                 }
                 CDMASMS.DeleteMsgByIndex(num);
             }
             else
             {
                 Thread.Sleep(3000);
             }
         }
     });
 }
Example #8
0
 /// <summary>
 /// 修改人井信息
 /// </summary>
 /// <param name="well">人井信息</param>
 /// <returns></returns>
 public int UpdateWellInfo(WellInfo wellInfo)
 {
     return(welldal.UpdateWellInfo(wellInfo));
 }
Example #9
0
 /// <summary>
 /// 增加人井信息
 /// </summary>
 public int InsertWellInfo(WellInfo wellInfo)
 {
     return(welldal.InsertWellInfo(wellInfo));
 }
Example #10
0
        private void GenerateRandWell()
        {
            for (int i = 0; i < 12; i++)
            {
                for (int j = 0; j < 9; j++)
                {
                    GameObject plane = new GameObject();
                    plane.name                    = "PlaneHolder";
                    plane.transform.parent        = m_parentRegisterPoint;
                    plane.transform.localPosition = new Vector3(i * 10, 2.5F, j * 10);
                    plane.tag = "InteractivePad";
                    bool createCubes = Random.Range(0, 10) >= 7 ? true : false;

                    EnumWellType wellType = EnumWellType.None;

                    if (createCubes)
                    {
                        int count         = 0;
                        int numberOfPoint = Random.Range(1, 2);

                        while (numberOfPoint >= count++)
                        {
                            float lastHeight   = 0f;
                            float lastPosition = 0f;
                            float posX         = Random.Range(-4, 4);
                            float posY         = Random.Range(-4, 4);
                            float height       = Random.Range(2, 10);

                            lastHeight = height;
                            List <float>    sizes         = new List <float>();
                            List <Renderer> cubeRenderers = new List <Renderer>();

                            GameObject cubeHolder = new GameObject();
                            cubeHolder.name                    = "CubeHolder";
                            cubeHolder.tag                     = "InteractiveField";
                            cubeHolder.transform.parent        = plane.transform;
                            cubeHolder.transform.localPosition = new Vector3(posX, 0, posY);

                            OutlineDisplay oD = cubeHolder.AddComponent <OutlineDisplay>();
                            oD.enabled = false;
                            if (useNewOutlineSystem)
                            {
                                oD.enabled = true;
                                oD.displayWhenMouseOver = true;
                                oD.lOutline             = new List <Outline>();
                            }

                            bool isWellProducing = Random.Range(0, 10) >= 4 ? true : false;

                            if (isWellProducing)
                            {
                                wellType = EnumWellType.Default;
                                for (int k = 0; k <= 2; k++)
                                {
                                    float rndHeight = Random.Range(0, lastHeight);
                                    sizes.Add(rndHeight);

                                    GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
                                    Destroy(cube.GetComponent <Collider>());

                                    cube.transform.parent        = cubeHolder.transform;
                                    cube.transform.localPosition = new Vector3(0, lastPosition + rndHeight, 0);

                                    cube.transform.localScale = new Vector3(2, rndHeight, 2);

                                    Renderer renderer = cube.GetComponent <Renderer>();
                                    cubeRenderers.Add(renderer);
                                    Color randColor = Color.red;

                                    switch (k)
                                    {
                                    case 0:
                                        randColor = Color.blue;
                                        break;

                                    case 1:
                                        randColor = Color.green;
                                        break;

                                    case 2:
                                        randColor = new Color(1, 0.5f, 0);
                                        break;
                                    }
                                    renderer.material.color = randColor;
                                    renderer.material.EnableKeyword("_EMISSION");
                                    renderer.material.SetColor("_EmissionColor", randColor / 3);

                                    lastPosition = lastPosition + rndHeight * 2;
                                    lastHeight   = height - rndHeight;

                                    if (useNewOutlineSystem)
                                    {
                                        Outline ou = cube.AddComponent <Outline>();
                                        ou.enabled = false;
                                        oD.lOutline.Add(ou);
                                    }
                                }
                            }
                            else
                            {
                                bool isAbandoned = Random.Range(0, 10) > 6 ? true : false;

                                GameObject cube = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
                                Destroy(cube.GetComponent <Collider>());
                                sizes.Add(height);
                                cube.transform.parent        = cubeHolder.transform;
                                cube.transform.localPosition = new Vector3(0, height, 0);

                                cube.transform.localScale = new Vector3(2, height, 2);

                                Renderer renderer = cube.GetComponent <Renderer>();
                                cubeRenderers.Add(renderer);
                                Color randColor;

                                if (isAbandoned)
                                {
                                    randColor = Color.grey;
                                    wellType  = EnumWellType.Abandoned;
                                }
                                else
                                {
                                    bool isWorkover = Random.Range(0, 10) > 6 ? true : false;
                                    if (isWorkover)
                                    {
                                        randColor = new Color(128 / 255f, 0, 128 / 255f, 1);
                                        wellType  = EnumWellType.WorkOver;
                                    }
                                    else
                                    {
                                        randColor = Color.yellow;
                                        wellType  = EnumWellType.Drilling;
                                    }
                                }

                                renderer.material.color = randColor;
                                renderer.material.EnableKeyword("_EMISSION");
                                renderer.material.SetColor("_EmissionColor", randColor / 3);

                                if (useNewOutlineSystem)
                                {
                                    Outline ou = cube.AddComponent <Outline>();
                                    ou.enabled = false;
                                    oD.lOutline.Add(ou);
                                }
                            }

                            BoxCollider boxCol = cubeHolder.AddComponent <BoxCollider>();

                            Bounds bounds = new Bounds(Vector3.zero, Vector3.zero);
                            boxCol.center = cubeHolder.transform.position;
                            boxCol.size   = bounds.size;

                            Transform[] allDescendants = cubeHolder.GetComponentsInChildren <Transform>();
                            foreach (Transform desc in allDescendants)
                            {
                                Renderer childRenderer = desc.GetComponent <Renderer>();
                                if (childRenderer != null)
                                {
                                    bounds.Encapsulate(childRenderer.bounds);
                                }
                                boxCol.center = bounds.center - cubeHolder.transform.position;
                                boxCol.size   = bounds.size;
                            }

                            boxCol.center = new Vector3(0, boxCol.center.y, 0);
                            boxCol.size   = new Vector3(2, boxCol.size.y, 2);


                            //Well UI
                            WellBarController wellBar   = cubeHolder.AddComponent <WellBarController>();
                            WellInfo          wellInfo  = cubeHolder.AddComponent <WellInfo>();
                            GameObject        wellPanel = null;//jiji
                            switch (wellType)
                            {
                            case EnumWellType.None:
                                break;

                            case EnumWellType.Default:
                                wellPanel        = Instantiate(WellInfoDefaultPrefab);
                                wellBar.wellType = EnumWellType.Default;
                                break;

                            case EnumWellType.Drilling:
                                wellPanel        = Instantiate(WellInfoDrillingPrefab);
                                wellBar.wellType = EnumWellType.Drilling;
                                break;

                            case EnumWellType.WorkOver:
                                wellPanel        = Instantiate(WellInfoWorkoverPrefab);
                                wellBar.wellType = EnumWellType.WorkOver;
                                break;

                            case EnumWellType.Abandoned:
                                wellPanel        = Instantiate(WellInfoAbandonedPrefab);
                                wellBar.wellType = EnumWellType.Abandoned;
                                break;

                            default:
                                break;
                            }

                            if (isWellProducing)
                            {
                                wellInfo.gas   = Mathf.RoundToInt(sizes[2] * 1000).ToString();
                                wellInfo.water = Mathf.RoundToInt(sizes[1] * 1000).ToString();
                                wellInfo.oil   = Mathf.RoundToInt(sizes[0] * 1000).ToString();
                            }
                            else
                            {
                                wellInfo.gas   = "";
                                wellInfo.water = "";
                                wellInfo.oil   = "";
                                wellInfo.depth = (height * 234.3).ToString();
                            }

                            wellPanel.transform.parent = cubeHolder.transform;
                            float offset = 10;
                            wellPanel.transform.localPosition = new Vector3(0, boxCol.size.y + offset, 0);
                            wellPanel.transform.localScale    = Vector3.one * 0.1f;
                            wellPanel.gameObject.SetActive(false);

                            //Outline
                            if (!useNewOutlineSystem)
                            {
                                GameObject cubeOutline = GameObject.CreatePrimitive(PrimitiveType.Cylinder);
                                cubeOutline.name             = "cubeOutline";
                                cubeOutline.transform.parent = cubeHolder.transform;

                                float CubeSize = 0;
                                foreach (float size in sizes)
                                {
                                    CubeSize += size;
                                }

                                cubeOutline.transform.localPosition = new Vector3(0, CubeSize, 0);
                                cubeOutline.transform.localScale    = new Vector3(2, CubeSize, 2);
                                Renderer OutlineRenderer = cubeOutline.GetComponent <Renderer>();
                                OutlineRenderer.material = OutlineMat;
                                cubeOutline.SetActive(false);

                                wellBar.MainPanel       = wellPanel;
                                wellBar.BarOutline      = cubeOutline;
                                wellBar.BarRenderer     = cubeRenderers;
                                wellBar.highlightColor  = new Color(0.25f, 0.25f, 0.25f);
                                wellBar.CameraTransform = m_cameraHeightInputControl.gameObject.transform;
                            }
                        }
                    }
                }
            }
        }
Example #11
0
        public WellInfo[] GetWells(string areaName)
        {
            List<WellInfo> wells = new List<WellInfo>();

            for (int ii = 0; ii < s_WellUIDs.Length; ii++)
            {
                WellInfo well = new WellInfo();
                well.Id = s_WellUIDs[ii];
                well.Name = s_WellUIDs[ii];

                if (s_WellNames.Length > ii)
                {
                    int index = s_WellNames[ii].LastIndexOf('/');

                    if (index >= 0)
                    {
                        if (s_WellNames[ii].Substring(0, index) == areaName)
                        {
                            well.Name = s_WellNames[ii].Substring(index + 1);
                            wells.Add(well);
                        }
                    }
                }
            }

            return wells.ToArray();
        }