Merge branch 'master' into kai_整合電站取得方式

This commit is contained in:
Kai 2021-09-01 16:30:04 +08:00
commit 985ff36854
18 changed files with 597 additions and 277 deletions

View File

@ -412,15 +412,31 @@ namespace SolarPower.Controllers
foreach (var record in records)
{
if (string.IsNullOrEmpty(record.FormId))
if(post.Status == 2)
{
record.FormId = @$"<a href='javascript:;' class='btn btn-success waves-effect waves-themed mb-3 mr-2 edit-btn'>填寫表單</a>";
record.Function = "<button class='btn btn-primary redu-btn'>還原</button>";
if (string.IsNullOrEmpty(record.FormId))
{
record.FormId = "";
}
else
{
record.FormId = record.FormId;
}
}
else
{
record.FormId = @$"<a href='javascript:;' class='waves-effect waves-themed mb-3 mr-2 edit-btn'>{record.FormId}</a>";
record.Function = "<button class='btn btn-danger del-btn'>刪除</button>";
if (string.IsNullOrEmpty(record.FormId))
{
record.FormId = @$"<a href='javascript:;' class='btn btn-success waves-effect waves-themed mb-3 mr-2 edit-btn'>填寫表單</a>";
}
else
{
record.FormId = @$"<a href='javascript:;' class='waves-effect waves-themed mb-3 mr-2 edit-btn'>{record.FormId}</a>";
}
}
if (record.RecordFiles != null && record.RecordFiles.Count > 0)
{
foreach (var file in record.RecordFiles)
@ -428,6 +444,7 @@ namespace SolarPower.Controllers
file.FileName = Path.Combine(operationRecordFilePath, record.Id.ToString()) + "/" + file.FileName;
}
}
}
totalRecords = records.Count();
@ -955,6 +972,37 @@ namespace SolarPower.Controllers
return apiResult;
}
public async Task<ApiResult<string>> ReductionOneOperationRecord(int id)
{
ApiResult<string> apiResult = new ApiResult<string>();
try
{
//var operationRecord = await operationRepository.GetOneOperationRecordAsync(id);
//if (operationRecord == null)
//{
// apiResult.Code = "9989";
// apiResult.Msg = errorCode.GetString(apiResult.Code);
// return apiResult;
//}
await operationRepository.ReductionOneOperationRecordAsync(id);
apiResult.Code = "0000";
apiResult.Msg = "還原成功";
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = errorCode.GetString(apiResult.Code);
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "Id=" + id);
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
return apiResult;
}
/// <summary>
/// 儲存運維作業記錄檔案
/// </summary>

View File

@ -123,10 +123,9 @@ namespace SolarPower.Models
public string EndTime { get; set; }
}
public class OperationRecord : Created
public class OperationRecord : UserInfo
{
private string startTime, endTime, finishTime, workTime;
public int Id { get; set; }
public string FormId { get; set; }
public string SerialNumber { get; set; }
public int PowerStationId { get; set; }
@ -273,6 +272,7 @@ namespace SolarPower.Models
}
} //本次作業預計
public List<string> HyperLinks { get; set; }
public string Function { get; set; }
}
public class PostOperationRecord

View File

