package com.shlanbao.tzsc.pms.sch.workorder.controller; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import com.shlanbao.tzsc.base.interceptor.PMSXmlDataInterceptor; import com.shlanbao.tzsc.base.model.*; import com.shlanbao.tzsc.data.webservice.client.SendMessageClient; import com.shlanbao.tzsc.utils.tools.RedisUtil; import net.sf.json.JSONObject; import org.apache.commons.lang.StringEscapeUtils; 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.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import com.shlanbao.tzsc.base.controller.BaseController; import com.shlanbao.tzsc.pms.sch.workorder.beans.TransmitterOutput; import com.shlanbao.tzsc.pms.sch.workorder.beans.TransmitterWorkOrderBean; import com.shlanbao.tzsc.pms.sch.workorder.beans.WorkOrderBean; import com.shlanbao.tzsc.pms.sch.workorder.service.WorkOrderServiceI; import java.util.HashMap; import java.util.List; import java.util.Map; /** * 工单控制器 * @author Leejean * @create 2014年11月18日下午2:23:51 */ @Controller @RequestMapping("/pms/workorder") public class WorkOrderController extends BaseController { @Autowired private WorkOrderServiceI workOrderService; /** * 查询工单 */ @ResponseBody @RequestMapping("/getAllWorkOrders") public DataGrid getAllWorkOrders(WorkOrderBean workOrderBean,PageParams pageParams){ try { workOrderBean.setParam("1,2,3"); return workOrderService.getAllWorkOrders(workOrderBean,pageParams); } catch (Exception e) { log.error("查询工单异常", e); } return null; } /** * 张璐 2015.10.12 * 查询成型车间工单 */ @ResponseBody @RequestMapping("/getFormingWorkOrders") public DataGrid getFormingWorkOrders(WorkOrderBean workOrderBean,PageParams pageParams){ try { workOrderBean.setParam("4,5"); return workOrderService.getAllWorkOrders(workOrderBean,pageParams); } catch (Exception e) { log.error("查询工单异常", e); } return null; } /** * 查看工单详情 */ @RequestMapping("/goToWorkOrderDetail") public String goToWorkOrderDetail(HttpServletRequest request,String id){ request.setAttribute("workOrderId",id); return "/pms/sch/workorder/workorderDetail"; } /** * 审核工单 * @author wanchanghuang * @create 2018年2月1日8:58:13 * @param id 工单ID * @return */ @ResponseBody @RequestMapping("/checkWorkOrderCX") public Json checkWorkOrderCX(HttpSession session,String id){ Json json = new Json(); try { SessionInfo info=(SessionInfo) session.getAttribute("sessionInfo"); if(info!=null){ log.error("成型机单个审核!!!"+id+" 审核人:"+info.getUser().getName()); String msg = workOrderService.checkWorkOrder(id); if (msg == null){ json.setSuccess(true); json.setMsg("操作成功!"); } else { json.setSuccess(true); json.setMsg("工单:"+msg+"非当日工单,无法审核!"); } }else{ json.setMsg("操作失败!"); } } catch (Exception e) { log.error("审核工单失败", e); json.setMsg("审核工单失败!"); } return json; } /** * 审核工单 * @author Leejean * @create 2014年11月25日下午3:55:56 * @param id 工单ID * @return */ @ResponseBody @RequestMapping("/checkWorkOrder") public Json checkWorkOrder(String id){ Json json = new Json(); try { String msg = workOrderService.checkWorkOrder(id); if (msg == null) { json.setSuccess(true); json.setMsg("操作成功!"); }else { json.setSuccess(true); json.setMsg("工单:"+msg+"非当日工单,无法审核!"); } } catch (Exception e) { log.error("审核工单失败", e); json.setMsg("审核工单失败!"); } return json; } /** * 批量审核工单(成型车间) * @author wanchanghuang * @create 2018年2月1日8:55:44 * @param ids * @return */ @ResponseBody @RequestMapping("/checkWorkOrdersCX") public Json checkWorkOrdersCX(HttpSession session,String ids){ Json json = new Json(); try { SessionInfo info=(SessionInfo) session.getAttribute("sessionInfo"); if(info!=null){ log.error("成型机批量审核!!!"+ids+" 审核人:"+info.getUser().getName()); String msg = workOrderService.checkWorkOrders(ids); if (msg == null) { json.setSuccess(true); json.setMsg("操作成功!"); }else { json.setSuccess(true); json.setMsg(msg); } }else{ json.setMsg("操作失败!"); } } catch (Exception e) { log.error("审核工单失败", e); json.setMsg("审核工单失败!"); } return json; } /** * 批量审核工单(卷包车间) * @author Leejean * @create 2014年11月25日下午3:56:15 * @param ids * @return */ @ResponseBody @RequestMapping("/checkWorkOrders") public Json checkWorkOrders(HttpSession session,String ids){ Json json = new Json(); try { SessionInfo info=(SessionInfo) session.getAttribute("sessionInfo"); if(info!=null){ String msg = workOrderService.checkWorkOrders(ids); if (msg == null) { json.setSuccess(true); json.setMsg("操作成功!"); }else { json.setSuccess(true); json.setMsg(msg); } }else{ json.setMsg("操作失败!"); } } catch (Exception e) { log.error("审核工单失败", e); json.setMsg("审核工单失败!"); } return json; } /** * 修改工单状态(卷包) * @author Leejean * @create 2014年11月25日下午3:56:30 * @param id 工单ID * @param sts 状态 工单状态 * ( * 1,下发
* 2,运行 -->运行时在生产实绩中保存val=0的数据,即采集程序只做update操作
* 3,暂停 -->MES取消撤销工单时
* 4,完成 -->工单完成,更新工单结束时间
* 5,终止 -->错误的工单运行时,执行本操作删除生产实绩相关数据
* 6,结束 -->工单已经反馈
* 7,锁定 -->MES发起撤销时
* 8,撤销 -->MES确定撤销时
* ) * @return */ @ResponseBody @RequestMapping("/editWorkOrderStatus") public Json editWorkOrderStatus(HttpSession session,String id,Long sts){ Json json = new Json(); try { SessionInfo info=(SessionInfo) session.getAttribute("sessionInfo"); if(info!=null){ workOrderService.editWorkOrderStatus(id, sts); json.setSuccess(true); json.setMsg("操作成功!"); //工单写入redis workOrderWriteToRedis(id,sts); }else{ json.setMsg("操作失败!"); } } catch (Exception e) { log.error("修改工单状态失败", e); json.setSuccess(false); json.setMsg("修改工单状态失败!错误原因:"+e.getMessage()); } return json; } /** * @Author bsw * @Description 提前要料时向辅料库发送运行状态 * @Date 2021/8/5 14:18 * @Param [session, ids] * @return com.shlanbao.tzsc.base.model.Json **/ @ResponseBody @RequestMapping("/sendOrderChange") public Json sendOrderChange(HttpSession session,String ids) { Json json = new Json(); try { SessionInfo info=(SessionInfo) session.getAttribute("sessionInfo"); if(info!=null){ String msg = workOrderService.sendOrderChange(ids); if (msg == null) { json.setSuccess(true); json.setMsg("操作成功!"); }else { json.setSuccess(true); json.setMsg(msg); } }else{ json.setMsg("操作失败!"); } } catch (Exception e) { log.error("提前要料失败", e); json.setMsg("提前要料失败!"); } return json; } @ResponseBody @RequestMapping(value = "/sendOrderStatusMsg",method = RequestMethod.POST) public Json sendOrderStatusMsg(String type,String xml){ Json json = new Json(); try{ xml = StringEscapeUtils.unescapeXml(xml); if ("orderSts".equals(type)){ SendMessageClient.SendMsgToOrderStsDetail(xml); PMSXmlDataInterceptor.getInstance().addLog(true,"工单状态反馈", 1, xml); } else if("maintainDetail".equals(type)){ SendMessageClient.SendMaintainDetail(xml); PMSXmlDataInterceptor.getInstance().addLog(true,"设备保养结果反馈", 1, xml); } else if("repairDetail".equals(type)){ SendMessageClient.SendRepairDetail(xml); PMSXmlDataInterceptor.getInstance().addLog(true,"维修工单结果反馈", 1, xml); } else if("FaultDetail".equals(type)){ SendMessageClient.SendRepairOrder(xml); PMSXmlDataInterceptor.getInstance().addLog(true,"维修请求工单反馈", 1, xml); } json.setSuccess(true); json.setMsg("发送成功!"); /** 日志 1-成功 */ }catch (Exception e ){ json.setSuccess(false); if ("orderSts".equals(type)){ json.setMsg("向MES发送工单状态信息失败!"); /** 日志 0-失败*/ PMSXmlDataInterceptor.getInstance().addLog(true,"工单状态反馈", 0, xml,e.getMessage()); } else if("maintainDetail".equals(type)){ json.setMsg("向MES发送保养结果失败!"); PMSXmlDataInterceptor.getInstance().addLog(true,"设备保养结果反馈", 0, xml,e.getMessage()); } else if("repairDetail".equals(type)){ json.setMsg("向MES发送维修结果失败!"); PMSXmlDataInterceptor.getInstance().addLog(true,"维修工单结果反馈", 0, xml,e.getMessage()); } else if("FaultDetail".equals(type)){ json.setMsg("向MES发送维修工单失败!"); PMSXmlDataInterceptor.getInstance().addLog(true,"维修请求工单反馈", 0, xml,e.getMessage()); } } return json; } /** * @title editWorkOrderStatusCX * @description 修改工单状态(成型) * @author bsw * @params [session, id, sts] * @updateTime 10:50 2019/8/5 0005 * @return com.shlanbao.tzsc.base.model.Json **/ @ResponseBody @RequestMapping("/editWorkOrderStatusCX") public Json editWorkOrderStatusCX(HttpSession session,String id,Long sts){ Json json = new Json(); try { SessionInfo info=(SessionInfo) session.getAttribute("sessionInfo"); if(info!=null){ log.error("[修改成型机工单状态修改]:"+sts +" 修改人:"+info.getUser().getName()); workOrderService.editWorkOrderStatus(id, sts); //工单写入redis workOrderWriteToRedis(id,sts); json.setSuccess(true); json.setMsg("操作成功!"); }else{ json.setMsg("操作失败!"); } } catch (Exception e) { log.error("修改工单状态失败", e); json.setSuccess(false); json.setMsg("修改工单状态失败!错误原因:"+e.getMessage()); } return json; } /** * 新增工单页面 * @author Leejean * @create 2014年12月24日下午1:22:48 * @return */ @RequestMapping("/goToOrderAddJsp") public String goToOrderAddJsp(){ return "/pms/sch/workorder/orderAdd"; } /** * @title goToOrderAddJspCX * @description 成型车间工单新增 页面跳转 * @author bsw * @params [] * @updateTime 11:43 2019/9/11 * @return java.lang.String **/ @RequestMapping("/goToOrderAddJspCX") public String goToOrderAddJspCX(){ return "/pms/sch/workorder/orderAddCX"; } /** * 编辑工单页面 * @author Leejean * @create 2014年12月24日下午1:22:48 * @return */ @RequestMapping("/goToOrderEditJsp") public String goToOrderEditJsp(){ return "/pms/sch/workorder/orderEdit"; } /** * 新增工单 * @author Leejean * @create 2014年12月24日下午1:22:48 * @param workOrderBean * @return */ @ResponseBody @RequestMapping("/addOrder") public Json addOrder(WorkOrderBean workOrderBean){ Json json = new Json(); try { workOrderService.addOrder(workOrderBean); json.setSuccess(true); json.setMsg("操作成功!"); } catch (Exception e) { log.error("新增工单失败", e); json.setMsg(e.getMessage()); } return json; } /** * 跳转至工单选择页面 * @author Leejean * @create 2014年12月2日下午6:49:14 * @param request * @param workshop 车间CODE * @return */ @RequestMapping("/goToWorkOrderPickJsp") public String goToWorkOrderPickJsp(HttpServletRequest request,String workshop){ request.setAttribute("workshop", workshop); return "/pms/sch/workorder/workorderPicker"; } /** * 张璐 * 成型实绩添加页面跳转 * @param request * @param workshop * @return */ @RequestMapping("/goToWorkOrderPickJspCX") public String goToWorkOrderPickJspCX(HttpServletRequest request,String workshop){ request.setAttribute("workshop", workshop); return "/pms/sch/workorder/workorderPickerCX"; } /** * 实例化所有运行工单的计数参数 */ @ResponseBody @RequestMapping("/initAllRunnedWorkOrderCalcValues") public Json initAllRunnedWorkOrderCalcValues(){ Json json = new Json(); try { workOrderService.initAllRunnedWorkOrderCalcValues(); json.setSuccess(true); json.setMsg("操作成功!"); } catch (Exception e) { log.error("修改工单状态失败", e); json.setMsg("修改工单状态失败!错误原因:"+e.getMessage()); } return json; } //测试方法================================================================= /** * 新增排班 * @return */ @RequestMapping("/goToPbWork") public String goToPbWork(){ return "/pms/sch/workorder/orderAddPb"; } /** * 跳转到成型车间排班窗口 * @return */ @RequestMapping("/goToPbWorkCX") public String goToPbWorkCX(){ return "/pms/sch/workorder/orderAddPbCX"; } /** * 批量新增排班 */ @ResponseBody @RequestMapping("/addPbWork") public Json addPbWork(WorkOrderBean workOrderBean){ Json json=new Json(); try { workOrderService.addPbWork(workOrderBean); json.setMsg("新增成功!"); json.setSuccess(true); } catch (Exception e) { log.error(message, e); json.setMsg(e.getMessage()); json.setSuccess(false); } return json; } /** * 新增工单 * @return */ @RequestMapping("/goToBatckWork") public String goToBatckWork(){ return "/pms/sch/workorder/orderAddWork"; } /** * 成型车间批量新增工单 * @return */ @RequestMapping("/goToBatckWorkCX") public String goToBatckWorkCX(){ return "/pms/sch/workorder/orderAddWorkCX"; } /** * 发射工单批量新增 * @return */ @RequestMapping("/goToBatckWorkFSJ") public String goToBatckWorkFSJ(){ return "/pms/sch/workorder_FSJ/orderAddWork"; } /** * 删除工单 * @author Leejean * @create 2014年11月25日下午3:56:15 * @param ids * @return */ @ResponseBody @RequestMapping("/deleteWorkOrders") public Json deleteWorkOrders(String ids,String eqpName,String team,String date,String mat,HttpSession session){ Json json = new Json(); try { SessionInfo info=(SessionInfo) session.getAttribute("sessionInfo"); if(info!=null){ workOrderService.deleteWorkOrders(ids,eqpName,team,date,mat,info); json.setSuccess(true); json.setMsg("操作成功!"); }else{ json.setMsg("操作失败!"); } } catch (Exception e) { log.error("审核工单删除", e); json.setMsg("审核工单删除!"); } return json; } /** * 删除工单 * @author Leejean * @create 2014年11月25日下午3:56:15 * @param ids * @return */ @ResponseBody @RequestMapping("/beatchDeleteWorkOrders") public Json beatchDeleteWorkOrders(String ids,String eqpName,String team,String date,String mat,HttpSession session){ Json json = new Json(); try { SessionInfo info=(SessionInfo) session.getAttribute("sessionInfo"); workOrderService.deleteBeatchWorkOrders(ids,eqpName,team,date,mat,info); json.setSuccess(true); json.setMsg("操作成功!"); } catch (Exception e) { log.error("审核工单删除", e); json.setMsg("审核工单删除!"); } return json; } /** * 批量新增工单 */ @ResponseBody @RequestMapping("/saveBatckWork") public Json saveBatckWork(String id, HttpServletRequest request){ Json json=new Json(); try { WorkOrderBean bean = new WorkOrderBean(); bean.setType(Long.parseLong(request.getParameter("type"))); bean.setQty(Double.parseDouble(request.getParameter("qty"))); bean.setUnitId(request.getParameter("unitId")); bean.setMatId(request.getParameter("matId")); bean.setBomVersion(request.getParameter("bomVersion")); bean.setParameterSetRevision(request.getParameter("paramVersion")); bean.setStim(request.getParameter("date1").trim() + " 00:00:00"); bean.setEtim(request.getParameter("date2").trim() + " 23:59:59"); // 填充BEAN String[] eqps =request.getParameter("equipmentId").split(","); boolean mes = true; for (String eqp:eqps) { bean.setEquipmentId(eqp); mes=workOrderService.saveBatckWork(bean); } if(mes){ json.setMsg("新增成功!"); json.setSuccess(true); }else{ json.setMsg("新增失败,没有排班!"); json.setSuccess(false); } } catch (Exception e) { log.error(message, e); json.setMsg(e.getMessage()); json.setSuccess(false); } return json; } /** * 批量新增工单(发射机) */ @ResponseBody @RequestMapping("/saveBatckWorkFSJ") public Json saveBatckWorkFSJ(String id, HttpServletRequest request){ Json json=new Json(); try { String type = request.getParameter("type"); String equipmentId = request.getParameter("equipmentId"); String qty = request.getParameter("qty"); String unitId = request.getParameter("unitId"); String matId = request.getParameter("matId"); String date1=request.getParameter("date1"); String date2=request.getParameter("date2"); TransmitterWorkOrderBean bean = new TransmitterWorkOrderBean(); bean.setOrderType(type); bean.setQty(Double.parseDouble(qty)); bean.setUnit(unitId); bean.setMaterialCode(matId); // 填充BEAN String[] eqps =equipmentId.split(","); boolean mes = true; for (String eqp:eqps) { bean.setEqpId(eqp); mes=workOrderService.saveBatckWorkFSJ(bean,date1,date2); } if(mes){ json.setMsg("新增成功!"); json.setSuccess(true); }else{ json.setMsg("新增失败,没有排班!"); json.setSuccess(false); } } catch (Exception e) { log.error(message, e); json.setMsg("新增失败!"+e.getMessage()); json.setSuccess(false); } return json; } /** * 运行时间 * * @return * Rengj */ @RequestMapping("/goToEditRunTime") public String goToEditRunTime(String ids,HttpSession session){ session.setAttribute("workOrderRunTime", workOrderService.getRuntime(ids)); session.setAttribute("runTimeIds", ids); return "/pms/sch/workorder/runTimeEdit"; } /** * 修改运行时间 * @author Rengj * @return */ @ResponseBody @RequestMapping("/addRunTime") public Json addRunTime(String stim,String etim,HttpSession session){ String result =""; Json json = new Json(); try { String ids= String.valueOf(session.getAttribute("runTimeIds")); result = workOrderService.editRuntime(stim,etim, ids); json.setSuccess(true); json.setMsg(result); session.removeAttribute("runTimeIds"); } catch (Exception e) { log.error("修改运行时间", e); json.setMsg(result); } return json; } /** * 查询发射机工单 */ @ResponseBody @RequestMapping("/getAllFSJOrders") public DataGrid getAllFSJOrders(TransmitterWorkOrderBean workOrderBean,PageParams pageParams){ try { return workOrderService.getAllFSJOrders(workOrderBean,pageParams); } catch (Exception e) { log.error("查询工单异常", e); } return null; } /** * 查看工单详情 */ @RequestMapping("/goToFSJOrderDetail") public String goToFSJOrderDetail(HttpServletRequest request,String id){ request.setAttribute("workOrderId",id); return "/pms/sch/workorder_FSJ/workorderDetail"; } /** * @title checkFSJOrder * @description 发射工单审核 * @author bsw * @params [id] * @updateTime 10:54 2019/8/5 0005 * @return com.shlanbao.tzsc.base.model.Json **/ @ResponseBody @RequestMapping("/checkFSJOrder") public Json checkFSJOrder(String id){ Json json = new Json(); try { workOrderService.checkFSJOrder(id); json.setSuccess(true); json.setMsg("操作成功!"); } catch (Exception e) { log.error("审核工单失败", e); json.setMsg("审核工单失败!"); } return json; } /** * @title checkFSJOrders * @description 批量审核发射工单 * @author bsw * @params [session, ids] * @updateTime 10:55 2019/8/5 0005 * @return com.shlanbao.tzsc.base.model.Json **/ @ResponseBody @RequestMapping("/checkFSJOrders") public Json checkFSJOrders(HttpSession session,String ids){ Json json = new Json(); try { SessionInfo info=(SessionInfo) session.getAttribute("sessionInfo"); if(info!=null){ log.error("发射机工单审核:"+ids+" 审核人:"+info.getUser().getName()); workOrderService.checkFSJOrders(ids); json.setSuccess(true); json.setMsg("操作成功!"); }else{ json.setMsg("操作失败!"); } } catch (Exception e) { log.error("审核工单失败", e); json.setMsg("审核工单失败!"); } return json; } /** * @title editFSJOrderStatus * @description 编辑发射机工单状态 * @author bsw * @params [id, sts] * @updateTime 10:55 2019/8/5 0005 * @return com.shlanbao.tzsc.base.model.Json **/ @ResponseBody @RequestMapping("/editFSJOrderStatus") public Json editFSJOrderStatus(String id,Long sts){ Json json = new Json(); try { workOrderService.editFSJOrderStatus(id, sts); //工单写入redis transmitterWorkOrderWriteToRedis(id,sts); json.setSuccess(true); json.setMsg("操作成功!"); } catch (Exception e) { log.error("修改工单状态失败", e); json.setSuccess(false); json.setMsg("修改工单状态失败!错误原因:"+e.getMessage()); } return json; } /** * @title goToFSJOrderAddJsp * @description 跳转到发射机工单新增页面 * @author bsw * @params [] * @updateTime 10:56 2019/8/5 0005 * @return java.lang.String **/ @RequestMapping("/goToFSJOrderAddJsp") public String goToFSJOrderAddJsp(){ return "/pms/sch/workorder_FSJ/orderAdd"; } /** * @title goToFSJOrderEditJsp * @description 跳转到发射机工单编辑页面 * @author bsw * @params [] * @updateTime 10:56 2019/8/5 0005 * @return java.lang.String **/ @RequestMapping("/goToFSJOrderEditJsp") public String goToFSJOrderEditJsp(){ return "/pms/sch/workorder_FSJ/orderEdit"; } /** * @title addFSJOrder * @description 新增发射机工单-保存至数据库 * @author bsw * @params [workOrderBean] * @updateTime 10:56 2019/8/5 0005 * @return com.shlanbao.tzsc.base.model.Json **/ @ResponseBody @RequestMapping("/addFSJOrder") public Json addFSJOrder(TransmitterWorkOrderBean workOrderBean){ Json json = new Json(); try { workOrderService.addFSJOrder(workOrderBean); json.setSuccess(true); json.setMsg("操作成功!"); } catch (Exception e) { log.error("新增工单失败", e); json.setMsg("新增工单失败!"); } return json; } /** * @title deleteFSJOrders * @description 发射机工单删除 * @author bsw * @params [ids, eqpName, team, date, mat, session] * @updateTime 10:57 2019/8/5 0005 * @return com.shlanbao.tzsc.base.model.Json **/ @ResponseBody @RequestMapping("/deleteFSJOrders") public Json deleteFSJOrders(String ids,String eqpName,String team,String date,String mat,HttpSession session){ Json json = new Json(); try { SessionInfo info=(SessionInfo) session.getAttribute("sessionInfo"); workOrderService.deleteFSJOrders(ids,eqpName,team,date,mat,info); json.setSuccess(true); json.setMsg("操作成功!"); } catch (Exception e) { log.error("审核工单删除", e); json.setMsg("审核工单删除!"); } return json; } /** * @title beatchDeleteFSJOrders * @description 发射机工单批量删除 * @author bsw * @params [ids, eqpName, team, date, mat, session] * @updateTime 10:57 2019/8/5 0005 * @return com.shlanbao.tzsc.base.model.Json **/ @ResponseBody @RequestMapping("/beatchDeleteFSJOrders") public Json beatchDeleteFSJOrders(String ids,String eqpName,String team,String date,String mat,HttpSession session){ Json json = new Json(); try { SessionInfo info=(SessionInfo) session.getAttribute("sessionInfo"); if(info!=null){ // workOrderService.deleteBeatchWorkOrders(ids,eqpName,team,date,mat,info); workOrderService.deleteBeatchFSJOrders(ids,eqpName,team,date,mat,info); json.setSuccess(true); json.setMsg("操作成功!"); }else{ json.setSuccess(false); json.setMsg("操作失败!"); } } catch (Exception e) { log.error("审核工单删除", e); json.setMsg("审核工单删除!"); } return json; } /** * @title goToEditFSJRunTime * @description 跳转到发射机工单运行时间编辑页面 * @author bsw * @params [ids, session] * @updateTime 10:58 2019/8/5 0005 * @return java.lang.String **/ @RequestMapping("/goToEditFSJRunTime") public String goToEditFSJRunTime(String ids,HttpSession session){ session.setAttribute("FSJOrderRunTime", workOrderService.getFSJRuntime(ids)); session.setAttribute("FSJrunTimeIds", ids); return "/pms/sch/workorder_FSJ/runTimeEdit"; } /** * @title goToEditFSJDatas * @description 跳转至发射机生产消耗数据编辑页面 * @author bsw * @params [id, request] * @updateTime 10:59 2019/8/5 0005 * @return java.lang.String **/ @RequestMapping("/goToEditFSJDatas") public String goToEditFSJDatas(String id,HttpServletRequest request){ //查询发射机消耗实际 request.setAttribute("transmitterBean", workOrderService.querytransmitterOutPut(id)); //session.setAttribute("FSJrunTimeIds", ids); return "/pms/sch/workorder_FSJ/outputEdit"; } /** * 保存修改后的数据 * 步骤: * 1:获得调整后的数据 * 2:原始数据-调整后的数据=调整值 * 3:修改详细调整后的数; * 4:修改主工单总发射量-调整值 * 因为发射量调整了,总发射量也会跟着变,所以要修改主表总发射量 * @return * @author wanchanghuang */ @ResponseBody @RequestMapping("/saveFSJDatas") public Json saveFSJDatas( TransmitterOutput tobean,HttpServletRequest request){ Json json = new Json(); try { workOrderService.saveFSJDatas(tobean); json.setSuccess(true); json.setMsg("修改成功!!!"); } catch (Exception e) { log.error("修改发射机量失败!!!", e); json.setMsg("修改失败!!!"); } return json; } /** * 修改运行时间 * @author Rengj * @return */ @ResponseBody @RequestMapping("/addFSJRunTime") public Json addFSJRunTime(String stim,String etim,HttpSession session){ String result =""; Json json = new Json(); try { String ids= String.valueOf(session.getAttribute("FSJrunTimeIds")); result = workOrderService.editFSJRuntime(stim,etim, ids); json.setSuccess(true); json.setMsg(result); session.removeAttribute("FSJrunTimeIds"); } catch (Exception e) { log.error("修改运行时间", e); json.setMsg(result); } return json; } /** * 查询发射机工单 */ @ResponseBody @RequestMapping("/getAllFSJOrderDetails") public DataGrid getAllFSJOrderDetails(TransmitterWorkOrderBean workOrderBean,PageParams pageParams){ try { return workOrderService.getAllFSJOrderDetails(workOrderBean,pageParams); } catch (Exception e) { log.error("查询工单异常", e); } return null; } /** * bom版本下拉查询 * @param matid * @return * @auther bsw * @date 2019-07-09 */ @ResponseBody @RequestMapping("/getBomVersionByProd") public List getBomVersionByProd(String matid){ return workOrderService.queryBomVersionByProd(matid); } /** * 工艺参数版本下拉查询 * @param matid * @return * @auther bsw * @date 2019-07-09 * */ @ResponseBody @RequestMapping("/getParamVersionByProd") public List getParamVersionByProd(String matid){ return workOrderService.getParamVersionByProd(matid); } /** * 获取bom明细 * @param bomVersion * @return * @auther bsw * @date 2019-07-09 */ @ResponseBody @RequestMapping("/getBomDetail") public DataGrid getBomDetail(String bomVersion){ return workOrderService.getBomDetail(bomVersion); } /** * 卷包机与成型机工单状态缓存redis * @param id 工单id * @param sts 工单状态 */ private void workOrderWriteToRedis(String id,Long sts) throws Exception{ //根据id获取工单详情 WorkOrderBean workOrderById = workOrderService.getWorkOrderById(id); //运行工单时保存到redis writeToRedis(sts, workOrderById != null, workOrderById.getEqpcode(), JSONObject.fromObject(workOrderById)); } /** * 发射机工单状态缓存redis * @param id 工单id * @param sts 工单状态 */ private void transmitterWorkOrderWriteToRedis(String id,Long sts) throws Exception{ //根据id获取工单详情 TransmitterWorkOrderBean workOrderById = workOrderService.getFSJOrderById(id); //运行工单时保存到redis writeToRedis(sts, workOrderById!=null, workOrderById.getEquCode(), JSONObject.fromObject(workOrderById)); } /** * 工单状态缓存redis * @param sts * @param b * @param equCode * @param jsonObject */ private void writeToRedis(Long sts, boolean b, String equCode, JSONObject jsonObject) { if (b && sts == 2) { //在redis创建工单集 if (!RedisUtil.hasKey("workorder")) RedisUtil.setMap("workorder", new HashMap<>()); //存入redis RedisUtil.addMap("workorder", equCode, jsonObject.toString()); //修改为其他状态则从redis移除该工单 } else { RedisUtil.delMapKey(equCode, "workorder"); } } }