|
@@ -584,7 +584,7 @@ module.exports = app => {
|
|
const info = this.ctx.tender.info;
|
|
const info = this.ctx.tender.info;
|
|
this.transaction = await this.db.beginTransaction();
|
|
this.transaction = await this.db.beginTransaction();
|
|
|
|
|
|
- const insertBillsData = [], insertPosData = [];
|
|
|
|
|
|
+ const insertBillsData = [], insertPosData = [], in_time = new Date();
|
|
const maxId = await this._getMaxLid(tenderId);
|
|
const maxId = await this._getMaxLid(tenderId);
|
|
const order = selectData.order;
|
|
const order = selectData.order;
|
|
for (let i = 0, iLen = data.length; i < iLen; i++) {
|
|
for (let i = 0, iLen = data.length; i < iLen; i++) {
|
|
@@ -606,20 +606,19 @@ module.exports = app => {
|
|
insertBillsData.push(qd);
|
|
insertBillsData.push(qd);
|
|
const precision = this.ctx.helper.findPrecision(info.precision, qd.unit);
|
|
const precision = this.ctx.helper.findPrecision(info.precision, qd.unit);
|
|
if (data[i].pos.length > 0) {
|
|
if (data[i].pos.length > 0) {
|
|
- for (const [i, p] of data[i].pos.entries()) {
|
|
|
|
|
|
+ for (const [j, p] of data[i].pos.entries()) {
|
|
const inD = {
|
|
const inD = {
|
|
- id: this.uuid.v4(), tid: tid, lid: bills.id,
|
|
|
|
|
|
+ id: this.uuid.v4(), tid: tenderId, lid: qd.id,
|
|
add_stage: 0, add_times: 0, add_user: this.ctx.session.sessionUser.accountId,
|
|
add_stage: 0, add_times: 0, add_user: this.ctx.session.sessionUser.accountId,
|
|
- in_time, porder: i + 1,
|
|
|
|
|
|
+ in_time, porder: j + 1,
|
|
name: p.name, drawing_code: p.drawing_code,
|
|
name: p.name, drawing_code: p.drawing_code,
|
|
};
|
|
};
|
|
- if (d.quantity) {
|
|
|
|
|
|
+ if (p.quantity) {
|
|
inD.sgfh_qty = this.round(p.quantity, precision.value);
|
|
inD.sgfh_qty = this.round(p.quantity, precision.value);
|
|
inD.quantity = inD.sgfh_qty;
|
|
inD.quantity = inD.sgfh_qty;
|
|
qd.sgfh_qty = this.ctx.helper.add(qd.sgfh_qty, inD.sgfh_qty);
|
|
qd.sgfh_qty = this.ctx.helper.add(qd.sgfh_qty, inD.sgfh_qty);
|
|
}
|
|
}
|
|
insertPosData.push(inD);
|
|
insertPosData.push(inD);
|
|
- await transaction.insert(this.tableName, insertDatas);
|
|
|
|
}
|
|
}
|
|
qd.sgfh_tp = this.ctx.helper.mul(qd.sgfh_qty, qd.unit_price, info.decimal.tp);
|
|
qd.sgfh_tp = this.ctx.helper.mul(qd.sgfh_qty, qd.unit_price, info.decimal.tp);
|
|
qd.quantity = qd.sgfh_qty;
|
|
qd.quantity = qd.sgfh_qty;
|