1. 電站管理 - 電站基本資料

This commit is contained in:
Kai 2021-06-17 22:05:34 +08:00
parent 32973c35a1
commit e89705cdfe
16 changed files with 2145 additions and 343 deletions

View File

@ -9,6 +9,7 @@ using SolarPower.Repository.Interface;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
@ -18,6 +19,8 @@ namespace SolarPower.Controllers
{
private readonly IUserRepository userRepository;
private readonly IPowerStationRepository powerStationRepository;
private string boeFilePath = "/upload/power_station/boe_file/";
private string powerSationSaveAsPath = "";
public PowerStationController(
IUserRepository userRepository,
@ -25,6 +28,8 @@ namespace SolarPower.Controllers
{
this.userRepository = userRepository;
this.powerStationRepository = powerStationRepository;
powerSationSaveAsPath = Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "power_station");
}
public IActionResult Index()
{
@ -68,6 +73,56 @@ namespace SolarPower.Controllers
return apiResult;
}
/// <summary>
/// 取得縣市選單
/// </summary>
/// <returns></returns>
[HttpGet]
public async Task<ApiResult<List<CitySelectItemList>>> GetCitySelectOptionList()
{
ApiResult<List<CitySelectItemList>> apiResult = new ApiResult<List<CitySelectItemList>>();
try
{
var citySelectItemLists = await powerStationRepository.GetCitySelectOptionListAsync();
apiResult.Code = "0000";
apiResult.Data = citySelectItemLists;
}
catch (Exception exception)
{
apiResult.Code = "9999";
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
apiResult.Msg = errorCode.GetString(apiResult.Code);
return apiResult;
}
/// <summary>
/// 取得縣市選單
/// </summary>
/// <returns></returns>
[HttpPost]
public async Task<ApiResult<List<AreaSelectItemList>>> GetAreaSelectOptionList(int cityId)
{
ApiResult<List<AreaSelectItemList>> apiResult = new ApiResult<List<AreaSelectItemList>>();
try
{
var areaSelectItemLists = await powerStationRepository.GetAreaSelectOptionListAsync(cityId);
apiResult.Code = "0000";
apiResult.Data = areaSelectItemLists;
}
catch (Exception exception)
{
apiResult.Code = "9999";
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
apiResult.Msg = errorCode.GetString(apiResult.Code);
return apiResult;
}
/// <summary>
/// 取得單一電站基本資料
/// </summary>
@ -90,13 +145,19 @@ namespace SolarPower.Controllers
apiResult.Msg = errorCode.GetString(apiResult.Code);
return apiResult;
}
else if (powerStation.Id != myUser.CompanyId)
else if (powerStation.CompanyId != myUser.CompanyId)
{
apiResult.Code = "9993";
apiResult.Msg = errorCode.GetString(apiResult.Code);
return apiResult;
}
//替能源局換檔案路徑
if (!string.IsNullOrEmpty(powerStation.BoEFile))
{
powerStation.BoEFile = boeFilePath + powerStation.BoEFile;
}
apiResult.Code = "0000";
apiResult.Data = powerStation;
@ -117,9 +178,9 @@ namespace SolarPower.Controllers
/// </summary>
/// <param name="post"></param>
/// <returns></returns>
public async Task<ApiResult<string>> SavePowerStationInfo(PostPowerStationInfo post)
public async Task<ApiResult<PowerStation>> SavePowerStationInfo(PostPowerStationInfo post)
{
ApiResult<string> apiResult = new ApiResult<string>();
ApiResult<PowerStation> apiResult = new ApiResult<PowerStation>();
PowerStation powerStation = null;
@ -137,12 +198,32 @@ namespace SolarPower.Controllers
}
#region
powerStation = new PowerStation() {
//取得電站該縣市的Zipcode
var zipcode = await powerStationRepository.GetCityAreaZipcodeAsync(post.AreaId);
//取得電站該縣市地區最後流水號
var lastSerialNumber = await powerStationRepository.GetLastSerialNumberByCityAreaIdAsync(post.CityId, post.AreaId);
var tempSerialNumber = 0;
if (!string.IsNullOrEmpty(lastSerialNumber))
{
tempSerialNumber = Convert.ToInt32(lastSerialNumber) + 1;
}
else
{
tempSerialNumber = 1;
}
var codeFormat = "{0}-{1}-{2}";
powerStation = new PowerStation()
{
CompanyId = myUser.CompanyId,
CityId = post.CityId,
AreaId = post.AreaId,
Address = post.Address,
Name = post.Name,
Code = String.Format(codeFormat, zipcode.City, zipcode.Area, tempSerialNumber.ToString().PadLeft(4, '0')),
SerialNumber = tempSerialNumber.ToString().PadLeft(4, '0'),
IsEscrow = post.IsEscrow,
EscrowName = post.EscrowName,
ElectricityMeterAt = post.ElectricityMeterAt,
@ -167,6 +248,8 @@ namespace SolarPower.Controllers
"AreaId",
"Address",
"Name",
"Code",
"SerialNumber",
"IsEscrow",
"EscrowName",
"ElectricityMeterAt",
@ -181,12 +264,35 @@ namespace SolarPower.Controllers
"PhotovoltaicPanelProductModel",
"PhotovoltaicPanelSpecification",
"PhotovoltaicPanelAmount",
"CreatedBy",
"CreatedBy"
};
var id = await powerStationRepository.AddOneAsync(powerStation, properties);
apiResult.Data = id.ToString();
#region
var city = await powerStationRepository.GetOneCityByIdAsync(post.CityId);
var area = await powerStationRepository.GetOneAreaByIdAsync(post.AreaId);
LandBuilding landBuilding = new LandBuilding()
{
Address = city.Name + area.Name + post.Address,
PowerStationId = id,
CreatedBy = myUser.Id
};
List<string> landBuildingProperties = new List<string>()
{
"Address",
"PowerStationId",
"CreatedBy",
"CreatedBy"
};
await powerStationRepository.AddOneLandBuildingInfo(landBuilding, landBuildingProperties);
#endregion
apiResult.Code = "0000";
apiResult.Msg = "儲存成功";
apiResult.Data = await powerStationRepository.GetOneAsync(id);
#endregion
}
else
@ -198,13 +304,175 @@ namespace SolarPower.Controllers
return apiResult;
}
#region
UpdatePowerStationInfo update = new UpdatePowerStationInfo()
{
Id = post.Id,
CityId = post.CityId,
AreaId = post.AreaId,
Address = post.Address,
Name = post.Name,
IsEscrow = post.IsEscrow,
EscrowName = post.EscrowName,
ElectricityMeterAt = post.ElectricityMeterAt,
EstimatedRecoveryTime = post.EstimatedRecoveryTime,
GeneratingCapacity = post.GeneratingCapacity,
PowerRate = post.PowerRate,
Coordinate = post.Coordinate,
InverterBrand = post.InverterBrand,
InverterProductModel = post.InverterProductModel,
InverterAmount = post.InverterAmount,
PhotovoltaicPanelBrand = post.PhotovoltaicPanelBrand,
PhotovoltaicPanelProductModel = post.PhotovoltaicPanelProductModel,
PhotovoltaicPanelSpecification = post.PhotovoltaicPanelSpecification,
PhotovoltaicPanelAmount = post.PhotovoltaicPanelAmount,
UpdatedBy = myUser.Id
};
List<string> properties = new List<string>()
{
"Id",
"CityId",
"AreaId",
"Address",
"Name",
"IsEscrow",
"EscrowName",
"ElectricityMeterAt",
"EstimatedRecoveryTime",
"GeneratingCapacity",
"PowerRate",
"Coordinate",
"InverterBrand",
"InverterProductModel",
"InverterAmount",
"PhotovoltaicPanelBrand",
"PhotovoltaicPanelProductModel",
"PhotovoltaicPanelSpecification",
"PhotovoltaicPanelAmount",
"UpdatedBy",
};
await powerStationRepository.UpdatePowerStationInfo(update, properties);
apiResult.Code = "0000";
apiResult.Msg = "儲存成功";
apiResult.Data = await powerStationRepository.GetOneAsync(powerStation.Id);
#endregion
}
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = errorCode.GetString(apiResult.Code);
string json = System.Text.Json.JsonSerializer.Serialize(post);
Logger.LogError("【" + controllerName + "/" + actionName + "】" + json);
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
return apiResult;
}
/// <summary>
/// 新增 / 修改 能源局與台電資料
/// </summary>
/// <param name="post"></param>
/// <returns></returns>
[HttpPost]
public async Task<ApiResult<PowerStation>> SaveBoETPCInfo([FromForm] PostBoETPCInfo post)
{
ApiResult<PowerStation> apiResult = new ApiResult<PowerStation>();
PowerStation powerStation = null;
try
{
powerStation = await powerStationRepository.GetOneAsync(post.Id);
if (powerStation == null)
{
if (post.Id != 0)
{
apiResult.Code = "9992";
apiResult.Msg = errorCode.GetString(apiResult.Code);
return apiResult;
}
}
else
{
if (powerStation.CompanyId != myUser.CompanyId)
{
apiResult.Code = "9993";
apiResult.Msg = errorCode.GetString(apiResult.Code);
return apiResult;
}
#region
//處理檔案
var boeFileName = "";
if (post.BoEFile != null)
{
var split = post.BoEFile.FileName.Split(".");
boeFileName = DateTime.Now.ToString("yyyyMMddHHmmss") + "." + split[split.Length - 1];
var fullPath = Path.Combine(powerSationSaveAsPath, "boe_file", boeFileName);
using (var stream = new FileStream(fullPath, FileMode.Create))
{
post.BoEFile.CopyTo(stream);
}
}
UpdateBoETPCInfo update = new UpdateBoETPCInfo()
{
Id = post.Id,
BoEFileName = post.BoEFile != null ? post.BoEFile.FileName : null, //原本檔名
BoEFile = boeFileName, //自訂檔名
BoEDiscountRate = post.BoEDiscountRate,
BoEDeviceRegisterNumber = post.BoEDeviceRegisterNumber,
BoERentRatio = post.BoERentRatio,
TPCContractNumber = post.TPCContractNumber,
TPCContractAt = post.TPCContractAt,
TPCSellDeadline = post.TPCSellDeadline,
TPCMeterReading = post.TPCMeterReading,
TPCPurchaseElectricityAt = post.TPCPurchaseElectricityAt,
TPCSellElectricityAt = post.TPCSellElectricityAt,
UpdatedBy = myUser.Id
};
List<string> properties = new List<string>()
{
"Id",
"BoEFileName",
"BoEFile",
"BoEDiscountRate",
"BoEDeviceRegisterNumber",
"BoERentRatio",
"TPCContractNumber",
"TPCContractAt",
"TPCSellDeadline",
"TPCMeterReading",
"TPCPurchaseElectricityAt",
"TPCSellElectricityAt",
"UpdatedBy",
};
await powerStationRepository.UpdateBoETPCInfo(update, properties);
#endregion
}
powerStation = await powerStationRepository.GetOneAsync(powerStation.Id);
//替能源局換檔案路徑
if (!string.IsNullOrEmpty(powerStation.BoEFile))
{
powerStation.BoEFile = boeFilePath + powerStation.BoEFile;
}
apiResult.Code = "0000";
apiResult.Msg = "修改成功";
apiResult.Data = powerStation;
}
catch (Exception exception)
{
@ -216,5 +484,176 @@ namespace SolarPower.Controllers
return apiResult;
}
/// <summary>
/// 新增 / 修改 土地與房屋資料
/// </summary>
/// <param name="post"></param>
/// <returns></returns>
public async Task<ApiResult<PowerStation>> SaveLandBuildingInfo(PostLandBuildingInfo post)
{
ApiResult<PowerStation> apiResult = new ApiResult<PowerStation>();
PowerStation powerStation = null;
LandBuilding landBuilding = null;
try
{
powerStation = await powerStationRepository.GetOneAsync(post.PowerStationId);
if (powerStation == null)
{
if (post.PowerStationId != 0)
{
apiResult.Code = "9992";
apiResult.Msg = errorCode.GetString(apiResult.Code);
return apiResult;
}
}
else
{
if (powerStation.CompanyId != myUser.CompanyId)
{
apiResult.Code = "9993";
apiResult.Msg = errorCode.GetString(apiResult.Code);
return apiResult;
}
landBuilding = await powerStationRepository.GetOneLandBuildingInfo(post.Id);
if (landBuilding == null)
{
if (post.Id != 0)
{
apiResult.Code = "9991";
apiResult.Msg = errorCode.GetString(apiResult.Code);
return apiResult;
}
#region
//取得公司在該縣市區域當前電站的流水編碼
landBuilding = new LandBuilding()
{
PowerStationId = powerStation.Id,
Address = post.Address,
LeaseNotarizationAt = post.LeaseNotarizationAt,
Landowner = post.Landowner,
Purpose = post.Purpose,
LeaseRate = post.LeaseRate,
Coordinate = post.Coordinate,
Phone = post.Phone,
CreatedBy = myUser.Id
};
List<string> properties = new List<string>()
{
"PowerStationId",
"Address",
"LeaseNotarizationAt",
"Landowner",
"Purpose",
"LeaseRate",
"Coordinate",
"Phone",
"CreatedBy"
};
var id = await powerStationRepository.AddOneLandBuildingInfo(landBuilding, properties);
apiResult.Code = "0000";
apiResult.Msg = "儲存成功";
apiResult.Data = await powerStationRepository.GetOneAsync(powerStation.Id);
#endregion
}
else
{
#region
UpdateLandBuilding update = new UpdateLandBuilding()
{
Id = post.Id,
Address = post.Address,
LeaseNotarizationAt = post.LeaseNotarizationAt,
Landowner = post.Landowner,
Purpose = post.Purpose,
LeaseRate = post.LeaseRate,
Coordinate = post.Coordinate,
Phone = post.Phone,
UpdatedBy = myUser.Id
};
List<string> properties = new List<string>()
{
"Id",
"Address",
"LeaseNotarizationAt",
"Landowner",
"Purpose",
"LeaseRate",
"Coordinate",
"Phone",
"UpdatedBy",
};
await powerStationRepository.UpdateLandBuildingInfo(update, properties);
apiResult.Code = "0000";
apiResult.Msg = "修改成功";
apiResult.Data = await powerStationRepository.GetOneAsync(powerStation.Id);
#endregion
}
}
}
catch (Exception exception)
{
apiResult.Code = "9999";
apiResult.Msg = errorCode.GetString(apiResult.Code);
string json = System.Text.Json.JsonSerializer.Serialize(post);
Logger.LogError("【" + controllerName + "/" + actionName + "】" + json);
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
}
return apiResult;
}
/// <summary>
/// 軟刪除單一土地房屋資訊
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
[HttpPost]
public async Task<ApiResult<PowerStation>> DeleteLandBuildingInfo(int id)
{
ApiResult<PowerStation> apiResult = new ApiResult<PowerStation>();
LandBuilding landBuilding;
try
{
landBuilding = await powerStationRepository.GetOneLandBuildingInfo(id);
if (landBuilding == null)
{
apiResult.Code = "9996";
apiResult.Msg = errorCode.GetString(apiResult.Code);
return apiResult;
}
await powerStationRepository.DeleteOneLandBuildingInfo(landBuilding.Id);
apiResult.Code = "0000";
apiResult.Msg = "刪除成功";
apiResult.Data = await powerStationRepository.GetOneAsync(landBuilding.PowerStationId);
}
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;
}
}
}

