<%@page
|
import="com.northglass.GlassLayout.Algorithm.AlgorithmDBInterface"%>
|
<%@page import="com.northglass.GlassLayout.Tempering.RackComboInfo"%>
|
<%@page
|
import="com.northglass.GlassLayout.Tempering.RackComboInfo.RackInfo"%>
|
<%@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"%>
|
|
<%
|
//System.out.println("获取");
|
String line = request.getParameter("line");
|
String strMx = request.getParameter("moxi");//膜系
|
String strHd = request.getParameter("houdu");//厚度
|
//System.out.print(line == null);
|
String caozuo = request.getParameter("caozuo");
|
String num = request.getParameter("Num");
|
double ratioLimit=Double.valueOf(request.getParameter("ratioLimit")) ;
|
double mixedLimit=Double.valueOf(request.getParameter("mixedLimit"));
|
|
int l = Integer.valueOf(line);
|
System.out.println("[线路:"+line+"][膜系:"+strMx+"][厚度:"+strHd+"][单炉最大装载率:"+ratioLimit+"][混排面积最大允许相差比例:"+mixedLimit+"]");
|
|
if ("上架推荐".equals(caozuo)) {
|
DBSession sn = null;
|
boolean ok = false;
|
int LckCount=0;
|
try{
|
String sqlcount="Select * from v_ghq_liuchengka where moxi='"+strMx+"' and houdu='"+strHd+"'";
|
sn = mes.getMesDBHelper().createSession(false);
|
sn.createSql(sqlcount);
|
JSONArray a = sn.query().resultToJson(false);
|
if (a != null) {
|
LckCount=a.length();
|
//out.print(a.toString());
|
} else {
|
//out.print("[]");
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
} finally {
|
if (sn != null) {
|
sn.close();
|
}
|
}
|
System.out.println("流程卡数量:"+LckCount);
|
if(LckCount<3){
|
out.println(LckCount);
|
}else{
|
String sql = "select `gs`.`id` AS `id`,`gs`.`processcard_id` AS `processcard`,lk.position,"
|
+ "100 AS `front`,`gs`.`width` AS `width`,`gs`.`height` AS `height`,"
|
+ "`gs`.`stop_rank` AS `glass_idx`,`gs`.`thickness` AS `thickness`,"
|
+ "`gs`.`color` AS `color`,100 AS `work_id`," + "0 AS `layout_mode`,"
|
+ "(select w from gmms_galss_task_buffer where id=gs.id) as w,"
|
+ "(select h from gmms_galss_task_buffer where id=gs.id) as h from "
|
+ "(select @rows:=@rows+1 as position,liuchengka from gmms_liuchengka,(select @rows:=0) as b where isgang='冷加工下片完成' and is_single=1 and gy_gang=1 and piece_count>10 and minArea>0.7) as lk "
|
+ "left join gmms_galss_task_stock as gs on lk.liuchengka=gs.processcard_id where gs.thickness ='"+strHd+"' and gs.color = '"+strMx+"'";
|
|
//System.out.println(sql);
|
//得到推荐结果 f(线路,sql)
|
RackComboInfo[] resultratio =com.northglass.GlassLayout.Algorithm.AlgorithmDBInterface.f(l, sql,ratioLimit,mixedLimit);
|
if(resultratio.length>0){
|
//一组结果 RackComboInfo类 :
|
//RackComboInfo.RackInfos 表示结果中的 流程卡数组
|
//RackComboInfo.RackInfo 表示流程卡信息
|
//RackComboInfo.ratioResult 表示这一组流程卡的优化率
|
|
String tj_lck ="";
|
int r_row = 0;
|
String result_ ="";
|
//for (RackInfo d : resultratio[0].rackinfos) {
|
for (RackComboInfo RackComboInfo : resultratio) {
|
result_+="【"+r_row+"】流程卡号:";
|
for (RackInfo d : RackComboInfo.rackinfos) {
|
//System.out.println(" id:" + d.id + " needed:" + d.needed + " level:" + d.level);
|
if(r_row==0){
|
tj_lck+=d.id+"_";
|
}
|
result_+=d.id+"、";
|
}
|
result_+="(炉数、装载率:";
|
for (double d : RackComboInfo.ratioResult) {
|
if(r_row==0){
|
tj_lck+=d+"_";
|
}
|
result_+=d+"、";
|
}
|
result_+=")";
|
|
|
r_row++;
|
}
|
|
System.out.println("钢化前上架推荐:"+tj_lck);
|
out.println(tj_lck);
|
|
try{
|
String param = "[膜系:"+strMx+"][厚度:"+strHd+"][玻璃架数:"+LckCount+"][单炉最大装载率:"+ratioLimit+"][混排面积最大允许相差比例:"+mixedLimit;
|
|
String sqlcount="Insert gmms_ganghuatuijian_log (result,Parameter,strremark,intremark)values('"+result_+"','"+param+"','',0)";
|
sn = mes.getMesDBHelper().createSession(false);
|
sn.createSql(sqlcount);
|
|
int a = sn.update();
|
|
} catch (Exception e) {
|
e.printStackTrace();
|
out.println("0");
|
} finally {
|
if (sn != null) {
|
sn.close();
|
}
|
}
|
}else{
|
|
System.out.println("ERROR:钢化推荐部分:116行");
|
out.println("0");
|
}
|
}
|
|
|
|
/* //遍历 每一组结果 id:流程卡号 needed:默认FALSE level:等级
|
for (RackComboInfo RackComboInfo : resultratio) {
|
//一组结果 RackComboInfo类 :
|
//RackComboInfo.RackInfos 表示结果中的 流程卡数组
|
//RackComboInfo.RackInfo 表示流程卡信息
|
//RackComboInfo.ratioResult 表示这一组流程卡的优化率
|
for (RackInfo d : RackComboInfo.rackinfos) {
|
System.out.println(" id:" + d.id + " needed:" + d.needed + " level:" + d.level);
|
}
|
for (double d : RackComboInfo.ratioResult) {
|
System.out.println(d);
|
}
|
} */
|
}
|
//out.print("{result:\"ok\"}");
|
%>
|