12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481 |
- BemsWebApplication.SimulatorIceStorage = 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 BemsIceThermalStorageDataSource = BemsWebApplication.db.createDataSource('BemsIceThermalStorageSimulation');
- var timeBoxForSearch = BWA.SearchView.createDateTimeBox($G.TimeTypesForDayOnly);
- var visibleConfigPopup = ko.observable(false);
- var timer;
- var initialized = false;
- var initializedforPopUp = false;
- var iceThermalStorage_SimulationValueGet = new BWA.Chart.IceThermalStorage_SimulationValueGet(BWA.UserInfo.SiteId());
- var chart = BWA.Chart.Instance('chartIS', 'dxChart');
- // 그리드 도표 작업 : 팝업창 추가
- // 팝업창뷰 보이기 속성 제어용 변수 선언
- var DataGridPopup_Visible = ko.observable(false);
- // 그래프 출력 이후 엑셀출력을 위한 팝업창을 위해 임시 저장용 배열 선언
- var dataArrayresult = ko.observableArray();
- // 그리드 도표 작업 : 팝업창 추가
- var dataArrayforPopup = []; // 도표에 들어갈 변수
- var visibleHourGlassPopup = ko.observable(false);
- var visibleEditButton = ko.observable(true); // 수정 버튼 활성화 여부 플래그
- var hasnotModificationPermission = ko.observable(false); // 수정버튼 비활성화 플래그
- var isEditModeInPopup = ko.observable(false); // 저장버튼 활성화 플래그
- var isNotModifyMode = ko.observable(true); // 저장버튼 비활성화 플래그
- var visibleCancelButton = ko.observable(false); // 취소버튼 활성화 플래그
- var simulatoricestoragePopupToolbarItems = [
- { location: 'before', text: '사용자 시뮬레이터 변수 설정' },
- { location: 'after', widget: 'button', options: { text: $G('edit'), icon: 'edit', visible: visibleEditButton, disabled: hasnotModificationPermission, clickAction: handlePopupButtonEdit } },
- { location: 'after', widget: 'button', options: { text: $G('cancel'), icon: 'cancel', visible: visibleCancelButton, clickAction: handlePopupButtonCancel } },
- { location: 'after', widget: 'button', options: { text: $G('save'), icon: 'save', visible: isEditModeInPopup, disabled: isNotModifyMode, clickAction: handlePopupButtonSave } },
- { location: 'after', widget: 'button', options: { text: $G('close'), icon: 'close', visible: true, disabled: false, clickAction: PopupButtonClose } }
- ];
- var CurrntRowStatusAsSave = 1; // 저장했을때 최종 row 인덱스 (취소, 닫기했을때 이전 최종 행 위치를 알기 위함)
- // 편집 중인 행과 활성화 여부 플래그
- var EditingFirstRow = ko.observable(true);
- var EditingSecondRow = ko.observable(false);
- var EditingThirdRow = ko.observable(false);
- var EditingFourthRow = ko.observable(false);
- var EditingFifthRow = ko.observable(false);
- var isSecondRow = ko.observable(false);
- var isThirdRow = ko.observable(false);
- var isFourthRow = ko.observable(false);
- var isFifthRow = ko.observable(false);
-
- //Initial Date는 지금 시점 이후부터 입력(initialDate와 finalDate는 기준 시작, 종료 일시)
- var initialDate = new Date();
- initialDate.setMinutes((parseInt(initialDate.getMinutes() / 15)) * 15);
- var finalDate = new Date();
- if (finalDate.getHours() < 21) {
- finalDate.setHours(0)
- finalDate.setMinutes(45);
- finalDate.setSeconds(0);
- finalDate = moment(finalDate).add(20, 'hours').toDate();
- }
- else {
- finalDate.setHours(0)
- finalDate.setMinutes(45);
- finalDate.setSeconds(0);
- finalDate = moment(finalDate).add(1, 'days').toDate();
- finalDate = moment(finalDate).add(20, 'hours').toDate();
- }
- // 행 추가, 제거시 기억할 변수 선언
- var initDate_prev = new Array();
- var finalDate_prev = new Array();
- var operationMode_prev = new Array();
- var ref1Status_prev = new Array();
- var ref2Status_prev = new Array();
- // 저장시 기억할 변수 선언 (~_asSave)
- var initDate_asSave = new Array(new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate));
- var finalDate_asSave = new Array(new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate));
- var operationMode_asSave = new Array(null, null, null, null, null);
- var ref1Status_asSave = new Array(null, null, null, null, null);
- var ref2Status_asSave = new Array(null, null, null, null, null);
- var treeOperationMode = [
- {
- id: 0,
- text: "OFF",
- value: 0
- },
- {
- id: 1,
- text: "제빙운전",
- value: 10
- },
- {
- id: 2,
- text: "축단운전",
- value: 20
- },
- {
- id: 3,
- text: "병렬운전",
- value: 30
- },
- {
- id: 4,
- text: "냉단운전",
- value: 40
- }
- ];
- // 현재시점에 최종 수정 row 플래그
- function EditingRowArrange() {
- var Edit_idx = [false, false, false, false, false];
- var EnDis_idx = [false, false, false, false, false];
- Edit_idx[CurrntRowStatusAsSave - 1] = true;
- for (var i = 0; i < CurrntRowStatusAsSave; i++) {
- EnDis_idx[i] = true;
- }
- EditingFirstRow(Edit_idx[0]);
- EditingSecondRow(Edit_idx[1]);
- EditingThirdRow(Edit_idx[2]);
- EditingFourthRow(Edit_idx[3]);
- EditingFifthRow(Edit_idx[4]);
- isSecondRow(EnDis_idx[1]);
- isThirdRow(EnDis_idx[2]);
- isFourthRow(EnDis_idx[3]);
- isFifthRow(EnDis_idx[4]);
- }
- // 팝업뜰 때마다 호출 (수정모드 템플릿)
- function InitializedTemplate() {
- visibleEditButton(true);
- hasnotModificationPermission(false);
- isEditModeInPopup(false);
- isNotModifyMode(true);
- visibleCancelButton(false);
- EditingRowArrange(); // 현재시점에 최종 수정 row 플래그
- // 팝업뜰때는 수정모드가 아니므로 모두 disabled
- for (var i = 0; i < 5; i++) {
- EnableDisableRow(i + 1, true);
- }
- }
- //초기 데이터 initialize
- function InitializedData() {
- var initialDate_ = new Date();
- initialDate_.setMinutes((parseInt(initialDate_.getMinutes() / 15)) * 15); // 15분 단위 맞춰주기 위함
- initialDate_.setSeconds(0);
- var finalDate_ = new Date();
- if (finalDate_.getHours() < 21) {
- finalDate_.setHours(0)
- finalDate_.setMinutes(45);
- finalDate_.setSeconds(0);
- finalDate_ = moment(finalDate_).add(20, 'hours').toDate();
- }
- else {
- finalDate_.setHours(0)
- finalDate_.setMinutes(45);
- finalDate_.setSeconds(0);
- finalDate_ = moment(finalDate_).add(1, 'days').toDate();
- finalDate_ = moment(finalDate_).add(20, 'hours').toDate();
- }
- for (var i = 0; i < 5; i++) {
- BoxInitialize(i + 1, initialDate_, finalDate_);
- EnableDisableRow(i + 1, true); // 초기는 수정모드가 아니므로 모두 disabled
- }
- }
-
- // 수정 버튼 클릭시 호출 함수
- function handlePopupButtonEdit() {
- visibleEditButton(false);
- hasnotModificationPermission(true);
- isEditModeInPopup(true);
- isNotModifyMode(false);
- visibleCancelButton(true);
- EditingRowArrange(); // 현재시점에 최종 수정 row 플래그
- EnableDisableRow(CurrntRowStatusAsSave, false); // 현재시점에 최종 수정 row 활성화
- }
- // ~_prev 변수 입력
- function prevDataWrite(row_num) {
- $("#InitialDate" + (row_num).toString()).dxDateBox('instance').option('value', initDate_prev[row_num - 1]);
- $("#InitialTime" + (row_num).toString()).dxDateBox('instance').option('value', initDate_prev[row_num - 1]);
- $("#FinalDate" + (row_num).toString()).dxDateBox('instance').option('value', finalDate_prev[row_num - 1]);
- $("#FinalTime" + (row_num).toString()).dxDateBox('instance').option('value', finalDate_prev[row_num - 1]);
- $("#OperationMode" + (row_num).toString()).dxSelectBox('instance').option('value', operationMode_prev[row_num - 1]);
- $("#Ref1_Status" + (row_num).toString()).dxSwitch('instance').option('value', ref1Status_prev[row_num - 1]);
- $("#Ref2_Status" + (row_num).toString()).dxSwitch('instance').option('value', ref2Status_prev[row_num - 1]);
- }
- function DeleteRow() {
- var now_ = new Date();
- var finalDate_ = new Date(now_.getFullYear(), now_.getMonth(), now_.getDate(), 20, 45, 0);
- if (now_.getHours() >= 21) {
- finalDate_ = moment(finalDate_).add(1, 'days').toDate();
- }
- if (EditingFirstRow() === true) {
- $("#FinalDate1").dxDateBox('instance').option('value', finalDate_);
- $("#FinalTime1").dxDateBox('instance').option('value', finalDate_);
- $("#OperationMode1").dxSelectBox('instance').option('value', null);// 운전 모드 클리어
- $("#Ref1_Status1").dxSwitch('instance').option('value', false);// 냉동기1 운전 모드 클리어
- $("#Ref2_Status1").dxSwitch('instance').option('value', false);// 냉동기2 운전 모드 클리어
-
- }
- else if (EditingSecondRow() === true) {
- $("#FinalDate2").dxDateBox('instance').option('value', finalDate_);
- $("#FinalTime2").dxDateBox('instance').option('value', finalDate_);
- $("#OperationMode2").dxSelectBox('instance').option('value', null);// 운전 모드 클리어
- $("#Ref1_Status2").dxSwitch('instance').option('value', false);// 냉동기1 운전 모드 클리어
- $("#Ref2_Status2").dxSwitch('instance').option('value', false);// 냉동기2 운전 모드 클리어
- EnableDisableRow(1, false);
- EditingFirstRow(true);
- EditingSecondRow(false);
- isSecondRow(false);
- prevDataWrite(1); // 행 삭제시 이전 행의 변수 초기화로 다시 쓰기
- }
- else if (EditingThirdRow() === true) {
- $("#FinalDate3").dxDateBox('instance').option('value', finalDate_);
- $("#FinalTime3").dxDateBox('instance').option('value', finalDate_);
- $("#OperationMode3").dxSelectBox('instance').option('value', null);// 운전 모드 클리어
- $("#Ref1_Status3").dxSwitch('instance').option('value', false);// 냉동기1 운전 모드 클리어
- $("#Ref2_Status3").dxSwitch('instance').option('value', false);// 냉동기2 운전 모드 클리어
- EnableDisableRow(2, false);
- EditingSecondRow(true);
- EditingThirdRow(false);
- isThirdRow(false);
- prevDataWrite(2); // 행 삭제시 이전 행의 변수 초기화로 다시 쓰기
- }
- else if (EditingFourthRow() === true) {
- $("#FinalDate4").dxDateBox('instance').option('value', finalDate_);
- $("#FinalTime4").dxDateBox('instance').option('value', finalDate_);
- $("#OperationMode4").dxSelectBox('instance').option('value', null);// 운전 모드 클리어
- $("#Ref1_Status4").dxSwitch('instance').option('value', false);// 냉동기1 운전 모드 클리어
- $("#Ref2_Status4").dxSwitch('instance').option('value', false);// 냉동기2 운전 모드 클리어
- EnableDisableRow(3, false);
- EditingThirdRow(true);
- EditingFourthRow(false);
- isFourthRow(false);
- prevDataWrite(3); // 행 삭제시 이전 행의 변수 초기화로 다시 쓰기
- }
- else if (EditingFifthRow() === true) {
- $("#FinalDate5").dxDateBox('instance').option('value', finalDate_);
- $("#FinalTime5").dxDateBox('instance').option('value', finalDate_);
- $("#OperationMode5").dxSelectBox('instance').option('value', null);// 운전 모드 클리어
- $("#Ref1_Status5").dxSwitch('instance').option('value', false);// 냉동기1 운전 모드 클리어
- $("#Ref2_Status5").dxSwitch('instance').option('value', false);// 냉동기2 운전 모드 클리어
- EnableDisableRow(4, false);
- EditingFourthRow(true);
- EditingFifthRow(false);
- isFifthRow(false);
- prevDataWrite(4); // 행 삭제시 이전 행의 변수 초기화로 다시 쓰기
- }
- }
-
- function FilledRow(row_num) {
- $("#InitialDate" + row_num.toString()).dxDateBox('instance').option('value', initDate_asSave[row_num - 1]);
- $("#InitialTime" + row_num.toString()).dxDateBox('instance').option('value', initDate_asSave[row_num - 1]);
- $("#FinalDate" + row_num.toString()).dxDateBox('instance').option('value', finalDate_asSave[row_num - 1]);
- $("#FinalTime" + row_num.toString()).dxDateBox('instance').option('value', finalDate_asSave[row_num - 1]);
- $("#OperationMode" + row_num.toString()).dxSelectBox('instance').option('value', operationMode_asSave[row_num - 1]);
- $("#Ref1_Status" + row_num.toString()).dxSwitch('instance').option('value', ref1Status_asSave[row_num - 1]);
- $("#Ref2_Status" + row_num.toString()).dxSwitch('instance').option('value', ref2Status_asSave[row_num - 1]);
- }
- // 취소 버튼 클릭시 호출 함수
- function handlePopupButtonCancel() {
- // 전체 열에 대해서 모두 삭제하고 저장된 열들만 다시 채워준다
- for (var i = 0; i < 5; i++) {
- DeleteRow();
- }
- for (var i = 0; i < 5; i++) {
- if (operationMode_asSave[i] != null) {
- FilledRow(i + 1);
- }
- }
- visibleEditButton(true);
- hasnotModificationPermission(false);
- isEditModeInPopup(false);
- isNotModifyMode(true);
- visibleCancelButton(false);
- EditingRowArrange(); // 현재시점에 최종 수정 row 플래그
- for (var i = 0; i < 5; i++) {
- EnableDisableRow(i + 1, true);
- }
- }
- // 데이터 DB 입력 함수
- function insert(postData) {
- BemsIceThermalStorageDataSource.filter([
- ["SiteId", "=", BWA.UserInfo.SiteId()],
- "and",
- ["FacilityCode", "=", postData.FacilityCode],
- "and",
- ["PropertyId", "=", postData.PropertyId],
- "and",
- ["SimulationCase", "=", postData.SimulationCase],
- "and",
- ["TargetDateTime", "=", postData.TargetDateTime]
- ]);
- //BemsIceThermalStorageDataSource.sort({ getter: "TargetDateTime", desc: true });
- BemsIceThermalStorageDataSource.load()
- .done(function (result) {
- var store = new DevExpress.data.ODataStore({
- url: endpointSelector + "/BemsIceThermalStorageSimulation",
- key: ["SiteId", "FacilityCode", "PropertyId", "CreatedDateTime", "TargetDateTime", "SimulationCase"],
- keyType: {
- SiteId: "Int32", FacilityCode: "Int32", PropertyId: "Int32", CreatedDateTime: "DateTime", TargetDateTime: "DateTime", SimulationCase: "Int32"
- }
- });
- if (result.length != 0) {
- var removeData = {
- SiteId: result[0].SiteId(),
- FacilityTypeId: result[0].FacilityTypeId(),
- FacilityCode: result[0].FacilityCode(),
- PropertyId: result[0].PropertyId(),
- CreatedDateTime: new Date(result[0].CreatedDateTime()),
- TargetDateTime: new Date(result[0].TargetDateTime()),
- SimulationValue: result[0].SimulationValue(),
- SimulationCase: result[0].SimulationCase()
- };
- store.remove(removeData).done(function (values, key) {
- store.insert(postData).done(function (key, result) {
- //utils.toast.show($G('successDatabaseInsertionMsg'));
- visibleConfigPopup(false);
- })
- .fail(function (error) {
- utils.toast.show(error, 'error');
- });
- })
- .fail(function (error) {
- utils.toast.show(error, 'error');
- });
- }
- else {
- store.insert(postData).done(function (key, result) {
- //utils.toast.show($G('successDatabaseInsertionMsg'));
- visibleConfigPopup(false);
- })
- .fail(function (error) {
- utils.toast.show(error, 'error');
- });
- }
- });
- }
- function DataArrange(initialDate_, finalDate_, facilityTypeId, facilityCode, propertyId, value, simulationCase) {
- var now_date = new Date();
- var comparedDate = new Date(initialDate_.getFullYear(), initialDate_.getMonth(), initialDate_.getDate(), initialDate_.getHours(), initialDate_.getMinutes(), 0);
- while (comparedDate <= finalDate_) {
- //insert
- var nowDate_tmp = new Date(now_date.getFullYear(), now_date.getMonth(), now_date.getDate(), now_date.getHours(), now_date.getMinutes(), now_date.getSeconds());
- var tmpDate = new Date(comparedDate.getFullYear(), comparedDate.getMonth(), comparedDate.getDate(), comparedDate.getHours(), comparedDate.getMinutes(), 0);
- var postViewModel = new BemsWebApplication.BemsIceThermalStorageSimulationViewModel();
- postViewModel.SiteId(BWA.UserInfo.SiteId());
- postViewModel.FacilityTypeId(facilityTypeId);
- postViewModel.FacilityCode(facilityCode);
- postViewModel.PropertyId(propertyId);
- postViewModel.CreatedDateTime(nowDate_tmp);
- postViewModel.TargetDateTime(tmpDate);
- postViewModel.SimulationValue(value);
- postViewModel.SimulationCase(simulationCase);
- var postData = postViewModel.toJS();
- insert(postData);
- comparedDate.setMinutes(comparedDate.getMinutes() + 15);
- }
- }
- function DataExtract(row_num) {
- var islastRow = false;
- if (EditingFirstRow() == true && row_num == 1) { islastRow = true; }
- else if (EditingSecondRow() == true && row_num == 2) { islastRow = true; }
- else if (EditingThirdRow() == true && row_num == 3) { islastRow = true; }
- else if (EditingFourthRow() == true && row_num == 4) { islastRow = true; }
- else if (EditingFifthRow() == true && row_num == 5) { islastRow = true; }
- // 데이터 저장
- // 현재 활성화된 마지막 행만 ~_prev 데이터에 저장하고 DB 입력을 위한 부분, 이전행은 '행 추가' 버튼 클릭시 저장됨
- if (islastRow) {
- var tmp_initDate_ = $("#InitialTime" + (row_num).toString()).dxDateBox('instance').option('value');
- initDate_prev[row_num - 1] = new Date(tmp_initDate_.getFullYear(), tmp_initDate_.getMonth(), tmp_initDate_.getDate(), tmp_initDate_.getHours(), tmp_initDate_.getMinutes(), 0);
- initDate_asSave[row_num - 1] = new Date(tmp_initDate_.getFullYear(), tmp_initDate_.getMonth(), tmp_initDate_.getDate(), tmp_initDate_.getHours(), tmp_initDate_.getMinutes(), 0);
- var tmp_finalDate_ = $("#FinalTime" + (row_num).toString()).dxDateBox('instance').option('value');
- finalDate_prev[row_num - 1] = new Date(tmp_finalDate_.getFullYear(), tmp_finalDate_.getMonth(), tmp_finalDate_.getDate(), tmp_finalDate_.getHours(), tmp_finalDate_.getMinutes(), 0);
- finalDate_asSave[row_num - 1] = new Date(tmp_finalDate_.getFullYear(), tmp_finalDate_.getMonth(), tmp_finalDate_.getDate(), tmp_finalDate_.getHours(), tmp_finalDate_.getMinutes(), 0);
- operationMode_prev[row_num - 1] = $("#OperationMode" + (row_num).toString()).dxSelectBox('instance').option('value');
- operationMode_asSave[row_num - 1] = $("#OperationMode" + (row_num).toString()).dxSelectBox('instance').option('value');
- ref1Status_prev[row_num - 1] = $("#Ref1_Status" + (row_num).toString()).dxSwitch('instance').option('value');
- ref1Status_asSave[row_num - 1] = $("#Ref1_Status" + (row_num).toString()).dxSwitch('instance').option('value');
- ref2Status_prev[row_num - 1] = $("#Ref2_Status" + (row_num).toString()).dxSwitch('instance').option('value');
- ref2Status_asSave[row_num - 1] = $("#Ref2_Status" + (row_num).toString()).dxSwitch('instance').option('value');
- if (ref1Status_prev[row_num - 1]) { var ref1Status_int = 1; } else { var ref1Status_int = 0; }
- if (ref2Status_prev[row_num - 1]) { var ref2Status_int = 1; } else { var ref2Status_int = 0; }
- DataArrange(initDate_prev[row_num - 1], finalDate_prev[row_num - 1], 3, 4478, 16, parseInt(operationMode_prev[row_num - 1] * 10), 1); // 0: OFF, 10: 제빙, 20: 축단, 30:병렬, 40: 냉단
- DataArrange(initDate_prev[row_num - 1], finalDate_prev[row_num - 1], 2, 4479, 15, ref1Status_int, 1);
- DataArrange(initDate_prev[row_num - 1], finalDate_prev[row_num - 1], 2, 4480, 15, ref2Status_int, 1);
- }
- else {
- // 날짜 박스에서 불러올 경우 enable된 열의 날짜를 불러오기때문에 ~_prev 변수에서 불러옴
- var initDate_ = initDate_prev[row_num - 1];
- var finalDate_ = finalDate_prev[row_num - 1];
- initDate_asSave[row_num - 1] = initDate_prev[row_num - 1];
- finalDate_asSave[row_num - 1] = finalDate_prev[row_num - 1];
- var operationMode = $("#OperationMode" + (row_num).toString()).dxSelectBox('instance').option('value');
- operationMode_asSave[row_num - 1] = $("#OperationMode" + (row_num).toString()).dxSelectBox('instance').option('value');
- var ref1Status = $("#Ref1_Status" + (row_num).toString()).dxSwitch('instance').option('value');
- ref1Status_asSave[row_num - 1] = $("#Ref1_Status" + (row_num).toString()).dxSwitch('instance').option('value');
- var ref2Status = $("#Ref2_Status" + (row_num).toString()).dxSwitch('instance').option('value');
- ref2Status_asSave[row_num - 1] = $("#Ref2_Status" + (row_num).toString()).dxSwitch('instance').option('value');
- if (ref1Status) { var ref1Status_int = 1; } else { var ref1Status_int = 0; }
- if (ref2Status) { var ref2Status_int = 1; } else { var ref2Status_int = 0; }
- DataArrange(initDate_, finalDate_, 3, 4478, 16, parseInt(operationMode * 10), 1); // 0: OFF, 10: 제빙, 20: 축단, 30:병렬, 40: 냉단
- DataArrange(initDate_, finalDate_, 2, 4479, 15, ref1Status_int, 1);
- DataArrange(initDate_, finalDate_, 2, 4480, 15, ref2Status_int, 1);
- }
- }
-
- function handlePopupButtonSave() {
- var now_date = new Date();
- if (now_date.getHours() != 0 && now_date.getMinutes() % 15 == 1 && now_date.getSeconds() > 0 && now_date.getSeconds() < 40) {
- utils.toast.show('데이터 모델이 업데이트 중입니다. 잠시후 다시 시도해주세요. (약 40초 소요 예정)', 'error');
- }
- else {
- // 0, 4, 8, 12 ...초 시간에만 동작
- visibleHourGlassPopup(true); // 모래시계 팝업 활성화
-
- if (EditingFirstRow() === true) {
- if (enabledDateRange(1, "save")) {
- initDate_asSave = new Array(new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate));
- finalDate_asSave = new Array(new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate));
- operationMode_asSave = new Array(null, null, null, null, null);
- ref1Status_asSave = new Array(null, null, null, null, null);
- ref2Status_asSave = new Array(null, null, null, null, null);
- DataExtract(1);
- $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
- visibleHourGlassPopup(true); // 모래시계 팝업 활성화
- // Python에서 데이터 처리하고 DB에서 데이터 불러오는 시간 고려
- setTimeout(function () {
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
- visibleHourGlassPopup(false);
- handleSearchInSearchView();
- }, 12000);
- CurrntRowStatusAsSave = 1;
- }
- }
- else if (EditingSecondRow() === true) {
- if (enabledDateRange(2, "save")) {
- initDate_asSave = new Array(new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate));
- finalDate_asSave = new Array(new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate));
- operationMode_asSave = new Array(null, null, null, null, null);
- ref1Status_asSave = new Array(null, null, null, null, null);
- ref2Status_asSave = new Array(null, null, null, null, null);
- DataExtract(1);
- DataExtract(2);
- $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
- visibleHourGlassPopup(true); // 모래시계 팝업 활성화
- // Python에서 데이터 처리하고 DB에서 데이터 불러오는 시간 고려
- setTimeout(function () {
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
- visibleHourGlassPopup(false);
- handleSearchInSearchView();
- }, 12000);
- CurrntRowStatusAsSave = 2;
- }
- }
- else if (EditingThirdRow() === true) {
- if (enabledDateRange(3, "save")) {
- initDate_asSave = new Array(new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate));
- finalDate_asSave = new Array(new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate));
- operationMode_asSave = new Array(null, null, null, null, null);
- ref1Status_asSave = new Array(null, null, null, null, null);
- ref2Status_asSave = new Array(null, null, null, null, null);
- DataExtract(1);
- DataExtract(2);
- DataExtract(3);
- $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
- visibleHourGlassPopup(true); // 모래시계 팝업 활성화
- // Python에서 데이터 처리하고 DB에서 데이터 불러오는 시간 고려
- setTimeout(function () {
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
- visibleHourGlassPopup(false);
- handleSearchInSearchView();
- }, 12000);
- CurrntRowStatusAsSave = 3;
- }
- }
- else if (EditingFourthRow() === true) {
- if (enabledDateRange(4, "save")) {
- initDate_asSave = new Array(new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate));
- finalDate_asSave = new Array(new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate));
- operationMode_asSave = new Array(null, null, null, null, null);
- ref1Status_asSave = new Array(null, null, null, null, null);
- ref2Status_asSave = new Array(null, null, null, null, null);
- DataExtract(1);
- DataExtract(2);
- DataExtract(3);
- DataExtract(4);
- $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
- visibleHourGlassPopup(true); // 모래시계 팝업 활성화
- // Python에서 데이터 처리하고 DB에서 데이터 불러오는 시간 고려
- setTimeout(function () {
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
- visibleHourGlassPopup(false);
- handleSearchInSearchView();
- }, 12000);
- CurrntRowStatusAsSave = 4;
- }
- }
- else if (EditingFifthRow() === true) {
- if (enabledDateRange(5, "save")) {
- initDate_asSave = new Array(new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate));
- finalDate_asSave = new Array(new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate));
- operationMode_asSave = new Array(null, null, null, null, null);
- ref1Status_asSave = new Array(null, null, null, null, null);
- ref2Status_asSave = new Array(null, null, null, null, null);
- DataExtract(1);
- DataExtract(2);
- DataExtract(3);
- DataExtract(4);
- DataExtract(5);
- $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
- visibleHourGlassPopup(true); // 모래시계 팝업 활성화
- // Python에서 데이터 처리하고 DB에서 데이터 불러오는 시간 고려
- setTimeout(function () {
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
- visibleHourGlassPopup(false);
- handleSearchInSearchView();
- }, 12000);
- CurrntRowStatusAsSave = 5;
- }
- }
- }
- visibleHourGlassPopup(false); // 모래시계 팝업 비활성화
- }
- // 데이터 범위 및 필수 입력사항 체크 함수
- function enabledDateRange(row_num, mode) {
- var now_ = new Date();
- var finalDate_ = new Date(now_.getFullYear(), now_.getMonth(), now_.getDate(), 20, 45, 0);
- if (now_.getHours() >= 21) {
- finalDate_ = moment(finalDate_).add(1, 'days').toDate();
- }
- var BoxInitDate_tmp = $("#InitialDate" + (row_num).toString()).dxDateBox('instance').option('value');
- var BoxInitTime_tmp = $("#InitialTime" + (row_num).toString()).dxDateBox('instance').option('value');
- var BoxFinalDate_tmp = $("#FinalDate" + (row_num).toString()).dxDateBox('instance').option('value');
- var BoxFinalTime_tmp = $("#FinalTime" + (row_num).toString()).dxDateBox('instance').option('value');
- var input_inialDateTime = new Date(BoxInitDate_tmp.getFullYear(), BoxInitDate_tmp.getMonth(), BoxInitDate_tmp.getDate(), BoxInitTime_tmp.getHours(), BoxInitTime_tmp.getMinutes(), 0);
- var input_finalDateTime = new Date(BoxFinalDate_tmp.getFullYear(), BoxFinalDate_tmp.getMonth(), BoxFinalDate_tmp.getDate(), BoxFinalTime_tmp.getHours(), BoxFinalTime_tmp.getMinutes(), 0);
- var comparedDate = new Date(now_.getFullYear(), now_.getMonth(), now_.getDate(), 20, 45, 0);
- if (now_.getHours() >= 21) {
- comparedDate = moment(comparedDate).add(1, 'days').toDate();
- }
- var BoxDate_tmp = $("#FinalTime" + (row_num).toString()).dxDateBox('instance').option('value');
- var BoxDate = new Date(BoxDate_tmp.getFullYear(), BoxDate_tmp.getMonth(), BoxDate_tmp.getDate(), BoxDate_tmp.getHours(), BoxDate_tmp.getMinutes(), 0);
- if ($("#OperationMode" + (row_num).toString()).dxSelectBox('instance').option('value') == null) {
- utils.toast.show('항목이 모두 입력되지 않았습니다.', 'error');
- return false;
- }
- else if (BoxDate.getTime() == finalDate_.getTime() && mode == "edit") {
- utils.toast.show('마지막 종료시점이 시뮬레이션 허용 마지막 시간(당일 21시 혹은 익일 21시)이므로 행 추가가 불가합니다.', 'error');
- return false;
- }
- else if (BoxDate.getTime() != finalDate_.getTime() && mode == "save") {
- utils.toast.show('마지막 행의 종료 시점이 시뮬레이션 마지막 시간(21시)과 일치하지 않습니다.', 'error');
- return false;
- }
- else if (input_finalDateTime.getTime() > comparedDate.getTime()) {
- utils.toast.show("입력 최대 기간(당일 21시 혹은 익일 21시)을 초과하였습니다.", 'error');
- $("#FinalTime" + (row_num).toString()).dxDateBox("instance").option('value', comparedDate);
- return false;
- }
- else if (input_finalDateTime.getTime() < input_inialDateTime.getTime()) {
- utils.toast.show("마지막 행의 종료 시간이 시작 시간보다 빠릅니다.", 'error');
- $("#FinalTime" + (row_num).toString()).dxDateBox("instance").option('value', comparedDate);
- return false;
- }
- else {
- return true;
- }
- }
- function handlePopupButtonAdd() {
- // 행추가시 기존 제어 변수 입력 열에 미입력 사항이 있는지 확인하는 기능
- var now_ = new Date();
- var finalDate_ = new Date(now_.getFullYear(), now_.getMonth(), now_.getDate(), 20, 45, 0);
- if (now_.getHours() >= 21) {
- finalDate_ = moment(finalDate_).add(1, 'days').toDate();
- }
- if (EditingFirstRow() === true) {
- if (enabledDateRange(1, "edit")) {
- var InitDate_tmp = $("#InitialTime1").dxDateBox('instance').option('value');
- var BoxDate_tmp = $("#FinalTime1").dxDateBox('instance').option('value');
- var BoxDate = new Date(BoxDate_tmp.getFullYear(), BoxDate_tmp.getMonth(), BoxDate_tmp.getDate(), BoxDate_tmp.getHours(), BoxDate_tmp.getMinutes(), 0);
- initDate_prev[0] = new Date(InitDate_tmp.getFullYear(), InitDate_tmp.getMonth(), InitDate_tmp.getDate(), InitDate_tmp.getHours(), InitDate_tmp.getMinutes(), 0);
- finalDate_prev[0] = new Date(BoxDate_tmp.getFullYear(), BoxDate_tmp.getMonth(), BoxDate_tmp.getDate(), BoxDate_tmp.getHours(), BoxDate_tmp.getMinutes(), 0);
- operationMode_prev[0] = $("#OperationMode1").dxSelectBox('instance').option('value');;
- ref1Status_prev[0] = $("#Ref1_Status1").dxSwitch("instance").option('value');
- ref2Status_prev[0] = $("#Ref2_Status1").dxSwitch("instance").option('value');
- EnableDisableRow(1, true);
- EnableDisableRow(2, false);
- EditingFirstRow(false);
- EditingSecondRow(true);
- isSecondRow(true);
- BoxDate.setMinutes(BoxDate.getMinutes() + 15);
- $("#InitialDate2").dxDateBox('instance').option('value', BoxDate);
- $("#InitialTime2").dxDateBox('instance').option('value', BoxDate);
- $("#FinalDate2").dxDateBox('instance').option('value', finalDate_);
- $("#FinalTime2").dxDateBox('instance').option('value', finalDate_);
- }
- else {
- return;
- }
- }
- else if (EditingSecondRow() === true) {
- if (enabledDateRange(2, "edit")) {
- var InitDate_tmp = $("#InitialTime2").dxDateBox('instance').option('value');
- var BoxDate_tmp = $("#FinalTime2").dxDateBox('instance').option('value');
- var BoxDate = new Date(BoxDate_tmp.getFullYear(), BoxDate_tmp.getMonth(), BoxDate_tmp.getDate(), BoxDate_tmp.getHours(), BoxDate_tmp.getMinutes(), 0);
- initDate_prev[1] = new Date(InitDate_tmp.getFullYear(), InitDate_tmp.getMonth(), InitDate_tmp.getDate(), InitDate_tmp.getHours(), InitDate_tmp.getMinutes(), 0);
- finalDate_prev[1] = new Date(BoxDate_tmp.getFullYear(), BoxDate_tmp.getMonth(), BoxDate_tmp.getDate(), BoxDate_tmp.getHours(), BoxDate_tmp.getMinutes(), 0);
- operationMode_prev[1] = $("#OperationMode2").dxSelectBox('instance').option('value');;
- ref1Status_prev[1] = $("#Ref1_Status2").dxSwitch("instance").option('value');
- ref2Status_prev[1] = $("#Ref2_Status2").dxSwitch("instance").option('value');
- EnableDisableRow(2, true);
- EnableDisableRow(3, false);
- EditingSecondRow(false);
- EditingThirdRow(true);
- isThirdRow(true);
- BoxDate.setMinutes(BoxDate.getMinutes() + 15);
- $("#InitialDate3").dxDateBox('instance').option('value', BoxDate);
- $("#InitialTime3").dxDateBox('instance').option('value', BoxDate);
- $("#FinalDate3").dxDateBox('instance').option('value', finalDate_);
- $("#FinalTime3").dxDateBox('instance').option('value', finalDate_);
- }
- }
- else if (EditingThirdRow() === true) {
- if (enabledDateRange(3, "edit")) {
- var InitDate_tmp = $("#InitialTime3").dxDateBox('instance').option('value');
- var BoxDate_tmp = $("#FinalTime3").dxDateBox('instance').option('value');
- var BoxDate = new Date(BoxDate_tmp.getFullYear(), BoxDate_tmp.getMonth(), BoxDate_tmp.getDate(), BoxDate_tmp.getHours(), BoxDate_tmp.getMinutes(), 0);
- initDate_prev[2] = new Date(InitDate_tmp.getFullYear(), InitDate_tmp.getMonth(), InitDate_tmp.getDate(), InitDate_tmp.getHours(), InitDate_tmp.getMinutes(), 0);
- finalDate_prev[2] = new Date(BoxDate_tmp.getFullYear(), BoxDate_tmp.getMonth(), BoxDate_tmp.getDate(), BoxDate_tmp.getHours(), BoxDate_tmp.getMinutes(), 0);
- operationMode_prev[2] = $("#OperationMode3").dxSelectBox('instance').option('value');;
- ref1Status_prev[2] = $("#Ref1_Status3").dxSwitch("instance").option('value');
- ref2Status_prev[2] = $("#Ref2_Status3").dxSwitch("instance").option('value');
- EnableDisableRow(3, true);
- EnableDisableRow(4, false);
- EditingThirdRow(false);
- EditingFourthRow(true);
- isFourthRow(true);
- BoxDate.setMinutes(BoxDate.getMinutes() + 15);
- $("#InitialDate4").dxDateBox('instance').option('value', BoxDate);
- $("#InitialTime4").dxDateBox('instance').option('value', BoxDate);
- $("#FinalDate4").dxDateBox('instance').option('value', finalDate_);
- $("#FinalTime4").dxDateBox('instance').option('value', finalDate_);
- }
- }
- else if (EditingFourthRow() === true) {
- if (enabledDateRange(4, "edit")) {
- var InitDate_tmp = $("#InitialTime4").dxDateBox('instance').option('value');
- var BoxDate_tmp = $("#FinalTime4").dxDateBox('instance').option('value');
- var BoxDate = new Date(BoxDate_tmp.getFullYear(), BoxDate_tmp.getMonth(), BoxDate_tmp.getDate(), BoxDate_tmp.getHours(), BoxDate_tmp.getMinutes(), 0);
- initDate_prev[3] = new Date(InitDate_tmp.getFullYear(), InitDate_tmp.getMonth(), InitDate_tmp.getDate(), InitDate_tmp.getHours(), InitDate_tmp.getMinutes(), 0);
- finalDate_prev[3] = new Date(BoxDate_tmp.getFullYear(), BoxDate_tmp.getMonth(), BoxDate_tmp.getDate(), BoxDate_tmp.getHours(), BoxDate_tmp.getMinutes(), 0);
- operationMode_prev[3] = $("#OperationMode4").dxSelectBox('instance').option('value');;
- ref1Status_prev[3] = $("#Ref1_Status4").dxSwitch("instance").option('value');
- ref2Status_prev[3] = $("#Ref2_Status4").dxSwitch("instance").option('value');
- EnableDisableRow(4, true);
- EnableDisableRow(5, false);
- EditingFourthRow(false);
- EditingFifthRow(true);
- isFifthRow(true);
- BoxDate.setMinutes(BoxDate.getMinutes() + 15);
- $("#InitialDate5").dxDateBox('instance').option('value', BoxDate);
- $("#InitialTime5").dxDateBox('instance').option('value', BoxDate);
- $("#FinalDate5").dxDateBox('instance').option('value', finalDate_);
- $("#FinalTime5").dxDateBox('instance').option('value', finalDate_);
- }
- }
- else if (EditingFifthRow() === true) {
- utils.toast.show('최대 행 추가 수는 5개입니다.', 'error');
- return;
- }
- }
- // 열 삭제
- function handlePopupButtonDelete() {
- if (EditingFirstRow() === true) {
- utils.toast.show('최소 1개 이상 행을 입력해야합니다.', 'error');
- }
- else {
- DeleteRow(); // 현재 열 삭제
- }
- return;
- }
- function EnableDisableRow(row_num, disabled) {
- // 모든 행의 시작일은 고정
- $("#InitialDate" + (row_num).toString()).dxDateBox("instance").option('disabled', true);
- $("#InitialTime" + (row_num).toString()).dxDateBox("instance").option('disabled', true);
- $("#FinalDate" + (row_num).toString()).dxDateBox("instance").option('disabled', disabled);
- $("#FinalTime" + (row_num).toString()).dxDateBox("instance").option('disabled', disabled);
- $("#OperationMode" + (row_num).toString()).dxSelectBox("instance").option('disabled', disabled);
- if ($("#OperationMode" + (row_num).toString()).dxSelectBox('instance').option('value') == 0
- || $("#OperationMode" + (row_num).toString()).dxSelectBox('instance').option('value') == 2) {
- $("#Ref1_Status" + (row_num).toString()).dxSwitch("instance").option('disabled', true);
- $("#Ref2_Status" + (row_num).toString()).dxSwitch("instance").option('disabled', true);
- }
- else {
- $("#Ref1_Status" + (row_num).toString()).dxSwitch("instance").option('disabled', disabled);
- $("#Ref2_Status" + (row_num).toString()).dxSwitch("instance").option('disabled', disabled);
- }
- }
- // 닫기버튼
- function PopupButtonClose() {
- visibleConfigPopup(false);
- // 전체 열에 대해서 모두 삭제하고 저장된 열들만 다시 채워준다
- for (var i = 0; i < 5; i++) {
- DeleteRow();
- }
- for (var i = 0; i < 5; i++) {
- if (operationMode_asSave[i] != null) {
- FilledRow(i + 1);
- }
- }
- visibleEditButton(true);
- hasnotModificationPermission(false);
- isEditModeInPopup(false);
- isNotModifyMode(true);
- visibleCancelButton(false);
- if (EditingFirstRow() == true) {
- EnableDisableRow(1, false);
- }
- else if (EditingSecondRow() == true) {
- EnableDisableRow(2, false);
- }
- else if (EditingThirdRow() == true) {
- EnableDisableRow(3, false);
- }
- else if (EditingFourthRow() == true) {
- EnableDisableRow(4, false);
- }
- else if (EditingFifthRow() == true) {
- EnableDisableRow(5, false);
- }
- }
- function SetPointer() {
- var now = new Date();
- var target_date;
- var isRecentData = ko.observable(false);
- if (now.getHours() < 21) {
- target_date = now
- }
- else {
- target_date = now.setDate(now.getDate() - 1);
- }
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointWeatherForecasted",
- },
- requireTotalCount: true,
- pageSize: 99,
- });
- dataSource.filter([
- ["SiteId", "=", BWA.UserInfo.SiteId()],
- "and",
- ["nx", "=", 89],
- "and",
- ["ny", "=", 91]
- ]);
- dataSource.sort({ getter: "ForecastedDateTime", desc: true });
- dataSource.load()
- .done(function (WeatherForecasted) {
- if (WeatherForecasted.length != 0) {
- var WFTemperature_tmp = new Array();
- var WFHumidity_tmp = new Array();
- for (var i = 0; i < 16; i++) { // 예보데이터는 3시간 단위로 8포인트씩 2세트(기온, 습도)이므로
- if (WeatherForecasted[i].ForecastedDateTime.getFullYear() == target_date.getFullYear()
- && WeatherForecasted[i].ForecastedDateTime.getMonth() == target_date.getMonth()
- && WeatherForecasted[i].ForecastedDateTime.getDate() == target_date.getDate()
- && WeatherForecasted[i].Category == 'Temperature') {
- WFTemperature_tmp.push(WeatherForecasted[i].ForecastedValue);
- }
- if (WeatherForecasted[i].ForecastedDateTime.getFullYear() == target_date.getFullYear()
- && WeatherForecasted[i].ForecastedDateTime.getMonth() == target_date.getMonth()
- && WeatherForecasted[i].ForecastedDateTime.getDate() == target_date.getDate()
- && WeatherForecasted[i].Category == 'Humidity') {
- WFHumidity_tmp.push(WeatherForecasted[i].ForecastedValue);
- }
- }
- if (WFTemperature_tmp.length != 0) {
- $('#pointerText1').text("익일 예상 최고 기온 : " + Math.max.apply(null, WFTemperature_tmp).toFixed(2).toString() + " °C, ");
- $('#pointerText2').text("익일 예상 최저 기온 : " + Math.min.apply(null, WFTemperature_tmp).toFixed(2).toString() + " °C, ");
- }
- else {
- $('#pointerText1').text("익일 예상 최고 기온 : ? °C, ");
- $('#pointerText2').text("익일 예상 최저 기온 : ? °C, ");
- utils.toast.show("데이터가 없습니다. (익일 기상 예보 데이터 - 기온)", 'error');
- }
- if (WFHumidity_tmp.length != 0) {
- $('#pointerText3').text("익일 예상 최고 습도 : " + Math.max.apply(null, WFHumidity_tmp).toFixed(2).toString() + " %, ");
- $('#pointerText4').text("익일 예상 최저 습도 : " + Math.min.apply(null, WFHumidity_tmp).toFixed(2).toString() + " %, ");
- }
- else {
- $('#pointerText3').text("익일 예상 최고 습도 : ? %, ");
- $('#pointerText4').text("익일 예상 최저 습도 : ? %, ");
- utils.toast.show("데이터가 없습니다. (익일 기상 예보 데이터 - 습도)", 'error');
- }
- }
- else {
- $('#pointerText1').text("익일 예상 최고 기온 : ? °C, ");
- $('#pointerText2').text("익일 예상 최저 기온 : ? °C, ");
- $('#pointerText3').text("익일 예상 최고 습도 : ? %, ");
- $('#pointerText4').text("익일 예상 최저 습도 : ? %, ");
- utils.toast.show("데이터가 없습니다. (익일 기상 예보 데이터 - 기온, 습도)", 'error');
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointForecastingDayAhead",
- },
- requireTotalCount: true,
- pageSize: 99,
- });
- dataSource.filter([
- ["SiteId", "=", BWA.UserInfo.SiteId()],
- "and",
- ["PropertyId", "=", 0]
- ]);
- dataSource.sort({ getter: "TargetDateTime", desc: true });
- dataSource.load()
- .done(function (PredictedDeicing) {
- if (PredictedDeicing.length != 0
- && PredictedDeicing[0].TargetDateTime.getFullYear() == target_date.getFullYear()
- && PredictedDeicing[0].TargetDateTime.getMonth() == target_date.getMonth()
- && PredictedDeicing[0].TargetDateTime.getDate() == target_date.getDate()) {
- $('#pointerText5').text("익일 예상 방냉량 : " + PredictedDeicing[0].ForecastedValue.toFixed(2).toString() + "%");
- }
- else {
- $('#pointerText5').text("익일 예상 방냉량 : 0%");
- utils.toast.show("데이터가 없습니다. (익일 예상 방냉량)", 'error');
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- var now_15min = new Date();
- now_15min.setMinutes(parseInt(now_15min.getMinutes() / 15) * 15); // 15분 단위 맞춰주기 위함
- var now_15min_ = new Date(now_15min.getFullYear(), now_15min.getMonth(), now_15min.getDate(), now_15min.getHours(), now_15min.getMinutes(), 0);
- var finalDate_ = new Date(now_15min_.getFullYear(), now_15min_.getMonth(), now_15min_.getDate(), 20, 45, 0);
- if (now_15min.getHours() >= 21) {
- finalDate_ = moment(finalDate_).add(1, 'days').toDate();
- }
- // 추천 가동 시간 로드
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsIceThermalStorageSimulation",
- },
- requireTotalCount: true,
- pageSize: 99,
- });
- dataSource.sort({ getter: "TargetDateTime", desc: true });
- dataSource.filter([
- ["SiteId", "=", BWA.UserInfo.SiteId()],
- "and",
- ["FacilityTypeId", "=", 3],
- "and",
- ["PropertyId", "=", 16],
- "and",
- ["SimulationCase", "=", 0], // recommend
- "and",
- ["TargetDateTime", ">=", now_15min_],
- "and",
- ["TargetDateTime", "<=", finalDate_],
- ]);
- dataSource.load()
- .done(function (Recommended) {
- if (Recommended.length != 0) {
- var isRecommended = false;
- var RecommendedTime = new Date(now_15min.getFullYear(), now_15min.getMonth(), now_15min.getDate(), 0, 0, 0); // 추천 축열조 운영 모드 (제빙 모드)
- for (var i = 0; i < Recommended.length; i++) {
- if (Recommended[i].SimulationValue == 10) {
- RecommendedTime.settMinutes(RecommendedTime.getMinutes() + 15);
- isRecommended = true;
- }
- }
- if (isRecommended == true) {
- $('#RecommendedTime').text("추천 가동 시간(제빙모드) : " + RecommendedTime.getHours().toString() + "시간 " + RecommendedTime.getMinutes().toString() + "분,");
- }
- else {
- $('#RecommendedTime').text("추천 가동 시간 : 현재 익일 예상 방냉량 초과 저장,");
- }
- }
- else {
- $('#RecommendedTime').text("추천 가동 시간 : ?,");
- utils.toast.show("데이터가 없습니다. (추천 가동 시간)", 'error');
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- // 냉동기1,2 전력량 로드
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsIceThermalStorageSimulation",
- },
- requireTotalCount: true,
- pageSize: 99,
- });
- dataSource.sort({ getter: "TargetDateTime", desc: true });
- dataSource.filter([
- ["SiteId", "=", BWA.UserInfo.SiteId()],
- "and",
- ["FacilityTypeId", "=", 2],
- "and",
- ["PropertyId", "=", 11],
- "and",
- ["SimulationCase", "=", 1], // simulation
- "and",
- ["TargetDateTime", ">=", now_15min_],
- "and",
- ["TargetDateTime", "<=", finalDate_],
- ]);
- dataSource.load()
- .done(function (RefPowerConsume) {
- if (RefPowerConsume.length != 0) {
- var RefPowerConsumeSum = 0; // 냉동기 전력량 합계 (시뮬레이션 모드)
- for (var i = 0; i < RefPowerConsume.length; i++) {
- RefPowerConsumeSum += RefPowerConsume[i].SimulationValue;
- }
- if (RefPowerConsumeSum == 0) {
- $('#RefPowerConsume').text("냉동기 계산 전력량(시뮬레이션 모드) : 0 kWh");
- }
- else {
- $('#RefPowerConsume').text("냉동기 계산 전력량(시뮬레이션 모드) : " + RefPowerConsumeSum.toFixed(2).toString() + " kWh");
- }
- }
- else {
- $('#RefPowerConsume').text("냉동기 계산 전력량(시뮬레이션 모드) : ?");
- utils.toast.show("데이터가 없습니다. (냉동기 계산 전력량)", 'error');
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- function handleViewShown() {
- $("#LoadPanel").dxLoadPanel({
- message: '로딩 중...',
- showIndicator: true,
- visible: false
- });
- $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
- visibleHourGlassPopup(true);
- // 초기 화면에서 기존 사용자 제어변수 삭제
- RemoveData(3, 4478, 16, 1); // 운전모드
- RemoveData(2, 4479, 15, 1); // 냉동기1 상태
- RemoveData(2, 4480, 15, 1); // 냉동기2 상태
- RemoveData(2, 4479, 11, 1); // 냉동기1 전력량
- RemoveData(2, 4480, 11, 1); // 냉동기2 전력량
- RemoveData(3, 4478, 2, 1); // 축열량
- if (initialized === false) {
- setTimeout(function () {
- chart = chart(BWA.ChartOptions.SimulatorIceStorage.getChartOptions());
- initialized = true;
- // 날짜 초기화 (오늘)
- timeBoxForSearch.setDefaultDateToday();
- handleSearchInSearchView();
- }, 4000);
- }
- else {
- setTimeout(function () {
- // 날짜 초기화 (오늘)
- timeBoxForSearch.setDefaultDateToday();
- handleSearchInSearchView();
- // 저장 변수 초기화
- initDate_asSave = new Array(new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate));
- finalDate_asSave = new Array(new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate));
- operationMode_asSave = new Array(null, null, null, null, null);
- ref1Status_asSave = new Array(null, null, null, null, null);
- ref2Status_asSave = new Array(null, null, null, null, null);
- }, 4000);
- }
- timer = setInterval(function () {
- //alert('timer'); // For Debugging
- var now = new Date();
- //if ((now.getMinutes() == 1 && now.getSeconds() == 30) || (now.getMinutes() == 5 && now.getSeconds() == 30)) {
- if (now.getMinutes() % 15 == 2 && now.getSeconds() == 30) {
- handleSearchInSearchView();
- }
- }, 1000);
- $("#UserCfgBtn").dxButton({
- text: "시뮬레이터 변수 설정",
- onClick: function () {
- visibleConfigPopup(true);
- }
- });
- }
- function handleViewHidden() {
- $SearchView.visibleObservable(false); // hcLee 2015 03 23
- visibleConfigPopup(false);
- clearInterval(timer); // hcLee 2015 06 12
- }
- function RemoveData(facilityTypeId, facilityCode, propertyId, simulationCase) {
- var now_15min = new Date();
- now_15min.setMinutes(parseInt(now_15min.getMinutes() / 15) * 15); // 15분 단위 맞춰주기 위함
- var targetDate_ = new Date(now_15min.getFullYear(), now_15min.getMonth(), now_15min.getDate(), now_15min.getHours(), now_15min.getMinutes(), 0);
- var finalDate_ = new Date(now_15min.getFullYear(), now_15min.getMonth(), now_15min.getDate(), 20, 45, 0);
- if (now_15min.getHours() >= 21) {
- finalDate_ = moment(finalDate_).add(1, 'days').toDate();
- }
- BemsIceThermalStorageDataSource.filter([
- ["SiteId", "=", BWA.UserInfo.SiteId()],
- "and",
- ["FacilityCode", "=", facilityCode],
- "and",
- ["PropertyId", "=", propertyId],
- "and",
- ["SimulationCase", "=", simulationCase],
- "and",
- ["TargetDateTime", ">=", targetDate_],
- "and",
- ["TargetDateTime", "<=", finalDate_]
- ]);
- BemsIceThermalStorageDataSource.load()
- .done(function (result) {
- var store = new DevExpress.data.ODataStore({
- url: endpointSelector + "/BemsIceThermalStorageSimulation",
- key: ["SiteId", "FacilityCode", "PropertyId", "CreatedDateTime", "TargetDateTime", "SimulationCase"],
- keyType: {
- SiteId: "Int32", FacilityCode: "Int32", PropertyId: "Int32", CreatedDateTime: "DateTime", TargetDateTime: "DateTime", SimulationCase: "Int32"
- }
- });
- if (result.length != 0) {
- for (var i = 0; i < result.length; i++) {
- var removeData = {
- SiteId: result[i].SiteId(),
- FacilityTypeId: result[i].FacilityTypeId(),
- FacilityCode: result[i].FacilityCode(),
- PropertyId: result[i].PropertyId(),
- CreatedDateTime: new Date(result[i].CreatedDateTime()),
- TargetDateTime: new Date(result[i].TargetDateTime()),
- SimulationValue: result[i].SimulationValue(),
- SimulationCase: result[i].SimulationCase()
- };
- store.remove(removeData).done(function (values, key) {
- })
- .fail(function (error) {
- utils.toast.show(error, 'error');
- });
- }
- }
- });
- }
- // 다른 페이지 갔다 들어오면 시뮬레이션 데이터 및 팝업 초기화
- function handleViewShowing() {
- SetPointer();
- initializedforPopUp = false;
- CurrntRowStatusAsSave = 1;
- }
- function refreshList() {
- }
- var searchViewOptions = {
- searchViewItems: [
- //{ id: 'TimeTypeId', defaultValue: 0, value: timeTypeIdForSearch, dataSource: timeTypesForSearch },
- //{ id: 'DateForHour', type: 'dateRange', isOnlyDate: true },
- ],
- };
- function handleSearchInSearchView() {
- $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
- visibleHourGlassPopup(true);
- var dataArray = [];
- dataArrayforPopup = [];
- var date = timeBoxForSearch.getDate();
- var start_date = moment(date.startDate).add(-3, 'hours').toDate();
- var end_date = moment(date.endDate).add(-3, 'hours').toDate();
- SetPointer();
- var commonParameters = {
- TimeIntervalType: $Code.TimeIntervalType.QUARTERMIN,
- StartDate: start_date,
- EndDate: end_date
- };
- var IceThermalStorageParameters_obs = {
- FacilityTypeId: 3,
- FacilityCode: 4478,
- PropertyId: 2,
- SimulationCase: 0 // observed and recommended schedule
- };
- var IceThermalStorageParameters_sim = {
- FacilityTypeId: 3,
- FacilityCode: 4478,
- PropertyId: 2,
- SimulationCase: 1 // simulated schedule
- };
- var now_sub = new Date();
- now_sub.setMinutes(now_sub.getMinutes() - 15); // 15분까지 데이터 확인 가능
- $.when(
- iceThermalStorage_SimulationValueGet.apiGet(_.extend(IceThermalStorageParameters_obs, commonParameters)),
- iceThermalStorage_SimulationValueGet.apiGet(_.extend(IceThermalStorageParameters_sim, commonParameters))
- ).done(function (Candidate_obs, Candidate_sim) {
- if (Candidate_obs.length == 0) {
- utils.toast.show("[BemsIceThermalStorageSimulation] 데이터가 없습니다.", 'error');
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
- }
- else {
- if (Candidate_obs.length != 0) {
- _.each(Candidate_obs[0][0], function (x) {
- if (moment(x.DateTime).toDate() < now_sub) {
- dataArray.push({
- DateTime: moment(x.DateTime).toDate(),
- ObservedValue: x.Value
- });
- }
- });
- // 2017.09.08 : 그리드 도표 작업 : 팝업창 추가
- _.each(Candidate_obs[0][0], function (x) {
- if (moment(x.DateTime).toDate() < now_sub) {
- dataArrayforPopup.push({
- DateTime: BWA.Chart.getCustermTimeArgumentAxisString($Code.TimeType.QUARTERMIN, moment(x.DateTime).toDate()),
- Value: x.Value,
- Case: 'Obs'
- });
- }
- });
- }
- if (Candidate_sim.length != 0) {
- _.each(Candidate_sim[0][0], function (x) {
- if (moment(x.DateTime).toDate() >= now_sub) {
- dataArray.push({
- DateTime: moment(x.DateTime).toDate(),
- SimulationValue: x.Value
- });
- }
- });
- // 2017.09.08 : 그리드 도표 작업 : 팝업창 추가
- _.each(Candidate_sim[0][0], function (x) {
- if (moment(x.DateTime).toDate() >= now_sub) {
- dataArrayforPopup.push({
- DateTime: BWA.Chart.getCustermTimeArgumentAxisString($Code.TimeType.QUARTERMIN, moment(x.DateTime).toDate()),
- Value: x.Value,
- Case: 'Sim'
- });
- }
- });
- }
- // 2017.09.08 : 그리드 도표 작업 : 팝업창 추가
- var options = BWA.ChartOptions.SimulatorIceStorage.getSeriesOptions();
- if (!_.isNull(start_date) && !_.isNull(end_date)) {
- options.argumentAxis.min = start_date;
- options.argumentAxis.max = end_date;
- }
- chart().option('argumentAxis', null); // 2015 05 21 결국 이 코드가 필요 함 (시간 축 에러 해결)
- options.dataSource = dataArray;
- chart().option(options);
- }
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
- visibleHourGlassPopup(false);
- })
- .fail(function (error) {
- utils.toast.show("데이터를 불러오는데 실패 하였습니다.", 'error');
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
- visibleConfigPopup(false);
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
- visibleHourGlassPopup(false);
- });
- }
- // 2017.09.08 : 그리드 도표 작업 : 팝업창 추가
- function DataGridPopup_ButtonClick() {
- DataGridPopup_Visible(true);
- }
- function handlePopupShown() {
- // 도표 컬럼명 업데이트
- viewModel.SimulatorIceStorageDataGridOptions.columns[0].caption = "날짜";
- viewModel.SimulatorIceStorageDataGridOptions.columns[1].caption = "실/계산 축열량";
- // 도표 데이터소스 업데이트
- $("#SimulatorIceStorageDataGrid_Container").dxDataGrid("instance").option("dataSource", dataArrayforPopup);
- // 도표 팝업창 갱신
- //DataGridPopup_Visible(true);
- }
- // Box Initialize
- function BoxInitialize(row_num, initial_Date, final_Date) {
- $("#InitialDate" + (row_num).toString()).dxDateBox({
- value: initial_Date,
- maxZoomLevel: 'month',
- formatString: "yyyy-MM-dd",
- onValueChanged: function (data) {
- initial_Date.setFullYear(data.value.getFullYear());
- initial_Date.setMonth(data.value.getMonth());
- initial_Date.setDate(data.value.getDate());
- $("#InitialDate" + (row_num).toString()).dxDateBox('instance').option('value', initial_Date);
- $("#InitialTime" + (row_num).toString()).dxDateBox('instance').option('value', initial_Date);
- }
- });
- $("#InitialTime" + (row_num).toString()).dxDateBox({
- value: initial_Date,
- format: "time",
- formatString: "HH:mm",
- onValueChanged: function (data) {
- initial_Date.setHours(data.value.getHours());
- initial_Date.setMinutes(data.value.getMinutes());
- $("#InitialDate" + (row_num).toString()).dxDateBox('instance').option('value', initial_Date);
- $("#InitialTime" + (row_num).toString()).dxDateBox('instance').option('value', initial_Date);
- }
- });
- $("#FinalDate" + (row_num).toString()).dxDateBox({
- value: final_Date,
- maxZoomLevel: 'month',
- formatString: "yyyy-MM-dd",
- min: new Date(moment().add(-1, 'd')),
- max: new Date(moment().add(1, 'd')),
- onValueChanged: function (data) {
- final_Date.setFullYear(data.value.getFullYear());
- final_Date.setMonth(data.value.getMonth());
- final_Date.setDate(data.value.getDate());
- $("#InitialDate" + (row_num).toString()).dxDateBox('instance').option('value', initial_Date);
- $("#InitialTime" + (row_num).toString()).dxDateBox('instance').option('value', initial_Date);
- $("#FinalDate" + (row_num).toString()).dxDateBox('instance').option('value', final_Date);
- $("#FinalTime" + (row_num).toString()).dxDateBox('instance').option('value', final_Date);
- }
- });
- $("#FinalTime" + (row_num).toString()).dxDateBox({
- value: final_Date,
- format: "time",
- formatString: "HH:mm",
- onValueChanged: function (data) {
- final_Date.setHours(data.value.getHours());
- final_Date.setMinutes(data.value.getMinutes());
- $("#InitialDate" + (row_num).toString()).dxDateBox('instance').option('value', initial_Date);
- $("#InitialTime" + (row_num).toString()).dxDateBox('instance').option('value', initial_Date);
- $("#FinalDate" + (row_num).toString()).dxDateBox('instance').option('value', final_Date);
- $("#FinalTime" + (row_num).toString()).dxDateBox('instance').option('value', final_Date);
- }
- });
- $("#OperationMode" + (row_num).toString()).dxSelectBox({
- placeholder: "운전 모드",
- dataSource: treeOperationMode,
- displayExpr: "text",
- valueExpr: "id",
- onValueChanged: function (data) {
- $("#OperationMode" + (row_num).toString()).dxSelectBox('instance').option('value', data.value);
- // OFF, 축단운전시 냉동기 모두 OFF
- if (data.value == 0 || data.value == 2) {
- $("#Ref1_Status" + (row_num).toString()).dxSwitch('instance').option('value', false);
- $("#Ref2_Status" + (row_num).toString()).dxSwitch('instance').option('value', false);
- $("#Ref1_Status" + (row_num).toString()).dxSwitch("instance").option('disabled', true);
- $("#Ref2_Status" + (row_num).toString()).dxSwitch("instance").option('disabled', true);
- }
- else {
- $("#Ref1_Status" + (row_num).toString()).dxSwitch("instance").option('disabled', false);
- $("#Ref2_Status" + (row_num).toString()).dxSwitch("instance").option('disabled', false);
- }
- }
- });
- $("#Ref1_Status" + (row_num).toString()).dxSwitch({
- onText: $G('use'),
- offText: $G('nonUse'),
- onValueChanged: function (data) {
- $("#Ref1_Status" + (row_num).toString()).dxSwitch('instance').option('value', data.value);
- }
- });
- $("#Ref2_Status" + (row_num).toString()).dxSwitch({
- onText: $G('use'),
- offText: $G('nonUse'),
- onValueChanged: function (data) {
- $("#Ref2_Status" + (row_num).toString()).dxSwitch('instance').option('value', data.value);
- }
- });
- // 초기 시작 시점은 고정
- $("#InitialDate" + (row_num).toString()).dxDateBox("instance").option('disabled', true);
- $("#InitialTime" + (row_num).toString()).dxDateBox("instance").option('disabled', true);
- $("#OperationMode" + (row_num).toString()).dxSelectBox('instance').option('value', null);// 운전 모드 클리어
- $("#Ref1_Status" + (row_num).toString()).dxSwitch('instance').option('value', false);// 냉동기1 운전 모드 클리어
- $("#Ref2_Status" + (row_num).toString()).dxSwitch('instance').option('value', false);// 냉동기2 운전 모드 클리어
- initDate_prev[row_num - 1] = new Date(initial_Date);
- finalDate_prev[row_num - 1] = new Date(final_Date);
- operationMode_prev[row_num - 1] = null;
- ref1Status_prev[row_num - 1] = false;
- ref2Status_prev[row_num - 1] = false;
- return 0;
- }
- var viewModel = $.extend(BWA.CommonView.create(
- params, viewInfo, searchViewOptions, ko.observable(null), handleViewShown, null,
- handleSearchInSearchView), {
- refreshList: refreshList,
- viewShowing: handleViewShowing,
- viewHidden: handleViewHidden, // hcLee 2015 03 23
- //viewDisposing: handleViewHidden, // hcLee 2015 03 23
- //locationEnableForSearch: locationEnableForSearch,
- // 그리드 도표 작업 : 팝업창 추가
- SimulatorIceStorageDataGridPopup_ButtonClicked: DataGridPopup_ButtonClick
- // 그리드 도표 작업 : 팝업창 추가
- });
- viewModel.SimulatorIceStoragePopupOptions = {
- width: 1500,//1250,
- height: 350,
- visible: visibleConfigPopup,
- dragEnabled: true,
- shading: true,
- closeOnOutsideClick: false,
- shadingColor: 'transparent',
- showTitle: true,
- //title: "사용자 시뮬레이터 변수 설정",
- showCloseButton: true,
- onShowing: function () {
- if (initializedforPopUp === false) {
- setTimeout(function () {
- var initialDate_ = new Date();
- initialDate_.setMinutes((parseInt(initialDate_.getMinutes() / 15)) * 15); // 15분 단위 맞춰주기 위함
- initialDate_.setSeconds(0);
- var finalDate_ = new Date(finalDate);
- for (var i = 0; i < 5; i++) {
- BoxInitialize(i + 1, initialDate_, finalDate_);
- }
- InitializedTemplate();
- InitializedData();
- initializedforPopUp = true;
- }, 100);
- }
- else {
- InitializedTemplate();
- }
- },
- onShown: function () {
- },
- onHidden: function () {
- }
- }
- // 2020.08.03 : 그리드 도표 작업 : 팝업창 추가
- // 그래프 도표 팝업창
- viewModel.SimulatorIceStorageDataGridPopupOptions = {
- width: '480px',
- height: '830px', // 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(),
- shading: false
- };
- // 2020.08.03 : 그리드 도표 작업 : 팝업창 추가
- // 2020.08.03 : 그리드 도표 작업 : 팝업창 추가
- viewModel.SimulatorIceStorageDataGridOptions = {
- dataSource: dataArrayforPopup,
- columns: [
- { dataField: 'DateTime', width: '40%', alignment: 'center' },// dataType: 'date', format: 'yyyy-MM-dd HH:mm' },
- { dataField: 'Value', width: '60%', alignment: 'center', format: 'fixedPoint', precision: 2 }
- //{ dataField: 'ObservedValue', width: '30%', alignment: 'center', format: 'fixedPoint', precision: 2 },
- //{ dataField: 'SimulationValue', width: '30%', alignment: 'center', format: 'fixedPoint', precision: 2 }
- ],
- rowPrepared: function (rowElement, rowInfo) {
- if (rowInfo.rowType == 'data') {
- var data = rowInfo.data;
- if (data['Case'] == 'Sim') {
- //rowElement.css('background-color', 'rgba(255,0,0,0.1)');
- rowElement.css('background-color', 'rgba(153,102,255,0.1)');
- }
- }
- },
- // 엑셀 출력
- "export": {
- enabled: true,
- fileName: '축열량 시뮬레이션 결과'
- }
- };
- /// 2020.08.03 : 그리드 도표 작업 : 팝업창 추가
- viewModel.simulatoricestoragePopupToolbarItems = simulatoricestoragePopupToolbarItems;
- viewModel.timeBoxForSearch = timeBoxForSearch;
- viewModel.handlePopupButtonAdd = handlePopupButtonAdd;
- viewModel.handlePopupButtonDelete = handlePopupButtonDelete;
- viewModel.isSecondRow = isSecondRow;
- viewModel.isThirdRow = isThirdRow;
- viewModel.isFourthRow = isFourthRow;
- viewModel.isFifthRow = isFifthRow;
- viewModel.visibleHourGlassPopup = visibleHourGlassPopup;
- viewModel.isEditModeInPopup = isEditModeInPopup;
- return viewModel;
- };
|