View File

@ -17,6 +17,7 @@ namespace SolarPower.Models
{
{ "0000", "OK" },
{ "0001", "傳入參數錯誤。" },
{ "9991", "查無該土地房屋資訊"},
{ "9992", "查無該電站資訊"},
{ "9993", "無此權限操作"},
{ "9994", "查無該公司角色"},

View File

@ -1,4 +1,5 @@
using System;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -7,16 +8,33 @@ namespace SolarPower.Models.PowerStation
{
public class PowerStation : Created
{
private string electricityMeterAt = "", tpcContractAt = "", tpcPurchaseElectricityAt = "", tpcSellElectricityAt = "";
public int Id { get; set; }
public int CompanyId { get; set; }
public int CityId { get; set; } //縣市
public int AreaId { get; set; } //地區
public string Address { get; set; } //地址
public string Name { get; set; } //名稱
//public string Code { get; set; }
public string Code { get; set; } //電站代碼
public string SerialNumber { get; set; } //四碼流水號
public byte IsEscrow { get; set; } //是否被代管
public string EscrowName { get; set; } //被代管公司
public string ElectricityMeterAt { get; set; } //台電掛錶日
public string ElectricityMeterAt //台電掛錶日
{
get
{
if (!string.IsNullOrEmpty(electricityMeterAt))
{
return Convert.ToDateTime(electricityMeterAt).ToString("yyyy-MM-dd");
}
else
{
return null;
}
}
set { electricityMeterAt = value; }
}
public int EstimatedRecoveryTime { get; set; } //預計回收年限
public double GeneratingCapacity { get; set; } //發電容量
public double PowerRate { get; set; } //授電費率
@ -28,30 +46,91 @@ namespace SolarPower.Models.PowerStation
public string PhotovoltaicPanelProductModel { get; set; } //光電板型號
public string PhotovoltaicPanelSpecification { get; set; } //光電板規格
public int PhotovoltaicPanelAmount { get; set; } //光電板規格
public string BoEFileName { get; set; } //能源局原檔案名
public string BoEFile { get; set; } //能源局檔案
public int BoEDiscountRate { get; set; } //能源局折扣率
public string BoEDeviceRegisterNumber { get; set; } //能源局設備登記編號
public int BoERentRatio { get; set; } //能源局租金比例
public string TPCContractNumber { get; set; } //台電契約編號
public string TPCContractAt { get; set; } //台電簽約日期
public string TPCContractAt //台電簽約日期
{
get
{
if (!string.IsNullOrEmpty(tpcContractAt))
{
return Convert.ToDateTime(tpcContractAt).ToString("yyyy-MM-dd");
}
else
{
return null;
}
}
set { tpcContractAt = value; }
}
public int TPCSellDeadline { get; set; } //台電售電期限(年)
public string TPCPurchaseElectricityAt { get; set; } //台電正式購電日
public string TPCSellElectricityAt { get; set; } //台電正式售電日
public int TPCMeterReading { get; set; } //台電每期抄錶日
public string TPCPurchaseElectricityAt //台電正式購電日
{
get
{
if (!string.IsNullOrEmpty(tpcPurchaseElectricityAt))
{
return Convert.ToDateTime(tpcPurchaseElectricityAt).ToString("yyyy-MM-dd");
}
else
{
return null;
}
}
set { tpcPurchaseElectricityAt = value; }
}
public string TPCSellElectricityAt //台電正式售電日
{
get
{
if (!string.IsNullOrEmpty(tpcPurchaseElectricityAt))
{
return Convert.ToDateTime(tpcPurchaseElectricityAt).ToString("yyyy-MM-dd");
}
else
{
return null;
}
}
set { tpcPurchaseElectricityAt = value; }
}
public List<LandBuilding> LandBuildings { get; set; } //土地房屋資料
public string CreatorName { get; set; } //創建者名稱
}
public class LandBuilding : Created
{
private string leaseNotarizationAt;
public int Id { get; set; }
public int PowerStationId { get; set; }
public string Address { get; set; }
public string LeaseNotarizationAt { get; set; } //租約公證日期
public string LeaseNotarizationAt //租約公證日期
{
get
{
if (!string.IsNullOrEmpty(leaseNotarizationAt))
{
return Convert.ToDateTime(leaseNotarizationAt).ToString("yyyy-MM-dd");
}
else
{
return null;
}
}
set { leaseNotarizationAt = value; }
}
public string Landowner { get; set; } //地主姓名
public string Purpose { get; set; } //房屋用途
public int LeaseRate { get; set; } //租金比例
public string Coordinate { get; set; } //經緯度
public string Phone { get; set; } //電話
public string CreatorName { get; set; } //創建者名稱
}
@ -78,4 +157,115 @@ namespace SolarPower.Models.PowerStation
public string PhotovoltaicPanelSpecification { get; set; } //光電板規格
public int PhotovoltaicPanelAmount { get; set; } //光電板規格
}
public class UpdatePowerStationInfo : Updated
{
public int CityId { get; set; } //縣市
public int AreaId { get; set; } //地區
public string Address { get; set; } //地址
public string Name { get; set; } //名稱
public byte IsEscrow { get; set; } //是否被代管
public string EscrowName { get; set; } //被代管公司
public string ElectricityMeterAt { get; set; } //台電掛錶日
public int EstimatedRecoveryTime { get; set; } //預計回收年限
public double GeneratingCapacity { get; set; } //發電容量
public double PowerRate { get; set; } //授電費率
public string Coordinate { get; set; } //座標
public string InverterBrand { get; set; } //逆變器廠牌
public string InverterProductModel { get; set; } //逆變器型號
public int InverterAmount { get; set; } //逆變器數量
public string PhotovoltaicPanelBrand { get; set; } //光電板廠牌
public string PhotovoltaicPanelProductModel { get; set; } //光電板型號
public string PhotovoltaicPanelSpecification { get; set; } //光電板規格
public int PhotovoltaicPanelAmount { get; set; } //光電板規格
}
public class PostBoETPCInfo
{
public int Id { get; set; }
public IFormFile BoEFile { get; set; }
public int BoEDiscountRate { get; set; }
public string BoEDeviceRegisterNumber { get; set; }
public int BoERentRatio { get; set; }
public string TPCContractNumber { get; set; }
public string TPCContractAt { get; set; }
public int TPCSellDeadline { get; set; }
public int TPCMeterReading { get; set; }
public string TPCPurchaseElectricityAt { get; set; }
public string TPCSellElectricityAt { get; set; }
}
public class UpdateBoETPCInfo : Updated
{
public string BoEFileName { get; set; }
public string BoEFile { get; set; }
public int BoEDiscountRate { get; set; }
public string BoEDeviceRegisterNumber { get; set; }
public int BoERentRatio { get; set; }
public string TPCContractNumber { get; set; }
public string TPCContractAt { get; set; }
public int TPCSellDeadline { get; set; }
public int TPCMeterReading { get; set; }
public string TPCPurchaseElectricityAt { get; set; }
public string TPCSellElectricityAt { get; set; }
}
public class PostLandBuildingInfo
{
public int Id { get; set; }
public int PowerStationId { get; set; }
public string Address { get; set; }
public string LeaseNotarizationAt { get; set; }
public string Landowner { get; set; }
public string Purpose { get; set; }
public int LeaseRate { get; set; }
public string Coordinate { get; set; }
public string Phone { get; set; }
}
public class UpdateLandBuilding : Updated
{
public string Address { get; set; }
public string LeaseNotarizationAt { get; set; }
public string Landowner { get; set; }
public string Purpose { get; set; }
public int LeaseRate { get; set; }
public string Coordinate { get; set; }
public string Phone { get; set; }
}
public class CitySelectItemList
{
public string Text { get; set; }
public string Value { get; set; }
}
public class AreaSelectItemList
{
public string Text { get; set; }
public string Value { get; set; }
}
public class Zipcode
{
public string City { get; set; }
public string Area { get; set; }
}
public class City
{
public int Id { get; set; }
public string Name { get; set; }
public string ZipCode { get; set; }
public int Priority { get; set; }
}
public class Area
{
public int Id { get; set; }
public int CityId { get; set; }
public string Name { get; set; }
public string ZipCode { get; set; }
}
}

View File

@ -186,101 +186,58 @@ namespace SolarPower.Models
/// 回傳結果
/// </summary>
/// <typeparam name="T">資料型別</typeparam>
public class ApiResult<S1>
public class ApiResult<T>
{
public string Code { get; set; }
public string Msg { get; set; }
public S1 Data { get; set; }
public T Data { get; set; }
}
public class DapperConnection
/// <summary>
/// 資料夾
/// </summary>
public class FolderFunction
{
/// <summary>
/// 新增SQL字串
/// 創建資料夾
/// </summary>
/// <param name="TableName">Table名稱</param>
/// <param name="TableValue">Add新增欄位名稱</param>
/// <returns></returns>
//public string InsertQueryTxt(string TableName, List<string> TableValue)
//{
// var sqlId = "";
// var sqlValue = "";
/// <param name="folderPath"></param>
/// <param name="tempType">0:找到資料夾也不刪除 1:找到資料夾並且刪除</param>
public void CreateFolder(string folderPath, int type)
{
DirectoryInfo dInfo = new DirectoryInfo(folderPath);
// foreach (var value in TableValue)
// {
// sqlId += value + ",";
// sqlValue += "@" + value + ",";
// }
if (dInfo.Exists) //找到
{
if (type == 1)
{
dInfo.Delete(true); //如果資料夾裡面有檔案給bool參數就可以直接刪除沒給bool參數會報錯誤
}
// var connTxt = "INSERT INTO " + TableName + "(" + sqlId.Substring(0, sqlId.Length - 1) + ") VALUES" + "(" + sqlValue.Substring(0, sqlValue.Length - 1) + ");";
// return connTxt;
//}
dInfo.Create();
}
else //沒找到
{
dInfo.Create(); //建立新的資料夾
}
}
/// <summary>
/// 修改SQL字串
/// 刪除檔案
/// </summary>
/// <param name="TableName">Table名稱</param>
/// <param name="TableValue">Update變動欄位名稱</param>
/// <param name="sWhere">where條件</param>
/// <returns></returns>
//public string UpdateQueryTxt(string TableName, List<string> TableValue, string sWhere = "")
//{
// var sqlTxt = "";
// foreach (var value in TableValue)
// {
// sqlTxt += value + "=@" + value + ",";
// }
// var connTxt = "UPDATE " + TableName + " SET " + sqlTxt.Substring(0, sqlTxt.Length - 1);
// if (sWhere != "")
// {
// connTxt += " WHERE " + sWhere;
// }
// return connTxt;
//}
//private string GenerateInsertQuery()
//{
// var insertQuery = new StringBuilder($"INSERT INTO {_tableName} ");
// insertQuery.Append("(");
// var properties = GenerateListOfProperties(GetProperties);
// properties.ForEach(prop => { insertQuery.Append($"[{prop}],"); });
// insertQuery
// .Remove(insertQuery.Length - 1, 1)
// .Append(") VALUES (");
// properties.ForEach(prop => { insertQuery.Append($"@{prop},"); });
// insertQuery
// .Remove(insertQuery.Length - 1, 1)
// .Append(")");
// return insertQuery.ToString();
//}
//private string GenerateUpdateQuery()
//{
// var updateQuery = new StringBuilder($"UPDATE {_tableName} SET ");
// var properties = GenerateListOfProperties(GetProperties);
// properties.ForEach(property =>
// {
// if (!property.Equals("Id"))
// {
// updateQuery.Append($"{property}=@{property},");
// }
// });
// updateQuery.Remove(updateQuery.Length - 1, 1); //remove last comma
// updateQuery.Append(" WHERE Id=@Id");
// return updateQuery.ToString();
//}
/// <param name="filePath"></param>
public void DeleteFile(string filePath)
{
System.IO.FileInfo file = new System.IO.FileInfo(filePath);
if (File.Exists(filePath)) //找到
{
//do something
file.Delete();
}
else //沒找到
{
//do something
}
}
}
}

