📄 find.java
字号:
}
}
} catch (Exception e) {
e.printStackTrace ();
}
finally {
try {
if (rs9 != null){ rs9.close();}
if (rs10 != null){rs10.close();}
}catch (SQLException ex) {}
}
return buf.toString ();
}
//----------------------编码前录入,查询编码表中的biaotou内容------------
public String blFindTitle () {
String goodst = goods + "_t";
MyResultSet rs8 = null;
ResultSetMetaData rsmd = null;
StringBuffer buf = new StringBuffer ();
try {
String sql = "select * from " + goodst + "";
rs8 = DbAccess.querySqlOptionp(sql);
rsmd = rs8.getMetaData();
//rsmd = super.executeQueryRsmt (sql);
if (rsmd != null) {
int count = rsmd.getColumnCount ();
for (int i = 3; i <= count; i++) {
buf.append (
"<td align=\"center\" style=\"white-space:nowrap\">");
buf.append (rsmd.getColumnName (i));
buf.append ("</td>");
}
}
} catch (Exception e) {
e.printStackTrace ();
}
finally {
try {
if (rs8 != null) {rs8.close();}
}
catch (SQLException ex) {}
}
return buf.toString ();
}
//-------------------------查询----------------------------
public String userFind () {
//String getStr = "";
StringBuffer buf = new StringBuffer ();
MyResultSet rs = null;
MyResultSet rs0 = null;
MyResultSet rs1 = null;
ResultSetMetaData rsmd = null;
ArrayList queslist = new ArrayList ();
String sql = "";
int m = 14;
String fm = ""; //读卡列值
String shPriv = "n"; //察看保密;priv表示审核结束
int rs_count = 0;
String bl = ""; //编码时录入
boolean lbView = true; //是否显示编码录入时的内容,默认为显示。
boolean biaoshi = true; //是否显示标识字段
String mlhg = ""; //mulu表中合格判定列值
String fujian = "";//是否复检
try {
String sqlm = "select 读卡,联合,判定合格 from mulu where 物品 = '" + goods +
"'";
//rs = super.executeQueryp (sqlm);
rs0 = DbAccess.querySqlOption(sqlm);
while (rs0.next ()) {
fm = rs0.getString ("读卡");
bl = rs0.getString ("联合");
mlhg = rs0.getString ("判定合格");
}
try {
if (rs0 != null) {rs0.close();}
}
catch (SQLException ex) {}
if (fm.trim ().equals ("n")) {
m = 14;
biaoshi = false;
}
String sqlPower = "select * from " + userids + " where 物品名称 = '" +
goods + "' and 察看保密 = 'y'";
//rs = super.executeQueryp (sqlPower);
rs1 = DbAccess.querySqlOption(sqlPower);
if (rs1.next ()) {
shPriv = "y";
}
try {
if (rs1 != null) { rs1.close();}
}
catch (SQLException ex) {}
sql = sqlFind ();
//rs = super.executeQueryp (sql);
rs = DbAccess.querySqlOptionp(sql);
String myrs = "";
//rsmd = super.executeQueryRsmt (sql);
rsmd = rs.getMetaData();
buf.append ("<tr bgcolor=\"#cccccc\" height= \"27\"> \n");
if (rsmd != null) {
int count = rsmd.getColumnCount ();
for (int i = 1; i <= count; i++) {
if (i > 3 && i < 17 || i == 21)
continue;
if (biaoshi && i == 19) //----
continue;
if (i == 23 && !biaoshi && mlhg.equals ("b"))
continue;
if (i <= 23)
buf.append (
"<td align=\"center\" height= \"24\" style=\"white-space:nowrap\">");
else
buf.append ("<td align=\"center\" height= \"24\">");
if (i == 2) {
if (biaoshi)
buf.append ("入厂日期");
else
buf.append ("取样日期");
} else if (i == 3)
buf.append ("编码流水");
else if (i == 17)
buf.append (" 样品来源 ");
else if (i == 18)
buf.append ("化验流水");
else if (i == 20)
buf.append ("化验日期");
else
buf.append (rsmd.getColumnName (i));
buf.append ("</td> \n");
}
if (bl.indexOf ("w") != -1) {
String blFindT = blFindTitle ();
buf.append (blFindT);
}
if (biaoshi) {
buf.append (
"<td align=\"center\" height= \"24\" style=\"white-space:nowrap\">");
buf.append ("车数</td>\n<td align=\"center\" height= \"24\" style=\"white-space:nowrap\">");
buf.append ("总重量kg</td>\n");
}
while (rs.next ()) {
rs_count++;
buf.append (
"<tr bgcolor=\"#FFFFFF\" height= \"22\" onclick=\"onClickColor(this);\">\n");
for (int i = 1; i <= count; i++) {
if(i==1)
fujian = rs.getString("l2");
if (i > 3 && i < 17 || i == 21)
continue;
if (biaoshi && i == 19)
continue; //读卡物资不显示标识列
if (i == 23 && !biaoshi && mlhg.equals ("b"))
continue; //不读卡物资,不显示合格与否列
if (i == 17 && rs.getString (17).length () >= 10)
buf.append ("<td align=\"center\">");
else
buf.append (
"<td align=\"center\" style=\"white-space:nowrap\">");
if (i == 17 || i <= 3 && i >= 1) {
String priv = rs.getString (5); //审核结束列
if (priv.trim ().equals ("y") ||
shPriv.equals ("y")) {
myrs = rs.getString (i);
lbView = true;
} else {
myrs = "******";
lbView = false;
}
} else if ((fujian!=null && i==19)||(fujian!=null && i==18 && biaoshi )){
if(fujian.indexOf("复检")!=-1)
myrs = rs.getString (i)+"<font color=\"#CC0000\">复检</font>";
else myrs = rs.getString(i);
}else{
myrs = rs.getString (i);
}
if (myrs == null || myrs.length () == 0) {
buf.append (" ");
} else {
if ( (i == 2 || i == 20) && !myrs.equals ("******")) {
buf.append (myrs.substring (0, 10));
} else {
if (myrs.length () <= 2) {
buf.append (" " + myrs + " ");
} else {
buf.append (myrs);
}
}
}
}
//----------------
if (bl.indexOf ("w") != -1) {
String blstr = "";
if (lbView || bl.indexOf ("s") != -1) {
blstr = blFindCont (rs.getString (7));
} else {
blstr = blFindCont ("");
}
buf.append (blstr);
}
//----------
if (biaoshi) {
String chehWe = chehaoFind (rs.getString (3));
ex ex = new ex ();
String[] chw = ex.split (chehWe, "@@");
if (lbView) {
buf.append (
"<td align=\"center\" height= \"24\" style=\"white-space:nowrap\">");
if (chw[0] != null) {
buf.append (
"<a href=\"#\" onMouseOver=\"showmessage('");
buf.append (chw[2]);
buf.append (
"')\" onMouseOut=\"hideticker()\">");
buf.append (chw[0]);
buf.append ("</a>");
}
buf.append ("</td>");
buf.append (
"<td align=\"center\" height= \"24\" style=\"white-space:nowrap\">");
buf.append (chw[1]+"</td>");
}else{
buf.append("<td></td><td></td>");
}
}
//-------------
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 (rs != null) { rs.close();}
}catch (SQLException ex) {}
}
return buf.toString ();
}
//审核查询-----------------------------------------------------------
public String checkFind () {
//String getStr = "";
StringBuffer buf = new StringBuffer ();
ResultSetMetaData rsmd = null;
MyResultSet rs = null; //此处不能省略,否则rs会只能查到一个值
MyResultSet rs11 = null;
MyResultSet rs12 = null;
MyResultSet rs15 = null;
MyResultSet rs14 = null;
ArrayList queslist = new ArrayList ();
String sql = "";
int m = 14;
String fm = "";
String shPriv = "n";
String signShen = "";
String judgech = "";
int signShenn = 0;
int isSignCheck = 0;
int rs_count = 0;
String bl = ""; //编码时录入
boolean lbView = true; //是否显示编码录入时的内容,默认为显示。
boolean biaoshi = true; //是否显示标识字段,默认为不显示//扩展功能为是否显示合格判定自段
String mlhg = ""; //mulu表中合格判定列值
//String bmls = "";//编码流水
String fujian = "";//是否复检
try {
String sqlm = "select 读卡,联合,判定合格 from mulu where 物品 = '" + goods +
"'";
//rs = super.executeQueryp (sqlm);
rs12 = DbAccess.querySqlOption(sqlm);
while (rs12.next ()) {
fm = rs12.getString ("读卡");
bl = rs12.getString ("联合");
mlhg = rs12.getString ("判定合格");
}
try {
if (rs12 != null) {rs12.close();}
}catch (SQLException ex) {}
if (fm.trim ().equals ("n")) {
m = 14; //不读卡物资
biaoshi = false;
}
String sqlPower = "select * from " + userids + " where 物品名称 = '" +
goods + "'";
//rs = super.executeQueryp (sqlPower);
rs14 = DbAccess.querySqlOption(sqlPower);
while (rs14.next ()) {
shPriv = rs14.getString ("察看保密");
signShen = rs14.getString ("审核级别");
judgech = rs14.getString ("合格");
signShenn = Integer.parseInt (signShen.trim ());
}
try {
if (rs14 != null) {rs14.close();}
}catch (SQLException ex) {}
sql = "select distinct bianma.使用单位,bianma.取样日期,bianma.编码流水," +
goods + ".* from " + goods + " LEFT OUTER JOIN bianma ON " +
goods + ".编码流水 = bianma.编码流水 where " + goods +
".作废 = 'n' and " + goods + ".审核结束 = 'n'";
//rs = super.executeQueryp (sql);
rs15 = DbAccess.querySqlOptionp(sql);
String myrs = "";
//rsmd = super.executeQueryRsmt (sql);
rsmd = rs15.getMetaData();
buf.append ("<tr bgcolor=\"#cccccc\" height= \"27\"> \n");
if (rsmd != null) {
int count = rsmd.getColumnCount ();
for (int i = 1; i <= count; i++) {
if (i > 3 && i < 17 || i == 21)
continue;
if (biaoshi && i == 19) //----
continue;
if (i == 23 && !biaoshi && mlhg.equals ("b"))
continue;
if (i <= 23)
buf.append (
"<td align=\"center\" height= \"24\" style=\"white-space:nowrap\">");
else
buf.append ("<td align=\"center\" height= \"24\">");
if (i == 2) {
if (biaoshi)
buf.append ("入厂日期");
else
buf.append ("取样日期");
} else if (i == 3)
buf.append ("编码流水");
else if (i == 17)
buf.append (" 样品来源 ");
else if (i == 18)
buf.append ("化验流水");
else if (i == 20)
buf.append ("化验日期");
else
buf.append (rsmd.getColumnName (i));
buf.append ("</td> \n");
}
if (bl.indexOf ("w") != -1) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -