严智鑫
2025-05-27 80f64d025e25cdba8a33a1badf2109c80d0bafe7
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<%@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 yemian = request.getParameter("yemian");
    
    if ("中空管理".equals(yemian)) {
        String caozuo = request.getParameter("caozuo");
        String leixing = request.getParameter("leixing");
        String pLine = request.getParameter("line");
        DBSession sn = null;
        boolean ok = false;
        
        try {
            
            sn = mes.getMesDBHelper().createSession(false);
            String qSQL = "";
 
            if ("获取列表".equals(caozuo)) {
                
                qSQL = "select y.id,(CASE y.Occupied WHEN 1 THEN '全部吸完' WHEN 2 THEN '完工退库' ELSE '配对吸片' END) as Occupied,x.parent_liuchengka,y.current_work_position,y.current_status,x.child_count,x.shelfcount,ifnull(x.shu,0),null,ifnull(y.getgroups,0) as aaaa,getdatatime,sls,(CASE y.Suction_sheet_mode WHEN 0 THEN '正吸' ELSE '反吸' END) as Suction_sheet_mode from (select a.id,parent_liuchengka,current_work_position,current_status,(select child_count from gmms_liuchengka where liuchengka=a.parent_liuchengka) as child_count,count(parent_liuchengka) as shelfcount,sum(shu) as shu from gmms_liuchengka a inner join (select sr.processcard_id from gmms_drop_frame_5 as dr5 inner join gmms_shelf_rack_2 as sr on dr5.rank=sr.id where (dr5.groups_=100 or dr5.groups_=4) and  sr.id is not null and sr.processcard_id is not null) as b on a.liuchengka=b.processcard_id inner join (select processcard_id,if(GROUP_CONCAT(stop_rank order by stop_rank)=GROUP_CONCAT(stop_position order by stop_rank),1,0) as shu from gmms_galss_task_shelf where work_procedure='钢化后下片' and work_state='已完成'  group by gc_number,processcard_id) as c on a.liuchengka=c.processcard_id group by a.parent_liuchengka) as x inner join gmms_liuchengka y on x.parent_liuchengka=y.liuchengka and (y.getgroups='"+pLine+"' or y.getgroups is null) inner join (select gc_number,group_concat(concat(stop_rank,'-',orientation,'-',sl) order by processcard_id separator ' / ') as sls from (select gc_number,df5.stop_rank,b.orientation,b.processcard_id,count(*) as sl from gmms_galss_task_shelf a inner join gmms_shelf_rack_2 b on a.processcard_id=b.processcard_id inner join gmms_drop_frame_5 df5 on df5.rank=b.id  where work_procedure='钢化后下片' and work_state='已完成' group by a.processcard_id ) as lck group by gc_number) as lcks on x.parent_liuchengka=lcks.gc_number order by current_work_position,aaaa desc, getdatatime asc";
            }
            
            //System.out.println(qSQL);
            sn.createSql(qSQL);
            //System.out.print(qSQL);
            if ("修改".equals(leixing)) {
                if ("领取任务".equals(caozuo)) {
                    
                    String Id = request.getParameter("Id");
                    qSQL="update gmms_liuchengka set getgroups='"+pLine+"',current_work_position='中空',current_status='等待中',getdatatime=now(),Occupied=0 where id='"+Id+"'";
                    
                    sn.createSql(qSQL);
                    int s=sn.update();//括号内是参数,没有参数不输入
                    out.print(s);    
                }
                if ("全部吸完".equals(caozuo)) {
                    String Id = request.getParameter("Id");
                    qSQL="update gmms_liuchengka set Occupied=1 where liuchengka='"+Id+"'";
                    /* qSQL="update gmms_drop_frame_5 as dr left join gmms_shelf_rack_2 as sr on dr.rank=sr.id"+
                            " left join gmms_liuchengka as lk on lk.liuchengka=sr.processcard_id set Occupied=1"+
                            " where dr.rank is not null and sr.processcard_id is not null and lk.parent_liuchengka='"+Id+"'"; */
                    sn.createSql(qSQL);
                    int s=sn.update();//括号内是参数,没有参数不输入
                    out.print(s);
                }
                if ("完工退库".equals(caozuo)) {
                    String Id = request.getParameter("Id");
                    qSQL="update gmms_liuchengka set Occupied=2,getgroups=null,current_work_position='中空',current_status='等待中' where liuchengka='"+Id+"'";
                    /* qSQL="update gmms_drop_frame_5 as dr left join gmms_shelf_rack_2 as sr on dr.rank=sr.id"+
                            " left join gmms_liuchengka as lk on lk.liuchengka=sr.processcard_id set Occupied=2"+
                            " where dr.rank is not null and sr.processcard_id is not null and lk.parent_liuchengka='"+Id+"'"; */
                    sn.createSql(qSQL);
                    int s=sn.update();//括号内是参数,没有参数不输入
                    out.print(s);
                }
                if ("切换吸片顺序".equals(caozuo)) {
                    String Id = request.getParameter("Id");
                    qSQL="update gmms_liuchengka set Suction_sheet_mode=(CASE Suction_sheet_mode WHEN 0 THEN 1 ELSE 0 END) where liuchengka='"+Id+"'";
                    /* qSQL="update gmms_drop_frame_5 as dr left join gmms_shelf_rack_2 as sr on dr.rank=sr.id"+
                            " left join gmms_liuchengka as lk on lk.liuchengka=sr.processcard_id set Occupied=2"+
                            " where dr.rank is not null and sr.processcard_id is not null and lk.parent_liuchengka='"+Id+"'"; */
                    sn.createSql(qSQL);
                    int s=sn.update();//括号内是参数,没有参数不输入
                    out.print(s);
                }
            }
            
            if ("查询".equals(leixing)) {
                
                JSONArray a = sn.query().resultToJson(false);
                if (a != null) {
                    out.print(a.toString());
                } else {
                    out.print("[]");
                }
            }
            //sn.createStdCall("aaa",3);
            //String s= sn.stdCall(1,2,3).ResultMessage;
 
        } catch (Exception e) {
            e.printStackTrace();
 
        } finally {
            if (sn != null)
                sn.close();
        }
    }
 
    
%>