提交人:陈绍鑫

日期:2025/6/6 12:30
内容:自动交易成功
This commit is contained in:
陈绍鑫 2025-06-10 12:35:45 +08:00
parent 780f98a501
commit 437010f5f6
1 changed files with 22 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import kd.bos.orm.query.QFilter;
import kd.bos.schedule.executor.AbstractTask;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.bos.servicehelper.botp.BFTrackerServiceHelper;
import kd.bos.servicehelper.operation.OperationServiceHelper;
import kd.tmc.cdm.common.constant.CdmEntityConst;
import kd.tmc.cdm.common.enums.BillStatusEnum;
@ -107,6 +108,27 @@ public class redeemTaskPlugin extends AbstractTask {
}
}else {
logger.info("单据编号:"+cdm_payablebill.getString("billno")+"后台生单成功");
//根据源单id查询源单下游单据
Map<String, HashSet<Long>> tarBills = BFTrackerServiceHelper.findTargetBills("cdm_payablebill", new Long[]{cdm_payablebill.getLong("id")});
//返回的Map对象 如果有数据 String 对应的是 目标单据标识 value 对应的目标单ids
Set<DynamicObject> bill = new HashSet<DynamicObject>();
if (tarBills.containsKey("cdm_drafttradebill")) {
HashSet<Long> billId = tarBills.get("cdm_drafttradebill");
for (Long aLong : billId) {
QFilter billfilter = new QFilter("tradetype", QCP.equals, "redeem");
billfilter.and(new QFilter("billstatus", QCP.equals, "C"));
billfilter.and(new QFilter("id", QCP.equals, aLong));
DynamicObject cdm_drafttradebill = BusinessDataServiceHelper.loadSingle("cdm_drafttradebill", "id,billno", billfilter.toArray());
if (cdm_drafttradebill != null) {
OperationResult operation = OperationServiceHelper.executeOperate("drawbillsave", "cdm_drafttradebill", new Object[]{aLong}, OperateOption.create());
if (operation.isSuccess()) {
logger.info("单据编号:" + cdm_drafttradebill.getString("billno") + "确认交易成功");
} else {
logger.info("单据编号:" + cdm_drafttradebill.getString("billno") + "确认交易失败,请检查交易状态或者手动操作");
}
}
}
}
}
} catch (NumberFormatException e) {
logger.error("单据编号:"+cdm_payablebill.getString("billno")+"后台生单錯誤原因:"+e.getMessage());