|
@@ -19,6 +19,9 @@
|
|
var iceThermalStorage_SimulationValueGet = new BWA.Chart.IceThermalStorage_SimulationValueGet(BWA.UserInfo.SiteId());
|
|
var iceThermalStorage_SimulationValueGet = new BWA.Chart.IceThermalStorage_SimulationValueGet(BWA.UserInfo.SiteId());
|
|
var chart = BWA.Chart.Instance('chartIS', 'dxChart');
|
|
var chart = BWA.Chart.Instance('chartIS', 'dxChart');
|
|
|
|
|
|
|
|
+ var RecentData = false;
|
|
|
|
+ var isNotRecentData = false;
|
|
|
|
+
|
|
// 그리드 도표 작업 : 팝업창 추가
|
|
// 그리드 도표 작업 : 팝업창 추가
|
|
// 팝업창뷰 보이기 속성 제어용 변수 선언
|
|
// 팝업창뷰 보이기 속성 제어용 변수 선언
|
|
var DataGridPopup_Visible = ko.observable(false);
|
|
var DataGridPopup_Visible = ko.observable(false);
|
|
@@ -441,7 +444,56 @@
|
|
DataArrange(initDate_, finalDate_, 2, 4480, 15, ref2Status_int, 1);
|
|
DataArrange(initDate_, finalDate_, 2, 4480, 15, ref2Status_int, 1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ // 저장 버튼 클릭 후 DB가 업데이트 되면 로딩 팝업창 종료 및 그래프 표시
|
|
|
|
+ function CheckRecentData() {
|
|
|
|
+ var now_15min = new Date();
|
|
|
|
+ now_15min.setMinutes(parseInt(now_15min.getMinutes() / 15) * 15); // 15분 단위 맞춰주기 위함
|
|
|
|
+ var finalDate_ = new Date(now_15min.getFullYear(), now_15min.getMonth(), now_15min.getDate(), 20, 45, 0);
|
|
|
|
+ if (now_15min.getHours() >= 21) {
|
|
|
|
+ finalDate_ = moment(finalDate_).add(1, 'days').toDate();
|
|
|
|
+ }
|
|
|
|
+ // 예상축열량 관제점 : FacilityTypeId = 3 and FacilityCode = 4478 and PropertyId = 2 and SimulationCase = 1
|
|
|
|
+ BemsIceThermalStorageDataSource.filter([
|
|
|
|
+ ["SiteId", "=", BWA.UserInfo.SiteId()],
|
|
|
|
+ "and",
|
|
|
|
+ ["FacilityCode", "=", 4478],
|
|
|
|
+ "and",
|
|
|
|
+ ["PropertyId", "=", 2],
|
|
|
|
+ "and",
|
|
|
|
+ ["SimulationCase", "=", 1],
|
|
|
|
+ "and",
|
|
|
|
+ ["TargetDateTime", "=", finalDate_]
|
|
|
|
+ ]);
|
|
|
|
+ BemsIceThermalStorageDataSource.load()
|
|
|
|
+ .done(function (result) {
|
|
|
|
+ var now_ = new Date();
|
|
|
|
+ if (result.length > 0) {
|
|
|
|
+ //var now_comp = new Date(now_.getFullYear(), now_.getMonth(), now_.getDate(), now_.getHours(), now_.getMinutes(), now_.getSeconds());
|
|
|
|
+ now_.setSeconds(now_.getSeconds() - 10);
|
|
|
|
+ if (result[0].CreatedDateTime().getTime() > now_.getTime()) {
|
|
|
|
+ RecentData = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 저장버튼 클릭 후 DB가 업데이트 될때까지 실행
|
|
|
|
+ function RecursiveFunc_isRecentData(isRecentData) {
|
|
|
|
+ setTimeout(function () {
|
|
|
|
+ if (RecentData == true) {
|
|
|
|
+ console.log('true');
|
|
|
|
+ $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
|
|
|
|
+ visibleHourGlassPopup(false);
|
|
|
|
+ handleSearchInSearchView();
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ RecursiveFunc_isRecentData(CheckRecentData());
|
|
|
|
+ }
|
|
|
|
+ }, 1000);
|
|
|
|
+ }
|
|
|
|
+
|
|
function handlePopupButtonSave() {
|
|
function handlePopupButtonSave() {
|
|
var now_date = new Date();
|
|
var now_date = new Date();
|
|
if (now_date.getHours() != 0 && now_date.getMinutes() % 15 == 1 && now_date.getSeconds() > 0 && now_date.getSeconds() < 40) {
|
|
if (now_date.getHours() != 0 && now_date.getMinutes() % 15 == 1 && now_date.getSeconds() > 0 && now_date.getSeconds() < 40) {
|
|
@@ -463,11 +515,10 @@
|
|
$("#LoadPanel").dxLoadPanel('instance').option('visible', true);
|
|
$("#LoadPanel").dxLoadPanel('instance').option('visible', true);
|
|
visibleHourGlassPopup(true); // 모래시계 팝업 활성화
|
|
visibleHourGlassPopup(true); // 모래시계 팝업 활성화
|
|
// Python에서 데이터 처리하고 DB에서 데이터 불러오는 시간 고려
|
|
// Python에서 데이터 처리하고 DB에서 데이터 불러오는 시간 고려
|
|
|
|
+ RecentData = false;
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
|
|
|
|
- visibleHourGlassPopup(false);
|
|
|
|
- handleSearchInSearchView();
|
|
|
|
- }, 12000);
|
|
|
|
|
|
+ RecursiveFunc_isRecentData(CheckRecentData());
|
|
|
|
+ }, 1000);
|
|
CurrntRowStatusAsSave = 1;
|
|
CurrntRowStatusAsSave = 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -484,11 +535,10 @@
|
|
$("#LoadPanel").dxLoadPanel('instance').option('visible', true);
|
|
$("#LoadPanel").dxLoadPanel('instance').option('visible', true);
|
|
visibleHourGlassPopup(true); // 모래시계 팝업 활성화
|
|
visibleHourGlassPopup(true); // 모래시계 팝업 활성화
|
|
// Python에서 데이터 처리하고 DB에서 데이터 불러오는 시간 고려
|
|
// Python에서 데이터 처리하고 DB에서 데이터 불러오는 시간 고려
|
|
|
|
+ RecentData = false;
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
|
|
|
|
- visibleHourGlassPopup(false);
|
|
|
|
- handleSearchInSearchView();
|
|
|
|
- }, 12000);
|
|
|
|
|
|
+ RecursiveFunc_isRecentData(CheckRecentData());
|
|
|
|
+ }, 1000);
|
|
CurrntRowStatusAsSave = 2;
|
|
CurrntRowStatusAsSave = 2;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -506,11 +556,10 @@
|
|
$("#LoadPanel").dxLoadPanel('instance').option('visible', true);
|
|
$("#LoadPanel").dxLoadPanel('instance').option('visible', true);
|
|
visibleHourGlassPopup(true); // 모래시계 팝업 활성화
|
|
visibleHourGlassPopup(true); // 모래시계 팝업 활성화
|
|
// Python에서 데이터 처리하고 DB에서 데이터 불러오는 시간 고려
|
|
// Python에서 데이터 처리하고 DB에서 데이터 불러오는 시간 고려
|
|
|
|
+ RecentData = false;
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
|
|
|
|
- visibleHourGlassPopup(false);
|
|
|
|
- handleSearchInSearchView();
|
|
|
|
- }, 12000);
|
|
|
|
|
|
+ RecursiveFunc_isRecentData(CheckRecentData());
|
|
|
|
+ }, 1000);
|
|
CurrntRowStatusAsSave = 3;
|
|
CurrntRowStatusAsSave = 3;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -529,11 +578,10 @@
|
|
$("#LoadPanel").dxLoadPanel('instance').option('visible', true);
|
|
$("#LoadPanel").dxLoadPanel('instance').option('visible', true);
|
|
visibleHourGlassPopup(true); // 모래시계 팝업 활성화
|
|
visibleHourGlassPopup(true); // 모래시계 팝업 활성화
|
|
// Python에서 데이터 처리하고 DB에서 데이터 불러오는 시간 고려
|
|
// Python에서 데이터 처리하고 DB에서 데이터 불러오는 시간 고려
|
|
|
|
+ RecentData = false;
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
|
|
|
|
- visibleHourGlassPopup(false);
|
|
|
|
- handleSearchInSearchView();
|
|
|
|
- }, 12000);
|
|
|
|
|
|
+ RecursiveFunc_isRecentData(CheckRecentData());
|
|
|
|
+ }, 1000);
|
|
CurrntRowStatusAsSave = 4;
|
|
CurrntRowStatusAsSave = 4;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -553,11 +601,10 @@
|
|
$("#LoadPanel").dxLoadPanel('instance').option('visible', true);
|
|
$("#LoadPanel").dxLoadPanel('instance').option('visible', true);
|
|
visibleHourGlassPopup(true); // 모래시계 팝업 활성화
|
|
visibleHourGlassPopup(true); // 모래시계 팝업 활성화
|
|
// Python에서 데이터 처리하고 DB에서 데이터 불러오는 시간 고려
|
|
// Python에서 데이터 처리하고 DB에서 데이터 불러오는 시간 고려
|
|
|
|
+ RecentData = false;
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
- $("#LoadPanel").dxLoadPanel('instance').option('visible', false);
|
|
|
|
- visibleHourGlassPopup(false);
|
|
|
|
- handleSearchInSearchView();
|
|
|
|
- }, 12000);
|
|
|
|
|
|
+ RecursiveFunc_isRecentData(CheckRecentData());
|
|
|
|
+ }, 1000);
|
|
CurrntRowStatusAsSave = 5;
|
|
CurrntRowStatusAsSave = 5;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -957,7 +1004,7 @@
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
$('#RecommendedTime').text("추천 가동 시간 : ?,");
|
|
$('#RecommendedTime').text("추천 가동 시간 : ?,");
|
|
- utils.toast.show("데이터가 없습니다. (추천 가동 시간)", 'error');
|
|
|
|
|
|
+ //utils.toast.show("데이터가 없습니다. (추천 가동 시간)", 'error');
|
|
}
|
|
}
|
|
|
|
|
|
})
|
|
})
|
|
@@ -1004,7 +1051,7 @@
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
$('#RefPowerConsume').text("냉동기 계산 전력량(시뮬레이션 모드) : ?");
|
|
$('#RefPowerConsume').text("냉동기 계산 전력량(시뮬레이션 모드) : ?");
|
|
- utils.toast.show("데이터가 없습니다. (냉동기 계산 전력량)", 'error');
|
|
|
|
|
|
+ //utils.toast.show("데이터가 없습니다. (냉동기 계산 전력량)", 'error');
|
|
}
|
|
}
|
|
})
|
|
})
|
|
.fail(function (error) {
|
|
.fail(function (error) {
|
|
@@ -1012,6 +1059,52 @@
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 처음 페이지 접근 시 DB가 업데이트 될때까지 실행
|
|
|
|
+ function CheckNotRecentData() {
|
|
|
|
+ var now_15min = new Date();
|
|
|
|
+ now_15min.setMinutes(parseInt(now_15min.getMinutes() / 15) * 15); // 15분 단위 맞춰주기 위함
|
|
|
|
+ var now_15min_ = new Date(now_15min.getFullYear(), now_15min.getMonth(), now_15min.getDate(), now_15min.getHours(), now_15min.getMinutes(), 0);
|
|
|
|
+ var finalDate_ = new Date(now_15min.getFullYear(), now_15min.getMonth(), now_15min.getDate(), 20, 45, 0);
|
|
|
|
+ if (now_15min.getHours() >= 21) {
|
|
|
|
+ finalDate_ = moment(finalDate_).add(1, 'days').toDate();
|
|
|
|
+ }
|
|
|
|
+ // 예상축열량 관제점 : FacilityTypeId = 3 and FacilityCode = 4478 and PropertyId = 2 and SimulationCase = 1
|
|
|
|
+ BemsIceThermalStorageDataSource.filter([
|
|
|
|
+ ["SiteId", "=", BWA.UserInfo.SiteId()],
|
|
|
|
+ "and",
|
|
|
|
+ ["FacilityCode", "=", 4478],
|
|
|
|
+ "and",
|
|
|
|
+ ["PropertyId", "=", 2],
|
|
|
|
+ "and",
|
|
|
|
+ ["SimulationCase", "=", 1],
|
|
|
|
+ "and",
|
|
|
|
+ ["TargetDateTime", ">=", now_15min_],
|
|
|
|
+ "and",
|
|
|
|
+ ["TargetDateTime", "<=", finalDate_]
|
|
|
|
+ ]);
|
|
|
|
+ BemsIceThermalStorageDataSource.load()
|
|
|
|
+ .done(function (result) {
|
|
|
|
+ var now_ = new Date();
|
|
|
|
+ if (result.length == 0) {
|
|
|
|
+ isNotRecentData = true;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ function RecursiveFunc_isNotRecentData() {
|
|
|
|
+ CheckNotRecentData();
|
|
|
|
+ setTimeout(function () {
|
|
|
|
+ if (isNotRecentData == true) {
|
|
|
|
+ timeBoxForSearch.setDefaultDateToday();
|
|
|
|
+ handleSearchInSearchView();
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ RecursiveFunc_isNotRecentData();
|
|
|
|
+ }
|
|
|
|
+ }, 1000);
|
|
|
|
+ }
|
|
|
|
+
|
|
function handleViewShown() {
|
|
function handleViewShown() {
|
|
$("#LoadPanel").dxLoadPanel({
|
|
$("#LoadPanel").dxLoadPanel({
|
|
message: '로딩 중...',
|
|
message: '로딩 중...',
|
|
@@ -1029,36 +1122,64 @@
|
|
RemoveData(2, 4480, 11, 1); // 냉동기2 전력량
|
|
RemoveData(2, 4480, 11, 1); // 냉동기2 전력량
|
|
RemoveData(3, 4478, 2, 1); // 축열량
|
|
RemoveData(3, 4478, 2, 1); // 축열량
|
|
if (initialized === false) {
|
|
if (initialized === false) {
|
|
|
|
+ chart = chart(BWA.ChartOptions.SimulatorIceStorage.getChartOptions());
|
|
|
|
+ initialized = true;
|
|
|
|
+ // 날짜 초기화 (오늘)
|
|
|
|
+ isNotRecentData = false;
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
- chart = chart(BWA.ChartOptions.SimulatorIceStorage.getChartOptions());
|
|
|
|
- initialized = true;
|
|
|
|
- // 날짜 초기화 (오늘)
|
|
|
|
- timeBoxForSearch.setDefaultDateToday();
|
|
|
|
- handleSearchInSearchView();
|
|
|
|
- }, 4000);
|
|
|
|
|
|
+ RecursiveFunc_isNotRecentData();
|
|
|
|
+ }, 1000);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
|
|
+ // 날짜 초기화 (오늘)
|
|
|
|
+ isNotRecentData = false;
|
|
setTimeout(function () {
|
|
setTimeout(function () {
|
|
- // 날짜 초기화 (오늘)
|
|
|
|
- timeBoxForSearch.setDefaultDateToday();
|
|
|
|
- handleSearchInSearchView();
|
|
|
|
-
|
|
|
|
- // 저장 변수 초기화
|
|
|
|
- initDate_asSave = new Array(new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate));
|
|
|
|
- finalDate_asSave = new Array(new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate));
|
|
|
|
- operationMode_asSave = new Array(null, null, null, null, null);
|
|
|
|
- ref1Status_asSave = new Array(null, null, null, null, null);
|
|
|
|
- ref2Status_asSave = new Array(null, null, null, null, null);
|
|
|
|
- }, 4000);
|
|
|
|
|
|
+ RecursiveFunc_isNotRecentData();
|
|
|
|
+ }, 1000);
|
|
|
|
+
|
|
|
|
+ // 저장 변수 초기화
|
|
|
|
+ initDate_asSave = new Array(new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate), new Date(initialDate));
|
|
|
|
+ finalDate_asSave = new Array(new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate), new Date(finalDate));
|
|
|
|
+ operationMode_asSave = new Array(null, null, null, null, null);
|
|
|
|
+ ref1Status_asSave = new Array(null, null, null, null, null);
|
|
|
|
+ ref2Status_asSave = new Array(null, null, null, null, null);
|
|
}
|
|
}
|
|
timer = setInterval(function () {
|
|
timer = setInterval(function () {
|
|
//alert('timer'); // For Debugging
|
|
//alert('timer'); // For Debugging
|
|
var now = new Date();
|
|
var now = new Date();
|
|
//if ((now.getMinutes() == 1 && now.getSeconds() == 30) || (now.getMinutes() == 5 && now.getSeconds() == 30)) {
|
|
//if ((now.getMinutes() == 1 && now.getSeconds() == 30) || (now.getMinutes() == 5 && now.getSeconds() == 30)) {
|
|
- if (now.getMinutes() % 15 == 2 && now.getSeconds() == 30) {
|
|
|
|
- handleSearchInSearchView();
|
|
|
|
|
|
+
|
|
|
|
+ var now_15min = new Date();
|
|
|
|
+ now_15min.setMinutes(parseInt(now_15min.getMinutes() / 15) * 15); // 15분 단위 맞춰주기 위함
|
|
|
|
+ var finalDate_ = new Date(now_15min.getFullYear(), now_15min.getMonth(), now_15min.getDate(), 20, 45, 0);
|
|
|
|
+ if (now_15min.getHours() >= 21) {
|
|
|
|
+ finalDate_ = moment(finalDate_).add(1, 'days').toDate();
|
|
}
|
|
}
|
|
- }, 1000);
|
|
|
|
|
|
+ // 계산축열량 관제점 : FacilityTypeId = 3 and FacilityCode = 4478 and PropertyId = 2 and SimulationCase = 1
|
|
|
|
+ BemsIceThermalStorageDataSource.filter([
|
|
|
|
+ ["SiteId", "=", BWA.UserInfo.SiteId()],
|
|
|
|
+ "and",
|
|
|
|
+ ["FacilityCode", "=", 4478],
|
|
|
|
+ "and",
|
|
|
|
+ ["PropertyId", "=", 2],
|
|
|
|
+ "and",
|
|
|
|
+ ["SimulationCase", "=", 0],
|
|
|
|
+ "and",
|
|
|
|
+ ["TargetDateTime", "=", finalDate_],
|
|
|
|
+ ]);
|
|
|
|
+ BemsIceThermalStorageDataSource.load()
|
|
|
|
+ .done(function (result) {
|
|
|
|
+ var now_ = new Date();
|
|
|
|
+ if (result.length > 0) {
|
|
|
|
+ //var now_comp = new Date(now_.getFullYear(), now_.getMonth(), now_.getDate(), now_.getHours(), now_.getMinutes(), now_.getSeconds());
|
|
|
|
+ now_.setSeconds(now_.getSeconds() - 5);
|
|
|
|
+ if (result[0].CreatedDateTime().getTime() > now_.getTime()) {
|
|
|
|
+ console.log('++');
|
|
|
|
+ handleSearchInSearchView();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }, 5000);
|
|
|
|
|
|
$("#UserCfgBtn").dxButton({
|
|
$("#UserCfgBtn").dxButton({
|
|
text: "시뮬레이터 변수 설정",
|
|
text: "시뮬레이터 변수 설정",
|