diff --git a/SolarPower/Controllers/OperationController.cs b/SolarPower/Controllers/OperationController.cs index 3450c6c..799c34a 100644 --- a/SolarPower/Controllers/OperationController.cs +++ b/SolarPower/Controllers/OperationController.cs @@ -544,6 +544,7 @@ namespace SolarPower.Controllers FixDo = post.FixDo, Status = post.Status, FinishTime = !string.IsNullOrEmpty(finishTime) ? finishTime : null, + WorkPersonId = post.WorkPersonId, WorkTime = post.WorkTime, Notice = post.Notice, Description = post.Description, @@ -562,6 +563,7 @@ namespace SolarPower.Controllers "WorkTime", "Notice", "Description", + "WorkPersonId", "UpdatedBy", }; @@ -753,7 +755,10 @@ namespace SolarPower.Controllers foreach (var file in recode.RecodeFiles) { var hyperLink = "" + file.FileName + ""; - + if(recode.HyperLinks == null) + { + recode.HyperLinks = new List(); + } recode.HyperLinks.Add(hyperLink); } } diff --git a/SolarPower/Models/Overview.cs b/SolarPower/Models/Overview.cs index e3b25e4..bb72716 100644 --- a/SolarPower/Models/Overview.cs +++ b/SolarPower/Models/Overview.cs @@ -42,6 +42,8 @@ namespace SolarPower.Models { public List Cityid { get; set; } //都市 public List Status { get; set; } //狀態 + public int KwhOrder { get; set; } + public int PrOrder { get; set; } } public class StationIds diff --git a/SolarPower/Repository/Implement/OverviewRepository.cs b/SolarPower/Repository/Implement/OverviewRepository.cs index b556728..2e74286 100644 --- a/SolarPower/Repository/Implement/OverviewRepository.cs +++ b/SolarPower/Repository/Implement/OverviewRepository.cs @@ -130,6 +130,28 @@ namespace SolarPower.Repository.Implement try { var ids = ""; + var KWH = ""; + var PR = ""; + if(post.KwhOrder == 0) + { + KWH = " ORDER BY Today_kwh DESC"; + } + else + { + KWH = " ORDER BY Today_kwh"; + } + + if (post.PrOrder == 0) + { + PR = ",today_PR DESC"; + } + else + { + PR = ",today_PR"; + } + + + foreach (var id in post.Cityid) { ids = ids + id + ","; @@ -140,19 +162,19 @@ namespace SolarPower.Repository.Implement } if (User.Role.Layer == 0 || User.Role.Layer == 1) { - var sql = "SELECT * FROM power_station WHERE CityId IN @IDs AND HealthStatus IN @Status"; + var sql = "SELECT * FROM power_station WHERE CityId IN @IDs AND HealthStatus IN @Status"+ KWH + PR; powerstation = (await conn.QueryAsync(sql, new { IDs = post.Cityid, Status = post.Status})).ToList(); trans.Commit(); } else if (User.Role.Layer == 2) { - var sql = "SELECT * FROM power_station WHERE CityId IN @IDs AND CompanyId=@CompanyId AND HealthStatus IN @Status"; + var sql = "SELECT * FROM power_station WHERE CityId IN @IDs AND CompanyId=@CompanyId AND HealthStatus IN @Status" + KWH + PR; powerstation = (await conn.QueryAsync(sql, new { IDs = post.Cityid, CompanyId = User.CompanyId , Status = post.Status })).ToList(); trans.Commit(); } else { - var sql = "SELECT power_station.* FROM power_station LEFT JOIN power_station_operation_personnel ON power_station.Id = power_station_operation_personnel.PowerStationId WHERE CityId IN @IDs AND Userid = @UserId AND HealthStatus IN @Status"; + var sql = "SELECT power_station.* FROM power_station LEFT JOIN power_station_operation_personnel ON power_station.Id = power_station_operation_personnel.PowerStationId WHERE CityId IN @IDs AND Userid = @UserId AND HealthStatus IN @Status" + KWH + PR; powerstation = (await conn.QueryAsync(sql, new { IDs = post.Cityid, UserId = User.Id , Status = post.Status })).ToList(); trans.Commit(); } diff --git a/SolarPower/Views/Operation/OperationRecord.cshtml b/SolarPower/Views/Operation/OperationRecord.cshtml index e0d4791..9a3f839 100644 --- a/SolarPower/Views/Operation/OperationRecord.cshtml +++ b/SolarPower/Views/Operation/OperationRecord.cshtml @@ -79,7 +79,7 @@ 狀態 執行人員 本次作業預計 - 照片 + 檔案 完成時間 @*功能*@ @@ -98,7 +98,7 @@ 狀態 執行人員 本次作業預計 - @*照片*@ + 檔案 完成時間 @@ -907,9 +907,10 @@ str += ""; if (value.finishTime != undefined || value.finishTime != null || value.finishTime != "") { - value.hyperLinks.forEach(function (value3, index) { - str += value3; - }); + //value.hyperLinks.forEach(function (value3, index) { + // str += value3; + //}); + str += value.finishTime ; } str += ""; diff --git a/SolarPower/Views/StationOverview/Index.cshtml b/SolarPower/Views/StationOverview/Index.cshtml index 1edc79b..6fb26cf 100644 --- a/SolarPower/Views/StationOverview/Index.cshtml +++ b/SolarPower/Views/StationOverview/Index.cshtml @@ -34,21 +34,21 @@
- +
-
+
- - + +
- - + +
- - + +
@@ -58,16 +58,16 @@
-
-
-
- @@ -210,9 +210,15 @@ 編號 電站名稱 裝置容量(kWp) - 逆變器數量 - 台電掛表日 - + 累積發電量 + 今日發電量 + 發電小時 + PR + 日照 + 平均日照 + 今日收入 + 狀況 + 功能 @@ -244,9 +250,15 @@ 編號 電站名稱 裝置容量(kWp) - 逆變器數量 - 台電掛表日 - + 累積發電量 + 今日發電量 + 發電小時 + PR + 日照 + 平均日照 + 今日收入 + 狀況 + 功能 @@ -264,7 +276,7 @@ var ids = new Array(0);//當前選擇縣市 var powerids = new Array(0);//當前選擇電站 var Allids = new Array(0);//全部縣市 - var Allpowerids = new Array(0);//全部電站 + var status123 = new Array(0);//狀態 //#region Array.Remove Array.prototype.remove = function (val) { var index = this.indexOf(val); @@ -275,6 +287,8 @@ //#endregion $(function () { + status123 = []; + var Nurl = "/PowerStation/GetSolarCitySummary"; $.post(Nurl, function (rel) { if (rel.code != "0000") { @@ -290,6 +304,9 @@ ids.push(rel.data[i].cityId); Allids.push(rel.data[i].cityId); } + status123.push(1); + status123.push(2); + status123.push(3); getStation(ids); }, 'json'); @@ -299,11 +316,7 @@ $('#citytest').on("click", "button", function () { var clickid = $(this).attr('id'); var classid = clickid.split("_"); - var Newpowerids = new Array(0); var value = document.getElementById(clickid).className; - ids.sort(function (a, b) { - return a - b; - }); if (value == 'btn btn-outline-success waves-effect waves-themed ml-2') { //選擇 document.getElementById(clickid).setAttribute("class", 'btn btn-success waves-effect waves-themed ml-2'); ids.push(Number(classid[1])); @@ -317,47 +330,109 @@ function getStation(ids) { - var status = [1,2,3]; + var kwh = $('#kwh_order').val(); + var pr = $('#pr_order').val(); var send_data = { cityid: ids, - status: status, + status: status123, + kwhOrder: kwh, + prOrder: pr }; - //ids.sort(function (a, b) { - // return a - b; - //}); - //ids.sort(); - var Nurl = "/StationOverview/GetSolarByCity"; - $.post(Nurl, send_data, function (rel) { - if (rel.code != "0000") { - toast_error(rel.msg); - return; - } + ids.sort(function (a, b) { + return a - b; + }); + ids.sort(); + if (ids.length == 0 || status123.length == 0) { $('#areaCard').empty(); - $.each(rel.data, function (index, val) { - $('#templateCard').find('.col-xl-3').clone().attr('id', 'card_' + val.id).appendTo($('#areaCard')); - $('#card_' + val.id).find('#solarName').html(val.name); - $('#card_' + val.id).find('#Temp').html(val.todayWeatherTemp); - var type = ""; - switch (val.solarType) { - case 0: type = "自建躉售"; break; - case 1: type = "租建躉售"; break; - case 2: type = "自建自用"; break; - default: - console.log(`Sorry, we are out of ${val.solarType}.`); + $('#solarTable').find('tbody').empty(); + $("#today_kwh").html(0); + $("#total_kwh").html(0); + $("#today_irradiance").html(0); + $("#avg_irradiance").html(0); + $("#today_PR").html(0); + $("#avg_PR").html(0); + $("#today_kwhkwp").html(0); + $("#avg_kwhkwp").html(0); + $("#today_carbon").html(0); + $("#total_power_station_count").html(0); + $("#total_capacity").html(0); + $("#update_at").html(0); + } + else + { + var Nurl = "/StationOverview/GetSolarByCity"; + $.post(Nurl, send_data, function (rel) { + if (rel.code != "0000") { + toast_error(rel.msg); + return; } - $('#card_' + val.id).find('#stationtype').html(type); - var time = new Date(val.createdAt); - $('#card_' + val.id).find('#editSolarUrl').attr('href', localurl + '/Info?stationId=' + val.id); - $('#card_' + val.id).find('#date').html(time.getMonth() + "/" + time.getDate() + " " + time.getHours() + ":" + time.getMinutes()); - $('#card_' + val.id).find('#Capacity').html(val.generatingCapacity); - $('#card_' + val.id).find('#PowerRate').html(val.generatingCapacity * val.powerRate); - $('#card_' + val.id).find('#PR').html(val.pr); - $('#card_' + val.id).find('#aria').attr('aria-valuenow', val.pr); - $('#card_' + val.id).find('#aria').attr('style', "width:" + val.pr + "%;"); - powerids.push(val.id); - }); - GetStationCard(); - }, 'json'); + $('#areaCard').empty(); + $('#solarTable').find('tbody').empty(); + powerids = []; + $.each(rel.data, function (index, val) { + $('#templateCard').find('.col-xl-3').clone().attr('id', 'card_' + val.id).appendTo($('#areaCard')); + var statusicon; + switch (val.healthStatus) { + case 1: statusicon = ""; break; + case 2: statusicon = ""; break; + case 3: statusicon = ""; break; + default: + statusicon = 'NULL'; break; + } + $('#card_' + val.id).find('#solarName').html(statusicon + val.name); + $('#card_' + val.id).find('#Temp').html(val.todayWeatherTemp); + var type = ""; + switch (val.solarType) { + case 0: type = "自建躉售"; break; + case 1: type = "租建躉售"; break; + case 2: type = "自建自用"; break; + default: + console.log(`Sorry, we are out of ${val.solarType}.`); + } + $('#card_' + val.id).find('#stationtype').html(type); + var time = new Date(val.createdAt); + $('#card_' + val.id).find('#editSolarUrl').attr('href', localurl + '/Info?stationId=' + val.id); + $('#card_' + val.id).find('#date').html(time.getMonth() + "/" + time.getDate() + " " + time.getHours() + ":" + time.getMinutes()); + $('#card_' + val.id).find('#Capacity').html(val.today_kWh); + $('#card_' + val.id).find('#PowerRate').html(val.today_kWh * val.powerRate); + $('#card_' + val.id).find('#PR').html(val.today_PR); + $('#card_' + val.id).find('#aria').attr('aria-valuenow', val.today_PR); + $('#card_' + val.id).find('#aria').attr('style', "width:" + val.today_PR + "%;"); + powerids.push(val.id); + var statusName; + switch (val.healthStatus) { + case 1: + statusName = "設備正常"; + break; + case 2: + statusName = "設備斷線"; + break; + case 3: + statusName = "設備異常"; + break; + default: + statusName = "NULL"; + } + $('#solarTable').find('tbody').append('' + + '' + val.code + '' + + '' + val.name + '' + + '' + val.generatingCapacity + '' + + '' + val.total_kWh + '' + + '' + val.today_kWh + '' + + '' + val.solarHour + '' + + '' + val.today_PR + '' + + '' + val.today_irradiance + '' + + '' + val.avg_irradiance + '' + + '' + val.today_Monery + '' + + '' + statusName + '' + + '' + + + ''); + }); + GetStationCard(); + }, 'json'); + } + } function GetStationCard() { @@ -386,7 +461,52 @@ }); } + //#region 選擇狀態checkbox + $('#CheckStatus').on("click", "input", function () { + var clickid = $(this).attr('id'); + var classid = clickid.split("_"); + var job = document.getElementById(clickid); + if (job.checked == true) { + status123.push(Number(classid[1])); + } + else { + status123.remove(Number(classid[1])); + } + getStation(ids); + }) + //#endregion + $('#kwh_order').change(function () { + getStation(ids); + }) + + $('#pr_order').change(function () { + getStation(ids); + }) + + //#region 縣市全選 + function Allcity() { + ids = []; + $.each(Allids, function (index, val) { + var cityid = 'cityID_' + val; + document.getElementById(cityid).setAttribute("class", 'btn btn-success waves-effect waves-themed ml-2'); + ids.push(val); + }); + getStation(ids); + } + //#endregion + + //#region 狀態全選 + function AllStatus() { + status123 = []; + for (var i = 1; i <= 3; i++) + { + $('#Status_' + i).prop("checked", true); + status123.push(i); + } + getStation(ids); + } + //#endregion function CardDisplay() { diff --git a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml index 44ce060..5cf28a6 100644 --- a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml +++ b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml @@ -97,10 +97,14 @@ @section Scripts{ } \ No newline at end of file diff --git a/SolarPower/Views/StationOverview/_OperationRecord.cshtml b/SolarPower/Views/StationOverview/_OperationRecord.cshtml index 94571ea..9243033 100644 --- a/SolarPower/Views/StationOverview/_OperationRecord.cshtml +++ b/SolarPower/Views/StationOverview/_OperationRecord.cshtml @@ -1 +1,185 @@ -

5

\ No newline at end of file +
+
+
+ + + + +
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+ + + + + + + + + + + + + + + + +
電廠表單號項目類型狀態處理人員本次作業預計照片完成時間
+ + + + + + + + + + + + + + + + + +
+
+ + + \ No newline at end of file diff --git a/SolarPower/wwwroot/upload/operation_recode/17/8f6f1382-0aaa-46e6-9d50-3016de4dfe4b.png b/SolarPower/wwwroot/upload/operation_recode/17/8f6f1382-0aaa-46e6-9d50-3016de4dfe4b.png new file mode 100644 index 0000000..7024b48 Binary files /dev/null and b/SolarPower/wwwroot/upload/operation_recode/17/8f6f1382-0aaa-46e6-9d50-3016de4dfe4b.png differ