ledger_check.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. 'use strict';
  2. /**
  3. *
  4. *
  5. * @author Mai
  6. * @date
  7. * @version
  8. */
  9. const ledgerCheckType = {
  10. sibling: {value: 1, text: '项目节、清单同层', fun: 'checkSibling', },
  11. empty_code: {value: 2, text: '项目节、清单编号同时为空', fun: 'checkCodeEmpty', },
  12. calc: {value: 3, text: '清单数量不等于计量单元之和', fun: 'checkCalc', },
  13. zero: {value: 4, text: '清单数量或单价为0', fun: 'checkZero', },
  14. zeroPos: {value: 12, text: '计量单元数量为0', fun: 'checkZeroPos', },
  15. pos_drawingCode: {value: 13, text: '计量单元图册号为空', fun: 'checkPosDrawingCode', },
  16. tp: {value: 5, text: '清单金额≠数量×单价', fun: 'checkTp', },
  17. over: {value: 6, text: '超计', fun: 'checkOver', },
  18. same_code: {value: 7, text: '重复项目节', fun: 'checkSameCode', },
  19. same_bills: {value: 14, text: '重复清单(同部位)', fun: 'checkSameBwBills', },
  20. limit3f: {
  21. fun: 'check3fLimit', items: [
  22. { value: 8, text: '违规计量(工序报验)', key: 'gxbyOver', type: 'gxby', },
  23. { value: 9, text: '遗漏计量(工序报验)', key: 'gxbyLost', type: 'gxby', },
  24. { value: 10, text: '违规计量(档案管理)', key: 'daglOver', type: 'dagl', },
  25. { value: 11, text: '遗漏计量(档案管理)', key: 'daglLost', type: 'dagl', },
  26. ]
  27. },
  28. multiLimit3f: {
  29. value: 12, text: '联动计量', fun: 'check3fMultiLimit'
  30. },
  31. minus_cb: { value: 13, text: '负变更清单漏计', url: window.location.pathname + '/stageCheck?type=minus_cb' },
  32. change_over: { value: 14, text: '变更令超计', url: window.location.pathname + '/stageCheck?type=change_over'},
  33. };
  34. const ledgerCheckUtil = {
  35. checkSibling: function (ledgerTree, ledgerPos, decimal, option) {
  36. const error = [];
  37. for (const node of ledgerTree.nodes) {
  38. if (!node.children || node.children.length === 0) continue;
  39. let hasXmj, hasGcl;
  40. for (const child of node.children) {
  41. if (child.b_code) hasXmj = true;
  42. if (!child.b_code) hasGcl = true;
  43. }
  44. if (hasXmj && hasGcl) error.push(node);
  45. }
  46. return error;
  47. },
  48. checkCodeEmpty: function (ledgerTree, ledgerPos, decimal, option) {
  49. const error = [];
  50. const checkNodeCode = function (node) {
  51. if ((!node.code || node.code === '') && (!node.b_code || node.b_code === '')) error.push(node);
  52. if (node.children && node.children.length > 0) {
  53. for (const child of node.children) {
  54. checkNodeCode(child);
  55. }
  56. }
  57. };
  58. for (const topLevel of ledgerTree.children) {
  59. if ([1, 3, 4].indexOf(topLevel.node_type) < 0) continue;
  60. checkNodeCode(topLevel);
  61. }
  62. return error;
  63. },
  64. checkCalc: function (ledgerTree, ledgerPos, decimal, option) {
  65. const error = [];
  66. for (const node of ledgerTree.nodes) {
  67. if (node.children && node.children.length > 0) continue;
  68. const nodePos = ledgerPos.getLedgerPos(node.id);
  69. if (!nodePos || nodePos.length === 0) continue;
  70. const checkData = {}, calcData = {};
  71. for (const f of option.fields) {
  72. checkData[f] = node[f] || 0;
  73. calcData[f] = 0;
  74. }
  75. for (const np of nodePos) {
  76. for (const f of option.fields) {
  77. calcData[f] = ZhCalc.add(calcData[f], np[f]) || 0;
  78. }
  79. }
  80. if (!_.isMatch(checkData, calcData)) {
  81. error.push(node);
  82. }
  83. }
  84. return error;
  85. },
  86. checkZero: function (ledgerTree, ledgerPos, decimal, option) {
  87. const error = [];
  88. for (const node of ledgerTree.nodes) {
  89. if ((!node.b_code || node.b_code === '')) continue;
  90. if (node.children && node.children.length > 0) continue;
  91. if ((checkZero(node.sgfh_qty) && checkZero(node.qtcl_qty) && checkZero(node.sjcl_qty)
  92. && checkZero(node.deal_qty) && checkZero(node.quantity))
  93. || checkZero(node.unit_price)) error.push(node);
  94. }
  95. return error;
  96. },
  97. checkZeroPos: function (ledgerTree, ledgerPos, decimal, option) {
  98. const error = [];
  99. for (const node of ledgerTree.nodes) {
  100. if (node.children && node.children.length > 0) continue;
  101. const nodePos = ledgerPos.getLedgerPos(node.id);
  102. if (!nodePos || nodePos.length === 0) continue;
  103. for (const np of nodePos) {
  104. if (checkZero(np.sgfh_qty) && checkZero(np.qtcl_qty) && checkZero(np.sjcl_qty) && checkZero(np.quantity)) {
  105. error.push(node);
  106. break;
  107. }
  108. }
  109. }
  110. return error;
  111. },
  112. checkPosDrawingCode: function (ledgerTree, ledgerPos, decimal, option) {
  113. const error = [];
  114. for (const node of ledgerTree.nodes) {
  115. if (node.children && node.children.length > 0) continue;
  116. const nodePos = ledgerPos.getLedgerPos(node.id);
  117. if (!nodePos || nodePos.length === 0) continue;
  118. for (const np of nodePos) {
  119. if (!np.drawing_code) {
  120. error.push(node);
  121. break;
  122. }
  123. }
  124. }
  125. return error;
  126. },
  127. checkTp: function (ledgerTree, ledgerPos, decimal, option) {
  128. const error = [];
  129. for (const node of ledgerTree.nodes) {
  130. if (node.children && node.children.length > 0) continue;
  131. if (option.filter && option.filter(node)) continue;
  132. const checkData = {}, calcData = {};
  133. for (const f of option.fields) {
  134. checkData[f.tp] = node[f.tp] || 0;
  135. calcData[f.tp] = ZhCalc.mul(node.unit_price, node[f.qty], decimal.tp) || 0;
  136. }
  137. if (!_.isMatch(checkData, calcData)) error.push(node);
  138. }
  139. return error;
  140. },
  141. checkOver: function(ledgerTree, ledgerPos, decimal, option) {
  142. const error = [];
  143. for (const node of ledgerTree.nodes) {
  144. if (node.children && node.children.length > 0) continue;
  145. if (checkUtils.billsOver(node, ledgerPos, option.checkInfo)) error.push(node);
  146. }
  147. return error;
  148. },
  149. checkSameCode: function (ledgerTree, ledgerPos, decimal, option) {
  150. const error = [];
  151. //let xmj = ledgerTree.nodes.filter(x => { return /^((GD*)|G)?[0-9]+/.test(x.code); });
  152. let xmj = [];
  153. const addXmjCheck = function (node) {
  154. if (/^((GD*)|G)?[0-9]+/.test(node.code)) xmj.push(node);
  155. for (const child of node.children) {
  156. addXmjCheck(child);
  157. }
  158. };
  159. for (const topLevel of ledgerTree.children) {
  160. if ([1, 2, 3, 4].indexOf(topLevel.node_type) < 0) continue;
  161. addXmjCheck(topLevel);
  162. }
  163. const xmjPart = {}, xmjIndex = [];
  164. for (const x of xmj) {
  165. if (!xmjPart[x.code]) {
  166. xmjPart[x.code] = [];
  167. xmjIndex.push(x.code);
  168. }
  169. xmjPart[x.code].push(x);
  170. }
  171. for (const x of xmjIndex) {
  172. if (xmjPart[x].length > 1) error.push(...xmjPart[x]);
  173. }
  174. return error;
  175. },
  176. checkSameBwBills: function(ledgerTree, ledgerPos, decimal, option) {
  177. const error = [];
  178. for (const node of ledgerTree.nodes) {
  179. if (!node.children || node.children.length === 0) continue;
  180. const gatherGcl = [];
  181. for (const child of node.children) {
  182. if (!child.b_code) continue;
  183. let gcl = gatherGcl.find(g => {
  184. return g.b_code === child.b_code &&
  185. (g.name || child.name ? g.name === child.name : true) &&
  186. (g.unit || child.unit ? g.unit === child.unit : true) &&
  187. checkZero(ZhCalc.sub(g.unit_price, child.unit_price));
  188. });
  189. if (!gcl) {
  190. gcl = { source: [], b_code: child.b_code || '', name: child.name || '', unit: child.unit || '', unit_price: child.unit_price || 0 };
  191. gatherGcl.push(gcl);
  192. }
  193. gcl.source.push(child);
  194. }
  195. gatherGcl.forEach(g => {
  196. if (g.source.length > 1) error.push(...g.source);
  197. })
  198. }
  199. return error;
  200. },
  201. check3fLimit: function (ledgerTree, ledgerPos, decimal, option) {
  202. const error = {};
  203. for (const i of ledgerCheckType.limit3f.items) {
  204. error[i.key] = [];
  205. }
  206. if (option.checkType.length === 0) return error;
  207. const findPrecision = function (list, unit) {
  208. if (unit) {
  209. for (const p in list) {
  210. if (list[p].unit && list[p].unit === unit) {
  211. return list[p];
  212. }
  213. }
  214. }
  215. return list.other;
  216. };
  217. const getRatio = function (type, status) {
  218. const statusConst = type === 'gxby' ? option.status.gxby : option.status.dagl;
  219. const sc = statusConst.find(x => { return x.value === status });
  220. return sc ? sc.ratio : null;
  221. };
  222. const getValid = function (type, status, limit) {
  223. if (limit) {
  224. const statusConst = type === 'gxby' ? option.status.gxby : option.status.dagl;
  225. const sc = statusConst.find(x => { return x.value === status; });
  226. return sc ? (sc.limit ? 1 : 0) : 0;
  227. } else {
  228. return -1;
  229. }
  230. };
  231. const check3f = function (data, limit, ratio) {
  232. if (limit === 0) {
  233. if (data.contract_tp || data.pre_contract_tp) return 1; // 违规
  234. }
  235. if (limit === 1) {
  236. if (ratio === 0) {
  237. if (!data.contract_tp && !data.pre_contract_tp) return 2; // 漏计
  238. } else {
  239. const tp = ZhCalc.mul(data.final_1_tp, ZhCalc.div(ratio, 100, 4), decimal.tp);
  240. const checkTp = ZhCalc.add(data.contract_tp, data.pre_contract_tp);
  241. if (tp > checkTp) return 1; // 违规
  242. if (tp < checkTp) return 2; // 漏计
  243. }
  244. }
  245. return 0; // 合法
  246. };
  247. const check3fQty = function (data, limit, ratio, unit) {
  248. if (limit === 0) {
  249. if (data.contract_qty || data.qc_qty || data.pre_contract_qty || data.pre_qc_qty) return 1; // 违规
  250. }
  251. if (limit === 1) {
  252. if (!ratio || ratio === 0) {
  253. if (!data.contract_qty && !data.qc_qty && !data.pre_contract_qty && !data.pre_qc_qty) return 2; // 漏计
  254. } else {
  255. const precision = findPrecision(tenderInfo.precision, unit);
  256. const checkQty = ZhCalc.mul(data.final_1_qty, ZhCalc.div(ratio, 100, 4), precision.value);
  257. const qty = ZhCalc.add(data.contract_qty, data.pre_contract_qty) || 0;
  258. if (qty > checkQty) return 1; // 违规
  259. if (qty < checkQty) return 2; // 漏计
  260. }
  261. }
  262. return 0; // 合法
  263. };
  264. const checkLeafBills3fLimit = function(bills, checkInfo) {
  265. const over = [], lost = [];
  266. const posRange = ledgerPos.getLedgerPos(bills.id);
  267. if (posRange && posRange.length > 0) {
  268. for (const p of posRange) {
  269. const posCheckInfo = _.assign({}, checkInfo);
  270. for (const ct of option.checkType) {
  271. if (p[ct + '_limit'] > 0) {
  272. posCheckInfo[ct + '_limit'] = p[ct + '_limit'];
  273. }
  274. }
  275. for (const ct of option.checkType) {
  276. const checkResult = check3fQty(p, getValid(ct, p[ct + '_status'], posCheckInfo[ct + '_limit']),
  277. getRatio(ct, p[ct + '_status']), bills.unit);
  278. if (checkResult === 1) {
  279. if (over.indexOf(ct) === -1) over.push(ct);
  280. }
  281. if (checkResult === 2) {
  282. if (lost.indexOf(ct) === -1) lost.push(ct);
  283. }
  284. }
  285. }
  286. } else {
  287. for (const ct of option.checkType) {
  288. const checkResult = bills.is_tp
  289. ? check3f(bills, getValid(ct, bills[ct + '_status'], checkInfo[ct + '_limit']), getRatio(ct, bills[ct + '_status']))
  290. : check3fQty(bills, getValid(ct, bills[ct + '_status'], checkInfo[ct + '_limit']), getRatio(ct, bills[ct + '_status']), bills.unit);
  291. if (checkResult === 1) {
  292. if (over.indexOf(ct) === -1) over.push(ct);
  293. }
  294. if (checkResult === 2) {
  295. if (lost.indexOf(ct) === -1) lost.push(ct);
  296. }
  297. }
  298. }
  299. if (over.indexOf('gxby') >= 0) error.gxbyOver.push(bills);
  300. if (over.indexOf('dagl') >= 0) error.daglOver.push(bills);
  301. if (lost.indexOf('gxby') >= 0) error.gxbyLost.push(bills);
  302. if (lost.indexOf('dagl') >= 0) error.daglLost.push(bills);
  303. };
  304. const recursiveCheckBills3fLimit = function (bills, parentCheckInfo) {
  305. const checkInfo = _.assign({}, parentCheckInfo);
  306. for (const ct of option.checkType) {
  307. if (bills[ct + '_limit'] > 0) {
  308. checkInfo[ct + '_limit'] = bills[ct + '_limit'];
  309. }
  310. }
  311. if (bills.children && bills.children.length > 0) {
  312. for (const c of bills.children) {
  313. recursiveCheckBills3fLimit(c, checkInfo);
  314. }
  315. } else {
  316. checkLeafBills3fLimit(bills, checkInfo);
  317. }
  318. };
  319. for (const b of ledgerTree.children) {
  320. recursiveCheckBills3fLimit(b, {});
  321. }
  322. return error;
  323. },
  324. check3fMultiLimit: function(ledgerTree, ledgerPos, decimal, option) {
  325. const error = [];
  326. if (option.limits.length === 0) return error;
  327. const findPrecision = function (list, unit) {
  328. if (unit) {
  329. for (const p in list) {
  330. if (list[p].unit && list[p].unit === unit) {
  331. return list[p];
  332. }
  333. }
  334. }
  335. return list.other;
  336. };
  337. const check3fTp = function (data, limit, range) {
  338. if (limit === 0) {
  339. if (data.contract_tp || data.pre_contract_tp) return 1; // 违规
  340. }
  341. if (limit === 1) {
  342. const lower = ZhCalc.mul(data.total_price, ZhCalc.div(range.lower, 100, 4), decimal.tp);
  343. const upper = ZhCalc.mul(data.total_price, ZhCalc.div(range.upper, 100, 4), decimal.tp);
  344. const checkTp = ZhCalc.add(data.contract_tp, data.pre_contract_tp) || 0;
  345. if (checkTp > upper) return 1; // 违规
  346. if (checkTp < lower) return 2; // 漏计
  347. }
  348. return 0; // 合法
  349. };
  350. const check3fQty = function (data, limit, range, unit) {
  351. if (limit === 0) {
  352. if (data.contract_qty || data.qc_qty || data.pre_contract_qty || data.pre_qc_qty) return 1; // 违规
  353. }
  354. if (limit === 1) {
  355. const precision = findPrecision(tenderInfo.precision, unit);
  356. const lower = ZhCalc.mul(data.final_1_qty, ZhCalc.div(range.lower, 100, 4), precision.value);
  357. const upper = ZhCalc.mul(data.final_1_qty, ZhCalc.div(range.upper, 100, 4), precision.value);
  358. const checkQty = ZhCalc.add(data.contract_qty, data.pre_contract_qty) || 0;
  359. if (checkQty > upper) return 1; // 违规
  360. if (checkQty < lower) return 2; // 漏计
  361. }
  362. return 0; // 合法
  363. };
  364. const valueCheck = {
  365. num(value, checkValue, operation) {
  366. switch (operation) {
  367. case '=':
  368. return !_.isNil(value) ? value === checkValue : false;
  369. case '>':
  370. return !_.isNil(value) ? value > checkValue : false;
  371. case '<':
  372. return !_.isNil(value) ? value < checkValue : false;
  373. case '>=':
  374. return !_.isNil(value) ? value >= checkValue : false;
  375. case '<=':
  376. return !_.isNil(value) ? value <= checkValue : false;
  377. default:
  378. return true;
  379. }
  380. },
  381. date(value, range, operation) {
  382. const curDate = new Date();
  383. switch (operation) {
  384. case '=':
  385. return moment(value).add({ days: range }).isSame(curDate, 'day');
  386. case '>':
  387. return moment(value).add({ days: range }).isBefore(curDate);
  388. case '<':
  389. return moment(value).add({ days: range }).isAfter(curDate);
  390. default:
  391. return true;
  392. }
  393. },
  394. gxby(value, checkValue, operation) {
  395. return valueCheck.num(value, checkValue, operation);
  396. },
  397. dagl(value, checkValue, operation) {
  398. return valueCheck.num(value, checkValue, operation);
  399. },
  400. gxbyDate(checkDate, operation) {
  401. return valueCheck.date(checkDate, operation);
  402. }
  403. };
  404. const checkMultiCondition = function (data, condition) {
  405. let result = true;
  406. for (const c of condition) {
  407. result = c.rela && c.rela === 'or'
  408. ? (result || valueCheck[c.check](data[c.field], c.value, c.operation))
  409. : (result && valueCheck[c.check](data[c.field], c.value, c.operation));
  410. }
  411. return result;
  412. };
  413. const checkMulti3f = function(checkData, statusData, limitOption) {
  414. if (!checkMultiCondition(statusData, limitOption.condition)) return;
  415. if (checkData.is_tp) return check3fTp(checkData, limitOption.limit, limitOption);
  416. return check3fQty(checkData, limitOption.limit, limitOption, checkData.unit);
  417. };
  418. const getErrorInfo = function(bills, lo, checkResult, pos = null) {
  419. if (checkResult <= 0) return;
  420. const errorType = checkResult === 1 ? '超计' : '漏计';
  421. if (!lo.rangeHint) lo.rangeHint = lo.limit ? (lo.lower === lo.upper ? `${lo.lower}%` : `${lo.lower}%~${lo.upper}%`) : '不允许计量';
  422. if (pos) {
  423. error.push({lid: ledgerTree.getNodeKey(bills), pid: pos.id, code: pos.code, b_code: '', name: pos.name, data: pos, memo: `${errorType}:${lo.hint}(${lo.rangeHint})` });
  424. } else {
  425. error.push({lid: ledgerTree.getNodeKey(bills), pid: '', code: bills.code, b_code: bills.b_code, name: bills.name, data: bills, memo: `${errorType}:${lo.hint}(${lo.rangeHint})` });
  426. }
  427. };
  428. const checkLeafBills3fMultiLimit = function(bills, multiLimit) {
  429. if (!multiLimit) return;
  430. const limitOption = option.limits.find(x => { return x.id === multiLimit });
  431. if (!limitOption) return;
  432. const posRange = pos.getLedgerPos(bills.id);
  433. if (posRange && posRange.nodes.length > 0) {
  434. for (const p of posRange) {
  435. for (const lo of limitOption.options) {
  436. const checkResult = checkMulti3f(p, bills, lo);
  437. getErrorInfo(bills, lo, checkResult, p);
  438. }
  439. }
  440. } else {
  441. for (const lo of limitOption) {
  442. const checkResult = checkMulti3f(bills, bills, lo);
  443. getErrorInfo(bills, lo, checkResult);
  444. }
  445. }
  446. };
  447. const recursiveCheckBills3fMultiLimit = function (bills, parentLimit = '') {
  448. const limit = bills.multi_limit || parentLimit;
  449. if (bills.children && bills.children.length > 0) {
  450. for (const c of bills.children) {
  451. recursiveCheckBills3fMultiLimit(c, limit);
  452. }
  453. } else {
  454. checkLeafBills3fMultiLimit(bills, limit);
  455. }
  456. };
  457. for (const x of ledgerTree.children) {
  458. recursiveCheckBills3fMultiLimit(x);
  459. }
  460. return error;
  461. },
  462. };
  463. const ledgerCheck2 = async function (setting) {
  464. const ledger = setting.ledgerTree, ledgerPos = setting.ledgerPos, decimal = setting.decimal;
  465. const checkOption = setting.checkOption;
  466. const assignWarningData = function (nodes, checkType, warningData) {
  467. for (const node of nodes) {
  468. warningData.push({
  469. type: checkType,
  470. ledger_id: node.ledger_id,
  471. code: node.code,
  472. b_code: node.b_code,
  473. name: node.name,
  474. })
  475. }
  476. };
  477. const checkData = {
  478. check_time: new Date(),
  479. warning_data: [],
  480. };
  481. const progressData = [];
  482. for (const prop in ledgerCheckType) {
  483. if (!checkOption[prop] || !checkOption[prop].enable) continue;
  484. const checkInfo = ledgerCheckType[prop];
  485. if (checkInfo.items) {
  486. const errors = ledgerCheckUtil[checkInfo.fun](ledger, ledgerPos, decimal, checkOption[prop]) || {};
  487. for (const i of checkInfo.items) {
  488. if (checkOption[prop].checkType.indexOf(i.type) < 0) continue;
  489. assignWarningData(errors[i.key], i.value, checkData.warning_data);
  490. progressData.push({key: prop + i.key, caption: i.text, error: errors[i.key].length});
  491. }
  492. } else if (checkInfo.url) {
  493. const errors = await postDataAsync(checkInfo.url, {}, false);
  494. if (errors && errors[prop]) {
  495. errors[prop].forEach(mcb => {
  496. checkData.warning_data.push({
  497. type: checkInfo.value, code: mcb.memo, b_code: mcb.b_code, name: mcb.name, lid: mcb.lid
  498. });
  499. });
  500. }
  501. progressData.push({key: prop, caption: checkInfo.text, error: errors && errors[prop] ? errors[prop].length : 0});
  502. } else {
  503. const errors = ledgerCheckUtil[checkInfo.fun](ledger, ledgerPos, decimal, checkOption[prop]) || [];
  504. assignWarningData(errors, checkInfo.value, checkData.warning_data);
  505. progressData.push({key: prop, caption: checkInfo.text, error: errors.length});
  506. }
  507. }
  508. setting.checkList.clearCheckData();
  509. if (checkData.warning_data.length > 0) {
  510. setting.checkList.loadCheckData(checkData);
  511. } else {
  512. setting.checkList.hide();
  513. }
  514. return progressData;
  515. };
  516. const getCheckType = function (option) {
  517. const result = {};
  518. for (const o in option) {
  519. if (option[o].enable) {
  520. if (ledgerCheckType[o].items) {
  521. for (const i of ledgerCheckType[o].items) {
  522. result[o + i.key] = i;
  523. }
  524. } else {
  525. result[o] = ledgerCheckType[o];
  526. }
  527. }
  528. }
  529. return result;
  530. };