gongqiuhong 1 жил өмнө
parent
commit
15eb76e2ea

+ 54 - 0
XdCxRhDW.App/Controllers/TxController.cs

@@ -0,0 +1,54 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Data.Entity;
+using System.Data.Entity.Migrations;
+using System.Data.SqlClient;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Web.Http;
+using XdCxRhDw.Dto;
+using XdCxRhDW.Api;
+using XdCxRhDW.Dto;
+using XdCxRhDW.Entity;
+using XdCxRhDW.Repostory;
+using XdCxRhDW.WebApi;
+
+namespace XdCxRhDW.App.Controllers
+{
+    /// <summary>
+    /// 天线信息接口
+    /// </summary>
+    public class TxController : BaseController
+    {
+        /// <summary>
+        /// 获取天线信息(Item1:接收站,Item2:超短波,Item3:测向站,Item4:参考站)
+        /// </summary>
+        /// <returns></returns>
+        [HttpGet]
+        public async Task<AjaxResult<(TxInfo recTx, TxInfo cdbTx, TxInfo cxTx, TxInfo refLoc)>> GetTxInfoAsync()
+        {
+            (TxInfo recTx, TxInfo cdbTx, TxInfo cxTx, TxInfo refLoc) txInfo;
+            try
+            {
+                using (RHDWContext db = new RHDWContext())
+                {
+                    List<TxInfo> list = await db.TxInfos.ToListAsync();
+                    var recTx = list.Find(p => p.TxType == EnumTxType.Rec);
+                    var cdbTx = list.Find(p => p.TxType == EnumTxType.Cdb);
+                    var cxTx = list.Find(p => p.TxType == EnumTxType.Cx);
+                    var refLoc = list.Find(p => p.TxType == EnumTxType.Ref);
+                    txInfo = ValueTuple.Create(recTx, cdbTx, cxTx, refLoc);
+                }
+            }
+            catch (Exception ex)
+            {
+                return Error<(TxInfo, TxInfo, TxInfo, TxInfo)>($"查询天线信息异常,{ex.Message}");
+            }
+
+            return Success<(TxInfo, TxInfo, TxInfo, TxInfo)>(txInfo);
+        }
+    }
+}

+ 3 - 0
XdCxRhDW.App/MainForm.cs

@@ -23,6 +23,9 @@ using XdCxRhDW.Dto;
 using XdCxRhDW.Entity;
 using XdCxRhDW.Repostory;
 using XdCxRhDW.Api;
+using System.Net.Http;
+using XdCxRhDW.App.App.Properties;
+using System.Windows.Documents;
 
 namespace XdCxRhDW
 {

+ 1 - 0
XdCxRhDW.App/XdCxRhDW.App.csproj

@@ -133,6 +133,7 @@
     <Compile Include="Controllers\FileController.cs" />
     <Compile Include="Controllers\PosController.cs" />
     <Compile Include="Controllers\SvrReportController.cs" />
+    <Compile Include="Controllers\TxController.cs" />
     <Compile Include="Controllers\XlController.cs" />
     <Compile Include="CorTools\GpuCalcForm.cs">
       <SubType>Form</SubType>