<%@page import="com.northglass.Globel.mes"%> <%@page import="com.northglass.SqlHelper.*"%> <%@page import="org.json.*"%> <%@ page contentType="text/json;charset=UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <% String caozuoName = request.getParameter("name"); String pLine = request.getParameter("line"); String yemian = request.getParameter("yemian"); //System.out.println("操作时间:"+new java.util.Date()+" 当前操作:"+caozuoName+"; 当前生产线:"+pLine); if ("钢化后下片位管理".equals(yemian)) { String caozuo = request.getParameter("caozuo"); String leixing = request.getParameter("leixing"); DBSession sn = null; boolean ok = false; try { sn = mes.getMesDBHelper().createSession(false); String qSQL = ""; if ("钢化前摆片状态切换".equals(caozuo)) { //String zt = request.getParameter("xiPian"); //qSQL = "update gmms_machine set remarks = " + zt + " where work_id = " + pLine+ " and machine_name like '%中空机器手%'"; qSQL = "update gmms_machine set state =If(state='正常','暂停','正常') where work_id="+pLine +" and machine_name like '%摆片台___1%'"; } if ("钢化前摆片状态".equals(caozuo)) { qSQL = "select state from gmms_machine where work_id = '" + pLine +"' and machine_name like '%摆片台___1%'"; } sn.createSql(qSQL); if ("修改".equals(leixing)) { //String Id = request.getParameter("Id"); sn.createSql(qSQL); int q = sn.update(); System.out.println(q); out.print(q); } if ("查询".equals(leixing)) { JSONArray a = sn.query().resultToJson(false); if (a != null) { out.print(a.toString()); } else { out.print("[]"); } } } catch (Exception e) { e.printStackTrace(); } finally { if (sn != null) sn.close(); } } if ("钢化后下片位信息".equals(caozuoName)) { DBSession sn = null; boolean ok = false; try { sn = mes.getMesDBHelper().createSession(false); String qSQL = "select id,stops,flag,rank,sign,processcard_id,wanchengshu,posunshu,zongshu,weiwanchegnshu,orientation,stop_rank from v_gh_xiapianwei where groups=" + pLine; sn.createSql(qSQL); //System.out.print(qSQL); //sn.createStdCall("aaa",3); //String s= sn.stdCall(1,2,3).ResultMessage; JSONArray a = sn.query().resultToJson(false); if (a != null) { out.print(a.toString()); } else { out.print("[]"); } //out.print(pLine); ok = true; } catch (Exception e) { e.printStackTrace(); } finally { if (sn != null) sn.close(); } } //更新数据 if ("钢化后下片位退库".equals(caozuoName)) { String tkId = request.getParameter("Id"); DBSession sn = null; try { sn = mes.getMesDBHelper().createSession(false); String qSQL = "update gmms_drop_frame_5 set sign=4 where Id = " + tkId; sn.createSql(qSQL); int s = sn.update(); out.print(s); } catch (Exception e) { e.printStackTrace(); } finally { if (sn != null) { sn.close(); } } } if ("钢化后下片位清空信息".equals(caozuoName)) { String qkId = request.getParameter("Id"); DBSession sn = null; try { sn = mes.getMesDBHelper().createSession(false); String qSQL = "update gmms_shelf_rack_2 set processcard_id=null where Id = (select rank from gmms_drop_frame_5 where Id = "+qkId+")"; sn.createSql(qSQL); int s = sn.update(); out.print(s); } catch (Exception e) { e.printStackTrace(); } finally { if (sn != null) { sn.close(); } } } if ("钢化后绑定料架".equals(caozuoName)) { String xiaPianWeiId = request.getParameter("Id"); String liaoJiaId = request.getParameter("LJId"); DBSession sn = null; try { sn = mes.getMesDBHelper().createSession(false); //String qSQL = "update gmms_drop_frame_3 set rank = ?,flag=1 where Id = ?"; String qSQL = "update gmms_drop_frame_5 set rank = ?,sign=1 where Id = ?"; sn.createSql(qSQL); int s = sn.update(liaoJiaId,xiaPianWeiId); qSQL = "update gmms_shelf_rack_2 set state='正在使用' where Id=?"; sn.createSql(qSQL); int q = sn.update(liaoJiaId); out.print(s+"_"+q); } catch (Exception e) { e.printStackTrace(); } finally { if (sn != null) { sn.close(); } } } if("钢化后空架列表".equals(caozuoName)){ String ABMian = request.getParameter("AB"); String aOrb =Integer.parseInt(ABMian)==1?"A":"B"; //System.out.println("ABMian"+ABMian+";"+aOrb); DBSession sn = null; boolean ok = false; try { sn = mes.getMesDBHelper().createSession(false); String qSQL = "select id,state,processcard_id from v_cc_liaojia where state != '正在使用' and falg ='启用' and orientation ='"+aOrb+"'"; sn.createSql(qSQL); //System.out.println(qSQL); //sn.createStdCall("aaa",3); //String s= sn.stdCall(1,2,3).ResultMessage; JSONArray a = sn.query().resultToJson(false); if (a != null) { out.print(a.toString()); } else { out.print("[]"); } //out.print(pLine); ok = true; } catch (Exception e) { e.printStackTrace(); } finally { if (sn != null) sn.close(); } } if("工位状态变更".equals(caozuoName)){ String s = request.getParameter("State"); String id = request.getParameter("Id"); DBSession sn = null; try { sn = mes.getMesDBHelper().createSession(false); String qSQL = "Update gmms_drop_frame_5 set flag = if(flag=1,0,1) where Id="+id; sn.createSql(qSQL); int a = sn.update(); //System.out.println(qSQL+" "+a); out.print(a); } catch (Exception e) { e.printStackTrace(); } finally { if (sn != null) sn.close(); } } //System.out.println("操作时间:"+new java.util.Date()+" 操作结束"); %>