|
@@ -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 };
|