1. bug fix

2. 電站刪除 only 平台管理員
3. 背景執行加入inner exception
This commit is contained in:
Kai 2021-09-03 15:09:57 +08:00
parent fc1483d580
commit 833ba0f672
6 changed files with 55 additions and 44 deletions

View File

@ -947,8 +947,8 @@ namespace SolarPower.Quartz.Jobs
}
catch (Exception exception)
{
logger.LogError("【CalcAvgPowerStationJob】[Exception] - {1}", "", exception.Message);
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {1}", "", exception.InnerException.Message);
logger.LogError("【CalcAvgPowerStationJob】[Exception] - {0}", exception.Message);
logger.LogError("【CalcAvgPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
}
}
}

View File

@ -493,7 +493,7 @@ namespace SolarPower.Quartz.Jobs
var exist_meter_table = await powerStationRepository.ExistTable(powerStation.SiteDB, meter_table_name);
if (string.IsNullOrEmpty(exist_meter_table))
{
logger.LogError("【CalcPowerStationJob】【查無電站[0]的s{0}01_meter資料表】", powerStation.Code);
logger.LogError("【CalcPowerStationJob】【查無電站[{0}]的s{0}01_meter資料表】", powerStation.Code);
}
else
{
@ -817,13 +817,12 @@ namespace SolarPower.Quartz.Jobs
#endregion
}
logger.LogInformation("【CalcPowerStationJob】【任務完成】");
}
catch (Exception exception)
{
logger.LogError("【{0}】{1}", "CalcPowerStationJob", exception.Message);
logger.LogError("【CalcPowerStationJob】[Exception] - {0}", exception.Message);
logger.LogError("【CalcPowerStationJob】[InnerException] - {0}", exception.InnerException.Message);
}
}
}

View File

