1.新增資料到back_fill_schedule
2.修改異常寄Email 3.逆變器監控bug修復
This commit is contained in:
parent
5fa5b58d79
commit
93e780b7dd
@ -447,6 +447,20 @@ namespace SolarPower.Controllers
|
||||
}
|
||||
#endregion
|
||||
|
||||
BackFillSchedule backFillSchedule = new BackFillSchedule()
|
||||
{
|
||||
UID = powerStation.Code,
|
||||
DBName = powerStation.SiteDB,
|
||||
TableName = "s" + powerStation.Code + "01_station"
|
||||
};
|
||||
properties = new List<string>()
|
||||
{
|
||||
"UID",
|
||||
"DBName",
|
||||
"TableName"
|
||||
};
|
||||
await powerStationRepository.AddAnyThing<BackFillSchedule>(backFillSchedule, properties, "back_fill_schedule");
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "儲存成功";
|
||||
apiResult.Data = await powerStationRepository.GetOneAsync(id);
|
||||
@ -1110,6 +1124,22 @@ namespace SolarPower.Controllers
|
||||
};
|
||||
await powerStationRepository.AddDevice(DeviceInfo, properties, powerStation.SiteDB);
|
||||
|
||||
BackFillSchedule backFillSchedule = new BackFillSchedule()
|
||||
{
|
||||
ColName = Device.ColName,
|
||||
UID = deviceController.ControllerId + "R" + Newnum,
|
||||
DBName = powerStation.SiteDB,
|
||||
TableName = Device.TableName
|
||||
};
|
||||
properties = new List<string>()
|
||||
{
|
||||
"ColName",
|
||||
"UID",
|
||||
"DBName",
|
||||
"TableName"
|
||||
};
|
||||
await powerStationRepository.AddAnyThing<BackFillSchedule>(backFillSchedule, properties, "back_fill_schedule");
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "新增成功";
|
||||
}
|
||||
@ -2284,22 +2314,37 @@ namespace SolarPower.Controllers
|
||||
BrandNum = post.BrandNum
|
||||
};
|
||||
List<string> properties = new List<string>()
|
||||
{
|
||||
"Status",
|
||||
"Brand",
|
||||
"Capacity",
|
||||
"Enabled",
|
||||
"Model",
|
||||
"InstallDate",
|
||||
"InverterName",
|
||||
"Pyrheliometer",
|
||||
"ControllerId",
|
||||
"SerialNumber",
|
||||
"CreatedBy",
|
||||
"InverterId",
|
||||
"BrandNum"
|
||||
};
|
||||
{
|
||||
"Status",
|
||||
"Brand",
|
||||
"Capacity",
|
||||
"Enabled",
|
||||
"Model",
|
||||
"InstallDate",
|
||||
"InverterName",
|
||||
"Pyrheliometer",
|
||||
"ControllerId",
|
||||
"SerialNumber",
|
||||
"CreatedBy",
|
||||
"InverterId",
|
||||
"BrandNum"
|
||||
};
|
||||
await powerStationRepository.AddInverter(inverter, properties, powerStation.SiteDB);
|
||||
|
||||
BackFillSchedule backFillSchedule = new BackFillSchedule()
|
||||
{
|
||||
UID = deviceController.ControllerId + Newnum,
|
||||
DBName = powerStation.SiteDB,
|
||||
TableName = "s" + deviceController.ControllerId + "_inv"
|
||||
};
|
||||
properties = new List<string>()
|
||||
{
|
||||
"UID",
|
||||
"DBName",
|
||||
"TableName"
|
||||
};
|
||||
await powerStationRepository.AddAnyThing<BackFillSchedule>(backFillSchedule, properties, "back_fill_schedule");
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "新增成功";
|
||||
}
|
||||
|
||||
@ -966,4 +966,12 @@ namespace SolarPower.Models.PowerStation
|
||||
public string BrandNum { get; set; }
|
||||
}
|
||||
|
||||
public class BackFillSchedule
|
||||
{
|
||||
public string DBName { get; set; }
|
||||
public string TableName { get; set; }
|
||||
public string ColName { get; set; }
|
||||
public string UID { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ namespace SolarPower.Quartz.Jobs
|
||||
var ExceptionList = await overviewRepository.GetEmailExceptionList();
|
||||
if(ExceptionList.Count > 0 )
|
||||
{
|
||||
var ExceptionListex = ExceptionList.Where(x => x.normalTime == null && DateTime.Now.Subtract(DateTime.Parse(x.dev_time)).Hours >= 4).ToList();
|
||||
var ExceptionListex = ExceptionList.Where(x => x.normalTime == "1970-01-01 08:00:00" && DateTime.Now.Subtract(DateTime.Parse(x.dev_time)).Hours >= 4).ToList();
|
||||
|
||||
|
||||
foreach (var Exception in ExceptionListex)
|
||||
|
||||
@ -5088,5 +5088,6 @@ namespace SolarPower.Repository.Implement
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -628,5 +628,36 @@ namespace SolarPower.Repository.Implement
|
||||
}
|
||||
return Num;
|
||||
}
|
||||
/// <summary>
|
||||
/// 新增資料
|
||||
/// </summary>
|
||||
/// <typeparam name="A"></typeparam>
|
||||
/// <param name="result"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <param name="tableName"></param>
|
||||
/// <returns></returns>
|
||||
public async Task AddAnyThing<A>(A result, List<string> properties, string tableName)
|
||||
{
|
||||
using (IDbConnection conn = _databaseHelper.GetConnection())
|
||||
{
|
||||
conn.Open();
|
||||
var trans = conn.BeginTransaction();
|
||||
try
|
||||
{
|
||||
string sql = GenerateInsertQueryWithCustomTable(properties, tableName);
|
||||
await conn.ExecuteAsync(sql, result);
|
||||
trans.Commit();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
trans.Rollback();
|
||||
throw exception;
|
||||
}
|
||||
finally
|
||||
{
|
||||
conn.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -111,5 +111,7 @@ namespace SolarPower.Repository.Interface
|
||||
/// <param name="table_name"></param>
|
||||
/// <returns></returns>
|
||||
Task PurgeOneByIdWithCustomDBNameAndTable(int id, string db_name, string table_name);
|
||||
|
||||
Task AddAnyThing<A>(A result, List<string> properties, string tableName);
|
||||
}
|
||||
}
|
||||
|
||||
@ -460,14 +460,12 @@
|
||||
}
|
||||
else {
|
||||
|
||||
|
||||
|
||||
|
||||
$.each(rel.data, function (index, val) {
|
||||
//電站卡片
|
||||
$('#templateCard').find('.col-xl-2').attr('id', 'card' + val.id).clone().appendTo($('#solarCard' + val.cityId));
|
||||
$('#card' + val.id).find('#editSolarUrl').attr('href', localurl + '/edit?stationId=' + val.id);
|
||||
$('#card' + val.id).find('#editSolarUrl').find('#Solarimg').attr('src', val.mainDisplay);
|
||||
$('#card' + val.id).find('#editSolarUrl').find('#Solarimg').attr('style', "width: 100%;height: 138px;");
|
||||
$('#card' + val.id).find('#solarName').text(val.name);
|
||||
$('#card' + val.id).find('#today_kwh').text(val.kwh);
|
||||
$('#card' + val.id).find('#kwhkwp').text(val.inverterAmount);
|
||||
@ -490,43 +488,6 @@
|
||||
|
||||
}, 'json');
|
||||
}
|
||||
//電站區域
|
||||
//$('#templateAreaTab').find('li').attr('id', 'AreaTabnewtaipei').clone().appendTo($('#areaTab'));
|
||||
//$('#AreaTabnewtaipei').find('a').attr('href', '#tab-newtaipei');
|
||||
//$('#AreaTabnewtaipei').find('a').attr('class', 'nav-link fs-lg px-4');
|
||||
//$('#AreaTabnewtaipei').find('#areaName').html('新北市')
|
||||
//$('#AreaTabnewtaipei').find('#solarCount').html('2')
|
||||
|
||||
//$('#templateAreaTab').find('li').attr('id', 'AreaTabHsinchu').clone().appendTo($('#areaTab'));
|
||||
//$('#AreaTabHsinchu').find('a').attr('href', '#tab-Hsinchu');
|
||||
//$('#AreaTabHsinchu').find('a').attr('class', 'nav-link fs-lg px-4');
|
||||
//$('#AreaTabHsinchu').find('#areaName').html('新竹市')
|
||||
//$('#AreaTabHsinchu').find('#solarCount').html('3')
|
||||
|
||||
//$('#templateAreaTab').find('li').attr('id', 'AreaTabPingtung').clone().appendTo($('#areaTab'));
|
||||
//$('#AreaTabPingtung').find('a').attr('href', '#tab-Pingtung');
|
||||
//$('#AreaTabPingtung').find('a').attr('class', 'nav-link fs-lg px-4');
|
||||
//$('#AreaTabPingtung').find('#areaName').html('屏東縣')
|
||||
//$('#AreaTabPingtung').find('#solarCount').html('1')
|
||||
|
||||
//電站區域內容
|
||||
//$('#templateArea').find('.tab-pane').attr('id', 'tab-newtaipei').clone().appendTo($('#area'));
|
||||
//$('#tab-newtaipei').attr('aria-labelledby', 'tab-newtaipei')
|
||||
//$('#tab-newtaipei').find('#solarCard').attr('id', 'solarCardnewtaipei');
|
||||
//$('#tab-newtaipei').find('#solarTable').attr('id', 'solarTablenewtaipei');
|
||||
|
||||
//$('#templateArea').find('.tab-pane').attr('id', 'tab-Hsinchu').clone().appendTo($('#area'));
|
||||
//$('#tab-Hsinchu').attr('aria-labelledby', 'tab-Hsinchu')
|
||||
//$('#tab-Hsinchu').find('#solarCard').attr('id', 'solarCardHsinchu');
|
||||
//$('#tab-Hsinchu').find('#solarTable').attr('id', 'solarTableHsinchu');
|
||||
|
||||
//$('#templateArea').find('.tab-pane').attr('id', 'tab-Pingtung').clone().appendTo($('#area'));
|
||||
//$('#tab-Pingtung').attr('aria-labelledby', 'tab-Pingtung')
|
||||
//$('#tab-Pingtung').find('#solarCard').attr('id', 'solarCardPingtung');
|
||||
//$('#tab-Pingtung').find('#solarTable').attr('id', 'solarTablePingtung');
|
||||
|
||||
//電站卡片
|
||||
|
||||
|
||||
$('.nav-tabs a[href="#tab-newtaipei"]').tab('show');
|
||||
|
||||
|
||||
@ -2114,7 +2114,7 @@
|
||||
document.getElementById('Device_Enabled_modal').disabled = true;
|
||||
$("#Device-modal .modal-title").html("裝置資料 - 新增");
|
||||
$("#Device-form").trigger("reset");
|
||||
/*$("#Device_TableName_modal").val("s" + $("#Device_Controller_modal").text() + "_sensoravg");*/
|
||||
$("#Device_TableName_modal").val("s" + $("#Device_Controller_modal").text() + "_sensoravg");
|
||||
$("#Device-modal").modal();
|
||||
}
|
||||
//#endregion
|
||||
|
||||
@ -185,7 +185,7 @@
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-6">
|
||||
<label class="form-label" for="Inverter_ControllerId_modal"><span class="text-danger">*</span>控制器編號</label>
|
||||
<select class="form-control" id="Inverter_ControllerId_modal">
|
||||
<select class="form-control" id="Inverter_ControllerId_modal" disabled>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-lg-6">
|
||||
@ -259,7 +259,7 @@
|
||||
<div class="row">
|
||||
<div class="form-group col-lg-6">
|
||||
<label class="form-label" for="Device_Controller_modal"><span class="text-danger">*</span>控制器編號</label>
|
||||
<select class="form-control" id="Device_Controller_modal">
|
||||
<select class="form-control" id="Device_Controller_modal" disabled>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-lg-6">
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
}
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-overview-operationRecord" role="tab">
|
||||
<a class="nav-link fs-lg px-4" data-toggle="tab" href="#tab-overview-InverterInfo" role="tab">
|
||||
<i class="fal fa-digital-tachograph text-success"></i> <span class="hidden-sm-down ml-1">逆變器監控</span>
|
||||
</a>
|
||||
</li>
|
||||
@ -109,6 +109,10 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="tab-pane fade" id="tab-overview-InverterInfo" role="tabpanel" aria-labelledby="tab-overview-InverterInfo">
|
||||
@Html.Partial("_InverterInfo")
|
||||
</div>
|
||||
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_History"))
|
||||
{
|
||||
<div class="tab-pane fade" id="tab-overview-history" role="tabpanel" aria-labelledby="tab-overview-history">
|
||||
@ -116,10 +120,6 @@
|
||||
</div>
|
||||
}
|
||||
|
||||
<div class="tab-pane fade" id="tab-overview-operationRecord" role="tabpanel" aria-labelledby="tab-overview-operationRecord">
|
||||
@Html.Partial("_InverterInfo")
|
||||
</div>
|
||||
|
||||
|
||||
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.auths.Contains("StationOverview_Inverter"))
|
||||
{
|
||||
|
||||
Loading…
Reference in New Issue
Block a user