重构批转换采购订单逻辑

- 移除直接调用 PfServiceScmUtil.processBatch 方法
- 使用 IPfExchangeService 接口进行数据转换
- 增加转换结果的空判断和日志记录
- 引入必要的类和接口
This commit is contained in:
张明 2025-05-29 18:11:57 +08:00
parent 72a07d87ba
commit 3cad4fdf2d
1 changed files with 10 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import nc.bs.framework.common.NCLocator;
import nc.bs.logging.Log; import nc.bs.logging.Log;
import nc.bs.pub.common.PfServiceScmUtil; import nc.bs.pub.common.PfServiceScmUtil;
import nc.bs.pub.pa.PreAlertObject; import nc.bs.pub.pa.PreAlertObject;
@ -13,6 +14,7 @@ import nc.bs.pub.taskcenter.IBackgroundWorkPlugin;
import nc.bs.pubapp.AppBsContext; import nc.bs.pubapp.AppBsContext;
import nc.impl.pubapp.pattern.data.vo.VOQuery; import nc.impl.pubapp.pattern.data.vo.VOQuery;
import nc.impl.pubapp.pattern.page.db.IDDBPage; import nc.impl.pubapp.pattern.page.db.IDDBPage;
import nc.itf.uap.pf.IPfExchangeService;
import nc.util.mmf.framework.base.MMArrayUtil; import nc.util.mmf.framework.base.MMArrayUtil;
import nc.util.mmf.framework.db.MMSqlBuilder; import nc.util.mmf.framework.db.MMSqlBuilder;
import nc.vo.pu.m20.entity.PraybillHeaderVO; import nc.vo.pu.m20.entity.PraybillHeaderVO;
@ -21,7 +23,9 @@ import nc.vo.pu.m20.entity.PraybillVO;
import nc.vo.pu.m21.entity.OrderItemVO; import nc.vo.pu.m21.entity.OrderItemVO;
import nc.vo.pu.m21.entity.OrderVO; import nc.vo.pu.m21.entity.OrderVO;
import nc.vo.pub.BusinessException; import nc.vo.pub.BusinessException;
import nc.vo.pub.compiler.PfParameterVO;
import nc.vo.pubapp.pattern.exception.ExceptionUtils; import nc.vo.pubapp.pattern.exception.ExceptionUtils;
import nc.vo.scmpub.res.billtype.POBillType;
public class BatchTransferToPurchaseOrder implements IBackgroundWorkPlugin { public class BatchTransferToPurchaseOrder implements IBackgroundWorkPlugin {
private static final Log logger = Log.getInstance("devpoordertask"); private static final Log logger = Log.getInstance("devpoordertask");
@ -199,8 +203,13 @@ public class BatchTransferToPurchaseOrder implements IBackgroundWorkPlugin {
bvo[j].setCrowno(String.valueOf(rowNum)); bvo[j].setCrowno(String.valueOf(rowNum));
} }
} }
PfServiceScmUtil.processBatch("SAVEBASE", "21", orderVOs, null, null); IPfExchangeService service = NCLocator.getInstance().lookup(IPfExchangeService.class);
OrderVO[] transVos = (OrderVO[]) service.runChangeDataAry("20", "21", orderVOs, null);
if (transVos == null || transVos.length <= 0) {
logger.info("转换时出现问题,传唤后VO对象数组为空", this.getClass(), "processBatchTransfer");
}
logger.info("采购订单保存完成", this.getClass(), "processBatchTransfer"); logger.info("采购订单保存完成", this.getClass(), "processBatchTransfer");
} else { } else {
logger.warn("单据转换未生成任何采购订单", this.getClass(), "processBatchTransfer"); logger.warn("单据转换未生成任何采购订单", this.getClass(), "processBatchTransfer");
} }