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
package com.shlanbao.tzsc.pms.sch.workorder.controller;
 
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
 
import com.alibaba.fastjson.JSON;
import com.shlanbao.tzsc.base.controller.BaseController;
import com.shlanbao.tzsc.base.model.DataGrid;
import com.shlanbao.tzsc.base.model.PageParams;
import com.shlanbao.tzsc.pms.sch.workorder.beans.FaultWkBean;
import com.shlanbao.tzsc.pms.sch.workorder.service.FaultWkServiceI;
import com.shlanbao.tzsc.utils.excel.ViewExcel;
/**
 * 
* @ClassName: FaultWkController 
* @Description: 设备故障历史记录
* @author luo 
* @date 2015年10月12日 上午8:38:33 
*
 */
@Controller
@RequestMapping("/pms/faultWk")
public class FaultWkController extends BaseController{
 
    @Autowired
    private FaultWkServiceI faultWkService;
    /**
    * @Title: getFaultWkGrid 
    * @Description: 故障历史记录查询
    * @param bean 条件实体
    * @param pageParams 翻页实体
    * @return DataGrid    返回类型 
    * @throws
     */
    @ResponseBody
    @RequestMapping("/getFaultWkGrid")
    public DataGrid getFaultWkGrid(FaultWkBean bean,PageParams pageParams){
        try {
            return faultWkService.queryFaultWkGrid(bean, pageParams);
        } catch (Exception e) {
            log.error("获取工单机台故障异常", e);
        }
        return null;
    }
    /**
    * @Title: viewExcel 
    * @Description: 故障历史记录Excel导出 
    * @param bean 查询条件
    * @param request
    * @param response
    * @return ModelAndView 返回类型 
    * @throws
     */
    @RequestMapping("/faultWkExcel")
    public ModelAndView viewExcel(FaultWkBean bean,HttpServletRequest request,HttpServletResponse response) {
        Map<String,Object> model = new HashMap<String,Object>();        
        //Excel 列表数据源
        model.put("list", faultWkService.exportFaultWkList(bean,""));    
        model.put("name", "故障历史记录");
        //Excel标题
        model.put("title", new String[]{"机台","班次","故障日期","故障名称","停机时间(分)","停机次数(次)","工单号","运行时长(分)"});
        //Excel标题对应的类的方法名
        model.put("method", new String[]{"getEqp_name","getTeam_name","getDate","getFault_name","getTime","getTimes","getWk_code","getRuntime"});
        //数据源中的Bean
        model.put("class", FaultWkBean.class);
        //设置列宽
        model.put("lineWidth", new Short[]{10,10,10,12,10,10,19,12});
        return new ModelAndView(new ViewExcel(), model);
    }
    
    /**
    * @Title: toFaultWkCount 
    * @Description: 故障历史记录查询
    * @author Rengj
    * @return DataGrid    返回类型 
    * @throws
     */
    @RequestMapping("/toFaultWkStatis")
    public String toFaultWkStatis(FaultWkBean bean,HttpServletRequest request){
        String param = request.getParameter("param");
        List<FaultWkBean> faultList = faultWkService.exportFaultWkList(bean,param);
        param="times";
        List<FaultWkBean> faultList2 = faultWkService.exportFaultWkList(bean,param);
        request.getSession().removeAttribute("faultList");
        request.getSession().setAttribute("faultList", faultList);
        request.getSession().removeAttribute("faultList2");
        request.getSession().setAttribute("faultList2", faultList2);
        return "/pms/sch/faultWk/faultStatis";
    }
    /**
    * @Title: goFaultWkCount 
    * @Description: 故障历史记录查询
    * @author Rengj
    * @return DataGrid    返回类型 
    * @throws
     */
    @ResponseBody
    @RequestMapping("/goFaultWkStatis")
    public String toFaultWkCount(FaultWkBean bean,HttpServletRequest request){
        String param = request.getParameter("param");
        List<FaultWkBean> faultList =(List<FaultWkBean>) request.getSession().getAttribute("faultList");
        List<FaultWkBean> faultList2 =(List<FaultWkBean>) request.getSession().getAttribute("faultList2");
        if("time".equals(param)){
            return JSON.toJSONString(faultList);
        }else
            return JSON.toJSONString(faultList2);
    }
}