严智鑫
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
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page import="com.northglass.Globel.mes"%>
<%@page import="com.northglass.SqlHelper.*"%>
<%@page import="org.json.*"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
    String method=request.getParameter("m");
    String param=request.getParameter("p");
    /***********仓储使能*************/
    if("load_entery".equals(method)){
        DBSession sn=null;
        int step=0;
        try{
            sn=mes.getMesDBHelper().createSession(false);
            int d=Integer.parseInt(param);
            step=1;
        
            if(d>=1 && d<=3){
                step=2;                
                sn.createSql("UPDATE gmms_device_state set `able`=1 where device_name='上片机' and line=?");
                sn.query(d);            
                step=3;
            }
        }
        catch(Exception e){
            
        }
        finally{
            if(sn!=null)
                sn.close();
            JSONObject obj=new JSONObject();
            String result="fail";
            switch(step){
                case 0:
                    result="确认失败:数据库异常";
                    break;
                case 1:
                    result="确认失败:错误的线号";
                    break;
                case 2:
                    result="确认失败:执行异常";
                    break;
                case 3:
                    result="ok";
                    break;
            }
            obj.put("result",result);
            out.print(obj.toString());
        }
    
    }
    /*********************冷加工打印汇报******************************/
    if("leng_print".equals(method)){
        DBSession sn=null;
        System.out.print(param);    
        int step=0;
        try{
            sn=mes.getMesDBHelper().createSession(false);
            step=1;
            step=2;
            sn.createStdCall("print_log",1);
            String k= sn.stdCall(param).ResultMessage;
            step=3;
        }
        catch(Exception e){
            e.printStackTrace();
        }
        finally{
            if(sn!=null)
                sn.close();
            JSONObject obj=new JSONObject();
            String result="fail";
            switch(step){
                case 0:
                    result="汇报失败:数据库异常";
                    break;
                case 1:
                    result="汇报失败:错误的线号";
                    break;
                case 2:
                    result="汇报失败:执行异常";
                    break;
                case 3:
                    result="ok";
                    break;
            }
            obj.put("result",result);
            out.print(obj.toString());
        }
    }
%>