根据物料库存信息批次管理字段决定是否生成批次号
This commit is contained in:
		
							parent
							
								
									e5c5cdc764
								
							
						
					
					
						commit
						ef9c5ffb0d
					
				|  | @ -10,15 +10,21 @@ import java.util.HashMap; | |||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Set; | ||||
| 
 | ||||
| import nc.bs.dao.BaseDAO; | ||||
| import nc.bs.dao.DAOException; | ||||
| import nc.bs.framework.common.NCLocator; | ||||
| import nc.bs.mmpac.pmo.pac0002.bp.service.PMOBPService; | ||||
| import nc.bs.trade.business.HYPubBO; | ||||
| import nc.impl.pubapp.pattern.rule.IRule; | ||||
| import nc.itf.bd.material.baseinfo.IMaterialBaseInfoQueryService; | ||||
| import nc.pub.billcode.itf.IBillcodeManage; | ||||
| import nc.uif.pub.exception.UifException; | ||||
| import nc.util.mmf.busi.service.MaterialPubService; | ||||
| import nc.util.mmf.framework.base.*; | ||||
| import nc.vo.bd.material.MaterialVO; | ||||
| import nc.vo.bd.material.prod.MaterialProdVO; | ||||
| import nc.vo.bd.material.stock.MaterialStockVO; | ||||
| import nc.vo.mmpac.pickm.param.PickmTransParamForMO; | ||||
| import nc.vo.mmpac.pmo.pac0002.constant.PMOConstLang; | ||||
| import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO; | ||||
|  | @ -42,10 +48,12 @@ public class PMOFillBatchCodeRule implements IRule<PMOAggVO> { | |||
|             this.fillBatchCode(aggvos); | ||||
|         } catch (UifException e) { | ||||
|             throw new RuntimeException(e); | ||||
|         } catch (BusinessException e) { | ||||
|             throw new RuntimeException(e); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private void fillBatchCode(PMOAggVO[] aggvos) throws UifException { | ||||
|     private void fillBatchCode(PMOAggVO[] aggvos) throws BusinessException { | ||||
|         PMOItemVO[] filteritems = this.getItemByBatchCode(aggvos); | ||||
|         if (!MMArrayUtil.isEmpty(filteritems)) { | ||||
|             Map<String, PMOHeadVO> headMap = new HashMap(); | ||||
|  | @ -122,7 +130,7 @@ public class PMOFillBatchCodeRule implements IRule<PMOAggVO> { | |||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private void genBatchCode(PMOItemVO[] paravos, Map<String, PMOHeadVO> headMap) throws UifException { | ||||
|     private void genBatchCode(PMOItemVO[] paravos, Map<String, PMOHeadVO> headMap) throws BusinessException { | ||||
|         if (!MMArrayUtil.isEmpty(paravos)) { | ||||
|             List<PMOItemVO> itemList = new ArrayList(); | ||||
| 
 | ||||
|  | @ -132,7 +140,10 @@ public class PMOFillBatchCodeRule implements IRule<PMOAggVO> { | |||
|             String org = hybo.findColValue("org_adminorg", "pk_adminorg", " code = 'C030'  ") + ""; | ||||
|             for(PMOItemVO vo : paravos) { | ||||
|                 if(vo.getPk_org().equals(org)) { | ||||
|                     xbitemList.add(vo); | ||||
|                     if(checkMaterial(vo.getCmaterialvid(),vo.getPk_org())){ | ||||
|                         xbitemList.add(vo); | ||||
|                     } | ||||
| 
 | ||||
|                 }else{ | ||||
|                     itemList.add(vo); | ||||
|                 } | ||||
|  | @ -270,4 +281,28 @@ public class PMOFillBatchCodeRule implements IRule<PMOAggVO> { | |||
| 
 | ||||
|         } | ||||
|     } | ||||
|     private boolean checkMaterial(String cmaterialid,String org) throws BusinessException { | ||||
|         // 根据物料档案库存信息页签批次管理字段判断是否生成批次号,只有勾选批次管理的物料才生成生产批次号 | ||||
| 
 | ||||
|         MaterialVO[] vos = NCLocator.getInstance().lookup(IMaterialBaseInfoQueryService.class).queryDataByPks(new String[]{cmaterialid}); | ||||
|         for (MaterialVO vo : vos) { | ||||
|             String whereSql = " pk_material='" + vo.getPk_material() + "' and pk_org='" + org + "'  and nvl(dr,0)=0 "; | ||||
|             List<MaterialStockVO> list = null; | ||||
|             try { | ||||
|                 list = (List<MaterialStockVO>) new BaseDAO().retrieveByClause(MaterialStockVO.class, whereSql); | ||||
|             } catch (DAOException e) { | ||||
|                 e.printStackTrace(); | ||||
|             } | ||||
|             if(!list.isEmpty()){ | ||||
|                 for (MaterialStockVO materialStockVO:list){ | ||||
|                     if(materialStockVO.getWholemanaflag().booleanValue()) { | ||||
|                         return true; | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|         return false; | ||||
|     } | ||||
| } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue