From 594b248ff1296ffb4c7039f0fc195bdefd348086 Mon Sep 17 00:00:00 2001 From: b110212000 Date: Fri, 8 Oct 2021 09:55:48 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=20=E9=81=8B=E7=B6=AD?= =?UTF-8?q?=E4=BA=BA=E5=93=A1=E7=84=A1=E6=8E=92=E9=99=A4=E4=BB=A5=E5=88=AA?= =?UTF-8?q?=E9=99=A4=E4=BA=BA=E5=93=A1=E5=95=8F=E9=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SolarPower/Repository/Implement/OperationRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SolarPower/Repository/Implement/OperationRepository.cs b/SolarPower/Repository/Implement/OperationRepository.cs index 0e6435c..53add52 100644 --- a/SolarPower/Repository/Implement/OperationRepository.cs +++ b/SolarPower/Repository/Implement/OperationRepository.cs @@ -625,7 +625,7 @@ namespace SolarPower.Repository.Implement { try { - var sql = @$"SELECT us.* FROM power_station_operation_personnel ps LEFT JOIN user us ON ps.UserId = us.Id WHERE PowerStationId = {PowerStationId}"; + var sql = @$"SELECT us.* FROM power_station_operation_personnel ps LEFT JOIN user us ON ps.UserId = us.Id WHERE ps.PowerStationId = {PowerStationId} and ps.Deleted = 0"; result = (await conn.QueryAsync(sql)).ToList(); } catch (Exception exception) From e3441a76f7fc5b0420096b8f7f6c16a0d7ed9d72 Mon Sep 17 00:00:00 2001 From: b110212000 Date: Fri, 8 Oct 2021 10:00:28 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E4=BF=AE=E5=BE=A9bug-=E5=A6=82=E4=B8=8A?= =?UTF-8?q?=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SolarPower/Repository/Implement/OperationRepository.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SolarPower/Repository/Implement/OperationRepository.cs b/SolarPower/Repository/Implement/OperationRepository.cs index 53add52..6ade5ac 100644 --- a/SolarPower/Repository/Implement/OperationRepository.cs +++ b/SolarPower/Repository/Implement/OperationRepository.cs @@ -625,7 +625,7 @@ namespace SolarPower.Repository.Implement { try { - var sql = @$"SELECT us.* FROM power_station_operation_personnel ps LEFT JOIN user us ON ps.UserId = us.Id WHERE ps.PowerStationId = {PowerStationId} and ps.Deleted = 0"; + var sql = @$"SELECT us.* FROM power_station_operation_personnel ps LEFT JOIN user us ON ps.UserId = us.Id WHERE ps.PowerStationId = {PowerStationId} and ps.Deleted = 0 AND us.Deleted = 0"; result = (await conn.QueryAsync(sql)).ToList(); } catch (Exception exception) From be00cb0bc9a0d1947b16affe83952570060602c2 Mon Sep 17 00:00:00 2001 From: b110212000 Date: Wed, 13 Oct 2021 10:18:01 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BF=AE=E5=BE=A9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SolarPower/Controllers/OperationController.cs | 3 ++- .../Implement/ElectricitySoldRecordRepository.cs | 2 +- SolarPower/Views/PowerStation/_UploadImage.cshtml | 2 +- .../Views/StationOverview/StationOverviewInfo.cshtml | 10 +++++----- SolarPower/Views/StationOverview/_Exception.cshtml | 2 +- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/SolarPower/Controllers/OperationController.cs b/SolarPower/Controllers/OperationController.cs index 33bc534..04caffd 100644 --- a/SolarPower/Controllers/OperationController.cs +++ b/SolarPower/Controllers/OperationController.cs @@ -643,7 +643,7 @@ namespace SolarPower.Controllers OperationRecordPersonnel operationRecordPersonnel = new OperationRecordPersonnel(); operationRecordPersonnel.OperationRecordId = id; operationRecordPersonnel.UserId = op; - + operationRecordPersonnel.CreatedBy = myUser.Id; insertOperationRecordPersonnels.Add(operationRecordPersonnel); } @@ -651,6 +651,7 @@ namespace SolarPower.Controllers { "OperationRecordId", "UserId", + "CreatedBy" }; await operationRepository.AddOperationRecordPersonnelAsync(insertOperationRecordPersonnels, operationRecordPersonnelProperties); diff --git a/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs b/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs index 5573c76..8865c1b 100644 --- a/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs +++ b/SolarPower/Repository/Implement/ElectricitySoldRecordRepository.cs @@ -122,7 +122,7 @@ namespace SolarPower.Repository.Implement var sql = @$"SELECT aa.StartAt,aa.EndAt,aa.Kwh actualkwh,aa.Money actualMoney,SUM(pd.TODAYKWH) realKWH,SUM(pd.MONEY) realMoney,ps.Estimate_kwh CBAkwh,ps.EstimateEfficacy CBAeff ,ps.GeneratingCapacity capacity ,ps.PowerRate rate FROM power_station_history_day pd - LEFT JOIN ( SELECT er.* FROM electricity_sold_record er WHERE {sqlwhere} AND er.Deleted = 0 ) aa + LEFT JOIN ( SELECT er.* FROM electricity_sold_record er WHERE {sqlwhere} AND er.Deleted = 0 AND er.PowerstationId = {info.PowerstationId}) aa ON aa.PowerstationId = pd.PowerStationId LEFT JOIN power_station ps ON ps.Id = pd.PowerStationId WHERE pd.TIMESTAMP BETWEEN aa.StartAt AND aa.EndAt AND ps.Id = {info.PowerstationId} GROUP BY aa.Id"; diff --git a/SolarPower/Views/PowerStation/_UploadImage.cshtml b/SolarPower/Views/PowerStation/_UploadImage.cshtml index 7c6a288..dd89116 100644 --- a/SolarPower/Views/PowerStation/_UploadImage.cshtml +++ b/SolarPower/Views/PowerStation/_UploadImage.cshtml @@ -41,7 +41,7 @@
單線圖
diff --git a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml index 3b96580..feba4a5 100644 --- a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml +++ b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml @@ -319,7 +319,7 @@ labels: chartToday.labels, datasets: [{ type: 'bar', - label: '輸出功率', + label: '發電量', yAxisID: 'A', backgroundColor: 'rgb(103, 180, 172)', order: 3, @@ -411,7 +411,7 @@ labels: chart7day.labels, datasets: [{ type: 'bar', - label: '輸出功率', + label: '發電量', yAxisID: 'A', backgroundColor: 'rgb(103, 180, 172)', order: 3, @@ -503,7 +503,7 @@ labels: chartMonth.labels, datasets: [{ type: 'bar', - label: '輸出功率', + label: '發電量', yAxisID: 'A', backgroundColor: 'rgb(103, 180, 172)', order: 3, @@ -595,7 +595,7 @@ labels: chartYear.labels, datasets: [{ type: 'bar', - label: '輸出功率', + label: '發電量', yAxisID: 'A', backgroundColor: 'rgb(103, 180, 172)', order: 2, @@ -2010,7 +2010,7 @@ }, title: { - text: '逆變器單日kWhkWp' + text: '各逆變器當日有效日照時數' }, xAxis: { categories: HeatMap.xAxis, diff --git a/SolarPower/Views/StationOverview/_Exception.cshtml b/SolarPower/Views/StationOverview/_Exception.cshtml index be88d72..6fb7943 100644 --- a/SolarPower/Views/StationOverview/_Exception.cshtml +++ b/SolarPower/Views/StationOverview/_Exception.cshtml @@ -131,7 +131,7 @@
- +
From 781bf9e6600f66b81004d9e50296260663238c3f Mon Sep 17 00:00:00 2001 From: b110212000 Date: Wed, 13 Oct 2021 14:07:45 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=96=AE=E7=B7=9A=E5=9C=96PDF=E4=B8=8A?= =?UTF-8?q?=E5=82=B3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PowerStation/PowerStationEdit.cshtml | 36 ++++++++++++++++-- SolarPower/wwwroot/img/pdf.png | Bin 0 -> 8183 bytes 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 SolarPower/wwwroot/img/pdf.png diff --git a/SolarPower/Views/PowerStation/PowerStationEdit.cshtml b/SolarPower/Views/PowerStation/PowerStationEdit.cshtml index ea46e76..96f7376 100644 --- a/SolarPower/Views/PowerStation/PowerStationEdit.cshtml +++ b/SolarPower/Views/PowerStation/PowerStationEdit.cshtml @@ -812,7 +812,12 @@ powerStationSingleLineCard = $("#power-station-single-line-card > .row"); powerStationSingleLineCard.empty(); rel.data.forEach(function (value, index) { - CreatePowerStationSingleLineBox(powerStationSingleLineCard, value); + var split = value.image.split("."); + if (split[split.length - 1].toLowerCase() == "pdf") { + CreatePowerStationSingleLineBoxPDF(powerStationSingleLineCard, value); + } else { + CreatePowerStationSingleLineBox(powerStationSingleLineCard, value); + } }); @@ -2870,7 +2875,7 @@ //#region 單線圖 Dropzone var powerStationSingleLineDropzone = new Dropzone("#power-station-single-line-form", { url: "/PowerStation/SavePowerStationSingleLine", - acceptedFiles: "image/*", + acceptedFiles: "image/*,application/pdf", autoProcessQueue: false, parallelUploads: 5, maxFiles: 5, @@ -2914,7 +2919,14 @@ powerStationSingleLineCard = $("#power-station-single-line-card > .row"); powerStationSingleLineCard.empty(); rel.data.forEach(function (value, index) { - CreatePowerStationSingleLineBox(powerStationSingleLineCard, value); + var split = value.image.split("."); + if (split[split.length - 1].toLowerCase() == "pdf") { + CreatePowerStationSingleLineBoxPDF(powerStationSingleLineCard, value); + } else { + CreatePowerStationSingleLineBox(powerStationSingleLineCard, value); + } + + }); }); @@ -2937,6 +2949,24 @@ } //#endregion + //#region 創建單線圖PDFbox + function CreatePowerStationSingleLineBoxPDF(dom, value) { + var str = '
' + + '
' + + '' + + '...' + + ''+ + '' + + '' + + '' + + '
' + + '
'; + + dom.append(str); + } + //#endregion + + //#region 刪除單線圖 $('#power-station-single-line-card').on("click", "a.del-power-station-single-line-btn", function () { diff --git a/SolarPower/wwwroot/img/pdf.png b/SolarPower/wwwroot/img/pdf.png new file mode 100644 index 0000000000000000000000000000000000000000..5196ca4687953f37eacf7ccc2ab0aed13ed1ce13 GIT binary patch literal 8183 zcmd6Mdpy+JyZ@RoF}Z|PgwPe`nvh(}ElJpvg(?d%t5?{fzP1_sKwd3pFc+TXn+;vZN*mfT*8=&PDT}!Nrli&rkTH z>sIVK(LY*>el-4G8Ew5k6WMD2;8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H@q$;IF^GI$s&bzq5I*Q-`g+_5~tueM&hu z8KKpqa>q|J%@Qs~(|CchQ)I>Etn_xF19SG`eu(aQdqnR_SwaKk1ePzBvNQ!#_R(E1 zSev&u3MAVdpgYP4apjqlR<&-xskLtQcV@fu=KVcdtGab*ALf2~ruvdq>(m>&HC3rL z(TyQtZ`iqCruGJy`4k%$**FM-1R3>vLmKU68>;Xx+xjdFsR|YK0b5r=z;{}`oEc@Q z){qXGEs(;$42P)=yhvuP`|XPCT#9YQ+CuyCMNL?I9CG%m*XUD}zW5MheDMfQ@7;+Z z#g+j3qSSB43EhvL299T+qcmfT(#tEQEGeR%rFJHu1jG5p z?y%Z Date: Wed, 13 Oct 2021 16:34:50 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=8D=B3=E6=99=82->?= =?UTF-8?q?=E4=BB=8A=E6=97=A5=20=20=E6=96=B0=E5=A2=9EEmail=E9=80=9A?= =?UTF-8?q?=E7=9F=A5=E5=8B=BE=E9=81=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SolarPower/Controllers/OperationController.cs | 239 +++++++++--------- SolarPower/Models/Operation.cs | 1 + SolarPower/Views/MapOverview/Index.cshtml | 6 +- .../Views/Operation/OperationRecord.cshtml | 154 ++++++----- SolarPower/Views/StationOverview/Index.cshtml | 2 +- .../StationOverviewInfo.cshtml | 162 ++++++++---- .../StationOverview/_OperationRecord.cshtml | 32 ++- 7 files changed, 344 insertions(+), 252 deletions(-) diff --git a/SolarPower/Controllers/OperationController.cs b/SolarPower/Controllers/OperationController.cs index 04caffd..88ca4a2 100644 --- a/SolarPower/Controllers/OperationController.cs +++ b/SolarPower/Controllers/OperationController.cs @@ -659,82 +659,83 @@ namespace SolarPower.Controllers } - if (post.WorkPersonIds != null) + if(post.Emailcheck == 1) { - var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); - List noticeSchedules = new List(); - foreach (var person in post.WorkPersonIds) + if (post.WorkPersonIds != null) { - var fixtype = post.WorkType switch + var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); + List noticeSchedules = new List(); + foreach (var person in post.WorkPersonIds) + { + var fixtype = post.WorkType switch + { + 0 => "清洗", + 1 => "巡檢", + 2 => "維修", + _ => "" + }; + var user = await userRepository.GetOneAsync(person); + NoticeSchedule schedule = new NoticeSchedule() + { + EmailType = 3, + Type = 1, + UserId = person, + RecipientName = user.Name, + RecipientEmail = user.Email, + Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime, + Content = "維修項目" + post.FixDo + "
注意事項 :" + post.Notice, + }; + noticeSchedules.Add(schedule); + } + properties = new List() + { + "UserId", + "EmailType", + "RecipientEmail", + "Subject", + "Content", + "RecipientName", + "Type", + "ExceptionId" + }; + await noticeScheduleRepository.AddAnyThing>(noticeSchedules, properties, "notice_schedule"); + } + + if (post.FixFirm != 0) + { + var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); + var fixtype = operationRecord.WorkType switch { 0 => "清洗", 1 => "巡檢", 2 => "維修", _ => "" }; - var user = await userRepository.GetOneAsync(person); + var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId); + var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync(post.FixFirm, powerstations.SiteDB, "operation_firm"); NoticeSchedule schedule = new NoticeSchedule() { EmailType = 3, Type = 1, - UserId = person, - RecipientName = user.Name, - RecipientEmail = user.Email, + RecipientName = firm.Name, + RecipientEmail = firm.Email, Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime, Content = "維修項目" + post.FixDo + "
注意事項 :" + post.Notice, }; - noticeSchedules.Add(schedule); + properties = new List() + { + "UserId", + "EmailType", + "RecipientEmail", + "Subject", + "Content", + "RecipientName", + "Type", + "ExceptionId" + }; + await noticeScheduleRepository.AddAnyThing(schedule, properties, "notice_schedule"); } - properties = new List() - { - "UserId", - "EmailType", - "RecipientEmail", - "Subject", - "Content", - "RecipientName", - "Type", - "ExceptionId" - }; - await noticeScheduleRepository.AddAnyThing>(noticeSchedules, properties, "notice_schedule"); } - - if (post.FixFirm != 0) - { - var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); - var fixtype = operationRecord.WorkType switch - { - 0 => "清洗", - 1 => "巡檢", - 2 => "維修", - _ => "" - }; - var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId); - var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync(post.FixFirm, powerstations.SiteDB, "operation_firm"); - NoticeSchedule schedule = new NoticeSchedule() - { - EmailType = 3, - Type = 1, - RecipientName = firm.Name, - RecipientEmail = firm.Email, - Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime, - Content = "維修項目" + post.FixDo + "
注意事項 :" + post.Notice, - }; - properties = new List() - { - "UserId", - "EmailType", - "RecipientEmail", - "Subject", - "Content", - "RecipientName", - "Type", - "ExceptionId" - }; - await noticeScheduleRepository.AddAnyThing(schedule, properties, "notice_schedule"); - } - - //using (TransactionScope scope = new TransactionScope(TransactionScopeAsyncFlowOption.Suppress)) //{ @@ -880,83 +881,89 @@ namespace SolarPower.Controllers } #endregion - - if (post.WorkPersonIds != null) + if (post.Emailcheck == 1) { - var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); - List noticeSchedules = new List(); - foreach (var person in post.WorkPersonIds) + if (post.WorkPersonIds != null) { - var fixtype = operationRecord.WorkType switch + var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); + List noticeSchedules = new List(); + foreach (var person in post.WorkPersonIds) + { + var fixtype = operationRecord.WorkType switch + { + 0 => "清洗", + 1 => "巡檢", + 2 => "維修", + _ => "" + }; + var user = await userRepository.GetOneAsync(person); + NoticeSchedule schedule = new NoticeSchedule() + { + EmailType = 3, + Type = 1, + UserId = person, + RecipientName = user.Name, + RecipientEmail = user.Email, + Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime, + Content = "維修項目:" + post.FixDo + "
注意事項 :" + post.Notice, + }; + noticeSchedules.Add(schedule); + } + properties = new List() + { + "UserId", + "EmailType", + "RecipientEmail", + "Subject", + "Content", + "RecipientName", + "Type", + "ExceptionId" + }; + await noticeScheduleRepository.AddAnyThing>(noticeSchedules, properties, "notice_schedule"); + } + if (post.FixFirm != 0) + { + var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); + var fixtype = post.WorkType switch { 0 => "清洗", 1 => "巡檢", 2 => "維修", _ => "" }; - var user = await userRepository.GetOneAsync(person); + var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId); + var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync(post.FixFirm, powerstations.SiteDB, "operation_firm"); NoticeSchedule schedule = new NoticeSchedule() { EmailType = 3, Type = 1, - UserId = person, - RecipientName = user.Name, - RecipientEmail = user.Email, + RecipientName = firm.Name, + RecipientEmail = firm.Email, Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime, Content = "維修項目:" + post.FixDo + "
注意事項 :" + post.Notice, }; - noticeSchedules.Add(schedule); + properties = new List() + { + "UserId", + "EmailType", + "RecipientEmail", + "Subject", + "Content", + "RecipientName", + "Type", + "ExceptionId" + }; + await noticeScheduleRepository.AddAnyThing(schedule, properties, "notice_schedule"); + + + } - properties = new List() - { - "UserId", - "EmailType", - "RecipientEmail", - "Subject", - "Content", - "RecipientName", - "Type", - "ExceptionId" - }; - await noticeScheduleRepository.AddAnyThing>(noticeSchedules, properties, "notice_schedule"); } - if (post.FixFirm != 0) - { - var powerstations = await powerStationRepository.GetOneAsync(post.PowerStationId); - var fixtype = post.WorkType switch - { - 0 => "清洗", - 1 => "巡檢", - 2 => "維修", - _ => "" - }; - var powerstation = await powerStationRepository.GetOneAsync(post.PowerStationId); - var firm = await operationRepository.GetOneWithCustomDBNameAndTableAsync(post.FixFirm, powerstations.SiteDB, "operation_firm"); - NoticeSchedule schedule = new NoticeSchedule() - { - EmailType = 3, - Type = 1, - RecipientName = firm.Name, - RecipientEmail = firm.Email, - Subject = powerstations.Name + "-" + fixtype + "-" + post.WorkTime, - Content = "維修項目:" + post.FixDo + "
注意事項 :" + post.Notice, - }; - properties = new List() - { - "UserId", - "EmailType", - "RecipientEmail", - "Subject", - "Content", - "RecipientName", - "Type", - "ExceptionId" - }; - await noticeScheduleRepository.AddAnyThing(schedule, properties, "notice_schedule"); - } + #endregion diff --git a/SolarPower/Models/Operation.cs b/SolarPower/Models/Operation.cs index f10b710..a251c26 100644 --- a/SolarPower/Models/Operation.cs +++ b/SolarPower/Models/Operation.cs @@ -293,6 +293,7 @@ namespace SolarPower.Models public string Notice { get; set; } public string Description { get; set; } public IFormFile[] RecordFiles { get; set; } + public byte Emailcheck { get; set; } } public class UpdateOperationRecord : Updated diff --git a/SolarPower/Views/MapOverview/Index.cshtml b/SolarPower/Views/MapOverview/Index.cshtml index a8f3d46..d592df2 100644 --- a/SolarPower/Views/MapOverview/Index.cshtml +++ b/SolarPower/Views/MapOverview/Index.cshtml @@ -20,7 +20,7 @@

-

即時總發電量

+

今日總發電量

0.00

@@ -36,7 +36,7 @@
-

即時日照度

+

今日日照度

0.00

@@ -279,7 +279,7 @@ '
' + '
' + '
今日發電量(kW h):' + item.today_kWh.toFixed(2) + '
'+ - '
即時日照度(k W/m2):' + item.today_irradiance + '
'+ + '
今日日照度(k W/m2):' + item.today_irradiance + '
'+ '
有效日照時數(kwh/kwp):' + item.today_kwhkwp.toFixed(2) + '
' + '
裝置容量(kWp):' + item.generatingCapacity.toFixed(3) + '
' + '
掛錶日期:' + item.electricityMeterAt + '
' + diff --git a/SolarPower/Views/Operation/OperationRecord.cshtml b/SolarPower/Views/Operation/OperationRecord.cshtml index a19c193..dac2a90 100644 --- a/SolarPower/Views/Operation/OperationRecord.cshtml +++ b/SolarPower/Views/Operation/OperationRecord.cshtml @@ -211,8 +211,13 @@
+
+
+ + +
+
-
@@ -707,7 +712,7 @@ $("#work_time_modal-error").hide(); - + $("#EmailcheckBox").prop("checked", false); $("#record-form-modal").modal(); } //#endregion @@ -1038,7 +1043,7 @@ - + $("#EmailcheckBox").prop("checked", false); $("#record-form-modal").modal(); }, 'json'); }); @@ -1057,94 +1062,87 @@ //#region 儲存表單資料 function SaveRecord() { if ($('#work_person_select_modal').val().length > 0 && $("#work_time_modal").val() != "") { - Swal.fire( - { - title: "儲存", - text: "你確定是否儲存此筆資料?\r\n 儲存成功後將會發送Email至負責人員及廠商", - type: "warning", - icon: 'warning', - showCancelButton: true, - confirmButtonText: "是", - cancelButtonText: "否" - }).then(function (result) { - if (result.value) { - if ($("#record-form").valid()) { - var url = "/Operation/SaveOperationRecord"; + if ($("#record-form").valid()) + { + var url = "/Operation/SaveOperationRecord"; - var formData = new FormData(); + var formData = new FormData(); - @*var work_person_ids = $.map($("#work_person_select_modal").val(), function (item) { - return parseInt(item); - }) *@ + @*var work_person_ids = $.map($("#work_person_select_modal").val(), function (item) { + return parseInt(item); + }) *@ - formData.append("Id", selected_id); - formData.append("PowerStationId", $("#power_station_select_modal").val()); - formData.append("WorkType", selected_work_type); - formData.append("ErrorCode", $("#error_code_modal").val()); - formData.append("FixDo", $("#fix_do_modal").val()); - formData.append("FixFirm", $("#fix_firm_select_modal").val()); - formData.append("Status", $("input[name=status_modal]:checked").val()); - $("#work_person_select_modal").val().forEach(function (item) { - formData.append("WorkPersonIds", parseInt(item)); - }); - formData.append("WorkTime", $("#work_time_modal").val()); - formData.append("Notice", $("#notice_textarea_modal").val()); - formData.append("Description", $("#description_textarea_modal").val()); + formData.append("Id", selected_id); + formData.append("PowerStationId", $("#power_station_select_modal").val()); + formData.append("WorkType", selected_work_type); + formData.append("ErrorCode", $("#error_code_modal").val()); + formData.append("FixDo", $("#fix_do_modal").val()); + formData.append("FixFirm", $("#fix_firm_select_modal").val()); + formData.append("Status", $("input[name=status_modal]:checked").val()); + $("#work_person_select_modal").val().forEach(function (item) { + formData.append("WorkPersonIds", parseInt(item)); + }); + formData.append("WorkTime", $("#work_time_modal").val()); + formData.append("Notice", $("#notice_textarea_modal").val()); + formData.append("Description", $("#description_textarea_modal").val()); + if (document.querySelector('[id=EmailcheckBox]:checked')) { + formData.append("Emailcheck", 1); + } + else { + formData.append("Emailcheck", 0); + } + $.ajax({ + type: "POST", + url: url, + data: formData, + cache: false, + contentType: false, + processData: false, + success: function (rel) { + if (rel.code != "0000") { + toast_error(rel.msg); + return; + } - $.ajax({ - type: "POST", - url: url, - data: formData, - cache: false, - contentType: false, - processData: false, - success: function (rel) { - if (rel.code != "0000") { - toast_error(rel.msg); - return; - } + var myDropzone = Dropzone.forElement("#record-file-form"); - var myDropzone = Dropzone.forElement("#record-file-form"); + if (myDropzone.files.length > 0) { - if (myDropzone.files.length > 0) { + selected_id = rel.data; - selected_id = rel.data; + myDropzone.processQueue(); - myDropzone.processQueue(); - - myDropzone.on("successmultiple", function (file, rel) { - if (rel.code != "0000") { - toast_error(rel.msg); - return; - } - - toast_ok(rel.msg); - $('#record-form-modal').modal('hide'); - recordFileDropzone.removeAllFiles(); - if (status == 2) { - operationRecordTable.column(10).visible(true); - } - else { - operationRecordTable.column(10).visible(false); - } - operationRecordTable.ajax.reload(); - }); - } else { - $('#record-form-modal').modal('hide'); - myDropzone.removeAllFiles(); - if (status == 2) { - operationRecordTable.column(10).visible(true); - } - else { - operationRecordTable.column(10).visible(false); - } - operationRecordTable.ajax.reload(); - } + myDropzone.on("successmultiple", function (file, rel) { + if (rel.code != "0000") { + toast_error(rel.msg); + return; } + + toast_ok(rel.msg); + $('#record-form-modal').modal('hide'); + recordFileDropzone.removeAllFiles(); + if (status == 2) { + operationRecordTable.column(10).visible(true); + } + else { + operationRecordTable.column(10).visible(false); + } + operationRecordTable.ajax.reload(); }); + } else { + $('#record-form-modal').modal('hide'); + myDropzone.removeAllFiles(); + if (status == 2) { + operationRecordTable.column(10).visible(true); + } + else { + operationRecordTable.column(10).visible(false); + } + operationRecordTable.ajax.reload(); } } }); + } } else { diff --git a/SolarPower/Views/StationOverview/Index.cshtml b/SolarPower/Views/StationOverview/Index.cshtml index ede80d0..6f96a5e 100644 --- a/SolarPower/Views/StationOverview/Index.cshtml +++ b/SolarPower/Views/StationOverview/Index.cshtml @@ -94,7 +94,7 @@
-

即時日照度

+

今日日照度

0.00

diff --git a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml index feba4a5..a8000df 100644 --- a/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml +++ b/SolarPower/Views/StationOverview/StationOverviewInfo.cshtml @@ -951,6 +951,32 @@ $("#work_person_select_modal").val(record.workPersonId); } } + + $("#work_person_select_modal").select2({ dropdownParent: $('#record-form-modal') }); + }); + + //查詢該電站的廠商 + var url_power_station_firm = "/PowerStation/GetFirmSelectOptionList"; + + $.post(url_power_station_firm, send_data, function (rel) { + if (rel.code != "0000") { + toast_error(rel.msg); + return; + } + + $("#fix_firm_select_modal").empty(); + if (rel.data.length > 0) { + + $.each(rel.data, function (index, val) { + $("#fix_firm_select_modal").append($("