负计划回写时候校验数量
This commit is contained in:
		
							parent
							
								
									1200e66287
								
							
						
					
					
						commit
						3bbc32ec31
					
				|  | @ -12,6 +12,7 @@ import java.util.List; | |||
| import java.util.Set; | ||||
| import nc.bs.pu.m20.plugin.PraybillPluginPoint; | ||||
| import nc.bs.pu.m20.rewrite.pu.rule.AccOrderNumCalcRule; | ||||
| import nc.bs.pu.m20.rewrite.pu.rule.CheckOrderNumCalcRule; | ||||
| import nc.bs.pu.m20.rewrite.pu.rule.PrayOrderWriteBackTolerRule; | ||||
| import nc.impl.pubapp.pattern.data.bill.BillQuery; | ||||
| import nc.impl.pubapp.pattern.data.bill.tool.BillTransferTool; | ||||
|  | @ -24,6 +25,7 @@ import nc.vo.pu.m20.entity.PraybillViewVO; | |||
| import nc.vo.pu.m20.entity.writeback.OrderWriteBackVO; | ||||
| import nc.vo.pu.m20.pub.PraybillVOUtil; | ||||
| import nc.vo.pu.pub.util.PUSysParamUtil; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pub.lang.UFBoolean; | ||||
| import nc.vo.pub.lang.UFDouble; | ||||
| import nccloud.commons.lang.ArrayUtils; | ||||
|  | @ -94,7 +96,9 @@ public class ReWrite20ForOrderBP { | |||
| 
 | ||||
|     private void addRule(AroundProcesser<PraybillViewVO> processer, OrderWriteBackVO[] vos, PraybillViewVO[] views) { | ||||
|         String pk_org = views[0].getPk_purchaseorg(); | ||||
| 
 | ||||
|         processer.addBeforeRule(new AccOrderNumCalcRule(vos)); | ||||
|         processer.addBeforeRule(new CheckOrderNumCalcRule()); | ||||
|         processer.addAfterRule(new PrayOrderWriteBackTolerRule("intolerance", PUSysParamUtil.getPO47(pk_org), "naccumulatenum", UFBoolean.valueOf(vos[0].isUserConfirm()))); | ||||
|     } | ||||
| } | ||||
|  |  | |||
|  | @ -0,0 +1,37 @@ | |||
| // | ||||
| // Source code recreated from a .class file by IntelliJ IDEA | ||||
| // (powered by FernFlower decompiler) | ||||
| // | ||||
| 
 | ||||
| package nc.bs.pu.m20.rewrite.pu.rule; | ||||
| 
 | ||||
| import java.util.Map; | ||||
| import nc.impl.pubapp.pattern.rule.IRule; | ||||
| import nc.vo.ml.NCLangRes4VoTransl; | ||||
| import nc.vo.pu.m20.entity.PraybillItemVO; | ||||
| import nc.vo.pu.m20.entity.PraybillViewVO; | ||||
| import nc.vo.pu.m20.entity.writeback.OrderWriteBackVO; | ||||
| import nc.vo.pu.pub.util.CirVOUtil; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pub.lang.UFDouble; | ||||
| import nc.vo.pubapp.pattern.exception.ExceptionUtils; | ||||
| import nc.vo.pubapp.pattern.pub.MathTool; | ||||
| 
 | ||||