@ -20,14 +20,16 @@ namespace SolarPower.Quartz.Jobs
private readonly IUserRepository userRepository;
private readonly INoticeScheduleRepository noticeScheduleRepository;
private readonly IStationReportRepository stationReportRepository;
private readonly IOperationRepository operationRepository;
public CalcAvgPowerStationJob(ILogger<CalcAvgPowerStationJob> logger, IPowerStationRepository powerStationRepository, IUserRepository userRepository, INoticeScheduleRepository noticeScheduleRepository, IStationReportRepository stationReportRepository)
public CalcAvgPowerStationJob(ILogger<CalcAvgPowerStationJob> logger, IPowerStationRepository powerStationRepository, IUserRepository userRepository, INoticeScheduleRepository noticeScheduleRepository, IStationReportRepository stationReportRepository,IOperationRepository operationRepository)
{
this.logger = logger;
this.powerStationRepository = powerStationRepository;
this.userRepository = userRepository;
this.noticeScheduleRepository = noticeScheduleRepository;
this.stationReportRepository = stationReportRepository;
this.operationRepository = operationRepository;
}
public async Task Execute(IJobExecutionContext context)
@ -309,6 +311,17 @@ namespace SolarPower.Quartz.Jobs
};
await powerStationRepository.AddWeatherForecast(weatherForecasts, weather_forecast_properties);
var OperationDeletes = await powerStationRepository.GetAllDataList<OperationRecord>("operation_record", "Deleted = 1");
List<int> deleteoperations = new List<int>();
foreach(var deletes in OperationDeletes)
{
if(DateTime.Now.AddDays(-60) > Convert.ToDateTime(deletes.UpdatedAt))
{
deleteoperations.Add(deletes.Id);
}
}
await operationRepository.DeleteRecord(deleteoperations);
#region step2.
foreach (var powerStation in powerStations)
{

View File

@ -205,13 +205,24 @@ namespace SolarPower.Repository.Implement
{
try
{
string where = "";
if(filter.Status == 2 )
{
where = $"opr.Deleted = 1 ";
}
else
{
where = $"opr.Deleted = 0 AND opr.Status = {filter.Status} ";
}
var sql = @$"SELECT aa.* FROM (
SELECT
opr.*,
ps.Name AS PowerStationName
FROM operation_record opr
LEFT JOIN power_station ps ON opr.PowerStationId = ps.Id
WHERE opr.Deleted = 0 AND opr.Status = {filter.Status}
WHERE {where}
AND ps.Id IN @PowerStationIds";
if (!string.IsNullOrEmpty(filter.Range))
@ -237,7 +248,7 @@ namespace SolarPower.Repository.Implement
ps.Name AS PowerStationName
FROM operation_record opr
LEFT JOIN power_station ps ON opr.PowerStationId = ps.Id
WHERE opr.Deleted = 0 AND opr.Status = {filter.Status}
WHERE {where}
AND ps.Id IN @PowerStationIds
AND opr.WorkType = 2";
if (!string.IsNullOrEmpty(filter.Range))
@ -449,6 +460,35 @@ namespace SolarPower.Repository.Implement
}
}
public async Task ReductionOneOperationRecordAsync(int id)
{
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
conn.Open();
using (var trans = conn.BeginTransaction())
{
try
{
var sql = $"UPDATE operation_record SET deleted = 0 WHERE Id = @Id";
await conn.ExecuteAsync(sql, new { Id = id }, trans);
trans.Commit();
}
catch (Exception exception)
{
trans.Rollback();
throw exception;
}
finally
{
conn.Close();
}
}
}
}
/// <summary>
/// 新增運維作業記錄的檔案
/// </summary>
@ -694,5 +734,34 @@ namespace SolarPower.Repository.Implement
}
}
}
public async Task DeleteRecord(List<int> operations)
{
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
conn.Open();
using (var trans = conn.BeginTransaction())
{
try
{
var sql = $"UPDATE operation_record SET Deleted = 2 WHERE Id IN @Ids";
await conn.ExecuteAsync(sql, new { Ids = operations }, trans);
trans.Commit();
}
catch (Exception exception)
{
trans.Rollback();
throw exception;
}
finally
{
conn.Close();
}
}
}
}
}
}

View File

@ -5290,6 +5290,8 @@ namespace SolarPower.Repository.Implement
{
sql += @" AND ps.Name LIKE CONCAT('%', @Filter, '%')";
}
sql += @" ORDER BY city.Priority";
result = (await conn.QueryAsync<PowerStationIdAndCity>(sql, new { Filter = filter })).ToList();
}
catch (Exception exception)
@ -5324,6 +5326,8 @@ namespace SolarPower.Repository.Implement
{
sql += @" AND ps.Name LIKE CONCAT('%', @Filter, '%')";
}
sql += @" ORDER BY city.Priority";
result = (await conn.QueryAsync<PowerStationIdAndCity>(sql, new { CompanyId = myUser.CompanyId, UserId = myUser.Id, Filter = filter })).ToList();
}
catch (Exception exception)

View File

@ -659,5 +659,34 @@ namespace SolarPower.Repository.Implement
}
}
}
/// <summary>
/// 取條件 的所有資料
/// </summary>
/// <param name="tableName"></param>
/// <param name="where"></param>
/// <returns></returns>
public async Task<List<A>> GetAllDataList<A>(string tableName, string where)
{
List<A> result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
conn.Open();
try
{
var sql = @$"SELECT Id FROM {tableName} WHERE {where}";
result = (await conn.QueryAsync<A>(sql)).ToList();
}
catch (Exception exception)
{
throw exception;
}
finally
{
conn.Close();
}
return result;
}
}
}
}

View File

@ -15,7 +15,7 @@ namespace SolarPower.Repository.Interface
Task UpdateOperationPlan(OperationCreatePlan OperationPlan, List<string> properties);
Task AddToRecord(PlanToRecord record, List<string> properties2);
Task ReductionOneOperationRecordAsync(int id);
/// <summary>
/// 透過搜尋條件,查詢過濾後的運維作業記錄
/// </summary>
@ -81,6 +81,8 @@ namespace SolarPower.Repository.Interface
Task<List<int>> GetOperationRecordPersonnelIdsByOperationRecordId(int operationRecordId);
Task DeleteOperationRecordPersonnel(List<OperationRecordPersonnel> operationRecordPersonnels);
Task DeleteRecord(List<int> operations);
}
}

View File

@ -113,5 +113,7 @@ namespace SolarPower.Repository.Interface
Task PurgeOneByIdWithCustomDBNameAndTable(int id, string db_name, string table_name);
Task AddAnyThing<A>(A result, List<string> properties, string tableName);
Task<List<A>> GetAllDataList<A>(string tableName, string where);
}
}

View File

