diff --git a/SolarPower/Controllers/OperationController.cs b/SolarPower/Controllers/OperationController.cs index 2ddb184..9a00d89 100644 --- a/SolarPower/Controllers/OperationController.cs +++ b/SolarPower/Controllers/OperationController.cs @@ -540,6 +540,7 @@ namespace SolarPower.Controllers WorkType = (int)OperationRecodeWorkTypeEnum.Fix, ErrorCode = post.ErrorCode, FixDo = post.FixDo, + FixFirm = post.FixFirm, Status = post.Status, WorkPersonId = post.WorkPersonId, FinishTime = finishTime, @@ -557,6 +558,7 @@ namespace SolarPower.Controllers "WorkType", "ErrorCode", "FixDo", + "FixFirm", "Status", "WorkPersonId", "FinishTime", @@ -609,6 +611,7 @@ namespace SolarPower.Controllers Id = post.Id, ErrorCode = post.ErrorCode, FixDo = post.FixDo, + FixFirm = post.FixFirm, Status = post.Status, FinishTime = !string.IsNullOrEmpty(finishTime) ? finishTime : null, WorkPersonId = post.WorkPersonId, @@ -625,6 +628,7 @@ namespace SolarPower.Controllers "Id", "ErrorCode", "FixDo", + "FixFirm", "Status", "FinishTime", "WorkTime", diff --git a/SolarPower/DBSchema/solar_power_schema.sql b/SolarPower/DBSchema/solar_power_schema.sql index a7e41be..f84046d 100644 --- a/SolarPower/DBSchema/solar_power_schema.sql +++ b/SolarPower/DBSchema/solar_power_schema.sql @@ -2159,6 +2159,10 @@ ALTER TABLE `device` ADD COLUMN `WarrantyDate` TIMESTAMP NULL DEFAULT NULL COMMENT '保固日期' AFTER `InstallDate`, ADD COLUMN `BrandNum` VARCHAR(50) NULL DEFAULT NULL COMMENT '廠商序號' AFTER `Brand`; +-- 新增運維作業紀錄加入廠商 20210825 +ALTER TABLE `operation_record` + ADD COLUMN `FixFirm` INT(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '負責廠商' AFTER `FixDo`; + /*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; /*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */; diff --git a/SolarPower/Models/Operation.cs b/SolarPower/Models/Operation.cs index d0bf3a1..84e0401 100644 --- a/SolarPower/Models/Operation.cs +++ b/SolarPower/Models/Operation.cs @@ -134,6 +134,7 @@ namespace SolarPower.Models public byte WorkType { get; set; } public string ErrorCode { get; set; } public string FixDo { get; set; } + public byte FixFirm { get; set; } public byte Status { get; set; } public int WorkPersonId { get; set; } public string StartTime @@ -281,6 +282,7 @@ namespace SolarPower.Models public byte WorkType { get; set; } public string ErrorCode { get; set; } public string FixDo { get; set; } + public byte FixFirm { get; set; } public byte Status { get; set; } public int WorkPersonId { get; set; } public string StartTime { get; set; }//開始時間 @@ -298,6 +300,7 @@ namespace SolarPower.Models public string SerialNumber { get; set; } public string ErrorCode { get; set; } public string FixDo { get; set; } + public byte FixFirm { get; set; } public byte Status { get; set; } public int WorkPersonId { get; set; } public string FinishTime { get; set; } // 完成時間 diff --git a/SolarPower/Repository/Implement/PowerStationRepository.cs b/SolarPower/Repository/Implement/PowerStationRepository.cs index 5abf259..d5f325b 100644 --- a/SolarPower/Repository/Implement/PowerStationRepository.cs +++ b/SolarPower/Repository/Implement/PowerStationRepository.cs @@ -1569,19 +1569,18 @@ namespace SolarPower.Repository.Implement } } - public async Task> GetFirmlSelectOptionListAsync(int powerStationId) + public async Task> GetFimlSelectOptionListAsync(int powerStationId, string siteDB) { List result; using (IDbConnection conn = this._databaseHelper.GetConnection()) { try { - var sql = @$"SELECT u.Id AS Value, u.Name AS Text - FROM power_station_operation_personnel op - LEFT JOIN user u ON op.UserId = u.Id - WHERE op.Deleted = 0 AND op.PowerStationId = @PowerStationId"; + var sql = @$"SELECT aa.Id AS Value, aa.Name AS Text + FROM {siteDB}.operation_firm aa + WHERE aa.Deleted = 0 AND aa.PowerStationId = @PowerStationId"; - result = (await conn.QueryAsync(sql, new { PowerStationId = powerStationId })).ToList(); + result = (await conn.QueryAsync(sql, new { PowerStationId = powerStationId })).ToList(); } catch (Exception exception) { diff --git a/SolarPower/Views/Operation/OperationRecord.cshtml b/SolarPower/Views/Operation/OperationRecord.cshtml index f2a269b..313c5f1 100644 --- a/SolarPower/Views/Operation/OperationRecord.cshtml +++ b/SolarPower/Views/Operation/OperationRecord.cshtml @@ -204,7 +204,7 @@
- +
@@ -398,17 +398,15 @@ return; } - $("#work_person_select_modal").empty(); + $("#fix_firm_select_modal").empty(); if (rel.data.length > 0) { $.each(rel.data, function (index, val) { - $("#work_person_select_modal").append($("