严智鑫
2024-05-13 cedce4883f0d204f5bf7bf87c0bf4858dabb0c23
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
<%@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 id,galss_id,width,height,thickness,processcard_id,stop_rank,stop_position,work_procedure,work_state,gc_number,null from gmms_galss_task_shelf " 
                      + " where work_procedure!='中空上片' and processcard_id=(select lk.liuchengka from gmms_drop_frame_5 as dr5  " 
                      + "         left join gmms_shelf_rack_2 as sr on dr5.rank=sr.id  " 
                      + "         left join gmms_liuchengka as lk on sr.processcard_id=lk.liuchengka  " 
                      + "         where groups_=3 and drop_groups=1 and sr.id is not null and lk.liuchengka is not null and   " 
                      + "         lk.current_status='正在工作' and lk.current_work_position='理片' limit 0,1) order by processcard_id asc,stop_rank desc";
            }
            
            //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_galss_task_shelf set work_state='破损' where id="+Id+" ";
                    /* qSQL="update gmms_slicecage_tempering as st LEFT JOIN gmms_galss_task_shelf as gs on st.id=gs.slicecage_rank set gs.work_state='破损',gs.finsh_time=now(),gs.slicecage_rank=null,"+
                         "st.state='空闲',st.count=0,st.type_id=null,st.processcard_id=null where gs.id="+Id+" "; */
                    qSQL="update gmms_galss_task_shelf as gs  LEFT JOIN gmms_slicecage_tempering as st  on st.id=gs.slicecage_rank set gs.work_state='破损',gs.finsh_time=now(),gs.slicecage_rank=null,"
                         +"st.state='空闲',st.count=0,st.type_id=null,st.processcard_id=null where gs.id="+Id+" ";
                    sn.createSql(qSQL);
                    int s=sn.update();//括号内是参数,没有参数不输入
                    out.print(s);
                    
                }if ("完成".equals(caozuo)) {
                    String Id = request.getParameter("Id");
                    qSQL="update gmms_galss_task_shelf set work_state='已完成' where id="+Id+" and (work_state='正在工作' or work_state='进库中' or work_state='出库中')";
                    sn.createSql(qSQL);
                    int s=sn.update();
                    out.print(s);
                }
                if ("重新测量".equals(caozuo)) {
                    String Id = request.getParameter("Id");
                    qSQL="update gmms_galss_task_shelf set work_state='理片笼上片',work_state='已完成' where id="+Id+" and work_state='理片' and work_state='等待中' ";
                    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();
        }
    }
 
    
%>