严智鑫
2025-08-18 3b65a5dc04be7cdac460c84ebaa38bf009405128
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<%@ 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();
                }
        }    
        
        
%>