SolutionMethodReference
用于支持跨应用、插件、扩展调用
方法签名
@SolutionMethodReference(entityId = "",methodName = "")
方法入参
- String entityId:调用Class或Table 的实体编号(对应xml的 id)
- String methodName:调用Class或Table 内方法的名称
示例代码
//示例1
//Invent app 有一个InventCountUitl Class 类 现在需要从Sales app 调用 其中的 countListMake方法执行其业务逻辑
//Invent App 内方法
public class InventCountUtil extends BaseInventCountUtil{
/**
* 库存盘点-批量制单
* @param inventCountIdList 盘点单号
* @param make 制单状态
*/
@Util
public void countListMake(List<String> inventCountIdList, boolean make){
for (String inventCountId : inventCountIdList) {
GongqiSession.ttsbegin();
BillLineAbnormalInfo.util().clearByBillId(GOTHelper.getEntityId(InventCountLine.class), inventCountId);
GongqiSession.ttscommit();
try {
GongqiSession.ttsbegin();
countMake(inventCountId, make);
GongqiSession.ttscommit();
} catch (Exception e) {
try {
GongqiSession.ttsrollback();
} catch (Exception e2) {
}
GongqiSession.ttsbegin();
BillLineAbnormalInfo.util().findOrCreate(GOTHelper.getEntityId(InventCountLine.class), SysTimeHelper.now().getTime(), inventCountId, e.getMessage());
GongqiSession.ttscommit();
}
}
}
}
//Sales App 内方法
public class Sales2InverntUtil extends BaseSales2InverntUtil{
/**
* 跨app调用Invent 对应 实体id是gongqi.df.invent.80400005 的class 里面的 countListMake 方法
*/
@Util
@SolutionMethodReference(entityId = "gongqi.df.invent.80400005",methodName = "countListMake")
public void countListMake(List<String> inventCountIdList, boolean make){
throw new ERPException("未找到对应调用方法");
}
}
//示例2
//Invent app 有一个InventTable上 有个findList方法 现在需要从Sales app 调用 该方法
//与Class 调用相似 需要 在 Sales app 的 Class 内 建一个 返回值相同 参数相同的方法
/**
* 跨app调用Invent 对应 实体id是gongqi.df.invent.30400006的Table 里面的 findList 方法
*/
@Util
@SolutionMethodReference(entityId = "gongqi.df.invent.30400006",methodName = "findList")
public void findInventList(List<String> inventCountIdList){
throw new ERPException("未找到对应调用方法");
}
//如果在Sales 执行 Sales2InverntUtil.util().countListMake() 方法 找不到 被调用 对应entityId的方法 则会执行 当前逻辑 抛出【未找到对应调用方法】
//如果在Sales 执行 Sales2InverntUtil.util().countListMake() 方法 被调用 对应entityId的方法执行错误 则会抛出执行代码对应的异常错误
[!NOTE]
注意 该类注解在 3.13及以后版本启用
如果调用的是Class 的方法 则只能调用@Util注解的方法,Table 则没有该限制
要求该注解的方法 返回值 参数列表 和 被调用方法保持一致 方法名称可以不一致
如果参数或者返回值需要GongqqiRecord 则用对应的Map替代