[后台] 修改排程, 資料對比錯誤, json增加mcut資料庫連綫

[前台] 後端修改emergencydevice api, emergencydevice model, json增加mcut資料庫連綫
This commit is contained in:
dev02 2023-06-07 16:45:00 +08:00
parent 56e18cc5a1
commit c969c24469
6 changed files with 46 additions and 31 deletions

View File

@ -86,6 +86,8 @@ namespace BackendWorkerService.Quartz.Jobs
foreach (var electricMeter in electricMeters) foreach (var electricMeter in electricMeters)
{ {
foreach (var point in electricPoints) foreach (var point in electricPoints)
{
if (electricMeter.device_building_tag == point.device_building_tag)
{ {
DeviceNumberPoint deviceNumberPoint = new DeviceNumberPoint(); DeviceNumberPoint deviceNumberPoint = new DeviceNumberPoint();
deviceNumberPoint.DeviceNumber = electricMeter.Device_number; deviceNumberPoint.DeviceNumber = electricMeter.Device_number;
@ -95,12 +97,15 @@ namespace BackendWorkerService.Quartz.Jobs
electricDeviceNumberPoints.Add(deviceNumberPoint); electricDeviceNumberPoints.Add(deviceNumberPoint);
} }
} }
}
#endregion #endregion
#region #region
List<DeviceNumberPoint> waterDeviceNumberPoints = new List<DeviceNumberPoint>(); List<DeviceNumberPoint> waterDeviceNumberPoints = new List<DeviceNumberPoint>();
foreach (var waterMeter in waterMeters) foreach (var waterMeter in waterMeters)
{ {
foreach (var point in waterPoints) foreach (var point in waterPoints)
{
if (waterMeter.device_building_tag == point.device_building_tag)
{ {
DeviceNumberPoint deviceNumberPoint = new DeviceNumberPoint(); DeviceNumberPoint deviceNumberPoint = new DeviceNumberPoint();
deviceNumberPoint.DeviceNumber = waterMeter.Device_number; deviceNumberPoint.DeviceNumber = waterMeter.Device_number;
@ -110,6 +115,7 @@ namespace BackendWorkerService.Quartz.Jobs
waterDeviceNumberPoints.Add(deviceNumberPoint); waterDeviceNumberPoints.Add(deviceNumberPoint);
} }
} }
}
#endregion #endregion
#region obix #region obix
@ -159,7 +165,6 @@ namespace BackendWorkerService.Quartz.Jobs
archiveRequest.Method = "POST"; archiveRequest.Method = "POST";
archiveRequest.Headers.Add("Authorization", "Basic " + encoded); archiveRequest.Headers.Add("Authorization", "Basic " + encoded);
archiveRequest.PreAuthenticate = true; archiveRequest.PreAuthenticate = true;
archiveRequest.Timeout = 3000;
byte[] byteArray = Encoding.UTF8.GetBytes(historyQueryFilter); byte[] byteArray = Encoding.UTF8.GetBytes(historyQueryFilter);
using (Stream reqStream = archiveRequest.GetRequestStream()) using (Stream reqStream = archiveRequest.GetRequestStream())
@ -217,7 +222,7 @@ namespace BackendWorkerService.Quartz.Jobs
archiveRequest.Method = "POST"; archiveRequest.Method = "POST";
archiveRequest.Headers.Add("Authorization", "Basic " + encoded); archiveRequest.Headers.Add("Authorization", "Basic " + encoded);
archiveRequest.PreAuthenticate = true; archiveRequest.PreAuthenticate = true;
archiveRequest.Timeout = 3000;
byte[] byteArray = Encoding.UTF8.GetBytes(historyQueryFilter); byte[] byteArray = Encoding.UTF8.GetBytes(historyQueryFilter);
using (Stream reqStream = archiveRequest.GetRequestStream()) using (Stream reqStream = archiveRequest.GetRequestStream())
@ -628,7 +633,7 @@ namespace BackendWorkerService.Quartz.Jobs
archiveRequest.Method = "POST"; archiveRequest.Method = "POST";
archiveRequest.Headers.Add("Authorization", "Basic " + encoded); archiveRequest.Headers.Add("Authorization", "Basic " + encoded);
archiveRequest.PreAuthenticate = true; archiveRequest.PreAuthenticate = true;
archiveRequest.Timeout = 3000;
byte[] byteArray = Encoding.UTF8.GetBytes(historyQueryFilter); byte[] byteArray = Encoding.UTF8.GetBytes(historyQueryFilter);
using (Stream reqStream = archiveRequest.GetRequestStream()) using (Stream reqStream = archiveRequest.GetRequestStream())
@ -685,7 +690,6 @@ namespace BackendWorkerService.Quartz.Jobs
archiveRequest.Method = "POST"; archiveRequest.Method = "POST";
archiveRequest.Headers.Add("Authorization", "Basic " + encoded); archiveRequest.Headers.Add("Authorization", "Basic " + encoded);
archiveRequest.PreAuthenticate = true; archiveRequest.PreAuthenticate = true;
archiveRequest.Timeout = 3000;
byte[] byteArray = Encoding.UTF8.GetBytes(historyQueryFilter); byte[] byteArray = Encoding.UTF8.GetBytes(historyQueryFilter);
using (Stream reqStream = archiveRequest.GetRequestStream()) using (Stream reqStream = archiveRequest.GetRequestStream())
@ -994,7 +998,6 @@ namespace BackendWorkerService.Quartz.Jobs
archiveRequest.Method = "POST"; archiveRequest.Method = "POST";
archiveRequest.Headers.Add("Authorization", "Basic " + encoded); archiveRequest.Headers.Add("Authorization", "Basic " + encoded);
archiveRequest.PreAuthenticate = true; archiveRequest.PreAuthenticate = true;
archiveRequest.Timeout = 3000;
byte[] byteArray = Encoding.UTF8.GetBytes(historyQueryFilter); byte[] byteArray = Encoding.UTF8.GetBytes(historyQueryFilter);
using (Stream reqStream = archiveRequest.GetRequestStream()) using (Stream reqStream = archiveRequest.GetRequestStream())
@ -1051,7 +1054,7 @@ namespace BackendWorkerService.Quartz.Jobs
archiveRequest.Method = "POST"; archiveRequest.Method = "POST";
archiveRequest.Headers.Add("Authorization", "Basic " + encoded); archiveRequest.Headers.Add("Authorization", "Basic " + encoded);
archiveRequest.PreAuthenticate = true; archiveRequest.PreAuthenticate = true;
archiveRequest.Timeout = 3000;
byte[] byteArray = Encoding.UTF8.GetBytes(historyQueryFilter); byte[] byteArray = Encoding.UTF8.GetBytes(historyQueryFilter);
using (Stream reqStream = archiveRequest.GetRequestStream()) using (Stream reqStream = archiveRequest.GetRequestStream())

