到货单已生成下游检验单时,到货单需要增加控制不能收回

This commit is contained in:
hefengkai 2024-10-28 11:58:53 +08:00
parent 9700d1d147
commit 93a3ae946a
1 changed files with 39 additions and 0 deletions

View File

@ -3,17 +3,23 @@ package nc.impl.pu.m23.approve.rule;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import nc.bs.framework.common.NCLocator;
import nc.impl.pubapp.pattern.rule.IRule; import nc.impl.pubapp.pattern.rule.IRule;
import nc.itf.pu.reference.ic.M45PUServices; import nc.itf.pu.reference.ic.M45PUServices;
import nc.itf.pu.reference.ic.M47PUServices; import nc.itf.pu.reference.ic.M47PUServices;
import nc.itf.uap.IUAPQueryBS;
import nc.jdbc.framework.processor.ColumnListProcessor;
import nc.vo.ml.NCLangRes4VoTransl; import nc.vo.ml.NCLangRes4VoTransl;
import nc.vo.pu.m23.entity.ArriveItemVO; import nc.vo.pu.m23.entity.ArriveItemVO;
import nc.vo.pu.m23.entity.ArriveVO; import nc.vo.pu.m23.entity.ArriveVO;
import nc.vo.pu.pub.util.ApproveFlowUtil; import nc.vo.pu.pub.util.ApproveFlowUtil;
import nc.vo.pub.BusinessException;
import nc.vo.pub.lang.UFBoolean; import nc.vo.pub.lang.UFBoolean;
import nc.vo.pub.lang.UFDouble; import nc.vo.pub.lang.UFDouble;
import nc.vo.pubapp.pattern.exception.ExceptionUtils; import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nc.vo.pubapp.pattern.pub.MathTool; import nc.vo.pubapp.pattern.pub.MathTool;
import nc.vo.pubapp.pattern.pub.SqlBuilder;
import nc.vo.scmpub.res.billtype.IBillType; import nc.vo.scmpub.res.billtype.IBillType;
import nc.vo.scmpub.res.billtype.POBillType; import nc.vo.scmpub.res.billtype.POBillType;
import nc.vo.scmpub.res.billtype.SCBillType; import nc.vo.scmpub.res.billtype.SCBillType;
@ -68,6 +74,12 @@ public class ChkCanUnApproveRule
ExceptionUtils.wrappBusinessException(message); ExceptionUtils.wrappBusinessException(message);
} }
//校验是否已经生成了到货检验单-华丰动力
if (isHaveDhjyd(aggVO)) {
String vbillcode = aggVO.getHVO().getVbillcode();//到货单单据号
ExceptionUtils.wrappBusinessException("到货单"+vbillcode+"已经生成检验单无法收回!");
}
ArriveItemVO[] itemVOArray = aggVO.getBVO(); ArriveItemVO[] itemVOArray = aggVO.getBVO();
for (int i = 0; i < itemVOArray.length; i++) { for (int i = 0; i < itemVOArray.length; i++) {
@ -135,4 +147,31 @@ public class ChkCanUnApproveRule
ExceptionUtils.wrappBusinessException( ExceptionUtils.wrappBusinessException(
NCLangRes4VoTransl.getNCLangRes().getStrByID("4004040_0", "04004040-0123")); NCLangRes4VoTransl.getNCLangRes().getStrByID("4004040_0", "04004040-0123"));
} }
//校验是否生成了到货检验单
private boolean isHaveDhjyd(ArriveVO aggVO) {
IUAPQueryBS querybs = NCLocator.getInstance().lookup(IUAPQueryBS.class);
String srcbillid = aggVO.getPrimaryKey();//获取到货单主键
SqlBuilder sb = new SqlBuilder();
sb.reset();
sb.append(" select pk_chekbill_h from hfdl_chekbill_h ");
sb.append(" where nvl(dr, 0) = 0 ");
sb.append(" and srcbillid = '" + srcbillid + "'");
try {
@SuppressWarnings("unchecked")
List<String> arridlist = (List<String>) querybs.executeQuery(sb.toString(), new ColumnListProcessor());
if (arridlist != null && arridlist.size() > 0) {
return true;
}
} catch(Exception e) {
return true;
}
return false;
}
} }