严智鑫
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<%@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 caozuoName = request.getParameter("name");
    String pLine = request.getParameter("line");
    String yemian = request.getParameter("yemian");
    //System.out.println("操作时间:"+new java.util.Date()+"  当前操作:"+caozuoName+";  当前生产线:"+pLine);
    if ("钢化后下片位管理".equals(yemian)) {
        String caozuo = request.getParameter("caozuo");
        String leixing = request.getParameter("leixing");
        DBSession sn = null;
        boolean ok = false;
        try {
            sn = mes.getMesDBHelper().createSession(false);
            String qSQL = "";
            if ("钢化前摆片状态切换".equals(caozuo)) {
                //String zt = request.getParameter("xiPian");
                //qSQL = "update gmms_machine set remarks = " + zt + " where work_id = " + pLine+ " and machine_name like '%中空机器手%'";
                
                
                qSQL = "update gmms_machine set state =If(state='正常','暂停','正常') where work_id="+pLine +" and machine_name like '%摆片台___1%'";
            }
            if ("钢化前摆片状态".equals(caozuo)) {
 
                qSQL = "select state from gmms_machine where work_id = '" + pLine +"' and machine_name like '%摆片台___1%'";
            }
            sn.createSql(qSQL);
            if ("修改".equals(leixing)) {
                //String Id = request.getParameter("Id");
                    sn.createSql(qSQL);
                    int q = sn.update();
                    System.out.println(q);
                    out.print(q);
                    
 
            }
            if ("查询".equals(leixing)) {
                JSONArray a = sn.query().resultToJson(false);
                if (a != null) {
                    out.print(a.toString());
                } else {
                    out.print("[]");
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
 
        } finally {
            if (sn != null)
                sn.close();
        }
    }
    if ("钢化后下片位信息".equals(caozuoName)) {
 
        DBSession sn = null;
        boolean ok = false;
        try {
            sn = mes.getMesDBHelper().createSession(false);
            String qSQL = "select id,stops,flag,rank,sign,processcard_id,wanchengshu,posunshu,zongshu,weiwanchegnshu,orientation,stop_rank from v_gh_xiapianwei where groups="
                    + pLine;
            sn.createSql(qSQL);
            //System.out.print(qSQL);
            //sn.createStdCall("aaa",3);
            //String s= sn.stdCall(1,2,3).ResultMessage;
            JSONArray a = sn.query().resultToJson(false);
            if (a != null) {
                out.print(a.toString());
            } else {
                out.print("[]");
            }
            //out.print(pLine);
            ok = true;
        } catch (Exception e) {
            e.printStackTrace();
 
        } finally {
            if (sn != null)
                sn.close();
        }
 
    }
 
    //更新数据
    if ("钢化后下片位退库".equals(caozuoName)) {
        String tkId = request.getParameter("Id");
        DBSession sn = null;
        try {
 
            sn = mes.getMesDBHelper().createSession(false);
            String qSQL = "update gmms_drop_frame_5 set sign=4  where Id = " + tkId;
            sn.createSql(qSQL);
            int s = sn.update();
            out.print(s);
 
        } catch (Exception e) {
            e.printStackTrace();
 
        } finally {
 
            if (sn != null) {
                sn.close();
            }
        }
 
    }
 
    if ("钢化后下片位清空信息".equals(caozuoName)) {
        String qkId = request.getParameter("Id");
        DBSession sn = null;
        try {
 
            sn = mes.getMesDBHelper().createSession(false);
            
            String qSQL = "update gmms_shelf_rack_2 set processcard_id=null where Id = (select rank from gmms_drop_frame_5 where Id = "+qkId+")";
            sn.createSql(qSQL);
            int s = sn.update();
            
            out.print(s);
 
        } catch (Exception e) {
            e.printStackTrace();
 
        } finally {
 
            if (sn != null) {
                sn.close();
            }
        }
    }
 
    if ("钢化后绑定料架".equals(caozuoName)) {
        String xiaPianWeiId = request.getParameter("Id");
        String liaoJiaId = request.getParameter("LJId");
        DBSession sn = null;
        try {
 
            sn = mes.getMesDBHelper().createSession(false);
            //String qSQL = "update gmms_drop_frame_3 set rank = ?,flag=1  where Id = ?";
            String qSQL = "update gmms_drop_frame_5 set rank = ?,sign=1  where Id = ?";
            sn.createSql(qSQL);
            int s = sn.update(liaoJiaId,xiaPianWeiId);
            qSQL = "update gmms_shelf_rack_2 set state='正在使用' where Id=?";
            sn.createSql(qSQL);
            int q = sn.update(liaoJiaId);
            
            out.print(s+"_"+q);
 
        } catch (Exception e) {
            e.printStackTrace();
 
        } finally {
 
            if (sn != null) {
                sn.close();
            }
        }
    }
    
    
    if("钢化后空架列表".equals(caozuoName)){
        String ABMian = request.getParameter("AB");
        String aOrb =Integer.parseInt(ABMian)==1?"A":"B";
        //System.out.println("ABMian"+ABMian+";"+aOrb);
        DBSession sn = null;
        boolean ok = false;
        try {
            sn = mes.getMesDBHelper().createSession(false);
            String qSQL = "select id,state,processcard_id from v_cc_liaojia where  state != '正在使用' and falg ='启用' and orientation ='"+aOrb+"'";
            sn.createSql(qSQL);
            //System.out.println(qSQL);
            //sn.createStdCall("aaa",3);
            //String s= sn.stdCall(1,2,3).ResultMessage;
            JSONArray a = sn.query().resultToJson(false);
            if (a != null) {
                out.print(a.toString());
            } else {
                out.print("[]");
            }
            //out.print(pLine);
            ok = true;
        } catch (Exception e) {
            e.printStackTrace();
 
        } finally {
            if (sn != null)
                sn.close();
        }
    }
    if("工位状态变更".equals(caozuoName)){
        String s = request.getParameter("State");
        String id = request.getParameter("Id");
        DBSession sn = null;
        try {
            sn = mes.getMesDBHelper().createSession(false);
            String qSQL = "Update gmms_drop_frame_5 set flag = if(flag=1,0,1) where Id="+id;
            sn.createSql(qSQL);
            int a = sn.update();
            //System.out.println(qSQL+"  "+a);
            out.print(a);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (sn != null)
                sn.close();
        }
        
    }
    
    
    //System.out.println("操作时间:"+new java.util.Date()+"  操作结束");
%>