7.5版本设置不允许断号,编码直接不出来,在提交里面再次调用编码生成规则
或者在服务端写方法调用
public void actionSave_actionPerformed(ActionEvent e) throws Exception {
if (this.editData.getNumber() == null) {
SysContext sysContext = SysContext.getSysContext();
if (sysContext.getCurrentOrgUnit() != null) {
String companyID = sysContext.getCurrentOrgUnit().getString(
"id");
ICodingRuleManager iCodingRuleManager = CodingRuleManagerFactory
.getRemoteInstance();
if (iCodingRuleManager.isExist(this.editData, companyID)) {
this.editData.setNumber(iCodingRuleManager.getNumber(
this.editData, companyID));
this.txtNumber.setText(this.editData.getNumber());
}
this.oldData = this.editData;
}
}
super.actionSave_actionPerformed(e);
}
服务端
/**
* 通过当前对象的编码规则,获取单据编码,没有返回NULL
* @param ctx
* @param info 获取编码规则的对象
* @return
*/
public static String getNewNumber(Context ctx,CoreBillBaseInfo info){
String number = "";
ICodingRuleManager iCodingRuleManager = null;
OrgUnitInfo orgUnit = ContextUtil.getCurrentOrgUnit(ctx);
if(orgUnit == null) return null;
try {
iCodingRuleManager = CodingRuleManagerFactory.getLocalInstance(ctx);
if(iCodingRuleManager.isExist(info, orgUnit.getId().toString()))
number = iCodingRuleManager.getNumber(info, orgUnit.getId().toString());
else
return null;
} catch (EASBizException e) {
e.printStackTrace();
} catch (BOSException e) {
e.printStackTrace();
}
return number;
}
断码回收代码
protected void _delete(Context ctx, IObjectPK pk) throws BOSException,
EASBizException {
ZjbfInfo info = ZjbfFactory.getLocalInstance(ctx).getZjbfInfo(pk);
String number = info.getNumber();
// 删除单据后,当前单据编码需要回收,调用回收接口
// recycleNumber(ctx, info, info.getAPPCompany().getId().toString(),
// number);
super._delete(ctx, pk);
ICodingRuleManager iCodingRuleManager = CodingRuleManagerFactory
.getLocalInstance(ctx);
iCodingRuleManager.recycleNumber(info, info.getAPPCompany().getId()
.toString(), number);
}