📄 newpaihao.java
字号:
setChengfen(paihao); String sql = ""; try { if(show.indexOf("y")!=-1){ if(currentpage==1){ sql = "select top " + size + " * " + strf + " where " + sqlw + " and" + " " + huaxue + ".id !=all(" + "select top " + ( (currentpage - 1) * size) + "" + " " + huaxue + ".id " + strf + " where " + sqlw + " " + "order by " + huaxue + ".id desc) " + "order by " + huaxue + ".id desc"; }else{ sql = "select top " + size + " * " + strf + " where " +sqlw + " and"+ " " + huaxue + ".id !=all(" +"select top " + (currentpage - 1) * (size-1) + ""+ " " + huaxue +".id "+strf+" where "+sqlw+" " +"order by " + huaxue + ".id desc) "+ "order by " + huaxue +".id desc"; } }else{ sql = "select * "+strf+" where "+sqlw+" order by " + huaxue + ".id desc"; } } catch (Exception e) { e.getMessage (); } //System.out.println(sql); return sql; }//-------------------------查询---------------------------- public String userFindPH() throws SQLException{ //String getStr = ""; StringBuffer buf = new StringBuffer (); MyResultSet rs22 = null; ResultSetMetaData rsmd = null; ArrayList queslist = new ArrayList (); String sql = ""; int rs_count = 0; String isview = "";//用于表示是否已经审核结束完毕; String fujian = ""; String huaxue = "钢坯"+paihao+"化学成分"; String dibeiP = "钢坯"+paihao + "低倍"; String biaomianP = "钢坯"+paihao + "表面质量"; String dibeiC = "圆钢"+paihao + "低倍"; String biaomianC = "圆钢"+paihao + "表面质量"; String feijinshuC = "圆钢"+paihao + "非金属夹杂物"; String jinxiangC = "圆钢"+paihao + "金相"; String wuliC = "圆钢"+paihao + "物理性能"; String taxingC = "圆钢"+paihao + "塔形"; int countdbc = 0; int countbmc = 0; int countfjsc = 0; int countjxc = 0; int countwlc = 0; int counttxc = 0; try { int counthx = countph(huaxue); int countdbp = countph(dibeiP); int countbmp = countph(biaomianP); if(pi_or_cai.equals("c")){ countdbc = countph (dibeiC); countbmc = countph (biaomianC); countfjsc = countph (feijinshuC); countjxc = countph (jinxiangC); countwlc = countph (wuliC); counttxc = countph (taxingC); } int c2 = counthx + countdbp; int c3 = c2 + countbmp; int c4 = c3 + countwlc; int c5 = c4 + countdbc; int c6 = c5 + countbmc; int c7 = c6 + countjxc; int c8 = c7 + countfjsc;//-------------- sql = sqlFindPH(huaxue,dibeiP,biaomianP,wuliC,dibeiC,biaomianC,jinxiangC,feijinshuC,taxingC); //System.out.println(sql); //rs22 = super.executeQuery (sql); rs22 = DbAccess.querySqlOptionp(sql); String myrs = ""; //rsmd = super.executeQueryRsmt (sql); rsmd = rs22.getMetaData(); buf.append ("<tr bgcolor=\"#cccccc\" height= \"33\"> \n"); buf.append (" </td><td align=\"center\" colspan=\""); buf.append(counthx-16);//减16而不减18是因为,第一个多显示了标识列和 buf.append ("\">钢坯"+paihao+"化学成分</td> \n<td style=\"border-left:1px solid #000000 \" align=\"center\" colspan=\""); buf.append(countdbp-18); buf.append ("\">钢坯"+paihao+"低倍</td>\n<td style=\"border-left:1px solid #000000 \" align=\"center\" colspan=\""); buf.append(countbmp-18); buf.append ("\">钢坯"+paihao+"表面质量</td> \n"); if(pi_or_cai.equals("c")){ buf.append ("<td style=\"border-left:1px solid #000000 \" align=\"center\" colspan=\""); buf.append (countwlc - 18); buf.append ("\">圆钢" + paihao + "物理性能</td>\n <td style=\"border-left:1px solid #000000 \" align=\"center\" colspan=\""); buf.append (countdbc - 18); buf.append ("\">圆钢" + paihao + "低倍</td>\n <td style=\"border-left:1px solid #000000 \" align=\"center\" colspan=\""); buf.append (countbmc - 18); buf.append ("\">圆钢" + paihao + "表面质量</td>\n <td style=\"border-left:1px solid #000000 \" align=\"center\" colspan=\""); buf.append (countjxc - 18); buf.append ("\">圆钢" + paihao + "金相实验</td>\n <td style=\"border-left:1px solid #000000 \" align=\"center\" colspan=\""); buf.append (countfjsc - 18); buf.append ("\">圆钢" + paihao + "非金属夹杂物</td>\n <td style=\"border-left:1px solid #000000 \" align=\"center\" colspan=\""); buf.append (counttxc - 18); buf.append ("\">圆钢" + paihao + "塔形实验</td> \n"); } buf.append ("<tr bgcolor=\"#cccccc\" height= \"27\"> \n"); if (rsmd != null) { //int count = rsmd.getColumnCount (); int count = counthx+countdbp+countbmp+countwlc+countdbc+countbmc+countjxc+countfjsc+counttxc; for (int i = 16; i <= count; i++) { if(i==18 || (counthx<i && i<counthx+19) || (c2<i && i<c2+19) || (c3<i && i<c3+19) || (c4<i && i<c4+19) || (c5<i && i<c5+19)|| (c6<i && i<c6+19)|| (c7<i && i<c7+19) ||(c8<i && i<c8+19)){ continue; }else{ if(i==counthx+19 || i==c2+19||i==c3+19||i==c4+19||i==c5+19||i==c6+19||i==c7+19||i==c8+19){ buf.append ("<td style=\"border-left:1px solid #000000\" align=\"center\" height= \"24\"><table width=\"50\" ><tr><td align=\"center\">制单人</td></tr></table></td>"); continue; }else if(i==19){ buf.append ("<td align=\"center\" height= \"24\"><table width=\"50\" ><tr><td align=\"center\">制单人</td></tr></table></td>"); continue; }else{ buf.append ("<td align=\"center\" height= \"24\">"); buf.append (rsmd.getColumnName (i)); buf.append ("</td> \n"); } } } int q = 0; String idrs = "";//记录本次循环中huaxueid号 while (rs22.next ()) { idrs = rs22.getString(1); rs_count++; if(rs_count == size-1){ setChong (idrs); } if(rs_count == size){ if(!idrs.equals(chong)){ continue; }else{ setIdend("y"); } } buf.append ( "<tr bgcolor=\"#FFFFFF\" height= \"22\" onclick=\"onClickColor(this);\">\n"); for (int i = 16; i <= count; i++) { if(i==18 || (counthx<i && i<counthx+19) || (c2<i && i<c2+19) || (c3<i && i<c3+19) || (c4<i && i<c4+19) || (c5<i && i<c5+19)|| (c6<i && i<c6+19)|| (c7<i && i<c7+19) ||(c8<i && i<c8+19)){ continue; }else{ if(i==counthx+19 || i==c2+19||i==c3+19||i==c4+19||i==c5+19||i==c6+19||i==c7+19||i==c8+19){ buf.append ("<td style=\"border-left:1px solid #000000; white-space:nowrap\" align=\"center\">"); }else{ buf.append ( "<td align=\"center\" style=\"white-space:nowrap\">"); } //////////////////////////////////////// if (i > 15 && i < counthx + 1){ isview = rs22.getString (2); fujian = rs22.getString (8); } if (i > counthx && i < c2 + 1){ isview = rs22.getString (counthx + 2); fujian = rs22.getString (counthx + 8); } if (i > c2 && i < c3 + 1){ isview = rs22.getString (c2 + 2); fujian = rs22.getString (c2 + 8); } if (i > c3 && i < c4 + 1){ isview = rs22.getString (c3 + 2); fujian = rs22.getString (c3 + 8); } if (i > c4 && i < c5 + 1){ isview = rs22.getString (c4 + 2); fujian = rs22.getString (c4 + 8); } if (i > c5 && i < c6 + 1){ isview = rs22.getString (c5 + 2); fujian = rs22.getString (c5 + 8); } if (i > c6 && i < c7 + 1){ isview = rs22.getString (c6 + 2); fujian = rs22.getString (c6 + 8); } if (i > c7 && i < c8 + 1){ isview = rs22.getString (c7 + 2); fujian = rs22.getString (c7 + 8); } if (i > c8 && i < count + 1){ isview = rs22.getString (c8 + 2); fujian = rs22.getString (c8 + 8); } //////////////////////////// if(isview!=null){ if (isview.indexOf ("y") != -1) { //System.out.println(fujian); if (fujian!=null && (i==20 ||i==counthx+20 || i==c2+20||i==c3+20||i==c4+20||i==c5+20||i==c6+20||i==c7+20||i==c8+20)){ if(fujian.indexOf("复检")!=-1){ myrs = rs22.getString (i)+"<font color=\"#CC0000\">(复检)</font>"; }else { myrs = rs22.getString (i); } }else{ myrs = rs22.getString (i); } } else { myrs = "****"; } }else{ myrs = rs22.getString (i); } if (myrs == null || myrs.length () == 0) { buf.append (" "); } else { if ( (i == 17) &&!myrs.equals ("******")) { buf.append (myrs.substring (0, 10)); } else { if(myrs.length()<=3){ buf.append (" "+myrs+" "); }else{ buf.append (myrs); } } } //////////////////////////////////////// buf.append ("</td> \n"); } }// buf.append ("</tr> \n"); } if (rs_count == 0) { buf.append ("<table width=\"100%\" bgcolor=\"#cccccc\" ><tr>\n<td align=\"center\" height= \"50\">"); buf.append ("没有符合条件的查询结果!</td> \n</tr> \n</table>"); } //---------------------------------------- } else { buf.append ( "<td align=\"center\" width=\"100%\" height= \"24\">无结果!</td>"); } } catch (Exception e) { e.printStackTrace (); } finally { try { if (rs22 != null) rs22.close(); }catch (SQLException ex) {} } return buf.toString (); }//-----每种成分下列的个数------------------------------ public int countph(String table){ ResultSetMetaData rsmd = null; MyResultSet rs23= null; int count = 0; try{ String sqlhx = "select * from "+table+""; rs23 = DbAccess.querySqlOptionp(sqlhx); //rsmd = super.executeQueryRsmt(sqlhx); rsmd = rs23.getMetaData(); count = rsmd.getColumnCount(); }catch(Exception e){ e.printStackTrace(); } finally { try { if (rs23 != null) rs23.close(); }catch (SQLException ex) {} } return count; }//----得到牌号名称-------------------------------- public String[] selectPaihao() throws Exception { String sql = ""; String phStr = ""; MyResultSet rs24 = null; ArrayList queslist = new ArrayList (); try { sql = "select * from paihao order by ph asc"; //rs = super.executeQueryp (sql); rs24 = DbAccess.querySqlOption(sql); while (rs24.next ()) { phStr = rs24.getString ("ph"); queslist.add (phStr); } } catch (SQLException ex) { ex.printStackTrace (); } finally { try { if (rs24 != null) rs24.close(); }catch (SQLException ex) {} } String[] rs0 = { ""}; return (String[])queslist.toArray (rs0); }public String getSubt() { return subt;}public void setSubt(String subt) { this.subt = subt;}}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -