ebbf482edc1119db20bdfe9182b94ded51bf5938.svn-base 124 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578
  1. BemsWebApplication.PlanEstablishment = function (params, viewInfo) {
  2. "use strict";
  3. //로딩 팝업 visible초기화 false
  4. var visiblePopup = ko.observable(false);
  5. //에너지원 선택 초기화 통합
  6. var energySelectButton = "all";
  7. //캘린더 선택 초기화 월
  8. var yearSelectButton = "month";
  9. var m3calValue;
  10. var temppowerFacilityCode, tempgasFacilityCode, tempwaterFacilityCode;
  11. var SITEID = BWA.UserInfo.SiteId();
  12. var FuelTypeIdtemp;
  13. var endpointSelector = "";
  14. if (BemsWebApplication.config.mode == "production") {
  15. endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.production;
  16. } else {
  17. endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.local;
  18. }
  19. //각 에너지원 메인 차트 데이터 소스 Array
  20. //월,목표값,실적값으로 구성, 캘런더 년기준 선택시 월->년단위로 변경
  21. var dataSource = [{
  22. dateTime: "1", //월
  23. Prediction: 0, //목표값
  24. Perform: 0, //실적값
  25. Goal: 0
  26. }, {
  27. dateTime: "2",
  28. Prediction: 0,
  29. Perform: 0
  30. , Goal: 0
  31. }, {
  32. dateTime: "3",
  33. Prediction: 0,
  34. Perform: 0
  35. , Goal: 0
  36. }, {
  37. dateTime: "4",
  38. Prediction: 0,
  39. Perform: 0
  40. , Goal: 0
  41. }, {
  42. dateTime: "5",
  43. Prediction: 0,
  44. Perform: 0
  45. , Goal: 0
  46. }, {
  47. dateTime: "6",
  48. Prediction: 0,
  49. Perform: 0
  50. , Goal: 0
  51. }, {
  52. dateTime: "7",
  53. Prediction: 0,
  54. Perform: 0
  55. , Goal: 0
  56. }, {
  57. dateTime: "8",
  58. Prediction: 0,
  59. Perform: 0
  60. , Goal: 0
  61. }, {
  62. dateTime: "9",
  63. Prediction: 0,
  64. Perform: 0
  65. , Goal: 0
  66. }, {
  67. dateTime: "10",
  68. Prediction: 0,
  69. Perform: 0
  70. , Goal: 0
  71. }, {
  72. dateTime: "11",
  73. Prediction: 0,
  74. Perform: 0
  75. , Goal: 0
  76. }, {
  77. dateTime: "12",
  78. Prediction: 0,
  79. Perform: 0
  80. , Goal: 0
  81. }, {
  82. dateTime: "13",
  83. Prediction: 0,
  84. Perform: 0
  85. , Goal: 0
  86. }, {
  87. dateTime: "14",
  88. Prediction: 0,
  89. Perform: 0
  90. , Goal: 0
  91. }, {
  92. dateTime: "15",
  93. Prediction: 0,
  94. Perform: 0
  95. , Goal: 0
  96. }, {
  97. dateTime: "16",
  98. Prediction: 0,
  99. Perform: 0
  100. , Goal: 0
  101. }, {
  102. dateTime: "17",
  103. Prediction: 0,
  104. Perform: 0
  105. , Goal: 0
  106. }, {
  107. dateTime: "18",
  108. Prediction: 0,
  109. Perform: 0
  110. , Goal: 0
  111. }, {
  112. dateTime: "19",
  113. Prediction: 0,
  114. Perform: 0
  115. , Goal: 0
  116. }, {
  117. dateTime: "20",
  118. Prediction: 0,
  119. Perform: 0
  120. , Goal: 0
  121. }, {
  122. dateTime: "21",
  123. Prediction: 0,
  124. Perform: 0
  125. , Goal: 0
  126. }, {
  127. dateTime: "22",
  128. Prediction: 0,
  129. Perform: 0
  130. , Goal: 0
  131. }, {
  132. dateTime: "23",
  133. Prediction: 0,
  134. Perform: 0
  135. , Goal: 0
  136. }, {
  137. dateTime: "24",
  138. Prediction: 0,
  139. Perform: 0
  140. , Goal: 0
  141. }, {
  142. dateTime: "25",
  143. Prediction: 0,
  144. Perform: 0
  145. , Goal: 0
  146. }, {
  147. dateTime: "26",
  148. Prediction: 0,
  149. Perform: 0
  150. , Goal: 0
  151. }, {
  152. dateTime: "27",
  153. Prediction: 0,
  154. Perform: 0
  155. , Goal: 0
  156. }, {
  157. dateTime: "28",
  158. Prediction: 0,
  159. Perform: 0
  160. , Goal: 0
  161. }, {
  162. dateTime: "29",
  163. Prediction: 0,
  164. Perform: 0
  165. , Goal: 0
  166. }, {
  167. dateTime: "30",
  168. Prediction: 0,
  169. Perform: 0,
  170. Goal: 0
  171. }, {
  172. dateTime: "31",
  173. Prediction: 0,
  174. Perform: 0
  175. , Goal: 0
  176. }];
  177. //각 에너지원 메인 차트 데이터 소스 Array
  178. var allDataSource = [{
  179. dateTime: "1", //날짜
  180. PredictionPower: 0, //전력목표값
  181. PredictionGas: 0, //가스목표값
  182. PerformPower: 0, //전력실적값
  183. PerformGas: 0 //가스실적값
  184. }, {
  185. dateTime: "2",
  186. PredictionPower: 0,
  187. PredictionGas: 0,
  188. PerformPower: 0,
  189. PerformGas: 0
  190. }, {
  191. dateTime: "3",
  192. PredictionPower: 0,
  193. PredictionGas: 0,
  194. PerformPower: 0,
  195. PerformGas: 0
  196. }, {
  197. dateTime: "4",
  198. PredictionPower: 0,
  199. PredictionGas: 0,
  200. PerformPower: 0,
  201. PerformGas: 0
  202. }, {
  203. dateTime: "5",
  204. PredictionPower: 0,
  205. PredictionGas: 0,
  206. PerformPower: 0,
  207. PerformGas: 0
  208. }, {
  209. dateTime: "6",
  210. PredictionPower: 0,
  211. PredictionGas: 0,
  212. PerformPower: 0,
  213. PerformGas: 0
  214. }, {
  215. dateTime: "7",
  216. PredictionPower: 0,
  217. PredictionGas: 0,
  218. PerformPower: 0,
  219. PerformGas: 0
  220. }, {
  221. dateTime: "8",
  222. PredictionPower: 0,
  223. PredictionGas: 0,
  224. PerformPower: 0,
  225. PerformGas: 0
  226. }, {
  227. dateTime: "9",
  228. PredictionPower: 0,
  229. PredictionGas: 0,
  230. PerformPower: 0,
  231. PerformGas: 0
  232. }, {
  233. dateTime: "10",
  234. PredictionPower: 0,
  235. PredictionGas: 0,
  236. PerformPower: 0,
  237. PerformGas: 0
  238. }, {
  239. dateTime: "11",
  240. PredictionPower: 0,
  241. PredictionGas: 0,
  242. PerformPower: 0,
  243. PerformGas: 0
  244. }, {
  245. dateTime: "12",
  246. PredictionPower: 0,
  247. PredictionGas: 0,
  248. PerformPower: 0,
  249. PerformGas: 0
  250. }, {
  251. dateTime: "13",
  252. PredictionPower: 0,
  253. PredictionGas: 0,
  254. PerformPower: 0,
  255. PerformGas: 0
  256. }, {
  257. dateTime: "14",
  258. PredictionPower: 0,
  259. PredictionGas: 0,
  260. PerformPower: 0,
  261. PerformGas: 0
  262. }, {
  263. dateTime: "15",
  264. PredictionPower: 0,
  265. PredictionGas: 0,
  266. PerformPower: 0,
  267. PerformGas: 0
  268. }, {
  269. dateTime: "16",
  270. PredictionPower: 0,
  271. PredictionGas: 0,
  272. PerformPower: 0,
  273. PerformGas: 0
  274. }, {
  275. dateTime: "17",
  276. PredictionPower: 0,
  277. PredictionGas: 0,
  278. PerformPower: 0,
  279. PerformGas: 0
  280. }, {
  281. dateTime: "18",
  282. PredictionPower: 0,
  283. PredictionGas: 0,
  284. PerformPower: 0,
  285. PerformGas: 0
  286. }, {
  287. dateTime: "19",
  288. PredictionPower: 0,
  289. PredictionGas: 0,
  290. PerformPower: 0,
  291. PerformGas: 0
  292. }, {
  293. dateTime: "20",
  294. PredictionPower: 0,
  295. PredictionGas: 0,
  296. PerformPower: 0,
  297. PerformGas: 0
  298. }, {
  299. dateTime: "21",
  300. PredictionPower: 0,
  301. PredictionGas: 0,
  302. PerformPower: 0,
  303. PerformGas: 0
  304. }, {
  305. dateTime: "22",
  306. PredictionPower: 0,
  307. PredictionGas: 0,
  308. PerformPower: 0,
  309. PerformGas: 0
  310. }, {
  311. dateTime: "23",
  312. PredictionPower: 0,
  313. PredictionGas: 0,
  314. PerformPower: 0,
  315. PerformGas: 0
  316. }, {
  317. dateTime: "24",
  318. PredictionPower: 0,
  319. PredictionGas: 0,
  320. PerformPower: 0,
  321. PerformGas: 0
  322. }, {
  323. dateTime: "25",
  324. PredictionPower: 0,
  325. PredictionGas: 0,
  326. PerformPower: 0,
  327. PerformGas: 0
  328. }, {
  329. dateTime: "26",
  330. PredictionPower: 0,
  331. PredictionGas: 0,
  332. PerformPower: 0,
  333. PerformGas: 0
  334. }, {
  335. dateTime: "27",
  336. PredictionPower: 0,
  337. PredictionGas: 0,
  338. PerformPower: 0,
  339. PerformGas: 0
  340. }, {
  341. dateTime: "28",
  342. PredictionPower: 0,
  343. PredictionGas: 0,
  344. PerformPower: 0,
  345. PerformGas: 0
  346. }, {
  347. dateTime: "29",
  348. PredictionPower: 0,
  349. PredictionGas: 0,
  350. PerformPower: 0,
  351. PerformGas: 0
  352. }, {
  353. dateTime: "30",
  354. PredictionPower: 0,
  355. PredictionGas: 0,
  356. PerformPower: 0,
  357. PerformGas: 0
  358. }, {
  359. dateTime: "31",
  360. PredictionPower: 0,
  361. PredictionGas: 0,
  362. PerformPower: 0,
  363. PerformGas: 0
  364. }];
  365. var goalDataSource = {
  366. };
  367. function handleViewShowing() {
  368. var getCmFacilitypowerDataSource = new DevExpress.data.DataSource({
  369. store: {
  370. type: "odata",
  371. url: endpointSelector + "/CmFacility"
  372. },
  373. requireTotalCount: true,
  374. pageSize: 3
  375. });
  376. getCmFacilitypowerDataSource.filter([
  377. ["SiteId", "=", SITEID],
  378. "and",
  379. ["FacilityTypeId", "=", $Code.FacilityType.ELECTRICITY]
  380. ]);
  381. getCmFacilitypowerDataSource.load()
  382. .done(function (Result) {
  383. if (Result.length != 0) {
  384. temppowerFacilityCode = Result[0].FacilityCode;
  385. }
  386. else {
  387. utils.toast.show("[CmFacility] 전력 데이터가 없습니다.");
  388. }
  389. })
  390. .fail(function (error) {
  391. utils.toast.show("[CmFacility] 전력 데이터를 불러오는데 실패 하였습니다.");
  392. });
  393. var getCmFacilitygasDataSource = new DevExpress.data.DataSource({
  394. store: {
  395. type: "odata",
  396. url: endpointSelector + "/CmFacility"
  397. },
  398. requireTotalCount: true,
  399. pageSize: 3
  400. });
  401. getCmFacilitygasDataSource.filter([
  402. ["SiteId", "=", SITEID],
  403. "and",
  404. ["FacilityTypeId", "=", $Code.FacilityType.GAS]
  405. ]);
  406. getCmFacilitygasDataSource.load()
  407. .done(function (Result) {
  408. if (Result.length != 0) {
  409. tempgasFacilityCode = Result[0].FacilityCode;
  410. }
  411. else {
  412. utils.toast.show("[CmFacility] 가스 데이터가 없습니다.");
  413. }
  414. })
  415. .fail(function (error) {
  416. utils.toast.show("[CmFacility] 가스 데이터를 불러오는데 실패 하였습니다.");
  417. });
  418. var getCmFacilitywaterDataSource = new DevExpress.data.DataSource({
  419. store: {
  420. type: "odata",
  421. url: endpointSelector + "/CmFacility"
  422. },
  423. requireTotalCount: true,
  424. pageSize: 3
  425. });
  426. getCmFacilitywaterDataSource.filter([
  427. ["SiteId", "=", SITEID],
  428. "and",
  429. ["FacilityTypeId", "=", $Code.FacilityType.WATER]
  430. ]);
  431. getCmFacilitywaterDataSource.load()
  432. .done(function (Result) {
  433. if (Result.length != 0) {
  434. tempwaterFacilityCode = Result[0].FacilityCode;
  435. }
  436. else {
  437. utils.toast.show("[CmFacility] 수도 데이터가 없습니다.");
  438. }
  439. })
  440. .fail(function (error) {
  441. utils.toast.show("[CmFacility] 수도 데이터를 불러오는데 실패 하였습니다.");
  442. });
  443. var getTOEDataSource = new DevExpress.data.DataSource({
  444. store: {
  445. type: "odata",
  446. url: endpointSelector + "/BemsFactorToe"
  447. },
  448. requireTotalCount: true,
  449. pageSize: 3
  450. });
  451. getTOEDataSource.load()
  452. .done(function (Result) {
  453. var powertoe, gastoe;
  454. if (Result.length != 0) {
  455. for (var i = 0; i < Result.length; i++) {
  456. if (Result[i].FuelTypeId == 1) {
  457. powertoe = Result[i].TotalFactor;
  458. }
  459. if (Result[i].FuelTypeId == 2) {
  460. gastoe = Result[i].TotalFactor;
  461. }
  462. }
  463. if (powertoe != null && gastoe != null)
  464. m3calValue = gastoe / powertoe;
  465. }
  466. else {
  467. utils.toast.show("[BemsFactorToe] 데이터가 없습니다.");
  468. }
  469. })
  470. .fail(function (error) {
  471. utils.toast.show("[BemsFactorToe] 데이터를 불러오는데 실패 하였습니다.");
  472. });
  473. }
  474. //재귀합산을 위한 전력 메타데이터카운트
  475. var powerMetaResultCnt = 0;
  476. //재귀합산을 위한 가스 메타데이터카운트
  477. var gasMetaResultCnt = 0;
  478. var powerMetaResultArray;
  479. var gasMetaResultArray;
  480. function getAllData2(SiteId) {
  481. var sumPrediction = 0;
  482. var sumPerform = 0;
  483. var compareValue = 0;
  484. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  485. var endDay = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  486. $("#sideBarChart").dxChart("instance").option('commonSeriesSettings').type = "stackedBar";
  487. var opt = [
  488. { valueField: "PredictionPower", name: "목표 전력", stack: "prediction", color: '#007994' },
  489. { valueField: "PredictionGas", name: "목표 가스", stack: "prediction", color: '#03C700' },
  490. { valueField: "PerformPower", name: "전력 사용량", stack: "perform", color: '#5F8B95' },
  491. { valueField: "PerformGas", name: "가스 사용량", stack: "perform", color: '#7CC77B' },
  492. ];
  493. $("#sideBarChart").dxChart("instance").option('series', opt);
  494. for (var i = 0; i < allDataSource.length; i++) {
  495. allDataSource[i].dateTime = i + 1;
  496. allDataSource[i].PredictionPower = 0;
  497. allDataSource[i].PredictionGas = 0;
  498. allDataSource[i].PerformPower = 0;
  499. allDataSource[i].PerformGas = 0;
  500. }
  501. $("#sideBarChart").dxChart("instance").option('dataSource', allDataSource);
  502. var powerMetaDataSource = new DevExpress.data.DataSource({
  503. store: {
  504. type: "odata",
  505. url: endpointSelector + "/BemsFormulaParameter"
  506. },
  507. map: function (itemData) {
  508. return {
  509. SiteId: itemData.SiteId,
  510. FacilityTypeId: itemData.FacilityTypeId,
  511. FormulaId: itemData.FormulaId,
  512. ParameterFacilityCode: itemData.ParameterFacilityCode,
  513. ParameterPropertyId: itemData.ParameterPropertyId
  514. }
  515. },
  516. requireTotalCount: true,
  517. pageSize: 20
  518. });
  519. powerMetaDataSource.filter([
  520. ["SiteId", "=", SiteId],
  521. "and",
  522. ["FacilityCode", "=", temppowerFacilityCode], //전력 시설ID
  523. "and",
  524. ["FormulaId", "=", 1]
  525. ]);
  526. powerMetaDataSource.sort({ getter: "ParameterPropertyId", asc: true });
  527. powerMetaDataSource.load()
  528. .done(function (powerMetaResult) {
  529. powerMetaResultArray = new Array(powerMetaResult.length);
  530. for (var t in powerMetaResult) {
  531. powerMetaResultArray[t] = new Array(5);
  532. }
  533. for (var i in powerMetaResult) {
  534. powerMetaResultArray[i][0] = powerMetaResult[i].SiteId;
  535. powerMetaResultArray[i][1] = powerMetaResult[i].FacilityTypeId;
  536. powerMetaResultArray[i][2] = powerMetaResult[i].FormulaId;
  537. powerMetaResultArray[i][3] = powerMetaResult[i].ParameterFacilityCode;
  538. powerMetaResultArray[i][4] = powerMetaResult[i].ParameterPropertyId;
  539. }
  540. getAllPredictionData(SiteId, 1, powerMetaResultArray[powerMetaResultCnt], powerMetaResultArray.length);
  541. powerMetaResultCnt = 0;
  542. })
  543. .fail(function (error) {
  544. utils.toast.show("데이터를 불러오는데 실패 하였습니다.");
  545. $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
  546. });
  547. }
  548. function getAllPredictionData(SiteId, FuelTypeId, metaResultArrayElement, recursiveCnt) {
  549. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  550. var endDay = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  551. var predictionDataSource = new DevExpress.data.DataSource({
  552. store: {
  553. type: "odata",
  554. url: endpointSelector + "/BemsEnergyDaily"
  555. },
  556. map: function (itemData) {
  557. return {
  558. dateTime: itemData.CreatedDate,
  559. Prediction: itemData.Goal,
  560. }
  561. },
  562. requireTotalCount: true,
  563. pageSize: 366
  564. });
  565. if (yearSelectButton == "year") {
  566. predictionDataSource.filter([
  567. ["SiteId", "=", SiteId],
  568. "and",
  569. ["FuelTypeId", "=", FuelTypeId],
  570. "and",
  571. ["CreatedDate", ">=", new Date(tmpDate.getFullYear(), 0, 1)],
  572. "and",
  573. ["CreatedDate", "<", new Date(tmpDate.getFullYear(), 12, 31)]
  574. ]);
  575. } else if (yearSelectButton == "month") {
  576. predictionDataSource.filter([
  577. ["SiteId", "=", SiteId],
  578. "and",
  579. ["FuelTypeId", "=", FuelTypeId],
  580. "and",
  581. ["CreatedDate", ">=", new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 1)],//tmpDate.getMonth()
  582. "and",
  583. ["CreatedDate", "<", new Date(tmpDate.getFullYear(), tmpDate.getMonth() + 1, 1)] //new Date(tmpDate.getFullYear(), tmpDate.getMonth(), endDay)]
  584. ]);
  585. } else {
  586. utils.toast.show("년월 선택이 되지 않았습니다.");
  587. }
  588. predictionDataSource.sort({ getter: "CreatedDate", asc: true });
  589. predictionDataSource.load()
  590. .done(function (predictionResult) {
  591. for (var i in predictionResult) {
  592. if (yearSelectButton == "year") {
  593. allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].dateTime = (predictionResult[i].dateTime.getMonth() + 1).toString();
  594. if (energySelectButton == "gaskwh") {//가스m3변환
  595. if (FuelTypeId == 1) {
  596. allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionPower = allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionPower + predictionResult[i].Prediction;//1kWh당 10430kcal
  597. } else if (FuelTypeId == 2) {
  598. allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionGas = allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionGas + predictionResult[i].Prediction;//1kWh당 10430kcal
  599. } else {
  600. utils.toast.show("에너지원 선택이 없습니다.");
  601. }
  602. sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  603. if (tmpDate.getFullYear() == new Date().getFullYear()) {
  604. if (YearToDay() - 1 >= i) {
  605. sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  606. }
  607. } else {
  608. sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  609. }
  610. } else {
  611. if (FuelTypeId == 1) {
  612. allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionPower = allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionPower + predictionResult[i].Prediction;
  613. } else if (FuelTypeId == 2) {
  614. allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionGas = allDataSource[(predictionResult[i].dateTime.getMonth()).toString()].PredictionGas + predictionResult[i].Prediction;
  615. } else {
  616. utils.toast.show("에너지원 선택이 없습니다.");
  617. }
  618. sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  619. if (tmpDate.getFullYear() == new Date().getFullYear()) {
  620. if (YearToDay() - 1 >= i) {
  621. sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  622. }
  623. } else {
  624. sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  625. }
  626. }
  627. } else if (yearSelectButton == "month") {
  628. allDataSource[i].dateTime = (parseInt(i) + 1).toString();
  629. if (energySelectButton == "gaskwh") {//가스m3변환
  630. if (FuelTypeId == 1) {
  631. allDataSource[i].PredictionPower = predictionResult[i].Prediction;
  632. } else if (FuelTypeId == 2) {
  633. allDataSource[i].PredictionGas = predictionResult[i].Prediction;
  634. } else {
  635. utils.toast.show("에너지원 선택이 없습니다.");
  636. }
  637. sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  638. if (tmpDate.getFullYear() == new Date().getFullYear() && tmpDate.getMonth() == new Date().getMonth()) {
  639. if ((new Date().getDate() - 1) >= i) {
  640. sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  641. }
  642. } else {
  643. sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  644. }
  645. } else {
  646. if (FuelTypeId == 1) {
  647. allDataSource[i].PredictionPower = predictionResult[i].Prediction;
  648. } else if (FuelTypeId == 2) {
  649. allDataSource[i].PredictionGas = predictionResult[i].Prediction;
  650. } else {
  651. utils.toast.show("에너지원 선택이 없습니다.");
  652. }
  653. sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  654. if (tmpDate.getFullYear() == new Date().getFullYear() && tmpDate.getMonth() == new Date().getMonth()) {
  655. if ((new Date().getDate() - 1) >= i) {
  656. sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  657. }
  658. }
  659. else {
  660. sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  661. }
  662. }
  663. }
  664. }
  665. GetAllPerformData(metaResultArrayElement, recursiveCnt, FuelTypeId);
  666. })
  667. .fail(function (error) {
  668. utils.toast.show("데이터를 불러오는데 실패 하였습니다.");
  669. $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
  670. });
  671. }
  672. function GetAllPerformData(metaResultArrayElement, recursiveCnt, FuelTypeId) {
  673. if (metaResultArrayElement == null) {
  674. $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
  675. utils.toast.show("데이터가 존재하지 않습니다..");
  676. return;
  677. }
  678. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  679. var endDay = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  680. var getPerformDataSource = new DevExpress.data.DataSource({
  681. store: {
  682. type: "odata",
  683. url: endpointSelector + "/BemsMonitoringPointHistoryDaily"
  684. },
  685. map: function (itemData) {
  686. return {
  687. dateTime: itemData.CreatedDateTime,
  688. Perform: itemData.DailyValue
  689. }
  690. },
  691. requireTotalCount: true,
  692. pageSize: 366
  693. });
  694. if (yearSelectButton == "year") {
  695. getPerformDataSource.filter([
  696. ["SiteId", "=", metaResultArrayElement[0]],
  697. "and",
  698. ["FacilityCode", "=", metaResultArrayElement[3]],
  699. "and",
  700. ["PropertyId", "=", metaResultArrayElement[4]],
  701. "and",
  702. ["CreatedDateTime", ">=", new Date(tmpDate.getFullYear(), 0, 1)],
  703. "and",
  704. ["CreatedDateTime", "<", new Date(tmpDate.getFullYear(), 12, 31)]
  705. ]);
  706. } else if (yearSelectButton == "month") {
  707. getPerformDataSource.filter([
  708. ["SiteId", "=", metaResultArrayElement[0]],
  709. "and",
  710. ["FacilityCode", "=", metaResultArrayElement[3]],
  711. "and",
  712. ["PropertyId", "=", metaResultArrayElement[4]],
  713. "and",
  714. ["CreatedDateTime", ">=", new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 1)],// tmpDate.getMonth()
  715. "and",
  716. ["CreatedDateTime", "<", new Date(tmpDate.getFullYear(), tmpDate.getMonth() + 1, 1)]
  717. ]);
  718. } else {
  719. utils.toast.show("년/월 선택이 되지 않았습니다.");
  720. }
  721. getPerformDataSource.sort({ getter: "CreatedDateTime", asc: true });
  722. getPerformDataSource.load()
  723. .done(function (result) {
  724. for (var i in result) {
  725. if (yearSelectButton == "year") {
  726. if (energySelectButton == "gaskwh" || energySelectButton == "all") {//가스m3변환
  727. if (FuelTypeId == 1) {
  728. allDataSource[(result[i].dateTime.getMonth()).toString()].PerformPower = allDataSource[(result[i].dateTime.getMonth()).toString()].PerformPower + result[i].Perform;
  729. } else if (FuelTypeId == 2) {
  730. allDataSource[(result[i].dateTime.getMonth()).toString()].PerformGas = allDataSource[(result[i].dateTime.getMonth()).toString()].PerformGas + result[i].Perform * m3calValue;
  731. } else {
  732. utils.toast.show("에너지원 선택이 없습니다.");
  733. }
  734. if (FuelTypeId == 2) {
  735. totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString()) * m3calValue;
  736. }
  737. else {
  738. totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
  739. }
  740. } else {
  741. if (FuelTypeId == 1) {
  742. allDataSource[(result[i].dateTime.getMonth()).toString()].PerformPower = allDataSource[(result[i].dateTime.getMonth()).toString()].PerformPower + result[i].Perform;
  743. } else if (FuelTypeId == 2) {
  744. allDataSource[(result[i].dateTime.getMonth()).toString()].PerformGas = allDataSource[(result[i].dateTime.getMonth()).toString()].PerformGas + result[i].Perform;
  745. } else {
  746. utils.toast.show("에너지원 선택이 없습니다.");
  747. }
  748. totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
  749. }
  750. performLength++;
  751. } else if (yearSelectButton == "month") {
  752. var GetDate = result[i].dateTime.getDate() - 1;
  753. //목표데이터와 실측데이터 병합
  754. if (energySelectButton == "gaskwh" || energySelectButton == "all") {//가스m3변환
  755. if (FuelTypeId == 1) {
  756. allDataSource[GetDate].PerformPower = allDataSource[GetDate].PerformPower + result[i].Perform; //kgpark
  757. } else if (FuelTypeId == 2) {
  758. allDataSource[GetDate].PerformGas = allDataSource[GetDate].PerformGas + result[i].Perform * m3calValue;
  759. } else {
  760. utils.toast.show("에너지원 선택이 없습니다.");
  761. }
  762. if (FuelTypeId == 2) {
  763. totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString()) * m3calValue;
  764. }
  765. else {
  766. totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
  767. }
  768. } else {
  769. if (FuelTypeId == 1) {
  770. allDataSource[GetDate].PerformPower = allDataSource[GetDate].PerformPower + result[i].Perform;
  771. } else if (FuelTypeId == 2) {
  772. allDataSource[GetDate].PerformGas = allDataSource[GetDate].PerformGas + result[i].Perform;
  773. } else {
  774. utils.toast.show("에너지원 선택이 없습니다.");
  775. }
  776. totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
  777. }
  778. performLength++;
  779. } else {
  780. utils.toast.show("년/월 선택이 되지 않았습니다.");
  781. }
  782. }
  783. recursiveCnt--;
  784. if (recursiveCnt >= 1) {
  785. if (FuelTypeId == 1) {
  786. powerMetaResultCnt++;
  787. GetAllPerformData(powerMetaResultArray[powerMetaResultCnt], recursiveCnt, FuelTypeId);
  788. } else if (FuelTypeId == 2) {
  789. gasMetaResultCnt++;
  790. GetAllPerformData(gasMetaResultArray[gasMetaResultCnt], recursiveCnt, FuelTypeId);
  791. }
  792. } else {
  793. if (FuelTypeId == 2) {
  794. SetEnergyResult();
  795. } else if (FuelTypeId == 1) {
  796. //가스 메타 조회
  797. var gasMetaDataSource = new DevExpress.data.DataSource({
  798. store: {
  799. type: "odata",
  800. url: endpointSelector + "/BemsFormulaParameter"
  801. },
  802. map: function (itemData) {
  803. return {
  804. SiteId: itemData.SiteId,
  805. FacilityTypeId: itemData.FacilityTypeId,
  806. FormulaId: itemData.FormulaId,
  807. ParameterFacilityCode: itemData.ParameterFacilityCode,
  808. ParameterPropertyId: itemData.ParameterPropertyId
  809. }
  810. },
  811. requireTotalCount: true,
  812. pageSize: 20
  813. });
  814. gasMetaDataSource.filter([
  815. ["SiteId", "=", metaResultArrayElement[0]],
  816. "and",
  817. ["FacilityCode", "=", tempgasFacilityCode], //가스 시설ID
  818. "and",
  819. ["FormulaId", "=", 1]
  820. ]);
  821. gasMetaDataSource.sort({ getter: "ParameterPropertyId", asc: true });
  822. gasMetaDataSource.load()
  823. .done(function (gasMetaResult) {
  824. gasMetaResultArray = new Array(gasMetaResult.length);
  825. for (var t in gasMetaResult) {
  826. gasMetaResultArray[t] = new Array(5);
  827. }
  828. for (var i in gasMetaResult) {
  829. gasMetaResultArray[i][0] = gasMetaResult[i].SiteId;
  830. gasMetaResultArray[i][1] = gasMetaResult[i].FacilityTypeId;
  831. gasMetaResultArray[i][2] = gasMetaResult[i].FormulaId;
  832. gasMetaResultArray[i][3] = gasMetaResult[i].ParameterFacilityCode;
  833. gasMetaResultArray[i][4] = gasMetaResult[i].ParameterPropertyId;
  834. }
  835. getAllPredictionData(metaResultArrayElement[0], 2, gasMetaResultArray[gasMetaResultCnt], gasMetaResultArray.length);
  836. })
  837. .fail(function (error) {
  838. utils.toast.show("데이터를 불러오는데 실패 하였습니다.");
  839. $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
  840. });
  841. } else {
  842. }
  843. }
  844. return true;
  845. })
  846. .fail(function (error) {
  847. utils.toast.show("사용량 데이터를 불러오는데 실패 하였습니다.");
  848. });
  849. }
  850. function YearToDay() {
  851. var msecPerMinute = 1000 * 60;
  852. var msecPerHour = msecPerMinute * 60;
  853. var msecPerDay = msecPerHour * 24;
  854. var date = new Date();
  855. var dateMsec = date.getTime();
  856. date.setMonth(0);
  857. date.setDate(1);
  858. date.setHours(0, 0, 0, 0);
  859. var interval = dateMsec - date.getTime();
  860. var days = Math.floor(interval / msecPerDay);
  861. return days;
  862. }
  863. var performLength = 0;
  864. var metaResultCnt = 0;
  865. var sumPrediction = 0;
  866. var sumCurPrediction = 0;
  867. var metaResultArray;
  868. function getEnergyData2(SiteId, FacilityTypeId, FormulaId, FuelTypeId) {
  869. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  870. var endDay = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  871. FuelTypeIdtemp = FuelTypeId;
  872. //통합->각 에너지원별 차트 타입 초기화
  873. $("#sideBarChart").dxChart("instance").option('commonSeriesSettings').type = "bar";
  874. var opt;
  875. if (yearSelectButton == "year") {
  876. if (FuelTypeId == 1) {
  877. opt = [
  878. //{ valueField: "Prediction", name: "목표", color: '#72A7B3' },
  879. { valueField: "Prediction", name: "목표", color: '#007994' },
  880. { valueField: "Perform", name: "사용량", color: '#5F8B95' }
  881. ];
  882. } else if (FuelTypeId == 2) {
  883. opt = [
  884. //{ valueField: "Prediction", name: "목표", color: '#90E68E' },
  885. { valueField: "Prediction", name: "목표", color: '#03C700' },
  886. { valueField: "Perform", name: "사용량", color: '#7CC77B' }
  887. ];
  888. } else if (FuelTypeId == 3) {
  889. opt = [
  890. //{ valueField: "Prediction", name: "목표", color: '#FAE0D4' },
  891. { valueField: "Prediction", name: "목표", color: '#FC6D00' },
  892. { valueField: "Perform", name: "사용량", color: '#FDCFAD' }
  893. ];
  894. } else {
  895. utils.toast.show("에너지원이 선택되지 않았습니다.");
  896. }
  897. } else {
  898. if (FuelTypeId == 1) {
  899. opt = [
  900. //{ valueField: "Prediction", name: "목표", color: '#72A7B3' },
  901. { valueField: "Prediction", name: "목표", color: '#007994' },
  902. { valueField: "Perform", name: "사용량", color: '#5F8B95' }
  903. // , { valueField: "Goal", name: "목표치", color: '#FF0000', type: 'line' }
  904. ];
  905. } else if (FuelTypeId == 2) {
  906. opt = [
  907. //{ valueField: "Prediction", name: "목표", color: '#90E68E' },
  908. { valueField: "Prediction", name: "목표", color: '#03C700' },
  909. { valueField: "Perform", name: "사용량", color: '#7CC77B' }
  910. //, { valueField: "Goal", name: "목표치", color: '#FF0000', type: 'line' }
  911. ];
  912. } else if (FuelTypeId == 3) {
  913. opt = [
  914. //{ valueField: "Prediction", name: "목표", color: '#FAE0D4' },
  915. { valueField: "Prediction", name: "목표", color: '#FC6D00' },
  916. { valueField: "Perform", name: "사용량", color: '#FDCFAD' }
  917. // , { valueField: "Goal", name: "목표치", color: '#FF0000', type: 'line' }
  918. ];
  919. } else {
  920. utils.toast.show("에너지원이 선택되지 않았습니다.");
  921. }
  922. }
  923. $("#sideBarChart").dxChart("instance").option('series', opt);
  924. //dataSource 초기화
  925. for (var i = 0; i < dataSource.length; i++) {
  926. dataSource[i].dateTime = i + 1;
  927. dataSource[i].Prediction = 0;
  928. dataSource[i].Perform = 0;
  929. dataSource[i].Goal = 0;
  930. }
  931. $("#sideBarChart").dxChart("instance").option('dataSource', dataSource);
  932. var metaDataSource = new DevExpress.data.DataSource({
  933. store: {
  934. type: "odata",
  935. url: endpointSelector + "/BemsFormulaParameter"
  936. },
  937. map: function (itemData) {
  938. return {
  939. SiteId: itemData.SiteId,
  940. FacilityTypeId: itemData.FacilityTypeId,
  941. FormulaId: itemData.FormulaId,
  942. ParameterFacilityCode: itemData.ParameterFacilityCode,
  943. ParameterPropertyId: itemData.ParameterPropertyId
  944. }
  945. },
  946. requireTotalCount: true,
  947. pageSize: 20
  948. });
  949. metaDataSource.filter([
  950. ["SiteId", "=", SiteId],
  951. "and",
  952. ["FacilityTypeId", "=", FacilityTypeId],
  953. "and",
  954. ["FormulaId", "=", FormulaId]
  955. ]);
  956. metaDataSource.sort({ getter: "ParameterPropertyId", asc: true });
  957. metaDataSource.load()
  958. .done(function (metaResult) {
  959. //목표데이터는 1번 조회, 조회합계 산출
  960. var getPredictionDataSource = new DevExpress.data.DataSource({
  961. store: {
  962. type: "odata",
  963. url: endpointSelector + "/BemsEnergyDaily"
  964. },
  965. map: function (itemData) {
  966. return {
  967. dateTime: itemData.CreatedDate,
  968. Prediction: itemData.Goal,
  969. }
  970. },
  971. requireTotalCount: true,
  972. pageSize: 366
  973. });
  974. if (yearSelectButton == "year") {
  975. getPredictionDataSource.filter([
  976. ["SiteId", "=", SiteId],
  977. "and",
  978. ["FuelTypeId", "=", FuelTypeId],
  979. "and",
  980. ["CreatedDate", ">=", new Date(tmpDate.getFullYear(), 0, 1)],
  981. "and",
  982. ["CreatedDate", "<", new Date(tmpDate.getFullYear(), 12, 31)]
  983. ]);
  984. } else if (yearSelectButton == "month") {
  985. getPredictionDataSource.filter([
  986. ["SiteId", "=", SiteId],
  987. "and",
  988. ["FuelTypeId", "=", FuelTypeId],
  989. "and",
  990. ["CreatedDate", ">=", new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 1)],
  991. "and",
  992. ["CreatedDate", "<", new Date(tmpDate.getFullYear(), tmpDate.getMonth() + 1, 1)]
  993. ]);
  994. } else {
  995. utils.toast.show("년/월 선택이 되지 않았습니다.");
  996. }
  997. getPredictionDataSource.sort({ getter: "CreatedDate", asc: true });
  998. getPredictionDataSource.load()
  999. .done(function (predictionResult) {
  1000. for (var i in predictionResult) {
  1001. //getPredictionDataSource._items[i].dateTime = (parseInt(i) + 1).toString();
  1002. if (yearSelectButton == "year") {
  1003. dataSource[(predictionResult[i].dateTime.getMonth()).toString()].dateTime = (predictionResult[i].dateTime.getMonth() + 1).toString();
  1004. if (energySelectButton == "gasm3") {//가스m3변환
  1005. dataSource[(predictionResult[i].dateTime.getMonth()).toString()].Prediction = dataSource[(predictionResult[i].dateTime.getMonth()).toString()].Prediction + predictionResult[i].Prediction / m3calValue;//1kWh당 10430kcal
  1006. sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString() / m3calValue);
  1007. if (tmpDate.getFullYear() == new Date().getFullYear()) {
  1008. if (YearToDay() - 1 >= i) {
  1009. sumCurPrediction = parseFloat((parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString()) / m3calValue));
  1010. }
  1011. } else {
  1012. sumCurPrediction = parseFloat((parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString()) / m3calValue));
  1013. }
  1014. } else {
  1015. dataSource[(predictionResult[i].dateTime.getMonth()).toString()].Prediction = dataSource[(predictionResult[i].dateTime.getMonth()).toString()].Prediction + predictionResult[i].Prediction;
  1016. sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  1017. if (tmpDate.getFullYear() == new Date().getFullYear()) {
  1018. if (YearToDay() - 1 >= i) {
  1019. sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  1020. }
  1021. } else {
  1022. sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  1023. }
  1024. }
  1025. } else if (yearSelectButton == "month") {
  1026. dataSource[i].dateTime = (parseInt(i) + 1).toString();
  1027. if (energySelectButton == "gasm3") {//가스m3변환
  1028. dataSource[i].Prediction = predictionResult[i].Prediction / m3calValue;
  1029. sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString()) / m3calValue;
  1030. if (tmpDate.getFullYear() == new Date().getFullYear() && tmpDate.getMonth() == new Date().getMonth()) {
  1031. if ((new Date().getDate() - 1) >= i) {
  1032. sumCurPrediction = parseFloat((parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString()) / m3calValue));
  1033. }
  1034. } else {
  1035. sumCurPrediction = parseFloat((parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString()) / m3calValue));
  1036. }
  1037. } else {
  1038. dataSource[i].Prediction = predictionResult[i].Prediction;
  1039. sumPrediction = parseFloat(sumPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  1040. if (tmpDate.getFullYear() == new Date().getFullYear() && tmpDate.getMonth() == new Date().getMonth()) {
  1041. if ((new Date().getDate() - 1) >= i) {
  1042. sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  1043. }
  1044. } else {
  1045. sumCurPrediction = parseFloat(sumCurPrediction.toString()) + parseFloat(predictionResult[i].Prediction.toString());
  1046. }
  1047. }
  1048. } else {
  1049. utils.toast.show("년/월 선택이 되지 않았습니다.");
  1050. }
  1051. }
  1052. metaResultArray = new Array(metaResult.length);
  1053. for (var t in metaResult) {
  1054. metaResultArray[t] = new Array(5);
  1055. }
  1056. for (var i in metaResult) {
  1057. metaResultArray[i][0] = metaResult[i].SiteId;
  1058. metaResultArray[i][1] = metaResult[i].FacilityTypeId;
  1059. metaResultArray[i][2] = metaResult[i].FormulaId;
  1060. metaResultArray[i][3] = metaResult[i].ParameterFacilityCode;
  1061. metaResultArray[i][4] = metaResult[i].ParameterPropertyId;
  1062. }
  1063. GetPerformData(metaResultArray[metaResultCnt], metaResultArray.length);
  1064. if (yearSelectButton == "month")
  1065. sumPerform_function(metaResultArray[metaResultCnt]);
  1066. })
  1067. .fail(function (error) {
  1068. utils.toast.show("목표 데이터를 불러오는데 실패 하였습니다.");
  1069. $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
  1070. });
  1071. })
  1072. .fail(function (error) {
  1073. utils.toast.show("메타 데이터를 불러오는데 실패 하였습니다.");
  1074. $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
  1075. });
  1076. }
  1077. function delay(gap) { /* gap is in millisecs */
  1078. var then, now;
  1079. then = new Date().getTime();
  1080. now = then;
  1081. while ((now - then) < gap) {
  1082. now = new Date().getTime(); // 현재시간을 읽어 함수를 불러들인 시간과의 차를 이용하여 처리
  1083. }
  1084. }
  1085. var totalPerform = 0;
  1086. var sumPerform = 0;
  1087. function SetEnergyResult() {
  1088. var compareValue = 0;
  1089. var today = new Date();
  1090. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  1091. var endDay = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  1092. if (energySelectButton == "all") {
  1093. $("#sideBarChart").dxChart("instance").option('dataSource', allDataSource);//병합데이터 최종 연동
  1094. } else {
  1095. $("#sideBarChart").dxChart("instance").option('dataSource', dataSource);//병합데이터 최종 연동
  1096. }
  1097. $("#textPrediction").html(numberWithCommas(sumPrediction.toFixed(2).toString()));
  1098. $("#textPrediction2").html(numberWithCommas(sumCurPrediction.toFixed(2).toString()));
  1099. $("#textPerform").html(numberWithCommas(totalPerform.toFixed(2).toString()));
  1100. if (yearSelectButton == "year") {
  1101. if (energySelectButton == "all") {
  1102. var length = powerMetaResultArray.length + gasMetaResultArray.length;
  1103. if (tmpDate.getFullYear() != new Date().getFullYear()) {
  1104. $("#textPredictionStandard").html("[1.1 ~ 12.31]");
  1105. $("#textPerformStandard").html("[1.1 ~ 12.31]");
  1106. } else {
  1107. var tempDate = new Date();
  1108. $("#textPredictionStandard").html("[1.1 ~ " + (tempDate.getMonth() + 1) + "." + tempDate.getDate() + "]");
  1109. $("#textPerformStandard").html("[1.1 ~ " + (tempDate.getMonth() + 1) + "." + tempDate.getDate() + "]");
  1110. }
  1111. } else {
  1112. if (tmpDate.getFullYear() != new Date().getFullYear()) {
  1113. $("#textPredictionStandard").html("[1.1 ~ 12.31]");
  1114. $("#textPerformStandard").html("[1.1 ~ 12.31]");
  1115. } else {
  1116. var tempDate = new Date();
  1117. $("#textPredictionStandard").html("[1.1 ~ " + (tempDate.getMonth() + 1) + "." + tempDate.getDate() + "]");
  1118. $("#textPerformStandard").html("[1.1 ~ " + (tempDate.getMonth() + 1) + "." + tempDate.getDate() + "]");
  1119. }
  1120. }
  1121. } else if (yearSelectButton == "month") {
  1122. if (energySelectButton == "all") {
  1123. var length = powerMetaResultArray.length + gasMetaResultArray.length;
  1124. if (tmpDate.getFullYear() == today.getFullYear() && tmpDate.getMonth() == today.getMonth()) {
  1125. $("#textPredictionStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + today.getDate() + "]");
  1126. $("#textPerformStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + today.getDate() + "]");
  1127. }
  1128. else {
  1129. $("#textPredictionStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + endDay + "]");
  1130. $("#textPerformStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + endDay + "]");
  1131. }
  1132. } else {
  1133. if (tmpDate.getFullYear() == today.getFullYear() && tmpDate.getMonth() == today.getMonth()) {
  1134. $("#textPredictionStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + today.getDate() + "]");
  1135. $("#textPerformStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + today.getDate() + "]");
  1136. }
  1137. else {
  1138. $("#textPredictionStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + endDay + "]");
  1139. $("#textPerformStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + endDay + "]");
  1140. }
  1141. }
  1142. } else {
  1143. utils.toast.show("년/월 선택이 되지 않았습니다.");
  1144. }
  1145. if (totalPerform != 0) {
  1146. compareValue = totalPerform / sumCurPrediction;
  1147. compareValue = (compareValue * 100).toFixed(2);
  1148. var resultTmp = compareValue;
  1149. if (!isFinite(resultTmp) || isNaN(resultTmp)) {
  1150. $("#textResult").html("계산수치 부적절");
  1151. } else {
  1152. $("#textResult").html(resultTmp.toString() + "%");
  1153. }
  1154. }
  1155. else {
  1156. compareValue = totalPerform / sumCurPrediction;
  1157. compareValue = (compareValue * 100).toFixed(2);
  1158. var resultTmp = (100 - compareValue).toFixed(2);
  1159. if (!isFinite(resultTmp) || isNaN(resultTmp)) {
  1160. $("#textResult").html("계산수치 부적절");
  1161. } else {
  1162. $("#textResult").html(compareValue.toString() + "%");
  1163. }
  1164. }
  1165. if (yearSelectButton == "year") {
  1166. if (energySelectButton == "all") {
  1167. var length = powerMetaResultArray.length + gasMetaResultArray.length;
  1168. var tempDate = new Date();
  1169. if (tmpDate.getFullYear() == today.getFullYear()) {
  1170. $("#textResultStandard").html("[1.1 ~ " + (tempDate.getMonth() + 1) + "." + tempDate.getDate() + "]");
  1171. }
  1172. else {
  1173. $("#textResultStandard").html("[1.1 ~ 12.31]");
  1174. }
  1175. } else {
  1176. var tempDate = new Date();
  1177. if (tmpDate.getFullYear() == today.getFullYear()) {
  1178. $("#textResultStandard").html("[1.1 ~ " + (tempDate.getMonth() + 1) + "." + tempDate.getDate() + "]");
  1179. }
  1180. else {
  1181. $("#textResultStandard").html("[1.1 ~ 12.31]");
  1182. }
  1183. }
  1184. } else if (yearSelectButton == "month") {
  1185. if (energySelectButton == "all") {
  1186. var length = powerMetaResultArray.length + gasMetaResultArray.length;
  1187. if (tmpDate.getFullYear() == today.getFullYear() && tmpDate.getMonth() == today.getMonth()) {
  1188. $("#textResultStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + today.getDate() + "]");
  1189. }
  1190. else {
  1191. $("#textResultStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + endDay + "]");
  1192. }
  1193. } else {
  1194. if (tmpDate.getFullYear() == today.getFullYear() && tmpDate.getMonth() == today.getMonth()) {
  1195. $("#textResultStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + today.getDate() + "]");
  1196. }
  1197. else {
  1198. $("#textResultStandard").html("[" + (tmpDate.getMonth() + 1) + ".1 ~ " + (tmpDate.getMonth() + 1) + "." + endDay + "]");
  1199. }
  1200. }
  1201. } else {
  1202. utils.toast.show("년/월 선택이 되지 않았습니다.");
  1203. }
  1204. var maxValue = 0;
  1205. if (energySelectButton == "all") {
  1206. for (var i = 0; i < allDataSource.length; i++) {
  1207. if (allDataSource[i].PredictionPower > maxValue) {
  1208. maxValue = allDataSource[i].PredictionPower;
  1209. } else if (allDataSource[i].PredictionGas > maxValue) {
  1210. maxValue = allDataSource[i].PredictionGas;
  1211. } else if (allDataSource[i].PerformPower > maxValue) {
  1212. maxValue = allDataSource[i].PerformPower;
  1213. } else if (allDataSource[i].PerformGas > maxValue) {
  1214. maxValue = allDataSource[i].PerformGas;
  1215. } else {
  1216. maxValue = maxValue;
  1217. }
  1218. }
  1219. } else {
  1220. for (var i = 0; i < dataSource.length; i++) {
  1221. if (dataSource[i].Prediction > maxValue) {
  1222. maxValue = dataSource[i].Prediction;
  1223. } else if (dataSource[i].Perform > maxValue) {
  1224. maxValue = dataSource[i].Perform;
  1225. }
  1226. else {
  1227. maxValue = maxValue;
  1228. }
  1229. }
  1230. }
  1231. var valAxis = $("#sideBarChart").dxChart("instance").option('valueAxis');
  1232. //valAxis.max = parseInt(maxValue * 1.1);
  1233. if (energySelectButton == "all") {
  1234. //valAxis.max = valAxis.max * 1.5;
  1235. }
  1236. $("#sideBarChart").dxChart("instance").option('valueAxis', valAxis);
  1237. if (totalPerform != 0) {
  1238. $("#dxCircularGauge").dxCircularGauge("instance").option('value', compareValue);
  1239. }
  1240. else {
  1241. $("#dxCircularGauge").dxCircularGauge("instance").option('value', 0.00);
  1242. }
  1243. performLength = 0;
  1244. totalPerform = 0;
  1245. sumPerform = 0;
  1246. sumPrediction = 0;
  1247. sumCurPrediction = 0;
  1248. metaResultCnt = 0;
  1249. powerMetaResultCnt = 0;
  1250. gasMetaResultCnt = 0;
  1251. $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
  1252. }
  1253. function GetPerformData(metaResultArrayElement, recursiveCnt) {
  1254. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  1255. var endDay = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  1256. var getPerformDataSource = new DevExpress.data.DataSource({
  1257. store: {
  1258. type: "odata",
  1259. url: endpointSelector + "/BemsMonitoringPointHistoryDaily"
  1260. },
  1261. map: function (itemData) {
  1262. return {
  1263. dateTime: itemData.CreatedDateTime,
  1264. Perform: itemData.DailyValue
  1265. }
  1266. },
  1267. requireTotalCount: true,
  1268. pageSize: 366
  1269. });
  1270. if (yearSelectButton == "year") {
  1271. getPerformDataSource.filter([
  1272. ["SiteId", "=", metaResultArrayElement[0]],
  1273. "and",
  1274. ["FacilityCode", "=", metaResultArrayElement[3]],
  1275. "and",
  1276. ["PropertyId", "=", metaResultArrayElement[4]],
  1277. "and",
  1278. ["CreatedDateTime", ">=", new Date(tmpDate.getFullYear(), 0, 1)],
  1279. "and",
  1280. ["CreatedDateTime", "<", new Date(tmpDate.getFullYear(), 12, 31)]
  1281. ]);
  1282. } else if (yearSelectButton == "month") {
  1283. getPerformDataSource.filter([
  1284. ["SiteId", "=", metaResultArrayElement[0]],
  1285. "and",
  1286. ["FacilityCode", "=", metaResultArrayElement[3]],
  1287. "and",
  1288. ["PropertyId", "=", metaResultArrayElement[4]],
  1289. "and",
  1290. ["CreatedDateTime", ">=", new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 1)],
  1291. "and",
  1292. ["CreatedDateTime", "<", new Date(tmpDate.getFullYear(), tmpDate.getMonth() + 1, 1)]
  1293. ]);
  1294. } else {
  1295. utils.toast.show("년/월 선택이 되지 않았습니다.");
  1296. }
  1297. getPerformDataSource.sort({ getter: "CreatedDateTime", asc: true });
  1298. getPerformDataSource.load()
  1299. .done(function (result) {
  1300. for (var i in result) {
  1301. if (yearSelectButton == "year") {
  1302. if (energySelectButton == "gaskwh" || energySelectButton == "all") {//가스m3변환
  1303. if (FuelTypeIdtemp == 2) {
  1304. dataSource[(result[i].dateTime.getMonth()).toString()].Perform = dataSource[(result[i].dateTime.getMonth()).toString()].Perform + result[i].Perform * m3calValue;
  1305. totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString()) * m3calValue;
  1306. }
  1307. else {
  1308. dataSource[(result[i].dateTime.getMonth()).toString()].Perform = dataSource[(result[i].dateTime.getMonth()).toString()].Perform + result[i].Perform;
  1309. totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
  1310. }
  1311. } else {
  1312. dataSource[(result[i].dateTime.getMonth()).toString()].Perform = dataSource[(result[i].dateTime.getMonth()).toString()].Perform + result[i].Perform;
  1313. totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
  1314. }
  1315. performLength++;
  1316. } else if (yearSelectButton == "month") {
  1317. var GetDate = result[i].dateTime.getDate() - 1;
  1318. //목표데이터와 실측데이터 병합
  1319. if (energySelectButton == "gaskwh" || energySelectButton == "all") {//가스m3변환
  1320. if (FuelTypeIdtemp == 2) {
  1321. dataSource[GetDate].Perform = dataSource[GetDate].Perform + result[i].Perform * m3calValue;
  1322. totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString()) * m3calValue;
  1323. }
  1324. else {
  1325. dataSource[GetDate].Perform = dataSource[GetDate].Perform + result[i].Perform;
  1326. totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
  1327. }
  1328. } else {
  1329. dataSource[GetDate].Perform = dataSource[GetDate].Perform + result[i].Perform;
  1330. totalPerform = parseFloat(totalPerform.toString()) + parseFloat(result[i].Perform.toString());
  1331. }
  1332. performLength++;
  1333. } else {
  1334. utils.toast.show("년/월 선택이 되지 않았습니다.");
  1335. }
  1336. }
  1337. metaResultCnt++;
  1338. recursiveCnt--;
  1339. if (recursiveCnt >= 1) {
  1340. GetPerformData(metaResultArray[metaResultCnt], recursiveCnt);
  1341. } else {
  1342. SetEnergyResult();
  1343. }
  1344. return true;
  1345. })
  1346. .fail(function (error) {
  1347. utils.toast.show("사용량 데이터를 불러오는데 실패 하였습니다.");
  1348. $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
  1349. });
  1350. }
  1351. function sumPerform_function(metaResultArrayElement) {
  1352. var Today = new Date();
  1353. var getPerformDataSource1 = new DevExpress.data.DataSource({
  1354. store: {
  1355. type: "odata",
  1356. url: endpointSelector + "/BemsMonitoringPointHistoryDaily"
  1357. },
  1358. map: function (itemData) {
  1359. return {
  1360. dateTime: itemData.CreatedDateTime,
  1361. Perform: itemData.DailyValue
  1362. }
  1363. },
  1364. requireTotalCount: true,
  1365. pageSize: 366
  1366. });
  1367. if (yearSelectButton == "month") {
  1368. getPerformDataSource1.filter([
  1369. ["SiteId", "=", metaResultArrayElement[0]],
  1370. "and",
  1371. ["FacilityCode", "=", metaResultArrayElement[3]],
  1372. "and",
  1373. ["PropertyId", "=", metaResultArrayElement[4]],
  1374. "and",
  1375. ["CreatedDateTime", ">=", new Date(Today.getFullYear(), 0, 1)],
  1376. "and",
  1377. ["CreatedDateTime", "<", new Date(Today.getFullYear(), Today.getMonth(), Today.getDate() + 1)]
  1378. ]);
  1379. }
  1380. getPerformDataSource1.sort({ getter: "CreatedDateTime", asc: true });
  1381. getPerformDataSource1.load()
  1382. .done(function (result) {
  1383. for (var i in result) {
  1384. if (yearSelectButton == "month") {
  1385. //목표데이터와 실측데이터 병합
  1386. if (energySelectButton == "gaskwh" || energySelectButton == "all") {//가스m3변환
  1387. if (FuelTypeIdtemp == 2)
  1388. sumPerform = parseFloat(sumPerform.toString()) + parseFloat(result[i].Perform.toString()) * m3calValue;
  1389. else
  1390. sumPerform = parseFloat(sumPerform.toString()) + parseFloat(result[i].Perform.toString());
  1391. } else {
  1392. sumPerform = parseFloat(sumPerform.toString()) + parseFloat(result[i].Perform.toString());
  1393. }
  1394. }
  1395. }
  1396. })
  1397. .fail(function (error) {
  1398. utils.toast.show("사용량 데이터를 불러오는데 실패 하였습니다.");
  1399. });
  1400. }
  1401. function numberWithCommas(x) {
  1402. return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
  1403. }
  1404. function handleViewShown() {
  1405. energySelectButton = "all";
  1406. yearSelectButton = "month";
  1407. $("#LoadPanel").dxLoadPanel({
  1408. message: '로딩 중...',
  1409. showIndicator: true,
  1410. visible: false
  1411. });
  1412. $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
  1413. visiblePopup(false);
  1414. var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
  1415. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  1416. $("#divGoal").hide();
  1417. $("#modGoalBtn").hide();
  1418. if (yearSelectButton == "month") {
  1419. argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  1420. var labelObj = {
  1421. customizeText: function () {
  1422. return this.value + '일';
  1423. }
  1424. };
  1425. } else {
  1426. argAxis.max = 12;
  1427. var labelObj = {
  1428. customizeText: function () {
  1429. return this.value + '월';
  1430. }
  1431. };
  1432. }
  1433. argAxis.label = labelObj;
  1434. $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
  1435. //getAllData2(1);
  1436. $('#allBtn').trigger('click');
  1437. }
  1438. var now = new Date();
  1439. var firstDay = new Date(now.getFullYear(), now.getMonth(), 1);
  1440. var searchViewOptions = {
  1441. };
  1442. function handleSearchInSearchView() {
  1443. }
  1444. var viewModel = $.extend(BWA.CommonView.create(params, viewInfo, searchViewOptions, ko.observable(null), handleViewShown, null, handleSearchInSearchView),
  1445. {
  1446. viewShowing: handleViewShowing,
  1447. chartOptions: {
  1448. dataSource: dataSource,
  1449. barWidth: 0.5,
  1450. size: {
  1451. height: 520
  1452. },
  1453. commonSeriesSettings: {
  1454. argumentField: "dateTime",
  1455. type: "bar"
  1456. },
  1457. series: [
  1458. //{ valueField: "Prediction", name: "목표", color: '#72A7B3' },
  1459. { valueField: "Prediction", name: "목표", color: '#007994' },
  1460. { valueField: "Perform", name: "사용량", color: '#5F8B95' }
  1461. ],
  1462. legend: {
  1463. verticalAlignment: "top",
  1464. horizontalAlignment: "center",
  1465. position: "outside",
  1466. border: { visible: false }
  1467. },
  1468. valueAxis: ko.observable({
  1469. visible: true,
  1470. label: {
  1471. customizeText: function () {
  1472. if (this.value >= 1000 && this.value < 10000) {
  1473. this.value = this.value.toString().substring(0, 1) + 'K';
  1474. } else if (this.value >= 10000) {
  1475. this.value = this.value.toString().substring(0, 2) + 'K';
  1476. } else {
  1477. this.value = this.value;
  1478. }
  1479. return this.value + ' kWh';
  1480. }
  1481. },
  1482. min: 0,
  1483. //max: 11000,
  1484. valueType: 'numeric',
  1485. //tickInterval: 1000
  1486. }),
  1487. argumentAxis: ko.observable({
  1488. visible: true,
  1489. label: {
  1490. customizeText: function () {
  1491. return this.value + '일';
  1492. }
  1493. },
  1494. min: 1,
  1495. max: 32 - new Date(now.getFullYear, now.getMonth, 32).getDate(),
  1496. valueType: 'numeric',
  1497. tickInterval: 1
  1498. }),
  1499. "export": {
  1500. enabled: true
  1501. },
  1502. tooltip: {
  1503. enabled: true,
  1504. //format: 'largeNumber',
  1505. customizeTooltip: function (point) {
  1506. return {
  1507. text: numberWithCommas(point.value.toFixed(2))
  1508. };
  1509. }
  1510. }
  1511. },
  1512. startDatePicker: {
  1513. pickerType: "calendar",
  1514. value: firstDay,
  1515. formatString: "yyyy년 MM월",
  1516. maxZoomLevel: "year",
  1517. width: "9%",
  1518. onValueChanged: function () {
  1519. $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
  1520. if (energySelectButton == "all") {
  1521. $("#divGoal").hide();
  1522. $("#modGoalBtn").hide();
  1523. var argSeries = this.chartOptions.series;
  1524. //argSeries = [{ valueField: "PredictionPower", name: "목표 전력", stack: "prediction", color: '#72A7B3' },
  1525. argSeries = [{ valueField: "PredictionPower", name: "목표 전력", stack: "prediction", color: '#007994' },
  1526. //{ valueField: "PredictionGas", name: "목표 가스", stack: "prediction", color: '#90E68E' },
  1527. { valueField: "PredictionGas", name: "목표 가스", stack: "prediction", color: '#03C700' },
  1528. { valueField: "PerformPower", name: "전력 사용량", stack: "perform", color: '#5F8B95' },
  1529. { valueField: "PerformGas", name: "가스 사용량", stack: "perform", color: '#7CC77B' }, ];
  1530. this.chartOptions.series = argSeries;
  1531. var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
  1532. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  1533. if (yearSelectButton == "month") {
  1534. argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  1535. var labelObj = {
  1536. customizeText: function () {
  1537. return this.value + '일';
  1538. }
  1539. };
  1540. } else {
  1541. argAxis.max = 12;
  1542. var labelObj = {
  1543. customizeText: function () {
  1544. return this.value + '월';
  1545. }
  1546. };
  1547. }
  1548. argAxis.label = labelObj;
  1549. $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
  1550. getAllData2(SITEID);
  1551. } else if (energySelectButton == "power") {
  1552. if (yearSelectButton == "month") {
  1553. $("#divGoal").show();
  1554. $("#modGoalBtn").show();
  1555. } else {
  1556. $("#divGoal").hide();
  1557. $("#modGoalBtn").hide();
  1558. }
  1559. var argSeries = this.chartOptions.series;
  1560. argSeries = [{ valueField: "Prediction", name: "목표", color: '#007994' }, { valueField: "Perform", name: "사용량", color: '#5F8B95' }];
  1561. this.chartOptions.series = argSeries;
  1562. var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
  1563. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  1564. if (yearSelectButton == "month") {
  1565. argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  1566. var labelObj = {
  1567. customizeText: function () {
  1568. return this.value + '일';
  1569. }
  1570. };
  1571. } else {
  1572. argAxis.max = 12;
  1573. var labelObj = {
  1574. customizeText: function () {
  1575. return this.value + '월';
  1576. }
  1577. };
  1578. }
  1579. argAxis.label = labelObj;
  1580. $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
  1581. getEnergyData2(SITEID, $Code.FacilityType.ELECTRICITY, 1, 1);
  1582. } else if (energySelectButton == "gaskwh") {
  1583. if (yearSelectButton == "month") {
  1584. $("#divGoal").show();
  1585. $("#modGoalBtn").show();
  1586. } else {
  1587. $("#divGoal").hide();
  1588. $("#modGoalBtn").hide();
  1589. }
  1590. var argSeries = this.chartOptions.series;
  1591. argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
  1592. this.chartOptions.series = argSeries;
  1593. var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
  1594. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  1595. if (yearSelectButton == "month") {
  1596. argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  1597. var labelObj = {
  1598. customizeText: function () {
  1599. return this.value + '일';
  1600. }
  1601. };
  1602. } else {
  1603. argAxis.max = 12;
  1604. var labelObj = {
  1605. customizeText: function () {
  1606. return this.value + '월';
  1607. }
  1608. };
  1609. }
  1610. argAxis.label = labelObj;
  1611. $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
  1612. getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
  1613. } else if (energySelectButton == "gasm3") {
  1614. if (yearSelectButton == "month") {
  1615. $("#divGoal").show();
  1616. $("#modGoalBtn").show();
  1617. } else {
  1618. $("#divGoal").hide();
  1619. $("#modGoalBtn").hide();
  1620. }
  1621. var argSeries = this.chartOptions.series;
  1622. argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
  1623. this.chartOptions.series = argSeries;
  1624. var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
  1625. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  1626. if (yearSelectButton == "month") {
  1627. argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  1628. var labelObj = {
  1629. customizeText: function () {
  1630. return this.value + '일';
  1631. }
  1632. };
  1633. } else {
  1634. argAxis.max = 12;
  1635. var labelObj = {
  1636. customizeText: function () {
  1637. return this.value + '월';
  1638. }
  1639. };
  1640. }
  1641. argAxis.label = labelObj;
  1642. $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
  1643. getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
  1644. } else if (energySelectButton == "water") {
  1645. if (yearSelectButton == "month") {
  1646. $("#divGoal").show();
  1647. $("#modGoalBtn").show();
  1648. } else {
  1649. $("#divGoal").hide();
  1650. $("#modGoalBtn").hide();
  1651. }
  1652. var argSeries = this.chartOptions.series;
  1653. argSeries = [{ valueField: "Prediction", name: "목표", color: '#FC6D00' }, { valueField: "Perform", name: "사용량", color: '#FDCFAD' }];
  1654. this.chartOptions.series = argSeries;
  1655. var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
  1656. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  1657. if (yearSelectButton == "month") {
  1658. argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  1659. var labelObj = {
  1660. customizeText: function () {
  1661. return this.value + '일';
  1662. }
  1663. };
  1664. } else {
  1665. argAxis.max = 12;
  1666. var labelObj = {
  1667. customizeText: function () {
  1668. return this.value + '월';
  1669. }
  1670. };
  1671. }
  1672. argAxis.label = labelObj;
  1673. $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
  1674. getEnergyData2(SITEID, $Code.FacilityType.WATER, 1, 3);
  1675. } else {
  1676. utils.toast.show("에너지원이 선택되지 않았습니다.");
  1677. }
  1678. }
  1679. },
  1680. tooltipVisible: ko.observable(false),
  1681. toggleTooltip: function () {
  1682. this.tooltipVisible(!this.tooltipVisible());
  1683. },
  1684. monthButtonClicked: function () {
  1685. $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
  1686. yearSelectButton = "month";
  1687. $("#startDatePicker").dxDateBox("instance").option("formatString", "yyyy년 MM월");
  1688. $("#startDatePicker").dxDateBox("instance").option("maxZoomLevel", "year");
  1689. $("#startDatePicker").dxDateBox("instance").option("width", "9%");
  1690. $("#monthBtn").css("background-image", "linear-gradient(180deg,#9babc3 0%,#41618c 100%)");
  1691. $("#yearBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  1692. var argAxis = this.chartOptions.argumentAxis();
  1693. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  1694. argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  1695. var labelObj = {
  1696. customizeText: function () {
  1697. return this.value + '일';
  1698. }
  1699. };
  1700. argAxis.label = labelObj;
  1701. this.chartOptions.argumentAxis(argAxis);
  1702. if (energySelectButton == "water") {
  1703. var valAxis = this.chartOptions.valueAxis();
  1704. valAxis.min = 0;
  1705. //valAxis.max = 100;
  1706. //valAxis.tickInterval = 10;
  1707. var labelObj = {
  1708. customizeText: function () {
  1709. if (this.value >= 1000) {
  1710. this.value = this.value.toString().substring(0, 1) + 'K';
  1711. } else {
  1712. this.value = this.value;
  1713. }
  1714. return this.value + ' m3';
  1715. }
  1716. };
  1717. valAxis.label = labelObj;
  1718. this.chartOptions.valueAxis(valAxis);
  1719. } else if (energySelectButton == "gasm3") {
  1720. var valAxis = this.chartOptions.valueAxis();
  1721. valAxis.min = 0;
  1722. //valAxis.max = 2000;
  1723. //valAxis.tickInterval = 100;
  1724. var labelObj = {
  1725. customizeText: function () {
  1726. if (this.value >= 1000 && this.value < 10000) {
  1727. this.value = this.value.toString().substring(0, 1) + 'K';
  1728. } else if (this.value >= 10000 && this.value < 100000) {
  1729. this.value = this.value.toString().substring(0, 2) + 'K';
  1730. } else if (this.value >= 100000 && this.value < 1000000) {
  1731. this.value = this.value.toString().substring(0, 3) + 'K';
  1732. } else if (this.value >= 1000000 && this.value < 10000000) {
  1733. this.value = this.value.toString().substring(0, 1) + 'M';
  1734. } else if (this.value >= 10000000 && this.value < 100000000) {
  1735. this.value = this.value.toString().substring(0, 2) + 'M';
  1736. } else if (this.value >= 100000000) {
  1737. this.value = this.value.toString().substring(0, 3) + 'M';
  1738. } else {
  1739. this.value = this.value;
  1740. }
  1741. return this.value + ' m3';
  1742. }
  1743. };
  1744. valAxis.label = labelObj;
  1745. this.chartOptions.valueAxis(valAxis);
  1746. } else if (energySelectButton == "gaskwh") {
  1747. var valAxis = this.chartOptions.valueAxis();
  1748. valAxis.min = 0;
  1749. //valAxis.max = 2000;
  1750. //valAxis.tickInterval = 200;
  1751. var labelObj = {
  1752. customizeText: function () {
  1753. if (this.value >= 1000 && this.value < 10000) {
  1754. this.value = this.value.toString().substring(0, 1) + 'K';
  1755. } else if (this.value >= 10000 && this.value < 100000) {
  1756. this.value = this.value.toString().substring(0, 2) + 'K';
  1757. } else if (this.value >= 100000 && this.value < 1000000) {
  1758. this.value = this.value.toString().substring(0, 3) + 'K';
  1759. } else if (this.value >= 1000000 && this.value < 10000000) {
  1760. this.value = this.value.toString().substring(0, 1) + 'M';
  1761. } else if (this.value >= 10000000 && this.value < 100000000) {
  1762. this.value = this.value.toString().substring(0, 2) + 'M';
  1763. } else if (this.value >= 100000000) {
  1764. this.value = this.value.toString().substring(0, 3) + 'M';
  1765. } else {
  1766. this.value = this.value;
  1767. }
  1768. return this.value + ' m3';
  1769. }
  1770. };
  1771. valAxis.label = labelObj;
  1772. this.chartOptions.valueAxis(valAxis);
  1773. } else {
  1774. var valAxis = this.chartOptions.valueAxis();
  1775. valAxis.min = 0;
  1776. //valAxis.max = 11000;
  1777. //valAxis.tickInterval = 1000;
  1778. var labelObj = {
  1779. customizeText: function () {
  1780. if (this.value >= 1000 && this.value < 10000) {
  1781. this.value = this.value.toString().substring(0, 1) + 'K';
  1782. } else if (this.value >= 10000) {
  1783. this.value = this.value.toString().substring(0, 2) + 'K';
  1784. } else {
  1785. this.value = this.value;
  1786. }
  1787. return this.value + ' kWh';
  1788. }
  1789. };
  1790. valAxis.label = labelObj;
  1791. this.chartOptions.valueAxis(valAxis);
  1792. }
  1793. if (energySelectButton == "all") {
  1794. $("#unitPrediction").html("금월 목표 사용량(kWh)");
  1795. $("#unitPerform").html("금월 사용량(kWh)");
  1796. $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
  1797. $("#divGoal").hide();
  1798. $("#modGoalBtn").hide();
  1799. var argSeries = this.chartOptions.series;
  1800. argSeries = [{ valueField: "PredictionPower", name: "목표 전력", stack: "prediction", color: '#007994' },
  1801. { valueField: "PredictionGas", name: "목표 가스", stack: "prediction", color: '#03C700' },
  1802. { valueField: "PerformPower", name: "전력 사용량", stack: "perform", color: '#5F8B95' },
  1803. { valueField: "PerformGas", name: "가스 사용량", stack: "perform", color: '#7CC77B' }, ];
  1804. this.chartOptions.series = argSeries;
  1805. getAllData2(SITEID);
  1806. } else if (energySelectButton == "power") {
  1807. $("#unitPrediction").html("금월 목표 사용량(kWh)");
  1808. $("#unitPerform").html("금월 사용량(kWh)");
  1809. $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
  1810. $("#divGoal").show();
  1811. $("#modGoalBtn").show();
  1812. var argSeries = this.chartOptions.series;
  1813. argSeries = [{ valueField: "Prediction", name: "목표", color: '#007994' }, { valueField: "Perform", name: "사용량", color: '#5F8B95' }];
  1814. this.chartOptions.series = argSeries;
  1815. getEnergyData2(SITEID, $Code.FacilityType.ELECTRICITY, 1, 1);
  1816. } else if (energySelectButton == "gaskwh") {
  1817. $("#unitPrediction").html("금월 목표 사용량(kWh)");
  1818. $("#unitPerform").html("금월 사용량(kWh)");
  1819. $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
  1820. $("#divGoal").show();
  1821. $("#modGoalBtn").show();
  1822. var argSeries = this.chartOptions.series;
  1823. argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
  1824. this.chartOptions.series = argSeries;
  1825. getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
  1826. } else if (energySelectButton == "gasm3") {
  1827. $("#unitPrediction").html("금월 목표 사용량(m3)");
  1828. $("#unitPerform").html("금월 사용량(m3)");
  1829. $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
  1830. $("#divGoal").show();
  1831. $("#modGoalBtn").show();
  1832. var argSeries = this.chartOptions.series;
  1833. argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
  1834. this.chartOptions.series = argSeries;
  1835. getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
  1836. } else if (energySelectButton == "water") {
  1837. $("#unitPrediction").html("금월 목표 사용량(m3)");
  1838. $("#unitPerform").html("금월 사용량(m3)");
  1839. $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
  1840. $("#divGoal").show();
  1841. $("#modGoalBtn").show();
  1842. var argSeries = this.chartOptions.series;
  1843. argSeries = [{ valueField: "Prediction", name: "목표", color: '#FC6D00' }, { valueField: "Perform", name: "사용량", color: '#FDCFAD' }];
  1844. this.chartOptions.series = argSeries;
  1845. getEnergyData2(SITEID, $Code.FacilityType.WATER, 1, 3);
  1846. } else {
  1847. utils.toast.show("에너지원이 선택되지 않았습니다.");
  1848. }
  1849. },
  1850. yearButtonClicked: function () {
  1851. $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
  1852. yearSelectButton = "year";
  1853. $("#startDatePicker").dxDateBox("instance").option("formatString", "yyyy년");
  1854. $("#startDatePicker").dxDateBox("instance").option("maxZoomLevel", "decade");
  1855. $("#startDatePicker").dxDateBox("instance").option("width", "7%");
  1856. $("#yearBtn").css("background-image", "linear-gradient(180deg,#9babc3 0%,#41618c 100%)");
  1857. $("#monthBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  1858. var argAxis = this.chartOptions.argumentAxis();
  1859. argAxis.max = 12;
  1860. var labelObj = {
  1861. customizeText: function () {
  1862. return this.value + '월';
  1863. }
  1864. };
  1865. argAxis.label = labelObj;
  1866. this.chartOptions.argumentAxis(argAxis);
  1867. if (energySelectButton == "water") {
  1868. var valAxis = this.chartOptions.valueAxis();
  1869. valAxis.min = 0;
  1870. //valAxis.max = 5000;
  1871. //valAxis.tickInterval = 500;
  1872. var labelObj = {
  1873. customizeText: function () {
  1874. if (this.value >= 1000 && this.value < 10000) {
  1875. this.value = this.value.toString().substring(0, 1) + 'K';
  1876. } else if (this.value >= 10000) {
  1877. this.value = this.value.toString().substring(0, 2) + 'K';
  1878. } else {
  1879. this.value = this.value;
  1880. }
  1881. return this.value + ' m3';
  1882. }
  1883. };
  1884. valAxis.label = labelObj;
  1885. this.chartOptions.valueAxis(valAxis);
  1886. } else if (energySelectButton == "gasm3") {
  1887. var valAxis = this.chartOptions.valueAxis();
  1888. valAxis.min = 0;
  1889. //valAxis.max = 2000;
  1890. //valAxis.tickInterval = this.value;
  1891. var labelObj = {
  1892. customizeText: function () {
  1893. if (this.value >= 1000 && this.value < 10000) {
  1894. this.value = this.value.toString().substring(0, 1) + 'K';
  1895. } else if (this.value >= 10000 && this.value < 100000) {
  1896. this.value = this.value.toString().substring(0, 2) + 'K';
  1897. } else if (this.value >= 100000 && this.value < 1000000) {
  1898. this.value = this.value.toString().substring(0, 3) + 'K';
  1899. } else if (this.value >= 1000000 && this.value < 10000000) {
  1900. this.value = this.value.toString().substring(0, 1) + 'M';
  1901. } else if (this.value >= 10000000 && this.value < 100000000) {
  1902. this.value = this.value.toString().substring(0, 2) + 'M';
  1903. } else if (this.value >= 100000000 && this.value < 1000000000) {
  1904. this.value = this.value.toString().substring(0, 3) + 'M';
  1905. } else if (this.value >= 1000000000) {
  1906. this.value = this.value.toString().substring(0, 4) + 'M';
  1907. } else {
  1908. this.value = this.value;
  1909. }
  1910. return this.value + ' m3';
  1911. }
  1912. };
  1913. valAxis.label = labelObj;
  1914. this.chartOptions.valueAxis(valAxis);
  1915. } else if (energySelectButton == "gaskwh") {
  1916. var valAxis = this.chartOptions.valueAxis();
  1917. valAxis.min = 0;
  1918. //valAxis.max = 2000;
  1919. //valAxis.tickInterval = 200;
  1920. var labelObj = {
  1921. customizeText: function () {
  1922. if (this.value >= 1000 && this.value < 10000) {
  1923. this.value = this.value.toString().substring(0, 1) + 'K';
  1924. } else if (this.value >= 10000 && this.value < 100000) {
  1925. this.value = this.value.toString().substring(0, 2) + 'K';
  1926. } else if (this.value >= 100000 && this.value < 1000000) {
  1927. this.value = this.value.toString().substring(0, 3) + 'K';
  1928. } else if (this.value >= 1000000 && this.value < 10000000) {
  1929. this.value = this.value.toString().substring(0, 1) + 'M';
  1930. } else if (this.value >= 10000000 && this.value < 100000000) {
  1931. this.value = this.value.toString().substring(0, 2) + 'M';
  1932. } else if (this.value >= 100000000) {
  1933. this.value = this.value.toString().substring(0, 3) + 'M';
  1934. } else {
  1935. this.value = this.value;
  1936. }
  1937. return this.value + ' m3';
  1938. }
  1939. };
  1940. valAxis.label = labelObj;
  1941. this.chartOptions.valueAxis(valAxis);
  1942. } else {
  1943. var valAxis = this.chartOptions.valueAxis();
  1944. valAxis.min = 0;
  1945. //valAxis.max = 500000;
  1946. //valAxis.tickInterval = 50000;
  1947. var labelObj = {
  1948. customizeText: function () {
  1949. if (this.value >= 1000 && this.value < 10000) {
  1950. this.value = this.value.toString().substring(0, 1) + 'K';
  1951. } else if (this.value >= 10000 && this.value < 100000) {
  1952. this.value = this.value.toString().substring(0, 2) + 'K';
  1953. } else if (this.value >= 100000) {
  1954. this.value = this.value.toString().substring(0, 3) + 'K';
  1955. } else {
  1956. this.value = this.value;
  1957. }
  1958. return this.value + ' kWh';
  1959. }
  1960. };
  1961. valAxis.label = labelObj;
  1962. this.chartOptions.valueAxis(valAxis);
  1963. }
  1964. if (energySelectButton == "all") {
  1965. $("#unitPrediction").html("금년 목표 사용량(kWh)");
  1966. $("#unitPerform").html("금년 사용량(kWh)");
  1967. $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
  1968. $("#divGoal").hide();
  1969. $("#modGoalBtn").hide();
  1970. var argSeries = this.chartOptions.series;
  1971. argSeries = [{ valueField: "PredictionPower", name: "목표 전력", stack: "prediction", color: '#007994' },
  1972. { valueField: "PredictionGas", name: "목표 가스", stack: "prediction", color: '#03C700' },
  1973. { valueField: "PerformPower", name: "전력 사용량", stack: "perform", color: '#5F8B95' },
  1974. { valueField: "PerformGas", name: "가스 사용량", stack: "perform", color: '#7CC77B' }, ];
  1975. this.chartOptions.series = argSeries;
  1976. getAllData2(SITEID);
  1977. } else if (energySelectButton == "power") {
  1978. $("#unitPrediction").html("금년 목표 사용량(kWh)");
  1979. $("#unitPerform").html("금년 사용량(kWh)");
  1980. $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
  1981. $("#divGoal").hide();
  1982. $("#modGoalBtn").hide();
  1983. var argSeries = this.chartOptions.series;
  1984. argSeries = [{ valueField: "Prediction", name: "목표", color: '#007994' }, { valueField: "Perform", name: "사용량", color: '#5F8B95' }];
  1985. this.chartOptions.series = argSeries;
  1986. getEnergyData2(SITEID, $Code.FacilityType.ELECTRICITY, 1, 1);
  1987. } else if (energySelectButton == "gaskwh") {
  1988. $("#unitPrediction").html("금년 목표 사용량(kWh)");
  1989. $("#unitPerform").html("금년 사용량(kWh)");
  1990. $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
  1991. $("#divGoal").hide();
  1992. $("#modGoalBtn").hide();
  1993. var argSeries = this.chartOptions.series;
  1994. argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
  1995. this.chartOptions.series = argSeries;
  1996. getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
  1997. } else if (energySelectButton == "gasm3") {
  1998. $("#unitPrediction").html("금년 목표 사용량(m3)");
  1999. $("#unitPerform").html("금년 사용량(m3)");
  2000. $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
  2001. $("#divGoal").hide();
  2002. $("#modGoalBtn").hide();
  2003. var argSeries = this.chartOptions.series;
  2004. argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
  2005. this.chartOptions.series = argSeries;
  2006. getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
  2007. } else if (energySelectButton == "water") {
  2008. $("#unitPrediction").html("금년 목표 사용량(m3)");
  2009. $("#unitPerform").html("금년 사용량(m3)");
  2010. $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
  2011. $("#divGoal").hide();
  2012. $("#modGoalBtn").hide();
  2013. var argSeries = this.chartOptions.series;
  2014. argSeries = [{ valueField: "Prediction", name: "목표", color: '#FC6D00' }, { valueField: "Perform", name: "사용량", color: '#FDCFAD' }];
  2015. this.chartOptions.series = argSeries;
  2016. getEnergyData2(SITEID, $Code.FacilityType.WATER, 1, 3);
  2017. } else {
  2018. utils.toast.show("에너지원이 선택되지 않았습니다.");
  2019. }
  2020. },
  2021. powerButtonClicked: function () {
  2022. $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
  2023. energySelectButton = "power";
  2024. $("#powerBtn").css("background-image", "linear-gradient(180deg,#9babc3 0%,#41618c 100%)");
  2025. $("#allBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2026. $("#gasm3Btn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2027. $("#gaskWhBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2028. $("#waterBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2029. if (yearSelectButton == "month") {
  2030. $("#unitPrediction").html("금월 목표 사용량(kWh)");
  2031. $("#unitPerform").html("금월 사용량(kWh)");
  2032. $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
  2033. $("#divGoal").show();
  2034. $("#modGoalBtn").show();
  2035. var valAxis = this.chartOptions.valueAxis();
  2036. valAxis.min = 0;
  2037. //valAxis.max = 11000;
  2038. //valAxis.tickInterval = 1000;
  2039. var labelObj = {
  2040. customizeText: function () {
  2041. if (this.value >= 1000 && this.value < 10000) {
  2042. this.value = this.value.toString().substring(0, 1) + 'K';
  2043. } else if (this.value >= 10000) {
  2044. this.value = this.value.toString().substring(0, 2) + 'K';
  2045. } else {
  2046. this.value = this.value;
  2047. }
  2048. return this.value + ' kWh';
  2049. }
  2050. };
  2051. valAxis.label = labelObj;
  2052. this.chartOptions.valueAxis(valAxis);
  2053. } else if (yearSelectButton == "year") {
  2054. $("#unitPrediction").html("금년 목표 사용량(kWh)");
  2055. $("#unitPerform").html("금년 사용량(kWh)");
  2056. $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
  2057. $("#divGoal").hide();
  2058. $("#modGoalBtn").hide();
  2059. var valAxis = this.chartOptions.valueAxis();
  2060. valAxis.min = 0;
  2061. //valAxis.max = 500000;
  2062. //valAxis.tickInterval = 50000;
  2063. var labelObj = {
  2064. customizeText: function () {
  2065. if (this.value >= 1000 && this.value < 10000) {
  2066. this.value = this.value.toString().substring(0, 1) + 'K';
  2067. } else if (this.value >= 10000 && this.value < 100000) {
  2068. this.value = this.value.toString().substring(0, 2) + 'K';
  2069. } else if (this.value >= 100000) {
  2070. this.value = this.value.toString().substring(0, 3) + 'K';
  2071. } else {
  2072. this.value = this.value;
  2073. }
  2074. return this.value + ' kWh';
  2075. }
  2076. };
  2077. valAxis.label = labelObj;
  2078. this.chartOptions.valueAxis(valAxis);
  2079. } else {
  2080. utils.toast.show("년/월 선택이 되지 않았습니다.");
  2081. }
  2082. var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
  2083. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  2084. if (yearSelectButton == "month") {
  2085. argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  2086. var labelObj = {
  2087. customizeText: function () {
  2088. return this.value + '일';
  2089. }
  2090. };
  2091. } else {
  2092. argAxis.max = 12;
  2093. var labelObj = {
  2094. customizeText: function () {
  2095. return this.value + '월';
  2096. }
  2097. };
  2098. }
  2099. argAxis.label = labelObj;
  2100. $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
  2101. getEnergyData2(SITEID, $Code.FacilityType.ELECTRICITY, 1, 1);
  2102. },
  2103. gasm3ButtonClicked: function () {
  2104. $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
  2105. energySelectButton = "gasm3";
  2106. $("#gasm3Btn").css("background-image", "linear-gradient(180deg,#9babc3 0%,#41618c 100%)");
  2107. $("#gaskWhBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2108. $("#powerBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2109. $("#waterBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2110. $("#allBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2111. if (yearSelectButton == "month") {
  2112. $("#divGoal").show();
  2113. $("#unitPrediction").html("금월 목표 사용량 (m3)");
  2114. $("#unitPerform").html("금월 사용량(m3)");
  2115. $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
  2116. $("#modGoalBtn").show();
  2117. var valAxis = this.chartOptions.valueAxis();
  2118. valAxis.min = 0;
  2119. //valAxis.max = 2000;
  2120. //valAxis.tickInterval = 100;
  2121. var labelObj = {
  2122. customizeText: function () {
  2123. if (this.value >= 1000 && this.value < 10000) {
  2124. this.value = this.value.toString().substring(0, 1) + 'K';
  2125. } else if (this.value >= 10000 && this.value < 100000) {
  2126. this.value = this.value.toString().substring(0, 2) + 'K';
  2127. } else if (this.value >= 100000 && this.value < 1000000) {
  2128. this.value = this.value.toString().substring(0, 3) + 'K';
  2129. } else if (this.value >= 1000000 && this.value < 10000000) {
  2130. this.value = this.value.toString().substring(0, 1) + 'M';
  2131. } else if (this.value >= 10000000 && this.value < 100000000) {
  2132. this.value = this.value.toString().substring(0, 2) + 'M';
  2133. } else if (this.value >= 100000000) {
  2134. this.value = this.value.toString().substring(0, 3) + 'M';
  2135. } else {
  2136. this.value = this.value;
  2137. }
  2138. return this.value + ' m3';
  2139. }
  2140. };
  2141. valAxis.label = labelObj;
  2142. this.chartOptions.valueAxis(valAxis);
  2143. } else if (yearSelectButton == "year") {
  2144. $("#unitPrediction").html("금년 목표 사용량(m3)");
  2145. $("#unitPerform").html("금년 사용량(m3)");
  2146. $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
  2147. $("#divGoal").hide();
  2148. $("#modGoalBtn").hide();
  2149. var valAxis = this.chartOptions.valueAxis();
  2150. valAxis.min = 0;
  2151. //valAxis.max = 2000;
  2152. //valAxis.tickInterval = 100;
  2153. var labelObj = {
  2154. customizeText: function () {
  2155. if (this.value >= 1000 && this.value < 10000) {
  2156. this.value = this.value.toString().substring(0, 1) + 'K';
  2157. } else if (this.value >= 10000 && this.value < 100000) {
  2158. this.value = this.value.toString().substring(0, 2) + 'K';
  2159. } else if (this.value >= 100000 && this.value < 1000000) {
  2160. this.value = this.value.toString().substring(0, 3) + 'K';
  2161. } else if (this.value >= 1000000 && this.value < 10000000) {
  2162. this.value = this.value.toString().substring(0, 1) + 'M';
  2163. } else if (this.value >= 10000000 && this.value < 100000000) {
  2164. this.value = this.value.toString().substring(0, 2) + 'M';
  2165. } else if (this.value >= 100000000 && this.value < 1000000000) {
  2166. this.value = this.value.toString().substring(0, 3) + 'M';
  2167. } else if (this.value >= 1000000000) {
  2168. this.value = this.value.toString().substring(0, 4) + 'M';
  2169. } else {
  2170. this.value = this.value;
  2171. }
  2172. return this.value + ' m3';
  2173. }
  2174. };
  2175. valAxis.label = labelObj;
  2176. this.chartOptions.valueAxis(valAxis);
  2177. } else {
  2178. utils.toast.show("년/월 선택이 되지 않았습니다.");
  2179. }
  2180. var argSeries = this.chartOptions.series;
  2181. argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
  2182. this.chartOptions.series = argSeries;
  2183. var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
  2184. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  2185. if (yearSelectButton == "month") {
  2186. argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  2187. var labelObj = {
  2188. customizeText: function () {
  2189. return this.value + '일';
  2190. }
  2191. };
  2192. } else {
  2193. argAxis.max = 12;
  2194. var labelObj = {
  2195. customizeText: function () {
  2196. return this.value + '월';
  2197. }
  2198. };
  2199. }
  2200. argAxis.label = labelObj;
  2201. $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
  2202. getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
  2203. },
  2204. gaskWhButtonClicked: function () {
  2205. $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
  2206. energySelectButton = "gaskwh";
  2207. $("#gaskWhBtn").css("background-image", "linear-gradient(180deg,#9babc3 0%,#41618c 100%)");
  2208. $("#gasm3Btn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2209. $("#powerBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2210. $("#waterBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2211. $("#allBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2212. if (yearSelectButton == "month") {
  2213. $("#unitPrediction").html("금월 목표 사용량(kWh)");
  2214. $("#unitPerform").html("금월 사용량(kWh)");
  2215. $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
  2216. $("#divGoal").show();
  2217. $("#modGoalBtn").show();
  2218. var valAxis = this.chartOptions.valueAxis();
  2219. valAxis.min = 0;
  2220. //valAxis.max = 2000;
  2221. //valAxis.tickInterval = 200;
  2222. var labelObj = {
  2223. customizeText: function () {
  2224. if (this.value >= 1000 && this.value < 10000) {
  2225. this.value = this.value.toString().substring(0, 1) + 'K';
  2226. } else if (this.value >= 10000) {
  2227. this.value = this.value.toString().substring(0, 2) + 'K';
  2228. } else {
  2229. this.value = this.value;
  2230. }
  2231. return this.value + ' kWh';
  2232. }
  2233. };
  2234. valAxis.label = labelObj;
  2235. this.chartOptions.valueAxis(valAxis);
  2236. } else if (yearSelectButton == "year") {
  2237. $("#unitPrediction").html("금년 목표 사용량(kWh)");
  2238. $("#unitPerform").html("금년 사용량(kWh)");
  2239. $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
  2240. $("#divGoal").hide();
  2241. $("#modGoalBtn").hide();
  2242. var valAxis = this.chartOptions.valueAxis();
  2243. valAxis.min = 0;
  2244. //valAxis.max = 2000;
  2245. //valAxis.tickInterval = 200;
  2246. var labelObj = {
  2247. customizeText: function () {
  2248. if (this.value >= 1000 && this.value < 10000) {
  2249. this.value = this.value.toString().substring(0, 1) + 'K';
  2250. } else if (this.value >= 10000 && this.value < 100000) {
  2251. this.value = this.value.toString().substring(0, 2) + 'K';
  2252. } else if (this.value >= 100000) {
  2253. this.value = this.value.toString().substring(0, 3) + 'K';
  2254. } else {
  2255. this.value = this.value;
  2256. }
  2257. return this.value + ' kWh';
  2258. }
  2259. };
  2260. valAxis.label = labelObj;
  2261. this.chartOptions.valueAxis(valAxis);
  2262. } else {
  2263. utils.toast.show("년/월 선택이 되지 않았습니다.");
  2264. }
  2265. var argSeries = this.chartOptions.series;
  2266. argSeries = [{ valueField: "Prediction", name: "목표", color: '#03C700' }, { valueField: "Perform", name: "사용량", color: '#7CC77B' }];
  2267. this.chartOptions.series = argSeries;
  2268. var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
  2269. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  2270. if (yearSelectButton == "month") {
  2271. argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  2272. var labelObj = {
  2273. customizeText: function () {
  2274. return this.value + '일';
  2275. }
  2276. };
  2277. } else {
  2278. argAxis.max = 12;
  2279. var labelObj = {
  2280. customizeText: function () {
  2281. return this.value + '월';
  2282. }
  2283. };
  2284. }
  2285. argAxis.label = labelObj;
  2286. $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
  2287. getEnergyData2(SITEID, $Code.FacilityType.GAS, 1, 2);
  2288. },
  2289. waterButtonClicked: function () {
  2290. $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
  2291. energySelectButton = "water";
  2292. $("#waterBtn").css("background-image", "linear-gradient(180deg,#9babc3 0%,#41618c 100%)");
  2293. $("#powerBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2294. $("#allBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2295. $("#gasm3Btn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2296. $("#gaskWhBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2297. if (yearSelectButton == "month") {
  2298. $("#unitPrediction").html("금월 목표 사용량(m3)");
  2299. $("#unitPerform").html("금월 사용량(m3)");
  2300. $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
  2301. $("#divGoal").show();
  2302. $("#modGoalBtn").show();
  2303. var valAxis = this.chartOptions.valueAxis();
  2304. valAxis.min = 0;
  2305. //valAxis.max = 100;
  2306. //valAxis.tickInterval = 10;
  2307. var labelObj = {
  2308. customizeText: function () {
  2309. if (this.value >= 1000) {
  2310. this.value = this.value.toString().substring(0, 1) + 'K';
  2311. } else {
  2312. this.value = this.value;
  2313. }
  2314. return this.value + ' m3';
  2315. }
  2316. };
  2317. valAxis.label = labelObj;
  2318. this.chartOptions.valueAxis(valAxis);
  2319. } else if (yearSelectButton == "year") {
  2320. $("#unitPrediction").html("금년 목표 사용량(m3)");
  2321. $("#unitPerform").html("금년 사용량(m3)");
  2322. $("#unitPrediction2").html("금일까지 목표 사용량(m3)");
  2323. $("#divGoal").hide();
  2324. $("#modGoalBtn").hide();
  2325. var valAxis = this.chartOptions.valueAxis();
  2326. valAxis.min = 0;
  2327. //valAxis.max = 5000;
  2328. //valAxis.tickInterval = 500;
  2329. var labelObj = {
  2330. customizeText: function () {
  2331. if (this.value >= 1000 && this.value < 10000) {
  2332. this.value = this.value.toString().substring(0, 1) + 'K';
  2333. } else if (this.value >= 10000) {
  2334. this.value = this.value.toString().substring(0, 2) + 'K';
  2335. } else {
  2336. this.value = this.value;
  2337. }
  2338. return this.value + ' kWh';
  2339. }
  2340. };
  2341. valAxis.label = labelObj;
  2342. this.chartOptions.valueAxis(valAxis);
  2343. } else {
  2344. utils.toast.show("년/월 선택이 되지 않았습니다.");
  2345. }
  2346. var argSeries = this.chartOptions.series;
  2347. argSeries = [{ valueField: "Prediction", name: "목표", color: '#FC6D00' }, { valueField: "Perform", name: "사용량", color: '#FDCFAD' }];
  2348. this.chartOptions.series = argSeries;
  2349. getEnergyData2(SITEID, $Code.FacilityType.WATER, 1, 3);
  2350. },
  2351. allButtonClicked: function () {
  2352. $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
  2353. energySelectButton = "all";
  2354. $("#allBtn").css("background-image", "linear-gradient(180deg,#9babc3 0%,#41618c 100%)");
  2355. $("#powerBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2356. $("#waterBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2357. $("#gasm3Btn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2358. $("#gaskWhBtn").css("background-image", "linear-gradient(rgb(56,88,130) 0%, rgb(44,68,101)100%)");
  2359. $("#divGoal").hide();
  2360. $("#modGoalBtn").hide();
  2361. if (yearSelectButton == "month") {
  2362. $("#unitPrediction").html("금월 목표 사용량(kWh)");
  2363. $("#unitPerform").html("금월 사용량(kWh)");
  2364. $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
  2365. var valAxis = this.chartOptions.valueAxis();
  2366. valAxis.min = 0;
  2367. //valAxis.max = 11000;
  2368. //valAxis.tickInterval = 1000;
  2369. var labelObj = {
  2370. customizeText: function () {
  2371. if (this.value >= 1000 && this.value < 10000) {
  2372. this.value = this.value.toString().substring(0, 1) + 'K';
  2373. } else if (this.value >= 10000) {
  2374. this.value = this.value.toString().substring(0, 2) + 'K';
  2375. } else {
  2376. this.value = this.value;
  2377. }
  2378. return this.value + ' kWh';
  2379. }
  2380. };
  2381. valAxis.label = labelObj;
  2382. this.chartOptions.valueAxis(valAxis);
  2383. } else if (yearSelectButton == "year") {
  2384. $("#unitPrediction").html("금년 목표 사용량(kWh)");
  2385. $("#unitPerform").html("금년 사용량(kWh)");
  2386. $("#unitPrediction2").html("금일까지 목표 사용량(kWh)");
  2387. var valAxis = this.chartOptions.valueAxis();
  2388. valAxis.min = 0;
  2389. //valAxis.max = 500000;
  2390. //valAxis.tickInterval = 50000;
  2391. var labelObj = {
  2392. customizeText: function () {
  2393. if (this.value >= 1000 && this.value < 10000) {
  2394. this.value = this.value.toString().substring(0, 1) + 'K';
  2395. } else if (this.value >= 10000 && this.value < 100000) {
  2396. this.value = this.value.toString().substring(0, 2) + 'K';
  2397. } else if (this.value >= 100000) {
  2398. this.value = this.value.toString().substring(0, 3) + 'K';
  2399. } else {
  2400. this.value = this.value;
  2401. }
  2402. return this.value + ' kWh';
  2403. }
  2404. };
  2405. valAxis.label = labelObj;
  2406. this.chartOptions.valueAxis(valAxis);
  2407. }
  2408. var argSeries = this.chartOptions.series;
  2409. argSeries = [{ valueField: "PredictionPower", name: "목표 전력", stack: "prediction", color: '#007994' },
  2410. { valueField: "PredictionGas", name: "목표 가스", stack: "prediction", color: '#03C700' },
  2411. { valueField: "PerformPower", name: "전력 사용량", stack: "perform", color: '#5F8B95' },
  2412. { valueField: "PerformGas", name: "가스 사용량", stack: "perform", color: '#7CC77B' }, ];
  2413. this.chartOptions.series = argSeries;
  2414. var argAxis = $("#sideBarChart").dxChart("instance").option('argumentAxis');
  2415. var tmpDate = $("#startDatePicker").dxDateBox("instance").option('value');
  2416. if (yearSelectButton == "month") {
  2417. argAxis.max = 32 - new Date(tmpDate.getFullYear(), tmpDate.getMonth(), 32).getDate();
  2418. var labelObj = {
  2419. customizeText: function () {
  2420. return this.value + '일';
  2421. }
  2422. };
  2423. } else {
  2424. argAxis.max = 12;
  2425. var labelObj = {
  2426. customizeText: function () {
  2427. return this.value + '월';
  2428. }
  2429. };
  2430. }
  2431. argAxis.label = labelObj;
  2432. $("#sideBarChart").dxChart("instance").option('argumentAxis', argAxis);
  2433. getAllData2(SITEID);
  2434. },
  2435. dxCircularGauge: {
  2436. geometry: {
  2437. startAngle: 180,
  2438. endAngle: 0
  2439. },
  2440. scale: {
  2441. startValue: 0,
  2442. endValue: 150,
  2443. },
  2444. rangeContainer: {
  2445. ranges: [
  2446. { startValue: 0, endValue: 90, color: '#77DD77' },
  2447. { startValue: 90, endValue: 100, color: 'orange' },
  2448. { startValue: 100, endValue: 150, color: '#92000A' }
  2449. ],
  2450. },
  2451. tickInterval: 50,
  2452. label: {
  2453. customizeText: function (arg) {
  2454. return arg.valueText + " %";
  2455. }
  2456. },
  2457. value: 0,
  2458. valueIndicator: {
  2459. type: "triangleNeedle",
  2460. color: "#8FBC8F"
  2461. },
  2462. animation: {
  2463. easing: 'linear'
  2464. },
  2465. spindleSize: 14,
  2466. indentFromCenter: 0,
  2467. tooltip: {
  2468. enabled: true
  2469. }
  2470. },
  2471. modGoalButtonClicked: function () {
  2472. visiblePopup(true);
  2473. },
  2474. dataGrid: {
  2475. dataSource: goalDataSource,
  2476. columns: ["날짜", "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"],
  2477. scrolling: {
  2478. mode: 'standard'
  2479. },
  2480. paging: { enabled: false }
  2481. }
  2482. }
  2483. );
  2484. viewModel.popupOptions = {
  2485. width: 1000,
  2486. height: 800,
  2487. visible: visiblePopup,
  2488. dragEnabled: false,
  2489. shading: false,
  2490. showTitle: true,
  2491. title: "목표치",
  2492. showCloseButton: true,
  2493. onShown: function (t, tt) {
  2494. }
  2495. };
  2496. return viewModel;
  2497. };