MaiXinRong hace 5 años
padre
commit
14b950eccc
Se han modificado 2 ficheros con 9 adiciones y 9 borrados
  1. 6 6
      app/service/revise_pos.js
  2. 3 3
      app/service/stage_pos.js

+ 6 - 6
app/service/revise_pos.js

@@ -122,7 +122,7 @@ module.exports = app => {
         async updatePos(tid, data) {
             if (data.sgfh_qty !== undefined || data.sjcl_qty !== undefined || data.qtcl_qty !== undefined) {
                 const op = await this.getDataById(data.id);
-                const bills = await this.ctx.service.ledger.getDataById(op.lid);
+                const bills = await this.ctx.service.reviseBills.getDataById(op.lid);
                 const billsPos = await this.getAllDataByCondition({where: {lid: op.lid} });
 
                 const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, bills.unit);
@@ -160,7 +160,7 @@ module.exports = app => {
                 const transaction = await this.db.beginTransaction();
                 try {
                     transaction.update(this.tableName, data);
-                    transaction.update(this.ctx.service.ledger.tableName, updateBills);
+                    transaction.update(this.ctx.service.reviseBills.tableName, updateBills);
                     await transaction.commit();
                     updateBills.ledger_id = bills.ledger_id;
                     return {
@@ -180,7 +180,7 @@ module.exports = app => {
         async updatePosArr(tid, data) {
             if (data.length === 0) return;
             const op = await this.getDataById(data[0].id);
-            const bills = await this.ctx.service.ledger.getDataById(op.lid);
+            const bills = await this.ctx.service.reviseBills.getDataById(op.lid);
             const billsPos = await this.getAllDataByCondition({where: {lid: op.lid} });
             const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, bills.unit);
             for (const d of data) {
@@ -223,7 +223,7 @@ module.exports = app => {
                 for (const d of data) {
                     transaction.update(this.tableName, d);
                 }
-                transaction.update(this.ctx.service.ledger.tableName, updateBills);
+                transaction.update(this.ctx.service.reviseBills.tableName, updateBills);
                 await transaction.commit();
                 updateBills.ledger_id = bills.ledger_id;
                 return {
@@ -242,7 +242,7 @@ module.exports = app => {
             }
 
             const pos = await this.getPosData({tid: tid, id: data});
-            const bills = await this.ctx.service.ledger.getDataById(pos[0].lid);
+            const bills = await this.ctx.service.reviseBills.getDataById(pos[0].lid);
             const billsPos = await this.getAllDataByCondition({ where: {lid: bills.id} });
             const updateBills = {id: bills.id};
             for (const bp of billsPos) {
@@ -261,7 +261,7 @@ module.exports = app => {
             const transaction = await this.db.beginTransaction();
             try {
                 await transaction.delete(this.tableName, {tid: tid, id: data});
-                await transaction.update(this.ctx.service.ledger.tableName, updateBills);
+                await transaction.update(this.ctx.service.reviseBills.tableName, updateBills);
                 await transaction.commit();
                 updateBills.ledger_id = bills.ledger_id;
                 return { ledger: { update: [updateBills] }, pos: data };

+ 3 - 3
app/service/stage_pos.js

@@ -199,7 +199,7 @@ module.exports = app => {
                     }
                 }
                 for (const lid of calcBills) {
-                    await this.ctx.service.reviseBills.calc(this.ctx.tender.id, lid, transaction);
+                    await this.ctx.service.ledger.calc(this.ctx.tender.id, lid, transaction);
                 }
                 for (const lid of calcStageBills) {
                     await this.ctx.service.stageBills.calc(ctx.tender.id, ctx.stage.id, lid, transaction);
@@ -298,7 +298,7 @@ module.exports = app => {
                     }
                 }
                 for (const lid of ledgerCalc) {
-                    await this.ctx.service.reviseBills.calc(this.ctx.tender.id, lid, transaction);
+                    await this.ctx.service.ledger.calc(this.ctx.tender.id, lid, transaction);
                 }
                 for (const lid of result.ledger) {
                     await this.ctx.service.stageBills.calc(this.ctx.tender.id, this.ctx.stage.id, lid, transaction);
@@ -338,7 +338,7 @@ module.exports = app => {
                 // 删除部位明细
                 await transaction.delete(this.ctx.service.pos.tableName, {tid: this.ctx.tender.id, id: data});
                 for (const lid of ledgerIds) {
-                    await this.ctx.service.reviseBills.calc(this.ctx.tender.id, lid, transaction);
+                    await this.ctx.service.ledger.calc(this.ctx.tender.id, lid, transaction);
                 }
                 // 删除部位明细计量数据
                 await transaction.delete(this.tableName, {tid: this.ctx.tender.id, lid: data});