123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710 |
- BemsWebApplication.FmsfacilityTime = function (params, viewInfo) {
- "use strict";
- var endpointSelector = "";
- if (BemsWebApplication.config.mode == "production") {
- endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.production;
- } else {
- endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.local;
- }
- // 2018.07.24 : 그리드 도표 작업 : 팝업창 추가
- // 팝업창뷰 보이기 속성 제어용 변수 선언
- var DataGridPopup_Visible = ko.observable(false);
- // 그래프 출력 이후 엑셀출력을 위한 팝업창을 위해 임시 저장용 배열 선언
- var facilityTypeDataID;
- var facilityTypes = ko.observableArray();
- var facilityTypeDataSource = BemsWebApplication.db.createDataSource('BemsFacilityType');
- var faclilitydataSource, dataArrayresult, resultdataArrayresult = [];
- var timedataSource;
- var Action_time = 9 //시간별 운전 시간
- //timedataSource 초기화 함수
- function Source_init() {
- timedataSource = [{
- Num: 0,
- Name: "",
- Time: 0,
- FacilityCode: 0,
- PropertyId: 0,
- CurrentValue: 0,
- D0: 0, D1: 0, D2: 0, D3: 0, D4: 0, D5: 0, D6: 0, D7: 0, D8: 0, D9: 0, D10: 0, D11: 0, D12: 0, D13: 0, D14: 0, D15: 0, D16: 0, D17: 0, D18: 0, D19: 0, D20: 0, D21: 0, D22: 0, D23: 0, D24: 0, D25: 0, D26: 0, D27: 0, D28: 0, D29: 0, D30: 0
- }];
- dataArrayresult = [{
- Num: 0,
- Name: "",
- FacilityCode: 0,
- PropertyId: 0,
- CurrentValue: 0,
- D0: 0, D1: 0, D2: 0, D3: 0, D4: 0, D5: 0, D6: 0, D7: 0, D8: 0, D9: 0, D10: 0, D11: 0, D12: 0, D13: 0, D14: 0, D15: 0, D16: 0, D17: 0, D18: 0, D19: 0, D20: 0, D21: 0, D22: 0, D23: 0, D24: 0, D25: 0, D26: 0, D27: 0, D28: 0, D29: 0, D30: 0
- }];
- }
- function facilitydataSourceAdd(cnt) { // 설비 개수만큼 추가
- for (var i = 0; i < (cnt - 1) ; i++) {
- timedataSource.push({
- Num: 0,
- Name: "",
- Time: 0,
- FacilityCode: 0,
- PropertyId: 0,
- CurrentValue: 0,
- D0: 0, D1: 0, D2: 0, D3: 0, D4: 0, D5: 0, D6: 0, D7: 0, D8: 0, D9: 0, D10: 0, D11: 0, D12: 0, D13: 0, D14: 0, D15: 0, D16: 0, D17: 0, D18: 0, D19: 0, D20: 0, D21: 0, D22: 0, D23: 0, D24: 0, D25: 0, D26: 0, D27: 0, D28: 0, D29: 0, D30: 0
- });
- }
- for (var i = 0; i < (cnt - 1) ; i++) {
- dataArrayresult.push({
- Num: 0,
- Name: "",
- FacilityCode: 0,
- PropertyId: 0,
- CurrentValue: 0,
- D0: 0, D1: 0, D2: 0, D3: 0, D4: 0, D5: 0, D6: 0, D7: 0, D8: 0, D9: 0, D10: 0, D11: 0, D12: 0, D13: 0, D14: 0, D15: 0, D16: 0, D17: 0, D18: 0, D19: 0, D20: 0, D21: 0, D22: 0, D23: 0, D24: 0, D25: 0, D26: 0, D27: 0, D28: 0, D29: 0, D30: 0
- });
- }
- }
- var facilitydataSourceCnt = 0;
- var faclilitydataSourceCnt = 0;
- var dateChar; //초기값 -6
- // 보일러 시설 정보 겟 함수
- function GetFaclilityData() {
- switch (facilityTypeDataID) {
- case $Code.FacilityType.AIR_HANDLING: //공조기
- Action_time = $Code.FacilityTypeActTime.AIR_HANDLING;
- break;
- case $Code.FacilityType.REFRIGERATOR://냉동기
- Action_time = $Code.FacilityTypeActTime.REFRIGERATOR;
- break;
- case $Code.FacilityType.REFRIGERATOR_TOP://냉각탑
- Action_time = $Code.FacilityTypeActTime.REFRIGERATOR_TOP;
- break;
- case $Code.FacilityType.PUMP://펌프(브라인5),(지열순환펌프, 냉수,난방용온수순환,냉각수),
- Action_time = $Code.FacilityTypeActTime.PUMP;
- break;
- case $Code.FacilityType.BOILER://보일러
- Action_time = $Code.FacilityTypeActTime.BOILER;
- break;
- }
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/CmFacility"
- },
- requireTotalCount: true,
- pageSize: 100
- });
- dataSource.filter([
- ["SiteId", "=", BWA.UserInfo.SiteId()],
- "and",
- ["FacilityTypeId", "=", facilityTypeDataID]
- ]);
- dataSource.load()
- .done(function (result) {
- faclilitydataSourceCnt = result.length; //설비 개수
- faclilitydataSource = result;
- GetFacilityDailyData();
- })
- .fail(function (error) {
- utils.toast.show(error);
- });
- }
- // 보일러 정보 가져오기 함수
- function GetFacilityDailyData() {
- Source_init(); //timedataSource 초기화
- facilitydataSourceAdd(faclilitydataSourceCnt); // timedataSource 필요한 만큼 추가
- dateChar = $("#facility_history_calendarPicker").dxDateBox("instance").option('value');
- var dataSource = new DevExpress.data.DataSource({
- store: {
- type: "odata",
- url: endpointSelector + "/BemsMonitoringPointHistoryDaily"
- },
- requireTotalCount: true,
- pageSize: 20000 // 설비 6개까지
- });
- dataSource.filter([
- ["SiteId", "=", BWA.UserInfo.SiteId()], //사이트 아이디
- "and",
- ["FacilityTypeId", "=", facilityTypeDataID], //설비 타입
- "and",
- ["PropertyId", "=", Action_time],//변경 Action_time // 이유: 가동시간 0이 아니면 무조건 가동으로 판단
- "and",
- ["CreatedDateTime", ">=", new Date(dateChar.getFullYear(), dateChar.getMonth(), dateChar.getDate(), 0, 0, 0)],
- "and",
- ["CreatedDateTime", "<", new Date(dateChar.getFullYear(), dateChar.getMonth() + 1, dateChar.getDate(), 0, 0, 0)]
- ]);
- dataSource.sort({ getter: "FacilityCode", ASC: true }, { getter: "CreatedDateTime", ASC: true });
- dataSource.load()
- .done(function (result) {
- facilitydataSourceCnt = result.length;
- var start = 0;
- var day = new Date();
- for (var i = 0; i < faclilitydataSourceCnt; i++)//설비 개수 = 행 개수
- {
- for (var j = start; j < facilitydataSourceCnt; j++) // 가져온 데이터는 350개
- {
- if (timedataSource[i].Name == "") {
- for (var k = 0; k < faclilitydataSourceCnt; k++)//설비 개수 = 행 개수
- {
- if (result[j].FacilityCode == faclilitydataSource[k].FacilityCode) {
- timedataSource[i].Name = faclilitydataSource[k].Name;
- timedataSource[i].FacilityCode = faclilitydataSource[k].FacilityCode;
- }
- }
- }
- if (timedataSource[i].FacilityCode != result[j].FacilityCode)
- break;
- ONOFF_state(i, j, result);
- start++;
- }
- }
- for (var i = 0; i < timedataSource.length; i++) { //백그라운드 컬러 위해서
- for (var j = 1; j <= 5; j = j + 2) {
- if ((i % 7) == j)
- timedataSource[i].Num = 1;
- }
- }
- if (new Date(dateChar.getFullYear(), dateChar.getMonth() + 1, dateChar.getDate() - 1, 0).getDate() != 31) {
- for (var i = 0; i < timedataSource.length; i++)
- switch (new Date(dateChar.getFullYear(), dateChar.getMonth() + 1, dateChar.getDate() - 1, 0).getDate()) {
- case 30:
- $("#facility_data_list").dxDataGrid("instance").columnOption('D31', "visible", false);
- $("#facility_data_list").dxDataGrid("instance").columnOption('D30', "visible", false);
- break;
- case 29:
- $("#facility_data_list").dxDataGrid("instance").columnOption('D31', "visible", false);
- $("#facility_data_list").dxDataGrid("instance").columnOption('D30', "visible", false);
- $("#facility_data_list").dxDataGrid("instance").columnOption('D29', "visible", false);
- break;
- case 28:
- $("#facility_data_list").dxDataGrid("instance").columnOption('D31', "visible", false);
- $("#facility_data_list").dxDataGrid("instance").columnOption('D30', "visible", false);
- $("#facility_data_list").dxDataGrid("instance").columnOption('D29', "visible", false);
- $("#facility_data_list").dxDataGrid("instance").columnOption('D28', "visible", false);
- break;
- case 27:
- $("#facility_data_list").dxDataGrid("instance").columnOption('D31', "visible", false);
- $("#facility_data_list").dxDataGrid("instance").columnOption('D30', "visible", false);
- $("#facility_data_list").dxDataGrid("instance").columnOption('D29', "visible", false);
- $("#facility_data_list").dxDataGrid("instance").columnOption('D28', "visible", false);
- $("#facility_data_list").dxDataGrid("instance").columnOption('D27', "visible", false);
- break;
- }
- }
- GetFacilityTime();
- })
- .fail(function (error) {
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
- utils.toast.show(error);
- });
- }
- // 2018.07.24 : 그리드 도표 작업 : 팝업창 추가
- function DataGridPopup_ButtonClick() {
- DataGridPopup_Visible(true);
- }
- function SEARCH_ButtonClick() {
- if ($("#facilityTypeData").dxSelectBox("instance").option('value') != null) {
- facilityTypeDataID = $("#facilityTypeData").dxSelectBox("instance").option('value');
- }
- else {
- utils.toast.show('조회할 설비를 선택해주세요.', 'error');
- return;
- }
- $("#LoadPanel").dxLoadPanel({
- message: '로딩 중...',
- showIndicator: true,
- visible: false
- });
- $("#LoadPanel").dxLoadPanel('instance').option('visible', true);
- $("#facility_data_list").dxDataGrid("instance").columnOption('D31', "visible", true);
- $("#facility_data_list").dxDataGrid("instance").columnOption('D30', "visible", true);
- $("#facility_data_list").dxDataGrid("instance").columnOption('D29', "visible", true);
- $("#facility_data_list").dxDataGrid("instance").columnOption('D28', "visible", true);
- $("#facility_data_list").dxDataGrid("instance").columnOption('D27', "visible", true);
- GetFaclilityData();
- }
- function handlePopupShown() {
- // 데이타소스 업데이트
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D31', "visible", true);
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D30', "visible", true);
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D29', "visible", true);
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D28', "visible", true);
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D27', "visible", true);
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").option("dataSource", resultdataArrayresult);
- if (new Date(dateChar.getFullYear(), dateChar.getMonth() + 1, dateChar.getDate() - 1, 0).getDate() != 31) {
- for (var i = 0; i < timedataSource.length; i++)
- switch (new Date(dateChar.getFullYear(), dateChar.getMonth() + 1, dateChar.getDate() - 1, 0).getDate()) {
- case 30:
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D31', "visible", false);
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D30', "visible", false);
- break;
- case 29:
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D31', "visible", false);
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D30', "visible", false);
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D29', "visible", false);
- break;
- case 28:
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D31', "visible", false);
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D30', "visible", false);
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D29', "visible", false);
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D28', "visible", false);
- break;
- case 27:
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D31', "visible", false);
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D30', "visible", false);
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D29', "visible", false);
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D28', "visible", false);
- $("#TimeHistoryDataGrid_Container").dxDataGrid("instance").columnOption('D27', "visible", false);
- break;
- }
- }
- // 팝업창 갱신
- DataGridPopup_Visible(true);
- }
- // 2018.07.24 : 그리드 도표 작업 : 팝업창 추가
- function GetFacilityTime() { //가동시간 추가 함수
- var value = 0;
- for (var i = 0; i < timedataSource.length; i++)//각 일 데이터 여부 확인 7 * faclilitydataSourceCnt
- {
- if (timedataSource[i] != null)
- value = value + 1;
- }
- for (var i = 0; i < value; i++)//각 일 데이터 여부 확인 7 * faclilitydataSourceCnt
- {
- if (timedataSource[i].Name == "")
- timedataSource[i] = null;
- }
- var temp = 0;
- for (var i = 0; i < timedataSource.length; i++) {
- if (timedataSource[i] != null) {
- temp = i;
- }
- }
- timedataSource = timedataSource.slice(0, temp + 1);
- for (var i = 0; i < timedataSource.length; i++)//각 일 데이터 여부 확인 7 * faclilitydataSourceCnt
- {
- if (timedataSource[i] != null) {
- timedataSource[i].Time = timedataSource[i].D0;
- timedataSource[i].Time += timedataSource[i].D1;
- timedataSource[i].Time += timedataSource[i].D2;
- timedataSource[i].Time += timedataSource[i].D3;
- timedataSource[i].Time += timedataSource[i].D4;
- timedataSource[i].Time += timedataSource[i].D5;
- timedataSource[i].Time += timedataSource[i].D6;
- timedataSource[i].Time += timedataSource[i].D7;
- timedataSource[i].Time += timedataSource[i].D8;
- timedataSource[i].Time += timedataSource[i].D9;
- timedataSource[i].Time += timedataSource[i].D10;
- timedataSource[i].Time += timedataSource[i].D11;
- timedataSource[i].Time += timedataSource[i].D12;
- timedataSource[i].Time += timedataSource[i].D13;
- timedataSource[i].Time += timedataSource[i].D14;
- timedataSource[i].Time += timedataSource[i].D15;
- timedataSource[i].Time += timedataSource[i].D16;
- timedataSource[i].Time += timedataSource[i].D17;
- timedataSource[i].Time += timedataSource[i].D18;
- timedataSource[i].Time += timedataSource[i].D19;
- timedataSource[i].Time += timedataSource[i].D20;
- timedataSource[i].Time += timedataSource[i].D21;
- timedataSource[i].Time += timedataSource[i].D22;
- timedataSource[i].Time += timedataSource[i].D23;
- timedataSource[i].Time += timedataSource[i].D24;
- timedataSource[i].Time += timedataSource[i].D25;
- timedataSource[i].Time += timedataSource[i].D26;
- timedataSource[i].Time += timedataSource[i].D27;
- timedataSource[i].Time += timedataSource[i].D28;
- timedataSource[i].Time += timedataSource[i].D29;
- timedataSource[i].Time += timedataSource[i].D30;
- }
- }
- $("#facility_data_list").dxDataGrid("instance").option('dataSource', timedataSource);//병합데이터 최종 연동
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
- // 2018.07.24 : 그리드 도표 작업 : 팝업창 추가
- var tempdataArrayresult = timedataSource;
- var cnt = 0;
- for (var i = 0; i < timedataSource.length; i++) {
- if (timedataSource[i] != null) {
- tempdataArrayresult[cnt] = timedataSource[i];
- cnt++;
- }
- }
- for (var i = 0; i < cnt; i++)//각 일 데이터 여부 확인
- {
- dataArrayresult[i].Name = tempdataArrayresult[i].Name + " [" + tempdataArrayresult[i].Time + "]";
- dataArrayresult[i].D0 = tempdataArrayresult[i].D0;
- dataArrayresult[i].D1 = tempdataArrayresult[i].D1;
- dataArrayresult[i].D2 = tempdataArrayresult[i].D2;
- dataArrayresult[i].D3 = tempdataArrayresult[i].D3;
- dataArrayresult[i].D4 = tempdataArrayresult[i].D4;
- dataArrayresult[i].D5 = tempdataArrayresult[i].D5;
- dataArrayresult[i].D6 = tempdataArrayresult[i].D6;
- dataArrayresult[i].D7 = tempdataArrayresult[i].D7;
- dataArrayresult[i].D8 = tempdataArrayresult[i].D8;
- dataArrayresult[i].D9 = tempdataArrayresult[i].D9;
- dataArrayresult[i].D10 = tempdataArrayresult[i].D10;
- dataArrayresult[i].D11 = tempdataArrayresult[i].D11;
- dataArrayresult[i].D12 = tempdataArrayresult[i].D12;
- dataArrayresult[i].D13 = tempdataArrayresult[i].D13;
- dataArrayresult[i].D14 = tempdataArrayresult[i].D14;
- dataArrayresult[i].D15 = tempdataArrayresult[i].D15;
- dataArrayresult[i].D16 = tempdataArrayresult[i].D16;
- dataArrayresult[i].D17 = tempdataArrayresult[i].D17;
- dataArrayresult[i].D18 = tempdataArrayresult[i].D18;
- dataArrayresult[i].D19 = tempdataArrayresult[i].D19;
- dataArrayresult[i].D20 = tempdataArrayresult[i].D20;
- dataArrayresult[i].D21 = tempdataArrayresult[i].D21;
- dataArrayresult[i].D22 = tempdataArrayresult[i].D22;
- dataArrayresult[i].D23 = tempdataArrayresult[i].D23;
- dataArrayresult[i].D24 = tempdataArrayresult[i].D24;
- dataArrayresult[i].D25 = tempdataArrayresult[i].D25;
- dataArrayresult[i].D26 = tempdataArrayresult[i].D26;
- dataArrayresult[i].D27 = tempdataArrayresult[i].D27;
- dataArrayresult[i].D28 = tempdataArrayresult[i].D28;
- dataArrayresult[i].D29 = tempdataArrayresult[i].D29;
- dataArrayresult[i].D30 = tempdataArrayresult[i].D30;
- }
- resultdataArrayresult = [];
- for (var i = 0; i < cnt; i++) {
- resultdataArrayresult.push({
- Num: 0,
- Name: "",
- FacilityCode: 0,
- PropertyId: 0,
- CurrentValue: 0,
- D0: 0, D1: 0, D2: 0, D3: 0, D4: 0, D5: 0, D6: 0, D7: 0, D8: 0, D9: 0, D10: 0, D11: 0, D12: 0, D13: 0, D14: 0, D15: 0, D16: 0, D17: 0, D18: 0, D19: 0, D20: 0, D21: 0, D22: 0, D23: 0, D24: 0, D25: 0, D26: 0, D27: 0, D28: 0, D29: 0, D30: 0
- });
- }
- for (var i = 0; i < cnt; i++) {
- resultdataArrayresult[i] = dataArrayresult[i];
- }
- }
- function ONOFF_state(i, j, result) { //시간마다 값 추가
- var Date = result[j].CreatedDateTime.getDate();
- switch (Date - 1) {
- case 0:
- timedataSource[i].D0 = Math.round(result[j].DailyValue);
- break;
- case 1:
- timedataSource[i].D1 = Math.round(result[j].DailyValue);
- break;
- case 2:
- timedataSource[i].D2 = Math.round(result[j].DailyValue);
- break;
- case 3:
- timedataSource[i].D3 = Math.round(result[j].DailyValue);
- break;
- case 4:
- timedataSource[i].D4 = Math.round(result[j].DailyValue);
- break;
- case 5:
- timedataSource[i].D5 = Math.round(result[j].DailyValue);
- break;
- case 6:
- timedataSource[i].D6 = Math.round(result[j].DailyValue);
- break;
- case 7:
- timedataSource[i].D7 = Math.round(result[j].DailyValue);
- break;
- case 8:
- timedataSource[i].D8 = Math.round(result[j].DailyValue);
- break;
- case 9:
- timedataSource[i].D9 = Math.round(result[j].DailyValue);
- break;
- case 10:
- timedataSource[i].D10 = Math.round(result[j].DailyValue);
- break;
- case 11:
- timedataSource[i].D11 = Math.round(result[j].DailyValue);
- break;
- case 12:
- timedataSource[i].D12 = Math.round(result[j].DailyValue);
- break;
- case 13:
- timedataSource[i].D13 = Math.round(result[j].DailyValue);
- break;
- case 14:
- timedataSource[i].D14 = Math.round(result[j].DailyValue);
- break;
- case 15:
- timedataSource[i].D15 = Math.round(result[j].DailyValue);
- break;
- case 16:
- timedataSource[i].D16 = Math.round(result[j].DailyValue);
- break;
- case 17:
- timedataSource[i].D17 = Math.round(result[j].DailyValue);
- break;
- case 18:
- timedataSource[i].D18 = Math.round(result[j].DailyValue);
- break;
- case 19:
- timedataSource[i].D19 = Math.round(result[j].DailyValue);
- break;
- case 20:
- timedataSource[i].D20 = Math.round(result[j].DailyValue);
- break;
- case 21:
- timedataSource[i].D21 = Math.round(result[j].DailyValue);
- break;
- case 22:
- timedataSource[i].D22 = Math.round(result[j].DailyValue);
- break;
- case 23:
- timedataSource[i].D23 = Math.round(result[j].DailyValue);
- break;
- case 24:
- timedataSource[i].D24 = Math.round(result[j].DailyValue);
- break;
- case 25:
- timedataSource[i].D25 = Math.round(result[j].DailyValue);
- break;
- case 26:
- timedataSource[i].D26 = Math.round(result[j].DailyValue);
- break;
- case 27:
- timedataSource[i].D27 = Math.round(result[j].DailyValue);
- break;
- case 28:
- timedataSource[i].D28 = Math.round(result[j].DailyValue);
- break;
- case 29:
- timedataSource[i].D29 = Math.round(result[j].DailyValue);
- break;
- case 30:
- timedataSource[i].D30 = Math.round(result[j].DailyValue);
- break;
- }
- }
- function handleViewShowing() {
- facilityTypeDataSource.filter([
- ['FacilityTypeId', '<', 99]
- ]);
- // 빌딩 데이터 로드 시점
- $.when(facilityTypeDataSource.load()
- ).done(function (result) {
- for (var i = 0; i < result.length; i++) {
- if (result[i].FacilityTypeId() == $Code.FacilityType.AIR_HANDLING || result[i].FacilityTypeId() == $Code.FacilityType.REFRIGERATOR || result[i].FacilityTypeId() == $Code.FacilityType.REFRIGERATOR_TOP || result[i].FacilityTypeId() == $Code.FacilityType.PUMP || result[i].FacilityTypeId() == $Code.FacilityType.BOILER) {
- facilityTypes.push(result[i]);
- }
- }
- });
- }
- function handleViewShown() {
- $SideMenu.showSideMenuIfWill(params.view);
- $SearchView.setPopupVisibleObservable(null);
- }
- var searchViewOptions = {
- }
- function handleSearchInSearchView() {
- }
- var viewModel = $.extend(BWA.CommonView.create(params, viewInfo, searchViewOptions, ko.observable(null), handleViewShown, null, handleSearchInSearchView),
- {
- viewShown: handleViewShown,
- viewShowing: handleViewShowing,
- facility_data_list: {
- dataSource: timedataSource,
- paging: { pageSize: 28 },
- columns: [
- { dataField: 'Name', caption: '설비명칭', width: '14%', alignment: 'center', allowSorting: false },
- { dataField: 'Time', caption: '가동시간(분)', width: '6%', alignment: 'center', allowSorting: false },
- {
- dataField: 'D0', caption: '1일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D1', caption: '2일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D2', caption: '3일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D3', caption: '4일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D4', caption: '5일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D5', caption: '6일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D6', caption: '7일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D7', caption: '8일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D8', caption: '9일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D9', caption: '10일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D10', caption: '11일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D11', caption: '12일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D12', caption: '13일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D13', caption: '14일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D14', caption: '15일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D15', caption: '16일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D16', caption: '17일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D17', caption: '18일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D18', caption: '19일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D19', caption: '20일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D20', caption: '21일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D21', caption: '22일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D22', caption: '23일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D23', caption: '24일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D24', caption: '25일', width: '3.1%', alignment: 'center', allowSorting: false
- },
- {
- dataField: 'D25', caption: '26일', width: '3.1%', alignment: 'center', allowSorting: false
- }
- ,
- {
- dataField: 'D26', caption: '27일', width: '3.1%', alignment: 'center', allowSorting: false
- }
- ,
- {
- dataField: 'D27', caption: '28일', width: '3.1%', alignment: 'center', allowSorting: false
- }
- ,
- {
- dataField: 'D28', caption: '29일', width: '3.1%', alignment: 'center', allowSorting: false
- }
- ,
- {
- dataField: 'D29', caption: '30일', width: '3.1%', alignment: 'center', allowSorting: false
- }
- ,
- {
- dataField: 'D30', caption: '31일', width: '3.1%', alignment: 'center', allowSorting: false
- }
- ],
- onRowPrepared: function (info) {
- if (info.rowType != 'header')
- if (info.data.Num == 1)
- info.rowElement.css('background-color', 'rgba(206,246,245,0.4)');
- }
- },
- facility_history_calendarPicker: {
- pickerType: "calendar",
- formatString: "yyyy-MM",
- maxZoomLevel: 'year',
- value: new Date(),
- onValueChanged: function () {
- var today = new Date();
- dateChar = $("#facility_history_calendarPicker").dxDateBox("instance").option('value');
- if (dateChar.getFullYear() > today.getFullYear()) {
- utils.toast.show('선택된 날짜를 조회할수 없습니다.', 'error');
- } else {
- if (dateChar.getMonth() > today.getMonth())
- utils.toast.show('선택된 날짜를 조회할수 없습니다.', 'error');
- }
- }
- }
- // 2018.07.24 : 그리드 도표 작업 : 팝업창 추가
- , TimeHistoryDataGridPopup_ButtonClicked: DataGridPopup_ButtonClick
- , search_ButtonClicked: SEARCH_ButtonClick
- // 2018.07.24 : 그리드 도표 작업 : 팝업창 추가
- });
- // 2018.07.24 : 그리드 도표 작업 : 팝업창 추가
- viewModel.TimeHistoryDataGridPopupOptions = {
- width: '1800px',
- height: '820px',
- contentTemplate: "content",
- showTitle: true,
- title: "도표",
- visible: DataGridPopup_Visible,
- dragEnabled: true,
- closeOnOutsideClick: true,
- shownAction: handlePopupShown,
- animation: window.utils.popup.createAnimation()
- };
- viewModel.TimeHistoryDataGridOptions = {
- dataSource: resultdataArrayresult,
- columns: [
- { dataField: 'Name', caption: '설비명칭[가동시간(분)]', width: '18%', alignment: 'center', allowSorting: false },
- { dataField: 'D0', caption: '1일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D1', caption: '2일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D2', caption: '3일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D3', caption: '4일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D4', caption: '5일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D5', caption: '6일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D6', caption: '7일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D7', caption: '8일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D8', caption: '9일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D9', caption: '10일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D10', caption: '11일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D11', caption: '12일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D12', caption: '13일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D13', caption: '14일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D14', caption: '15일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D15', caption: '16일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D16', caption: '17일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D17', caption: '18일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D18', caption: '19일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D19', caption: '20일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D20', caption: '21일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D21', caption: '22일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D22', caption: '23일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D23', caption: '24일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D24', caption: '25일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D25', caption: '26일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D26', caption: '27일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D27', caption: '28일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D28', caption: '29일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D29', caption: '30일', width: '3.3%', alignment: 'center', allowSorting: false },
- { dataField: 'D30', caption: '31일', width: '3.3%', alignment: 'center', allowSorting: false }
- ],
- // 엑셀 출력, dx.all.debug.js / _getCellIndex /63882
- "export": {
- enabled: true,
- fileName: '설비별 가동시간'
- }
- };
- // 2018.07.24 : 그리드 도표 작업 : 팝업창 추가
- viewModel.facilityTypes = facilityTypes;
- return viewModel;
- };
|