1.采购需求自动生成编码规则优化

S
This commit is contained in:
weiyunlong 2024-12-19 12:38:50 +08:00
parent 18a8a1a064
commit 288fa85533
1 changed files with 31 additions and 29 deletions

View File

@ -26,36 +26,7 @@ public class PurDemandFormPlugin extends AbstractFormPlugin {
super.afterBindData(e);
//根据组织携带项目
updateRenovationProject();
DynamicObject dataEntity = this.getModel().getDataEntity(true);
// if (StringUtils.isEmpty(dataEntity.getString("billno"))) {
// QFilter q1 = new QFilter("number","=","CGXQ");
// DynamicObject coderule = BusinessDataServiceHelper.loadSingle("bos_coderule", "id", new QFilter[]{q1});
// if (null != coderule) {
// CodeRuleInfo codeRule = CodeRuleCache.reloadCodeRuleById(coderule.getString("id"));
// String number = CodeRuleServiceHelper.getNumber(codeRule, dataEntity);
// String purissue = codeRuleNumberIsExits(number, codeRule, dataEntity);
// this.getModel().setValue("billno", purissue);
// }
// }
}
/**
* 递归,若生成的采购单号已存在则重新生成
* @param purissue
* @param codeRule
* @param purapplybill
* @return
*/
public static String codeRuleNumberIsExits(String purissue,CodeRuleInfo codeRule,DynamicObject purapplybill){
QFilter filter = new QFilter("billno", QCP.equals,purissue);
boolean exists = QueryServiceHelper.exists("recon_settleplanbill", new QFilter[]{filter});
if(exists){
purissue = CodeRuleServiceHelper.getNumber(codeRule, purapplybill);
return codeRuleNumberIsExits(purissue,codeRule,purapplybill);
}else{
return purissue;
}
}
@Override
@ -98,3 +69,34 @@ public class PurDemandFormPlugin extends AbstractFormPlugin {
}
}
// DynamicObject dataEntity = this.getModel().getDataEntity(true);
// if (StringUtils.isEmpty(dataEntity.getString("billno"))) {
// QFilter q1 = new QFilter("number","=","CGXQ");
// DynamicObject coderule = BusinessDataServiceHelper.loadSingle("bos_coderule", "id", new QFilter[]{q1});
// if (null != coderule) {
// CodeRuleInfo codeRule = CodeRuleCache.reloadCodeRuleById(coderule.getString("id"));
// String number = CodeRuleServiceHelper.getNumber(codeRule, dataEntity);
// String purissue = codeRuleNumberIsExits(number, codeRule, dataEntity);
// this.getModel().setValue("billno", purissue);
// }
// }
// /**
// * 递归,若生成的采购单号已存在则重新生成
// * @param purissue
// * @param codeRule
// * @param purapplybill
// * @return
// */
// public static String codeRuleNumberIsExits(String purissue,CodeRuleInfo codeRule,DynamicObject purapplybill){
// QFilter filter = new QFilter("billno", QCP.equals,purissue);
// boolean exists = QueryServiceHelper.exists("recon_settleplanbill", new QFilter[]{filter});
// if(exists){
// purissue = CodeRuleServiceHelper.getNumber(codeRule, purapplybill);
// return codeRuleNumberIsExits(purissue,codeRule,purapplybill);
// }else{
// return purissue;
// }
// }