PMOApproveBP-代码同步
This commit is contained in:
		
							parent
							
								
									bb40b3e24c
								
							
						
					
					
						commit
						dacd990975
					
				|  | @ -40,6 +40,9 @@ public class PMOApproveBP { | |||
|         processer.addBeforeRule(operTypeRule); | ||||
|         IRule<PMOAggVO> mmatoMaterialCheckRule = new MMATOMaterialCheckRule((String) null, "cmaterialvid", "cffileid"); | ||||
|         processer.addBeforeRule(mmatoMaterialCheckRule); | ||||
|         //提交前根据组织参数判断备料计划表体是否存在仓库 zhangxinah | ||||
|         IRule<PMOAggVO> coutstockidCheckRule = new CoutstockidCheckBeforeRule(); | ||||
|         processer.addBeforeRule(coutstockidCheckRule); | ||||
|     } | ||||
| 
 | ||||
|     private void addApproveAfterRule(CompareAroundProcesser<PMOAggVO> processer) { | ||||
|  |  | |||
|  | @ -0,0 +1,67 @@ | |||
| package nc.bs.mmpac.pmo.pac0002.bp.rule; | ||||
| 
 | ||||
| import nc.impl.pubapp.pattern.rule.IRule; | ||||
| import nc.itf.mmpac.pickm.IPickmQueryService; | ||||
| import nc.util.mmf.framework.base.MMArrayUtil; | ||||
| import nc.vo.mmpac.pmo.pac0002.entity.PMOAggVO; | ||||
| import nc.vo.mmpac.pmo.pac0002.entity.PMOItemVO; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||
| import nc.vo.bc.pub.util.SysParaInitQuery; | ||||
| import nc.vo.mmpac.pickm.entity.AggPickmVO; | ||||
| import nc.vo.mmpac.pickm.entity.PickmHeadVO; | ||||
| import nc.vo.mmpac.pickm.entity.PickmItemVO; | ||||
| import java.util.List; | ||||
| import nc.bs.dao.BaseDAO; | ||||
| import nc.bs.framework.common.NCLocator; | ||||
| 
 | ||||
| public class CoutstockidCheckBeforeRule extends Object implements IRule<PMOAggVO> { | ||||
| 
 | ||||
| 	public void process(PMOAggVO[] bills) { | ||||
| 		if (MMArrayUtil.isEmpty(bills)) { | ||||
| 			return; | ||||
| 		} | ||||
| 		for (PMOAggVO bill : bills) { | ||||
| 			try { | ||||
| 				checkStockid(bill); | ||||
| 			} catch (BusinessException e) { | ||||
| 				ExceptionUtils.wrappException(e); | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	private void checkStockid(PMOAggVO bill) throws BusinessException { | ||||
| 		String targetCode = SysParaInitQuery.getParaString(bill.getParentVO().getPk_org(), "Beiliao_Warehouse"); | ||||
| 		// 根据组织判断是否启用组织参数,对应各行产品的备料计划行上的【发料仓库】不能为空,如果为空,不能【提交】给予报错。 | ||||
| 		if ("Y".equals(targetCode)) { | ||||
| 			String scddno = bill.getParentVO().getVbillcode(); | ||||
| 			PMOItemVO[] bodys = bill.getChildrenVO(); | ||||
| 			IPickmQueryService service = NCLocator.getInstance().lookup(IPickmQueryService.class); | ||||
| 			for (PMOItemVO pmoItemVO : bodys) { | ||||
| 				String cmoid = pmoItemVO.getPrimaryKey(); | ||||
| 				String sql = " csourcebillrowid='" + cmoid + "' and nvl(dr,0)=0 "; | ||||
| 				List<PickmHeadVO> pickmList = (List<PickmHeadVO>) new BaseDAO().retrieveByClause(PickmHeadVO.class, | ||||
| 						sql); | ||||
| 				if (pickmList != null && pickmList.size() == 1) { | ||||
| 					String cpickmid = pickmList.get(0).getPrimaryKey(); | ||||
| 					String vbillno = pickmList.get(0).getVbillcode(); | ||||
| 					AggPickmVO pickmaggvo = service.querySingleBillByPk(cpickmid); | ||||
| 					if (pickmaggvo != null) { | ||||
| 						PickmItemVO[] bvos = (PickmItemVO[]) pickmaggvo.getChildrenVO(); | ||||
| 						if (bvos != null && bvos.length > 0) { | ||||
| 							for (PickmItemVO bvo : bvos) { | ||||
| 								if (bvo.getCoutstockid() == null) { | ||||
| 									throw new BusinessException( | ||||
| 											"生产订单单号:"+scddno+",备料计划单号:" + vbillno + ",行号:" + bvo.getVrowno() + ",发料仓库为空,不允许提交!"); | ||||
| 								} | ||||
| 							} | ||||
| 						} | ||||
| 					} | ||||
| 				} else { | ||||
| 					throw new BusinessException("未找到该生产订单对应的备料计划!!"); | ||||
| 				} | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
		Loading…
	
		Reference in New Issue