Merge branch 'master' into Willy

This commit is contained in:
b110212000 2021-06-29 18:07:16 +08:00
commit 85858ff7c0
9 changed files with 74 additions and 48 deletions

View File

@ -331,7 +331,7 @@ namespace SolarPower.Controllers
await roleRepository.AddAsync(role, roleProperties); await roleRepository.AddAsync(role, roleProperties);
#endregion #endregion
#region DB及TableDB編號規則 solar_com_()exsolar_com_0001 #region DB及TableDB編號規則 solar_com_()exsolar_com0001
var siteDBFormat = "solar_com{0}_test"; var siteDBFormat = "solar_com{0}_test";

View File

@ -276,6 +276,7 @@ namespace SolarPower.Controllers
PhotovoltaicPanelSpecification = post.PhotovoltaicPanelSpecification, PhotovoltaicPanelSpecification = post.PhotovoltaicPanelSpecification,
PhotovoltaicPanelAmount = post.PhotovoltaicPanelAmount, PhotovoltaicPanelAmount = post.PhotovoltaicPanelAmount,
SiteDB = company.SiteDB, SiteDB = company.SiteDB,
SolarType = post.SolarType,
CreatedBy = myUser.Id CreatedBy = myUser.Id
}; };
@ -303,6 +304,7 @@ namespace SolarPower.Controllers
"PhotovoltaicPanelSpecification", "PhotovoltaicPanelSpecification",
"PhotovoltaicPanelAmount", "PhotovoltaicPanelAmount",
"SiteDB", "SiteDB",
"SolarType",
"CreatedBy" "CreatedBy"
}; };
@ -392,6 +394,7 @@ namespace SolarPower.Controllers
PhotovoltaicPanelProductModel = post.PhotovoltaicPanelProductModel, PhotovoltaicPanelProductModel = post.PhotovoltaicPanelProductModel,
PhotovoltaicPanelSpecification = post.PhotovoltaicPanelSpecification, PhotovoltaicPanelSpecification = post.PhotovoltaicPanelSpecification,
PhotovoltaicPanelAmount = post.PhotovoltaicPanelAmount, PhotovoltaicPanelAmount = post.PhotovoltaicPanelAmount,
SolarType = post.SolarType,
UpdatedBy = myUser.Id UpdatedBy = myUser.Id
}; };
@ -416,6 +419,7 @@ namespace SolarPower.Controllers
"PhotovoltaicPanelProductModel", "PhotovoltaicPanelProductModel",
"PhotovoltaicPanelSpecification", "PhotovoltaicPanelSpecification",
"PhotovoltaicPanelAmount", "PhotovoltaicPanelAmount",
"SolarType",
"UpdatedBy", "UpdatedBy",
}; };

View File

@ -177,6 +177,7 @@ namespace SolarPower.Models.PowerStation
public string PhotovoltaicPanelProductModel { get; set; } //光電板型號 public string PhotovoltaicPanelProductModel { get; set; } //光電板型號
public string PhotovoltaicPanelSpecification { get; set; } //光電板規格 public string PhotovoltaicPanelSpecification { get; set; } //光電板規格
public int PhotovoltaicPanelAmount { get; set; } //光電板規格 public int PhotovoltaicPanelAmount { get; set; } //光電板規格
public byte SolarType { get; set; } //電站類型
} }
public class UpdatePowerStationInfo : Updated public class UpdatePowerStationInfo : Updated
@ -199,6 +200,7 @@ namespace SolarPower.Models.PowerStation
public string PhotovoltaicPanelProductModel { get; set; } //光電板型號 public string PhotovoltaicPanelProductModel { get; set; } //光電板型號
public string PhotovoltaicPanelSpecification { get; set; } //光電板規格 public string PhotovoltaicPanelSpecification { get; set; } //光電板規格
public int PhotovoltaicPanelAmount { get; set; } //光電板規格 public int PhotovoltaicPanelAmount { get; set; } //光電板規格
public byte SolarType { get; set; } //電站類型
} }
public class PostBoETPCInfo public class PostBoETPCInfo

View File

