yxy_采购入库新增接口货位翻译逻辑处理
This commit is contained in:
		
							parent
							
								
									1fb65a9ecb
								
							
						
					
					
						commit
						e6836e42dc
					
				|  | @ -0,0 +1,5 @@ | |||
| <?xml version="1.0" encoding='gb2312'?> | ||||
| 	<module displayname="yxy" name="yxy"> | ||||
| 		<dependencies> | ||||
| 		</dependencies> | ||||
| 	</module> | ||||
|  | @ -0,0 +1,625 @@ | |||
| package nc.impl.urmex.pub; | ||||
| 
 | ||||
| import java.text.MessageFormat; | ||||
| import java.util.Collection; | ||||
| import java.util.HashMap; | ||||
| import java.util.HashSet; | ||||
| import java.util.Map; | ||||
| import java.util.Set; | ||||
| import java.util.concurrent.ConcurrentHashMap; | ||||
| 
 | ||||
| import nc.bs.dao.BaseDAO; | ||||
| import nc.bs.framework.common.InvocationInfoProxy; | ||||
| import nc.bs.framework.common.NCLocator; | ||||
| import nc.impl.pubapp.env.BSContext; | ||||
| import nc.itf.so.m30trantype.IM30TranTypeService; | ||||
| import nc.itf.uap.IUAPQueryBS; | ||||
| import nc.itf.uap.pf.IPFConfig; | ||||
| import nc.itf.urmex.pub.IRMGlobalCache; | ||||
| import nc.pubitf.org.IOrgUnitPubService; | ||||
| import nc.vo.bd.balatype.BalaTypeVO; | ||||
| import nc.vo.bd.currtype.CurrtypeVO; | ||||
| import nc.vo.bd.cust.CustomerVO; | ||||
| import nc.vo.bd.material.MaterialVersionVO; | ||||
| import nc.vo.bd.material.measdoc.MeasdocVO; | ||||
| import nc.vo.bd.psn.PsndocVO; | ||||
| import nc.vo.bd.rack.RackVO; | ||||
| import nc.vo.bd.stordoc.StordocVO; | ||||
| import nc.vo.bd.supplier.SupplierVO; | ||||
| import nc.vo.fibd.RecpaytypeVO; | ||||
| import nc.vo.org.DeptVO; | ||||
| import nc.vo.org.OrgVO; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pub.SuperVO; | ||||
| import nc.vo.pub.billtype.BilltypeVO; | ||||
| import nc.vo.pubapp.AppContext; | ||||
| import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||
| import nc.vo.scmf.ic.mbatchcode.BatchcodeVO; | ||||
| import nc.vo.scmpub.res.billtype.SOBillType; | ||||
| import nc.vo.so.m30trantype.entity.M30TranTypeVO; | ||||
| import nc.vo.so.mreturnreason.entity.ReturnReasonVO; | ||||
| import nc.vo.bd.goodsref.GoodsRefVO; | ||||
| import nc.vo.urmex.pub.util.SqlBuilder; | ||||
| import nc.vo.urmex.pub.util.SqlUtil; | ||||
| import nc.vo.urmex.pub.util.StringUtil; | ||||
| 
 | ||||
| 
 | ||||