@ -466,8 +466,8 @@
'<input type="checkbox" class="" name="selectedInverterLayer2[]" >' +
'</div>' +
'<a href="javascript:;" class="" data-toggle="collapse" data-target="#cp-' + index1 + '-' + index2 + ' > .card-body" aria-expanded="true">' +
'<span class="collapsed-hidden"><h5 class="font-weight-bold mb-0"><i class="fal fa-charging-station"></i>' + powerStationkey + '<i class="fal fa-chevron-down fs-xl ml-2"></i></h5></span>' +
'<span class="collapsed-reveal"><h5 class="font-weight-bold mb-0"><i class="fal fa-charging-station"></i>' + powerStationkey + '<i class="fal fa-chevron-up fs-xl ml-2"></i></h5></span>' +
'<span class="collapsed-hidden"><h5 class="font-weight-bold mb-0">' + powerStationkey + '<i class="fal fa-chevron-down fs-xl ml-2"></i></h5></span>' +
'<span class="collapsed-reveal"><h5 class="font-weight-bold mb-0">' + powerStationkey + '<i class="fal fa-chevron-up fs-xl ml-2"></i></h5></span>' +
'</a>' +
'</div>' +
'<div class="card-body p-0">' +

View File

@ -661,7 +661,7 @@
'<div class="">' +
'<input type="checkbox" class="mr-2" name="selectedPowerStationLayer2[]" value="' + powerStation.powerStationId + '" valueName ="' + powerStation.powerStationName + '">' +
'</div>' +
'<h5 class="font-weight-bold"><i class="fal fa-charging-station"></i> ' + powerStation.powerStationName + '</h5>' +
'<h5 class="font-weight-bold">' + powerStation.powerStationName + '</h5>' +
'</div>' +
'</li>';
});

View File

@ -481,8 +481,8 @@
'<input type="checkbox" class="" name="selectedDeviceLayer2[]" >' +
'</div>' +
'<a href="javascript:;" class="" data-toggle="collapse" data-target="#cp-' + index1 + '-' + index2 + ' > .card-body" aria-expanded="true">' +
'<span class="collapsed-hidden"><h5 class="font-weight-bold mb-0"><i class="fal fa-charging-station"></i>' + powerStationkey + '<i class="fal fa-chevron-down fs-xl ml-2"></i></h5></span>' +
'<span class="collapsed-reveal"><h5 class="font-weight-bold mb-0"><i class="fal fa-charging-station"></i>' + powerStationkey + '<i class="fal fa-chevron-up fs-xl ml-2"></i></h5></span>' +
'<span class="collapsed-hidden"><h5 class="font-weight-bold mb-0">' + powerStationkey + '<i class="fal fa-chevron-down fs-xl ml-2"></i></h5></span>' +
'<span class="collapsed-reveal"><h5 class="font-weight-bold mb-0">' + powerStationkey + '<i class="fal fa-chevron-up fs-xl ml-2"></i></h5></span>' +
'</a>' +
'</div>' +
'<div class="card-body p-0">' +

View File

@ -398,7 +398,7 @@
'<div class="mr-2">' +
'<input type="checkbox" class="" name="selectedInverterLayer2[]" value="' + inverter.powerStationId + '" valueName ="' + inverter.powerStationName + '" checked>' +
'</div>' +
'<h5 class="font-weight-bold"><i class="fal fa-charging-station"></i> ' + inverter.powerStationName + '</h5>' +
'<h5 class="font-weight-bold">' + inverter.powerStationName + '</h5>' +
'</div>' +
'</li>';
}
@ -408,7 +408,7 @@
'<div class="mr-2">' +
'<input type="checkbox" class="" name="selectedInverterLayer2[]" value="' + inverter.powerStationId + '" valueName ="' + inverter.powerStationName + '">' +
'</div>' +
'<h5 class="font-weight-bold"><i class="fal fa-charging-station"></i> ' + inverter.powerStationName + '</h5>' +
'<h5 class="font-weight-bold">' + inverter.powerStationName + '</h5>' +
'</div>' +
'</li>';
}

View File

@ -502,7 +502,7 @@
'<div class="mr-2">' +
'<input type="checkbox" class="" name="selectedInverterLayer2[]" value="' + inverter.powerStationId + '" valueName ="' + inverter.powerStationName + '" checked>' +
'</div>' +
'<h5 class="font-weight-bold"><i class="fal fa-charging-station"></i> ' + inverter.powerStationName + '</h5>' +
'<h5 class="font-weight-bold">' + inverter.powerStationName + '</h5>' +
'</div>' +
'</li>';
}
@ -512,7 +512,7 @@
'<div class="mr-2">' +
'<input type="checkbox" class="" name="selectedInverterLayer2[]" value="' + inverter.powerStationId + '" valueName ="' + inverter.powerStationName + '">' +
'</div>' +
'<h5 class="font-weight-bold"><i class="fal fa-charging-station"></i> ' + inverter.powerStationName + '</h5>' +
'<h5 class="font-weight-bold">' + inverter.powerStationName + '</h5>' +
'</div>' +
'</li>';
}

View File

