|
@@ -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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|