最新价格查询-init
This commit is contained in:
		
							parent
							
								
									9178d6123f
								
							
						
					
					
						commit
						4d2df055d7
					
				|  | @ -0,0 +1,5 @@ | ||||||
|  | <?xml version="1.0" encoding='gb2312'?> | ||||||
|  | 	<module displayname="purp" name="purp"> | ||||||
|  | 		<dependencies> | ||||||
|  | 		</dependencies> | ||||||
|  | 	</module> | ||||||
|  | @ -0,0 +1,273 @@ | ||||||
|  | // | ||||||
|  | // Source code recreated from a .class file by IntelliJ IDEA | ||||||
|  | // (powered by FernFlower decompiler) | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | package nc.impl.pp.supplierprice.rule; | ||||||
|  | 
 | ||||||
|  | import java.util.ArrayList; | ||||||
|  | import java.util.List; | ||||||
|  | import nc.vo.pp.report.entity.PurpReportTransMap; | ||||||
|  | import nc.vo.pp.report.util.PurpRptUtils; | ||||||
|  | import nc.vo.pp.supplierprice.entity.SupPriceRptConst; | ||||||
|  | import nc.vo.pp.util.StringUtils; | ||||||
|  | import nc.vo.pub.lang.UFDate; | ||||||
|  | import nc.vo.pub.query.ConditionVO; | ||||||
|  | import nc.vo.pubapp.AppContext; | ||||||
|  | import nc.vo.scmpub.util.ArrayUtil; | ||||||
|  | import nc.vo.util.CloneUtil; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * ×îм۸ñ²éѯ | ||||||
|  |  * 2005ÊÊÅä2312 | ||||||
|  |  * | ||||||
|  |  * @author mzr | ||||||
|  |  * @date 2025/04/16 | ||||||
|  |  */ | ||||||
|  | public class SupPriceQryRule { | ||||||
|  |     public SupPriceQryRule() { | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String getWhereCtForHis(PurpReportTransMap tranMap, PurpRptUtils rptutils, String htablealias, String btablealias) { | ||||||
|  |         ConditionVO[] convos = this.getInitQryCondVOs(tranMap, rptutils); | ||||||
|  |         if (ArrayUtil.isEmpty(convos)) { | ||||||
|  |             return ""; | ||||||
|  |         } else { | ||||||
|  |             ConditionVO[] copyconvos = (ConditionVO[])CloneUtil.deepClone(convos); | ||||||
|  |             List<ConditionVO> list = new ArrayList(); | ||||||
|  | 
 | ||||||
|  |             for(ConditionVO vo : copyconvos) { | ||||||
|  |                 if (vo.getFieldCode().equals("pk_supplier")) { | ||||||
|  |                     vo.setFieldCode(htablealias + ".cvendorid"); | ||||||
|  |                     list.add(vo); | ||||||
|  |                 } else if (vo.getFieldCode().equals("tcreatetime")) { | ||||||
|  |                     if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { | ||||||
|  |                         UFDate date = new UFDate(vo.getValue()); | ||||||
|  |                         vo.setValue(date.toLocalString()); | ||||||
|  |                     } | ||||||
|  | 
 | ||||||
|  |                     vo.setFieldCode(htablealias + ".creationtime"); | ||||||
|  |                     list.add(vo); | ||||||
|  |                 } else if (!vo.getFieldCode().equals("fpricesrctype")) { | ||||||
|  |                     if (vo.getFieldCode().equals("dvaliddate")) { | ||||||
|  |                         if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { | ||||||
|  |                             UFDate date = new UFDate(vo.getValue()); | ||||||
|  |                             vo.setValue(date.toLocalString()); | ||||||
|  |                         } | ||||||
|  | 
 | ||||||
|  |                         vo.setFieldCode(htablealias + ".dbilldate"); | ||||||
|  |                         list.add(vo); | ||||||
|  |                     } else if (vo.getFieldCode().equals("dinvaliddate")) { | ||||||
|  |                         if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { | ||||||
|  |                             UFDate date = new UFDate(vo.getValue()); | ||||||
|  |                             vo.setValue(date.toLocalString()); | ||||||
|  |                         } | ||||||
|  |                     } else { | ||||||
|  |                         vo.setFieldCode(htablealias + "." + vo.getFieldCode()); | ||||||
|  |                         list.add(vo); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             StringBuilder sql = new StringBuilder(""); | ||||||
|  |             sql.append((new ConditionVO()).getSQLStr((ConditionVO[])list.toArray(new ConditionVO[list.size()]))); | ||||||
|  |             this.addMarWhere(sql, tranMap, rptutils, btablealias); | ||||||
|  |             return sql.toString(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String getWhereCtForNew(PurpReportTransMap tranMap, PurpRptUtils rptutils, String htablealias, String btablealias) { | ||||||
|  |         ConditionVO[] convos = this.getInitQryCondVOs(tranMap, rptutils); | ||||||
|  |         if (ArrayUtil.isEmpty(convos)) { | ||||||
|  |             return ""; | ||||||
|  |         } else { | ||||||
|  |             ConditionVO[] copyconvos = (ConditionVO[])CloneUtil.deepClone(convos); | ||||||
|  | 
 | ||||||
|  |             for(ConditionVO vo : copyconvos) { | ||||||
|  |                 if (vo.getFieldCode().equals(SupPriceRptConst.DBUSINESSDATE)) { | ||||||
|  |                     int month = Integer.valueOf(vo.getValue()); | ||||||
|  |                     UFDate curdate = AppContext.getInstance().getBusiDate(); | ||||||
|  |                     UFDate befdate = curdate.getDateBefore(month * 30); | ||||||
|  |                     vo.setFieldCode(htablealias + ".dbilldate"); | ||||||
|  |                     vo.setOperaCode("between"); | ||||||
|  |                     vo.setDataType(3); | ||||||
|  |                     String var10001 = befdate.toString(); | ||||||
|  |                     vo.setValue(var10001 + " ," + curdate.toString() + " "); | ||||||
|  |                 } else if (vo.getFieldCode().equals("pk_supplier")) { | ||||||
|  |                     vo.setFieldCode(htablealias + ".cvendorid"); | ||||||
|  |                 } else { | ||||||
|  |                     vo.setFieldCode(htablealias + "." + vo.getFieldCode()); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             StringBuilder sql = new StringBuilder(""); | ||||||
|  |             sql.append((new ConditionVO()).getSQLStr(copyconvos)); | ||||||
|  |             this.addMarWhere(sql, tranMap, rptutils, btablealias); | ||||||
|  |             return sql.toString(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String getWhereOrderForHis(PurpReportTransMap tranMap, PurpRptUtils rptutils, String htablealias, String btablealias) { | ||||||
|  |         List<ConditionVO> list = new ArrayList(); | ||||||
|  |         ConditionVO[] convos = this.getInitQryCondVOs(tranMap, rptutils); | ||||||
|  |         if (ArrayUtil.isEmpty(convos)) { | ||||||
|  |             return ""; | ||||||
|  |         } else { | ||||||
|  |             ConditionVO[] convosCt = (ConditionVO[])CloneUtil.deepClone(convos); | ||||||
|  | 
 | ||||||
|  |             for(ConditionVO vo : convosCt) { | ||||||
|  |                 if (!vo.getFieldCode().equals("bsc") && !vo.getFieldCode().equals("fpricesrctype")) { | ||||||
|  |                     if (vo.getFieldCode().equals("dinvaliddate")) { | ||||||
|  |                         if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { | ||||||
|  |                             UFDate date = new UFDate(vo.getValue()); | ||||||
|  |                             vo.setValue(date.toLocalString()); | ||||||
|  |                         } | ||||||
|  |                     } else if (vo.getFieldCode().equals("dvaliddate")) { | ||||||
|  |                         if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { | ||||||
|  |                             UFDate date = new UFDate(vo.getValue()); | ||||||
|  |                             vo.setValue(date.toLocalString()); | ||||||
|  |                         } | ||||||
|  |                     } else if (vo.getFieldCode().equals("tcreatetime")) { | ||||||
|  |                         vo.setFieldCode(htablealias + ".creationtime"); | ||||||
|  |                         if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { | ||||||
|  |                             UFDate date = new UFDate(vo.getValue()); | ||||||
|  |                             vo.setValue(date.toLocalString()); | ||||||
|  |                         } | ||||||
|  | 
 | ||||||
|  |                         list.add(vo); | ||||||
|  |                     } else { | ||||||
|  |                         vo.setFieldCode(htablealias + "." + vo.getFieldCode()); | ||||||
|  |                         list.add(vo); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             StringBuilder sql = new StringBuilder(""); | ||||||
|  |             sql.append((new ConditionVO()).getSQLStr((ConditionVO[])list.toArray(new ConditionVO[list.size()]))); | ||||||
|  |             this.addMarWhere(sql, tranMap, rptutils, btablealias); | ||||||
|  |             return sql.toString(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String getWhereOrderForNew(PurpReportTransMap tranMap, PurpRptUtils rptutils, String htablealias, String btablealias) { | ||||||
|  |         List<ConditionVO> list = new ArrayList(); | ||||||
|  |         ConditionVO[] convos = this.getInitQryCondVOs(tranMap, rptutils); | ||||||
|  |         ConditionVO[] convosCt = (ConditionVO[])CloneUtil.deepClone(convos); | ||||||
|  |         if (convosCt != null && convosCt.length > 0) { | ||||||
|  |             for(ConditionVO vo : convosCt) { | ||||||
|  |                 if (vo.getFieldCode().equals(SupPriceRptConst.DBUSINESSDATE)) { | ||||||
|  |                     int month = Integer.valueOf(vo.getValue()); | ||||||
|  |                     UFDate curdate = AppContext.getInstance().getBusiDate(); | ||||||
|  |                     UFDate befdate = curdate.getDateBefore(month * 30); | ||||||
|  |                     vo.setFieldCode(htablealias + ".dbilldate"); | ||||||
|  |                     vo.setOperaCode("between"); | ||||||
|  |                     vo.setDataType(3); | ||||||
|  |                     String var10001 = befdate.toString(); | ||||||
|  |                     vo.setValue(var10001 + " ," + curdate.toString() + " "); | ||||||
|  |                     list.add(vo); | ||||||
|  |                 } else if (!vo.getFieldCode().equals("bsc")) { | ||||||
|  |                     vo.setFieldCode(htablealias + "." + vo.getFieldCode()); | ||||||
|  |                     list.add(vo); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         StringBuilder sql = new StringBuilder(""); | ||||||
|  |         sql.append((new ConditionVO()).getSQLStr((ConditionVO[])list.toArray(new ConditionVO[list.size()]))); | ||||||
|  |         this.addMarWhere(sql, tranMap, rptutils, btablealias); | ||||||
|  |         return sql.toString(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String getWhereSupPrice(PurpReportTransMap tranMap, PurpRptUtils rptutils, String tablealias) { | ||||||
|  |         ConditionVO[] convos = this.getInitQryCondVOs(tranMap, rptutils); | ||||||
|  |         if (ArrayUtil.isEmpty(convos)) { | ||||||
|  |             return ""; | ||||||
|  |         } else { | ||||||
|  |             ConditionVO[] copyconvos = (ConditionVO[])CloneUtil.deepClone(convos); | ||||||
|  | 
 | ||||||
|  |             for(ConditionVO vo : copyconvos) { | ||||||
|  |                 if (vo.getFieldCode().equals(SupPriceRptConst.DBUSINESSDATE)) { | ||||||
|  |                     int month = Integer.valueOf(vo.getValue()); | ||||||
|  |                     UFDate curdate = AppContext.getInstance().getBusiDate(); | ||||||
|  |                     UFDate befdate = curdate.getDateBefore(month * 30); | ||||||
|  |                     vo.setFieldCode(tablealias + ".dvaliddate"); | ||||||
|  |                     vo.setOperaCode("between"); | ||||||
|  |                     vo.setDataType(3); | ||||||
|  |                     String var10001 = befdate.toString(); | ||||||
|  |                     vo.setValue(var10001 + " ," + 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 { | ||||||
|  |                     vo.setFieldCode(tablealias + "." + vo.getFieldCode()); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             StringBuilder sql = new StringBuilder(""); | ||||||
|  |             sql.append((new ConditionVO()).getSQLStr(copyconvos)); | ||||||
|  |             this.addMarWhere(sql, tranMap, rptutils, tablealias); | ||||||
|  |             return sql.toString(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String getWhereSupPriceNew(PurpReportTransMap tranMap, PurpRptUtils rptutils, String tablealias) { | ||||||
|  |         ConditionVO[] convos = this.getInitQryCondVOs(tranMap, rptutils); | ||||||
|  |         if (ArrayUtil.isEmpty(convos)) { | ||||||
|  |             return ""; | ||||||
|  |         } else { | ||||||
|  |             ConditionVO[] copyconvos = (ConditionVO[])CloneUtil.deepClone(convos); | ||||||
|  |             List<ConditionVO> list = new ArrayList(); | ||||||
|  | 
 | ||||||
|  |             for(ConditionVO vo : copyconvos) { | ||||||
|  |                 if (vo.getFieldCode().equals(SupPriceRptConst.DBUSINESSDATE)) { | ||||||
|  |                     int month = Integer.valueOf(vo.getValue()); | ||||||
|  |                     UFDate curdate = AppContext.getInstance().getBusiDate(); | ||||||
|  |                     UFDate befdate = curdate.getDateBefore(month * 30); | ||||||
|  |                     vo.setFieldCode(tablealias + ".dinvaliddate"); | ||||||
|  |                     vo.setOperaCode("between"); | ||||||
|  |                     vo.setDataType(3); | ||||||
|  |                     String var10001 = befdate.toString(); | ||||||
|  |                     vo.setValue(var10001 + " ," + curdate.toString() + " "); | ||||||
|  |                     ConditionVO newvo = new ConditionVO(); | ||||||
|  |                     newvo.setLogic(false); | ||||||
|  |                     newvo.setFieldCode(tablealias + ".dvaliddate"); | ||||||
|  |                     newvo.setOperaCode("between"); | ||||||
|  |                     newvo.setDataType(3); | ||||||
|  |                     var10001 = befdate.toString(); | ||||||
|  |                     newvo.setValue(var10001 + " ," + curdate.toString() + " "); | ||||||
|  |                     list.add(vo); | ||||||
|  |                     list.add(newvo); | ||||||
|  |                 } else if (vo.getDataType() == 3 && vo.getOperaCode().equalsIgnoreCase("=")) { | ||||||
|  |                     UFDate date = new UFDate(vo.getValue()); | ||||||
|  |                     vo.setValue(date.toLocalString()); | ||||||
|  |                     vo.setFieldCode(tablealias + "." + vo.getFieldCode()); | ||||||
|  |                     list.add(vo); | ||||||
|  |                 } else { | ||||||
|  |                     vo.setFieldCode(tablealias + "." + vo.getFieldCode()); | ||||||
|  |                     list.add(vo); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             StringBuilder sql = new StringBuilder(""); | ||||||
|  |             sql.append((new ConditionVO()).getSQLStr((ConditionVO[])list.toArray(new ConditionVO[0]))); | ||||||
|  |             this.addMarWhere(sql, tranMap, rptutils, tablealias); | ||||||
|  |             return sql.toString(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private void addMarWhere(StringBuilder sql, PurpReportTransMap tranMap, PurpRptUtils rptutils, String btablealias) { | ||||||
|  |         String[] marQryKeys = new String[]{SupPriceRptConst.MARBASCLASS, SupPriceRptConst.MATERIALCODE, SupPriceRptConst.MARTERIALNAME}; | ||||||
|  |         String marwhere = rptutils.getWhereForMar(tranMap, btablealias, marQryKeys); | ||||||
|  |         if (!StringUtils.isEmpty(marwhere)) { | ||||||
|  |             sql.append(" and " + marwhere); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private ConditionVO[] getInitQryCondVOs(PurpReportTransMap tranMap, PurpRptUtils rptutils) { | ||||||
|  |         ConditionVO[] generalvos = tranMap.getConditionVOs(SupPriceRptConst.SUPPRICE_GENERALCOND); | ||||||
|  |         ConditionVO[] logicalvos = tranMap.getConditionVOs(SupPriceRptConst.SUPPRICE_LOGICALCOND); | ||||||
|  |         return rptutils.combineCondVOs(generalvos, logicalvos); | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | @ -0,0 +1,175 @@ | ||||||
|  | // | ||||||
|  | // Source code recreated from a .class file by IntelliJ IDEA | ||||||
|  | // (powered by FernFlower decompiler) | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | 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; | ||||||
|  | import nc.pub.smart.data.DataSet; | ||||||
|  | import nc.pub.smart.metadata.MetaData; | ||||||
|  | import nc.vo.ml.MultiLangUtil; | ||||||
|  | import nc.vo.ml.NCLangRes4VoTransl; | ||||||
|  | import nc.vo.pp.report.entity.PurpReportTransMap; | ||||||
|  | import nc.vo.pub.ISuperVO; | ||||||
|  | import nc.vo.pub.query.ConditionVO; | ||||||
|  | import nc.vo.pubapp.pattern.model.entity.view.AbstractDataView; | ||||||
|  | import nc.vo.pubapp.pattern.model.meta.entity.view.IDataViewMeta; | ||||||
|  | import nc.vo.scmbd.pub.SCMESAPI; | ||||||
|  | import nc.vo.scmpub.util.ArrayUtil; | ||||||
|  | 
 | ||||||
|  | /** | ||||||
|  |  * ×îм۸ñ²éѯ | ||||||
|  |  * 2005ÊÊÅä2312 | ||||||
|  |  * | ||||||
|  |  * @author mzr | ||||||
|  |  * @date 2025/04/16 | ||||||
|  |  */ | ||||||
|  | public class PurpRptUtils { | ||||||
|  |     public static final int UFDATEDATATIMETYPE = 8; | ||||||
|  |     public static final int UFDATEDATATYPE = 3; | ||||||
|  | 
 | ||||||
|  |     public PurpRptUtils() { | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public ConditionVO[] combineCondVOs(ConditionVO[] generalvos, ConditionVO[] logicalvos) { | ||||||
|  |         ConditionVO[] endvos = null; | ||||||
|  |         if (!ArrayUtil.isEmpty(generalvos)) { | ||||||
|  |             endvos = generalvos; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if (!ArrayUtil.isEmpty(logicalvos) && ArrayUtil.isEmpty(endvos)) { | ||||||
|  |             endvos = logicalvos; | ||||||
|  |         } else if (!ArrayUtil.isEmpty(logicalvos) && endvos != null && endvos.length > 0) { | ||||||
|  |             System.arraycopy(logicalvos, 0, endvos, endvos.length, logicalvos.length); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         return endvos; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public DataSet convertDataSet(IDataViewMeta md, AbstractDataView[] vos) { | ||||||
|  |         String[] fields = md.getAttributeNames(); | ||||||
|  |         MetaData mtd = new MetaData(); | ||||||
|  |         RPMetaDataUtil.addVOMetaFieldByKeys(mtd, md, fields); | ||||||
|  |         if (vos != null && vos.length > 0) { | ||||||
|  |             Object[][] datas = new Object[vos.length][fields.length]; | ||||||
|  | 
 | ||||||
|  |             for(int i = 0; i < vos.length; ++i) { | ||||||
|  |                 if (vos[i] != null) { | ||||||
|  |                     for(int k = 0; k < fields.length; ++k) { | ||||||
|  |                         datas[i][k] = vos[i].getAttributeValue(fields[k]); | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             return new DataSet(mtd, datas); | ||||||
|  |         } else { | ||||||
|  |             DataSet ds = new DataSet(); | ||||||
|  |             ds.setMetaData(mtd); | ||||||
|  |             return ds; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String getChnNo() { | ||||||
|  |         return NCLangRes4VoTransl.getNCLangRes().getStrByID("40050004", "1400500040031"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String getChnYes() { | ||||||
|  |         return NCLangRes4VoTransl.getNCLangRes().getStrByID("40050004", "1400500040030"); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String getPermisionInnerJoin(SmartContext context, Class<? extends ISuperVO> marclass, String btablealias) { | ||||||
|  |         ReportPermissionUtils utils = new ReportPermissionUtils(context); | ||||||
|  |         Map<Class<? extends ISuperVO>, String> beanMap = new HashMap(); | ||||||
|  |         beanMap.put(marclass, btablealias); | ||||||
|  |         return utils.getPermissionSQL(beanMap); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public String getWhereForMar(PurpReportTransMap tranMap, String btablealias, String[] marQryKeys) { | ||||||
|  |         String marclassKey = marQryKeys[0]; | ||||||
|  |         String marcodeKey = marQryKeys[1]; | ||||||
|  |         String marnameKey = marQryKeys[2]; | ||||||
|  |         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) { | ||||||
|  |             return ""; | ||||||
|  |         } else { | ||||||
|  |             StringBuilder wheresql = new StringBuilder(); | ||||||
|  |             wheresql.append(btablealias + ".pk_material in ( select bd_material.pk_material from bd_material bd_material where bd_material.dr=0 "); | ||||||
|  |             if (codeVO != null) { | ||||||
|  |                 wheresql.append(" and "); | ||||||
|  |                 this.setMarWhere(codeVO, "bd_material.code", wheresql); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             if (nameVO != null) { | ||||||
|  |                 String langseq = MultiLangUtil.getCurrentLangSeqSuffix(); | ||||||
|  |                 wheresql.append(" and "); | ||||||
|  |                 this.setMarWhere(nameVO, "bd_material.name" + langseq, wheresql); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             if (classVO != null) { | ||||||
|  |                 wheresql.append(" and "); | ||||||
|  |                 this.setMarWhere(classVO, "bd_material.pk_marbasclass", wheresql); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             wheresql.append(" ) "); | ||||||
|  |             return wheresql.toString(); | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public ConditionVO updUFDateCondVO(ConditionVO condvo, String qryDlgWhereSql, String dateField) { | ||||||
|  |         if (!qryDlgWhereSql.contains(dateField)) { | ||||||
|  |             return null; | ||||||
|  |         } else { | ||||||
|  |             String[] conds = qryDlgWhereSql.split(dateField); | ||||||
|  |             StringBuilder valueBuilder = new StringBuilder(); | ||||||
|  |             String first = conds[1].split("'")[1]; | ||||||
|  |             if (condvo.getOperaCode().equalsIgnoreCase("between")) { | ||||||
|  |                 if (condvo.getValue().toLowerCase().contains("isnull")) { | ||||||
|  |                     if (condvo.getValue().toLowerCase().startsWith("isnull")) { | ||||||
|  |                         valueBuilder.append(first); | ||||||
|  |                         condvo.setOperaCode("<="); | ||||||
|  |                     } else { | ||||||
|  |                         valueBuilder.append(first); | ||||||
|  |                         condvo.setOperaCode(">="); | ||||||
|  |                     } | ||||||
|  | 
 | ||||||
|  |                     condvo.setValue(valueBuilder.toString()); | ||||||
|  |                     return condvo; | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 String end = conds[2].split("'")[1]; | ||||||
|  |                 valueBuilder.append(first); | ||||||
|  |                 valueBuilder.append(","); | ||||||
|  |                 valueBuilder.append(end); | ||||||
|  |             } else { | ||||||
|  |                 valueBuilder.append(first); | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             condvo.setValue(valueBuilder.toString()); | ||||||
|  |             return condvo; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private ConditionVO getMarCondVO(PurpReportTransMap tranMap, String key) { | ||||||
|  |         ConditionVO[] tempvos = tranMap.getConditionVOs(key); | ||||||
|  |         return ArrayUtil.isEmpty(tempvos) ? null : tempvos[0]; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private void setMarWhere(ConditionVO condvo, String field, StringBuilder wheresql) { | ||||||
|  |         if (condvo.getOperaCode().equals("in")) { | ||||||
|  |             wheresql.append(field + " in " + condvo.getValue()); | ||||||
|  |         } else if (condvo.getOperaCode().equals("=")) { | ||||||
|  |             wheresql.append(field + " = '" + SCMESAPI.sqlEncodeGeneral(condvo.getValue()) + "' "); | ||||||
|  |         } else if (condvo.getOperaCode().equals("left like")) { | ||||||
|  |             String value = condvo.getValue().replaceAll("\\(", "").replaceAll("\\)", ""); | ||||||
|  |             wheresql.append(field + " like '" + SCMESAPI.sqlEncodeGeneral(value) + "%' "); | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue