This commit is contained in:
Kai 2021-08-12 18:47:21 +08:00
commit b4909cbba2
11 changed files with 404 additions and 38 deletions

View File

@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.SS.Util;
using NPOI.XSSF.UserModel;
@ -233,11 +234,16 @@ namespace SolarPower.Controllers
//stylein12.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
//stylein12.BorderLeft = NPOI.SS.UserModel.BorderStyle.Thin;
//stylein12.WrapText = true;
IFont font14NoBold = workbook.CreateFont();
font14NoBold.FontName = "新細明體";
font14NoBold.FontHeightInPoints = 14;
font14NoBold.IsBold = false;
IFont font14 = workbook.CreateFont();
font14.FontName = "新細明體";
font14.FontHeightInPoints = 14;
font14.IsBold = true;
ICellStyle style14 = workbook.CreateCellStyle();
style14.SetFont(font14);
style14.Alignment = HorizontalAlignment.Left;
@ -251,6 +257,7 @@ namespace SolarPower.Controllers
fontBlue14.FontHeightInPoints = 14;
fontBlue14.IsBold = true;
fontBlue14.Color = NPOI.HSSF.Util.HSSFColor.Indigo.Index;
ICellStyle buttomLineBlue14 = workbook.CreateCellStyle();
buttomLineBlue14.SetFont(fontBlue14);
buttomLineBlue14.BorderBottom = BorderStyle.Medium;
@ -273,7 +280,65 @@ namespace SolarPower.Controllers
style14up.BorderRight = BorderStyle.Thin;
style14up.BorderBottom = BorderStyle.Thin;
ICellStyle style14upright = workbook.CreateCellStyle();
style14upright.SetFont(font14);
style14upright.Alignment = HorizontalAlignment.Center;
style14upright.VerticalAlignment = VerticalAlignment.Center;
style14upright.BorderTop = BorderStyle.Medium;
style14upright.BorderLeft = BorderStyle.Thin;
style14upright.BorderRight = BorderStyle.Medium;
style14upright.BorderBottom = BorderStyle.Thin;
ICellStyle style14bodyleft = workbook.CreateCellStyle();
style14bodyleft.SetFont(font14NoBold);
style14bodyleft.Alignment = HorizontalAlignment.Center;
style14bodyleft.VerticalAlignment = VerticalAlignment.Center;
style14bodyleft.BorderTop = BorderStyle.Thin;
style14bodyleft.BorderLeft = BorderStyle.Medium;
style14bodyleft.BorderRight = BorderStyle.Thin;
style14bodyleft.BorderBottom = BorderStyle.Thin;
ICellStyle style14body = workbook.CreateCellStyle();
style14body.SetFont(font14NoBold);
style14body.Alignment = HorizontalAlignment.Center;
style14body.VerticalAlignment = VerticalAlignment.Center;
style14body.BorderTop = BorderStyle.Thin;
style14body.BorderLeft = BorderStyle.Thin;
style14body.BorderRight = BorderStyle.Thin;
style14body.BorderBottom = BorderStyle.Thin;
ICellStyle style14bodyright = workbook.CreateCellStyle();
style14bodyright.SetFont(font14NoBold);
style14bodyright.Alignment = HorizontalAlignment.Center;
style14bodyright.VerticalAlignment = VerticalAlignment.Center;
style14bodyright.BorderTop = BorderStyle.Thin;
style14bodyright.BorderLeft = BorderStyle.Thin;
style14bodyright.BorderRight = BorderStyle.Medium;
style14bodyright.BorderBottom = BorderStyle.Thin;
ICellStyle style14bodyrightnoborder = workbook.CreateCellStyle();
style14bodyrightnoborder.SetFont(font14);
style14bodyrightnoborder.Alignment = HorizontalAlignment.Left;
style14bodyrightnoborder.VerticalAlignment = VerticalAlignment.Center;
style14bodyrightnoborder.BorderTop = BorderStyle.None;
style14bodyrightnoborder.BorderBottom = BorderStyle.None;
style14bodyrightnoborder.BorderLeft = BorderStyle.None;
style14bodyrightnoborder.BorderRight = BorderStyle.Medium;
ICellStyle style14bodyleftnoborder = workbook.CreateCellStyle();
style14bodyleftnoborder.SetFont(font14);
style14bodyleftnoborder.Alignment = HorizontalAlignment.Left;
style14bodyleftnoborder.VerticalAlignment = VerticalAlignment.Top;
style14bodyleftnoborder.BorderLeft = BorderStyle.Medium;
style14bodyleftnoborder.WrapText = true;
ICellStyle style14bodyleftrigrtbottom = workbook.CreateCellStyle();
style14bodyleftrigrtbottom.SetFont(font14);
style14bodyleftrigrtbottom.Alignment = HorizontalAlignment.Left;
style14bodyleftrigrtbottom.VerticalAlignment = VerticalAlignment.Center;
style14bodyleftrigrtbottom.BorderRight = BorderStyle.Medium;
style14bodyleftrigrtbottom.BorderBottom = BorderStyle.Medium;
style14bodyleftrigrtbottom.BorderLeft = BorderStyle.Medium;
#endregion
var bill = electricitySoldRecordRepository.GetBill(post);
@ -286,8 +351,8 @@ namespace SolarPower.Controllers
sheet.SetColumnWidth(2, 6 * 160 * 8);
sheet.SetColumnWidth(3, 4 * 160 * 8);
sheet.SetColumnWidth(4, 6 * 160 * 8);
sheet.SetColumnWidth(5, 6 * 160 * 8);
sheet.SetColumnWidth(6, 6 * 160 * 8);
sheet.SetColumnWidth(5, 5 * 160 * 8);
sheet.SetColumnWidth(6, 5 * 160 * 8);
CellRangeAddress region;
row = sheet.CreateRow(1);
@ -297,6 +362,14 @@ namespace SolarPower.Controllers
cell.SetCellValue(bill.Result.Name);
cell.CellStyle = style26;
if(bill.Result.Logo != null)
{
byte[] bytes = System.IO.File.ReadAllBytes(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "upload", "company_logo", bill.Result.Logo));
XSSFDrawing patriarch = (XSSFDrawing)sheet.CreateDrawingPatriarch();
XSSFClientAnchor regionr = (XSSFClientAnchor)patriarch.CreateAnchor(0, 0, 2, 2, 1, 1, 2, 3);
patriarch.CreatePicture(regionr, workbook.AddPicture(bytes, XSSFWorkbook.PICTURE_TYPE_JPEG));
}
row = sheet.CreateRow(2);
cell = row.CreateCell(1);
region = new CellRangeAddress(2, 2, 1, 6);
@ -384,7 +457,7 @@ namespace SolarPower.Controllers
region = new CellRangeAddress(12, 12, 2, 3);
sheet.AddMergedRegion(region);
cell = row.CreateCell(2);
cell.SetCellValue("台灣電力股份有限公司桃園區營業處");
cell.SetCellValue(bill.Result.TPCInvoiceBuyer);
cell.CellStyle = buttomLineBlue14;
row = sheet.CreateRow(13); //第13行
@ -393,7 +466,7 @@ namespace SolarPower.Controllers
cell.CellStyle = style14;
cell = row.CreateCell(2);
cell.SetCellValue("02488533");
cell.SetCellValue(bill.Result.GUINumber);
cell.CellStyle = buttomLineBlue14;
@ -405,7 +478,7 @@ namespace SolarPower.Controllers
region = new CellRangeAddress(14, 14, 2, 4);
sheet.AddMergedRegion(region);
cell = row.CreateCell(2);
cell.SetCellValue("330桃園市觀音區中山路一段280巷90號(屋頂)");
cell.SetCellValue(bill.Result.TPCInvoiceAddress);
cell.CellStyle = buttomLineBlue14;
row = sheet.CreateRow(16); //第16行
@ -439,15 +512,243 @@ namespace SolarPower.Controllers
cell.CellStyle = style14up;
cell = row.CreateCell(6);
cell.CellStyle = style14up;
cell.CellStyle = style14upright;
row = sheet.CreateRow(18); //第18行
cell = row.CreateCell(1);
cell.SetCellValue(1);
cell.CellStyle = style14bodyleft;
cell = row.CreateCell(2);
cell.SetCellValue("太陽光電售電");
cell.CellStyle = style14body;
cell = row.CreateCell(3);
cell.SetCellValue(1);
cell.CellStyle = style14body;
cell = row.CreateCell(4);
cell.SetCellValue(bill.Result.Money);
ICellStyle style0 = workbook.CreateCellStyle();
IDataFormat dataformat = workbook.CreateDataFormat();
style0.DataFormat = dataformat.GetFormat("$#,##0");
style0.SetFont(font14NoBold);
style0.Alignment = HorizontalAlignment.Center;
style0.VerticalAlignment = VerticalAlignment.Center;
style0.BorderTop = BorderStyle.Thin;
style0.BorderLeft = BorderStyle.Thin;
style0.BorderRight = BorderStyle.Thin;
style0.BorderBottom = BorderStyle.Thin;
cell.CellStyle = style0;
cell = row.CreateCell(5);
region = new CellRangeAddress(18, 18, 5, 6);
sheet.AddMergedRegion(region);
cell.CellStyle = style14body;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyright;
for(var index = 19;index < 26;index++)
{
row = sheet.CreateRow(index); //第19行
cell = row.CreateCell(1);
if(index != 25){
cell.SetCellValue(index - 17);
}
else{
cell.SetCellValue("合計");
}
cell.CellStyle = style14bodyleft;
cell = row.CreateCell(2);
cell.CellStyle = style14body;
cell = row.CreateCell(3);
cell.CellStyle = style14body;
cell = row.CreateCell(4);
if (index == 25){
cell.CellStyle = style0;
cell.SetCellValue(bill.Result.Money);
}
else{
cell.CellStyle = style14body;
}
cell = row.CreateCell(5);
region = new CellRangeAddress(index, index, 5, 6);
sheet.AddMergedRegion(region);
cell.CellStyle = style14body;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyright;
} //第19-25行
row = sheet.CreateRow(26); //第26行
region = new CellRangeAddress(26, 26, 1, 6);
sheet.AddMergedRegion(region);
cell = row.CreateCell(1);
cell.SetCellValue("說明(請略述發票開立性質及金額計算)");
cell.CellStyle = style14bodyleftnoborder;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyrightnoborder;
row = sheet.CreateRow(27); //第27行
row.Height = 40 * 15;
region = new CellRangeAddress(27, 29, 1, 6);
sheet.AddMergedRegion(region);
cell = row.CreateCell(1);
cell.SetCellValue($"{bill.Result.PowerName}-太陽光電售電收入 \r計算期間:{bill.Result.StartAt}-{bill.Result.EndAt} \r售電收入 = ( 度數 {bill.Result.Kwh} * 費率{bill.Result.PowerRate}) * 1.05 = {bill.Result.Kwh * bill.Result.PowerRate * 1.05} 元");
cell.CellStyle = style14bodyleftnoborder;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyrightnoborder;
row = sheet.CreateRow(28); //第28行
row.Height = 40 * 15;
cell = row.CreateCell(1);
cell.CellStyle = style14bodyleftnoborder;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyrightnoborder;
row = sheet.CreateRow(29); //第29行
row.Height = 40 * 15;
cell = row.CreateCell(1);
cell.CellStyle = style14bodyleftnoborder;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyrightnoborder;
row = sheet.CreateRow(30); //第30行
cell = row.CreateCell(1);
cell.CellStyle = style14bodyleftnoborder;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyrightnoborder;
row = sheet.CreateRow(31); //第31行
cell = row.CreateCell(1);
cell.SetCellValue("入帳會計科目:");
cell.CellStyle = style14bodyleftnoborder;
cell = row.CreateCell(2);
cell.SetCellValue("售電收入");
cell.CellStyle = style14;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyrightnoborder;
row = sheet.CreateRow(32); //第32行
cell = row.CreateCell(1);
cell.SetCellValue("入帳成本中心:");
cell.CellStyle = style14bodyleftnoborder;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyrightnoborder;
row = sheet.CreateRow(33); //第32行
cell = row.CreateCell(1);
cell.CellStyle = style14bodyleftnoborder;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyrightnoborder;
row = sheet.CreateRow(34); //第34行
cell = row.CreateCell(1);
cell.SetCellValue("備註:");
cell.CellStyle = style14bodyleftnoborder;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyrightnoborder;
row = sheet.CreateRow(35); //第35行
cell = row.CreateCell(1);
region = new CellRangeAddress(35, 35, 1, 6);
sheet.AddMergedRegion(region);
cell.SetCellValue(" 1.請申請人提醒客戶付款期限為收到發票後30天內以匯款方式給付於旭天能源指定之帳戶。");
cell.CellStyle = style14bodyleftnoborder;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyrightnoborder;
row = sheet.CreateRow(36); //第36行
cell = row.CreateCell(1);
region = new CellRangeAddress(36, 36, 1, 6);
sheet.AddMergedRegion(region);
cell.SetCellValue(" 2.申請人應於收到客戶匯款時,填具收入繳存單交予出納,並請於收入繳存單上註明發票號碼。");
cell.CellStyle = style14bodyleftnoborder;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyrightnoborder;
row = sheet.CreateRow(37); //第37行
cell = row.CreateCell(1);
region = new CellRangeAddress(37, 37, 1, 6);
sheet.AddMergedRegion(region);
cell.SetCellValue(" 3. 發票如需作廢或更改者,應於次月五日前通知會計部,逾期恕不受理。");
cell.CellStyle = style14bodyleftnoborder;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyrightnoborder;
row = sheet.CreateRow(38); //第38行
cell = row.CreateCell(1);
region = new CellRangeAddress(38, 38, 1, 6);
sheet.AddMergedRegion(region);
cell.SetCellValue(" 4. 發票內容確認無誤後,請於發票領取人簽收欄內簽名。");
cell.CellStyle = style14bodyleftnoborder;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyrightnoborder;
row = sheet.CreateRow(39); //第39行
cell = row.CreateCell(1);
region = new CellRangeAddress(39, 39, 1, 6);
sheet.AddMergedRegion(region);
cell.SetCellValue(" 5. 申請人填具申請表單至少須經L3主管或以上之主管核准。");
cell.CellStyle = style14bodyleftnoborder;
cell = row.CreateCell(6);
cell.CellStyle = style14bodyrightnoborder;
row = sheet.CreateRow(40); //第39行
cell = row.CreateCell(1);
region = new CellRangeAddress(40, 40, 1, 6);
sheet.AddMergedRegion(region);
cell.SetCellValue(" 6. 若對上述內容有任何問題,請電會計部-旭天:Yuchi Lin #15220");
cell.CellStyle = style14bodyleftrigrtbottom;
for(int a = 2; a < 7; a++)
{
cell = row.CreateCell(a);
cell.CellStyle = style14bodyleftrigrtbottom;
}
row = sheet.CreateRow(43); //第5行
cell = row.CreateCell(1);
cell.SetCellValue("申 請 人 ");
cell.CellStyle = style14;
cell = row.CreateCell(2);
cell.CellStyle = buttomLine14;
cell = row.CreateCell(3);
cell.SetCellValue("部門主管: ");
cell.CellStyle = style14;
cell = row.CreateCell(4);
cell.CellStyle = buttomLine14;
row = sheet.CreateRow(45); //第5行
cell = row.CreateCell(5);
cell.SetCellValue("發票領取人簽收:");
cell.CellStyle = style14;
cell = row.CreateCell(6);
cell.CellStyle = buttomLine14;
var ms = new NpoiMemoryStream
{

View File

@ -2472,9 +2472,9 @@ namespace SolarPower.Controllers
/// 其他電站下拉式選單
/// </summary>
/// <returns></returns>
public async Task<ApiResult<List<PowerstationOption>>> GetPowerstationOption(int stationId)
public async Task<ApiResult<List<PowerstationOptionAndName>>> GetPowerstationOption(int stationId)
{
ApiResult<List<PowerstationOption>> apiResult = new ApiResult<List<PowerstationOption>>();
ApiResult<List<PowerstationOptionAndName>> apiResult = new ApiResult<List<PowerstationOptionAndName>>();
try
{
var powerStation = await powerStationRepository.GetOneAsync(stationId);
@ -2497,9 +2497,9 @@ namespace SolarPower.Controllers
/// </summary>
/// <param name="stationId"></param>
/// <returns></returns>
public async Task<ApiResult<List<PowerstationOption>>> GetDeviceUIDList(int stationId)
public async Task<ApiResult<List<PowerstationOptionAndName>>> GetDeviceUIDList(int stationId)
{
ApiResult<List<PowerstationOption>> apiResult = new ApiResult<List<PowerstationOption>>();
ApiResult<List<PowerstationOptionAndName>> apiResult = new ApiResult<List<PowerstationOptionAndName>>();
try
{
var powerStation = await powerStationRepository.GetOneAsync(stationId);

View File

@ -43,7 +43,13 @@ namespace SolarPower.Models
public string TPCInvoiceAddress { get; set; }
public string Name { get; set; }
public string Logo { get; set; }
private string startAt;
public string StartAt { get { return Convert.ToDateTime(startAt).ToString("yyyy/MM/dd"); } set { startAt = value; } }
private string endAt;
public string EndAt { get { return Convert.ToDateTime(endAt).ToString("yyyy/MM/dd"); } set { endAt = value; } }
public int Kwh { get; set; }
public double PowerRate { get; set; }
public string PowerName { get; set; }
}
}

View File

@ -574,6 +574,12 @@ namespace SolarPower.Models.PowerStation
public string Text { get; set; }
public string Value { get; set; }
}
public class PowerstationOptionAndName
{
public string Text { get; set; }
public string Value { get; set; }
public string Name { get; set; }
}
/// <summary>
/// 共享設備
/// </summary>

View File

@ -81,7 +81,8 @@ namespace SolarPower.Repository.Implement
BillInfo a = new BillInfo();
try
{
var sql = @$"SELECT es.Money,ps.GUINumber,ps.TPCInvoiceBuyer,ps.TPCInvoiceAddress,cp.Name,cp.Logo,ps.Id
var sql = @$"SELECT es.Money,ps.GUINumber,ps.TPCInvoiceBuyer,ps.TPCInvoiceAddress,cp.Name,cp.Logo,ps.Id,
es.StartAt,es.EndAt,es.Kwh,ps.PowerRate,ps.Name as PowerName
FROM electricity_sold_record es
LEFT JOIN power_station ps
ON es.PowerstationId = ps.Id

View File

@ -1760,16 +1760,16 @@ namespace SolarPower.Repository.Implement
/// 其餘電站列表
/// </summary>
/// <returns></returns>
public async Task<List<PowerstationOption>> GetPowerstationOptionAsync(string db_name, int stationId)
public async Task<List<PowerstationOptionAndName>> GetPowerstationOptionAsync(string db_name, int stationId)
{
List<PowerstationOption> result;
List<PowerstationOptionAndName> result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var sql = $@"SELECT Id AS Value, Code AS Text FROM {db_name}.power_station WHERE Deleted = 0 AND Id !={stationId}";
var sql = $@"SELECT Id AS Value, Code AS Text ,Name FROM {db_name}.power_station WHERE Deleted = 0 AND Id !={stationId}";
result = (await conn.QueryAsync<PowerstationOption>(sql)).ToList();
result = (await conn.QueryAsync<PowerstationOptionAndName>(sql)).ToList();
}
catch (Exception exception)
{
@ -1808,16 +1808,16 @@ namespace SolarPower.Repository.Implement
/// <param name="db_name"></param>
/// <param name="stationId"></param>
/// <returns></returns>
public async Task<List<PowerstationOption>> GetDeviceUIDListAsync(string db_name, int stationId)
public async Task<List<PowerstationOptionAndName>> GetDeviceUIDListAsync(string db_name, int stationId)
{
List<PowerstationOption> result;
List<PowerstationOptionAndName> result;
using (IDbConnection conn = this._databaseHelper.GetConnection())
{
try
{
var sql = $@"SELECT Id AS Value, UID AS Text FROM {db_name}.device WHERE Deleted = 0 AND PowerStationId ={stationId}";
var sql = $@"SELECT Id AS Value, UID AS Text, Name FROM {db_name}.device WHERE Deleted = 0 AND PowerStationId ={stationId}";
result = (await conn.QueryAsync<PowerstationOption>(sql)).ToList();
result = (await conn.QueryAsync<PowerstationOptionAndName>(sql)).ToList();
}
catch (Exception exception)
{

View File

@ -405,14 +405,14 @@ namespace SolarPower.Repository.Interface
/// 電站下拉式選單
/// </summary>
/// <returns></returns>
Task<List<PowerstationOption>> GetPowerstationOptionAsync(string db_name, int stationId);
Task<List<PowerstationOptionAndName>> GetPowerstationOptionAsync(string db_name, int stationId);
/// <summary>
/// 設備編號下拉式選單
/// </summary>
/// <param name="db_name"></param>
/// <param name="stationId"></param>
/// <returns></returns>
Task<List<PowerstationOption>> GetDeviceUIDListAsync(string db_name, int stationId);
Task<List<PowerstationOptionAndName>> GetDeviceUIDListAsync(string db_name, int stationId);
/// <summary>
/// 新增共享設備
/// </summary>

View File

@ -796,7 +796,7 @@
$("#ShareDevice_PowerStationId_modal").empty();
$.each(rel.data, function (index, val) {
$("#ShareDevice_PowerStationId_modal").append($("<option />").val(val.value).text(val.text));
$("#ShareDevice_PowerStationId_modal").append($("<option />").val(val.value).text(val.text +"/"+ val.name));
});
if (rel.data.length > 0)
{
@ -914,7 +914,7 @@
}
else {
$.each(rel.data, function (index, val) {
$("#ShareDevice_UID_modal").append($("<option />").val(val.value).text(val.text));
$("#ShareDevice_UID_modal").append($("<option />").val(val.value).text(val.text + "/" + val.name));
});
@ -2105,6 +2105,7 @@
document.getElementById('Device_Enabled_modal').disabled = true;
$("#Device-modal .modal-title").html("裝置資料 - 新增");
$("#Device-form").trigger("reset");
/*$("#Device_TableName_modal").val("s" + $("#Device_Controller_modal").text() + "_sensoravg");*/
$("#Device-modal").modal();
}
//#endregion
@ -2284,6 +2285,7 @@
if ($("#Device-form").valid()) {
var url = "/PowerStation/SaveDevice";
var a = padLeft($("#Device_ColName_modal").val(), 2);
var send_data = {
Id: selected_id,
PowerStationId: stationId,
@ -2295,7 +2297,7 @@
ProductModel: $("#Device_ProductModel_modal").val(),
//DBName: $("#Device_DBName_modal").val(),
TableName: $("#Device_TableName_modal").val(),
ColName: $("#Device_ColName_modal").val(),
ColName: "SENSORAVG" + a,
InstallDate: $("#Device_InstallDate_modal").val(),
Status: $("#Device_Status_modal").val(),
Enabled: $("#Device_Enabled_modal").val(),
@ -2345,7 +2347,9 @@
$("#Device_ProductModel_modal").val(rel.data.productModel);
//$("#Device_DBName_modal").val(rel.data.dbName);
$("#Device_TableName_modal").val(rel.data.tableName);
$("#Device_ColName_modal").val(rel.data.colName);
var colNameNum = rel.data.colName.substr(9, 2);
$("#Device_ColName_modal").val(colNameNum);
$("#Device_Controller_modal").val(rel.data.controllerId);
$("#Device_Name_modal").val(rel.data.name);
$("#Device_Status_modal").val(rel.data.status);
@ -2791,5 +2795,55 @@
min: 0
});
});
function padLeft(str, lenght) {
if (str.length >= lenght)
return str;
else
return padLeft("0" + str, lenght);
}
$("#Device-form").validate({
rules: {
Device_Brand_modal: {
required: true
},
Device_Name_modal: {
required: true
},
Device_ProductModel_modal: {
required: true
},
Device_InstallDate_modal: {
required: true
},
Device_ColName_modal: {
max: 50,
min: 1
}
}
});
$("#Inverter-form").validate({
rules: {
Inverter_ControllerId_modal: {
required: true
},
Inverter_InverterName_modal: {
required: true
},
Inverter_InstallDate_modal: {
required: true
},
Inverter_Brand_modal: {
required: true
},
Inverter_Model_modal: {
required: true
},
Inverter_Capacity_modal: {
required: true
},
}
});
</script>
}

View File

@ -275,22 +275,19 @@
<label class="form-label" for="Device_ProductModel_modal"><span class="text-danger">*</span>型號</label>
<input type="text" id="Device_ProductModel_modal" name="Device_ProductModel_modal" class="form-control">
</div>
@*<div class="form-group col-lg-6">
<div style="margin-bottom: 0.3rem">
<label class="form-label" for="Device_DBName_modal">DBName</label>
<input type="text" id="Device_DBName_modal" name="Device_DBName_modal" class="form-control">
</div>
</div>*@
<div class="form-group col-lg-6">
<div style="margin-bottom: 0.3rem">
<label class="form-label" for="Device_TableName_modal">tableName</label>
<input type="text" id="Device_TableName_modal" name="Device_TableName_modal" class="form-control">
<input type="text" id="Device_TableName_modal" name="Device_TableName_modal" class="form-control" disabled>
</div>
</div>
<div class="form-group col-lg-6">
<div style="margin-bottom: 0.3rem">
<label class="form-label" for="Device_ColName_modal">columnName</label>
<input type="text" id="Device_ColName_modal" name="Device_ColName_modal" class="form-control">
<div class="row align-items-center">
<label class="col-lg-4 text-right">SENSORAVG</label>
<input type="number" id="Device_ColName_modal" name="Device_ColName_modal" class="form-control col-md-3">
</div>
</div>
</div>
<div class="form-group col-lg-6">
@ -300,8 +297,7 @@
<div class="form-group col-lg-3">
<label class="form-label" for="Device_Status_modal">狀態</label>
<select class="form-control" id="Device_Status_modal" disabled>
<option value="0" action>未啟用</option>
<option value="1">正常</option>
<option value="1" action>正常</option>
<option value="2">異常</option>
</select>
</div>

View File

@ -155,6 +155,7 @@
var countOperationRecodeFile = 0;
$(function () {
var url = new URL(location.href);
stationId = url.searchParams.get('stationId');
@ -799,7 +800,7 @@
$(this).trigger('change');
});
//#endregion
//#region 運維作業記錄 DataTable
powerids.push(stationId);
operationRecodeTable = $("#operation_recode_table").DataTable({
@ -1069,6 +1070,7 @@
//歷史第一個table
getTable();
$('#to30day').trigger('click');
});
//#region 變更左邊電站Collapse選單箭頭

View File

@ -6,7 +6,7 @@
</div>
</div>
<div class="pr-3">
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeDate30exception()">近30天</button>
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeDate30exception()" id="to30day">近30天</button>
</div>
<div class="pr-6">
<div class="form-group">