|
|
@@ -190,7 +190,7 @@ module.exports = app => {
|
|
|
data.ex_qty1 = op.ex_qty1;
|
|
|
}
|
|
|
|
|
|
- const updateBills = {id: bills.id};
|
|
|
+ const updateBills = {id: bills.id, check_calc: 1};
|
|
|
for (const bp of billsPos) {
|
|
|
const calcData = bp.id === data.id ? data : bp;
|
|
|
updateBills.sgfh_qty = this.ctx.helper.add(updateBills.sgfh_qty, calcData.sgfh_qty);
|
|
|
@@ -227,7 +227,6 @@ module.exports = app => {
|
|
|
}
|
|
|
|
|
|
async updatePosArr(tid, data) {
|
|
|
- // console.log(data);
|
|
|
if (data.length === 0) return;
|
|
|
const op = await this.getDataById(data[0].id);
|
|
|
const bills = await this.ctx.service.reviseBills.getDataById(op.lid);
|
|
|
@@ -260,7 +259,7 @@ module.exports = app => {
|
|
|
needUpdateBills = true;
|
|
|
}
|
|
|
}
|
|
|
- const updateBills = {id: bills.id};
|
|
|
+ const updateBills = {id: bills.id, check_calc: 1};
|
|
|
if (needUpdateBills) {
|
|
|
for (const bp of billsPos) {
|
|
|
const newPos = data.find(function (x) { return x.id === bp.id });
|
|
|
@@ -285,7 +284,7 @@ module.exports = app => {
|
|
|
updateBills.sjcl_tp = this.ctx.helper.mul(updateBills.sjcl_qty, bills.unit_price, info.decimal.tp);
|
|
|
updateBills.qtcl_tp = this.ctx.helper.mul(updateBills.qtcl_qty, bills.unit_price, info.decimal.tp);
|
|
|
updateBills.total_price = this.ctx.helper.mul(updateBills.quantity, bills.unit_price, info.decimal.tp);
|
|
|
- updateBills.sgfh_tp = this.ctx.helper.mul(updateBills.ex_qty1, bills.unit_price, info.decimal.tp);
|
|
|
+ updateBills.ex_tp1 = this.ctx.helper.mul(updateBills.ex_qty1, bills.unit_price, info.decimal.tp);
|
|
|
}
|
|
|
|
|
|
const transaction = await this.db.beginTransaction();
|
|
|
@@ -314,7 +313,7 @@ module.exports = app => {
|
|
|
const pos = await this.getPosData({tid: tid, id: data});
|
|
|
const bills = await this.ctx.service.reviseBills.getDataById(pos[0].lid);
|
|
|
const billsPos = await this.getAllDataByCondition({ where: {tid: tid, lid: bills.id} });
|
|
|
- const updateBills = {id: bills.id, sgfh_qty: 0, sjcl_qty: 0, qtcl_qty: 0, quantity: 0, ex_qty1: 0};
|
|
|
+ const updateBills = {id: bills.id, sgfh_qty: 0, sjcl_qty: 0, qtcl_qty: 0, quantity: 0, ex_qty1: 0, check_calc: 1};
|
|
|
for (const bp of billsPos) {
|
|
|
if (data.indexOf(bp.id) >= 0) continue;
|
|
|
updateBills.sgfh_qty = this.ctx.helper.add(updateBills.sgfh_qty, bp.sgfh_qty);
|
|
|
@@ -361,7 +360,7 @@ module.exports = app => {
|
|
|
|
|
|
const bills = await this.ctx.service.reviseBills.getDataById(data[0].lid);
|
|
|
const precision = this.ctx.helper.findPrecision(this.ctx.tender.info.precision, bills.unit);
|
|
|
- const updateBills = {id: bills.id};
|
|
|
+ const updateBills = {id: bills.id, check_calc: 1};
|
|
|
const billsPos = await this.getAllDataByCondition({where: {tid: tid, lid: bills.id} });
|
|
|
let needUpdateBills;
|
|
|
for (const bp of billsPos) {
|