到货单已生成下游检验单时,到货单需要增加控制不能收回
This commit is contained in:
		
							parent
							
								
									57b55e1e40
								
							
						
					
					
						commit
						9700d1d147
					
				|  | @ -0,0 +1,138 @@ | ||||||
|  | package nc.impl.pu.m23.approve.rule; | ||||||
|  | 
 | ||||||
|  | import java.util.ArrayList; | ||||||
|  | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
|  | import nc.impl.pubapp.pattern.rule.IRule; | ||||||
|  | import nc.itf.pu.reference.ic.M45PUServices; | ||||||
|  | import nc.itf.pu.reference.ic.M47PUServices; | ||||||
|  | import nc.vo.ml.NCLangRes4VoTransl; | ||||||
|  | import nc.vo.pu.m23.entity.ArriveItemVO; | ||||||
|  | import nc.vo.pu.m23.entity.ArriveVO; | ||||||
|  | import nc.vo.pu.pub.util.ApproveFlowUtil; | ||||||
|  | import nc.vo.pub.lang.UFBoolean; | ||||||
|  | import nc.vo.pub.lang.UFDouble; | ||||||
|  | import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||||
|  | import nc.vo.pubapp.pattern.pub.MathTool; | ||||||
|  | import nc.vo.scmpub.res.billtype.IBillType; | ||||||
|  | import nc.vo.scmpub.res.billtype.POBillType; | ||||||
|  | import nc.vo.scmpub.res.billtype.SCBillType; | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public class ChkCanUnApproveRule | ||||||
|  |   extends Object | ||||||
|  |   implements IRule<ArriveVO> | ||||||
|  | { | ||||||
|  |   public void process(ArriveVO[] voArray) { | ||||||
|  |     for (ArriveVO aggVO : voArray) | ||||||
|  |     { | ||||||
|  |       chkCanUnApprove(aggVO); | ||||||
|  |     } | ||||||
|  |      | ||||||
|  |     checkHasPurchaseIn(voArray); | ||||||
|  |      | ||||||
|  |     checkHasSubcontIn(voArray); | ||||||
|  |   } | ||||||
|  |    | ||||||
|  |   private void checkHasPurchaseIn(ArriveVO[] vos) { | ||||||
|  |     List<String> hidLst = getHIDSourceFrom(vos, POBillType.Order); | ||||||
|  |     if (hidLst.size() == 0) { | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |     Map<String, UFBoolean> hidMap = M45PUServices.getMapBysrcHid((String[])hidLst | ||||||
|  |         .toArray(new String[hidLst.size()])); | ||||||
|  |     if (null == hidMap || hidMap.size() == 0) { | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |     for (UFBoolean value : hidMap.values()) { | ||||||
|  |       if (UFBoolean.TRUE.equals(value)) { | ||||||
|  |         throwHasStoreInExp(); | ||||||
|  |       } | ||||||
|  |     }  | ||||||
|  |   } | ||||||
|  |    | ||||||
|  |   private void checkHasSubcontIn(ArriveVO[] vos) { | ||||||
|  |     List<String> hidLst = getHIDSourceFrom(vos, SCBillType.Order); | ||||||
|  |     if (hidLst.size() == 0) { | ||||||
|  |       return; | ||||||
|  |     } | ||||||
|  |     if (M47PUServices.hasFromSource(hidLst)) { | ||||||
|  |       throwHasStoreInExp(); | ||||||
|  |     } | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |    | ||||||
|  |   private void chkCanUnApprove(ArriveVO aggVO) { | ||||||
|  |     if (!ApproveFlowUtil.isCanUnApprove(aggVO)) { | ||||||
|  |       String message = NCLangRes4VoTransl.getNCLangRes().getStrByID("4004040_0", "04004040-0122"); | ||||||
|  |       ExceptionUtils.wrappBusinessException(message); | ||||||
|  |     }  | ||||||
|  |      | ||||||
|  |     ArriveItemVO[] itemVOArray = aggVO.getBVO(); | ||||||
|  |     for (int i = 0; i < itemVOArray.length; i++) { | ||||||
|  |        | ||||||
|  |       if (MathTool.nvl(itemVOArray[i].getNaccumstorenum()).doubleValue() > 0.0D) { | ||||||
|  |         throwHasStoreInExp(); | ||||||
|  |       } | ||||||
|  |       if (itemVOArray[i].getBfaflag().booleanValue()) | ||||||
|  |       { | ||||||
|  |         ExceptionUtils.wrappBusinessException( | ||||||
|  |             NCLangRes4VoTransl.getNCLangRes().getStrByID("4004040_0", "04004040-0124")); | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       if (MathTool.nvl(itemVOArray[i].getNaccumreplnum()).doubleValue() > 0.0D) | ||||||
|  |       { | ||||||
|  |         ExceptionUtils.wrappBusinessException( | ||||||
|  |             NCLangRes4VoTransl.getNCLangRes().getStrByID("4004040_0", "04004040-0125")); | ||||||
|  |       } | ||||||
|  | 
 | ||||||
|  |       if (aggVO.getHVO().getBisback() == null || !aggVO.getHVO().getBisback().booleanValue()) | ||||||
|  |       { | ||||||
|  |         if (MathTool.nvl(itemVOArray[i].getNaccumchecknum()) | ||||||
|  |           .doubleValue() > 0.0D) | ||||||
|  |         { | ||||||
|  |           ExceptionUtils.wrappBusinessException( | ||||||
|  |               NCLangRes4VoTransl.getNCLangRes().getStrByID("4004040_0", "04004040-0126")); | ||||||
|  |         } | ||||||
|  |       } | ||||||
|  |        | ||||||
|  |       if (MathTool.nvl(itemVOArray[i].getNaccumletgonum()).doubleValue() > 0.0D) | ||||||
|  |       { | ||||||
|  |         ExceptionUtils.wrappBusinessException( | ||||||
|  |             NCLangRes4VoTransl.getNCLangRes().getStrByID("4004040_0", "04004040-0127")); | ||||||
|  |       } | ||||||
|  |        | ||||||
|  |       if (UFBoolean.TRUE.equals(itemVOArray[i].getBtransasset())) | ||||||
|  |       { | ||||||
|  |         ExceptionUtils.wrappBusinessException( | ||||||
|  |             NCLangRes4VoTransl.getNCLangRes().getStrByID("4004040_0", "04004040-0128")); | ||||||
|  |       } | ||||||
|  |        | ||||||
|  |       if (itemVOArray[i].getNaccumbacknum() != null &&  | ||||||
|  |         !UFDouble.ZERO_DBL.equals(itemVOArray[i] | ||||||
|  |           .getNaccumbacknum())) | ||||||
|  |       { | ||||||
|  |         ExceptionUtils.wrappBusinessException( | ||||||
|  |             NCLangRes4VoTransl.getNCLangRes().getStrByID("4004040_0", "04004040-0192")); | ||||||
|  |       } | ||||||
|  |     }  | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   private List<String> getHIDSourceFrom(ArriveVO[] vos, IBillType bt) { | ||||||
|  |     List<String> hidLst = new ArrayList<String>(); | ||||||
|  |     for (ArriveVO vo : vos) { | ||||||
|  |       for (ArriveItemVO item : vo.getBVO()) { | ||||||
|  |         if (bt.getCode().equals(item.getCsourcetypecode())) { | ||||||
|  |           hidLst.add(item.getPk_arriveorder()); | ||||||
|  |           break; | ||||||
|  |         }  | ||||||
|  |       }  | ||||||
|  |     }  | ||||||
|  |     return hidLst; | ||||||
|  |   } | ||||||
|  |    | ||||||
|  |   private void throwHasStoreInExp() { | ||||||
|  |     ExceptionUtils.wrappBusinessException( | ||||||
|  |         NCLangRes4VoTransl.getNCLangRes().getStrByID("4004040_0", "04004040-0123")); | ||||||
|  |   } | ||||||
|  | } | ||||||
		Loading…
	
		Reference in New Issue