123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902 |
- BemsWebApplication.EnergyUsageFactorAnalysis = 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 facilityDataSource = BWA.db.createDataSource('CmFacility');
- var eq = BWA.DataUtil.constructEqualFilter;
- var SITEID = BWA.UserInfo.SiteId();
- var visiblePopup = ko.observable(false);
- var toe = 0;
- var kwh = 0;
- var HDDStandard = 0;
- var CDDStandard = 0;
- var powerFuelTypeId = 1; //전력 고유 구분 코드
- var gasFuelTypeId = 2; //가스 고유 구분 코드
- var powerFacilityTypeId = $Code.FacilityType.ELECTRICITY; //전력 타입 고유 ID - 100
- var gasFacilityTypeId = $Code.FacilityType.GAS; //가스 타입 고유 ID - 101
- var powerFacilityCode = 0; //전력 시설 코드
- var powerFormulaId = 1; //전력 전체 사용량 수식
- var gasFacilityCode = 0; //가스 시설 코드
- var gasFormulaId = 1; //가스 전체 사용량 수식
- var temperatureFormula = [ //외기온도 조회 정보(외기온도 관제점 추가시 배열형태로 추가할것)
- {
- FacilityCode: 4864,
- PropertyId: 1
- }
- ]
- // 2019.04.16 : 그리드 도표 작업 : 팝업창 추가 ~~~
- // 팝업창뷰 보이기 속성 제어용 변수 선언
- var DataGridPopup_Visible = ko.observable(false);
- var DataGridPopup_Visible1 = ko.observable(false);
- var DataGridPopup_Visible2 = ko.observable(false);
- // 그래프 출력 이후 엑셀출력을 위한 팝업창을 위해 임시 저장용 배열 선언
- var dataArrayresult = ko.observableArray();
- var dataArrayresult1 = ko.observableArray();
- var dataArrayresult2 = ko.observableArray();
- // ~~~ 2019.04.16 : 그리드 도표 작업 : 팝업창 추가
- var useFactor = [{ id: 0, value: "인원증감" }, { id: 1, value: "임대율" }, { id: 2, value: "냉방도일" }, { id: 3, value: "난방도일" }, { id: 4, value: "냉/난방도일" }];
- var rentalRateYear = "";
- var peopleIncreaseYear = "";
- var rentalRate =
- [{ month: "1", value: 0 },
- { month: "2", value: 0 },
- { month: "3", value: 0 },
- { month: "4", value: 0 },
- { month: "5", value: 0 },
- { month: "6", value: 0 },
- { month: "7", value: 0 },
- { month: "8", value: 0 },
- { month: "9", value: 0 },
- { month: "10", value: 0 },
- { month: "11", value: 0 },
- { month: "12", value: 0 }];
- var peopleIncrease =
- [{ month: "1", value: 0 },
- { month: "2", value: 0 },
- { month: "3", value: 0 },
- { month: "4", value: 0 },
- { month: "5", value: 0 },
- { month: "6", value: 0 },
- { month: "7", value: 0 },
- { month: "8", value: 0 },
- { month: "9", value: 0 },
- { month: "10", value: 0 },
- { month: "11", value: 0 },
- { month: "12", value: 0 }];
- var powerDataSource =
- [{ month: "1", value: 0 },
- { month: "2", value: 0 },
- { month: "3", value: 0 },
- { month: "4", value: 0 },
- { month: "5", value: 0 },
- { month: "6", value: 0 },
- { month: "7", value: 0 },
- { month: "8", value: 0 },
- { month: "9", value: 0 },
- { month: "10", value: 0 },
- { month: "11", value: 0 },
- { month: "12", value: 0 }];
- var gasDataSource =
- [{ month: "1", value: 0 },
- { month: "2", value: 0 },
- { month: "3", value: 0 },
- { month: "4", value: 0 },
- { month: "5", value: 0 },
- { month: "6", value: 0 },
- { month: "7", value: 0 },
- { month: "8", value: 0 },
- { month: "9", value: 0 },
- { month: "10", value: 0 },
- { month: "11", value: 0 },
- { month: "12", value: 0 }];
- var HDDDataSource =
- [{ month: "1", value: 0 },
- { month: "2", value: 0 },
- { month: "3", value: 0 },
- { month: "4", value: 0 },
- { month: "5", value: 0 },
- { month: "6", value: 0 },
- { month: "7", value: 0 },
- { month: "8", value: 0 },
- { month: "9", value: 0 },
- { month: "10", value: 0 },
- { month: "11", value: 0 },
- { month: "12", value: 0 }];
- var CDDDataSource =
- [{ month: "1", value: 0 },
- { month: "2", value: 0 },
- { month: "3", value: 0 },
- { month: "4", value: 0 },
- { month: "5", value: 0 },
- { month: "6", value: 0 },
- { month: "7", value: 0 },
- { month: "8", value: 0 },
- { month: "9", value: 0 },
- { month: "10", value: 0 },
- { month: "11", value: 0 },
- { month: "12", value: 0 }];
- var chartDataSource =
- [{ month: "1", use: 0, factor: 0 },
- { month: "2", use: 0, factor: 0 },
- { month: "3", use: 0, factor: 0 },
- { month: "4", use: 0, factor: 0 },
- { month: "5", use: 0, factor: 0 },
- { month: "6", use: 0, factor: 0 },
- { month: "7", use: 0, factor: 0 },
- { month: "8", use: 0, factor: 0 },
- { month: "9", use: 0, factor: 0 },
- { month: "10", use: 0, factor: 0 },
- { month: "11", use: 0, factor: 0 },
- { month: "12", use: 0, factor: 0 }];
- var chartDataSourceHDDCDD =
- [{ month: "1", use: 0, cdd: 0, hdd: 0 },
- { month: "2", use: 0, cdd: 0, hdd: 0 },
- { month: "3", use: 0, cdd: 0, hdd: 0 },
- { month: "4", use: 0, cdd: 0, hdd: 0 },
- { month: "5", use: 0, cdd: 0, hdd: 0 },
- { month: "6", use: 0, cdd: 0, hdd: 0 },
- { month: "7", use: 0, cdd: 0, hdd: 0 },
- { month: "8", use: 0, cdd: 0, hdd: 0 },
- { month: "9", use: 0, cdd: 0, hdd: 0 },
- { month: "10", use: 0, cdd: 0, hdd: 0 },
- { month: "11", use: 0, cdd: 0, hdd: 0 },
- { month: "12", use: 0, cdd: 0, hdd: 0 }];
- var monthInputArray =
- [{ month: "1", value: 0 },
- { month: "2", value: 0 },
- { month: "3", value: 0 },
- { month: "4", value: 0 },
- { month: "5", value: 0 },
- { month: "6", value: 0 },
- { month: "7", value: 0 },
- { month: "8", value: 0 },
- { month: "9", value: 0 },
- { month: "10", value: 0 },
- { month: "11", value: 0 },
- { month: "12", value: 0 }];
- function numberWithCommas(x) {
- return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
- }
- function SetUseFactorSelect() {
- $("#factorSelect").dxSelectBox("instance").option('dataSource', useFactor);
- $("#factorSelect").dxSelectBox("instance").option('displayExpr', "value");
- $("#factorSelect").dxSelectBox("instance").option('valueExpr', "id");
- $("#factorSelect").dxSelectBox("instance").option('value', 0);
- }
- function GetSiteHDDCDDStandard() {
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/CmSite"
- },
- requireTotalCount: true,
- pageSize: 1
- });
- dataSource.filter([
- ["SiteId", "=", SITEID]
- ]);
- dataSource.load()
- .done(function (result) {
- HDDStandard = result[0].HDD;
- CDDStandard = result[0].CDD;
- $("#inputHDD").dxTextBox("instance").option('value', HDDStandard.toString());
- $("#inputCDD").dxTextBox("instance").option('value', CDDStandard.toString());
- GetHDDCDD();
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- function GetSitePeopleIncrease() {
- var now = new Date();
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsPeopleIncrease"
- },
- requireTotalCount: true,
- pageSize: 1
- });
- dataSource.filter([
- ["SiteId", "=", SITEID],
- "and",
- ["Date", "=", now.getFullYear().toString()]
- ]);
- dataSource.sort({ getter: "Date", desc: true });
- dataSource.load()
- .done(function (result) {
- if (result.length != 0) {
- peopleIncreaseYear = result[0].Date;
- peopleIncrease[0].value = result[0].m1;
- peopleIncrease[1].value = result[0].m2;
- peopleIncrease[2].value = result[0].m3;
- peopleIncrease[3].value = result[0].m4;
- peopleIncrease[4].value = result[0].m5;
- peopleIncrease[5].value = result[0].m6;
- peopleIncrease[6].value = result[0].m7;
- peopleIncrease[7].value = result[0].m8;
- peopleIncrease[8].value = result[0].m9;
- peopleIncrease[9].value = result[0].m10;
- peopleIncrease[10].value = result[0].m11;
- peopleIncrease[11].value = result[0].m12;
- var tmpValue;
- for (var i = 11; i >= 0; i--) {
- if (peopleIncrease[i].value != null) {
- tmpValue = peopleIncrease[i].value;
- for (var j = i; j <= now.getMonth() ; j++) {
- peopleIncrease[j].value = tmpValue;
- }
- break;
- }
- }
- var store = new DevExpress.data.ODataStore({
- url: endpointSelector + "/BemsPeopleIncrease",
- key: ["Date", "SiteId"],
- keyType: { Date: "String", SiteId: "Int32" }
- });
- store.update({ Date: peopleIncreaseYear.toString(), SiteId: SITEID },
- {
- m1: peopleIncrease[0].value,
- m2: peopleIncrease[1].value,
- m3: peopleIncrease[2].value,
- m4: peopleIncrease[3].value,
- m5: peopleIncrease[4].value,
- m6: peopleIncrease[5].value,
- m7: peopleIncrease[6].value,
- m8: peopleIncrease[7].value,
- m9: peopleIncrease[8].value,
- m10: peopleIncrease[9].value,
- m11: peopleIncrease[10].value,
- m12: peopleIncrease[11].value
- })
- } else if (result.length == 0) {
- var dataSource2 = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsPeopleIncrease"
- },
- requireTotalCount: true,
- pageSize: 1
- });
- dataSource2.filter([
- ["SiteId", "=", SITEID],
- ]);
- dataSource2.sort({ getter: "Date", desc: true });
- dataSource2.load()
- .done(function (result2) {
- if (result2.length != 0) {
- peopleIncreaseYear = result2[0].Date;
- peopleIncrease[0].value = result2[0].m1;
- peopleIncrease[1].value = result2[0].m2;
- peopleIncrease[2].value = result2[0].m3;
- peopleIncrease[3].value = result2[0].m4;
- peopleIncrease[4].value = result2[0].m5;
- peopleIncrease[5].value = result2[0].m6;
- peopleIncrease[6].value = result2[0].m7;
- peopleIncrease[7].value = result2[0].m8;
- peopleIncrease[8].value = result2[0].m9;
- peopleIncrease[9].value = result2[0].m10;
- peopleIncrease[10].value = result2[0].m11;
- peopleIncrease[11].value = result2[0].m12;
- var tmpValue;
- for (var i = 11; i >= 0; i--) {
- if (peopleIncrease[i].value != null) {
- tmpValue = peopleIncrease[i].value;
- for (var j = i; j < peopleIncrease.length; j++) {
- peopleIncrease[j].value = tmpValue;
- }
- break;
- }
- }
- var store = new DevExpress.data.ODataStore({
- url: endpointSelector + "/BemsPeopleIncrease",
- key: ["Date", "SiteId"],
- keyType: { Date: "String", SiteId: "Int32" }
- });
- store.update({ Date: peopleIncreaseYear.toString(), SiteId: SITEID },
- {
- m1: peopleIncrease[0].value,
- m2: peopleIncrease[1].value,
- m3: peopleIncrease[2].value,
- m4: peopleIncrease[3].value,
- m5: peopleIncrease[4].value,
- m6: peopleIncrease[5].value,
- m7: peopleIncrease[6].value,
- m8: peopleIncrease[7].value,
- m9: peopleIncrease[8].value,
- m10: peopleIncrease[9].value,
- m11: peopleIncrease[10].value,
- m12: peopleIncrease[11].value
- })
- var curYear = new Date().getFullYear() - (parseInt(peopleIncreaseYear));
- for (var i = 0; i < curYear; i++) {
- if (i == curYear - 1) {
- peopleIncreaseYear = new Date().getFullYear();
- var tmpMonth = new Date().getMonth();
- for (var j = 0; j < peopleIncrease.length; j++) {
- if (j <= tmpMonth) {
- peopleIncrease[j].value = tmpValue;
- } else {
- peopleIncrease[j].value = null;
- }
- }
- store.insert({
- Date: peopleIncreaseYear.toString(),
- SiteId: SITEID,
- m1: CheckNull(peopleIncrease[0].value),
- m2: CheckNull(peopleIncrease[1].value),
- m3: CheckNull(peopleIncrease[2].value),
- m4: CheckNull(peopleIncrease[3].value),
- m5: CheckNull(peopleIncrease[4].value),
- m6: CheckNull(peopleIncrease[5].value),
- m7: CheckNull(peopleIncrease[6].value),
- m8: CheckNull(peopleIncrease[7].value),
- m9: CheckNull(peopleIncrease[8].value),
- m10: CheckNull(peopleIncrease[9].value),
- m11: CheckNull(peopleIncrease[10].value),
- m12: CheckNull(peopleIncrease[11].value)
- })
- } else {
- store.insert({
- Date: (parseInt(peopleIncreaseYear.toString()) + (i + 1)).toString(),
- SiteId: SITEID,
- m1: tmpValue.toString(),
- m2: tmpValue.toString(),
- m3: tmpValue.toString(),
- m4: tmpValue.toString(),
- m5: tmpValue.toString(),
- m6: tmpValue.toString(),
- m7: tmpValue.toString(),
- m8: tmpValue.toString(),
- m9: tmpValue.toString(),
- m10: tmpValue.toString(),
- m11: tmpValue.toString(),
- m12: tmpValue.toString()
- })
- }
- }
- } else {
- utils.toast.show("데이터가 없습니다.");
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- function GetSitePeopleIncreaseHistory() {
- var selectDate = $("#standardDatePicker").dxDateBox("instance").option('value');
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsPeopleIncrease"
- },
- requireTotalCount: true,
- pageSize: 1
- });
- dataSource.filter([
- ["SiteId", "=", SITEID],
- "and",
- ["Date", "=", selectDate.getFullYear().toString()]
- ]);
- dataSource.sort({ getter: "Date", desc: true });
- dataSource.load()
- .done(function (result) {
- if (result.length == 0) {
- peopleIncreaseYear = selectDate.getFullYear();
- peopleIncrease[0].value = null;
- peopleIncrease[1].value = null;
- peopleIncrease[2].value = null;
- peopleIncrease[3].value = null;
- peopleIncrease[4].value = null;
- peopleIncrease[5].value = null;
- peopleIncrease[6].value = null;
- peopleIncrease[7].value = null;
- peopleIncrease[8].value = null;
- peopleIncrease[9].value = null;
- peopleIncrease[10].value = null;
- peopleIncrease[11].value = null;
- } else {
- peopleIncreaseYear = result[0].Date;
- peopleIncrease[0].value = result[0].m1;
- peopleIncrease[1].value = result[0].m2;
- peopleIncrease[2].value = result[0].m3;
- peopleIncrease[3].value = result[0].m4;
- peopleIncrease[4].value = result[0].m5;
- peopleIncrease[5].value = result[0].m6;
- peopleIncrease[6].value = result[0].m7;
- peopleIncrease[7].value = result[0].m8;
- peopleIncrease[8].value = result[0].m9;
- peopleIncrease[9].value = result[0].m10;
- peopleIncrease[10].value = result[0].m11;
- peopleIncrease[11].value = result[0].m12;
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- function GetSiteRentalRate() {
- var now = new Date();
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsRentalRate"
- },
- requireTotalCount: true,
- pageSize: 1
- });
- dataSource.filter([
- ["SiteId", "=", SITEID],
- "and",
- ["Date", "=", now.getFullYear().toString()]
- ]);
- dataSource.sort({ getter: "Date", desc: true });
- dataSource.load()
- .done(function (result) {
- if (result.length != 0) {
- rentalRateYear = result[0].Date;
- rentalRate[0].value = result[0].m1;
- rentalRate[1].value = result[0].m2;
- rentalRate[2].value = result[0].m3;
- rentalRate[3].value = result[0].m4;
- rentalRate[4].value = result[0].m5;
- rentalRate[5].value = result[0].m6;
- rentalRate[6].value = result[0].m7;
- rentalRate[7].value = result[0].m8;
- rentalRate[8].value = result[0].m9;
- rentalRate[9].value = result[0].m10;
- rentalRate[10].value = result[0].m11;
- rentalRate[11].value = result[0].m12;
- var tmpValue;
- for (var i = 11; i >= 0; i--) {
- if (rentalRate[i].value != null) {
- tmpValue = rentalRate[i].value;
- for (var j = i; j <= now.getMonth() ; j++) {
- rentalRate[j].value = tmpValue;
- }
- break;
- }
- }
- var store = new DevExpress.data.ODataStore({
- url: endpointSelector + "/BemsRentalRate",
- key: ["Date", "SiteId"],
- keyType: { Date: "String", SiteId: "Int32" }
- });
- store.update({ Date: rentalRateYear.toString(), SiteId: SITEID },
- {
- m1: rentalRate[0].value,
- m2: rentalRate[1].value,
- m3: rentalRate[2].value,
- m4: rentalRate[3].value,
- m5: rentalRate[4].value,
- m6: rentalRate[5].value,
- m7: rentalRate[6].value,
- m8: rentalRate[7].value,
- m9: rentalRate[8].value,
- m10: rentalRate[9].value,
- m11: rentalRate[10].value,
- m12: rentalRate[11].value
- })
- } else if (result.length == 0) {
- var dataSource2 = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsRentalRate"
- },
- requireTotalCount: true,
- pageSize: 1
- });
- dataSource2.filter([
- ["SiteId", "=", SITEID],
- ]);
- dataSource2.sort({ getter: "Date", desc: true });
- dataSource2.load()
- .done(function (result2) {
- if (result2.length != 0) {
- rentalRateYear = result2[0].Date;
- rentalRate[0].value = result2[0].m1;
- rentalRate[1].value = result2[0].m2;
- rentalRate[2].value = result2[0].m3;
- rentalRate[3].value = result2[0].m4;
- rentalRate[4].value = result2[0].m5;
- rentalRate[5].value = result2[0].m6;
- rentalRate[6].value = result2[0].m7;
- rentalRate[7].value = result2[0].m8;
- rentalRate[8].value = result2[0].m9;
- rentalRate[9].value = result2[0].m10;
- rentalRate[10].value = result2[0].m11;
- rentalRate[11].value = result2[0].m12;
- var tmpValue;
- for (var i = 11; i >= 0; i--) {
- if (rentalRate[i].value != null) {
- tmpValue = rentalRate[i].value;
- for (var j = i; j < rentalRate.length; j++) {
- rentalRate[j].value = tmpValue;
- }
- break;
- }
- }
- var store = new DevExpress.data.ODataStore({
- url: endpointSelector + "/BemsRentalRate",
- key: ["Date", "SiteId"],
- keyType: { Date: "String", SiteId: "Int32" }
- });
- store.update({ Date: rentalRateYear.toString(), SiteId: SITEID },
- {
- m1: rentalRate[0].value,
- m2: rentalRate[1].value,
- m3: rentalRate[2].value,
- m4: rentalRate[3].value,
- m5: rentalRate[4].value,
- m6: rentalRate[5].value,
- m7: rentalRate[6].value,
- m8: rentalRate[7].value,
- m9: rentalRate[8].value,
- m10: rentalRate[9].value,
- m11: rentalRate[10].value,
- m12: rentalRate[11].value
- })
- var curYear = new Date().getFullYear() - (parseInt(rentalRateYear));
- for (var i = 0; i < curYear; i++) {
- if (i == curYear - 1) {
- rentalRateYear = new Date().getFullYear();
- var tmpMonth = new Date().getMonth();
- for (var j = 0; j < rentalRate.length; j++) {
- if (j <= tmpMonth) {
- rentalRate[j].value = tmpValue;
- } else {
- rentalRate[j].value = null;
- }
- }
- store.insert({
- Date: rentalRateYear.toString(),
- SiteId: SITEID,
- m1: CheckNull(rentalRate[0].value),
- m2: CheckNull(rentalRate[1].value),
- m3: CheckNull(rentalRate[2].value),
- m4: CheckNull(rentalRate[3].value),
- m5: CheckNull(rentalRate[4].value),
- m6: CheckNull(rentalRate[5].value),
- m7: CheckNull(rentalRate[6].value),
- m8: CheckNull(rentalRate[7].value),
- m9: CheckNull(rentalRate[8].value),
- m10: CheckNull(rentalRate[9].value),
- m11: CheckNull(rentalRate[10].value),
- m12: CheckNull(rentalRate[11].value)
- })
- } else {
- store.insert({
- Date: (parseInt(rentalRateYear.toString()) + (i + 1)).toString(),
- SiteId: SITEID,
- m1: tmpValue.toString(),
- m2: tmpValue.toString(),
- m3: tmpValue.toString(),
- m4: tmpValue.toString(),
- m5: tmpValue.toString(),
- m6: tmpValue.toString(),
- m7: tmpValue.toString(),
- m8: tmpValue.toString(),
- m9: tmpValue.toString(),
- m10: tmpValue.toString(),
- m11: tmpValue.toString(),
- m12: tmpValue.toString()
- })
- }
- }
- } else {
- utils.toast.show("데이터가 없습니다.");
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- function CheckNull(value) {
- if (value == null) {
- return null;
- } else {
- return value;
- }
- }
- function GetSiteRentalRateHistory() {
- var selectDate = $("#standardDatePicker").dxDateBox("instance").option('value');
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsRentalRate"
- },
- requireTotalCount: true,
- pageSize: 1
- });
- dataSource.filter([
- ["SiteId", "=", SITEID],
- "and",
- ["Date", "=", selectDate.getFullYear().toString()]
- ]);
- dataSource.sort({ getter: "Date", desc: true });
- dataSource.load()
- .done(function (result) {
- if (result.length == 0) {
- rentalRateYear = selectDate.getFullYear();
- rentalRate[0].value = null;
- rentalRate[1].value = null;
- rentalRate[2].value = null;
- rentalRate[3].value = null;
- rentalRate[4].value = null;
- rentalRate[5].value = null;
- rentalRate[6].value = null;
- rentalRate[7].value = null;
- rentalRate[8].value = null;
- rentalRate[9].value = null;
- rentalRate[10].value = null;
- rentalRate[11].value = null;
- } else {
- rentalRateYear = result[0].Date;
- rentalRate[0].value = result[0].m1;
- rentalRate[1].value = result[0].m2;
- rentalRate[2].value = result[0].m3;
- rentalRate[3].value = result[0].m4;
- rentalRate[4].value = result[0].m5;
- rentalRate[5].value = result[0].m6;
- rentalRate[6].value = result[0].m7;
- rentalRate[7].value = result[0].m8;
- rentalRate[8].value = result[0].m9;
- rentalRate[9].value = result[0].m10;
- rentalRate[10].value = result[0].m11;
- rentalRate[11].value = result[0].m12;
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- function GetEnergyData(FuelTypeId, FacilityTypeId, FacilityCode, FormulaId) {
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsFormulaParameter"
- },
- requireTotalCount: true,
- pageSize: 100
- });
- dataSource.filter([
- ["SiteId", "=", SITEID],
- "and",
- ["FacilityTypeId", "=", FacilityTypeId],
- "and",
- ["FacilityCode", "=", FacilityCode],
- "and",
- ["FormulaId", "=", FormulaId]
- ]);
- dataSource.sort({ getter: "ParameterId", desc: true });
- dataSource.load()
- .done(function (result) {
- var formulaArray = new Array(result.length);
- for (var i = 0; i < formulaArray.length; i++) {
- formulaArray[i] = new Array(2);
- }
- for (var i = 0; i < formulaArray.length; i++) {
- formulaArray[i][0] = result[i].ParameterFacilityCode;
- formulaArray[i][1] = result[i].ParameterPropertyId;
- }
- for (var i = 0; i < formulaArray.length; i++) {
- GetDailyData(FuelTypeId, formulaArray[i]);
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- function GetDailyData(FuelTypeId, formulaArray) {
- var now = new Date();
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointHistoryDaily"
- },
- requireTotalCount: true,
- pageSize: 366
- });
- dataSource.filter([
- ["SiteId", "=", SITEID],
- "and",
- ["FacilityCode", "=", formulaArray[0]],
- "and",
- ["PropertyId", "=", formulaArray[1]],
- "and",
- ["CreatedDateTime", ">=", new Date(now.getFullYear(), 1 - 1, 1)],
- "and",
- ["CreatedDateTime", "<=", new Date(now.getFullYear(), 12 - 1, 31)]
- ]);
- dataSource.sort({ getter: "CreatedDateTime", asc: true });
- dataSource.load()
- .done(function (result) {
- for (var i = 0; i < result.length; i++) {
- if (FuelTypeId == powerFuelTypeId) {
- for (var j = 0; j < powerDataSource.length; j++) {
- if (powerDataSource[j].month.toString() == (result[i].CreatedDateTime.getMonth() + 1).toString()) {
- powerDataSource[j].value = powerDataSource[j].value + result[i].DailyValue;
- }
- }
- } else if (FuelTypeId == gasFuelTypeId) {
- for (var j = 0; j < gasDataSource.length; j++) {
- if (gasDataSource[j].month.toString() == (result[i].CreatedDateTime.getMonth() + 1).toString()) {
- gasDataSource[j].value = gasDataSource[j].value + (result[i].DailyValue * toe / kwh);
- }
- }
- } else {
- /*for (var j = 0; j < waterDataSource.length; j++) {
- if (waterDataSource[j].month.toString() == (result[i].CreatedDateTime.getMonth() + 1).toString()) {
- waterDataSource[j].value = waterDataSource[j].value + result[i].DailyValue;
- }
- }*/
- }
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- function GetEnergyDataHistory(FuelTypeId, FacilityTypeId, FacilityCode, FormulaId) {
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsFormulaParameter"
- },
- requireTotalCount: true,
- pageSize: 100
- });
- dataSource.filter([
- ["SiteId", "=", SITEID],
- "and",
- ["FacilityTypeId", "=", FacilityTypeId],
- "and",
- ["FacilityCode", "=", FacilityCode],
- "and",
- ["FormulaId", "=", FormulaId]
- ]);
- dataSource.sort({ getter: "ParameterId", desc: true });
- dataSource.load()
- .done(function (result) {
- var formulaArray = new Array(result.length);
- for (var i = 0; i < formulaArray.length; i++) {
- formulaArray[i] = new Array(2);
- }
- for (var i = 0; i < formulaArray.length; i++) {
- formulaArray[i][0] = result[i].ParameterFacilityCode;
- formulaArray[i][1] = result[i].ParameterPropertyId;
- }
- if (FuelTypeId == powerFuelTypeId) {
- for (var i = 0; i < powerDataSource.length; i++) {
- powerDataSource[i].value = null;
- }
- } else if (FuelTypeId == gasFuelTypeId) {
- for (var i = 0; i < gasDataSource.length; i++) {
- gasDataSource[i].value = null;
- }
- }
- for (var i = 0; i < formulaArray.length; i++) {
- GetDailyDataHistory(FuelTypeId, formulaArray[i]);
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- function GetDailyDataHistory(FuelTypeId, formulaArray) {
- var selectDate = $("#standardDatePicker").dxDateBox("instance").option('value');
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointHistoryDaily"
- },
- requireTotalCount: true,
- pageSize: 366
- });
- dataSource.filter([
- ["SiteId", "=", SITEID],
- "and",
- ["FacilityCode", "=", formulaArray[0]],
- "and",
- ["PropertyId", "=", formulaArray[1]],
- "and",
- ["CreatedDateTime", ">=", new Date(selectDate.getFullYear(), 1 - 1, 1)],
- "and",
- ["CreatedDateTime", "<=", new Date(selectDate.getFullYear(), 12 - 1, 31)]
- ]);
- dataSource.sort({ getter: "CreatedDateTime", asc: true });
- dataSource.load()
- .done(function (result) {
- for (var i = 0; i < result.length; i++) {
- if (FuelTypeId == powerFuelTypeId) {
- for (var j = 0; j < powerDataSource.length; j++) {
- if (powerDataSource[j].month.toString() == (result[i].CreatedDateTime.getMonth() + 1).toString()) {
- powerDataSource[j].value = powerDataSource[j].value + result[i].DailyValue;
- }
- }
- } else if (FuelTypeId == gasFuelTypeId) {
- for (var j = 0; j < gasDataSource.length; j++) {
- if (gasDataSource[j].month.toString() == (result[i].CreatedDateTime.getMonth() + 1).toString()) {
- gasDataSource[j].value = gasDataSource[j].value + (result[i].DailyValue * toe / kwh);
- }
- }
- } else {
- /*for (var j = 0; j < waterDataSource.length; j++) {
- if (waterDataSource[j].month.toString() == (result[i].CreatedDateTime.getMonth() + 1).toString()) {
- waterDataSource[j].value = waterDataSource[j].value + result[i].DailyValue;
- }
- }*/
- }
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- function SetChart() {
- var selectFactor = $("#factorSelect").dxSelectBox("instance").option('value');
- if (selectFactor == 0) {
- for (var i = 0; i < chartDataSource.length; i++) {
- if (powerDataSource[i].value == null && gasDataSource[i].value == null) {
- chartDataSource[i].use = null;
- } else {
- chartDataSource[i].use = powerDataSource[i].value + gasDataSource[i].value;
- }
- chartDataSource[i].factor = peopleIncrease[i].value;
- }
- $("#compareChart").dxChart("instance").option('dataSource', chartDataSource);
- var tmpSeries = $("#compareChart").dxChart("instance").option('series');
- if (tmpSeries.length == 3) {
- tmpSeries.pop();
- }
- tmpSeries[0].name = "에너지 사용량(kWh/월)";
- tmpSeries[0].valueField = "use";
- tmpSeries[0].axis = "에너지 사용량";
- tmpSeries[1].name = "재실 인원(명/월)";
- tmpSeries[1].valueField = "factor";
- tmpSeries[1].axis = "재실 인원";
- $("#compareChart").dxChart("instance").option('series', tmpSeries);
- var tmpValueAxis = $("#compareChart").dxChart("instance").option('valueAxis');
- if (tmpValueAxis.length == 3) {
- tmpValueAxis.pop();
- }
- tmpValueAxis[0].name = "에너지 사용량";
- tmpValueAxis[0].position = "left";
- tmpValueAxis[0].title = "에너지 사용량(kWh/월)";
- tmpValueAxis[1].name = "재실 인원";
- tmpValueAxis[1].position = "right";
- tmpValueAxis[1].inverted = true;
- tmpValueAxis[1].title = "재실 인원(명/월)";
- $("#compareChart").dxChart("instance").option('valueAxis', tmpValueAxis);
- } else if (selectFactor == 1) {
- for (var i = 0; i < chartDataSource.length; i++) {
- if (powerDataSource[i].value == null && gasDataSource[i].value == null) {
- chartDataSource[i].use = null;
- } else {
- chartDataSource[i].use = powerDataSource[i].value + gasDataSource[i].value;
- }
- chartDataSource[i].factor = rentalRate[i].value;
- }
- $("#compareChart").dxChart("instance").option('dataSource', chartDataSource);
- var tmpSeries = $("#compareChart").dxChart("instance").option('series');
- if (tmpSeries.length == 3) {
- tmpSeries.pop();
- }
- tmpSeries[0].name = "에너지 사용량(kWh/월)";
- tmpSeries[0].valueField = "use";
- tmpSeries[0].axis = "에너지 사용량";
- tmpSeries[1].name = "임대율(%/월)";
- tmpSeries[1].valueField = "factor";
- tmpSeries[1].axis = "임대율";
- $("#compareChart").dxChart("instance").option('series', tmpSeries);
- var tmpValueAxis = $("#compareChart").dxChart("instance").option('valueAxis');
- if (tmpValueAxis.length == 3) {
- tmpValueAxis.pop();
- }
- tmpValueAxis[0].name = "에너지 사용량";
- tmpValueAxis[0].position = "left";
- tmpValueAxis[0].title = "에너지 사용량(kWh/월)";
- tmpValueAxis[1].name = "임대율";
- tmpValueAxis[1].position = "right";
- tmpValueAxis[1].inverted = true;
- tmpValueAxis[1].title = "임대율(%/월)";
- $("#compareChart").dxChart("instance").option('valueAxis', tmpValueAxis);
- }
- else if (selectFactor == 2) {
- for (var i = 0; i < chartDataSource.length; i++) {
- if (powerDataSource[i].value == null && gasDataSource[i].value == null) {
- chartDataSource[i].use = null;
- } else {
- chartDataSource[i].use = powerDataSource[i].value + gasDataSource[i].value;
- }
- chartDataSource[i].factor = CDDDataSource[i].value;
- }
- $("#compareChart").dxChart("instance").option('dataSource', chartDataSource);
- var tmpSeries = $("#compareChart").dxChart("instance").option('series');
- if (tmpSeries.length == 3) {
- tmpSeries.pop();
- }
- tmpSeries[0].name = "에너지 사용량(kWh/월)";
- tmpSeries[0].valueField = "use";
- tmpSeries[0].axis = "에너지 사용량";
- tmpSeries[1].name = "냉방도일(월)";
- tmpSeries[1].valueField = "factor";
- tmpSeries[1].axis = "냉방도일";
- $("#compareChart").dxChart("instance").option('series', tmpSeries);
- var tmpValueAxis = $("#compareChart").dxChart("instance").option('valueAxis');
- if (tmpValueAxis.length == 3) {
- tmpValueAxis.pop();
- }
- tmpValueAxis[0].name = "에너지 사용량";
- tmpValueAxis[0].position = "left";
- tmpValueAxis[0].title = "에너지 사용량(kWh/월)";
- tmpValueAxis[1].name = "냉방도일";
- tmpValueAxis[1].position = "right";
- tmpValueAxis[1].inverted = false;
- tmpValueAxis[1].title = "냉방도일(월)";
- $("#compareChart").dxChart("instance").option('valueAxis', tmpValueAxis);
- }
- else if (selectFactor == 3) {
- for (var i = 0; i < chartDataSource.length; i++) {
- if (powerDataSource[i].value == null && gasDataSource[i].value == null) {
- chartDataSource[i].use = null;
- } else {
- chartDataSource[i].use = powerDataSource[i].value + gasDataSource[i].value;
- }
- chartDataSource[i].factor = HDDDataSource[i].value;
- }
- $("#compareChart").dxChart("instance").option('dataSource', chartDataSource);
- var tmpSeries = $("#compareChart").dxChart("instance").option('series');
- if (tmpSeries.length == 3) {
- tmpSeries.pop();
- }
- tmpSeries[0].name = "에너지 사용량(kWh/월)";
- tmpSeries[0].valueField = "use";
- tmpSeries[0].axis = "에너지 사용량";
- tmpSeries[1].name = "난방도일(월)";
- tmpSeries[1].valueField = "factor";
- tmpSeries[1].axis = "난방도일";
- $("#compareChart").dxChart("instance").option('series', tmpSeries);
- var tmpValueAxis = $("#compareChart").dxChart("instance").option('valueAxis');
- if (tmpValueAxis.length == 3) {
- tmpValueAxis.pop();
- }
- tmpValueAxis[0].name = "에너지 사용량";
- tmpValueAxis[0].position = "left";
- tmpValueAxis[0].title = "에너지 사용량(kWh/월)";
- tmpValueAxis[1].name = "난방도일";
- tmpValueAxis[1].position = "right";
- tmpValueAxis[1].inverted = false;
- tmpValueAxis[1].title = "난방도일(월)";
- $("#compareChart").dxChart("instance").option('valueAxis', tmpValueAxis);
- }
- else if (selectFactor == 4) {
- for (var i = 0; i < chartDataSourceHDDCDD.length; i++) {
- if (powerDataSource[i].value == null && gasDataSource[i].value == null) {
- chartDataSourceHDDCDD[i].use = null;
- } else {
- chartDataSourceHDDCDD[i].use = powerDataSource[i].value + gasDataSource[i].value;
- }
- chartDataSourceHDDCDD[i].hdd = HDDDataSource[i].value;
- chartDataSourceHDDCDD[i].cdd = CDDDataSource[i].value;
- }
- $("#compareChart").dxChart("instance").option('dataSource', chartDataSourceHDDCDD);
- var tmpSeries = $("#compareChart").dxChart("instance").option('series');
- if (tmpSeries.length == 2) {
- tmpSeries.push({ valueField: "hdd", name: "난방도일(월)", color: '#FFBB00', axis: "난방도일" });
- }
- tmpSeries[0].name = "에너지 사용량(kWh/월)";
- tmpSeries[0].valueField = "use";
- tmpSeries[0].axis = "에너지 사용량";
- tmpSeries[1].name = "냉방도일(월)";
- tmpSeries[1].valueField = "cdd";
- tmpSeries[1].axis = "냉방도일";
- $("#compareChart").dxChart("instance").option('series', tmpSeries);
- var tmpValueAxis = $("#compareChart").dxChart("instance").option('valueAxis');
- if (tmpValueAxis.length == 2) {
- tmpValueAxis.push({ valueField: "hdd", name: "난방도일", axis: "난방도일", position: "right", title: "난방도일(월)" });
- }
- tmpValueAxis[0].name = "에너지 사용량";
- tmpValueAxis[0].position = "left";
- tmpValueAxis[0].title = "에너지 사용량(kWh/월)";
- tmpValueAxis[1].name = "냉방도일";
- tmpValueAxis[1].position = "right";
- tmpValueAxis[1].inverted = false;
- tmpValueAxis[1].title = "냉방도일(월)";
- $("#compareChart").dxChart("instance").option('valueAxis', tmpValueAxis);
- } else {
- utils.toast.show("소비 요인이 선택되지 않았습니다.");
- }
- }
- function GetTOEKWH() {
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsFactorToe"
- },
- requireTotalCount: true,
- pageSize: 10
- });
- dataSource.filter([
- ["FuelTypeId", "=", powerFuelTypeId],
- "or",
- ["FuelTypeId", "=", gasFuelTypeId]
- ]);
- dataSource.sort({ getter: "FuelTypeId", asc: true });
- dataSource.load()
- .done(function (result) {
- toe = result[1].PureFactor;
- kwh = result[0].PureFactor;
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- function GetHDDCDD() {
- for (var i = 0; i < temperatureFormula.length; i++) {
- var now = new Date();
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointHistoryDaily"
- },
- requireTotalCount: true,
- pageSize: 366
- });
- dataSource.filter([
- ["SiteId", "=", SITEID],
- "and",
- ["FacilityCode", "=", temperatureFormula[i].FacilityCode],
- "and",
- ["PropertyId", "=", temperatureFormula[i].PropertyId],
- "and",
- ["CreatedDateTime", ">=", new Date(now.getFullYear(), 1 - 1, 1)],
- "and",
- ["CreatedDateTime", "<=", new Date(now.getFullYear(), 12 - 1, 31)]
- ]);
- dataSource.sort({ getter: "CreatedDateTime", asc: true });
- dataSource.load()
- .done(function (result) {
- for (var i = 0; i < result.length; i++) {
- for (var j = 0; j < HDDDataSource.length; j++) {
- if (HDDDataSource[j].month.toString() == (result[i].CreatedDateTime.getMonth() + 1).toString()) {
- HDDDataSource[j].value = HDDDataSource[j].value + (HDDStandard - parseFloat(result[i].DailyValue.toString()));
- }
- }
- for (var j = 0; j < CDDDataSource.length; j++) {
- if (CDDDataSource[j].month.toString() == (result[i].CreatedDateTime.getMonth() + 1).toString()) {
- CDDDataSource[j].value = CDDDataSource[j].value + (parseFloat(result[i].DailyValue.toString()) - CDDStandard);
- }
- }
- }
- for (var j = 0; j < HDDDataSource.length; j++) {
- HDDDataSource[j].value = HDDDataSource[j].value / temperatureFormula.length;
- }
- for (var j = 0; j < CDDDataSource.length; j++) {
- CDDDataSource[j].value = CDDDataSource[j].value / temperatureFormula.length;
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- }
- function GetHDDCDDHistory() {
- for (var i = 0; i < HDDDataSource.length; i++) {
- HDDDataSource[i].value = null;
- }
- for (var i = 0; i < CDDDataSource.length; i++) {
- CDDDataSource[i].value = null;
- }
- for (var i = 0; i < temperatureFormula.length; i++) {
- var selectDate = $("#standardDatePicker").dxDateBox("instance").option('value');
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointHistoryDaily"
- },
- requireTotalCount: true,
- pageSize: 366
- });
- dataSource.filter([
- ["SiteId", "=", SITEID],
- "and",
- ["FacilityCode", "=", temperatureFormula[i].FacilityCode],
- "and",
- ["PropertyId", "=", temperatureFormula[i].PropertyId],
- "and",
- ["CreatedDateTime", ">=", new Date(selectDate.getFullYear(), 1 - 1, 1)],
- "and",
- ["CreatedDateTime", "<=", new Date(selectDate.getFullYear(), 12 - 1, 31)]
- ]);
- dataSource.sort({ getter: "CreatedDateTime", asc: true });
- dataSource.load()
- .done(function (result) {
- for (var i = 0; i < result.length; i++) {
- for (var j = 0; j < HDDDataSource.length; j++) {
- if (HDDDataSource[j].month.toString() == (result[i].CreatedDateTime.getMonth() + 1).toString()) {
- HDDDataSource[j].value = HDDDataSource[j].value + (HDDStandard - parseFloat(result[i].DailyValue.toString()));
- }
- }
- for (var j = 0; j < CDDDataSource.length; j++) {
- if (CDDDataSource[j].month.toString() == (result[i].CreatedDateTime.getMonth() + 1).toString()) {
- CDDDataSource[j].value = CDDDataSource[j].value + (parseFloat(result[i].DailyValue.toString()) - CDDStandard);
- }
- }
- }
- for (var j = 0; j < HDDDataSource.length; j++) {
- if (HDDDataSource[j].value == null) {
- HDDDataSource[j].value = null;
- } else {
- HDDDataSource[j].value = HDDDataSource[j].value / temperatureFormula.length;
- }
- }
- for (var j = 0; j < CDDDataSource.length; j++) {
- if (CDDDataSource[j].value == null) {
- CDDDataSource[j].value = null;
- } else {
- CDDDataSource[j].value = CDDDataSource[j].value / temperatureFormula.length;
- }
- }
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- }
- function UpdatePeopleIncreseRentalRate() {
- var changeIndex = 0;
- for (var i = 0; i < monthInputArray.length; i++) {
- var inputValue = $("#textBox" + (i + 1).toString()).dxTextBox("instance").option('value');
- if (monthInputArray[i].value.toString() != inputValue.toString()) {
- changeIndex = i + 1;
- break;
- }
- }
- if (changeIndex == 0) {
- visiblePopup(false);
- return;
- }
- for (var i = changeIndex; i <= monthInputArray.length; i++) {
- $("#textBox" + i.toString()).dxTextBox("instance").option('value', $("#textBox" + changeIndex.toString()).dxTextBox("instance").option('value'));
- }
- var selectFactor = $("#factorSelect").dxSelectBox("instance").option('value');
- if (selectFactor == 0) {
- var store = new DevExpress.data.ODataStore({
- url: endpointSelector + "/BemsPeopleIncrease",
- key: ["Date", "SiteId"],
- keyType: { Date: "String", SiteId: "Int32" }
- });
- if (peopleIncreaseYear.toString() != new Date().getFullYear().toString()) {
- store.insert({
- Date: new Date().getFullYear().toString(),
- SiteId: SITEID,
- m1: $("#textBox1").dxTextBox("instance").option('value').toString(),
- m2: $("#textBox2").dxTextBox("instance").option('value').toString(),
- m3: $("#textBox3").dxTextBox("instance").option('value').toString(),
- m4: $("#textBox4").dxTextBox("instance").option('value').toString(),
- m5: $("#textBox5").dxTextBox("instance").option('value').toString(),
- m6: $("#textBox6").dxTextBox("instance").option('value').toString(),
- m7: $("#textBox7").dxTextBox("instance").option('value').toString(),
- m8: $("#textBox8").dxTextBox("instance").option('value').toString(),
- m9: $("#textBox9").dxTextBox("instance").option('value').toString(),
- m10: $("#textBox10").dxTextBox("instance").option('value').toString(),
- m11: $("#textBox11").dxTextBox("instance").option('value').toString(),
- m12: $("#textBox12").dxTextBox("instance").option('value').toString()
- }).done(function (key, result) {
- peopleIncrease[0].value = parseFloat($("#textBox1").dxTextBox("instance").option('value').toString());
- peopleIncrease[1].value = parseFloat($("#textBox2").dxTextBox("instance").option('value').toString());
- peopleIncrease[2].value = parseFloat($("#textBox3").dxTextBox("instance").option('value').toString());
- peopleIncrease[3].value = parseFloat($("#textBox4").dxTextBox("instance").option('value').toString());
- peopleIncrease[4].value = parseFloat($("#textBox5").dxTextBox("instance").option('value').toString());
- peopleIncrease[5].value = parseFloat($("#textBox6").dxTextBox("instance").option('value').toString());
- peopleIncrease[6].value = parseFloat($("#textBox7").dxTextBox("instance").option('value').toString());
- peopleIncrease[7].value = parseFloat($("#textBox8").dxTextBox("instance").option('value').toString());
- peopleIncrease[8].value = parseFloat($("#textBox9").dxTextBox("instance").option('value').toString());
- peopleIncrease[9].value = parseFloat($("#textBox10").dxTextBox("instance").option('value').toString());
- peopleIncrease[10].value = parseFloat($("#textBox11").dxTextBox("instance").option('value').toString());
- peopleIncrease[11].value = parseFloat($("#textBox12").dxTextBox("instance").option('value').toString());
- for (var i = 0; i < chartDataSource.length; i++) {
- chartDataSource[i].factor = peopleIncrease[i].value;
- }
- $("#compareChart").dxChart("instance").option('dataSource', chartDataSource);
- visiblePopup(false);
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- } else {
- store.update({ Date: peopleIncreaseYear, SiteId: SITEID },
- {
- m1: $("#textBox1").dxTextBox("instance").option('value').toString(),
- m2: $("#textBox2").dxTextBox("instance").option('value').toString(),
- m3: $("#textBox3").dxTextBox("instance").option('value').toString(),
- m4: $("#textBox4").dxTextBox("instance").option('value').toString(),
- m5: $("#textBox5").dxTextBox("instance").option('value').toString(),
- m6: $("#textBox6").dxTextBox("instance").option('value').toString(),
- m7: $("#textBox7").dxTextBox("instance").option('value').toString(),
- m8: $("#textBox8").dxTextBox("instance").option('value').toString(),
- m9: $("#textBox9").dxTextBox("instance").option('value').toString(),
- m10: $("#textBox10").dxTextBox("instance").option('value').toString(),
- m11: $("#textBox11").dxTextBox("instance").option('value').toString(),
- m12: $("#textBox12").dxTextBox("instance").option('value').toString(),
- })
- .done(function (key, result) {
- peopleIncrease[0].value = parseFloat($("#textBox1").dxTextBox("instance").option('value').toString());
- peopleIncrease[1].value = parseFloat($("#textBox2").dxTextBox("instance").option('value').toString());
- peopleIncrease[2].value = parseFloat($("#textBox3").dxTextBox("instance").option('value').toString());
- peopleIncrease[3].value = parseFloat($("#textBox4").dxTextBox("instance").option('value').toString());
- peopleIncrease[4].value = parseFloat($("#textBox5").dxTextBox("instance").option('value').toString());
- peopleIncrease[5].value = parseFloat($("#textBox6").dxTextBox("instance").option('value').toString());
- peopleIncrease[6].value = parseFloat($("#textBox7").dxTextBox("instance").option('value').toString());
- peopleIncrease[7].value = parseFloat($("#textBox8").dxTextBox("instance").option('value').toString());
- peopleIncrease[8].value = parseFloat($("#textBox9").dxTextBox("instance").option('value').toString());
- peopleIncrease[9].value = parseFloat($("#textBox10").dxTextBox("instance").option('value').toString());
- peopleIncrease[10].value = parseFloat($("#textBox11").dxTextBox("instance").option('value').toString());
- peopleIncrease[11].value = parseFloat($("#textBox12").dxTextBox("instance").option('value').toString());
- for (var i = 0; i < chartDataSource.length; i++) {
- chartDataSource[i].factor = peopleIncrease[i].value;
- }
- $("#compareChart").dxChart("instance").option('dataSource', chartDataSource);
- visiblePopup(false);
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- } else {
- var store = new DevExpress.data.ODataStore({
- url: endpointSelector + "/BemsRentalRate",
- key: ["Date", "SiteId"],
- keyType: { Date: "String", SiteId: "Int32" }
- });
- if (rentalRateYear.toString() != new Date().getFullYear().toString()) {
- store.insert({
- Date: new Date().getFullYear().toString(),
- SiteId: SITEID,
- m1: $("#textBox1").dxTextBox("instance").option('value').toString(),
- m2: $("#textBox2").dxTextBox("instance").option('value').toString(),
- m3: $("#textBox3").dxTextBox("instance").option('value').toString(),
- m4: $("#textBox4").dxTextBox("instance").option('value').toString(),
- m5: $("#textBox5").dxTextBox("instance").option('value').toString(),
- m6: $("#textBox6").dxTextBox("instance").option('value').toString(),
- m7: $("#textBox7").dxTextBox("instance").option('value').toString(),
- m8: $("#textBox8").dxTextBox("instance").option('value').toString(),
- m9: $("#textBox9").dxTextBox("instance").option('value').toString(),
- m10: $("#textBox10").dxTextBox("instance").option('value').toString(),
- m11: $("#textBox11").dxTextBox("instance").option('value').toString(),
- m12: $("#textBox12").dxTextBox("instance").option('value').toString()
- }).done(function (key, result) {
- rentalRate[0].value = parseFloat($("#textBox1").dxTextBox("instance").option('value').toString());
- rentalRate[1].value = parseFloat($("#textBox2").dxTextBox("instance").option('value').toString());
- rentalRate[2].value = parseFloat($("#textBox3").dxTextBox("instance").option('value').toString());
- rentalRate[3].value = parseFloat($("#textBox4").dxTextBox("instance").option('value').toString());
- rentalRate[4].value = parseFloat($("#textBox5").dxTextBox("instance").option('value').toString());
- rentalRate[5].value = parseFloat($("#textBox6").dxTextBox("instance").option('value').toString());
- rentalRate[6].value = parseFloat($("#textBox7").dxTextBox("instance").option('value').toString());
- rentalRate[7].value = parseFloat($("#textBox8").dxTextBox("instance").option('value').toString());
- rentalRate[8].value = parseFloat($("#textBox9").dxTextBox("instance").option('value').toString());
- rentalRate[9].value = parseFloat($("#textBox10").dxTextBox("instance").option('value').toString());
- rentalRate[10].value = parseFloat($("#textBox11").dxTextBox("instance").option('value').toString());
- rentalRate[11].value = parseFloat($("#textBox12").dxTextBox("instance").option('value').toString());
- for (var i = 0; i < chartDataSource.length; i++) {
- chartDataSource[i].factor = rentalRate[i].value;
- }
- $("#compareChart").dxChart("instance").option('dataSource', chartDataSource);
- visiblePopup(false);
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- } else {
- store.update({ Date: rentalRateYear, SiteId: SITEID },
- {
- m1: $("#textBox1").dxTextBox("instance").option('value').toString(),
- m2: $("#textBox2").dxTextBox("instance").option('value').toString(),
- m3: $("#textBox3").dxTextBox("instance").option('value').toString(),
- m4: $("#textBox4").dxTextBox("instance").option('value').toString(),
- m5: $("#textBox5").dxTextBox("instance").option('value').toString(),
- m6: $("#textBox6").dxTextBox("instance").option('value').toString(),
- m7: $("#textBox7").dxTextBox("instance").option('value').toString(),
- m8: $("#textBox8").dxTextBox("instance").option('value').toString(),
- m9: $("#textBox9").dxTextBox("instance").option('value').toString(),
- m10: $("#textBox10").dxTextBox("instance").option('value').toString(),
- m11: $("#textBox11").dxTextBox("instance").option('value').toString(),
- m12: $("#textBox12").dxTextBox("instance").option('value').toString(),
- })
- .done(function (key, result) {
- rentalRate[0].value = parseFloat($("#textBox1").dxTextBox("instance").option('value').toString());
- rentalRate[1].value = parseFloat($("#textBox2").dxTextBox("instance").option('value').toString());
- rentalRate[2].value = parseFloat($("#textBox3").dxTextBox("instance").option('value').toString());
- rentalRate[3].value = parseFloat($("#textBox4").dxTextBox("instance").option('value').toString());
- rentalRate[4].value = parseFloat($("#textBox5").dxTextBox("instance").option('value').toString());
- rentalRate[5].value = parseFloat($("#textBox6").dxTextBox("instance").option('value').toString());
- rentalRate[6].value = parseFloat($("#textBox7").dxTextBox("instance").option('value').toString());
- rentalRate[7].value = parseFloat($("#textBox8").dxTextBox("instance").option('value').toString());
- rentalRate[8].value = parseFloat($("#textBox9").dxTextBox("instance").option('value').toString());
- rentalRate[9].value = parseFloat($("#textBox10").dxTextBox("instance").option('value').toString());
- rentalRate[10].value = parseFloat($("#textBox11").dxTextBox("instance").option('value').toString());
- rentalRate[11].value = parseFloat($("#textBox12").dxTextBox("instance").option('value').toString());
- for (var i = 0; i < chartDataSource.length; i++) {
- chartDataSource[i].factor = rentalRate[i].value;
- }
- $("#compareChart").dxChart("instance").option('dataSource', chartDataSource);
- visiblePopup(false);
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- }
- }
- function handleViewShowing() {
- facilityDataSource.filter([
- eq('SiteId', SITEID),
- 'and',
- eq('FacilityTypeId', powerFacilityTypeId),
- 'or',
- eq('FacilityTypeId', gasFacilityTypeId)
- ]);
- facilityDataSource.load().done(function (facilities) {
- if (_.isEmpty(facilities) === false) {
- for (var i = 0; i < facilities.length; i++) {
- if (facilities[i].FacilityTypeId() == powerFacilityTypeId) {
- powerFacilityCode = facilities[i].FacilityCode();
- }
- else {
- gasFacilityCode = facilities[i].FacilityCode();
- }
- }
- }
- });
- GetTOEKWH();
- GetSiteHDDCDDStandard();
- GetSiteRentalRate();
- GetSitePeopleIncrease();
- GetEnergyData(powerFuelTypeId, powerFacilityTypeId, powerFacilityCode, powerFormulaId);
- GetEnergyData(gasFuelTypeId, gasFacilityTypeId, gasFacilityCode, gasFormulaId);
- }
- // 2019.04.16 : 그리드 도표 작업 : 팝업창 추가 ~~~
- function DataGridPopup_ButtonClick() {
- // DevExpress.ui.notify("날짜가 일치하지 않는 데이타가 존재합니다", "fail", 1000);
- var selectFactor = $("#factorSelect").dxSelectBox("instance").option('value');
- // 팝업창 레이아웃 **********kgp
- if (selectFactor == 4)
- DataGridPopup_Visible2(true);
- else if (selectFactor == 2 || selectFactor == 3)
- DataGridPopup_Visible1(true);
- else
- DataGridPopup_Visible(true);
- }
- // 도표를 선택하면 함수호출
- function handlePopupShown() {
- var today = new Date();
- var TodayMonth = today.getMonth();
- var TodayYear = today.getFullYear();
- var selectDate = $("#standardDatePicker").dxDateBox("instance").option('value');
- var selectedYear = selectDate.getFullYear();
- var selectFactor = $("#factorSelect").dxSelectBox("instance").option('value');
- if (selectFactor == 4) {
- dataArrayresult2 = chartDataSourceHDDCDD.slice();
- if (selectedYear == TodayYear)
- dataArrayresult2.splice(TodayMonth, 12 - TodayMonth); // 불필요 데이터 삭제
- }
- else if (selectFactor == 2 || selectFactor == 3) {
- dataArrayresult1 = chartDataSource.slice();
- if (selectedYear == TodayYear)
- dataArrayresult1.splice(TodayMonth, 12 - TodayMonth); // 불필요 데이터 삭제
- }
- else {
- dataArrayresult = chartDataSource.slice();
- if (selectedYear == TodayYear)
- dataArrayresult.splice(TodayMonth, 12 - TodayMonth); // 불필요 데이터 삭제
- }
- // 컬럼명 업데이트
- var ColumnCaptionName = "";
- if (selectFactor == 0) {
- ColumnCaptionName = "재실 인원(명/월)";
- viewModel.EnergyUsageFactorOptions.columns[2].caption = ColumnCaptionName;
- $("#EnergyUsageFactor_Container").dxDataGrid("instance").option("dataSource", dataArrayresult);
- DataGridPopup_Visible(true);
- }
- else if (selectFactor == 1) {
- ColumnCaptionName = "임대율(%/월)";
- viewModel.EnergyUsageFactorOptions.columns[2].caption = ColumnCaptionName;
- $("#EnergyUsageFactor_Container").dxDataGrid("instance").option("dataSource", dataArrayresult);
- DataGridPopup_Visible(true);
- }
- else if (selectFactor == 2) {
- ColumnCaptionName = "냉방도일(월)";
- viewModel.EnergyUsageFactorOptions1.columns[2].caption = ColumnCaptionName;
- $("#EnergyUsageFactor_Container1").dxDataGrid("instance").option("dataSource", dataArrayresult1);
- DataGridPopup_Visible1(true);
- }
- else if (selectFactor == 3) {
- ColumnCaptionName = "난방도일(월)";
- viewModel.EnergyUsageFactorOptions1.columns[2].caption = ColumnCaptionName;
- $("#EnergyUsageFactor_Container1").dxDataGrid("instance").option("dataSource", dataArrayresult1);
- DataGridPopup_Visible1(true);
- }
- else if (selectFactor == 4) {
- viewModel.EnergyUsageFactorOptions2.columns[2].caption = "냉방도일(월)";
- viewModel.EnergyUsageFactorOptions2.columns[3].caption = "난방도일(월)";
- $("#EnergyUsageFactor_Container2").dxDataGrid("instance").option("dataSource", dataArrayresult2);
- DataGridPopup_Visible2(true);
- }
- }
- // ~~~ 2019.04.16 : 그리드 도표 작업 : 팝업창 추가
- function handleViewShown() {
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', true);
- setTimeout(function () {
- SetUseFactorSelect();
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', false);
- }, 500);
- visiblePopup(false);
- }
- var searchViewOptions = {
- };
- function handleSearchInSearchView() {
- }
- var viewModel = $.extend(BWA.CommonView.create(params, viewInfo, searchViewOptions, ko.observable(null), handleViewShown, null, handleSearchInSearchView),
- {
- viewShowing: handleViewShowing,
- factorSelect: {
- onSelectionChanged: function () {
- var selectFactor = $("#factorSelect").dxSelectBox("instance").option('value');
- if (selectFactor == 0) {
- $("#insertBtn").show();
- $("#textHDD").hide();
- $("#inputHDD").hide();
- $("#textCDD").hide();
- $("#inputCDD").hide();
- GetSitePeopleIncreaseHistory();
- GetEnergyDataHistory(powerFuelTypeId, powerFacilityTypeId, powerFacilityCode, powerFormulaId);
- GetEnergyDataHistory(gasFuelTypeId, gasFacilityTypeId, gasFacilityCode, gasFormulaId);
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', true);
- setTimeout(function () {
- SetChart();
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', false);
- }, 500);
- } else if (selectFactor == 1) {
- $("#insertBtn").show();
- $("#textHDD").hide();
- $("#inputHDD").hide();
- $("#textCDD").hide();
- $("#inputCDD").hide();
- GetSiteRentalRateHistory();
- GetEnergyDataHistory(powerFuelTypeId, powerFacilityTypeId, powerFacilityCode, powerFormulaId);
- GetEnergyDataHistory(gasFuelTypeId, gasFacilityTypeId, gasFacilityCode, gasFormulaId);
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', true);
- setTimeout(function () {
- SetChart();
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', false);
- }, 500);
- } else if (selectFactor == 2) {
- $("#insertBtn").hide();
- $("#textCDD").show();
- $("#inputCDD").show();
- $("#textHDD").hide();
- $("#inputHDD").hide();
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', true);
- GetHDDCDDHistory();
- GetEnergyDataHistory(powerFuelTypeId, powerFacilityTypeId, powerFacilityCode, powerFormulaId);
- GetEnergyDataHistory(gasFuelTypeId, gasFacilityTypeId, gasFacilityCode, gasFormulaId);
- setTimeout(function () {
- SetChart();
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', false);
- }, 500);
- } else if (selectFactor == 3) {
- $("#insertBtn").hide();
- $("#textCDD").hide();
- $("#inputCDD").hide();
- $("#textHDD").show();
- $("#inputHDD").show();
- GetHDDCDDHistory();
- GetEnergyDataHistory(powerFuelTypeId, powerFacilityTypeId, powerFacilityCode, powerFormulaId);
- GetEnergyDataHistory(gasFuelTypeId, gasFacilityTypeId, gasFacilityCode, gasFormulaId);
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', true);
- setTimeout(function () {
- SetChart();
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', false);
- }, 500);
- } else if (selectFactor == 4) {
- $("#insertBtn").hide();
- $("#textHDD").show();
- $("#inputHDD").show();
- $("#textCDD").show();
- $("#inputCDD").show();
- GetHDDCDDHistory();
- GetEnergyDataHistory(powerFuelTypeId, powerFacilityTypeId, powerFacilityCode, powerFormulaId);
- GetEnergyDataHistory(gasFuelTypeId, gasFacilityTypeId, gasFacilityCode, gasFormulaId);
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', true);
- setTimeout(function () {
- SetChart();
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', false);
- }, 500);
- } else {
- utils.toast.show("소비 요인이 선택되지 않았습니다.");
- }
- }
- },
- compareChart: {
- size: {
- height: 650
- },
- commonSeriesSettings: {
- argumentField: "month",
- type: "line"
- },
- series: ko.observable([
- { valueField: "use", name: "에너지 사용량", color: '#5F8B95' },
- { valueField: "factor", name: "재실 인원", color: '#FF5E00', axis: "재실 인원" }
- ]),
- legend: {
- verticalAlignment: "top",
- horizontalAlignment: "center",
- position: "outside",
- border: { visible: false }
- },
- argumentAxis: ko.observable({
- visible: true,
- label: {
- customizeText: function () {
- return this.value + '월';
- }
- },
- min: 1,
- max: 12,
- valueType: 'numeric',
- tickInterval: 1
- }),
- valueAxis: [{
- name: "에너지 사용량",
- position: "left",
- },
- {
- name: "재실 인원",
- position: "right",
- }
- ],
- "export": {
- enabled: true
- },
- tooltip: {
- enabled: true,
- customizeTooltip: function (point) {
- return {
- text: numberWithCommas(parseFloat(point.value.toString()).toFixed(2))
- };
- }
- }
- },
- InsertButtonClicked: function () {
- visiblePopup(true);
- },
- textBox1: {},
- textBox2: {},
- textBox3: {},
- textBox4: {},
- textBox5: {},
- textBox6: {},
- textBox7: {},
- textBox8: {},
- textBox9: {},
- textBox10: {},
- textBox11: {},
- textBox12: {},
- AcceptButtonClicked: function () {
- UpdatePeopleIncreseRentalRate();
- },
- inputHDD: {
- readOnly: true
- },
- inputCDD: {
- readOnly: true
- },
- loadIndicator: {
- visible: false
- },
- standardDatePicker: {
- pickerType: "calendar",
- value: new Date(),
- formatString: "yyyy년",
- maxZoomLevel: "decade",
- width: "8%",
- onValueChanged: function () {
- var selectFactor = $("#factorSelect").dxSelectBox("instance").option('value');
- if (selectFactor == 0) {
- GetSitePeopleIncreaseHistory();
- GetEnergyDataHistory(powerFuelTypeId, powerFacilityTypeId, powerFacilityCode, powerFormulaId);
- GetEnergyDataHistory(gasFuelTypeId, gasFacilityTypeId, gasFacilityCode, gasFormulaId);
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', true);
- setTimeout(function () {
- SetChart();
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', false);
- }, 500);
- } else if (selectFactor == 1) {
- GetSiteRentalRateHistory();
- GetEnergyDataHistory(powerFuelTypeId, powerFacilityTypeId, powerFacilityCode, powerFormulaId);
- GetEnergyDataHistory(gasFuelTypeId, gasFacilityTypeId, gasFacilityCode, gasFormulaId);
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', true);
- setTimeout(function () {
- SetChart();
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', false);
- }, 500);
- } else if (selectFactor == 2) {
- GetHDDCDDHistory();
- GetEnergyDataHistory(powerFuelTypeId, powerFacilityTypeId, powerFacilityCode, powerFormulaId);
- GetEnergyDataHistory(gasFuelTypeId, gasFacilityTypeId, gasFacilityCode, gasFormulaId);
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', true);
- setTimeout(function () {
- SetChart();
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', false);
- }, 500);
- } else if (selectFactor == 3) {
- GetHDDCDDHistory();
- GetEnergyDataHistory(powerFuelTypeId, powerFacilityTypeId, powerFacilityCode, powerFormulaId);
- GetEnergyDataHistory(gasFuelTypeId, gasFacilityTypeId, gasFacilityCode, gasFormulaId);
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', true);
- setTimeout(function () {
- SetChart();
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', false);
- }, 500);
- } else if (selectFactor == 4) {
- GetHDDCDDHistory();
- GetEnergyDataHistory(powerFuelTypeId, powerFacilityTypeId, powerFacilityCode, powerFormulaId);
- GetEnergyDataHistory(gasFuelTypeId, gasFacilityTypeId, gasFacilityCode, gasFormulaId);
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', true);
- setTimeout(function () {
- SetChart();
- $("#loadIndicator").dxLoadIndicator("instance").option('visible', false);
- }, 500);
- } else {
- utils.toast.show("소비 요인이 선택되지 않았습니다.");
- }
- }
- },
- // 2019.04.16 : 그리드 도표 작업 : 팝업창 추가
- EnergyUsageFactorPopup_ButtonClicked: DataGridPopup_ButtonClick
- });
- // 2019.04.16 : 그리드 도표 작업 : 팝업창 추가 ~~~
- // 그래프 도표 팝업창
- viewModel.EnergyUsageFactorPopupOptions = {
- width: '480px',
- 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()
- };
- viewModel.EnergyUsageFactorPopupOptions1 = {
- width: '480px',
- height: '750px', // cyim 2017.05.30 : 테스트 결과 Devextreme 버그임. px 로 지정하면 초기 출력시 정확하게 가운데에 있지만, auto 설정시 화면아래에 위치하게 됨
- contentTemplate: "content",
- showTitle: true,
- title: "도표",
- visible: DataGridPopup_Visible1,
- dragEnabled: true,
- closeOnOutsideClick: true,
- shownAction: handlePopupShown,
- animation: window.utils.popup.createAnimation()
- };
- viewModel.EnergyUsageFactorPopupOptions2 = {
- width: '480px',
- height: '750px', // cyim 2017.05.30 : 테스트 결과 Devextreme 버그임. px 로 지정하면 초기 출력시 정확하게 가운데에 있지만, auto 설정시 화면아래에 위치하게 됨
- contentTemplate: "content",
- showTitle: true,
- title: "도표",
- visible: DataGridPopup_Visible2,
- dragEnabled: true,
- closeOnOutsideClick: true,
- shownAction: handlePopupShown,
- animation: window.utils.popup.createAnimation()
- };
- // ~~~ 2019.04.16 : 그리드 도표 작업 : 팝업창 추가
- viewModel.popupOptions = {
- width: 350,
- height: 548,
- visible: visiblePopup,
- dragEnabled: false,
- shading: true,
- showTitle: true,
- title: "월별 자료 입력",
- showCloseButton: true,
- onShowing: function () {
- },
- onShown: function () {
- var selectFactor = $("#factorSelect").dxSelectBox("instance").option('value');
- if (selectFactor == 0) {
- $("#textBox1").dxTextBox("instance").option('value', peopleIncrease[0].value.toString());
- $("#textBox2").dxTextBox("instance").option('value', peopleIncrease[1].value.toString());
- $("#textBox3").dxTextBox("instance").option('value', peopleIncrease[2].value.toString());
- $("#textBox4").dxTextBox("instance").option('value', peopleIncrease[3].value.toString());
- $("#textBox5").dxTextBox("instance").option('value', peopleIncrease[4].value.toString());
- $("#textBox6").dxTextBox("instance").option('value', peopleIncrease[5].value.toString());
- $("#textBox7").dxTextBox("instance").option('value', peopleIncrease[6].value.toString());
- $("#textBox8").dxTextBox("instance").option('value', peopleIncrease[7].value.toString());
- $("#textBox9").dxTextBox("instance").option('value', peopleIncrease[8].value.toString());
- $("#textBox10").dxTextBox("instance").option('value', peopleIncrease[9].value.toString());
- $("#textBox11").dxTextBox("instance").option('value', peopleIncrease[10].value.toString());
- $("#textBox12").dxTextBox("instance").option('value', peopleIncrease[11].value.toString());
- monthInputArray[0].value = parseFloat(peopleIncrease[0].value.toString());
- monthInputArray[1].value = parseFloat(peopleIncrease[1].value.toString());
- monthInputArray[2].value = parseFloat(peopleIncrease[2].value.toString());
- monthInputArray[3].value = parseFloat(peopleIncrease[3].value.toString());
- monthInputArray[4].value = parseFloat(peopleIncrease[4].value.toString());
- monthInputArray[5].value = parseFloat(peopleIncrease[5].value.toString());
- monthInputArray[6].value = parseFloat(peopleIncrease[6].value.toString());
- monthInputArray[7].value = parseFloat(peopleIncrease[7].value.toString());
- monthInputArray[8].value = parseFloat(peopleIncrease[8].value.toString());
- monthInputArray[9].value = parseFloat(peopleIncrease[9].value.toString());
- monthInputArray[10].value = parseFloat(peopleIncrease[10].value.toString());
- monthInputArray[11].value = parseFloat(peopleIncrease[11].value.toString());
- $("#label1").text("1월(명)");
- $("#label2").text("2월(명)");
- $("#label3").text("3월(명)");
- $("#label4").text("4월(명)");
- $("#label5").text("5월(명)");
- $("#label6").text("6월(명)");
- $("#label7").text("7월(명)");
- $("#label8").text("8월(명)");
- $("#label9").text("9월(명)");
- $("#label10").text("10월(명)");
- $("#label11").text("11월(명)");
- $("#label12").text("12월(명)");
- } else if (selectFactor == 1) {
- $("#textBox1").dxTextBox("instance").option('value', rentalRate[0].value.toString());
- $("#textBox2").dxTextBox("instance").option('value', rentalRate[1].value.toString());
- $("#textBox3").dxTextBox("instance").option('value', rentalRate[2].value.toString());
- $("#textBox4").dxTextBox("instance").option('value', rentalRate[3].value.toString());
- $("#textBox5").dxTextBox("instance").option('value', rentalRate[4].value.toString());
- $("#textBox6").dxTextBox("instance").option('value', rentalRate[5].value.toString());
- $("#textBox7").dxTextBox("instance").option('value', rentalRate[6].value.toString());
- $("#textBox8").dxTextBox("instance").option('value', rentalRate[7].value.toString());
- $("#textBox9").dxTextBox("instance").option('value', rentalRate[8].value.toString());
- $("#textBox10").dxTextBox("instance").option('value', rentalRate[9].value.toString());
- $("#textBox11").dxTextBox("instance").option('value', rentalRate[10].value.toString());
- $("#textBox12").dxTextBox("instance").option('value', rentalRate[11].value.toString());
- monthInputArray[0].value = parseFloat(rentalRate[0].value.toString());
- monthInputArray[1].value = parseFloat(rentalRate[1].value.toString());
- monthInputArray[2].value = parseFloat(rentalRate[2].value.toString());
- monthInputArray[3].value = parseFloat(rentalRate[3].value.toString());
- monthInputArray[4].value = parseFloat(rentalRate[4].value.toString());
- monthInputArray[5].value = parseFloat(rentalRate[5].value.toString());
- monthInputArray[6].value = parseFloat(rentalRate[6].value.toString());
- monthInputArray[7].value = parseFloat(rentalRate[7].value.toString());
- monthInputArray[8].value = parseFloat(rentalRate[8].value.toString());
- monthInputArray[9].value = parseFloat(rentalRate[9].value.toString());
- monthInputArray[10].value = parseFloat(rentalRate[10].value.toString());
- monthInputArray[11].value = parseFloat(rentalRate[11].value.toString());
- $("#label1").text("1월(%)");
- $("#label2").text("2월(%)");
- $("#label3").text("3월(%)");
- $("#label4").text("4월(%)");
- $("#label5").text("5월(%)");
- $("#label6").text("6월(%)");
- $("#label7").text("7월(%)");
- $("#label8").text("8월(%)");
- $("#label9").text("9월(%)");
- $("#label10").text("10월(%)");
- $("#label11").text("11월(%)");
- $("#label12").text("12월(%)");
- } else {
- utils.toast.show("소비 요인이 선택되지 않았습니다.");
- }
- },
- onHidden: function () {
- }
- };
- // 2019.04.16 : 그리드 도표 작업 : 팝업창 추가 ~~~
- // 주석이 너무 없음. 나중에 변경 작업을 진행하는 누군가가 시간 소비를 하지 않기 위해...남김
- // 시간 포맷은 그래프에 귀속해야 되므로 포맷은 변경하지 않는 것이 유리함
- // 전기,가스,수도 와 같이 선택적으로 변경해야 된다면 아래와 같이 캡션은 고정하지 말것
-
- viewModel.EnergyUsageFactorOptions = {
- dataSource: dataArrayresult,
- paging: { pageSize: 17 },
- columns: [
- { dataField: 'month', caption: "월", width: '20%', alignment: 'center', },// dataType: 'date', format: 'yyyy-MM-dd HH:mm' },
- { dataField: 'use', caption: "에너지 사용량(kWh/월)", width: '46%', alignment: 'center', format: 'fixedPoint', precision: 2 },
- { dataField: 'factor', width: '33%', alignment: 'center', format: 'fixedPoint', precision: 2 }
- ],
- // 엑셀 출력
- "export": {
- enabled: true,
- fileName: '에너지 소비요인'
- }
- };
- viewModel.EnergyUsageFactorOptions1 = {
- dataSource: dataArrayresult1,
- paging: { pageSize: 17 },
- columns: [
- { dataField: 'month', caption: "월", width: '20%', alignment: 'center', },// dataType: 'date', format: 'yyyy-MM-dd HH:mm' },
- { dataField: 'use', caption: "에너지 사용량(kWh/월)", width: '46%', alignment: 'center', format: 'fixedPoint', precision: 2 },
- { dataField: 'factor', width: '33%', alignment: 'center', format: 'fixedPoint', precision: 2 }
- ],
- // 엑셀 출력
- "export": {
- enabled: true,
- fileName: '에너지 소비요인'
- }
- };
- viewModel.EnergyUsageFactorOptions2 = {
- dataSource: dataArrayresult2,
- paging: { pageSize: 17 },
- columns: [
- { dataField: 'month', caption: "월", width: '15%', alignment: 'center', },// dataType: 'date', format: 'yyyy-MM-dd HH:mm' },
- { dataField: 'use', caption: "에너지 사용량(kWh/월)", width: '35%', alignment: 'center', format: 'fixedPoint', precision: 2 },
- { dataField: 'cdd', width: '25%', alignment: 'center', format: 'fixedPoint', precision: 2 },
- { dataField: 'hdd', width: '25%', alignment: 'center', format: 'fixedPoint', precision: 2 }
- ],
- // 엑셀 출력
- "export": {
- enabled: true,
- fileName: '에너지 소비요인 분석'
- }
- };
- // ~~~ 2019.04.16 : 그리드 도표 작업 : 팝업창 추가
-
- return viewModel;
- };
|