1.電站管理 資料重整

2. DBHelper Connection sting 修改
This commit is contained in:
Kai 2021-06-18 10:45:44 +08:00
parent e8873251d1
commit 9cf929df5f
3 changed files with 330 additions and 478 deletions

View File

@ -37,7 +37,7 @@ namespace SolarPower.Helper
var passwordStr = ed.DESDecrypt(dbConfig.Password);
//var connStr = $"server={serverStr};database={databaseStr};user={rootStr};password={passwordStr};charset=utf8;";
var connStr = @"server=127.0.0.1;port=3308;database=solar_power;user=root;password=00000000;charset=utf8;";
var connStr = @"server=127.0.0.1;database=solar_power;user=root;password=000000;charset=utf8;";
this._connectionString = connStr;
}

View File

@ -1,163 +0,0 @@
<!-- Your main content goes below here: -->
<div class="row">
<div class="col-xl-12">
<div id="panel-5" class="panel">
<div class="panel-container show">
<div class="panel-content">
<div class="tab-content p-3">
<div class="row mb-5">
<div class="card border mb-g w-100">
<!-- notice the additions of utility paddings and display properties on .card-header -->
<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">
<!-- we wrap header title inside a div tag with utility padding -->
<div class="card-title font-weight-bold">電站基本資料</div>
<div class="text-right">
<a href="javascript:;" class="btn btn-sm btn-info ml-auto waves-effect waves-themed">
<span class="fal fa-cog mr-1"></span> 儲存
</a>
</div>
</div>
<div class="card-body">
<div class="row d-flex justify-content-between">
<div class="col-xl-2 justify-content-center">
<label class="form-label" for="power_station_id">電站編號</label>
<input type="text" id="power_station_id" name="power_station_id" disabled="disabled" class="form-control">
</div>
<div class="col-xl-2 justify-content-center">
<label class="form-label" for="power_station_name">電站名稱</label>
<input type="text" id="power_station_name" name="power_station_name" class="form-control">
</div>
<div class="col-xl-2 justify-content-center">
<p>是否為代管:</p>
<p class="color-info-600">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="IsEscrow" name="IsEscrow">
<label class="custom-control-label" for="IsEscrow" id="IsEscrowLabel">No</label>
</div>
</p>
</div>
<div class="col-xl-2 justify-content-center">
<label class="form-label" for="ElectricityMeterAt">台電掛錶日</label>
<input type="date" id="ElectricityMeterAt" name="ElectricityMeterAt" class="form-control">
</div>
<div class="col-xl-2 justify-content-center">
<label class="form-label" for="EstimatedRecoveryTime">預計回收年限</label>
<input type="text" id="EstimatedRecoveryTime" name="EstimatedRecoveryTime" class="form-control">
</div>
</div>
<div class="row d-flex justify-content-between mb-5">
<div class="col-xl-2 justify-content-center">
<label class="form-label" for="GeneratingCapacity">電廠發電容量</label>
<input type="text" id="GeneratingCapacity" name="GeneratingCapacity" class="form-control">
</div>
<div class="col-xl-2 justify-content-center">
<label class="form-label" for="power_station_operation_personnel">運維人員</label>
<br />
<select class="js-example-basic-multiple form-control" id="power_station_operation_personnel" multiple="multiple">
</select>
</div>
<div class="col-xl-2 justify-content-center">
<label class="form-label" for="EscrowName">被代管公司</label>
<input type="text" id="EscrowName" name="EscrowName" class="form-control" disabled="disabled">
</div>
<div class="col-xl-2 justify-content-center">
<label class="form-label" for="PowerRate">授電費率</label>
<input type="text" id="PowerRate" name="PowerRate" class="form-control">
</div>
<div class="col-xl-2 justify-content-center">
<label class="form-label" for="Coordinate">座標</label>
<input type="text" id="Coordinate" name="Coordinate" class="form-control">
</div>
</div>
<div class="row">
<div class="col-xl-6">
<h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">逆變器</h5>
<div class="row d-flex justify-content-between px-5">
<div class="col-xl-4">
<label class="form-label" for="InverterBrand">廠牌</label>
<input type="text" id="InverterBrand" name="InverterBrand" class="form-control">
</div>
<div class="col-xl-4">
<label class="form-label" for="InverterProductModel">型號</label>
<input type="text" id="InverterProductModel" name="InverterProductModel" class="form-control">
</div>
<div class="col-xl-4">
<label class="form-label" for="InverterAmount">數量</label>
<input type="text" id="InverterAmount" name="InverterAmount" class="form-control">
</div>
</div>
</div>
<div class="col-xl-6">
<h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">光電板</h5>
<div class="row d-flex justify-content-between px-5">
<div class="col-xl-4">
<label class="form-label" for="PhotovoltaicPanelBrand">廠牌</label>
<input type="text" id="PhotovoltaicPanelBrand" name="PhotovoltaicPanelBrand" class="form-control">
</div>
<div class="col-xl-4">
<label class="form-label" for="PhotovoltaicPanelSpecification">規格</label>
<input type="text" id="PhotovoltaicPanelSpecification" name="PhotovoltaicPanelSpecification" class="form-control">
</div>
<div class="col-xl-4">
<label class="form-label" for="PhotovoltaicPanelAmount">數量</label>
<input type="text" id="PhotovoltaicPanelAmount" name="PhotovoltaicPanelAmount" class="form-control">
</div>
<div class="col-xl-4">
<label class="form-label" for="PhotovoltaicPanelProductModel">型號</label>
<input type="text" id="PhotovoltaicPanelProductModel" name="PhotovoltaicPanelProductModel" class="form-control">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
@section Scripts{
<script>
//#region 預先載入公司下拉式選單select_option
var url_user_select_option = "/PowerStation/GetUserSelectOptionList";
$.get(url_user_select_option, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$("#power_station_operation_personnel").empty();
$.each(rel.data, function (index, val) {
$("#power_station_operation_personnel").append($("<option />").val(val.value).text(val.text));
});
//預設查詢第一個
$("#power_station_operation_personnel").val($("#power_station_operation_personnel option:first").val());
});
//#endregion
$('.js-example-basic-multiple').select2();
$("#IsEscrow").click(function () {
if ($(this).prop("checked")) {
$('#IsEscrowLabel').html("Yes");
$("#EscrowName").attr('disabled', false)
} else {
$('#IsEscrowLabel').html("No");
$("#EscrowName").attr('disabled', true)
}
});
</script>
}

