package com.shlanbao.tzsc.pms.isp.controller;
|
|
import java.util.List;
|
import java.util.Map;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import com.google.gson.Gson;
|
import com.shlanbao.tzsc.base.model.Json;
|
import com.shlanbao.tzsc.pms.sch.workorder.beans.WorkOrderBean;
|
import net.sf.json.JSONObject;
|
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.RequestParam;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
import com.shlanbao.tzsc.base.controller.BaseController;
|
import com.shlanbao.tzsc.pms.isp.beans.BoxerGroup;
|
import com.shlanbao.tzsc.pms.isp.beans.FilterGroup;
|
import com.shlanbao.tzsc.pms.isp.beans.RollerPackerGroup;
|
import com.shlanbao.tzsc.pms.isp.beans.ShooterGroup;
|
import com.shlanbao.tzsc.pms.isp.beans.WorkorderInfoBean;
|
import com.shlanbao.tzsc.pms.isp.service.PmsIspServiceI;
|
|
/**
|
* PMS实时监控监控控制器
|
*
|
* @author Leejean
|
* @create 2015年1月22日下午3:03:24
|
*/
|
@Controller
|
@RequestMapping("/pms/isp")
|
public class PmsIspController extends BaseController {
|
@Autowired
|
private PmsIspServiceI pmsIspService;
|
|
/**
|
* 初始化卷包机组
|
*
|
* @param request
|
* @return
|
* @author Leejean
|
* @create 2015年1月15日上午9:50:17
|
*/
|
@ResponseBody
|
@RequestMapping("/initRollerPackerGroups")
|
public List<RollerPackerGroup> initRollerPackerGroups(HttpServletRequest request) {
|
|
return pmsIspService.initRollerPackerGroups(request);
|
}
|
|
/**
|
* @param type 1:卷烟机工单2:包装机工单3:封箱机工单4:成型机工
|
* 卷烟机和包装机为一个整体机组,该机组使用卷烟机工单作为显示
|
* @return
|
* @author Leejean
|
* @create 2015年1月26日上午11:41:07
|
*/
|
@ResponseBody
|
@RequestMapping("/initWorkOrderInfo")
|
public List<WorkOrderBean> initWorkOrderInfo(Long type) {
|
return pmsIspService.initRollerPackerGroupWorkOrderInfo(type);
|
}
|
|
/**
|
* 初始化封箱机
|
*
|
* @param request
|
* @return
|
* @author Leejean
|
* @create 2015年1月15日上午9:50:17
|
*/
|
@ResponseBody
|
@RequestMapping("/initBoxerGroups")
|
public List<BoxerGroup> initBoxerGroups(HttpServletRequest request) {
|
return pmsIspService.initBoxerGroups(request);
|
}
|
|
/**
|
* 初始化发射机
|
*
|
* @param request
|
* @return
|
* @author Leejean
|
* @create 2015年1月15日上午9:50:17
|
*/
|
@ResponseBody
|
@RequestMapping("/initShootererGroups")
|
public List<ShooterGroup> initShootererGroups(HttpServletRequest request) {
|
return pmsIspService.initShootererGroups(request);
|
}
|
|
/**
|
* 初始化成型机
|
*
|
* @param request
|
* @return
|
* @author Leejean
|
* @create 2015年1月15日上午9:50:17
|
*/
|
@ResponseBody
|
@RequestMapping("/initFilterGroups")
|
public List<FilterGroup> initFilterGroups(HttpServletRequest request) {
|
return pmsIspService.initFilterGroups(request);
|
}
|
|
/**
|
* 获得所有卷包机组数据
|
*
|
* @return
|
* @author Leejean
|
* @create 2015年1月16日上午9:05:57
|
*/
|
@ResponseBody
|
@RequestMapping("/getAllRollerPackerDatas")
|
public Json getAllRollerPackerDatas() {
|
Json json = new Json();
|
List<Map> list = pmsIspService.getAllRollerPackerDatas();
|
|
try {
|
if (list != null && list.size() > 0) {
|
Gson gson = new Gson();
|
String s = gson.toJson(list);
|
json.setMsg(s);
|
json.setSuccess(true);
|
// log.info("卷包设备实时数据:" + list.toString());
|
} else {
|
json.setMsg("获取数据失败!请重试!");
|
}
|
|
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
return json;
|
}
|
|
/**
|
* 获得所有成型机组数据
|
*
|
* @return
|
* @author Leejean
|
* @create 2015年1月16日上午9:05:57
|
*/
|
@ResponseBody
|
@RequestMapping("/getAllFilterDatas")
|
public Json getAllFilterDatas() {
|
Json json = new Json();
|
List<Map> list = pmsIspService.getAllFilterDatas();
|
|
try {
|
if (list != null && list.size() > 0) {
|
Gson gson = new Gson();
|
String s = gson.toJson(list);
|
json.setMsg(s);
|
json.setSuccess(true);
|
// log.info("成型设备实时数据:" + list.toString());
|
} else {
|
json.setMsg("获取数据失败!请重试!");
|
}
|
|
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
return json;
|
}
|
|
|
/**
|
* @param map 设备相关信息 equCode 设备code
|
* @return
|
* @desc 获取单个设备的详细实时数据
|
* @author zgf
|
*/
|
@ResponseBody
|
@RequestMapping("/getEquDetailRealData")
|
public Json getEquDetailRealData(@RequestParam Map<Object, Object> map) {
|
Map<Object, Object> data = pmsIspService.getEquDetailRealData(map);
|
Json json = new Json();
|
try {
|
if (!data.isEmpty()) {
|
|
json.setMsg(JSONObject.fromObject(data).toString());
|
json.setSuccess(true);
|
} else {
|
json.setMsg("获取数据失败!请重试!");
|
}
|
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
|
return json;
|
}
|
|
|
/**
|
* 获取条烟输送实时数据
|
* @return
|
*/
|
@ResponseBody
|
@RequestMapping("/getFormatted")
|
public Json getFormatted() {
|
Json json = new Json();
|
Map map = pmsIspService.getFormatted();
|
try {
|
if (map != null && map.size() > 0) {
|
Gson gson = new Gson();
|
String s = gson.toJson(map);
|
json.setMsg(s);
|
json.setSuccess(true);
|
// log.info("卷包设备实时数据:" + list.toString());
|
} else {
|
json.setMsg("获取数据失败!请重试!");
|
}
|
|
|
} catch (Exception e) {
|
e.printStackTrace();
|
}
|
return json;
|
}
|
|
@RequestMapping("/board")
|
public String board(HttpServletRequest request){
|
return "pms/isp/board";
|
}
|
}
|