严智鑫
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
<%@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("gongyi");
    String line = request.getParameter("line");
    String caozuo = request.getParameter("caozuo");
    String leixing = request.getParameter("leixing");
    String Id = request.getParameter("Id");
    String gongyi = request.getParameter("gongyi");
    DBSession sn = null;
    boolean ok = false;
    try {
 
        sn = mes.getMesDBHelper().createSession(false);
        String strSQL = "";
        if ("获取列表".equals(caozuo)) {
            if ("钢化前".equals(gongyi)) {
                //strSQL = "select * from gmms_galss_task_2  where groups= " + line
                //    + "  and orders is not null and (work_procedure='钢化上片' or work_procedure='钢化前复合' or work_procedure='钢化前摆片' or work_procedure='钢化') and work_state<>'破损' order by furnace,orders";
 
                strSQL = "select * from v_ghq_online_glass where groups = " + line;
            }
            if ("钢化后".equals(gongyi)) {
                //strSQL = "select * from gmms_galss_task_2  where groups=" + line
                //    + "   and orders is not null and ((work_procedure='钢化' and work_state<>'等待中' ) or (work_procedure='钢化后摆片' ) or (work_procedure='钢化后复合') or (work_procedure='钢化后下片' and work_state<>'已完成')) and work_state<>'破损' order by furnace,grouporder,fine_throwing";
 
                strSQL = "select * from v_ghh_online_glass where groups = " + line;
            }
            if ("中空".equals(gongyi)) {
 
            }
            sn.createSql(strSQL);
            JSONArray a = sn.query().resultToJson(false);
            if (a != null) {
                out.print(a.toString());
            } else {
                out.print("[]");
            }
        }
 
        
        if ("人工拿走".equals(caozuo)) {
            
            if ("钢化前".equals(gongyi)) {
 
            }
            if ("钢化后".equals(gongyi)) {
 
            }
            if ("中空".equals(gongyi)) {
 
            }
            sn.createSql(strSQL);
            int s = sn.update();//括号内是参数,没有参数不输入
            out.print(s);
        }
 
        if ("设置完成".equals(caozuo)) {
            if ("钢化前".equals(gongyi)) {
 
            }
            if ("钢化后".equals(gongyi)) {
 
            }
            if ("中空".equals(gongyi)) {
 
            }
            sn.createSql(strSQL);
            int s = sn.update();//括号内是参数,没有参数不输入
            out.print(s);
        }
 
        
        if ("修改".equals(caozuo)) {
            if ("变更班组".equals(leixing)) {
                String bzinfo = request.getParameter("info");
                strSQL = "update gmms_user_current set banzu = '" + bzinfo + "' where gongyi = '" + gongyi
                        + "' and chanxian = " + line;
            }
            if ("重新上片".equals(leixing)) {
                /*galssTask.setWorkState("已优化");
            galssTask.setWorkProcedure("钢化上片");*/
                strSQL = "update gmms_galss_task_2 set work_state = '已优化',work_procedure='钢化上片' ,galss_id = 0 where id="+Id;
            }
            if ("重新摆片".equals(leixing)) {
                /* galssTask.setWorkState("等待中");
                galssTask.setWorkProcedure("钢化前摆片"); */
                strSQL = "update gmms_galss_task_2 set work_state = '等待中',work_procedure='钢化前摆片' where id="+Id;
            }
            if ("重新钢化".equals(leixing)) {
                /* galssTask.setWorkState("等待中");
                galssTask.setWorkProcedure("钢化"); */
                strSQL = "update gmms_galss_task_2 set work_state = '等待中',work_procedure='钢化' where id="+Id;
            }
            if ("重新复合".equals(leixing)) {
                if("钢化前".equals(gongyi)){
                    /* galssTask.setWorkState("等待中");
                    galssTask.setWorkProcedure("钢化前复合"); */
                    strSQL = "update gmms_galss_task_2 set work_state = '等待中',work_procedure='钢化前复合' where id="+Id;
                }else if ("钢化后".equals(gongyi)){
                    /* galssTask.setWorkState("待复合");
                    galssTask.setWorkProcedure("钢化后复合"); */    
                    strSQL = "update gmms_galss_task_2 set work_state = '待复合',work_procedure='钢化后复合' where id="+Id;
                }
            }
            if ("下片完成".equals(leixing)) {
                /* galssTask.setWorkState("已完成");
                galssTask.setWorkProcedure("钢化后下片"); */
                
                //strSQL = "select count(1) from gmms_galss_task_2 where processcard_id = ( select processcard_id from gmms_galss_task_2 where id = '"+Id+"') and work_state = '已完成',work_procedure='钢化后下片'";
                
                String snum ="select ( select count(1) from gmms_galss_task_2 where processcard_id = ( select processcard_id from gmms_galss_task_2 where id = '"+Id+"') and work_state = '已完成' and work_procedure='钢化后下片')+1";
                
                sn.createSql(snum);
                JSONArray a = sn.query().resultToJson(false);
                //JSONArray a = sn.query();
                if (a != null) {
                    //num = a[0][0].toString();
                    String num = a.getJSONArray(0).getString(0);
                    strSQL="update gmms_galss_task_2 as gt INNER join gmms_user_current as guc on gt.groups=guc.chanxian "+
                           "set gt.work_state='已完成',gt.work_procedure='钢化后下片',gt.fine_throwing=0,gt.stop_position=0,gt.stop_rank= '"+num+"',gt.finsh_time=NOW(),gt.banzu=guc.banzu "+
                           "where guc.gongyi='钢化' and gt.work_state!='人工拿走' and gt.work_state!='破损' and gt.id="+Id;
                    //strSQL = "update gmms_galss_task_2 set work_state = '已完成',work_procedure='钢化后下片',stop_rank = '"+num+"',finsh_time = null,fine_throwing = 0 where id="+Id;
                }
                
                
                
            }
            if ("重新下片".equals(leixing)) {
                strSQL = "update gmms_galss_task_2 set work_state = '等待中',work_procedure='钢化后下片' where id="+Id;
            }
            if ("人工拿走".equals(leixing)) {
                String NazouSql = "update gmms_galss_task_2 set work_state = '破损' where id="+Id;
                sn.createSql(NazouSql);
                int s = sn.update();
                strSQL ="INSERT INTO e_record_tempering(processcard_id, glass_id, width, height, thinkess, color, sequence, create_time, line, team_name, type_num, is_report,rank) "+                         
                        "select gt.processcard_id,gt.id,gt.edg_width,gt.edg_height,gt.thickness,gt.color,gt.stop_rank,NOW(),gt.groups,guc.banzu,gt.edg_speed2,1,0 from gmms_galss_task_2 as gt INNER join gmms_user_current as guc on gt.groups=guc.chanxian "+
                        "left join e_record_tempering as et on gt.id=et.glass_id "+
                        "where guc.gongyi='钢化' and gt.id='"+Id+"' and et.glass_id is null";
            }
 
            //System.out.println(strSQL);
 
            sn.createSql(strSQL);
            int s = sn.update();
            //System.out.println(s);
            out.print(s);
 
        }
 
    } catch (Exception e) {
        e.printStackTrace();
 
    } finally {
        if (sn != null)
            sn.close();
    }
%>