@ -24,8 +24,9 @@
<div class="row mb-3 d-flex justify-content-start px-3">
<div class="pr-3">
<div class="btn-group btn-group-md">
<button type="button" class="btn btn-secondary waves-effect waves-themed status-type" onclick="CheckStatus(1,this)">完成</button>
<button type="button" class="btn btn-success waves-effect waves-themed status-type" onclick="CheckStatus(0,this)">未完成</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed status-type" onclick="CheckStatus(1,this)">完成</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed status-type" onclick="CheckStatus(2,this)">刪除區</button>
</div>
</div>
<div class="pr-3">
@ -98,6 +99,7 @@
<th>檔案</th>
<th>完成時間</th>
<th>創建時間</th>
<th>刪除時間</th>
@if (ViewBag.myUser.Role.Layer != (int)RoleLayerEnum.CompanyUser)
{
<th>功能</th>
@ -276,6 +278,7 @@
var AllidsType = true;
var status = 0; //1:完成 0:未完成
var Searchtype = false;
var Deleteshow = false;
//#region Array.Remove
Array.prototype.remove = function (val) {
@ -323,7 +326,7 @@
ids.push(String(rel.data[i].cityId));
Allids.push(String(rel.data[i].cityId));
}
var send_data = {
cityid: ids
}
@ -354,6 +357,12 @@
$("#power_station_select_modal").val($("#power_station_select_modal option:first").val()).trigger('change');
$('#Allcity').trigger("click");
if (status == 2) {
operationRecordTable.column(10).visible(true);
}
else {
operationRecordTable.column(10).visible(false);
}
operationRecordTable.ajax.reload();
})
@ -390,7 +399,7 @@
$("#work_person_select_modal").select2({ dropdownParent: $('#record-form-modal') });
});
//查詢該電站的廠商
@ -451,8 +460,10 @@
},{
"data": "createdAt"
}, {
"data": null,
"defaultContent": '<button class="btn btn-danger del-btn">刪除</button>'
"data": "updatedAt",
//"defaultContent": '<button class="btn btn-danger del-btn">刪除</button>'
}, {
"data": "function"
}],
"columnDefs": [{
'targets': 7,
@ -552,6 +563,12 @@
document.getElementById(name).setAttribute("class", "btn btn-secondary waves-effect waves-themed");
}
document.getElementById("button" + type).setAttribute("class", "btn btn-success waves-effect waves-themed");
if (status == 2) {
operationRecordTable.column(10).visible(true);
}
else {
operationRecordTable.column(10).visible(false);
}
operationRecordTable.ajax.reload();
}
@ -559,6 +576,12 @@
//#region 改變日期
$('#date-range').on('change', function () {
if (status == 2) {
operationRecordTable.column(10).visible(true);
}
else {
operationRecordTable.column(10).visible(false);
}
operationRecordTable.ajax.reload();
});
//#endregion
@ -628,6 +651,12 @@
powerids = [];
powerids = Newpowerids;
})
if (status == 2) {
operationRecordTable.column(10).visible(true);
}
else {
operationRecordTable.column(10).visible(false);
}
operationRecordTable.ajax.reload();
}
@ -698,6 +727,12 @@
powerids = [];
}
})
if (status == 2) {
operationRecordTable.column(10).visible(true);
}
else {
operationRecordTable.column(10).visible(false);
}
operationRecordTable.ajax.reload();
})
}
@ -721,6 +756,12 @@
powerids = [];
}
})
if (status == 2) {
operationRecordTable.column(10).visible(true);
}
else {
operationRecordTable.column(10).visible(false);
}
operationRecordTable.ajax.reload();
}
//#endregion
@ -771,6 +812,12 @@
powerids = [];
powerids = Newpowerids;
})
if (status == 2) {
operationRecordTable.column(10).visible(true);
}
else {
operationRecordTable.column(10).visible(false);
}
operationRecordTable.ajax.reload();
})
//#endregion
@ -786,6 +833,12 @@
else {
powerids.remove(classid[1]);
}
if (status == 2) {
operationRecordTable.column(10).visible(true);
}
else {
operationRecordTable.column(10).visible(false);
}
operationRecordTable.ajax.reload();
})
@ -944,13 +997,23 @@
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();
}
}
@ -963,11 +1026,11 @@
}
//#endregion
//#region 刪除公司
//#region 刪除運維紀錄
$('#operation_record_table').on("click", "button.del-btn", function () {
selected_id = $(this).parents('tr').attr('data-id');
@ -998,6 +1061,56 @@
}
toast_ok(rel.msg);
if (status == 2) {
operationRecordTable.column(10).visible(true);
}
else {
operationRecordTable.column(10).visible(false);
}
operationRecordTable.ajax.reload();
}, 'json');
}
});
});
//#endregion
//#region 還原運維紀錄
$('#operation_record_table').on("click", "button.redu-btn", function () {
selected_id = $(this).parents('tr').attr('data-id');
Swal.fire(
{
title: "還原",
text: "你確定是否還原此筆資料?",
type: "warning",
icon: 'warning',
showCancelButton: true,
confirmButtonText: "是",
cancelButtonText: "否"
}).then(function (result) {
if (result.value) {
//還原單一運維紀錄
var url = "/Operation/ReductionOneOperationRecord/";
var send_data = {
Id: selected_id
}
$.post(url, send_data, function (rel) {
if (rel.code == "9999") {
toast_error(rel.msg);
return;
}
else if (rel.code == "9998") {
toast_error(rel.msg);
return;
}
toast_ok(rel.msg);
if (status == 2) {
operationRecordTable.column(10).visible(true);
}
else {
operationRecordTable.column(10).visible(false);
}
operationRecordTable.ajax.reload();
}, 'json');
}
@ -1207,6 +1320,12 @@
$(".status-type").removeClass("btn-success").addClass("btn-secondary");
}
$(e).removeClass("btn-secondary").addClass("btn-success");
if (status == 2) {
operationRecordTable.column(10).visible(true);
}
else {
operationRecordTable.column(10).visible(false);
}
operationRecordTable.ajax.reload();
}
//#endregion

View File

@ -420,7 +420,7 @@
'<div class="mr-2">' +
'<input type="checkbox" class="" name="selectedInverterLayer2[]" value="' + inverter.powerStationId + '" valueName ="' + inverter.powerStationName + '" checked>' +
'</div>' +
'<h5 class="font-weight-bold"><i class="fal fa-charging-station"></i> ' + inverter.powerStationName + '</h5>' +
'<h5 class="font-weight-bold">' + inverter.powerStationName + '</h5>' +
'</div>' +
'</li>';
}
@ -430,7 +430,7 @@
'<div class="mr-2">' +
'<input type="checkbox" class="" name="selectedInverterLayer2[]" value="' + inverter.powerStationId + '" valueName ="' + inverter.powerStationName + '">' +
'</div>' +
'<h5 class="font-weight-bold"><i class="fal fa-charging-station"></i> ' + inverter.powerStationName + '</h5>' +
'<h5 class="font-weight-bold">' + inverter.powerStationName + '</h5>' +
'</div>' +
'</li>';
}

