最新价格查询增加物料备注查询条件

This commit is contained in:
mzr 2025-04-17 16:39:02 +08:00
parent 6e7f80cab5
commit ce12efdb62
2 changed files with 39 additions and 15 deletions

View File

@ -82,7 +82,7 @@ public class SupPriceQryRule {
return ""; return "";
} else { } else {
ConditionVO[] copyconvos = (ConditionVO[])CloneUtil.deepClone(convos); ConditionVO[] copyconvos = (ConditionVO[])CloneUtil.deepClone(convos);
List<ConditionVO> list = new ArrayList();
for(ConditionVO vo : copyconvos) { for(ConditionVO vo : copyconvos) {
if (vo.getFieldCode().equals(SupPriceRptConst.DBUSINESSDATE)) { if (vo.getFieldCode().equals(SupPriceRptConst.DBUSINESSDATE)) {
int month = Integer.valueOf(vo.getValue()); int month = Integer.valueOf(vo.getValue());
@ -91,17 +91,23 @@ public class SupPriceQryRule {
vo.setFieldCode(htablealias + ".dbilldate"); vo.setFieldCode(htablealias + ".dbilldate");
vo.setOperaCode("between"); vo.setOperaCode("between");
vo.setDataType(3); vo.setDataType(3);
String var10001 = befdate.toString(); String befdateStr = befdate.toString();
vo.setValue(var10001 + " ," + curdate.toString() + " "); vo.setValue(befdateStr + " ," + curdate.toString() + " ");
} else if (vo.getFieldCode().equals("pk_supplier")) { } else if (vo.getFieldCode().equals("pk_supplier")) {
vo.setFieldCode(htablealias + ".cvendorid"); vo.setFieldCode(htablealias + ".cvendorid");
} else if (vo.getFieldCode().equalsIgnoreCase("memo")) {
tranMap.put("memo", vo);
} else { } else {
vo.setFieldCode(htablealias + "." + vo.getFieldCode()); vo.setFieldCode(htablealias + "." + vo.getFieldCode());
} }
if (!vo.getFieldCode().equalsIgnoreCase("memo")) {
list.add(vo);
}
} }
StringBuilder sql = new StringBuilder(""); 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); this.addMarWhere(sql, tranMap, rptutils, btablealias);
return sql.toString(); return sql.toString();
} }
@ -162,9 +168,11 @@ public class SupPriceQryRule {
vo.setFieldCode(htablealias + ".dbilldate"); vo.setFieldCode(htablealias + ".dbilldate");
vo.setOperaCode("between"); vo.setOperaCode("between");
vo.setDataType(3); vo.setDataType(3);
String var10001 = befdate.toString(); String befdateStr = befdate.toString();
vo.setValue(var10001 + " ," + curdate.toString() + " "); vo.setValue(befdateStr + " ," + curdate.toString() + " ");
list.add(vo); list.add(vo);
} else if (vo.getFieldCode().equalsIgnoreCase("memo")) {
tranMap.put("memo", vo);
} else if (!vo.getFieldCode().equals("bsc")) { } else if (!vo.getFieldCode().equals("bsc")) {
vo.setFieldCode(htablealias + "." + vo.getFieldCode()); vo.setFieldCode(htablealias + "." + vo.getFieldCode());
list.add(vo); list.add(vo);
@ -184,7 +192,7 @@ public class SupPriceQryRule {
return ""; return "";
} else { } else {
ConditionVO[] copyconvos = (ConditionVO[])CloneUtil.deepClone(convos); ConditionVO[] copyconvos = (ConditionVO[])CloneUtil.deepClone(convos);
List<ConditionVO> list = new ArrayList();
for(ConditionVO vo : copyconvos) { for(ConditionVO vo : copyconvos) {
if (vo.getFieldCode().equals(SupPriceRptConst.DBUSINESSDATE)) { if (vo.getFieldCode().equals(SupPriceRptConst.DBUSINESSDATE)) {
int month = Integer.valueOf(vo.getValue()); int month = Integer.valueOf(vo.getValue());
@ -193,19 +201,25 @@ public class SupPriceQryRule {
vo.setFieldCode(tablealias + ".dvaliddate"); vo.setFieldCode(tablealias + ".dvaliddate");
vo.setOperaCode("between"); vo.setOperaCode("between");
vo.setDataType(3); vo.setDataType(3);
String var10001 = befdate.toString(); String befdateStr = befdate.toString();
vo.setValue(var10001 + " ," + curdate.toString() + " "); vo.setValue(befdateStr + " ," + curdate.toString() + " ");
} else if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { } else if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) {
UFDate date = new UFDate(vo.getValue()); UFDate date = new UFDate(vo.getValue());
vo.setValue(date.toLocalString()); vo.setValue(date.toLocalString());
vo.setFieldCode(tablealias + "." + vo.getFieldCode()); vo.setFieldCode(tablealias + "." + vo.getFieldCode());
} else if (vo.getFieldCode().equalsIgnoreCase("memo")) {
tranMap.put("memo", vo);
} else { } else {
vo.setFieldCode(tablealias + "." + vo.getFieldCode()); vo.setFieldCode(tablealias + "." + vo.getFieldCode());
} }
if (!vo.getFieldCode().equalsIgnoreCase("memo")) {
list.add(vo);
}
} }
StringBuilder sql = new StringBuilder(""); 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); this.addMarWhere(sql, tranMap, rptutils, tablealias);
return sql.toString(); return sql.toString();
} }

