feat(ic):优化无备料领料-材料出库-批次赋值调整为根据仓库判断
This commit is contained in:
		
							parent
							
								
									0b2487117d
								
							
						
					
					
						commit
						a7b4fd64cf
					
				|  | @ -1,5 +1,7 @@ | ||||||
| package nc.bs.ic.m4d.insert.rule; | package nc.bs.ic.m4d.insert.rule; | ||||||
| 
 | 
 | ||||||
|  | import nc.bs.dao.BaseDAO; | ||||||
|  | import nc.bs.dao.DAOException; | ||||||
| import nc.bs.framework.common.InvocationInfoProxy; | import nc.bs.framework.common.InvocationInfoProxy; | ||||||
| import nc.bs.framework.common.NCLocator; | import nc.bs.framework.common.NCLocator; | ||||||
| import nc.bs.ic.pub.base.ICRule; | import nc.bs.ic.pub.base.ICRule; | ||||||
|  | @ -8,8 +10,10 @@ import nc.bs.trade.business.HYPubBO; | ||||||
| import nc.bs.uapbd.util.MyHelper; | import nc.bs.uapbd.util.MyHelper; | ||||||
| import nc.itf.mmpac.pickm.IPickmQueryService; | import nc.itf.mmpac.pickm.IPickmQueryService; | ||||||
| import nc.itf.uap.IUAPQueryBS; | import nc.itf.uap.IUAPQueryBS; | ||||||
|  | import nc.jdbc.framework.processor.ColumnProcessor; | ||||||
| import nc.util.mmf.framework.base.MMValueCheck; | import nc.util.mmf.framework.base.MMValueCheck; | ||||||
| import nc.vo.bd.material.MaterialVO; | import nc.vo.bd.material.MaterialVO; | ||||||
|  | import nc.vo.bd.stordoc.StordocVO; | ||||||
| import nc.vo.ic.m4d.entity.MaterialOutBodyVO; | import nc.vo.ic.m4d.entity.MaterialOutBodyVO; | ||||||
| import nc.vo.ic.m4d.entity.MaterialOutHeadVO; | import nc.vo.ic.m4d.entity.MaterialOutHeadVO; | ||||||
| import nc.vo.ic.m4d.entity.MaterialOutVO; | import nc.vo.ic.m4d.entity.MaterialOutVO; | ||||||
|  | @ -36,6 +40,16 @@ public class MaterialOutBatchCodeRule extends ICRule<MaterialOutVO> { | ||||||
|     private static final String LOG_INFO_NAME = "jmqylog"; |     private static final String LOG_INFO_NAME = "jmqylog"; | ||||||
|     private static final Log logger = Log.getInstance(LOG_INFO_NAME); |     private static final Log logger = Log.getInstance(LOG_INFO_NAME); | ||||||
|     private Map<String, String> configParams; |     private Map<String, String> configParams; | ||||||
|  | 
 | ||||||
|  |     public BaseDAO dao; | ||||||
|  | 
 | ||||||
|  |     public BaseDAO getDao() { | ||||||
|  |         if (dao == null) { | ||||||
|  |             dao = new BaseDAO(); | ||||||
|  |         } | ||||||
|  |         return dao; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|     private IUAPQueryBS queryBS = null; |     private IUAPQueryBS queryBS = null; | ||||||
| 
 | 
 | ||||||
|     public final IUAPQueryBS getQueryBS() { |     public final IUAPQueryBS getQueryBS() { | ||||||
|  | @ -64,10 +78,15 @@ public class MaterialOutBatchCodeRule extends ICRule<MaterialOutVO> { | ||||||
|                 MaterialOutHeadVO headVO = vo.getHead(); |                 MaterialOutHeadVO headVO = vo.getHead(); | ||||||
|                 MaterialOutBodyVO[] bodys = vo.getBodys(); |                 MaterialOutBodyVO[] bodys = vo.getBodys(); | ||||||
|                 String pk_org = (String) headVO.getAttributeValue("pk_org"); |                 String pk_org = (String) headVO.getAttributeValue("pk_org"); | ||||||
|                 String vtrantypecode = headVO.getVtrantypecode(); |                 String cwarehouseid = headVO.getCwarehouseid(); | ||||||
|                 String orgCode = MyHelper.transferField(StockOrgVO.getDefaultTableName(), StockOrgVO.CODE, StockOrgVO.PK_STOCKORG, pk_org); |                 String orgCode = MyHelper.transferField(StockOrgVO.getDefaultTableName(), StockOrgVO.CODE, StockOrgVO.PK_STOCKORG, pk_org); | ||||||
|                 if ("C038".equals(orgCode)) { |                 if ("C038".equals(orgCode)) { | ||||||
|                     if ("4D-Cxx-58".equals(vtrantypecode)) { |                     String warehouseId = getWarehouseInfo(pk_org, configParams); | ||||||
|  |                     if (MMValueCheck.isEmpty(warehouseId) || "~".equals(warehouseId)) { | ||||||
|  |                         ExceptionUtils.wrappBusinessException("请检查仓库编码是否配置正确"); | ||||||
|  |                     } | ||||||
|  |                     // 判断仓库是否为WF001 | ||||||
|  |                     if (warehouseId.equals(cwarehouseid)) { | ||||||
|                         IPickmQueryService service = NCLocator.getInstance().lookup(IPickmQueryService.class); |                         IPickmQueryService service = NCLocator.getInstance().lookup(IPickmQueryService.class); | ||||||
|                         // Åú´ÎºÅ¸³Öµ |                         // Åú´ÎºÅ¸³Öµ | ||||||
|                         for (MaterialOutBodyVO body : bodys) { |                         for (MaterialOutBodyVO body : bodys) { | ||||||
|  | @ -126,4 +145,18 @@ public class MaterialOutBatchCodeRule extends ICRule<MaterialOutVO> { | ||||||
|         return resMap; |         return resMap; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     private String getWarehouseInfo(String pk_org, Map<String, String> configParams) throws DAOException { | ||||||
|  |         String warehouseCode = configParams.get("warehouseCode"); | ||||||
|  |         SqlBuilder sqlBuilder = new SqlBuilder(); | ||||||
|  |         sqlBuilder.append(" select " + StordocVO.PK_STORDOC); | ||||||
|  |         sqlBuilder.append(" from " + StordocVO.getDefaultTableName()); | ||||||
|  |         sqlBuilder.append(" where dr = 0"); | ||||||
|  |         sqlBuilder.append(" and "); | ||||||
|  |         sqlBuilder.append(StordocVO.CODE, warehouseCode); | ||||||
|  |         sqlBuilder.append(" and "); | ||||||
|  |         sqlBuilder.append(StordocVO.PK_ORG, pk_org); | ||||||
|  |         String warehouseId = (String) getDao().executeQuery(sqlBuilder.toString(), new ColumnProcessor()); | ||||||
|  |         return warehouseId; | ||||||
|  |     } | ||||||
|  | 
 | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue