严智鑫
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
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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
<%@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,groups,stops,rank,flag,sign,processcard_id,zongshu,kuneishu,quepianshu,wanchengshu,shengyushu,orientation,stop_rank from v_zk_shangpianwei where groups="
                        + pLine;
            }
 
            if ("退库".equals(caozuo)) {
                String Id = request.getParameter("Id");
                //qSQL = "update gmms_drop_frame_4 set sign=4  where Id = " + Id;
                qSQL = "update gmms_drop_frame_5 set sign=4  where Id = " + Id;
            }
            if ("获取空架".equals(caozuo)) {
                String aOrb = Integer.parseInt(request.getParameter("AB")) == 1 ? "A" : "B";
                qSQL = "select id,state,processcard_id from gmms_shelf_rack_2 where  state != '正在使用' and falg ='启用' and orientation ='"
                        + aOrb + "'";
            }
            if ("料架状态".equals(caozuo)) {
                String Id = request.getParameter("Id");
                String flag = Integer.parseInt(request.getParameter("flag")) == 1 ? "2" : "1";
                //qSQL = "update gmms_drop_frame_4 set flag = "+flag+" where Id = "+Id;
 
                qSQL = "update gmms_drop_frame_5 set flag = " + flag + " where Id = " + Id;
            }
            if ("吸片模式切换".equals(caozuo)) {
                String zt = request.getParameter("xiPian");
                qSQL = "update gmms_machine set remarks = " + zt + " where work_id = " + pLine
                        + " and machine_name like '%中空机器手%'";
            }
            if ("吸片状态".equals(caozuo)) {
 
                qSQL = "select remarks from gmms_machine where work_id = " + pLine
                        + " and machine_name like '%中空机器手%'";
            }
            
            if ("领取模式状态".equals(caozuo)) {
                qSQL = "select IF(mode_type='自动',0,1) from y_mode_type where number='ZKXZ0001' and groups="+pLine;
            }
            if ("领取模式切换".equals(caozuo)) {
                String Ms = request.getParameter("moshi");
                if("0".equals(Ms)){
                    qSQL = "update y_mode_type set mode_type='自动' where number='ZKXZ0001' and groups="+pLine;
                }else{
                    qSQL = "update y_mode_type set mode_type='手动' where number='ZKXZ0001' and groups="+pLine;
                }
                
            }
            //System.out.println(qSQL);
            sn.createSql(qSQL);
            //System.out.print(qSQL);
            if ("修改".equals(leixing)) {
                String Id = request.getParameter("Id");
                if ("绑定料架".equals(caozuo)) {
 
                    String liaoJiaId = request.getParameter("liaoJiaId");
                    //qSQL = "update gmms_drop_frame_4 set rank = ?,sign=1  where Id = ?";
                    qSQL = "update gmms_drop_frame_5 set rank = ?,sign=1  where Id = ?";
                    sn.createSql(qSQL);
                    int s = sn.update(liaoJiaId, Id);
                    qSQL = "update gmms_shelf_rack_2 set state='正在使用' where Id=?";
                    sn.createSql(qSQL);
                    int q = sn.update(liaoJiaId);
                    out.print(s + "_" + q);
                } else if ("清空信息".equals(caozuo)) {
 
                    qSQL = "update gmms_shelf_rack_2 set state='使用中' where Id = (select rank from gmms_drop_frame_5 where Id = "
                            + Id + ")";
                    sn.createSql(qSQL);
                    int s = sn.update();
                    qSQL = "update gmms_drop_frame_5 set sign= 0,rank = null  where Id = " + Id;
                    sn.createSql(qSQL);
                    int q = sn.update();
                    out.print(s + "_" + q);
                }
 
                else {
                    sn.createSql(qSQL);
                    int q = sn.update();
                    out.print(q);
                }
            }
            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();
        }
    }
 
    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)) {
                qSQL = "select id,stops,rank,flag,sign,processcard_id,zongshu,kuneishu,posunshu,quepianshu,yishangpian,jiazishengyushu,orientation,stop_rank from v_zklp_shangpianwei";
            }
            /* if ("清空信息".equals(caozuo)) {
                String Id = request.getParameter("Id");
                qSQL = "update gmms_drop_frame_4 set sign= 0,rank = null  where Id = " + Id;
            } */
            if ("退库".equals(caozuo)) {
                String Id = request.getParameter("Id");
                //qSQL = "update gmms_drop_frame_4 set sign=4  where Id = " + Id;
                qSQL = "update gmms_drop_frame_5 set sign=4  where Id = " + Id;
            }
            if ("出库".equals(caozuo)) {
                String Id = request.getParameter("Id");
                //qSQL = "update gmms_drop_frame_4 set sign=4  where Id = " + Id;
                qSQL = "update gmms_liuchengka set ischu='待出库' where liuchengka='"+Id+"' and ischu is null;";
            }
            if ("获取空架".equals(caozuo)) {
                String aOrb = Integer.parseInt(request.getParameter("AB")) == 1 ? "A" : "B";
                qSQL = "select id,state,processcard_id from gmms_shelf_rack_2 where  state != '正在使用' and falg ='启用' and orientation ='"
                        + aOrb + "'";
            }
            if ("料架状态".equals(caozuo)) {
                String Id = request.getParameter("Id");
                String flag = Integer.parseInt(request.getParameter("flag")) == 1 ? "2" : "1";
                //qSQL = "update gmms_drop_frame_4 set flag = "+flag+" where Id = "+Id;
                qSQL = "update gmms_drop_frame_5 set flag = " + flag + " where Id = " + Id;
            }
            if ("吸片模式切换".equals(caozuo)) {
                String zt = request.getParameter("xiPian");
                qSQL = "update gmms_machine set remarks = " + zt + " where id = 47";
            }
            if ("吸片状态".equals(caozuo)) {
 
                qSQL = "select remarks from gmms_machine where id = 47 ";
            }
            //System.out.println(qSQL);
            sn.createSql(qSQL);
            //System.out.print(qSQL);
            if ("修改".equals(leixing)) {
                String Id = request.getParameter("Id");
                if ("绑定料架".equals(caozuo)) {
 
                    String liaoJiaId = request.getParameter("liaoJiaId");
                    qSQL = "update gmms_drop_frame_5 set rank = ?,sign=1  where Id = ?";
                    sn.createSql(qSQL);
                    int s = sn.update(liaoJiaId, Id);
                    qSQL = "update gmms_shelf_rack_2 set state='正在使用' where Id=?";
                    sn.createSql(qSQL);
                    int q = sn.update(liaoJiaId);
                    out.print(s + "_" + q);
                } else if ("清空信息".equals(caozuo)) {
 
                    qSQL = "update gmms_shelf_rack_2 set state='使用中' where Id = (select rank from gmms_drop_frame_5 where Id = "
                            + Id + ")";
                    sn.createSql(qSQL);
                    int s = sn.update();
                    qSQL = "update gmms_drop_frame_5 set sign= 0,rank = null  where Id = " + Id;
                    sn.createSql(qSQL);
                    int q = sn.update();
                    out.print(s + "_" + q);
                } else {
                    sn.createSql(qSQL);
                    int q = sn.update();
                    out.print(q);
                }
            }
            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();
        }
    }
 
    
    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)) {
                qSQL = "select xuhao,zkliuchengka,liuchengkas,zongshu,kuneishu from y_parent_liuchengka";
            }
            if ("获取详情".equals(caozuo)) {
                String zklck_i = request.getParameter("lck");
                //qSQL ="select xuhao,liuchengka,id,orientation,taskid,stop_rank,stop_position,width,height,thickness,color,work_state,work_procedure  from y_shelfgalsss where parent_liuchengka = '"+zklck_i+"' order by work_procedure, stop_rank,liuchengka";
                qSQL = "select xuhao,liuchengka,taskid,width,height,thickness,color,id,orientation,stop_rank,stop_position,work_state,work_procedure  from y_shelfgalsss where parent_liuchengka = '"
                        + zklck_i + "' order by work_procedure, stop_rank,liuchengka";
 
            }
 
            if ("获取缺片详情".equals(caozuo)) {
                String zklck_i = request.getParameter("lck");
                //qSQL ="select xuhao,liuchengka,id,orientation,taskid,stop_rank,stop_position,width,height,thickness,color,work_state,work_procedure  from y_shelfgalsss where parent_liuchengka = '"+zklck_i+"' and id is null order by work_procedure, stop_rank,liuchengka";
                qSQL = "select xuhao,liuchengka,taskid,width,height,thickness,color,id,orientation,stop_rank,stop_position,work_state,work_procedure  from y_shelfgalsss where parent_liuchengka = '"
                        + zklck_i + "' and (stop_rank is null or work_state='破损') order by work_procedure, stop_rank,liuchengka";
            }
            sn.createSql(qSQL);
            if ("修改".equals(leixing)) {
                if ("绑定料架".equals(caozuo)) {
                    String Id = request.getParameter("Id");
                    String liaoJiaId = request.getParameter("liaoJiaId");
                    qSQL = "update gmms_drop_frame_4 set rank = ?,sign=1  where Id = ?";
                    sn.createSql(qSQL);
                    int s = sn.update(liaoJiaId, Id);
                    qSQL = "update gmms_shelf_rack_2 set state='正在使用' where Id=?";
                    sn.createSql(qSQL);
                    int q = sn.update(liaoJiaId);
                    out.print(s + "_" + q);
                } else {
                    sn.createSql(qSQL);
                    int q = sn.update();
                    out.print(q);
                }
            }
            if ("查询".equals(leixing)) {
                JSONArray a = sn.query().resultToJson(false);
                if (a != null) {
                    out.print(a.toString());
                } else {
                    out.print("[]");
                }
            }
 
            if ("存储过程".equals(leixing)) {
 
                if ("理片".equals(caozuo)) {
                    String moshi = request.getParameter("moshi");
                    String lck = request.getParameter("lck");
                    sn.createStdCall("y_optimize_GAI", 2);
 
                    String s = sn.stdCall(lck, moshi).ResultMessage;
                    //int s=1;
                    System.out.println("操作时间:" + new java.util.Date() + "  当前操作:" + caozuo + "  流程卡:" + lck
                            + " 模式:" + moshi + "  返回结果:" + s);
                    out.print(s);
                }
            }
 
            //sn.createStdCall("aaa",3);
            //String s= sn.stdCall(1,2,3).ResultMessage;
 
        } catch (Exception e) {
            e.printStackTrace();
 
        } finally {
            if (sn != null)
                sn.close();
        }
    }
%>