负计划(到货单保存校验最终需求数量)

This commit is contained in:
lihao 2025-10-21 18:43:19 +08:00
parent c2d403c9ba
commit 509fab347d
3 changed files with 49 additions and 3 deletions

View File

@ -30,6 +30,7 @@ import nc.vo.pub.BusinessException;
import nc.vo.pub.compiler.PfParameterVO;
import nc.vo.pub.lang.UFBoolean;
import nc.vo.pub.lang.UFDateTime;
import nc.vo.pub.lang.UFDouble;
import nc.vo.scmpub.util.ArrayUtil;
import nc.vo.scmpub.util.BillBodySortUtils;
import nc.vo.scmpub.util.TransferSortUtil;
@ -163,9 +164,9 @@ public class TransferOrderAction implements ICommonAction {
for (OrderVO vo : sorceVOs) {
for (OrderItemVO itemVO:vo.getBVO()){
if(null != itemVO.getAttributeValue("vbdef33") && itemVO.getNastnum().compareTo(itemVO.getAttributeValue("vbdef33"))<0){
throw new BusinessException("采购数量大于最终需求数量不能生成采购订单!");
}
// if(null != itemVO.getAttributeValue("vbdef33") && itemVO.getNastnum().compareTo(new UFDouble(String.valueOf(itemVO.getAttributeValue("vbdef33"))))>0){
// throw new BusinessException("采购数量大于最终需求数量不能生成采购订单!");
// }
}
}
AggregatedValueObject[] arrivos = service.runChangeDataAry("21", "23", sorceVOs, (PfParameterVO)null);

View File

@ -8,6 +8,7 @@ package nc.impl.pu.m23.maintain.action;
import nc.bs.pu.m23.maintain.ArriveInsertBP;
import nc.bs.pu.m23.plugin.ArriveActionPlugInPoint;
import nc.impl.pu.m23.maintain.rule.CheckBillDateRule;
import nc.impl.pu.m23.maintain.rule.CheckFinalNumRule;
import nc.impl.pubapp.pattern.rule.processer.AroundProcesser;
import nc.vo.pu.m23.entity.ArriveVO;
import nc.vo.pu.m23.env.ArrivalUIToBSEnv;
@ -19,6 +20,7 @@ public class ArriveInsertAction {
public ArriveVO[] insertArrive(ArriveVO[] voArray, ArrivalUIToBSEnv env) {
AroundProcesser<ArriveVO> processer = new AroundProcesser(ArriveActionPlugInPoint.ArriveInsertAction);
addBeforeRule(processer);
processer.addBeforeRule(new CheckBillDateRule());
processer.before(voArray);
ArriveInsertBP bp = new ArriveInsertBP(env);
@ -28,5 +30,6 @@ public class ArriveInsertAction {
}
private void addBeforeRule(AroundProcesser<ArriveVO> processer) {
processer.addBeforeFinalRule(new CheckBillDateRule());
processer.addBeforeRule(new CheckFinalNumRule());
}
}

View File

@ -0,0 +1,42 @@
package nc.impl.pu.m23.maintain.rule;
import nc.vo.pu.m23.entity.ArriveItemVO;
import nc.vo.pu.m23.entity.ArriveVO;
import nc.impl.pubapp.pattern.rule.IRule;
import nc.vo.pub.BusinessException;
import nc.vo.pub.lang.UFDateTime;
import nc.vo.pub.lang.UFDouble;
/**
* 最终需求数量校验
*/
public class CheckFinalNumRule implements IRule<ArriveVO> {
public CheckFinalNumRule() {
}
public void process(ArriveVO[] arriveVOS) {
for (ArriveVO vo : arriveVOS) {
if (vo.getPrimaryKey() != null) {
continue;
}
if (vo == null || vo.getHVO() == null) {
try {
throw new BusinessException("到货单主信息不能为空");
} catch (BusinessException e) {
throw new RuntimeException(e);
}
}
ArriveItemVO[] bodys=vo.getBVO();
for(ArriveItemVO body : bodys) {
if(null!=body.getAttributeValue("vbdef33") && body.getNastnum().compareTo(new UFDouble(String.valueOf(body.getAttributeValue("vbdef33"))))>0){
try {
throw new BusinessException("数量大于最终需求数量不能生成到货单!");
} catch (BusinessException e) {
throw new RuntimeException(e);
}
}
}
}
}
}