View File

@ -23,8 +23,9 @@
"Port": "js2LutKe+rdjzdxMPQUrvQ==", "Port": "js2LutKe+rdjzdxMPQUrvQ==",
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30 //"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp //"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome //"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
//"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel //"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //mcut
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==", "Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
"Password": "FVAPxztxpY4gJJKQ/se4bQ==" "Password": "FVAPxztxpY4gJJKQ/se4bQ=="
}, },

View File

@ -23,8 +23,9 @@
"Port": "js2LutKe+rdjzdxMPQUrvQ==", "Port": "js2LutKe+rdjzdxMPQUrvQ==",
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30 //"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp //"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome //"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
//"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel //"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //mcut
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==", "Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
"Password": "FVAPxztxpY4gJJKQ/se4bQ==" "Password": "FVAPxztxpY4gJJKQ/se4bQ=="
}, },

View File

@ -108,7 +108,7 @@ namespace FrontendWebApi.ApiControllers
[HttpPost] [HttpPost]
[Route("api/EmergencyDevice")] [Route("api/EmergencyDevice")]
public async Task<ActionResult<ApiResult<List<deviceMenu>>>> EmergencyDevice(selectdevice selectdevice) public async Task<ActionResult<ApiResult<List<deviceMenu>>>> EmergencyDevice([FromBody] selectdevice selectdevice)
{ {
ApiResult<List<deviceMenu>> apiResult = new ApiResult<List<deviceMenu>>(); ApiResult<List<deviceMenu>> apiResult = new ApiResult<List<deviceMenu>>();
if (!jwtlife) if (!jwtlife)
@ -120,6 +120,16 @@ namespace FrontendWebApi.ApiControllers
try try
{ {
string deviceQue = "";
string disasQue = "";
if (selectdevice.selectbuilding != null && selectdevice.selectbuilding.Count > 0)
deviceQue += $" AND d.device_building_tag in @building_tag ";
if (selectdevice.select_Floors != null && selectdevice.select_Floors.Count > 0)
deviceQue += $" AND d.device_floor_tag in @floor ";
if (selectdevice.select_Layer3 != null && selectdevice.select_Layer3.Count > 0)
deviceQue += $" AND d.device_name_tag IN @layer3 ";
if (selectdevice.select_disasters != null && selectdevice.select_disasters.Count > 0)
disasQue = " where dd.device_system_value IN @disasters ";
var sqlString = @$"select var sqlString = @$"select
d.device_guid, d.device_guid,
@ -140,9 +150,8 @@ namespace FrontendWebApi.ApiControllers
(SELECT * (SELECT *
FROM device d FROM device d
WHERE d.deleted = 0 WHERE d.deleted = 0
AND d.device_building_tag = '{selectdevice.selectbuilding}' {deviceQue}
AND d.device_floor_tag in @floor ) d
AND d.device_name_tag IN @layer3) d
left join floor on floor.full_name = d.device_floor_tag and floor.building_tag = d.device_building_tag left join floor on floor.full_name = d.device_floor_tag and floor.building_tag = d.device_building_tag
left join ( left join (
SELECT SELECT
@ -158,10 +167,11 @@ namespace FrontendWebApi.ApiControllers
left join device_disaster dd on dd.device_guid = d.device_guid left join device_disaster dd on dd.device_guid = d.device_guid
left join (select * from variable v where v.system_type = 'disaster') ddd on ddd.system_value = dd.device_system_value left join (select * from variable v where v.system_type = 'disaster') ddd on ddd.system_value = dd.device_system_value
LEFT JOIN building b ON b.deleted = 0 AND d.device_building_tag = b.building_tag LEFT JOIN building b ON b.deleted = 0 AND d.device_building_tag = b.building_tag
where dd.device_system_value IN @disasters {disasQue}
ORDER BY d.device_number ORDER BY d.device_number
"; ";
Variable = await backendRepository.GetAllAsync<deviceMenu>(sqlString, new { disasters= selectdevice.select_disasters, floor = selectdevice.select_Floors, layer3 = selectdevice.select_Layer3 }); Variable = await backendRepository.GetAllAsync<deviceMenu>(sqlString, new { disasters= selectdevice.select_disasters, building_tag = selectdevice.selectbuilding,
floor = selectdevice.select_Floors, layer3 = selectdevice.select_Layer3 });
apiResult.Code = "0000"; apiResult.Code = "0000";
apiResult.Data = Variable; apiResult.Data = Variable;

View File

@ -106,7 +106,7 @@ namespace FrontendWebApi.Models
public class selectdevice public class selectdevice
{ {
public List<int> select_disasters { get; set; } public List<int> select_disasters { get; set; }
public string selectbuilding { get; set; } public List<string> selectbuilding { get; set; }
public List<string> select_Floors { get; set; } public List<string> select_Floors { get; set; }
public List<string> select_Layer3 { get; set; } public List<string> select_Layer3 { get; set; }
} }

View File

@ -18,10 +18,10 @@
"Port": "js2LutKe+rdjzdxMPQUrvQ==", "Port": "js2LutKe+rdjzdxMPQUrvQ==",
//"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30 //"Database": "VJB2XC+lAtzuHObDGMVOAA==", //30
//"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp //"Database": "IgYBsgG2VLKKxFb64j7LOA==", //wsp
//"Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome "Database": "7gWfmZ28HGIJZbxEbK+0yg==", //tpe_dome_dome
//"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel //"Database": "siTUcDaC/g2yGTMFWD72Kg==", //tpe_dome_hotel
//"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office //"Database": "iuaY0h0+TWkir44/eZLDqw==", //tpe_dome_office
"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //MCUT //"Database": "Rq7Gn4x6LwBvVtl7GY8LbA==", //MCUT
"Root": "SzdxEgaJJ7tcTCrUl2zKsA==", "Root": "SzdxEgaJJ7tcTCrUl2zKsA==",
"Password": "FVAPxztxpY4gJJKQ/se4bQ==" "Password": "FVAPxztxpY4gJJKQ/se4bQ=="
} }