View File

@ -5,8 +5,6 @@
package nc.vo.pp.report.util; package nc.vo.pp.report.util;
import java.util.HashMap;
import java.util.Map;
import nc.bs.ic.icreport.pub.RPMetaDataUtil; import nc.bs.ic.icreport.pub.RPMetaDataUtil;
import nc.bs.pubapp.report.ReportPermissionUtils; import nc.bs.pubapp.report.ReportPermissionUtils;
import nc.pub.smart.context.SmartContext; 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.scmbd.pub.SCMESAPI;
import nc.vo.scmpub.util.ArrayUtil; import nc.vo.scmpub.util.ArrayUtil;
import java.util.HashMap;
import java.util.Map;
/** /**
* ×îм۸ñ²éѯ * ×îм۸ñ²éѯ
* 2005ÊÊÅä2312 * 2005ÊÊÅä2312
@ -58,9 +59,9 @@ public class PurpRptUtils {
if (vos != null && vos.length > 0) { if (vos != null && vos.length > 0) {
Object[][] datas = new Object[vos.length][fields.length]; 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) { 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]); datas[i][k] = vos[i].getAttributeValue(fields[k]);
} }
} }
@ -96,7 +97,8 @@ public class PurpRptUtils {
ConditionVO codeVO = this.getMarCondVO(tranMap, marcodeKey); ConditionVO codeVO = this.getMarCondVO(tranMap, marcodeKey);
ConditionVO nameVO = this.getMarCondVO(tranMap, marnameKey); ConditionVO nameVO = this.getMarCondVO(tranMap, marnameKey);
ConditionVO classVO = this.getMarCondVO(tranMap, marclassKey); 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 ""; return "";
} else { } else {
StringBuilder wheresql = new StringBuilder(); StringBuilder wheresql = new StringBuilder();
@ -116,6 +118,11 @@ public class PurpRptUtils {
wheresql.append(" and "); wheresql.append(" and ");
this.setMarWhere(classVO, "bd_material.pk_marbasclass", wheresql); 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(" ) "); wheresql.append(" ) ");
return wheresql.toString(); return wheresql.toString();
@ -169,6 +176,9 @@ public class PurpRptUtils {
} else if (condvo.getOperaCode().equals("left like")) { } else if (condvo.getOperaCode().equals("left like")) {
String value = condvo.getValue().replaceAll("\\(", "").replaceAll("\\)", ""); String value = condvo.getValue().replaceAll("\\(", "").replaceAll("\\)", "");
wheresql.append(field + " like '" + SCMESAPI.sqlEncodeGeneral(value) + "%' "); 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) + "%' ");
} }
} }