<%@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 moshi = request.getParameter("moshi"); //System.out.println("操作时间:" + new java.util.Date() + " 当前操作:" + caozuoName + "; 当前生产线:" + pLine + ";模式:" + moshi); //查询 if ("1".equals(moshi)) { DBSession sn = null; boolean ok = false; try { sn = mes.getMesDBHelper().createSession(false); String qSQL = ""; if ("上片位信息".equals(caozuoName)) { qSQL = "select id,stops,processcard_id,state,zongshu,posunshu,yiyouhua,wanchengshu,shengyushu,shangpianshengyushu,noodles,flag,weizhi from v_gh_shangpianwei where groups = " + pLine; } if ("优化模式".equals(caozuoName)) { } //38 2号线机械手 63 1号线机械手 if ("吸片模式".equals(caozuoName)) { String mId = "1".equals(pLine) ? "63" : "38"; qSQL = "select remarks from gmms_machine where id = " + mId; } if ("获取流程卡".equals(caozuoName)) { qSQL = "Select * from v_ghq_liuchengka"; } if ("换架判断".equals(caozuoName)) { String Id = request.getParameter("Id"); qSQL = "select count(*) from gmms_galss_task_2 where processcard_id = (select processcard_id from gmms_drop_frame_2 where Id =" + Id + ") and work_state <> '破损' and work_state <> '未优化' "; } if ("查询流程卡详情".equals(caozuoName)) { String Id = request.getParameter("Id"); qSQL = "select processcard_id,stop_rank,galss_id,thickness,color,edg_width,edg_height,work_state,work_procedure,Id from gmms_galss_task_2 where processcard_id = (select processcard_id from gmms_drop_frame_2 where Id =" + Id + ") order by stop_rank"; } if ("工位信息".equals(caozuoName)) { String Id = request.getParameter("Id"); qSQL = "Select stops,processcard_id,zongshu,posunshu,shengyushu,noodles from v_gh_shangpianwei where id ="+Id; } if ("当前摆片".equals(caozuoName)) { qSQL = "Select width,length,xinterval,yinterval from gmms_furnace where Id ="+pLine; } if("摆片规则".equals(caozuoName)){ qSQL = "Select id,width,length,xinterval,yinterval,description,line from gmms_furnace_config"; } if("进炉时间".equals(caozuoName)){ if("1".equals(pLine)){ qSQL ="Select time_out from gmms_timer where timer_name = 'ganghua_1'"; }else if("2".equals(pLine)){ qSQL ="Select time_out from gmms_timer where timer_name = 'ganghua_2'"; } } sn.createSql(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) { System.out.println("操作时间:" + new java.util.Date() + " 出现错误!!!:" + " 当前操作:" + caozuoName + "; 当前生产线:" + pLine + ";模式:" + moshi); e.printStackTrace(); } finally { if (sn != null) { sn.close(); } } } else { } //修改 if ("2".equals(moshi)) { DBSession sn = null; boolean ok = false; try { sn = mes.getMesDBHelper().createSession(false); String qSQL = ""; if ("设置使用面".equals(caozuoName)) { String sId = request.getParameter("Id"); qSQL = "update gmms_drop_frame_2 set flag = if(flag=1,0,1) where stops = " + sId + " and groups = " + pLine; } //2 不吸片 1吸片 if ("吸片模式切换".equals(caozuoName)) { String mId = "1".equals(pLine) ? "63" : "38"; qSQL = "update gmms_machine set remarks = if(remarks=1,2,1) where Id=" + mId; } if ("设置破损".equals(caozuoName)) { String gId = request.getParameter("Id"); qSQL = "update gmms_galss_task_2 set work_state = '破损' where Id = " + gId; } if ("删除上片位信息".equals(caozuoName)) { String Id = request.getParameter("Id"); qSQL = "update gmms_drop_frame_2 set processcard_Id = null ,state='" + "空闲" + "',processcard_count =0 ,surplus_count = 0 where Id=" + Id; } if("修改数量".equals(caozuoName)){ String Id = request.getParameter("Id"); String u_num = request.getParameter("U_Num"); qSQL = "update gmms_drop_frame_2 set surplus_count = "+u_num +" where Id = "+Id; } if("摆片新增".equals(caozuoName)){ String ms = request.getParameter("bpms"); String[] m = ms.split("_"); // n + "_" + w + "_" + l + "_" + x + "_" + y qSQL = "insert into gmms_furnace_config(width,length,xinterval,yinterval,description) values ("+m[1]+","+m[2]+","+m[3]+","+m[4]+",'"+m[0]+"')"; } if("删除摆片规则".equals(caozuoName)){ String Id = request.getParameter("Id"); qSQL = "Delete from gmms_furnace_config where id = "+Id; } if("标记钢化完成".equals(caozuoName)){ String lck = request.getParameter("lck_num"); qSQL ="update gmms_liuchengka set isgang='手动钢化' where liuchengka='"+lck+"'"; } System.out.println("操作时间:" + new java.util.Date() + " 当前操作:钢化前上片位-" + caozuoName + ";SQL:" + qSQL); sn.createSql(qSQL); int s = sn.update(); out.print(s); } catch (Exception e) { e.printStackTrace(); } finally { if (sn != null) { sn.close(); } } } //存储过程 if ("3".equals(moshi)) { DBSession sn = null; boolean ok = false; try { sn = mes.getMesDBHelper().createSession(false); if ("上架确认".equals(caozuoName)) { sn.createStdCall("GlassTask_ganghuaqian", 1); int s = sn.stdCall(pLine).ResultCode; out.print(s); }if("绑定流程卡".equals(caozuoName)){ //GlassTask_ghq_BindRack String Id = request.getParameter("Id"); String lckNum = request.getParameter("lckNum"); sn.createStdCall("GlassTask_ghq_BindRack", 2); DBSession.StdCallResult scr = sn.stdCall(Id,lckNum); int s = scr.ResultCode; String rM = scr.ResultMessage; out.print(s+"_"+rM); }if("摆片修改".equals(caozuoName)){ String Id =request.getParameter("Id"); sn.createStdCall("GlassTask_furnace", 2); DBSession.StdCallResult scr = sn.stdCall(Id,pLine); int s = scr.ResultCode; String rM = scr.ResultMessage; out.print(s+"_"+rM); } } catch (Exception e) { e.printStackTrace(); } finally { if (sn != null) { sn.close(); } } } //需要修改多条数据 if ("4".equals(moshi)) { DBSession sn = null; boolean ok = false; try { sn = mes.getMesDBHelper().createSession(false); String qSQL = ""; //弃用 if ("绑定流程卡".equals(caozuoName)) { String Id = request.getParameter("Id"); String lckNum = request.getParameter("lckNum"); qSQL = "update gmms_drop_frame_2 set processcard_Id ='" + lckNum + "' ,state='" + "使用中" + "',processcard_count =(SELECT count(1) FROM gmms_galss_task_stock WHERE processcard_id = '" + lckNum + "') ,surplus_count = (SELECT count(1) FROM gmms_galss_task_stock WHERE processcard_id = '" + lckNum + "') where Id=" + Id; sn.createSql(qSQL); int s = sn.update(); if (s == 1) { qSQL = "update gmms_liuchengka set Occupied = " + Id + " where liuchengka = '" + lckNum + "';"; sn.createSql(qSQL); int t = sn.update(); if (t == 1) { out.print(t); } else { out.print("上片位信息修改成功,流程卡占用标记失败"); } } else { out.print("上片位信息修改失败,流程卡绑定失败"); } } if ("清空信息".equals(caozuoName)) { String Id = request.getParameter("Id"); qSQL = "delete from gmms_galss_task_2 where processcard_id = (select processcard_id from gmms_drop_frame_2 where id=" + Id + ")"; sn.createSql(qSQL); sn.update(); qSQL = "update gmms_drop_frame_2 set processcard_Id = null ,state='" + "空闲" + "',processcard_count =0 ,surplus_count = 0 where Id=" + Id; sn.createSql(qSQL); int r = sn.update(); if (r == 1) { out.print(r); } else { out.print("收影响行数大于1条,清空信息可能存在异常!"); } } if ("删除上片位信息".equals(caozuoName)) { String Id = request.getParameter("Id"); qSQL = "update gmms_liuchengka set Occupied = 0 where liuchengka =(select processcard_id from gmms_drop_frame_2 where id=" + Id + ")"; sn.createSql(qSQL); sn.update(); qSQL = "update gmms_drop_frame_2 set processcard_Id = null ,state='" + "空闲" + "',processcard_count =0 ,surplus_count = 0 where Id=" + Id; sn.createSql(qSQL); int t = sn.update(); if (t == 1) { out.print(t); } else { out.print("上片位信息修改失败!"); } } } catch (Exception e) { e.printStackTrace(); } finally { if (sn != null) { sn.close(); } } } //System.out.println("操作时间:"+new java.util.Date()+" 操作结束"); %>