@ -90,7 +90,11 @@ namespace SolarPower.Repository.Implement
{ {
try try
{ {
var sql = $"SELECT * FROM {tableName} WHERE Deleted = 0"; var sql = @$"SELECT *, psc.SPStationAmount FROM {tableName} c
LEFT JOIN (SELECT ps.CompanyId, COUNT(*) AS SPStationAmount
FROM power_station ps
WHERE ps.Deleted = 0 GROUP BY ps.CompanyId) psc ON psc.CompanyId = c.Id
WHERE c.Deleted = 0";
if (filter.SelectedCompanyId > 0) if (filter.SelectedCompanyId > 0)
{ {

View File

@ -36,6 +36,10 @@
</a> </a>
</div> </div>
<div class="card p-4 border-top-left-radius-0 border-top-right-radius-0"> <div class="card p-4 border-top-left-radius-0 border-top-right-radius-0">
@if (ViewBag.ErrMsg != null && ViewBag.ErrMsg != "")
{
<p class="alert alert-danger">@ViewBag.ErrMsg</p>
}
<form id="login-form" asp-action="Index" method="post"> <form id="login-form" asp-action="Index" method="post">
<div class="form-group"> <div class="form-group">
<label class="form-label" for="username">帳號</label> <label class="form-label" for="username">帳號</label>

View File

@ -327,8 +327,8 @@
</a> </a>
</div> </div>
<div class="col-6 text-right"> <div class="col-6 text-right">
<a href="javascript:CardDisplay();" class="btn btn-secondary btn-icon waves-effect waves-themed"><span class="fal fa-list mr-1"></span></a> <a href="javascript:TableDisplay();" class="btn btn-secondary btn-icon waves-effect waves-themed"><span class="fal fa-list mr-1"></span></a>
<a href="javascript:TableDisplay();" class="btn btn-secondary btn-icon waves-effect waves-themed"><span class="fal fa-grip-horizontal mr-1"></span></a> <a href="javascript:CardDisplay();" class="btn btn-secondary btn-icon waves-effect waves-themed"><span class="fal fa-grip-horizontal mr-1"></span></a>
</div> </div>
</div> </div>
@ -343,24 +343,24 @@
<th>裝置容量(kWp)</th> <th>裝置容量(kWp)</th>
<th>逆變器數量</th> <th>逆變器數量</th>
<th>台電掛表日</th> <th>台電掛表日</th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@*<tr> @*<tr>
<th scope="row">PEP-NTP001-PYR-01</th> <th scope="row">PEP-NTP001-PYR-01</th>
<td>日照計01</td> <td>日照計01</td>
<td>日照計</td> <td>日照計</td>
<td>ADTEK</td> <td>ADTEK</td>
<td>CS1</td> <td>CS1</td>
<td></td> <td></td>
<td>CS1</td> <td>CS1</td>
<td></td> <td></td>
<td></td> <td></td>
<td> <td>
<button type="button" class="btn btn-primary btn-pills waves-effect waves-themed">修改</button> <button type="button" class="btn btn-primary btn-pills waves-effect waves-themed">修改</button>
</td> </td>
</tr>*@ </tr>*@
</tbody> </tbody>
</table> </table>
</div> </div>
@ -410,10 +410,6 @@
$(function () { $(function () {
var localurl = this.location.href; var localurl = this.location.href;
//#region 電站區域Tab
//#endregion
var url = "/PowerStation/GetSolarCitySummary"; var url = "/PowerStation/GetSolarCitySummary";
var ids = new Array(0) var ids = new Array(0)
$.post(url, function (rel) { $.post(url, function (rel) {
@ -435,12 +431,14 @@
$('#AreaTab' + val.cityId).find('#solarCount').html(val.amount) $('#AreaTab' + val.cityId).find('#solarCount').html(val.amount)
//alert(val.cityId+val.city + val.amount); //alert(val.cityId+val.city + val.amount);
//電站區域內容 //電站區域內容
$('#templateArea').find('.tab-pane').attr('id', 'tab-'+val.cityId).clone().appendTo($('#area')); $('#templateArea').find('.tab-pane').attr('id', 'tab-' + val.cityId).clone().appendTo($('#area'));
$('#tab-' + val.cityId).attr('aria-labelledby', val.cityId) $('#tab-' + val.cityId).attr('aria-labelledby', val.cityId)
$('#tab-' + val.cityId).find('#solarCard').attr('id', 'solarCard' + val.cityId); $('#tab-' + val.cityId).find('#solarCard').attr('id', 'solarCard' + val.cityId);
$('#tab-' + val.cityId).find('#solarTable').attr('id', 'solarTable' + val.cityId); $('#tab-' + val.cityId).find('#solarTable').attr('id', 'solarTable' + val.cityId);
}); });
addPowerStationCard(ids); addPowerStationCard(ids);
$("#areaTab").find(".nav-item > a").first().click();
return; return;
} }
@ -462,34 +460,30 @@
else { else {
$.each(rel.data, function (index, val) { $.each(rel.data, function (index, val) {
//電站卡片 //電站卡片
$('#templateCard').find('.col-xl-2').attr('id', 'card'+val.id).clone().appendTo($('#solarCard' + val.cityId)); $('#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').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('src', val.mainDisplay);
$('#card' + val.id).find('#solarName').text(val.name); $('#card' + val.id).find('#solarName').text(val.name);
$('#card' + val.id).find('#today_kwh').text(val.kwh); $('#card' + val.id).find('#today_kwh').text(val.kwh);
$('#card' + val.id).find('#kwhkwp').text(val.inverterAmount); $('#card' + val.id).find('#kwhkwp').text(val.inverterAmount);
$('#card' + val.id).find('#PR').text(val.electricityMeterAt); $('#card' + val.id).find('#PR').text(val.electricityMeterAt);
$('#solarTable' + val.id).find('tbody').append('<tr>' + $('#solarTable' + val.cityId).find('tbody').append('<tr>' +
'<td>'+val.id+'</td>' + '<td>' + val.id + '</td>' +
'<td>' + val.name+'</td>' + '<td>' + val.name + '</td>' +
'<td>' + val.kwh+'</td>' + '<td>' + val.kwh + '</td>' +
'<td>' + val.inverterAmount+'</td>' + '<td>' + val.inverterAmount + '</td>' +
'<td>' + val.electricityMeterAt+'</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></td>' + '<td><button type="button" class="btn btn-primary btn-pills waves-effect waves-themed" onclick="location.href=\'' + localurl + '/edit?stationId=' + val.id + '\'">選擇</button></td>' +
'</tr>'); '</tr>');
}); });
$('.nav-tabs a[href="#' + tablocation + '"]').tab('show'); $('.nav-tabs a[href="#' + tablocation + '"]').tab('show');
$('.TableArea').hide();
return; return;
} }
}, 'json'); }, 'json');
} }
//電站區域 //電站區域
//$('#templateAreaTab').find('li').attr('id', 'AreaTabnewtaipei').clone().appendTo($('#areaTab')); //$('#templateAreaTab').find('li').attr('id', 'AreaTabnewtaipei').clone().appendTo($('#areaTab'));
@ -503,13 +497,13 @@
//$('#AreaTabHsinchu').find('a').attr('class', 'nav-link fs-lg px-4'); //$('#AreaTabHsinchu').find('a').attr('class', 'nav-link fs-lg px-4');
//$('#AreaTabHsinchu').find('#areaName').html('新竹市') //$('#AreaTabHsinchu').find('#areaName').html('新竹市')
//$('#AreaTabHsinchu').find('#solarCount').html('3') //$('#AreaTabHsinchu').find('#solarCount').html('3')
//$('#templateAreaTab').find('li').attr('id', 'AreaTabPingtung').clone().appendTo($('#areaTab')); //$('#templateAreaTab').find('li').attr('id', 'AreaTabPingtung').clone().appendTo($('#areaTab'));
//$('#AreaTabPingtung').find('a').attr('href', '#tab-Pingtung'); //$('#AreaTabPingtung').find('a').attr('href', '#tab-Pingtung');
//$('#AreaTabPingtung').find('a').attr('class', 'nav-link fs-lg px-4'); //$('#AreaTabPingtung').find('a').attr('class', 'nav-link fs-lg px-4');
//$('#AreaTabPingtung').find('#areaName').html('屏東縣') //$('#AreaTabPingtung').find('#areaName').html('屏東縣')
//$('#AreaTabPingtung').find('#solarCount').html('1') //$('#AreaTabPingtung').find('#solarCount').html('1')
//電站區域內容 //電站區域內容
//$('#templateArea').find('.tab-pane').attr('id', 'tab-newtaipei').clone().appendTo($('#area')); //$('#templateArea').find('.tab-pane').attr('id', 'tab-newtaipei').clone().appendTo($('#area'));
//$('#tab-newtaipei').attr('aria-labelledby', 'tab-newtaipei') //$('#tab-newtaipei').attr('aria-labelledby', 'tab-newtaipei')
@ -527,14 +521,14 @@
//$('#tab-Pingtung').find('#solarTable').attr('id', 'solarTablePingtung'); //$('#tab-Pingtung').find('#solarTable').attr('id', 'solarTablePingtung');
//電站卡片 //電站卡片
$('.nav-tabs a[href="#tab-newtaipei"]').tab('show'); $('.nav-tabs a[href="#tab-newtaipei"]').tab('show');
$('.TableArea').hide(); TableDisplay();
}); });
function CardDisplay() { function CardDisplay() {
$('.TableArea').hide(); $('.TableArea').hide();
$('.solarCard').show(); $('.solarCard').show();
} }

