Merge branch 'Willy'
This commit is contained in:
commit
111e901aef
1
.gitignore
vendored
1
.gitignore
vendored
@ -338,3 +338,4 @@ ASALocalRun/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
/SolarPower/wwwroot/js/bower_components
|
||||
|
||||
@ -179,14 +179,14 @@ namespace SolarPower.Controllers
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <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>();
|
||||
ApiResult<List<OperationPlanTable>> apiResult = new ApiResult<List<OperationPlanTable>>();
|
||||
try
|
||||
{
|
||||
apiResult.Code = "0000";
|
||||
OperationPlanTable = await operationRepository.OperationPlanTable(id);
|
||||
OperationPlanTable = await operationRepository.OperationPlanTable(id,type);
|
||||
foreach (OperationPlanTable a in OperationPlanTable)
|
||||
{
|
||||
if(a.Type == 0)
|
||||
|
||||
@ -936,12 +936,13 @@ namespace SolarPower.Controllers
|
||||
{
|
||||
ApiResult<string> apiResult = new ApiResult<string>();
|
||||
try
|
||||
{
|
||||
if (Device.Id == 0)
|
||||
{
|
||||
PowerStation powerStation = null;
|
||||
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;
|
||||
if (!string.IsNullOrEmpty(Number))
|
||||
{
|
||||
@ -985,7 +986,7 @@ namespace SolarPower.Controllers
|
||||
"TypeName",
|
||||
"SerialNumber"
|
||||
};
|
||||
await powerStationRepository.AddDevice(DeviceInfo, properties);
|
||||
await powerStationRepository.AddDevice(DeviceInfo, properties, powerStation.SiteDB);
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "新增成功";
|
||||
@ -1018,7 +1019,7 @@ namespace SolarPower.Controllers
|
||||
"CreatedBy",
|
||||
"TypeName"
|
||||
};
|
||||
await powerStationRepository.UpdateDevice(DeviceInfo, properties);
|
||||
await powerStationRepository.UpdateDevice(DeviceInfo, properties, powerStation.SiteDB);
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "儲存成功";
|
||||
}
|
||||
@ -1028,6 +1029,8 @@ namespace SolarPower.Controllers
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = exception.ToString();
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "Device=" + Device);
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
}
|
||||
return apiResult;
|
||||
}
|
||||
@ -1042,8 +1045,10 @@ namespace SolarPower.Controllers
|
||||
ApiResult<List<DeviceTable>> apiResult = new ApiResult<List<DeviceTable>>();
|
||||
try
|
||||
{
|
||||
PowerStation powerStation = null;
|
||||
powerStation = await powerStationRepository.GetOneAsync(stationId);
|
||||
apiResult.Code = "0000";
|
||||
deviceTables = await powerStationRepository.DeviceTable(stationId);
|
||||
deviceTables = await powerStationRepository.DeviceTable(stationId, powerStation.SiteDB);
|
||||
foreach (DeviceTable a in deviceTables)
|
||||
{
|
||||
a.Function = @"
|
||||
@ -1056,6 +1061,8 @@ namespace SolarPower.Controllers
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = exception.ToString();
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "stationId=" + stationId);
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
}
|
||||
var result = Json(new
|
||||
{
|
||||
@ -1112,20 +1119,24 @@ namespace SolarPower.Controllers
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<DeviceInfo>> GetOneDevice(int id)
|
||||
public async Task<ApiResult<DeviceInfo>> GetOneDevice(PostPowerStationIdAndSelectedId id)
|
||||
{
|
||||
DeviceInfo Device = new DeviceInfo();
|
||||
ApiResult<DeviceInfo> apiResult = new ApiResult<DeviceInfo>();
|
||||
try
|
||||
{
|
||||
PowerStation powerStation = null;
|
||||
powerStation = await powerStationRepository.GetOneAsync(id.PowerStationId);
|
||||
apiResult.Code = "0000";
|
||||
Device = await powerStationRepository.OneDeviceInfo(id);
|
||||
Device = await powerStationRepository.OneDeviceInfo(id.SelectedId, powerStation.SiteDB);
|
||||
apiResult.Data = Device;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = exception.ToString();
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "id=" + id);
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
}
|
||||
|
||||
return apiResult;
|
||||
@ -1136,13 +1147,15 @@ namespace SolarPower.Controllers
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<string>> DeleteOneDevice(int id)
|
||||
public async Task<ApiResult<string>> DeleteOneDevice(PostPowerStationIdAndSelectedId id)
|
||||
{
|
||||
ApiResult<string> apiResult = new ApiResult<string>();
|
||||
DeviceInfo Device = new DeviceInfo();
|
||||
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)
|
||||
{
|
||||
@ -1178,8 +1191,11 @@ namespace SolarPower.Controllers
|
||||
ApiResult<string> apiResult = new ApiResult<string>();
|
||||
try
|
||||
{
|
||||
PowerStation powerStation = null;
|
||||
powerStation = await powerStationRepository.GetOneAsync(exceptionModal.PowerStationId);
|
||||
if (exceptionModal.Id == 0)
|
||||
{
|
||||
|
||||
ExceptionModal Exception = new ExceptionModal()
|
||||
{
|
||||
Alarm = exceptionModal.Alarm,
|
||||
@ -1200,7 +1216,7 @@ namespace SolarPower.Controllers
|
||||
"Type",
|
||||
"UpperLimit",
|
||||
};
|
||||
await powerStationRepository.AddException(Exception, properties);
|
||||
await powerStationRepository.AddException(Exception, properties,powerStation.SiteDB);
|
||||
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "新增成功";
|
||||
@ -1227,7 +1243,7 @@ namespace SolarPower.Controllers
|
||||
"Type",
|
||||
"UpperLimit",
|
||||
};
|
||||
await powerStationRepository.UpdateException(Exception, properties);
|
||||
await powerStationRepository.UpdateException(Exception, properties,powerStation.SiteDB);
|
||||
apiResult.Code = "0000";
|
||||
apiResult.Msg = "儲存成功";
|
||||
}
|
||||
@ -1237,6 +1253,8 @@ namespace SolarPower.Controllers
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = exception.ToString();
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "ExceptionModal=" + exceptionModal);
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
}
|
||||
return apiResult;
|
||||
}
|
||||
@ -1251,8 +1269,10 @@ namespace SolarPower.Controllers
|
||||
ApiResult<List<ExceptionTable>> apiResult = new ApiResult<List<ExceptionTable>>();
|
||||
try
|
||||
{
|
||||
PowerStation powerStation = null;
|
||||
powerStation = await powerStationRepository.GetOneAsync(stationId);
|
||||
apiResult.Code = "0000";
|
||||
exceptionTable = await powerStationRepository.ExceptionTable(stationId);
|
||||
exceptionTable = await powerStationRepository.ExceptionTable(stationId,powerStation.SiteDB);
|
||||
foreach (ExceptionTable a in exceptionTable)
|
||||
{
|
||||
a.Function = @"
|
||||
@ -1273,6 +1293,8 @@ namespace SolarPower.Controllers
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = exception.ToString();
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "stationId=" + stationId);
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
}
|
||||
var result = Json(new
|
||||
{
|
||||
@ -1285,20 +1307,24 @@ namespace SolarPower.Controllers
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<ExceptionModal>> GetOneException(int id)
|
||||
public async Task<ApiResult<ExceptionModal>> GetOneException(PostPowerStationIdAndSelectedId id)
|
||||
{
|
||||
ExceptionModal Exception = new ExceptionModal();
|
||||
ApiResult<ExceptionModal> apiResult = new ApiResult<ExceptionModal>();
|
||||
try
|
||||
{
|
||||
PowerStation powerStation = null;
|
||||
powerStation = await powerStationRepository.GetOneAsync(id.PowerStationId);
|
||||
apiResult.Code = "0000";
|
||||
Exception = await powerStationRepository.OneException(id);
|
||||
Exception = await powerStationRepository.OneException(id.SelectedId,powerStation.SiteDB);
|
||||
apiResult.Data = Exception;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = exception.ToString();
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "id=" + id);
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
}
|
||||
|
||||
return apiResult;
|
||||
@ -1309,17 +1335,19 @@ namespace SolarPower.Controllers
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ApiResult<string>> DeleteOneException(int id)
|
||||
public async Task<ApiResult<string>> DeleteOneException(PostPowerStationIdAndSelectedId id)
|
||||
{
|
||||
ApiResult<string> apiResult = new ApiResult<string>();
|
||||
ExceptionModal Exception = new ExceptionModal();
|
||||
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)
|
||||
{
|
||||
apiResult.Code = "9996";
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
return apiResult;
|
||||
}
|
||||
@ -1334,7 +1362,7 @@ namespace SolarPower.Controllers
|
||||
{
|
||||
apiResult.Code = "9999";
|
||||
apiResult.Msg = errorCode.GetString(apiResult.Code);
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "Id=" + id);
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + "id=" + id);
|
||||
Logger.LogError("【" + controllerName + "/" + actionName + "】" + exception.Message);
|
||||
}
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ namespace SolarPower.Helper
|
||||
var passwordStr = ed.AESDecrypt(dbConfig.Password);
|
||||
|
||||
//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;
|
||||
}
|
||||
|
||||
@ -26,6 +26,10 @@ namespace SolarPower.Models
|
||||
public string Text { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
public class SendData
|
||||
{
|
||||
public List<int> id { get; set; }
|
||||
}
|
||||
public class OperationCreatePlanModal : Created
|
||||
{
|
||||
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;
|
||||
var count = 0;
|
||||
@ -80,11 +80,25 @@ namespace SolarPower.Repository.Implement
|
||||
{
|
||||
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.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";
|
||||
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();
|
||||
}
|
||||
catch (Exception exception)
|
||||
|
||||
@ -651,16 +651,17 @@ namespace SolarPower.Repository.Implement
|
||||
/// <param name="DeviceInfo"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <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();
|
||||
var trans = conn.BeginTransaction();
|
||||
conn.Open();
|
||||
try
|
||||
{
|
||||
string sql = GenerateInsertQueryWithCustomTable(properties, "device");
|
||||
string sql = GenerateUpdateQueryWithCustomDBNameAndTable(properties,db_name, "device");
|
||||
|
||||
await conn.ExecuteAsync(sql, DeviceInfo);
|
||||
|
||||
trans.Commit();
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
@ -668,6 +669,7 @@ namespace SolarPower.Repository.Implement
|
||||
}
|
||||
finally
|
||||
{
|
||||
trans.Rollback();
|
||||
conn.Close();
|
||||
}
|
||||
|
||||
@ -678,14 +680,14 @@ namespace SolarPower.Repository.Implement
|
||||
/// <param name="DeviceInfo"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <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();
|
||||
conn.Open();
|
||||
var trans = conn.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var updateQuery = GenerateUpdateQueryWithCustomTable(properties, "device");
|
||||
var updateQuery = GenerateUpdateQueryWithCustomDBNameAndTable(properties,db_name, "device");
|
||||
await conn.ExecuteAsync(updateQuery.ToString(), DeviceInfo, trans);
|
||||
trans.Commit();
|
||||
}
|
||||
@ -704,14 +706,14 @@ namespace SolarPower.Repository.Implement
|
||||
/// </summary>
|
||||
/// <param name="stationId"></param>
|
||||
/// <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();
|
||||
conn.Open();
|
||||
List<DeviceTable> Device = new List<DeviceTable>();
|
||||
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();
|
||||
}
|
||||
catch (Exception exception)
|
||||
@ -729,7 +731,7 @@ namespace SolarPower.Repository.Implement
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<DeviceInfo> OneDeviceInfo(int id)
|
||||
public async Task<DeviceInfo> OneDeviceInfo(int id, string db_name)
|
||||
{
|
||||
using (IDbConnection conn = _databaseHelper.GetConnection())
|
||||
{
|
||||
@ -737,7 +739,7 @@ namespace SolarPower.Repository.Implement
|
||||
conn.Open();
|
||||
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 });
|
||||
}
|
||||
catch (Exception exception)
|
||||
@ -757,13 +759,13 @@ namespace SolarPower.Repository.Implement
|
||||
/// <param name="Exception"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <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();
|
||||
conn.Open();
|
||||
try
|
||||
{
|
||||
string sql = GenerateInsertQueryWithCustomTable(properties, "power_station_exception");
|
||||
string sql = GenerateUpdateQueryWithCustomDBNameAndTable(properties,db_name,"power_station_exception");
|
||||
|
||||
await conn.ExecuteAsync(sql, Exception);
|
||||
|
||||
@ -783,7 +785,7 @@ namespace SolarPower.Repository.Implement
|
||||
/// </summary>
|
||||
/// <param name="stationId"></param>
|
||||
/// <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();
|
||||
conn.Open();
|
||||
@ -791,8 +793,8 @@ namespace SolarPower.Repository.Implement
|
||||
try
|
||||
{
|
||||
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
|
||||
LEFT JOIN power_station ps ON pe.PowerStationId = ps.Id
|
||||
FROM {db_name}.power_station_exception pe
|
||||
LEFT JOIN {db_name}.power_station ps ON pe.PowerStationId = ps.Id
|
||||
WHERE pe.Deleted = 0 AND pe.PowerStationId = @StationId";
|
||||
Exception = (await conn.QueryAsync<ExceptionTable>(sql, new { StationId = stationId })).ToList();
|
||||
}
|
||||
@ -811,7 +813,7 @@ namespace SolarPower.Repository.Implement
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<ExceptionModal> OneException(int id)
|
||||
public async Task<ExceptionModal> OneException(int id, string db_name)
|
||||
{
|
||||
using (IDbConnection conn = _databaseHelper.GetConnection())
|
||||
{
|
||||
@ -819,7 +821,7 @@ namespace SolarPower.Repository.Implement
|
||||
conn.Open();
|
||||
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 });
|
||||
}
|
||||
catch (Exception exception)
|
||||
@ -839,14 +841,14 @@ namespace SolarPower.Repository.Implement
|
||||
/// <param name="Exception"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <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();
|
||||
conn.Open();
|
||||
var trans = conn.BeginTransaction();
|
||||
try
|
||||
{
|
||||
var updateQuery = GenerateUpdateQueryWithCustomTable(properties, "power_station_exception");
|
||||
var updateQuery = GenerateUpdateQueryWithCustomDBNameAndTable(properties,db_name,"power_station_exception");
|
||||
await conn.ExecuteAsync(updateQuery.ToString(), Exception, trans);
|
||||
trans.Commit();
|
||||
}
|
||||
@ -860,7 +862,7 @@ namespace SolarPower.Repository.Implement
|
||||
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;
|
||||
using IDbConnection conn = _databaseHelper.GetConnection();
|
||||
@ -868,7 +870,7 @@ namespace SolarPower.Repository.Implement
|
||||
var trans = conn.BeginTransaction();
|
||||
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 });
|
||||
trans.Commit();
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@ namespace SolarPower.Repository.Interface
|
||||
{
|
||||
Task<List<PowerStationIdList>> GetPowerStationIdList(int UserId);
|
||||
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 UpdateOperationPlan(OperationCreatePlan OperationPlan, List<string> properties);
|
||||
Task AddToRecord(PlanToRecord record, List<string> properties2);
|
||||
|
||||
@ -159,34 +159,34 @@ namespace SolarPower.Repository.Interface
|
||||
/// </summary>
|
||||
/// <param name=""></param>
|
||||
/// <returns></returns>
|
||||
Task AddDevice(Device DeviceInfo, List<string> properties);
|
||||
Task AddDevice(Device DeviceInfo, List<string> properties, string db_name);
|
||||
/// <summary>
|
||||
/// 修改 裝置
|
||||
/// </summary>
|
||||
/// <param name="DeviceInfo"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateDevice(Device DeviceInfo, List<string> properties);
|
||||
Task UpdateDevice(Device DeviceInfo, List<string> properties, string db_name);
|
||||
/// <summary>
|
||||
/// 設備datatable
|
||||
/// </summary>
|
||||
/// <param name="stationId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<DeviceTable>> DeviceTable(int stationId);
|
||||
Task<List<DeviceTable>> DeviceTable(int stationId, string db_name);
|
||||
|
||||
/// <summary>
|
||||
/// 異常datatable
|
||||
/// </summary>
|
||||
/// <param name="stationId"></param>
|
||||
/// <returns></returns>
|
||||
Task<List<ExceptionTable>> ExceptionTable(int stationId);
|
||||
Task<List<ExceptionTable>> ExceptionTable(int stationId, string db_name);
|
||||
|
||||
/// <summary>
|
||||
/// 取單一筆DeviceInfo
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<DeviceInfo> OneDeviceInfo(int id);
|
||||
Task<DeviceInfo> OneDeviceInfo(int id, string db_name);
|
||||
|
||||
/// <summary>
|
||||
/// 新增 異常設定
|
||||
@ -194,14 +194,14 @@ namespace SolarPower.Repository.Interface
|
||||
/// <param name="Exception"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <returns></returns>
|
||||
Task AddException(ExceptionModal Exception, List<string> properties);
|
||||
Task AddException(ExceptionModal Exception, List<string> properties, string db_name);
|
||||
|
||||
/// <summary>
|
||||
/// 取一筆異常設定
|
||||
/// </summary>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
Task<ExceptionModal> OneException(int id);
|
||||
Task<ExceptionModal> OneException(int id, string db_name);
|
||||
|
||||
/// <summary>
|
||||
/// 更新異常設定
|
||||
@ -209,7 +209,7 @@ namespace SolarPower.Repository.Interface
|
||||
/// <param name="Exception"></param>
|
||||
/// <param name="properties"></param>
|
||||
/// <returns></returns>
|
||||
Task UpdateException(ExceptionModal Exception, List<string> properties);
|
||||
Task UpdateException(ExceptionModal Exception, List<string> properties, string db_name);
|
||||
|
||||
/// <summary>
|
||||
/// 取最後一個設備流水號
|
||||
@ -217,7 +217,7 @@ namespace SolarPower.Repository.Interface
|
||||
/// <param name="PowerStationId"></param>
|
||||
/// <param name="Type"></param>
|
||||
/// <returns></returns>
|
||||
Task<string> GetFinalSerialNumber(int PowerStationId, string Type);
|
||||
Task<string> GetFinalSerialNumber(int PowerStationId, string Type, string db_name);
|
||||
|
||||
/// <summary>
|
||||
/// 透過電站編號,取得該電站的運維人員編號
|
||||
|
||||
@ -23,6 +23,20 @@
|
||||
<Content Remove="Views\Operation\_OperationPlanCreate.cshtml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Include="wwwroot\js\bower_components\jquery-table2excel\.bower.json" />
|
||||
<Content Include="wwwroot\js\bower_components\jquery-table2excel\bower.json" />
|
||||
<Content Include="wwwroot\js\bower_components\jquery-table2excel\demo\index.html" />
|
||||
<Content Include="wwwroot\js\bower_components\jquery-table2excel\package.json" />
|
||||
<Content Include="wwwroot\js\bower_components\jquery-table2excel\serve.json" />
|
||||
<Content Include="wwwroot\js\bower_components\jquery-table2excel\table2excel.jquery.json" />
|
||||
<Content Include="wwwroot\js\bower_components\jquery\.bower.json" />
|
||||
<Content Include="wwwroot\js\bower_components\jquery\AUTHORS.txt" />
|
||||
<Content Include="wwwroot\js\bower_components\jquery\bower.json" />
|
||||
<Content Include="wwwroot\js\bower_components\jquery\external\sizzle\LICENSE.txt" />
|
||||
<Content Include="wwwroot\js\bower_components\jquery\LICENSE.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Dapper" Version="2.0.78" />
|
||||
<PackageReference Include="MySql.Data" Version="8.0.24" />
|
||||
@ -101,6 +115,124 @@
|
||||
<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\bower_components\jquery-table2excel\.editorconfig" />
|
||||
<None Include="wwwroot\js\bower_components\jquery-table2excel\.gitignore" />
|
||||
<None Include="wwwroot\js\bower_components\jquery-table2excel\.gitpod.yml" />
|
||||
<None Include="wwwroot\js\bower_components\jquery-table2excel\.jshintrc" />
|
||||
<None Include="wwwroot\js\bower_components\jquery-table2excel\.travis.yml" />
|
||||
<None Include="wwwroot\js\bower_components\jquery-table2excel\CHANGELOG.md" />
|
||||
<None Include="wwwroot\js\bower_components\jquery-table2excel\CONTRIBUTING.md" />
|
||||
<None Include="wwwroot\js\bower_components\jquery-table2excel\demo\download.xls" />
|
||||
<None Include="wwwroot\js\bower_components\jquery-table2excel\dist\jquery.table2excel.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery-table2excel\dist\jquery.table2excel.min.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery-table2excel\Gruntfile.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery-table2excel\README.md" />
|
||||
<None Include="wwwroot\js\bower_components\jquery-table2excel\src\jquery.table2excel.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery-table2excel\yarn.lock" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\dist\jquery.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\dist\jquery.min.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\dist\jquery.min.map" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\external\sizzle\dist\sizzle.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\external\sizzle\dist\sizzle.min.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\external\sizzle\dist\sizzle.min.map" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\README.md" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\.jshintrc" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\ajax.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\ajax\jsonp.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\ajax\load.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\ajax\parseJSON.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\ajax\parseXML.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\ajax\script.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\ajax\var\location.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\ajax\var\nonce.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\ajax\var\rquery.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\ajax\xhr.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\attributes.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\attributes\attr.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\attributes\classes.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\attributes\prop.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\attributes\support.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\attributes\val.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\callbacks.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\core.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\core\access.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\core\init.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\core\parseHTML.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\core\ready.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\core\var\rsingleTag.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\css.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\css\addGetHookIf.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\css\adjustCSS.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\css\curCSS.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\css\defaultDisplay.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\css\hiddenVisibleSelectors.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\css\showHide.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\css\support.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\css\var\cssExpand.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\css\var\getStyles.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\css\var\isHidden.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\css\var\rmargin.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\css\var\rnumnonpx.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\css\var\swap.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\data.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\data\Data.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\data\var\acceptData.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\data\var\dataPriv.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\data\var\dataUser.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\deferred.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\deprecated.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\dimensions.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\effects.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\effects\animatedSelector.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\effects\Tween.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\event.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\event\ajax.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\event\alias.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\event\focusin.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\event\support.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\event\trigger.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\exports\amd.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\exports\global.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\intro.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\jquery.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\manipulation.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\manipulation\buildFragment.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\manipulation\getAll.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\manipulation\setGlobalEval.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\manipulation\support.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\manipulation\var\rcheckableType.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\manipulation\var\rscriptType.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\manipulation\var\rtagName.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\manipulation\wrapMap.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\manipulation\_evalUrl.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\offset.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\outro.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\queue.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\queue\delay.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\selector-native.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\selector-sizzle.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\selector.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\serialize.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\traversing.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\traversing\findFilter.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\traversing\var\dir.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\traversing\var\rneedsContext.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\traversing\var\siblings.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\var\arr.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\var\class2type.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\var\concat.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\var\document.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\var\documentElement.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\var\hasOwn.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\var\indexOf.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\var\pnum.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\var\push.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\var\rcssNum.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\var\rnotwhite.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\var\slice.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\var\support.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\var\toString.js" />
|
||||
<None Include="wwwroot\js\bower_components\jquery\src\wrap.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" />
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
@using SolarPower.Models.Role
|
||||
@model RoleLayerEnum
|
||||
|
||||
|
||||
<ol class="breadcrumb page-breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="javascript:void(0);">系統管理</a></li>
|
||||
<li class="breadcrumb-item active">定期計畫建立</li>
|
||||
@ -26,9 +27,9 @@
|
||||
<div class="row mb-3 px-3">
|
||||
<div class="pr-3">
|
||||
<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-secondary waves-effect waves-themed">巡檢</button>
|
||||
<button type="button" class="btn btn-secondary 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" onclick="ChangeType(1)" id="button1">巡檢</button>
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed" onclick="ChangeType(0)" id="button0">清洗</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -38,12 +39,12 @@
|
||||
<button type="button" class="btn btn-secondary waves-effect waves-themed">全部縣市</button>
|
||||
</div>
|
||||
<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">
|
||||
新北市
|
||||
<span class="badge bg-success-700 ml-2">4</span>
|
||||
</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>
|
||||
</button>
|
||||
@ -58,7 +59,10 @@
|
||||
<button type="button" class="btn btn-outline-success waves-effect waves-themed">
|
||||
台中市
|
||||
<span class="badge bg-success-700 ml-2">4</span>
|
||||
</button>
|
||||
</button>*@
|
||||
</div>
|
||||
<div class="frame-wrap" id="city">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -98,7 +102,7 @@
|
||||
</div>
|
||||
|
||||
<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>
|
||||
匯出
|
||||
</button>
|
||||
@ -126,6 +130,34 @@
|
||||
<tbody>
|
||||
</tbody>
|
||||
</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>
|
||||
@ -236,8 +268,11 @@
|
||||
|
||||
|
||||
@section Scripts{
|
||||
|
||||
|
||||
<script>
|
||||
var selected_id = 0;
|
||||
var type = 9;
|
||||
$(function () {
|
||||
//#region 電站下拉式選單select_option
|
||||
var url_operation_select_option = "/Operation/GetPowerStationSelectOption";
|
||||
@ -321,7 +356,8 @@
|
||||
"url": "/Operation/OperationPlanTable",
|
||||
"type": "POST",
|
||||
"data": function (d) {
|
||||
d.id = [1,2];
|
||||
d.id = [1, 2],
|
||||
d.type = type
|
||||
},
|
||||
"dataSrc": function (rel) {
|
||||
if (rel.data.code == "9999") {
|
||||
@ -337,7 +373,61 @@
|
||||
}
|
||||
});
|
||||
//#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 新增計畫基本資料
|
||||
function AddOperationPlan() {
|
||||
|
||||
@ -453,5 +543,43 @@
|
||||
|
||||
});
|
||||
//#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>
|
||||
|
||||
}
|
||||
@ -1541,7 +1541,8 @@
|
||||
var url = "/PowerStation/GetOneDevice/";
|
||||
|
||||
var send_data = {
|
||||
id: selected_id
|
||||
SelectedId: selected_id,
|
||||
PowerStationId: stationId,
|
||||
}
|
||||
|
||||
|
||||
@ -1581,7 +1582,8 @@
|
||||
if (result.value) {
|
||||
var url = "/PowerStation/DeleteOneDevice/";
|
||||
var send_data = {
|
||||
Id: selected_id
|
||||
SelectedId: selected_id,
|
||||
PowerStationId: stationId
|
||||
}
|
||||
$.post(url, send_data, function (rel) {
|
||||
if (rel.code != "0000") {
|
||||
@ -1645,7 +1647,8 @@
|
||||
var url = "/PowerStation/GetOneException/";
|
||||
|
||||
var send_data = {
|
||||
id: selected_id
|
||||
SelectedId: selected_id,
|
||||
PowerStationId: stationId,
|
||||
}
|
||||
|
||||
|
||||
@ -1683,7 +1686,8 @@
|
||||
if (result.value) {
|
||||
var url = "/PowerStation/DeleteOneException/";
|
||||
var send_data = {
|
||||
Id: selected_id
|
||||
SelectedId: selected_id,
|
||||
PowerStationId: stationId,
|
||||
}
|
||||
$.post(url, send_data, function (rel) {
|
||||
if (rel.code == "9999") {
|
||||
|
||||
@ -1134,7 +1134,6 @@
|
||||
<script src="~/js/notifications/toastr/toastr.js"></script>
|
||||
<!--Toast-->
|
||||
<script src="~/js/toast.js"></script>
|
||||
|
||||
<!-- Select2 JS -->
|
||||
@*<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>*@
|
||||
<script src="~/js/formplugins/select2/select2.bundle.js"></script>
|
||||
@ -1142,7 +1141,7 @@
|
||||
<script src="~/js/formplugins/dropzone/dropzone.js"></script>
|
||||
<!-- Custome JS -->
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
|
||||
<script src="~/js/bower_components/jquery-table2excel/dist/jquery.table2excel.min.js"></script>
|
||||
|
||||
|
||||
@*各頁面的JavaScript*@
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
@{
|
||||
ViewData["MainNum"] = "6";
|
||||
ViewData["MainNum"] = "7";
|
||||
ViewData["SubNum"] = "3";
|
||||
ViewData["Title"] = "帳號管理";
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user