This commit is contained in:
2024-03-26 15:56:31 +08:00
parent 634e8b71ab
commit 0855ae42cd
547 changed files with 94818 additions and 60463 deletions

View File

@ -1,44 +1,12 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Maintenance/MaintenanceBase.master" AutoEventWireup="true" CodeFile="AlertsManagement.aspx.cs" Inherits="Maintenance_AlertsManagement" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link href="../css/jquery.datetimepicker.css" rel="stylesheet" />
<style type="text/css">
.selectinput {
width: 150px;
margin-right: 10px;
}
.dialog-content table {
border-collapse: collapse;
width: 100%;
}
.dialog-content table td.label {
width: 150px;
text-align: right;
padding-right: 10px;
line-height: 24px;
height: 24px;
vertical-align: top;
}
.dialog-content table td input,
.dialog-content table td textarea {
border: 1px solid #a9a9a9;
width: 400px;
height: 18px;
padding: 1px;
}
.dialog-content table td select {
width: 403px;
}
.dialog-content table td input[type="checkbox"] {
border: none;
}
#dialogdatatb td {
padding-top: 5px;
}
@ -64,10 +32,6 @@
/*font-size: 10px;*/
}
.div_filter .dropdown {
width: 100px;
}
.assettr {
background: #f1f4f8;
}
@ -132,7 +96,6 @@
width: unset;
}
</style>
<script src="<%=GetFileUrlWithVersion("../js/jquery.datetimepicker.full.js")%>" type="text/javascript"></script>
<script src="<%=GetFileUrlWithVersion("js/inputdatactr.js")%>" type="text/javascript"></script>
<script type="text/javascript">
var CanEditWorkOrder = <%=CanEditWorkOrder?"true":"false"%>;
@ -146,16 +109,17 @@
var selectedAlerts = [];//已选择的AlertID
var selectedAlertData = [];//已选择的Alert
var selectedAssetGroups = [];
var alerttypeparam;
var assetgroupparam;
var alertstatusparam;
var jobsitesparam;
var isalertview = true;
var isacknowledgingalerts = false;
var tabIndex = 0;
var assetid = "<%=AssetID %>";
var AlertViewApiAddress = "<%=AlertViewApiAddress%>";
var AssetViewApiAddress = "<%=AssetViewApiAddress%>";
var AcknowledgedApiAddress = "<%=AcknowledgedApiAddress%>";
var CompanyID = "<%=CompanyID%>";
function alertrequest(method, param, callback, error) {
_network.request("Maintenance/AlertsManagement.aspx", -1, method, param, callback, error || function (e) {
console.log(e);
@ -172,25 +136,39 @@
});
}
var SPLIT_CHAR175 = String.fromCharCode(175);
var SPLIT_CHAR180 = String.fromCharCode(180);
var SPLIT_CHAR181 = String.fromCharCode(181);
var SPLIT_CHAR182 = String.fromCharCode(182);
var SPLIT_CHAR183 = String.fromCharCode(183);
function GetAlerts() {
if (AlertViewApiAddress) {
GetAlerts1();
return;
}
var begindate = $('#txtbegindate').val();
var enddate = $('#txtenddate').val();
if (begindate && !$('#txtbegindate').is(':valid')) {
showAlert(GetTextByKey('P_COMMON_BEGINDATEISINVALID', "The begin date is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (enddate && !$('#txtenddate').is(':valid')) {
showAlert(GetTextByKey('P_COMMON_ENDDATEISINVALID', "The end date is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (begindate && enddate && begindate > enddate) {
showAlert(GetTextByKey("P_JS_ENDDATEMUSTBELATERTHANBEGINDATE", "End Date must be later than Begin Date."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
showloading(true);
$('#chk_all_ackalert').prop('checked', false);
var searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
//var showCompleted = $('#chkShowCompleted').prop("checked") ? 1 : 0;
var beginDate = $('#txtbegindate').val();
var endDate = $('#txtenddate').val();
var alerttypes = [];
var assetgroups = [];
var alertstatus = [];
var jobsites = [];
if (alerttypeparam)
alerttypes = alerttypeparam.selectedvalue;
if (assetgroupparam)
assetgroups = assetgroupparam.selectedvalue;
if (alertstatusparam)
alertstatus = alertstatusparam.selectedvalue;
if (jobsitesparam)
jobsites = jobsitesparam.selectedvalue;
var alerttypes = $('#div_alerttype').dropdownVals();
var assetgroups = $('#div_assetgroup').dropdownVals();
var alertstatus = $('#div_alertstatus').dropdownVals();
var jobsites = $('#div_jobsites').dropdownVals();
var category = $('#div_categorys').dropdownVals();
var item = {
AssetID: assetid == "" ? -1 : eval(assetid),
SearchText: searchtxt,
@ -198,8 +176,9 @@
AssetGroups: assetgroups,
AlertTypes: alerttypes,
JobSites: jobsites,
BeginDate: beginDate,
EndDate: endDate,
Category: category,
BeginDate: begindate,
EndDate: enddate,
IncludeunCompleted: $('#chk_includeuncompleted').prop("checked"),
}
@ -207,12 +186,12 @@
$('#alertviewlist').data("dataloaded", true);
alertrequest("GETALERTS", JSON.stringify(item), function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
if (typeof (data) !== "string") {
showAlert(data[0], GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
if (data && data.length > 0)
allalertdata = data;
if (data !== "")
allalertdata = ConvertAlertInfos(data);
else
allalertdata = [];
@ -226,12 +205,12 @@
alertrequest("GETMACHINEALERTS", JSON.stringify(item), function (data) {
showloading(false);
$('#tbody_alerts').empty();
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
if (typeof (data) !== "string") {
showAlert(data[0], GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
if (data && data.length > 0)
allmachinealertdata = data;
if (data !== "")
allmachinealertdata = ConvertMachineInfoForAlert(data);
else
allmachinealertdata = [];
@ -246,12 +225,12 @@
$('#acknowledgedalertslist').data("dataloaded", true);
alertrequest("GetAcknowledgedAlerts", JSON.stringify(item), function (data) {
showloading(false);
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
if (typeof (data) !== "string") {
showAlert(data[0], GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
if (data && data.length > 0)
allAcknowledgedalertdata = data;
if (data !== "")
allAcknowledgedalertdata = ConvertAlertInfos(data);
else
allAcknowledgedalertdata = [];
@ -262,6 +241,190 @@
}
}
function GetAlerts1() {
var begindate = $('#txtbegindate').val();
var enddate = $('#txtenddate').val();
if (begindate && !$('#txtbegindate').is(':valid')) {
showAlert(GetTextByKey('P_COMMON_BEGINDATEISINVALID', "The begin date is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (enddate && !$('#txtenddate').is(':valid')) {
showAlert(GetTextByKey('P_COMMON_ENDDATEISINVALID', "The end date is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (begindate && enddate && begindate > enddate) {
showAlert(GetTextByKey("P_JS_ENDDATEMUSTBELATERTHANBEGINDATE", "End Date must be later than Begin Date."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
showloading(true);
$('#chk_all_ackalert').prop('checked', false);
var searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
//var showCompleted = $('#chkShowCompleted').prop("checked") ? 1 : 0;
var alerttypes = $('#div_alerttype').dropdownVals();
var assetgroups = $('#div_assetgroup').dropdownVals();
var alertstatus = $('#div_alertstatus').dropdownVals();
var jobsites = $('#div_jobsites').dropdownVals();
var category = $('#div_categorys').dropdownVals();
var item = {
AssetID: assetid == "" ? -1 : eval(assetid),
SearchText: searchtxt,
AlertStatus: alertstatus,
AssetGroups: assetgroups,
AlertTypes: alerttypes,
JobSites: jobsites,
Category: category,
BeginDate: begindate,
EndDate: enddate,
IncludeunCompleted: $('#chk_includeuncompleted').prop("checked"),
}
if (tabIndex == 0) {
$('#alertviewlist').data("dataloaded", true);
_network.apipost(AlertViewApiAddress, CompanyID, item, function (data) {
showloading(false);
if (typeof (data) !== "string") {
showAlert(data[0], GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
if (data !== "")
allalertdata = ConvertAlertInfos(data);
else
allalertdata = [];
showAlerts(allalertdata);
}, function (err) {
showloading(false);
});
}
else if (tabIndex == 1) {
$('#machineviewlist').data("dataloaded", true);
_network.apipost(AssetViewApiAddress, CompanyID, item, function (data) {
showloading(false);
$('#tbody_alerts').empty();
if (typeof (data) !== "string") {
showAlert(data[0], GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
if (data !== "")
allmachinealertdata = ConvertMachineInfoForAlert(data);
else
allmachinealertdata = [];
sortTableData($('#tbRecordList'), allmachinealertdata);
showMachineAlerts(allmachinealertdata);
}, function (err) {
console.log(err);
showloading(false);
});
}
else {
$('#acknowledgedalertslist').data("dataloaded", true);
_network.apipost(AcknowledgedApiAddress, CompanyID, item, function (data) {
showloading(false);
if (typeof (data) !== "string") {
showAlert(data[0], GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
if (data !== "")
allAcknowledgedalertdata = ConvertAlertInfos(data);
else
allAcknowledgedalertdata = [];
showAcknowledgedAlerts(allAcknowledgedalertdata);
}, function (err) {
showloading(false);
});
}
}
function ConvertMachineInfoForAlert(str) {
var machinealerts = [];
var arrays = str.split(SPLIT_CHAR183);
if (arrays && arrays.length > 0) {
for (var i = 0; i < arrays.length; i++) {
var array = arrays[i].split(SPLIT_CHAR182);
var mi = {};
mi.MachineID = parseInt(array[0]);
mi.VIN = array[1];
mi.MachineName = array[2];
mi.Make = array[3];
mi.Model = array[4];
mi.EngineHours = parseFloat(array[5]);
mi.DTCAlertCount = parseInt(array[6]);
mi.PMAlertCount = parseInt(array[7]);
mi.InspectAlertCount = parseInt(array[8]);
mi.OpenWorkOrders = parseInt(array[9]);
mi.LatestAlertDateTime = array[10];
mi.LatestAlertDateTimeStr = array[11];
var alertsstr = array[12];
if (alertsstr !== "") {
mi.Alerts = ConvertAlertInfos(alertsstr);
}
machinealerts.push(mi);
}
}
return machinealerts;
}
function ConvertAlertInfos(str) {
var alerts = [];
var arrays = str.split(SPLIT_CHAR180);
if (arrays && arrays.length > 0) {
for (var i = 0; i < arrays.length; i++) {
var array = arrays[i].split(SPLIT_CHAR175);
var alert = {};
alert.AlertID = parseInt(array[0]);
alert.WorkOrderID = parseInt(array[1]);
alert.WorkOrderStatus = array[2];
alert.AlertType = array[3];
alert.AlertTime_UTC = array[4];
alert.AlertTime_UTCStr = array[5];
alert.AlertLocalTime = array[6];
alert.AlertLocalTimeStr = array[7];
alert.Completed = parseInt(array[8]) == 1;
alert.MachineID = parseInt(array[9]);
alert.ModelID = parseInt(array[10]);
alert.Model = array[11];
alert.MakeID = parseInt(array[12]);
alert.Make = array[13];
alert.VIN = array[14];
alert.MachineName = array[15];
alert.EngineHours = parseFloat(array[16]);
alert.CurrentHours = parseFloat(array[17]);
alert.Description = array[18];
alert.ServiceDescription = array[19];
alert.ScheduleID = array[20];
alert.IntervalID = array[21];
alert.Recurring = parseInt(array[22]) == 1;
alert.Priority = parseInt(array[23]);
alert.ExpectedCost = parseFloat(array[24]);
alert.AlertCount = parseInt(array[25]);
var repeatedalertsstr = array[26];
if (repeatedalertsstr !== "") {
alert.RepeatedAlerts = repeatedalertsstr.split(SPLIT_CHAR181);
}
alert.OpenWorkOrderCount = parseInt(array[27]);
alert.PMType = array[28];
alert.AcknowledgedBy = array[29];
alert.AcknowledgedByName = array[30];
alert.AcknowledgedTime_UTC = array[31];
alert.AcknowledgedTime_UTCStr = array[32];
alert.AcknowledgedTime_Local = array[33];
alert.AcknowledgedTime_LocalStr = array[34];
alert.AcknowledgedComment = array[35];
alert.WorkOrderNumber = array[36];
alert.Comment = array[37];
alerts.push(alert);
}
}
return alerts;
}
function showAlerts(data) {
var rows = [];
for (var i = 0; i < data.length; i++) {
@ -276,11 +439,10 @@
r[j] = { DisplayValue: "", Value: r[j] };
}
if (j === "AlertType") {
r[j] = { DisplayValue: ($.trim(r[j]) == "" ? GetTextByKey("P_XXXXX", '(Blank)') : r[j]), Value: $.trim(r[j]) };
r[j] = { DisplayValue: ($.trim(r[j]) == "" ? GetTextByKey("P_AM_BLANK", '(Blank)') : r[j]), Value: $.trim(r[j]) };
}
}
var fr = { Values: r };
rows.push(fr);
rows.push(r);
}
alertview_dt.SelectedCount = 0;
@ -503,14 +665,15 @@
var table = $("<table class='main_table'></table>");
var thr = $("<tr></tr>").appendTo(table);
$("<th style='width: 54px;'></th>").appendTo(thr);
$("<th style='width: 100px;' data-lgid='P_AM_WORKORDERID'>Work Order ID</th>").appendTo(thr);
$("<th style='width: 110px;' data-lgid='P_AM_WORKORDERSTATUS'>Work Order Status</th>").appendTo(thr);
$("<th style='width: 120px;' data-lgid='P_AM_ALERTTYPE'>Alert Type</th>").appendTo(thr);
$("<th style='width: 300px;' data-lgid='P_AM_DESCRIPTION'>Description</th>").appendTo(thr);
$("<th style='width: 150px;' data-lgid='P_AM_ENGINEHOURS'>Engine Hours</th>").appendTo(thr);
$("<th style='width: 120px;' data-lgid='P_AM_ALERTDATETIME'>Alert DateTime</th>").appendTo(thr);
$("<th style='width: 70px;' data-lgid='P_AM_ALERTCOUNT'>Alert Count</th>").appendTo(thr);
$("<th style='white-space:nowrap;' data-lgid='P_AM_SERVICEDESCRIPTION'>Service Description</th>").appendTo(thr);
$("<th style='width: 100px;'>" + GetTextByKey('P_WO_WORKORDERNUMBER', 'Work Order Number') + "</th>").appendTo(thr);
$("<th style='width: 110px;'>" + GetTextByKey('P_AM_WORKORDERSTATUS', 'Work Order Status') + "</th>").appendTo(thr);
$("<th style='width: 120px;'>" + GetTextByKey('P_AM_ALERTTYPE', 'Alert Type') + "</th>").appendTo(thr);
$("<th style='width: 300px;'>" + GetTextByKey('P_AM_DESCRIPTION', 'Description') + "</th>").appendTo(thr);
$("<th style='width: 150px;'>" + GetTextByKey('P_AM_ENGINEHOURS', 'Engine Hours') + "</th>").appendTo(thr);
$("<th style='width: 120px;'>" + GetTextByKey('P_AM_ALERTDATETIME', 'Alert DateTime') + "</th>").appendTo(thr);
$("<th style='width: 70px;'>" + GetTextByKey('P_AM_ALERTCOUNT', 'Alert Count') + "</th>").appendTo(thr);
$("<th style='white-space:nowrap;'>" + GetTextByKey('P_AM_SERVICEDESCRIPTION', 'Service Description') + "</th>").appendTo(thr);
$("<th style='white-space:nowrap;'>" + GetTextByKey('P_AM_COMMENT', 'Comment') + "</th>").appendTo(thr);
//$("<th style='width: 50px;'>Completed</th>").appendTo(thr);
var pmalertsarray = [];
for (var i = 0; i < alerts.length; i++) {
@ -527,9 +690,9 @@
}
tr.append(tdacksubchk);
tr.append($('<td></td>').text(alert.WorkOrderID > 0 ? alert.WorkOrderID : ""));
tr.append($('<td></td>').text(alert.WorkOrderNumber));
tr.append($('<td></td>').text(alert.WorkOrderStatus));
tr.append($('<td></td>').text($.trim(alert.AlertType) == "" ? GetTextByKey("P_XXXXX", '(Blank)') : alert.AlertType));
tr.append($('<td></td>').text($.trim(alert.AlertType) == "" ? GetTextByKey("P_AM_BLANK", '(Blank)') : alert.AlertType));
var tdnote = $('<td style="word-wrap:break-word;"></td>').text(alert.Description).attr('title', alert.Description);
tr.append(tdnote);
tr.append($('<td></td>').text(alert.EngineHours == 0 ? "" : alert.EngineHours));
@ -538,7 +701,10 @@
var text = alert.ServiceDescription.length > 80 ? alert.ServiceDescription.substring(0, 80) + " ..." : alert.ServiceDescription;
var tdsnote = $('<td style="word-wrap:break-word;"></td>').text(text).attr('title', alert.ServiceDescription);
tr.append(tdsnote);
//tr.append($('<td></td>').html(alert.Completed ? "Yes" : "No"));
//tr.append($('<td></td>').html(alert.Completed ? GetTextByKey("P_UTILITY_YES", "Yes") : GetTextByKey("P_UTILITY_NO", "No")));
text = alert.Comment?.length > 80 ? alert.Comment.substring(0, 80) + " ..." : alert.Comment;
var tdscomment = $('<td style="word-wrap:break-word;"></td>').html(window['lib-utility'].escapeHtml(text)).attr('title', alert.Comment);
tr.append(tdscomment);
table.append(tr);
if (alert.AlertType == "Preventative Maintenance")
@ -632,6 +798,7 @@
function CloseDialog(type) {
$('#dialog_workorder').hideDialog();
setPageTitle(GetTextByKey("P_ALERTSMANAGEMENT", "Alerts Management"), true);
if (type == 1) {
OnSearchClick();
}
@ -751,32 +918,28 @@
var alerttypesdata;
function GetAlertTypes() {
$('#div_alerttype').empty();
alertrequest('GetAlertTypes', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
data.splice(0, 0, { Key: "", Value: GetTextByKey("P_XXXXX", '(Blank)') });
alerttypeparam = {
items: data,
selectedvalue: []
};
alerttypesdata = data;
var iptalertype = editmultiselect(alerttypeparam);
$('#div_alerttype').append(iptalertype);
iptalertype.change(function () {
showIncludeunCompleted(false);
if (alerttypeparam) {
var alerttypes = alerttypeparam.selectedvalue;
if (alerttypes && alerttypes.length > 0) {
if (alerttypes.indexOf("Preventative Maintenance") >= 0 || alerttypes.indexOf("Yellow-Inspect") >= 0 || alerttypes.indexOf("Red-Inspect") >= 0) {
showIncludeunCompleted(true);
}
}
else
data.splice(0, 0, { Key: "", Value: GetTextByKey("P_AM_BLANK", '(Blank)') });
$('#div_alerttype').css('width', 110).dropdown(data, {
search: true,
multiselect: true,
textKey: 'Value',
valueKey: 'Key'
}).on('collapsed', function (_e, wo) {
var alerttypes = $('#div_alerttype').dropdownVals();
if (alerttypes && alerttypes.length > 0) {
if (alerttypes.indexOf("Preventative Maintenance") >= 0 || alerttypes.indexOf("Yellow-Inspect") >= 0 || alerttypes.indexOf("Red-Inspect") >= 0) {
showIncludeunCompleted(true);
}
}
})
else
showIncludeunCompleted(true);
});
});
}
function GetAssetGroups() {
@ -785,12 +948,12 @@
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
assetgroupparam = {
items: data,
selectedvalue: []
};
var iptalertype = editmultiselect(assetgroupparam);
$('#div_assetgroup').append(iptalertype);
$('#div_assetgroup').css('width', 110).dropdown(data, {
search: true,
multiselect: true,
textKey: 'Value',
valueKey: 'Key'
});
});
}
@ -801,12 +964,28 @@
return;
}
jobsitesparam = {
items: data,
selectedvalue: []
};
var ipt = editmultiselect(jobsitesparam);
$('#div_jobsites').append(ipt);
$('#div_jobsites').css('width', 110).dropdown(data, {
search: true,
multiselect: true,
textKey: 'Value',
valueKey: 'Key'
});
});
}
function GetCategory() {
alertrequest('GetAlertCategory', '', function (data) {
if (typeof (data) === "string") {
showAlert(data, GetTextByKey("P_AM_ERROR", 'Error'));
return;
}
$('#div_categorys').css('width', 110).dropdown(data, {
search: true,
multiselect: true,
textKey: 'Value',
valueKey: 'Value'
});
});
}
@ -817,37 +996,68 @@
{ 'Key': "Completed", 'Value': "Show Completed" },
{ 'Key': "Uncompleted", 'Value': "Show Uncompleted" }
];
alertstatusparam = {
items: data,
selectedvalue: []
};
var iptalertype = editmultiselect(alertstatusparam);
$('#div_alertstatus').append(iptalertype);
$('#div_alertstatus').css('width', 110).dropdown(data, {
search: true,
multiselect: true,
textKey: 'Value',
valueKey: 'Key'
});
}
function onEditText(it, next) {
showmaskbg(true);
$('#dialog_edittext').data('item', it).data('next', next)
.css({
'top': (document.documentElement.clientHeight - $('#dialog_edittext').height()) / 3,
'left': (document.documentElement.clientWidth - $('#dialog_edittext').width()) / 2
}).showDialogfixed();
$('#dialog_text').val(it.Comment).focus();
}
function SaveText() {
var text = $('#dialog_text').val();
var item = $('#dialog_edittext').data('item');
var next = $('#dialog_edittext').data('next');
item.Comment = text;
if (next)
next();
$('#dialog_edittext').hideDialog();
showmaskbg(false);
var ids = [item.AlertID];
if (item.RepeatedAlerts) {
ids = ids.concat(item.RepeatedAlerts);
}
alertrequest('UpdateAlertComment', encodeURIComponent(JSON.stringify([ids.join(','), item.Comment])), function (data) {
if (data !== 'OK') {
showAlert(data, GetTextByKey('P_AM_EDITCOMMENT', 'Edit Comment'));
return;
}
});
}
var alertview_dt;
function InitGridData() {
alertview_dt = new GridView('#alertviewlist');
alertview_dt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
alertview_dt = createGridView('#alertviewlist');
var list_columns = [
{ name: 'Selected', caption: "", valueIndex: 'Selected', type: 3, css: { 'width': 45, 'text-align': 'center' } },
{ name: 'WorkOrderID', caption: GetTextByKey("P_AM_WORKORDERID", "Work Order ID"), valueIndex: 'WorkOrderID', css: { 'width': 120, 'text-align': 'left' } },
{ name: 'WorkOrderNumber', caption: GetTextByKey("P_WO_WORKORDERNUMBER", "Work Order Number"), valueIndex: 'WorkOrderNumber', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'WorkOrderStatus', caption: GetTextByKey("P_AM_WORKORDERSTATUS", "Work Order Status"), valueIndex: 'WorkOrderStatus', allowFilter: true, css: { 'width': 140, 'text-align': 'left' } },
{ name: 'MachineName', caption: GetTextByKey("P_AM_ASSETNAME", "Asset Name"), valueIndex: 'MachineName', css: { 'width': 180, 'text-align': 'left' } },
{ name: 'MachineName', caption: GetTextByKey("P_AM_ASSETNAME", "Asset Name"), valueIndex: 'MachineName', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
{ name: 'Make', caption: GetTextByKey("P_AM_MAKE", "Make"), valueIndex: 'Make', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'Model', caption: GetTextByKey("P_AM_MODEL", "Model"), valueIndex: 'Model', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'VIN', caption: GetTextByKey("P_AM_VIN", "SN/VIN"), valueIndex: 'VIN', css: { 'width': 180, 'text-align': 'left' } },
{ name: 'CurrentHours', caption: GetTextByKey("P_AM_CURRENTHOURS", "Current Hours"), valueIndex: 'CurrentHours', css: { 'width': 120, 'text-align': 'left' } },
{ name: 'EngineHours', caption: GetTextByKey("P_AM_HOURS", "Hours"), valueIndex: 'EngineHours', css: { 'width': 120, 'text-align': 'left' } },
{ name: 'VIN', caption: GetTextByKey("P_AM_VIN", "SN/VIN"), valueIndex: 'VIN', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
{ name: 'CurrentHours', caption: GetTextByKey("P_AM_CURRENTHOURS", "Current Hours"), valueIndex: 'CurrentHours', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'EngineHours', caption: GetTextByKey("P_AM_HOURS", "Hours"), valueIndex: 'EngineHours', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'AlertType', caption: GetTextByKey("P_AM_ALERTTYPE", "Alert Type"), valueIndex: 'AlertType', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'Description', caption: GetTextByKey("P_AM_DESCRIPTION", "Description"), valueIndex: 'Description', css: { 'width': 240, 'text-align': 'left' } },
{ name: 'AlertCount', caption: GetTextByKey("P_AM_ALERTCOUNT", "Alert Count"), valueIndex: 'AlertCount', css: { 'width': 80, 'text-align': 'left' } },
{ name: 'AlertCount', caption: GetTextByKey("P_AM_ALERTCOUNT", "Alert Count"), valueIndex: 'AlertCount', allowFilter: true, css: { 'width': 100, 'text-align': 'left' } },
{ name: 'AlertLocalTime', caption: GetTextByKey("P_AM_LATESTALERTDATETIME", "Latest Alert DateTime"), valueIndex: 'AlertLocalTime', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'OpenWorkOrderCount', caption: GetTextByKey("P_AM_OPENWORKORDERS", "Open Work Orders"), valueIndex: 'OpenWorkOrderCount', css: { 'width': 130, 'text-align': 'left' } },
{ name: 'OpenWorkOrderCount', caption: GetTextByKey("P_AM_OPENWORKORDERS", "Open Work Orders"), allowFilter: true, valueIndex: 'OpenWorkOrderCount', css: { 'width': 130, 'text-align': 'left' } },
{ name: 'Comment', caption: GetTextByKey("P_AM_COMMENT", "Comment"), valueIndex: 'Comment', css: { 'width': 240, 'text-align': 'left' } },
];
var columns = [];
// head
@ -867,6 +1077,7 @@
columns.push(col);
if (col.name === "Selected") {
col.enabled = "Enabled";
col.sortable = false;
col.events = {
onchange: function () {
if (this.Selected) {
@ -878,7 +1089,7 @@
if (a.MachineID !== this.MachineID)
a.Enabled = false;
}
alertview_dt.reload();
alertview_dt.refresh();
}
else {
alertview_dt.SelectedCount--;
@ -887,29 +1098,35 @@
var a = allalertdata[i];
a.Enabled = true;
}
alertview_dt.reload();
alertview_dt.refresh();
}
}
}
};
}
if (col.name === "Selected") {
col.styleFilter = function (item) {
return {
display: (item.WorkOrderID > 0 || item.Completed) ? 'none' : ''
};
}
}
else if (col.name === 'Comment') {
col.type = NoteColumn;
col.onClicked = function (item, element) {
onEditText(item, function () {
element.querySelector('.cell-flex-memo').innerHTML = window['lib-utility'].escapeHtml(item.Comment);
});
};
}
}
alertview_dt.canMultiSelect = false;
alertview_dt.isEditable = true;
alertview_dt.multiSelect = false;
alertview_dt.columns = columns;
alertview_dt.init();
//alertview_dt.rowdblclick = OnEdit;
alertview_dt.selectedrowchanged = function (rowindex) {
alertview_dt.onSelectedRowChanged = function (rowindex) {
var rowdata = alertview_dt.source[rowindex];
if (rowdata) {
workOrderID = rowdata.Values.workOrderID;
workOrderID = rowdata.workOrderID;
}
}
}
@ -927,11 +1144,10 @@
r[j] = { DisplayValue: r["AcknowledgedTime_LocalStr"], Value: r[j] };
}
if (j === "AlertType") {
r[j] = { DisplayValue: ($.trim(r[j]) == "" ? GetTextByKey("P_XXXXX", '(Blank)') : r[j]), Value: $.trim(r[j]) };
r[j] = { DisplayValue: ($.trim(r[j]) == "" ? GetTextByKey("P_AM_BLANK", '(Blank)') : r[j]), Value: $.trim(r[j]) };
}
}
var fr = { Values: r };
rows.push(fr);
rows.push(r);
}
acknowledgedalerts_dt.SelectedCount = 0;
@ -940,26 +1156,22 @@
var acknowledgedalerts_dt;
function InitAcknowledgedAlertsGridData() {
acknowledgedalerts_dt = new GridView('#acknowledgedalertslist');
acknowledgedalerts_dt.lang = {
all: GetTextByKey("P_GRID_ALL", "(All)"),
ok: GetTextByKey("P_GRID_OK", "OK"),
reset: GetTextByKey("P_GRID_RESET", "Reset")
};
acknowledgedalerts_dt = createGridView('#acknowledgedalertslist');
var list_columns = [
{ name: 'AcknowledgedByName', caption: GetTextByKey("P_AM_ACKNOWLEDGEDBY", "Acknowledged By"), valueIndex: 'AcknowledgedByName', allowFilter: true, css: { 'width': 150, 'text-align': 'left' } },
{ name: 'AcknowledgedTime_Local', caption: GetTextByKey("P_AM_ACKNOWLEDGEDDATETIME", "Acknowledged DateTime"), valueIndex: 'AcknowledgedTime_Local', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'MachineName', caption: GetTextByKey("P_AM_ASSETNAME", "Asset Name"), valueIndex: 'MachineName', css: { 'width': 180, 'text-align': 'left' } },
{ name: 'MachineName', caption: GetTextByKey("P_AM_ASSETNAME", "Asset Name"), valueIndex: 'MachineName', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
{ name: 'Make', caption: GetTextByKey("P_AM_MAKE", "Make"), valueIndex: 'Make', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'Model', caption: GetTextByKey("P_AM_MODEL", "Model"), valueIndex: 'Model', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'VIN', caption: GetTextByKey("P_AM_VIN", "SN/VIN"), valueIndex: 'VIN', css: { 'width': 180, 'text-align': 'left' } },
{ name: 'EngineHours', caption: GetTextByKey("P_AM_HOURS", "Hours"), valueIndex: 'EngineHours', css: { 'width': 120, 'text-align': 'left' } },
{ name: 'VIN', caption: GetTextByKey("P_AM_VIN", "SN/VIN"), valueIndex: 'VIN', allowFilter: true, css: { 'width': 180, 'text-align': 'left' } },
{ name: 'EngineHours', caption: GetTextByKey("P_AM_HOURS", "Hours"), valueIndex: 'EngineHours', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'AlertType', caption: GetTextByKey("P_AM_ALERTTYPE", "Alert Type"), valueIndex: 'AlertType', allowFilter: true, css: { 'width': 120, 'text-align': 'left' } },
{ name: 'Description', caption: GetTextByKey("P_AM_DESCRIPTION", "Description"), valueIndex: 'Description', css: { 'width': 240, 'text-align': 'left' } },
{ name: 'AlertCount', caption: GetTextByKey("P_AM_ALERTCOUNT", "Alert Count"), valueIndex: 'AlertCount', css: { 'width': 80, 'text-align': 'left' } },
{ name: 'AlertCount', caption: GetTextByKey("P_AM_ALERTCOUNT", "Alert Count"), valueIndex: 'AlertCount', allowFilter: true, css: { 'width': 80, 'text-align': 'left' } },
{ name: 'AlertLocalTime', caption: GetTextByKey("P_AM_LATESTALERTDATETIME", "Latest Alert DateTime"), valueIndex: 'AlertLocalTime', css: { 'width': 150, 'text-align': 'left' } },
{ name: 'OpenWorkOrderCount', caption: GetTextByKey("P_AM_OPENWORKORDERS", "Open Work Orders"), valueIndex: 'OpenWorkOrderCount', css: { 'width': 130, 'text-align': 'left' } },
{ name: 'OpenWorkOrderCount', caption: GetTextByKey("P_AM_OPENWORKORDERS", "Open Work Orders"), valueIndex: 'OpenWorkOrderCount', allowFilter: true, css: { 'width': 130, 'text-align': 'left' } },
{ name: 'AcknowledgedComment', caption: GetTextByKey("P_AM_ACKNOWLEDGEDCOMMENT", "Acknowledged Comment"), valueIndex: 'AcknowledgedComment', css: { 'width': 200, 'text-align': 'left' } },
{ name: 'Comment', caption: GetTextByKey("P_AM_COMMENT", "Comment"), valueIndex: 'Comment', css: { 'width': 200, 'text-align': 'left' } },
];
var columns = [];
// head
@ -979,18 +1191,15 @@
//if (col.name === "AcknowledgedComment") {
// col.visible = isacknowledgingalerts;
//}
if (col.name === 'Comment') {
col.type = NoteColumn;
col.enabled = false;
}
columns.push(col);
}
acknowledgedalerts_dt.canMultiSelect = false;
acknowledgedalerts_dt.multiSelect = false;
acknowledgedalerts_dt.columns = columns;
acknowledgedalerts_dt.init();
//acknowledgedalerts_dt.rowdblclick = OnEdit;
acknowledgedalerts_dt.selectedrowchanged = function (rowindex) {
var rowdata = acknowledgedalerts_dt.source[rowindex];
if (rowdata) {
}
}
}
function switchPage(index) {
@ -1062,6 +1271,7 @@
GetAssetGroups();
GetAlertStatus();
GetJobsites();
GetCategory();
InitGridData();
@ -1078,6 +1288,9 @@
$('#dialog_acknowledgingalerts').dialog(function () {
showmaskbg(false);
});
$('#dialog_edittext').dialog(function () {
showmaskbg(false);
});
$('#searchinputtxt').keydown(enterKeydown);
$('#chk_all_ackalert').change(function (e) {
@ -1091,26 +1304,6 @@
});
});
$('#dialog_duedate').datetimepicker({
timepicker: false,
format: 'm/d/Y',
enterLikeTab: false,
onSelectDate: function (v, inp) {
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
inp.parent().data('val', [date]);
}
});
$('#dialog_completeddate').datetimepicker({
timepicker: false,
format: 'm/d/Y',
enterLikeTab: false,
onSelectDate: function (v, inp) {
var date = new DateFormatter().formatDate(v, 'm/d/Y 00:00:00');
inp.parent().data('val', [date]);
}
});
$("#listDiv").scroll(null, function (e) {
var t = $(e.target);
$('#tbalertlist').css('margin-left', -(t.scrollLeft()));
@ -1127,15 +1320,6 @@
$('#listDiv').css('height', $(window).height() - $('#alertviewlist').offset().top - 40);
}).resize();
$("#txtbegindate").datetimepicker({
timepicker: false,
format: 'm/d/Y'
});
$("#txtenddate").datetimepicker({
timepicker: false,
format: 'm/d/Y'
});
if (!canExport) {
$('#spExport').hide();
}
@ -1193,21 +1377,27 @@
function OnExport() {
var begindate = $('#txtbegindate').val();
var enddate = $('#txtenddate').val();
if (begindate && !$('#txtbegindate').is(':valid')) {
showAlert(GetTextByKey('P_COMMON_BEGINDATEISINVALID', "The begin date is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (enddate && !$('#txtenddate').is(':valid')) {
showAlert(GetTextByKey('P_COMMON_ENDDATEISINVALID', "The end date is invalid."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
if (begindate && enddate && begindate > enddate) {
showAlert(GetTextByKey("P_JS_ENDDATEMUSTBELATERTHANBEGINDATE", "End Date must be later than Begin Date."), GetTextByKey("P_FR_ERROR", 'Error'));
return;
}
var searchtxt = htmlencode($.trim($('#searchinputtxt').val()));
var beginDate = $('#txtbegindate').val();
var endDate = $('#txtenddate').val();
var alerttypes = [];
var assetgroups = [];
var alertstatus = [];
var jobsites = [];
if (alerttypeparam)
alerttypes = alerttypeparam.selectedvalue;
if (assetgroupparam)
assetgroups = assetgroupparam.selectedvalue;
if (alertstatusparam)
alertstatus = alertstatusparam.selectedvalue;
if (jobsitesparam)
jobsites = jobsitesparam.selectedvalue;
var alerttypes = $('#div_alerttype').dropdownVals();
var assetgroups = $('#div_assetgroup').dropdownVals();
var alertstatus = $('#div_alertstatus').dropdownVals();
var jobsites = $('#div_jobsites').dropdownVals();
var category = $('#div_categorys').dropdownVals();
var item = {
AssetID: assetid == "" ? -1 : eval(assetid),
SearchText: searchtxt,
@ -1215,8 +1405,9 @@
AssetGroups: assetgroups,
AlertTypes: alerttypes,
JobSites: jobsites,
BeginDate: beginDate,
EndDate: endDate,
Category: category,
BeginDate: begindate,
EndDate: enddate,
IncludeunCompleted: $('#chk_includeuncompleted').prop("checked"),
}
@ -1230,11 +1421,11 @@
<div id="recordcontent" style="padding: 0px; margin: 0px;">
<div class="page_title">
<span data-lgid="P_ALERTSMANAGEMENT">Alerts Management</span>
<span class="exit" onclick="OnExit();" style="<%=InDialog?"": "display:none;"%>;float: right; font-size: 14px; margin-right: 10px; cursor: pointer;">
<span class="exit" onclick="OnExit();" style="<%=InDialog?"": "display:none;"%>; float: right; font-size: 14px; margin-right: 10px; cursor: pointer;">
<label data-lgid="P_WO_EXIT" style="padding-left: 2px;">Exit</label>
</span>
<span id="spExport" class="export" style="float: right; font-size: 14px;margin-right: 10px; cursor: pointer;" onclick="OnExport();">
<span id="spExport" class="export" style="float: right; font-size: 14px; margin-right: 10px; cursor: pointer;" onclick="OnExport();">
<label data-lgid="P_AM_EXPORT" style="padding-left: 2px;">Export</label>
</span>
<span class="autoacknowledge" style="<%=InDialog?"display:none;": ""%>; float: right; font-size: 14px; margin-right: 15px; cursor: pointer;" onclick="openOpenAutoAcknowled();">
@ -1250,15 +1441,15 @@
<td style="border-bottom: 1px solid #bbb;">&nbsp;</td>
</tr>
</table>
<div class="search_bar" style="margin-top: 10px;margin-bottom: 0px; min-width: 1320px;">
<div class="search_bar" style="margin-top: 10px; margin-bottom: 0px; min-width: 1400px;">
<input type="password" autocomplete="new-password" style="display: none" />
<span data-lgid="P_AM_BEGINDATE_COLON">Begin Date:</span>
<div>
<input type="text" style="margin-left: 5px; width: 70px;" id="txtbegindate" value="<%=BeginDate %>" />
<input id="txtbegindate" type="date" class="type-date" required min="1900-01-01" style="margin-left: 5px; width: 90px;" value="<%=BeginDate %>" />
</div>
<span data-lgid="P_AM_ENDDATE_COLON">End Date:</span>
<div>
<input type="text" style="margin-left: 5px; width: 70px;" id="txtenddate" value="<%=EndDate %>" />
<input id="txtenddate" type="date" class="type-date" required min="1900-01-01" style="margin-left: 5px; width: 90px;" value="<%=EndDate %>" />
</div>
<div style="<%=InDialog?"display:none;": ""%>; display: flex;">
<span data-lgid="P_AM_ALERTTYPE_COLON">Alert Type:</span>
@ -1271,12 +1462,14 @@
</div>
<span data-lgid="P_AM_JOBSITES_COLON">Jobsites:</span>
<div id="div_jobsites"></div>
<span data-lgid="P_AM_CATEGORY_COLON">Category:</span>
<div id="div_categorys"></div>
<input style="margin-left: 5px; width: 140px;" type="text" id="searchinputtxt" autocomplete="off" />
</div>
<input class="search" type="button" style="margin-left: 8px;" onclick="OnSearchClick();" value="Search" data-lgid="P_AM_SEARCH" />
<%--<input id="chkShowCompleted" type="checkbox" onclick="GetAlerts();" /><span>Show Completed Alerts</span>--%>
</div>
<div class="search_bar" style="margin-top: 5px;"">
<div class="search_bar" style="margin-top: 5px;">
<div id="div_includeuncompleted">
<input id="chk_includeuncompleted" type="checkbox" onclick="OnSearchClick();" />
<span data-lgid="P_AM_INCLUDEUNCOMPLETED">Display triggered/incomplete PM and red/yellow inspect alerts despite date selection</span>
@ -1289,10 +1482,10 @@
<span class="sbutton iconexpand" id="btnExpandAll" onclick="ExpandAll(this);" data-lgid="P_AM_EXPANDALL">Expand All</span>
</div>
<div class="clear"></div>
<div id="alertviewlist" style="min-width: 1280px;"></div>
<div id="alertviewlist" style="min-width: 1300px;"></div>
<div id="machineviewlist" class="content_main" style="overflow-x: auto; display: none;">
<div style="overflow: hidden;">
<table id="tbalertlist" class="main_table" style="min-width: 1280px; width: 100%; table-layout: fixed;">
<table id="tbalertlist" class="main_table" style="min-width: 1300px; width: 100%; table-layout: fixed;">
<thead>
<tr>
<th style="width: 12px;"></th>
@ -1313,17 +1506,19 @@
</table>
</div>
<div id="listDiv" class="content_div">
<table class="main_table" style="min-width: 1280px; width: 100%; table-layout: fixed;">
<table class="main_table" style="min-width: 1300px; width: 100%; table-layout: fixed;">
<tbody id="tbody_alerts">
</tbody>
</table>
</div>
</div>
<div id="acknowledgedalertslist" style="min-width: 1280px;"></div>
<div id="acknowledgedalertslist" style="min-width: 1300px;"></div>
</div>
<div id="mask_bg" style="display: none;"><div class="loading c-spin"></div></div>
<div id="mask_bg" style="display: none;">
<div class="loading c-spin"></div>
</div>
<div class="dialog" id="dialog_workorder" style="display: none; height: 100%; border-bottom: 0; border-top: 0;">
<iframe id="iframeworkorder" style="width: 100%; height: 100%; display: block; border: none;"></iframe>
<div class="maskbg" style="display: none;"></div>
@ -1354,5 +1549,22 @@
<div class="maskbg" style="display: none;"></div>
</div>
<div class="dialog" id="dialog_edittext" style="display: none;">
<div class="dialog-title"><span class="title" data-lgid="P_AM_EDITCOMMENT">Edit Comment</span><em class="dialog-close"></em></div>
<div class="dialog-content">
<table style="line-height: 30px;">
<tr>
<td>
<textarea id="dialog_text" tabindex="1" style="width: 480px; height: 200px; margin-top: 6px;" maxlength="1000"></textarea></td>
</tr>
</table>
</div>
<div class="dialog-func">
<input type="button" value="Cancel" data-lgid="P_WO_CANCEL" class="dialog-close" tabindex="3" />
<input type="button" onclick="SaveText();" value="Save" data-lgid="P_WO_SAVE" tabindex="2" />
<div class="clear"></div>
</div>
</div>
</asp:Content>