修复请购单转换到采购订单时的异常处理
- 移除了不必要的异常处理工具类 ExceptionUtils -优化了查询 SQL 的构建逻辑- 增加了对 pkGroup 和 pkorgs 的空值校验,抛出 BusinessException - 删除了冗余的注释和代码
This commit is contained in:
parent
7ce829f8b5
commit
e15ef4f523
|
@ -22,10 +22,7 @@ import nc.vo.pu.m21.entity.OrderHeaderVO;
|
|||
import nc.vo.pu.m21.entity.OrderItemVO;
|
||||
import nc.vo.pu.m21.entity.OrderVO;
|
||||
import nc.vo.pub.BusinessException;
|
||||
import nc.vo.pub.CircularlyAccessibleValueObject;
|
||||
import nc.vo.pub.ISuperVO;
|
||||
import nc.vo.pub.VOStatus;
|
||||
import nc.vo.pubapp.pattern.exception.ExceptionUtils;
|
||||
import nc.vo.pubapp.pattern.model.entity.bill.AbstractBill;
|
||||
import nc.vo.scmpub.res.billtype.POBillType;
|
||||
import nc.vo.scmpub.util.AppInfoContext;
|
||||
|
@ -89,8 +86,6 @@ public class BatchTransferToPurchaseOrder implements IBackgroundWorkPlugin {
|
|||
return resultList.toArray(new PraybillVO[resultList.size()]);
|
||||
} catch (Exception e) {
|
||||
logger.error("查询满足条件的请购单失败", e, this.getClass(), "getQualifiedPurchaseRequests");
|
||||
// marsh Å׳öÒì³£
|
||||
ExceptionUtils.marsh(e);
|
||||
return new PraybillVO[0];
|
||||
}
|
||||
}
|
||||
|
@ -98,20 +93,22 @@ public class BatchTransferToPurchaseOrder implements IBackgroundWorkPlugin {
|
|||
/**
|
||||
* 构建查询SQL 查询视图
|
||||
*/
|
||||
private String getSql(BgWorkingContext bgwc) {
|
||||
private String getSql(BgWorkingContext bgwc) throws BusinessException {
|
||||
logger.debug("开始构建查询SQL", this.getClass(), "getSql");
|
||||
String[] pkorgs = bgwc.getPk_orgs();
|
||||
String pkGroup = AppBsContext.getInstance().getPkGroup();
|
||||
if (pkGroup == null) {
|
||||
throw new BusinessException("请购单转换到采购订单任务时pkGroup为空");
|
||||
}
|
||||
if (MMArrayUtil.isNotEmpty(pkorgs)) {
|
||||
throw new BusinessException("请购单转换到采购订单时组织为空");
|
||||
}
|
||||
MMSqlBuilder sb = new MMSqlBuilder();
|
||||
sb.append(" SELECT PK_PRAYBILL_B");
|
||||
sb.append(" FROM TRANS_PRAYBILL_PURCHASE");
|
||||
if (pkGroup != null) {
|
||||
sb.append(" WHERE PK_GROUP ", pkGroup);
|
||||
}
|
||||
if (MMArrayUtil.isNotEmpty(pkorgs)) {
|
||||
sb.append(" AND");
|
||||
sb.append(" PK_ORG", pkorgs);
|
||||
}
|
||||
sb.append(" WHERE PK_GROUP ", pkGroup);
|
||||
sb.append(" AND");
|
||||
sb.append(" PK_ORG", pkorgs);
|
||||
String finalSql = sb.toString();
|
||||
logger.debug("SQL构建完成", this.getClass(), "getSql");
|
||||
return finalSql;
|
||||
|
|
Loading…
Reference in New Issue