| public class CheckOrderNumCalcRule implements IRule<PraybillViewVO> { | ||||
| 
 | ||||
| 
 | ||||
|     public CheckOrderNumCalcRule() { | ||||
|     } | ||||
|     public void process(PraybillViewVO[] views) { | ||||
|         for(PraybillViewVO vo : views) { | ||||
|             PraybillItemVO itemVO=vo.getItem(); | ||||
|             if(null != itemVO.getAttributeValue("vbdef33") && null!=itemVO.getNaccumulatenum()&& itemVO.getNaccumulatenum().compareTo(new UFDouble(String.valueOf(itemVO.getAttributeValue("vbdef33"))))>0){ | ||||
|                 try { | ||||
|                     throw new BusinessException("请购单累计订货数量大于最终需求数量不能生成采购订单!"); | ||||
|                 } catch (BusinessException e) { | ||||
|                     throw new RuntimeException(e); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,111 @@ | |||
| // | ||||
| // Source code recreated from a .class file by IntelliJ IDEA | ||||
| // (powered by FernFlower decompiler) | ||||
| // | ||||
| 
 | ||||
| package nc.bs.pu.m21.writeback.pu; | ||||
| 
 | ||||
| import java.util.HashSet; | ||||
| import java.util.Set; | ||||
| import nc.bs.pu.m21.writeback.OrderWBStoreArrvTolerRule; | ||||
| import nc.bs.pu.m21.writeback.OrderWritebackTolerRule; | ||||
| import nc.bs.pu.m21.writeback.ReceivePlanTolerRule; | ||||
| import nc.bs.pu.m21.writeback.pu.rule.AccArrNumChkRule; | ||||
| import nc.bs.pu.m21.writeback.pu.rule.AccArriveNumCalcRule; | ||||
| import nc.bs.pu.m21.writeback.pu.rule.ArriveCloseChkRule; | ||||
| import nc.bs.pu.m21.writeback.pu.rule.AutoArriveCloseRule; | ||||
| import nc.bs.pu.m21.writeback.pu.rule.ReceivePlanArrCalRule; | ||||
| import nc.bs.pu.m21.writeback.pu.rule.ReceivePlanArrChkRule; | ||||
| import nc.impl.pubapp.pattern.data.view.ViewQuery; | ||||
| import nc.impl.pubapp.pattern.data.vo.VOQuery; | ||||
| import nc.impl.pubapp.pattern.data.vo.VOUpdate; | ||||
| import nc.impl.pubapp.pattern.rule.plugin.IPluginPoint; | ||||
| import nc.impl.pubapp.pattern.rule.processer.AroundProcesser; | ||||
| import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser; | ||||
| import nc.pubitf.pu.m21.ic.m45.IOrderWriteBackPara; | ||||
| import nc.pubitf.pu.m21.pu.m23.IOrderWriteBackParaFor23; | ||||
| import nc.vo.pu.m21.entity.OrderReceivePlanVO; | ||||
| import nc.vo.pu.m21.entity.OrderViewVO; | ||||
| import nc.vo.pu.m21.pub.OrderVOUtil; | ||||
| import nc.vo.pu.pub.util.PUSysParamUtil; | ||||
| import nc.vo.pub.lang.UFBoolean; | ||||
| import nc.vo.pubapp.pattern.data.ValueUtils; | ||||
| import nccloud.commons.lang.ArrayUtils; | ||||
| 
 | ||||
| public class OrderWriteBackFor23BP { | ||||
|     private UFBoolean isUserConfirm; | ||||
| 
 | ||||
|     public OrderWriteBackFor23BP(UFBoolean isUserConfirm) { | ||||
|         this.isUserConfirm = isUserConfirm; | ||||
|     } | ||||
| 
 | ||||
|     public void writeback(IOrderWriteBackParaFor23[] vos) { | ||||
|         if (!ArrayUtils.isEmpty(vos)) { | ||||
|             String[] bids = OrderVOUtil.getInsance().getBIDs(vos); | ||||
|             OrderViewVO[] views = (OrderViewVO[])(new ViewQuery(OrderViewVO.class)).query(bids); | ||||
|             if (!ArrayUtils.isEmpty(views)) { | ||||
|                 OrderViewVO[] orgViews = new OrderViewVO[views.length]; | ||||
| 
 | ||||
|                 for(int i = 0; i < views.length; ++i) { | ||||
|                     orgViews[i] = (OrderViewVO)views[i].clone(); | ||||
|                 } | ||||
| 
 | ||||
|                 OrderReceivePlanVO[] rpVOs = this.getRPVOs(vos); | ||||
|                 if (!ArrayUtils.isEmpty(rpVOs)) { | ||||
|                     AroundProcesser<OrderReceivePlanVO> rpPrecosser = new AroundProcesser((IPluginPoint)null); | ||||
|                     this.addRPRule(rpPrecosser, vos, views); | ||||
|                     rpPrecosser.before(rpVOs); | ||||
|                     String[] rpNames = new String[]{"naccumarrvnum", "nbackarrvnum", "naccumwastnum"}; | ||||
|                     VOUpdate<OrderReceivePlanVO> rpUpdate = new VOUpdate(); | ||||
|                     rpUpdate.update(rpVOs, rpNames); | ||||
|                     rpPrecosser.after(rpVOs); | ||||
|                 } | ||||
| 
 | ||||
|                 CompareAroundProcesser<OrderViewVO> processer = new CompareAroundProcesser((IPluginPoint)null); | ||||
|                 this.addRule(processer, vos, orgViews); | ||||
|                 processer.before(views, orgViews); | ||||
|                 processer.after(views, orgViews); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private void addRPRule(AroundProcesser<OrderReceivePlanVO> processer, IOrderWriteBackParaFor23[] vos, OrderViewVO[] views) { | ||||
|         processer.addBeforeRule(new ReceivePlanArrCalRule(vos, views)); | ||||
|         processer.addBeforeRule(new ReceivePlanArrChkRule(vos, views)); | ||||
|         processer.addAfterRule(new ReceivePlanTolerRule("intolerance", PUSysParamUtil.getPO02(views[0].getPk_org()), "naccumarrvnum", this.isUserConfirm)); | ||||
|     } | ||||
| 
 | ||||
|     private void addRule(CompareAroundProcesser<OrderViewVO> processer, IOrderWriteBackParaFor23[] vos, OrderViewVO[] orgViews) { | ||||
|         processer.addBeforeRule(new AccArriveNumCalcRule(vos)); | ||||
|         processer.addBeforeRule(new ArriveCloseChkRule(orgViews, vos)); | ||||
|         processer.addBeforeRule(new AccArrNumChkRule(vos)); | ||||
|         processer.addAfterRule(new AutoArriveCloseRule(vos)); | ||||
|         processer.addAfterRule(new OrderWritebackTolerRule("intolerance", PUSysParamUtil.getPO02(orgViews[0].getPk_org()), "naccumarrvnum", this.isUserConfirm)); | ||||
|         processer.addAfterRule(new OrderWBStoreArrvTolerRule(true, ValueUtils.getBoolean(this.isUserConfirm))); | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     private OrderReceivePlanVO[] getRPVOs(IOrderWriteBackPara[] wbVos) { | ||||
|         if (ArrayUtils.isEmpty(wbVos)) { | ||||
|             return null; | ||||
|         } else { | ||||
|             Set<String> set = new HashSet(); | ||||
| 
 | ||||
|             for(IOrderWriteBackPara vo : wbVos) { | ||||
|                 if (vo != null && vo.getBBID() != null) { | ||||
|                     set.add(vo.getBBID()); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             if (set.isEmpty()) { | ||||
|                 return null; | ||||
|             } else { | ||||
|                 String[] pkOrderBBs = (String[])set.toArray(new String[0]); | ||||
|                 VOQuery<OrderReceivePlanVO> query = new VOQuery(OrderReceivePlanVO.class); | ||||
|                 OrderReceivePlanVO[] rpVOs = (OrderReceivePlanVO[])query.query(pkOrderBBs); | ||||
|                 return rpVOs; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,66 @@ | |||
| // | ||||
| // Source code recreated from a .class file by IntelliJ IDEA | ||||
| // (powered by FernFlower decompiler) | ||||
| // | ||||
| 
 | ||||
| package nc.bs.pu.m21.writeback.pu.rule; | ||||
| 
 | ||||
| import java.util.Map; | ||||
| import nc.impl.pubapp.pattern.rule.IRule; | ||||
| import nc.pubitf.pu.m21.pu.m23.IOrderWriteBackParaFor23; | ||||
| import nc.vo.pu.m21.entity.OrderItemVO; | ||||
| import nc.vo.pu.m21.entity.OrderViewVO; | ||||
| import nc.vo.pu.pub.util.CirVOUtil; | ||||
| import nc.vo.pub.BusinessException; | ||||
| import nc.vo.pub.lang.UFDouble; | ||||
| import nc.vo.pubapp.pattern.pub.MathTool; | ||||
| 
 | ||||
| public class AccArriveNumCalcRule implements IRule<OrderViewVO> { | ||||
|     private IOrderWriteBackParaFor23[] wbVos; | ||||
| 
 | ||||
|     public AccArriveNumCalcRule(IOrderWriteBackParaFor23[] wbVos) { | ||||
|         this.wbVos = wbVos; | ||||
|     } | ||||
| 
 | ||||
|     public void process(OrderViewVO[] views) { | ||||
|         Map<String, OrderViewVO> viewMap = CirVOUtil.createKeyVOMap(views); | ||||
| 
 | ||||
|         for(IOrderWriteBackParaFor23 vo : this.wbVos) { | ||||
|             OrderViewVO view = (OrderViewVO)viewMap.get(vo.getBID()); | ||||
|             UFDouble diffNum = vo.getDiffNum(); | ||||
|             if (!vo.isReturn()) { | ||||
|                 UFDouble newAccNum = MathTool.add(view.getNaccumarrvnum(), diffNum); | ||||
|                 Object vbdef33= ((OrderItemVO)view.getVO(OrderItemVO.class)).getAttributeValue("vbdef33"); | ||||
|                 if(null != vbdef33 && null!=newAccNum && newAccNum.compareTo(new UFDouble(String.valueOf(vbdef33)))>0) { | ||||
|                     try { | ||||
|                         throw new BusinessException("累计到货主数量大于最终需求数量不能生成到货单!"); | ||||
|                     } catch (BusinessException e) { | ||||
|                         throw new RuntimeException(e); | ||||
|                     } | ||||
|                 } | ||||
|                 view.setNaccumarrvnum(newAccNum); | ||||
|             } else { | ||||
|                 if (view.getBreturn().booleanValue() || view.getBrefwhenreturn().booleanValue()) { | ||||
|                     UFDouble newAccNum = MathTool.add(view.getNaccumarrvnum(), diffNum); | ||||
|                     Object vbdef33= ((OrderItemVO)view.getVO(OrderItemVO.class)).getAttributeValue("vbdef33"); | ||||
|                     if(null != vbdef33 && null!=newAccNum && newAccNum.compareTo(new UFDouble(String.valueOf(vbdef33)))>0) { | ||||
|                         try { | ||||
|                             throw new BusinessException("累计到货主数量大于最终需求数量不能生成到货单!"); | ||||
|                         } catch (BusinessException e) { | ||||
|                             throw new RuntimeException(e); | ||||
|                         } | ||||
|                     } | ||||
|                     view.setNaccumarrvnum(newAccNum); | ||||
|                 } | ||||
| 
 | ||||
|                 UFDouble newAccBackNum = MathTool.add(view.getNbackarrvnum(), MathTool.oppose(diffNum)); | ||||
|                 view.setNbackarrvnum(newAccBackNum); | ||||
|             } | ||||
| 
 | ||||
|             UFDouble diffWasteNum = vo.getDiffWasteNum(); | ||||
|             UFDouble newWasteNum = MathTool.add(view.getNaccumwastnum(), diffWasteNum); | ||||
|             view.setNaccumwastnum(newWasteNum); | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| } | ||||
|  | @ -0,0 +1,109 @@ | |||
| // | ||||
| // Source code recreated from a .class file by IntelliJ IDEA | ||||
| // (powered by FernFlower decompiler) | ||||
| // | ||||
| 
 | ||||
| package nc.bs.pu.m23.writeback.ic.m45; | ||||
| 
 | ||||
| import java.util.HashSet; | ||||
| import java.util.Set; | ||||
| import nc.bs.pu.m21.writeback.OrderWBStoreArrvTolerRule; | ||||
| import nc.bs.pu.m21.writeback.OrderWritebackTolerRule; | ||||
| import nc.bs.pu.m21.writeback.ReceivePlanTolerRule; | ||||
| import nc.bs.pu.m21.writeback.pu.rule.AccArrNumChkRule; | ||||
| import nc.bs.pu.m21.writeback.pu.rule.AccArriveNumCalcRule; | ||||
| import nc.bs.pu.m21.writeback.pu.rule.ArriveCloseChkRule; | ||||
| import nc.bs.pu.m21.writeback.pu.rule.AutoArriveCloseRule; | ||||
| import nc.bs.pu.m21.writeback.pu.rule.ReceivePlanArrCalRule; | ||||
| import nc.bs.pu.m21.writeback.pu.rule.ReceivePlanArrChkRule; | ||||
| import nc.impl.pubapp.pattern.data.view.ViewQuery; | ||||
| import nc.impl.pubapp.pattern.data.vo.VOQuery; | ||||
| import nc.impl.pubapp.pattern.data.vo.VOUpdate; | ||||
| import nc.impl.pubapp.pattern.rule.plugin.IPluginPoint; | ||||
| import nc.impl.pubapp.pattern.rule.processer.AroundProcesser; | ||||
| import nc.impl.pubapp.pattern.rule.processer.CompareAroundProcesser; | ||||
| import nc.pubitf.pu.m21.ic.m45.IOrderWriteBackPara; | ||||
| import nc.pubitf.pu.m21.pu.m23.IOrderWriteBackParaFor23; | ||||
| import nc.vo.pu.m21.entity.OrderReceivePlanVO; | ||||
| import nc.vo.pu.m21.entity.OrderViewVO; | ||||
| import nc.vo.pu.m21.pub.OrderVOUtil; | ||||
| import nc.vo.pu.pub.util.PUSysParamUtil; | ||||
| import nc.vo.pub.lang.UFBoolean; | ||||
| import nc.vo.pubapp.pattern.data.ValueUtils; | ||||
| import nccloud.commons.lang.ArrayUtils; | ||||
| 
 | ||||
| public class OrderWriteBackFor23BP { | ||||
|     private UFBoolean isUserConfirm; | ||||
| 
 | ||||
|     public OrderWriteBackFor23BP(UFBoolean isUserConfirm) { | ||||
|         this.isUserConfirm = isUserConfirm; | ||||
|     } | ||||
| 
 | ||||
|     public void writeback(IOrderWriteBackParaFor23[] vos) { | ||||
|         if (!ArrayUtils.isEmpty(vos)) { | ||||
|             String[] bids = OrderVOUtil.getInsance().getBIDs(vos); | ||||
|             OrderViewVO[] views = (OrderViewVO[])(new ViewQuery(OrderViewVO.class)).query(bids); | ||||
|             if (!ArrayUtils.isEmpty(views)) { | ||||
|                 OrderViewVO[] orgViews = new OrderViewVO[views.length]; | ||||
| 
 | ||||
|                 for(int i = 0; i < views.length; ++i) { | ||||
|                     orgViews[i] = (OrderViewVO)views[i].clone(); | ||||
|                 } | ||||
| 
 | ||||
|                 OrderReceivePlanVO[] rpVOs = this.getRPVOs(vos); | ||||
|                 if (!ArrayUtils.isEmpty(rpVOs)) { | ||||
|                     AroundProcesser<OrderReceivePlanVO> rpPrecosser = new AroundProcesser((IPluginPoint)null); | ||||
|                     this.addRPRule(rpPrecosser, vos, views); | ||||
|                     rpPrecosser.before(rpVOs); | ||||
|                     String[] rpNames = new String[]{"naccumarrvnum", "nbackarrvnum", "naccumwastnum"}; | ||||
|                     VOUpdate<OrderReceivePlanVO> rpUpdate = new VOUpdate(); | ||||
|                     rpUpdate.update(rpVOs, rpNames); | ||||
|                     rpPrecosser.after(rpVOs); | ||||
|                 } | ||||
| 
 | ||||
|                 CompareAroundProcesser<OrderViewVO> processer = new CompareAroundProcesser((IPluginPoint)null); | ||||
|                 this.addRule(processer, vos, orgViews); | ||||
|                 processer.before(views, orgViews); | ||||
|                 processer.after(views, orgViews); | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     private void addRPRule(AroundProcesser<OrderReceivePlanVO> processer, IOrderWriteBackParaFor23[] vos, OrderViewVO[] views) { | ||||
|         processer.addBeforeRule(new ReceivePlanArrCalRule(vos, views)); | ||||
|         processer.addBeforeRule(new ReceivePlanArrChkRule(vos, views)); | ||||
|         processer.addAfterRule(new ReceivePlanTolerRule("intolerance", PUSysParamUtil.getPO02(views[0].getPk_org()), "naccumarrvnum", this.isUserConfirm)); | ||||
|     } | ||||
| 
 | ||||
|     private void addRule(CompareAroundProcesser<OrderViewVO> processer, IOrderWriteBackParaFor23[] vos, OrderViewVO[] orgViews) { | ||||
|         processer.addBeforeRule(new AccArriveNumCalcRule(vos)); | ||||
|         processer.addBeforeRule(new ArriveCloseChkRule(orgViews, vos)); | ||||
|         processer.addBeforeRule(new AccArrNumChkRule(vos)); | ||||
|         processer.addAfterRule(new AutoArriveCloseRule(vos)); | ||||
|         processer.addAfterRule(new OrderWritebackTolerRule("intolerance", PUSysParamUtil.getPO02(orgViews[0].getPk_org()), "naccumarrvnum", this.isUserConfirm)); | ||||
|         processer.addAfterRule(new OrderWBStoreArrvTolerRule(true, ValueUtils.getBoolean(this.isUserConfirm))); | ||||
|     } | ||||
| 
 | ||||
|     private OrderReceivePlanVO[] getRPVOs(IOrderWriteBackPara[] wbVos) { | ||||
|         if (ArrayUtils.isEmpty(wbVos)) { | ||||
|             return null; | ||||
|         } else { | ||||
|             Set<String> set = new HashSet(); | ||||
| 
 | ||||
|             for(IOrderWriteBackPara vo : wbVos) { | ||||
|                 if (vo != null && vo.getBBID() != null) { | ||||
|                     set.add(vo.getBBID()); | ||||
|                 } | ||||
|             } | ||||
| 
 | ||||
|             if (set.isEmpty()) { | ||||
|                 return null; | ||||
|             } else { | ||||
|                 String[] pkOrderBBs = (String[])set.toArray(new String[0]); | ||||
|                 VOQuery<OrderReceivePlanVO> query = new VOQuery(OrderReceivePlanVO.class); | ||||
|                 OrderReceivePlanVO[] rpVOs = (OrderReceivePlanVO[])query.query(pkOrderBBs); | ||||
|                 return rpVOs; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Loading…
	
		Reference in New Issue