|
本帖最后由 lz_net 于 2014-11-25 11:41 编辑
我有一个ACTION用来作数量比较,并返回相应批次号:
public static Map<String, Object> return_PCH(String ID) throws NamingException, SQLException{
//根据主表返回出库批次号
String CHECK_PCH = "SELECT DISTINCT HX_CRK.fLSPCH AS fLSPCH FROM HX_CRK HX_CRK WHERE HX_CRK.fCRKLZZBID='"+ID+"'";
Connection conn = null;
Statement stat = null;
ResultSet rs = null;
Map<String, Object> result = new HashMap<String, Object>();
conn=ModelUtils.getConnection("/HX/ERP/data");
ContextHelper.getTransaction().begin(conn);
stat = conn.createStatement();
try{
rs = stat.executeQuery(CHECK_PCH);
while(rs.next()){
String fLSPCH = rs.getString("fLSPCH");
String MAX_LLCCPSL = "SELECT MAX(HX_CRK.fLLCCPSL) AS MAX FROM HX_CRK HX_CRK WHERE HX_CRK.fLSPCH = '"+fLSPCH+"'";
String MIN_LLCCPSL = "SELECT MIN(HX_CRK.fLLCCPSL) AS MIN FROM HX_CRK HX_CRK WHERE HX_CRK.fLSPCH = '"+fLSPCH+"'";
Connection conn1 = null;
Statement stat1 = null;
ResultSet rs1 = null;
ResultSet rs2 = null;
BigDecimal fLLCCPSL_MIN = new BigDecimal("0.0");
BigDecimal fLLCCPSL_MAX = new BigDecimal("0.0");
conn1=ModelUtils.getConnection("/HX/ERP/data");
ContextHelper.getTransaction().begin(conn1);
stat1 = conn1.createStatement();
try{
rs1 = stat1.executeQuery(MAX_LLCCPSL);
if(rs1.next()){
fLLCCPSL_MAX = rs1.getBigDecimal("MAX");
}
rs2 = stat1.executeQuery(MIN_LLCCPSL);
if(rs2.next()){
fLLCCPSL_MIN = rs2.getBigDecimal("MIN");
}
if(!fLLCCPSL_MAX.equals(fLLCCPSL_MIN)){
result.put("LSPCH", fLSPCH);
}
}
finally{
if(rs1 != null){
rs1.close();
rs1 = null;
}
if(rs2 != null){
rs2.close();
rs2 = null;
}
}
}
}
finally{
if(rs != null){
rs.close();
rs = null;
}
}
return result;
}
在JS中将结果存入cdata:
var param = new justep.Request.ActionParam();
param.setString('ID', ZBID);
justep.Request.sendBizRequest2({
dataType: "json",
action: "return_PCH",
parameters : param,
callback: function(result) {
if (result.state) {
justep.xbl("LSPCH").loadJson(result.response);
}
else{
throw new Error("调用失败!|" + result.response.message);
}
}
});
执行报错:Uncaught Type Cannot read property 'length' of undefined
我对map、数组操作不熟悉,请问怎样修改呢?谢谢
|
|