View File

@ -17,6 +17,159 @@ namespace SolarPower.Repository.Implement
tableName = "power_station";
}
/// <summary>
/// 查詢縣市列表
/// </summary>
/// <returns></returns>
public async Task<List<CitySelectItemList>> GetCitySelectOptionListAsync()
{
List<CitySelectItemList> result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var sql = $"SELECT Id AS Value, Name AS Text FROM city";
result = (await conn.QueryAsync<CitySelectItemList>(sql)).ToList();
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
/// <summary>
/// 查詢縣市列表
/// </summary>
/// <param name="cityId"></param>
/// <returns></returns>
public async Task<List<AreaSelectItemList>> GetAreaSelectOptionListAsync(int cityId)
{
List<AreaSelectItemList> result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var sql = $"SELECT Id AS Value, Name AS Text FROM Area WHERE CityId = @CityId";
result = (await conn.QueryAsync<AreaSelectItemList>(sql, new { CityId = cityId })).ToList();
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
/// <summary>
/// 透過編號取得,縣市資訊
/// </summary>
/// <param name="cityId"></param>
/// <returns></returns>
public async Task<City> GetOneCityByIdAsync(int cityId)
{
City result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var sql = @$"SELECT * FROM city WHERE Id=@Id";
result = await conn.QueryFirstOrDefaultAsync<City>(sql, new { Id = cityId });
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
/// <summary>
/// 透過編號取得,地區資訊
/// </summary>
/// <param name="areaId"></param>
/// <returns></returns>
public async Task<Area> GetOneAreaByIdAsync(int areaId)
{
Area result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var sql = @$"SELECT * FROM area WHERE Id=@Id";
result = await conn.QueryFirstOrDefaultAsync<Area>(sql, new { Id = areaId });
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
/// <summary>
/// 取得縣市地區代碼
/// </summary>
/// <param name="areaId"></param>
/// <returns></returns>
public async Task<Zipcode> GetCityAreaZipcodeAsync(int areaId)
{
Zipcode result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var sql = @$"SELECT a.ZipCode AS Area, c.ZipCode AS City FROM area a
LEFT JOIN city c ON a.cityId = c.Id
WHERE a.Id = @AreaId";
result = await conn.QueryFirstOrDefaultAsync<Zipcode>(sql, new { AreaId = areaId });
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
/// <summary>
/// 透過縣市地區編號,取得該縣市地區最後的流水號
/// </summary>
/// <param name="cityId"></param>
/// <param name="areaId"></param>
/// <returns></returns>
public async Task<string> GetLastSerialNumberByCityAreaIdAsync(int cityId, int areaId)
{
string result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var sql = @$"SELECT SerialNumber FROM {tableName}
WHERE CityId = @CityId && AreaId = @AreaId ORDER BY SerialNumber DESC";
result = await conn.QueryFirstOrDefaultAsync<string>(sql, new { CityId = cityId, AreaId = areaId });
}
catch (Exception exception)
{
throw exception;
}
return result;
}
}
/// <summary>
/// 透過電站編號,取得單一電站資訊(覆寫)
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public override async Task<PowerStation> GetOneAsync(int id)
{
//base.GetOneAsync(id);
@ -27,13 +180,17 @@ namespace SolarPower.Repository.Implement
conn.Open();
try
{
var sql = $"SELECT * FROM {tableName} WHERE Deleted = 0 AND Id = @Id";
var sql = @$"SELECT ps.*, u.Name AS CreatorName FROM {tableName} ps
LEFT JOIN user u ON ps.CreatedBy = u.Id
WHERE ps.Deleted = 0 AND ps.Id = @Id";
result = await conn.QueryFirstOrDefaultAsync<PowerStation>(sql, new { Id = id});
if(result!= null)
{
var sql_land_building = @"SELECT * FROM land_building WHERE Deleted = 0 AND PowerStationId = @PowerStationId";
var sql_land_building = @$"SELECT lb.*, u.Name AS CreatorName FROM land_building lb
LEFT JOIN user u ON lb.CreatedBy = u.Id
WHERE lb.Deleted = 0 AND PowerStationId = @PowerStationId";
result.LandBuildings = (await conn.QueryAsync<LandBuilding>(sql_land_building, new { PowerStationId = result.Id })).ToList();
}
}
@ -48,5 +205,203 @@ namespace SolarPower.Repository.Implement
return result;
}
}
/// <summary>
/// 修改電站基本資訊
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task UpdatePowerStationInfo(UpdatePowerStationInfo entity, List<string> properties)
{
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
conn.Open();
using (var trans = conn.BeginTransaction())
{
try
{
var sql = GenerateUpdateQuery(properties);
await conn.ExecuteAsync(sql, entity, trans);
trans.Commit();
}
catch (Exception exception)
{
trans.Rollback();
throw exception;
}
finally
{
conn.Close();
}
}
}
}
/// <summary>
/// 修改能源局與台電資訊
/// </summary>
/// <param name="entity"></param>
/// <returns></returns>
public async Task UpdateBoETPCInfo(UpdateBoETPCInfo entity, List<string> properties)
{
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
conn.Open();
using (var trans = conn.BeginTransaction())
{
try
{
var sql = GenerateUpdateQuery(properties);
await conn.ExecuteAsync(sql, entity, trans);
trans.Commit();
}
catch (Exception exception)
{
trans.Rollback();
throw exception;
}
finally
{
conn.Close();
}
}
}
}
/// <summary>
/// 新增 土地房屋資訊
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<LandBuilding> GetOneLandBuildingInfo(int id)
{
LandBuilding result;
using (IDbConnection conn = _databaseHelper.GetConnection())
{
conn.Open();
try
{
var sql = @"SELECT * FROM land_building WHERE Deleted =0 AND Id = @Id";
result = await conn.QueryFirstOrDefaultAsync<LandBuilding>(sql, new { Id = id });
}
catch (Exception exception)
{
throw exception;
}
finally
{
conn.Close();
}
return result;
}
}
/// <summary>
/// 新增 土地房屋資訊
/// </summary>
/// <param name="entity"></param>
/// <param name="properties"></param>
/// <returns></returns>
public async Task<int> AddOneLandBuildingInfo(LandBuilding entity, List<string> properties)
{
int id;
using (IDbConnection conn = _databaseHelper.GetConnection())
{
conn.Open();
try
{
string sql = GenerateInsertQueryWithCustomTable(properties, "land_building");
sql += "SELECT LAST_INSERT_ID();";
id = (await conn.QueryAsync<int>(sql, entity)).Single();
}
catch (Exception exception)
{
throw exception;
}
finally
{
conn.Close();
}
return id;
}
}
/// <summary>
/// 更新 土地房屋資訊
/// </summary>
/// <param name="entity"></param>
/// <param name="properties"></param>
/// <returns></returns>
public async Task UpdateLandBuildingInfo(UpdateLandBuilding entity, List<string> properties)
{
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
conn.Open();
using (var trans = conn.BeginTransaction())
{
try
{
var sql = GenerateUpdateQueryWithCustomTable(properties, "land_building");
await conn.ExecuteAsync(sql, entity, trans);
trans.Commit();
}
catch (Exception exception)
{
trans.Rollback();
throw exception;
}
finally
{
conn.Close();
}
}
}
}
/// <summary>
/// 軟刪除土地房屋資訊
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task DeleteOneLandBuildingInfo(int id)
{
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
conn.Open();
using (var trans = conn.BeginTransaction())
{
try
{
var sql = $"UPDATE land_building SET deleted = 1 WHERE id = @Id";
await conn.ExecuteAsync(sql, new { Id = id }, trans);
trans.Commit();
}
catch (Exception exception)
{
trans.Rollback();
throw exception;
}
finally
{
conn.Close();
}
}
}
}
}
}

View File

@ -282,7 +282,7 @@ namespace SolarPower.Repository.Implement
insertQuery
.Remove(insertQuery.Length - 1, 1)
.Append(")");
.Append(");");
return insertQuery.ToString();
}
@ -309,5 +309,29 @@ namespace SolarPower.Repository.Implement
return updateQuery.ToString();
}
/// <summary>
/// 產生Update語句可選擇自己要加入資料表
/// </summary>
/// <param name="properties"></param>
/// <param name="table_name">欲新增至目標資料表</param>
/// <returns></returns>
protected string GenerateUpdateQueryWithCustomTable(List<string> properties, string table_name)
{
var updateQuery = new StringBuilder($"UPDATE {table_name} SET ");
properties.ForEach(property =>
{
if (!property.Equals("Id"))
{
updateQuery.Append($"{property}=@{property},");
}
});
updateQuery.Remove(updateQuery.Length - 1, 1); //remove last comma
updateQuery.Append(" WHERE id = @Id");
return updateQuery.ToString();
}
}
}

View File

@ -8,5 +8,94 @@ namespace SolarPower.Repository.Interface
{
public interface IPowerStationRepository : IRepositoryBase<PowerStation>
{
/// <summary>
/// 查詢縣市列表
/// </summary>
/// <param name="CompanyId"></param>
/// <returns></returns>
Task<List<CitySelectItemList>> GetCitySelectOptionListAsync();
/// <summary>
/// 查詢地區列表
/// </summary>
/// <param name="CompanyId"></param>
/// <returns></returns>
Task<List<AreaSelectItemList>> GetAreaSelectOptionListAsync(int cityId);
/// <summary>
/// 透過編號取得,縣市資訊
/// </summary>
/// <param name="cityId"></param>
/// <returns></returns>
Task<City> GetOneCityByIdAsync(int cityId);
/// <summary>
/// 透過編號取得,地區資訊
/// </summary>
/// <param name="areaId"></param>
/// <returns></returns>
Task<Area> GetOneAreaByIdAsync(int areaId);
/// <summary>
/// 取得縣市地區代碼
/// </summary>
/// <param name="areaId"></param>
/// <returns></returns>
Task<Zipcode> GetCityAreaZipcodeAsync(int areaId);
/// <summary>
/// 透過縣市地區編號,取得該縣市地區最後的流水號
/// </summary>
/// <param name="cityId"></param>
/// <param name="areaId"></param>
/// <returns></returns>
Task<string> GetLastSerialNumberByCityAreaIdAsync(int cityId, int areaId);
/// <summary>
/// 修改電站基本資訊
/// </summary>
/// <param name="entity"></param>
/// <param name="properties"></param>
/// <returns></returns>
Task UpdatePowerStationInfo(UpdatePowerStationInfo entity, List<string> properties);
/// <summary>
/// 修改能源局與台電資訊
/// </summary>
/// <param name="entity"></param>
/// <param name="properties"></param>
/// <returns></returns>
Task UpdateBoETPCInfo(UpdateBoETPCInfo entity, List<string> properties);
/// <summary>
/// 取得 土地房屋資訊
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task<LandBuilding> GetOneLandBuildingInfo(int id);
/// <summary>
/// 新增 土地房屋資訊
/// </summary>
/// <param name="entity"></param>
/// <param name="properties"></param>
/// <returns></returns>
Task<int> AddOneLandBuildingInfo(LandBuilding entity, List<string> properties);
/// <summary>
/// 更新 土地房屋資訊
/// </summary>
/// <param name="entity"></param>
/// <param name="properties"></param>
/// <returns></returns>
Task UpdateLandBuildingInfo(UpdateLandBuilding entity, List<string> properties);
/// <summary>
/// 軟刪除土地房屋資訊
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
Task DeleteOneLandBuildingInfo(int id);
}
}

View File

