| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626 | 
							- BemsWebApplication.Zone_TempHumi = function (params, viewInfo) {
 
-     "use strict";
 
-     var endpointSelector = "";
 
-     if (BemsWebApplication.config.mode == "production") {
 
-         endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.production;
 
-     } else {
 
-         endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.local;
 
-     }
 
-     var AIR_HANDLING = $Code.FacilityType.AIR_HANDLING;
 
-     var BUILDING_DEPTH = 1, FLOOR_DEPTH = 2, ZONE_DEPTH = 3;
 
-     var CODE = $Code, FuelType = CODE.FuelType, FT = CODE.FacilityType, FC = CODE.FacilityCode, F = CODE.Formula, TIT = CODE.TimeIntervalType;
 
-     var QUARTERMIN = $Code.TimeType.QUARTERMIN;
 
-     var visiblePopup = ko.observable(false);
 
-     var tempvisiblePopup = ko.observable(false);
 
-     var initialized = false,
 
-         shouldReload = false,
 
-         facilityViewModel = new BWA.CmFacilityViewModel(),
 
-         dataSource;
 
-     var eq = BWA.DataUtil.constructEqualFilter, and = BWA.DataUtil.andFilter;
 
-     var currentTabIndex = ko.observable(0);
 
-     var m_Facility;
 
-     var FacilityCode;
 
-     var facilityDataSource = BWA.db.createDataSource('CmFacility'), facilitiesForSearch = ko.observableArray(), facilityCodeForSearch = ko.observable(0), deferredForSearch = new $.Deferred();
 
-     var SiteId = BWA.UserInfo.SiteId();
 
-     var formulaGet = new BWA.Chart.FormulaGet(SiteId);
 
-     var timeBoxForSearch = BWA.SearchView.createDateTimeBox();
 
-     var deferredForLoadData = new $.Deferred();
 
-     var chart = BWA.Chart.Instance('chartZTH', 'dxChart');
 
-     var locationEnableForSearch = ko.observable(false);
 
-     var t_temp = ko.observable(22);
 
-     var t_humi = ko.observable(33);
 
-     //  2017.09.08 : 그리드 도표 작업 : 팝업창 추가
 
-     // 팝업창뷰 보이기 속성 제어용 변수 선언
 
-     var DataGridPopup_Visible = ko.observable(false);
 
-     // 그래프 출력 이후 엑셀출력을 위한 팝업창을 위해 임시 저장용 배열 선언
 
-     var dataArrayresult = ko.observableArray();
 
-     //  2017.09.08 : 그리드 도표 작업 : 팝업창 추가
 
-     function isNumber(s) {
 
-         s += ''; // 문자열로 변환
 
-         s = s.replace(/^\s*|\s*$/g, ''); // 좌우 공백 제거
 
-         if (s == '' || isNaN(s)) return false;
 
-         return true;
 
-     }
 
-     function handleClickTreeItem(element, data) {
 
-         var eq = BWA.DataUtil.constructEqualFilter;
 
-         var depth = data.depth;
 
-         //data = data.data;
 
-         switch (depth) {
 
-             case BUILDING_DEPTH: // building
 
-                 data = data.data;
 
-                 buildingIdForSearch(data.BuildingId());
 
-                 buildingNameForSearch(data.Name());
 
-                 floorIdForSearch(null);
 
-                 floorNameForSearch('');
 
-                 zoneIdForSearch(null);
 
-                 zoneNameForSearch('');
 
-                 break;
 
-             case FLOOR_DEPTH: // floor
 
-                 buildingNameForSearch(data.parentData.data.Name());
 
-                 //alert(buildingIdForSearch());
 
-                 data = data.data;
 
-                 buildingIdForSearch(data.BuildingId());
 
-                 floorIdForSearch(data.FloorId());
 
-                 floorNameForSearch(data.Name());
 
-                 zoneIdForSearch(null);
 
-                 zoneNameForSearch('');
 
-                 break;
 
-             case ZONE_DEPTH: // zone
 
-                 floorNameForSearch(data.parentData.data.Name());
 
-                 buildingNameForSearch(data.parentData.parentData.data.Name());
 
-                 data = data.data;
 
-                 buildingIdForSearch(data.BuildingId());
 
-                 floorIdForSearch(data.FloorId());
 
-                 zoneIdForSearch(data.ZoneId());
 
-                 zoneNameForSearch(data.Name());
 
-                 break;
 
-         }
 
-     }
 
-     function handleViewShown() {
 
-         if (initialized === false) {
 
-             chart = chart(BWA.ChartOptions.Zone_TempHumi.getSeriesOptions(timeBoxForSearch.type(), t_temp(22), t_humi(33)));
 
-             initialized = true;
 
-         }
 
-         var eq = BWA.DataUtil.constructEqualFilter;
 
-         facilityDataSource.filter([
 
-             eq('SiteId', SiteId),
 
-             'and',
 
-             eq('FacilityTypeId', AIR_HANDLING)
 
-         ]);
 
-         facilityDataSource.load().done(function (facilities) {
 
-             facilitiesForSearch(facilities);
 
-             if (_.isEmpty(facilities) === false) {
 
-                 var f = facilities[0];
 
-                 handleSelectedFacilityInSearchView(f);
 
-                 handleSearchInSearchView();
 
-                 var datagrid = $('#airHandlingDataGridViewInSearchView').dxDataGrid('instance');
 
-                 if (_.has(datagrid, 'selectRows')) {
 
-                     datagrid.selectRows(f);
 
-                 }
 
-             }
 
-         });
 
-         if (shouldReload) {
 
-         }
 
-         $("#S_Temp_Btn").dxButton({
 
-             text: "기준온도 설정",
 
-             onClick: function () {
 
-                 if ($("#Set_Max_Temp").dxTextBox("instance") != null)
 
-                     $("#Set_Max_Temp").dxTextBox("instance").option('value', null);
 
-                 if ($("#Set_Min_Temp").dxTextBox("instance") != null)
 
-                     $("#Set_Min_Temp").dxTextBox("instance").option('value', null);
 
-                 tempvisiblePopup(true);
 
-             }
 
-         });
 
-     }
 
-     function handleViewHidden() {
 
-         $SearchView.visibleObservable(false); // hcLee 2015 03 23
 
-         visiblePopup(false);
 
-     }
 
-     function handleViewShowing() {
 
-     }
 
-     function refreshList() {
 
-     }
 
-     var searchViewOptions = {
 
-         searchViewItems: [
 
-             { id: 'FacilityCode', ignoreValue: 0, defaultValue: 0, value: facilityCodeForSearch, dataSource: facilitiesForSearch },
 
-         ],
 
-         promiseDataInSearchView: deferredForSearch.promise()
 
-     };
 
-     function handleSelectedFacilityInSearchView(facility) {
 
-         m_Facility = facility;
 
-         return;
 
-     }
 
-     function handleSearchInSearchView(filter, searchViewItems) {
 
-         if (m_Facility == null) return;
 
-         visiblePopup(true);
 
-         var f = m_Facility.toJS();
 
-         facilityViewModel.fromJS(f);
 
-         FacilityCode = f.FacilityCode;
 
-         var timeIntervalType = timeBoxForSearch.type();
 
-         var formula = $Code.Formula[AIR_HANDLING];
 
-         var formulaIds = _.values(formula);
 
-         var date = timeBoxForSearch.getDate();
 
-         var promises = [];
 
-         _.each(formulaIds, function (formulaId) {
 
-             var p = formulaGet.apiGet({
 
-                 FacilityTypeId: f.FacilityTypeId,
 
-                 FacilityCode: FacilityCode,
 
-                 FormulaId: formulaId,
 
-                 TimeIntervalType: timeIntervalType,
 
-                 StartDate: date.startDate,
 
-                 EndDate: date.endDate
 
-             });
 
-             promises.push(p);
 
-         });
 
-         // 외기 온도와 습도를 위해 추가 hcLee 2015 04 20  ->
 
-         var commonParameters = {
 
-             TimeIntervalType: timeIntervalType,
 
-             StartDate: date.startDate,
 
-             EndDate: date.endDate
 
-         };
 
-         var temperatureParameters = {
 
-             FacilityTypeId: FT.OUTDOOR,
 
-             FacilityCode: FC.OUTDOOR,
 
-             FormulaId: F[FT.OUTDOOR].TEMPERATURE,
 
-         };
 
-         var humidityParameters = _.extend({}, temperatureParameters, {
 
-             FormulaId: F[FT.OUTDOOR].HUMIDITY,
 
-         });
 
-         promises.push(formulaGet.apiGet(_.extend(temperatureParameters, commonParameters)));
 
-         promises.push(formulaGet.apiGet(_.extend(humidityParameters, commonParameters)));
 
-         // 외기 온도와 습도를 위해 추가 hcLee 2015 04 20  <-
 
-         //promises.push(utils.toast.show('공조기 성능분석 중 입니다. 잠시만 기다려 주세요'));
 
-         $.when.apply(this, promises)
 
-         .done(function (coldWaterCalories, hotWaterCalories, coldWaterAtfws,
 
-             hotWaterAtfws, in_temperatures, out_temperatures, cold_electricities, hot_electricities,
 
-             cold_vopen, hot_vopen,
 
-             cold_in_temperatures, cold_out_temperatures, // 이 2개는 2015 06 15일 추가
 
-             f_temp, f_humi, // 2015 07 10 추가  실내 온, 습도
 
-             co2, // 2015 07 10 추가
 
-             x16, x17, x18, x19, X20,
 
-             A21, A22, A23, A24, A25, A26,
 
-             S_TEMP, M_TEMP, S_HUMY, CO, DUST, OZONE, S_VOLUME, M_OPENING_RATE, ONOFF, DUTYCYCLE_CHECK, ENTHALPY_CHECK,
 
-             OUTtemperatures, OUTHumi) {
 
-             coldWaterCalories = coldWaterCalories[0];
 
-             hotWaterCalories = hotWaterCalories[0];
 
-             coldWaterAtfws = coldWaterAtfws[0];
 
-             hotWaterAtfws = hotWaterAtfws[0];
 
-             in_temperatures = in_temperatures[0];
 
-             out_temperatures = out_temperatures[0];
 
-             cold_electricities = cold_electricities[0];
 
-             hot_electricities = hot_electricities[0];
 
-             cold_vopen = cold_vopen[0];
 
-             hot_vopen = hot_vopen[0];
 
-             cold_in_temperatures = cold_in_temperatures[0];
 
-             cold_out_temperatures = cold_out_temperatures[0];
 
-             X20 = X20[0]; // 목표온도
 
-             f_temp = f_temp[0],// 2015 07 10 추가  실내 온도
 
-             f_humi = f_humi[0], // 2015 07 10 추가  실내 습도
 
-             co2 = co2[0]; // co2
 
-             OUTtemperatures = OUTtemperatures[0];
 
-             OUTHumi = OUTHumi[0];
 
-             var temp = f_temp;
 
-             var humi = f_humi;
 
-             var dataArray = [];
 
-             //  2017.09.08 : 그리드 도표 작업 : 팝업창 추가
 
-             var dataArray_Temp = [];
 
-             var dataArray_Temp1 = [];
 
-             var dataArray_Temp2 = [];
 
-             var dataArray_Temp3 = [];
 
-             var dataArray_Temp4 = [];
 
-             var dataArray_Temp5 = [];
 
-             var dataArray_final = []
 
-             //  2017.09.08 : 그리드 도표 작업 : 팝업창 추가
 
-             _.each(temp, function (x) {
 
-                 dataArray_Temp.push({
 
-                     DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
 
-                     temp: x.Value, //실내온도
 
-                 });
 
-             });
 
-             // 2016 04 12 추가
 
-             _.each(OUTtemperatures, function (x) {
 
-                 dataArray_Temp2.push({
 
-                     DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
 
-                     Temperature: x.Value //외기온도
 
-                 });
 
-             });
 
-             _.each(humi, function (x) {
 
-                 dataArray_Temp3.push({
 
-                     DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
 
-                     humi: x.Value,  //실내습도
 
-                 });
 
-             });
 
-             // 2016 04 12 추가
 
-             _.each(OUTHumi, function (x) {
 
-                 dataArray_Temp4.push({
 
-                     DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
 
-                     Humidity: x.Value //외기습도
 
-                 });
 
-             });
 
-             _.each(co2, function (x) {
 
-                 dataArray_Temp5.push({
 
-                     DateTime: BWA.Chart.getCustermTimeArgumentAxisString(timeBoxForSearch.type(), moment(x.DateTime).toDate()),
 
-                     co2: x.Value, //CO2농도
 
-                 });
 
-             });
 
-             t_temp(0);
 
-             t_humi(0);
 
-             //  2017.09.08 : 그리드 도표 작업 : 팝업창 추가
 
-             // 배열을 하나로 합치자  
 
-             var array_length_size = Math.max(dataArray_Temp.length, dataArray_Temp2.length, dataArray_Temp3.length, dataArray_Temp4.length, dataArray_Temp5.length);
 
-             // 크기가 동일한 경우에만 허용함 (예외 방어용)
 
-             if ((dataArray_Temp.length == dataArray_Temp2.length) && (dataArray_Temp2.length == dataArray_Temp3.length) && (dataArray_Temp3.length == dataArray_Temp4.length) && (dataArray_Temp4.length == dataArray_Temp5.length)) {
 
-                 for (var i = 0; i < array_length_size; i++) {
 
-                     dataArray.push(
 
-                         {
 
-                             DateTime: dataArray_Temp[i].DateTime,
 
-                             temp: dataArray_Temp[i].temp,
 
-                             Temperature: dataArray_Temp2[i].Temperature,
 
-                             humi: dataArray_Temp3[i].humi,
 
-                             Humidity: dataArray_Temp4[i].Humidity,
 
-                             co2: dataArray_Temp5[i].co2
 
-                         });
 
-                 }
 
-             }
 
-             var BemsSTempDataSource = new DevExpress.data.DataSource({
 
-                 store: {
 
-                     type: "odata",
 
-                     url: endpointSelector + "/BemsControlAHUTempConfig"
 
-                 },
 
-                 requireTotalCount: true,
 
-                 pageSize: 1
 
-             });
 
-             BemsSTempDataSource.filter([
 
-                 ['SiteId', "=", SiteId],
 
-                  'and',
 
-                 ['FacilityCode', "=", FacilityCode]
 
-             ]);
 
-             BemsSTempDataSource.load()
 
-             .done(function (STemp) {
 
-                 var Maxtemp, Mintemp;
 
-                 if (STemp.length == 0) {
 
-                     //utils.toast.show("공조기 기준온도가 없습니다.");
 
-                     dataArray_final = dataArray;
 
-                 }
 
-                 else {
 
-                     Maxtemp = STemp[0].MaxTemperature;
 
-                     Mintemp = STemp[0].MinTemperature;
 
-                     for (var i = 0; i < dataArray.length; i++) {
 
-                         dataArray_final.push(
 
-                             {
 
-                                 DateTime: dataArray[i].DateTime,
 
-                                 temp: dataArray[i].temp,
 
-                                 Temperature: dataArray[i].Temperature,
 
-                                 humi: dataArray[i].humi,
 
-                                 Humidity: dataArray[i].Humidity,
 
-                                 co2: dataArray[i].co2,
 
-                                 tempSetminT: Mintemp,
 
-                                 tempSetmaxT: Maxtemp,
 
-                             });
 
-                     }
 
-                 }
 
-                 dataArrayresult = dataArray_final;
 
-                 // 2017.09.08 : 그리드 도표 작업 : 팝업창 추가
 
-                 var options = BWA.ChartOptions.Zone_TempHumi.getSeriesOptions(timeBoxForSearch.type(), t_temp(), t_humi());
 
-                 options.dataSource = dataArray_final;
 
-                 chart().option(options);
 
-                 $('#st').text(f.Name + ' : ' + '(' + f.FacilityUsage + ')   온,습도 현황');
 
-                 visiblePopup(false);
 
-             });
 
-         })
 
-         .fail(function (error) {
 
-             visiblePopup(false);
 
-         });
 
-     }
 
-     function handleMenuItemClick(e) {
 
-         var chartIntance = chart();
 
-         var chartOptions = chartIntance._options;
 
-         var series = chartIntance.getAllSeries();
 
-         var table = [];
 
-         var columns = [chartOptions.argumentAxis.title];
 
-         var values = {};
 
-         _.each(chartOptions.valueAxis, function (a) {
 
-             columns.push(a.title.text);
 
-         });
 
-         _.each(series, function (s, i) {
 
-             _.each(s.pointsByArgument, function (point, argument) {
 
-                 var array = values[argument];
 
-                 if (_.isArray(array) === false) {
 
-                     array = values[argument] = [];
 
-                 }
 
-                 array[i] = point.value;
 
-             });
 
-         });
 
-         var csvRows = [columns.join(',')];
 
-         _.each(values, function (values, argument) {
 
-             csvRows.push([$G.dateTime(moment(Number(argument))), values.join(',')].join(','));
 
-         });
 
-         var csvContent = csvRows.join("\r\n");
 
-         var agent = navigator.userAgent.toLowerCase();
 
-         if (window.navigator.msSaveOrOpenBlob) {
 
-             var fileData = ['\uFEFF' + csvContent];
 
-             var blobObject = new Blob(fileData);
 
-             window.navigator.msSaveOrOpenBlob(blobObject, 'export.csv');
 
-         }
 
-         else {
 
-             var csvString = 'data:text/csv;utf-8,\uFEFF' + encodeURI(csvContent);
 
-             var a = $('#csvExporter');
 
-             a.attr({
 
-                 'href': csvString,
 
-                 'target': '_blank',
 
-                 'download': 'export.csv'
 
-             });
 
-             var aa = document.getElementById('csvExporter');
 
-             aa.click();
 
-         }
 
-     }
 
-     //  2017.09.08 : 그리드 도표 작업 : 팝업창 추가
 
-     function DataGridPopup_ButtonClick() {
 
-         DataGridPopup_Visible(true);
 
-     }
 
-     function handlePopupShown() {
 
-         // 데이타소스 업데이트
 
-         $("#Zone_TempHumiDataGrid_Container").dxDataGrid("instance").option("dataSource", dataArrayresult);
 
-         // 팝업창 갱신
 
-         DataGridPopup_Visible(true);
 
-     }
 
-     //  2017.09.08 : 그리드 도표 작업 : 팝업창 추가
 
-     var viewModel = $.extend(BWA.CommonView.create(
 
-             params, viewInfo, searchViewOptions, ko.observable(null), handleViewShown, null,
 
-             handleSearchInSearchView, undefined), {
 
-                 refreshList: refreshList,
 
-                 viewShowing: handleViewShowing,
 
-                 viewHidden: handleViewHidden, // hcLee 2015 03 23
 
-                 airHandlingDataGridOptions: {
 
-                     dataSource: facilitiesForSearch,
 
-                     columns: [
 
-                         { dataField: 'Name', caption: $G('facilityName'), width: '100%', alignment: 'left' },
 
-                     ],
 
-                     filterRow: {
 
-                         visible: true,
 
-                         showOperationChooser: false
 
-                     },
 
-                     selection: {
 
-                         mode: 'single'
 
-                     },
 
-                     rowClick: function (clickRow) {
 
-                         handleSelectedFacilityInSearchView(clickRow.data);
 
-                     }
 
-                 },
 
-                 handleMenuItemClick: handleMenuItemClick,
 
-                 menuItems: [{
 
-                     text: '엑셀(csv) 내보내기'
 
-                 }]
 
-                 //  2017.09.08 : 그리드 도표 작업 : 팝업창 추가
 
-                 , Zone_TempHumiDataGridPopup_ButtonClicked: DataGridPopup_ButtonClick
 
-                 //  2017.09.08 : 그리드 도표 작업 : 팝업창 추가
 
-             });
 
-     //  2017.09.08 : 그리드 도표 작업 : 팝업창 추가
 
-     viewModel.Zone_TempHumiDataGridPopupOptions = {
 
-         width: '700px',
 
-         height: '750px', // cyim 2017.05.30 : 테스트 결과 Devextreme 버그임. px 로 지정하면 초기 출력시 정확하게 가운데에 있지만, auto 설정시 화면아래에 위치하게 됨
 
-         contentTemplate: "content",
 
-         showTitle: true,
 
-         title: "도표",
 
-         visible: DataGridPopup_Visible,
 
-         dragEnabled: true,
 
-         closeOnOutsideClick: true,
 
-         shownAction: handlePopupShown,
 
-         animation: window.utils.popup.createAnimation()
 
-     };
 
-     //  2017.09.08 : 그리드 도표 작업 : 팝업창 추가
 
-     viewModel.timeBoxForSearch = timeBoxForSearch;
 
-     viewModel.temppopupOptions = {
 
-         width: 330,
 
-         height: 200,
 
-         visible: tempvisiblePopup,
 
-         dragEnabled: true,
 
-         shading: true,
 
-         closeOnOutsideClick: true,
 
-         shadingColor: 'transparent',
 
-         showTitle: true,
 
-         title: "기준온도 설정",
 
-         showCloseButton: true,
 
-         onShowing: function () {
 
-         },
 
-         onShown: function (t, tt) {
 
-             $("#Save_Btn").dxButton({
 
-                 text: "저장",
 
-                 onClick: function () {
 
-                     var tempMaxvalue = $("#Set_Max_Temp").dxTextBox("instance").option('value');
 
-                     var tempMinvalue = $("#Set_Min_Temp").dxTextBox("instance").option('value');
 
-                     if (!isNumber(tempMaxvalue) || !isNumber(tempMinvalue)) {
 
-                         utils.toast.show("숫자를 입력해주십시요.");
 
-                     }
 
-                     if (!(tempMaxvalue >= tempMinvalue)) {
 
-                         utils.toast.show("기준온도 최대값 , 최소값이 잘못 입력되었습니다.");
 
-                         return;
 
-                     }
 
-                     else {
 
-                         tempMaxvalue = parseFloat(parseFloat(tempMaxvalue).toFixed(2));
 
-                         tempMinvalue = parseFloat(parseFloat(tempMinvalue).toFixed(2));
 
-                         $("#Set_Max_Temp").dxTextBox("instance").option('value', tempMaxvalue);
 
-                         $("#Set_Min_Temp").dxTextBox("instance").option('value', tempMinvalue);
 
-                         var BemsSTempDataSource = new DevExpress.data.DataSource({
 
-                             store: {
 
-                                 type: "odata",
 
-                                 url: endpointSelector + "/BemsControlAHUTempConfig"
 
-                             },
 
-                             requireTotalCount: true,
 
-                             pageSize: 1
 
-                         });
 
-                         BemsSTempDataSource.filter([
 
-                             ['SiteId', "=", SiteId],
 
-                              'and',
 
-                             ['FacilityCode', "=", FacilityCode]
 
-                         ]);
 
-                         BemsSTempDataSource.load()
 
-                         .done(function (STemp) {
 
-                             if (STemp.length == 0) {
 
-                                 BWA.api.post('BemsControlAHUTempConfig/Insert', {
 
-                                     SiteId: SiteId,
 
-                                     FacilityTypeId: AIR_HANDLING,
 
-                                     FacilityCode: FacilityCode,
 
-                                     MaxTemperature: tempMaxvalue,
 
-                                     MinTemperature: tempMinvalue
 
-                                 }).done(function () {
 
-                                     utils.toast.show("공조기 기준온도를 설정하였습니다.");
 
-                                     tempvisiblePopup(false);
 
-                                 }).fail(function (error) {
 
-                                     utils.toast.show("공조기 기준온도 설정를 실패하였습니다.");
 
-                                 });
 
-                             }
 
-                             else {
 
-                                 BWA.api.post('BemsControlAHUTempConfig/Update', {
 
-                                     SiteId: SiteId,
 
-                                     FacilityTypeId: AIR_HANDLING,
 
-                                     FacilityCode: FacilityCode,
 
-                                     MaxTemperature: tempMaxvalue,
 
-                                     MinTemperature: tempMinvalue
 
-                                 }).done(function () {
 
-                                     utils.toast.show("공조기 기준온도를 설정하였습니다.");
 
-                                     tempvisiblePopup(false);
 
-                                 }).fail(function (error) {
 
-                                     utils.toast.show("공조기 기준온도 설정를 실패하였습니다.");
 
-                                 });
 
-                             }
 
-                             handleSelectedFacilityInSearchView(m_Facility);
 
-                             handleSearchInSearchView();
 
-                             var datagrid = $('#airHandlingDataGridViewInSearchView').dxDataGrid('instance');
 
-                             if (_.has(datagrid, 'selectRows')) {
 
-                                 datagrid.selectRows(f);
 
-                             }
 
-                         });
 
-                     }
 
-                 }
 
-             });
 
-             $("#Set_Max_Temp").dxTextBox({
 
-                 placeholder: "기준온도 최대값 설정"
 
-             });
 
-             $("#Set_Min_Temp").dxTextBox({
 
-                 placeholder: "기준온도 최소값 설정"
 
-             });
 
-         },
 
-         onHidden: function () {
 
-         }
 
-     };
 
-     viewModel.popupOptions = {
 
-         width: 300,
 
-         height: 100,
 
-         contentTemplate: "info",
 
-         showTitle: false,
 
-         title: "메세지",
 
-         visible: visiblePopup,
 
-         dragEnabled: false,
 
-         shading: false,
 
-         closeOnOutsideClick: false
 
-     };
 
-     //  2017.09.08 : 그리드 도표 작업 : 팝업창 추가
 
-     // 주석이 너무 없음. 나중에 변경 작업을 진행하는 누군가가 시간 소비를 하지 않기 위해...남김
 
-     // 시간 포맷은 그래프에 귀속해야 되므로 포맷은 변경하지 않는 것이 유리함
 
-     // 전기,가스,수도 와 같이 선택적으로 변경해야 된다면 아래와 같이 캡션은 고정하지 말것
 
-     viewModel.Zone_TempHumiDataGridOptions = {
 
-         dataSource: dataArrayresult,
 
-         paging: { pageSize: 17 },
 
-         columns: [
 
-             { dataField: 'DateTime', caption: "날짜", width: '12%', alignment: 'center', format: 'fixedPoint', precision: 2 },
 
-             { dataField: 'tempSetminT', caption: "목표실내온도(최소)", width: '19%', alignment: 'center', format: 'fixedPoint', precision: 2 },
 
-             { dataField: 'tempSetmaxT', caption: "목표실내온도(최대)", width: '19%', alignment: 'center', format: 'fixedPoint', precision: 2 },
 
-             { dataField: 'temp', caption: "실내온도", width: '10%', alignment: 'center', format: 'fixedPoint', precision: 2 },
 
-             { dataField: 'Temperature', caption: "외기온도", width: '10%', alignment: 'center', format: 'fixedPoint', precision: 2 },
 
-             { dataField: 'humi', caption: "실내습도", width: '10%', alignment: 'center', format: 'fixedPoint', precision: 2 },
 
-             { dataField: 'Humidity', caption: "외기습도", width: '10%', alignment: 'center', format: 'fixedPoint', precision: 2 },
 
-             { dataField: 'co2', caption: "CO2농도", width: '10%', alignment: 'center', format: 'fixedPoint', precision: 2 }
 
-         ],
 
-         // 엑셀 출력
 
-         "export": {
 
-             enabled: true,
 
-             fileName: '실내환경 분석'
 
-         }
 
-     };
 
-     //  2017.09.08 : 그리드 도표 작업 : 팝업창 추가
 
-     return viewModel;
 
- };
 
 
  |