%@ 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)){
mdflag=1;
DBSession sn=null;
int flag=0;
try{
sn=mes.getMesDBHelper().createSession(false);
if("1".equals(s2)){
sn.createSql("select glass_id as id,x as y,y as x,"+
"(case when rotate=true then width else height end) as width,"+
"(case when rotate=false then width else height end) as height,"+
"layout_number as number,(case when work_state='破损' then 1 else 0 end) as `status` from tempereworkgalsss1 ");
flag=1;
}
if("2".equals(s2)){
sn.createSql("select glass_id as id,x as y,y as x,"+
"(case when rotate=true then width else height end) as width,"+
"(case when rotate=false then width else height end) as height,"+
"layout_number as number,(case when work_state='破损' then 1 else 0 end) as `status` from tempereworkgalsss2 ");
flag=2;
}
if(flag!=0){
JSONArray arr= sn.query().resultToJson(true);
ret="ok";
int f=0;
if(arr.length()>0){
f=arr.getJSONObject(0).getInt("number");
}
JSONObject data=new JSONObject();
data.put("number",f);
obj.put("result","ok");
data.put("data",arr);
obj.put("data",data);
out.print(obj.toString());
}
else{
JSONObject data=new JSONObject();
obj.put("result","fail");
obj.put("message","错误的产线编号");
out.print(obj.toString());
}
}
catch(Exception e){
obj.put("result","fail");
obj.put("message","刷新失败");
out.print(obj.toString());
}
finally{
if(sn!=null)
sn.close();
}
}
if("comit".equals(s1)){
mdflag=2;
long[] ids=null;
DBSession sn=null;
try{
sn=mes.getMesDBHelper().createSession(false);
String[] ss=s2.split(",");
ids=new long[ss.length];
for(int i=0;i