tender_material.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. 'use strict';
  2. /**
  3. *
  4. *
  5. * @author Mai
  6. * @date
  7. * @version
  8. */
  9. const materialConst = require('../../const/material');
  10. const Ledger = require('../../lib/ledger');
  11. const billsFields = (function () {
  12. const cur = ['contract_qty', 'contract_tp', 'contract_expr', 'qc_qty', 'qc_tp', 'gather_qty', 'gather_tp', 'postil'];
  13. const pre = ['pre_contract_qty', 'pre_contract_tp', 'pre_qc_qty', 'pre_qc_tp', 'pre_gather_qty', 'pre_gather_tp'];
  14. const end = ['end_contract_qty', 'end_contract_tp', 'end_qc_qty', 'end_qc_tp', 'end_gather_qty', 'end_gather_tp'];
  15. const final = ['final_tp', 'final_ratio'];
  16. const stageDgn = ['deal_dgn_qty1', 'deal_dgn_qty2', 'c_dgn_qty1', 'c_dgn_qty2'];
  17. const stage = cur.concat(pre, end, final);
  18. const stageEnd = pre.concat(end, final);
  19. const bgl = ['qc_bgl_code'];
  20. const leafXmj = ['leaf_xmj_id'];
  21. return {cur, pre, end, final, stageDgn, stage, stageEnd, bgl, leafXmj};
  22. })();
  23. const posFields = (function () {
  24. const cur = ['contract_qty', 'qc_qty', 'gather_qty', 'postil'];
  25. const pre = ['pre_contract_qty', 'pre_qc_qty', 'pre_gather_qty'];
  26. const end = ['end_contract_qty', 'end_qc_qty', 'end_gather_qty'];
  27. const final = ['final_ratio'];
  28. const stage = cur.concat(pre, end, final);
  29. const stageEnd = pre.concat(end, final);
  30. const bgl = ['qc_bgl_code'];
  31. return {cur, pre, end, final, stage, stageEnd, bgl};
  32. })();
  33. class ReportMemoryMaterial {
  34. constructor(ctx) {
  35. this.ctx = ctx;
  36. }
  37. _getNewPos(updateFields) {
  38. const helper = this.ctx.helper;
  39. return new Ledger.pos({
  40. id: 'id', ledgerId: 'lid',
  41. updateFields: ['contract_qty', 'qc_qty', 'postil'],
  42. calc: function (p) {
  43. p.pre_gather_qty = helper.add(p.pre_contract_qty, p.pre_qc_qty);
  44. p.gather_qty = helper.add(p.contract_qty, p.qc_qty);
  45. p.gather_minus_qty = helper.add(p.gather_qty, p.qc_minus_qty);
  46. p.end_contract_qty = helper.add(p.pre_contract_qty, p.contract_qty);
  47. p.end_qc_qty = helper.add(p.pre_qc_qty, p.qc_qty);
  48. p.end_gather_qty = helper.add(p.pre_gather_qty, p.gather_qty);
  49. }
  50. });
  51. }
  52. _getNewBillsTree(calcFields) {
  53. return new Ledger.billsTree(this.ctx, {
  54. id: 'ledger_id',
  55. pid: 'ledger_pid',
  56. order: 'order',
  57. level: 'level',
  58. rootId: -1,
  59. keys: ['id', 'tender_id', 'ledger_id'],
  60. stageId: 'id',
  61. calcFields: calcFields || ['deal_tp', 'total_price', 'contract_tp', 'qc_tp', 'gather_tp', 'pre_contract_tp', 'pre_qc_tp', 'pre_gather_tp'],
  62. calc: function (node, helper) {
  63. if (node.children && node.children.length === 0) {
  64. node.pre_gather_qty = helper.add(node.pre_contract_qty, node.pre_qc_qty);
  65. node.gather_qty = helper.add(node.contract_qty, node.qc_qty);
  66. node.gather_minus_qty = helper.add(node.gather_qty, node.qc_minus_qty);
  67. node.end_contract_qty = helper.add(node.pre_contract_qty, node.contract_qty);
  68. node.end_qc_qty = helper.add(node.pre_qc_qty, node.qc_qty);
  69. node.end_gather_qty = helper.add(node.pre_gather_qty, node.gather_qty);
  70. }
  71. node.pre_gather_tp = helper.add(node.pre_contract_tp, node.pre_qc_tp);
  72. node.gather_tp = helper.add(node.contract_tp, node.qc_tp);
  73. node.end_contract_tp = helper.add(node.pre_contract_tp, node.contract_tp);
  74. node.end_qc_tp = helper.add(node.pre_qc_tp, node.qc_tp);
  75. node.end_gather_tp = helper.add(node.pre_gather_tp, node.gather_tp);
  76. node.final_tp = helper.add(node.total_price, node.end_qc_tp);
  77. node.final_ratio = helper.mul(helper.div(node.end_gather_tp, node.final_tp, 4), 100);
  78. }
  79. });
  80. }
  81. _checkFieldsExist(source, check) {
  82. for (const s of source) {
  83. if (check.indexOf(s) >= 0) {
  84. return true;
  85. }
  86. }
  87. return false;
  88. }
  89. async getSelectMaterialAuditors(tid, material_order, fields) {
  90. await this.ctx.service.material.checkMaterial(tid, material_order);
  91. const auditors = await this.ctx.service.materialAudit.getFinalAuditGroup(this.ctx.material.id, this.ctx.material.curTimes);
  92. const user = await this.ctx.service.projectAccount.getDataById(this.ctx.material.user_id);
  93. const result = [{
  94. aid: user.id,
  95. name: user.name,
  96. company: user.company,
  97. role: user.role,
  98. mobile: user.mobile,
  99. telephone: user.telephone,
  100. sign_path: user.sign_path,
  101. opinion: user.opinion,
  102. end_time: auditors && auditors.length > 0 ? auditors[0].begin_time : null,
  103. sort: 0,
  104. tp_data: this.ctx.material.tp_data,
  105. }, ...auditors];
  106. return result;
  107. }
  108. async getMaterial(tender_id, material_order, fields) {
  109. const result = await this.ctx.service.material.getValidMaterials(tender_id);
  110. if (this._checkFieldsExist(fields, ['checked_time'])) {
  111. for (const r of result) {
  112. const auditors = await this.ctx.service.materialAudit.getFinalAuditGroup(r.id, r.curTimes || r.times);
  113. r.checked_time = !r.curTimes ? auditors[auditors.length - 1].end_time : null;
  114. }
  115. }
  116. return result;
  117. }
  118. _completeMaterialGl(materialGl, decimal) {
  119. const tTypeStr = [], mTypeStr = [];
  120. for (const t of materialConst.t_type) {
  121. tTypeStr[t.value] = t.text;
  122. }
  123. for (const m of materialConst.m_type) {
  124. mTypeStr[m.value] = m.text;
  125. }
  126. for (const gl of materialGl) {
  127. gl.tp = this.ctx.helper.mul(gl.quantity, gl.m_spread, decimal.tp);
  128. gl.t_type_str = tTypeStr[gl.t_type];
  129. gl.m_type_str = mTypeStr[gl.m_type];
  130. gl.end_tp = this.ctx.helper.add(gl.tp, gl.pre_tp);
  131. }
  132. }
  133. async _loadMaterialMonth(material, gl) {
  134. const materialMonth = await this.ctx.service.materialMonth.getAllDataByCondition({
  135. where: { mid: material.id },
  136. orders: [['mb_id', 'asc'], ['yearmonth', 'asc']],
  137. });
  138. const month = this.ctx.helper._.uniq(materialMonth.map(x => { return x.yearmonth; }));
  139. let g;
  140. for (const mm of materialMonth) {
  141. if (!g || g.id !== mm.mb_id) g = gl.find(x => { return mm.mb_id === x.id; });
  142. if (!g.month_msg_tp) g.month_msg_tp = [];
  143. if (!g.month) g.month = month.concat([]);
  144. const index = month.indexOf(mm.yearmonth);
  145. if (index >= 0) g.month_msg_tp[index] = mm.msg_tp;
  146. }
  147. }
  148. async getMaterialGl(tender_id, material_order, fields) {
  149. const materials = await this.ctx.service.material.getAllDataByCondition({
  150. where: {tid: tender_id},
  151. orders: [['order', 'desc']],
  152. });
  153. if (materials.length === 0) return [];
  154. let result, material, decimal;
  155. if (materials[0].order === material_order) {
  156. material = materials[0];
  157. decimal = material.decimal ? JSON.parse(material.decimal) : { qty: 3, up: 3, tp: 2 };
  158. if (material.is_stage_self) {
  159. const sql = 'SELECT msb.id, msb.tid, msb.mid, msb.ms_id, ms.sid, ms.`order` as s_order, mb.order, mb.t_type, mb.code, mb.name, mb.unit, mb.spec, mb.m_type,' +
  160. ' msb.quantity, mb.expr,' +
  161. ' mb.basic_price, mb.basic_times, ' +
  162. ' msb.msg_tp, msb.msg_times, msb.msg_spread, mb.m_up_risk, mb.m_down_risk, msb.m_spread, msb.m_tp, mb.pre_tp, msb.m_tax_tp, mb.tax_pre_tp, mb.origin, ' +
  163. ' msb.remark, msb.is_summary, mb.m_tax, mb.in_time, mb.origin' +
  164. ` FROM ${this.ctx.service.materialStageBills.tableName} msb` +
  165. ` LEFT JOIN ${this.ctx.service.materialBills.tableName} mb ON msb.mb_id = mb.id` +
  166. ' LEFT JOIN ' + this.ctx.service.materialStage.tableName + ' ms ON msb.ms_id = ms.id ' +
  167. ` WHERE msb.mid = ?` +
  168. ' ORDER By msb.ms_id, mb.order';
  169. result = await this.ctx.app.mysql.query(sql, [material.id]);
  170. } else {
  171. result = await this.ctx.service.materialBills.getAllDataByCondition({
  172. where: {tid: tender_id}
  173. });
  174. }
  175. } else {
  176. material = this.ctx.helper._.find(materials, {order: material_order});
  177. if (!material) return [];
  178. decimal = material.decimal ? JSON.parse(material.decimal) : { tp: 2 };
  179. if (material.is_stage_self) {
  180. const sql = 'SELECT msb.id, msb.tid, msb.mid, msb.ms_id, ms.sid, ms.`order` as s_order, mb.order, mb.t_type, mb.code, mb.name, mb.unit, mb.spec, mb.m_type,' +
  181. ' msb.quantity, mbh.expr,' +
  182. ' mb.basic_price, mb.basic_times, ' +
  183. ' msb.msg_tp, msb.msg_times, msb.msg_spread, mbh.m_up_risk, mbh.m_down_risk, msb.m_spread, msb.m_tp, mbh.pre_tp, msb.m_tax_tp, mbh.tax_pre_tp, mbh.origin, ' +
  184. ' msb.remark, msb.is_summary, mbh.m_tax, mb.in_time, mbh.origin' +
  185. ` FROM ${this.ctx.service.materialStageBills.tableName} msb` +
  186. ' LEFT JOIN ' + this.ctx.service.materialBillsHistory.tableName + ' mbh ON msb.mb_id = mbh.mb_id AND msb.mid = mbh.mid' +
  187. ' LEFT JOIN ' + this.ctx.service.materialBills.tableName + ' mb ON msb.mb_id = mb.id ' +
  188. ' LEFT JOIN ' + this.ctx.service.materialStage.tableName + ' ms ON msb.ms_id = ms.id ' +
  189. ' WHERE msb.mid = ?'+
  190. ' ORDER By msb.ms_id, mb.order';
  191. result = await this.ctx.app.mysql.query(sql, [material.id]);
  192. } else {
  193. const sql = 'SELECT mb.id, mb.tid, mb.mid, mb.order, mb.t_type, mb.code, mb.name, mb.unit, mb.spec, mb.m_type,' +
  194. ' mbh.quantity, mbh.expr,' +
  195. ' mb.basic_price, mb.basic_times, ' +
  196. ' mbh.msg_tp, mbh.msg_times, mbh.msg_spread, mbh.m_up_risk, mbh.m_down_risk, mbh.m_spread, mbh.m_tp, mbh.pre_tp, mbh.m_tax_tp, mbh.tax_pre_tp, mbh.origin, ' +
  197. ' mb.remark, mb.is_summary, mbh.m_tax, mb.in_time, mbh.origin' +
  198. ' FROM ' + this.ctx.service.materialBillsHistory.tableName + ' mbh ' +
  199. ' LEFT JOIN ' + this.ctx.service.materialBills.tableName + ' mb ON mbh.mb_id = mb.id ' +
  200. ' WHERE mbh.tid = ? And mbh.mid = ?'+
  201. ' ORDER By mb.order';
  202. result = await this.ctx.app.mysql.query(sql, [tender_id, material.id]);
  203. }
  204. }
  205. this._completeMaterialGl(result, decimal);
  206. if (this._checkFieldsExist(fields, ['month_msg_tp', 'month'])) await this._loadMaterialMonth(material, result);
  207. return result;
  208. }
  209. async getMaterialGlDetail(tender_id, material_order, fields) {
  210. const material = await this.ctx.service.material.getDataByCondition({tid: tender_id, order: material_order});
  211. if (!material) return [];
  212. if (material.is_stage_self) {
  213. return await this.ctx.service.materialList.getMaterialStageData(tender_id, material.id);
  214. } else {
  215. return await this.ctx.service.materialList.getMaterialData(tender_id, material.id);
  216. }
  217. }
  218. async getMaterialBills(tender_id, material_order, fields, showLevel) {
  219. await this.ctx.service.tender.checkTender(tender_id);
  220. const material = await this.ctx.service.material.getDataByCondition({tid: tender_id, order: material_order});
  221. if (!material) return [];
  222. try {
  223. const billsData = await this.ctx.service.ledger.getData(tender_id);
  224. if (this._checkFieldsExist(fields, billsFields.stage)) {
  225. const curStage = await this.ctx.service.stageBills.getStagesData(tender_id, material.stage_id);
  226. this.ctx.helper.assignRelaData(billsData, [
  227. {data: curStage, fields: ['contract_qty', 'contract_tp', 'contract_expr', 'qc_qty', 'qc_tp', 'qc_minus_qty', 'postil'], prefix: '', relaId: 'lid'}
  228. ]);
  229. }
  230. const billsTree = this._getNewBillsTree();
  231. billsTree.loadDatas(billsData);
  232. billsTree.calculateAll();
  233. return showLevel ? billsTree.getDefaultDatasByLevel(this.ctx.tender.rpt_show_level) : billsTree.getDefaultDatas();
  234. } catch(err) {
  235. this.ctx.helper.log(err);
  236. return [];
  237. }
  238. }
  239. async getMaterialPos(tender_id, material_order, fields) {
  240. const material = await this.ctx.service.material.getDataByCondition({tid: tender_id, order: material_order});
  241. if (!material) return [];
  242. try {
  243. const posData = await this.ctx.service.pos.getAllDataByCondition({ where: {tid: tender_id }});
  244. if (this._checkFieldsExist(fields, posFields.stage)) {
  245. const curPosStage = await this.ctx.service.stagePos.getStagesData(tender_id, material.stage_id);
  246. this.ctx.helper.assignRelaData(posData, [
  247. {data: curPosStage, fields: ['contract_qty', 'qc_qty', 'qc_minus_qty', 'contract_expr', 'postil'], prefix: '', relaId: 'pid'}
  248. ]);
  249. }
  250. const pos = this._getNewPos();
  251. pos.loadDatas(posData);
  252. pos.calculateAll();
  253. return pos.getDatas();
  254. } catch (err) {
  255. this.ctx.helper.log(err);
  256. return [];
  257. }
  258. }
  259. getMaterialCalcQty(qtySource, info, is_join) {
  260. let qty = 0;
  261. switch(qtySource) {
  262. case materialConst.qty_source_value.gather_qty: qty = info.gather_qty; break;
  263. case materialConst.qty_source_value.contract_qty: qty = info.contract_qty; break;
  264. case materialConst.qty_source_value.gather_minus_qty: qty = info.gather_minus_qty; break;
  265. default: throw '未配置计量来源';
  266. }
  267. if (qtySource !== materialConst.qty_source_value.contract_qty && is_join === 2) {
  268. qty = info.contract_qty;
  269. }
  270. return qty;
  271. }
  272. async _getMaterialStageGatherBills(tender_id, stage_id, stage_order, stageSelf, stageIndex = 0) {
  273. const decimal = this.materialGatherBase.decimal;
  274. //const billsData = this.ctx.helper.clone(this.materialGatherBase.billsData);
  275. const billsData = this.materialGatherBase.billsData;
  276. billsData.forEach(x => {
  277. for (const prop of ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'qc_minus_qty']) {
  278. x[prop] = undefined;
  279. }
  280. });
  281. const curStageBills = await this.ctx.service.stageBills.getStagesData(tender_id, stage_id);
  282. this.ctx.helper.assignRelaData(billsData, [
  283. { data: curStageBills, fields: ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'qc_minus_qty'], prefix: '', relaId: 'lid' },
  284. ]);
  285. const billsTree = this._getNewBillsTree();
  286. billsTree.loadDatas(billsData);
  287. billsTree.calculateAll();
  288. //const posData = this.ctx.helper.clone(this.materialGatherBase.posData);
  289. const posData = this.materialGatherBase.posData;
  290. posData.forEach(x => {
  291. for (const prop of ['contract_qty', 'qc_qty', 'qc_minus_qty']) {
  292. x[prop] = undefined;
  293. }
  294. });
  295. const curStage = await this.ctx.service.stagePos.getStagesData(tender_id, stage_id);
  296. this.ctx.helper.assignRelaData(posData, [
  297. { data: curStage, fields: ['contract_qty', 'qc_qty', 'qc_minus_qty'], prefix: '', relaId: 'pid' },
  298. ]);
  299. const pos = this._getNewPos();
  300. pos.loadDatas(posData);
  301. pos.calculateAll();
  302. const gclGatherModel = require('../gcl_gather').gclGather;
  303. const gatherUtil = new gclGatherModel(this.ctx);
  304. gatherUtil.gatherObj(billsTree, pos);
  305. const materialGl = stageSelf
  306. ? this.materialGatherBase.materialGl.filter(x => { return x.sid === parseInt(stage_id); })
  307. : this.materialGatherBase.materialGl;
  308. if (stageIndex) materialGl.forEach(x => { x.s_index = stageIndex });
  309. const materialNotJoin = this.materialGatherBase.materialNotJoin;
  310. const materialNotChange = this.materialGatherBase.materialNotChange;
  311. const helper = this.ctx.helper;
  312. for (const g of gatherUtil.gclList) {
  313. if (!g.contract_qty && !g.qc_qty && !g.qc_minus_qty) continue;
  314. g.sid = stage_id;
  315. g.sorder = stage_order;
  316. g.s_index = stageIndex;
  317. g.jiacha = 0;
  318. g.jiacha_qty = 0;
  319. for (const x of g.leafXmjs) {
  320. x.sid = stage_id;
  321. x.sorder = stage_order;
  322. x.s_index = stageIndex;
  323. x.jiacha = 0;
  324. const mnj = materialNotJoin.find(m => {
  325. return m.gcl_id === x.org_gcl_id && m.xmj_id === x.id && (x.mx_id && x.mx_id !== x.id ? x.mx_id === m.mx_id : true);
  326. });
  327. x.is_join = !mnj;
  328. const mnc = materialNotChange.find(m => {
  329. return m.gcl_id === x.org_gcl_id && m.xmj_id === x.id && (x.mx_id && x.mx_id !== x.id ? x.mx_id === m.mx_id : true);
  330. });
  331. x.is_change = mnc ? 2 : 1;
  332. const list = materialGl.filter(gl => {
  333. return gl.gcl_id === x.org_gcl_id && gl.xmj_id === x.id && (x.mx_id && x.mx_id !== x.id ? x.mx_id === gl.mx_id : true);
  334. });
  335. list.forEach(l => { l.gather_gcl_id = x.gcl_id});
  336. if (mnj) continue;
  337. x.jiacha_qty = this.getMaterialCalcQty(this.materialGatherBase.qtySource, x, x.is_change);
  338. for (const l of list) {
  339. x.jiacha = helper.add(x.jiacha, helper.mul(helper.mul(x.jiacha_qty, l.quantity), l.m_spread));
  340. }
  341. x.jiacha = helper.round(x.jiacha, decimal.tp);
  342. g.jiacha = helper.add(g.jiacha, x.jiacha);
  343. g.jiacha_qty = helper.add(g.jiacha_qty, x.jiacha_qty);
  344. }
  345. }
  346. return [gatherUtil.gclList, gatherUtil.leafXmjs];
  347. }
  348. async getMaterialGatherBills(tender_id, material_order) {
  349. const materials = await this.ctx.service.material.getAllDataByCondition({
  350. where: { tid: tender_id },
  351. orders: [['order', 'desc']],
  352. });
  353. if (materials.length === 0) return {};
  354. const material = await this.ctx.service.material.getDataByCondition({ tid: tender_id, order: material_order });
  355. this.materialGatherBase = {};
  356. this.materialGatherBase.qtySource = material.qty_source;
  357. this.materialGatherBase.decimal = material.decimal ? JSON.parse(material.decimal) : materialConst.decimal;
  358. try {
  359. // 获取基础数据
  360. this.materialGatherBase.billsData = await this.ctx.service.ledger.getData(tender_id);
  361. this.materialGatherBase.posData = await this.ctx.service.pos.getPosData({ tid: tender_id });
  362. if (material.is_stage_self) {
  363. this.materialGatherBase.materialGl = material_order === materials[0].order
  364. ? await this.ctx.service.materialList.getMaterialStageData(tender_id, material.id)
  365. : await this.ctx.service.materialList.getPreMaterialStageData(tender_id, material.id);
  366. } else {
  367. this.materialGatherBase.materialGl = material_order === materials[0].order
  368. ? await this.ctx.service.materialList.getMaterialData(tender_id, material.id)
  369. : await this.ctx.service.materialList.getPreMaterialData(tender_id, material.id);
  370. }
  371. this.materialGatherBase.materialNotJoin = await this.ctx.service.materialListNotjoin.getAllDataByCondition({ where: { mid: material.id, type: 1 } });
  372. this.materialGatherBase.materialNotChange = await this.ctx.service.materialListNotjoin.getAllDataByCondition({ where: { mid: material.id, type: 2 } });
  373. const mem_material_gather_bills = [], mem_material_gather_xmj = [];
  374. if (material.is_stage_self) {
  375. const stageIds = material.stage_id.split(',');
  376. const stageOrders = material.s_order.split(',');
  377. for (const [i, sid] of stageIds.entries()) {
  378. const [gclList, leafXmjs] = await this._getMaterialStageGatherBills(tender_id, sid, stageOrders[i], true, i + 1);
  379. mem_material_gather_bills.push(...gclList);
  380. mem_material_gather_xmj.push(...leafXmjs);
  381. }
  382. } else {
  383. const [gclList, leafXmjs] = await this._getMaterialStageGatherBills(tender_id, material.stage_id, material.stage_order, false);
  384. mem_material_gather_bills.push(...gclList);
  385. mem_material_gather_xmj.push(...leafXmjs);
  386. }
  387. return {mem_material_gather_bills, mem_material_gather_xmj, mem_material_gather_gl: this.materialGatherBase.materialGl};
  388. } catch (err) {
  389. this.ctx.log(err);
  390. return {};
  391. }
  392. }
  393. async getMaterialStage(tender_id, material_order, fields) {
  394. const material = await this.ctx.service.material.getDataByCondition({tid: tender_id, order: material_order});
  395. if (!material) return [];
  396. if (material.is_stage_self) {
  397. return await this.ctx.service.materialStage.getAllDataByCondition({ where: { mid: material.id } });
  398. } else {
  399. return [{
  400. id: -1, tid: material.id, mid: material.id, sid: material.stage_id, order: material.stage_order,
  401. m_tp: material.m_tp, m_tax_tp: material.m_tax_tp,
  402. }];
  403. }
  404. }
  405. }
  406. module.exports = ReportMemoryMaterial;