|
@@ -241,102 +241,6 @@
|
|
|
send_alert("下班操作成功! <a href='denglu.html'> 点击这里返回控制主页 </a>");
|
|
|
};
|
|
|
this.bind = function () {
|
|
|
- $(".confirm-clear-data").click(function(){
|
|
|
- FlowRealTime.ClearDataControl.clearDataOfDeviceId($('#handInput').val());
|
|
|
- });
|
|
|
- $(".open-clear-panel").click(function () {
|
|
|
- FlowRealTime.UI.showClearPanel();
|
|
|
- })
|
|
|
- $(".close-schedule").click(function () {
|
|
|
- FlowRealTime.Action.confirmStopSchedule();
|
|
|
- })
|
|
|
- }
|
|
|
- })(this);
|
|
|
-
|
|
|
- var ClearDataControl = new (function (parent) {
|
|
|
- this.p = parent;
|
|
|
- this.finished = true;
|
|
|
- this.executed = false;
|
|
|
- this.directCount = -1;
|
|
|
-
|
|
|
- this.clearDataOfDeviceId = function (handId) {
|
|
|
- this.executed = false;
|
|
|
- this.directCount = -1;
|
|
|
- this.finished = true;
|
|
|
- var hand = handId;
|
|
|
- var hd = 0;
|
|
|
- if (hand.length > 0) {
|
|
|
- hd = parseInt(hand);
|
|
|
- }
|
|
|
- get_data("endpoint/clearBoard?flowId=" + flowId + "&handheldId=" + hd, this.clearSuccess);
|
|
|
- };
|
|
|
-
|
|
|
- this.clearSuccess = function (obj, sta) {
|
|
|
- console.warn("------- 手持设备清空 ----------");
|
|
|
- console.warn(obj);
|
|
|
- send_alert("发送清空请求成功, 正在等待采集端进行处理...");
|
|
|
- this.finished = false;
|
|
|
- setTimeout(this.resultVerifyTimeout, 8000, this);
|
|
|
- setTimeout(this.getVerify, 300, this);
|
|
|
- }
|
|
|
-
|
|
|
- this.getVerify = function (obj) {
|
|
|
- if (obj.finished) return;
|
|
|
- get_data("endpoint/heartbeat?flowId=" + flowId, obj.onVerifyResult);
|
|
|
- setTimeout(obj.getVerify, 100, obj);
|
|
|
- };
|
|
|
-
|
|
|
- this.onVerifyResult = function (obj, sta) {
|
|
|
- var parsed = {};
|
|
|
- if (typeof(obj) === "string") {
|
|
|
- parsed = JSON.parse(obj);
|
|
|
- } else {
|
|
|
- parsed = obj;
|
|
|
- }
|
|
|
-
|
|
|
- if (typeof(parsed) === "object") {
|
|
|
- if (parsed.ret === "10000") {
|
|
|
- //ok
|
|
|
- if (parsed.model == null || parsed.model === undefined) {
|
|
|
- executed = true;
|
|
|
- finished = true;
|
|
|
- } else if (typeof(obj.model) === "object") {
|
|
|
- // 没有拿到,继续
|
|
|
- if (obj.model.list != null && obj.model.list.length > 0) {
|
|
|
- var direct = obj.model.list[0];
|
|
|
- if (direct.eventType + "" !== "500") {
|
|
|
- // OK
|
|
|
- executed = true;
|
|
|
- finished = true;
|
|
|
- } else if (direct.arg2 + "" !== "" + $("#handInput").val()) {
|
|
|
- // OK
|
|
|
- executed = true;
|
|
|
- finished = true;
|
|
|
- } else {
|
|
|
- directCount = direct.counter;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- this.resultVerifyTimeout = function (obj) {
|
|
|
- finished = true;
|
|
|
- if (executed) {
|
|
|
- // 执行成功
|
|
|
- } else {
|
|
|
- if (directCount >= 0) {
|
|
|
- get_data("endpoint/ack?counter=" + directCount, function () {
|
|
|
- console.log("撤销操作成功");
|
|
|
- console.log(this);
|
|
|
- });
|
|
|
- directCount = -1;
|
|
|
- send_alert("请求已经超时!请注意,采集端可能没有执行成功。即将撤销您的请求。");
|
|
|
- } else {
|
|
|
- send_alert("请求已经超时!请注意,采集端可能没有执行成功。");
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
})(this);
|
|
|
|