@ -18,6 +18,145 @@
<ItemGroup>
<Folder Include="Logs\" />
<Folder Include="wwwroot\upload\company_logo\" />
<Folder Include="wwwroot\upload\power_station\boe_file\" />
</ItemGroup>
<ItemGroup>
<None Include="wwwroot\css\adminlte.min.css.map" />
<None Include="wwwroot\css\app.bundle.css.map_" />
<None Include="wwwroot\css\datagrid\datatables\datatables.bundle.css.map_" />
<None Include="wwwroot\css\fa-brands.css.map_" />
<None Include="wwwroot\css\fa-duotone.css.map_" />
<None Include="wwwroot\css\fa-light.css.map_" />
<None Include="wwwroot\css\fa-regular.css.map_" />
<None Include="wwwroot\css\fa-solid.css.map_" />
<None Include="wwwroot\css\formplugins\bootstrap-colorpicker\bootstrap-colorpicker.css.map" />
<None Include="wwwroot\css\formplugins\bootstrap-datepicker\bootstrap-datepicker.css.map" />
<None Include="wwwroot\css\formplugins\bootstrap-daterangepicker\bootstrap-daterangepicker.css.map" />
<None Include="wwwroot\css\formplugins\bootstrap-markdown\bootstrap-markdown.css.map" />
<None Include="wwwroot\css\formplugins\cropperjs\cropper.css.map" />
<None Include="wwwroot\css\formplugins\dropzone\dropzone.css.map" />
<None Include="wwwroot\css\formplugins\ion-rangeslider\ion-rangeslider.css.map" />
<None Include="wwwroot\css\formplugins\nouislider\nouislider.css.map" />
<None Include="wwwroot\css\formplugins\select2\select2.bundle.css.map" />
<None Include="wwwroot\css\formplugins\smartwizard\smartwizard.css.map" />
<None Include="wwwroot\css\formplugins\summernote\summernote.css.map" />
<None Include="wwwroot\css\json-path-picker\json-path-picker.css.map" />
<None Include="wwwroot\css\miscellaneous\fullcalendar\fullcalendar.bundle.css.map" />
<None Include="wwwroot\css\miscellaneous\jqvmap\jqvmap.bundle.css.map" />
<None Include="wwwroot\css\miscellaneous\lightgallery\lightgallery.bundle.css.map" />
<None Include="wwwroot\css\miscellaneous\nestable\nestable.css.map" />
<None Include="wwwroot\css\miscellaneous\reactions\reactions.css.map" />
<None Include="wwwroot\css\miscellaneous\treeview\treeview.css.map" />
<None Include="wwwroot\css\notifications\sweetalert2\sweetalert2.bundle.css.map" />
<None Include="wwwroot\css\notifications\toastr\toastr.css.map" />
<None Include="wwwroot\css\page-invoice.css.map_" />
<None Include="wwwroot\css\page-login-alt.css.map_" />
<None Include="wwwroot\css\skins\skin-master.css.map_" />
<None Include="wwwroot\css\statistics\c3\c3.css.map" />
<None Include="wwwroot\css\statistics\chartist\chartist.css.map" />
<None Include="wwwroot\css\statistics\chartjs\chartjs.css.map" />
<None Include="wwwroot\css\statistics\dygraph\dygraph.css.map" />
<None Include="wwwroot\css\theme-demo.css.map_" />
<None Include="wwwroot\css\themes\cust-theme-1.css.map" />
<None Include="wwwroot\css\themes\cust-theme-10.css.map" />
<None Include="wwwroot\css\themes\cust-theme-11.css.map" />
<None Include="wwwroot\css\themes\cust-theme-12.css.map" />
<None Include="wwwroot\css\themes\cust-theme-13.css.map" />
<None Include="wwwroot\css\themes\cust-theme-14.css.map" />
<None Include="wwwroot\css\themes\cust-theme-15.css.map" />
<None Include="wwwroot\css\themes\cust-theme-15.css.map_" />
<None Include="wwwroot\css\themes\cust-theme-2.css.map" />
<None Include="wwwroot\css\themes\cust-theme-3.css.map" />
<None Include="wwwroot\css\themes\cust-theme-4.css.map" />
<None Include="wwwroot\css\themes\cust-theme-5.css.map" />
<None Include="wwwroot\css\themes\cust-theme-6.css.map" />
<None Include="wwwroot\css\themes\cust-theme-7.css.map" />
<None Include="wwwroot\css\themes\cust-theme-8.css.map" />
<None Include="wwwroot\css\themes\cust-theme-9.css.map" />
<None Include="wwwroot\css\vendors.bundle.css.map_" />
<None Include="wwwroot\img\favicon\safari-pinned-tab.svg" />
<None Include="wwwroot\img\favicon\site.webmanifest" />
<None Include="wwwroot\img\logo-flat.svg" />
<None Include="wwwroot\img\logo-gradient.svg" />
<None Include="wwwroot\img\logo.svg" />
<None Include="wwwroot\img\svg\pattern-1.svg" />
<None Include="wwwroot\img\svg\pattern-2.svg" />
<None Include="wwwroot\img\svg\pattern-3.svg" />
<None Include="wwwroot\img\svg\pattern-4.svg" />
<None Include="wwwroot\js\app.bundle.js" />
<None Include="wwwroot\js\datagrid\datatables\datatables.bundle.js" />
<None Include="wwwroot\js\datagrid\datatables\datatables.export.js" />
<None Include="wwwroot\js\dependency\moment\moment.js" />
<None Include="wwwroot\js\formplugins\bootstrap-colorpicker\bootstrap-colorpicker.js" />
<None Include="wwwroot\js\formplugins\bootstrap-datepicker\bootstrap-datepicker.js" />
<None Include="wwwroot\js\formplugins\bootstrap-daterangepicker\bootstrap-daterangepicker.js" />
<None Include="wwwroot\js\formplugins\bootstrap-markdown\bootstrap-markdown.js" />
<None Include="wwwroot\js\formplugins\cropperjs\cropper.js" />
<None Include="wwwroot\js\formplugins\dropzone\dropzone.js" />
<None Include="wwwroot\js\formplugins\inputmask\inputmask.bundle.js" />
<None Include="wwwroot\js\formplugins\ion-rangeslider\ion-rangeslider.js" />
<None Include="wwwroot\js\formplugins\nouislider\nouislider.js" />
<None Include="wwwroot\js\formplugins\select2\select2.bundle.js" />
<None Include="wwwroot\js\formplugins\smartwizard\smartwizard.js" />
<None Include="wwwroot\js\formplugins\summernote\summernote.js" />
<None Include="wwwroot\js\i18n\i18n.js" />
<None Include="wwwroot\js\json-path-picker\json-path-picker.js" />
<None Include="wwwroot\js\miscellaneous\fullcalendar\fullcalendar.bundle.js" />
<None Include="wwwroot\js\miscellaneous\jqvmap\jqvmap.bundle.js" />
<None Include="wwwroot\js\miscellaneous\jqvmap\maps\jquery.vmap.algeria.js" />
<None Include="wwwroot\js\miscellaneous\jqvmap\maps\jquery.vmap.argentina.js" />
<None Include="wwwroot\js\miscellaneous\jqvmap\maps\jquery.vmap.brazil.js" />
<None Include="wwwroot\js\miscellaneous\jqvmap\maps\jquery.vmap.canada.js" />
<None Include="wwwroot\js\miscellaneous\jqvmap\maps\jquery.vmap.europe.js" />
<None Include="wwwroot\js\miscellaneous\jqvmap\maps\jquery.vmap.france.js" />
<None Include="wwwroot\js\miscellaneous\jqvmap\maps\jquery.vmap.germany.js" />
<None Include="wwwroot\js\miscellaneous\jqvmap\maps\jquery.vmap.greece.js" />
<None Include="wwwroot\js\miscellaneous\jqvmap\maps\jquery.vmap.iran.js" />
<None Include="wwwroot\js\miscellaneous\jqvmap\maps\jquery.vmap.iraq.js" />
<None Include="wwwroot\js\miscellaneous\jqvmap\maps\jquery.vmap.russia.js" />
<None Include="wwwroot\js\miscellaneous\jqvmap\maps\jquery.vmap.tunisia.js" />
<None Include="wwwroot\js\miscellaneous\jqvmap\maps\jquery.vmap.turkey.js" />
<None Include="wwwroot\js\miscellaneous\jqvmap\maps\jquery.vmap.usa.js" />
<None Include="wwwroot\js\miscellaneous\lightgallery\lightgallery.bundle.js" />
<None Include="wwwroot\js\miscellaneous\lightgallery\smartvoice.bundle.js" />
<None Include="wwwroot\js\miscellaneous\nestable\nestable.js" />
<None Include="wwwroot\js\miscellaneous\treeview\treeview.js" />
<None Include="wwwroot\js\notifications\sweetalert2\sweetalert2.bundle.js" />
<None Include="wwwroot\js\notifications\toastr\toastr.js" />
<None Include="wwwroot\js\site.js" />
<None Include="wwwroot\js\statistics\c3\c3.js" />
<None Include="wwwroot\js\statistics\chartist\chartist.js" />
<None Include="wwwroot\js\statistics\chartjs\chartjs.bundle.js" />
<None Include="wwwroot\js\statistics\d3\d3.js" />
<None Include="wwwroot\js\statistics\demo-data\demo-c3.js" />
<None Include="wwwroot\js\statistics\demo-data\demo-data-dygraph.js" />
<None Include="wwwroot\js\statistics\dygraph\dygraph.js" />
<None Include="wwwroot\js\statistics\easypiechart\easypiechart.bundle.js" />
<None Include="wwwroot\js\statistics\flot\flot.bundle.js" />
<None Include="wwwroot\js\statistics\peity\peity.bundle.js" />
<None Include="wwwroot\js\statistics\sparkline\sparkline.bundle.js" />
<None Include="wwwroot\js\toast.js" />
<None Include="wwwroot\js\vendors.bundle.js" />
<None Include="wwwroot\media\sound\bigbox.ogg" />
<None Include="wwwroot\media\sound\messagebox.ogg" />
<None Include="wwwroot\media\sound\smallbox.ogg" />
<None Include="wwwroot\media\sound\voice_alert.ogg" />
<None Include="wwwroot\media\sound\voice_off.ogg" />
<None Include="wwwroot\media\sound\voice_on.ogg" />
<None Include="wwwroot\webfonts\fa-brands-400.svg" />
<None Include="wwwroot\webfonts\fa-brands-400.woff2" />
<None Include="wwwroot\webfonts\fa-duotone-900.svg" />
<None Include="wwwroot\webfonts\fa-duotone-900.woff2" />
<None Include="wwwroot\webfonts\fa-light-300.svg" />
<None Include="wwwroot\webfonts\fa-light-300.woff2" />
<None Include="wwwroot\webfonts\fa-regular-400.svg" />
<None Include="wwwroot\webfonts\fa-regular-400.woff2" />
<None Include="wwwroot\webfonts\fa-solid-900.svg" />
<None Include="wwwroot\webfonts\fa-solid-900.woff2" />
<None Include="wwwroot\webfonts\nextgen-icons.svg" />
<None Include="wwwroot\webfonts\nextgen-icons.woff2" />
<None Include="wwwroot\webfonts\summernote.woff2" />
</ItemGroup>
</Project>

View File

@ -12,7 +12,7 @@
<!-- base css -->
<link id="vendorsbundle" rel="stylesheet" media="screen, print" href="~/css/vendors.bundle.css">
<link id="appbundle" rel="stylesheet" media="screen, print" href="~/css/app.bundle.css">
<link id="mytheme" rel="stylesheet" media="screen, print" href="#">
<link id="mytheme" rel="stylesheet" media="screen, print" href="~/css/themes/cust-theme-15.css">
<link id="myskin" rel="stylesheet" media="screen, print" href="~/css/skins/skin-master.css">
<!-- Place favicon.ico in the root directory -->
<link rel="apple-touch-icon" sizes="180x180" href="~/img/favicon/apple-touch-icon.png">

View File

