严智鑫
2025-08-18 3b65a5dc04be7cdac460c84ebaa38bf009405128
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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
 
<html>
<head>
<script src="tb.js"></script>
<script src="jq.js"></script>
<script src="${ctx}/static/js/ng/tb.js" type="text/javascript"></script>
 
<style>
.table>tbody>tr>td {
    vertical-align: middle;
    /* content:middle; */
     text-align: center;
    font-weight: bold;
    font-size:16px;
    /* border: 1px solid green; */
}
 
.table>thead>tr>th{
    font-weight: bold;
    font-size:20px;
     text-align: center;
}
 
h1 {
    display: inline;
}
 
.s-style {
    font-size: 18px;
    font-weight: bold;
}
 
.s-title {
    font-size: 18px;
    /*font-weight: bold;
     text-align :center; */
    vertical-align: middle;
    text-align: center;
    margin-left:20px;
}
 
.sel-style {
    width: 200px;
    font-size: 20px;
}
 
.span-data {
    font-weight: bold;
    color: red;
}
</style>
 
<script>
 
var rTime = 5000;//自动刷新间隔时间 单位:毫秒
</script>
 
<title>磨边</title>
</head>
<body>
    <div class="content-wrapper">
        <div>
            <section class="content-header">
                <h1>磨边开合</h1>
                <hr style="border:1px solid #E7EDFA;"/>
                <span id="rf_total"></span>
                    <span class="s-title" style="margin-left:0px;">实际时间</span> 
                    <input type="datetime-local" id="starttime" class="mdate" name="starttime" /> 
                    <span>~</span>
                    <input type="datetime-local" id="endtime" class="emdate" name="endtime" />
                    
                    <!-- <span class="s-title">报工时间</span>
                    <input type="date" id="Bstime" class="Bstime" name="Bstime" />
                    <span>~</span>
                    <input type="date" id="Betime" class="Betime" name="Betime" /> -->
                    </select> 
                        <span class="s-title">生产线</span> 
                        <select id="rf_chanxian" class="span_tasktext">
                        <option value="1">磨边1线</option>
                        <option value="2">磨边2线</option>
                        <option value="3">磨边3线</option>
                    </select>
                    </select> 
                        <span class="s-title">磨边机</span> 
                        <select id="rf_mobianji" class="span_tasktext">
                        <option value="0">整线磨边</option>
                        <option value="1">1号磨边</option>
                        <option value="2">2号磨边</option>
                    </select>
                    
                    <span class="s-title">选择班组</span> 
                    <select id="rf_banzu" class="span_tasktext">
                        <option value="0">全部班组</option>
                    </select> 
                    <button id='BBcha' type='button' data-toggle='popover' data-content='' data-trigger='hover' class="btn btn-sm btn-success s-title" onclick="ischaxun()">查询</button>
                    
                    <button id="ms_baipian" class="btn btn-sm btn-success"
                                type='button' onclick="ExportTable();">导出表格</button>
                    <br>
                    <p style="font-size: 20px" id="p_total">
                            查询数据总览: 【共&nbsp;<span id="rNum" class="span-data"></span>&nbsp;条数据】
                            【开合次数:<span id="kaiCount" class="span-data"></span>】
                    </p>
                <ol class="breadcrumb">
                    <li class="active"></li>
                </ol>
            </section>
        </div>
 
        <!-- 上片位信息 -->
        <div>
            <section class="content container-fluid">
                <div class="box" style="overflow: auto;">
                    <div class="box-header"></div>
                    <!-- /.box-header -->
                    <div class="box-body no-padding" id="Edg_info"></div>
                </div>
            </section>
        </div>
        <!-- 弹窗 -->
        <div class="modal fade" id="CZ-info" tabindex="-1" role="dialog"
            aria-labelledby="myModalLabel" aria-hidden="true">
            <form class="form-horizontal" role="form">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <input type='hidden' id="lineprint">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal"
                                aria-hidden="true">&times;</button>
                            <h3 class="modal-title" id="CZ_AlertTitle">撤销操作提示:</h3>
                        </div>
                        <div class="modal-body" style="text-align: left;">
                            <h3 id="CZ_MsgShow">
                                是否确定执行 <span id="CZ_Id" style="font-weight: bold"></span> 号撤销
                                <span id="CZ_NeiRong" style="color: red; font-weight: bold"> </span> 操作?
                            </h3>
                        </div>
                        <div class="modal-footer">
 
                            <button type="button" class="btn btn-primary btn-lg"
                                data-dismiss="modal">取消</button>
 
                            <button type="button" class="btn btn-warning btn-lg"
                                id="CZ_button" onclick="CZ_Submit()">确认</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        <!-- 信息提示 -->
        <div class="modal fade" id="CZ_Msg" tabindex="-1" role="dialog"
            aria-labelledby="myModalLabel" aria-hidden="true">
            <form class="form-horizontal" role="form">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal"
                                aria-hidden="true">&times;</button>
                            <h3 class="modal-title" id="TK_AlertTitle">操作提示:</h3>
                        </div>
                        <div class="modal-body" style="text-align: left;">
                            <h3 id="MsgShow">
                                <span id="CZ_Ming" style="font-weight: bold"></span> <span
                                    id="CZ_Zhuangtai" style="font-weight: bold"></span>
                            </h3>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-primary btn-lg"
                                data-dismiss="modal">确定</button>
                        </div>
                    </div>
                </div>
            </form>
        </div>
        
    </div>
    <!-- /.content-wrapper -->
 
    <!--  希望每次打开都要默认为今天日期+00:00 -->
    <script>
            //默认时间
            var myDate = new Date(), Y = myDate.getFullYear(), M = myDate.getMonth() + 1, D = myDate.getDate();
            //处理月是一位的情况
            if((M + '').length == 1){
                M = '0' + (M + '');
            }
            //处理日是一位的情况
            if((D + '').length == 1){
                D = '0' + (D + '')
            }
            var curDay = Y + '-' + M + '-' + D;
            if(navigator.userAgent.indexOf('Chrome') > -1){
                console.log(curDay);
                $('.mdate').val(curDay+'T00:00:00');
                $('.emdate').val(curDay+'T23:59:59');
            }else{
                console.log(curDay);
                $('.mdate').val(curDay+' 00:00:00');
                $('.emdate').val(curDay+' 23:59:59');
            }
            
            /* $('.Bstime').val(curDay);
            $('.Betime').val(curDay); */
    </script>
    <!-- 表内容显示 -->
    <script>
        var opt = {
            table : {
                style : "width:100%",
                "class" : "table table-striped table-hover"
            },
            columns : [
 
             {
                name : "宽",
                binding : 0,
                //style : "width:5%",
                //    editAble:true,//设置列可编辑
                filter : {}
            //设置列可搜索
            }, {
                name : "高",
                binding : 1,
                //style : "width:8%",
                filter : {}
            }, {
 
                name : "时间",
                binding : 2,
                //style : "width:8%",
                
                filter : {}
            }, {
                name : "线路",
                binding : 3,
                //style : "width:8%",
                filter : {}
            }, {
                name : "片数",
                binding : 4,
                //style : "width:8%",
                filter : {}
            }, {
                name : "班组",
                binding : 5,
                //style : "width:8%",
                filter : {}
            }]
        };
        var opt2 = {
                table : {
                    style : "width:100%",
                    "class" : "table table-striped table-hover"
                },
                columns : [
 
                 {
                    name : "磨边",
                    binding : 0,
                    //style : "width:5%",
                    //    editAble:true,//设置列可编辑
                    filter : {}
                //设置列可搜索
                }, {
                    name : "时间",
                    binding : 1,
                    //style : "width:8%",
                    filter : {}
                }, {
                    name : "线路",
                    binding : 2,
                    //style : "width:8%",
                    filter : {}
                }, {
                    name : "班组",
                    binding : 3,
                    //style : "width:8%",
                    filter : {}
                }, {
                    name : "片数",
                    binding : 4,
                    //style : "width:8%",
                    filter : {}
                }]
        };
    <%String groups = request.getParameter("group");
            if (groups == null)
                groups = "null";
            out.print("var group=" + groups + ";\r\n");%>
        //创建表
        
        /* var a = true;
        var t = false; */
 
        //加载表格内容    
        /*     var zhuangtais=0;
        function fuzhi(No){
            $(".zhuangtai").css("background-color","#5CADFE");
            $(".zhuangtai").eq(No).css("background-color","green");
            zhuangtais=No;
            loadTable();
        } */
        var db;
        var total_num=0;
        var IsAllow=false;
        var cunt=0;
        function AllowQuery(){
            
        }
        // 设置一个每2000毫秒执行一次的定时器
        setInterval(function() {
            if(IsAllow){
                chaxun('1');
            }
        }, 1000);
        function ischaxun(){
            if(!IsAllow){
                IsAllow=true;
            }
            
        }
        function chaxun(trigger){
            var stime = $("#starttime").val();//开始时间
            var etime = $("#endtime").val();//结束时间
            var line = $("#rf_chanxian").val();//线路
            var Edg = $("#rf_mobianji").val();//磨边机
            var banzu = $("#rf_banzu").val();//班组
            if(Edg=="0"){
                //显示磨边机
                 db = createTable(document.getElementById("Edg_info"), opt);
            }else{
                //显示1或2号磨边机
                 db = createTable(document.getElementById("Edg_info"), opt2);
            }
            if ("1"==trigger) {
                if(stime == "" || stime == null){
                    $("#CZ_Msg").modal('toggle');
                    $("#CZ_Ming").html("查询:");
                    $("#CZ_Zhuangtai").html("查询失败,请选择或输入开始时间!");
                    $("#CZ_Zhuangtai").attr("style", "color:red;");
                    return;
                }    
            }else{
                line=group;
            }
            $.ajax({
                type : "post",
                async: false,
                data : {
                    caozuo:"查询",
                    leixing:"磨边开合查询",
                    line : line,
                    stime:stime,
                    etime:etime,
                    trigger:trigger,
                    Edg:Edg,
                    banzu:banzu
                },
                dataType : "json",
                url : "/gmms2/mesview/data/_public_manage",
                success : loadSuccess,
                error : loadError
            });
        }
        
        function loadTable() {
            chaxun('0');
        }
        initBanZu();
        loadTable();
        
        function loadSuccess(data) {
            var d = data;
            var Allcount=0;
            var Rowcount=d.length;
            var a;
            total_num=d.length;
            for (var i = 0; i < d.length; i++) {
                Allcount+=Number(d[i][4]);
            } 
            db.update(d);
            $("#rNum").text(Allcount);
            $("#kaiCount").text(Rowcount);
 
            IsAllow=false;
        }
 
        function loadError(data) {
            //alert("刷新了");
            /* if (a == true) {
                setTimeout(loadTable, 5000);
                a = false;
            } */
            IsAllow=false;
        }
        function initBanZu() {
            var gy ="磨边";
            $.ajax({
                        type : "post",
                        data : {
                            caozuo : "查询",
                            leixing : "班组列表",
                            gongyi : gy
                        },
                        dataType : "json",
                        url :"/gmms2/mesview/data/_public_manage",
                        success : function(data) {
                            d = data;
                            var html = " <option selected=\"selected\"  value='0'>全部班组</option>";
                            $("#rf_banzu").empty();
                            for (var i = 0; i < d.length; i++) {
                                html += " <option  value="+d[i][0]+">"
                                        + d[i][0] + "</option>";
                            }
                            document.getElementById("rf_banzu").innerHTML += html;
 
                            //AddBPShow(2,isshow);
 
                        },
                        error : function(data) {
 
                        }
                    });
        }
        
        //InitLoad();
    </script>
    <!-- 导出表格 -->
    <script>
        function ExportTable() {
            if (total_num < 1) {
                $("#CZ_Msg").modal('toggle');
                $("#cz_Ming").html("导出表格:");
                $("#cz_Zhuangtai").html("无需导出");
                $("#cz_Zhuangtai").attr("style", "color:red;");
                $("#cz_mingxi").html("没有数据,不需要导出!");
                return;
 
            }
            var dt = new Date().getFullYear().toString();
            dt += (new Date().getMonth() + 1).toString();
            dt += new Date().getDate().toString();
            var tName = "磨边开合报表-" + dt + ".xls";
            let    exportFileContent = document.getElementById('Edg_info').outerHTML;
            let    blob = new Blob([ exportFileContent ], {
                type : 'text/plain;charset=utf-8'
            }); // 解决中文乱码问题
            blob = new Blob([ String.fromCharCode(0xFEFF), blob ], {
                type : blob.type
            });
            // 设置链接
            let
            link = window.URL.createObjectURL(blob);
            let
            a = document.createElement('a'); // 创建a标签
            a.download = tName; // 设置被下载的超链接目标(文件名)
            a.href = link; // 设置a标签的链接
            document.body.appendChild(a); // a标签添加到页面
            a.click(); // 设置a标签触发单击事件
            document.body.removeChild(a); // 移除a标签
        }
    </script>
    <!-- 页面定时刷新 暂停 恢复
    <script>
        var interval = setInterval('loadTable()', rTime);//定时刷新
        function refresh() {
            interval = setInterval('loadTable()', rTime);//刷新恢复
        }
 
        function stopRefresh() {
            clearInterval(interval);//停止刷新
        }
 
        $(function() {
 
            $('#CX-info').on('show.bs.modal', function() {
                stopRefresh();
                //alert("停止刷新1");
            });
            
            
        });
    </script> -->
 
    <!-- 操作 -->
    <script>
        //开始
        var current_Id;
        var current_Nr;
        var current_Lx;
        //操作 
        function CaoZuo(Id,CZ_NeiRong,CZ_LeiXing) {
            stopRefresh();
            $("#CZ_NeiRong").text(CZ_NeiRong);
            if (Id == 0) {
                var czmsg = "编号为空,请刷新页面后再次尝试退出操作!";
                $("#CZ_MsgShow").html(czmsg);
                $("#CZ_button").attr("style", "display:none;");
            } else {
                $("#CZ_Id").html(Id);
                current_Id=Id;
                current_Nr=CZ_NeiRong;
                current_Lx=CZ_LeiXing;
            }
            $('#CZ-info').modal('toggle');
 
        }
 
        function CZ_Submit() {
            if (current_Id == "" || current_Id == 0) {
                return;
            }
                $.ajax({
                    async : true,
                    //cache:false,
                    type : "POST",
                    url : "/gmms2/mesview/data/_cangchu_mangage",
                    dataType : 'text',
                    data : {
                        
                        yemian:"半成品仓储",
                        caozuo:current_Nr,
                        leixing:current_Lx,
                        Id : current_Id
                        
                    },
                    success : czSuccess,
                    error : czError
                });
            //}
            
        }
 
        function czSuccess(data) {
            var d = data;
            d = d.trim();
            $('#CZ-info').modal('hide');
            if (d != 1) {
                czError;
            } else {
                loadTable();
            }
        }
 
        function czError(data) {
            $("#CZ_Msg").modal('toggle');
            $("#CZ_Ming").html(""+current_Nr+"操作");
            $("#CZ_Zhuangtai").html("执行失败,请检查原因!");
            $("#CZ_Zhuangtai").attr("style", "color:red;");
        }
    </script>
 
    
 
    
 
</body>
 
 
</html>