先上傳

This commit is contained in:
b110212000 2021-06-26 16:41:52 +08:00
parent 8a9569fce0
commit 8dd4bcc9f8
3 changed files with 256 additions and 30 deletions

View File

@ -193,10 +193,8 @@ namespace SolarPower.Repository.Implement
{ {
var db_name = result.SiteDB; var db_name = result.SiteDB;
var sql_operation_personnel = @$"SELECT UserId FROM power_station_operation_personnel op WHERE Deleted = 0 AND op.PowerStationId = @PowerStationId";
var sql_operation_personnel = @$"SELECT UserId FROM {db_name}.power_station_operation_personnel op WHERE Deleted = 0 AND op.PowerStationId = @PowerStationId";
result.OperationPersonnelIds = (await conn.QueryAsync<int>(sql_operation_personnel, new { PowerStationId = result.Id })).ToList(); result.OperationPersonnelIds = (await conn.QueryAsync<int>(sql_operation_personnel, new { PowerStationId = result.Id })).ToList();
var sql_land_building = @$"SELECT lb.*, u.Name AS CreatorName FROM {db_name}.land_building lb var sql_land_building = @$"SELECT lb.*, u.Name AS CreatorName FROM {db_name}.land_building lb
LEFT JOIN user u ON lb.CreatedBy = u.Id LEFT JOIN user u ON lb.CreatedBy = u.Id
WHERE lb.Deleted = 0 AND PowerStationId = @PowerStationId"; WHERE lb.Deleted = 0 AND PowerStationId = @PowerStationId";
@ -931,7 +929,7 @@ namespace SolarPower.Repository.Implement
conn.Open(); conn.Open();
try try
{ {
string sql = GenerateInsertQueryWithCustomDBNameAndTable(properties, db_name, "power_station_operation_personnel"); string sql = GenerateInsertQueryWithCustomTable(properties, "power_station_operation_personnel");
count = await conn.ExecuteAsync(sql, entity); count = await conn.ExecuteAsync(sql, entity);
} }

View File

@ -1485,6 +1485,24 @@
}); });
//#endregion //#endregion
//#region 新增控制器資料
function AddController() {
selected_id = 0;
$("#Controller-modal .modal-title").html("控制器資料 - 新增");
$("#Controller-form").trigger("reset");
$("#Controller-modal").modal();
}
//#endregion
//#region 新增逆變器資料
function AddInverter() {
selected_id = 0;
$("#Inverter-modal .modal-title").html("逆變器資料 - 新增");
$("#Inverter-form").trigger("reset");
$("#Inverter-modal").modal();
}
//#endregion
//#region 新增裝置資料 //#region 新增裝置資料
function AddDevice() { function AddDevice() {
selected_id = 0; selected_id = 0;
@ -1494,6 +1512,21 @@
} }
//#endregion //#endregion
//#region 新增共用裝置資料
function AddShareDevice() {
selected_id = 0;
$("#ShareDevice-modal .modal-title").html("共用裝置資料 - 新增");
$("#ShareDevice-form").trigger("reset");
$("#ShareDevice-modal").modal();
}
//#endregion
//#region 儲存控制器資料
function SaveController() {
}
//#endregion
//#region 儲存裝置資料 //#region 儲存裝置資料
function SaveDevice() { function SaveDevice() {

View File

@ -1,29 +1,188 @@
<div class="row mb-5"> <div class="row mb-5">
<div class="col-6"><h3>裝置設定</h3></div> <div class="card border mb-g w-100">
<div class="col-6 text-right"> <div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">
<a href="javascript:;" class="btn btn-success waves-effect waves-themed mb-3" id="addDevice-btn" onclick="AddDevice()"> <!-- we wrap header title inside a div tag with utility padding -->
<span class="fal fa-plus mr-1"></span>新增 <div class="card-title font-weight-bold">控制器</div>
</a> <div class="text-right ">
<a href="javascript:;" class="btn btn-success waves-effect waves-themed mb-3" id="addController-btn" onclick="AddController()">
<span class="fal fa-plus mr-1"></span> 新增
</a>
</div>
</div>
<div class="card-body">
<div class="w-100">
<table id="Controller_table" class="table table-bordered table-hover m-0 text-center">
<thead class="thead-themed">
<tr>
<th>控制器編號</th>
<th>建立時間</th>
<th>建立人</th>
<th>功能</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div> </div>
<div class="w-100">
<table id="Device_table" class="table table-bordered table-hover m-0 text-center"> <div class="card border mb-g w-100">
<thead class="thead-themed"> <div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">
<tr> <!-- we wrap header title inside a div tag with utility padding -->
<th>設備ID</th> <div class="card-title font-weight-bold">逆變器</div>
<th>裝置名稱</th> <div class="text-right">
<th>裝置類型</th> <a href="javascript:;" class="btn btn-success waves-effect waves-themed mb-3" id="addInverter-btn" onclick="AddInverter()">
<th>廠牌</th> <span class="fal fa-plus mr-1"></span> 新增
<th>型號</th> </a>
<th>DBName</th> </div>
<th>tableName</th> </div>
<th>columnName</th> <div class="card-body" id="power-station-image-card">
<th>備註</th> <div class="w-100">
<th>功能</th> <table id="Inverter_table" class="table table-bordered table-hover m-0 text-center">
</tr> <thead class="thead-themed">
</thead> <tr>
<tbody> <th>控制器編號</th>
</tbody> <th>逆變器編號</th>
</table> <th>建立時間</th>
<th>建立人</th>
<th>功能</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="card border mb-g w-100">
<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-success waves-effect waves-themed mb-3" id="addDevice-btn" onclick="AddDevice()">
<span class="fal fa-plus mr-1"></span> 新增
</a>
</div>
</div>
<div class="card-body" id="power-station-image-card">
<div class="w-100">
<table id="Device_table" class="table table-bordered table-hover m-0 text-center">
<thead class="thead-themed">
<tr>
<th>電站編號</th>
<th>控制器編號</th>
<th>設備編號</th>
<th>裝置類型</th>
<th>廠牌</th>
<th>型號</th>
<th>DBName</th>
<th>tableName</th>
<th>columnName</th>
<th>備註</th>
<th>功能</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="card border mb-g w-100">
<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-success waves-effect waves-themed mb-3" id="addShareDevice-btn" onclick="AddShareDevice()">
<span class="fal fa-plus mr-1"></span> 新增
</a>
</div>
</div>
<div class="card-body" id="power-station-image-card">
<div class="w-100">
<table id="ShareDevice_table" class="table table-bordered table-hover m-0 text-center">
<thead class="thead-themed">
<tr>
<th>電站編號</th>
<th>控制器編號</th>
<th>設備編號</th>
<th>裝置類型</th>
<th>廠牌</th>
<th>型號</th>
<th>DBName</th>
<th>tableName</th>
<th>columnName</th>
<th>備註</th>
<th>功能</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="modal fade" id="Controller-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">
控制器 - 新增
</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true"><i class="fal fa-times"></i></span>
</button>
</div>
<div class="modal-body">
<form class="Controller-form" id="Controller-form">
<div class="row">
<div class="form-group col-lg-6">
<label class="form-label" for="Controller_Count_modal"><span class="text-danger">*</span>控制器數量</label>
<input type="number" id="Controller_Count_modal" name="Device_Name_modal" class="form-control">
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" onclick="SaveController()">確定</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="Inverter-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">
逆變器 - 新增
</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true"><i class="fal fa-times"></i></span>
</button>
</div>
<div class="modal-body">
<form class="Inverter-form" id="Controller-form">
<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>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" onclick="SaveInverter()">確定</button>
</div>
</div>
</div> </div>
</div> </div>
@ -43,8 +202,9 @@
<div class="row"> <div class="row">
<div class="form-group col-lg-6"> <div class="form-group col-lg-6">
<label class="form-label" for="Device_Name_modal"><span class="text-danger">*</span>裝置名稱</label> <label class="form-label" for="Device_Controller_modal"><span class="text-danger">*</span>控制器編號</label>
<input type="text" id="Device_Name_modal" name="Device_Name_modal" class="form-control"> <select class="form-control" id="Device_Controller_modal">
</select>
</div> </div>
<div class="form-group col-lg-6"> <div class="form-group col-lg-6">
<label class="form-label" for="Device_Type_modal"><span class="text-danger">*</span>裝置類型</label> <label class="form-label" for="Device_Type_modal"><span class="text-danger">*</span>裝置類型</label>
@ -92,4 +252,39 @@
</div> </div>
</div> </div>
</div> </div>
</div>
<div class="modal fade" id="ShareDevice-modal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">
共用裝置 - 新增
</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true"><i class="fal fa-times"></i></span>
</button>
</div>
<div class="modal-body">
<form class="ShareDevice-form" id="ShareDevice-form">
<div class="row">
<div class="form-group col-lg-6">
<label class="form-label" for="ShareDevice_PowerStationId_modal"><span class="text-danger">*</span>電站編號</label>
<select class="form-control" id="ShareDevice_PowerStationId_modal">
</select>
</div>
<div class="form-group col-lg-6">
<label class="form-label" for="ShareDevice_UID_modal"><span class="text-danger">*</span>設備編號</label>
<select class="form-control" id="ShareDevice_UID_modal">
</select>
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" onclick="SaveShareDevice()">確定</button>
</div>
</div>
</div>
</div> </div>