@ -24,7 +24,10 @@
<i class="base-7 icon-stack-3x color-info-500"></i>
<i class="base-7 icon-stack-2x color-info-700"></i>
<i class="ni ni-graph icon-stack-1x text-white"></i>
</span> 新竹巨城站
</span>
<span id="power-station-title">
新增電站
</span>
</h1>
</div>
<ul class="nav nav-tabs mb-5" role="tablist" id="tablist">
@ -86,6 +89,9 @@
@section Scripts{
<script>
var stationId;
var powerStationData;
var selectedLandBuildingId;
var isLandBuildingLock = false;
$(function () {
var url = new URL(location.href);
@ -94,6 +100,7 @@
//#region 電站資料 view 控制
if (stationId == 'new') {
//#region 電站基本資料
$("#address_detail_text").hide();
$("#power_station_code_text").hide();
$("#power_station_name_text").hide();
$("#electricity_meter_at_text").hide();
@ -139,24 +146,27 @@
return;
}
powerStationData = rel.data;
//#region 電站基本資料
$("#add-station-info-btn").hide()
$("#canecl-station-info-btn").hide()
SetStationInfo(rel.data);
ChangeMode("station_info", "view");
SetStationInfo();
//#endregion
//#region 能源局與台電資料
$("#add-station-info-btn").hide()
$("#canecl-station-info-btn").hide()
SetStationInfo(rel.data);
ChangeMode("BOE_TPC", "view");
SetBoETPCInfo();
//#endregion
//#region 土地與房屋資料
ChangeMode("land_building_info", "view");
SetLandBuildingInfo();
//#endregion
}, 'json');
}
//#region 預先載入公司下拉式選單select_option
//#region 預先載入運維人員下拉式選單select_option
var url_user_select_option = "/PowerStation/GetUserSelectOptionList";
$.get(url_user_select_option, function (rel) {
if (rel.code != "0000") {
@ -173,8 +183,64 @@
//預設查詢第一個
$("#power_station_operation_personnel").val($("#power_station_operation_personnel option:first").val());
});
//#endregion
$('.js-example-basic-multiple').select2();
//#endregion
//#region 預先載入縣市下拉式選單select_option
var url_city_select_option = "/PowerStation/GetCitySelectOptionList";
$.get(url_city_select_option, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$("#select_city").empty();
$.each(rel.data, function (index, val) {
$("#select_city").append($("<option />").val(val.value).text(val.text));
});
if (powerStationData == undefined || powerStationData == null) {
//預設查詢第一個
$("#select_city").val($("#select_city option:first").val()).trigger("change");
}
else {
$("#select_city").val(powerStationData.cityId).trigger("change");
}
});
//#endregion
//#region 縣市選擇後取得地區下拉式選單select_option
$("#select_city").change(function () {
var url_area_select_option = "/PowerStation/GetAreaSelectOptionList";
var send_data = {
cityId: $(this).val()
}
$.post(url_area_select_option, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
$("#select_area").empty();
$.each(rel.data, function (index, val) {
$("#select_area").append($("<option />").val(val.value).text(val.text));
});
if (powerStationData == undefined || powerStationData == null) {
//預設查詢第一個
$("#select_area").val($("#select_area option:first").val());
}
else {
$("#select_area").val(powerStationData.areaId);
}
});
});
//#endregion
});
//#region 代管切換
@ -189,21 +255,21 @@
});
//#endregion
//#region 儲存電站基本資料資訊
function SaveStationInfo() {
var url = "/PowerStation/SavePowerStationInfo";
var send_data = {
Id: stationId,
CityId: $("#select_city").val(),
AreaId: $("#select_area").val(),
AddressDetail: $("#address_detail").val(),
Address: $("#address_detail").val(),
Name: $("#power_station_name").val(),
IsEscrow: $("#check_escrow").val() == true ? 1 : 0,
ElectricityMeterAt: $("electricity_meter_at").val(),
EstimatedRecoveryTime: $("estimated_recovery_time").val(),
GeneratingCapacity: $("generating_capacity").val(),
EscrowName: $("#check_escrow").val() == true? $("escrow_name").val() : "",
IsEscrow: $('#check_escrow').is(':checked') ? 1 : 0,
ElectricityMeterAt: $("#electricity_meter_at").val(),
EstimatedRecoveryTime: $("#estimated_recovery_time").val(),
GeneratingCapacity: $("#generating_capacity").val(),
EscrowName: $('#check_escrow').is(':checked') ? $("#escrow_name").val() : "",
PowerRate: $("#power_rate").val(),
Coordinate: $("#coordinate").val(),
InverterBrand: $("#inverter_brand").val(),
@ -212,7 +278,7 @@
PhotovoltaicPanelBrand: $("#photovoltaic_panel_brand").val(),
PhotovoltaicPanelSpecification: $("#photovoltaic_panel_specification").val(),
PhotovoltaicPanelAmount: $("#photovoltaic_panel_amount").val(),
PhotovoltaicProductModel: $("#photovoltaic_panel_product_model").val()
PhotovoltaicPanelProductModel: $("#photovoltaic_panel_product_model").val()
}
$.post(url, send_data, function (rel) {
@ -221,14 +287,96 @@
return;
}
toast_ok(rel.msg);
if (stationId == "new") {
window.location = "/PowerStation/Edit?stationId=" + rel.data
window.location = "/PowerStation/Edit?stationId=" + rel.data.id
} else {
//回填資料
SetStationInfo(rel.data);
powerStationData = rel.data;
SetStationInfo();
ChangeMode("station_info", "view");
}
}, 'json');
}
//#endregion
//#region 儲存能源局台電資料資訊
function SaveBoETPCInfo() {
var url = "/PowerStation/SaveBoETPCInfo";
var formData = new FormData();
var BoEFile = $('#BoE_file')[0].files;
formData.append("Id", stationId);
if (BoEFile.length > 0) {
formData.append("BoEFile", BoEFile[0]);
}
formData.append("BoEDiscountRate", $("#BoE_discount_rate").val());
formData.append("BoEDeviceRegisterNumber", $("#BoE_device_register_number").val());
formData.append("BoERentRatio", $("#BoE_discount_rate").val());
formData.append("TPCContractNumber", $("#TPC_contract_number").val());
formData.append("TPCContractAt", $("#TPC_contract_at").val());
formData.append("TPCSellDeadline", $("#TPC_sell_deadline").val());
formData.append("TPCMeterReading", $("#TPC_meter_reading").val());
formData.append("TPCPurchaseElectricityAt", $("#TPC_purchase_electricity_at").val());
formData.append("TPCSellElectricityAt", $("#TPC_sell_electricity_at").val());
$.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;
}
toast_ok(rel.msg);
powerStationData = rel.data;
//回填資料
SetBoETPCInfo();
ChangeMode("BOE_TPC", "view");
}
});
}
//#endregion
//#region 儲存土地房屋資訊
function SaveLandBuildingInfo() {
var url = "/PowerStation/SaveLandBuildingInfo";
var send_data = {
Id: selectedLandBuildingId,
PowerStationId: stationId,
Address: $("#land_building_address_" + selectedLandBuildingId).val(),
LeaseNotarizationAt: $("#lease_notarization_at_" + selectedLandBuildingId).val(),
Landowner: $("#land_building_landowner_" + selectedLandBuildingId).val(),
Purpose: $("#land_building_purpose_" + selectedLandBuildingId).val(),
LeaseRate: $("#land_building_lease_Rate_" + selectedLandBuildingId).val(),
Coordinate: $("#land_building_coordinate_" + selectedLandBuildingId).val(),
Phone: $("#land_building_phone_" + selectedLandBuildingId).val(),
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
toast_ok(rel.msg);
powerStationData = rel.data;
SetLandBuildingInfo();
}, 'json');
}
//#endregion
//#region 切換【電站基本資料】、【能源局與台電】等檢視或修改模式
function ChangeMode(type, mode) {
@ -236,7 +384,10 @@
case "station_info": //【電站基本資料】
if (mode === "view") {
//觀看
//#region 電站基本資料 文字
$("#address_detail_text").show();
$("#power_station_code_text").show();
$("#power_station_name_text").show();
$("#electricity_meter_at_text").show();
@ -262,6 +413,9 @@
//#endregion
//#region 電站基本資料 input
$("#select_city").attr("disabled", true);
$("#select_area").attr("disabled", true);
$("#address_detail").hide();
$("#power_station_name").hide();
$("#check_escrow").attr("disabled", true);
$("#electricity_meter_at").hide();
@ -284,14 +438,16 @@
$("#photovoltaic_panel_product_model").hide();
//#endregion
//電站基本資料btn
//#region 電站基本資料 btn
$("#add-station-info-btn").hide();
$("#edit-station-info-btn").show();
$("#canecl-station-info-btn").hide();
//#endregion
} else {
//修改
//#region 電站基本資料 文字
$("#power_station_code_text").hide();
$("#address_detail_text").hide();
$("#power_station_name_text").hide();
$("#electricity_meter_at_text").hide();
$("#estimated_recovery_time_text").hide();
@ -316,6 +472,9 @@
//#endregion
//#region 電站基本資料 input
$("#select_city").attr("disabled", false);
$("#select_area").attr("disabled", false);
$("#address_detail").show();
$("#power_station_name").show();
$("#check_escrow").attr("disabled", false);
$("#electricity_meter_at").show();
@ -338,10 +497,11 @@
$("#photovoltaic_panel_product_model").show();
//#endregion
//電站基本資料btn
//#region 電站基本資料 btn
$("#add-station-info-btn").show();
$("#edit-station-info-btn").hide();
$("#canecl-station-info-btn").show();
//#endregion
}
break;
case "BOE_TPC": //【能源局與台電】
@ -351,7 +511,7 @@
$("#link-boe-file").show();
$("#BoE_discount_rate_text").show();
$("#BoE_device_register_number_text").show();
$("#BoE_discount_rate_text").show();
$("#BoE_rent_ratio_text").show();
$("#TPC_contract_number_text").show();
$("#TPC_contract_at_text").show();
@ -359,13 +519,16 @@
$("#TPC_meter_reading_text").show();
$("#TPC_purchase_electricity_at_text").show();
$("#TPC_sell_electricity_at_text").show();
$("#BOE_TPC_created_by_text").show();
$("#BOE_TPC_created_at_text").show();
//#endregion
//#region 能源局與台電資料 input
$("#BoE_file").hide();
$("#BoE_discount_rate").hide();
$("#BoE_device_register_number").hide();
$("#BoE_discount_rate").hide();
$("#BoE_rent_ratio").hide();
$("#TPC_contract_number").hide();
$("#TPC_contract_at").hide();
@ -375,17 +538,18 @@
$("#TPC_sell_electricity_at").hide();
//#endregion
//能源局與台電btn
//#region 能源局與台電btn
$("#add-boe-tpc-btn").hide();
$("#edit-boe-tpc-btn").show();
$("#canecl-boe-tpc-btn").hide();
//#endregion
} else {
//修改
//#region 能源局與台電資料 文字
$("#link-boe-file").hide();
$("#BoE_discount_rate_text").hide();
$("#BoE_device_register_number_text").hide();
$("#BoE_discount_rate_text").hide();
$("#BoE_rent_ratio_text").hide();
$("#TPC_contract_number_text").hide();
$("#TPC_contract_at_text").hide();
@ -393,13 +557,16 @@
$("#TPC_meter_reading_text").hide();
$("#TPC_purchase_electricity_at_text").hide();
$("#TPC_sell_electricity_at_text").hide();
@*$("#BOE_TPC_created_by_text").hide();
$("#BOE_TPC_created_at_text").hide();*@
//#endregion
//#region 能源局與台電資料 input
$("#BoE_file").show();
$("#BoE_discount_rate").show();
$("#BoE_device_register_number").show();
$("#BoE_discount_rate").show();
$("#BoE_rent_ratio").show();
$("#TPC_contract_number").show();
$("#TPC_contract_at").show();
@ -409,10 +576,74 @@
$("#TPC_sell_electricity_at").show();
//#endregion
//能源局與台電btn
//#region 能源局與台電btn
$("#add-boe-tpc-btn").show();
$("#edit-boe-tpc-btn").hide();
$("#canecl-boe-tpc-btn").show();
//#endregion
}
break;
case "land_building_info": //【土地房屋資料】
if (mode === "view") {
//觀看
//#region 土地房屋資料 文字
$("#land_building_address_text_" + selectedLandBuildingId).show();
$("#land_building_coordinate_text_" + selectedLandBuildingId).show();
$("#lease_notarization_at_text_" + selectedLandBuildingId).show();
$("#land_building_lease_Rate_text_" + selectedLandBuildingId).show();
$("#land_building_landowner_text_" + selectedLandBuildingId).show();
$("#land_building_phone_text_" + selectedLandBuildingId).show();
$("#land_building_purpose_text_" + selectedLandBuildingId).show();
$("#land_building_created_by_text_" + selectedLandBuildingId).show();
$("#land_building_created_at_text_" + selectedLandBuildingId).show();
//#endregion
//#region 土地房屋資料 input
$("#land_building_address_" + selectedLandBuildingId).hide();
$("#land_building_coordinate_" + selectedLandBuildingId).hide();
$("#lease_notarization_at_" + selectedLandBuildingId).hide();
$("#land_building_lease_Rate_" + selectedLandBuildingId).hide();
$("#land_building_landowner_" + selectedLandBuildingId).hide();
$("#land_building_phone_" + selectedLandBuildingId).hide();
$("#land_building_purpose_" + selectedLandBuildingId).hide();
//#endregion
//#region 土地房屋資料 btn
$("#save-land-building-info-btn-" + selectedLandBuildingId).hide();
$("#edit-land-building-info-btn-" + selectedLandBuildingId).show();
$("#canecl-land-building-info-btn-" + selectedLandBuildingId).hide();
$("#del-land-building-info-btn-" + selectedLandBuildingId).show();
//#endregion
} else {
//修改
//#region 土地房屋資料 文字
$("#land_building_address_text_" + selectedLandBuildingId).hide();
$("#land_building_coordinate_text_" + selectedLandBuildingId).hide();
$("#lease_notarization_at_text_" + selectedLandBuildingId).hide();
$("#land_building_lease_Rate_text_" + selectedLandBuildingId).hide();
$("#land_building_landowner_text_" + selectedLandBuildingId).hide();
$("#land_building_phone_text_" + selectedLandBuildingId).hide();
$("#land_building_purpose_text_" + selectedLandBuildingId).hide();
$("#land_building_created_by_text_" + selectedLandBuildingId).hide();
$("#land_building_created_at_text_" + selectedLandBuildingId).hide();
//#endregion
//#region 土地房屋資料 input
$("#land_building_address_" + selectedLandBuildingId).show();
$("#land_building_coordinate_" + selectedLandBuildingId).show();
$("#lease_notarization_at_" + selectedLandBuildingId).show();
$("#land_building_lease_Rate_" + selectedLandBuildingId).show();
$("#land_building_landowner_" + selectedLandBuildingId).show();
$("#land_building_phone_" + selectedLandBuildingId).show();
$("#land_building_purpose_" + selectedLandBuildingId).show();
//#endregion
//#region 土地房屋資料 btn
$("#save-land-building-info-btn-" + selectedLandBuildingId).show();
$("#edit-land-building-info-btn-" + selectedLandBuildingId).hide();
$("#canecl-land-building-info-btn-" + selectedLandBuildingId).show();
$("#del-land-building-info-btn-" + selectedLandBuildingId).hide();
//#endregion
}
break;
}
@ -420,65 +651,387 @@
//#endregion
//#region 設定電站基本資料
function SetStationInfo(data) {
//#region 顯示的部分
$("#power_station_code_text").html(station);
$("#power_station_name_text").hide();
$("#electricity_meter_at_text").hide();
$("#estimated_recovery_time_text").hide();
$("#created_by_text").hide();
function SetStationInfo() {
$("#generating_capacity_text").hide();
$("#escrow_name_text").hide();
$("#power_rate_text").hide();
$("#coordinate_text").hide();
$("#created_at_text").hide();
$("#power-station-title").html(powerStationData.name);
$("#select_city").val(powerStationData.cityId).trigger("change");
$("#select_area").val(powerStationData.areaId);
//#region 電站基本資料 文字
$("#address_detail_text").html(powerStationData.address);
$("#power_station_code_text").html(powerStationData.code);
$("#power_station_name_text").html(powerStationData.name);
$("#electricity_meter_at_text").html(powerStationData.electricityMeterAt);
$("#estimated_recovery_time_text").html(powerStationData.estimatedRecoveryTime);
$("#created_by_text").html(powerStationData.CreatorName);
$("#generating_capacity_text").html(powerStationData.generatingCapacity);
$("#escrow_name_text").html(powerStationData.escrowName);
$("#power_rate_text").html(powerStationData.powerRate);
$("#coordinate_text").html(powerStationData.coordinate);
$("#created_at_text").html(powerStationData.createdAt);
//逆變器
$("#inverter_brand_text").hide();
$("#inverter_product_model_text").hide();
$("#inverter_amount_text").hide();
$("#inverter_brand_text").html(powerStationData.inverterBrand);
$("#inverter_product_model_text").html(powerStationData.inverterProductModel);
$("#inverter_amount_text").html(powerStationData.inverterAmount);
//光電板
$("#photovoltaic_panel_brand_text").hide();
$("#photovoltaic_panel_specification_text").hide();
$("#photovoltaic_panel_amount_text").hide();
$("#photovoltaic_panel_product_model_text").hide();
$("#photovoltaic_panel_brand_text").html(powerStationData.photovoltaicPanelBrand);
$("#photovoltaic_panel_product_model_text").html(powerStationData.photovoltaicPanelProductModel);
$("#photovoltaic_panel_specification_text").html(powerStationData.photovoltaicPanelSpecification);
$("#photovoltaic_panel_amount_text").html(powerStationData.photovoltaicPanelAmount);
//#endregion
//#region 電站基本資料 input
$("#address_detail").val(powerStationData.address);
$("#power_station_name").val(powerStationData.name);
$("#check_escrow").attr("checked", powerStationData.isEscrow == 1 ? true : false);
$("#check_escrow_label").html(powerStationData.isEscrow == 1 ? "Yes" : "No");
$("#electricity_meter_at").val(powerStationData.electricityMeterAt);
$("#estimated_recovery_time").val(powerStationData.estimatedRecoveryTime);
$("#generating_capacity").val(powerStationData.generatingCapacity);
$("#escrow_name").val(powerStationData.escrowName);
$("#power_rate").val(powerStationData.powerRate);
$("#coordinate").val(powerStationData.coordinate);
//逆變器
$("#inverter_brand").val(powerStationData.inverterBrand);
$("#inverter_product_model").val(powerStationData.inverterProductModel);
$("#inverter_amount").val(powerStationData.inverterAmount);
//光電板
$("#photovoltaic_panel_brand").val(powerStationData.photovoltaicPanelBrand);
$("#photovoltaic_panel_product_model").val(powerStationData.photovoltaicPanelProductModel);
$("#photovoltaic_panel_specification").val(powerStationData.photovoltaicPanelSpecification);
$("#photovoltaic_panel_amount").val(powerStationData.photovoltaicPanelAmount);
//#endregion
}
//#endregion
//#region 設定能源局與台電資料
function SetBoETPCInfo(data) {
//#region 顯示的部分
$("#BoE_file").html(data.boeFileName).attr("href", data.boeFile);
$("#BoE_discount_rate_text").hide();
$("#electricity_meter_at_text").hide();
$("#estimated_recovery_time_text").hide();
$("#created_by_text").hide();
function SetBoETPCInfo() {
//#region 能源局與台電資料 文字
$("#link-boe-file").html(powerStationData.boEFileName).attr("href", powerStationData.boEFile);
$("#BoE_discount_rate_text").html(powerStationData.boEDiscountRate);
$("#BoE_device_register_number_text").html(powerStationData.boEDeviceRegisterNumber);
$("#BoE_rent_ratio_text").html(powerStationData.boERentRatio);
$("#generating_capacity_text").hide();
$("#escrow_name_text").hide();
$("#power_rate_text").hide();
$("#coordinate_text").hide();
$("#created_at_text").hide();
//逆變器
$("#inverter_brand_text").hide();
$("#inverter_product_model_text").hide();
$("#inverter_amount_text").hide();
//光電板
$("#photovoltaic_panel_brand_text").hide();
$("#photovoltaic_panel_specification_text").hide();
$("#photovoltaic_panel_amount_text").hide();
$("#photovoltaic_panel_product_model_text").hide();
$("#TPC_contract_number_text").html(powerStationData.tpcContractNumber);
$("#TPC_contract_at_text").html(powerStationData.tpcContractAt);
$("#TPC_sell_deadline_text").html(powerStationData.tpcSellDeadline);
$("#TPC_meter_reading_text").html(powerStationData.tpcMeterReading);
$("#TPC_purchase_electricity_at_text").html(powerStationData.tpcPurchaseElectricityAt);
$("#TPC_sell_electricity_at_text").html(powerStationData.tpcSellElectricityAt);
$("#BOE_TPC_created_by_text").html(powerStationData.creatorName);
$("#BOE_TPC_created_at_text").html(powerStationData.createdAt);
//#endregion
//#region 能源局與台電資料 input
$("#BoE_discount_rate").val(powerStationData.boeEiscountRate);
$("#BoE_device_register_number").val(powerStationData.boEDeviceRegisterNumber);
$("#BoE_discount_rate").val(powerStationData.boERentRatio);
$("#TPC_contract_number").val(powerStationData.tpcContractNumber);
$("#TPC_contract_at").val(powerStationData.tpcContractAt);
$("#TPC_sell_deadline").val(powerStationData.tpcSellDeadline);
$("#TPC_meter_reading").val(powerStationData.tpcMeterReading);
$("#TPC_purchase_electricity_at").val(powerStationData.tpcPurchaseElectricityAt);
$("#TPC_sell_electricity_at").val(powerStationData.tpcSellElectricityAt);
//#endregion
}
//#endregion
//#region 設定土地與房屋資料
function SetLandBuildingInfo() {
var landBuildingCard = $("#land_buildingPart");
landBuildingCard.empty();
powerStationData.landBuildings.forEach(function (value, index) {
CreateLandBuildingCard(landBuildingCard, value);
});
// 找出第一個移除"刪除"按鈕
var firstCardId = landBuildingCard.find(".card").first().attr("data-land-building-id");
$("#del-land-building-info-btn-" + firstCardId).remove();
//加入新增土地房屋卡片
CreateAddLandBuildingCard(landBuildingCard);
}
//#region 創建每份土地房屋資訊卡片
function CreateLandBuildingCard(dom, value) {
var appendStr = "";
appendStr += '<div class="card border mb-g w-100" data-land-building-id="' + value.id + '">' +
'<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">' +
'<div class="card-title font-weight-bold">土地房屋資料</div>' +
'<div class="text-right">' +
'<button class="btn btn-sm btn-success ml-auto waves-effect waves-themed save-land-building-info-btn" style="display:none" data-land-building-id="' + value.id + '" id="save-land-building-info-btn-' + value.id + '">' +
'<span class="fal fa-cog mr-1"></span> 儲存' +
'</button>' +
'<button class="btn btn-sm btn-info ml-auto waves-effect waves-themed edit-land-building-info-btn" data-land-building-id="' + value.id + '" id="edit-land-building-info-btn-' + value.id + '">' +
'<span class="fal fa-cog mr-1"></span> 修改' +
'</button>' +
'<button class="btn btn-sm btn-primary ml-auto waves-effect waves-themed canecl-land-building-info-btn" style="display:none" data-land-building-id="' + value.id + '" id="canecl-land-building-info-btn-' + value.id + '">' +
'<span class="fal fa-cog mr-1"></span> 取消' +
'</button>' +
'<button class="btn btn-sm btn-danger ml-auto waves-effect waves-themed del-land-building-info-btn" data-land-building-id="' + value.id + '" id="del-land-building-info-btn-' + value.id + '">' +
'<span class="fal fa-cog mr-1"></span> 刪除' +
'</button>' +
'</div>' +
'</div>';
appendStr += '<div class="card-body">' +
'<div class="row d-flex justify-content-between card-land-building" data-id="' + value.id + '">' +
'<div class="col-xl">' +
'<div class="row mb-3">' +
'<label class="col-xl-4 form-label">地址</label>' +
'<div class="col-xl-8">' +
'<label id="land_building_address_text_' + value.id + '" class="color-info-600">' + value.address + '</label>' +
'<input type="text" style="display:none" id="land_building_address_' + value.id + '" name="land_building_address_' + value.id + '" class="form-control" value="' + value.address + '">' +
'</div>' +
'</div>' +
'<div class="row">' +
'<label class="col-xl-4 form-label">經緯度</label>' +
'<div class="col-xl-8">' +
'<label id="land_building_coordinate_text_' + value.id + '" class="color-info-600">' + value.coordinate + '</label>' +
'<input type="text" style="display:none" id="land_building_coordinate_' + value.id + '" name="land_building_coordinate_' + value.id + '" class="form-control" value="' + value.coordinate + '">' +
'</div>' +
'</div>' +
'</div>' +
'<div class="col-xl">' +
'<div class="row mb-3">' +
'<label class="col-xl-4 form-label">租約公證日期</label>' +
'<div class="col-xl-8">' +
'<label id="lease_notarization_at_text_' + value.id + '" class="color-info-600">' + value.leaseNotarizationAt + '</label>' +
'<input type="date" style="display:none" id="lease_notarization_at_' + value.id + '" name="lease_notarization_at_' + value.id + '" class="form-control" value="' + value.leaseNotarizationAt + '">' +
'</div>' +
'</div>' +
'<div class="row">' +
'<label class="col-xl-4 form-label">租金比例 (%)</label>' +
'<div class="col-xl-8">' +
'<label id="land_building_lease_Rate_text_' + value.id + '" class="color-info-600">' + value.leaseRate + '</label>' +
'<input type="text" style="display:none" id="land_building_lease_Rate_' + value.id + '" name="land_building_lease_Rate_' + value.id + '" class="form-control" value="' + value.leaseRate + '">' +
'</div>' +
'</div>' +
'</div>' +
'<div class="col-xl">' +
'<div class="row mb-3">' +
'<label class="col-xl-4 form-label">地主姓名</label>' +
'<div class="col-xl-8">' +
'<label id="land_building_landowner_text_' + value.id + '" class="color-info-600">' + value.landowner + '</label>' +
'<input type="text" style="display:none" id="land_building_landowner_' + value.id + '" name="land_building_landowner_' + value.id + '" class="form-control" value="' + value.landowner + '">' +
'</div>' +
'</div>' +
'<div class="row">' +
'<label class="col-xl-4 form-label">電話</label>' +
'<div class="col-xl-8">' +
'<label id="land_building_phone_text_' + value.id + '" class="color-info-600">' + value.phone + '</label>' +
'<input type="text" style="display:none" id="land_building_phone_' + value.id + '" name="land_building_phone_' + value.id + '" class="form-control" value="' + value.phone + '">' +
'</div>' +
'</div>' +
'</div>' +
'<div class="col-xl">' +
'<div class="row mb-3">' +
'<label class="col-xl-4 form-label">房屋用途</label>' +
'<div class="col-xl-8">' +
'<label id="land_building_purpose_text_' + value.id + '" class="color-info-600">' + value.purpose + '</label>' +
'<input type="text" style="display:none" id="land_building_purpose_' + value.id + '" name="land_building_purpose_' + value.id + '" class="form-control" value="' + value.purpose + '">' +
'</div>' +
'</div>' +
'</div>' +
'<div class="col-xl">' +
'<div class="row mb-3">' +
'<label class="col-xl-4 form-label">資料建立</label>' +
'<div class="col-xl-8">' +
'<label id="land_building_created_by_text_' + value.id + '" class="color-info-600">' + value.creatorName + '</label>' +
'</div>' +
'</div>' +
'<div class="row">' +
'<label class="col-xl-4 form-label">建立時間</label>' +
'<div class="col-xl-8">' +
'<label id="land_building_created_at_text_' + value.id + '" class="color-info-600">' + value.createdAt + '</label>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
dom.append(appendStr);
}
//#endregion
//#region 創建新增土地房屋資訊卡片
function CreateAddLandBuildingCard(dom) {
var appendStr = "";
appendStr += '<div class="card border mb-g w-100" id="add-land-building-card">' +
'<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">' +
'<div class="card-title font-weight-bold">土地房屋資料</div>' +
'<div class="text-right">' +
'<button class="btn btn-sm btn-info ml-auto waves-effect waves-themed" id="add-land-building-info-btn">' +
'<span class="fal fa-cog mr-1"></span> 新增' +
'</button>' +
'<div aria-expanded="true">' +
'<button class="btn btn-sm btn-success ml-auto waves-effect waves-themed save-land-building-info-btn" style="display:none" data-land-building-id="0" id="save-land-building-info-btn-0">' +
'<span class="fal fa-cog mr-1"></span> 儲存' +
'</button>' +
'<button class="btn btn-sm btn-primary ml-auto waves-effect waves-themed" style="display:none" id="cancel-add-land-building-info-btn">' +
'<span class="fal fa-cog mr-1"></span> 取消' +
'</button>' +
'</div>' +
'</div>' +
'</div>';
appendStr += '<div class="card-body collapse">' +
'<div class="row d-flex justify-content-between card-land-building">' +
'<div class="col-xl">' +
'<div class="row mb-3">' +
'<label class="col-xl-4 form-label">地址</label>' +
'<div class="col-xl-8">' +
'<input type="text" id="land_building_address_0" name="land_building_address_0" class="form-control">' +
'</div>' +
'</div>' +
'<div class="row">' +
'<label class="col-xl-4 form-label">經緯度</label>' +
'<div class="col-xl-8">' +
'<input type="text" id="land_building_coordinate_0" name="land_building_coordinate_0" class="form-control">' +
'</div>' +
'</div>' +
'</div>' +
'<div class="col-xl">' +
'<div class="row mb-3">' +
'<label class="col-xl-4 form-label">租約公證日期</label>' +
'<div class="col-xl-8">' +
'<input type="date" id="lease_notarization_at_0" name="lease_notarization_at_0" class="form-control">' +
'</div>' +
'</div>' +
'<div class="row">' +
'<label class="col-xl-4 form-label">租金比例 (%)</label>' +
'<div class="col-xl-8">' +
'<input type="text" id="land_building_lease_Rate_0" name="land_building_lease_Rate_0" class="form-control">' +
'</div>' +
'</div>' +
'</div>' +
'<div class="col-xl">' +
'<div class="row mb-3">' +
'<label class="col-xl-4 form-label">地主姓名</label>' +
'<div class="col-xl-8">' +
'<input type="text" id="land_building_landowner_0" name="land_building_landowner_0" class="form-control">' +
'</div>' +
'</div>' +
'<div class="row">' +
'<label class="col-xl-4 form-label">電話</label>' +
'<div class="col-xl-8">' +
'<input type="text" id="land_building_phone_0" name="land_building_phone_0" class="form-control">' +
'</div>' +
'</div>' +
'</div>' +
'<div class="col-xl">' +
'<div class="row mb-3">' +
'<label class="col-xl-4 form-label">房屋用途</label>' +
'<div class="col-xl-8">' +
'<input type="text" id="land_building_purpose_0" name="land_building_purpose_0" class="form-control">' +
'</div>' +
'</div>' +
'</div>' +
'<div class="col-xl">' +
'<div class="row mb-3">' +
'<label class="col-xl-4 form-label">資料建立</label>' +
'<div class="col-xl-8">' +
'<label id="land_building_created_by_text_0" class="color-info-600"></label>' +
'</div>' +
'</div>' +
'<div class="row">' +
'<label class="col-xl-4 form-label">建立時間</label>' +
'<div class="col-xl-8">' +
'<label id="land_building_created_at_text_0" class="color-info-600"></label>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>' +
'</div>';
dom.append(appendStr);
}
//#endregion
//#endregion
//#region 土地與房屋按鈕控制
//儲存
$('#land_buildingPart').on("click", "button.save-land-building-info-btn", function () {
selectedLandBuildingId = $(this).attr("data-land-building-id");
SaveLandBuildingInfo();
isLandBuildingLock = false;
});
//編輯
$('#land_buildingPart').on("click", "button.edit-land-building-info-btn", function () {
if (isLandBuildingLock) {
toast_error("當前已有其他【土地方屋資訊】正在編輯中。")
}
selectedLandBuildingId = $(this).attr("data-land-building-id");
ChangeMode("land_building_info", "edit");
isLandBuildingLock = true;
});
//取消
$('#land_buildingPart').on("click", "button.canecl-land-building-info-btn", function () {
selectedLandBuildingId = $(this).attr("data-land-building-id");
ChangeMode("land_building_info", "view");
isLandBuildingLock = false;
});
//刪除
$('#land_buildingPart').on("click", "button.del-land-building-info-btn", function () {
selectedLandBuildingId = $(this).attr("data-land-building-id");
var url = "/PowerStation/DeleteLandBuildingInfo";
var send_data = {
Id: selectedLandBuildingId
}
$.post(url, send_data, function (rel) {
if (rel.code != "0000") {
toast_error(rel.msg);
return;
}
toast_ok(rel.msg);
powerStationData = rel.data;
SetLandBuildingInfo();
}, 'json');
});
//新增土地房屋卡片
//新增
$('#land_buildingPart').on("click", "#add-land-building-card button#add-land-building-info-btn", function () {
$("#add-land-building-card > .card-body").collapse('show');
$("#add-land-building-card button#add-land-building-info-btn").hide();
$("#add-land-building-card button#save-land-building-info-btn-0").show();
$("#add-land-building-card button#cancel-add-land-building-info-btn").show();
});
//取消
$('#land_buildingPart').on("click", "#add-land-building-card button#cancel-add-land-building-info-btn", function () {
alert("bbb");
$("#add-land-building-card > .card-body").collapse('hide');
$("#add-land-building-card button#add-land-building-info-btn").show();
$("#add-land-building-card button#save-land-building-info-btn-0").hide();
$("#add-land-building-card button#cancel-add-land-building-info-btn").hide();
});
//#endregion
</script>
}

View File

@ -19,7 +19,7 @@
<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>
<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>
@ -27,15 +27,16 @@
</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>
<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>
</div>
<div class="col-xl-6 row">
<div class="col-xl-6 row align-items-center">
<div class="col-12">
<label id="address_detail_text" class="color-info-600"></label>
<input type="text" id="address_detail" name="address_detail" class="form-control">
</div>
</div>
@ -43,21 +44,21 @@
<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>
<label class="col-xl-4 form-label" id="power_station_code_label" for="power_station_code">電站編號</label>
<div class="col-xl-8">
<p id="power_station_code_text">PEP-NTP001</p>
<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>
<label class="col-xl-4 form-label" id="power_station_name_label" for="power_station_name">電站名稱</label>
<div class="col-xl-8">
<p id="power_station_name_text">薪族鋸成</p>
<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>
<label class="col-xl-4 form-label">是否為代管</label>
<div class="col-xl-8">
<p class="color-info-600">
<div class="custom-control custom-switch">
@ -68,69 +69,70 @@
</div>
</div>
<div class="col-xl-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" id="electricity_meter_at_label" for="electricity_meter_at">台電掛錶日:</label>
<label class="col-xl-4 form-label" id="escrow_name_lable" for="escrow_name">被代管公司</label>
<div class="col-xl-8">
<p id="electricity_meter_at_text">2021-02-29</p>
<input type="date" id="electricity_meter_at" name="electricity_meter_at" class="form-control">
<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="estimated_recovery_time_label" for="estimated_recovery_time">預計回收年限:</label>
<label class="col-xl-4 form-label" id="electricity_meter_at_label" for="electricity_meter_at">台電掛錶日</label>
<div class="col-xl-8">
<p id="estimated_recovery_time_text">20</p>
<label id="electricity_meter_at_text" class="color-info-600"></label>
<input type="date" id="electricity_meter_at" name="electricity_meter_at" 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_rate_label" for="power_rate">授電費率</label>
<div class="col-xl-8">
<label id="power_rate_text" class="color-info-600"></label>
<input type="number" step="0.001" id="power_rate" name="power_rate" 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="text" id="estimated_recovery_time" name="estimated_recovery_time" 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="generating_capacity_label" for="generating_capacity">電廠發電容量(kW)</label>
<div class="col-xl-8">
<p id="generating_capacity_text">123123</p>
<label id="generating_capacity_text" class="color-info-600"></label>
<input type="number" step="0.1" 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="escrow_name_lable" for="escrow_name">被代管公司:</label>
<div class="col-xl-8">
<p id="escrow_name_text">台電電</p>
<input type="text" id="escrow_name" name="escrow_name" class="form-control" disabled="disabled">
</div>
</div>
<div class="row mb-5 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_operation_personnel_label">運維人員:</label>
<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>
<div class="row mb-5 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_rate_label" for="power_rate">授電費率</label>
<div class="col-xl-8">
<p id="power_rate_text">123123</p>
<input type="number" step="0.001" id="power_rate" name="power_rate" 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">座標</label>
<div class="col-xl-8">
<p id="coordinate_text">座標:</p>
<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">資料建立</label>
<label class="col-xl-4 form-label">資料建立</label>
<div class="col-xl-8">
<p id="created_by_text">野員新之助</p>
<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">建立時間</label>
<label class="col-xl-4 form-label">建立時間</label>
<div class="col-xl-8">
<p id="created_at_text">YYYY-MM-DD</p>
<label id="created_at_text" class="color-info-600"></label>
</div>
</div>
</div>
@ -139,55 +141,67 @@
<div class="col-xl-6">
<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">
<label class="form-label" id="inverter_brand_label" for="inverter_brand">廠牌</label>
<p id="inverter_brand_text" class="color-info-600">AUO</p>
<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-8">
<label id="inverter_brand_text" class="color-info-600"></label>
<input type="text" id="inverter_brand" name="inverter_brand" class="form-control">
</div>
<div class="col-xl-4">
<label class="form-label" id="inverter_product_model_label" for="inverter_product_model">型號</label>
<p id="inverter_product_model_text" class="color-info-600">PM060MW2_305</p>
</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>
<div class="col-xl-4">
<label class="form-label" id="inverter_amount_label" for="inverter_amount">數量</label>
<p id="inverter_amount_text" class="color-info-600">400</p>
</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-8">
<label id="inverter_amount_text" class="color-info-600"></label>
<input type="text" id="inverter_amount" name="inverter_amount" class="form-control">
</div>
</div>
</div>
</div>
<div class="col-xl-6">
<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">
<label class="form-label" id="photovoltaic_panel_brand_label" for="photovoltaic_panel_brand">廠牌</label>
<p id="photovoltaic_panel_brand_text" class="color-info-600">ABLYTEK</p>
<div class="col-xl-4 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 class="col-xl-4">
<label class="form-label" id="photovoltaic_panel_specification_label" for="photovoltaic_panel_specification">規格</label>
<p id="photovoltaic_panel_specification_text" class="color-info-600">1640×992×40</p>
</div>
<div class="col-xl-4 mb-3 row">
<label class="col-xl-4 form-label" id="photovoltaic_panel_specification_label" for="photovoltaic_panel_specification">規格</label>
<div class="col-xl-8">
<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-4">
<label class="form-label" id="photovoltaic_panel_amount_label" for="photovoltaic_panel_amount">數量</label>
<p id="photovoltaic_panel_amount_text" class="color-info-600">1116</p>
</div>
<div class="col-xl-4 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="text" id="photovoltaic_panel_amount" name="photovoltaic_panel_amount" class="form-control">
</div>
<div class="col-xl-4">
<label class="form-label" id="photovoltaic_panel_product_model_label" for="photovoltaic_panel_product_model">型號</label>
<p id="photovoltaic_panel_product_model_text" class="color-info-600">6MN6A295</p>
</div>
<div class="col-xl-4 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>
</div>
</div>
</div>
<div class="row mb-5" id="BoEPart">
<div class="card border mb-g w-100">
<!-- notice the additions of utility paddings and display properties on .card-header -->
@ -212,31 +226,31 @@
<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-6 mb-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label">能源局同意檔案</label>
<label class="col-xl-4 form-label">能源局同意檔案</label>
<div class="col-xl-8">
<a id="link-boe-file" class="color-info-600" href="link/to/your/download/file" download>Download link</a>
<input type="file" id="BoE_file" name="BoE_file" class="form-control">
</div>
</div>
<div class="col-xl-6 mb-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label">折扣率</label>
<label class="col-xl-4 form-label">折扣率</label>
<div class="col-xl-8">
<p id="BoE_discount_rate_text" class="color-info-600">123123</p>
<label id="BoE_discount_rate_text" class="color-info-600"></label>
<input type="number" step="1" id="BoE_discount_rate" name="BoE_discount_rate" class="form-control">
</div>
</div>
<div class="col-xl-6 mb-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" for="BoE_device_register_number">能源局設備登記編號</label>
<label class="col-xl-4 form-label" for="BoE_device_register_number">能源局設備登記編號</label>
<div class="col-xl-8">
<p id="BoE_device_register_number_text" class="color-info-600">123123</p>
<label id="BoE_device_register_number_text" class="color-info-600"></label>
<input type="text" id="BoE_device_register_number" name="BoE_device_register_number" class="form-control">
</div>
</div>
<div class="col-xl-6 mb-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label">租金比例 (%)</label>
<label class="col-xl-4 form-label">租金比例(%)</label>
<div class="col-xl-8">
<p id="BoE_discount_rate_text" class="color-info-600">123123</p>
<input type="number" step="1" id="BoE_discount_rate" name="BoE_discount_rate" class="form-control">
<label id="BoE_rent_ratio_text" class="color-info-600"></label>
<input type="number" step="1" id="BoE_rent_ratio" name="BoE_rent_ratio" class="form-control">
</div>
</div>
</div>
@ -245,56 +259,56 @@
<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-6 mb-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" for="TPC_contract_number">契約編號</label>
<label class="col-xl-4 form-label" for="TPC_contract_number">契約編號</label>
<div class="col-xl-8">
<p id="TPC_contract_number_text" class="color-info-600">123123</p>
<label id="TPC_contract_number_text" class="color-info-600"></label>
<input type="text" id="TPC_contract_number" name="TPC_contract_number" class="form-control">
</div>
</div>
<div class="col-xl-6 mb-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" for="TPC_contract_at">簽約日期</label>
<label class="col-xl-4 form-label" for="TPC_contract_at">簽約日期</label>
<div class="col-xl-8">
<p id="TPC_contract_at_text" class="color-info-600">123123</p>
<label id="TPC_contract_at_text" class="color-info-600"></label>
<input type="date" id="TPC_contract_at" name="TPC_contract_at" class="form-control">
</div>
</div>
<div class="col-xl-6 mb-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" for="TPC_sell_deadline">售電期限(年)</label>
<label class="col-xl-4 form-label" for="TPC_sell_deadline">售電期限(年)</label>
<div class="col-xl-8">
<p id="TPC_sell_deadline_text" class="color-info-600">123123</p>
<input type="text" id="TPC_sell_deadline" name="TPC_sell_deadline" class="form-control">
<label id="TPC_sell_deadline_text" class="color-info-600"></label>
<input type="number" step="1" id="TPC_sell_deadline" name="TPC_sell_deadline" class="form-control">
</div>
</div>
<div class="col-xl-6 mb-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" for="TPC_meter_reading">每期抄錶日</label>
<label class="col-xl-4 form-label" for="TPC_meter_reading">每期抄錶日</label>
<div class="col-xl-8">
<p id="TPC_meter_reading_text" class="color-info-600">123123</p>
<input type="text" id="TPC_meter_reading" name="TPC_meter_reading" class="form-control">
<label id="TPC_meter_reading_text" class="color-info-600"></label>
<input type="number" step="1" id="TPC_meter_reading" name="TPC_meter_reading" class="form-control">
</div>
</div>
<div class="col-xl-6 mb-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" for="TPC_purchase_electricity_at">正式購電日</label>
<label class="col-xl-4 form-label" for="TPC_purchase_electricity_at">正式購電日</label>
<div class="col-xl-8">
<p id="TPC_purchase_electricity_at_text" class="color-info-600">123123</p>
<label id="TPC_purchase_electricity_at_text" class="color-info-600"></label>
<input type="date" id="TPC_purchase_electricity_at" name="TPC_purchase_electricity_at" class="form-control">
</div>
</div>
<div class="col-xl-6 mb-3 row justify-content-center align-items-center">
<label class="col-xl-4 form-label" for="TPC_sell_electricity_at">正式售電日</label>
<label class="col-xl-4 form-label" for="TPC_sell_electricity_at">正式售電日</label>
<div class="col-xl-8">
<p id="TPC_sell_electricity_at_text" class="color-info-600">123123</p>
<label id="TPC_sell_electricity_at_text" class="color-info-600"></label>
<input type="date" id="TPC_sell_electricity_at" name="TPC_sell_electricity_at" class="form-control">
</div>
</div>
</div>
<div class="row d-flex justify-content-end px-5">
<div class="col-xl-6 mb-3 row justify-content-center align-items-center">
<label class="col-xl-12 text-right">資料建立<span id="BOE_TPC_created_by_text" class="color-info-600">123123</span></label>
<div class="col-xl-6 mb-3 row justify-content-end align-items-center">
<label class="col-xl-12 text-right">資料建立 <span id="BOE_TPC_created_by_text" class="ml-3 color-info-600"></span></label>
</div>
</div>
<div class="row d-flex justify-content-end px-5">
<div class="col-xl-6 mb-3 row justify-content-center align-items-center">
<label class="col-xl-12 text-right">建立時間<span id="BOE_TPC_created_at_text" class="color-info-600">123123</span></label>
<div class="col-xl-6 mb-3 row justify-content-end align-items-center">
<label class="col-xl-12 text-right">建立時間 <span id="BOE_TPC_created_at_text" class="ml-3 color-info-600"></span></label>
</div>
</div>
</div>
@ -305,11 +319,11 @@
</div>
<div class="row mb-5" id="land_buildingPart">
<div class="card border mb-g w-100">
<!--<div class="card border mb-g w-100">-->
<!-- notice the additions of utility paddings and display properties on .card-header -->
<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">
<!--<div class="card-header bg-fusion-50 pr-3 d-flex align-items-center flex-wrap justify-content-between">-->
<!-- we wrap header title inside a div tag with utility padding -->
<div class="card-title font-weight-bold">土地房屋資料</div>
<!--<div class="card-title font-weight-bold">土地房屋資料</div>
<div class="text-right">
<a href="javascript:;" class="btn btn-sm btn-success ml-auto waves-effect waves-themed">
<span class="fal fa-plus mr-1"></span> 新增
@ -320,25 +334,79 @@
</div>
</div>
<div class="card-body">
<div class="row d-flex justify-content-between">
<div class="row d-flex justify-content-between card-land-building" data-id="xxx">
<div class="col-xl">
<p>地址 <span class="color-info-600">台北市內湖區中山路一段1001號</span></p>
<p>經緯度 <span class="color-info-600">25.0726625,121.5725953</span></p>
<div class="row">
<label class="col-xl-4 form-label" for="land_building_address">地址</label>
<div class="col-xl-8">
<p id="land_building_address_text" class="color-info-600">台北市內湖區中山路一段1001號</p>
<input type="text" id="land_building_address" name="land_building_address" class="form-control">
</div>
</div>
<div class="row">
<label class="col-xl-4 form-label" for="land_building_coordinate">經緯度</label>
<div class="col-xl-8">
<p id="land_building_coordinate_text" class="color-info-600">台北市內湖區中山路一段1001號</p>
<input type="text" id="land_building_coordinate" name="land_building_coordinate" class="form-control">
</div>
</div>
</div>
<div class="col-xl">
<p>租約公證日期 <span class="color-info-600">新竹巨城站</span></p>
<p>租金比例 (%) <span class="color-info-600">10</span></p>
<div class="row">
<label class="col-xl-4 form-label" for="lease_notarization_at">租約公證日期</label>
<div class="col-xl-8">
<p id="lease_notarization_at_text" class="color-info-600">2021-12-01</p>
<input type="text" id="lease_notarization_at" name="lease_notarization_at" class="form-control">
</div>
</div>
<div class="row">
<label class="col-xl-4 form-label" for="land_building_lease_Rate">租金比例 (%)</label>
<div class="col-xl-8">
<p id="land_building_coordinate_text" class="color-info-600">台北市內湖區中山路一段1001號</p>
<input type="text" id="land_building_lease_Rate" name="land_building_coordinate" class="form-control">
</div>
</div>
</div>
<div class="col-xl">
<p>地主姓名 <span class="color-info-600">鋼鐵人</span></p>
<p>電話 <span class="color-info-600">0828-123456</span></p>
<div class="row">
<label class="col-xl-4 form-label" for="land_building_lease_Rate">地主姓名</label>
<div class="col-xl-8">
<p id="land_building_coordinate_text" class="color-info-600">鋼鐵人</p>
<input type="text" id="land_building_landowner" name="land_building_coordinate" class="form-control">
</div>
</div>
<div class="row">
<label class="col-xl-4 form-label" for="land_building_lease_Rate">電話</label>
<div class="col-xl-8">
<p id="land_building_coordinate_text" class="color-info-600">0828-123456</p>
<input type="text" id="land_building_lease_Rate" name="land_building_coordinate" class="form-control">
</div>
</div>
</div>
<div class="col-xl">
<p>房屋用途 <span class="color-info-600">工廠</span></p>
<div class="row">
<label class="col-xl-4 form-label" for="land_building_lease_Rate">房屋用途</label>
<div class="col-xl-8">
<p id="land_building_coordinate_text" class="color-info-600">0828-123456</p>
<input type="text" id="land_building_lease_Rate" name="land_building_coordinate" class="form-control">
</div>
</div>
</div>
<div class="col-xl">
<p>資料建立 <span class="color-info-600">蜘蛛人</span></p>
<p>建立時間 <span class="color-info-600">2018-10-01 12:00</span></p>
<div class="row">
<label class="col-xl-4 form-label" for="land_building_lease_Rate">資料建立</label>
<div class="col-xl-8">
<p id="land_building_coordinate_text" class="color-info-600">蜘蛛人</p>
<input type="text" id="land_building_lease_Rate" name="land_building_coordinate" class="form-control">
</div>
</div>
<div class="row">
<label class="col-xl-4 form-label" for="land_building_lease_Rate">建立時間</label>
<div class="col-xl-8">
<p id="land_building_coordinate_text" class="color-info-600">2018-10-01 12:00</p>
<input type="text" id="land_building_lease_Rate" name="land_building_coordinate" class="form-control">
</div>
</div>
</div>
</div>
</div>
@ -377,7 +445,7 @@
</div>
</div>
</div>
</div>-->
</div>

View File

@ -14,7 +14,7 @@
<!-- base css -->
<link id="vendorsbundle" rel="stylesheet" media="screen, print" href="~/css/vendors.bundle.css">
<link id="appbundle" rel="stylesheet" media="screen, print" href="~/css/app.bundle.css">
<link id="mytheme" rel="stylesheet" media="screen, print" href="#">
<link id="mytheme" rel="stylesheet" media="screen, print" href="~/css/themes/cust-theme-15.css">
<link id="myskin" rel="stylesheet" media="screen, print" href="~/css/skins/skin-master.css">
<!-- Place favicon.ico in the root directory -->
@ -41,10 +41,8 @@
<!-- BEGIN Left Aside -->
<aside class="page-sidebar">
<div class="page-logo">
<a href="#" class="page-logo-link press-scale-down d-flex align-items-center position-relative" data-toggle="modal" data-target="#modal-shortcut">
<img src="~/img/logo.png" alt="SmartAdmin WebApp" aria-roledescription="logo">
<span class="page-logo-text mr-1"></span>
<span class="position-absolute text-white opacity-50 small pos-top pos-right mr-2 mt-n2"></span>
<a href="#" class="page-logo-link press-scale-down" data-toggle="modal" data-target="#modal-shortcut">
<img src="~/img/logo.png" alt="SmartAdmin WebApp" aria-roledescription="logo"> <span class="page-logo-text mr-1"></span> <span class="position-absolute text-white opacity-50 small pos-top pos-right mr-2 mt-n2"></span>
<!--<i class="fal fa-angle-down d-inline-block ml-1 fs-lg color-primary-300"></i>-->
</a>
</div>
@ -90,23 +88,6 @@
<span class="nav-link-text" data-i18n="nav.category">總覽</span>
</a>
<ul>
<li>
<a href="javascript:void(0);" title="Menu child" data-filter-tags="utilities menu child">
<span class="nav-link-text" data-i18n="nav.utilities_menu_child">地圖總覽</span>
</a>
<ul>
<li>
<a href="javascript:void(0);" title="Sublevel Item" data-filter-tags="utilities menu child sublevel item">
<span class="nav-link-text" data-i18n="nav.utilities_menu_child_sublevel_item">電站總覽</span>
</a>
</li>
<li>
<a href="javascript:void(0);" title="Another Item" data-filter-tags="utilities menu child another item">
<span class="nav-link-text" data-i18n="nav.utilities_menu_child_another_item">運維總覽</span>
</a>
</li>
</ul>
</li>
<li class="">
<a href="javascript:void(0);" title="地圖總覽" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">地圖總覽</span>
@ -117,23 +98,18 @@
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">電站總覽</span>
</a>
</li>
<li class="">
<a href="javascript:void(0);" title="運維總覽" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">運維總覽</span>
</a>
</li>
</ul>
</li>
<!-- Example of open and active states -->
<li class="">
<a href="#" title="Category" data-filter-tags="category">
<i class="fal fa-alien"></i>
<span class="nav-link-text" data-i18n="nav.category">即時告警</span>
<i class="fal fa-file"></i>
<span class="nav-link-text" data-i18n="nav.category">電站資訊</span>
</a>
<ul>
<li class="">
<a href="javascript:void(0);" title="即時告警管理" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">即時告警管理</span>
<li class="@(ViewData["MainNum"] == "6" && ViewData["SubNum"] == "1" ? "active" : "")">
<a asp-controller="PowerStation" asp-action="Index" title="電站管理" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">電站管理</span>
</a>
</li>
</ul>
@ -145,18 +121,18 @@
</a>
<ul>
<li class="">
<a href="javascript:void(0);" title="逆變器熱圖" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">逆變器熱圖</span>
<a href="javascript:void(0);" title="合併電站" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">合併電站</span>
</a>
</li>
<li class="">
<a href="javascript:void(0);" title="電站運轉效率" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">電站運轉效率</span>
<a href="javascript:void(0);" title="電站交叉分析" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">電站交叉分析</span>
</a>
</li>
<li class="">
<a href="javascript:void(0);" title="逆變器效率" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">逆變器效率</span>
<a href="javascript:void(0);" title="逆變器交叉分析" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">逆變器交叉分析</span>
</a>
</li>
</ul>
@ -184,6 +160,21 @@
</li>
</ul>
</li>
<li class="">
<a href="#" title="Category" data-filter-tags="category">
<i class="fal fa-alien"></i>
<span class="nav-link-text" data-i18n="nav.category">即時告警</span>
</a>
<ul>
<li class="">
<a href="javascript:void(0);" title="即時告警管理" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">即時告警管理</span>
</a>
</li>
</ul>
</li>
<li class="">
<a href="#" title="Category" data-filter-tags="category">
<i class="fal fa-alien"></i>
@ -191,18 +182,13 @@
</a>
<ul>
<li class="">
<a href="javascript:void(0);" title="異常事件查詢" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">異常事件查詢</span>
<a href="javascript:void(0);" title="定期計劃建立" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">定期計劃建立</span>
</a>
</li>
<li class="">
<a href="javascript:void(0);" title="異常派工處理" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">異常派工處理</span>
</a>
</li>
<li class="">
<a href="javascript:void(0);" title="日常檢查記錄" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">日常檢查記錄</span>
<a href="javascript:void(0);" title="運維作業記錄" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">運維作業記錄</span>
</a>
</li>
</ul>
@ -213,11 +199,6 @@
<span class="nav-link-text" data-i18n="nav.category">系統管理</span>
</a>
<ul>
<li class="@(ViewData["MainNum"] == "6" && ViewData["SubNum"] == "1" ? "active" : "")">
<a asp-controller="PowerStation" asp-action="Index" title="電站資料管理" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">電站資料管理</span>
</a>
</li>
<li class="@(ViewData["MainNum"] == "6" && ViewData["SubNum"] == "2" ? "active" : "")">
<a asp-controller="Company" asp-action="Index" title="公司管理" data-filter-tags="utilities disabled item">
<span class="nav-link-text" data-i18n="nav.utilities_disabled_item">公司管理</span>

View File

@ -1815,6 +1815,12 @@ code {
.color-danger-900 {
color: #6c1919; }
.bg-fusion-25 {
background-color: #C3C3C3;
color: #4a4a4a; }
.bg-fusion-25:hover {
color: #4a4a4a; }
.bg-fusion-50 {
background-color: #818181;
color: white; }

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.6 KiB