金蝶二开凭证生成反写二开单据凭证号
/**
* 凭证生成时反写凭证号
*/
@Override
public void reverseSave(Context ctx, IObjectPK srcBillPK,CoreBillBaseInfo srcBillVO,
BOTBillOperStateEnum bOTBillOperStateEnum,BOTRelationInfo bOTRelationInfo) throws BOSException, EASBizException {
BOTRelationInfo relation = (BOTRelationInfo) bOTRelationInfo;
BOSObjectType bosType = BOSUuid.read(relation.getDestObjectID()).getType();
if(bosType.equals((new VoucherInfo()).getBOSType())) {
FundTransInterInfo info = (FundTransInterInfo) srcBillVO;
if(!bOTBillOperStateEnum.equals(BOTBillOperStateEnum.DELETE)) {
// 生成凭证
String voucherID = relation.getDestObjectID();
VoucherInfo voucherInfo = (VoucherInfo) VoucherFactory.getLocalInstance(ctx).getValue(new ObjectStringPK(voucherID));
// 以下设置单据的凭证信息
info.setVoucherNum(voucherInfo.getNumber());
}
FundTransInterFactory.getLocalInstance(ctx).reverseSave(srcBillPK, info);
}
}
/**
* 凭证删除时反写凭证号为空
*/
@Override
public void reverseSave(Context ctx, IObjectPK srcBillPK, IObjectValue arg2,
BOTBillOperStateEnum arg3, IObjectValue arg4, IObjectValue arg5)
throws BOSException, EASBizException {
BOTRelationInfo relation = (BOTRelationInfo) arg4;
BOSObjectType bosType = BOSUuid.read(relation.getDestObjectID()).getType();
if(bosType.equals((new VoucherInfo()).getBOSType())) {
FundTransInterInfo info = (FundTransInterInfo) arg2;
// 删除凭证
if(arg3.equals(BOTBillOperStateEnum.DELETE)) {
// 以下设置单据的凭证信息
info.setVoucherNum(null);
}
FundTransInterFactory.getLocalInstance(ctx).reverseSave(srcBillPK, info);
}
}
需要对框架的凭证进行处理时,在对应controllerBean中重写对应方法
在生成凭证时反写
public void reverseSave(Context ctx, IObjectPK srcBillPK,CoreBillBaseInfo srcBillVO,
BOTBillOperStateEnum bOTBillOperStateEnum,BOTRelationInfo bOTRelationInfo) throws BOSException, EASBizException {}
在删除凭证时反写
public void reverseSave(Context ctx, IObjectPK srcBillPK, IObjectValue arg2,
BOTBillOperStateEnum arg3, IObjectValue arg4, IObjectValue arg5)
throws BOSException, EASBizException {}