diff --git a/purp/src/private/nc/impl/pp/supplierprice/rule/SupPriceQryRule.java b/purp/src/private/nc/impl/pp/supplierprice/rule/SupPriceQryRule.java index bcaed47..081dd3a 100644 --- a/purp/src/private/nc/impl/pp/supplierprice/rule/SupPriceQryRule.java +++ b/purp/src/private/nc/impl/pp/supplierprice/rule/SupPriceQryRule.java @@ -82,7 +82,7 @@ public class SupPriceQryRule { return ""; } else { ConditionVO[] copyconvos = (ConditionVO[])CloneUtil.deepClone(convos); - + List list = new ArrayList(); for(ConditionVO vo : copyconvos) { if (vo.getFieldCode().equals(SupPriceRptConst.DBUSINESSDATE)) { int month = Integer.valueOf(vo.getValue()); @@ -91,17 +91,23 @@ public class SupPriceQryRule { vo.setFieldCode(htablealias + ".dbilldate"); vo.setOperaCode("between"); vo.setDataType(3); - String var10001 = befdate.toString(); - vo.setValue(var10001 + " ," + curdate.toString() + " "); + String befdateStr = befdate.toString(); + vo.setValue(befdateStr + " ," + curdate.toString() + " "); } else if (vo.getFieldCode().equals("pk_supplier")) { vo.setFieldCode(htablealias + ".cvendorid"); + } else if (vo.getFieldCode().equalsIgnoreCase("memo")) { + tranMap.put("memo", vo); } else { vo.setFieldCode(htablealias + "." + vo.getFieldCode()); } + if (!vo.getFieldCode().equalsIgnoreCase("memo")) { + list.add(vo); + } } StringBuilder sql = new StringBuilder(""); - sql.append((new ConditionVO()).getSQLStr(copyconvos)); + ConditionVO[] array = list.toArray(new ConditionVO[0]); + sql.append((new ConditionVO()).getSQLStr(array)); this.addMarWhere(sql, tranMap, rptutils, btablealias); return sql.toString(); } @@ -162,9 +168,11 @@ public class SupPriceQryRule { vo.setFieldCode(htablealias + ".dbilldate"); vo.setOperaCode("between"); vo.setDataType(3); - String var10001 = befdate.toString(); - vo.setValue(var10001 + " ," + curdate.toString() + " "); + String befdateStr = befdate.toString(); + vo.setValue(befdateStr + " ," + curdate.toString() + " "); list.add(vo); + } else if (vo.getFieldCode().equalsIgnoreCase("memo")) { + tranMap.put("memo", vo); } else if (!vo.getFieldCode().equals("bsc")) { vo.setFieldCode(htablealias + "." + vo.getFieldCode()); list.add(vo); @@ -184,7 +192,7 @@ public class SupPriceQryRule { return ""; } else { ConditionVO[] copyconvos = (ConditionVO[])CloneUtil.deepClone(convos); - + List list = new ArrayList(); for(ConditionVO vo : copyconvos) { if (vo.getFieldCode().equals(SupPriceRptConst.DBUSINESSDATE)) { int month = Integer.valueOf(vo.getValue()); @@ -193,19 +201,25 @@ public class SupPriceQryRule { vo.setFieldCode(tablealias + ".dvaliddate"); vo.setOperaCode("between"); vo.setDataType(3); - String var10001 = befdate.toString(); - vo.setValue(var10001 + " ," + curdate.toString() + " "); + String befdateStr = befdate.toString(); + vo.setValue(befdateStr + " ," + curdate.toString() + " "); } else if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { UFDate date = new UFDate(vo.getValue()); vo.setValue(date.toLocalString()); vo.setFieldCode(tablealias + "." + vo.getFieldCode()); + } else if (vo.getFieldCode().equalsIgnoreCase("memo")) { + tranMap.put("memo", vo); } else { vo.setFieldCode(tablealias + "." + vo.getFieldCode()); } + if (!vo.getFieldCode().equalsIgnoreCase("memo")) { + list.add(vo); + } } StringBuilder sql = new StringBuilder(""); - sql.append((new ConditionVO()).getSQLStr(copyconvos)); + ConditionVO[] array = list.toArray(new ConditionVO[0]); + sql.append((new ConditionVO()).getSQLStr(array)); this.addMarWhere(sql, tranMap, rptutils, tablealias); return sql.toString(); } diff --git a/purp/src/public/nc/vo/pp/report/util/PurpRptUtils.java b/purp/src/public/nc/vo/pp/report/util/PurpRptUtils.java index fcfae47..a0bdcaf 100644 --- a/purp/src/public/nc/vo/pp/report/util/PurpRptUtils.java +++ b/purp/src/public/nc/vo/pp/report/util/PurpRptUtils.java @@ -5,8 +5,6 @@ package nc.vo.pp.report.util; -import java.util.HashMap; -import java.util.Map; import nc.bs.ic.icreport.pub.RPMetaDataUtil; import nc.bs.pubapp.report.ReportPermissionUtils; import nc.pub.smart.context.SmartContext; @@ -22,6 +20,9 @@ import nc.vo.pubapp.pattern.model.meta.entity.view.IDataViewMeta; import nc.vo.scmbd.pub.SCMESAPI; import nc.vo.scmpub.util.ArrayUtil; +import java.util.HashMap; +import java.util.Map; + /** * 最新价格查询 * 2005适配2312 @@ -58,9 +59,9 @@ public class PurpRptUtils { if (vos != null && vos.length > 0) { Object[][] datas = new Object[vos.length][fields.length]; - for(int i = 0; i < vos.length; ++i) { + for (int i = 0; i < vos.length; ++i) { if (vos[i] != null) { - for(int k = 0; k < fields.length; ++k) { + for (int k = 0; k < fields.length; ++k) { datas[i][k] = vos[i].getAttributeValue(fields[k]); } } @@ -96,7 +97,8 @@ public class PurpRptUtils { ConditionVO codeVO = this.getMarCondVO(tranMap, marcodeKey); ConditionVO nameVO = this.getMarCondVO(tranMap, marnameKey); ConditionVO classVO = this.getMarCondVO(tranMap, marclassKey); - if (null == codeVO && null == nameVO && null == classVO) { + boolean flag = tranMap.get("memo") == null; + if (null == codeVO && null == nameVO && null == classVO && flag) { return ""; } else { StringBuilder wheresql = new StringBuilder(); @@ -116,6 +118,11 @@ public class PurpRptUtils { wheresql.append(" and "); this.setMarWhere(classVO, "bd_material.pk_marbasclass", wheresql); } + if (!flag) { + ConditionVO memoVo = (ConditionVO) tranMap.get("memo"); + wheresql.append(" and "); + this.setMarWhere(memoVo, "bd_material.memo", wheresql); + } wheresql.append(" ) "); return wheresql.toString(); @@ -169,6 +176,9 @@ public class PurpRptUtils { } else if (condvo.getOperaCode().equals("left like")) { String value = condvo.getValue().replaceAll("\\(", "").replaceAll("\\)", ""); wheresql.append(field + " like '" + SCMESAPI.sqlEncodeGeneral(value) + "%' "); + } else if (condvo.getOperaCode().equals("like")) { + String value = condvo.getValue().replaceAll("\\(", "").replaceAll("\\)", ""); + wheresql.append(field + " like '%" + SCMESAPI.sqlEncodeGeneral(value) + "%' "); } }