package com.shlanbao.tzsc.pms.qm.onlineCheck.controller; import java.text.ParseException; import java.util.ArrayList; import java.util.List; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; 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 com.alibaba.fastjson.JSON; import com.shlanbao.tzsc.base.controller.BaseController; import com.shlanbao.tzsc.base.mapping.QMFinishedAddTo; import com.shlanbao.tzsc.base.mapping.QmOnlineCheckHsYsd; import com.shlanbao.tzsc.base.mapping.SchWorkorder; import com.shlanbao.tzsc.base.model.DataGrid; import com.shlanbao.tzsc.base.model.Json; import com.shlanbao.tzsc.base.model.PageParams; import com.shlanbao.tzsc.pms.md.FilterCount.SchFilterCountBean; import com.shlanbao.tzsc.pms.qm.onlineCheck.bean.QMOnlineCheckBean; import com.shlanbao.tzsc.pms.qm.onlineCheck.bean.QMOnlineCheckHsYsdBean; import com.shlanbao.tzsc.pms.qm.onlineCheck.bean.QmCxOnlineCHKGY; import com.shlanbao.tzsc.pms.qm.onlineCheck.service.QMOnlineCheckService; import com.shlanbao.tzsc.pms.qm.onlineCheck.service.impl.QmOnlineCheckServiceImpl; import com.shlanbao.tzsc.pms.qm.self.beans.QmAppearanceDataBean; import com.shlanbao.tzsc.pms.sch.workorder.beans.WorkOrderBean; /** * 综合测试台数据 * @author shisihai * */ @Controller @RequestMapping("/pms/onlineCheck") public class OnlineCheckController extends BaseController{ @Autowired private QMOnlineCheckService service; /** 成品检验查询*/ @ResponseBody @RequestMapping("/getList") public DataGrid getList(WorkOrderBean orderBean,String orderType,PageParams pageParams){ try { orderBean.setParam("cp"); DataGrid grid = service.productqueryList(orderBean,pageParams); return grid; } catch (Exception e) { log.error(message, e); } return null; } /** 成品检验查询*/ @ResponseBody @RequestMapping("/getCxGyList") public DataGrid getCxGyList(WorkOrderBean orderBean,String orderType,PageParams pageParams){ try { orderBean.setParam("cp"); DataGrid grid = service.getCxGyList(orderBean,pageParams); return grid; } catch (Exception e) { log.error(message, e); } return null; } /** 查询详细*/ @ResponseBody @RequestMapping("/getListDetail") public DataGrid getListDetail(String pid,String orderType,PageParams pageParams){ try { DataGrid grid = service.queryDetailList(pid,orderType,pageParams); return grid; } catch (Exception e) { log.error(message, e); } return null; } /** 查询详细(成品)*/ @ResponseBody @RequestMapping("/getProdListDetail") public DataGrid getProdListDetail(String pid,String orderType,PageParams pageParams){ try { DataGrid grid = service.queryProdDetailList(pid,orderType,pageParams); return grid; } catch (Exception e) { log.error(message, e); } return null; } /** 过程检验查询*/ @ResponseBody @RequestMapping("/getProductList") public DataGrid getProductList(WorkOrderBean orderBean,PageParams pageParams){ try { DataGrid grid = service.productqueryList(orderBean,pageParams); return grid; } catch (Exception e) { log.error(message, e); } return null; } @ResponseBody @RequestMapping("/sendMsg") public Json sendMsg(String id,String param){ Json json=new Json(); try { String result = service.sendMsg(id,param); json.setSuccess(true); json.setMsg(result); } catch (Exception e) { json.setMsg(message); } return json; } @ResponseBody @RequestMapping("/sendMsgBz") public Json sendMsgBz(String id,String param){ Json json=new Json(); try { String result = service.sendMsgBz(id,param); json.setSuccess(true); json.setMsg(result); } catch (Exception e) { json.setMsg(message); } return json; } /** * [功能说明]:成品,成型成品 * @author wanchanghuang * @date 2017年4月11日15:43:52 * */ @ResponseBody @RequestMapping("/sendMsgCP") public Json sendMsgCP(String id,String param){ Json json=new Json(); try { service.sendMsgCP(id,param); json.setSuccess(true); json.setMsg("反馈MES成功!"); } catch (Exception e) { json.setMsg(message); } return json; } /** * [功能说明]:成品,成型成品 * @author wanchanghuang * @date 2017年4月11日15:43:52 * */ @ResponseBody @RequestMapping("/sendMESToData") public Json sendMESToData(String id,String param){ Json json=new Json(); try { service.sendMESToData(id,param); json.setSuccess(true); json.setMsg("反馈MES成功!"); } catch (Exception e) { json.setMsg(message); } return json; } /** * [功能说明]:成型在线甘油施加量上传mes * @author bsw * @date 2017年4月11日15:43:52 * */ @ResponseBody @RequestMapping("/sendGYSJLToMES") public Json sendGYSJLToMES(String id,String param){ Json json=new Json(); try { service.sendGYSJLToMES(id,param); json.setSuccess(true); json.setMsg("反馈MES成功!"); } catch (Exception e) { json.setMsg(message); } return json; } /** * [功能说明]:成型成品含水率上传mes * @author bsw * @date 2018年3月6日15:43:52 * */ @ResponseBody @RequestMapping("/sendHSLToMES") public Json sendHSLToMES(String id,String param){ Json json=new Json(); try { service.sendHSLToMES(id,param); json.setSuccess(true); json.setMsg("反馈MES成功!"); } catch (Exception e) { json.setMsg(message); } return json; } /** * 用户组织机构批量分配 * @author Leejean * @create 2014-8-19下午07:22:22 * @param uids 用户ids * @param oids 角色ids * @return * @throws ParseException */ @ResponseBody @RequestMapping("/getJson") public String getJson() throws Exception{ List list= service.getProdJson(); return JSON.toJSONString(list); } /** * 批量删除自检数据 * @author Rengj * */ @ResponseBody @RequestMapping("/deleteProd") public Json deleteProd(String id,String param,HttpServletRequest request){ Json json=new Json(); try { String result = service.deleteProd(id,param,request); json.setSuccess(true); json.setMsg(result); } catch (Exception e) { json.setMsg(message); } return json; } /** * 批量删除成型成品检测数据 * @author Zhouzq * */ @ResponseBody @RequestMapping("/deleteCprod") public Json deleteCprod(String id,String param,HttpServletRequest request){ Json json=new Json(); try { String result = service.deleteCprod(id,param,request); json.setSuccess(true); json.setMsg(result); } catch (Exception e) { json.setMsg(message); } return json; } /** * 批量反馈班长/质检员 * @author Rengj * */ @ResponseBody @RequestMapping("/feedbackProd") public Json feedbackProd(String id,String param){ Json json=new Json(); try { String result = service.updateFeedback(id, param); json.setSuccess(true); json.setMsg(result); } catch (Exception e) { json.setMsg(message); } return json; } /** * 跳转录入含水含末界面 * * Rengj */ @RequestMapping("/goToQmOnlineCheckAppendJsp") public String goToAddFixUserJsp(String id,String param,HttpSession session){ if(!"".equals(id)){ session.setAttribute("parameterIds", id); } if("xj".equals(param)) return "/pms/quality/onlineCheck/qmOnlineCheckXjAppend"; else return "/pms/quality/onlineCheck/qmOnlineCheckAppend"; } /** * 跳转甘油施加量维护界面 * * Rengj */ @RequestMapping("/qmCxOnlineCheckGYEdit") public String qmCxOnlineCheckGYEdit(String id,String code,String gy1,String gy2,HttpSession session){ session.setAttribute("id", id); session.setAttribute("qmocid", code); session.setAttribute("gy1", gy1); session.setAttribute("gy2", gy2); return "/pms/quality/onlineCheck/qmCxOnlineCheckGYEdit"; } /** * 保存含水含末率 * @author Rengj * */ @ResponseBody @RequestMapping("/insertQmFinished") public Json insertQmFinished(QMFinishedAddTo bean){ Json json=new Json(); try { String result = service.insertQmFinished(bean); json.setSuccess(true); json.setMsg(result); } catch (Exception e) { json.setMsg(message); } return json; } /** * 保存甘油施加量 * @author bsw * */ @ResponseBody @RequestMapping("/saveCxOnlineCHKGY") public Json saveCxOnlineCHKGY(QmCxOnlineCHKGY bean){ Json json=new Json(); try { String result = service.saveCxOnlineCHKGY(bean); json.setSuccess(true); json.setMsg(result); } catch (Exception e) { json.setMsg(message); } return json; } /** * 跳转录入压实端信息录入界面 * * Rengj */ @RequestMapping("/goToYsdAddJsp") public String goToYsdAddJsp(String param){ if("hsl".equals(param)){ return "/pms/quality/onlineCheck/qmOnlineCheckHslAdd"; }else return "/pms/quality/onlineCheck/qmOnlineCheckYsdAdd"; } /** * 保存含水率/压实端数据 * @author Rengj * */ @ResponseBody @RequestMapping("/saveYsd") public Json insertQmYsd(QMOnlineCheckHsYsdBean bean){ Json json=new Json(); try { service.saveOnHsYsd(bean, ""); json.setSuccess(true); json.setMsg("保存成功"); } catch (Exception e) { json.setMsg(message); } return json; } /** * 查询含水含末率 * @author Rengj * */ @ResponseBody @RequestMapping("/getYsdList") public DataGrid getHslYsdList(QMOnlineCheckHsYsdBean bean,PageParams pageParams){ try { DataGrid grid = service.queryYsdList(bean,pageParams); return grid; } catch (Exception e) { log.error(message, e); } return null; } /** * 查询含水含末率 * @author Rengj * */ @ResponseBody @RequestMapping("/getHslList") public DataGrid getHslList(QMOnlineCheckHsYsdBean bean,PageParams pageParams){ try { DataGrid grid = service.queryHslList(bean, pageParams); return grid; } catch (Exception e) { log.error(message, e); } return null; } /** * 压实端反馈mes * @author Rengj * */ @ResponseBody @RequestMapping("/sendYsdMsg") public Json sendYsdMsg(String id,String param){ Json json=new Json(); try { String result = service.sendYsdMsg(id); json.setSuccess(true); json.setMsg(result); } catch (Exception e) { json.setMsg(message); } return json; } /** * 删除压实端数据 * @author Rengj * */ @ResponseBody @RequestMapping("/deleteYsd") public Json deleteYsd(String id,String param,HttpServletRequest request){ Json json=new Json(); try { String result = service.deleteYsdMsg(id,param,request); json.setSuccess(true); json.setMsg(result); } catch (Exception e) { json.setMsg(message); } return json; } /** * 压实端数据反馈班长/回退质检员 * @author Rengj * */ @ResponseBody @RequestMapping("/sendMonitorOrInspector") public Json sendMonitorOrInspector(String id,String param){ Json json=new Json(); try { String result = service.sendMonitorOrInspector(id, param); json.setSuccess(true); json.setMsg(result); } catch (Exception e) { json.setMsg(message); } return json; } /** * 跳转超标支数录入界面 * * Rengj */ @RequestMapping("/goToOverproofAddJsp") public String goToOverproofAddJsp(String ids,String param, HttpSession session){ session.setAttribute("ids", ids); session.setAttribute("parameterIds", ids); if("edit".equals(param)){ session.setAttribute("finshed",service.queryFisaList(ids)); return "/pms/quality/onlineCheck/qmOnlineCheckEdit"; }else return "/pms/quality/onlineCheck/qmOnlineCheckOverproof"; } @RequestMapping("/goToAddJsp") public String goToAddJsp(String ids,String param, HttpSession session){ //session.setAttribute("ids", ids); return "/pms/quality/onlineCheck/goToAddJsp"; } @RequestMapping("/goToAddJsp2") public String goToAddJsp2(String ids,String param, HttpSession session){ //session.setAttribute("ids", ids); return "/pms/quality/onlineCheck/goToAddJsp2"; } @RequestMapping("/goToAddJsp3") public String goToAddJsp3(String ids,String param, HttpSession session){ //session.setAttribute("ids", ids); return "/pms/quality/onlineCheck/goToAddJsp3"; } @RequestMapping("/goToAddJsp4") public String goToAddJsp4(String ids,String param, HttpSession session){ //session.setAttribute("ids", ids); return "/pms/quality/onlineCheck/goToAddJsp4"; } @ResponseBody @RequestMapping("/getorder") public String getorder(WorkOrderBean bean,HttpSession session){ // bean.setId(String.valueOf(session.getAttribute("ids"))); String result = service.getorder(bean); return result; } @ResponseBody @RequestMapping("/getorderRoller") public String getorderRoller(WorkOrderBean bean,HttpSession session){ // bean.setId(String.valueOf(session.getAttribute("ids"))); String result = service.getorderRoller(bean); return result; } @ResponseBody @RequestMapping("/addorder") public Json addorder(QMOnlineCheckBean bean){ Json json=new Json(); try { if (bean.getInspectionType()==3) { service.addorder(bean); }else if(bean.getInspectionType()==2){ service.addorder1(bean); }else { service.addorder2(bean); } json.setMsg("新增成功!"); json.setSuccess(true); } catch (Exception e) { log.error(message, e); json.setMsg("新增失败!"); json.setSuccess(false); } return json; } /** * 保存超标支数 * @author Rengj * */ @ResponseBody @RequestMapping("/saveOverproof") public Json saveOverproof(QMOnlineCheckBean bean,HttpSession session){ bean.setId(String.valueOf(session.getAttribute("ids"))); Json json=new Json(); try { String result = service.saveOverProof(bean); session.removeAttribute("ids"); json.setSuccess(true); json.setMsg(result); } catch (Exception e) { json.setMsg(message); } return json; } /** * 跳转更改缺陷检测时间界面 * * Rengj */ @RequestMapping("/goToEditCheckTime") public String goToEditCheckTime(String ids,HttpServletRequest request){ request.getSession().setAttribute("onlineIds", ids); return "/pms/quality/self/checkTimeEdit"; } /** * 保存修改检测时间 * @author Rengj * @return */ @ResponseBody @RequestMapping("/addCheckTime") public Json addCheckTime(String stim,String etim,HttpServletRequest request){ String result =""; Json json = new Json(); try { String ids= String.valueOf(request.getSession().getAttribute("onlineIds")); result = service.updateCheckTimes(stim, ids); json.setSuccess(true); json.setMsg(result); request.getSession().removeAttribute("onlineIds"); } catch (Exception e) { log.error("修改运行时间", e); json.setMsg(result); } return json; } /** * 含水数据追加到机台 * @author Rengj * */ @ResponseBody @RequestMapping("/additionalProd") public Json additionalProd(String id,String param){ Json json=new Json(); try { String result = service.additionalProd(id, param); json.setSuccess(true); json.setMsg(result); } catch (Exception e) { json.setMsg(message); } return json; } @ResponseBody @RequestMapping("/sendRequest") public Json sendRequest(String sts,String date,String shift){ Json json=new Json(); try { service.sendRequest(sts,date,shift); json.setSuccess(true); json.setMsg("请求成功!!!"); } catch (Exception e) { json.setMsg("请求失败!!!"); } return json; } }