%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page import="com.northglass.Globel.mes"%>
<%@page import="com.northglass.SqlHelper.*"%>
<%@page import="org.json.*"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
String ret="未知操作";
int mdflag=0;
String s1= request.getParameter("a");
String s2 = request.getParameter("b");
JSONObject obj=new JSONObject();
if("update".equals(s1)){
String sql1= "SELECT a.id as id,a.galss_id as glass_id,a.furnace as layout_number,a.processcard_id,a.work_procedure as proc,a.work_state as state,"
+"b.x as y,b.y as x,"
+"(case when rotate=true then b.width else b.height end) as width,"
+"(case when rotate=false then b.width else b.height end) as height"
+" from gmms_galss_task_2 a inner join gmms_tempere_layout b on a.id=b.glass_id and a.furnace=b.layout_number where a.groups=1 and (select count(*) from gmms_galss_task_2 where processcard_id=a.processcard_id and work_state!='破损' and furnace=a.furnace and !(work_procedure='钢化后下片' and work_state='已完成'))>0 and (not (a.work_procedure='钢化后下片' and a.work_state='已完成')) order by a.furnace";
String sql2= "SELECT a.id as id,a.galss_id as glass_id,a.furnace as layout_number,a.processcard_id,a.work_procedure as proc,a.work_state as state,"
+"b.x as y,b.y as x,"
+"(case when rotate=true then b.width else b.height end) as width,"
+"(case when rotate=false then b.width else b.height end) as height"
+" from gmms_galss_task_2 a inner join gmms_tempere_layout b on a.id=b.glass_id and a.furnace=b.layout_number where a.groups=2 and (select count(*) from gmms_galss_task_2 where processcard_id=a.processcard_id and work_state!='破损' and furnace=a.furnace and !(work_procedure='钢化后下片' and work_state='已完成'))>0 and (not (a.work_procedure='钢化后下片' and a.work_state='已完成')) order by a.furnace";
mdflag=1;
DBSession sn=null;
int flag=0;
try{
sn=mes.getMesDBHelper().createSession(false);
if("1".equals(s2)){
sn.createSql(sql1);
flag=1;
}
if("2".equals(s2)){
sn.createSql(sql2);
flag=2;
}
if(flag!=0){
JSONArray arr= sn.query().resultToJson(true);
ret="ok";
int f=0;
JSONObject data=new JSONObject();
obj.put("result","ok");
obj.put("data",arr);
out.print(obj.toString());
}
else{
JSONObject data=new JSONObject();
obj.put("result","fail");
obj.put("message","错误的产线编号");
out.print(obj.toString());
}
}
catch(Exception e){
e.printStackTrace();
obj.put("result","fail");
obj.put("message","刷新失败");
out.print(obj.toString());
}
finally{
if(sn!=null)
sn.close();
}
}
%>