Merge branch 'master' of https://github.com/shanghohui-Company/SolarPower
This commit is contained in:
commit
a8ca32f96c
@ -99,11 +99,11 @@ namespace SolarPower.Models
|
|||||||
public string UpdatedAt { get { return Convert.ToDateTime(updatedAt).ToString("yyyy-MM-dd HH:mm:ss"); } set { updatedAt = value; } } //修改時間
|
public string UpdatedAt { get { return Convert.ToDateTime(updatedAt).ToString("yyyy-MM-dd HH:mm:ss"); } set { updatedAt = value; } } //修改時間
|
||||||
private string lastCreateTime;
|
private string lastCreateTime;
|
||||||
public string LastCreateTime { get { return Convert.ToDateTime(lastCreateTime).ToString("yyyy-MM-dd HH:mm:ss"); } set { lastCreateTime = value; } }
|
public string LastCreateTime { get { return Convert.ToDateTime(lastCreateTime).ToString("yyyy-MM-dd HH:mm:ss"); } set { lastCreateTime = value; } }
|
||||||
|
public string PowerStationName { get; set; }
|
||||||
}
|
}
|
||||||
public class OperationPlanTable : OperationCreatePlan
|
public class OperationPlanTable : OperationCreatePlan
|
||||||
{
|
{
|
||||||
public string TypeName { get; set; }
|
public string TypeName { get; set; }
|
||||||
public string PowerStationName { get; set; }
|
|
||||||
public string Schedule { get; set; }
|
public string Schedule { get; set; }
|
||||||
public string EmailTypeName { get; set; }
|
public string EmailTypeName { get; set; }
|
||||||
public string CreatedPerson { get; set; }
|
public string CreatedPerson { get; set; }
|
||||||
|
|||||||
@ -158,7 +158,7 @@ namespace SolarPower.Quartz.Jobs
|
|||||||
{
|
{
|
||||||
//Get所有運維人員
|
//Get所有運維人員
|
||||||
var personal = await operationRepository.GetOperationPersonnel(a.PowerStationId);
|
var personal = await operationRepository.GetOperationPersonnel(a.PowerStationId);
|
||||||
var Title = $@"編號:{a.PlanId} - {WorkType}單 - 作業紀錄建立通知";
|
var Title = $@"電站:{a.PowerStationName} - {WorkType}單 - 編號:{a.PlanId}";
|
||||||
var content = $@" {noticeName} {Environment.NewLine} 內容描述:{a.Description}";
|
var content = $@" {noticeName} {Environment.NewLine} 內容描述:{a.Description}";
|
||||||
await operationRepository.InsertNoticeSchedule(personal, Title, content);
|
await operationRepository.InsertNoticeSchedule(personal, Title, content);
|
||||||
|
|
||||||
|
|||||||
@ -604,7 +604,8 @@ namespace SolarPower.Repository.Implement
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var sql = @$"SELECT * FROM operation_plan_create opc
|
var sql = @$"SELECT opc.*,ps.Name AS PowerStationName FROM operation_plan_create opc
|
||||||
|
LEFT JOIN power_station ps ON opc.PowerStationId = ps.Id
|
||||||
WHERE opc.Deleted = 0";
|
WHERE opc.Deleted = 0";
|
||||||
result = (await conn.QueryAsync<OperationCreatePlan>(sql)).ToList();
|
result = (await conn.QueryAsync<OperationCreatePlan>(sql)).ToList();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -148,15 +148,16 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label" for="power_station_select_modal">電站</label>
|
<label class="form-label" for="power_station_select_modal"><span class="text-danger">*</span>電站</label>
|
||||||
<select class="form-control" id="power_station_select_modal">
|
<select class="form-control" id="power_station_select_modal">
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label" for="work_time_modal">作業日期</label>
|
<label class="form-label" for="work_time_modal"><span class="text-danger">*</span>作業日期</label>
|
||||||
<input class="form-control" id="work_time_modal" type="date" name="work_time_modal" />
|
<input class="form-control" id="work_time_modal" type="date" name="work_time_modal" />
|
||||||
|
<label id="work_time_modal-error" class="" style="z-index:1;color:red;display:none">此為必填欄位</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -164,7 +165,7 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-label" for="example-select">狀態</label>
|
<label class="form-label" for="example-select"><span class="text-danger">*</span>狀態</label>
|
||||||
<div>
|
<div>
|
||||||
<div class="custom-control custom-radio custom-control-inline">
|
<div class="custom-control custom-radio custom-control-inline">
|
||||||
<input type="radio" class="custom-control-input ml-auto" id="status_none_complete" name="status_modal" value="0" />
|
<input type="radio" class="custom-control-input ml-auto" id="status_none_complete" name="status_modal" value="0" />
|
||||||
@ -179,9 +180,10 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="col-lg-6">
|
<div class="col-lg-6">
|
||||||
<div class="">
|
<div class="">
|
||||||
<label class="form-label" for="work_person_select_modal">執行人員</label>
|
<label class="form-label" for="work_person_select_modal"><span class="text-danger">*</span>執行人員</label>
|
||||||
<select class="form-control" id="work_person_select_modal" multiple="multiple">
|
<select class="form-control" id="work_person_select_modal" multiple="multiple">
|
||||||
</select>
|
</select>
|
||||||
|
<label id="work_person_select_modal-error" class="" style="z-index:1;color:red;display:none">此為必填欄位</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -291,6 +293,7 @@
|
|||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
//#region Date-Picker
|
//#region Date-Picker
|
||||||
|
|
||||||
datepicker = $('#date-range').daterangepicker({
|
datepicker = $('#date-range').daterangepicker({
|
||||||
autoUpdateInput: false,
|
autoUpdateInput: false,
|
||||||
locale: { format: 'YYYY/MM/DD' },
|
locale: { format: 'YYYY/MM/DD' },
|
||||||
@ -597,6 +600,20 @@
|
|||||||
//#endregion
|
//#endregion
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$('#work_person_select_modal').change(function () {
|
||||||
|
if ($('#work_person_select_modal').val().length == 0) {
|
||||||
|
$('#work_person_select_modal-error').show();
|
||||||
|
} else {
|
||||||
|
$('#work_person_select_modal-error').hide();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#work_time_modal').change(function () {
|
||||||
|
$("#work_time_modal-error").hide();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getPowerStationCheckBox() {
|
function getPowerStationCheckBox() {
|
||||||
var send_data = {
|
var send_data = {
|
||||||
cityIds: ids
|
cityIds: ids
|
||||||
@ -685,8 +702,9 @@
|
|||||||
$("#record-form").trigger("reset");
|
$("#record-form").trigger("reset");
|
||||||
$("input[name=status_modal][value='" + 0 + "']").prop('checked', true); //狀態
|
$("input[name=status_modal][value='" + 0 + "']").prop('checked', true); //狀態
|
||||||
$("#record_files_div > .row").empty();
|
$("#record_files_div > .row").empty();
|
||||||
|
|
||||||
|
|
||||||
|
$('#work_person_select_modal-error').hide();
|
||||||
|
$("#work_time_modal-error").hide();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1029,7 +1047,7 @@
|
|||||||
//#region 表單驗證
|
//#region 表單驗證
|
||||||
$("#record-form").validate({
|
$("#record-form").validate({
|
||||||
rules: {
|
rules: {
|
||||||
work_person_select_modal: {
|
work_time_modal: {
|
||||||
required: true
|
required: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1038,70 +1056,82 @@
|
|||||||
|
|
||||||
//#region 儲存表單資料
|
//#region 儲存表單資料
|
||||||
function SaveRecord() {
|
function SaveRecord() {
|
||||||
Swal.fire(
|
if ($('#work_person_select_modal').val().length > 0 && $("#work_time_modal").val() != "") {
|
||||||
{
|
Swal.fire(
|
||||||
title: "儲存",
|
{
|
||||||
text: "你確定是否儲存此筆資料?\r\n 儲存成功後將會發送Email至負責人員及廠商",
|
title: "儲存",
|
||||||
type: "warning",
|
text: "你確定是否儲存此筆資料?\r\n 儲存成功後將會發送Email至負責人員及廠商",
|
||||||
icon: 'warning',
|
type: "warning",
|
||||||
showCancelButton: true,
|
icon: 'warning',
|
||||||
confirmButtonText: "是",
|
showCancelButton: true,
|
||||||
cancelButtonText: "否"
|
confirmButtonText: "是",
|
||||||
}).then(function (result) {
|
cancelButtonText: "否"
|
||||||
if (result.value) {
|
}).then(function (result) {
|
||||||
if ($("#record-form").valid()) {
|
if (result.value) {
|
||||||
var url = "/Operation/SaveOperationRecord";
|
if ($("#record-form").valid()) {
|
||||||
|
var url = "/Operation/SaveOperationRecord";
|
||||||
|
|
||||||
var formData = new FormData();
|
var formData = new FormData();
|
||||||
|
|
||||||
@*var work_person_ids = $.map($("#work_person_select_modal").val(), function (item) {
|
@*var work_person_ids = $.map($("#work_person_select_modal").val(), function (item) {
|
||||||
return parseInt(item);
|
return parseInt(item);
|
||||||
}) *@
|
}) *@
|
||||||
|
|
||||||
formData.append("Id", selected_id);
|
formData.append("Id", selected_id);
|
||||||
formData.append("PowerStationId", $("#power_station_select_modal").val());
|
formData.append("PowerStationId", $("#power_station_select_modal").val());
|
||||||
formData.append("WorkType", selected_work_type);
|
formData.append("WorkType", selected_work_type);
|
||||||
formData.append("ErrorCode", $("#error_code_modal").val());
|
formData.append("ErrorCode", $("#error_code_modal").val());
|
||||||
formData.append("FixDo", $("#fix_do_modal").val());
|
formData.append("FixDo", $("#fix_do_modal").val());
|
||||||
formData.append("FixFirm", $("#fix_firm_select_modal").val());
|
formData.append("FixFirm", $("#fix_firm_select_modal").val());
|
||||||
formData.append("Status", $("input[name=status_modal]:checked").val());
|
formData.append("Status", $("input[name=status_modal]:checked").val());
|
||||||
$("#work_person_select_modal").val().forEach(function (item) {
|
$("#work_person_select_modal").val().forEach(function (item) {
|
||||||
formData.append("WorkPersonIds", parseInt(item));
|
formData.append("WorkPersonIds", parseInt(item));
|
||||||
});
|
});
|
||||||
formData.append("WorkTime", $("#work_time_modal").val());
|
formData.append("WorkTime", $("#work_time_modal").val());
|
||||||
formData.append("Notice", $("#notice_textarea_modal").val());
|
formData.append("Notice", $("#notice_textarea_modal").val());
|
||||||
formData.append("Description", $("#description_textarea_modal").val());
|
formData.append("Description", $("#description_textarea_modal").val());
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: url,
|
url: url,
|
||||||
data: formData,
|
data: formData,
|
||||||
cache: false,
|
cache: false,
|
||||||
contentType: false,
|
contentType: false,
|
||||||
processData: false,
|
processData: false,
|
||||||
success: function (rel) {
|
success: function (rel) {
|
||||||
if (rel.code != "0000") {
|
if (rel.code != "0000") {
|
||||||
toast_error(rel.msg);
|
toast_error(rel.msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var myDropzone = Dropzone.forElement("#record-file-form");
|
var myDropzone = Dropzone.forElement("#record-file-form");
|
||||||
|
|
||||||
if (myDropzone.files.length > 0) {
|
if (myDropzone.files.length > 0) {
|
||||||
|
|
||||||
selected_id = rel.data;
|
selected_id = rel.data;
|
||||||
|
|
||||||
myDropzone.processQueue();
|
myDropzone.processQueue();
|
||||||
|
|
||||||
myDropzone.on("successmultiple", function (file, rel) {
|
myDropzone.on("successmultiple", function (file, rel) {
|
||||||
if (rel.code != "0000") {
|
if (rel.code != "0000") {
|
||||||
toast_error(rel.msg);
|
toast_error(rel.msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
toast_ok(rel.msg);
|
toast_ok(rel.msg);
|
||||||
|
$('#record-form-modal').modal('hide');
|
||||||
|
recordFileDropzone.removeAllFiles();
|
||||||
|
if (status == 2) {
|
||||||
|
operationRecordTable.column(10).visible(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
operationRecordTable.column(10).visible(false);
|
||||||
|
}
|
||||||
|
operationRecordTable.ajax.reload();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
$('#record-form-modal').modal('hide');
|
$('#record-form-modal').modal('hide');
|
||||||
recordFileDropzone.removeAllFiles();
|
myDropzone.removeAllFiles();
|
||||||
if (status == 2) {
|
if (status == 2) {
|
||||||
operationRecordTable.column(10).visible(true);
|
operationRecordTable.column(10).visible(true);
|
||||||
}
|
}
|
||||||
@ -1109,29 +1139,25 @@
|
|||||||
operationRecordTable.column(10).visible(false);
|
operationRecordTable.column(10).visible(false);
|
||||||
}
|
}
|
||||||
operationRecordTable.ajax.reload();
|
operationRecordTable.ajax.reload();
|
||||||
});
|
|
||||||
} else {
|
|
||||||
$('#record-form-modal').modal('hide');
|
|
||||||
myDropzone.removeAllFiles();
|
|
||||||
if (status == 2) {
|
|
||||||
operationRecordTable.column(10).visible(true);
|
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
operationRecordTable.column(10).visible(false);
|
|
||||||
}
|
|
||||||
operationRecordTable.ajax.reload();
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($('#work_person_select_modal').val().length == 0)
|
||||||
|
{
|
||||||
|
$('#work_person_select_modal-error').show();
|
||||||
|
}
|
||||||
|
if ($("#work_time_modal").val() == "")
|
||||||
|
{
|
||||||
|
$("#work_time_modal-error").show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//#endregion
|
//#endregion
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user