上去
This commit is contained in:
parent
6de3525a05
commit
f05bd9e1a7
@ -179,14 +179,14 @@ namespace SolarPower.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<ActionResult> OperationPlanTable(List<int> id)
|
public async Task<ActionResult> OperationPlanTable(List<int> id,int type)
|
||||||
{
|
{
|
||||||
List<OperationPlanTable> OperationPlanTable = new List<OperationPlanTable>();
|
List<OperationPlanTable> OperationPlanTable = new List<OperationPlanTable>();
|
||||||
ApiResult<List<OperationPlanTable>> apiResult = new ApiResult<List<OperationPlanTable>>();
|
ApiResult<List<OperationPlanTable>> apiResult = new ApiResult<List<OperationPlanTable>>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
OperationPlanTable = await operationRepository.OperationPlanTable(id);
|
OperationPlanTable = await operationRepository.OperationPlanTable(id,type);
|
||||||
foreach (OperationPlanTable a in OperationPlanTable)
|
foreach (OperationPlanTable a in OperationPlanTable)
|
||||||
{
|
{
|
||||||
if(a.Type == 0)
|
if(a.Type == 0)
|
||||||
|
|||||||
@ -936,12 +936,13 @@ namespace SolarPower.Controllers
|
|||||||
{
|
{
|
||||||
ApiResult<string> apiResult = new ApiResult<string>();
|
ApiResult<string> apiResult = new ApiResult<string>();
|
||||||
try
|
try
|
||||||
{
|
|
||||||
if (Device.Id == 0)
|
|
||||||
{
|
{
|
||||||
PowerStation powerStation = null;
|
PowerStation powerStation = null;
|
||||||
powerStation = await powerStationRepository.GetOneAsync(Device.PowerStationId);
|
powerStation = await powerStationRepository.GetOneAsync(Device.PowerStationId);
|
||||||
string Number = await powerStationRepository.GetFinalSerialNumber(Device.PowerStationId, Device.Type);
|
if (Device.Id == 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
string Number = await powerStationRepository.GetFinalSerialNumber(Device.PowerStationId, Device.Type,powerStation.SiteDB);
|
||||||
var tempSerialNumber = 0;
|
var tempSerialNumber = 0;
|
||||||
if (!string.IsNullOrEmpty(Number))
|
if (!string.IsNullOrEmpty(Number))
|
||||||
{
|
{
|
||||||
@ -985,7 +986,7 @@ namespace SolarPower.Controllers
|
|||||||
"TypeName",
|
"TypeName",
|
||||||
"SerialNumber"
|
"SerialNumber"
|
||||||
};
|
};
|
||||||
await powerStationRepository.AddDevice(DeviceInfo, properties);
|
await powerStationRepository.AddDevice(DeviceInfo, properties, powerStation.SiteDB);
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Msg = "新增成功";
|
apiResult.Msg = "新增成功";
|
||||||
@ -1018,7 +1019,7 @@ namespace SolarPower.Controllers
|
|||||||
"CreatedBy",
|
"CreatedBy",
|
||||||
"TypeName"
|
"TypeName"
|
||||||
};
|
};
|
||||||
await powerStationRepository.UpdateDevice(DeviceInfo, properties);
|
await powerStationRepository.UpdateDevice(DeviceInfo, properties, powerStation.SiteDB);
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Msg = "儲存成功";
|
apiResult.Msg = "儲存成功";
|
||||||
}
|
}
|
||||||
@ -1028,6 +1029,8 @@ namespace SolarPower.Controllers
|
|||||||
{
|
{
|
||||||
apiResult.Code = "9999";
|
apiResult.Code = "9999";
|
||||||
apiResult.Msg = exception.ToString();
|
apiResult.Msg = exception.ToString();
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "Device=" + Device);
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||||
}
|
}
|
||||||
return apiResult;
|
return apiResult;
|
||||||
}
|
}
|
||||||
@ -1042,8 +1045,10 @@ namespace SolarPower.Controllers
|
|||||||
ApiResult<List<DeviceTable>> apiResult = new ApiResult<List<DeviceTable>>();
|
ApiResult<List<DeviceTable>> apiResult = new ApiResult<List<DeviceTable>>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
PowerStation powerStation = null;
|
||||||
|
powerStation = await powerStationRepository.GetOneAsync(stationId);
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
deviceTables = await powerStationRepository.DeviceTable(stationId);
|
deviceTables = await powerStationRepository.DeviceTable(stationId, powerStation.SiteDB);
|
||||||
foreach (DeviceTable a in deviceTables)
|
foreach (DeviceTable a in deviceTables)
|
||||||
{
|
{
|
||||||
a.Function = @"
|
a.Function = @"
|
||||||
@ -1056,6 +1061,8 @@ namespace SolarPower.Controllers
|
|||||||
{
|
{
|
||||||
apiResult.Code = "9999";
|
apiResult.Code = "9999";
|
||||||
apiResult.Msg = exception.ToString();
|
apiResult.Msg = exception.ToString();
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "stationId=" + stationId);
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||||
}
|
}
|
||||||
var result = Json(new
|
var result = Json(new
|
||||||
{
|
{
|
||||||
@ -1112,20 +1119,24 @@ namespace SolarPower.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<ApiResult<DeviceInfo>> GetOneDevice(int id)
|
public async Task<ApiResult<DeviceInfo>> GetOneDevice(PostPowerStationIdAndSelectedId id)
|
||||||
{
|
{
|
||||||
DeviceInfo Device = new DeviceInfo();
|
DeviceInfo Device = new DeviceInfo();
|
||||||
ApiResult<DeviceInfo> apiResult = new ApiResult<DeviceInfo>();
|
ApiResult<DeviceInfo> apiResult = new ApiResult<DeviceInfo>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
PowerStation powerStation = null;
|
||||||
|
powerStation = await powerStationRepository.GetOneAsync(id.PowerStationId);
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
Device = await powerStationRepository.OneDeviceInfo(id);
|
Device = await powerStationRepository.OneDeviceInfo(id.SelectedId, powerStation.SiteDB);
|
||||||
apiResult.Data = Device;
|
apiResult.Data = Device;
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
apiResult.Code = "9999";
|
apiResult.Code = "9999";
|
||||||
apiResult.Msg = exception.ToString();
|
apiResult.Msg = exception.ToString();
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "id=" + id);
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return apiResult;
|
return apiResult;
|
||||||
@ -1136,13 +1147,15 @@ namespace SolarPower.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<ApiResult<string>> DeleteOneDevice(int id)
|
public async Task<ApiResult<string>> DeleteOneDevice(PostPowerStationIdAndSelectedId id)
|
||||||
{
|
{
|
||||||
ApiResult<string> apiResult = new ApiResult<string>();
|
ApiResult<string> apiResult = new ApiResult<string>();
|
||||||
DeviceInfo Device = new DeviceInfo();
|
DeviceInfo Device = new DeviceInfo();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Device = await powerStationRepository.OneDeviceInfo(id);
|
PowerStation powerStation = null;
|
||||||
|
powerStation = await powerStationRepository.GetOneAsync(id.PowerStationId);
|
||||||
|
Device = await powerStationRepository.OneDeviceInfo(id.SelectedId, powerStation.SiteDB);
|
||||||
|
|
||||||
if (Device == null)
|
if (Device == null)
|
||||||
{
|
{
|
||||||
@ -1178,8 +1191,11 @@ namespace SolarPower.Controllers
|
|||||||
ApiResult<string> apiResult = new ApiResult<string>();
|
ApiResult<string> apiResult = new ApiResult<string>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
PowerStation powerStation = null;
|
||||||
|
powerStation = await powerStationRepository.GetOneAsync(exceptionModal.PowerStationId);
|
||||||
if (exceptionModal.Id == 0)
|
if (exceptionModal.Id == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
ExceptionModal Exception = new ExceptionModal()
|
ExceptionModal Exception = new ExceptionModal()
|
||||||
{
|
{
|
||||||
Alarm = exceptionModal.Alarm,
|
Alarm = exceptionModal.Alarm,
|
||||||
@ -1200,7 +1216,7 @@ namespace SolarPower.Controllers
|
|||||||
"Type",
|
"Type",
|
||||||
"UpperLimit",
|
"UpperLimit",
|
||||||
};
|
};
|
||||||
await powerStationRepository.AddException(Exception, properties);
|
await powerStationRepository.AddException(Exception, properties,powerStation.SiteDB);
|
||||||
|
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Msg = "新增成功";
|
apiResult.Msg = "新增成功";
|
||||||
@ -1227,7 +1243,7 @@ namespace SolarPower.Controllers
|
|||||||
"Type",
|
"Type",
|
||||||
"UpperLimit",
|
"UpperLimit",
|
||||||
};
|
};
|
||||||
await powerStationRepository.UpdateException(Exception, properties);
|
await powerStationRepository.UpdateException(Exception, properties,powerStation.SiteDB);
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
apiResult.Msg = "儲存成功";
|
apiResult.Msg = "儲存成功";
|
||||||
}
|
}
|
||||||
@ -1237,6 +1253,8 @@ namespace SolarPower.Controllers
|
|||||||
{
|
{
|
||||||
apiResult.Code = "9999";
|
apiResult.Code = "9999";
|
||||||
apiResult.Msg = exception.ToString();
|
apiResult.Msg = exception.ToString();
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "ExceptionModal=" + exceptionModal);
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||||
}
|
}
|
||||||
return apiResult;
|
return apiResult;
|
||||||
}
|
}
|
||||||
@ -1251,8 +1269,10 @@ namespace SolarPower.Controllers
|
|||||||
ApiResult<List<ExceptionTable>> apiResult = new ApiResult<List<ExceptionTable>>();
|
ApiResult<List<ExceptionTable>> apiResult = new ApiResult<List<ExceptionTable>>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
PowerStation powerStation = null;
|
||||||
|
powerStation = await powerStationRepository.GetOneAsync(stationId);
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
exceptionTable = await powerStationRepository.ExceptionTable(stationId);
|
exceptionTable = await powerStationRepository.ExceptionTable(stationId,powerStation.SiteDB);
|
||||||
foreach (ExceptionTable a in exceptionTable)
|
foreach (ExceptionTable a in exceptionTable)
|
||||||
{
|
{
|
||||||
a.Function = @"
|
a.Function = @"
|
||||||
@ -1273,6 +1293,8 @@ namespace SolarPower.Controllers
|
|||||||
{
|
{
|
||||||
apiResult.Code = "9999";
|
apiResult.Code = "9999";
|
||||||
apiResult.Msg = exception.ToString();
|
apiResult.Msg = exception.ToString();
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "stationId=" + stationId);
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||||
}
|
}
|
||||||
var result = Json(new
|
var result = Json(new
|
||||||
{
|
{
|
||||||
@ -1285,20 +1307,24 @@ namespace SolarPower.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<ApiResult<ExceptionModal>> GetOneException(int id)
|
public async Task<ApiResult<ExceptionModal>> GetOneException(PostPowerStationIdAndSelectedId id)
|
||||||
{
|
{
|
||||||
ExceptionModal Exception = new ExceptionModal();
|
ExceptionModal Exception = new ExceptionModal();
|
||||||
ApiResult<ExceptionModal> apiResult = new ApiResult<ExceptionModal>();
|
ApiResult<ExceptionModal> apiResult = new ApiResult<ExceptionModal>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
PowerStation powerStation = null;
|
||||||
|
powerStation = await powerStationRepository.GetOneAsync(id.PowerStationId);
|
||||||
apiResult.Code = "0000";
|
apiResult.Code = "0000";
|
||||||
Exception = await powerStationRepository.OneException(id);
|
Exception = await powerStationRepository.OneException(id.SelectedId,powerStation.SiteDB);
|
||||||
apiResult.Data = Exception;
|
apiResult.Data = Exception;
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
apiResult.Code = "9999";
|
apiResult.Code = "9999";
|
||||||
apiResult.Msg = exception.ToString();
|
apiResult.Msg = exception.ToString();
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "id=" + id);
|
||||||
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return apiResult;
|
return apiResult;
|
||||||
@ -1309,17 +1335,19 @@ namespace SolarPower.Controllers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<ApiResult<string>> DeleteOneException(int id)
|
public async Task<ApiResult<string>> DeleteOneException(PostPowerStationIdAndSelectedId id)
|
||||||
{
|
{
|
||||||
ApiResult<string> apiResult = new ApiResult<string>();
|
ApiResult<string> apiResult = new ApiResult<string>();
|
||||||
ExceptionModal Exception = new ExceptionModal();
|
ExceptionModal Exception = new ExceptionModal();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Exception = await powerStationRepository.OneException(id);
|
PowerStation powerStation = null;
|
||||||
|
powerStation = await powerStationRepository.GetOneAsync(id.PowerStationId);
|
||||||
|
Exception = await powerStationRepository.OneException(id.SelectedId,powerStation.SiteDB);
|
||||||
|
|
||||||
if (Exception == null)
|
if (Exception == null)
|
||||||
{
|
{
|
||||||
apiResult.Code = "9996";
|
apiResult.Code = "9999";
|
||||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||||
return apiResult;
|
return apiResult;
|
||||||
}
|
}
|
||||||
@ -1334,7 +1362,7 @@ namespace SolarPower.Controllers
|
|||||||
{
|
{
|
||||||
apiResult.Code = "9999";
|
apiResult.Code = "9999";
|
||||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "Id=" + id);
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "id=" + id);
|
||||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -37,7 +37,7 @@ namespace SolarPower.Helper
|
|||||||
var passwordStr = ed.AESDecrypt(dbConfig.Password);
|
var passwordStr = ed.AESDecrypt(dbConfig.Password);
|
||||||
|
|
||||||
//var connStr = $"server={serverStr};database={databaseStr};user={rootStr};password={passwordStr};charset=utf8;";
|
//var connStr = $"server={serverStr};database={databaseStr};user={rootStr};password={passwordStr};charset=utf8;";
|
||||||
var connStr = @"server=127.0.0.1;database=solar_power;user=root;password=000000;charset=utf8;";
|
var connStr = @"server=210.61.91.43;port=10068;database=solar_power_test;user=idafenweb;password=P@ssw0rd;charset=utf8;";
|
||||||
|
|
||||||
this._connectionString = connStr;
|
this._connectionString = connStr;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,6 +26,10 @@ namespace SolarPower.Models
|
|||||||
public string Text { get; set; }
|
public string Text { get; set; }
|
||||||
public string Value { get; set; }
|
public string Value { get; set; }
|
||||||
}
|
}
|
||||||
|
public class SendData
|
||||||
|
{
|
||||||
|
public List<int> id { get; set; }
|
||||||
|
}
|
||||||
public class OperationCreatePlanModal : Created
|
public class OperationCreatePlanModal : Created
|
||||||
{
|
{
|
||||||
private string startTime = "", endTime = "";
|
private string startTime = "", endTime = "";
|
||||||
|
|||||||
@ -58,7 +58,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public async Task<List<OperationPlanTable>> OperationPlanTable(List<int> id)
|
public async Task<List<OperationPlanTable>> OperationPlanTable(List<int> id,int Type)
|
||||||
{
|
{
|
||||||
List<OperationPlanTable> result;
|
List<OperationPlanTable> result;
|
||||||
var count = 0;
|
var count = 0;
|
||||||
@ -80,11 +80,25 @@ namespace SolarPower.Repository.Implement
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sql = @$"SELECT oc.Id,oc.PlanId,oc.PowerStationId,oc.Type,
|
var sql = "";
|
||||||
|
if (Type != 9)
|
||||||
|
{
|
||||||
|
sql = @$"SELECT oc.Id,oc.PlanId,oc.PowerStationId,oc.Type,
|
||||||
oc.ScheduleNum,oc.ScheduleType,oc.WorkDay,oc.StartTime,
|
oc.ScheduleNum,oc.ScheduleType,oc.WorkDay,oc.StartTime,
|
||||||
oc.EmailType,oc.Description,oc.CreatedAt,ps.Name AS PowerStationName ,us.Name AS CreatedPerson FROM operation_plan_create oc LEFT JOIN power_station ps
|
oc.EmailType,oc.Description,oc.CreatedAt,ps.Name AS PowerStationName ,us.Name AS CreatedPerson FROM operation_plan_create oc LEFT JOIN power_station ps
|
||||||
ON oc.PowerStationId = ps.Id LEFT JOIN user us
|
ON oc.PowerStationId = ps.Id LEFT JOIN user us
|
||||||
ON us.Id = oc.CreatedBy WHERE {Wheresql} AND oc.Deleted = 0";
|
ON us.Id = oc.CreatedBy WHERE ({Wheresql}) AND oc.Deleted = 0 AND oc.Type = {Type}";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sql = @$"SELECT oc.Id,oc.PlanId,oc.PowerStationId,oc.Type,
|
||||||
|
oc.ScheduleNum,oc.ScheduleType,oc.WorkDay,oc.StartTime,
|
||||||
|
oc.EmailType,oc.Description,oc.CreatedAt,ps.Name AS PowerStationName ,us.Name AS CreatedPerson FROM operation_plan_create oc LEFT JOIN power_station ps
|
||||||
|
ON oc.PowerStationId = ps.Id LEFT JOIN user us
|
||||||
|
ON us.Id = oc.CreatedBy WHERE ({Wheresql}) AND oc.Deleted = 0";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
result = (await conn.QueryAsync<OperationPlanTable>(sql)).ToList();
|
result = (await conn.QueryAsync<OperationPlanTable>(sql)).ToList();
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
|
|||||||
@ -651,16 +651,17 @@ namespace SolarPower.Repository.Implement
|
|||||||
/// <param name="DeviceInfo"></param>
|
/// <param name="DeviceInfo"></param>
|
||||||
/// <param name="properties"></param>
|
/// <param name="properties"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task AddDevice(Device DeviceInfo, List<string> properties)
|
public async Task AddDevice(Device DeviceInfo, List<string> properties, string db_name)
|
||||||
{
|
{
|
||||||
using IDbConnection conn = _databaseHelper.GetConnection();
|
using IDbConnection conn = _databaseHelper.GetConnection();
|
||||||
|
var trans = conn.BeginTransaction();
|
||||||
conn.Open();
|
conn.Open();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string sql = GenerateInsertQueryWithCustomTable(properties, "device");
|
string sql = GenerateUpdateQueryWithCustomDBNameAndTable(properties,db_name, "device");
|
||||||
|
|
||||||
await conn.ExecuteAsync(sql, DeviceInfo);
|
await conn.ExecuteAsync(sql, DeviceInfo);
|
||||||
|
trans.Commit();
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
{
|
{
|
||||||
@ -668,6 +669,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
trans.Rollback();
|
||||||
conn.Close();
|
conn.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -678,14 +680,14 @@ namespace SolarPower.Repository.Implement
|
|||||||
/// <param name="DeviceInfo"></param>
|
/// <param name="DeviceInfo"></param>
|
||||||
/// <param name="properties"></param>
|
/// <param name="properties"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task UpdateDevice(Device DeviceInfo, List<string> properties)
|
public async Task UpdateDevice(Device DeviceInfo, List<string> properties, string db_name)
|
||||||
{
|
{
|
||||||
using IDbConnection conn = _databaseHelper.GetConnection();
|
using IDbConnection conn = _databaseHelper.GetConnection();
|
||||||
conn.Open();
|
conn.Open();
|
||||||
var trans = conn.BeginTransaction();
|
var trans = conn.BeginTransaction();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var updateQuery = GenerateUpdateQueryWithCustomTable(properties, "device");
|
var updateQuery = GenerateUpdateQueryWithCustomDBNameAndTable(properties,db_name, "device");
|
||||||
await conn.ExecuteAsync(updateQuery.ToString(), DeviceInfo, trans);
|
await conn.ExecuteAsync(updateQuery.ToString(), DeviceInfo, trans);
|
||||||
trans.Commit();
|
trans.Commit();
|
||||||
}
|
}
|
||||||
@ -704,14 +706,14 @@ namespace SolarPower.Repository.Implement
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stationId"></param>
|
/// <param name="stationId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<List<DeviceTable>> DeviceTable(int stationId)
|
public async Task<List<DeviceTable>> DeviceTable(int stationId, string db_name)
|
||||||
{
|
{
|
||||||
using IDbConnection conn = _databaseHelper.GetConnection();
|
using IDbConnection conn = _databaseHelper.GetConnection();
|
||||||
conn.Open();
|
conn.Open();
|
||||||
List<DeviceTable> Device = new List<DeviceTable>();
|
List<DeviceTable> Device = new List<DeviceTable>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string sql = @$"SELECT * FROM device WHERE Deleted = 0 AND PowerStationId = @StationId";
|
string sql = @$"SELECT * FROM {db_name}.device WHERE Deleted = 0 AND PowerStationId = @StationId";
|
||||||
Device = (await conn.QueryAsync<DeviceTable>(sql, new { StationId = stationId })).ToList();
|
Device = (await conn.QueryAsync<DeviceTable>(sql, new { StationId = stationId })).ToList();
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
@ -729,7 +731,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<DeviceInfo> OneDeviceInfo(int id)
|
public async Task<DeviceInfo> OneDeviceInfo(int id, string db_name)
|
||||||
{
|
{
|
||||||
using (IDbConnection conn = _databaseHelper.GetConnection())
|
using (IDbConnection conn = _databaseHelper.GetConnection())
|
||||||
{
|
{
|
||||||
@ -737,7 +739,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
conn.Open();
|
conn.Open();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string sql = @$"SELECT * FROM device WHERE Id = @Id";
|
string sql = @$"SELECT * FROM {db_name}.device WHERE Id = @Id";
|
||||||
Device = await conn.QueryFirstOrDefaultAsync<DeviceInfo>(sql, new { Id = id });
|
Device = await conn.QueryFirstOrDefaultAsync<DeviceInfo>(sql, new { Id = id });
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
@ -757,13 +759,13 @@ namespace SolarPower.Repository.Implement
|
|||||||
/// <param name="Exception"></param>
|
/// <param name="Exception"></param>
|
||||||
/// <param name="properties"></param>
|
/// <param name="properties"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task AddException(ExceptionModal Exception, List<string> properties)
|
public async Task AddException(ExceptionModal Exception, List<string> properties, string db_name)
|
||||||
{
|
{
|
||||||
using IDbConnection conn = _databaseHelper.GetConnection();
|
using IDbConnection conn = _databaseHelper.GetConnection();
|
||||||
conn.Open();
|
conn.Open();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string sql = GenerateInsertQueryWithCustomTable(properties, "power_station_exception");
|
string sql = GenerateUpdateQueryWithCustomDBNameAndTable(properties,db_name,"power_station_exception");
|
||||||
|
|
||||||
await conn.ExecuteAsync(sql, Exception);
|
await conn.ExecuteAsync(sql, Exception);
|
||||||
|
|
||||||
@ -783,7 +785,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stationId"></param>
|
/// <param name="stationId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<List<ExceptionTable>> ExceptionTable(int stationId)
|
public async Task<List<ExceptionTable>> ExceptionTable(int stationId, string db_name)
|
||||||
{
|
{
|
||||||
using IDbConnection conn = _databaseHelper.GetConnection();
|
using IDbConnection conn = _databaseHelper.GetConnection();
|
||||||
conn.Open();
|
conn.Open();
|
||||||
@ -791,8 +793,8 @@ namespace SolarPower.Repository.Implement
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
string sql = @$"SELECT pe.Type,pe.UpperLimit,pe.LowerLimit,pe.Alarm,ps.Code AS PowerStationCode ,ps.Name AS PowerStationName,pe.CreatedAt,pe.Id
|
string sql = @$"SELECT pe.Type,pe.UpperLimit,pe.LowerLimit,pe.Alarm,ps.Code AS PowerStationCode ,ps.Name AS PowerStationName,pe.CreatedAt,pe.Id
|
||||||
FROM power_station_exception pe
|
FROM {db_name}.power_station_exception pe
|
||||||
LEFT JOIN power_station ps ON pe.PowerStationId = ps.Id
|
LEFT JOIN {db_name}.power_station ps ON pe.PowerStationId = ps.Id
|
||||||
WHERE pe.Deleted = 0 AND pe.PowerStationId = @StationId";
|
WHERE pe.Deleted = 0 AND pe.PowerStationId = @StationId";
|
||||||
Exception = (await conn.QueryAsync<ExceptionTable>(sql, new { StationId = stationId })).ToList();
|
Exception = (await conn.QueryAsync<ExceptionTable>(sql, new { StationId = stationId })).ToList();
|
||||||
}
|
}
|
||||||
@ -811,7 +813,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<ExceptionModal> OneException(int id)
|
public async Task<ExceptionModal> OneException(int id, string db_name)
|
||||||
{
|
{
|
||||||
using (IDbConnection conn = _databaseHelper.GetConnection())
|
using (IDbConnection conn = _databaseHelper.GetConnection())
|
||||||
{
|
{
|
||||||
@ -819,7 +821,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
conn.Open();
|
conn.Open();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string sql = @$"SELECT * FROM power_station_exception WHERE Id = @Id";
|
string sql = @$"SELECT * FROM {db_name}.power_station_exception WHERE Id = @Id";
|
||||||
Exception = await conn.QueryFirstOrDefaultAsync<ExceptionModal>(sql, new { Id = id });
|
Exception = await conn.QueryFirstOrDefaultAsync<ExceptionModal>(sql, new { Id = id });
|
||||||
}
|
}
|
||||||
catch (Exception exception)
|
catch (Exception exception)
|
||||||
@ -839,14 +841,14 @@ namespace SolarPower.Repository.Implement
|
|||||||
/// <param name="Exception"></param>
|
/// <param name="Exception"></param>
|
||||||
/// <param name="properties"></param>
|
/// <param name="properties"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task UpdateException(ExceptionModal Exception, List<string> properties)
|
public async Task UpdateException(ExceptionModal Exception, List<string> properties, string db_name)
|
||||||
{
|
{
|
||||||
using IDbConnection conn = _databaseHelper.GetConnection();
|
using IDbConnection conn = _databaseHelper.GetConnection();
|
||||||
conn.Open();
|
conn.Open();
|
||||||
var trans = conn.BeginTransaction();
|
var trans = conn.BeginTransaction();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var updateQuery = GenerateUpdateQueryWithCustomTable(properties, "power_station_exception");
|
var updateQuery = GenerateUpdateQueryWithCustomDBNameAndTable(properties,db_name,"power_station_exception");
|
||||||
await conn.ExecuteAsync(updateQuery.ToString(), Exception, trans);
|
await conn.ExecuteAsync(updateQuery.ToString(), Exception, trans);
|
||||||
trans.Commit();
|
trans.Commit();
|
||||||
}
|
}
|
||||||
@ -860,7 +862,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
conn.Close();
|
conn.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public async Task<string> GetFinalSerialNumber(int PowerStationId, string Type)
|
public async Task<string> GetFinalSerialNumber(int PowerStationId, string Type, string db_name)
|
||||||
{
|
{
|
||||||
string Num;
|
string Num;
|
||||||
using IDbConnection conn = _databaseHelper.GetConnection();
|
using IDbConnection conn = _databaseHelper.GetConnection();
|
||||||
@ -868,7 +870,7 @@ namespace SolarPower.Repository.Implement
|
|||||||
var trans = conn.BeginTransaction();
|
var trans = conn.BeginTransaction();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sql = "SELECT SerialNumber FROM device WHERE PowerStationId = @PowerStationId AND Type = @Type ORDER BY SerialNumber DESC";
|
var sql = $"SELECT SerialNumber FROM {db_name}.device WHERE PowerStationId = @PowerStationId AND Type = @Type ORDER BY SerialNumber DESC";
|
||||||
Num = await conn.QueryFirstOrDefaultAsync<string>(sql, new { PowerStationId = PowerStationId, Type = Type });
|
Num = await conn.QueryFirstOrDefaultAsync<string>(sql, new { PowerStationId = PowerStationId, Type = Type });
|
||||||
trans.Commit();
|
trans.Commit();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@ namespace SolarPower.Repository.Interface
|
|||||||
{
|
{
|
||||||
Task<List<PowerStationIdList>> GetPowerStationIdList(int UserId);
|
Task<List<PowerStationIdList>> GetPowerStationIdList(int UserId);
|
||||||
Task AddOperationPlan(OperationCreatePlan OperationPlan, List<string> properties);
|
Task AddOperationPlan(OperationCreatePlan OperationPlan, List<string> properties);
|
||||||
Task<List<OperationPlanTable>> OperationPlanTable(List<int> id);
|
Task<List<OperationPlanTable>> OperationPlanTable(List<int> id,int Type);
|
||||||
Task<OperationCreatePlan> GetOneOperation(int id);
|
Task<OperationCreatePlan> GetOneOperation(int id);
|
||||||
Task UpdateOperationPlan(OperationCreatePlan OperationPlan, List<string> properties);
|
Task UpdateOperationPlan(OperationCreatePlan OperationPlan, List<string> properties);
|
||||||
Task AddToRecord(PlanToRecord record, List<string> properties2);
|
Task AddToRecord(PlanToRecord record, List<string> properties2);
|
||||||
|
|||||||
@ -159,34 +159,34 @@ namespace SolarPower.Repository.Interface
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name=""></param>
|
/// <param name=""></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task AddDevice(Device DeviceInfo, List<string> properties);
|
Task AddDevice(Device DeviceInfo, List<string> properties, string db_name);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 修改 裝置
|
/// 修改 裝置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="DeviceInfo"></param>
|
/// <param name="DeviceInfo"></param>
|
||||||
/// <param name="properties"></param>
|
/// <param name="properties"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task UpdateDevice(Device DeviceInfo, List<string> properties);
|
Task UpdateDevice(Device DeviceInfo, List<string> properties, string db_name);
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 設備datatable
|
/// 設備datatable
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stationId"></param>
|
/// <param name="stationId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<List<DeviceTable>> DeviceTable(int stationId);
|
Task<List<DeviceTable>> DeviceTable(int stationId, string db_name);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 異常datatable
|
/// 異常datatable
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stationId"></param>
|
/// <param name="stationId"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<List<ExceptionTable>> ExceptionTable(int stationId);
|
Task<List<ExceptionTable>> ExceptionTable(int stationId, string db_name);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 取單一筆DeviceInfo
|
/// 取單一筆DeviceInfo
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<DeviceInfo> OneDeviceInfo(int id);
|
Task<DeviceInfo> OneDeviceInfo(int id, string db_name);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 新增 異常設定
|
/// 新增 異常設定
|
||||||
@ -194,14 +194,14 @@ namespace SolarPower.Repository.Interface
|
|||||||
/// <param name="Exception"></param>
|
/// <param name="Exception"></param>
|
||||||
/// <param name="properties"></param>
|
/// <param name="properties"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task AddException(ExceptionModal Exception, List<string> properties);
|
Task AddException(ExceptionModal Exception, List<string> properties, string db_name);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 取一筆異常設定
|
/// 取一筆異常設定
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id"></param>
|
/// <param name="id"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<ExceptionModal> OneException(int id);
|
Task<ExceptionModal> OneException(int id, string db_name);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 更新異常設定
|
/// 更新異常設定
|
||||||
@ -209,7 +209,7 @@ namespace SolarPower.Repository.Interface
|
|||||||
/// <param name="Exception"></param>
|
/// <param name="Exception"></param>
|
||||||
/// <param name="properties"></param>
|
/// <param name="properties"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task UpdateException(ExceptionModal Exception, List<string> properties);
|
Task UpdateException(ExceptionModal Exception, List<string> properties, string db_name);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 取最後一個設備流水號
|
/// 取最後一個設備流水號
|
||||||
@ -217,7 +217,7 @@ namespace SolarPower.Repository.Interface
|
|||||||
/// <param name="PowerStationId"></param>
|
/// <param name="PowerStationId"></param>
|
||||||
/// <param name="Type"></param>
|
/// <param name="Type"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<string> GetFinalSerialNumber(int PowerStationId, string Type);
|
Task<string> GetFinalSerialNumber(int PowerStationId, string Type, string db_name);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 透過電站編號,取得該電站的運維人員編號
|
/// 透過電站編號,取得該電站的運維人員編號
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
@using SolarPower.Models.Role
|
@using SolarPower.Models.Role
|
||||||
@model RoleLayerEnum
|
@model RoleLayerEnum
|
||||||
|
|
||||||
|
|
||||||
<ol class="breadcrumb page-breadcrumb">
|
<ol class="breadcrumb page-breadcrumb">
|
||||||
<li class="breadcrumb-item"><a href="javascript:void(0);">系統管理</a></li>
|
<li class="breadcrumb-item"><a href="javascript:void(0);">系統管理</a></li>
|
||||||
<li class="breadcrumb-item active">定期計畫建立</li>
|
<li class="breadcrumb-item active">定期計畫建立</li>
|
||||||
@ -26,9 +27,9 @@
|
|||||||
<div class="row mb-3 px-3">
|
<div class="row mb-3 px-3">
|
||||||
<div class="pr-3">
|
<div class="pr-3">
|
||||||
<div class="btn-group btn-group-md">
|
<div class="btn-group btn-group-md">
|
||||||
<button type="button" class="btn btn-success waves-effect waves-themed">全部</button>
|
<button type="button" class="btn btn-success waves-effect waves-themed" onclick="ChangeType(9)" id="button9">全部</button>
|
||||||
<button type="button" class="btn btn-secondary waves-effect waves-themed">巡檢</button>
|
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeType(1)" id="button1">巡檢</button>
|
||||||
<button type="button" class="btn btn-secondary waves-effect waves-themed">清洗</button>
|
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeType(0)" id="button0">清洗</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -38,12 +39,12 @@
|
|||||||
<button type="button" class="btn btn-secondary waves-effect waves-themed">全部縣市</button>
|
<button type="button" class="btn btn-secondary waves-effect waves-themed">全部縣市</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="pr-3">
|
<div class="pr-3">
|
||||||
<div class="frame-wrap">
|
<div class="frame-wrap" id="citytest" style="display:none">
|
||||||
<button type="button" class="btn btn-outline-success waves-effect waves-themed">
|
<button type="button" class="btn btn-outline-success waves-effect waves-themed">
|
||||||
新北市
|
新北市
|
||||||
<span class="badge bg-success-700 ml-2">4</span>
|
<span class="badge bg-success-700 ml-2">4</span>
|
||||||
</button>
|
</button>
|
||||||
<button type="button" class="btn btn-outline-success waves-effect waves-themed">
|
@*<button type="button" class="btn btn-outline-success waves-effect waves-themed">
|
||||||
台北市
|
台北市
|
||||||
<span class="badge bg-success-700 ml-2">4</span>
|
<span class="badge bg-success-700 ml-2">4</span>
|
||||||
</button>
|
</button>
|
||||||
@ -58,7 +59,10 @@
|
|||||||
<button type="button" class="btn btn-outline-success waves-effect waves-themed">
|
<button type="button" class="btn btn-outline-success waves-effect waves-themed">
|
||||||
台中市
|
台中市
|
||||||
<span class="badge bg-success-700 ml-2">4</span>
|
<span class="badge bg-success-700 ml-2">4</span>
|
||||||
</button>
|
</button>*@
|
||||||
|
</div>
|
||||||
|
<div class="frame-wrap" id="city">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -98,7 +102,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row d-flex justify-content-end px-3">
|
<div class="row d-flex justify-content-end px-3">
|
||||||
<button type="button" class="btn btn-info waves-effect waves-themed mb-3 mr-2">
|
<button type="button" class="btn btn-info waves-effect waves-themed mb-3 mr-2" onClick="saveToExcel();">
|
||||||
<span class="fal fa-file-excel mr-1"></span>
|
<span class="fal fa-file-excel mr-1"></span>
|
||||||
匯出
|
匯出
|
||||||
</button>
|
</button>
|
||||||
@ -126,6 +130,34 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
<table id="NoView">
|
||||||
|
<thead class="thead-themed">
|
||||||
|
<tr>
|
||||||
|
<th>計劃單號</th>
|
||||||
|
<th>項目</th>
|
||||||
|
<th>電站</th>
|
||||||
|
<th>排程週期</th>
|
||||||
|
<th>每次預期/天</th>
|
||||||
|
<th>開始時間</th>
|
||||||
|
<th>email 通知</th>
|
||||||
|
<th>建立人</th>
|
||||||
|
<th>建立時間</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody id="NoViewbody">
|
||||||
|
<tr>
|
||||||
|
<td>1</td>
|
||||||
|
<td>1</td>
|
||||||
|
<td>1</td>
|
||||||
|
<td>1</td>
|
||||||
|
<td>1</td>
|
||||||
|
<td>1</td>
|
||||||
|
<td>1</td>
|
||||||
|
<td>1</td>
|
||||||
|
<td>1</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -236,8 +268,11 @@
|
|||||||
|
|
||||||
|
|
||||||
@section Scripts{
|
@section Scripts{
|
||||||
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var selected_id = 0;
|
var selected_id = 0;
|
||||||
|
var type = 9;
|
||||||
$(function () {
|
$(function () {
|
||||||
//#region 電站下拉式選單select_option
|
//#region 電站下拉式選單select_option
|
||||||
var url_operation_select_option = "/Operation/GetPowerStationSelectOption";
|
var url_operation_select_option = "/Operation/GetPowerStationSelectOption";
|
||||||
@ -321,7 +356,8 @@
|
|||||||
"url": "/Operation/OperationPlanTable",
|
"url": "/Operation/OperationPlanTable",
|
||||||
"type": "POST",
|
"type": "POST",
|
||||||
"data": function (d) {
|
"data": function (d) {
|
||||||
d.id = [1,2];
|
d.id = [1, 2],
|
||||||
|
d.type = type
|
||||||
},
|
},
|
||||||
"dataSrc": function (rel) {
|
"dataSrc": function (rel) {
|
||||||
if (rel.data.code == "9999") {
|
if (rel.data.code == "9999") {
|
||||||
@ -337,7 +373,61 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
//#endregion
|
//#endregion
|
||||||
|
var Nurl = "/PowerStation/GetSolarCitySummary";
|
||||||
|
var ids = new Array(0);
|
||||||
|
$.post(Nurl, function (rel)
|
||||||
|
{
|
||||||
|
if (rel.code != "0000") {
|
||||||
|
toast_error(rel.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.each(rel.data, function (index, val) {
|
||||||
|
ids.push(val.cityId);
|
||||||
|
$('#citytest').find('button').attr('id', 'cityID' + val.cityId).clone().appendTo($('#city'));
|
||||||
|
var name = 'cityID' + val.cityId;
|
||||||
|
document.getElementById(name).innerHTML = val.city;
|
||||||
|
/* $('#cityID1').text = val.city;*/
|
||||||
|
$('#cityID' + val.cityId).find('span').attr('id', 'cityspan' + val.cityId);
|
||||||
|
document.getElementById('cityspan' + String(val.cityId)).innerHTML = val.amount;
|
||||||
|
});
|
||||||
|
|
||||||
|
//for (var i = 0; i < rel.data.length; i++)
|
||||||
|
//{
|
||||||
|
|
||||||
|
|
||||||
|
// $('#city').append(h[i]);
|
||||||
|
// //$('#city').append("<button type='button' class='btn btn-outline-success waves-effect waves-themed ' style='margin - right: 40px;' >" +
|
||||||
|
// // rel.data[i].city +
|
||||||
|
// // "<span class= 'badge bg-success-700 ml-2' >" + rel.data[i].amount + "</span >" +
|
||||||
|
// // "</button >");
|
||||||
|
//}
|
||||||
|
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
function ChangeType(Num) {
|
||||||
|
type = Num;
|
||||||
|
OperationPlanTable.ajax.reload();
|
||||||
|
if (Num == 9)
|
||||||
|
{
|
||||||
|
document.getElementById("button9").setAttribute("class", "btn btn-success waves-effect waves-themed");
|
||||||
|
document.getElementById("button1").setAttribute("class", "btn btn-secondary waves-effect waves-themed");
|
||||||
|
document.getElementById("button0").setAttribute("class", "btn btn-secondary waves-effect waves-themed");
|
||||||
|
}
|
||||||
|
else if (Num == 1)
|
||||||
|
{
|
||||||
|
document.getElementById("button1").setAttribute("class", "btn btn-success waves-effect waves-themed");
|
||||||
|
document.getElementById("button9").setAttribute("class", "btn btn-secondary waves-effect waves-themed");
|
||||||
|
document.getElementById("button0").setAttribute("class", "btn btn-secondary waves-effect waves-themed");
|
||||||
|
}
|
||||||
|
else if(Num == 0)
|
||||||
|
{
|
||||||
|
document.getElementById("button0").setAttribute("class", "btn btn-success waves-effect waves-themed");
|
||||||
|
document.getElementById("button1").setAttribute("class", "btn btn-secondary waves-effect waves-themed");
|
||||||
|
document.getElementById("button9").setAttribute("class", "btn btn-secondary waves-effect waves-themed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//#region 新增計畫基本資料
|
//#region 新增計畫基本資料
|
||||||
function AddOperationPlan() {
|
function AddOperationPlan() {
|
||||||
|
|
||||||
@ -453,5 +543,43 @@
|
|||||||
|
|
||||||
});
|
});
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
function saveToExcel() {
|
||||||
|
|
||||||
|
var url = "/Operation/OperationPlanTable";
|
||||||
|
var send_data = {
|
||||||
|
id: [1, 2]
|
||||||
|
};
|
||||||
|
$.post(url, send_data, function (rel) {
|
||||||
|
if (rel.data.code != "0000") {
|
||||||
|
toast_error(rel.msg);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for (var i = 0; i < rel.data.data.length; i++)
|
||||||
|
{
|
||||||
|
$('#NoViewbody').append("<tr>");
|
||||||
|
$('#NoViewbody').append("<td>" + rel.data.data[i].planId + "</td>");
|
||||||
|
$('#NoViewbody').append("<td>" + rel.data.data[i].typeName + "</td>");
|
||||||
|
$('#NoViewbody').append("<td>" + rel.data.data[i].powerStationName + "</td>");
|
||||||
|
$('#NoViewbody').append("<td>" + rel.data.data[i].schedule + "</td>");
|
||||||
|
$('#NoViewbody').append("<td>" + rel.data.data[i].workDay + "</td>");
|
||||||
|
$('#NoViewbody').append("<td>" + rel.data.data[i].startTimeString + "</td>");
|
||||||
|
$('#NoViewbody').append("<td>" + rel.data.data[i].emailTypeName + "</td>");
|
||||||
|
$('#NoViewbody').append("<td>" + rel.data.data[i].createdPerson + "</td>");
|
||||||
|
$('#NoViewbody').append("<td>" + rel.data.data[i].createTimeString + "</td>");
|
||||||
|
$('#NoViewbody').append("</tr>");
|
||||||
|
}
|
||||||
|
}, 'json');
|
||||||
|
|
||||||
|
$("#NoView").table2excel({
|
||||||
|
// 匯出的Excel文件的名稱
|
||||||
|
name: "Excel Document Name",
|
||||||
|
// Excel檔案的名稱
|
||||||
|
filename: "test",
|
||||||
|
//檔案字尾名
|
||||||
|
fileext: ".xls",
|
||||||
|
});
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1541,7 +1541,8 @@
|
|||||||
var url = "/PowerStation/GetOneDevice/";
|
var url = "/PowerStation/GetOneDevice/";
|
||||||
|
|
||||||
var send_data = {
|
var send_data = {
|
||||||
id: selected_id
|
SelectedId: selected_id,
|
||||||
|
PowerStationId: stationId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1581,7 +1582,8 @@
|
|||||||
if (result.value) {
|
if (result.value) {
|
||||||
var url = "/PowerStation/DeleteOneDevice/";
|
var url = "/PowerStation/DeleteOneDevice/";
|
||||||
var send_data = {
|
var send_data = {
|
||||||
Id: selected_id
|
SelectedId: selected_id,
|
||||||
|
PowerStationId: stationId
|
||||||
}
|
}
|
||||||
$.post(url, send_data, function (rel) {
|
$.post(url, send_data, function (rel) {
|
||||||
if (rel.code != "0000") {
|
if (rel.code != "0000") {
|
||||||
@ -1645,7 +1647,8 @@
|
|||||||
var url = "/PowerStation/GetOneException/";
|
var url = "/PowerStation/GetOneException/";
|
||||||
|
|
||||||
var send_data = {
|
var send_data = {
|
||||||
id: selected_id
|
SelectedId: selected_id,
|
||||||
|
PowerStationId: stationId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1683,7 +1686,8 @@
|
|||||||
if (result.value) {
|
if (result.value) {
|
||||||
var url = "/PowerStation/DeleteOneException/";
|
var url = "/PowerStation/DeleteOneException/";
|
||||||
var send_data = {
|
var send_data = {
|
||||||
Id: selected_id
|
SelectedId: selected_id,
|
||||||
|
PowerStationId: stationId,
|
||||||
}
|
}
|
||||||
$.post(url, send_data, function (rel) {
|
$.post(url, send_data, function (rel) {
|
||||||
if (rel.code == "9999") {
|
if (rel.code == "9999") {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
@{
|
@{
|
||||||
ViewData["MainNum"] = "6";
|
ViewData["MainNum"] = "7";
|
||||||
ViewData["SubNum"] = "3";
|
ViewData["SubNum"] = "3";
|
||||||
ViewData["Title"] = "帳號管理";
|
ViewData["Title"] = "帳號管理";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user