<%@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(); } %>