|
@@ -132,6 +132,91 @@ function get_stop_scheudle1() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+function show_clear_panel(){
|
|
|
+ $("#clearModal").modal('show');
|
|
|
+}
|
|
|
+
|
|
|
+var executed = false;
|
|
|
+var finished = true;
|
|
|
+var directCount = -1;
|
|
|
+
|
|
|
+function clear_one_data(){
|
|
|
+ executed = false;
|
|
|
+ directCount = -1;
|
|
|
+ finished = true;
|
|
|
+ var hand = $("#handInput").val();
|
|
|
+ if(hand.length > 0){
|
|
|
+ var hd = parseInt(hand);
|
|
|
+ }
|
|
|
+ get_data("endpoint/clearBoard?flowId="+flowId+"&handheldId=" + hd, clearSuccess);
|
|
|
+}
|
|
|
+
|
|
|
+function clearSuccess(obj, sta){
|
|
|
+ console.warn("------- 手持设备清空 ----------");
|
|
|
+ console.warn(this);
|
|
|
+ send_alert("发送清空请求成功, 正在等待采集端进行处理...");
|
|
|
+ finished = false;
|
|
|
+ setTimeout(on_timeout_clear, 5000);
|
|
|
+ setTimeout(recurseget,300);
|
|
|
+ //var output = first_success(this, obj);
|
|
|
+}
|
|
|
+
|
|
|
+function recurseget(){
|
|
|
+ if(finished) return;
|
|
|
+ get_data("endpoint/heartbeat?flowId=" + flowId, onheart);
|
|
|
+ setTimeout(recurseget,100);
|
|
|
+}
|
|
|
+
|
|
|
+function onheart(obj,sta){
|
|
|
+ var ouy = {};
|
|
|
+ if(typeof(obj) === "string"){
|
|
|
+ ouy = JSON.parse(obj);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ if(typeof(obj) === "object"){
|
|
|
+ if(ouy.ret === "10000"){
|
|
|
+ //ok
|
|
|
+ if(ouy.model == null || ouy.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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+function on_timeout_clear(){
|
|
|
+ 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("请求已经超时!请注意,采集端可能没有执行成功。");
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
function get_stop_scheudle() {
|
|
|
get_data("fcWorkSchedule/stopSchedule?userId="+userId+"scheduleId=" + scheduleId, stopSuccess);
|
|
|
|