zhuguifei
2026-03-10 2c1fd10c6fbabb8e9f0e9f07fe66fb36c008e883
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
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<html>
<head>
    <title>设备点检</title>
    <jsp:include page="../../../initlib/initAll.jsp"></jsp:include>
    <link href="${pageContext.request.contextPath}/css/toptoolbar.css" rel="stylesheet" type="text/css"/>
 
    <script type="text/javascript">
        function dateFomat(value) {
            var date = value;
            var year = date.getFullYear().toString();
            var month = (date.getMonth() + 1);
            var day = date.getDate().toString();
            var hour = date.getHours().toString();
            var minutes = date.getMinutes().toString();
            var seconds = date.getSeconds().toString();
            if (month < 10) {
                month = "0" + month;
            }
            if (day < 10) {
                day = "0" + day;
            }
            if (hour < 10) {
                hour = "0" + hour;
            }
 
            if (minutes < 10) {
                minutes = "0" + minutes;
            }
            if (seconds < 10) {
                seconds = "0" + seconds;
            }
            return year + "-" + month + "-" + day + " " + hour + ":" + minutes + ":" + seconds;
        }
 
        function dateFomatYYYYMMDD(value) {
            var date = value;
            var year = date.getFullYear().toString();
            var month = (date.getMonth() + 1);
            var day = date.getDate().toString();
            if (month < 10) {
                month = "0" + month;
            }
            if (day < 10) {
                day = "0" + day;
            }
            return year + "-" + month + "-" + day;
        }
    </script>
    <script type="text/javascript">
        var plan_id = null; //维保计划id
        var orderDetailId = null;//维保计划详细项id
        var dataGrid = null;
        var param = null;
        $(function () {
            //初始化时间
            var today = new Date();
            var month = today.getMonth() + 1;
            if (month < 10) {
                month = ("0" + month);
            }
            var day = today.getDate();
            if (day < 10) {
                day = ("0" + day);
            }
            var date = today.getFullYear() + "-" + month + "-" + day;//获取当月最后一天日期
            $("#date1").datebox("setValue", date);
            $("#date2").datebox("setValue", date);
            dataGrid = $('#dataGrid').datagrid({
                fit: true,
                fitColumns: true,
                border: false,
                pagination: true,
                idField: 'id',
                striped: true,
                rownumbers: true,
                remoteSort: false,
                pageSize: 10,
                pageList: [10, 20, 30, 40, 50],
                sortName: 'id',
                sortOrder: 'desc',
                singleSelect: true,
                checkOnSelect: true,
                selectOnCheck: false,
                nowrap: false,
                showPageList: false,
                columns: [[{
                    field: 'id',
                    title: '编号',
                    width: 100,
                    checkbox: true
                }, {
                    field: 'shop_name',
                    title: '车间名称',
                    width: 70,
                    hidden: true
                }, {
                    field: 'type',
                    title: '维保类型',
                    width: 70,
                    align: 'center',
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "轮保计划";
                        } else if (value == 2) {
                            return "润滑计划";
                        } else if (value == 3) {
                            return "检修计划";
                        } else if (value == 4) {
                            return "保养计划";
                        } else if (value == 5) {
                            return "点检计划";
                        }
                    }
                }, {
                    field: 'eqp_name',
                    title: '设备名称',
                    width: 120,
                    align: 'center'
                }, {
                    field: 'shift_name',
                    title: '班次',
                    width: 50,
                    align: 'center',
                    sortable: true
                }/* ,{
                    field : 'attr2',
                    title : '检验周期',
                    align:'center',
                    width : 60
                } */, {
                    field: 'attr1',
                    title: '检验类型',
                    align: 'center',
                    width: 60,
                    formatter: function (value, row, index) {
                        if (value == 1) {
                            return "月检";
                        } else if (value == 2) {
                            return "周检";
                        } else if (value == 3) {
                            return "日检";
                        } else if (value == 4) {
                            return "年检";
                        } else if (value == 5) {
                            return "每班";
                        }
                    }
                }, {
                    field: 'plan_stime',
                    title: '计划开始时间',
                    width: 120,
                    align: 'center',
                    sortable: true,
                    formatter: function (value, row, index) {
                        var unixTimestamp = new Date(value);
                        return dateFomat(unixTimestamp);
                    }
 
                }, {
                    field: 'plan_times',
                    title: '计划维护时长/小时',
                    align: 'center',
                    width: 100,
                    align: 'center',
                    sortable: true
                }, {
                    field: 'plan_name',
                    title: '制单人',
                    align: 'center',
                    width: 65,
                    align: 'center'
                }, {
                    field: 'last_stime',
                    title: '实际开始时间',
                    align: 'center',
                    width: 120,
                    hidden: true,
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (value != null && value != "") {
                            var unixTimestamp = new Date(value);
                            return dateFomat(unixTimestamp);
                        } else {
                            return "";
                        }
                    }
                }, {
                    field: 'last_etime',
                    title: '实际结束时间',
                    align: 'center',
                    width: 120,
                    sortable: true,
                    formatter: function (value, row, index) {
                        if (value != null && value != "") {
                            var unixTimestamp = new Date(value);
                            return dateFomat(unixTimestamp);
                        } else {
                            return "";
                        }
 
                    }
                }, {
                    field: 'sh_status',
                    title: '状态',
                    align: 'center',
                    width: 50,
                    formatter: function (value, row, index) {
                        var status = "";//0:默认 1:正在保养  2:保养完成 3:反馈MES
                        switch (value) {
                            case 0:
                                status = "下发";
                                break;
                            case 1:
                                status = "<font color='blue'>已完成</font> ";
                                break;
                            /* case 2:
                                status="<font color='blue'>已完成</font>";
                                break;
                            case 3:
                                status="<font color='green'>已反馈MES</font>";
                                break; */
                        }
                        return status;
                    }
                }]],
                toolbar: '#toolbar',
                url: "${pageContext.request.contextPath}/pms/eqpMaintain/queryMaintainPlan.do",
                queryParams: $("#searchForm").form("getData"),
                onLoadError: function (data) {
                    $.messager.show('提示', "查询保养计划异常", 'error');
                },
                onLoadSuccess: function () {
                    //$(this).datagrid('tooltip');
                }, onRowContextMenu: function (e, rowIndex, rowData) {
                    plan_id = rowData.id;
                    e.preventDefault();
                    $(this).datagrid('unselectAll').datagrid('uncheckAll');
                    $(this).datagrid('selectRow', rowIndex);
                    $('#editPlanMenu').menu('show', {
                        left: e.pageX - 10,
                        top: e.pageY - 5
                    });
                }, onClickRow: function (rowIndex, rowData) {
                    getParam(rowData.id, rowData.eqp_id, rowData.type);
                }
            });
            param = $('#paramGrid').datagrid({
                rownumbers: true,
                fit: true,
                fitColumns: false,//fitColumns= true就会自动适应宽度(无滚动条)
                //width:$(this).width()-252,
                border: false,
                pagination: false,
                idField: 'id',
                striped: true,
                remoteSort: false,
                pageSize: 100,
                pageList: [80, 100],
                singleSelect: true,
                checkOnSelect: false,
                selectOnCheck: false,
                nowrap: true,
                showPageList: false,
                columns: [[{
                    field: 'id',
                    title: 'id',
                    width: 120,
                    hidden: true
                }, {
                    field: 'jobNo',
                    title: '序号',
                    width: 30,
                    align: 'center',
                    sortable: true
                }, {
                    field: 'maintMethod',
                    title: '点检方法',
                    width: 150,
                    align: 'center'
                }, {
                    field: 'jobStandard',
                    title: '判定标准',
                    width: 250,
                    align: 'center'
                }, {
                    field: 'reviewer',
                    title: '任务角色',
                    width: 100,
                    align: 'center'
                }, {
                    field: 'completeStatus',
                    title: '完成情况',
                    align: 'center',
                    width: 100,
                    formatter: function (value, row, index) {
                        /* 0未完成   1完成  3-后期处理 */
                        if (value == 0) {
                            return '<span style="color:red">未完成<span>';
                        } else {
                            return value;
                        }
                    }
                }, {
                    field: 'checkResult',
                    title: '检查情况',
                    align: 'center',
                    width: 60
                }, {
                    field: 'completeby',
                    title: '完成人',
                    width: 100,
                    align: 'center'
                }]],
                onLoadSuccess: function () {
                    $(this).datagrid('tooltip');
                }/* ,
                //右键事件
                onRowContextMenu : function(e, rowIndex, rowData) {
                    orderDetailId=rowData.id;
                    e.preventDefault();
                    $(this).datagrid('unselectAll').datagrid('uncheckAll');
                    $(this).datagrid('selectRow', rowIndex);
                    $('#editPlanParamMenu').menu('show', {
                        left : e.pageX-10,
                        top : e.pageY-5
                    });
                } */
 
            });
        });
 
        // 查询设备保养计划
        function queryWCPlan() {
            dataGrid.datagrid({
                url: "${pageContext.request.contextPath}/pms/eqpMaintain/queryMaintainPlan.do",
                queryParams: $("#searchForm").form("getData"),
                onLoadError: function (data) {
                    $.messager.show('提示', "查询保养计划异常", 'error');
                }
            });
            $('#dataGrid').datagrid('clearSelections');
        }
 
        //获取维保详细
        function getParam(id, eqpid, type) {
            plan_id = id;
            param.datagrid({
                url: "${pageContext.request.contextPath}/pms/eqpMaintain/queryMaintainInfo.do?ewcpId=" + id + "&des=" + eqpid + "&teamName=" + type
            });
        }
 
        //完成维保计划
        function finishPlan() {
            //按钮是否点击标志(默认为true:可被点击)
            var isClick = true;
            //未点击过则执行里面的内容
            if (isClick) {
                //改变为点击无效状态
                isClick = false;
                $.post('${pageContext.request.contextPath}/pms/eqpMaintain/finishMaintainPlan.do', {id: plan_id},
                    function (json) {
                        //恢复点击有效状态
                        isClick = true;
                        if (json.success) {
                            $.messager.show('提示', json.msg, 'info');
                            queryWCPlan();
                        } else {
                            $.messager.show('提示', json.msg, 'info');
                        }
                    }, "JSON");
            }
        }
 
        //添加维修呼叫记录
        function addCallInfo() {
            var dialog = parent.$.modalDialog({
                title: '维修呼叫',
                width: 750,
                height: 420,
                href: '${pageContext.request.contextPath}/pms/equ/maintain/chooseMaintenanceman.jsp',
                buttons: [{
                    text: '选择',
                    iconCls: 'icon-standard-disk',
                    handler: function () {
                        var row = dialog.find("#maintencemanGrid").datagrid('getSelected');
                        if (row) {
                            $.post("${pageContext.request.contextPath}/pms/eqpMaintain/addCallInfo.do", {
                                id: plan_id,
                                rId: row.userId,
                                rName: row.userName,
                                rType: row.typeId
                            }, function (json) {
                                if (json.success) {
                                    $.messager.show('提示', json.msg, 'info');
                                    dialog.dialog('destroy');
                                } else {
                                    $.messager.show('提示', json.msg, 'error');
                                    dialog.dialog('destroy');
                                }
                            }, "JSON");
                        }
                    }
                }]
            });
        };
 
 
        /**清空查询条件*/
        function clearForm() {
            $("#searchForm input").val(null);
            $("#type").val("5");
        };
 
 
        /* 反馈MES */
        function sendMes() {
            var rows = dataGrid.datagrid('getChecked');
            var ids = [];
            if (rows.length > 0) {
                parent.$.messager.confirm('确认', '确定将选中数据反馈MES吗?', function (r) {
                    if (r) {
                        for (var i = 0; i < rows.length; i++) {
                            ids.push(rows[i].id);
                        }
                        parent.$.messager.progress({
                            title: '提示',
                            text: '数据处理中,请稍后....'
                        });
                        $.post('${pageContext.request.contextPath}/pms/eqpMaintain/dasSendEquipmentWorkOrderResult.do',
                            {
                                ids: ids.join(',')
                            }, function (json) {
                                parent.$.messager.progress('close');
                                if (json.success) {
                                    $.messager.show('提示', json.msg, 'info');
                                } else {
                                    $.messager.show('提示', json.msg, 'info');
                                }
                            }, "JSON");
                    }
                });
            } else {
                parent.$.messager.show({
                    title: '提示',
                    msg: '请选择数据!!'
                });
            }
 
        }
 
        //修改维保计划详细
        function goToEditEqpOrderDetail() {
            //按钮是否点击标志(默认为true:可被点击)
            var isClick = true;
            var dialog = parent.$.modalDialog({
                title: '维保计划小项信息',
                width: 750,
                height: 420,
                href: '${pageContext.request.contextPath}/pms/eqpMaintain/goToEditParamsDetailJsp.do?id=' + orderDetailId,
                buttons: [{
                    text: '保存',
                    iconCls: 'icon-standard-disk',
                    handler: function () {
                        var f = dialog.find('#form');
                        if (f.form("validate")) {
                            //未点击过则执行里面的内容
                            if (isClick) {
                                //改变为点击无效状态
                                isClick = false;
                                $.post("${pageContext.request.contextPath}/pms/eqpMaintain/editParamsBean.do", f.form("getData"), function (json) {
                                    //恢复点击有效状态
                                    isClick = true;
                                    if (json.success) {
                                        $.messager.show('提示', json.msg, 'info');
                                        dialog.dialog('destroy');
                                        getParam(plan_id);
                                    } else {
                                        $.messager.show('提示', json.msg, 'error');
                                    }
                                }, "JSON");
                            }
                        }
 
                    }
                }]
            });
        }
 
 
        function deleteWCPlan() {
            //按钮是否点击标志(默认为true:可被点击)
            var isClick = true;
            var rows = dataGrid.datagrid('getChecked');
            var ids = [];
            if (rows.length > 0) {
                parent.$.messager.confirm('确认', '确定将选中数据删除吗?', function (r) {
                    if (r) {
                        for (var i = 0; i < rows.length; i++) {
                            ids.push(rows[i].id);
                        }
                        parent.$.messager.progress({
                            title: '提示',
                            text: '数据处理中,请稍后....'
                        });
                        //未点击过则执行里面的内容
                        if (isClick) {
                            //改变为点击无效状态
                            isClick = false;
                            $.post('${pageContext.request.contextPath}/pms/eqpMaintain/delMainTainPlan.do',
                                {
                                    ids: ids.join(',')
                                }, function (json) {
                                    //恢复点击有效状态
                                    isClick = true;
                                    parent.$.messager.progress('close');
                                    if (json.success) {
                                        $.messager.show('提示', json.msg, 'info');
                                        queryWCPlan();
                                    } else {
                                        $.messager.show('提示', json.msg, 'info');
                                    }
                                }, "JSON");
                        }
                    }
                });
            } else {
                parent.$.messager.show({
                    title: '提示',
                    msg: '请选择数据!!'
                });
            }
        }
    </script>