View File

@ -101,7 +101,9 @@
var countPowerStationImage = 0; var countPowerStationSingleLine = 0;
var upper = 0;
var stationDB = "";
var station_infocreate = false;
$(function () {
$('#power_station_operation_personnel-error').hide();
var url = new URL(location.href);
stationId = url.searchParams.get('stationId');
@ -376,14 +378,14 @@
if (val.warrantyDate == "0001-01-01") {
val.warrantyDate = "";
}
});
if (data == null || data.length == 0) {
this.data = [];
}
return data;
}
},
@ -855,7 +857,7 @@
});
if (rel.data.length > 0) {
DeviceUIDList($("#ShareDevice_PowerStationId_modal").val());
$("#ShareDevice_PowerStationId_modal").attr('disabled', false);
$("#ShareDevice_PowerStationId_modal").attr('disabled', false);
$("#ShareDevice-modal").find('.btn-primary').attr('disabled', false);
}
else
@ -1020,51 +1022,67 @@
//#region 儲存電站基本資料資訊
function SaveStationInfo() {
$(".select2-selection__choice").each(function () {
$(this).children(".select2-selection__choice__remove").show();
})
$("#power_station_operation_personnel > option").each(function () {
if ($("#station-created-form").valid() && $('#power_station_operation_personnel').val().length != 0) {
station_infocreate = false;
$(".select2-selection__choice").each(function () {
$(this).children(".select2-selection__choice__remove").show();
})
$("#power_station_operation_personnel > option").each(function () {
$(this).attr("disabled", false);
});
});
$("#power_station_operation_personnel").select2();
$("#power_station_operation_personnel").select2();
var ps_company_text = $("#select_power_station_company").find(':selected').text();
var ps_company_text = $("#select_power_station_company").find(':selected').text();
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformUser)
{
<text>
@if (ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformAdmin || ViewBag.myUser.Role.Layer == (int)RoleLayerEnum.PlatformUser)
{
<text>
if (stationId == 'new') {
Swal.fire(
{
title: "",
text: "你確定是否要將該電站加入至【" + ps_company_text + "】?",
type: "question",
icon: 'question',
showCancelButton: true,
confirmButtonText: "是",
cancelButtonText: "否"
}).then(function (result) {
if (result.value) {
PostPowerStationData();
}
});
} else {
if (stationId == 'new') {
Swal.fire(
{
title: "",
text: "你確定是否要將該電站加入至【" + ps_company_text + "】?",
type: "question",
icon: 'question',
showCancelButton: true,
confirmButtonText: "是",
cancelButtonText: "否"
}).then(function (result) {
if (result.value) {
PostPowerStationData();
}
});
} else {
PostPowerStationData();
}
</text>
}
else
{
<text>
PostPowerStationData();
</text>
}
}
</text>
}
else
{
<text>
PostPowerStationData();
</text>
else {
if ($('#power_station_operation_personnel').val().length == 0) {
$('#power_station_operation_personnel-error').show();
}
}
}
//#endregion
@ -1296,7 +1314,7 @@
//#endregion
} else {
//修改
station_infocreate = true;
//#region 電站基本資料 文字
$("#address_detail_text").hide();
@ -1630,7 +1648,7 @@
$("#address_detail_text").html(powerStationData.address);
$("#power_station_code_text").html(powerStationData.code);
$("#power_station_name_text").html(powerStationData.name);
$("#estimated_recovery_time_text").html(powerStationData.estimatedRecoveryTime);
$("#created_by_text").html(powerStationData.creatorName);
@ -2473,8 +2491,8 @@
} else {
$("#Device_WarrantyDate_modal").val(null);
}
$("#Device-modal").modal();
}, 'json');
@ -2516,7 +2534,7 @@
$("#Inverter_WarrantyDate_modal").val(null);
}
$("#Inverter-modal").modal();
@ -2963,6 +2981,49 @@
}
}
});
$("#station-created-form").validate({
rules: {
address_detail: {
required: true
},
power_station_name: {
required: true
},
coordinate: {
required: true
},
estimate_efficacy:
{
required: true
},
estimate_kwh:
{
required: true
},
estimated_recovery_time:
{
required: true
},
generating_capacity:
{
required: true
}
}
});
$('#power_station_operation_personnel').change(function () {
//$(this).valid();
if (stationId == 'new' || station_infocreate) {
console.log($('#power_station_operation_personnel').val().length);
if ($('#power_station_operation_personnel').val().length == 0) {
$('#power_station_operation_personnel-error').show();
} else {
$('#power_station_operation_personnel-error').hide();
}
}
});
$("#Inverter-form").validate({
rules: {
Inverter_ControllerId_modal: {
@ -2985,6 +3046,8 @@
},
}
});
$("#Operation-form").validate({
rules: {
Operation_factory_modal: {
@ -3043,7 +3106,7 @@
$("#Exception_Type_modal").attr('disabled', true);
$("#savebtn").attr('disabled', true);
}
});
}

