|
@@ -8,8 +8,12 @@
|
|
* @version
|
|
* @version
|
|
*/
|
|
*/
|
|
|
|
|
|
-const materialConst = require('../../const/material');
|
|
|
|
|
|
+const RptMemBase = require('./base');
|
|
|
|
+const bindData = {
|
|
|
|
+ materialGather: ['mem_material_gather_bills', 'mem_material_gather_xmj', 'mem_material_gather_gl'],
|
|
|
|
+};
|
|
|
|
|
|
|
|
+const materialConst = require('../../const/material');
|
|
const Ledger = require('../../lib/ledger');
|
|
const Ledger = require('../../lib/ledger');
|
|
|
|
|
|
const billsFields = (function () {
|
|
const billsFields = (function () {
|
|
@@ -39,9 +43,26 @@ const posFields = (function () {
|
|
return {cur, pre, end, final, stage, stageEnd, bgl};
|
|
return {cur, pre, end, final, stage, stageEnd, bgl};
|
|
})();
|
|
})();
|
|
|
|
|
|
-class ReportMemoryMaterial {
|
|
|
|
|
|
+class rptMemChange extends RptMemBase {
|
|
constructor(ctx) {
|
|
constructor(ctx) {
|
|
- this.ctx = ctx;
|
|
|
|
|
|
+ super(ctx, bindData);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ async doCheckMaterial(materialId) {
|
|
|
|
+ if (this.ctx.material) return;
|
|
|
|
+ this.ctx.material = await this.ctx.service.material.getDataByCondition({ id: materialId });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ async doCheckTender(tenderId) {
|
|
|
|
+ if (this.ctx.tender) return;
|
|
|
|
+ this.ctx.tender = { id: tenderId };
|
|
|
|
+ this.ctx.tender.data = await this.ctx.service.tender.getTender(tenderId);
|
|
|
|
+ this.ctx.tender.info = await this.ctx.service.tenderInfo.getTenderInfo(tenderId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ async doBeforeLoadReport(params) {
|
|
|
|
+ await this.doCheckMaterial(params.material_id);
|
|
|
|
+ await this.doCheckTender(this.ctx.material.tid);
|
|
}
|
|
}
|
|
|
|
|
|
_getNewPos(updateFields) {
|
|
_getNewPos(updateFields) {
|
|
@@ -59,7 +80,6 @@ class ReportMemoryMaterial {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
-
|
|
|
|
_getNewBillsTree(calcFields) {
|
|
_getNewBillsTree(calcFields) {
|
|
return new Ledger.billsTree(this.ctx, {
|
|
return new Ledger.billsTree(this.ctx, {
|
|
id: 'ledger_id',
|
|
id: 'ledger_id',
|
|
@@ -91,17 +111,7 @@ class ReportMemoryMaterial {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
- _checkFieldsExist(source, check) {
|
|
|
|
- for (const s of source) {
|
|
|
|
- if (check.indexOf(s) >= 0) {
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- async getSelectMaterialAuditors(tid, material_order, fields) {
|
|
|
|
- await this.ctx.service.material.checkMaterial(tid, material_order);
|
|
|
|
|
|
+ async getMaterialAuditors() {
|
|
const auditors = await this.ctx.service.materialAudit.getFinalAuditGroup(this.ctx.material.id, this.ctx.material.curTimes);
|
|
const auditors = await this.ctx.service.materialAudit.getFinalAuditGroup(this.ctx.material.id, this.ctx.material.curTimes);
|
|
const user = await this.ctx.service.projectAccount.getDataById(this.ctx.material.user_id);
|
|
const user = await this.ctx.service.projectAccount.getDataById(this.ctx.material.user_id);
|
|
const result = [{
|
|
const result = [{
|
|
@@ -120,17 +130,22 @@ class ReportMemoryMaterial {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- async getMaterial(tender_id, material_order, fields) {
|
|
|
|
- const result = await this.ctx.service.material.getValidMaterials(tender_id);
|
|
|
|
- if (this._checkFieldsExist(fields, ['checked_time'])) {
|
|
|
|
- for (const r of result) {
|
|
|
|
- const auditors = await this.ctx.service.materialAudit.getFinalAuditGroup(r.id, r.curTimes || r.times);
|
|
|
|
- r.checked_time = !r.curTimes ? auditors[auditors.length - 1].end_time : null;
|
|
|
|
- }
|
|
|
|
|
|
+ async _loadMaterialMonth(material, gl) {
|
|
|
|
+ const materialMonth = await this.ctx.service.materialMonth.getAllDataByCondition({
|
|
|
|
+ where: { mid: material.id },
|
|
|
|
+ orders: [['mb_id', 'asc'], ['yearmonth', 'asc']],
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ const month = this.ctx.helper._.uniq(materialMonth.map(x => { return x.yearmonth; }));
|
|
|
|
+ let g;
|
|
|
|
+ for (const mm of materialMonth) {
|
|
|
|
+ if (!g || g.id !== mm.mb_id) g = gl.find(x => { return mm.mb_id === x.id; });
|
|
|
|
+ if (!g.month_msg_tp) g.month_msg_tp = [];
|
|
|
|
+ if (!g.month) g.month = month.concat([]);
|
|
|
|
+ const index = month.indexOf(mm.yearmonth);
|
|
|
|
+ if (index >= 0) g.month_msg_tp[index] = mm.msg_tp;
|
|
}
|
|
}
|
|
- return result;
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
_completeMaterialGl(materialGl, decimal) {
|
|
_completeMaterialGl(materialGl, decimal) {
|
|
const tTypeStr = [], mTypeStr = [];
|
|
const tTypeStr = [], mTypeStr = [];
|
|
for (const t of materialConst.t_type) {
|
|
for (const t of materialConst.t_type) {
|
|
@@ -146,34 +161,18 @@ class ReportMemoryMaterial {
|
|
gl.end_tp = this.ctx.helper.add(gl.tp, gl.pre_tp);
|
|
gl.end_tp = this.ctx.helper.add(gl.tp, gl.pre_tp);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ async getMaterialGl(fields) {
|
|
|
|
+ if (!this.ctx.material) return [];
|
|
|
|
|
|
- async _loadMaterialMonth(material, gl) {
|
|
|
|
- const materialMonth = await this.ctx.service.materialMonth.getAllDataByCondition({
|
|
|
|
- where: { mid: material.id },
|
|
|
|
- orders: [['mb_id', 'asc'], ['yearmonth', 'asc']],
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- const month = this.ctx.helper._.uniq(materialMonth.map(x => { return x.yearmonth; }));
|
|
|
|
- let g;
|
|
|
|
- for (const mm of materialMonth) {
|
|
|
|
- if (!g || g.id !== mm.mb_id) g = gl.find(x => { return mm.mb_id === x.id; });
|
|
|
|
- if (!g.month_msg_tp) g.month_msg_tp = [];
|
|
|
|
- if (!g.month) g.month = month.concat([]);
|
|
|
|
- const index = month.indexOf(mm.yearmonth);
|
|
|
|
- if (index >= 0) g.month_msg_tp[index] = mm.msg_tp;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- async getMaterialGl(tender_id, material_order, fields) {
|
|
|
|
const materials = await this.ctx.service.material.getAllDataByCondition({
|
|
const materials = await this.ctx.service.material.getAllDataByCondition({
|
|
- where: {tid: tender_id},
|
|
|
|
|
|
+ where: {tid: this.ctx.material.tid},
|
|
orders: [['order', 'desc']],
|
|
orders: [['order', 'desc']],
|
|
});
|
|
});
|
|
if (materials.length === 0) return [];
|
|
if (materials.length === 0) return [];
|
|
|
|
|
|
let result, material, decimal;
|
|
let result, material, decimal;
|
|
- if (materials[0].order === material_order) {
|
|
|
|
- material = materials[0];
|
|
|
|
|
|
+ material = this.ctx.material;
|
|
|
|
+ if (materials[0].order === material.order) {
|
|
decimal = material.decimal ? JSON.parse(material.decimal) : { qty: 3, up: 3, tp: 2 };
|
|
decimal = material.decimal ? JSON.parse(material.decimal) : { qty: 3, up: 3, tp: 2 };
|
|
if (material.is_stage_self) {
|
|
if (material.is_stage_self) {
|
|
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,' +
|
|
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,' +
|
|
@@ -189,13 +188,10 @@ class ReportMemoryMaterial {
|
|
result = await this.ctx.app.mysql.query(sql, [material.id]);
|
|
result = await this.ctx.app.mysql.query(sql, [material.id]);
|
|
} else {
|
|
} else {
|
|
result = await this.ctx.service.materialBills.getAllDataByCondition({
|
|
result = await this.ctx.service.materialBills.getAllDataByCondition({
|
|
- where: {tid: tender_id}
|
|
|
|
|
|
+ where: {tid: material.tid}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- material = this.ctx.helper._.find(materials, {order: material_order});
|
|
|
|
- if (!material) return [];
|
|
|
|
-
|
|
|
|
decimal = material.decimal ? JSON.parse(material.decimal) : { tp: 2 };
|
|
decimal = material.decimal ? JSON.parse(material.decimal) : { tp: 2 };
|
|
if (material.is_stage_self) {
|
|
if (material.is_stage_self) {
|
|
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,' +
|
|
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,' +
|
|
@@ -220,7 +216,7 @@ class ReportMemoryMaterial {
|
|
' LEFT JOIN ' + this.ctx.service.materialBills.tableName + ' mb ON mbh.mb_id = mb.id ' +
|
|
' LEFT JOIN ' + this.ctx.service.materialBills.tableName + ' mb ON mbh.mb_id = mb.id ' +
|
|
' WHERE mbh.tid = ? And mbh.mid = ?'+
|
|
' WHERE mbh.tid = ? And mbh.mid = ?'+
|
|
' ORDER By mb.order';
|
|
' ORDER By mb.order';
|
|
- result = await this.ctx.app.mysql.query(sql, [tender_id, material.id]);
|
|
|
|
|
|
+ result = await this.ctx.app.mysql.query(sql, [material.tid, material.id]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this._completeMaterialGl(result, decimal);
|
|
this._completeMaterialGl(result, decimal);
|
|
@@ -229,26 +225,25 @@ class ReportMemoryMaterial {
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
- async getMaterialGlDetail(tender_id, material_order, fields) {
|
|
|
|
- const material = await this.ctx.service.material.getDataByCondition({tid: tender_id, order: material_order});
|
|
|
|
|
|
+ async getMaterialGlDetail(fields) {
|
|
|
|
+ const material = this.ctx.material;
|
|
if (!material) return [];
|
|
if (!material) return [];
|
|
|
|
|
|
if (material.is_stage_self) {
|
|
if (material.is_stage_self) {
|
|
- return await this.ctx.service.materialList.getMaterialStageData(tender_id, material.id);
|
|
|
|
|
|
+ return await this.ctx.service.materialList.getMaterialStageData(material.tid, material.id);
|
|
} else {
|
|
} else {
|
|
- return await this.ctx.service.materialList.getMaterialData(tender_id, material.id);
|
|
|
|
|
|
+ return await this.ctx.service.materialList.getMaterialData(material.tid, material.id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- async getMaterialBills(tender_id, material_order, fields, showLevel) {
|
|
|
|
- await this.ctx.service.tender.checkTender(tender_id);
|
|
|
|
- const material = await this.ctx.service.material.getDataByCondition({tid: tender_id, order: material_order});
|
|
|
|
|
|
+ async getMaterialBills(fields, showLevel) {
|
|
|
|
+ const material = this.ctx.material;
|
|
if (!material) return [];
|
|
if (!material) return [];
|
|
|
|
|
|
try {
|
|
try {
|
|
- const billsData = await this.ctx.service.ledger.getData(tender_id);
|
|
|
|
|
|
+ const billsData = await this.ctx.service.ledger.getData(material.tid);
|
|
if (this._checkFieldsExist(fields, billsFields.stage)) {
|
|
if (this._checkFieldsExist(fields, billsFields.stage)) {
|
|
- const curStage = await this.ctx.service.stageBills.getStagesData(tender_id, material.stage_id);
|
|
|
|
|
|
+ const curStage = await this.ctx.service.stageBills.getStagesData(material.tid, material.stage_id);
|
|
this.ctx.helper.assignRelaData(billsData, [
|
|
this.ctx.helper.assignRelaData(billsData, [
|
|
{data: curStage, fields: ['contract_qty', 'contract_tp', 'contract_expr', 'qc_qty', 'qc_tp', 'qc_minus_qty', 'postil'], prefix: '', relaId: 'lid'}
|
|
{data: curStage, fields: ['contract_qty', 'contract_tp', 'contract_expr', 'qc_qty', 'qc_tp', 'qc_minus_qty', 'postil'], prefix: '', relaId: 'lid'}
|
|
]);
|
|
]);
|
|
@@ -265,14 +260,14 @@ class ReportMemoryMaterial {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- async getMaterialPos(tender_id, material_order, fields) {
|
|
|
|
- const material = await this.ctx.service.material.getDataByCondition({tid: tender_id, order: material_order});
|
|
|
|
|
|
+ async getMaterialPos(fields) {
|
|
|
|
+ const material = this.ctx.material;
|
|
if (!material) return [];
|
|
if (!material) return [];
|
|
|
|
|
|
try {
|
|
try {
|
|
- const posData = await this.ctx.service.pos.getAllDataByCondition({ where: {tid: tender_id }});
|
|
|
|
|
|
+ const posData = await this.ctx.service.pos.getAllDataByCondition({ where: {tid: material.tid }});
|
|
if (this._checkFieldsExist(fields, posFields.stage)) {
|
|
if (this._checkFieldsExist(fields, posFields.stage)) {
|
|
- const curPosStage = await this.ctx.service.stagePos.getStagesData(tender_id, material.stage_id);
|
|
|
|
|
|
+ const curPosStage = await this.ctx.service.stagePos.getStagesData(material.tid, material.stage_id);
|
|
this.ctx.helper.assignRelaData(posData, [
|
|
this.ctx.helper.assignRelaData(posData, [
|
|
{data: curPosStage, fields: ['contract_qty', 'qc_qty', 'qc_minus_qty', 'contract_expr', 'postil'], prefix: '', relaId: 'pid'}
|
|
{data: curPosStage, fields: ['contract_qty', 'qc_qty', 'qc_minus_qty', 'contract_expr', 'postil'], prefix: '', relaId: 'pid'}
|
|
]);
|
|
]);
|
|
@@ -288,23 +283,51 @@ class ReportMemoryMaterial {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- getMaterialCalcQty(qtySource, info, is_join) {
|
|
|
|
- let qty = 0;
|
|
|
|
- switch(qtySource) {
|
|
|
|
- case materialConst.qty_source_value.gather_qty: qty = info.gather_qty; break;
|
|
|
|
- case materialConst.qty_source_value.contract_qty: qty = info.contract_qty; break;
|
|
|
|
- case materialConst.qty_source_value.gather_minus_qty: qty = info.gather_minus_qty; break;
|
|
|
|
- default: throw '未配置计量来源';
|
|
|
|
|
|
+ async getMaterialStage(fields) {
|
|
|
|
+ const material = this.ctx.material;
|
|
|
|
+ if (!material) return [];
|
|
|
|
+
|
|
|
|
+ if (material.is_stage_self) {
|
|
|
|
+ return await this.ctx.service.materialStage.getAllDataByCondition({ where: { mid: material.id } });
|
|
|
|
+ } else {
|
|
|
|
+ return [{
|
|
|
|
+ id: -1, tid: material.id, mid: material.id, sid: material.stage_id, order: material.stage_order,
|
|
|
|
+ m_tp: material.m_tp, m_tax_tp: material.m_tax_tp,
|
|
|
|
+ }];
|
|
}
|
|
}
|
|
- if (qtySource !== materialConst.qty_source_value.contract_qty && is_join === 2) {
|
|
|
|
- qty = info.contract_qty;
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ getCommonData(params, tableName, fields, customDefine, customSelect) {
|
|
|
|
+ switch (tableName) {
|
|
|
|
+ case 'mem_project':
|
|
|
|
+ return this.ctx.service.project.getDataByCondition({ id: this.ctx.session.sessionProject.id });
|
|
|
|
+ case 'mem_tender':
|
|
|
|
+ return [this.ctx.tender.data];
|
|
|
|
+ case 'mem_tender_info':
|
|
|
|
+ return [this.ctx.tender.info];
|
|
|
|
+ case 'mem_material':
|
|
|
|
+ return [this.ctx.material];
|
|
|
|
+ case 'mem_material_audit':
|
|
|
|
+ return this.getMaterialAuditors();
|
|
|
|
+ case 'mem_material_gl':
|
|
|
|
+ return this.getMaterialGl(fields);
|
|
|
|
+ case 'mem_material_gl_detail':
|
|
|
|
+ return this.getMaterialGlDetail(fields);
|
|
|
|
+ case 'mem_material_bills':
|
|
|
|
+ return this.getMaterialBills(fields);
|
|
|
|
+ case 'mem_material_bills_filter':
|
|
|
|
+ return this.getMaterialBills(fields, true);
|
|
|
|
+ case 'mem_material_pos':
|
|
|
|
+ return this.getMaterialPos(fields);
|
|
|
|
+ case 'mem_material_stage':
|
|
|
|
+ return this.getMaterialStage(fields);
|
|
|
|
+ default:
|
|
|
|
+ return [];
|
|
}
|
|
}
|
|
- return qty;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
async _getMaterialStageGatherBills(tender_id, stage_id, stage_order, stageSelf, stageIndex = 0) {
|
|
async _getMaterialStageGatherBills(tender_id, stage_id, stage_order, stageSelf, stageIndex = 0) {
|
|
const decimal = this.materialGatherBase.decimal;
|
|
const decimal = this.materialGatherBase.decimal;
|
|
- //const billsData = this.ctx.helper.clone(this.materialGatherBase.billsData);
|
|
|
|
const billsData = this.materialGatherBase.billsData;
|
|
const billsData = this.materialGatherBase.billsData;
|
|
billsData.forEach(x => {
|
|
billsData.forEach(x => {
|
|
for (const prop of ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'qc_minus_qty']) {
|
|
for (const prop of ['contract_qty', 'contract_tp', 'qc_qty', 'qc_tp', 'qc_minus_qty']) {
|
|
@@ -319,7 +342,6 @@ class ReportMemoryMaterial {
|
|
billsTree.loadDatas(billsData);
|
|
billsTree.loadDatas(billsData);
|
|
billsTree.calculateAll();
|
|
billsTree.calculateAll();
|
|
|
|
|
|
- //const posData = this.ctx.helper.clone(this.materialGatherBase.posData);
|
|
|
|
const posData = this.materialGatherBase.posData;
|
|
const posData = this.materialGatherBase.posData;
|
|
posData.forEach(x => {
|
|
posData.forEach(x => {
|
|
for (const prop of ['contract_qty', 'qc_qty', 'qc_minus_qty']) {
|
|
for (const prop of ['contract_qty', 'qc_qty', 'qc_minus_qty']) {
|
|
@@ -385,29 +407,31 @@ class ReportMemoryMaterial {
|
|
return [gatherUtil.gclList, gatherUtil.leafXmjs];
|
|
return [gatherUtil.gclList, gatherUtil.leafXmjs];
|
|
}
|
|
}
|
|
|
|
|
|
- async getMaterialGatherBills(tender_id, material_order) {
|
|
|
|
|
|
+ async getMaterialGatherBills() {
|
|
|
|
+ const material = this.ctx.material;
|
|
|
|
+ if (!material) return {};
|
|
|
|
+
|
|
const materials = await this.ctx.service.material.getAllDataByCondition({
|
|
const materials = await this.ctx.service.material.getAllDataByCondition({
|
|
- where: { tid: tender_id },
|
|
|
|
|
|
+ where: { tid: material.tid },
|
|
orders: [['order', 'desc']],
|
|
orders: [['order', 'desc']],
|
|
});
|
|
});
|
|
if (materials.length === 0) return {};
|
|
if (materials.length === 0) return {};
|
|
|
|
|
|
- const material = await this.ctx.service.material.getDataByCondition({ tid: tender_id, order: material_order });
|
|
|
|
this.materialGatherBase = {};
|
|
this.materialGatherBase = {};
|
|
this.materialGatherBase.qtySource = material.qty_source;
|
|
this.materialGatherBase.qtySource = material.qty_source;
|
|
this.materialGatherBase.decimal = material.decimal ? JSON.parse(material.decimal) : materialConst.decimal;
|
|
this.materialGatherBase.decimal = material.decimal ? JSON.parse(material.decimal) : materialConst.decimal;
|
|
try {
|
|
try {
|
|
// 获取基础数据
|
|
// 获取基础数据
|
|
- this.materialGatherBase.billsData = await this.ctx.service.ledger.getData(tender_id);
|
|
|
|
- this.materialGatherBase.posData = await this.ctx.service.pos.getPosData({ tid: tender_id });
|
|
|
|
|
|
+ this.materialGatherBase.billsData = await this.ctx.service.ledger.getData(material.tid);
|
|
|
|
+ this.materialGatherBase.posData = await this.ctx.service.pos.getPosData({ tid: material.tid });
|
|
if (material.is_stage_self) {
|
|
if (material.is_stage_self) {
|
|
- this.materialGatherBase.materialGl = material_order === materials[0].order
|
|
|
|
- ? await this.ctx.service.materialList.getMaterialStageData(tender_id, material.id)
|
|
|
|
- : await this.ctx.service.materialList.getPreMaterialStageData(tender_id, material.id);
|
|
|
|
|
|
+ this.materialGatherBase.materialGl = material.order === materials[0].order
|
|
|
|
+ ? await this.ctx.service.materialList.getMaterialStageData(material.tid, material.id)
|
|
|
|
+ : await this.ctx.service.materialList.getPreMaterialStageData(material.tid, material.id);
|
|
} else {
|
|
} else {
|
|
- this.materialGatherBase.materialGl = material_order === materials[0].order
|
|
|
|
- ? await this.ctx.service.materialList.getMaterialData(tender_id, material.id)
|
|
|
|
- : await this.ctx.service.materialList.getPreMaterialData(tender_id, material.id);
|
|
|
|
|
|
+ this.materialGatherBase.materialGl = material.order === materials[0].order
|
|
|
|
+ ? await this.ctx.service.materialList.getMaterialData(material.tid, material.id)
|
|
|
|
+ : await this.ctx.service.materialList.getPreMaterialData(material.tid, material.id);
|
|
}
|
|
}
|
|
this.materialGatherBase.materialNotJoin = await this.ctx.service.materialListNotjoin.getAllDataByCondition({ where: { mid: material.id, type: 1 } });
|
|
this.materialGatherBase.materialNotJoin = await this.ctx.service.materialListNotjoin.getAllDataByCondition({ where: { mid: material.id, type: 1 } });
|
|
this.materialGatherBase.materialNotChange = await this.ctx.service.materialListNotjoin.getAllDataByCondition({ where: { mid: material.id, type: 2 } });
|
|
this.materialGatherBase.materialNotChange = await this.ctx.service.materialListNotjoin.getAllDataByCondition({ where: { mid: material.id, type: 2 } });
|
|
@@ -417,12 +441,12 @@ class ReportMemoryMaterial {
|
|
const stageIds = material.stage_id.split(',');
|
|
const stageIds = material.stage_id.split(',');
|
|
const stageOrders = material.s_order.split(',');
|
|
const stageOrders = material.s_order.split(',');
|
|
for (const [i, sid] of stageIds.entries()) {
|
|
for (const [i, sid] of stageIds.entries()) {
|
|
- const [gclList, leafXmjs] = await this._getMaterialStageGatherBills(tender_id, sid, stageOrders[i], true, i + 1);
|
|
|
|
|
|
+ const [gclList, leafXmjs] = await this._getMaterialStageGatherBills(material.tid, sid, stageOrders[i], true, i + 1);
|
|
mem_material_gather_bills.push(...gclList);
|
|
mem_material_gather_bills.push(...gclList);
|
|
mem_material_gather_xmj.push(...leafXmjs);
|
|
mem_material_gather_xmj.push(...leafXmjs);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- const [gclList, leafXmjs] = await this._getMaterialStageGatherBills(tender_id, material.stage_id, material.stage_order, false);
|
|
|
|
|
|
+ const [gclList, leafXmjs] = await this._getMaterialStageGatherBills(material.tid, material.stage_id, material.stage_order, false);
|
|
mem_material_gather_bills.push(...gclList);
|
|
mem_material_gather_bills.push(...gclList);
|
|
mem_material_gather_xmj.push(...leafXmjs);
|
|
mem_material_gather_xmj.push(...leafXmjs);
|
|
}
|
|
}
|
|
@@ -433,19 +457,14 @@ class ReportMemoryMaterial {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- async getMaterialStage(tender_id, material_order, fields) {
|
|
|
|
- const material = await this.ctx.service.material.getDataByCondition({tid: tender_id, order: material_order});
|
|
|
|
- if (!material) return [];
|
|
|
|
-
|
|
|
|
- if (material.is_stage_self) {
|
|
|
|
- return await this.ctx.service.materialStage.getAllDataByCondition({ where: { mid: material.id } });
|
|
|
|
- } else {
|
|
|
|
- return [{
|
|
|
|
- id: -1, tid: material.id, mid: material.id, sid: material.stage_id, order: material.stage_order,
|
|
|
|
- m_tp: material.m_tp, m_tax_tp: material.m_tax_tp,
|
|
|
|
- }];
|
|
|
|
|
|
+ async getBindData(params, key, fields, customDefine, customSelect) {
|
|
|
|
+ switch (key) {
|
|
|
|
+ case 'materialGather':
|
|
|
|
+ return await this.getMaterialGatherBills();
|
|
|
|
+ default:
|
|
|
|
+ return {};
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-module.exports = ReportMemoryMaterial;
|
|
|
|
|
|
+module.exports = rptMemChange;
|