</head>
<body class="easyui-layout" data-options="fit : true,border : false">
<div data-options="region:'north',border:false,split:true,title:'设备点检计划管理'" style="height:400px;">
    <div id="toolbar" style="display: none;width:100%;">
        <form id="searchForm" style="margin:4px 0px 0px 0px;">
            <div class="topTool">
                <fieldset>
                    <div>
                        <span class="label">计划日期:</span>
                        <span>
                                <input id="date1" name="date1" type="text" class="easyui-datebox" readOnly=true
                                       datefmt="yyyy-MM-dd" style="width:120px"/>
                            </span>
                    </div>
                    <div>
                        <span class="label">到</span>
                        <span>
                                <input id="date2" name="date2" type="text" class="easyui-datebox" readOnly=true
                                       datefmt="yyyy-MM-dd" style="width:120px"/>
                            </span>
                    </div>
                    <div>
                        <span class="label">设备类型:</span>
                        <select name="eqpType"
                                class="easyui-combobox"
                                data-options="panelHeight:'auto',editable:false,width:120">
                            <option value="">全部</option>
                            <option value="卷接机">卷接机</option>
                            <option value="包装机">包装机</option>
                            <option value="成型机">成型机</option>
                            <option value="封箱机">封箱机</option>
                            <option value="发射机">发射机</option>
                        </select>
                    </div>
                    <div>
                        <span class="label">周期:</span>
                        <select name="attr1"
                                class="easyui-combobox"
                                data-options="panelHeight:'auto',editable:false,width:120">
                            <option value="">全部</option>
                            <option value="3">日</option>
                            <option value="2">周</option>
                            <option value="1">月</option>
                            <option value="4">年</option>
                        </select>
                    </div>
                    <div>
                        <span class="label">班次:</span>
                        <select name="attr2"
                                class="easyui-combobox"
                                data-options="panelHeight:'auto',editable:false,width:120">
                            <option value="">全部</option>
                            <option value="1">早</option>
                            <option value="2">中</option>
                            <option value="3">晚</option>
                        </select>
                    </div>
                    <div>
                        <span class="label">状态:</span>
                        <select name="sh_status"
                                class="easyui-combobox"
                                data-options="panelHeight:'auto',editable:false,width:120">
                            <option value="-1">全部</option>
                            <option value="0">下发</option>
                            <option value="1">完成</option>
                        </select>
                        <input id="type" name="type" type="hidden" value="5"/>
                    </div>
                </fieldset>
            </div>
        </form>
        <div class="easyui-toolbar">
            <a onclick="queryWCPlan()" href="javascript:void(0);" class="easyui-linkbutton"
               data-options="plain:true,iconCls:'icon-standard-zoom'">查询</a>
            <a onclick="clearForm();" href="javascript:void(0);" class="easyui-linkbutton"
               data-options="plain:true,iconCls:'icon-standard-table-refresh'">重置</a>
            <a onclick="deleteWCPlan();" href="javascript:void(0);" class="easyui-linkbutton"
               data-options="plain:true,iconCls:'icon-standard-plugin-delete'">删除</a>
            <!-- <a onclick="sendMes();" href="javascript:void(0);" class="easyui-linkbutton" data-options="plain:true,iconCls:'icon-standard-plugin'">反馈MES</a> -->
        </div>
        <!-- 详细项右键菜单 -->
        <div id="editPlanParamMenu" class="easyui-menu" style="width: 80px; display: none;">
            <div onclick="goToEditEqpOrderDetail()" data-options="iconCls:'icon-standard-server-edit'">编辑</div>
        </div>
        <!-- 维保项右键菜单 -->
        <div id="editPlanMenu" class="easyui-menu" style="width: 80px; display: none;">
            <div onclick="finishPlan()" data-options="iconCls:'icon-standard-plugin-add'">完成</div>
            <!-- <div onclick="addCallInfo()" data-options="iconCls:'icon-standard-plugin-error'">维修呼叫</div> -->
        </div>
    </div>
    <table id="dataGrid"></table>
</div>
<div data-options="region:'',border:false">
    <table id="paramGrid"></table>
</div>
</body>
</html>