View File

@ -17,234 +17,205 @@
</div>
</div>
<div class="card-body">
<div class="row mb-3 d-flex justify-content-between">
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="city_label">縣市</label>
<div class="col-xl-8">
<select class="form-control" id="select_city">
<option value="0" selected>全部</option>
</select>
<form id="station-created-form">
<div class="row mb-3 d-flex justify-content-between">
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="city_label"><span class="text-danger">*</span>縣市</label>
<div class="col-xl-8">
<select class="form-control" id="select_city">
<option value="0" selected>全部</option>
</select>
</div>
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="area_label">地區</label>
<div class="col-xl-8">
<select class="form-control" id="select_area">
<option value="0" selected>全部</option>
</select>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="area_label"><span class="text-danger">*</span>地區</label>
<div class="col-xl-8">
<select class="form-control" id="select_area">
<option value="0" selected>全部</option>
</select>
</div>
</div>
</div>
<div class="col-xl-3 row align-items-center">
<label class="col-xl-4 form-label" id="area_label">地址</label>
<div class="col-xl-8">
<label id="address_detail_text" class="color-info-600"></label>
<input type="text" id="address_detail" name="address_detail" class="form-control">
<div class="col-xl-3 row align-items-center">
<label class="col-xl-4 form-label" id="area_label"><span class="text-danger">*</span>地址</label>
<div class="col-xl-8">
<label id="address_detail_text" class="color-info-600"></label>
<input type="text" id="address_detail" name="address_detail" class="form-control">
</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 class="row mb-3 d-flex justify-content-between">
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="power_station_code_label" for="power_station_code">電站編號</label>
<div class="col-xl-8">
<label id="power_station_code_text" class="color-info-600"></label>
@*<input type="text" id="power_station_code" name="power_station_code" disabled="disabled" class="form-control">*@
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="power_station_name_label" for="power_station_name">電站名稱</label>
<div class="col-xl-8">
<label id="power_station_name_text" class="color-info-600"></label>
<input type="text" id="power_station_name" name="power_station_name" class="form-control">
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label">是否為代管</label>
<div class="col-xl-8">
<p class="color-info-600">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="check_escrow" name="check_escrow" disabled="disabled">
<label class="custom-control-label" for="check_escrow" id="check_escrow_label">No</label>
</div>
</p>
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="escrow_name_lable" for="escrow_name">被代管公司</label>
<div class="col-xl-8">
<label id="escrow_name_text" class="color-info-600"></label>
<input type="text" id="escrow_name" name="escrow_name" class="form-control" disabled="disabled">
</div>
</div>
</div>
<div class="row mb-3 d-flex justify-content-between">
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="generating_capacity_label" for="generating_capacity">
裝置容量(kWp)
</label>
<div class="col-xl-8">
<label id="generating_capacity_text" class="color-info-600"></label>
<input type="number" step="0.0001" id="generating_capacity" name="generating_capacity" class="form-control">
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="estimate_efficacy_label" for="estimate_efficacy">
預估發電效能
</label>
<div class="col-xl-8">
<label id="estimate_efficacy_text" class="color-info-600"></label>
<input type="number" step="0.01" id="estimate_efficacy" name="estimate_efficacy" class="form-control">
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="estimate_kwh_label" for="estimate_kwh">
預估發電度數(kW/日)
</label>
<div class="col-xl-8">
<label id="estimate_kwh_text" class="color-info-600"></label>
<input type="number" step="0.01" id="estimate_kwh" name="estimate_kwh" class="form-control">
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="estimated_recovery_time_label" for="estimated_recovery_time">
預計回收年限
</label>
<div class="col-xl-8">
<label id="estimated_recovery_time_text" class="color-info-600"></label>
<input type="number" step="1" id="estimated_recovery_time" name="estimated_recovery_time" class="form-control">
</div>
</div>
</div>
<div class="row mb-5 d-flex justify-content-between ">
<div class="col-xl-6 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="power_station_operation_personnel_label">運維人員</label>
<div class="col-xl-8">
<select class="js-example-basic-multiple form-control" id="power_station_operation_personnel" multiple="multiple">
</select>
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="coordinate_label" for="coordinate">座標</label>
<div class="col-xl-8">
<label id="coordinate_text" class="color-info-600"></label>
<input type="text" id="coordinate" name="coordinate" class="form-control">
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="coordinate_label" for="coordinate">Line Token</label>
<div class="col-xl-8">
<label id="line_token_text" class="color-info-600"></label>
<input type="text" id="line_token" name="line_token" class="form-control">
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="solar_tpye_label"><span class="text-danger">*</span>電站類型</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-5 d-flex justify-content-between ">
<div class="col-xl-6 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="select_power_station_company_title">
電站歸屬
</label>
<div class="col-xl-8">
<select class="form-control" id="select_power_station_company">
</select>
<div class="row mb-3 d-flex justify-content-between">
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="power_station_code_label" for="power_station_code">電站編號</label>
<div class="col-xl-8">
<label id="power_station_code_text" class="color-info-600"></label>
@*<input type="text" id="power_station_code" name="power_station_code" disabled="disabled" class="form-control">*@
</div>
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="created_by_title">資料建立</label>
<div class="col-xl-8">
<label id="created_by_text" class="color-info-600"></label>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="power_station_name_label" for="power_station_name"><span class="text-danger">*</span>電站名稱</label>
<div class="col-xl-8">
<label id="power_station_name_text" class="color-info-600"></label>
<input type="text" id="power_station_name" name="power_station_name" class="form-control">
</div>
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="created_at_title">建立時間</label>
<div class="col-xl-8">
<label id="created_at_text" class="color-info-600"></label>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label">是否為代管</label>
<div class="col-xl-8">
<p class="color-info-600">
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="check_escrow" name="check_escrow" disabled="disabled">
<label class="custom-control-label" for="check_escrow" id="check_escrow_label">No</label>
</div>
</p>
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="escrow_name_lable" for="escrow_name">被代管公司</label>
<div class="col-xl-8">
<label id="escrow_name_text" class="color-info-600"></label>
<input type="text" id="escrow_name" name="escrow_name" class="form-control" disabled="disabled">
</div>
</div>
</div>
</div>
<div class="row mb-3 d-flex justify-content-between">
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="generating_capacity_label" for="generating_capacity">
<span class="text-danger">*</span>裝置容量(kWp)
</label>
<div class="col-xl-8">
<label id="generating_capacity_text" class="color-info-600"></label>
<input type="number" step="0.0001" id="generating_capacity" name="generating_capacity" class="form-control">
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="estimate_efficacy_label" for="estimate_efficacy">
<span class="text-danger">*</span>預估發電效能
</label>
<div class="col-xl-8">
<label id="estimate_efficacy_text" class="color-info-600"></label>
<input type="number" step="0.01" id="estimate_efficacy" name="estimate_efficacy" class="form-control">
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="estimate_kwh_label" for="estimate_kwh">
<span class="text-danger">*</span>預估發電度數(kW/日)
</label>
<div class="col-xl-8">
<label id="estimate_kwh_text" class="color-info-600"></label>
<input type="number" step="0.01" id="estimate_kwh" name="estimate_kwh" class="form-control">
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="estimated_recovery_time_label" for="estimated_recovery_time">
<span class="text-danger">*</span>預計回收年限
</label>
<div class="col-xl-8">
<label id="estimated_recovery_time_text" class="color-info-600"></label>
<input type="number" step="1" id="estimated_recovery_time" name="estimated_recovery_time" class="form-control">
</div>
</div>
</div>
<div class="row align-items-end">
@*
<div class="col-xl-6">
<h5 class="border-bottom font-weight-bold mb-3 pl-5 pb-3">逆變器</h5>
<div class="row mb-5 d-flex justify-content-between ">
<div class="col-xl-6 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="power_station_operation_personnel_label"><span class="text-danger">*</span>運維人員</label>
<div class="col-xl-8" id="power_station_operation_personnel_div">
<select class="js-example-basic-multiple form-control" id="power_station_operation_personnel" multiple="multiple">
</select>
<label id="power_station_operation_personnel-error" class="" style="z-index:1;color:red;display:none">此為必填欄位</label>
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="coordinate_label" for="coordinate"><span class="text-danger">*</span>座標</label>
<div class="col-xl-8">
<label id="coordinate_text" class="color-info-600"></label>
<input type="text" id="coordinate" name="coordinate" class="form-control">
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="coordinate_label" for="coordinate">Line Token</label>
<div class="col-xl-8">
<label id="line_token_text" class="color-info-600"></label>
<input type="text" id="line_token" name="line_token" class="form-control">
</div>
</div>
</div>
<div class="row mb-5 d-flex justify-content-between ">
<div class="col-xl-6 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="select_power_station_company_title">
<span class="text-danger">*</span>電站歸屬
</label>
<div class="col-xl-8">
<select class="form-control" id="select_power_station_company">
</select>
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="created_by_title">資料建立</label>
<div class="col-xl-8">
<label id="created_by_text" class="color-info-600"></label>
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="created_at_title">建立時間</label>
<div class="col-xl-8">
<label id="created_at_text" class="color-info-600"></label>
</div>
</div>
</div>
<div class="row align-items-end">
<div class="col-xl-8">
<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 row">
<label class="col-xl-4 form-label" id="inverter_brand_label" for="inverter_brand">廠牌</label>
<div class="col-xl-3 mb-3 row">
<label class="col-xl-4 form-label" id="photovoltaic_panel_brand_label" for="photovoltaic_panel_brand">廠牌</label>
<div class="col-xl-8">
<label id="inverter_brand_text" class="color-info-600"></label>
<input type="text" id="inverter_brand" name="inverter_brand" class="form-control">
<label id="photovoltaic_panel_brand_text" class="color-info-600"></label>
<input type="text" id="photovoltaic_panel_brand" name="photovoltaic_panel_brand" class="form-control">
</div>
</div>
<div class="col-xl-4 row">
<label class="col-xl-4 form-label" id="inverter_product_model_label" for="inverter_product_model">型號</label>
<div class="col-xl-8">
<label id="inverter_product_model_text" class="color-info-600"></label>
<input type="text" id="inverter_product_model" name="inverter_product_model" class="form-control">
<div class="col-xl-3 mb-3 row">
<label class="col-xl-4 form-label" id="photovoltaic_panel_specification_label" for="photovoltaic_panel_specification">規格</label>
<div class="col-xl-6">
<label id="photovoltaic_panel_specification_text" class="color-info-600"></label>
<input type="text" id="photovoltaic_panel_specification" name="photovoltaic_panel_specification" class="form-control">
</div>
<div class="col-xl-2 p-0">
<span>mm</span>
</div>
</div>
<div class="col-xl-4 row">
<label class="col-xl-4 form-label" id="inverter_amount_label" for="inverter_amount">數量</label>
<div class="col-xl-3 mb-3 row">
<label class="col-xl-4 form-label" id="photovoltaic_panel_amount_label" for="photovoltaic_panel_amount">數量</label>
<div class="col-xl-8">
<label id="inverter_amount_text" class="color-info-600"></label>
<input type="text" id="inverter_amount" name="inverter_amount" class="form-control">
<label id="photovoltaic_panel_amount_text" class="color-info-600"></label>
<input type="number" step="1" id="photovoltaic_panel_amount" name="photovoltaic_panel_amount" class="form-control">
</div>
</div>
</div>
</div>
*@
<div class="col-xl-8">
<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-3 mb-3 row">
<label class="col-xl-4 form-label" id="photovoltaic_panel_brand_label" for="photovoltaic_panel_brand">廠牌</label>
<div class="col-xl-8">
<label id="photovoltaic_panel_brand_text" class="color-info-600"></label>
<input type="text" id="photovoltaic_panel_brand" name="photovoltaic_panel_brand" class="form-control">
</div>
</div>
<div class="col-xl-3 mb-3 row">
<label class="col-xl-4 form-label" id="photovoltaic_panel_specification_label" for="photovoltaic_panel_specification">規格</label>
<div class="col-xl-6">
<label id="photovoltaic_panel_specification_text" class="color-info-600"></label>
<input type="text" id="photovoltaic_panel_specification" name="photovoltaic_panel_specification" class="form-control">
</div>
<div class="col-xl-2 p-0">
<span>mm</span>
</div>
</div>
<div class="col-xl-3 mb-3 row">
<label class="col-xl-4 form-label" id="photovoltaic_panel_amount_label" for="photovoltaic_panel_amount">數量</label>
<div class="col-xl-8">
<label id="photovoltaic_panel_amount_text" class="color-info-600"></label>
<input type="number" step="1" id="photovoltaic_panel_amount" name="photovoltaic_panel_amount" class="form-control">
</div>
</div>
<div class="col-xl-3 mb-3 row">
<label class="col-xl-4 form-label" id="photovoltaic_panel_product_model_label" for="photovoltaic_panel_product_model">型號</label>
<div class="col-xl-8">
<label id="photovoltaic_panel_product_model_text" class="color-info-600"></label>
<input type="text" id="photovoltaic_panel_product_model" name="photovoltaic_panel_product_model" class="form-control">
<div class="col-xl-3 mb-3 row">
<label class="col-xl-4 form-label" id="photovoltaic_panel_product_model_label" for="photovoltaic_panel_product_model">型號</label>
<div class="col-xl-8">
<label id="photovoltaic_panel_product_model_text" class="color-info-600"></label>
<input type="text" id="photovoltaic_panel_product_model" name="photovoltaic_panel_product_model" class="form-control">
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</div>
</div>
</div>

View File

@ -614,7 +614,7 @@
'<div class="mr-2">' +
'<input type="checkbox" class="" name="selectedInverterLayer2[]" value="' + inverter.powerStationId + '" valueName ="' + inverter.powerStationName + '" checked>' +
'</div>' +
'<h5 class="font-weight-bold"><i class="fal fa-charging-station"></i> ' + inverter.powerStationName + '</h5>' +
'<h5 class="font-weight-bold">' + inverter.powerStationName + '</h5>' +
'</div>' +
'</li>';
}
@ -624,7 +624,7 @@
'<div class="mr-2">' +
'<input type="checkbox" class="" name="selectedInverterLayer2[]" value="' + inverter.powerStationId + '" valueName ="' + inverter.powerStationName + '">' +
'</div>' +
'<h5 class="font-weight-bold"><i class="fal fa-charging-station"></i> ' + inverter.powerStationName + '</h5>' +
'<h5 class="font-weight-bold">' + inverter.powerStationName + '</h5>' +
'</div>' +
'</li>';
}