View File

@ -129,6 +129,8 @@
$("#canecl-station-info-btn").hide(); $("#canecl-station-info-btn").hide();
$("#check_escrow").attr('disabled', false); $("#check_escrow").attr('disabled', false);
$("#select_solar_tpye").attr('disabled', false);
$(".city-name").hide(); $(".city-name").hide();
$(".power-station-name").html("新增電站"); $(".power-station-name").html("新增電站");
@ -864,7 +866,8 @@
PhotovoltaicPanelBrand: $("#photovoltaic_panel_brand").val(), PhotovoltaicPanelBrand: $("#photovoltaic_panel_brand").val(),
PhotovoltaicPanelSpecification: $("#photovoltaic_panel_specification").val(), PhotovoltaicPanelSpecification: $("#photovoltaic_panel_specification").val(),
PhotovoltaicPanelAmount: $("#photovoltaic_panel_amount").val(), PhotovoltaicPanelAmount: $("#photovoltaic_panel_amount").val(),
PhotovoltaicPanelProductModel: $("#photovoltaic_panel_product_model").val() PhotovoltaicPanelProductModel: $("#photovoltaic_panel_product_model").val(),
SolarType: $("#select_solar_tpye").val()
} }
$.post(url, send_data, function (rel) { $.post(url, send_data, function (rel) {
@ -1006,6 +1009,8 @@
$("#electricity_meter_at").hide(); $("#electricity_meter_at").hide();
$("#estimated_recovery_time").hide(); $("#estimated_recovery_time").hide();
$("#select_solar_tpye").attr("disabled", true);
$("#generating_capacity").hide(); $("#generating_capacity").hide();
$("#escrow_name").hide(); $("#escrow_name").hide();
$("#power_rate").hide(); $("#power_rate").hide();
@ -1066,6 +1071,8 @@
$("#electricity_meter_at").show(); $("#electricity_meter_at").show();
$("#estimated_recovery_time").show(); $("#estimated_recovery_time").show();
$("#select_solar_tpye").attr("disabled", false);
$("#generating_capacity").show(); $("#generating_capacity").show();
$("#escrow_name").show(); $("#escrow_name").show();
$("#power_rate").show(); $("#power_rate").show();
@ -1244,6 +1251,7 @@
$("#select_city").val(powerStationData.cityId).trigger("change"); $("#select_city").val(powerStationData.cityId).trigger("change");
$("#select_area").val(powerStationData.areaId); $("#select_area").val(powerStationData.areaId);
$("#select_solar_tpye").val(powerStationData.solarType);
//#region 電站基本資料 文字 //#region 電站基本資料 文字
$("#address_detail_text").html(powerStationData.address); $("#address_detail_text").html(powerStationData.address);
@ -2227,7 +2235,7 @@
//#region 創建電站圖片box //#region 創建電站圖片box
function CreatePowerStationImageBox(dom, value) { function CreatePowerStationImageBox(dom, value) {
var str = '<div class="col-xl">' + var str = '<div class="col-xl" style="max-width: 20%;">' +
'<div class="card border m-auto m-lg-0" style="padding: 9.5px;">' + '<div class="card border m-auto m-lg-0" style="padding: 9.5px;">' +
'<img src="' + value.image + '" class="card-img-top img-zoom" alt="...">' + '<img src="' + value.image + '" class="card-img-top img-zoom" alt="...">' +
'<a href="javascript:void(0);" class="btn btn-danger btn-lg btn-icon rounded-circle waves-effect waves-themed position-absolute pos-top pos-right del-power-station-image-btn" data-id="' + value.id + '">' + '<a href="javascript:void(0);" class="btn btn-danger btn-lg btn-icon rounded-circle waves-effect waves-themed position-absolute pos-top pos-right del-power-station-image-btn" data-id="' + value.id + '">' +
@ -2369,7 +2377,7 @@
//#region 創建單線圖box //#region 創建單線圖box
function CreatePowerStationSingleLineBox(dom, value) { function CreatePowerStationSingleLineBox(dom, value) {
var str = '<div class="col-xl">' + var str = '<div class="col-xl" style="max-width: 20%;">' +
'<div class="card border m-auto m-lg-0" style="padding: 9.5px;">' + '<div class="card border m-auto m-lg-0" style="padding: 9.5px;">' +
'<img src="' + value.image + '" class="card-img-top img-zoom" alt="...">' + '<img src="' + value.image + '" class="card-img-top img-zoom" alt="...">' +
'<a href="javascript:void(0);" class="btn btn-danger btn-lg btn-icon rounded-circle waves-effect waves-themed position-absolute pos-top pos-right del-power-station-single-line-btn" data-id="' + value.id + '">' + '<a href="javascript:void(0);" class="btn btn-danger btn-lg btn-icon rounded-circle waves-effect waves-themed position-absolute pos-top pos-right del-power-station-single-line-btn" data-id="' + value.id + '">' +

View File

@ -34,12 +34,22 @@
</select> </select>
</div> </div>
</div> </div>
<div class="col-xl-6 row align-items-center"> <div class="col-xl-3 row align-items-center">
<div class="col-12"> <div class="col-12">
<label id="address_detail_text" class="color-info-600"></label> <label id="address_detail_text" class="color-info-600"></label>
<input type="text" id="address_detail" name="address_detail" class="form-control"> <input type="text" id="address_detail" name="address_detail" class="form-control">
</div> </div>
</div> </div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="solar_tpye_label">電站類型</label>
<div class="col-xl-8">
<select class="form-control" id="select_solar_tpye">
<option value="0" selected>自建躉售</option>
<option value="1" selected>租建躉售</option>
<option value="2" selected>自建自用</option>
</select>
</div>
</div>
</div> </div>
<div class="row mb-3 d-flex justify-content-between"> <div class="row mb-3 d-flex justify-content-between">

View File

@ -11,7 +11,7 @@
</div> </div>
</div> </div>
<div class="card-body" id="power-station-image-card"> <div class="card-body" id="power-station-image-card">
<div class="row d-flex justify-content-between img-zoom-div"> <div class="row d-flex justify-content-start img-zoom-div">
</div> </div>
</div> </div>
@ -46,7 +46,7 @@
</div> </div>
</div> </div>
<div class="card-body" id="power-station-single-line-card"> <div class="card-body" id="power-station-single-line-card">
<div class="row d-flex justify-content-between img-zoom-div"> <div class="row d-flex justify-content-start img-zoom-div">
</div> </div>
</div> </div>