1
hao
2025-05-20 8e24c6fea30d9b179375ee2893710cdec2443b13
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
//物料入库看板
var interval_do=null;//页面刷新定时器
clearInterval(interval_do);
 
var MyMarhq = '';//滚动定时器
clearInterval(MyMarhq);
 
$(function() {
    doData()
    interval_do = setInterval(getKanbanData,3000 * 1000); // 启动,执行默认方法
})
 
function doData(){
    tableBox()
}
 
function tableBox(){
    var Items = KANBAN_DATA.data
 
    $('.tbl-body tbody').empty();
    $('.tbl-header tbody').empty();
    var str = '';
    var style = '';
    var border = '';
    var style1 = '';
    if(Items.length<=15){//不滚动
        $.each(Items,function (i, item) {
            if(i==Items.length-1){
                //style = "style='border-bottom: 2px solid #333399;padding:5px;'";
                border='border-bottom: 2px solid #333399;padding:5px;'
                style = "style='border-bottom: 2px solid #333399;padding:5px;'";
            }else{
                style = "style='padding:5px;'";
            }
            if(item.URGENT_FLAG>0){
                style1 = "style='color:#CC0033;"+border+"'";
            }else{
                style1 = "style='color:#FFFFFF;"+border+"'";
            }
            str = '<tr>'+
                '<td ' + style1 + '>'+isNull(item.综合仓)+'</td>'+
                '<td ' + style1 + '>'+isNull(item.包装车间)+'</td>'+
                '<td ' + style1 + '>'+isNull(item.注塑件仓)+'</td>'+
 
                '</tr>'
            $('.tbl-body tbody').append(str);
            $('.tbl-header tbody').append(str);
        });
    }else{//会滚动
        $.each(Items,function (i, item) {
            style = "style=''";
 
            if(item.URGENT_FLAG>0){
                style1 = "style='color:#CC0033;"+border+"'";
            }else{
                style1 = "style='color:#FFFFFF;"+border+"'";
            }
 
            str = '<tr>'+
                '<td ' + style1 + '>'+isNull(item.综合仓)+'</td>'+
                '<td ' + style1 + '>'+isNull(item.包装车间)+'</td>'+
                '<td ' + style1 + '>'+isNull(item.注塑件仓)+'</td>'+
 
                '</tr>'
            $('.tbl-body tbody').append(str);
            $('.tbl-header tbody').append(str);
        });
    }
    if (MyMarhq != null) {// 判断计时器是否为空-关闭
        clearInterval(MyMarhq);
        MyMarhq = null;
    }
 
    if(Items.length > 15){
        $('.tbl-body tbody').html($('.tbl-body tbody').html()+$('.tbl-body tbody').html());
        $('.tbl-body').css('top', '0');
        var tblTop = 0;
        var speedhq = 50; // 数值越大越慢
        var outerHeight = $('.tbl-body tbody').find("tr").outerHeight();
        function Marqueehq(){
            if(tblTop <= -outerHeight*Items.length){
                tblTop = 0;
            } else {
                tblTop -= 1;
            }
            $('.tbl-body').css('top', tblTop+'px');
        }
 
        MyMarhq = setInterval(Marqueehq,speedhq);
 
        // 鼠标移上去取消事件
        $(".tbl-header tbody").hover(function (){
            clearInterval(MyMarhq);
        },function (){
            clearInterval(MyMarhq);
            MyMarhq = setInterval(Marqueehq,speedhq);
        })
    }
}
 
 
function getKanbanData(){
    $.ajax({
        type : "GET",
        url : context + "/kanban/TOKCSET",
        data : {floor:FLOOR},
        dataType : "json",
        success : function(res) {
            console.log(res)
            if (res.result) {
                KANBAN_DATA=res
                doData()
            } else {
                //clearInterval(interval_do);//错误-关闭定时器
            }
        }
    });
}
//插入样式
function setColor(style,value){
    var bgcolor=''
    if(value=='N'){
 
    }else{
        if(value=="0"){
            bgcolor='background-color:#999999;'
 
        }else if(value=="100"){
            bgcolor='background-color:#33CC99;'
        }else{
            bgcolor='background-color:#FF9900;'
        }
        var s=style.substring(0, style.length-1)
        style = s+bgcolor+"'";
    }
 
    return style
}
 
function isNull(str){
    if(str==null){
        return ""
    }else{
        return str
    }
}