| /** | ||||
|  * @description 档案信息查询与清空 | ||||
|  * @author tianglk | ||||
|  * @date 2022年3月15日 下午1:13:50 | ||||
|  * @version ncc1.0 | ||||
|  */ | ||||
| public class RMGlobalCacheImpl implements IRMGlobalCache { | ||||
| 
 | ||||
|     private IUAPQueryBS queryBS = null; | ||||
| 
 | ||||
|     public final IUAPQueryBS getQueryBS() { | ||||
|         if (null == queryBS) { | ||||
|             queryBS = NCLocator.getInstance().lookup(IUAPQueryBS.class); | ||||
|         } | ||||
|         return queryBS; | ||||
|     } | ||||
| 
 | ||||
|     BaseDAO baseDAO = null; | ||||
| 
 | ||||
|     public final BaseDAO getBaseDAO() { | ||||
|         if (baseDAO == null) { | ||||
|             baseDAO = new BaseDAO(); | ||||
|         } | ||||
|         return baseDAO; | ||||
|     } | ||||
| 
 | ||||
|     Map<String, SuperVO> cache = new ConcurrentHashMap<String, SuperVO>(); | ||||
| 
 | ||||
|     private void retrieveVOByCode(String prefix, String codeField, String[] codes, Class<? extends SuperVO> className, | ||||
|                                   String condition) throws BusinessException { | ||||
|         String pk_group = InvocationInfoProxy.getInstance().getGroupId(); | ||||
|         this.retrieveVOByCode(prefix, codeField, codes, className, condition, pk_group); | ||||
|     } | ||||
| 
 | ||||
|     @SuppressWarnings("unchecked") | ||||
|     private void retrieveVOByCode(String prefix, String codeField, String[] codes, Class<? extends SuperVO> className, | ||||
|                                   String condition, String pk_group) throws BusinessException { | ||||
|         Set<String> codeset = new HashSet<String>(); | ||||
|         for (String code : codes) { | ||||
|             String key = MessageFormat.format("{0}{1}{2}", prefix, pk_group, code); | ||||
|             if (!cache.containsKey(key)) { | ||||
|                 codeset.add(code); | ||||
|             } | ||||
|         } | ||||
|         if (codeset.size() > 0) { | ||||
|             SqlBuilder sb = new SqlBuilder(); | ||||
|             sb.append("isnull(dr,0)", 0); | ||||
|             sb.append(" and "); | ||||
|             if ("currtype_".equals(prefix)) { // 币种特殊处理 | ||||
|                 sb.append("pk_org", new String[] { pk_group, "~" }); | ||||
|             } else { | ||||
|                 sb.append("pk_group", new String[] { pk_group, "~" }); | ||||
|             } | ||||
|             sb.append(" and "); | ||||
|             sb.append(SqlUtil.getInOrExistsSql("", codeField, codeset.toArray(new String[codeset.size()]))); | ||||
|             if (!StringUtil.isSEmptyOrNull(condition)) { | ||||
|                 sb.append(" and "); | ||||
|                 sb.append(condition); | ||||
|             } | ||||
|             Collection<SuperVO> vos = this.getQueryBS().retrieveByClause(className, sb.toString()); | ||||
|             for (SuperVO vo : vos) { | ||||
|                 String code = vo.getAttributeValue(codeField).toString(); | ||||
|                 String key = MessageFormat.format("{0}{1}{2}", prefix, pk_group, code); | ||||
|                 if (cache.containsKey(key)) { | ||||
|                     SuperVO cacheVO = cache.get(key); | ||||
|                     if (!cacheVO.getPrimaryKey().equals(vo.getPrimaryKey())) { | ||||
|                         ExceptionUtils.wrappBusinessException(nc.vo.ml.NCLangRes4VoTransl.getNCLangRes().getStrByID("4081004_0","04081004-0073", null, new String[] {code}));/*@res "编码为{0}的档案查询结果不唯一,请检查!"*/ | ||||
|                     } | ||||
|                 } | ||||
|                 cache.put(key, vo); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Map<String, OrgVO> getOrgVO(String[] codes) throws BusinessException { | ||||
|         String prefix = "org_"; | ||||
|         Map<String, OrgVO> ret = new HashMap<String, OrgVO>(); | ||||
|         this.retrieveVOByCode(prefix, "code", codes, OrgVO.class, "isbusinessunit='Y' and islastversion='Y'"); | ||||
|         for (String code : codes) { | ||||
|             String key = MessageFormat.format("{0}{1}{2}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                     code); | ||||
|             if (cache.containsKey(key)) { | ||||
|                 ret.put(code, (OrgVO) cache.get(key)); | ||||
|             } | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Map<String, CustomerVO> getCustomerVO(String[] codes) throws BusinessException { | ||||
|         String prefix = "cust_"; | ||||
|         Map<String, CustomerVO> ret = new HashMap<String, CustomerVO>(); | ||||
|         this.retrieveVOByCode(prefix, "code", codes, CustomerVO.class, ""); | ||||
|         for (String code : codes) { | ||||
|             String key = MessageFormat.format("{0}{1}{2}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                     code); | ||||
|             if (cache.containsKey(key)) { | ||||
|                 ret.put(code, (CustomerVO) cache.get(key)); | ||||
|             } | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     @Override | ||||
|     public Map<String, BilltypeVO> getTranstypeVO(String[] codes) throws BusinessException { | ||||
|         String pk_group = InvocationInfoProxy.getInstance().getGroupId(); | ||||
|         String initBillTypeKey = MessageFormat.format("initBillType_{0}", pk_group); | ||||
|         if (!cache.containsKey(initBillTypeKey)) { | ||||
|             //有可能事务回滚导致缓存不准,所以需要清空一下 | ||||
|             cache.clear(); | ||||
|             cache.put(initBillTypeKey, new BilltypeVO()); | ||||
|         } | ||||
|         String prefix = "trantype_"; | ||||
|         Map<String, BilltypeVO> ret = new HashMap<String, BilltypeVO>(); | ||||
|         this.retrieveVOByCode(prefix, "pk_billtypecode", codes, BilltypeVO.class, ""); | ||||
|         for (String code : codes) { | ||||
|             String key = MessageFormat.format("{0}{1}{2}", prefix, pk_group, code); | ||||
|             if (cache.containsKey(key)) { | ||||
|                 ret.put(code, (BilltypeVO) cache.get(key)); | ||||
|             } | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
|     @SuppressWarnings("unchecked") | ||||
|     @Override | ||||
|     public Map<String, BatchcodeVO> getBatchcodeVO(String[] materialvids, String[] batchcodes) | ||||
|             throws BusinessException { | ||||
|         Map<String, BatchcodeVO> ret = new HashMap<String, BatchcodeVO>(); | ||||
|         Map<String, String> materialmap = new HashMap<String, String>(); | ||||
|         Map<String, String> batchmap = new HashMap<String, String>(); | ||||
|         for (int i = 0; i < materialvids.length; i++) { | ||||
|             materialmap.put(materialvids[i], materialvids[i]); | ||||
|             batchmap.put(batchcodes[i], batchcodes[i]); | ||||
|         } | ||||
|         SqlBuilder sb = new SqlBuilder(); | ||||
|         sb.append("pk_group", InvocationInfoProxy.getInstance().getGroupId()); | ||||
|         sb.append("isnull(dr,0)", 0); | ||||
|         sb.append(" and "); | ||||
|         sb.append(SqlUtil.getInOrExistsSql("", "cmaterialvid", materialvids)); | ||||
|         sb.append(" and "); | ||||
|         sb.append(SqlUtil.getInOrExistsSql("", "vbatchcode", batchcodes)); | ||||
|         Collection<BatchcodeVO> vos = this.getQueryBS().retrieveByClause(BatchcodeVO.class, sb.toString()); | ||||
|         for (BatchcodeVO vo : vos) { | ||||
|             String cmaterialvid = vo.getCmaterialvid(); | ||||
|             String vbatchcode = vo.getVbatchcode(); | ||||
|             if (materialmap.containsKey(cmaterialvid) && batchmap.containsKey(vbatchcode)) { | ||||
|                 String key = cmaterialvid + "#" + vbatchcode; | ||||
|                 ret.put(key, vo); | ||||
|             } | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Map<String, PsndocVO> getPsndocVO(String[] codes) throws BusinessException { | ||||
|         String prefix = "psn_"; | ||||
|         Map<String, PsndocVO> ret = new HashMap<String, PsndocVO>(); | ||||
|         this.retrieveVOByCode(prefix, "code", codes, PsndocVO.class, ""); | ||||
|         for (String code : codes) { | ||||
|             String key = MessageFormat.format("{0}{1}{2}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                     code); | ||||
|             if (cache.containsKey(key)) { | ||||
|                 ret.put(code, (PsndocVO) cache.get(key)); | ||||
|             } | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Map<String, MaterialVersionVO> getMaterialVersionVO(String[] codes) throws BusinessException { | ||||
|         String prefix = "material_"; | ||||
|         Map<String, MaterialVersionVO> ret = new HashMap<String, MaterialVersionVO>(); | ||||
|         this.retrieveVOByCode(prefix, "code", codes, MaterialVersionVO.class, "enablestate=2"); | ||||
|         for (String code : codes) { | ||||
|             String key = MessageFormat.format("{0}{1}{2}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                     code); | ||||
|             if (cache.containsKey(key)) { | ||||
|                 ret.put(code, (MaterialVersionVO) cache.get(key)); | ||||
|             } | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
|     @SuppressWarnings("unchecked") | ||||
|     @Override | ||||
|     public Map<String, MeasdocVO> getMeasdocVO(String[] codes) throws BusinessException { | ||||
|         String prefix = "measdoc_"; | ||||
|         Set<String> codeset = new HashSet<String>(); | ||||
|         for (String code : codes) { | ||||
|             String key = MessageFormat.format("{0}{1}", prefix, code); | ||||
|             if (!cache.containsKey(key)) { | ||||
|                 codeset.add(code); | ||||
|             } | ||||
|         } | ||||
|         if (codeset.size() > 0) { | ||||
|             SqlBuilder sb = new SqlBuilder(); | ||||
|             sb.append("isnull(dr,0)", 0); | ||||
|             sb.append(" and "); | ||||
|             sb.append(SqlUtil.getInOrExistsSql("", "code", codeset.toArray(new String[codeset.size()]))); | ||||
|             Collection<SuperVO> vos = this.getQueryBS().retrieveByClause(MeasdocVO.class, sb.toString()); | ||||
|             for (SuperVO vo : vos) { | ||||
|                 String code = vo.getAttributeValue("code").toString(); | ||||
|                 String key = MessageFormat.format("{0}{1}", prefix, code); | ||||
|                 cache.put(key, vo); | ||||
|             } | ||||
|         } | ||||
|         Map<String, MeasdocVO> ret = new HashMap<String, MeasdocVO>(); | ||||
|         for (String code : codes) { | ||||
|             String key = MessageFormat.format("{0}{1}", prefix, code); | ||||
|             if (cache.containsKey(key)) { | ||||
|                 ret.put(code, (MeasdocVO) cache.get(key)); | ||||
|             } | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public OrgVO getOrgVOByPK(String pkOrg) throws BusinessException { | ||||
|         String prefix = "org_"; | ||||
|         Set<String> set = new HashSet<String>(); | ||||
|         String key = prefix + pkOrg; | ||||
|         if (!cache.containsKey(key)) { | ||||
|             set.add(pkOrg); | ||||
|         } | ||||
|         if (set.size() > 0) { | ||||
|             IOrgUnitPubService orgService = NCLocator.getInstance().lookup(IOrgUnitPubService.class); | ||||
|             OrgVO[] orgVOs = orgService.getOrgs(new String[] { pkOrg }, new String[] { OrgVO.CODE,OrgVO.PK_VID }); | ||||
|             if (orgVOs != null && orgVOs.length > 0) { | ||||
|                 cache.put(key, orgVOs[0]); | ||||
|             } | ||||
|         } | ||||
|         return (OrgVO) cache.get(key); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Map<String, GoodsRefVO> getSKUVO(String[] codes) throws BusinessException { | ||||
| 
 | ||||
|         String prefix = "sku_"; | ||||
|         String condition = " exists(select 1 from bd_material_v where bd_material_v.pk_source=urm_goodsref.pk_material)"; | ||||
|         Map<String, GoodsRefVO> ret = new HashMap<String, GoodsRefVO>(); | ||||
|         this.retrieveVOByCode(prefix, "goodscode", codes, GoodsRefVO.class, condition); | ||||
|         for (String code : codes) { | ||||
|             String key = MessageFormat.format("{0}{1}{2}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                     code); | ||||
|             if (cache.containsKey(key)) { | ||||
|                 ret.put(code, (GoodsRefVO) cache.get(key)); | ||||
|             } | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public M30TranTypeVO getM30TranstypeVO(String code) throws BusinessException { | ||||
|         String prefix = "m30_trantype_"; | ||||
|         String key = prefix + code; | ||||
|         this.initM30TransType(prefix, key, code); | ||||
|         return (M30TranTypeVO) cache.get(key); | ||||
|     } | ||||
| 
 | ||||
|     private void initM30TransType(String prefix, String key, String code) throws BusinessException { | ||||
|         M30TranTypeVO vo = NCLocator.getInstance().lookup(IM30TranTypeService.class) | ||||
|                 .queryTranType(AppContext.getInstance().getPkGroup(), code); | ||||
|         if (null != vo) { | ||||
|             cache.put(key, vo); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * 设置业务流程 | ||||
|      */ | ||||
|     @Override | ||||
|     public String getBusitypeCanStart(String csaleorgid, String destTransType) throws BusinessException { | ||||
| 
 | ||||
|         String userId = BSContext.getInstance().getUserID(); | ||||
| 
 | ||||
|         String cbiztypeid = null; | ||||
|         try { | ||||
| 
 | ||||
|             IPFConfig pfsrv = NCLocator.getInstance().lookup(IPFConfig.class); | ||||
|             cbiztypeid = pfsrv.retBusitypeCanStart(SOBillType.Order.getCode(), destTransType, csaleorgid, userId); | ||||
| 
 | ||||
|         } catch (BusinessException e) { | ||||
|             ExceptionUtils.wrappException(e); | ||||
|         } | ||||
|         return cbiztypeid; | ||||
|     } | ||||
| 
 | ||||
|     @SuppressWarnings("unchecked") | ||||
|     @Override | ||||
|     public Map<String, BalaTypeVO> getSettleVO(String[] codes) throws BusinessException { | ||||
|         String prefix = "settle_"; | ||||
|         Set<String> codeset = new HashSet<String>(); | ||||
|         for (String code : codes) { | ||||
|             String key = MessageFormat.format("{0}{1}", prefix, code); | ||||
|             if (!cache.containsKey(key)) { | ||||
|                 codeset.add(code); | ||||
|             } | ||||
|         } | ||||
|         if (codeset.size() > 0) { | ||||
|             SqlBuilder sb = new SqlBuilder(); | ||||
|             sb.append("isnull(dr,0)", 0); | ||||
|             sb.append(" and "); | ||||
|             sb.append(SqlUtil.getInOrExistsSql("", "code", codeset.toArray(new String[codeset.size()]))); | ||||
|             Collection<SuperVO> vos = this.getQueryBS().retrieveByClause(BalaTypeVO.class, sb.toString()); | ||||
|             for (SuperVO vo : vos) { | ||||
|                 String code = vo.getAttributeValue("code").toString(); | ||||
|                 String key = MessageFormat.format("{0}{1}", prefix, code); | ||||
|                 cache.put(key, vo); | ||||
|             } | ||||
|         } | ||||
|         Map<String, BalaTypeVO> ret = new HashMap<String, BalaTypeVO>(); | ||||
|         for (String code : codes) { | ||||
|             String key = MessageFormat.format("{0}{1}", prefix, code); | ||||
|             if (cache.containsKey(key)) { | ||||
|                 ret.put(code, (BalaTypeVO) cache.get(key)); | ||||
|             } | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     @Override | ||||
|     public Map<String, SupplierVO> getSupplierVO(String[] codes) throws BusinessException { | ||||
|         String prefix = "supplier_"; | ||||
|         Map<String, SupplierVO> ret = new HashMap<String, SupplierVO>(); | ||||
|         this.retrieveVOByCode(prefix, "code", codes, SupplierVO.class, ""); | ||||
|         for (String code : codes) { | ||||
|             String key = MessageFormat.format("{0}{1}{2}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                     code); | ||||
|             if (cache.containsKey(key)) { | ||||
|                 ret.put(code, (SupplierVO) cache.get(key)); | ||||
|             } | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
|     @SuppressWarnings("unchecked") | ||||
|     @Override | ||||
|     public Map<String, ReturnReasonVO> getBackReasonVO(String[] codes, String[] orgIds) throws BusinessException { | ||||
|         String prefix = "backreason_"; | ||||
|         Set<String> codeSet = new HashSet<String>(); | ||||
|         for (int i = 0; i < codes.length; i++) { | ||||
|             String code = codes[i]; | ||||
|             String orgid = orgIds[i]; | ||||
|             String key1 = MessageFormat.format("{0}{1}{2}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                     code); | ||||
|             String key2 = key1 + "_" + orgid; | ||||
|             if (!cache.containsKey(key1) && !cache.containsKey(key2)) { | ||||
|                 codeSet.add(code); | ||||
|             } | ||||
|         } | ||||
|         if (!codeSet.isEmpty()) { | ||||
|             SqlBuilder sb = new SqlBuilder(); | ||||
|             sb.append("isnull(dr,0)", 0); | ||||
|             sb.append(" and "); | ||||
|             sb.append("pk_group", new String[] { InvocationInfoProxy.getInstance().getGroupId(), "~" }); | ||||
|             sb.append(" and "); | ||||
|             sb.append(SqlUtil.getInOrExistsSql("", "vreasoncode", codeSet.toArray(new String[0]))); | ||||
|             Collection<ReturnReasonVO> vos = this.getQueryBS().retrieveByClause(ReturnReasonVO.class, sb.toString()); | ||||
|             for (ReturnReasonVO vo : vos) { | ||||
|                 String key1 = MessageFormat.format("{0}{1}{2}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                         vo.getVreasoncode()); | ||||
|                 cache.put(key1, vo); | ||||
|                 String key2 = key1 + "_" + vo.getPk_org(); | ||||
|                 cache.put(key2, vo); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         Map<String, ReturnReasonVO> ret = new HashMap<String, ReturnReasonVO>(); | ||||
|         for (int i = 0; i < codes.length; i++) { | ||||
|             String code = codes[i]; | ||||
|             String orgid = orgIds[i]; | ||||
|             String key = MessageFormat.format("{0}{1}{2}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                     code); | ||||
|             if (cache.containsKey(key)) { | ||||
|                 ret.put(code, (ReturnReasonVO) cache.get(key)); | ||||
|             } | ||||
|             if (!StringUtil.isSEmptyOrNull(orgid)) { | ||||
|                 key = key + "_" + orgid; | ||||
|                 if (cache.containsKey(key)) { | ||||
|                     ret.put(code, (ReturnReasonVO) cache.get(key)); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
|     @SuppressWarnings("unchecked") | ||||
|     @Override | ||||
|     public Map<String, DeptVO> getDeptVO(String[] codes, String[] orgIds) throws BusinessException { | ||||
|         String prefix = "dept_"; | ||||
|         Set<String> codeSet = new HashSet<String>(); | ||||
|         for (int i = 0; i < codes.length; i++) { | ||||
|             String code = codes[i]; | ||||
|             String orgid = orgIds[i]; | ||||
|             String key1 = MessageFormat.format("{0}{1}{2}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                     code); | ||||
|             String key2 = key1 + "_" + orgid; | ||||
|             if (!cache.containsKey(key1) && !cache.containsKey(key2)) { | ||||
|                 codeSet.add(code); | ||||
|             } | ||||
|         } | ||||
|         if (!codeSet.isEmpty()) { | ||||
|             SqlBuilder sb = new SqlBuilder(); | ||||
|             sb.append("isnull(dr,0)", 0); | ||||
|             sb.append(" and "); | ||||
|             sb.append("pk_group", new String[] { InvocationInfoProxy.getInstance().getGroupId(), "~" }); | ||||
|             sb.append(" and "); | ||||
|             sb.append(SqlUtil.getInOrExistsSql("", "code", codeSet.toArray(new String[0]))); | ||||
|             Collection<DeptVO> vos = this.getQueryBS().retrieveByClause(DeptVO.class, sb.toString()); | ||||
|             for (DeptVO vo : vos) { | ||||
|                 String key1 = MessageFormat.format("{0}{1}{2}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                         vo.getCode()); | ||||
|                 cache.put(key1, vo); | ||||
|                 String key2 = key1 + "_" + vo.getPk_org(); | ||||
|                 cache.put(key2, vo); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         Map<String, DeptVO> ret = new HashMap<String, DeptVO>(); | ||||
|         for (int i = 0; i < codes.length; i++) { | ||||
|             String code = codes[i]; | ||||
|             String orgid = orgIds[i]; | ||||
|             String key = MessageFormat.format("{0}{1}{2}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                     code); | ||||
|             if (cache.containsKey(key)) { | ||||
|                 ret.put(code, (DeptVO) cache.get(key)); | ||||
|             } | ||||
|             if (!StringUtil.isSEmptyOrNull(orgid)) { | ||||
|                 key = key + "_" + orgid; | ||||
|                 if (cache.containsKey(key)) { | ||||
|                     ret.put(code, (DeptVO) cache.get(key)); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
|     @SuppressWarnings("unchecked") | ||||
|     @Override | ||||
|     public Map<String, StordocVO> getStordocVO(String[] codes, String[] orgIds) throws BusinessException { | ||||
|         String prefix = "stordoc_"; | ||||
|         Set<String> codeSet = new HashSet<String>(); | ||||
|         for (int i = 0; i < codes.length; i++) { | ||||
|             String code = codes[i]; | ||||
|             String orgid = orgIds[i]; | ||||
|             String key1 = MessageFormat.format("{0}{1}{2}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                     code); | ||||
|             String key2 = key1 + "_" + orgid; | ||||
|             if (!cache.containsKey(key1) && !cache.containsKey(key2)) { | ||||
|                 codeSet.add(code); | ||||
|             } | ||||
|         } | ||||
|         if (!codeSet.isEmpty()) { | ||||
|             SqlBuilder sb = new SqlBuilder(); | ||||
|             sb.append("isnull(dr,0)", 0); | ||||
|             sb.append(" and "); | ||||
|             sb.append("pk_group", new String[] { InvocationInfoProxy.getInstance().getGroupId(), "~" }); | ||||
|             sb.append(" and "); | ||||
|             sb.append(SqlUtil.getInOrExistsSql("", "code", codeSet.toArray(new String[0]))); | ||||
|             Collection<StordocVO> vos = this.getQueryBS().retrieveByClause(StordocVO.class, sb.toString()); | ||||
|             for (StordocVO vo : vos) { | ||||
|                 String key1 = MessageFormat.format("{0}{1}{2}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                         vo.getCode()); | ||||
|                 cache.put(key1, vo); | ||||
|                 String key2 = key1 + "_" + vo.getPk_org(); | ||||
|                 cache.put(key2, vo); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         Map<String, StordocVO> ret = new HashMap<String, StordocVO>(); | ||||
|         for (int i = 0; i < codes.length; i++) { | ||||
|             String code = codes[i]; | ||||
|             String orgid = orgIds[i]; | ||||
|             String key = MessageFormat.format("{0}{1}{2}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                     code); | ||||
|             if (cache.containsKey(key)) { | ||||
|                 ret.put(code, (StordocVO) cache.get(key)); | ||||
|             } | ||||
|             if (!StringUtil.isSEmptyOrNull(orgid)) { | ||||
|                 key = key + "_" + orgid; | ||||
|                 if (cache.containsKey(key)) { | ||||
|                     ret.put(code, (StordocVO) cache.get(key)); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
|     @SuppressWarnings("unchecked") | ||||
|     @Override | ||||
|     public Map<String, RackVO> getRackVO(String[] codes, String[] warehouses) throws BusinessException { | ||||
|         String prefix = "rack_"; | ||||
|         Set<String> codeSet = new HashSet<String>(); | ||||
|         for (int i = 0; i < codes.length; i++) { | ||||
|             String code = codes[i]; | ||||
|             //修改查询逻辑--2025年4月11日15点38分--存在codes与warehouses长度不一致,需要做处理   start | ||||
|             for(String warehouse:warehouses){ | ||||
|                 String key = MessageFormat.format("{0}{1}{2}{3}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                         code, warehouse); | ||||
|                 if (!cache.containsKey(key)) { | ||||
|                     codeSet.add(code); | ||||
|                 } | ||||
|             } | ||||
|             //修改查询逻辑--2025年4月11日15点38分--存在codes与warehouses长度不一致,需要做处理   end | ||||
|         } | ||||
|         if (!codeSet.isEmpty()) { | ||||
|             SqlBuilder sb = new SqlBuilder(); | ||||
|             sb.append("isnull(dr,0)", 0); | ||||
|             sb.append(" and "); | ||||
|             sb.append("pk_group", new String[] { InvocationInfoProxy.getInstance().getGroupId(), "~" }); | ||||
|             sb.append(" and "); | ||||
|             sb.append(SqlUtil.getInOrExistsSql("", "code", codeSet.toArray(new String[0]))); | ||||
|             Collection<RackVO> vos = this.getQueryBS().retrieveByClause(RackVO.class, sb.toString()); | ||||
|             for (RackVO vo : vos) { | ||||
|                 String key = MessageFormat.format("{0}{1}{2}{3}", prefix, | ||||
|                         InvocationInfoProxy.getInstance().getGroupId(), vo.getCode(), vo.getPk_stordoc()); | ||||
|                 cache.put(key, vo); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         Map<String, RackVO> ret = new HashMap<String, RackVO>(); | ||||
|         for (int i = 0; i < codes.length; i++) { | ||||
|             String code = codes[i]; | ||||
|             //修改查询逻辑--2025年4月11日15点38分--存在codes与warehouses长度不一致,需要做处理   start | ||||
|             for(String warehouse:warehouses){ | ||||
|                 String key = MessageFormat.format("{0}{1}{2}{3}", prefix, InvocationInfoProxy.getInstance().getGroupId(), | ||||
|                         code, warehouse); | ||||
|                 if (cache.containsKey(key)) { | ||||
|                     ret.put(code + warehouse, (RackVO) cache.get(key)); | ||||
|                 } | ||||
|             } | ||||
|             //修改查询逻辑--2025年4月11日15点38分--存在codes与warehouses长度不一致,需要做处理   end | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Map<String, RecpaytypeVO> getRecpaytypeVOs(String[] codes) throws BusinessException { | ||||
|         String prefix = "recpay_"; | ||||
|         String pk_group = "GLOBLE00000000000000"; | ||||
|         Map<String, RecpaytypeVO> ret = new HashMap<String, RecpaytypeVO>(); | ||||
|         this.retrieveVOByCode(prefix, "code", codes, RecpaytypeVO.class, "", pk_group); | ||||
|         for (String code : codes) { | ||||
|             String key = MessageFormat.format("{0}{1}{2}", prefix, pk_group, code); | ||||
|             if (cache.containsKey(key)) { | ||||
|                 ret.put(code, (RecpaytypeVO) cache.get(key)); | ||||
|             } | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public Map<String, CurrtypeVO> getCurrtypeVOs(String[] codes) throws BusinessException { | ||||
|         String prefix = "currtype_"; | ||||
|         String pk_group = "GLOBLE00000000000000"; | ||||
|         Map<String, CurrtypeVO> ret = new HashMap<String, CurrtypeVO>(); | ||||
|         this.retrieveVOByCode(prefix, "code", codes, CurrtypeVO.class, "", pk_group); | ||||
|         for (String code : codes) { | ||||
|             String key = MessageFormat.format("{0}{1}{2}", prefix, pk_group, code); | ||||
|             if (cache.containsKey(key)) { | ||||
|                 ret.put(code, (CurrtypeVO) cache.get(key)); | ||||
|             } | ||||
|         } | ||||
|         return ret; | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|     public void clear() throws BusinessException { | ||||
|         if (cache != null) { | ||||
|             cache.clear(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Loading…
	
		Reference in New Issue