View File

@ -175,92 +175,93 @@
}
}
});
//#endregion
//#endregion
//#region 設備列表 DataTable
DeviceTable = $("#Device_table").DataTable({
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": true,
"order": [[9, "desc"]],
"columns": [{
"data": "uid"
}, {
"data": "name"
}, {
"data": "typeName"
}, {
"data": "brand"
}, {
"data": "productModel"
}, {
"data": "dbName"
}, {
"data": "tableName"
}, {
"data": "colName"
}, {
"data": "remark"
},{
"data": "function"
}],
"columnDefs": [{
'targets': 1,
'searchable': false,
'orderable': false,
'className': 'dt-body-center'
}],
"language": {
"emptyTable": "無資料...",
"processing": "處理中...",
"loadingRecords": "載入中...",
"lengthMenu": "顯示 _MENU_ 項結果",
"zeroRecords": "沒有符合的結果",
"info": "顯示第 _START_ 至 _END_ 項結果,共 _TOTAL_ 項",
"infoEmpty": "顯示第 0 至 0 項結果,共 0 項",
"infoFiltered": "(從 _MAX_ 項結果中過濾)",
"infoPostFix": "",
"search": "搜尋:",
"paginate": {
"first": "第一頁",
"previous": "上一頁",
"next": "下一頁",
"last": "最後一頁"
},
"aria": {
"sortAscending": ": 升冪排列",
"sortDescending": ": 降冪排列"
}
},
'createdRow': function (row, data, dataIndex) {
$(row).attr('data-id', data.id);
},
"ajax": {
"url": "/PowerStation/DeviceTable",
"type": "POST",
"data": function (d) {
d.stationId = stationId;
},
"dataSrc": function (rel) {
if (rel.data.code == "9999") {
toast_error(rel.data.msg);
return;
"paging": true,
"lengthChange": false,
"searching": false,
"ordering": true,
"info": true,
"autoWidth": false,
"responsive": true,
"order": [[9, "desc"]],
"columns": [{
"data": "uid"
}, {
"data": "name"
}, {
"data": "typeName"
}, {
"data": "brand"
}, {
"data": "productModel"
}, {
"data": "dbName"
}, {
"data": "tableName"
}, {
"data": "colName"
}, {
"data": "remark"
},{
"data": "function"
}],
"columnDefs": [{
'targets': 1,
'searchable': false,
'orderable': false,
'className': 'dt-body-center'
}],
"language": {
"emptyTable": "無資料...",
"processing": "處理中...",
"loadingRecords": "載入中...",
"lengthMenu": "顯示 _MENU_ 項結果",
"zeroRecords": "沒有符合的結果",
"info": "顯示第 _START_ 至 _END_ 項結果,共 _TOTAL_ 項",
"infoEmpty": "顯示第 0 至 0 項結果,共 0 項",
"infoFiltered": "(從 _MAX_ 項結果中過濾)",
"infoPostFix": "",
"search": "搜尋:",
"paginate": {
"first": "第一頁",
"previous": "上一頁",
"next": "下一頁",
"last": "最後一頁"
},
"aria": {
"sortAscending": ": 升冪排列",
"sortDescending": ": 降冪排列"
}
},
'createdRow': function (row, data, dataIndex) {
$(row).attr('data-id', data.id);
},
"ajax": {
"url": "/PowerStation/DeviceTable",
"type": "POST",
"data": function (d) {
d.stationId = stationId;
},
"dataSrc": function (rel) {
if (rel.data.code == "9999") {
toast_error(rel.data.msg);
return;
}
data = rel.data.data;
data = rel.data.data;
if (data == null || data.length == 0) {
this.data = [];
if (data == null || data.length == 0) {
this.data = [];
}
return data;
}
return data;
}
}
});
//#endregion
});
//#endregion
//#region 異常設定列表 DataTable
ExceptionTable = $("#Exception_table").DataTable({
"paging": true,
@ -341,7 +342,8 @@
}
}
});
//#endregion
//#endregion
//#region 電站資料 view 控制
if (stationId == 'new') {
//#region 電站基本資料
@ -378,6 +380,7 @@
$("#land_buildingPart").hide();
$("#tablist").hide();
$("#tablist").find(".nav-item > a").first().click();
} else {
var url = "/PowerStation/GetOnePowerStation"
@ -410,6 +413,7 @@
}, 'json');
}
//#endregion
//#region 預先載入運維人員下拉式選單select_option
var url_user_select_option = "/PowerStation/GetUserSelectOptionList";
@ -486,6 +490,8 @@
});
});
//#endregion
//#region 預先載入設備類型下拉式選單select_option
var url_DeviceType = "/PowerStation/GetDeviceTypeSelectOptionList";
$.get(url_DeviceType, function (rel) {
if (rel.code != "0000") {
@ -498,11 +504,10 @@
$("#Device_Type_modal").append($("<option />").val(val.value).text(val.text));
});
})
//#endregion
});
//#region 代管切換
$("#check_escrow").click(function () {
if ($(this).prop("checked")) {
@ -646,7 +651,6 @@
//觀看
//#region 電站基本資料 文字
$("#address_detail_text").show();
$("#power_station_code_text").show();
$("#power_station_name_text").show();
@ -968,7 +972,6 @@
$("#photovoltaic_panel_specification").val(powerStationData.photovoltaicPanelSpecification);
$("#photovoltaic_panel_amount").val(powerStationData.photovoltaicPanelAmount);
//#endregion
}
//#endregion
@ -1022,6 +1025,7 @@
CreateAddLandBuildingCard(landBuildingCard);
}
//#endregion
//#region 創建每份土地房屋資訊卡片
function CreateLandBuildingCard(dom, value) {
var appendStr = "";
@ -1219,238 +1223,9 @@
'</div>';
dom.append(appendStr);
}
//#endregion
//#region 新增維運資料
function AddOperation()
{
$("#Operation-modal .modal-title").html("運維廠商資料 - 新增");
$("#Operation-form").trigger("reset");
$("#Operation-modal").modal();
}
//#endregion
//#region 儲存運維資料
function SaveOperation() {
if ($("#Operation-form").valid()) {
var url = "/PowerStation/SaveOperation";
var send_data = {
Id: selected_id,
PowerStationId: stationId,
Type: $("#Operation_role_modal").val(),
Name: $("#Operation_factory_modal").val(),
ContactPerson: $("#Operation_name_modal").val(),
Phone: $("#Operation_phone_modal").val(),
Email: $("#Operation_email_modal").val(),
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
else
{
toast_ok(rel.msg);
$('#Operation-modal').modal('hide');
OperationTable.ajax.reload();
return;
}
}, 'json');
}
}
//#endregion
//#region 取一筆運維
$('#Operation_table').on("click", "button.edit-btn", function () {
$("#Operation-modal .modal-title").html("運維廠商資料 - 編輯");
selected_id = $(this).parents('tr').attr('data-id');
//取得單一運維基本資料
var url = "/PowerStation/GetOneOperation/";
var send_data = {
id: selected_id
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$("#Operation_role_modal").val(rel.data.type);
$("#Operation_factory_modal").val(rel.data.name);
$("#Operation_name_modal").val(rel.data.contactPerson);
$("#Operation_phone_modal").val(rel.data.phone);
$("#Operation_email_modal").val(rel.data.email);
$("#Operation-modal").modal();
}, 'json');
});
//#endregion
//#region 刪除運維
$('#Device_table').on("click", "button.del-btn", function () {
selected_id = $(this).parents('tr').attr('data-id');
var url = "/PowerStation/DeleteOneDevice/";
var send_data = {
Id: selected_id
}
$.post(url, send_data, function (rel) {
if (rel.code == "9999") {
toast_error(rel.msg);
return;
}
toast_ok(rel.msg);
DeviceTable.ajax.reload();
}, 'json');
});
//#endregion
//#region 刪除設備
$('#Operation_table').on("click", "button.del-btn", function () {
selected_id = $(this).parents('tr').attr('data-id');
var url = "/PowerStation/DeleteOneOperation/";
var send_data = {
Id: selected_id
}
$.post(url, send_data, function (rel) {
if (rel.code == "9999") {
toast_error(rel.msg);
return;
}
toast_ok(rel.msg);
OperationTable.ajax.reload();
}, 'json');
});
//#endregion
//#region 新增裝置資料
function AddDevice() {
$("#Device-modal .modal-title").html("裝置資料 - 新增");
$("#Device-form").trigger("reset");
$("#Device-modal").modal();
}
//#endregion
//#region 新增異常設定資料
function AddException() {
$("#Exception-modal .modal-title").html("異常設定資料 - 新增");
$("#Exception-form").trigger("reset");
$("#Exception-modal").modal();
}
//#endregion
//#region 儲存裝置資料
function SaveDevice() {
if ($("#Device-form").valid()) {
var url = "/PowerStation/SaveDevice";
var send_data = {
Id: selected_id,
PowerStationId: stationId,
Name: $("#Device_Name_modal").val(),
Type: $("#Device_Type_modal").val(),
TypeName: $("#Device_Type_modal :selected").text(),
Brand: $("#Device_Brand_modal").val(),
ProductModel: $("#Device_ProductModel_modal").val(),
DBName: $("#Device_DBName_modal").val(),
TableName: $("#Device_TableName_modal").val(),
ColName: $("#Device_ColName_modal").val(),
Remark: $("#Device_Remark_modal").val()
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
else {
toast_ok(rel.msg);
$('#Device-modal').modal('hide');
DeviceTable.ajax.reload();
return;
}
}, 'json');
}
}
//#endregion
//#region 儲存異常設定資料
function SaveException() {
if ($("#Exception-form").valid()) {
var url = "/PowerStation/SaveException";
var send_data = {
Id: selected_id,
PowerStationId: stationId,
Type: $("#Exception_Type_modal").val(),
UpperLimit: $("#Exception_UpperLimit_modal").val(),
LowerLimit: $("#Exception_LowerLimit_modal").val(),
Alarm: $("#Exception_Alarm_modal").val()
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
else {
toast_ok(rel.msg);
$('#Exception-modal').modal('hide');
ExceptionTable.ajax.reload();
return;
}
}, 'json');
}
}
//#endregion
//#region 取一筆異常設定
$('#Exception_table').on("click", "button.edit-btn", function () {
$("#Exception-modal .modal-title").html("異常設定資料 - 編輯");
selected_id = $(this).parents('tr').attr('data-id');
//取得單一異常設定資料
var url = "/PowerStation/GetOneException/";
var send_data = {
id: selected_id
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$("#Exception_Type_modal").val(rel.data.type);
$("#Exception_Alarm_modal").val(rel.data.alarm);
$("#Exception_UpperLimit_modal").val(rel.data.upperLimit);
$("#Exception_LowerLimit_modal").val(rel.data.lowerLimit);
$("#Exception-modal").modal();
}, 'json');
});
//#endregion
//#region 土地與房屋按鈕控制
//儲存
$('#land_buildingPart').on("click", "button.save-land-building-info-btn", function () {
@ -1521,6 +1296,152 @@
$("#add-land-building-card button#cancel-add-land-building-info-btn").hide();
});
//#endregion
//#region 新增維運資料
function AddOperation()
{
selected_id = 0;
$("#Operation-modal .modal-title").html("運維廠商資料 - 新增");
$("#Operation-form").trigger("reset");
$("#Operation-modal").modal();
}
//#endregion
//#region 儲存運維資料
function SaveOperation() {
if ($("#Operation-form").valid()) {
var url = "/PowerStation/SaveOperation";
var send_data = {
Id: selected_id,
PowerStationId: stationId,
Type: $("#Operation_role_modal").val(),
Name: $("#Operation_factory_modal").val(),
ContactPerson: $("#Operation_name_modal").val(),
Phone: $("#Operation_phone_modal").val(),
Email: $("#Operation_email_modal").val(),
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
else
{
toast_ok(rel.msg);
$('#Operation-modal').modal('hide');
OperationTable.ajax.reload();
return;
}
}, 'json');
}
}
//#endregion
//#region 取一筆運維
$('#Operation_table').on("click", "button.edit-btn", function () {
$("#Operation-modal .modal-title").html("運維廠商資料 - 編輯");
selected_id = $(this).parents('tr').attr('data-id');
//取得單一運維基本資料
var url = "/PowerStation/GetOneOperation/";
var send_data = {
id: selected_id
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$("#Operation_role_modal").val(rel.data.type);
$("#Operation_factory_modal").val(rel.data.name);
$("#Operation_name_modal").val(rel.data.contactPerson);
$("#Operation_phone_modal").val(rel.data.phone);
$("#Operation_email_modal").val(rel.data.email);
$("#Operation-modal").modal();
}, 'json');
});
//#endregion
//#region 刪除運維資料
$('#Operation_table').on("click", "button.del-btn", function () {
selected_id = $(this).parents('tr').attr('data-id');
var url = "/PowerStation/DeleteOneOperation/";
var send_data = {
Id: selected_id
}
$.post(url, send_data, function (rel) {
if (rel.code == "9999") {
toast_error(rel.msg);
return;
}
toast_ok(rel.msg);
OperationTable.ajax.reload();
}, 'json');
});
//#endregion
//#region 新增裝置資料
function AddDevice() {
selected_id = 0;
$("#Device-modal .modal-title").html("裝置資料 - 新增");
$("#Device-form").trigger("reset");
$("#Device-modal").modal();
}
//#endregion
//#region 儲存裝置資料
function SaveDevice() {
if ($("#Device-form").valid()) {
var url = "/PowerStation/SaveDevice";
var send_data = {
Id: selected_id,
PowerStationId: stationId,
Name: $("#Device_Name_modal").val(),
Type: $("#Device_Type_modal").val(),
TypeName: $("#Device_Type_modal :selected").text(),
Brand: $("#Device_Brand_modal").val(),
ProductModel: $("#Device_ProductModel_modal").val(),
DBName: $("#Device_DBName_modal").val(),
TableName: $("#Device_TableName_modal").val(),
ColName: $("#Device_ColName_modal").val(),
Remark: $("#Device_Remark_modal").val()
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
else {
toast_ok(rel.msg);
$('#Device-modal').modal('hide');
DeviceTable.ajax.reload();
return;
}
}, 'json');
}
}
//#endregion
//#region 取一筆設備
$('#Device_table').on("click", "button.edit-btn", function () {
$("#Device-modal .modal-title").html("設備資料 - 編輯");
@ -1555,7 +1476,101 @@
});
//#endregion
//#region 刪除運維
//#region 刪除裝置
$('#Device_table').on("click", "button.del-btn", function () {
selected_id = $(this).parents('tr').attr('data-id');
var url = "/PowerStation/DeleteOneDevice/";
var send_data = {
Id: selected_id
}
$.post(url, send_data, function (rel) {
if (rel.code == "9999") {
toast_error(rel.msg);
return;
}
toast_ok(rel.msg);
DeviceTable.ajax.reload();
}, 'json');
});
//#endregion
//#region 新增異常設定資料
function AddException() {
selected_id = 0;
$("#Exception-modal .modal-title").html("異常設定資料 - 新增");
$("#Exception-form").trigger("reset");
$("#Exception-modal").modal();
}
//#endregion
//#region 儲存異常設定資料
function SaveException() {
if ($("#Exception-form").valid()) {
var url = "/PowerStation/SaveException";
var send_data = {
Id: selected_id,
PowerStationId: stationId,
Type: $("#Exception_Type_modal").val(),
UpperLimit: $("#Exception_UpperLimit_modal").val(),
LowerLimit: $("#Exception_LowerLimit_modal").val(),
Alarm: $("#Exception_Alarm_modal").val()
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
else {
toast_ok(rel.msg);
$('#Exception-modal').modal('hide');
ExceptionTable.ajax.reload();
return;
}
}, 'json');
}
}
//#endregion
//#region 取一筆異常設定
$('#Exception_table').on("click", "button.edit-btn", function () {
$("#Exception-modal .modal-title").html("異常設定資料 - 編輯");
selected_id = $(this).parents('tr').attr('data-id');
//取得單一異常設定資料
var url = "/PowerStation/GetOneException/";
var send_data = {
id: selected_id
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$("#Exception_Type_modal").val(rel.data.type);
$("#Exception_Alarm_modal").val(rel.data.alarm);
$("#Exception_UpperLimit_modal").val(rel.data.upperLimit);
$("#Exception_LowerLimit_modal").val(rel.data.lowerLimit);
$("#Exception-modal").modal();
}, 'json');
});
//#endregion
//#region 刪除異常
$('#Exception_table').on("click", "button.del-btn", function () {
selected_id = $(this).parents('tr').attr('data-id');