一、场景
1、数据及操作数据动态变化
【结算归集】中“未归集的数据”
1)npID
每次编辑结算类型、结算维度拆分数据时,自动生成npID。
一般确定结算类型、维度后 npId值不变。
2) costShareID
打开归集界面,都会自动进行成本拆分,每个申请单明细数据 自动赋值 costShareId 。
未归集时,多次打开同npid数据,成本的costShareId会更新。
3)receivableID
成本数据(申请单明细) 生成应收时,自动赋值 receivableId,只在生成应收时自动赋值,后续不自动更新。
除非删除应收,重新生成成本。
3)npID、CostShareID 、receivableID关系:
①一个npID 对应多个 CostShareID 和多个 receivableID
②成本生成应收数据(应收数据):
每个 costShareID 都对应唯一一个 receivableID ()
③ 添加明细数据(应收数据):
只有receivableID,无costShareID
2、当前测试场景
前置条件:归集界面,10个成本都已添加应收,暂存未归集
数据情况分析:npID固定,每个成本都有唯一一个costShareID 和对应的 receivableID,且每次打开归集界面 costShareID会自动更新
二、问题及解决方案
1)问题:
测试点:归集保存
参数中 有多条应收 及多条成本数据,及有多条 receivableID 和 costShareID ,关联参数1个,含多个不同的receivableID 或者costShareID ,需要挨个分别传参
2)解决思路:设置关联,将关联获取参数保存到数组,进行参数调用
3)代码实现
Actio{
int i; // 定义变量
int count; 定义变量
char param[30][30]; 定义数组
。。。
web_reg_save_param("receivableId", //设置关联
"LB=receivableId\":\"",
"RB=\",\"npId",
"Search=Body",
"ORD=ALL", // 一定要有
LAST);
web_custom_request("queryNotionalPoolingData", // 获取 costShareID 和 receivableID Url
"URL=http://huodaitest.fruitease.com/api/ff-settlement/v1/pfNotionalPooling/queryNotionalPoolingData?ran=0.13618501576784198",
"Method=POST",
"TargetFrame=",
"Resource=0",
"RecContentType=application/json",
"Referer=http://huodaitest.fruitease.com/static/dashboard/collection/settlement-aggregation/settlement-detail?ywbh={Ywbh}&npId={npId}&dataSource=",
"Snapshot=t156.inf",
"Mode=HTML",
"EncType=application/json",
"Body={\"ywbh\":\"{Ywbh}\",\"dataSource\":\"\",\"id\":\"{npId}\",\"currentPage\":1,\"pageSize\":999}",
LAST);
count=atoi(lr_eval_string("{receivableId_count}")); // 获取 receivableId数量 赋值给count
lr_error_message("receivableId数量:%d",count); //打印 获取的receivableId 数量
for(i=1;i<=count;i++){
sprintf(param[i],"{receivableId_%d}",i);//参数名称存到数组中
lr_error_message(lr_eval_string(param[i])); //分别打印每个参数值
}
lr_save_string(lr_eval_string(param[1]),"Value1"); // 方法一:将变量转为参数,直接在请求中使用参数
// 方法二:直接用数组参数 进行调用 参数值 替换为 {receivableId_编号}
web_custom_request("saveNotionalPooling", // 关联数组参数使用URL
"URL=http://huodaitest.fruitease.com/api/ff-settlement/v1/notionalPooling/saveNotionalPooling?ran=0.24734918492299512",
"Method=POST",
"TargetFrame=",
"Resource=0",
"RecContentType=application/json",
"Referer=http://huodaitest.fruitease.com/static/dashboard/collection/settlement-aggregation/settlement-detail?ywbh={Ywbh}&npId={npId}&dataSource=",
"Snapshot=t158.inf",
"Mode=HTML",
"EncType=application/json",
"Body={\"npId\":\"{npId}\",\"dataSource\":\"\",\"currency\":\"CNY\",\"list\":{\"inserted\":[],\"updated\":[{\"receivableId\":\"{receivableId_10}\",\"npId\":\"{npId}\",\"businessNo\":\"{Ywbh}\",\"masterBillNo\":\"TDH-HRR-JDD\",\"containerNo\":\"HDMU5535120\",\"mainCostName\":\"海运堆场费用\",\"mainCostType\":\"0103\",\"costName\":\"污箱费\",\"costType\":\"010303\",\"noTaxMoney\":\"100.00\",\"taxPoint\":\"1.00"
"\",\"receivableMoney\":\"100.00\",\"applyNo\":\"SGTSF202201140001\",\"costShareId\":\"7aeca739-4248-4217-a530-280f97d038a0\",\"oldData\":\"0\",\"receivableMoneyRmb\":\"100.00\",\"rate\":\"1.00000000\",\"currency\":\"CNY\"},。。。有10组数据}",
LAST);
}