rpt_gather_memory.js 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939
  1. 'use strict';
  2. /**
  3. *
  4. *
  5. * @author Mai
  6. * @date
  7. * @version
  8. */
  9. const Ledger = require('../lib/ledger');
  10. const PayCalculator = require('../lib/pay_calc');
  11. const auditConst = require('../const/audit');
  12. const payConst = require('../const/deal_pay');
  13. const moment = require('moment');
  14. const indexPre = 'id_';
  15. const normalPrefix = 't_', sumPrefix = 's_', specPrefix = 'ts_';
  16. const gatherUtils = {
  17. completeGatherData: function (datas, completeDatas) {
  18. for (const data of datas) {
  19. for (const cd of completeDatas) {
  20. data[cd.prefix + 'id'] = cd.id;
  21. data[cd.prefix + 'name'] = cd.name;
  22. }
  23. }
  24. },
  25. gatherStage: function (tender, gatherNode, sourceNode, prefix, helper) {
  26. gatherNode[prefix + 'id'] = tender.id;
  27. gatherNode[prefix + 'name'] = tender.name;
  28. gatherNode[prefix + "qty"] = helper.add(gatherNode[prefix + "qty"], sourceNode.quantity);
  29. gatherNode[prefix + "tp"] = helper.add(gatherNode[prefix + "tp"], sourceNode.total_price);
  30. gatherNode[prefix + "dgn_qty1"] = helper.add(gatherNode[prefix + "dgn_qty1"], sourceNode.dgn_qty1);
  31. gatherNode[prefix + "dgn_qty2"] = helper.add(gatherNode[prefix + "dgn_qty2"], sourceNode.dgn_qty2);
  32. gatherNode[prefix + "contract_qty"] = helper.add(gatherNode[prefix + "contract_qty"], sourceNode.contract_qty);
  33. gatherNode[prefix + "contract_tp"] = helper.add(gatherNode[prefix + "contract_tp"], sourceNode.contract_tp);
  34. gatherNode[prefix + "qc_qty"] = helper.add(gatherNode[prefix + "qc_qty"], sourceNode.qc_qty);
  35. gatherNode[prefix + "qc_tp"] = helper.add(gatherNode[prefix + "qc_tp"], sourceNode.qc_tp);
  36. gatherNode[prefix + "gather_qty"] = helper.add(gatherNode[prefix + "gather_qty"], sourceNode.gather_qty);
  37. gatherNode[prefix + "gather_tp"] = helper.add(gatherNode[prefix + "gather_tp"], sourceNode.gather_tp);
  38. gatherNode[prefix + "pre_contract_qty"] = helper.add(gatherNode[prefix + "pre_contract_qty"], sourceNode.pre_contract_qty);
  39. gatherNode[prefix + "pre_contract_tp"] = helper.add(gatherNode[prefix + "pre_contract_tp"], sourceNode.pre_contract_tp);
  40. gatherNode[prefix + "pre_qc_qty"] = helper.add(gatherNode[prefix + "pre_qc_qty"], sourceNode.pre_qc_qty);
  41. gatherNode[prefix + "pre_qc_tp"] = helper.add(gatherNode[prefix + "pre_qc_tp"], sourceNode.pre_qc_tp);
  42. gatherNode[prefix + "pre_gather_qty"] = helper.add(gatherNode[prefix + "pre_gather_qty"], sourceNode.pre_gather_qty);
  43. gatherNode[prefix + "pre_gather_tp"] = helper.add(gatherNode[prefix + "pre_gather_tp"], sourceNode.pre_gather_tp);
  44. gatherNode[prefix + "end_contract_qty"] = helper.add(gatherNode[prefix + "end_contract_qty"], sourceNode.end_contract_qty);
  45. gatherNode[prefix + "end_contract_tp"] = helper.add(gatherNode[prefix + "end_contract_tp"], sourceNode.end_contract_tp);
  46. gatherNode[prefix + "end_qc_qty"] = helper.add(gatherNode[prefix + "end_qc_qty"], sourceNode.end_qc_qty);
  47. gatherNode[prefix + "end_qc_tp"] = helper.add(gatherNode[prefix + "end_qc_tp"], sourceNode.end_qc_tp);
  48. gatherNode[prefix + "end_gather_qty"] = helper.add(gatherNode[prefix + "end_gather_qty"], sourceNode.end_gather_qty);
  49. gatherNode[prefix + "end_gather_tp"] = helper.add(gatherNode[prefix + "end_gather_tp"], sourceNode.end_gather_tp);
  50. gatherNode[prefix + "deal_dgn_qty1"] = helper.add(gatherNode[prefix + "deal_dgn_qty1"], sourceNode.deal_dgn_qty1);
  51. gatherNode[prefix + "deal_dgn_qty2"] = helper.add(gatherNode[prefix + "deal_dgn_qty2"], sourceNode.deal_dgn_qty2);
  52. gatherNode[prefix + "c_dgn_qty1"] = helper.add(gatherNode[prefix + "c_dgn_qty1"], sourceNode.c_dgn_qty1);
  53. gatherNode[prefix + "c_dgn_qty2"] = helper.add(gatherNode[prefix + "c_dgn_qty2"], sourceNode.c_dgn_qty2);
  54. gatherNode['s_' + "qty"] = helper.add(gatherNode['s_' + "qty"], sourceNode.quantity);
  55. gatherNode['s_' + "tp"] = helper.add(gatherNode['s_' + "tp"], sourceNode.total_price);
  56. gatherNode['s_' + "dgn_qty1"] = helper.add(gatherNode['s_' + "dgn_qty1"], sourceNode.dgn_qty1);
  57. gatherNode['s_' + "dgn_qty2"] = helper.add(gatherNode['s_' + "dgn_qty2"], sourceNode.dgn_qty2);
  58. gatherNode['s_' + "contract_qty"] = helper.add(gatherNode['s_' + "contract_qty"], sourceNode.contract_qty);
  59. gatherNode['s_' + "contract_tp"] = helper.add(gatherNode['s_' + "contract_tp"], sourceNode.contract_tp);
  60. gatherNode['s_' + "qc_qty"] = helper.add(gatherNode['s_' + "qc_qty"], sourceNode.qc_qty);
  61. gatherNode['s_' + "qc_tp"] = helper.add(gatherNode['s_' + "qc_tp"], sourceNode.qc_tp);
  62. gatherNode['s_' + "gather_qty"] = helper.add(gatherNode['s_' + "gather_qty"], sourceNode.gather_qty);
  63. gatherNode['s_' + "gather_tp"] = helper.add(gatherNode['s_' + "gather_tp"], sourceNode.gather_tp);
  64. gatherNode['s_' + "pre_contract_qty"] = helper.add(gatherNode['s_' + "pre_contract_qty"], sourceNode.pre_contract_qty);
  65. gatherNode['s_' + "pre_contract_tp"] = helper.add(gatherNode['s_' + "pre_contract_tp"], sourceNode.pre_contract_tp);
  66. gatherNode['s_' + "pre_qc_qty"] = helper.add(gatherNode['s_' + "pre_qc_qty"], sourceNode.pre_qc_qty);
  67. gatherNode['s_' + "pre_qc_tp"] = helper.add(gatherNode['s_' + "pre_qc_tp"], sourceNode.pre_qc_tp);
  68. gatherNode['s_' + "pre_gather_qty"] = helper.add(gatherNode['s_' + "pre_gather_qty"], sourceNode.pre_gather_qty);
  69. gatherNode['s_' + "pre_gather_tp"] = helper.add(gatherNode['s_' + "pre_gather_tp"], sourceNode.pre_gather_tp);
  70. gatherNode['s_' + "end_contract_qty"] = helper.add(gatherNode['s_' + "end_contract_qty"], sourceNode.end_contract_qty);
  71. gatherNode['s_' + "end_contract_tp"] = helper.add(gatherNode['s_' + "end_contract_tp"], sourceNode.end_contract_tp);
  72. gatherNode['s_' + "end_qc_qty"] = helper.add(gatherNode['s_' + "end_qc_qty"], sourceNode.end_qc_qty);
  73. gatherNode['s_' + "end_qc_tp"] = helper.add(gatherNode['s_' + "end_qc_tp"], sourceNode.end_qc_tp);
  74. gatherNode['s_' + "end_gather_qty"] = helper.add(gatherNode['s_' + "end_gather_qty"], sourceNode.end_gather_qty);
  75. gatherNode['s_' + "end_gather_tp"] = helper.add(gatherNode['s_' + "end_gather_tp"], sourceNode.end_gather_tp);
  76. gatherNode['s_' + "deal_dgn_qty1"] = helper.add(gatherNode['s_' + "deal_dgn_qty1"], sourceNode.deal_dgn_qty1);
  77. gatherNode['s_' + "deal_dgn_qty2"] = helper.add(gatherNode['s_' + "deal_dgn_qty2"], sourceNode.deal_dgn_qty2);
  78. gatherNode['s_' + "c_dgn_qty1"] = helper.add(gatherNode['s_' + "c_dgn_qty1"], sourceNode.c_dgn_qty1);
  79. gatherNode['s_' + "c_dgn_qty2"] = helper.add(gatherNode['s_' + "c_dgn_qty2"], sourceNode.c_dgn_qty2);
  80. },
  81. gatherZone: function (tender, gatherNode, sourceNode, prefix, helper) {
  82. gatherNode[prefix + 'id'] = tender.id;
  83. gatherNode[prefix + 'name'] = tender.name;
  84. gatherNode[prefix + "qty"] = helper.add(gatherNode[prefix + "qty"], sourceNode.quantity);
  85. gatherNode[prefix + "tp"] = helper.add(gatherNode[prefix + "tp"], sourceNode.total_price);
  86. gatherNode[prefix + "dgn_qty1"] = helper.add(gatherNode[prefix + "dgn_qty1"], sourceNode.dgn_qty1);
  87. gatherNode[prefix + "dgn_qty2"] = helper.add(gatherNode[prefix + "dgn_qty2"], sourceNode.dgn_qty2);
  88. gatherNode[prefix + "contract_qty"] = helper.add(gatherNode[prefix + "contract_qty"], sourceNode.contract_qty);
  89. gatherNode[prefix + "contract_tp"] = helper.add(gatherNode[prefix + "contract_tp"], sourceNode.contract_tp);
  90. gatherNode[prefix + "qc_qty"] = helper.add(gatherNode[prefix + "qc_qty"], sourceNode.qc_qty);
  91. gatherNode[prefix + "qc_tp"] = helper.add(gatherNode[prefix + "qc_tp"], sourceNode.qc_tp);
  92. gatherNode[prefix + "gather_qty"] = helper.add(gatherNode[prefix + "gather_qty"], sourceNode.gather_qty);
  93. gatherNode[prefix + "gather_tp"] = helper.add(gatherNode[prefix + "gather_tp"], sourceNode.gather_tp);
  94. gatherNode[prefix + "deal_dgn_qty1"] = helper.add(gatherNode[prefix + "deal_dgn_qty1"], sourceNode.deal_dgn_qty1);
  95. gatherNode[prefix + "deal_dgn_qty2"] = helper.add(gatherNode[prefix + "deal_dgn_qty2"], sourceNode.deal_dgn_qty2);
  96. gatherNode[prefix + "c_dgn_qty1"] = helper.add(gatherNode[prefix + "c_dgn_qty1"], sourceNode.c_dgn_qty1);
  97. gatherNode[prefix + "c_dgn_qty2"] = helper.add(gatherNode[prefix + "c_dgn_qty2"], sourceNode.c_dgn_qty2);
  98. gatherNode['s_' + "qty"] = helper.add(gatherNode['s_' + "qty"], sourceNode.quantity);
  99. gatherNode['s_' + "tp"] = helper.add(gatherNode['s_' + "tp"], sourceNode.total_price);
  100. gatherNode['s_' + "contract_qty"] = helper.add(gatherNode['s_' + "contract_qty"], sourceNode.contract_qty);
  101. gatherNode['s_' + "contract_tp"] = helper.add(gatherNode['s_' + "contract_tp"], sourceNode.contract_tp);
  102. gatherNode['s_' + "qc_qty"] = helper.add(gatherNode['s_' + "qc_qty"], sourceNode.qc_qty);
  103. gatherNode['s_' + "qc_tp"] = helper.add(gatherNode['s_' + "qc_tp"], sourceNode.qc_tp);
  104. gatherNode['s_' + "gather_qty"] = helper.add(gatherNode['s_' + "gather_qty"], sourceNode.gather_qty);
  105. gatherNode['s_' + "gather_tp"] = helper.add(gatherNode['s_' + "gather_tp"], sourceNode.gather_tp);
  106. },
  107. gatherLedger: function (tender, gatherNode, sourceNode, prefix, helper) {
  108. gatherNode[prefix + 'id'] = tender.id;
  109. gatherNode[prefix + 'name'] = tender.name;
  110. gatherNode[prefix + "qty"] = helper.add(gatherNode[prefix + "qty"], sourceNode.quantity);
  111. gatherNode[prefix + "tp"] = helper.add(gatherNode[prefix + "tp"], sourceNode.total_price);
  112. gatherNode[prefix + "dgn_qty1"] = helper.add(gatherNode[prefix + "dgn_qty1"], sourceNode.dgn_qty1);
  113. gatherNode[prefix + "dgn_qty2"] = helper.add(gatherNode[prefix + "dgn_qty2"], sourceNode.dgn_qty2);
  114. gatherNode['s_' + "qty"] = helper.add(gatherNode['s_' + "qty"], sourceNode.quantity);
  115. gatherNode['s_' + "tp"] = helper.add(gatherNode['s_' + "tp"], sourceNode.total_price);
  116. },
  117. gatherSpecial: function (gatherNode, sourceNode, prefix, helper) {
  118. gatherNode[prefix + "qty"] = helper.add(gatherNode[prefix + "qty"], sourceNode.quantity);
  119. gatherNode[prefix + "tp"] = helper.add(gatherNode[prefix + "tp"], sourceNode.total_price);
  120. gatherNode[prefix + "dgn_qty1"] = helper.add(gatherNode[prefix + "dgn_qty1"], sourceNode.dgn_qty1);
  121. gatherNode[prefix + "dgn_qty2"] = helper.add(gatherNode[prefix + "dgn_qty2"], sourceNode.dgn_qty2);
  122. },
  123. };
  124. module.exports = app => {
  125. class RptGatherMemory extends app.BaseService {
  126. /**
  127. * 构造函数
  128. *
  129. * @param {Object} ctx - egg全局context
  130. * @return {void}
  131. */
  132. constructor(ctx) {
  133. super(ctx);
  134. this.resultTree = new Ledger.gatherTree(ctx, {
  135. id: 'id',
  136. pid: 'pid',
  137. order: 'order',
  138. level: 'level',
  139. rootId: -1
  140. });
  141. this.resultTenderInfo = [];
  142. this.resultDealPay = [];
  143. this.resultDealBills = [];
  144. }
  145. async _getValidStages(tenderId) {
  146. const stages = await this.db.select(this.ctx.service.stage.tableName, {
  147. where: { tid: tenderId },
  148. orders: [['order', 'desc']],
  149. });
  150. if (stages.length !== 0) {
  151. const lastStage = stages[0];
  152. if (lastStage.status === auditConst.stage.status.uncheck && lastStage.user_id !== this.ctx.session.sessionUser.accountId) {
  153. stages.splice(0, 1);
  154. }
  155. }
  156. return stages;
  157. }
  158. async _getCheckedStages(tenderId) {
  159. const stages = await this.db.select(this.ctx.service.stage.tableName, {
  160. where: { tid: tenderId },
  161. orders: [['order', 'desc']],
  162. });
  163. if (stages.length !== 0) {
  164. const lastStage = stages[0];
  165. if (lastStage.status !== auditConst.stage.status.checked) {
  166. stages.splice(0, 1);
  167. }
  168. }
  169. return stages;
  170. }
  171. _checkSpecialTender(tender, special) {
  172. if (special) {
  173. for (const spec of special) {
  174. if (tender[spec.key] === true) return spec.key;
  175. }
  176. }
  177. return '';
  178. }
  179. async _getTimeZoneStages(tender, zone) {
  180. const times = zone.split(' - ');
  181. if (times.length !== 2) throw '选择的汇总周期无效';
  182. const beginTime = moment(times[0], 'YYYY-MM');
  183. const endTime = moment(times[1], 'YYYY-MM');
  184. const stages = await this._getValidStages(tender.id), validStages = [];
  185. for (const stage of stages) {
  186. const sTime = moment(stage.s_time, 'YYYY-MM');
  187. if (sTime.isBetween(beginTime, endTime, null, '[]')) {
  188. validStages.push(stage);
  189. }
  190. }
  191. return validStages;
  192. }
  193. async _getOrderZoneStages (tender, zone) {
  194. let [iBegin, iEnd] = zone.split(':');
  195. iBegin = this.ctx.helper._.toInteger(iBegin) || 0;
  196. iEnd = this.ctx.helper._.toInteger(iEnd) || 0;
  197. const stages = await this._getValidStages(tender.id), validStages = [];
  198. for (const stage of stages) {
  199. if (stage.order < iBegin || stage.order > iEnd) continue;
  200. validStages.push(stage);
  201. }
  202. return validStages;
  203. }
  204. /**
  205. * 台账数据
  206. */
  207. async _gatherStageData(completeData, tender, stage, hasPre) {
  208. const helper = this.ctx.helper;
  209. completeData.id = tender.id;
  210. completeData.name = tender.name;
  211. const billsTree = new Ledger.billsTree(this.ctx, {
  212. id: 'ledger_id',
  213. pid: 'ledger_pid',
  214. order: 'order',
  215. level: 'level',
  216. rootId: -1,
  217. keys: ['id', 'tender_id', 'ledger_id'],
  218. stageId: 'id',
  219. calcFields: ['deal_tp', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp', 'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp'],
  220. calc: function (node) {
  221. if (node.children && node.children.length === 0) {
  222. node.pre_gather_qty = helper.add(node.pre_contract_qty, node.pre_qc_qty);
  223. node.gather_qty = helper.add(node.contract_qty, node.qc_qty);
  224. node.end_contract_qty = helper.add(node.pre_contract_qty, node.contract_qty);
  225. node.end_qc_qty = helper.add(node.pre_qc_qty, node.qc_qty);
  226. node.end_gather_qty = helper.add(node.pre_gather_qty, node.gather_qty);
  227. }
  228. node.pre_gather_tp = helper.add(node.pre_contract_tp, node.pre_qc_tp);
  229. node.gather_tp = helper.add(node.contract_tp, node.qc_tp);
  230. node.end_contract_tp = helper.add(node.pre_contract_tp, node.contract_tp);
  231. node.end_qc_tp = helper.add(node.pre_qc_tp, node.qc_tp);
  232. node.end_gather_tp = helper.add(node.pre_gather_tp, node.gather_tp);
  233. }
  234. });
  235. const billsData = await this.ctx.service.ledger.getData(tender.id);
  236. const dgnData = await this.ctx.service.stageBillsDgn.getDgnData(tender.id);
  237. for (const d of dgnData) {
  238. const l = this.ctx.helper._.find(billsData, {id: d.id});
  239. this.ctx.helper._.assignIn(l, d);
  240. }
  241. if (stage) {
  242. await this.ctx.service.stage.doCheckStage(stage);
  243. if (stage.readOnly) {
  244. const curStage = await this.ctx.service.stageBills.getAuditorStageData(tender.id,
  245. stage.id, stage.curTimes, stage.curOrder);
  246. this.ctx.helper.assignRelaData(billsData, [
  247. {
  248. data: curStage,
  249. fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp'],
  250. prefix: '',
  251. relaId: 'lid'
  252. }
  253. ]);
  254. } else {
  255. const curStage = await this.ctx.service.stageBills.getLastestStageData(tender.id, stage.id);
  256. this.ctx.helper.assignRelaData(billsData, [
  257. {
  258. data: curStage,
  259. fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp'],
  260. prefix: '',
  261. relaId: 'lid'
  262. }
  263. ]);
  264. }
  265. if (hasPre) {
  266. const preStage = stage.order > 1 ? await this.ctx.service.stageBillsFinal.getFinalData(tender, stage.order - 1) : [];
  267. this.ctx.helper.assignRelaData(billsData, [
  268. {
  269. data: preStage,
  270. fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp'],
  271. prefix: 'pre_',
  272. relaId: 'lid'
  273. }
  274. ]);
  275. }
  276. }
  277. billsTree.loadDatas(billsData);
  278. billsTree.calculateAll();
  279. this.resultTree.loadGatherTree(billsTree, function (gatherNode, sourceNode) {
  280. gatherUtils.gatherStage(tender, gatherNode, sourceNode, completeData.prefix, helper);
  281. });
  282. }
  283. async _gatherStagesData(completeData, tender, stages) {
  284. const helper = this.ctx.helper;
  285. completeData.id = tender.id;
  286. completeData.name = tender.name;
  287. /**
  288. * 汇总并合并 相关数据
  289. * @param {Array} index - 主数据
  290. * @param {Array[]}rela - 相关数据 {data, fields, prefix, relaId}
  291. */
  292. const sumAssignRelaData = function (index, rela) {
  293. const loadFields = function (datas, fields, prefix, relaId) {
  294. for (const d of datas) {
  295. const key = indexPre + d[relaId];
  296. const m = index[key];
  297. if (m) {
  298. for (const f of fields) {
  299. if (d[f] !== undefined) {
  300. m[prefix + f] = helper.add(m[prefix + f], d[f]);
  301. }
  302. }
  303. }
  304. }
  305. };
  306. for (const r of rela) {
  307. loadFields(r.data, r.fields, r.prefix, r.relaId);
  308. }
  309. };
  310. const billsTree = new Ledger.billsTree(this.ctx, {
  311. id: 'ledger_id',
  312. pid: 'ledger_pid',
  313. order: 'order',
  314. level: 'level',
  315. rootId: -1,
  316. keys: ['id', 'tender_id', 'ledger_id'],
  317. stageId: 'id',
  318. calcFields: ['deal_tp', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp'],
  319. calc: function (node) {
  320. if (node.children && node.children.length === 0) {
  321. node.gather_qty = helper.add(node.contract_qty, node.qc_qty);
  322. }
  323. node.gather_tp = helper.add(node.contract_tp, node.qc_tp);
  324. }
  325. });
  326. const billsData = await this.ctx.service.ledger.getData(tender.id);
  327. const dgnData = await this.ctx.service.stageBillsDgn.getDgnData(tender.id);
  328. for (const d of dgnData) {
  329. const l = this.ctx.helper._.find(billsData, {id: d.id});
  330. this.ctx.helper._.assignIn(l, d);
  331. }
  332. let billsIndexData = {};
  333. for (const bd of billsData) {
  334. billsIndexData[indexPre + bd.id] = bd;
  335. }
  336. for (const stage of stages) {
  337. await this.ctx.service.stage.doCheckStage(stage);
  338. if (stage.readOnly) {
  339. const curStage = await this.ctx.service.stageBills.getAuditorStageData(tender.id,
  340. stage.id, stage.curTimes, stage.curOrder);
  341. sumAssignRelaData(billsIndexData, [{
  342. data: curStage,
  343. fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp'],
  344. prefix: '',
  345. relaId: 'lid'
  346. }]);
  347. } else {
  348. const curStage = await this.ctx.service.stageBills.getLastestStageData(tender.id, stage.id);
  349. sumAssignRelaData(billsIndexData, [{
  350. data: curStage,
  351. fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp'],
  352. prefix: '',
  353. relaId: 'lid'
  354. }]);
  355. }
  356. }
  357. billsTree.loadDatas(billsData);
  358. billsTree.calculateAll();
  359. this.resultTree.loadGatherTree(billsTree, function (gatherNode, sourceNode) {
  360. gatherUtils.gatherZone(tender, gatherNode, sourceNode, completeData.prefix, helper);
  361. });
  362. }
  363. async _gatherMonthData(tender, completeData, month, hasPre) {
  364. const stages = await this._getValidStages(tender.id);
  365. const stage = this.ctx.helper._.find(stages, {s_time: month});
  366. await this._gatherStageData(completeData, tender, stage, hasPre);
  367. }
  368. async _gatherIndexData(tender, completeData, index, hasPre) {
  369. const stages = await this._getValidStages(tender.id);
  370. const stage = this.ctx.helper._.find(stages, {order: index});
  371. await this._gatherStageData(completeData, tender, stage, hasPre);
  372. }
  373. async _gatherZoneData(tender, completeData, zone) {
  374. const stages = await this._getTimeZoneStages(tender, zone);
  375. await this._gatherStagesData(completeData, tender, stages);
  376. }
  377. async _gatherIndexZoneData(tender, completeData, stageZone) {
  378. const stages = await this._getOrderZoneStages(tender, stageZone);
  379. await this._gatherStagesData(completeData, tender, stages);
  380. }
  381. async _gatherFinalData(tender, completeData, hasPre) {
  382. const stages = await this._getValidStages(tender.id);
  383. await this._gatherStageData(completeData, tender, stages[0], hasPre);
  384. }
  385. async _gatherCheckedFinalData(tender, completeData, hasPre) {
  386. const stages = await this._getCheckedStages(tender.id);
  387. await this._gatherStageData(completeData, tender, stages[0], hasPre);
  388. }
  389. async _gatherLedgerData(tender, completeData) {
  390. const helper = this.ctx.helper;
  391. const billsTree = new Ledger.billsTree(this.ctx, {
  392. id: 'ledger_id',
  393. pid: 'ledger_pid',
  394. order: 'order',
  395. level: 'level',
  396. rootId: -1,
  397. keys: ['id', 'tender_id', 'ledger_id'],
  398. stageId: 'id',
  399. calcFields: ['deal_tp', 'total_price'],
  400. });
  401. const billsData = await this.ctx.service.ledger.getData(tender.id);
  402. billsTree.loadDatas(billsData);
  403. billsTree.calculateAll();
  404. this.resultTree.loadGatherTree(billsTree, function (gatherNode, sourceNode) {
  405. gatherUtils.gatherLedger(tender, gatherNode, sourceNode, completeData.prefix, helper);
  406. });
  407. }
  408. async _gatherSpecialData(tender, sKey) {
  409. const helper = this.ctx.helper;
  410. const billsTree = new Ledger.billsTree(this.ctx, {
  411. id: 'ledger_id',
  412. pid: 'ledger_pid',
  413. order: 'order',
  414. level: 'level',
  415. rootId: -1,
  416. keys: ['id', 'tender_id', 'ledger_id'],
  417. stageId: 'id',
  418. calcFields: ['deal_tp', 'total_price'],
  419. });
  420. const billsData = await this.ctx.service.ledger.getData(tender.id);
  421. billsTree.loadDatas(billsData);
  422. billsTree.calculateAll();
  423. this.resultTree.loadGatherTree(billsTree, function (gatherNode, sourceNode) {
  424. gatherUtils.gatherSpecial(gatherNode, sourceNode, 'ts_' + sKey + '_', helper);
  425. });
  426. }
  427. async getGatherStageBills(memFieldKeys, gsDefine, gsCustom) {
  428. if (!gsDefine || !gsDefine.enable) return [];
  429. if (!gsCustom || !gsCustom.tenders || gsCustom.tenders.length === 0) return [];
  430. const gsSetting = JSON.parse(gsDefine.setting);
  431. let commonIndex = 0;
  432. const completeDatas = [];
  433. for (const t of gsCustom.tenders) {
  434. const specialKey = this._checkSpecialTender(t, gsSetting.special);
  435. const tender = await this.ctx.service.tender.getCheckTender(t.tid);
  436. if (specialKey === '') {
  437. const completeData = {
  438. prefix: 't_' + commonIndex + '_',
  439. };
  440. completeDatas.push(completeData);
  441. switch (gsSetting.type) {
  442. case 'month':
  443. await this._gatherMonthData(tender, completeData, gsCustom.month, gsSetting.hasPre);
  444. break;
  445. case 'zone':
  446. await this._gatherZoneData(tender, completeData, gsCustom.zone);
  447. break;
  448. case 'final':
  449. await this._gatherFinalData(tender, completeData, gsSetting.hasPre);
  450. break;
  451. case 'checked-final':
  452. await this._gatherCheckedFinalData(tender, completeData, gsSetting.hasPre);
  453. break;
  454. case 'ledger':
  455. await this._gatherLedgerData(tender, completeData);
  456. break;
  457. case 'stage':
  458. await this._gatherIndexData(tender, completeData, gsCustom.stage, gsSetting.hasPre);
  459. break;
  460. case 'stage-zone':
  461. await this._gatherIndexZoneData(tender, completeData, gsCustom.stage_zone);
  462. break;
  463. }
  464. commonIndex++;
  465. } else {
  466. await this._gatherSpecialData(tender, specialKey);
  467. }
  468. }
  469. this.resultTree.generateSortNodes();
  470. gatherUtils.completeGatherData(this.resultTree.nodes, completeDatas);
  471. return this.resultTree.getDefaultDatas();
  472. }
  473. /**
  474. * 标段信息
  475. */
  476. async _getBaseTenderInfo(tender) {
  477. const info = {
  478. id: tender.id,
  479. name: tender.name,
  480. deal_tp: tender.deal_tp,
  481. tp: tender.total_price
  482. };
  483. const deal_bills_sum = await this.ctx.service.dealBills.getSum(tender.id);
  484. info.deal_bills_tp = deal_bills_sum ? deal_bills_sum.total_price : 0;
  485. if (tender.ledger_status === auditConst.ledger.status.uncheck || tender.ledger_status === auditConst.ledger.status.checkNo) {
  486. const sum = await this.ctx.service.ledger.addUp({tender_id: tender.id/*, is_leaf: true*/});
  487. info.tp = sum.total_price;
  488. info.deal_tp = sum.deal_tp;
  489. }
  490. info.deal_info = tender.info.deal_info;
  491. info.construction_unit = tender.info.construction_unit;
  492. info.tech_param = tender.info.tech_param;
  493. info.deal_param = tender.info.deal_param;
  494. info.pay_account = tender.info.pay_account;
  495. info.deal_param.contractPriceWithoutZL = this.ctx.helper.sub(info.deal_param.contractPrice,
  496. info.deal_param.zanLiePrice);
  497. info.bid_info = tender.info.bid_info;
  498. return info;
  499. }
  500. async _getStageTenderInfo(stage, info) {
  501. if (stage) {
  502. const helper = this.ctx.helper;
  503. await this.ctx.service.stage.doCheckStage(stage);
  504. await this.ctx.service.stage.checkStageGatherData(stage);
  505. info.pre_contract_tp = stage.pre_contract_tp;
  506. info.pre_qc_tp = stage.pre_qc_tp;
  507. info.pre_gather_tp = helper.add(info.pre_contract_tp, info.pre_qc_tp);
  508. info.contract_tp = stage.contract_tp;
  509. info.qc_tp = stage.qc_tp;
  510. info.gather_tp = helper.add(info.contract_tp, info.qc_tp);
  511. info.end_contract_tp = helper.add(info.pre_contract_tp, info.contract_tp);
  512. info.end_qc_tp = helper.add(info.pre_qc_tp, info.qc_tp);
  513. info.end_gather_tp = helper.add(info.pre_gather_tp, info.gather_tp);
  514. info.yf_tp = stage.yf_tp;
  515. info.pre_yf_tp = stage.pre_yf_tp;
  516. info.end_yf_tp = helper.add(stage.yf_tp, stage.pre_yf_tp);
  517. }
  518. }
  519. async _getStagesTenderInfo(stages, info) {
  520. const helper = this.ctx.helper;
  521. for (const stage of stages) {
  522. await this.ctx.service.stage.doCheckStage(stage);
  523. await this.ctx.service.stage.checkStageGatherData(stage);
  524. info.contract_tp = helper.add(info.contract_tp, stage.contract_tp);
  525. info.qc_tp = helper.add(info.qc_tp, stage.qc_tp);
  526. info.yf_tp = helper.add(info.yf_tp, stage.yf_tp);
  527. }
  528. info.gather_tp = helper.add(info.contract_tp, info.qc_tp);
  529. }
  530. async _gatherMonthTenderInfo(tender, index, month, hasPre) {
  531. const info = await this._getBaseTenderInfo(tender);
  532. const stages = await this._getValidStages(tender.id);
  533. const stage = this.ctx.helper._.find(stages, {s_time: month});
  534. await this._getStageTenderInfo(stage, info);
  535. this.resultTenderInfo.push(info);
  536. }
  537. async _gatherOrderTenderInfo(tender, index, order, hasPre) {
  538. const info = await this._getBaseTenderInfo(tender);
  539. const stages = await this._getValidStages(tender.id);
  540. const stage = this.ctx.helper._.find(stages, {order: order});
  541. await this._getStageTenderInfo(stage, info);
  542. this.resultTenderInfo.push(info);
  543. }
  544. async _gatherZoneTenderInfo(tender, index, zone) {
  545. const info = await this._getBaseTenderInfo(tender);
  546. const stages = await this._getTimeZoneStages(tender, zone);
  547. await this._getStagesTenderInfo(stages, info);
  548. this.resultTenderInfo.push(info);
  549. }
  550. async _gatherOrderZoneTenderInfo(tender, index, stageZone) {
  551. const info = await this._getBaseTenderInfo(tender);
  552. const stages = await this._getOrderZoneStages(tender, stageZone);
  553. await this._getStagesTenderInfo(stages, info);
  554. this.resultTenderInfo.push(info);
  555. }
  556. async _gatherFinalTenderInfo(tender, index, hasPre) {
  557. const info = await this._getBaseTenderInfo(tender);
  558. const stages = await this._getValidStages(tender.id);
  559. await this._getStageTenderInfo(stages[0], info);
  560. this.resultTenderInfo.push(info);
  561. }
  562. async _gatherCheckedFinalTenderInfo(tender, index, hasPre) {
  563. const info = await this._getBaseTenderInfo(tender);
  564. const stages = await this._getCheckedStages(tender.id);
  565. await this._getStageTenderInfo(stages[0], info);
  566. this.resultTenderInfo.push(info);
  567. }
  568. async _gatherLedgerTenderInfo(tender, index) {
  569. const info = await this._getBaseTenderInfo(tender);
  570. this.resultTenderInfo.push(info);
  571. }
  572. async _gatherSpecialTenderInfo(tender, sKey) {
  573. const info = await this._getBaseTenderInfo(tender);
  574. info.spec = sKey;
  575. this.resultTenderInfo.push(info);
  576. }
  577. async getGatherTenderInfo(memFieldKeys, gsDefine, gsCustom) {
  578. if (!gsDefine || !gsDefine.enable) return [];
  579. if (!gsCustom || !gsCustom.tenders || gsCustom.tenders.length === 0) return [];
  580. this.resultTenderInfo = [];
  581. const gsSetting = JSON.parse(gsDefine.setting);
  582. let commonIndex = 0;
  583. for (const t of gsCustom.tenders) {
  584. const specialKey = this._checkSpecialTender(t, gsSetting.special);
  585. const tender = await this.ctx.service.tender.getCheckTender(t.tid);
  586. if (specialKey === '') {
  587. switch (gsSetting.type) {
  588. case 'month':
  589. await this._gatherMonthTenderInfo(tender, commonIndex, gsCustom.month, gsSetting.hasPre);
  590. break;
  591. case 'zone':
  592. await this._gatherZoneTenderInfo(tender, commonIndex, gsCustom.zone);
  593. break;
  594. case 'final':
  595. await this._gatherFinalTenderInfo(tender, commonIndex, gsSetting.hasPre);
  596. break;
  597. case 'checked-final':
  598. await this._gatherCheckedFinalTenderInfo(tender, commonIndex, gsSetting.hasPre);
  599. break;
  600. case 'ledger':
  601. await this._gatherLedgerTenderInfo(tender, commonIndex);
  602. break;
  603. case 'stage':
  604. await this._gatherOrderTenderInfo(tender, commonIndex, gsCustom.stage, gsSetting.hasPre);
  605. break;
  606. case 'stage-zone':
  607. await this._gatherOrderZoneTenderInfo(tender, commonIndex, gsCustom.stage_zone);
  608. break;
  609. }
  610. commonIndex++;
  611. } else {
  612. await this._gatherSpecialTenderInfo(tender, specialKey);
  613. }
  614. }
  615. return this.resultTenderInfo;
  616. }
  617. /**
  618. * 合同支付
  619. */
  620. _gatherPayRecord(dealPay, fun) {
  621. let rdp;
  622. if (dealPay.ptype !== payConst.payType.normal) {
  623. rdp = this.ctx.helper._.find(this.resultDealPay, {ptype: dealPay.ptype});
  624. } else {
  625. rdp = this.ctx.helper._.find(this.resultDealPay, {
  626. name: dealPay.name,
  627. minus: dealPay.minus ? true : false,
  628. is_yf: dealPay.is_yf ? true : false,
  629. });
  630. }
  631. if (!rdp) {
  632. rdp = {
  633. ptype: dealPay.ptype,
  634. name: dealPay.name,
  635. minus: dealPay.minus ? true : false,
  636. is_yf: dealPay.is_yf ? true : false,
  637. };
  638. this.resultDealPay.push(rdp);
  639. }
  640. if (fun) fun(rdp, dealPay);
  641. }
  642. async _checkStagePayCalc(tender, stage, dealPay) {
  643. if (!stage.readOnly) {
  644. // 计算 本期金额
  645. const payCalculator = new PayCalculator(this.ctx, stage, tender.info);
  646. await payCalculator.calculateAll(dealPay);
  647. }
  648. }
  649. async _gatherStagePay(completeData, tender, stage, hasPre) {
  650. if (stage) {
  651. completeData.id = tender.id;
  652. completeData.name = tender.name;
  653. const helper = this.ctx.helper;
  654. await this.ctx.service.stage.doCheckStage(stage);
  655. const dealPay = await this.ctx.service.stagePay.getStagePays(stage);
  656. await this._checkStagePayCalc(tender, stage, dealPay);
  657. for (const dp of dealPay) {
  658. dp.end_tp = helper.add(dp.pre_tp, dp.tp);
  659. this._gatherPayRecord(dp, function (gatherData, sourceData) {
  660. gatherData[completeData.prefix + 'id'] = tender.id;
  661. gatherData[completeData.prefix + 'name'] = tender.name;
  662. gatherData[completeData.prefix + 'tp'] = helper.add(gatherData[completeData.prefix + 'tp'], sourceData.tp);
  663. gatherData[completeData.prefix + 'pre_tp'] = helper.add(gatherData[completeData.prefix + 'pre_tp'], sourceData.pre_tp);
  664. gatherData[completeData.prefix + 'end_tp'] = helper.add(gatherData[completeData.prefix + 'end_tp'], sourceData.end_tp);
  665. gatherData['s_' + 'tp'] = helper.add(gatherData['s_' + 'tp'], sourceData.tp);
  666. gatherData['s_' + 'pre_tp'] = helper.add(gatherData['s_' + 'pre_tp'], sourceData.pre_tp);
  667. gatherData['s_' + 'end_tp'] = helper.add(gatherData['s_' + 'end_tp'], sourceData.end_tp);
  668. });
  669. }
  670. }
  671. }
  672. async _gatherStagesPay(completeData, tender, stages) {
  673. const helper = this.ctx.helper;
  674. completeData.id = tender.id;
  675. completeData.name = tender.name;
  676. for (const stage of stages) {
  677. await this.ctx.service.stage.doCheckStage(stage);
  678. const dealPay = await this.ctx.service.stagePay.getStagePays(stage);
  679. await this._checkStagePayCalc(tender, stage, dealPay);
  680. for (const dp of dealPay) {
  681. dp.end_tp = helper.add(dp.pre_tp, dp.tp);
  682. this._gatherPayRecord(dp, function (gatherData, sourceData) {
  683. gatherData[completeData.prefix + 'id'] = tender.id;
  684. gatherData[completeData.prefix + 'name'] = tender.name;
  685. gatherData[completeData.prefix + 'tp'] = helper.add(gatherData[completeData.prefix + 'tp'], sourceData.tp);
  686. gatherData['s_' + 'tp'] = helper.add(gatherData['s_' + 'tp'], sourceData.tp);
  687. });
  688. }
  689. }
  690. }
  691. async _gatherMonthStagePay(sTender, completeData, month, hasPre) {
  692. const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
  693. const stages = await this._getValidStages(tender.id);
  694. const stage = this.ctx.helper._.find(stages, {s_time: month});
  695. await this._gatherStagePay(completeData, tender, stage, hasPre);
  696. }
  697. async _gatherOrderStagePay(sTender, completeData, order, hasPre) {
  698. const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
  699. const stages = await this._getValidStages(tender.id);
  700. const stage = this.ctx.helper._.find(stages, {order: order});
  701. await this._gatherStagePay(completeData, tender, stage, hasPre);
  702. }
  703. async _gatherZoneStagePay(sTender, completeData, zone) {
  704. const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
  705. const stages = await this._getTimeZoneStages(tender, zone);
  706. await this._gatherStagesPay(completeData, tender, stages);
  707. }
  708. async _gatherOrderZoneStagePay(sTender, completeData, stageZone) {
  709. const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
  710. const stages = await this._getOrderZoneStages(tender, stageZone)
  711. await this._gatherStagesPay(completeData, tender, stages);
  712. }
  713. async _gatherFinalStagePay(sTender, completeData, hasPre) {
  714. const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
  715. const stages = await this._getValidStages(tender.id);
  716. await this._gatherStagePay(completeData, tender, stages[0], hasPre);
  717. }
  718. async _gatherCheckedFinalStagePay(sTender, completeData, hasPre) {
  719. const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
  720. const stages = await this._getCheckedStages(tender.id);
  721. await this._gatherStagePay(completeData, tender, stages[0], hasPre);
  722. }
  723. async getGatherStagePay(memFieldKeys, gsDefine, gsCustom) {
  724. if (!gsDefine || !gsDefine.enable) return [];
  725. if (!gsCustom || !gsCustom.tenders || gsCustom.tenders.length === 0) return [];
  726. this.resultTenderInfo = [];
  727. const gsSetting = JSON.parse(gsDefine.setting);
  728. let commonIndex = 0;
  729. const completeDatas = [];
  730. for (const tender of gsCustom.tenders) {
  731. const specialKey = this._checkSpecialTender(tender, gsSetting.special);
  732. if (specialKey === '') {
  733. const completeData = {
  734. prefix: 't_' + commonIndex + '_',
  735. };
  736. completeDatas.push(completeData);
  737. switch (gsSetting.type) {
  738. case 'month':
  739. await this._gatherMonthStagePay(tender, completeData, gsCustom.month, gsSetting.hasPre);
  740. break;
  741. case 'zone':
  742. await this._gatherZoneStagePay(tender, completeData, gsCustom.zone);
  743. break;
  744. case 'final':
  745. await this._gatherFinalStagePay(tender, completeData, gsSetting.hasPre);
  746. break;
  747. case 'checked-final':
  748. await this._gatherCheckedFinalStagePay(tender, completeData, gsSetting.hasPre);
  749. break;
  750. case 'stage':
  751. await this._gatherOrderStagePay(tender, completeData, gsCustom.stage, gsSetting.hasPre);
  752. break;
  753. case 'stage-zone':
  754. await this._gatherOrderZoneStagePay(tender, completeData, gsCustom.stage_zone);
  755. break;
  756. }
  757. commonIndex++;
  758. }
  759. // 合同支付,只有在每一期中有数据,故特殊标段直接不汇总合同支付
  760. }
  761. gatherUtils.completeGatherData(this.resultDealPay, completeDatas);
  762. return this.resultDealPay;
  763. }
  764. /**
  765. * 签约清单
  766. */
  767. async _gatherDealBills(tender, fun) {
  768. const dealBills = await this.ctx.service.dealBills.getAllDataByCondition({
  769. where: { tender_id: tender.id }
  770. });
  771. for (const db of dealBills) {
  772. let rdb = this.ctx.helper._.find(this.resultDealBills, {
  773. code: db.code,
  774. name: db.name,
  775. unit: db.unit,
  776. unit_price: db.unit_price ? db.unit_price: 0,
  777. });
  778. if (!rdb) {
  779. rdb = {
  780. code: db.code,
  781. name: db.name,
  782. unit: db.unit,
  783. unit_price: db.unit_price ? db.unit_price: 0,
  784. };
  785. this.resultDealBills.push(rdb);
  786. }
  787. if (fun) fun(rdb, db);
  788. }
  789. }
  790. async _gatherCommonDealBills(sTender, completeData) {
  791. const self = this;
  792. const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
  793. completeData.id = tender.id;
  794. completeData.name = tender.name;
  795. await this._gatherDealBills(tender, function (gatherData, sourceData) {
  796. gatherData[completeData.prefix + 'id'] = tender.id;
  797. gatherData[completeData.prefix + 'name'] = tender.name;
  798. gatherData[completeData.prefix + 'qty'] = sourceData.quantity;
  799. gatherData[completeData.prefix + 'tp'] = sourceData.total_price;
  800. gatherData['s_' + 'qty'] = self.ctx.helper.add(gatherData['s_' + 'qty'], sourceData.quantity);
  801. gatherData['s_' + 'tp'] = self.ctx.helper.add(gatherData['s_' + 'tp'], sourceData.total_price);
  802. });
  803. }
  804. async _gatherSpecialDealBills(sTender, sKey) {
  805. const tender = await this.ctx.service.tender.getCheckTender(sTender.tid);
  806. await this._gatherDealBills(tender, function (gatherData, sourceData) {
  807. const prefix = 'ts_' + sKey + '_';
  808. gatherData[prefix + 'qty'] = sourceData.quantity;
  809. gatherData[prefix + 'tp'] = sourceData.total_price;
  810. });
  811. }
  812. async getGatherDealBills(memFieldKeys, gsDefine, gsCustom) {
  813. if (!gsDefine || !gsDefine.enable) return [];
  814. if (!gsCustom || !gsCustom.tenders || gsCustom.tenders.length === 0) return [];
  815. this.resultTenderInfo = [];
  816. const gsSetting = JSON.parse(gsDefine.setting);
  817. let commonIndex = 0;
  818. const completeDatas = [];
  819. for (const tender of gsCustom.tenders) {
  820. const specialKey = this._checkSpecialTender(tender, gsSetting.special);
  821. if (specialKey === '') {
  822. const completeData = {
  823. prefix: 't_' + commonIndex + '_',
  824. };
  825. completeDatas.push(completeData);
  826. await this._gatherCommonDealBills(tender, completeData);
  827. commonIndex++;
  828. } else {
  829. await this._gatherSpecialDealBills(tender, specialKey);
  830. }
  831. }
  832. gatherUtils.completeGatherData(this.resultDealBills, completeDatas);
  833. return this.resultDealBills;
  834. }
  835. }
  836. return RptGatherMemory;
  837. };