| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286 | 
							- 
 
- BWA.AlarmInfo = {
 
-     Alarm_Image_Change: ko.observable(false)
 
- };
 
- $(function () {
 
-     'use strict';
 
-     var AlarmPopupVisible = ko.observable(false);
 
-     BWA.AlarmPopup = {
 
-         AlarmPopupOptions: {
 
-             visible: AlarmPopupVisible,
 
-             width: '1400px',
 
-             height: '850px', // cyim 2017.05.30 : 테스트 결과 Devextreme 버그임. px 로 지정하면 초기 출력시 정확하게 가운데에 있지만, auto 설정시 화면아래에 위치하게 됨
 
-             contentTemplate: "content",
 
-             showTitle: true,
 
-             title: "알람정보",
 
-             dragEnabled: false,
 
-             closeOnOutsideClick: false,
 
-             shadingColor: 'rgba(0,0,0,0.0)',
 
-             shownAction: handlePopupShown,
 
-             animation: window.utils.popup.createAnimation()
 
-         },
 
-         AlarmPopupOpen: function() {
 
-             AlarmPopupVisible(true);
 
-         },
 
-         AlarmPopupCheckOptions: {
 
-             visible: false,
 
-             width: '400px',
 
-             height: '400px', // cyim 2017.05.30 : 테스트 결과 Devextreme 버그임. px 로 지정하면 초기 출력시 정확하게 가운데에 있지만, auto 설정시 화면아래에 위치하게 됨
 
-             contentTemplate: "content",
 
-             showTitle: true,
 
-             title: "조치방법",
 
-             dragEnabled: false,
 
-             closeOnOutsideClick: false,
 
-             shadingColor: 'rgba(0,0,0,0.0)',
 
-             //shownAction: handlePopupShown,
 
-             animation: window.utils.popup.createAnimation()
 
-         },
 
-     }
 
-     // 알람 정보 저장
 
-     var DataArrayInfo = [];
 
-     // 팝업 생성되면서 실행
 
-     function handlePopupShown() {
 
-         // dxLoadPanel 패널
 
-         $("#LoadPanel").dxLoadPanel({
 
-             message: '전체 알람 해제중...',
 
-             showIndicator: true,
 
-             visible: false
 
-         });
 
-         $("#Button_StopAlarm").dxButton({
 
-             text: "전체 알람 해제",
 
-             onClick: function () {
 
-                 var num = DataArrayInfo.length;
 
-                 if (num == 0) {
 
-                     // 에러 발생
 
-                     utils.toast.show('해제 할 알람 정보가 없습니다.', 'error');
 
-                     return;
 
-                 }
 
-                 DevExpress.ui.dialog.confirm("전체 알람 해제 하시겠습니까?", "전체 알람 해제").done(function (dialogResult) {
 
-                     if (dialogResult)
 
-                     {
 
-                         // 전체 알람 해제 버튼 비활성화
 
-                         $("#Button_StopAlarm").dxButton('instance').option('disabled', true);
 
-                         // dxLoadPanel 패널 시작
 
-                         $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
 
-                         // 알람 버튼 색 컬러 변경 정지
 
-                         BWA.AlarmInfo.Alarm_Image_Change = false;
 
-                         var index = 0;
 
-                         for (var i = 0; i < num; i++) {
 
-                             BWA.db.BemsAlarmLog.update({
 
-                                 SiteId: DataArrayInfo[i].SiteId(),
 
-                                 FacilityTypeId: DataArrayInfo[i].FacilityTypeId(),
 
-                                 FacilityCode: DataArrayInfo[i].FacilityCode(),
 
-                                 PropertyId: DataArrayInfo[i].PropertyId(),
 
-                                 FormulaId: DataArrayInfo[i].FormulaId(),
 
-                                 CreatedDateTime: DataArrayInfo[i].CreatedDateTime()
 
-                             },
 
-                            {
 
-                                Conform: true // 확인함
 
-                            }).done(function () {
 
-                                index++;
 
-                                if (num == index) {
 
-                                    // 데이터 갱신
 
-                                    DataArrayInfo = [];
 
-                                    $("#gridContainer_alarm").dxDataGrid("instance").option("dataSource", DataArrayInfo);
 
-                                    // 전체 알람 해제 버튼 활성화
 
-                                    $("#Button_StopAlarm").dxButton('instance').option('disabled', false);
 
-                                    // dxLoadPanel 패널 종료
 
-                                    $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
 
-                                }
 
-                            }).fail(function () {
 
-                                index++;
 
-                                if (num == index) {
 
-                                    // 전체 알람 해제 버튼 활성화
 
-                                    $("#Button_StopAlarm").dxButton('instance').option('disabled', false);
 
-                                    // dxLoadPanel 패널 종료
 
-                                    $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
 
-                                    // 에러 발생
 
-                                    utils.toast.show('전체 알람 해제시 에러가 발생하였습니다.', 'error');
 
-                                }
 
-                            });
 
-                         }
 
-                     }
 
-                 });
 
-                 
 
-             }
 
-         });
 
-         // 그리드 세팅
 
-         $("#gridContainer_alarm").dxDataGrid({
 
-             rowAlternationEnabled: true,
 
-             paging: {
 
-                 pageSize: 21
 
-             },
 
-             columns: [
 
-                 { dataField: 'CreatedDateTime', caption: '날짜', width: '12%', alignment: 'center', dataType: 'date', format: 'yyyy-MM-dd HH:mm:ss', sortOrder: 'asc', },
 
-                 { dataField: 'Type', caption: '타입', width: '5%', alignment: 'center' },
 
-                 { dataField: 'FacilityName', caption: '설비명칭', width: '20%', alignment: 'center' },
 
-                 { dataField: 'PropertyName', caption: '관제점(분석요소)', width: '20%', alignment: 'center' },
 
-                 { dataField: 'CurrentValue', caption: '값', width: '8%', alignment: 'center' },
 
-                 { dataField: 'UpperLimit', caption: '기준상한(이상)', width: '9%', alignment: 'center' },
 
-                 { dataField: 'LowerLimit', caption: '기준하한(이하)', width: '9%', alignment: 'center' },
 
-                 { dataField: 'SMSResult', caption: 'SMS 결과', width: '6%', alignment: 'center' },
 
-                 { dataField: 'EmailResult', caption: 'Email 결과', width: '6%', alignment: 'center' },
 
-                 { dataField: 'Check', caption: '조치방법', width: '5%', alignment: 'center' },
 
-                 // 아래 visible 속성을 true를 준 이유는 조치방법 확인을 클릭했을때, SiteId 등의 값을 읽어오지 못해서다
 
-                 { dataField: 'SiteId', visible: true },
 
-                 { dataField: 'FacilityTypeId', visible: true },
 
-                 { dataField: 'FacilityCode', visible: true },
 
-                 { dataField: 'PropertyId', visible: true },
 
-                 { dataField: 'FormulaId', visible: true },
 
-             ],
 
-             //dataSource: setDataSource,
 
-             onCellClick: function (object) {
 
-                 if (object.columnIndex == 9) {
 
-                     var DataArrayInfo = object.values;
 
-                     var SiteId = DataArrayInfo[10];
 
-                     var FacilityTypeId = DataArrayInfo[11];
 
-                     var FacilityCode = DataArrayInfo[12];
 
-                     var PropertyId = DataArrayInfo[13];
 
-                     var FormulaId = DataArrayInfo[14];
 
-                     // 조치 방법
 
-                     $("#PopupAlarmCheck").dxPopup('instance').option('visible', true);
 
-                     var BemsAlarmSettingDataSource = BemsWebApplication.db.createDataSource('BemsAlarmSetting');
 
-                     BemsAlarmSettingDataSource.filter([
 
-                         ['SiteId', '=', parseInt(SiteId)],
 
-                         'and',
 
-                         ['FacilityTypeId', '=', parseInt(FacilityTypeId)],
 
-                         'and',
 
-                         ['FacilityCode', '=', parseInt(FacilityCode)],
 
-                         'and',
 
-                         ['PropertyId', '=', parseInt(PropertyId)],
 
-                         'and',
 
-                         ['FormulaId', '=', parseInt(FormulaId)]
 
-                     ]);
 
-                     BemsAlarmSettingDataSource.load().done(function (result) {
 
-                         _.each(result, function (x) {
 
-                             $("#TextArea_Check").dxTextArea({
 
-                                 disabled: true,
 
-                                 value: x.Content
 
-                             });
 
-                         });
 
-                     })
 
-                 }
 
-             },
 
-         });
 
-         var BemsAlarmLogDataSource = BemsWebApplication.DataUtil.createDataSource({
 
-             dataSourceOptions: {
 
-                 select: [
 
-                     'CreatedDateTime', 'BemsAlarmSetting/FacilityName', 'BemsAlarmSetting/PointName', 'CurrentValue', 'BemsAlarmSetting/UpperLimit', 'BemsAlarmSetting/LowerLimit', 'SMSResult', 'EmailResult',
 
-                     'SiteId', 'FacilityTypeId', 'FacilityCode', 'PropertyId', 'FormulaId'
 
-                 ],
 
-                 expand: ['BemsAlarmSetting'],
 
-                 extendOptions: {
 
-                     forceOriginalField: true,
 
-                     alterNames: {
 
-                         'BemsAlarmSetting/FacilityName': 'FacilityName',
 
-                         'BemsAlarmSetting/PointName': 'PointName',
 
-                         'BemsAlarmSetting/UpperLimit': 'UpperLimit',
 
-                         'BemsAlarmSetting/LowerLimit': 'LowerLimit'
 
-                     }
 
-                 },
 
-                 filter: [
 
-                     ['SiteId', '=', BWA.UserInfo.SiteId()],
 
-                     'and',
 
-                     ['Conform', '=', false]
 
-                 ]
 
-             }
 
-         }, 'BemsAlarmLog');
 
-         BemsAlarmLogDataSource.load().done(function (result) {
 
-             if(result.length == 0)
 
-             {
 
-                 // 알람 버튼 색 컬러 변경 정지
 
-                 BWA.AlarmInfo.Alarm_Image_Change = false;
 
-             }
 
-             DataArrayInfo = []; // 초기화
 
-             _.each(result, function (x) {
 
-                 var temp = '';
 
-                 if (x.FormulaId() != 0) {
 
-                     temp = '성능분석';
 
-                 }
 
-                 else {
 
-                     if (x.FacilityTypeId() == 99) {
 
-                         temp = '가상시설';
 
-                     }
 
-                     else {
 
-                         temp = '일반시설';
 
-                     }
 
-                 }
 
-                 DataArrayInfo.push({
 
-                     CreatedDateTime: x.CreatedDateTime,
 
-                     Type: temp,
 
-                     FacilityName: x.FacilityName,
 
-                     PropertyName: x.PointName,
 
-                     CurrentValue: x.CurrentValue,
 
-                     UpperLimit: x.UpperLimit,
 
-                     LowerLimit: x.LowerLimit,
 
-                     SMSResult: x.SMSResult,
 
-                     EmailResult: x.EmailResult,
 
-                     Check: "확인",
 
-                     SiteId: x.SiteId,
 
-                     FacilityTypeId: x.FacilityTypeId,
 
-                     FacilityCode: x.FacilityCode,
 
-                     PropertyId: x.PropertyId,
 
-                     FormulaId: x.FormulaId
 
-                 });
 
-             });
 
-             $("#gridContainer_alarm").dxDataGrid("instance").option("dataSource", DataArrayInfo);
 
-         })
 
-         
 
-         //var setDataSource = new Array();
 
-         //var setData = {
 
-         //    "CreatedDateTime": "2018-05-03 14:00:00", "Type": "", "FacilityName": "", "PropertyName": "", "CurrentValue": 0, "UpperLimit": 0, "LowerLimit": 0, "Chekck": "",
 
-         //    "SiteId": 0, "FacilityTypeId": 0, "FacilityCode": 0, "PropertyId": 0, "FormulaId": 0
 
-         //};
 
-         //setData.CreatedDateTime = "2018-05-03 14:00:00";
 
-         //setData.Type = "성능분석";
 
-         //setData.FacilityName = "공조기_AHU - 101";
 
-         //setData.PropertyName = "난방ATF";
 
-         //setData.CurrentValue = 10;
 
-         //setData.UpperLimit = 10;
 
-         //setData.LowerLimit = 5;
 
-         //setData.Chekck = "확인";
 
-         //setDataSource.push(setData);
 
-     }
 
- });
 
 
  |