Release 0.9

This commit is contained in:
Georgy Khatuncev 2021-05-18 10:19:03 +05:00
parent dd34aea664
commit 3cddebe08a
2 changed files with 44 additions and 3 deletions

@ -54,6 +54,12 @@
<script src="Scripts/jquery-3.6.0.min.js"></script>
<script src="Scripts/umd/popper.min.js"></script>
<script src="Scripts/bootstrap.min.js"></script>
<!--<script src="DiagramStoveDll/Rectangle.js"></script>
<script src="DiagramStoveDll/PercentColumn.js"></script>
<script src="DiagramStoveDll/ProcessColumn.js"></script>
<script src="DiagramStoveDll/BlinkStatus.js"></script>
<script src="DiagramStoveDll/NumberColumn.js"></script>
<script src="DiagramStoveDll/Diagram.js"></script>-->
<script src="DiagramStoveDll/Diagram.min.js"></script>
<script src="index.js"></script>
</div>

@ -87,7 +87,7 @@ PrintCycle();
//Update Status \/ \/ \/
function UpdateStatus() {
var xhr = new XMLHttpRequest();
xhr.open('POST', 'https://test1.mbucb.ru/api/currcycles', true);
xhr.open('POST', 'api/currcycles', true);
xhr.send();
xhr.onreadystatechange = function () {
if (xhr.readyState != 4) return;
@ -101,7 +101,7 @@ function UpdateStatus() {
$("#Error_Border").hide();
var data = JSON.parse(xhr.responseText);
if (data.currTime === undefined) {
htmlErrMSG.innerHTML = "Ошибка в полученных данных";
htmlErrMSG.innerHTML = "Ошибка в полученных данных: отсутствует время сервера";
$("#Error_Border").show();
$("#Update_Button").show();
return;
@ -109,6 +109,41 @@ function UpdateStatus() {
updateDateSynch(new Date());
updateDateServer(new Date(data.currTime));
if (data.data === undefined || !Array.isArray(data.data)) {
htmlErrMSG.innerHTML = "Ошибка в полученных данных: отстутствует массив днных";
$("#Error_Border").show();
$("#Update_Button").show();
return;
}
var p = data.data;
for (var i = 0; i < p.length; i++) {
var idx = p[i].vdp - 1;
var s = -1;
var b = -1;
switch (p[i].cycle) {
case 0: s = 0; b = -1; break;
case 1: s = 0; b = 1; break;
case 2: s = 1; b = 0; break;
case 5: s = 2; b = 0; break;
case 6: s = 3; b = 0; break;
case 7: s = 4; b = 0; break;
case 8: s = 5; b = 3; break;
case 9: s = 6; b = 3; break;
case 10: s = 7; b = 3; break;
case 11: s = 8; b = 3; break;
case 12: s = 9; b = 3; break;
case 14: s = 1; b = 1; break;
case 15: s = 2; b = 1; break;
case 16: s = 3; b = 1; break;
default: s = -1; b = -1;
}
diagram.ChangeStatProc(idx, s, 0);
diagram.ChangeStatBlink(idx, b);
diagram.StartDate(idx, new Date(p[i].factStart));
diagram.EndDate(idx, new Date(p[i].thinkEnd));
}
diagram.Cycle(true);
/*
ctx.clearRect(0, 0, canvas.width, canvas.height);
@ -134,7 +169,7 @@ function UpdateStatus() {
else
$("#Error_Border").hide();
*/
diagram.Print();
diagram.Print(ctx);
setTimeout(UpdateStatus, 60 * 1000);
}
}