rpt_gather_memory.js 46 KB

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