@ -505,15 +505,15 @@
}
powerids = [];
$.each(Allpowerids, function (index, val) {
$('input[name="check_power_station[]"]').map(function () {
if (AllpoweridsType) {
$('#check_' + val).prop("checked", true);
powerids.push(val);
} else {
$('#check_' + val).prop("checked", false);
powerids = [];
$(this).prop("checked", true);
powerids.push($(this).val());
}
})
else {
$(this).prop("checked", false);
}
});
ExceptionTable.ajax.reload();
}
//#endregion
@ -602,12 +602,12 @@
$.each(rel.data, function (index, val) {
if ($.inArray(parseInt(val.cityId), ids) > -1) {
$('#CheckPowerStation').append("<div class='col-2 mb-2 custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "' checked>");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input'name='check_power_station[]' id='check_" + val.id + "' value='" + val.id + "' checked>");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
powerids.push(String(val.id));
} else {
$('#CheckPowerStation').append("<div class='col-2 mb-2 custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "'>");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input'name='check_power_station[]' id='check_" + val.id + "' value='" + val.id + "' >");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
if ($.inArray(parseInt(val.id), powerids) > -1) {

View File

@ -464,15 +464,17 @@
}
powerids = [];
$.each(Allpowerids, function (index, val) {
$('input[name="check_power_station[]"]').map(function () {
if (AllpoweridsType) {
$('#check_' + val).prop("checked", true);
powerids.push(val);
} else {
$('#check_' + val).prop("checked", false);
powerids = [];
$(this).prop("checked", true);
powerids.push($(this).val());
}
})
else {
$(this).prop("checked", false);
}
});
OperationPlanTable.ajax.reload();
}
//#endregion
@ -553,12 +555,12 @@
if ($.inArray(parseInt(val.cityId), ids) > -1) {
$('#CheckPowerStation').append("<div class='col-2 mb-2 custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "' checked>");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' name='check_power_station[]' id='check_" + val.id + "' value='" + val.id + "' checked>");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
powerids.push(String(val.id));
} else {
$('#CheckPowerStation').append("<div class='col-2 mb-2 custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "'>");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' name='check_power_station[]' id='check_" + val.id + "' value='" + val.id + "' >");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
if ($.inArray(parseInt(val.id), powerids) > -1) {

View File

@ -614,12 +614,12 @@
if ($.inArray(parseInt(val.cityId), ids) > -1) {
$('#CheckPowerStation').append("<div class='col-2 mb-2 custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "' checked>");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' name='check_power_station[]' id='check_" + val.id + "' value='" + val.id + "' checked>");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
powerids.push(String(val.id));
} else {
$('#CheckPowerStation').append("<div class='col-2 mb-2 custom-control custom-checkbox custom-control-inline' id='station_" + val.id + "' > ");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' id='check_" + val.id + "'>");
$('#station_' + val.id).append("<input type='checkbox' class='custom-control-input' name='check_power_station[]' id='check_" + val.id + "' value='" + val.id + "' >");
$('#station_' + val.id).append("<label class='custom-control-label' for='check_" + val.id + "'>" + val.name + "</label>");
if ($.inArray(parseInt(val.id), powerids) > -1) {
@ -839,15 +839,15 @@
}
powerids = [];
$.each(Allpowerids, function (index, val) {
$('input[name="check_power_station[]"]').map(function () {
if (AllpoweridsType) {
$('#check_' + val).prop("checked", true);
powerids.push(val);
} else {
$('#check_' + val).prop("checked", false);
powerids = [];
$(this).prop("checked", true);
powerids.push($(this).val());
}
})
else {
$(this).prop("checked", false);
}
});
if (status == 2) {
operationRecordTable.column(10).visible(true);
}

View File

@ -3,6 +3,8 @@
ViewData["SubNum"] = "1";
ViewData["Title"] = "電站管理";
}
@using SolarPower.Models.Role
@model RoleLayerEnum
<ol class="breadcrumb page-breadcrumb">
<li class="breadcrumb-item"><a href="javascript:void(0);">總覽</a></li>
@ -326,12 +328,12 @@
<div id="templateArea" hidden="hidden">
<div class="tab-pane" id="tab-name" role="tabpanel" aria-labelledby="tab-name">
@*<div class="row mb-5 d-flex justify-content-end">
<div class="col-6 text-right">
<a href="javascript:TableDisplay();" class="btn btn-secondary btn-icon waves-effect waves-themed mr-1" style="width: 47px;"><span class="fal fa-list fa-2x mt-2"></span></a>
<a href="javascript:CardDisplay();" class="btn btn-secondary btn-icon waves-effect waves-themed mr-1" style="width: 47px;"><span class="fal fa-grip-horizontal fa-2x mt-2"></span></a>
</div>
</div>*@
<div class="col-6 text-right">
<a href="javascript:TableDisplay();" class="btn btn-secondary btn-icon waves-effect waves-themed mr-1" style="width: 47px;"><span class="fal fa-list fa-2x mt-2"></span></a>
<a href="javascript:CardDisplay();" class="btn btn-secondary btn-icon waves-effect waves-themed mr-1" style="width: 47px;"><span class="fal fa-grip-horizontal fa-2x mt-2"></span></a>
</div>
</div>*@
<div class="row solarCard" id="solarCard">
</div>
@ -487,14 +489,22 @@
$('#card' + val.id).find('#inverter_amount').text(val.inverterAmount);
$('#card' + val.id).find('#electricity_meter_at').text(val.electricityMeterAt);
var del_str = "";
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin){
<text>
del_str = '<button type = "button" class= "btn btn-danger btn-pills waves-effect waves-themed del-btnto" > 刪除</button >';
</text>
}
$('#solarTable' + val.cityId).find('tbody').append('<tr data-id="' + val.id + '" datacity-id="' + val.cityId+'"">' +
'<td>' + val.id + '</td>' +
'<td>' + val.name + '</td>' +
'<td>' + val.generatingCapacity.toFixed(2) + '</td>' +
'<td>' + val.inverterAmount + '</td>' +
'<td>' + val.electricityMeterAt + '</td>' +
'<td> <button type="button" class="btn btn-primary btn-pills waves-effect waves-themed" onclick="location.href=\'' + localurl + '/edit?stationId=' + val.id + '\'">選擇</button> <button type="button" class="btn btn-danger btn-pills waves-effect waves-themed del-btnto">刪除</button></td>' +
'<td> <button type="button" class="btn btn-primary btn-pills waves-effect waves-themed" onclick="location.href=\'' + localurl + '/edit?stationId=' + val.id + '\'">選擇</button> ' +
del_str +
'</td > ' +
'</tr>');
});
@ -506,7 +516,7 @@
}, 'json');
}
@ -570,7 +580,7 @@
}, 'json');
}
});
return;
}
@ -580,7 +590,7 @@
});