Browse Source

修复bug

ellisran 2 months ago
parent
commit
ebeb39cb7e
1 changed files with 2 additions and 2 deletions
  1. 2 2
      app/service/material_list.js

+ 2 - 2
app/service/material_list.js

@@ -897,11 +897,11 @@ module.exports = app => {
                 // 新增或删除list_gcl表
                 await this.ctx.service.materialListGcl.insertOrDelGcl(transaction, data.insertGclList, data.removeGclList, material.id);
                 // 修改本期应耗数量值和有效价差,需要剔除不参与调差的清单数据,并返回总金额
-                const materials = await this.getAllDataByCondition({
+                const materials = await this.ctx.service.material.getAllDataByCondition({
                     where: { tid: this.ctx.tender.id },
                     order: ['order'],
                 });
-                const preMaterial = materials[materials.length - 1];
+                const preMaterial = materials[materials.length - 2];
                 if (material.is_stage_self) {
                     await this.ctx.service.materialStageBills.insertMsBills(transaction, this.ctx.tender.id, material.id, this._.find(materialStages, { sid: parseInt(data.stage_id) }), JSON.parse(material.decimal), preMaterial.is_stage_self, material.qty_source, material.rate);
                     await transaction.update(this.ctx.service.material.tableName, {